Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP theme screen #501

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ private fun items(
)
add(DebugItem.Header("Logs"))
add(DebugItem.Element.ButtonElement("Show logs", LogsModal))
add(DebugItem.Element.ButtonElement("Theme Screen", ThemeScreen))
add(
DebugItem.Element.ButtonElement(
"Leak Analysis",
Expand Down
182 changes: 182 additions & 0 deletions app/src/debug/kotlin/io/sweers/catchup/ui/debug/ThemeScreen.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
package io.sweers.catchup.ui.debug

import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.background
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.systemBarsPadding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.material3.Divider
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Switch
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.slack.circuit.CircuitUiState
import com.slack.circuit.Screen
import com.slack.circuit.codegen.annotations.CircuitInject
import dev.zacsweers.catchup.compose.CatchUpTheme
import dev.zacsweers.catchup.di.AppScope
import kotlinx.parcelize.Parcelize

@Parcelize
object ThemeScreen : Screen {
object State : CircuitUiState
}

@CircuitInject(ThemeScreen::class, AppScope::class)
@Composable
fun ThemeScreenPresenter() = ThemeScreen.State

@CircuitInject(ThemeScreen::class, AppScope::class)
@OptIn(ExperimentalFoundationApi::class)
@Composable
fun ThemeScreenUI(modifier: Modifier) {
val isInDarkMode = isSystemInDarkTheme()
var darkMode by remember { mutableStateOf(isInDarkMode) }
CatchUpTheme(darkMode) {
LazyColumn(modifier.fillMaxWidth().systemBarsPadding()) {
stickyHeader {
Row(Modifier.fillParentMaxWidth().padding(16.dp)) {
Text("Dark mode")
Spacer(Modifier.weight(1f))
Switch(checked = darkMode, onCheckedChange = { darkMode = it })
}
}
item {
Column(
Modifier.fillParentMaxWidth()
.background(MaterialTheme.colorScheme.primaryContainer)
.padding(16.dp)
) {
Text(
"(primaryContainer)\nonPrimaryContainer",
color = MaterialTheme.colorScheme.onPrimaryContainer
)
Column(
Modifier.fillParentMaxWidth()
.background(MaterialTheme.colorScheme.primary)
.padding(16.dp)
) {
Text("(primary)\nonPrimary", color = MaterialTheme.colorScheme.onPrimary)
}
}
}
item {
Column(
Modifier.fillParentMaxWidth()
.background(MaterialTheme.colorScheme.secondaryContainer)
.padding(16.dp)
) {
Text(
"(secondaryContainer)\nonSecondaryContainer",
color = MaterialTheme.colorScheme.onSecondaryContainer
)
Column(
Modifier.fillParentMaxWidth()
.background(MaterialTheme.colorScheme.secondary)
.padding(16.dp)
) {
Text("(secondary)\nonSecondary", color = MaterialTheme.colorScheme.onSecondary)
}
}
}
item {
Column(
Modifier.fillParentMaxWidth()
.background(MaterialTheme.colorScheme.tertiaryContainer)
.padding(16.dp)
) {
Text(
"(tertiaryContainer)\nonTertiaryContainer",
color = MaterialTheme.colorScheme.onTertiaryContainer
)
Column(
Modifier.fillParentMaxWidth()
.background(MaterialTheme.colorScheme.tertiary)
.padding(16.dp)
) {
Text("(tertiary)\nonTertiary", color = MaterialTheme.colorScheme.onTertiary)
}
}
}
item {
Column(
Modifier.fillParentMaxWidth()
.background(MaterialTheme.colorScheme.errorContainer)
.padding(16.dp)
) {
Text(
"(errorContainer)\nonErrorContainer",
color = MaterialTheme.colorScheme.onErrorContainer
)
Column(
Modifier.fillParentMaxWidth().background(MaterialTheme.colorScheme.error).padding(16.dp)
) {
Text("(error)\nonError", color = MaterialTheme.colorScheme.onError)
}
}
}
item {
Column(
Modifier.fillParentMaxWidth()
.background(MaterialTheme.colorScheme.surfaceVariant)
.padding(16.dp)
) {
Text(
"(surfaceVariant)\nonSurfaceVariant",
color = MaterialTheme.colorScheme.onSurfaceVariant
)
Column(
Modifier.fillParentMaxWidth()
.background(MaterialTheme.colorScheme.surface)
.padding(16.dp)
) {
Text("(surface)\nonSurface", color = MaterialTheme.colorScheme.onSurface)
Text("surfaceTint", color = MaterialTheme.colorScheme.surfaceTint)
}
}
}
item {
Column(
Modifier.fillParentMaxWidth()
.background(MaterialTheme.colorScheme.inverseSurface)
.padding(16.dp)
) {
Text(
"(inverseSurface)\ninverseOnSurface",
color = MaterialTheme.colorScheme.inverseOnSurface
)
}
}
item {
Column {
Divider(
Modifier.fillParentMaxWidth(),
thickness = 5.dp,
color = MaterialTheme.colorScheme.outline
)
Divider(
Modifier.fillParentMaxWidth(),
thickness = 5.dp,
color = MaterialTheme.colorScheme.outlineVariant
)
}
}
}
}
// md_theme_light_background
// md_theme_light_onBackground
// md_theme_light_inversePrimary
// md_theme_light_shadow
// md_theme_light_scrim
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ import androidx.compose.ui.graphics.Color

val md_theme_light_primary = Color(0xFFB72200)
val md_theme_light_onPrimary = Color(0xFFFFFFFF)
val md_theme_light_primaryContainer = Color(0xFFFFDAD3)
val md_theme_light_primaryContainer = Color(0xFFFFFFFF)
val md_theme_light_onPrimaryContainer = Color(0xFF3E0500)
val md_theme_light_secondary = Color(0xFFB72200)
val md_theme_light_onSecondary = Color(0xFFFFFFFF)
val md_theme_light_secondaryContainer = Color(0xFFFFDAD3)
val md_theme_light_secondaryContainer = Color(0xFFFFFFFF)
val md_theme_light_onSecondaryContainer = Color(0xFF3E0500)
val md_theme_light_tertiary = Color(0xFFB72200)
val md_theme_light_onTertiary = Color(0xFFFFFFFF)
val md_theme_light_tertiaryContainer = Color(0xFFFFDAD3)
val md_theme_light_tertiaryContainer = Color(0xFFFFFFFF)
val md_theme_light_onTertiaryContainer = Color(0xFF3E0500)
val md_theme_light_error = Color(0xFFBA1A1A)
val md_theme_light_errorContainer = Color(0xFFFFDAD6)
val md_theme_light_errorContainer = Color(0xFFFFFFFF)
val md_theme_light_onError = Color(0xFFFFFFFF)
val md_theme_light_onErrorContainer = Color(0xFF410002)
val md_theme_light_background = Color(0xFFF9F9F9)
val md_theme_light_background = Color(0xFFFFFFFF)
val md_theme_light_onBackground = Color(0xFF201A19)
val md_theme_light_surface = Color(0xFFFFFFFF)
val md_theme_light_onSurface = Color(0xFF201A19)
Expand Down