From 8945ef88809d3d87ebbd9c12ade89a3ee9266fef Mon Sep 17 00:00:00 2001 From: Ivan Iskandar <12537387+ivaniskandar@users.noreply.github.com> Date: Mon, 5 Dec 2022 12:10:11 +0700 Subject: [PATCH] Change source preference theming fix (#8679) --- .../kanade/tachiyomi/ui/base/delegate/ThemingDelegate.kt | 3 --- .../browse/extension/details/SourcePreferencesScreen.kt | 9 +++++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/base/delegate/ThemingDelegate.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/base/delegate/ThemingDelegate.kt index aa9408be39..4ad7474fe3 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/base/delegate/ThemingDelegate.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/base/delegate/ThemingDelegate.kt @@ -53,9 +53,6 @@ interface ThemingDelegate { resIds += R.style.ThemeOverlay_Tachiyomi_Amoled } - // For source preference theme - resIds += R.style.PreferenceThemeOverlay_Tachiyomi - return resIds } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/details/SourcePreferencesScreen.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/details/SourcePreferencesScreen.kt index bc36d15d7d..d65d2d9bcb 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/details/SourcePreferencesScreen.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/details/SourcePreferencesScreen.kt @@ -2,7 +2,9 @@ package eu.kanade.tachiyomi.ui.browse.extension.details import android.content.Context import android.os.Bundle +import android.util.TypedValue import android.view.View +import androidx.appcompat.view.ContextThemeWrapper import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding import androidx.compose.material.icons.Icons @@ -127,6 +129,13 @@ class SourcePreferencesScreen(val sourceId: Long) : Screen { class SourcePreferencesFragment : PreferenceFragmentCompat() { + override fun getContext(): Context? { + val superCtx = super.getContext() ?: return null + val tv = TypedValue() + superCtx.theme.resolveAttribute(R.attr.preferenceTheme, tv, true) + return ContextThemeWrapper(superCtx, tv.resourceId) + } + override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { preferenceScreen = populateScreen() }