diff --git a/app/src/main/java/eu/kanade/tachiyomi/App.kt b/app/src/main/java/eu/kanade/tachiyomi/App.kt index 53b9417d23..1125ec2c90 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/App.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/App.kt @@ -29,7 +29,7 @@ import eu.kanade.tachiyomi.data.notification.Notifications import eu.kanade.tachiyomi.data.preference.PreferenceValues import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.network.NetworkHelper -import eu.kanade.tachiyomi.ui.security.SecureActivityDelegate +import eu.kanade.tachiyomi.ui.base.delegate.SecureActivityDelegate import eu.kanade.tachiyomi.util.preference.asImmediateFlow import eu.kanade.tachiyomi.util.system.AuthenticatorUtil import eu.kanade.tachiyomi.util.system.animatorDurationScale diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/base/activity/BaseActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/base/activity/BaseActivity.kt new file mode 100644 index 0000000000..7312d1236d --- /dev/null +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/base/activity/BaseActivity.kt @@ -0,0 +1,29 @@ +package eu.kanade.tachiyomi.ui.base.activity + +import android.content.Context +import android.os.Bundle +import androidx.appcompat.app.AppCompatActivity +import eu.kanade.tachiyomi.data.preference.PreferencesHelper +import eu.kanade.tachiyomi.ui.base.delegate.SecureActivityDelegate +import eu.kanade.tachiyomi.ui.base.delegate.SecureActivityDelegateImpl +import eu.kanade.tachiyomi.ui.base.delegate.ThemingDelegate +import eu.kanade.tachiyomi.ui.base.delegate.ThemingDelegateImpl +import eu.kanade.tachiyomi.util.system.prepareTabletUiContext +import uy.kohesive.injekt.injectLazy + +open class BaseActivity : + AppCompatActivity(), + SecureActivityDelegate by SecureActivityDelegateImpl(), + ThemingDelegate by ThemingDelegateImpl() { + + protected val preferences: PreferencesHelper by injectLazy() + + override fun attachBaseContext(newBase: Context) { + super.attachBaseContext(newBase.prepareTabletUiContext()) + } + + override fun onCreate(savedInstanceState: Bundle?) { + applyAppTheme(this) + super.onCreate(savedInstanceState) + } +} diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/base/activity/BaseRxActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/base/activity/BaseRxActivity.kt index 63738ccad1..8b22dd2eef 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/base/activity/BaseRxActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/base/activity/BaseRxActivity.kt @@ -2,32 +2,29 @@ package eu.kanade.tachiyomi.ui.base.activity import android.content.Context import android.os.Bundle -import androidx.viewbinding.ViewBinding +import eu.kanade.tachiyomi.data.preference.PreferencesHelper +import eu.kanade.tachiyomi.ui.base.delegate.SecureActivityDelegate +import eu.kanade.tachiyomi.ui.base.delegate.SecureActivityDelegateImpl +import eu.kanade.tachiyomi.ui.base.delegate.ThemingDelegate +import eu.kanade.tachiyomi.ui.base.delegate.ThemingDelegateImpl import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter -import eu.kanade.tachiyomi.ui.security.SecureActivityDelegate import eu.kanade.tachiyomi.util.system.prepareTabletUiContext import nucleus.view.NucleusAppCompatActivity +import uy.kohesive.injekt.injectLazy -abstract class BaseRxActivity> : NucleusAppCompatActivity

() { +open class BaseRxActivity

> : + NucleusAppCompatActivity

(), + SecureActivityDelegate by SecureActivityDelegateImpl(), + ThemingDelegate by ThemingDelegateImpl() { - @Suppress("LeakingThis") - private val secureActivityDelegate = SecureActivityDelegate(this) - - lateinit var binding: VB + protected val preferences: PreferencesHelper by injectLazy() override fun attachBaseContext(newBase: Context) { super.attachBaseContext(newBase.prepareTabletUiContext()) } override fun onCreate(savedInstanceState: Bundle?) { + applyAppTheme(this) super.onCreate(savedInstanceState) - - secureActivityDelegate.onCreate() - } - - override fun onResume() { - super.onResume() - - secureActivityDelegate.onResume() } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/base/activity/BaseViewBindingActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/base/activity/BaseViewBindingActivity.kt deleted file mode 100644 index 29f041b5a9..0000000000 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/base/activity/BaseViewBindingActivity.kt +++ /dev/null @@ -1,25 +0,0 @@ -package eu.kanade.tachiyomi.ui.base.activity - -import android.os.Bundle -import androidx.viewbinding.ViewBinding -import eu.kanade.tachiyomi.ui.security.SecureActivityDelegate - -abstract class BaseViewBindingActivity : BaseThemedActivity() { - - lateinit var binding: VB - - @Suppress("LeakingThis") - private val secureActivityDelegate = SecureActivityDelegate(this) - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - - secureActivityDelegate.onCreate() - } - - override fun onResume() { - super.onResume() - - secureActivityDelegate.onResume() - } -} diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/base/delegate/SecureActivityDelegate.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/base/delegate/SecureActivityDelegate.kt new file mode 100644 index 0000000000..2c8be25042 --- /dev/null +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/base/delegate/SecureActivityDelegate.kt @@ -0,0 +1,73 @@ +package eu.kanade.tachiyomi.ui.base.delegate + +import android.content.Intent +import androidx.appcompat.app.AppCompatActivity +import androidx.lifecycle.DefaultLifecycleObserver +import androidx.lifecycle.LifecycleOwner +import androidx.lifecycle.lifecycleScope +import eu.kanade.tachiyomi.data.preference.PreferenceValues +import eu.kanade.tachiyomi.data.preference.PreferencesHelper +import eu.kanade.tachiyomi.ui.security.UnlockActivity +import eu.kanade.tachiyomi.util.system.AuthenticatorUtil.isAuthenticationSupported +import eu.kanade.tachiyomi.util.view.setSecureScreen +import kotlinx.coroutines.flow.combine +import kotlinx.coroutines.flow.launchIn +import kotlinx.coroutines.flow.onEach +import uy.kohesive.injekt.injectLazy +import java.util.Date + +interface SecureActivityDelegate { + fun registerSecureActivity(activity: AppCompatActivity) + + companion object { + var locked: Boolean = true + } +} + +class SecureActivityDelegateImpl : SecureActivityDelegate, DefaultLifecycleObserver { + + private lateinit var activity: AppCompatActivity + + private val preferences: PreferencesHelper by injectLazy() + + override fun registerSecureActivity(activity: AppCompatActivity) { + this.activity = activity + activity.lifecycle.addObserver(this) + } + + override fun onCreate(owner: LifecycleOwner) { + setSecureScreen() + } + + override fun onResume(owner: LifecycleOwner) { + setAppLock() + } + + private fun setSecureScreen() { + val secureScreenFlow = preferences.secureScreen().asFlow() + val incognitoModeFlow = preferences.incognitoMode().asFlow() + combine(secureScreenFlow, incognitoModeFlow) { secureScreen, incognitoMode -> + secureScreen == PreferenceValues.SecureScreenMode.ALWAYS || + secureScreen == PreferenceValues.SecureScreenMode.INCOGNITO && incognitoMode + } + .onEach { activity.window.setSecureScreen(it) } + .launchIn(activity.lifecycleScope) + } + + private fun setAppLock() { + if (!preferences.useAuthenticator().get()) return + if (activity.isAuthenticationSupported()) { + if (!isAppLocked()) return + activity.startActivity(Intent(activity, UnlockActivity::class.java)) + activity.overridePendingTransition(0, 0) + } else { + preferences.useAuthenticator().set(false) + } + } + + private fun isAppLocked(): Boolean { + if (!SecureActivityDelegate.locked) return false + return preferences.lockAppAfter().get() <= 0 || + Date().time >= preferences.lastAppUnlock().get() + 60 * 1000 * preferences.lockAppAfter().get() + } +} diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/base/activity/BaseThemedActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/base/delegate/ThemingDelegate.kt similarity index 67% rename from app/src/main/java/eu/kanade/tachiyomi/ui/base/activity/BaseThemedActivity.kt rename to app/src/main/java/eu/kanade/tachiyomi/ui/base/delegate/ThemingDelegate.kt index c8b05e5da5..c3d74a15ce 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/base/activity/BaseThemedActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/base/delegate/ThemingDelegate.kt @@ -1,33 +1,16 @@ -package eu.kanade.tachiyomi.ui.base.activity +package eu.kanade.tachiyomi.ui.base.delegate -import android.content.Context -import android.os.Bundle -import androidx.appcompat.app.AppCompatActivity +import android.app.Activity import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.preference.PreferenceValues import eu.kanade.tachiyomi.data.preference.PreferencesHelper -import eu.kanade.tachiyomi.util.system.prepareTabletUiContext -import uy.kohesive.injekt.injectLazy +import uy.kohesive.injekt.Injekt +import uy.kohesive.injekt.api.get -abstract class BaseThemedActivity : AppCompatActivity() { - - val preferences: PreferencesHelper by injectLazy() - - override fun attachBaseContext(newBase: Context) { - super.attachBaseContext(newBase.prepareTabletUiContext()) - } - - override fun onCreate(savedInstanceState: Bundle?) { - applyAppTheme(preferences) - super.onCreate(savedInstanceState) - } +interface ThemingDelegate { + fun applyAppTheme(activity: Activity) companion object { - fun AppCompatActivity.applyAppTheme(preferences: PreferencesHelper) { - getThemeResIds(preferences.appTheme().get(), preferences.themeDarkAmoled().get()) - .forEach { setTheme(it) } - } - fun getThemeResIds(appTheme: PreferenceValues.AppTheme, isAmoled: Boolean): List { val resIds = mutableListOf() when (appTheme) { @@ -68,3 +51,11 @@ abstract class BaseThemedActivity : AppCompatActivity() { } } } + +class ThemingDelegateImpl : ThemingDelegate { + override fun applyAppTheme(activity: Activity) { + val preferences = Injekt.get() + ThemingDelegate.getThemeResIds(preferences.appTheme().get(), preferences.themeDarkAmoled().get()) + .forEach { activity.setTheme(it) } + } +} diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt index 3bd4c1d74f..b11b2e1bcb 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt @@ -40,7 +40,7 @@ import eu.kanade.tachiyomi.data.updater.AppUpdateChecker import eu.kanade.tachiyomi.data.updater.AppUpdateResult import eu.kanade.tachiyomi.databinding.MainActivityBinding import eu.kanade.tachiyomi.extension.api.ExtensionGithubApi -import eu.kanade.tachiyomi.ui.base.activity.BaseViewBindingActivity +import eu.kanade.tachiyomi.ui.base.activity.BaseActivity import eu.kanade.tachiyomi.ui.base.controller.DialogController import eu.kanade.tachiyomi.ui.base.controller.FabController import eu.kanade.tachiyomi.ui.base.controller.NoAppBarElevationController @@ -77,7 +77,9 @@ import kotlinx.coroutines.flow.onEach import logcat.LogPriority import uy.kohesive.injekt.injectLazy -class MainActivity : BaseViewBindingActivity() { +class MainActivity : BaseActivity() { + + lateinit var binding: MainActivityBinding private lateinit var router: Router @@ -627,6 +629,10 @@ class MainActivity : BaseViewBindingActivity() { private val nav: NavigationBarView get() = binding.bottomNav ?: binding.sideNav!! + init { + registerSecureActivity(this) + } + companion object { // Splash screen private const val SPLASH_MIN_DURATION = 500 // ms diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt index ead8a3c024..7af5436be2 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt @@ -50,10 +50,8 @@ import eu.kanade.tachiyomi.data.database.models.Chapter import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.data.notification.NotificationReceiver import eu.kanade.tachiyomi.data.notification.Notifications -import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.databinding.ReaderActivityBinding import eu.kanade.tachiyomi.ui.base.activity.BaseRxActivity -import eu.kanade.tachiyomi.ui.base.activity.BaseThemedActivity.Companion.applyAppTheme import eu.kanade.tachiyomi.ui.main.MainActivity import eu.kanade.tachiyomi.ui.manga.MangaController import eu.kanade.tachiyomi.ui.reader.ReaderPresenter.SetAsCoverResult.AddToLibraryFirst @@ -88,7 +86,6 @@ import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.sample import logcat.LogPriority import nucleus.factory.RequiresPresenter -import uy.kohesive.injekt.injectLazy import kotlin.math.abs import kotlin.math.max @@ -97,7 +94,7 @@ import kotlin.math.max * viewers, to which calls from the presenter or UI events are delegated. */ @RequiresPresenter(ReaderPresenter::class) -class ReaderActivity : BaseRxActivity() { +class ReaderActivity : BaseRxActivity() { companion object { fun newIntent(context: Context, manga: Manga, chapter: Chapter): Intent { @@ -115,7 +112,7 @@ class ReaderActivity : BaseRxActivity() const val SHARED_ELEMENT_NAME = "reader_shared_element_root" } - private val preferences: PreferencesHelper by injectLazy() + lateinit var binding: ReaderActivityBinding val hasCutout by lazy { hasDisplayCutout() } @@ -157,7 +154,7 @@ class ReaderActivity : BaseRxActivity() * Called when the activity is created. Initializes the presenter and configuration. */ override fun onCreate(savedInstanceState: Bundle?) { - applyAppTheme(preferences) + registerSecureActivity(this) // Setup shared element transitions if (intent.extras?.getBoolean(EXTRA_IS_TRANSITION) == true) { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/security/SecureActivityDelegate.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/security/SecureActivityDelegate.kt deleted file mode 100644 index 638de82b89..0000000000 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/security/SecureActivityDelegate.kt +++ /dev/null @@ -1,55 +0,0 @@ -package eu.kanade.tachiyomi.ui.security - -import android.content.Intent -import androidx.fragment.app.FragmentActivity -import androidx.lifecycle.lifecycleScope -import eu.kanade.tachiyomi.data.preference.PreferenceValues -import eu.kanade.tachiyomi.data.preference.PreferencesHelper -import eu.kanade.tachiyomi.util.system.AuthenticatorUtil.isAuthenticationSupported -import eu.kanade.tachiyomi.util.view.setSecureScreen -import kotlinx.coroutines.flow.combine -import kotlinx.coroutines.flow.launchIn -import kotlinx.coroutines.flow.onEach -import uy.kohesive.injekt.injectLazy -import java.util.Date - -class SecureActivityDelegate(private val activity: FragmentActivity) { - - private val preferences: PreferencesHelper by injectLazy() - - fun onCreate() { - val secureScreenFlow = preferences.secureScreen().asFlow() - val incognitoModeFlow = preferences.incognitoMode().asFlow() - combine(secureScreenFlow, incognitoModeFlow) { secureScreen, incognitoMode -> - secureScreen == PreferenceValues.SecureScreenMode.ALWAYS || secureScreen == PreferenceValues.SecureScreenMode.INCOGNITO && incognitoMode - } - .onEach { activity.window.setSecureScreen(it) } - .launchIn(activity.lifecycleScope) - } - - fun onResume() { - if (preferences.useAuthenticator().get()) { - if (activity.isAuthenticationSupported()) { - if (isAppLocked()) { - activity.startActivity(Intent(activity, UnlockActivity::class.java)) - activity.overridePendingTransition(0, 0) - } - } else { - preferences.useAuthenticator().set(false) - } - } - } - - private fun isAppLocked(): Boolean { - if (!locked) { - return false - } - - return preferences.lockAppAfter().get() <= 0 || - Date().time >= preferences.lastAppUnlock().get() + 60 * 1000 * preferences.lockAppAfter().get() - } - - companion object { - var locked: Boolean = true - } -} diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/security/UnlockActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/security/UnlockActivity.kt index e34f3e4900..40247b871c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/security/UnlockActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/security/UnlockActivity.kt @@ -4,7 +4,8 @@ import android.os.Bundle import androidx.biometric.BiometricPrompt import androidx.fragment.app.FragmentActivity import eu.kanade.tachiyomi.R -import eu.kanade.tachiyomi.ui.base.activity.BaseThemedActivity +import eu.kanade.tachiyomi.ui.base.activity.BaseActivity +import eu.kanade.tachiyomi.ui.base.delegate.SecureActivityDelegate import eu.kanade.tachiyomi.util.system.AuthenticatorUtil import eu.kanade.tachiyomi.util.system.AuthenticatorUtil.startAuthentication import eu.kanade.tachiyomi.util.system.logcat @@ -14,7 +15,7 @@ import java.util.Date /** * Blank activity with a BiometricPrompt. */ -class UnlockActivity : BaseThemedActivity() { +class UnlockActivity : BaseActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/track/BaseOAuthLoginActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/track/BaseOAuthLoginActivity.kt index 06cee4de7e..1f73aac837 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/track/BaseOAuthLoginActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/track/BaseOAuthLoginActivity.kt @@ -8,11 +8,11 @@ import android.view.ViewGroup import android.widget.FrameLayout import android.widget.ProgressBar import eu.kanade.tachiyomi.data.track.TrackManager -import eu.kanade.tachiyomi.ui.base.activity.BaseThemedActivity +import eu.kanade.tachiyomi.ui.base.activity.BaseActivity import eu.kanade.tachiyomi.ui.main.MainActivity import uy.kohesive.injekt.injectLazy -abstract class BaseOAuthLoginActivity : BaseThemedActivity() { +abstract class BaseOAuthLoginActivity : BaseActivity() { internal val trackManager: TrackManager by injectLazy() diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/webview/WebViewActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/webview/WebViewActivity.kt index 5295e34eb4..c925206402 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/webview/WebViewActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/webview/WebViewActivity.kt @@ -19,7 +19,7 @@ import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.databinding.WebviewActivityBinding import eu.kanade.tachiyomi.source.SourceManager import eu.kanade.tachiyomi.source.online.HttpSource -import eu.kanade.tachiyomi.ui.base.activity.BaseViewBindingActivity +import eu.kanade.tachiyomi.ui.base.activity.BaseActivity import eu.kanade.tachiyomi.util.system.WebViewClientCompat import eu.kanade.tachiyomi.util.system.WebViewUtil import eu.kanade.tachiyomi.util.system.getResourceColor @@ -32,7 +32,9 @@ import reactivecircus.flowbinding.appcompat.navigationClicks import reactivecircus.flowbinding.swiperefreshlayout.refreshes import uy.kohesive.injekt.injectLazy -class WebViewActivity : BaseViewBindingActivity() { +class WebViewActivity : BaseActivity() { + + private lateinit var binding: WebviewActivityBinding private val sourceManager: SourceManager by injectLazy() @@ -203,6 +205,10 @@ class WebViewActivity : BaseViewBindingActivity() { openInBrowser(binding.webview.url!!, forceDefaultBrowser = true) } + init { + registerSecureActivity(this) + } + companion object { private const val URL_KEY = "url_key" private const val SOURCE_KEY = "source_key" diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/system/ContextExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/util/system/ContextExtensions.kt index b229c0deba..2894f7ab20 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/system/ContextExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/system/ContextExtensions.kt @@ -41,7 +41,7 @@ import com.hippo.unifile.UniFile import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.preference.PreferenceValues import eu.kanade.tachiyomi.data.preference.PreferencesHelper -import eu.kanade.tachiyomi.ui.base.activity.BaseThemedActivity +import eu.kanade.tachiyomi.ui.base.delegate.ThemingDelegate import eu.kanade.tachiyomi.util.lang.truncateCenter import logcat.LogPriority import uy.kohesive.injekt.Injekt @@ -325,7 +325,7 @@ fun Context.createReaderThemeContext(): Context { val wrappedContext = ContextThemeWrapper(this, R.style.Theme_Tachiyomi) wrappedContext.applyOverrideConfiguration(overrideConf) - BaseThemedActivity.getThemeResIds(prefs.appTheme().get(), prefs.themeDarkAmoled().get()) + ThemingDelegate.getThemeResIds(prefs.appTheme().get(), prefs.themeDarkAmoled().get()) .forEach { wrappedContext.theme.applyStyle(it, true) } return wrappedContext } diff --git a/app/src/main/java/eu/kanade/tachiyomi/widget/preference/ThemesPreferenceAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/widget/preference/ThemesPreferenceAdapter.kt index c505bab595..38e71410f7 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/widget/preference/ThemesPreferenceAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/widget/preference/ThemesPreferenceAdapter.kt @@ -9,7 +9,7 @@ import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.preference.PreferenceValues import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.databinding.PrefThemeItemBinding -import eu.kanade.tachiyomi.ui.base.activity.BaseThemedActivity +import eu.kanade.tachiyomi.ui.base.delegate.ThemingDelegate import eu.kanade.tachiyomi.util.system.getResourceColor import uy.kohesive.injekt.injectLazy @@ -23,7 +23,7 @@ class ThemesPreferenceAdapter(private val clickListener: OnItemClickListener) : private lateinit var binding: PrefThemeItemBinding override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ThemeViewHolder { - val themeResIds = BaseThemedActivity.getThemeResIds(themes[viewType], preferences.themeDarkAmoled().get()) + val themeResIds = ThemingDelegate.getThemeResIds(themes[viewType], preferences.themeDarkAmoled().get()) val themedContext = themeResIds.fold(parent.context) { context, themeResId -> ContextThemeWrapper(context, themeResId)