mirror of
https://github.com/awfixers-stuff/OwnDroid.git
synced 2026-03-23 19:15:58 +00:00
New app installer
Update dependencies
This commit is contained in:
@@ -1,22 +1,22 @@
|
||||
package com.bintianqi.owndroid
|
||||
|
||||
import android.app.Application
|
||||
import android.content.Context
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.AndroidViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
class MyViewModel: ViewModel() {
|
||||
class MyViewModel(application: Application): AndroidViewModel(application) {
|
||||
val theme = MutableStateFlow(ThemeSettings())
|
||||
val installedPackages = mutableListOf<PackageInfo>()
|
||||
val selectedPackage = MutableStateFlow("")
|
||||
val userRestrictions = MutableStateFlow(Bundle())
|
||||
|
||||
var initialized = false
|
||||
fun initialize(context: Context) {
|
||||
val sharedPrefs = context.getSharedPreferences("data", Context.MODE_PRIVATE)
|
||||
init {
|
||||
val sharedPrefs = application.getSharedPreferences("data", Context.MODE_PRIVATE)
|
||||
theme.value = ThemeSettings(
|
||||
materialYou = sharedPrefs.getBoolean("material_you", Build.VERSION.SDK_INT >= 31),
|
||||
darkTheme = if(sharedPrefs.contains("dark_theme")) sharedPrefs.getBoolean("dark_theme", false) else null,
|
||||
|
||||
Reference in New Issue
Block a user