-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
83 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
app/src/main/java/com/rokoblak/chatbackup/ui/theme/AppThemePreviews.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package com.rokoblak.chatbackup.ui.theme | ||
|
||
class AppThemePreviews { | ||
} |
70 changes: 0 additions & 70 deletions
70
app/src/main/java/com/rokoblak/chatbackup/ui/theme/AppTypography.kt
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
app/src/main/java/com/rokoblak/chatbackup/ui/theme/Shape.kt
This file was deleted.
Oops, something went wrong.
52 changes: 35 additions & 17 deletions
52
app/src/main/java/com/rokoblak/chatbackup/ui/theme/Theme.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,61 @@ | ||
package com.rokoblak.chatbackup.ui.theme | ||
|
||
import android.app.Activity | ||
import androidx.compose.foundation.isSystemInDarkTheme | ||
import androidx.compose.material.MaterialTheme | ||
import androidx.compose.material.darkColors | ||
import androidx.compose.material.lightColors | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.material3.darkColorScheme | ||
import androidx.compose.material3.lightColorScheme | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.SideEffect | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.graphics.toArgb | ||
import androidx.compose.ui.platform.LocalView | ||
import androidx.core.view.WindowCompat | ||
|
||
private val DarkColorPalette = darkColors( | ||
private val DarkColorScheme = darkColorScheme( | ||
primary = PrimaryDark, | ||
primaryVariant = PrimaryVariantDark, | ||
secondary = SecondaryDark, | ||
onPrimary = Color.White, | ||
tertiary = SecondaryDark, | ||
primaryContainer = Color(0xFF292929), | ||
) | ||
|
||
private val LightColorPalette = lightColors( | ||
private val LightColorScheme = lightColorScheme( | ||
primary = PrimaryLight, | ||
primaryVariant = PrimaryVariantLight, | ||
secondary = SecondaryLight, | ||
onPrimary = Color.Black, | ||
background = Color(0xFFFAFDFF), | ||
tertiary = SecondaryLight, | ||
primaryContainer = Color(0xFFE6E6E6), | ||
|
||
) | ||
|
||
@Composable | ||
fun ChatBackupTheme( | ||
overrideDarkMode: Boolean? = null, | ||
darkTheme: Boolean = overrideDarkMode ?: isSystemInDarkTheme(), | ||
// Dynamic color is available on Android 12+ | ||
dynamicColor: Boolean = true, | ||
content: @Composable () -> Unit | ||
) { | ||
val colors = if (darkTheme) { | ||
DarkColorPalette | ||
} else { | ||
LightColorPalette | ||
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 | ||
} | ||
} | ||
|
||
MaterialTheme( | ||
colors = colors, | ||
typography = ChatBackupTypography, | ||
shapes = Shapes, | ||
colorScheme = colorScheme, | ||
typography = Typography, | ||
content = content | ||
) | ||
} |
34 changes: 34 additions & 0 deletions
34
app/src/main/java/com/rokoblak/chatbackup/ui/theme/Type.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.rokoblak.chatbackup.ui.theme | ||
|
||
import androidx.compose.material3.Typography | ||
import androidx.compose.ui.text.TextStyle | ||
import androidx.compose.ui.text.font.FontFamily | ||
import androidx.compose.ui.text.font.FontWeight | ||
import androidx.compose.ui.unit.sp | ||
|
||
// Set of Material typography styles to start with | ||
val Typography = Typography( | ||
bodyLarge = TextStyle( | ||
fontFamily = FontFamily.Default, | ||
fontWeight = FontWeight.Normal, | ||
fontSize = 16.sp, | ||
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 | ||
) | ||
*/ | ||
) |