mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
feat: Enable/Disable Sources Swipe (#396)
* Update SourceItem.kt * Update SettingsBrowseController.kt 1 * Update SettingsBrowseController.kt * Update SettingsBrowseController.kt * Update strings.xml * Update SettingsBrowseController.kt * Update UiPreferences.kt * Update SettingsBrowseController.kt * Update SourceItem.kt
This commit is contained in:
parent
66241774dc
commit
94c314559b
4 changed files with 19 additions and 1 deletions
|
@ -8,6 +8,7 @@ import androidx.preference.PreferenceScreen
|
|||
import androidx.preference.SwitchPreferenceCompat
|
||||
import eu.kanade.tachiyomi.BuildConfig
|
||||
import eu.kanade.tachiyomi.R
|
||||
import yokai.domain.ui.UiPreferences
|
||||
import yokai.i18n.MR
|
||||
import yokai.util.lang.getString
|
||||
import dev.icerock.moko.resources.compose.stringResource
|
||||
|
@ -45,6 +46,8 @@ class SettingsBrowseController : SettingsLegacyController() {
|
|||
val sourceManager: SourceManager by injectLazy()
|
||||
var updatedExtNotifPref: SwitchPreferenceCompat? = null
|
||||
|
||||
private val uiPreferences: UiPreferences by injectLazy()
|
||||
|
||||
override fun setupPreferenceScreen(screen: PreferenceScreen) = screen.apply {
|
||||
titleRes = MR.strings.browse
|
||||
|
||||
|
@ -199,6 +202,15 @@ class SettingsBrowseController : SettingsLegacyController() {
|
|||
infoPreference(MR.strings.you_can_migrate_in_library)
|
||||
}
|
||||
|
||||
preferenceCategory {
|
||||
titleRes = MR.strings.sources
|
||||
|
||||
switchPreference {
|
||||
bindTo(uiPreferences.enableSourceSwipeAction())
|
||||
titleRes = MR.strings.enable_source_swipe_action
|
||||
}
|
||||
}
|
||||
|
||||
preferenceCategory {
|
||||
titleRes = MR.strings.nsfw_sources
|
||||
|
||||
|
|
|
@ -11,6 +11,9 @@ import yokai.util.lang.getString
|
|||
import dev.icerock.moko.resources.compose.stringResource
|
||||
import eu.kanade.tachiyomi.source.CatalogueSource
|
||||
import eu.kanade.tachiyomi.source.LocalSource
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
import yokai.domain.ui.UiPreferences
|
||||
|
||||
/**
|
||||
* Item that contains source information.
|
||||
|
@ -29,7 +32,7 @@ class SourceItem(val source: CatalogueSource, header: LangItem? = null, val isPi
|
|||
}
|
||||
|
||||
override fun isSwipeable(): Boolean {
|
||||
return source.id != LocalSource.ID && header != null && header.code != SourcePresenter.LAST_USED_KEY
|
||||
return Injekt.get<UiPreferences>().enableSourceSwipeAction().get() && source.id != LocalSource.ID && header != null && header.code != SourcePresenter.LAST_USED_KEY
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -11,4 +11,6 @@ class UiPreferences(private val preferenceStore: PreferenceStore) {
|
|||
fun uniformGrid() = preferenceStore.getBoolean(PreferenceKeys.uniformGrid, true)
|
||||
|
||||
fun enableChapterSwipeAction() = preferenceStore.getBoolean("enable_chapter_swipe_action", true)
|
||||
|
||||
fun enableSourceSwipeAction() = preferenceStore.getBoolean("enable_source_swipe_action", true)
|
||||
}
|
||||
|
|
|
@ -884,6 +884,7 @@
|
|||
<string name="you_can_migrate_in_library">You can also migrate by selecting entries in your
|
||||
library</string>
|
||||
<string name="source_migration_guide">Source migration guide</string>
|
||||
<string name="enable_source_swipe_action">Enable source swipe action</string>
|
||||
<string name="nsfw_sources">NSFW (18+) sources</string>
|
||||
<string name="show_in_sources_and_extensions">Show in sources and extensions lists</string>
|
||||
<string name="does_not_prevent_unofficial_nsfw">This does not prevent unofficial or potentially incorrectly flagged extensions from surfacing NSFW (18+) content within the app.</string>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue