Archived
Further error handling. Also given the user the option to colour dietary preference icons. Colours have partially been derived from those used on stw-bremen.de but have all been processed through the theme builder on m3.material.io
This commit is contained in:
@@ -30,4 +30,11 @@ class CanteenPageViewModel(app: Application) : AppViewModel(app) {
|
||||
*/
|
||||
val preferenceAllergen: Boolean
|
||||
get() = repo.getBooleanPreference(SettingsPreferences.ALLERGEN, defaultValue = true)
|
||||
|
||||
/**
|
||||
* This value determines which canteen the user has selected.
|
||||
*/
|
||||
var preferenceColour: Boolean
|
||||
get() = repo.getBooleanPreference(SettingsPreferences.COLOUR_PREFS)
|
||||
set(newValue) { repo.setPreference(SettingsPreferences.COLOUR_PREFS, newValue) }
|
||||
}
|
||||
@@ -2,6 +2,8 @@ package com.denizk0461.studip.viewmodel
|
||||
|
||||
import android.app.Application
|
||||
import com.denizk0461.studip.data.StudIPParser
|
||||
import java.io.IOException
|
||||
import kotlin.jvm.Throws
|
||||
|
||||
/**
|
||||
* View model for [com.denizk0461.studip.activity.FetcherActivity]
|
||||
@@ -10,7 +12,20 @@ import com.denizk0461.studip.data.StudIPParser
|
||||
*/
|
||||
class FetcherViewModel(app: Application) : AppViewModel(app) {
|
||||
|
||||
/**
|
||||
* Instance of the parser used to fetch and parse the user's Stud.IP schedule.
|
||||
*/
|
||||
private val parser: StudIPParser = StudIPParser(app)
|
||||
|
||||
fun parse(html: String) { doAsync { parser.parse(html, {}) }}
|
||||
/**
|
||||
* Fetches and parses the user's Stud.IP schedule.
|
||||
*
|
||||
* @param html source code of the schedule website
|
||||
*/
|
||||
@Throws(IOException::class)
|
||||
fun parse(html: String) {
|
||||
doAsync {
|
||||
parser.parse(html)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -70,6 +70,13 @@ class SettingsViewModel(app: Application) : AppViewModel(app) {
|
||||
get() = repo.getBooleanPreference(SettingsPreferences.LAUNCH_CANTEEN_ON_START)
|
||||
set(newValue) { repo.setPreference(SettingsPreferences.LAUNCH_CANTEEN_ON_START, newValue) }
|
||||
|
||||
/**
|
||||
* This value determines which canteen the user has selected.
|
||||
*/
|
||||
var preferenceColour: Boolean
|
||||
get() = repo.getBooleanPreference(SettingsPreferences.COLOUR_PREFS)
|
||||
set(newValue) { repo.setPreference(SettingsPreferences.COLOUR_PREFS, newValue) }
|
||||
|
||||
/**
|
||||
* This value determines whether the user opts into submitting crash reports.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user