Loading app-ui-catalog/build.gradle.kts +1 −0 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ android { dependencies { implementation(projects.core.ui.compose.designsystem) implementation(libs.androidx.compose.material) androidTestImplementation(libs.androidx.test.ext.junit.ktx) androidTestImplementation(libs.androidx.test.espresso.core) Loading app-ui-catalog/src/main/AndroidManifest.xml +1 −1 Original line number Diff line number Diff line Loading @@ -10,7 +10,7 @@ android:theme="@style/Theme.Thunderbird" > <activity android:name=".MainActivity" android:name=".CatalogActivity" android:exported="true"> <intent-filter> <action android:name="android.intent.action.MAIN" /> Loading app-ui-catalog/src/main/java/app/k9mail/ui/catalog/MainActivity.kt→app-ui-catalog/src/main/java/app/k9mail/ui/catalog/CatalogActivity.kt +6 −2 Original line number Diff line number Diff line Loading @@ -3,12 +3,16 @@ package app.k9mail.ui.catalog import android.os.Bundle import androidx.activity.ComponentActivity import androidx.activity.compose.setContent class MainActivity : ComponentActivity() { import androidx.core.view.WindowCompat class CatalogActivity : ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) WindowCompat.setDecorFitsSystemWindows(window, false) setContent { MainView() CatalogScreen() } } } app-ui-catalog/src/main/java/app/k9mail/ui/catalog/CatalogContent.kt 0 → 100644 +66 −0 Original line number Diff line number Diff line package app.k9mail.ui.catalog import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.grid.GridCells import androidx.compose.foundation.lazy.grid.LazyVerticalGrid import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp import app.k9mail.core.ui.compose.common.DevicePreviews import app.k9mail.core.ui.compose.designsystem.atom.Surface import app.k9mail.core.ui.compose.theme.MainTheme import app.k9mail.ui.catalog.items.buttonItems import app.k9mail.ui.catalog.items.colorItems import app.k9mail.ui.catalog.items.imageItems import app.k9mail.ui.catalog.items.selectionControlItems import app.k9mail.ui.catalog.items.themeHeaderItem import app.k9mail.ui.catalog.items.themeSelectorItems import app.k9mail.ui.catalog.items.typographyItems @Composable fun CatalogContent( catalogTheme: CatalogTheme, catalogThemeVariant: CatalogThemeVariant, onThemeChange: () -> Unit, onThemeVariantChange: () -> Unit, contentPadding: PaddingValues, modifier: Modifier = Modifier, ) { Surface { LazyVerticalGrid( columns = GridCells.Adaptive(300.dp), contentPadding = contentPadding, horizontalArrangement = Arrangement.spacedBy(MainTheme.spacings.double), verticalArrangement = Arrangement.spacedBy(MainTheme.spacings.double), modifier = modifier.padding(MainTheme.spacings.double), ) { themeHeaderItem(text = "Thunderbird Catalog") themeSelectorItems( catalogTheme = catalogTheme, catalogThemeVariant = catalogThemeVariant, onThemeChange = onThemeChange, onThemeVariantChange = onThemeVariantChange, ) typographyItems() colorItems() buttonItems() selectionControlItems() imageItems() } } } @DevicePreviews @Composable internal fun CatalogContentPreview() { CatalogContent( catalogTheme = CatalogTheme.K9, catalogThemeVariant = CatalogThemeVariant.LIGHT, onThemeChange = {}, onThemeVariantChange = {}, contentPadding = PaddingValues(), ) } app-ui-catalog/src/main/java/app/k9mail/ui/catalog/CatalogScreen.kt 0 → 100644 +50 −0 Original line number Diff line number Diff line package app.k9mail.ui.catalog import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.layout.asPaddingValues import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.systemBars import androidx.compose.runtime.Composable import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.ui.Modifier import app.k9mail.core.ui.compose.common.DevicePreviews @Composable fun CatalogScreen( modifier: Modifier = Modifier, ) { val themeState = remember { mutableStateOf(CatalogTheme.K9) } val themeVariantState = remember { mutableStateOf(CatalogThemeVariant.LIGHT) } CatalogThemeSwitch(theme = themeState.value, themeVariation = themeVariantState.value) { val contentPadding = WindowInsets.systemBars.asPaddingValues() CatalogContent( catalogTheme = themeState.value, catalogThemeVariant = themeVariantState.value, onThemeChange = { themeState.value = when (themeState.value) { CatalogTheme.K9 -> CatalogTheme.THUNDERBIRD CatalogTheme.THUNDERBIRD -> CatalogTheme.K9 } }, onThemeVariantChange = { themeVariantState.value = when (themeVariantState.value) { CatalogThemeVariant.LIGHT -> CatalogThemeVariant.DARK CatalogThemeVariant.DARK -> CatalogThemeVariant.LIGHT } }, contentPadding = contentPadding, modifier = Modifier .fillMaxSize() .then(modifier), ) } } @DevicePreviews @Composable internal fun CatalogScreenPreview() { CatalogScreen() } Loading
app-ui-catalog/build.gradle.kts +1 −0 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ android { dependencies { implementation(projects.core.ui.compose.designsystem) implementation(libs.androidx.compose.material) androidTestImplementation(libs.androidx.test.ext.junit.ktx) androidTestImplementation(libs.androidx.test.espresso.core) Loading
app-ui-catalog/src/main/AndroidManifest.xml +1 −1 Original line number Diff line number Diff line Loading @@ -10,7 +10,7 @@ android:theme="@style/Theme.Thunderbird" > <activity android:name=".MainActivity" android:name=".CatalogActivity" android:exported="true"> <intent-filter> <action android:name="android.intent.action.MAIN" /> Loading
app-ui-catalog/src/main/java/app/k9mail/ui/catalog/MainActivity.kt→app-ui-catalog/src/main/java/app/k9mail/ui/catalog/CatalogActivity.kt +6 −2 Original line number Diff line number Diff line Loading @@ -3,12 +3,16 @@ package app.k9mail.ui.catalog import android.os.Bundle import androidx.activity.ComponentActivity import androidx.activity.compose.setContent class MainActivity : ComponentActivity() { import androidx.core.view.WindowCompat class CatalogActivity : ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) WindowCompat.setDecorFitsSystemWindows(window, false) setContent { MainView() CatalogScreen() } } }
app-ui-catalog/src/main/java/app/k9mail/ui/catalog/CatalogContent.kt 0 → 100644 +66 −0 Original line number Diff line number Diff line package app.k9mail.ui.catalog import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.grid.GridCells import androidx.compose.foundation.lazy.grid.LazyVerticalGrid import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp import app.k9mail.core.ui.compose.common.DevicePreviews import app.k9mail.core.ui.compose.designsystem.atom.Surface import app.k9mail.core.ui.compose.theme.MainTheme import app.k9mail.ui.catalog.items.buttonItems import app.k9mail.ui.catalog.items.colorItems import app.k9mail.ui.catalog.items.imageItems import app.k9mail.ui.catalog.items.selectionControlItems import app.k9mail.ui.catalog.items.themeHeaderItem import app.k9mail.ui.catalog.items.themeSelectorItems import app.k9mail.ui.catalog.items.typographyItems @Composable fun CatalogContent( catalogTheme: CatalogTheme, catalogThemeVariant: CatalogThemeVariant, onThemeChange: () -> Unit, onThemeVariantChange: () -> Unit, contentPadding: PaddingValues, modifier: Modifier = Modifier, ) { Surface { LazyVerticalGrid( columns = GridCells.Adaptive(300.dp), contentPadding = contentPadding, horizontalArrangement = Arrangement.spacedBy(MainTheme.spacings.double), verticalArrangement = Arrangement.spacedBy(MainTheme.spacings.double), modifier = modifier.padding(MainTheme.spacings.double), ) { themeHeaderItem(text = "Thunderbird Catalog") themeSelectorItems( catalogTheme = catalogTheme, catalogThemeVariant = catalogThemeVariant, onThemeChange = onThemeChange, onThemeVariantChange = onThemeVariantChange, ) typographyItems() colorItems() buttonItems() selectionControlItems() imageItems() } } } @DevicePreviews @Composable internal fun CatalogContentPreview() { CatalogContent( catalogTheme = CatalogTheme.K9, catalogThemeVariant = CatalogThemeVariant.LIGHT, onThemeChange = {}, onThemeVariantChange = {}, contentPadding = PaddingValues(), ) }
app-ui-catalog/src/main/java/app/k9mail/ui/catalog/CatalogScreen.kt 0 → 100644 +50 −0 Original line number Diff line number Diff line package app.k9mail.ui.catalog import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.layout.asPaddingValues import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.systemBars import androidx.compose.runtime.Composable import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.ui.Modifier import app.k9mail.core.ui.compose.common.DevicePreviews @Composable fun CatalogScreen( modifier: Modifier = Modifier, ) { val themeState = remember { mutableStateOf(CatalogTheme.K9) } val themeVariantState = remember { mutableStateOf(CatalogThemeVariant.LIGHT) } CatalogThemeSwitch(theme = themeState.value, themeVariation = themeVariantState.value) { val contentPadding = WindowInsets.systemBars.asPaddingValues() CatalogContent( catalogTheme = themeState.value, catalogThemeVariant = themeVariantState.value, onThemeChange = { themeState.value = when (themeState.value) { CatalogTheme.K9 -> CatalogTheme.THUNDERBIRD CatalogTheme.THUNDERBIRD -> CatalogTheme.K9 } }, onThemeVariantChange = { themeVariantState.value = when (themeVariantState.value) { CatalogThemeVariant.LIGHT -> CatalogThemeVariant.DARK CatalogThemeVariant.DARK -> CatalogThemeVariant.LIGHT } }, contentPadding = contentPadding, modifier = Modifier .fillMaxSize() .then(modifier), ) } } @DevicePreviews @Composable internal fun CatalogScreenPreview() { CatalogScreen() }