mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-22 12:03:09 -04:00
Fixed detekt errors
This commit is contained in:
parent
b2c1c1ed5d
commit
7c23207225
@ -40,7 +40,9 @@ class LibkiwixBookmarks @Inject constructor(
|
|||||||
) : PageDao {
|
) : PageDao {
|
||||||
|
|
||||||
private val bookmarksFolderPath: String by lazy {
|
private val bookmarksFolderPath: String by lazy {
|
||||||
sharedPreferenceUtil.getPublicDirectoryPath(sharedPreferenceUtil.defaultStorage()) + "/kiwix/Bookmarks/"
|
sharedPreferenceUtil.getPublicDirectoryPath(
|
||||||
|
sharedPreferenceUtil.defaultStorage()
|
||||||
|
) + "/kiwix/Bookmarks/"
|
||||||
}
|
}
|
||||||
|
|
||||||
private val bookmarkFile: File by lazy {
|
private val bookmarkFile: File by lazy {
|
||||||
|
@ -20,7 +20,6 @@ package org.kiwix.kiwixmobile.core.data
|
|||||||
import io.reactivex.Completable
|
import io.reactivex.Completable
|
||||||
import io.reactivex.Flowable
|
import io.reactivex.Flowable
|
||||||
import io.reactivex.Single
|
import io.reactivex.Single
|
||||||
import org.kiwix.kiwixmobile.core.page.bookmark.adapter.BookmarkItem
|
|
||||||
import org.kiwix.kiwixmobile.core.page.bookmark.adapter.LibkiwixBookmarkItem
|
import org.kiwix.kiwixmobile.core.page.bookmark.adapter.LibkiwixBookmarkItem
|
||||||
import org.kiwix.kiwixmobile.core.page.history.adapter.HistoryListItem
|
import org.kiwix.kiwixmobile.core.page.history.adapter.HistoryListItem
|
||||||
import org.kiwix.kiwixmobile.core.page.history.adapter.HistoryListItem.HistoryItem
|
import org.kiwix.kiwixmobile.core.page.history.adapter.HistoryListItem.HistoryItem
|
||||||
|
@ -342,7 +342,6 @@ abstract class CoreReaderFragment :
|
|||||||
private var navigationHistoryList: MutableList<NavigationHistoryListItem> = ArrayList()
|
private var navigationHistoryList: MutableList<NavigationHistoryListItem> = ArrayList()
|
||||||
private var isReadSelection = false
|
private var isReadSelection = false
|
||||||
private var isReadAloudServiceRunning = false
|
private var isReadAloudServiceRunning = false
|
||||||
private var libKiwixBook: Book? = null
|
|
||||||
|
|
||||||
private var storagePermissionForNotesLauncher: ActivityResultLauncher<String>? =
|
private var storagePermissionForNotesLauncher: ActivityResultLauncher<String>? =
|
||||||
registerForActivityResult(
|
registerForActivityResult(
|
||||||
@ -1114,7 +1113,6 @@ abstract class CoreReaderFragment :
|
|||||||
unRegisterReadAloudService()
|
unRegisterReadAloudService()
|
||||||
storagePermissionForNotesLauncher?.unregister()
|
storagePermissionForNotesLauncher?.unregister()
|
||||||
storagePermissionForNotesLauncher = null
|
storagePermissionForNotesLauncher = null
|
||||||
libKiwixBook = null
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateTableOfContents() {
|
private fun updateTableOfContents() {
|
||||||
@ -1653,16 +1651,16 @@ abstract class CoreReaderFragment :
|
|||||||
fun toggleBookmark() {
|
fun toggleBookmark() {
|
||||||
getCurrentWebView()?.url?.let { articleUrl ->
|
getCurrentWebView()?.url?.let { articleUrl ->
|
||||||
zimReaderContainer?.zimFileReader?.let { zimFileReader ->
|
zimReaderContainer?.zimFileReader?.let { zimFileReader ->
|
||||||
libKiwixBook = Book().apply {
|
val libKiwixBook = Book().apply {
|
||||||
update(zimFileReader.jniKiwixReader)
|
update(zimFileReader.jniKiwixReader)
|
||||||
}
|
}
|
||||||
if (isBookmarked) {
|
if (isBookmarked) {
|
||||||
repositoryActions?.deleteBookmark(libKiwixBook!!.id, articleUrl)
|
repositoryActions?.deleteBookmark(libKiwixBook.id, articleUrl)
|
||||||
snackBarRoot?.snack(R.string.bookmark_removed)
|
snackBarRoot?.snack(R.string.bookmark_removed)
|
||||||
} else {
|
} else {
|
||||||
getCurrentWebView()?.title?.let {
|
getCurrentWebView()?.title?.let {
|
||||||
repositoryActions?.saveBookmark(
|
repositoryActions?.saveBookmark(
|
||||||
LibkiwixBookmarkItem(it, articleUrl, zimFileReader, libKiwixBook!!)
|
LibkiwixBookmarkItem(it, articleUrl, zimFileReader, libKiwixBook)
|
||||||
)
|
)
|
||||||
snackBarRoot?.snack(
|
snackBarRoot?.snack(
|
||||||
stringId = R.string.bookmark_added,
|
stringId = R.string.bookmark_added,
|
||||||
|
@ -30,6 +30,6 @@ data class BookmarkState(
|
|||||||
) : PageState<LibkiwixBookmarkItem>() {
|
) : PageState<LibkiwixBookmarkItem>() {
|
||||||
override val visiblePageItems: List<PageRelated> = filteredPageItems
|
override val visiblePageItems: List<PageRelated> = filteredPageItems
|
||||||
|
|
||||||
override fun copyWithNewItems(newItems: List<LibkiwixBookmarkItem>): PageState<LibkiwixBookmarkItem> =
|
override fun copyWithNewItems(newItems: List<LibkiwixBookmarkItem>):
|
||||||
copy(pageItems = newItems)
|
PageState<LibkiwixBookmarkItem> = copy(pageItems = newItems)
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,6 @@ import io.reactivex.processors.PublishProcessor
|
|||||||
import org.kiwix.kiwixmobile.core.base.SideEffect
|
import org.kiwix.kiwixmobile.core.base.SideEffect
|
||||||
import org.kiwix.kiwixmobile.core.dao.PageDao
|
import org.kiwix.kiwixmobile.core.dao.PageDao
|
||||||
import org.kiwix.kiwixmobile.core.extensions.ActivityExtensions.cachedComponent
|
import org.kiwix.kiwixmobile.core.extensions.ActivityExtensions.cachedComponent
|
||||||
import org.kiwix.kiwixmobile.core.page.bookmark.adapter.BookmarkItem
|
|
||||||
import org.kiwix.kiwixmobile.core.page.bookmark.adapter.LibkiwixBookmarkItem
|
import org.kiwix.kiwixmobile.core.page.bookmark.adapter.LibkiwixBookmarkItem
|
||||||
import org.kiwix.kiwixmobile.core.page.viewmodel.PageState
|
import org.kiwix.kiwixmobile.core.page.viewmodel.PageState
|
||||||
import org.kiwix.kiwixmobile.core.page.viewmodel.effects.DeletePageItems
|
import org.kiwix.kiwixmobile.core.page.viewmodel.effects.DeletePageItems
|
||||||
|
Loading…
x
Reference in New Issue
Block a user