Full Compose settings (#8201)

* Uses Voyager for navigation.
* Replaces every screen inside settings except category editor screen since it's
called from several places.
This commit is contained in:
Ivan Iskandar
2022-10-15 22:38:01 +07:00
committed by GitHub
parent 3fdcd636d7
commit 890f1a3c7b
42 changed files with 4904 additions and 80 deletions

View File

@@ -1,10 +1,15 @@
package eu.kanade.presentation.theme
import androidx.appcompat.view.ContextThemeWrapper
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalLayoutDirection
import com.google.android.material.composethemeadapter3.createMdc3Theme
import eu.kanade.domain.ui.model.AppTheme
import eu.kanade.tachiyomi.ui.base.delegate.ThemingDelegate
import uy.kohesive.injekt.api.get
@Composable
fun TachiyomiTheme(content: @Composable () -> Unit) {
@@ -22,3 +27,29 @@ fun TachiyomiTheme(content: @Composable () -> Unit) {
content = content,
)
}
@Composable
fun TachiyomiTheme(
appTheme: AppTheme,
amoled: Boolean,
content: @Composable () -> Unit,
) {
val originalContext = LocalContext.current
val layoutDirection = LocalLayoutDirection.current
val themedContext = remember(appTheme, originalContext) {
val themeResIds = ThemingDelegate.getThemeResIds(appTheme, amoled)
themeResIds.fold(originalContext) { context, themeResId ->
ContextThemeWrapper(context, themeResId)
}
}
val (colorScheme, typography) = createMdc3Theme(
context = themedContext,
layoutDirection = layoutDirection,
)
MaterialTheme(
colorScheme = colorScheme!!,
typography = typography!!,
content = content,
)
}