settings: optionally tag new mark
This commit is contained in:
@@ -87,7 +87,8 @@ class Setting(auxId: SettingsId, auxName: String, auxChecked: Boolean) {
|
|||||||
enum class SettingsId {
|
enum class SettingsId {
|
||||||
Svoboda,
|
Svoboda,
|
||||||
Amoled,
|
Amoled,
|
||||||
RefreshButton
|
RefreshButton,
|
||||||
|
TagNewMarks
|
||||||
}
|
}
|
||||||
|
|
||||||
class SettingsData {
|
class SettingsData {
|
||||||
@@ -109,7 +110,13 @@ class SettingsData {
|
|||||||
true
|
true
|
||||||
)
|
)
|
||||||
|
|
||||||
override fun toString() = "$useSvobodaMode\n$useAmoledMode\n$showRefreshButton"
|
var tagNewMarks: Setting = Setting(
|
||||||
|
SettingsId.TagNewMarks,
|
||||||
|
"Označit nové známky",
|
||||||
|
true
|
||||||
|
)
|
||||||
|
|
||||||
|
override fun toString() = "$useSvobodaMode\n$useAmoledMode\n$showRefreshButton\n$tagNewMarks"
|
||||||
}
|
}
|
||||||
|
|
||||||
var settings : SettingsData = SettingsData()
|
var settings : SettingsData = SettingsData()
|
||||||
|
|||||||
@@ -237,7 +237,7 @@ fun MarksAll() {
|
|||||||
modifier = Modifier.fillMaxSize().weight(1f),
|
modifier = Modifier.fillMaxSize().weight(1f),
|
||||||
contentAlignment = Alignment.TopStart
|
contentAlignment = Alignment.TopStart
|
||||||
) {
|
) {
|
||||||
if (subjectContainsNewMark) {
|
if (subjectContainsNewMark && settings.tagNewMarks.checked.value) {
|
||||||
Icon(
|
Icon(
|
||||||
modifier = Modifier.padding(start = 4.dp, top = 4.dp),
|
modifier = Modifier.padding(start = 4.dp, top = 4.dp),
|
||||||
imageVector = Icons.Default.AutoAwesome,
|
imageVector = Icons.Default.AutoAwesome,
|
||||||
@@ -428,7 +428,13 @@ fun MarksSubject() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// only add if mark date is not older than one week
|
// only add if mark date is not older than one week
|
||||||
if (LocalDate.parse(mark.date, DateTimeFormatter.ISO_LOCAL_DATE_TIME).isAfter(LocalDate.now().minusWeeks(1))) {
|
if (
|
||||||
|
(
|
||||||
|
LocalDate
|
||||||
|
.parse(mark.date, DateTimeFormatter.ISO_LOCAL_DATE_TIME)
|
||||||
|
.isAfter(LocalDate.now().minusWeeks(1))
|
||||||
|
) && settings.tagNewMarks.checked.value
|
||||||
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
modifier = Modifier.padding(start = 7.dp, top = 4.dp),
|
modifier = Modifier.padding(start = 7.dp, top = 4.dp),
|
||||||
imageVector = Icons.Default.AutoAwesome,
|
imageVector = Icons.Default.AutoAwesome,
|
||||||
|
|||||||
@@ -88,6 +88,10 @@ fun SettingsScreen(modifier: Modifier = Modifier) {
|
|||||||
Spacer(Modifier.height(10.dp))
|
Spacer(Modifier.height(10.dp))
|
||||||
|
|
||||||
SettingsTableRow(settings.showRefreshButton)
|
SettingsTableRow(settings.showRefreshButton)
|
||||||
|
|
||||||
|
Spacer(Modifier.height(10.dp))
|
||||||
|
|
||||||
|
SettingsTableRow(settings.tagNewMarks)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,6 +121,7 @@ fun SettingsTableRow(setting: Setting) {
|
|||||||
SettingsId.Svoboda -> settings.useSvobodaMode = setting
|
SettingsId.Svoboda -> settings.useSvobodaMode = setting
|
||||||
SettingsId.Amoled -> settings.useAmoledMode = setting
|
SettingsId.Amoled -> settings.useAmoledMode = setting
|
||||||
SettingsId.RefreshButton -> settings.showRefreshButton = setting
|
SettingsId.RefreshButton -> settings.showRefreshButton = setting
|
||||||
|
SettingsId.TagNewMarks -> settings.tagNewMarks = setting
|
||||||
}
|
}
|
||||||
Util.saveStringToFile(settingsDataFilePath, settings.toString())
|
Util.saveStringToFile(settingsDataFilePath, settings.toString())
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user