Release v2.0.1
This commit is contained in:
@ -1,17 +1,21 @@
|
||||
package com.tommasoberlose.anotherwidget.ui.viewmodels
|
||||
|
||||
import android.app.Application
|
||||
import android.content.Intent
|
||||
import android.content.pm.ApplicationInfo
|
||||
import androidx.databinding.ObservableField
|
||||
import androidx.lifecycle.*
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import android.content.pm.ResolveInfo
|
||||
import androidx.lifecycle.AndroidViewModel
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.liveData
|
||||
|
||||
class ChooseApplicationViewModel(application: Application) : AndroidViewModel(application) {
|
||||
|
||||
val appList: LiveData<List<ApplicationInfo>> = liveData {
|
||||
val app = application.packageManager.getInstalledApplications(0)
|
||||
val appList: LiveData<List<ResolveInfo>> = liveData {
|
||||
val mainIntent = Intent(Intent.ACTION_MAIN, null).apply {
|
||||
addCategory(Intent.CATEGORY_LAUNCHER)
|
||||
}
|
||||
val app = application.packageManager.queryIntentActivities( mainIntent, 0)
|
||||
emit(app)
|
||||
}
|
||||
val searchInput: MutableLiveData<String> = MutableLiveData("")
|
||||
|
@ -0,0 +1,10 @@
|
||||
package com.tommasoberlose.anotherwidget.ui.viewmodels
|
||||
|
||||
import android.app.Application
|
||||
import androidx.lifecycle.AndroidViewModel
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import com.tommasoberlose.anotherwidget.global.Preferences
|
||||
|
||||
class CustomDateViewModel(application: Application) : AndroidViewModel(application) {
|
||||
val dateInput: MutableLiveData<String> = MutableLiveData(if (Preferences.dateFormat == "") "EEEE, MMM dd" else Preferences.dateFormat)
|
||||
}
|
@ -26,7 +26,6 @@ class MainViewModel : ViewModel() {
|
||||
|
||||
val eventAppName = Preferences.asLiveData(Preferences::eventAppName)
|
||||
|
||||
|
||||
// Clock Settings
|
||||
val showClock = Preferences.asLiveData(Preferences::showClock)
|
||||
val clockTextSize = Preferences.asLiveData(Preferences::clockTextSize)
|
||||
@ -35,6 +34,8 @@ class MainViewModel : ViewModel() {
|
||||
val showNextAlarm = Preferences.asLiveData(Preferences::showNextAlarm)
|
||||
val dateFormat = Preferences.asLiveData(Preferences::dateFormat)
|
||||
|
||||
val showBigClockWarning = Preferences.asLiveData(Preferences::showBigClockWarning)
|
||||
|
||||
// Weather Settings
|
||||
val showWeather = Preferences.asLiveData(Preferences::showWeather)
|
||||
val weatherTempUnit = Preferences.asLiveData(Preferences::weatherTempUnit)
|
||||
@ -45,6 +46,8 @@ class MainViewModel : ViewModel() {
|
||||
|
||||
val customLocationAdd = Preferences.asLiveData(Preferences::customLocationAdd)
|
||||
|
||||
val showWeatherWarning = Preferences.asLiveData(Preferences::showWeatherWarning)
|
||||
|
||||
// Advanced Settings
|
||||
val darkThemePreference = Preferences.asLiveData(Preferences::darkThemePreference)
|
||||
val showWallpaper = Preferences.asLiveData(Preferences::showWallpaper)
|
||||
|
Reference in New Issue
Block a user