diff --git a/.idea/compiler.xml b/.idea/compiler.xml
index b589d56..312bf2e 100644
--- a/.idea/compiler.xml
+++ b/.idea/compiler.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 80b22e7..412228a 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,6 +1,6 @@
-
+
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index cfdda5e..9736915 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -61,6 +61,8 @@ dependencies {
implementation("com.google.accompanist:accompanist-systemuicontroller:0.31.2-alpha")
implementation("androidx.navigation:navigation-compose:2.7.0-alpha01")
implementation("androidx.compose.material:material:1.5.0-beta01")
+ implementation("androidx.datastore:datastore:1.1.0-alpha04")
+ implementation("androidx.datastore:datastore-preferences:1.1.0-alpha04")
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.5")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
diff --git a/app/src/main/java/com/anthonyla/livewallpaper/MainActivity.kt b/app/src/main/java/com/anthonyla/livewallpaper/MainActivity.kt
index a571e98..258196c 100644
--- a/app/src/main/java/com/anthonyla/livewallpaper/MainActivity.kt
+++ b/app/src/main/java/com/anthonyla/livewallpaper/MainActivity.kt
@@ -3,15 +3,12 @@ package com.anthonyla.livewallpaper
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
-import androidx.core.view.WindowCompat
import com.anthonyla.livewallpaper.themes.LiveWallpaperTheme
import com.anthonyla.livewallpaper.ui.LiveWallpaperApp
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
- // Enable full screen app mode
- WindowCompat.setDecorFitsSystemWindows(window, false)
setContent {
LiveWallpaperTheme {
LiveWallpaperApp()
diff --git a/app/src/main/java/com/anthonyla/livewallpaper/navigation/BottomNavigationBar.kt b/app/src/main/java/com/anthonyla/livewallpaper/navigation/BottomNavigationBar.kt
index 4f508e3..a6b5cdf 100644
--- a/app/src/main/java/com/anthonyla/livewallpaper/navigation/BottomNavigationBar.kt
+++ b/app/src/main/java/com/anthonyla/livewallpaper/navigation/BottomNavigationBar.kt
@@ -1,12 +1,17 @@
package com.anthonyla.livewallpaper.navigation
+import androidx.compose.foundation.layout.RowScope
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.NavigationBar
+import androidx.compose.material3.NavigationBarDefaults
+import androidx.compose.material3.NavigationBarDefaults.containerColor
import androidx.compose.material3.NavigationBarItem
import androidx.compose.material3.Text
+import androidx.compose.material3.contentColorFor
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
+import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.navigation.NavController
@@ -25,7 +30,11 @@ fun BottomNavigationBar(
screens: List
) {
NavigationBar(
- containerColor = MaterialTheme.colorScheme.primary,
+ containerColor = containerColor,
+ contentColor = MaterialTheme.colorScheme.contentColorFor(containerColor),
+ tonalElevation = NavigationBarDefaults.Elevation,
+ windowInsets = NavigationBarDefaults.windowInsets,
+ modifier = Modifier
) {
val navBackStackEntry by navController.currentBackStackEntryAsState()
val currentDestination = navBackStackEntry?.destination
diff --git a/app/src/main/java/com/anthonyla/livewallpaper/themes/Color.kt b/app/src/main/java/com/anthonyla/livewallpaper/themes/Color.kt
index 32d8e93..2517606 100644
--- a/app/src/main/java/com/anthonyla/livewallpaper/themes/Color.kt
+++ b/app/src/main/java/com/anthonyla/livewallpaper/themes/Color.kt
@@ -1,11 +1,67 @@
package com.anthonyla.livewallpaper.themes
-
import androidx.compose.ui.graphics.Color
-val Purple80 = Color(0xFFD0BCFF)
-val PurpleGrey80 = Color(0xFFCCC2DC)
-val Pink80 = Color(0xFFEFB8C8)
+val md_theme_light_primary = Color(0xFF136D34)
+val md_theme_light_onPrimary = Color(0xFFFFFFFF)
+val md_theme_light_primaryContainer = Color(0xFFA0F6AD)
+val md_theme_light_onPrimaryContainer = Color(0xFF00210A)
+val md_theme_light_secondary = Color(0xFF506351)
+val md_theme_light_onSecondary = Color(0xFFFFFFFF)
+val md_theme_light_secondaryContainer = Color(0xFFD3E8D2)
+val md_theme_light_onSecondaryContainer = Color(0xFF0E1F11)
+val md_theme_light_tertiary = Color(0xFF39656D)
+val md_theme_light_onTertiary = Color(0xFFFFFFFF)
+val md_theme_light_tertiaryContainer = Color(0xFFBDEAF4)
+val md_theme_light_onTertiaryContainer = Color(0xFF001F24)
+val md_theme_light_error = Color(0xFFBA1A1A)
+val md_theme_light_errorContainer = Color(0xFFFFDAD6)
+val md_theme_light_onError = Color(0xFFFFFFFF)
+val md_theme_light_onErrorContainer = Color(0xFF410002)
+val md_theme_light_background = Color(0xFFFCFDF7)
+val md_theme_light_onBackground = Color(0xFF1A1C19)
+val md_theme_light_surface = Color(0xFFFCFDF7)
+val md_theme_light_onSurface = Color(0xFF1A1C19)
+val md_theme_light_surfaceVariant = Color(0xFFDDE5DA)
+val md_theme_light_onSurfaceVariant = Color(0xFF414941)
+val md_theme_light_outline = Color(0xFF727970)
+val md_theme_light_inverseOnSurface = Color(0xFFF0F1EC)
+val md_theme_light_inverseSurface = Color(0xFF2E312E)
+val md_theme_light_inversePrimary = Color(0xFF85D993)
+val md_theme_light_shadow = Color(0xFF000000)
+val md_theme_light_surfaceTint = Color(0xFF136D34)
+val md_theme_light_outlineVariant = Color(0xFFC1C9BE)
+val md_theme_light_scrim = Color(0xFF000000)
-val Purple40 = Color(0xFF6650a4)
-val PurpleGrey40 = Color(0xFF625b71)
-val Pink40 = Color(0xFF7D5260)
\ No newline at end of file
+val md_theme_dark_primary = Color(0xFF85D993)
+val md_theme_dark_onPrimary = Color(0xFF003916)
+val md_theme_dark_primaryContainer = Color(0xFF005323)
+val md_theme_dark_onPrimaryContainer = Color(0xFFA0F6AD)
+val md_theme_dark_secondary = Color(0xFFB7CCB6)
+val md_theme_dark_onSecondary = Color(0xFF233425)
+val md_theme_dark_secondaryContainer = Color(0xFF394B3B)
+val md_theme_dark_onSecondaryContainer = Color(0xFFD3E8D2)
+val md_theme_dark_tertiary = Color(0xFFA1CED7)
+val md_theme_dark_onTertiary = Color(0xFF00363E)
+val md_theme_dark_tertiaryContainer = Color(0xFF204D55)
+val md_theme_dark_onTertiaryContainer = Color(0xFFBDEAF4)
+val md_theme_dark_error = Color(0xFFFFB4AB)
+val md_theme_dark_errorContainer = Color(0xFF93000A)
+val md_theme_dark_onError = Color(0xFF690005)
+val md_theme_dark_onErrorContainer = Color(0xFFFFDAD6)
+val md_theme_dark_background = Color(0xFF1A1C19)
+val md_theme_dark_onBackground = Color(0xFFE2E3DE)
+val md_theme_dark_surface = Color(0xFF1A1C19)
+val md_theme_dark_onSurface = Color(0xFFE2E3DE)
+val md_theme_dark_surfaceVariant = Color(0xFF414941)
+val md_theme_dark_onSurfaceVariant = Color(0xFFC1C9BE)
+val md_theme_dark_outline = Color(0xFF8B9389)
+val md_theme_dark_inverseOnSurface = Color(0xFF1A1C19)
+val md_theme_dark_inverseSurface = Color(0xFFE2E3DE)
+val md_theme_dark_inversePrimary = Color(0xFF136D34)
+val md_theme_dark_shadow = Color(0xFF000000)
+val md_theme_dark_surfaceTint = Color(0xFF85D993)
+val md_theme_dark_outlineVariant = Color(0xFF414941)
+val md_theme_dark_scrim = Color(0xFF000000)
+
+
+val seed = Color(0xFFA5D0A8)
diff --git a/app/src/main/java/com/anthonyla/livewallpaper/themes/Theme.kt b/app/src/main/java/com/anthonyla/livewallpaper/themes/Theme.kt
index c203424..b8fa3e8 100644
--- a/app/src/main/java/com/anthonyla/livewallpaper/themes/Theme.kt
+++ b/app/src/main/java/com/anthonyla/livewallpaper/themes/Theme.kt
@@ -1,70 +1,90 @@
package com.anthonyla.livewallpaper.themes
-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.material3.darkColorScheme
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
-private val DarkColorScheme = darkColorScheme(
- primary = Purple80,
- secondary = PurpleGrey80,
- tertiary = Pink80
+
+private val LightColors = lightColorScheme(
+ primary = md_theme_light_primary,
+ onPrimary = md_theme_light_onPrimary,
+ primaryContainer = md_theme_light_primaryContainer,
+ onPrimaryContainer = md_theme_light_onPrimaryContainer,
+ secondary = md_theme_light_secondary,
+ onSecondary = md_theme_light_onSecondary,
+ secondaryContainer = md_theme_light_secondaryContainer,
+ onSecondaryContainer = md_theme_light_onSecondaryContainer,
+ tertiary = md_theme_light_tertiary,
+ onTertiary = md_theme_light_onTertiary,
+ tertiaryContainer = md_theme_light_tertiaryContainer,
+ onTertiaryContainer = md_theme_light_onTertiaryContainer,
+ error = md_theme_light_error,
+ errorContainer = md_theme_light_errorContainer,
+ onError = md_theme_light_onError,
+ onErrorContainer = md_theme_light_onErrorContainer,
+ background = md_theme_light_background,
+ onBackground = md_theme_light_onBackground,
+ surface = md_theme_light_surface,
+ onSurface = md_theme_light_onSurface,
+ surfaceVariant = md_theme_light_surfaceVariant,
+ onSurfaceVariant = md_theme_light_onSurfaceVariant,
+ outline = md_theme_light_outline,
+ inverseOnSurface = md_theme_light_inverseOnSurface,
+ inverseSurface = md_theme_light_inverseSurface,
+ inversePrimary = md_theme_light_inversePrimary,
+ surfaceTint = md_theme_light_surfaceTint,
+ outlineVariant = md_theme_light_outlineVariant,
+ scrim = md_theme_light_scrim,
)
-private val LightColorScheme = lightColorScheme(
- primary = Purple40,
- secondary = PurpleGrey40,
- tertiary = Pink40
- /* Other default colors to override
- background = Color(0xFFFFFBFE),
- surface = Color(0xFFFFFBFE),
- onPrimary = Color.White,
- onSecondary = Color.White,
- onTertiary = Color.White,
- onBackground = Color(0xFF1C1B1F),
- onSurface = Color(0xFF1C1B1F),
- */
+private val DarkColors = darkColorScheme(
+ primary = md_theme_dark_primary,
+ onPrimary = md_theme_dark_onPrimary,
+ primaryContainer = md_theme_dark_primaryContainer,
+ onPrimaryContainer = md_theme_dark_onPrimaryContainer,
+ secondary = md_theme_dark_secondary,
+ onSecondary = md_theme_dark_onSecondary,
+ secondaryContainer = md_theme_dark_secondaryContainer,
+ onSecondaryContainer = md_theme_dark_onSecondaryContainer,
+ tertiary = md_theme_dark_tertiary,
+ onTertiary = md_theme_dark_onTertiary,
+ tertiaryContainer = md_theme_dark_tertiaryContainer,
+ onTertiaryContainer = md_theme_dark_onTertiaryContainer,
+ error = md_theme_dark_error,
+ errorContainer = md_theme_dark_errorContainer,
+ onError = md_theme_dark_onError,
+ onErrorContainer = md_theme_dark_onErrorContainer,
+ background = md_theme_dark_background,
+ onBackground = md_theme_dark_onBackground,
+ surface = md_theme_dark_surface,
+ onSurface = md_theme_dark_onSurface,
+ surfaceVariant = md_theme_dark_surfaceVariant,
+ onSurfaceVariant = md_theme_dark_onSurfaceVariant,
+ outline = md_theme_dark_outline,
+ inverseOnSurface = md_theme_dark_inverseOnSurface,
+ inverseSurface = md_theme_dark_inverseSurface,
+ inversePrimary = md_theme_dark_inversePrimary,
+ surfaceTint = md_theme_dark_surfaceTint,
+ outlineVariant = md_theme_dark_outlineVariant,
+ scrim = md_theme_dark_scrim,
)
@Composable
fun LiveWallpaperTheme(
- darkTheme: Boolean = isSystemInDarkTheme(),
- // Dynamic color is available on Android 12+
- dynamicColor: Boolean = true,
- content: @Composable () -> Unit
+ useDarkTheme: Boolean = isSystemInDarkTheme(),
+ 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)
- }
+ val colors = if (!useDarkTheme) {
+ LightColors
+ } else {
+ DarkColors
+ }
- 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(
- colorScheme = colorScheme,
- typography = Typography,
- content = content
- )
+ MaterialTheme(
+ colorScheme = colors,
+ content = content
+ )
}
\ No newline at end of file
diff --git a/app/src/main/java/com/anthonyla/livewallpaper/ui/LiveWallpaperApp.kt b/app/src/main/java/com/anthonyla/livewallpaper/ui/LiveWallpaperApp.kt
index 36aef4a..2ce2884 100644
--- a/app/src/main/java/com/anthonyla/livewallpaper/ui/LiveWallpaperApp.kt
+++ b/app/src/main/java/com/anthonyla/livewallpaper/ui/LiveWallpaperApp.kt
@@ -1,5 +1,6 @@
package com.anthonyla.livewallpaper.ui
+import android.app.Activity
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Scaffold
@@ -7,6 +8,9 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.SideEffect
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.graphics.toArgb
+import androidx.compose.ui.platform.LocalView
+import androidx.core.view.WindowCompat
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.rememberNavController
import com.anthonyla.livewallpaper.navigation.BottomNavScreens
@@ -17,15 +21,7 @@ import com.google.accompanist.systemuicontroller.rememberSystemUiController
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun LiveWallpaperApp(modifier: Modifier = Modifier) {
- // Transparent status bar
- val systemUiController = rememberSystemUiController()
- SideEffect {
- systemUiController.setStatusBarColor(
- color = Color.Transparent,
- // check if app is in dark mode or not
- darkIcons = false
- )
- }
+ SetTransparentSystemBars()
// Bottom navigation
val navController = rememberNavController()
@@ -47,4 +43,20 @@ fun LiveWallpaperApp(modifier: Modifier = Modifier) {
bottomNav(navController)
}
}
+}
+
+@Composable
+fun SetTransparentSystemBars() {
+ val systemUiController = rememberSystemUiController()
+ val view = LocalView.current
+ SideEffect {
+ with(view.context as Activity) {
+ WindowCompat.setDecorFitsSystemWindows(window, false)
+ systemUiController.setSystemBarsColor(
+ color = Color.Transparent,
+ // check if app is in dark mode or not
+ darkIcons = false
+ )
+ }
+ }
}
\ No newline at end of file