Archived
Replaced fragment switching functionality in MainActivity.kt with Navigation component, simplifying logic significantly; upgraded to AGP 8.0.1
This commit is contained in:
@@ -43,7 +43,6 @@ class CanteenPageViewModel(app: Application) : AppViewModel(app) {
|
||||
/**
|
||||
* 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) }
|
||||
val preferenceColour: Boolean
|
||||
get() = repo.getBooleanPreference(SettingsPreferences.COLOUR_PREFS, defaultValue = true)
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.denizk0461.studip.viewmodel
|
||||
|
||||
import android.app.Application
|
||||
import androidx.lifecycle.LiveData
|
||||
import com.denizk0461.studip.model.SettingsPreferences
|
||||
import com.denizk0461.studip.model.StudIPEvent
|
||||
|
||||
/**
|
||||
@@ -17,4 +18,14 @@ class EventPageViewModel(app: Application) : AppViewModel(app) {
|
||||
* @return Stud.IP events for a certain day exposed through a LiveData object
|
||||
*/
|
||||
fun getEventsForDay(day: Int): LiveData<List<StudIPEvent>> = repo.getEventsForDay(day)
|
||||
|
||||
/**
|
||||
* This value determines whether the user wants to have the next course in their schedule
|
||||
* highlighted.
|
||||
*/
|
||||
val preferenceCourseHighlighting: Boolean
|
||||
get() = repo.getBooleanPreference(
|
||||
SettingsPreferences.COURSE_HIGHLIGHTING,
|
||||
defaultValue = true
|
||||
)
|
||||
}
|
||||
@@ -15,7 +15,10 @@ class SettingsViewModel(app: Application) : AppViewModel(app) {
|
||||
* highlighted.
|
||||
*/
|
||||
var preferenceCourseHighlighting: Boolean
|
||||
get() = repo.getBooleanPreference(SettingsPreferences.COURSE_HIGHLIGHTING)
|
||||
get() = repo.getBooleanPreference(
|
||||
SettingsPreferences.COURSE_HIGHLIGHTING,
|
||||
defaultValue = true
|
||||
)
|
||||
set(newValue) { repo.setPreference(SettingsPreferences.COURSE_HIGHLIGHTING, newValue) }
|
||||
|
||||
/**
|
||||
@@ -36,7 +39,7 @@ class SettingsViewModel(app: Application) : AppViewModel(app) {
|
||||
* This value determines which canteen the user has selected.
|
||||
*/
|
||||
var preferenceColour: Boolean
|
||||
get() = repo.getBooleanPreference(SettingsPreferences.COLOUR_PREFS)
|
||||
get() = repo.getBooleanPreference(SettingsPreferences.COLOUR_PREFS, defaultValue = true)
|
||||
set(newValue) { repo.setPreference(SettingsPreferences.COLOUR_PREFS, newValue) }
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user