Remove legacy data store
This commit is contained in:
parent
3f31cc130d
commit
f635a4dc33
1
.gitignore
vendored
1
.gitignore
vendored
@ -260,6 +260,7 @@ obj/
|
|||||||
.idea/sqlDataSources.xml
|
.idea/sqlDataSources.xml
|
||||||
.idea/dynamic.xml
|
.idea/dynamic.xml
|
||||||
.idea/uiDesigner.xml
|
.idea/uiDesigner.xml
|
||||||
|
.idea/runConfigurations.xml
|
||||||
|
|
||||||
# OS-specific files
|
# OS-specific files
|
||||||
.DS_Store?
|
.DS_Store?
|
||||||
|
|||||||
@ -2,7 +2,6 @@ package de.mm20.launcher2.ui.base
|
|||||||
|
|
||||||
import androidx.compose.runtime.*
|
import androidx.compose.runtime.*
|
||||||
import de.mm20.launcher2.preferences.IconShape
|
import de.mm20.launcher2.preferences.IconShape
|
||||||
import de.mm20.launcher2.preferences.LegacySettings
|
|
||||||
import de.mm20.launcher2.preferences.ui.CardStyle
|
import de.mm20.launcher2.preferences.ui.CardStyle
|
||||||
import de.mm20.launcher2.preferences.ui.GridSettings
|
import de.mm20.launcher2.preferences.ui.GridSettings
|
||||||
import de.mm20.launcher2.preferences.ui.UiSettings
|
import de.mm20.launcher2.preferences.ui.UiSettings
|
||||||
|
|||||||
@ -15,7 +15,6 @@ import androidx.compose.ui.res.stringResource
|
|||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.lifecycle.viewmodel.compose.viewModel
|
import androidx.lifecycle.viewmodel.compose.viewModel
|
||||||
import de.mm20.launcher2.preferences.GestureAction
|
import de.mm20.launcher2.preferences.GestureAction
|
||||||
import de.mm20.launcher2.preferences.LegacySettings
|
|
||||||
import de.mm20.launcher2.ui.R
|
import de.mm20.launcher2.ui.R
|
||||||
import de.mm20.launcher2.ui.component.BottomSheetDialog
|
import de.mm20.launcher2.ui.component.BottomSheetDialog
|
||||||
import de.mm20.launcher2.ui.component.MissingPermissionBanner
|
import de.mm20.launcher2.ui.component.MissingPermissionBanner
|
||||||
|
|||||||
@ -15,7 +15,6 @@ import androidx.compose.ui.Modifier
|
|||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.lifecycle.viewmodel.compose.viewModel
|
import androidx.lifecycle.viewmodel.compose.viewModel
|
||||||
import de.mm20.launcher2.preferences.LegacySettings
|
|
||||||
import de.mm20.launcher2.preferences.SurfaceShape
|
import de.mm20.launcher2.preferences.SurfaceShape
|
||||||
import de.mm20.launcher2.preferences.ui.CardStyle
|
import de.mm20.launcher2.preferences.ui.CardStyle
|
||||||
import de.mm20.launcher2.ui.R
|
import de.mm20.launcher2.ui.R
|
||||||
|
|||||||
@ -29,7 +29,6 @@ import de.mm20.launcher2.icons.LauncherIcon
|
|||||||
import de.mm20.launcher2.ktx.isAtLeastApiLevel
|
import de.mm20.launcher2.ktx.isAtLeastApiLevel
|
||||||
import de.mm20.launcher2.preferences.BaseLayout
|
import de.mm20.launcher2.preferences.BaseLayout
|
||||||
import de.mm20.launcher2.preferences.GestureAction
|
import de.mm20.launcher2.preferences.GestureAction
|
||||||
import de.mm20.launcher2.preferences.LegacySettings.LayoutSettings.Layout
|
|
||||||
import de.mm20.launcher2.search.SavableSearchable
|
import de.mm20.launcher2.search.SavableSearchable
|
||||||
import de.mm20.launcher2.ui.R
|
import de.mm20.launcher2.ui.R
|
||||||
import de.mm20.launcher2.ui.common.SearchablePicker
|
import de.mm20.launcher2.ui.common.SearchablePicker
|
||||||
|
|||||||
@ -26,7 +26,6 @@ import androidx.compose.ui.unit.dp
|
|||||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||||
import androidx.lifecycle.viewmodel.compose.viewModel
|
import androidx.lifecycle.viewmodel.compose.viewModel
|
||||||
import com.google.accompanist.pager.HorizontalPagerIndicator
|
import com.google.accompanist.pager.HorizontalPagerIndicator
|
||||||
import de.mm20.launcher2.preferences.LegacySettings
|
|
||||||
import de.mm20.launcher2.preferences.SearchBarColors
|
import de.mm20.launcher2.preferences.SearchBarColors
|
||||||
import de.mm20.launcher2.preferences.SearchBarStyle
|
import de.mm20.launcher2.preferences.SearchBarStyle
|
||||||
import de.mm20.launcher2.preferences.SystemBarColors
|
import de.mm20.launcher2.preferences.SystemBarColors
|
||||||
|
|||||||
@ -13,7 +13,6 @@ import androidx.lifecycle.viewModelScope
|
|||||||
import androidx.lifecycle.viewmodel.initializer
|
import androidx.lifecycle.viewmodel.initializer
|
||||||
import androidx.lifecycle.viewmodel.viewModelFactory
|
import androidx.lifecycle.viewmodel.viewModelFactory
|
||||||
import de.mm20.launcher2.ktx.isAtLeastApiLevel
|
import de.mm20.launcher2.ktx.isAtLeastApiLevel
|
||||||
import de.mm20.launcher2.preferences.LegacySettings
|
|
||||||
import de.mm20.launcher2.preferences.ScreenOrientation
|
import de.mm20.launcher2.preferences.ScreenOrientation
|
||||||
import de.mm20.launcher2.preferences.SearchBarColors
|
import de.mm20.launcher2.preferences.SearchBarColors
|
||||||
import de.mm20.launcher2.preferences.SearchBarStyle
|
import de.mm20.launcher2.preferences.SearchBarStyle
|
||||||
|
|||||||
@ -10,8 +10,6 @@ import androidx.compose.ui.graphics.Color
|
|||||||
import androidx.compose.ui.graphics.toArgb
|
import androidx.compose.ui.graphics.toArgb
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.datastore.core.DataStore
|
|
||||||
import de.mm20.launcher2.preferences.LegacySettings
|
|
||||||
import de.mm20.launcher2.preferences.ui.UiSettings
|
import de.mm20.launcher2.preferences.ui.UiSettings
|
||||||
import de.mm20.launcher2.themes.CorePalette
|
import de.mm20.launcher2.themes.CorePalette
|
||||||
import de.mm20.launcher2.themes.DefaultDarkColorScheme
|
import de.mm20.launcher2.themes.DefaultDarkColorScheme
|
||||||
@ -22,9 +20,7 @@ import de.mm20.launcher2.themes.Theme
|
|||||||
import de.mm20.launcher2.themes.get
|
import de.mm20.launcher2.themes.get
|
||||||
import de.mm20.launcher2.themes.merge
|
import de.mm20.launcher2.themes.merge
|
||||||
import de.mm20.launcher2.ui.locals.LocalWallpaperColors
|
import de.mm20.launcher2.ui.locals.LocalWallpaperColors
|
||||||
import kotlinx.coroutines.flow.map
|
|
||||||
import org.koin.androidx.compose.inject
|
import org.koin.androidx.compose.inject
|
||||||
import org.koin.core.component.inject
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun lightColorSchemeOf(theme: Theme): ColorScheme {
|
fun lightColorSchemeOf(theme: Theme): ColorScheme {
|
||||||
@ -113,44 +109,3 @@ fun systemCorePalette(): CorePalette<Int> {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun CustomColorScheme(colors: LegacySettings.AppearanceSettings.CustomColors.Scheme): ColorScheme {
|
|
||||||
return ColorScheme(
|
|
||||||
primary = Color(colors.primary),
|
|
||||||
onPrimary = Color(colors.onPrimary),
|
|
||||||
primaryContainer = Color(colors.primaryContainer),
|
|
||||||
onPrimaryContainer = Color(colors.onPrimaryContainer),
|
|
||||||
secondary = Color(colors.secondary),
|
|
||||||
onSecondary = Color(colors.onSecondary),
|
|
||||||
secondaryContainer = Color(colors.secondaryContainer),
|
|
||||||
onSecondaryContainer = Color(colors.onSecondaryContainer),
|
|
||||||
tertiary = Color(colors.tertiary),
|
|
||||||
onTertiary = Color(colors.onTertiary),
|
|
||||||
tertiaryContainer = Color(colors.tertiaryContainer),
|
|
||||||
onTertiaryContainer = Color(colors.onTertiaryContainer),
|
|
||||||
background = Color(colors.background),
|
|
||||||
onBackground = Color(colors.onBackground),
|
|
||||||
surface = Color(colors.surface),
|
|
||||||
onSurface = Color(colors.onSurface),
|
|
||||||
surfaceVariant = Color(colors.surfaceVariant),
|
|
||||||
onSurfaceVariant = Color(colors.onSurfaceVariant),
|
|
||||||
outline = Color(colors.outline),
|
|
||||||
inverseSurface = Color(colors.inverseSurface),
|
|
||||||
inverseOnSurface = Color(colors.inverseOnSurface),
|
|
||||||
inversePrimary = Color(colors.inversePrimary),
|
|
||||||
surfaceTint = Color(colors.surfaceTint),
|
|
||||||
error = Color(colors.error),
|
|
||||||
onError = Color(colors.onError),
|
|
||||||
errorContainer = Color(colors.errorContainer),
|
|
||||||
onErrorContainer = Color(colors.onErrorContainer),
|
|
||||||
outlineVariant = Color(colors.outlineVariant),
|
|
||||||
scrim = Color(colors.scrim),
|
|
||||||
surfaceBright = Color(colors.surfaceBright),
|
|
||||||
surfaceDim = Color(colors.surfaceDim),
|
|
||||||
surfaceContainer = Color(colors.surfaceContainer),
|
|
||||||
surfaceContainerHigh = Color(colors.surfaceContainerHigh),
|
|
||||||
surfaceContainerHighest = Color(colors.surfaceContainerHighest),
|
|
||||||
surfaceContainerLow = Color(colors.surfaceContainerLow),
|
|
||||||
surfaceContainerLowest = Color(colors.surfaceContainerLowest),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@ -2,7 +2,6 @@ plugins {
|
|||||||
alias(libs.plugins.kotlin.android) apply false
|
alias(libs.plugins.kotlin.android) apply false
|
||||||
alias(libs.plugins.kotlin.plugin.serialization) apply false
|
alias(libs.plugins.kotlin.plugin.serialization) apply false
|
||||||
alias(libs.plugins.ksp) apply false
|
alias(libs.plugins.ksp) apply false
|
||||||
alias(libs.plugins.protobuf) apply false
|
|
||||||
alias(libs.plugins.android.application) apply false
|
alias(libs.plugins.android.application) apply false
|
||||||
alias(libs.plugins.android.library) apply false
|
alias(libs.plugins.android.library) apply false
|
||||||
alias(libs.plugins.dokka) apply true
|
alias(libs.plugins.dokka) apply true
|
||||||
|
|||||||
@ -1,9 +1,6 @@
|
|||||||
import com.google.protobuf.gradle.*
|
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
alias(libs.plugins.android.library)
|
alias(libs.plugins.android.library)
|
||||||
alias(libs.plugins.kotlin.android)
|
alias(libs.plugins.kotlin.android)
|
||||||
alias(libs.plugins.protobuf)
|
|
||||||
alias(libs.plugins.kotlin.plugin.serialization)
|
alias(libs.plugins.kotlin.plugin.serialization)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,32 +34,12 @@ android {
|
|||||||
namespace = "de.mm20.launcher2.preferences"
|
namespace = "de.mm20.launcher2.preferences"
|
||||||
}
|
}
|
||||||
|
|
||||||
protobuf {
|
|
||||||
protoc {
|
|
||||||
artifact = libs.protobuf.protoc.get().toString()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Generates the java Protobuf-lite code for the Protobufs in this project. See
|
|
||||||
// https://github.com/google/protobuf-gradle-plugin#customizing-protobuf-compilation
|
|
||||||
// for more information.
|
|
||||||
generateProtoTasks {
|
|
||||||
all().forEach { task ->
|
|
||||||
task.plugins {
|
|
||||||
create("java") {
|
|
||||||
option("lite")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(libs.kotlin.stdlib)
|
implementation(libs.kotlin.stdlib)
|
||||||
implementation(libs.kotlinx.serialization.json)
|
implementation(libs.kotlinx.serialization.json)
|
||||||
implementation(libs.androidx.core)
|
implementation(libs.androidx.core)
|
||||||
implementation(libs.androidx.appcompat)
|
implementation(libs.androidx.appcompat)
|
||||||
api(libs.androidx.datastore)
|
api(libs.androidx.datastore)
|
||||||
api(libs.protobuf.javalite)
|
|
||||||
implementation(libs.koin.android)
|
implementation(libs.koin.android)
|
||||||
|
|
||||||
implementation(project(":core:ktx"))
|
implementation(project(":core:ktx"))
|
||||||
|
|||||||
@ -1,221 +0,0 @@
|
|||||||
package de.mm20.launcher2.preferences
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import androidx.core.graphics.blue
|
|
||||||
import de.mm20.launcher2.ktx.isAtLeastApiLevel
|
|
||||||
import de.mm20.launcher2.preferences.LegacySettings.SearchBarSettings.SearchBarColors
|
|
||||||
import de.mm20.launcher2.preferences.ktx.toSettingsColorsScheme
|
|
||||||
import scheme.Scheme
|
|
||||||
import java.util.UUID
|
|
||||||
|
|
||||||
fun createFactorySettings(context: Context): LegacySettings {
|
|
||||||
return LegacySettings.newBuilder()
|
|
||||||
.setAppearance(
|
|
||||||
LegacySettings.AppearanceSettings
|
|
||||||
.newBuilder()
|
|
||||||
.setTheme(LegacySettings.AppearanceSettings.Theme.System)
|
|
||||||
.setDimWallpaper(false)
|
|
||||||
.setBlurWallpaper(true)
|
|
||||||
.setBlurWallpaperRadius(32)
|
|
||||||
.setThemeId(UUID(0L, 0L).toString())
|
|
||||||
.setFont(LegacySettings.AppearanceSettings.Font.Outfit)
|
|
||||||
.build()
|
|
||||||
)
|
|
||||||
.setWeather(
|
|
||||||
LegacySettings.WeatherSettings
|
|
||||||
.newBuilder()
|
|
||||||
.setProvider(LegacySettings.WeatherSettings.WeatherProvider.MetNo)
|
|
||||||
.setImperialUnits(context.resources.getBoolean(R.bool.default_imperialUnits))
|
|
||||||
.build()
|
|
||||||
)
|
|
||||||
.setMusicWidget(
|
|
||||||
LegacySettings.MusicWidgetSettings
|
|
||||||
.newBuilder()
|
|
||||||
.build()
|
|
||||||
)
|
|
||||||
.setCalendarWidget(
|
|
||||||
LegacySettings.CalendarWidgetSettings
|
|
||||||
.newBuilder()
|
|
||||||
.setHideAlldayEvents(false)
|
|
||||||
)
|
|
||||||
.setClockWidget(
|
|
||||||
LegacySettings.ClockWidgetSettings
|
|
||||||
.newBuilder()
|
|
||||||
.setLayout(LegacySettings.ClockWidgetSettings.ClockWidgetLayout.Vertical)
|
|
||||||
.setClockStyle(LegacySettings.ClockWidgetSettings.ClockStyle.DigitalClock1)
|
|
||||||
.setColor(LegacySettings.ClockWidgetSettings.ClockWidgetColors.Auto)
|
|
||||||
.setAlarmPart(true)
|
|
||||||
.setBatteryPart(true)
|
|
||||||
.setMusicPart(true)
|
|
||||||
.setDatePart(true)
|
|
||||||
.setFavoritesPart(false)
|
|
||||||
.setFillHeight(true)
|
|
||||||
.setAlignment(LegacySettings.ClockWidgetSettings.ClockWidgetAlignment.Bottom)
|
|
||||||
.build()
|
|
||||||
)
|
|
||||||
.setFavorites(
|
|
||||||
LegacySettings.FavoritesSettings
|
|
||||||
.newBuilder()
|
|
||||||
.setEnabled(true)
|
|
||||||
.setFrequentlyUsed(true)
|
|
||||||
.setFrequentlyUsedRows(1)
|
|
||||||
.setEditButton(true)
|
|
||||||
)
|
|
||||||
.setFileSearch(
|
|
||||||
LegacySettings.FilesSearchSettings
|
|
||||||
.newBuilder()
|
|
||||||
.setLocalFiles(true)
|
|
||||||
.setNextcloud(false)
|
|
||||||
.setGdrive(false)
|
|
||||||
.setOnedrive(false)
|
|
||||||
.setNextcloud(false)
|
|
||||||
)
|
|
||||||
.setContactsSearch(
|
|
||||||
LegacySettings.ContactsSearchSettings
|
|
||||||
.newBuilder()
|
|
||||||
.setEnabled(true)
|
|
||||||
)
|
|
||||||
.setCalendarSearch(
|
|
||||||
LegacySettings.CalendarSearchSettings
|
|
||||||
.newBuilder()
|
|
||||||
.setEnabled(true)
|
|
||||||
)
|
|
||||||
.setAppShortcutSearch(
|
|
||||||
LegacySettings.AppShortcutSearchSettings
|
|
||||||
.newBuilder()
|
|
||||||
.setEnabled(true)
|
|
||||||
)
|
|
||||||
.setCalculatorSearch(
|
|
||||||
LegacySettings.CalculatorSearchSettings
|
|
||||||
.newBuilder()
|
|
||||||
.setEnabled(true)
|
|
||||||
)
|
|
||||||
.setUnitConverterSearch(
|
|
||||||
LegacySettings.UnitConverterSearchSettings
|
|
||||||
.newBuilder()
|
|
||||||
.setEnabled(true)
|
|
||||||
.setCurrencies(true)
|
|
||||||
)
|
|
||||||
.setWikipediaSearch(
|
|
||||||
LegacySettings.WikipediaSearchSettings
|
|
||||||
.newBuilder()
|
|
||||||
.setEnabled(false)
|
|
||||||
.setImages(false)
|
|
||||||
.setCustomUrl("")
|
|
||||||
)
|
|
||||||
.setWebsiteSearch(
|
|
||||||
LegacySettings.WebsiteSearchSettings
|
|
||||||
.newBuilder()
|
|
||||||
.setEnabled(false)
|
|
||||||
)
|
|
||||||
.setWebSearch(
|
|
||||||
LegacySettings.WebSearchSettings
|
|
||||||
.newBuilder()
|
|
||||||
.setEnabled(true)
|
|
||||||
)
|
|
||||||
.setBadges(
|
|
||||||
LegacySettings.BadgeSettings
|
|
||||||
.newBuilder()
|
|
||||||
.setNotifications(true)
|
|
||||||
.setCloudFiles(true)
|
|
||||||
.setShortcuts(true)
|
|
||||||
.setSuspendedApps(true)
|
|
||||||
)
|
|
||||||
.setGrid(
|
|
||||||
LegacySettings.GridSettings.newBuilder()
|
|
||||||
.setColumnCount(context.resources.getInteger(R.integer.config_columnCount))
|
|
||||||
.setIconSize(48)
|
|
||||||
.setShowLabels(true)
|
|
||||||
.build()
|
|
||||||
)
|
|
||||||
.setSearchBar(
|
|
||||||
LegacySettings.SearchBarSettings.newBuilder()
|
|
||||||
.setSearchBarStyle(LegacySettings.SearchBarSettings.SearchBarStyle.Transparent)
|
|
||||||
.setAutoFocus(true)
|
|
||||||
.setLaunchOnEnter(true)
|
|
||||||
.setColor(SearchBarColors.Auto)
|
|
||||||
.setHiddenItemsButton(true)
|
|
||||||
.build()
|
|
||||||
)
|
|
||||||
.setIcons(
|
|
||||||
LegacySettings.IconSettings.newBuilder()
|
|
||||||
.setAdaptify(true)
|
|
||||||
.setShape(LegacySettings.IconSettings.IconShape.PlatformDefault)
|
|
||||||
.setThemedIcons(false)
|
|
||||||
.setIconPack("")
|
|
||||||
.setIconPackThemed(true)
|
|
||||||
)
|
|
||||||
.setEasterEgg(false)
|
|
||||||
.setSystemBars(
|
|
||||||
LegacySettings.SystemBarsSettings.newBuilder()
|
|
||||||
.setNavBarColor(LegacySettings.SystemBarsSettings.SystemBarColors.Auto)
|
|
||||||
.setStatusBarColor(LegacySettings.SystemBarsSettings.SystemBarColors.Auto)
|
|
||||||
.setHideStatusBar(false)
|
|
||||||
.setHideNavBar(false)
|
|
||||||
)
|
|
||||||
.setCards(
|
|
||||||
LegacySettings.CardSettings.newBuilder()
|
|
||||||
.setBorderWidth(0)
|
|
||||||
.setRadius(12)
|
|
||||||
.setOpacity(1f)
|
|
||||||
)
|
|
||||||
.setWidgets(
|
|
||||||
LegacySettings.WidgetSettings.newBuilder()
|
|
||||||
.setEditButton(true)
|
|
||||||
)
|
|
||||||
.setLayout(
|
|
||||||
LegacySettings.LayoutSettings.newBuilder()
|
|
||||||
.setBaseLayout(LegacySettings.LayoutSettings.Layout.PullDown)
|
|
||||||
.setBottomSearchBar(false)
|
|
||||||
.setReverseSearchResults(false)
|
|
||||||
.setFixedRotation(false)
|
|
||||||
)
|
|
||||||
.setGestures(
|
|
||||||
LegacySettings.GestureSettings.newBuilder()
|
|
||||||
.setDoubleTap(
|
|
||||||
if (isAtLeastApiLevel(28)) {
|
|
||||||
LegacySettings.GestureSettings.GestureAction.LockScreen
|
|
||||||
} else {
|
|
||||||
LegacySettings.GestureSettings.GestureAction.None
|
|
||||||
})
|
|
||||||
.setLongPress(LegacySettings.GestureSettings.GestureAction.None)
|
|
||||||
.setSwipeDown(LegacySettings.GestureSettings.GestureAction.OpenNotificationDrawer)
|
|
||||||
.setSwipeLeft(LegacySettings.GestureSettings.GestureAction.None)
|
|
||||||
.setSwipeRight(LegacySettings.GestureSettings.GestureAction.None)
|
|
||||||
)
|
|
||||||
.setResultOrdering(
|
|
||||||
LegacySettings.SearchResultOrderingSettings.newBuilder()
|
|
||||||
.setOrdering(LegacySettings.SearchResultOrderingSettings.Ordering.Weighted)
|
|
||||||
.setWeightFactor(LegacySettings.SearchResultOrderingSettings.WeightFactor.Default)
|
|
||||||
)
|
|
||||||
.setAnimations(
|
|
||||||
LegacySettings.AnimationSettings.newBuilder()
|
|
||||||
.setCharging(true)
|
|
||||||
)
|
|
||||||
.build()
|
|
||||||
}
|
|
||||||
|
|
||||||
internal val DefaultCustomColorsBase: LegacySettings.AppearanceSettings.CustomColors.BaseColors
|
|
||||||
get() {
|
|
||||||
val scheme = Scheme.light(0xFFACE330.toInt())
|
|
||||||
return LegacySettings.AppearanceSettings.CustomColors.BaseColors.newBuilder()
|
|
||||||
.setAccent1(scheme.primary)
|
|
||||||
.setAccent2(scheme.secondary)
|
|
||||||
.setAccent3(scheme.tertiary)
|
|
||||||
.setNeutral1(scheme.surface)
|
|
||||||
.setNeutral2(scheme.surfaceVariant)
|
|
||||||
.setError(scheme.error)
|
|
||||||
.build()
|
|
||||||
}
|
|
||||||
|
|
||||||
internal val DefaultLightCustomColorScheme: LegacySettings.AppearanceSettings.CustomColors.Scheme
|
|
||||||
get() {
|
|
||||||
val scheme = Scheme.light(0xFFACE330.toInt())
|
|
||||||
return scheme.toSettingsColorsScheme()
|
|
||||||
}
|
|
||||||
|
|
||||||
internal val DefaultDarkCustomColorScheme: LegacySettings.AppearanceSettings.CustomColors.Scheme
|
|
||||||
get() {
|
|
||||||
val scheme = Scheme.dark(0xFFACE330.toInt())
|
|
||||||
return scheme.toSettingsColorsScheme()
|
|
||||||
}
|
|
||||||
@ -1,20 +1,17 @@
|
|||||||
package de.mm20.launcher2.preferences
|
package de.mm20.launcher2.preferences
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import de.mm20.launcher2.preferences.migrations.Migration1
|
|
||||||
import de.mm20.launcher2.preferences.migrations.Migration2
|
import de.mm20.launcher2.preferences.migrations.Migration2
|
||||||
import de.mm20.launcher2.preferences.migrations.Migration3
|
import de.mm20.launcher2.preferences.migrations.Migration3
|
||||||
import de.mm20.launcher2.settings.BaseSettings
|
import de.mm20.launcher2.settings.BaseSettings
|
||||||
|
|
||||||
internal class LauncherDataStore(
|
internal class LauncherDataStore(
|
||||||
private val context: Context,
|
private val context: Context,
|
||||||
legacyDataStore: LegacyDataStore,
|
|
||||||
): BaseSettings<LauncherSettingsData>(
|
): BaseSettings<LauncherSettingsData>(
|
||||||
context,
|
context,
|
||||||
fileName = "settings.json",
|
fileName = "settings.json",
|
||||||
serializer = LauncherSettingsDataSerializer,
|
serializer = LauncherSettingsDataSerializer,
|
||||||
migrations = listOf(
|
migrations = listOf(
|
||||||
Migration1(legacyDataStore),
|
|
||||||
Migration2(),
|
Migration2(),
|
||||||
Migration3(),
|
Migration3(),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -1,52 +1,5 @@
|
|||||||
package de.mm20.launcher2.preferences
|
package de.mm20.launcher2.preferences
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import androidx.datastore.core.CorruptionException
|
|
||||||
import androidx.datastore.core.DataMigration
|
|
||||||
import androidx.datastore.core.DataStore
|
|
||||||
import androidx.datastore.core.Serializer
|
|
||||||
import androidx.datastore.core.handlers.ReplaceFileCorruptionHandler
|
|
||||||
import androidx.datastore.dataStore
|
|
||||||
import com.google.protobuf.InvalidProtocolBufferException
|
|
||||||
import de.mm20.launcher2.crashreporter.CrashReporter
|
|
||||||
import de.mm20.launcher2.preferences.migrations.*
|
|
||||||
import java.io.InputStream
|
|
||||||
import java.io.OutputStream
|
|
||||||
|
|
||||||
internal typealias LegacyDataStore = DataStore<LegacySettings>
|
|
||||||
|
|
||||||
internal val Context.legacyDataStore: LegacyDataStore by dataStore(
|
|
||||||
fileName = "settings.pb",
|
|
||||||
serializer = LegacySettingsSerializer,
|
|
||||||
produceMigrations = {
|
|
||||||
getMigrations(it)
|
|
||||||
},
|
|
||||||
corruptionHandler = ReplaceFileCorruptionHandler {
|
|
||||||
CrashReporter.logException(it)
|
|
||||||
LegacySettings.getDefaultInstance()
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
internal const val SchemaVersion = 18
|
internal const val SchemaVersion = 18
|
||||||
|
|
||||||
internal fun getMigrations(context: Context): List<DataMigration<LegacySettings>> {
|
|
||||||
return listOf()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
object LegacySettingsSerializer : Serializer<LegacySettings> {
|
|
||||||
override val defaultValue: LegacySettings = LegacySettings.getDefaultInstance()
|
|
||||||
|
|
||||||
override suspend fun readFrom(input: InputStream): LegacySettings {
|
|
||||||
try {
|
|
||||||
return LegacySettings.parseFrom(input)
|
|
||||||
} catch (e: InvalidProtocolBufferException) {
|
|
||||||
throw CorruptionException("Cannot read proto.", e)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override suspend fun writeTo(t: LegacySettings, output: OutputStream) {
|
|
||||||
t.writeTo(output)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -27,8 +27,7 @@ import org.koin.core.qualifier.named
|
|||||||
import org.koin.dsl.module
|
import org.koin.dsl.module
|
||||||
|
|
||||||
val preferencesModule = module {
|
val preferencesModule = module {
|
||||||
single { androidContext().legacyDataStore }
|
single { LauncherDataStore(androidContext()) }
|
||||||
single { LauncherDataStore(androidContext(), get()) }
|
|
||||||
factory<Backupable>(named<LauncherDataStore>()) { get<LauncherDataStore>() }
|
factory<Backupable>(named<LauncherDataStore>()) { get<LauncherDataStore>() }
|
||||||
factory { MediaSettings(get()) }
|
factory { MediaSettings(get()) }
|
||||||
factory { ContactSearchSettings(get()) }
|
factory { ContactSearchSettings(get()) }
|
||||||
|
|||||||
@ -1,46 +0,0 @@
|
|||||||
package de.mm20.launcher2.preferences.ktx
|
|
||||||
|
|
||||||
import de.mm20.launcher2.preferences.LegacySettings
|
|
||||||
import scheme.Scheme
|
|
||||||
|
|
||||||
fun Scheme.toSettingsColorsScheme(): LegacySettings.AppearanceSettings.CustomColors.Scheme {
|
|
||||||
val scheme = this
|
|
||||||
return LegacySettings.AppearanceSettings.CustomColors.Scheme.newBuilder()
|
|
||||||
.setPrimary(scheme.primary)
|
|
||||||
.setSurfaceTint(scheme.primary)
|
|
||||||
.setOnPrimary(scheme.onPrimary)
|
|
||||||
.setPrimaryContainer(scheme.primaryContainer)
|
|
||||||
.setOnPrimaryContainer(scheme.onPrimaryContainer)
|
|
||||||
.setSecondary(scheme.secondary)
|
|
||||||
.setOnSecondary(scheme.onSecondary)
|
|
||||||
.setSecondaryContainer(scheme.secondaryContainer)
|
|
||||||
.setOnSecondaryContainer(scheme.onSecondaryContainer)
|
|
||||||
.setTertiary(scheme.tertiary)
|
|
||||||
.setOnTertiary(scheme.onTertiary)
|
|
||||||
.setTertiaryContainer(scheme.tertiaryContainer)
|
|
||||||
.setOnTertiaryContainer(scheme.onTertiaryContainer)
|
|
||||||
.setError(scheme.error)
|
|
||||||
.setOnError(scheme.onError)
|
|
||||||
.setErrorContainer(scheme.errorContainer)
|
|
||||||
.setOnErrorContainer(scheme.onErrorContainer)
|
|
||||||
.setBackground(scheme.background)
|
|
||||||
.setOnBackground(scheme.onBackground)
|
|
||||||
.setSurface(scheme.surface)
|
|
||||||
.setOnSurface(scheme.onSurface)
|
|
||||||
.setSurfaceVariant(scheme.surfaceVariant)
|
|
||||||
.setOnSurfaceVariant(scheme.onSurfaceVariant)
|
|
||||||
.setOutline(scheme.outline)
|
|
||||||
.setOutlineVariant(scheme.outlineVariant)
|
|
||||||
.setInverseSurface(scheme.inverseSurface)
|
|
||||||
.setInverseOnSurface(scheme.inverseOnSurface)
|
|
||||||
.setInversePrimary(scheme.inversePrimary)
|
|
||||||
.setScrim(scheme.scrim)
|
|
||||||
.setSurfaceDim(scheme.surfaceDim)
|
|
||||||
.setSurfaceBright(scheme.surfaceBright)
|
|
||||||
.setSurfaceContainerLowest(scheme.surfaceContainerLowest)
|
|
||||||
.setSurfaceContainerLow(scheme.surfaceContainerLow)
|
|
||||||
.setSurfaceContainer(scheme.surfaceContainer)
|
|
||||||
.setSurfaceContainerHigh(scheme.surfaceContainerHigh)
|
|
||||||
.setSurfaceContainerHighest(scheme.surfaceContainerHighest)
|
|
||||||
.build()
|
|
||||||
}
|
|
||||||
@ -1,25 +0,0 @@
|
|||||||
package de.mm20.launcher2.preferences.migrations
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.util.Log
|
|
||||||
import androidx.datastore.core.DataMigration
|
|
||||||
import de.mm20.launcher2.preferences.SchemaVersion
|
|
||||||
import de.mm20.launcher2.preferences.LegacySettings
|
|
||||||
import de.mm20.launcher2.preferences.createFactorySettings
|
|
||||||
|
|
||||||
class FactorySettingsMigration(private val context: Context): DataMigration<LegacySettings> {
|
|
||||||
override suspend fun cleanUp() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
override suspend fun migrate(currentData: LegacySettings): LegacySettings {
|
|
||||||
Log.d("MM20", "Initializing user settings…")
|
|
||||||
Log.d("MM20", "Done")
|
|
||||||
val defaults = createFactorySettings(context)
|
|
||||||
return defaults.toBuilder().setVersion(SchemaVersion).build()
|
|
||||||
}
|
|
||||||
|
|
||||||
override suspend fun shouldMigrate(currentData: LegacySettings): Boolean {
|
|
||||||
return currentData.version == 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,254 +0,0 @@
|
|||||||
package de.mm20.launcher2.preferences.migrations
|
|
||||||
|
|
||||||
import androidx.datastore.core.DataMigration
|
|
||||||
import de.mm20.launcher2.preferences.BaseLayout
|
|
||||||
import de.mm20.launcher2.preferences.ClockWidgetAlignment
|
|
||||||
import de.mm20.launcher2.preferences.ClockWidgetColors
|
|
||||||
import de.mm20.launcher2.preferences.ClockWidgetStyle
|
|
||||||
import de.mm20.launcher2.preferences.ColorScheme
|
|
||||||
import de.mm20.launcher2.preferences.Font
|
|
||||||
import de.mm20.launcher2.preferences.GestureAction
|
|
||||||
import de.mm20.launcher2.preferences.IconShape
|
|
||||||
import de.mm20.launcher2.preferences.LauncherSettingsData
|
|
||||||
import de.mm20.launcher2.preferences.LegacyDataStore
|
|
||||||
import de.mm20.launcher2.preferences.LegacySettings
|
|
||||||
import de.mm20.launcher2.preferences.ScreenOrientation
|
|
||||||
import de.mm20.launcher2.preferences.SearchBarColors
|
|
||||||
import de.mm20.launcher2.preferences.SearchBarStyle
|
|
||||||
import de.mm20.launcher2.preferences.SearchResultOrder
|
|
||||||
import de.mm20.launcher2.preferences.SurfaceShape
|
|
||||||
import de.mm20.launcher2.preferences.SystemBarColors
|
|
||||||
import de.mm20.launcher2.preferences.ThemeDescriptor
|
|
||||||
import de.mm20.launcher2.preferences.WeightFactor
|
|
||||||
import kotlinx.coroutines.flow.first
|
|
||||||
import java.util.UUID
|
|
||||||
|
|
||||||
class Migration1(
|
|
||||||
private val legacyDataStore: LegacyDataStore,
|
|
||||||
) : DataMigration<LauncherSettingsData> {
|
|
||||||
override suspend fun cleanUp() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
override suspend fun shouldMigrate(currentData: LauncherSettingsData): Boolean {
|
|
||||||
return legacyDataStore.data.first().version > 0 && currentData.schemaVersion < 1
|
|
||||||
}
|
|
||||||
|
|
||||||
override suspend fun migrate(currentData: LauncherSettingsData): LauncherSettingsData {
|
|
||||||
val legacyData = legacyDataStore.data.first()
|
|
||||||
return currentData.copy(
|
|
||||||
schemaVersion = 1,
|
|
||||||
uiBaseLayout = when (legacyData.layout.baseLayout) {
|
|
||||||
LegacySettings.LayoutSettings.Layout.Pager -> BaseLayout.PullDown
|
|
||||||
LegacySettings.LayoutSettings.Layout.PagerReversed -> BaseLayout.PagerReversed
|
|
||||||
else -> BaseLayout.PullDown
|
|
||||||
},
|
|
||||||
gridColumnCount = legacyData.grid.columnCount,
|
|
||||||
animationsCharging = legacyData.animations.charging,
|
|
||||||
badgesCloudFiles = legacyData.badges.cloudFiles,
|
|
||||||
badgesNotifications = legacyData.badges.notifications,
|
|
||||||
badgesShortcuts = legacyData.badges.shortcuts,
|
|
||||||
badgesSuspendedApps = legacyData.badges.suspendedApps,
|
|
||||||
calculatorEnabled = legacyData.calculatorSearch.enabled,
|
|
||||||
calendarSearchEnabled = legacyData.calendarSearch.enabled,
|
|
||||||
clockWidgetAlarmPart = legacyData.clockWidget.alarmPart,
|
|
||||||
clockWidgetBatteryPart = legacyData.clockWidget.batteryPart,
|
|
||||||
clockWidgetDatePart = legacyData.clockWidget.datePart,
|
|
||||||
clockWidgetColors = when (legacyData.clockWidget.color) {
|
|
||||||
LegacySettings.ClockWidgetSettings.ClockWidgetColors.Light -> ClockWidgetColors.Light
|
|
||||||
LegacySettings.ClockWidgetSettings.ClockWidgetColors.Dark -> ClockWidgetColors.Dark
|
|
||||||
else -> ClockWidgetColors.Auto
|
|
||||||
},
|
|
||||||
clockWidgetAlignment = when (legacyData.clockWidget.alignment) {
|
|
||||||
LegacySettings.ClockWidgetSettings.ClockWidgetAlignment.Top -> ClockWidgetAlignment.Top
|
|
||||||
LegacySettings.ClockWidgetSettings.ClockWidgetAlignment.Center -> ClockWidgetAlignment.Center
|
|
||||||
else -> ClockWidgetAlignment.Bottom
|
|
||||||
},
|
|
||||||
homeScreenDock = legacyData.clockWidget.favoritesPart,
|
|
||||||
clockWidgetFillHeight = legacyData.clockWidget.fillHeight,
|
|
||||||
clockWidgetCompact = legacyData.clockWidget.layout == LegacySettings.ClockWidgetSettings.ClockWidgetLayout.Horizontal,
|
|
||||||
clockWidgetMusicPart = legacyData.clockWidget.musicPart,
|
|
||||||
_clockWidgetStyle = when (legacyData.clockWidget.clockStyle) {
|
|
||||||
LegacySettings.ClockWidgetSettings.ClockStyle.DigitalClock1 -> ClockWidgetStyle.Digital1()
|
|
||||||
LegacySettings.ClockWidgetSettings.ClockStyle.DigitalClock2 -> ClockWidgetStyle.Digital2
|
|
||||||
LegacySettings.ClockWidgetSettings.ClockStyle.OrbitClock -> ClockWidgetStyle.Orbit
|
|
||||||
LegacySettings.ClockWidgetSettings.ClockStyle.BinaryClock -> ClockWidgetStyle.Binary
|
|
||||||
LegacySettings.ClockWidgetSettings.ClockStyle.AnalogClock -> ClockWidgetStyle.Analog
|
|
||||||
LegacySettings.ClockWidgetSettings.ClockStyle.EmptyClock -> ClockWidgetStyle.Empty
|
|
||||||
LegacySettings.ClockWidgetSettings.ClockStyle.DigitalClock1_MDY -> ClockWidgetStyle.Digital1(
|
|
||||||
variant = ClockWidgetStyle.Digital1.Variant.MDY
|
|
||||||
)
|
|
||||||
|
|
||||||
LegacySettings.ClockWidgetSettings.ClockStyle.DigitalClock1_Outlined -> ClockWidgetStyle.Digital1(
|
|
||||||
outlined = true
|
|
||||||
)
|
|
||||||
|
|
||||||
LegacySettings.ClockWidgetSettings.ClockStyle.DigitalClock1_OnePlus -> ClockWidgetStyle.Digital1(
|
|
||||||
variant = ClockWidgetStyle.Digital1.Variant.Default
|
|
||||||
)
|
|
||||||
|
|
||||||
else -> ClockWidgetStyle.Digital1()
|
|
||||||
},
|
|
||||||
contactSearchEnabled = legacyData.contactsSearch.enabled,
|
|
||||||
easterEgg = legacyData.easterEgg,
|
|
||||||
favoritesEditButton = legacyData.favorites.editButton,
|
|
||||||
favoritesEnabled = legacyData.favorites.enabled,
|
|
||||||
favoritesFrequentlyUsed = legacyData.favorites.frequentlyUsed,
|
|
||||||
favoritesFrequentlyUsedRows = legacyData.favorites.frequentlyUsedRows,
|
|
||||||
rankingWeightFactor = when (legacyData.resultOrdering.weightFactor) {
|
|
||||||
LegacySettings.SearchResultOrderingSettings.WeightFactor.Low -> WeightFactor.Low
|
|
||||||
LegacySettings.SearchResultOrderingSettings.WeightFactor.High -> WeightFactor.High
|
|
||||||
else -> WeightFactor.Default
|
|
||||||
},
|
|
||||||
fileSearchProviders = buildSet {
|
|
||||||
if (legacyData.fileSearch.localFiles) add("local")
|
|
||||||
if (legacyData.fileSearch.nextcloud) add("nextcloud")
|
|
||||||
if (legacyData.fileSearch.gdrive) add("gdrive")
|
|
||||||
if (legacyData.fileSearch.onedrive) add("onedrive")
|
|
||||||
},
|
|
||||||
gesturesDoubleTap = makeGestureSettings(
|
|
||||||
legacyData.gestures.doubleTap,
|
|
||||||
legacyData.gestures.doubleTapApp
|
|
||||||
),
|
|
||||||
gesturesSwipeDown = makeGestureSettings(
|
|
||||||
legacyData.gestures.swipeDown,
|
|
||||||
legacyData.gestures.swipeDownApp
|
|
||||||
),
|
|
||||||
gesturesSwipeLeft = makeGestureSettings(
|
|
||||||
legacyData.gestures.swipeLeft,
|
|
||||||
legacyData.gestures.swipeLeftApp
|
|
||||||
),
|
|
||||||
gesturesSwipeRight = makeGestureSettings(
|
|
||||||
legacyData.gestures.swipeRight,
|
|
||||||
legacyData.gestures.swipeRightApp
|
|
||||||
),
|
|
||||||
gesturesLongPress = makeGestureSettings(
|
|
||||||
legacyData.gestures.longPress,
|
|
||||||
legacyData.gestures.longPressApp
|
|
||||||
),
|
|
||||||
gesturesHomeButton = makeGestureSettings(
|
|
||||||
legacyData.gestures.homeButton,
|
|
||||||
legacyData.gestures.homeButtonApp
|
|
||||||
),
|
|
||||||
gridIconSize = legacyData.grid.iconSize,
|
|
||||||
gridLabels = legacyData.grid.showLabels,
|
|
||||||
mediaAllowList = legacyData.musicWidget.allowListList.toSet(),
|
|
||||||
mediaDenyList = legacyData.musicWidget.denyListList.toSet(),
|
|
||||||
hiddenItemsShowButton = legacyData.searchBar.hiddenItemsButton,
|
|
||||||
iconsAdaptify = legacyData.icons.adaptify,
|
|
||||||
iconsForceThemed = legacyData.icons.forceThemed,
|
|
||||||
iconsPack = legacyData.icons.iconPack.takeIf { it.isNotBlank() },
|
|
||||||
iconsPackThemed = legacyData.icons.iconPackThemed,
|
|
||||||
iconsShape = when (legacyData.icons.shape) {
|
|
||||||
LegacySettings.IconSettings.IconShape.Circle -> IconShape.Circle
|
|
||||||
LegacySettings.IconSettings.IconShape.Square -> IconShape.Square
|
|
||||||
LegacySettings.IconSettings.IconShape.Squircle -> IconShape.Squircle
|
|
||||||
LegacySettings.IconSettings.IconShape.RoundedSquare -> IconShape.RoundedSquare
|
|
||||||
LegacySettings.IconSettings.IconShape.EasterEgg -> IconShape.EasterEgg
|
|
||||||
LegacySettings.IconSettings.IconShape.Hexagon -> IconShape.Hexagon
|
|
||||||
LegacySettings.IconSettings.IconShape.Triangle -> IconShape.Triangle
|
|
||||||
LegacySettings.IconSettings.IconShape.Pentagon -> IconShape.Pentagon
|
|
||||||
LegacySettings.IconSettings.IconShape.Teardrop -> IconShape.Teardrop
|
|
||||||
LegacySettings.IconSettings.IconShape.Pebble -> IconShape.Pebble
|
|
||||||
else -> IconShape.PlatformDefault
|
|
||||||
},
|
|
||||||
iconsThemed = legacyData.icons.themedIcons,
|
|
||||||
searchBarBottom = legacyData.layout.bottomSearchBar,
|
|
||||||
searchBarColors = when (legacyData.systemBars.statusBarColor) {
|
|
||||||
LegacySettings.SystemBarsSettings.SystemBarColors.Light -> SearchBarColors.Light
|
|
||||||
LegacySettings.SystemBarsSettings.SystemBarColors.Dark -> SearchBarColors.Dark
|
|
||||||
else -> SearchBarColors.Auto
|
|
||||||
},
|
|
||||||
searchBarFixed = legacyData.layout.bottomSearchBar,
|
|
||||||
searchBarKeyboard = legacyData.searchBar.autoFocus,
|
|
||||||
searchBarStyle = when (legacyData.searchBar.searchBarStyle) {
|
|
||||||
LegacySettings.SearchBarSettings.SearchBarStyle.Hidden -> SearchBarStyle.Hidden
|
|
||||||
LegacySettings.SearchBarSettings.SearchBarStyle.Solid -> SearchBarStyle.Solid
|
|
||||||
else -> SearchBarStyle.Transparent
|
|
||||||
},
|
|
||||||
searchLaunchOnEnter = legacyData.searchBar.launchOnEnter,
|
|
||||||
searchResultOrder = when (legacyData.resultOrdering.ordering) {
|
|
||||||
LegacySettings.SearchResultOrderingSettings.Ordering.Alphabetic -> SearchResultOrder.Alphabetical
|
|
||||||
LegacySettings.SearchResultOrderingSettings.Ordering.LaunchCount -> SearchResultOrder.LaunchCount
|
|
||||||
else -> SearchResultOrder.Weighted
|
|
||||||
},
|
|
||||||
searchResultsReversed = legacyData.layout.reverseSearchResults,
|
|
||||||
shortcutSearchEnabled = legacyData.appShortcutSearch.enabled,
|
|
||||||
stateTagsMultiline = legacyData.ui.searchTagsMultiline,
|
|
||||||
surfacesBorderWidth = legacyData.cards.borderWidth,
|
|
||||||
surfacesOpacity = legacyData.cards.opacity,
|
|
||||||
surfacesRadius = legacyData.cards.radius,
|
|
||||||
surfacesShape = when (legacyData.cards.shape) {
|
|
||||||
LegacySettings.CardSettings.Shape.Cut -> SurfaceShape.Cut
|
|
||||||
else -> SurfaceShape.Rounded
|
|
||||||
},
|
|
||||||
systemBarsHideNav = legacyData.systemBars.hideNavBar,
|
|
||||||
systemBarsHideStatus = legacyData.systemBars.hideStatusBar,
|
|
||||||
systemBarsNavColors = when (legacyData.systemBars.navBarColor) {
|
|
||||||
LegacySettings.SystemBarsSettings.SystemBarColors.Light -> SystemBarColors.Light
|
|
||||||
LegacySettings.SystemBarsSettings.SystemBarColors.Dark -> SystemBarColors.Dark
|
|
||||||
else -> SystemBarColors.Auto
|
|
||||||
},
|
|
||||||
systemBarsStatusColors = when (legacyData.systemBars.statusBarColor) {
|
|
||||||
LegacySettings.SystemBarsSettings.SystemBarColors.Light -> SystemBarColors.Light
|
|
||||||
LegacySettings.SystemBarsSettings.SystemBarColors.Dark -> SystemBarColors.Dark
|
|
||||||
else -> SystemBarColors.Auto
|
|
||||||
},
|
|
||||||
uiColorScheme = when (legacyData.appearance.theme) {
|
|
||||||
LegacySettings.AppearanceSettings.Theme.Light -> ColorScheme.Light
|
|
||||||
LegacySettings.AppearanceSettings.Theme.Dark -> ColorScheme.Dark
|
|
||||||
else -> ColorScheme.System
|
|
||||||
},
|
|
||||||
uiFont = when (legacyData.appearance.font) {
|
|
||||||
LegacySettings.AppearanceSettings.Font.SystemDefault -> Font.System
|
|
||||||
else -> Font.Outfit
|
|
||||||
},
|
|
||||||
uiOrientation = when (legacyData.layout.fixedRotation) {
|
|
||||||
true -> ScreenOrientation.Portrait
|
|
||||||
else -> ScreenOrientation.Auto
|
|
||||||
},
|
|
||||||
uiTheme = when (legacyData.appearance.themeId) {
|
|
||||||
UUID(0L, 0L).toString() -> ThemeDescriptor.Default
|
|
||||||
UUID(0L, 1L).toString() -> ThemeDescriptor.BlackAndWhite
|
|
||||||
else -> ThemeDescriptor.Custom(legacyData.appearance.themeId)
|
|
||||||
},
|
|
||||||
unitConverterCurrencies = legacyData.unitConverterSearch.currencies,
|
|
||||||
unitConverterEnabled = legacyData.unitConverterSearch.enabled,
|
|
||||||
wallpaperBlur = legacyData.appearance.blurWallpaper,
|
|
||||||
weatherImperialUnits = legacyData.weather.imperialUnits,
|
|
||||||
wallpaperBlurRadius = legacyData.appearance.blurWallpaperRadius,
|
|
||||||
wallpaperDim = legacyData.appearance.dimWallpaper,
|
|
||||||
weatherProvider = when (legacyData.weather.provider) {
|
|
||||||
LegacySettings.WeatherSettings.WeatherProvider.MetNo -> "metno"
|
|
||||||
LegacySettings.WeatherSettings.WeatherProvider.OpenWeatherMap -> "owm"
|
|
||||||
LegacySettings.WeatherSettings.WeatherProvider.Here -> "here"
|
|
||||||
LegacySettings.WeatherSettings.WeatherProvider.BrightSky -> "dwd"
|
|
||||||
else -> "metno"
|
|
||||||
},
|
|
||||||
websiteSearchEnabled = legacyData.websiteSearch.enabled,
|
|
||||||
widgetsEditButton = legacyData.widgets.editButton,
|
|
||||||
wikipediaCustomUrl = legacyData.wikipediaSearch.customUrl.takeIf { it.isNotBlank() },
|
|
||||||
wikipediaSearchEnabled = legacyData.wikipediaSearch.enabled,
|
|
||||||
wikipediaSearchImages = legacyData.wikipediaSearch.images,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun makeGestureSettings(
|
|
||||||
gesture: LegacySettings.GestureSettings.GestureAction,
|
|
||||||
key: String
|
|
||||||
): GestureAction {
|
|
||||||
return when (gesture) {
|
|
||||||
LegacySettings.GestureSettings.GestureAction.OpenSearch -> GestureAction.Search
|
|
||||||
LegacySettings.GestureSettings.GestureAction.OpenNotificationDrawer -> GestureAction.Notifications
|
|
||||||
LegacySettings.GestureSettings.GestureAction.LockScreen -> GestureAction.ScreenLock
|
|
||||||
LegacySettings.GestureSettings.GestureAction.OpenQuickSettings -> GestureAction.QuickSettings
|
|
||||||
LegacySettings.GestureSettings.GestureAction.OpenRecents -> GestureAction.Recents
|
|
||||||
LegacySettings.GestureSettings.GestureAction.OpenPowerDialog -> GestureAction.PowerMenu
|
|
||||||
LegacySettings.GestureSettings.GestureAction.LaunchApp -> GestureAction.Launch(
|
|
||||||
key
|
|
||||||
)
|
|
||||||
|
|
||||||
else -> GestureAction.NoAction
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,22 +0,0 @@
|
|||||||
package de.mm20.launcher2.preferences.migrations
|
|
||||||
|
|
||||||
import de.mm20.launcher2.preferences.LegacySettings
|
|
||||||
|
|
||||||
class Migration_10_11: VersionedMigration(10, 11) {
|
|
||||||
override suspend fun applyMigrations(builder: LegacySettings.Builder): LegacySettings.Builder {
|
|
||||||
return builder.setAppearance(
|
|
||||||
builder.appearance.toBuilder()
|
|
||||||
.setCustomColors(
|
|
||||||
builder.appearance.customColors.toBuilder()
|
|
||||||
.setLightScheme(
|
|
||||||
builder.appearance.customColors.lightScheme.toBuilder()
|
|
||||||
.setSurfaceTint(builder.appearance.customColors.lightScheme.primary)
|
|
||||||
)
|
|
||||||
.setDarkScheme(
|
|
||||||
builder.appearance.customColors.darkScheme.toBuilder()
|
|
||||||
.setSurfaceTint(builder.appearance.customColors.darkScheme.primary)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,53 +0,0 @@
|
|||||||
package de.mm20.launcher2.preferences.migrations
|
|
||||||
|
|
||||||
import de.mm20.launcher2.ktx.isAtLeastApiLevel
|
|
||||||
import de.mm20.launcher2.preferences.LegacySettings
|
|
||||||
import de.mm20.launcher2.preferences.LegacySettings.GestureSettings
|
|
||||||
import de.mm20.launcher2.preferences.LegacySettings.LayoutSettings
|
|
||||||
|
|
||||||
class Migration_11_12: VersionedMigration(11, 12) {
|
|
||||||
override suspend fun applyMigrations(builder: LegacySettings.Builder): LegacySettings.Builder {
|
|
||||||
val oldLayout = builder.appearance.layout
|
|
||||||
when(oldLayout) {
|
|
||||||
LayoutSettings.Layout.Pager -> {
|
|
||||||
builder.setLayout(
|
|
||||||
LayoutSettings.newBuilder()
|
|
||||||
.setBaseLayout(LayoutSettings.Layout.Pager)
|
|
||||||
.setBottomSearchBar(true)
|
|
||||||
.setReverseSearchResults(true)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
LayoutSettings.Layout.PagerReversed -> {
|
|
||||||
builder.setLayout(
|
|
||||||
LayoutSettings.newBuilder()
|
|
||||||
.setBaseLayout(LayoutSettings.Layout.PagerReversed)
|
|
||||||
.setBottomSearchBar(true)
|
|
||||||
.setReverseSearchResults(true)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
else -> {
|
|
||||||
builder.setLayout(
|
|
||||||
LayoutSettings.newBuilder()
|
|
||||||
.setBaseLayout(LayoutSettings.Layout.PullDown)
|
|
||||||
.setBottomSearchBar(false)
|
|
||||||
.setReverseSearchResults(false)
|
|
||||||
)
|
|
||||||
.setGestures(
|
|
||||||
GestureSettings.newBuilder()
|
|
||||||
.setDoubleTap(
|
|
||||||
if (isAtLeastApiLevel(28)) {
|
|
||||||
GestureSettings.GestureAction.LockScreen
|
|
||||||
} else {
|
|
||||||
GestureSettings.GestureAction.None
|
|
||||||
}
|
|
||||||
)
|
|
||||||
.setLongPress(GestureSettings.GestureAction.None)
|
|
||||||
.setSwipeDown(GestureSettings.GestureAction.OpenNotificationDrawer)
|
|
||||||
.setSwipeLeft(GestureSettings.GestureAction.None)
|
|
||||||
.setSwipeRight(GestureSettings.GestureAction.None)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return builder
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,20 +0,0 @@
|
|||||||
package de.mm20.launcher2.preferences.migrations
|
|
||||||
|
|
||||||
import de.mm20.launcher2.preferences.LegacySettings
|
|
||||||
import de.mm20.launcher2.preferences.LegacySettings.SearchResultOrderingSettings.WeightFactor
|
|
||||||
|
|
||||||
class Migration_12_13: VersionedMigration(12, 13) {
|
|
||||||
override suspend fun applyMigrations(builder: LegacySettings.Builder): LegacySettings.Builder {
|
|
||||||
return builder
|
|
||||||
.setClockWidget(
|
|
||||||
builder.clockWidget.toBuilder()
|
|
||||||
.setDatePart(true)
|
|
||||||
.build()
|
|
||||||
)
|
|
||||||
.setResultOrdering(
|
|
||||||
builder.resultOrdering.toBuilder()
|
|
||||||
.setWeightFactor(WeightFactor.Default)
|
|
||||||
.build()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
package de.mm20.launcher2.preferences.migrations
|
|
||||||
|
|
||||||
import de.mm20.launcher2.preferences.LegacySettings
|
|
||||||
|
|
||||||
class Migration_13_14 : VersionedMigration(13, 14) {
|
|
||||||
override suspend fun applyMigrations(builder: LegacySettings.Builder): LegacySettings.Builder {
|
|
||||||
return builder
|
|
||||||
.setIcons(
|
|
||||||
builder.icons.toBuilder()
|
|
||||||
.setIconPackThemed(true)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,12 +0,0 @@
|
|||||||
package de.mm20.launcher2.preferences.migrations
|
|
||||||
|
|
||||||
import de.mm20.launcher2.preferences.LegacySettings
|
|
||||||
|
|
||||||
class Migration_14_15: VersionedMigration(14, 15) {
|
|
||||||
override suspend fun applyMigrations(builder: LegacySettings.Builder): LegacySettings.Builder {
|
|
||||||
return builder.setSearchBar(
|
|
||||||
builder.searchBar.toBuilder()
|
|
||||||
.setHiddenItemsButton(true)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,51 +0,0 @@
|
|||||||
package de.mm20.launcher2.preferences.migrations
|
|
||||||
|
|
||||||
import de.mm20.launcher2.preferences.LegacySettings
|
|
||||||
import de.mm20.launcher2.preferences.LegacySettings.AppearanceSettings.CustomColors.Scheme
|
|
||||||
import palettes.TonalPalette
|
|
||||||
|
|
||||||
class Migration_15_16 : VersionedMigration(15, 16) {
|
|
||||||
override suspend fun applyMigrations(builder: LegacySettings.Builder): LegacySettings.Builder {
|
|
||||||
return builder.setAppearance(
|
|
||||||
builder.appearance.toBuilder()
|
|
||||||
.setCustomColors(
|
|
||||||
builder.appearance.customColors.toBuilder()
|
|
||||||
.setLightScheme(
|
|
||||||
migrateColorScheme(
|
|
||||||
builder.appearance.customColors.lightScheme,
|
|
||||||
false,
|
|
||||||
builder.appearance.customColors.advancedMode
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.setDarkScheme(
|
|
||||||
migrateColorScheme(
|
|
||||||
builder.appearance.customColors.darkScheme,
|
|
||||||
true,
|
|
||||||
builder.appearance.customColors.advancedMode
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun migrateColorScheme(colorScheme: Scheme, dark: Boolean, advancedMode: Boolean): Scheme {
|
|
||||||
val oldSurface = colorScheme.surface
|
|
||||||
val oldSurfaceVariant = colorScheme.surfaceVariant
|
|
||||||
val neutralPalette = TonalPalette.fromInt(oldSurface)
|
|
||||||
val neutralVariantPalette = TonalPalette.fromInt(oldSurfaceVariant)
|
|
||||||
|
|
||||||
return colorScheme.toBuilder().apply {
|
|
||||||
if (!advancedMode) {
|
|
||||||
surface = neutralPalette.tone(if (dark) 6 else 98)
|
|
||||||
}
|
|
||||||
surfaceDim = neutralPalette.tone(if (dark) 6 else 87)
|
|
||||||
surfaceBright = neutralPalette.tone(if (dark) 24 else 98)
|
|
||||||
surfaceContainerLowest = neutralVariantPalette.tone(if (dark) 4 else 100)
|
|
||||||
surfaceContainerLow = neutralVariantPalette.tone(if (dark) 10 else 96)
|
|
||||||
surfaceContainer = neutralVariantPalette.tone(if (dark) 12 else 94)
|
|
||||||
surfaceContainerHigh = neutralVariantPalette.tone(if (dark) 17 else 92)
|
|
||||||
surfaceContainerHighest = neutralVariantPalette.tone(if (dark) 22 else 90)
|
|
||||||
}.build()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,23 +0,0 @@
|
|||||||
package de.mm20.launcher2.preferences.migrations
|
|
||||||
|
|
||||||
import de.mm20.launcher2.preferences.LegacySettings
|
|
||||||
import java.util.UUID
|
|
||||||
|
|
||||||
class Migration_16_17: VersionedMigration(16, 17) {
|
|
||||||
override suspend fun applyMigrations(builder: LegacySettings.Builder): LegacySettings.Builder {
|
|
||||||
return builder.setAppearance(
|
|
||||||
builder.appearance.toBuilder()
|
|
||||||
.setThemeId(
|
|
||||||
when(builder.appearance.colorScheme) {
|
|
||||||
LegacySettings.AppearanceSettings.ColorScheme.BlackAndWhite -> UUID(0L, 1L)
|
|
||||||
LegacySettings.AppearanceSettings.ColorScheme.Custom -> UUID(1L, 1L)
|
|
||||||
else -> UUID(0L, 0L)
|
|
||||||
}.toString()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.setAnimations(
|
|
||||||
builder.animations.toBuilder()
|
|
||||||
.setCharging(true)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,15 +0,0 @@
|
|||||||
package de.mm20.launcher2.preferences.migrations
|
|
||||||
|
|
||||||
import de.mm20.launcher2.preferences.LegacySettings
|
|
||||||
|
|
||||||
class Migration_17_18 : VersionedMigration(17, 18) {
|
|
||||||
override suspend fun applyMigrations(builder: LegacySettings.Builder): LegacySettings.Builder {
|
|
||||||
return builder
|
|
||||||
.setAppearance(builder.appearance.toBuilder()
|
|
||||||
.setBlurWallpaperRadius(32)
|
|
||||||
)
|
|
||||||
.setClockWidget(builder.clockWidget.toBuilder()
|
|
||||||
.setAlignment(LegacySettings.ClockWidgetSettings.ClockWidgetAlignment.Bottom)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,15 +0,0 @@
|
|||||||
package de.mm20.launcher2.preferences.migrations
|
|
||||||
|
|
||||||
import de.mm20.launcher2.preferences.LegacySettings
|
|
||||||
|
|
||||||
class Migration_1_2: VersionedMigration(1, 2) {
|
|
||||||
|
|
||||||
override suspend fun applyMigrations(builder: LegacySettings.Builder): LegacySettings.Builder {
|
|
||||||
return builder.setSystemBars(
|
|
||||||
builder.systemBars.toBuilder()
|
|
||||||
.setHideNavBar(false)
|
|
||||||
.setHideStatusBar(false)
|
|
||||||
)
|
|
||||||
.setSearchBar(builder.searchBar.toBuilder().setAutoFocus(false))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,14 +0,0 @@
|
|||||||
package de.mm20.launcher2.preferences.migrations
|
|
||||||
|
|
||||||
import de.mm20.launcher2.preferences.LegacySettings
|
|
||||||
|
|
||||||
class Migration_2_3: VersionedMigration(2, 3) {
|
|
||||||
override suspend fun applyMigrations(builder: LegacySettings.Builder): LegacySettings.Builder {
|
|
||||||
return builder.setClockWidget(
|
|
||||||
builder.clockWidget.toBuilder()
|
|
||||||
.setAlarmPart(true)
|
|
||||||
.setBatteryPart(true)
|
|
||||||
.setMusicPart(true)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,12 +0,0 @@
|
|||||||
package de.mm20.launcher2.preferences.migrations
|
|
||||||
|
|
||||||
import de.mm20.launcher2.preferences.LegacySettings
|
|
||||||
|
|
||||||
class Migration_3_4: VersionedMigration(3, 4) {
|
|
||||||
override suspend fun applyMigrations(builder: LegacySettings.Builder): LegacySettings.Builder {
|
|
||||||
return builder.setAppShortcutSearch(
|
|
||||||
LegacySettings.AppShortcutSearchSettings.newBuilder()
|
|
||||||
.setEnabled(true)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
package de.mm20.launcher2.preferences.migrations
|
|
||||||
|
|
||||||
import de.mm20.launcher2.preferences.LegacySettings
|
|
||||||
|
|
||||||
class Migration_4_5: VersionedMigration(4, 5) {
|
|
||||||
override suspend fun applyMigrations(builder: LegacySettings.Builder): LegacySettings.Builder {
|
|
||||||
return builder.setGrid(
|
|
||||||
builder.grid.toBuilder()
|
|
||||||
.setIconSize(48)
|
|
||||||
.build()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,24 +0,0 @@
|
|||||||
package de.mm20.launcher2.preferences.migrations
|
|
||||||
|
|
||||||
import de.mm20.launcher2.preferences.DefaultCustomColorsBase
|
|
||||||
import de.mm20.launcher2.preferences.DefaultDarkCustomColorScheme
|
|
||||||
import de.mm20.launcher2.preferences.DefaultLightCustomColorScheme
|
|
||||||
import de.mm20.launcher2.preferences.LegacySettings
|
|
||||||
|
|
||||||
class Migration_5_6: VersionedMigration(5, 6) {
|
|
||||||
override suspend fun applyMigrations(builder: LegacySettings.Builder): LegacySettings.Builder {
|
|
||||||
return builder.setAppearance(
|
|
||||||
builder.appearance.toBuilder()
|
|
||||||
.setCustomColors(
|
|
||||||
LegacySettings.AppearanceSettings.CustomColors.newBuilder()
|
|
||||||
.setAdvancedMode(false)
|
|
||||||
.setBaseColors(DefaultCustomColorsBase)
|
|
||||||
.setLightScheme(DefaultLightCustomColorScheme)
|
|
||||||
.setDarkScheme(DefaultDarkCustomColorScheme)
|
|
||||||
)
|
|
||||||
).setUnitConverterSearch(
|
|
||||||
builder.unitConverterSearch.toBuilder()
|
|
||||||
.setCurrencies(true)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,12 +0,0 @@
|
|||||||
package de.mm20.launcher2.preferences.migrations
|
|
||||||
|
|
||||||
import de.mm20.launcher2.preferences.LegacySettings
|
|
||||||
|
|
||||||
class Migration_6_7 : VersionedMigration(6, 7) {
|
|
||||||
override suspend fun applyMigrations(builder: LegacySettings.Builder): LegacySettings.Builder {
|
|
||||||
return builder.setIcons(
|
|
||||||
builder.icons.toBuilder()
|
|
||||||
.setAdaptify(true)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
package de.mm20.launcher2.preferences.migrations
|
|
||||||
|
|
||||||
import de.mm20.launcher2.preferences.LegacySettings
|
|
||||||
|
|
||||||
class Migration_7_8: VersionedMigration(7, 8) {
|
|
||||||
override suspend fun applyMigrations(builder: LegacySettings.Builder): LegacySettings.Builder {
|
|
||||||
return builder.setAppearance(
|
|
||||||
builder.appearance.toBuilder()
|
|
||||||
.setBlurWallpaper(true)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,18 +0,0 @@
|
|||||||
package de.mm20.launcher2.preferences.migrations
|
|
||||||
|
|
||||||
import de.mm20.launcher2.preferences.LegacySettings
|
|
||||||
|
|
||||||
class Migration_8_9: VersionedMigration(8, 9) {
|
|
||||||
override suspend fun applyMigrations(builder: LegacySettings.Builder): LegacySettings.Builder {
|
|
||||||
return builder
|
|
||||||
.setClockWidget(
|
|
||||||
builder.clockWidget.toBuilder()
|
|
||||||
.setFillHeight(true)
|
|
||||||
)
|
|
||||||
.setGrid(
|
|
||||||
builder.grid.toBuilder()
|
|
||||||
.setShowLabels(true)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,19 +0,0 @@
|
|||||||
package de.mm20.launcher2.preferences.migrations
|
|
||||||
|
|
||||||
import de.mm20.launcher2.preferences.LegacySettings
|
|
||||||
|
|
||||||
class Migration_9_10 : VersionedMigration(9, 10) {
|
|
||||||
override suspend fun applyMigrations(builder: LegacySettings.Builder): LegacySettings.Builder {
|
|
||||||
return builder
|
|
||||||
.setFavorites(
|
|
||||||
builder.favorites.toBuilder()
|
|
||||||
.setFrequentlyUsed(true)
|
|
||||||
.setFrequentlyUsedRows(1)
|
|
||||||
.setEditButton(true)
|
|
||||||
)
|
|
||||||
.setWidgets(
|
|
||||||
LegacySettings.WidgetSettings.newBuilder()
|
|
||||||
.setEditButton(true)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,25 +0,0 @@
|
|||||||
package de.mm20.launcher2.preferences.migrations
|
|
||||||
|
|
||||||
import androidx.datastore.core.DataMigration
|
|
||||||
import de.mm20.launcher2.preferences.SchemaVersion
|
|
||||||
import de.mm20.launcher2.preferences.LegacySettings
|
|
||||||
|
|
||||||
abstract class VersionedMigration(
|
|
||||||
private val fromVersion: Int,
|
|
||||||
private val toVersion: Int
|
|
||||||
) : DataMigration<LegacySettings> {
|
|
||||||
abstract suspend fun applyMigrations(builder: LegacySettings.Builder): LegacySettings.Builder
|
|
||||||
|
|
||||||
final override suspend fun migrate(currentData: LegacySettings): LegacySettings {
|
|
||||||
val builder = currentData.toBuilder()
|
|
||||||
applyMigrations(builder)
|
|
||||||
builder.version = toVersion
|
|
||||||
return builder.build()
|
|
||||||
}
|
|
||||||
|
|
||||||
override suspend fun cleanUp() {}
|
|
||||||
|
|
||||||
override suspend fun shouldMigrate(currentData: LegacySettings): Boolean {
|
|
||||||
return currentData.version <= fromVersion && SchemaVersion >= toVersion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,386 +0,0 @@
|
|||||||
syntax = "proto3";
|
|
||||||
|
|
||||||
option java_package = "de.mm20.launcher2.preferences";
|
|
||||||
option java_multiple_files = true;
|
|
||||||
|
|
||||||
message LegacySettings {
|
|
||||||
uint32 version = 1;
|
|
||||||
message AppearanceSettings {
|
|
||||||
enum Theme {
|
|
||||||
Light = 0;
|
|
||||||
Dark = 1;
|
|
||||||
System = 2;
|
|
||||||
}
|
|
||||||
Theme theme = 1;
|
|
||||||
enum ColorScheme {
|
|
||||||
Default = 0;
|
|
||||||
BlackAndWhite = 1;
|
|
||||||
DebugMaterialYouCompat = 2;
|
|
||||||
Custom = 3;
|
|
||||||
EasterEgg = 4;
|
|
||||||
}
|
|
||||||
ColorScheme color_scheme = 6 [deprecated = true];
|
|
||||||
message CustomColors {
|
|
||||||
bool advanced_mode = 1;
|
|
||||||
message BaseColors {
|
|
||||||
uint32 accent1 = 1;
|
|
||||||
uint32 accent2 = 2;
|
|
||||||
uint32 accent3 = 3;
|
|
||||||
uint32 neutral1 = 4;
|
|
||||||
uint32 neutral2 = 5;
|
|
||||||
uint32 error = 6;
|
|
||||||
}
|
|
||||||
BaseColors base_colors = 2;
|
|
||||||
message Scheme {
|
|
||||||
uint32 primary = 1;
|
|
||||||
uint32 on_primary = 2;
|
|
||||||
uint32 primary_container = 3;
|
|
||||||
uint32 on_primary_container = 4;
|
|
||||||
uint32 secondary = 5;
|
|
||||||
uint32 on_secondary = 6;
|
|
||||||
uint32 secondary_container = 7;
|
|
||||||
uint32 on_secondary_container = 8;
|
|
||||||
uint32 tertiary = 9;
|
|
||||||
uint32 on_tertiary = 10;
|
|
||||||
uint32 tertiary_container = 11;
|
|
||||||
uint32 on_tertiary_container = 12;
|
|
||||||
uint32 background = 13;
|
|
||||||
uint32 on_background = 14;
|
|
||||||
uint32 surface = 15;
|
|
||||||
uint32 on_surface = 16;
|
|
||||||
uint32 surface_variant = 17;
|
|
||||||
uint32 on_surface_variant = 18;
|
|
||||||
uint32 outline = 19;
|
|
||||||
uint32 inverse_surface = 20;
|
|
||||||
uint32 inverse_on_surface = 21;
|
|
||||||
uint32 inverse_primary = 22;
|
|
||||||
uint32 error = 23;
|
|
||||||
uint32 on_error = 24;
|
|
||||||
uint32 error_container = 25;
|
|
||||||
uint32 on_error_container = 26;
|
|
||||||
uint32 outline_variant = 27;
|
|
||||||
uint32 scrim = 28;
|
|
||||||
uint32 surface_tint = 29;
|
|
||||||
uint32 surface_dim = 30;
|
|
||||||
uint32 surface_bright = 31;
|
|
||||||
uint32 surface_container_lowest = 32;
|
|
||||||
uint32 surface_container_low = 33;
|
|
||||||
uint32 surface_container = 34;
|
|
||||||
uint32 surface_container_high = 35;
|
|
||||||
uint32 surface_container_highest = 36;
|
|
||||||
}
|
|
||||||
Scheme light_scheme = 3;
|
|
||||||
Scheme dark_scheme = 4;
|
|
||||||
}
|
|
||||||
CustomColors custom_colors = 8 [deprecated = true];
|
|
||||||
bool dim_wallpaper = 7;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Deprecated, use layout instead
|
|
||||||
*/
|
|
||||||
LayoutSettings.Layout layout = 9 [deprecated = true];
|
|
||||||
|
|
||||||
enum Font {
|
|
||||||
Outfit = 0;
|
|
||||||
SystemDefault = 1;
|
|
||||||
}
|
|
||||||
Font font = 10;
|
|
||||||
|
|
||||||
bool blur_wallpaper = 11;
|
|
||||||
// UUID of the selected theme
|
|
||||||
string theme_id = 12;
|
|
||||||
uint32 blur_wallpaper_radius = 13;
|
|
||||||
}
|
|
||||||
AppearanceSettings appearance = 2;
|
|
||||||
|
|
||||||
message WeatherSettings {
|
|
||||||
enum WeatherProvider {
|
|
||||||
MetNo = 0;
|
|
||||||
OpenWeatherMap = 1;
|
|
||||||
Here = 2;
|
|
||||||
BrightSky = 3;
|
|
||||||
}
|
|
||||||
WeatherProvider provider = 1;
|
|
||||||
bool imperial_units = 2;
|
|
||||||
reserved 3;
|
|
||||||
}
|
|
||||||
WeatherSettings weather = 5;
|
|
||||||
|
|
||||||
message MusicWidgetSettings {
|
|
||||||
reserved 1;
|
|
||||||
repeated string allow_list = 2;
|
|
||||||
repeated string deny_list = 3;
|
|
||||||
}
|
|
||||||
MusicWidgetSettings music_widget = 6;
|
|
||||||
|
|
||||||
message ClockWidgetSettings {
|
|
||||||
enum ClockWidgetLayout {
|
|
||||||
Vertical = 0;
|
|
||||||
Horizontal = 1;
|
|
||||||
}
|
|
||||||
ClockWidgetLayout layout = 1;
|
|
||||||
enum ClockStyle {
|
|
||||||
DigitalClock1 = 0;
|
|
||||||
DigitalClock2 = 1;
|
|
||||||
OrbitClock = 5;
|
|
||||||
BinaryClock = 2;
|
|
||||||
AnalogClock = 3;
|
|
||||||
EmptyClock = 4;
|
|
||||||
DigitalClock1_MDY = 6;
|
|
||||||
DigitalClock1_Outlined = 7;
|
|
||||||
DigitalClock1_OnePlus = 8;
|
|
||||||
}
|
|
||||||
ClockStyle clock_style = 2;
|
|
||||||
bool date_part = 3;
|
|
||||||
bool music_part = 4;
|
|
||||||
bool battery_part = 5;
|
|
||||||
bool alarm_part = 6;
|
|
||||||
bool favorites_part = 7;
|
|
||||||
bool fill_height = 8;
|
|
||||||
|
|
||||||
enum ClockWidgetColors {
|
|
||||||
Auto = 0;
|
|
||||||
Light = 1;
|
|
||||||
Dark = 2;
|
|
||||||
}
|
|
||||||
ClockWidgetColors color = 9;
|
|
||||||
|
|
||||||
enum ClockWidgetAlignment {
|
|
||||||
Bottom = 0;
|
|
||||||
Center = 1;
|
|
||||||
Top = 2;
|
|
||||||
}
|
|
||||||
ClockWidgetAlignment alignment = 10;
|
|
||||||
}
|
|
||||||
ClockWidgetSettings clock_widget = 7;
|
|
||||||
|
|
||||||
message FavoritesSettings {
|
|
||||||
bool enabled = 1;
|
|
||||||
bool frequently_used = 2;
|
|
||||||
int32 frequently_used_rows = 3;
|
|
||||||
bool edit_button = 4;
|
|
||||||
}
|
|
||||||
FavoritesSettings favorites = 8;
|
|
||||||
|
|
||||||
message FilesSearchSettings {
|
|
||||||
bool local_files = 1;
|
|
||||||
bool gdrive = 2;
|
|
||||||
bool onedrive = 3;
|
|
||||||
bool nextcloud = 4;
|
|
||||||
bool owncloud = 5;
|
|
||||||
}
|
|
||||||
FilesSearchSettings file_search = 9 [deprecated = true];
|
|
||||||
|
|
||||||
message ContactsSearchSettings {
|
|
||||||
bool enabled = 1;
|
|
||||||
}
|
|
||||||
ContactsSearchSettings contacts_search = 10;
|
|
||||||
|
|
||||||
message CalendarSearchSettings {
|
|
||||||
bool enabled = 1;
|
|
||||||
}
|
|
||||||
CalendarSearchSettings calendar_search = 11;
|
|
||||||
|
|
||||||
message CalculatorSearchSettings {
|
|
||||||
bool enabled = 1;
|
|
||||||
}
|
|
||||||
CalculatorSearchSettings calculator_search = 12;
|
|
||||||
|
|
||||||
message UnitConverterSearchSettings {
|
|
||||||
bool enabled = 1;
|
|
||||||
bool currencies = 2;
|
|
||||||
}
|
|
||||||
UnitConverterSearchSettings unit_converter_search = 13;
|
|
||||||
|
|
||||||
message WikipediaSearchSettings {
|
|
||||||
bool enabled = 1;
|
|
||||||
bool images = 2;
|
|
||||||
string custom_url = 3;
|
|
||||||
}
|
|
||||||
WikipediaSearchSettings wikipedia_search = 14;
|
|
||||||
|
|
||||||
message WebsiteSearchSettings {
|
|
||||||
bool enabled = 1;
|
|
||||||
}
|
|
||||||
WebsiteSearchSettings website_search = 15;
|
|
||||||
|
|
||||||
message WebSearchSettings {
|
|
||||||
bool enabled = 1;
|
|
||||||
}
|
|
||||||
WebSearchSettings web_search = 16;
|
|
||||||
|
|
||||||
message CalendarWidgetSettings {
|
|
||||||
bool hide_allday_events = 1;
|
|
||||||
repeated int64 exclude_calendars = 2;
|
|
||||||
}
|
|
||||||
CalendarWidgetSettings calendar_widget = 17;
|
|
||||||
|
|
||||||
message BadgeSettings {
|
|
||||||
bool notifications = 1;
|
|
||||||
bool suspended_apps = 2;
|
|
||||||
bool cloud_files = 3;
|
|
||||||
bool shortcuts = 4;
|
|
||||||
}
|
|
||||||
BadgeSettings badges = 18 [deprecated = true];
|
|
||||||
|
|
||||||
message GridSettings {
|
|
||||||
uint32 column_count = 1;
|
|
||||||
uint32 icon_size = 2;
|
|
||||||
bool show_labels = 3;
|
|
||||||
}
|
|
||||||
GridSettings grid = 19;
|
|
||||||
|
|
||||||
message SearchBarSettings {
|
|
||||||
enum SearchBarStyle {
|
|
||||||
Transparent = 0;
|
|
||||||
Solid = 1;
|
|
||||||
Hidden = 2;
|
|
||||||
}
|
|
||||||
SearchBarStyle search_bar_style = 1;
|
|
||||||
bool auto_focus = 2;
|
|
||||||
enum SearchBarColors {
|
|
||||||
Auto = 0;
|
|
||||||
Light = 1;
|
|
||||||
Dark = 2;
|
|
||||||
}
|
|
||||||
SearchBarColors color = 3;
|
|
||||||
bool launch_on_enter = 4;
|
|
||||||
bool hidden_items_button = 5;
|
|
||||||
}
|
|
||||||
SearchBarSettings search_bar = 20;
|
|
||||||
|
|
||||||
message IconSettings {
|
|
||||||
enum IconShape {
|
|
||||||
PlatformDefault = 0;
|
|
||||||
Circle = 1;
|
|
||||||
Square = 2;
|
|
||||||
RoundedSquare = 3;
|
|
||||||
Triangle = 4;
|
|
||||||
Squircle = 5;
|
|
||||||
Hexagon = 6;
|
|
||||||
Pentagon = 7;
|
|
||||||
EasterEgg = 8;
|
|
||||||
Teardrop = 9;
|
|
||||||
Pebble = 10;
|
|
||||||
}
|
|
||||||
IconShape shape = 1;
|
|
||||||
bool themed_icons = 2;
|
|
||||||
string icon_pack = 3;
|
|
||||||
reserved 4;
|
|
||||||
bool adaptify = 5;
|
|
||||||
bool force_themed = 6;
|
|
||||||
bool icon_pack_themed = 7;
|
|
||||||
}
|
|
||||||
IconSettings icons = 21;
|
|
||||||
|
|
||||||
bool easter_egg = 22;
|
|
||||||
|
|
||||||
message SystemBarsSettings {
|
|
||||||
enum SystemBarColors {
|
|
||||||
// Light icons
|
|
||||||
Auto = 0;
|
|
||||||
// Dark icons
|
|
||||||
Dark = 1;
|
|
||||||
// Wallpaper based
|
|
||||||
Light = 2;
|
|
||||||
}
|
|
||||||
SystemBarColors statusBarColor = 1;
|
|
||||||
SystemBarColors navBarColor = 2;
|
|
||||||
bool hideStatusBar = 3;
|
|
||||||
bool hideNavBar = 4;
|
|
||||||
}
|
|
||||||
SystemBarsSettings system_bars = 23;
|
|
||||||
|
|
||||||
message CardSettings {
|
|
||||||
float opacity = 1;
|
|
||||||
uint32 radius = 2;
|
|
||||||
uint32 border_width = 3;
|
|
||||||
Shape shape = 4;
|
|
||||||
enum Shape {
|
|
||||||
Rounded = 0;
|
|
||||||
Cut = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
CardSettings cards = 24;
|
|
||||||
|
|
||||||
message AppShortcutSearchSettings {
|
|
||||||
bool enabled = 1;
|
|
||||||
}
|
|
||||||
AppShortcutSearchSettings app_shortcut_search = 25;
|
|
||||||
|
|
||||||
message WidgetSettings {
|
|
||||||
bool edit_button = 1;
|
|
||||||
}
|
|
||||||
WidgetSettings widgets = 26;
|
|
||||||
|
|
||||||
message LayoutSettings {
|
|
||||||
enum Layout {
|
|
||||||
PullDown = 0;
|
|
||||||
Pager = 1;
|
|
||||||
PagerReversed = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
Layout base_layout = 1;
|
|
||||||
bool bottom_search_bar = 2;
|
|
||||||
bool reverse_search_results = 3;
|
|
||||||
bool fixed_search_bar = 4;
|
|
||||||
bool fixed_rotation = 5;
|
|
||||||
}
|
|
||||||
LayoutSettings layout = 27;
|
|
||||||
|
|
||||||
message GestureSettings {
|
|
||||||
enum GestureAction {
|
|
||||||
None = 0;
|
|
||||||
OpenSearch = 1;
|
|
||||||
OpenNotificationDrawer = 2;
|
|
||||||
LockScreen = 3;
|
|
||||||
OpenQuickSettings = 4;
|
|
||||||
OpenRecents = 5;
|
|
||||||
OpenPowerDialog = 6;
|
|
||||||
LaunchApp = 7;
|
|
||||||
}
|
|
||||||
GestureAction swipe_down = 1;
|
|
||||||
GestureAction swipe_left = 2;
|
|
||||||
GestureAction swipe_right = 3;
|
|
||||||
GestureAction double_tap = 4;
|
|
||||||
GestureAction long_press = 5;
|
|
||||||
string swipe_down_app = 6;
|
|
||||||
string swipe_left_app = 7;
|
|
||||||
string swipe_right_app = 8;
|
|
||||||
string double_tap_app = 9;
|
|
||||||
string long_press_app = 10;
|
|
||||||
GestureAction home_button = 11;
|
|
||||||
string home_button_app = 12;
|
|
||||||
}
|
|
||||||
GestureSettings gestures = 28;
|
|
||||||
|
|
||||||
message SearchResultOrderingSettings {
|
|
||||||
enum Ordering {
|
|
||||||
Alphabetic = 0;
|
|
||||||
LaunchCount = 1;
|
|
||||||
Weighted = 2;
|
|
||||||
}
|
|
||||||
Ordering ordering = 1;
|
|
||||||
enum WeightFactor {
|
|
||||||
Low = 0;
|
|
||||||
Default = 1;
|
|
||||||
High = 2;
|
|
||||||
}
|
|
||||||
WeightFactor weight_factor = 2;
|
|
||||||
}
|
|
||||||
SearchResultOrderingSettings result_ordering = 29;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Persistent UI state that does not have a corresponding setting.
|
|
||||||
*/
|
|
||||||
message UiState {
|
|
||||||
bool search_tags_multiline = 1;
|
|
||||||
bool widget_tags_multiline = 2;
|
|
||||||
}
|
|
||||||
UiState ui = 30;
|
|
||||||
|
|
||||||
message AnimationSettings {
|
|
||||||
bool charging = 1;
|
|
||||||
}
|
|
||||||
AnimationSettings animations = 31;
|
|
||||||
}
|
|
||||||
@ -11,7 +11,6 @@ pluginSdk = "2.1.0-SNAPSHOT"
|
|||||||
|
|
||||||
gradle = "8.1.2"
|
gradle = "8.1.2"
|
||||||
android-gradle-plugin = "8.2.2"
|
android-gradle-plugin = "8.2.2"
|
||||||
protobuf-gradle-plugin = "0.9.4"
|
|
||||||
ksp-gradle-plugin = "2.0.0-1.0.21"
|
ksp-gradle-plugin = "2.0.0-1.0.21"
|
||||||
|
|
||||||
kotlin = "2.0.0"
|
kotlin = "2.0.0"
|
||||||
@ -37,7 +36,6 @@ androidx-constraint-layout = "1.1.0-alpha13"
|
|||||||
accompanist = "0.33.2-alpha"
|
accompanist = "0.33.2-alpha"
|
||||||
coil = "2.3.0"
|
coil = "2.3.0"
|
||||||
koin = "3.2.0"
|
koin = "3.2.0"
|
||||||
protobuf = "3.14.0"
|
|
||||||
retrofit = "2.9.0"
|
retrofit = "2.9.0"
|
||||||
junit = "4.13.2"
|
junit = "4.13.2"
|
||||||
junitVersion = "1.1.5"
|
junitVersion = "1.1.5"
|
||||||
@ -128,9 +126,6 @@ google-apiclient = { group = "com.google.api-client", name = "google-api-client"
|
|||||||
google-drive = { group = "com.google.apis", name = "google-api-services-drive", version = "v3-rev20221219-2.0.0" }
|
google-drive = { group = "com.google.apis", name = "google-api-services-drive", version = "v3-rev20221219-2.0.0" }
|
||||||
google-oauth2 = { group = "com.google.apis", name = "google-api-services-oauth2", version = "v2-rev20200213-2.0.0" }
|
google-oauth2 = { group = "com.google.apis", name = "google-api-services-oauth2", version = "v2-rev20200213-2.0.0" }
|
||||||
|
|
||||||
protobuf-protoc = { group = "com.google.protobuf", name = "protoc", version.ref = "protobuf" }
|
|
||||||
protobuf-javalite = { group = "com.google.protobuf", name = "protobuf-javalite", version.ref = "protobuf" }
|
|
||||||
|
|
||||||
koin-android = { group = "io.insert-koin", name = "koin-android", version.ref = "koin" }
|
koin-android = { group = "io.insert-koin", name = "koin-android", version.ref = "koin" }
|
||||||
koin-androidxcompose = { group = "io.insert-koin", name = "koin-androidx-compose", version.ref = "koin" }
|
koin-androidxcompose = { group = "io.insert-koin", name = "koin-androidx-compose", version.ref = "koin" }
|
||||||
|
|
||||||
@ -150,7 +145,6 @@ tests = ["junit"]
|
|||||||
[plugins]
|
[plugins]
|
||||||
android-application = { id = "com.android.application", version.ref = "android-gradle-plugin" }
|
android-application = { id = "com.android.application", version.ref = "android-gradle-plugin" }
|
||||||
android-library = { id = "com.android.library", version.ref = "android-gradle-plugin" }
|
android-library = { id = "com.android.library", version.ref = "android-gradle-plugin" }
|
||||||
protobuf = { id = "com.google.protobuf", version.ref = "protobuf-gradle-plugin" }
|
|
||||||
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp-gradle-plugin" }
|
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp-gradle-plugin" }
|
||||||
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
|
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
|
||||||
kotlin-plugin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
|
kotlin-plugin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user