mirror of
https://github.com/Myzel394/NumberHub.git
synced 2025-06-18 16:25:27 +02:00
parent
050c0dbe1d
commit
a692b46e7a
@ -73,7 +73,7 @@ data class AppPreferences(
|
|||||||
val enableDynamicTheme: Boolean = true,
|
val enableDynamicTheme: Boolean = true,
|
||||||
val enableAmoledTheme: Boolean = false,
|
val enableAmoledTheme: Boolean = false,
|
||||||
val customColor: Color = Color.Unspecified,
|
val customColor: Color = Color.Unspecified,
|
||||||
val monetMode: MonetMode = MonetMode.values().first(),
|
val monetMode: MonetMode = MonetMode.TonalSpot,
|
||||||
val startingScreen: String = TopLevelDestinations.Calculator.graph,
|
val startingScreen: String = TopLevelDestinations.Calculator.graph,
|
||||||
val enableToolsExperiment: Boolean = false,
|
val enableToolsExperiment: Boolean = false,
|
||||||
val systemFont: Boolean = false,
|
val systemFont: Boolean = false,
|
||||||
@ -152,7 +152,7 @@ class UserPreferencesRepository @Inject constructor(private val dataStore: DataS
|
|||||||
customColor = preferences[PrefsKeys.CUSTOM_COLOR]?.letTryOrNull { Color(it.toULong()) }
|
customColor = preferences[PrefsKeys.CUSTOM_COLOR]?.letTryOrNull { Color(it.toULong()) }
|
||||||
?: Color.Unspecified,
|
?: Color.Unspecified,
|
||||||
monetMode = preferences[PrefsKeys.MONET_MODE]?.letTryOrNull { MonetMode.valueOf(it) }
|
monetMode = preferences[PrefsKeys.MONET_MODE]?.letTryOrNull { MonetMode.valueOf(it) }
|
||||||
?: MonetMode.values().first(),
|
?: MonetMode.TonalSpot,
|
||||||
startingScreen = preferences[PrefsKeys.STARTING_SCREEN]
|
startingScreen = preferences[PrefsKeys.STARTING_SCREEN]
|
||||||
?: TopLevelDestinations.Calculator.graph,
|
?: TopLevelDestinations.Calculator.graph,
|
||||||
enableToolsExperiment = preferences[PrefsKeys.ENABLE_TOOLS_EXPERIMENT] ?: false,
|
enableToolsExperiment = preferences[PrefsKeys.ENABLE_TOOLS_EXPERIMENT] ?: false,
|
||||||
|
@ -55,25 +55,23 @@ internal fun ColorSelector(
|
|||||||
selected: Color,
|
selected: Color,
|
||||||
onItemClick: (Color) -> Unit,
|
onItemClick: (Color) -> Unit,
|
||||||
colorSchemes: List<Color>,
|
colorSchemes: List<Color>,
|
||||||
defaultColor: Color? = null
|
defaultColor: Color
|
||||||
) {
|
) {
|
||||||
LazyRow(
|
LazyRow(
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
horizontalArrangement = Arrangement.spacedBy(8.dp)
|
horizontalArrangement = Arrangement.spacedBy(8.dp)
|
||||||
) {
|
) {
|
||||||
if (defaultColor != null) {
|
// Default, Unitto colors
|
||||||
// Default, Unitto colors
|
item(defaultColor.value.toLong()) {
|
||||||
item {
|
ColorCheckbox(
|
||||||
ColorCheckbox(
|
color = defaultColor,
|
||||||
color = defaultColor,
|
selected = Color.Unspecified == selected,
|
||||||
selected = Color.Unspecified == selected,
|
onClick = { onItemClick(Color.Unspecified) }
|
||||||
onClick = { onItemClick(Color.Unspecified) }
|
)
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
colorSchemes.forEach {
|
colorSchemes.forEach {
|
||||||
item {
|
item(it.value.toLong()) {
|
||||||
ColorCheckbox(
|
ColorCheckbox(
|
||||||
color = it,
|
color = it,
|
||||||
selected = it == selected,
|
selected = it == selected,
|
||||||
|
@ -0,0 +1,186 @@
|
|||||||
|
/*
|
||||||
|
* Unitto is a unit converter for Android
|
||||||
|
* Copyright (c) 2023 Elshan Agaev
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.sadellie.unitto.feature.settings.display
|
||||||
|
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
|
||||||
|
internal val colorSchemes: List<Color> by lazy {
|
||||||
|
listOf(
|
||||||
|
Color(0xFFe8f8f5),
|
||||||
|
Color(0xFFd1f2eb),
|
||||||
|
Color(0xFFa3e4d7),
|
||||||
|
Color(0xFF76d7c4),
|
||||||
|
Color(0xFF48c9b0),
|
||||||
|
Color(0xFF1abc9c),
|
||||||
|
Color(0xFF17a589),
|
||||||
|
Color(0xFF148f77),
|
||||||
|
Color(0xFF117864),
|
||||||
|
Color(0xFF0e6251),
|
||||||
|
Color(0xFFe8f6f3),
|
||||||
|
Color(0xFFd0ece7),
|
||||||
|
Color(0xFFa2d9ce),
|
||||||
|
Color(0xFF73c6b6),
|
||||||
|
Color(0xFF45b39d),
|
||||||
|
Color(0xFF16a085),
|
||||||
|
Color(0xFF138d75),
|
||||||
|
Color(0xFF117a65),
|
||||||
|
Color(0xFF0e6655),
|
||||||
|
Color(0xFF0b5345),
|
||||||
|
Color(0xFFeafaf1),
|
||||||
|
Color(0xFFd5f5e3),
|
||||||
|
Color(0xFFabebc6),
|
||||||
|
Color(0xFF82e0aa),
|
||||||
|
Color(0xFF58d68d),
|
||||||
|
Color(0xFF2ecc71),
|
||||||
|
Color(0xFF28b463),
|
||||||
|
Color(0xFF239b56),
|
||||||
|
Color(0xFF1d8348),
|
||||||
|
Color(0xFF186a3b),
|
||||||
|
Color(0xFFe9f7ef),
|
||||||
|
Color(0xFFd4efdf),
|
||||||
|
Color(0xFFa9dfbf),
|
||||||
|
Color(0xFF7dcea0),
|
||||||
|
Color(0xFF52be80),
|
||||||
|
Color(0xFF27ae60),
|
||||||
|
Color(0xFF229954),
|
||||||
|
Color(0xFF1e8449),
|
||||||
|
Color(0xFF196f3d),
|
||||||
|
Color(0xFF145a32),
|
||||||
|
Color(0xFFebf5fb),
|
||||||
|
Color(0xFFd6eaf8),
|
||||||
|
Color(0xFFaed6f1),
|
||||||
|
Color(0xFF85c1e9),
|
||||||
|
Color(0xFF5dade2),
|
||||||
|
Color(0xFF3498db),
|
||||||
|
Color(0xFF2e86c1),
|
||||||
|
Color(0xFF2874a6),
|
||||||
|
Color(0xFF21618c),
|
||||||
|
Color(0xFF1b4f72),
|
||||||
|
Color(0xFFeaf2f8),
|
||||||
|
Color(0xFFd4e6f1),
|
||||||
|
Color(0xFFa9cce3),
|
||||||
|
Color(0xFF7fb3d5),
|
||||||
|
Color(0xFF5499c7),
|
||||||
|
Color(0xFF2980b9),
|
||||||
|
Color(0xFF2471a3),
|
||||||
|
Color(0xFF1f618d),
|
||||||
|
Color(0xFF1a5276),
|
||||||
|
Color(0xFF154360),
|
||||||
|
Color(0xFFf5eef8),
|
||||||
|
Color(0xFFebdef0),
|
||||||
|
Color(0xFFd7bde2),
|
||||||
|
Color(0xFFc39bd3),
|
||||||
|
Color(0xFFaf7ac5),
|
||||||
|
Color(0xFF9b59b6),
|
||||||
|
Color(0xFF884ea0),
|
||||||
|
Color(0xFF76448a),
|
||||||
|
Color(0xFF633974),
|
||||||
|
Color(0xFF512e5f),
|
||||||
|
Color(0xFFf4ecf7),
|
||||||
|
Color(0xFFe8daef),
|
||||||
|
Color(0xFFd2b4de),
|
||||||
|
Color(0xFFbb8fce),
|
||||||
|
Color(0xFFa569bd),
|
||||||
|
Color(0xFF8e44ad),
|
||||||
|
Color(0xFF7d3c98),
|
||||||
|
Color(0xFF6c3483),
|
||||||
|
Color(0xFF5b2c6f),
|
||||||
|
Color(0xFF4a235a),
|
||||||
|
Color(0xFFebedef),
|
||||||
|
Color(0xFFd6dbdf),
|
||||||
|
Color(0xFFaeb6bf),
|
||||||
|
Color(0xFF85929e),
|
||||||
|
Color(0xFF5d6d7e),
|
||||||
|
Color(0xFF34495e),
|
||||||
|
Color(0xFF2e4053),
|
||||||
|
Color(0xFF283747),
|
||||||
|
Color(0xFF212f3c),
|
||||||
|
Color(0xFF1b2631),
|
||||||
|
Color(0xFFeaecee),
|
||||||
|
Color(0xFFd5d8dc),
|
||||||
|
Color(0xFFabb2b9),
|
||||||
|
Color(0xFF808b96),
|
||||||
|
Color(0xFF566573),
|
||||||
|
Color(0xFF2c3e50),
|
||||||
|
Color(0xFF273746),
|
||||||
|
Color(0xFF212f3d),
|
||||||
|
Color(0xFF1c2833),
|
||||||
|
Color(0xFF17202a),
|
||||||
|
Color(0xFFfef9e7),
|
||||||
|
Color(0xFFfcf3cf),
|
||||||
|
Color(0xFFf9e79f),
|
||||||
|
Color(0xFFf7dc6f),
|
||||||
|
Color(0xFFf4d03f),
|
||||||
|
Color(0xFFf1c40f),
|
||||||
|
Color(0xFFd4ac0d),
|
||||||
|
Color(0xFFb7950b),
|
||||||
|
Color(0xFF9a7d0a),
|
||||||
|
Color(0xFF7d6608),
|
||||||
|
Color(0xFFfef5e7),
|
||||||
|
Color(0xFFfdebd0),
|
||||||
|
Color(0xFFfad7a0),
|
||||||
|
Color(0xFFf8c471),
|
||||||
|
Color(0xFFf5b041),
|
||||||
|
Color(0xFFf39c12),
|
||||||
|
Color(0xFFd68910),
|
||||||
|
Color(0xFFb9770e),
|
||||||
|
Color(0xFF9c640c),
|
||||||
|
Color(0xFF7e5109),
|
||||||
|
Color(0xFFfdf2e9),
|
||||||
|
Color(0xFFfae5d3),
|
||||||
|
Color(0xFFf5cba7),
|
||||||
|
Color(0xFFf0b27a),
|
||||||
|
Color(0xFFeb984e),
|
||||||
|
Color(0xFFe67e22),
|
||||||
|
Color(0xFFca6f1e),
|
||||||
|
Color(0xFFaf601a),
|
||||||
|
Color(0xFF935116),
|
||||||
|
Color(0xFF784212),
|
||||||
|
Color(0xFFfbeee6),
|
||||||
|
Color(0xFFf6ddcc),
|
||||||
|
Color(0xFFedbb99),
|
||||||
|
Color(0xFFe59866),
|
||||||
|
Color(0xFFdc7633),
|
||||||
|
Color(0xFFd35400),
|
||||||
|
Color(0xFFba4a00),
|
||||||
|
Color(0xFFa04000),
|
||||||
|
Color(0xFF873600),
|
||||||
|
Color(0xFF6e2c00),
|
||||||
|
Color(0xFFfdedec),
|
||||||
|
Color(0xFFfadbd8),
|
||||||
|
Color(0xFFf5b7b1),
|
||||||
|
Color(0xFFf1948a),
|
||||||
|
Color(0xFFec7063),
|
||||||
|
Color(0xFFe74c3c),
|
||||||
|
Color(0xFFcb4335),
|
||||||
|
Color(0xFFb03a2e),
|
||||||
|
Color(0xFF943126),
|
||||||
|
Color(0xFF78281f),
|
||||||
|
Color(0xFFf9ebea),
|
||||||
|
Color(0xFFf2d7d5),
|
||||||
|
Color(0xFFe6b0aa),
|
||||||
|
Color(0xFFd98880),
|
||||||
|
Color(0xFFcd6155),
|
||||||
|
Color(0xFFc0392b),
|
||||||
|
Color(0xFFa93226),
|
||||||
|
Color(0xFF922b21),
|
||||||
|
Color(0xFF7b241c),
|
||||||
|
Color(0xFF641e16),
|
||||||
|
)
|
||||||
|
}
|
@ -68,27 +68,12 @@ import io.github.sadellie.themmo.ThemingMode
|
|||||||
import io.github.sadellie.themmo.Themmo
|
import io.github.sadellie.themmo.Themmo
|
||||||
import io.github.sadellie.themmo.ThemmoController
|
import io.github.sadellie.themmo.ThemmoController
|
||||||
|
|
||||||
private val colorSchemes: List<Color> by lazy {
|
|
||||||
listOf(
|
|
||||||
Color(0xFFF6A1BC),
|
|
||||||
Color(0xFFFDA387),
|
|
||||||
Color(0xFFEAAF60),
|
|
||||||
Color(0xFFC2BD64),
|
|
||||||
Color(0xFF94C78A),
|
|
||||||
Color(0xFF73C9B5),
|
|
||||||
Color(0xFF72C6DA),
|
|
||||||
Color(0xFF8FBEF2),
|
|
||||||
Color(0xFFB6B3F6),
|
|
||||||
Color(0xFFDCA8E4),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
internal fun DisplayRoute(
|
internal fun DisplayRoute(
|
||||||
viewModel: DisplayViewModel = hiltViewModel(),
|
viewModel: DisplayViewModel = hiltViewModel(),
|
||||||
navigateUp: () -> Unit = {},
|
navigateUp: () -> Unit = {},
|
||||||
themmoController: ThemmoController,
|
themmoController: ThemmoController,
|
||||||
navigateToLanguages: () -> Unit
|
navigateToLanguages: () -> Unit,
|
||||||
) {
|
) {
|
||||||
val prefs = viewModel.prefs.collectAsStateWithLifecycle()
|
val prefs = viewModel.prefs.collectAsStateWithLifecycle()
|
||||||
|
|
||||||
@ -103,8 +88,8 @@ internal fun DisplayRoute(
|
|||||||
onDynamicThemeChange = {
|
onDynamicThemeChange = {
|
||||||
// Prevent old devices from using other monet modes when dynamic theming is on
|
// Prevent old devices from using other monet modes when dynamic theming is on
|
||||||
if (it) {
|
if (it) {
|
||||||
themmoController.setMonetMode(MonetMode.TONAL_SPOT)
|
themmoController.setMonetMode(MonetMode.TonalSpot)
|
||||||
viewModel.updateMonetMode(MonetMode.TONAL_SPOT)
|
viewModel.updateMonetMode(MonetMode.TonalSpot)
|
||||||
}
|
}
|
||||||
themmoController.enableDynamicTheme(it)
|
themmoController.enableDynamicTheme(it)
|
||||||
viewModel.updateDynamicTheme(it)
|
viewModel.updateDynamicTheme(it)
|
||||||
|
@ -17,7 +17,7 @@ androidxTest = "1.5.0"
|
|||||||
androidxTestExtJunitKtx = "1.1.5"
|
androidxTestExtJunitKtx = "1.1.5"
|
||||||
androidxTestRunner = "1.5.2"
|
androidxTestRunner = "1.5.2"
|
||||||
comAndroidToolsDesugarJdkLibs = "2.0.3"
|
comAndroidToolsDesugarJdkLibs = "2.0.3"
|
||||||
comGithubSadellieThemmo = "1.0.0"
|
comGithubSadellieThemmo = "1.1.1"
|
||||||
comGoogleAccompanistAccompanistSystemuicontroller = "0.30.1"
|
comGoogleAccompanistAccompanistSystemuicontroller = "0.30.1"
|
||||||
comGoogleDagger = "2.47"
|
comGoogleDagger = "2.47"
|
||||||
comSquareupMoshiMoshiKotlin = "1.15.0"
|
comSquareupMoshiMoshiKotlin = "1.15.0"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user