Archived
Converted all bottom sheets to use blank constructors and instead rely on bundles to retrieve data/objects, or custom view models to execute functions
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package com.denizk0461.studip.viewmodel
|
||||
|
||||
import android.app.Application
|
||||
import com.denizk0461.studip.model.AllergenPreferences
|
||||
import com.denizk0461.studip.model.SettingsPreferences
|
||||
|
||||
/**
|
||||
@@ -11,44 +10,6 @@ import com.denizk0461.studip.model.SettingsPreferences
|
||||
*/
|
||||
class SettingsViewModel(app: Application) : AppViewModel(app) {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Deletes everything from the database.
|
||||
*/
|
||||
fun nukeEverything() {
|
||||
nukeEvents()
|
||||
nukeOfferItems()
|
||||
nukeOfferCategories()
|
||||
nukeOfferCanteens()
|
||||
nukeOfferDates()
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all Stud.IP events from the database.
|
||||
*/
|
||||
fun nukeEvents() { doAsync { repo.nukeEvents() } }
|
||||
|
||||
/**
|
||||
* Deletes all canteen items from the database.
|
||||
*/
|
||||
fun nukeOfferItems() { doAsync { repo.nukeOfferItems() } }
|
||||
|
||||
/**
|
||||
* Deletes all canteen categories from the database.
|
||||
*/
|
||||
fun nukeOfferCategories() { doAsync { repo.nukeOfferCategories() } }
|
||||
|
||||
/**
|
||||
* Deletes all canteens from the database.
|
||||
*/
|
||||
fun nukeOfferCanteens() { doAsync { repo.nukeOfferCanteens() } }
|
||||
|
||||
/**
|
||||
* Deletes all canteen dates from the database.
|
||||
*/
|
||||
fun nukeOfferDates() { doAsync { repo.nukeOfferDates() } }
|
||||
|
||||
/**
|
||||
* This value determines whether the user wants to have the next course in their schedule
|
||||
* highlighted.
|
||||
@@ -57,15 +18,6 @@ class SettingsViewModel(app: Application) : AppViewModel(app) {
|
||||
get() = repo.getBooleanPreference(SettingsPreferences.COURSE_HIGHLIGHTING)
|
||||
set(newValue) { repo.setPreference(SettingsPreferences.COURSE_HIGHLIGHTING, newValue) }
|
||||
|
||||
/**
|
||||
* This value determines which allergens the user wants to have displayed or hidden.
|
||||
*/
|
||||
var preferenceAllergenConfig: String
|
||||
get() = repo.getStringPreference(
|
||||
SettingsPreferences.ALLERGEN_CONFIG, defaultValue = AllergenPreferences.TEMPLATE
|
||||
)
|
||||
set(newValue) { repo.setPreference(SettingsPreferences.ALLERGEN_CONFIG, newValue) }
|
||||
|
||||
/**
|
||||
* This value determines whether the user wants to have allergens marked.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user