Skip to content
Merged
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
2 changes: 2 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,6 @@ dependencies {
implementation(Libs.Common.arrowCore)
//----------------------------------------------------------------------------------------------
implementation(Libs.Common.coil)
//----------------------------------------------------------------------------------------------
implementation(Libs.Common.material)
}
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
package com.example.composecodechallenge.main.ui.theme

import android.app.Activity
import android.os.Build
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.darkColorScheme
import androidx.compose.material3.dynamicDarkColorScheme
import androidx.compose.material3.dynamicLightColorScheme
import androidx.compose.material3.lightColorScheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.SideEffect
import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalView
import androidx.core.view.WindowCompat
import androidx.compose.ui.graphics.Color

val LightColorScheme = lightColorScheme(
Expand Down Expand Up @@ -75,27 +66,10 @@ val DarkColorScheme = darkColorScheme(
@Composable
fun ItollTheme(
darkTheme: Boolean = isSystemInDarkTheme(),
// Dynamic color is available on Android 12+
dynamicColor: Boolean = true,
content: @Composable () -> Unit
) {
val colorScheme = when {
dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> {
val context = LocalContext.current
if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context)
}

darkTheme -> DarkColorScheme
else -> LightColorScheme
}
val view = LocalView.current
if (!view.isInEditMode) {
SideEffect {
val window = (view.context as Activity).window
window.statusBarColor = colorScheme.primary.toArgb()
WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = darkTheme
}
}
val colorScheme = if (darkTheme) DarkColorScheme else LightColorScheme

MaterialTheme(
colorScheme = colorScheme,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,4 @@ val Typography = Typography(
lineHeight = 24.sp,
letterSpacing = 0.5.sp
)
/* Other default text styles to override
titleLarge = TextStyle(
fontFamily = FontFamily.Default,
fontWeight = FontWeight.Normal,
fontSize = 22.sp,
lineHeight = 28.sp,
letterSpacing = 0.sp
),
labelSmall = TextStyle(
fontFamily = FontFamily.Default,
fontWeight = FontWeight.Medium,
fontSize = 11.sp,
lineHeight = 16.sp,
letterSpacing = 0.5.sp
)
*/
)
2 changes: 1 addition & 1 deletion app/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>

<style name="Theme.ComposeCodeChallenge" parent="android:Theme.Material.Light.NoActionBar" />
<style name="Theme.ComposeCodeChallenge" parent="Theme.Material3.DayNight.NoActionBar" />
</resources>
1 change: 1 addition & 0 deletions buildSrc/src/main/java/com/example/buildsrc/Libs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ object Libs {
const val stetho_OkHttp = "com.facebook.stetho:stetho-okhttp3:${Versions.stetho}"
const val arrowCore = "io.arrow-kt:arrow-core:${Versions.arrow}"
const val coil = "io.coil-kt:coil-compose:${Versions.coil}"
const val material = "com.google.android.material:material:${Versions.material}"
}

object Testing {
Expand Down
1 change: 1 addition & 0 deletions buildSrc/src/main/java/com/example/buildsrc/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ object Versions {
const val junit = "4.13.2"
const val junitEx = "1.1.5"
const val espresso = "3.5.1"
const val material = "1.9.0"
}