Clean up DataStore schema

This commit is contained in:
MM20 2022-01-02 22:05:20 +01:00
parent 11e6a3ceb3
commit d84bbe3011
No known key found for this signature in database
GPG Key ID: 0B61A8F2DEAFA389
3 changed files with 2 additions and 94 deletions

View File

@ -14,73 +14,12 @@ message Settings {
Theme theme = 1;
enum ColorScheme {
Default = 0;
MM20 = 1;
MaterialYou = 2;
Wallpaper = 3;
BlackAndWhite = 4;
Custom = 5;
BlackAndWhite = 1;
}
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;
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 {
enum WeatherProvider {
MetNo = 0;

View File

@ -58,18 +58,6 @@ class ComposeActivity : AppCompatActivity() {
val colorSchemePreference = Settings.AppearanceSettings.ColorScheme.Default
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()
else -> DefaultColorPalette()
}

View File

@ -5,26 +5,18 @@ import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.provider.AlarmClock
import androidx.compose.animation.animateColorAsState
import androidx.compose.foundation.clickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.*
import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
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.locals.LocalWindowSize
import de.mm20.launcher2.ui.widget.parts.DatePart
import kotlinx.coroutines.flow.map
@Composable
fun ClockWidget(
@ -54,7 +46,6 @@ fun ClockWidget(
fun Clock() {
var time by remember { mutableStateOf(System.currentTimeMillis()) }
val context = LocalContext.current
val clockStyle = ClockStyle.Digital
DisposableEffect(null) {
val receiver = object : BroadcastReceiver() {
@ -82,17 +73,7 @@ fun Clock() {
})
}
) {
when (clockStyle) {
ClockStyle.Analog -> {
AnalogClock(time = time)
}
ClockStyle.Binary -> {
BinaryClock(time = time)
}
else -> {
DigitalClock(time = time)
}
}
DigitalClock(time = time)
}
}