Clean up DataStore schema
This commit is contained in:
parent
11e6a3ceb3
commit
d84bbe3011
@ -14,73 +14,12 @@ message Settings {
|
|||||||
Theme theme = 1;
|
Theme theme = 1;
|
||||||
enum ColorScheme {
|
enum ColorScheme {
|
||||||
Default = 0;
|
Default = 0;
|
||||||
MM20 = 1;
|
BlackAndWhite = 1;
|
||||||
MaterialYou = 2;
|
|
||||||
Wallpaper = 3;
|
|
||||||
BlackAndWhite = 4;
|
|
||||||
Custom = 5;
|
|
||||||
}
|
}
|
||||||
ColorScheme color_scheme = 6;
|
ColorScheme color_scheme = 6;
|
||||||
|
|
||||||
message CustomColors {
|
|
||||||
uint32 neutral1 = 1;
|
|
||||||
uint32 neutral2 = 2;
|
|
||||||
uint32 accent1 = 3;
|
|
||||||
uint32 accent2 = 4;
|
|
||||||
uint32 accent3 = 5;
|
|
||||||
}
|
|
||||||
CustomColors custom_colors = 7;
|
|
||||||
|
|
||||||
bool light_status_bar = 2;
|
|
||||||
bool light_nav_bar = 3;
|
|
||||||
bool dim_wallpaper = 4;
|
|
||||||
bool app_start_animation = 5;
|
|
||||||
|
|
||||||
enum ClockStyle {
|
|
||||||
Digital = 0;
|
|
||||||
Analog = 1;
|
|
||||||
Binary = 2;
|
|
||||||
}
|
|
||||||
ClockStyle clock_style = 8;
|
|
||||||
}
|
}
|
||||||
AppearanceSettings appearance = 2;
|
AppearanceSettings appearance = 2;
|
||||||
|
|
||||||
message SearchSettings {
|
|
||||||
bool show_favorites = 1;
|
|
||||||
bool calculator = 2;
|
|
||||||
bool unit_converter = 3;
|
|
||||||
bool files = 4;
|
|
||||||
bool wikipedia = 5;
|
|
||||||
bool wikipedia_mobile_data = 6;
|
|
||||||
bool wikipedia_pictures = 7;
|
|
||||||
bool websites = 8;
|
|
||||||
enum WebsitesProtocol {
|
|
||||||
Https = 0;
|
|
||||||
Http = 1;
|
|
||||||
}
|
|
||||||
WebsitesProtocol websitesProtocol = 9;
|
|
||||||
bool websites_mobile_data = 10;
|
|
||||||
bool activities = 11;
|
|
||||||
bool calendar_events = 12;
|
|
||||||
bool contacts = 13;
|
|
||||||
bool owncloud = 14;
|
|
||||||
bool nextcloud = 15;
|
|
||||||
bool onedrive = 16;
|
|
||||||
bool onedrive_mobile_data = 17;
|
|
||||||
bool gdrive = 18;
|
|
||||||
bool gdrive_mobile_data = 19;
|
|
||||||
}
|
|
||||||
SearchSettings search = 3;
|
|
||||||
|
|
||||||
message BadgeSettings {
|
|
||||||
bool notification_badges = 1;
|
|
||||||
bool cloud_badges = 2;
|
|
||||||
bool suspend_badges = 3;
|
|
||||||
bool profile_badges = 4;
|
|
||||||
bool shortcut_badges = 5;
|
|
||||||
}
|
|
||||||
BadgeSettings badges = 4;
|
|
||||||
|
|
||||||
message WeatherSettings {
|
message WeatherSettings {
|
||||||
enum WeatherProvider {
|
enum WeatherProvider {
|
||||||
MetNo = 0;
|
MetNo = 0;
|
||||||
|
|||||||
@ -58,18 +58,6 @@ class ComposeActivity : AppCompatActivity() {
|
|||||||
val colorSchemePreference = Settings.AppearanceSettings.ColorScheme.Default
|
val colorSchemePreference = Settings.AppearanceSettings.ColorScheme.Default
|
||||||
|
|
||||||
val colorScheme = when (colorSchemePreference) {
|
val colorScheme = when (colorSchemePreference) {
|
||||||
Settings.AppearanceSettings.ColorScheme.MM20 -> MM20ColorPalette()
|
|
||||||
Settings.AppearanceSettings.ColorScheme.Wallpaper -> {
|
|
||||||
if (isAtLeastApiLevel(Build.VERSION_CODES.O_MR1)) {
|
|
||||||
val wallpaperColors by wallpaperColorsAsState()
|
|
||||||
WallpaperColorPalette(wallpaperColors)
|
|
||||||
} else DefaultColorPalette()
|
|
||||||
}
|
|
||||||
Settings.AppearanceSettings.ColorScheme.MaterialYou -> {
|
|
||||||
if (isAtLeastApiLevel(Build.VERSION_CODES.S)) {
|
|
||||||
SystemColorPalette(context)
|
|
||||||
} else DefaultColorPalette()
|
|
||||||
}
|
|
||||||
Settings.AppearanceSettings.ColorScheme.BlackAndWhite -> BlackWhiteColorPalette()
|
Settings.AppearanceSettings.ColorScheme.BlackAndWhite -> BlackWhiteColorPalette()
|
||||||
else -> DefaultColorPalette()
|
else -> DefaultColorPalette()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,26 +5,18 @@ import android.content.Context
|
|||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.IntentFilter
|
import android.content.IntentFilter
|
||||||
import android.provider.AlarmClock
|
import android.provider.AlarmClock
|
||||||
import androidx.compose.animation.animateColorAsState
|
|
||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.interaction.MutableInteractionSource
|
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.material3.LocalContentColor
|
import androidx.compose.material3.LocalContentColor
|
||||||
import androidx.compose.material3.MaterialTheme
|
|
||||||
import androidx.compose.runtime.*
|
import androidx.compose.runtime.*
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import com.google.accompanist.insets.LocalWindowInsets
|
|
||||||
import de.mm20.launcher2.preferences.Settings.AppearanceSettings.ClockStyle
|
|
||||||
import de.mm20.launcher2.ui.component.AnalogClock
|
|
||||||
import de.mm20.launcher2.ui.component.BinaryClock
|
|
||||||
import de.mm20.launcher2.ui.component.DigitalClock
|
import de.mm20.launcher2.ui.component.DigitalClock
|
||||||
import de.mm20.launcher2.ui.locals.LocalWindowSize
|
|
||||||
import de.mm20.launcher2.ui.widget.parts.DatePart
|
import de.mm20.launcher2.ui.widget.parts.DatePart
|
||||||
import kotlinx.coroutines.flow.map
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ClockWidget(
|
fun ClockWidget(
|
||||||
@ -54,7 +46,6 @@ fun ClockWidget(
|
|||||||
fun Clock() {
|
fun Clock() {
|
||||||
var time by remember { mutableStateOf(System.currentTimeMillis()) }
|
var time by remember { mutableStateOf(System.currentTimeMillis()) }
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
val clockStyle = ClockStyle.Digital
|
|
||||||
|
|
||||||
DisposableEffect(null) {
|
DisposableEffect(null) {
|
||||||
val receiver = object : BroadcastReceiver() {
|
val receiver = object : BroadcastReceiver() {
|
||||||
@ -82,17 +73,7 @@ fun Clock() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
when (clockStyle) {
|
DigitalClock(time = time)
|
||||||
ClockStyle.Analog -> {
|
|
||||||
AnalogClock(time = time)
|
|
||||||
}
|
|
||||||
ClockStyle.Binary -> {
|
|
||||||
BinaryClock(time = time)
|
|
||||||
}
|
|
||||||
else -> {
|
|
||||||
DigitalClock(time = time)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user