Add simple hentai features option
This commit is contained in:
parent
3bfda338ef
commit
38b469755f
@ -228,4 +228,6 @@ object PreferenceKeys {
|
||||
const val eh_tag_filtering_value = "eh_tag_filtering_value"
|
||||
|
||||
const val eh_tag_watching_value = "eh_tag_watching_value"
|
||||
|
||||
const val eh_is_hentai_enabled = "eh_is_hentai_enabled"
|
||||
}
|
||||
|
@ -258,6 +258,8 @@ class PreferencesHelper(val context: Context) {
|
||||
// <--
|
||||
|
||||
// --> EH
|
||||
fun eh_isHentaiEnabled() = flowPrefs.getBoolean(Keys.eh_is_hentai_enabled, true)
|
||||
|
||||
fun enableExhentai() = flowPrefs.getBoolean(Keys.eh_enableExHentai, false)
|
||||
|
||||
fun secureEXH() = flowPrefs.getBoolean("secure_exh", true)
|
||||
|
@ -395,6 +395,8 @@ class LibraryController(
|
||||
|
||||
// Mutate the filter icon because it needs to be tinted and the resource is shared.
|
||||
menu.findItem(R.id.action_filter).icon.mutate()
|
||||
|
||||
menu.findItem(R.id.action_sync_favorites).isEnabled = preferences.eh_isHentaiEnabled().get()
|
||||
}
|
||||
|
||||
fun search(query: String) {
|
||||
|
@ -37,8 +37,17 @@ import eu.kanade.tachiyomi.ui.recent.history.HistoryController
|
||||
import eu.kanade.tachiyomi.ui.recent.updates.UpdatesController
|
||||
import eu.kanade.tachiyomi.util.lang.launchUI
|
||||
import eu.kanade.tachiyomi.util.system.toast
|
||||
import exh.EH_SOURCE_ID
|
||||
import exh.EIGHTMUSES_SOURCE_ID
|
||||
import exh.EXHMigrations
|
||||
import exh.EXH_SOURCE_ID
|
||||
import exh.HBROWSE_SOURCE_ID
|
||||
import exh.HITOMI_SOURCE_ID
|
||||
import exh.NHENTAI_SOURCE_ID
|
||||
import exh.PERV_EDEN_EN_SOURCE_ID
|
||||
import exh.PERV_EDEN_IT_SOURCE_ID
|
||||
import exh.eh.EHentaiUpdateWorker
|
||||
import exh.source.BlacklistedSources
|
||||
import exh.uconfig.WarnConfigureDialogController
|
||||
import java.util.Date
|
||||
import java.util.LinkedList
|
||||
@ -189,8 +198,34 @@ class MainActivity : BaseActivity<MainActivityBinding>() {
|
||||
|
||||
EHentaiUpdateWorker.scheduleBackground(this)
|
||||
}
|
||||
// EXH <--
|
||||
}
|
||||
if (!preferences.eh_isHentaiEnabled().get()) {
|
||||
if (EH_SOURCE_ID !in BlacklistedSources.HIDDEN_SOURCES) {
|
||||
BlacklistedSources.HIDDEN_SOURCES += EH_SOURCE_ID
|
||||
}
|
||||
if (EXH_SOURCE_ID !in BlacklistedSources.HIDDEN_SOURCES) {
|
||||
BlacklistedSources.HIDDEN_SOURCES += EXH_SOURCE_ID
|
||||
}
|
||||
if (PERV_EDEN_EN_SOURCE_ID !in BlacklistedSources.HIDDEN_SOURCES) {
|
||||
BlacklistedSources.HIDDEN_SOURCES += PERV_EDEN_EN_SOURCE_ID
|
||||
}
|
||||
if (PERV_EDEN_IT_SOURCE_ID !in BlacklistedSources.HIDDEN_SOURCES) {
|
||||
BlacklistedSources.HIDDEN_SOURCES += PERV_EDEN_IT_SOURCE_ID
|
||||
}
|
||||
if (NHENTAI_SOURCE_ID !in BlacklistedSources.HIDDEN_SOURCES) {
|
||||
BlacklistedSources.HIDDEN_SOURCES += NHENTAI_SOURCE_ID
|
||||
}
|
||||
if (HITOMI_SOURCE_ID !in BlacklistedSources.HIDDEN_SOURCES) {
|
||||
BlacklistedSources.HIDDEN_SOURCES += HITOMI_SOURCE_ID
|
||||
}
|
||||
if (EIGHTMUSES_SOURCE_ID !in BlacklistedSources.HIDDEN_SOURCES) {
|
||||
BlacklistedSources.HIDDEN_SOURCES += EIGHTMUSES_SOURCE_ID
|
||||
}
|
||||
if (HBROWSE_SOURCE_ID !in BlacklistedSources.HIDDEN_SOURCES) {
|
||||
BlacklistedSources.HIDDEN_SOURCES += HBROWSE_SOURCE_ID
|
||||
}
|
||||
}
|
||||
// EXH <--
|
||||
|
||||
setExtensionsBadge()
|
||||
preferences.extensionUpdatesCount().asFlow()
|
||||
|
@ -76,12 +76,14 @@ class MoreController :
|
||||
router.pushController(MigrationController().withFadeTransaction())
|
||||
}
|
||||
}
|
||||
preference {
|
||||
titleRes = R.string.eh_batch_add
|
||||
iconRes = R.drawable.ic_playlist_add_black_24dp
|
||||
iconTint = tintColor
|
||||
onClick {
|
||||
router.pushController(BatchAddController().withFadeTransaction())
|
||||
if (preferences.eh_isHentaiEnabled().get()) {
|
||||
preference {
|
||||
titleRes = R.string.eh_batch_add
|
||||
iconRes = R.drawable.ic_playlist_add_black_24dp
|
||||
iconTint = tintColor
|
||||
onClick {
|
||||
router.pushController(BatchAddController().withFadeTransaction())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction
|
||||
import eu.kanade.tachiyomi.ui.library.LibraryController
|
||||
import eu.kanade.tachiyomi.util.preference.defaultValue
|
||||
import eu.kanade.tachiyomi.util.preference.intListPreference
|
||||
import eu.kanade.tachiyomi.util.preference.onChange
|
||||
import eu.kanade.tachiyomi.util.preference.onClick
|
||||
import eu.kanade.tachiyomi.util.preference.preference
|
||||
import eu.kanade.tachiyomi.util.preference.preferenceCategory
|
||||
@ -34,8 +35,17 @@ import eu.kanade.tachiyomi.util.preference.switchPreference
|
||||
import eu.kanade.tachiyomi.util.preference.titleRes
|
||||
import eu.kanade.tachiyomi.util.system.powerManager
|
||||
import eu.kanade.tachiyomi.util.system.toast
|
||||
import exh.EH_SOURCE_ID
|
||||
import exh.EIGHTMUSES_SOURCE_ID
|
||||
import exh.EXH_SOURCE_ID
|
||||
import exh.HBROWSE_SOURCE_ID
|
||||
import exh.HITOMI_SOURCE_ID
|
||||
import exh.NHENTAI_SOURCE_ID
|
||||
import exh.PERV_EDEN_EN_SOURCE_ID
|
||||
import exh.PERV_EDEN_IT_SOURCE_ID
|
||||
import exh.debug.SettingsDebugController
|
||||
import exh.log.EHLogLevel
|
||||
import exh.source.BlacklistedSources
|
||||
import rx.Observable
|
||||
import rx.android.schedulers.AndroidSchedulers
|
||||
import rx.schedulers.Schedulers
|
||||
@ -117,6 +127,68 @@ class SettingsAdvancedController : SettingsController() {
|
||||
title = "Developer tools"
|
||||
isPersistent = false
|
||||
|
||||
switchPreference {
|
||||
title = "Enable integrated hentai features"
|
||||
summary = "This is a experimental feature that will disable all hentai features if toggled off"
|
||||
key = PreferenceKeys.eh_is_hentai_enabled
|
||||
defaultValue = true
|
||||
|
||||
onChange {
|
||||
if (preferences.eh_isHentaiEnabled().get()) {
|
||||
if (EH_SOURCE_ID !in BlacklistedSources.HIDDEN_SOURCES) {
|
||||
BlacklistedSources.HIDDEN_SOURCES += EH_SOURCE_ID
|
||||
}
|
||||
if (EXH_SOURCE_ID !in BlacklistedSources.HIDDEN_SOURCES) {
|
||||
BlacklistedSources.HIDDEN_SOURCES += EXH_SOURCE_ID
|
||||
}
|
||||
if (PERV_EDEN_EN_SOURCE_ID !in BlacklistedSources.HIDDEN_SOURCES) {
|
||||
BlacklistedSources.HIDDEN_SOURCES += PERV_EDEN_EN_SOURCE_ID
|
||||
}
|
||||
if (PERV_EDEN_IT_SOURCE_ID !in BlacklistedSources.HIDDEN_SOURCES) {
|
||||
BlacklistedSources.HIDDEN_SOURCES += PERV_EDEN_IT_SOURCE_ID
|
||||
}
|
||||
if (NHENTAI_SOURCE_ID !in BlacklistedSources.HIDDEN_SOURCES) {
|
||||
BlacklistedSources.HIDDEN_SOURCES += NHENTAI_SOURCE_ID
|
||||
}
|
||||
if (HITOMI_SOURCE_ID !in BlacklistedSources.HIDDEN_SOURCES) {
|
||||
BlacklistedSources.HIDDEN_SOURCES += HITOMI_SOURCE_ID
|
||||
}
|
||||
if (EIGHTMUSES_SOURCE_ID !in BlacklistedSources.HIDDEN_SOURCES) {
|
||||
BlacklistedSources.HIDDEN_SOURCES += EIGHTMUSES_SOURCE_ID
|
||||
}
|
||||
if (HBROWSE_SOURCE_ID !in BlacklistedSources.HIDDEN_SOURCES) {
|
||||
BlacklistedSources.HIDDEN_SOURCES += HBROWSE_SOURCE_ID
|
||||
}
|
||||
} else {
|
||||
if (EH_SOURCE_ID in BlacklistedSources.HIDDEN_SOURCES) {
|
||||
BlacklistedSources.HIDDEN_SOURCES -= EH_SOURCE_ID
|
||||
}
|
||||
if (EXH_SOURCE_ID in BlacklistedSources.HIDDEN_SOURCES) {
|
||||
BlacklistedSources.HIDDEN_SOURCES -= EXH_SOURCE_ID
|
||||
}
|
||||
if (PERV_EDEN_EN_SOURCE_ID in BlacklistedSources.HIDDEN_SOURCES) {
|
||||
BlacklistedSources.HIDDEN_SOURCES -= PERV_EDEN_EN_SOURCE_ID
|
||||
}
|
||||
if (PERV_EDEN_IT_SOURCE_ID in BlacklistedSources.HIDDEN_SOURCES) {
|
||||
BlacklistedSources.HIDDEN_SOURCES -= PERV_EDEN_IT_SOURCE_ID
|
||||
}
|
||||
if (NHENTAI_SOURCE_ID in BlacklistedSources.HIDDEN_SOURCES) {
|
||||
BlacklistedSources.HIDDEN_SOURCES -= NHENTAI_SOURCE_ID
|
||||
}
|
||||
if (HITOMI_SOURCE_ID in BlacklistedSources.HIDDEN_SOURCES) {
|
||||
BlacklistedSources.HIDDEN_SOURCES -= HITOMI_SOURCE_ID
|
||||
}
|
||||
if (EIGHTMUSES_SOURCE_ID in BlacklistedSources.HIDDEN_SOURCES) {
|
||||
BlacklistedSources.HIDDEN_SOURCES -= EIGHTMUSES_SOURCE_ID
|
||||
}
|
||||
if (HBROWSE_SOURCE_ID in BlacklistedSources.HIDDEN_SOURCES) {
|
||||
BlacklistedSources.HIDDEN_SOURCES -= HBROWSE_SOURCE_ID
|
||||
}
|
||||
}
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
switchPreference {
|
||||
title = "Enable delegated sources"
|
||||
key = PreferenceKeys.eh_delegateSources
|
||||
|
@ -66,23 +66,25 @@ class SettingsMainController : SettingsController() {
|
||||
titleRes = R.string.pref_category_security
|
||||
onClick { navigateTo(SettingsSecurityController()) }
|
||||
}
|
||||
preference {
|
||||
iconRes = R.drawable.eh_ic_ehlogo_red_24dp
|
||||
iconTint = tintColor
|
||||
titleRes = R.string.pref_category_eh
|
||||
onClick { navigateTo(SettingsEhController()) }
|
||||
}
|
||||
preference {
|
||||
iconRes = R.drawable.eh_ic_nhlogo_color
|
||||
iconTint = tintColor
|
||||
titleRes = R.string.pref_category_nh
|
||||
onClick { navigateTo(SettingsNhController()) }
|
||||
}
|
||||
preference {
|
||||
iconRes = R.drawable.eh_ic_hllogo
|
||||
iconTint = tintColor
|
||||
titleRes = R.string.pref_category_hl
|
||||
onClick { navigateTo(SettingsHlController()) }
|
||||
if (preferences.eh_isHentaiEnabled().get()) {
|
||||
preference {
|
||||
iconRes = R.drawable.eh_ic_ehlogo_red_24dp
|
||||
iconTint = tintColor
|
||||
titleRes = R.string.pref_category_eh
|
||||
onClick { navigateTo(SettingsEhController()) }
|
||||
}
|
||||
preference {
|
||||
iconRes = R.drawable.eh_ic_nhlogo_color
|
||||
iconTint = tintColor
|
||||
titleRes = R.string.pref_category_nh
|
||||
onClick { navigateTo(SettingsNhController()) }
|
||||
}
|
||||
preference {
|
||||
iconRes = R.drawable.eh_ic_hllogo
|
||||
iconTint = tintColor
|
||||
titleRes = R.string.pref_category_hl
|
||||
onClick { navigateTo(SettingsHlController()) }
|
||||
}
|
||||
}
|
||||
preference {
|
||||
iconRes = R.drawable.ic_code_24dp
|
||||
|
@ -38,7 +38,7 @@ object BlacklistedSources {
|
||||
"eu.kanade.tachiyomi.extension.it.perveden"
|
||||
)
|
||||
|
||||
val HIDDEN_SOURCES = listOf(
|
||||
var HIDDEN_SOURCES = listOf(
|
||||
MERGED_SOURCE_ID
|
||||
)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user