Changed Theme / Deprecated Preferences. Use DataStore instead.
This commit is contained in:
@@ -111,10 +111,13 @@ dependencies {
|
|||||||
kapt("androidx.room:room-compiler:2.3.0")
|
kapt("androidx.room:room-compiler:2.3.0")
|
||||||
implementation("androidx.room:room-ktx:2.3.0")
|
implementation("androidx.room:room-ktx:2.3.0")
|
||||||
|
|
||||||
|
implementation("androidx.datastore:datastore:1.0.0")
|
||||||
|
implementation("androidx.datastore:datastore-preferences:1.0.0")
|
||||||
|
|
||||||
implementation("org.kodein.di:kodein-di-framework-compose:7.9.0")
|
implementation("org.kodein.di:kodein-di-framework-compose:7.9.0")
|
||||||
|
|
||||||
implementation("com.google.android.material:material:1.4.0")
|
implementation("com.google.android.material:material:1.4.0")
|
||||||
0
|
|
||||||
implementation(platform("com.google.firebase:firebase-bom:28.3.0"))
|
implementation(platform("com.google.firebase:firebase-bom:28.3.0"))
|
||||||
implementation("com.google.firebase:firebase-analytics-ktx")
|
implementation("com.google.firebase:firebase-analytics-ktx")
|
||||||
implementation("com.google.firebase:firebase-crashlytics")
|
implementation("com.google.firebase:firebase-crashlytics")
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import androidx.compose.foundation.layout.padding
|
|||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.material.Card
|
import androidx.compose.material.Card
|
||||||
import androidx.compose.material.LinearProgressIndicator
|
import androidx.compose.material.LinearProgressIndicator
|
||||||
|
import androidx.compose.material.MaterialTheme
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
@@ -20,7 +21,7 @@ fun ProgressCard(progress: Float? = null, content: @Composable () -> Unit) {
|
|||||||
elevation = 4.dp
|
elevation = 4.dp
|
||||||
) {
|
) {
|
||||||
Column {
|
Column {
|
||||||
progress?.run { LinearProgressIndicator(progress = progress, modifier = Modifier.fillMaxWidth()) }
|
progress?.run { LinearProgressIndicator(progress = progress, modifier = Modifier.fillMaxWidth(), color = MaterialTheme.colors.secondary) }
|
||||||
content()
|
content()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,9 +23,19 @@ import androidx.compose.material.MaterialTheme
|
|||||||
import androidx.compose.material.darkColors
|
import androidx.compose.material.darkColors
|
||||||
import androidx.compose.material.lightColors
|
import androidx.compose.material.lightColors
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
|
||||||
private val DarkColorPalette = darkColors()
|
private val DarkColorPalette = darkColors(
|
||||||
private val LightColorPalette = lightColors()
|
secondary = Pink600,
|
||||||
|
onSecondary = Color.White
|
||||||
|
)
|
||||||
|
private val LightColorPalette = lightColors(
|
||||||
|
primary = LightBlue300,
|
||||||
|
primaryVariant = LightBlue700,
|
||||||
|
secondary = Pink600,
|
||||||
|
onPrimary = Color.White,
|
||||||
|
onSecondary = Color.White
|
||||||
|
)
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun PupilTheme(
|
fun PupilTheme(
|
||||||
|
|||||||
@@ -18,10 +18,15 @@
|
|||||||
|
|
||||||
package xyz.quaver.pupil.ui.viewmodel
|
package xyz.quaver.pupil.ui.viewmodel
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
|
||||||
import android.app.Application
|
import android.app.Application
|
||||||
import androidx.compose.runtime.*
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.lifecycle.*
|
import androidx.compose.runtime.mutableStateListOf
|
||||||
|
import androidx.compose.runtime.mutableStateOf
|
||||||
|
import androidx.compose.runtime.setValue
|
||||||
|
import androidx.lifecycle.AndroidViewModel
|
||||||
|
import androidx.lifecycle.MutableLiveData
|
||||||
|
import androidx.lifecycle.Transformations
|
||||||
|
import androidx.lifecycle.viewModelScope
|
||||||
import kotlinx.coroutines.*
|
import kotlinx.coroutines.*
|
||||||
import org.kodein.di.DIAware
|
import org.kodein.di.DIAware
|
||||||
import org.kodein.di.android.x.closestDI
|
import org.kodein.di.android.x.closestDI
|
||||||
@@ -29,7 +34,9 @@ import org.kodein.di.direct
|
|||||||
import org.kodein.di.instance
|
import org.kodein.di.instance
|
||||||
import org.kodein.log.LoggerFactory
|
import org.kodein.log.LoggerFactory
|
||||||
import org.kodein.log.newLogger
|
import org.kodein.log.newLogger
|
||||||
import xyz.quaver.pupil.sources.*
|
import xyz.quaver.pupil.sources.History
|
||||||
|
import xyz.quaver.pupil.sources.ItemInfo
|
||||||
|
import xyz.quaver.pupil.sources.Source
|
||||||
import xyz.quaver.pupil.util.Preferences
|
import xyz.quaver.pupil.util.Preferences
|
||||||
import xyz.quaver.pupil.util.source
|
import xyz.quaver.pupil.util.source
|
||||||
import kotlin.math.ceil
|
import kotlin.math.ceil
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import kotlin.reflect.KClass
|
|||||||
|
|
||||||
lateinit var preferences: SharedPreferences
|
lateinit var preferences: SharedPreferences
|
||||||
|
|
||||||
|
@Deprecated("Use DataStore")
|
||||||
object Preferences: SharedPreferences by preferences {
|
object Preferences: SharedPreferences by preferences {
|
||||||
|
|
||||||
val defMap = mapOf(
|
val defMap = mapOf(
|
||||||
|
|||||||
Reference in New Issue
Block a user