mirror of
https://github.com/Aviortheking/Neo-Store.git
synced 2025-04-23 19:32:16 +00:00
Add: App's compose themes
This commit is contained in:
parent
b994df4ede
commit
cfa68524f3
@ -44,7 +44,7 @@ val DarkOnError = Color(0xFF680003)
|
||||
val DarkOnErrorContainer = Color(0xFFFFDAD4)
|
||||
val DarkBackground = Color(0xFF191C1A)
|
||||
val DarkOnBackground = Color(0xFFE1E3DE)
|
||||
val DarkSurface = Color(0xFF191C1A)
|
||||
val DarkSurface = Color(0xFF2C2C2C)
|
||||
val DarkOnSurface = Color(0xFFE1E3DE)
|
||||
val DarkSurfaceVariant = Color(0xFF414942)
|
||||
val DarkOnSurfaceVariant = Color(0xFFC0C9C0)
|
||||
@ -53,5 +53,9 @@ val DarkInversePrimary = Color(0xFFE1E3DE)
|
||||
val DarkInverseSurface = Color(0xFF191C1A)
|
||||
val DarkInverseOnSurface = Color(0xFF006D3E)
|
||||
|
||||
// Black Theme
|
||||
val BlackBackground = Color(0xFF000000)
|
||||
val BlackSurface = Color(0xFF191C1A)
|
||||
|
||||
val Seed = Color(0xFF51DF93)
|
||||
|
||||
|
@ -0,0 +1,64 @@
|
||||
package com.looker.droidify.ui.compose.theme
|
||||
|
||||
import androidx.compose.foundation.isSystemInDarkTheme
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.darkColors
|
||||
import androidx.compose.material.lightColors
|
||||
import androidx.compose.runtime.Composable
|
||||
import com.looker.droidify.utility.isBlackTheme
|
||||
|
||||
@Composable
|
||||
fun AppTheme(
|
||||
darkTheme: Boolean = isSystemInDarkTheme(),
|
||||
blackTheme: Boolean = isBlackTheme,
|
||||
content: @Composable () -> Unit
|
||||
) {
|
||||
MaterialTheme(
|
||||
shapes = AppShapes,
|
||||
colors = when {
|
||||
darkTheme && blackTheme -> BlackColors
|
||||
darkTheme -> DarkColors
|
||||
else -> LightColors
|
||||
},
|
||||
content = content
|
||||
)
|
||||
}
|
||||
|
||||
private val LightColors = lightColors(
|
||||
primary = LightPrimary,
|
||||
primaryVariant = LightPrimaryContainer,
|
||||
onPrimary = LightOnPrimary,
|
||||
secondary = LightSecondary,
|
||||
secondaryVariant = LightSecondaryContainer,
|
||||
onSecondary = LightOnSecondary,
|
||||
surface = LightSurface,
|
||||
background = LightBackground,
|
||||
onBackground = LightOnBackground,
|
||||
error = LightError
|
||||
)
|
||||
|
||||
private val DarkColors = darkColors(
|
||||
primary = DarkPrimary,
|
||||
primaryVariant = DarkPrimaryContainer,
|
||||
onPrimary = DarkOnPrimary,
|
||||
secondary = DarkSecondary,
|
||||
secondaryVariant = DarkSecondaryContainer,
|
||||
onSecondary = DarkOnSecondary,
|
||||
surface = DarkSurface,
|
||||
background = DarkBackground,
|
||||
onBackground = DarkOnBackground,
|
||||
error = DarkError
|
||||
)
|
||||
|
||||
private val BlackColors = darkColors(
|
||||
primary = DarkPrimary,
|
||||
primaryVariant = DarkPrimaryContainer,
|
||||
onPrimary = DarkOnPrimary,
|
||||
secondary = DarkSecondary,
|
||||
secondaryVariant = DarkSecondaryContainer,
|
||||
onSecondary = DarkOnSecondary,
|
||||
surface = BlackSurface,
|
||||
background = BlackBackground,
|
||||
onBackground = DarkOnBackground,
|
||||
error = DarkError
|
||||
)
|
@ -8,8 +8,6 @@ import android.content.pm.PackageInfo
|
||||
import android.content.pm.Signature
|
||||
import android.content.res.Configuration
|
||||
import android.graphics.drawable.Drawable
|
||||
import androidx.recyclerview.widget.AsyncDifferConfig
|
||||
import androidx.recyclerview.widget.DiffUtil
|
||||
import com.fasterxml.jackson.core.JsonGenerator
|
||||
import com.fasterxml.jackson.core.JsonParser
|
||||
import com.looker.droidify.BuildConfig
|
||||
@ -194,21 +192,17 @@ fun jsonGenerate(callback: (JsonGenerator) -> Unit): ByteArray {
|
||||
return outputStream.toByteArray()
|
||||
}
|
||||
|
||||
val PRODUCT_ASYNC_DIFFER_CONFIG
|
||||
get() = AsyncDifferConfig.Builder(object :
|
||||
DiffUtil.ItemCallback<com.looker.droidify.database.entity.Product>() {
|
||||
override fun areItemsTheSame(
|
||||
oldItem: com.looker.droidify.database.entity.Product,
|
||||
newItem: com.looker.droidify.database.entity.Product
|
||||
): Boolean {
|
||||
return oldItem.repository_id == newItem.repository_id
|
||||
&& oldItem.package_name == newItem.package_name
|
||||
}
|
||||
val isDarkTheme: Boolean
|
||||
get() = when (Preferences[Preferences.Key.Theme]) {
|
||||
is Preferences.Theme.Light -> false
|
||||
is Preferences.Theme.Dark -> true
|
||||
is Preferences.Theme.Amoled -> true
|
||||
else -> false
|
||||
}
|
||||
|
||||
override fun areContentsTheSame(
|
||||
oldItem: com.looker.droidify.database.entity.Product,
|
||||
newItem: com.looker.droidify.database.entity.Product
|
||||
): Boolean {
|
||||
return oldItem.item == newItem.item
|
||||
}
|
||||
}).build()
|
||||
val isBlackTheme: Boolean
|
||||
get() = when (Preferences[Preferences.Key.Theme]) {
|
||||
is Preferences.Theme.Amoled -> true
|
||||
is Preferences.Theme.AmoledSystem -> true
|
||||
else -> false
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user