From c90ad97f55df5f106aa23b8f2636c1573cf8ca46 Mon Sep 17 00:00:00 2001 From: kuba2k2 Date: Tue, 25 Oct 2022 17:33:38 +0200 Subject: [PATCH] [UI] Remove "enable shared events" setting. Reorder settings a bit. --- .../edziennik/data/db/dao/ProfileDao.kt | 2 +- .../edziennik/data/db/entity/Profile.kt | 3 +- .../ui/dialogs/settings/AgendaConfigDialog.kt | 59 +++--- .../edziennik/ui/event/EventManualDialog.kt | 18 +- .../edziennik/ui/notes/NoteEditorDialog.kt | 21 +- .../edziennik/ui/settings/SettingsCard.kt | 4 +- .../edziennik/ui/settings/SettingsUtil.kt | 11 +- .../ui/settings/cards/SettingsAboutCard.kt | 9 +- .../ui/settings/cards/SettingsProfileCard.kt | 7 +- .../ui/settings/cards/SettingsRegisterCard.kt | 195 ++++++++---------- .../ui/settings/cards/SettingsSyncCard.kt | 9 +- .../ui/settings/cards/SettingsThemeCard.kt | 9 +- .../main/res/layout/dialog_config_agenda.xml | 26 ++- app/src/main/res/values-de/strings.xml | 4 - app/src/main/res/values-en/strings.xml | 4 - app/src/main/res/values/strings.xml | 5 +- 16 files changed, 154 insertions(+), 232 deletions(-) diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/db/dao/ProfileDao.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/db/dao/ProfileDao.kt index 6d1e799d..ef5a3655 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/db/dao/ProfileDao.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/db/dao/ProfileDao.kt @@ -49,7 +49,7 @@ interface ProfileDao { @get:Query("SELECT profileId FROM profiles WHERE profileId >= 0 ORDER BY profileId") val idsNow: List - @Query("SELECT profiles.* FROM teams JOIN profiles USING(profileId) WHERE teamCode = :teamCode AND registration = " + Profile.REGISTRATION_ENABLED + " AND enableSharedEvents = 1") + @Query("SELECT profiles.* FROM teams JOIN profiles USING(profileId) WHERE teamCode = :teamCode AND registration = " + Profile.REGISTRATION_ENABLED) fun getByTeamCodeNowWithRegistration(teamCode: String?): List @get:Query("SELECT profileId FROM profiles WHERE profileId > 0 ORDER BY profileId ASC LIMIT 1") diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/data/db/entity/Profile.kt b/app/src/main/java/pl/szczodrzynski/edziennik/data/db/entity/Profile.kt index 6b5b0f83..9fda1420 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/data/db/entity/Profile.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/data/db/entity/Profile.kt @@ -54,7 +54,8 @@ open class Profile( var empty = true var archived = false var syncEnabled = true - var enableSharedEvents = true + @ColumnInfo(name = "enableSharedEvents") + var unused1 = true var registration = REGISTRATION_UNSPECIFIED var userCode = "" diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/settings/AgendaConfigDialog.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/settings/AgendaConfigDialog.kt index 05012c32..0aa8e39a 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/settings/AgendaConfigDialog.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/dialogs/settings/AgendaConfigDialog.kt @@ -32,48 +32,37 @@ class AgendaConfigDialog( override fun inflate(layoutInflater: LayoutInflater) = DialogConfigAgendaBinding.inflate(layoutInflater) - private val profileConfig by lazy { app.config.forProfile().ui } + private val profileConfig by lazy { app.config.forProfile() } override suspend fun loadConfig() { b.config = profileConfig - b.isAgendaMode = profileConfig.agendaViewType == Profile.AGENDA_DEFAULT + b.isAgendaMode = profileConfig.ui.agendaViewType == Profile.AGENDA_DEFAULT - b.eventSharingEnabled.isChecked = - app.profile.enableSharedEvents && app.profile.canShare + var calledFromListener = false + b.eventSharingEnabled.isChecked = app.profile.canShare + b.shareByDefault.isEnabled = app.profile.canShare b.eventSharingEnabled.onChange { _, isChecked -> - if (isChecked && !app.profile.canShare) { - b.eventSharingEnabled.isChecked = false - val dialog = RegistrationConfigDialog( - activity, - app.profile, - onChangeListener = { enabled -> - b.eventSharingEnabled.isChecked = enabled - setEventSharingEnabled(enabled) - }, - onShowListener, - onDismissListener, - ) - dialog.showEnableDialog() + if (calledFromListener) { + calledFromListener = false return@onChange } - setEventSharingEnabled(isChecked) + b.eventSharingEnabled.isChecked = !isChecked + val dialog = RegistrationConfigDialog( + activity, + app.profile, + onChangeListener = { enabled -> + calledFromListener = true + b.eventSharingEnabled.isChecked = enabled + b.shareByDefault.isEnabled = enabled + }, + onShowListener, + onDismissListener, + ) + if (isChecked) + dialog.showEnableDialog() + else + dialog.showDisableDialog() + return@onChange } } - - private fun setEventSharingEnabled(enabled: Boolean) { - if (enabled == app.profile.enableSharedEvents) - return - app.profile.enableSharedEvents = enabled - app.profileSave() - MaterialAlertDialogBuilder(activity) - .setTitle(R.string.event_sharing) - .setMessage( - if (enabled) - R.string.settings_register_shared_events_dialog_enabled_text - else - R.string.settings_register_shared_events_dialog_disabled_text - ) - .setPositiveButton(R.string.ok, null) - .show() - } } diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/event/EventManualDialog.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/event/EventManualDialog.kt index 8b39d0c0..ffdda131 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/event/EventManualDialog.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/event/EventManualDialog.kt @@ -137,9 +137,7 @@ class EventManualDialog( loadLists() - val shareByDefault = profileConfig.shareByDefault - && profile.enableSharedEvents - && profile.registration == Profile.REGISTRATION_ENABLED + val shareByDefault = profileConfig.shareByDefault && profile.canShare b.shareSwitch.isChecked = editingShared || editingEvent == null && shareByDefault b.shareSwitch.isEnabled = !editingShared || editingOwn @@ -417,20 +415,6 @@ class EventManualDialog( return } - if (share && !profile.enableSharedEvents) { - MaterialAlertDialogBuilder(activity) - .setTitle(R.string.event_sharing) - .setMessage(R.string.settings_register_shared_events_dialog_enabled_text) - .setPositiveButton(R.string.ok) { _, _ -> - profile.enableSharedEvents = true - app.profileSave(profile) - saveEvent() - } - .setNegativeButton(R.string.cancel, null) - .show() - return - } - b.dateDropdown.error = null b.teamDropdown.error = null b.typeDropdown.error = null diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/notes/NoteEditorDialog.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/notes/NoteEditorDialog.kt index dd5e7db0..c54dd847 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/notes/NoteEditorDialog.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/notes/NoteEditorDialog.kt @@ -79,23 +79,6 @@ class NoteEditorDialog( return NO_DISMISS } - if (note.isShared && !profile.enableSharedEvents) { - MaterialAlertDialogBuilder(activity) - .setTitle(R.string.event_sharing) - .setMessage(R.string.settings_register_shared_events_dialog_enabled_text) - .setPositiveButton(R.string.ok) { _, _ -> - profile.enableSharedEvents = true - app.profileSave(profile) - launch { - if (onPositiveClick()) - dismiss() - } - } - .setNegativeButton(R.string.cancel, null) - .show() - return NO_DISMISS - } - if (note.isShared || editingNote?.isShared == true) { progressDialog = MaterialAlertDialogBuilder(activity) .setTitle(R.string.please_wait) @@ -153,9 +136,7 @@ class NoteEditorDialog( b.ownerType = owner?.getNoteType() ?: Note.OwnerType.NONE b.editingNote = editingNote - b.shareByDefault = profileConfig.shareByDefault - && profile?.enableSharedEvents == true - && profile.registration == Profile.REGISTRATION_ENABLED + b.shareByDefault = profileConfig.shareByDefault && profile?.canShare == true b.color.clear().append(Note.Color.values().map { color -> TextInputDropDown.Item( diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/SettingsCard.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/SettingsCard.kt index b04ee4a8..eafbd721 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/SettingsCard.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/SettingsCard.kt @@ -23,6 +23,6 @@ abstract class SettingsCard( } protected abstract fun buildCard(): MaterialAboutCard - protected abstract fun getItems(): List - protected open fun getItemsMore(): List = listOf() + protected abstract fun getItems(card: MaterialAboutCard): List + protected open fun getItemsMore(card: MaterialAboutCard): List = listOf() } diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/SettingsUtil.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/SettingsUtil.kt index 160ae8b7..6b4fe5db 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/SettingsUtil.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/SettingsUtil.kt @@ -34,8 +34,8 @@ class SettingsUtil( fun createCard( titleRes: Int?, - items: List, - itemsMore: List, + items: (card: MaterialAboutCard) -> List, + itemsMore: (card: MaterialAboutCard) -> List, backgroundColor: Int? = null, theme: Int? = null ): MaterialAboutCard { @@ -44,10 +44,11 @@ class SettingsUtil( .cardColor(backgroundColor ?: 0) .theme(theme ?: 0) .build() - card.items.addAll(items) + card.items.addAll(items(card)) - if (itemsMore.isNotEmpty()) { - card.items.add(createMoreItem(card, itemsMore)) + val more = itemsMore(card) + if (more.isNotEmpty()) { + card.items.add(createMoreItem(card, more)) } return card diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/cards/SettingsAboutCard.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/cards/SettingsAboutCard.kt index b06393d3..5057d1b4 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/cards/SettingsAboutCard.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/cards/SettingsAboutCard.kt @@ -42,17 +42,14 @@ class SettingsAboutCard(util: SettingsUtil) : SettingsCard(util), CoroutineScope override fun buildCard(): MaterialAboutCard = util.createCard( null, - items = listOf(), - itemsMore = listOf(), + items = ::getItems, + itemsMore = ::getItemsMore, backgroundColor = 0xff1976d2.toInt(), theme = R.style.AppTheme_Dark ).also { it.items.addAll(getItems(it)) } - override fun getItems() = listOf() - override fun getItemsMore() = listOf() - private val versionDetailsItem by lazy { util.createActionItem( text = R.string.settings_about_version_details_text, @@ -64,7 +61,7 @@ class SettingsAboutCard(util: SettingsUtil) : SettingsCard(util), CoroutineScope ) } - private fun getItems(card: MaterialAboutCard) = listOf( + override fun getItems(card: MaterialAboutCard) = listOf( util.createTitleItem(), util.createActionItem( diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/cards/SettingsProfileCard.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/cards/SettingsProfileCard.kt index 88c4dae7..a5ec33d8 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/cards/SettingsProfileCard.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/cards/SettingsProfileCard.kt @@ -5,6 +5,7 @@ package pl.szczodrzynski.edziennik.ui.settings.cards import android.content.Intent +import com.danielstone.materialaboutlibrary.model.MaterialAboutCard import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial import pl.szczodrzynski.edziennik.R import pl.szczodrzynski.edziennik.ui.dialogs.settings.ProfileConfigDialog @@ -17,8 +18,8 @@ class SettingsProfileCard(util: SettingsUtil) : SettingsCard(util) { override fun buildCard() = util.createCard( null, - items = getItems(), - itemsMore = listOf() + items = ::getItems, + itemsMore = ::getItemsMore, ) private fun getProfileItem(): MaterialAboutProfileItem = util.createProfileItem( @@ -34,7 +35,7 @@ class SettingsProfileCard(util: SettingsUtil) : SettingsCard(util) { }).show() } - override fun getItems() = listOf( + override fun getItems(card: MaterialAboutCard) = listOf( getProfileItem(), util.createActionItem( diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/cards/SettingsRegisterCard.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/cards/SettingsRegisterCard.kt index d39e4905..4f0f1078 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/cards/SettingsRegisterCard.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/cards/SettingsRegisterCard.kt @@ -4,6 +4,8 @@ package pl.szczodrzynski.edziennik.ui.settings.cards +import com.danielstone.materialaboutlibrary.items.MaterialAboutItem +import com.danielstone.materialaboutlibrary.model.MaterialAboutCard import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial import eu.szkolny.font.SzkolnyFont @@ -29,8 +31,8 @@ class SettingsRegisterCard(util: SettingsUtil) : SettingsCard(util) { override fun buildCard() = util.createCard( R.string.settings_card_register_title, - items = getItems(), - itemsMore = getItemsMore() + items = ::getItems, + itemsMore = ::getItemsMore, ) private fun getBellSync() = @@ -41,34 +43,6 @@ class SettingsRegisterCard(util: SettingsUtil) : SettingsCard(util) { ) } ?: activity.getString(R.string.settings_register_bell_sync_subtext_disabled) - private val sharedEventsItem by lazy { - util.createPropertyItem( - text = R.string.settings_register_shared_events_text, - subText = R.string.settings_register_shared_events_subtext, - icon = CommunityMaterial.Icon3.cmd_share_outline, - value = app.profile.enableSharedEvents - ) { item, value -> - app.profile.enableSharedEvents = value - app.profileSave() - MaterialAlertDialogBuilder(activity) - .setTitle(R.string.event_sharing) - .setMessage( - if (value) - R.string.settings_register_shared_events_dialog_enabled_text - else - R.string.settings_register_shared_events_dialog_disabled_text - ) - .setPositiveButton(R.string.ok, null) - .show() - if (value) { - card.items.after(item, sharedEventsDefaultItem) - } else { - card.items.remove(sharedEventsDefaultItem) - } - util.refresh() - } - } - private val sharedEventsDefaultItem by lazy { util.createPropertyItem( text = R.string.settings_register_share_by_default_text, @@ -80,7 +54,7 @@ class SettingsRegisterCard(util: SettingsUtil) : SettingsCard(util) { } } - override fun getItems() = listOfNotNull( + override fun getItems(card: MaterialAboutCard) = listOfNotNull( util.createActionItem( text = R.string.menu_timetable_config, icon = CommunityMaterial.Icon3.cmd_timetable @@ -108,7 +82,8 @@ class SettingsRegisterCard(util: SettingsUtil) : SettingsCard(util) { ) { MessagesConfigDialog(activity, reloadOnDismiss = false).show() }.takeIf { - app.profile.hasUIFeature(FeatureType.MESSAGES_INBOX) || app.profile.hasUIFeature(FeatureType.MESSAGES_SENT) + app.profile.hasUIFeature(FeatureType.MESSAGES_INBOX) || app.profile.hasUIFeature( + FeatureType.MESSAGES_SENT) }, util.createActionItem( @@ -118,96 +93,90 @@ class SettingsRegisterCard(util: SettingsUtil) : SettingsCard(util) { AttendanceConfigDialog(activity, reloadOnDismiss = false).show() }.takeIf { app.profile.hasUIFeature(FeatureType.ATTENDANCE) }, - if (app.profile.archived) - null - else - util.createPropertyItem( - text = R.string.settings_register_allow_registration_text, - subText = R.string.settings_register_allow_registration_subtext, - icon = CommunityMaterial.Icon.cmd_account_circle_outline, - value = app.profile.canShare, - beforeChange = { item, value -> - if (app.profile.canShare == value) - // allow the switch to change - needed for util.refresh() to change the visual state - return@createPropertyItem true - val dialog = - RegistrationConfigDialog(activity, app.profile, onChangeListener = { enabled -> + util.createMoreItem( + card = card, + items = listOfNotNull( + util.createActionItem( + text = R.string.settings_register_bell_sync_text, + icon = SzkolnyFont.Icon.szf_alarm_bell_outline, + onClick = { + BellSyncConfigDialog(activity, onChangeListener = { + it.subText = getBellSync() + util.refresh() + }).show() + } + ).also { + it.subText = getBellSync() + }, + + util.createPropertyItem( + text = R.string.settings_register_count_in_seconds_text, + subText = R.string.settings_register_count_in_seconds_subtext, + icon = CommunityMaterial.Icon3.cmd_timer_outline, + value = configGlobal.timetable.countInSeconds + ) { _, it -> + configGlobal.timetable.countInSeconds = it + }, + + util.createPropertyItem( + text = R.string.settings_register_show_teacher_absences_text, + icon = CommunityMaterial.Icon.cmd_account_arrow_right_outline, + value = app.profile.getStudentData("showTeacherAbsences", true) + ) { _, it -> + app.profile["showTeacherAbsences"] = it + app.profileSave() + }.takeIf { app.profile.loginStoreType == LoginType.LIBRUS }, + + util.createPropertyItem( + text = R.string.settings_register_hide_sticks_from_old, + icon = CommunityMaterial.Icon3.cmd_numeric_1_box_outline, + value = configProfile.grades.hideSticksFromOld + ) { _, it -> + configProfile.grades.hideSticksFromOld = it + }.takeIf { App.devMode && app.profile.hasUIFeature(FeatureType.GRADES) }, + ), + ), + + *(getRegistrationItems().takeIf { !app.profile.archived } ?: arrayOf()), + ) + + private fun getRegistrationItems() = listOfNotNull( + util.createSectionItem( + text = R.string.settings_registration_section, + ), + + util.createPropertyItem( + text = R.string.settings_register_allow_registration_text, + subText = R.string.settings_register_allow_registration_subtext, + icon = CommunityMaterial.Icon.cmd_account_circle_outline, + value = app.profile.canShare, + beforeChange = + { item, value -> + if (app.profile.canShare == value) + // allow the switch to change - needed for util.refresh() to change the visual state + return@createPropertyItem true + val dialog = + RegistrationConfigDialog(activity, + app.profile, + onChangeListener = { enabled -> if (item.isChecked == enabled) return@RegistrationConfigDialog item.isChecked = enabled if (value) { - card.items.after(item, sharedEventsItem) - if (app.profile.enableSharedEvents) - card.items.after(item, sharedEventsDefaultItem) + card.items.after(item, sharedEventsDefaultItem) } else { - card.items.remove(sharedEventsItem) card.items.remove(sharedEventsDefaultItem) } util.refresh() }) - if (value) - dialog.showEnableDialog() - else - dialog.showDisableDialog() - false - } - ) { _, _ -> }, - - if (app.profile.canShare) - sharedEventsItem - else - null, - - if (app.profile.enableSharedEvents) - sharedEventsDefaultItem - else - null - ) - - override fun getItemsMore() = listOfNotNull( - util.createActionItem( - text = R.string.settings_register_bell_sync_text, - icon = SzkolnyFont.Icon.szf_alarm_bell_outline, - onClick = { - BellSyncConfigDialog(activity, onChangeListener = { - it.subText = getBellSync() - util.refresh() - }).show() + if (value) + dialog.showEnableDialog() + else + dialog.showDisableDialog() + false } - ).also { - it.subText = getBellSync() - }, + ) { _, _ -> }, - util.createPropertyItem( - text = R.string.settings_register_count_in_seconds_text, - subText = R.string.settings_register_count_in_seconds_subtext, - icon = CommunityMaterial.Icon3.cmd_timer_outline, - value = configGlobal.timetable.countInSeconds - ) { _, it -> - configGlobal.timetable.countInSeconds = it - }, - - if (app.profile.loginStoreType == LoginType.LIBRUS) - util.createPropertyItem( - text = R.string.settings_register_show_teacher_absences_text, - icon = CommunityMaterial.Icon.cmd_account_arrow_right_outline, - value = app.profile.getStudentData("showTeacherAbsences", true) - ) { _, it -> - app.profile["showTeacherAbsences"] = it - app.profileSave() - } - else - null, - - if (App.devMode) - util.createPropertyItem( - text = R.string.settings_register_hide_sticks_from_old, - icon = CommunityMaterial.Icon3.cmd_numeric_1_box_outline, - value = configProfile.grades.hideSticksFromOld - ) { _, it -> - configProfile.grades.hideSticksFromOld = it - }.takeIf { app.profile.hasUIFeature(FeatureType.GRADES) } - else - null - ) + sharedEventsDefaultItem.takeIf { app.profile.canShare }, + ).toTypedArray() } diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/cards/SettingsSyncCard.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/cards/SettingsSyncCard.kt index ba1c0981..a8a68da1 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/cards/SettingsSyncCard.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/cards/SettingsSyncCard.kt @@ -10,6 +10,7 @@ import android.net.Uri import android.os.Build.VERSION.SDK_INT import android.os.Build.VERSION_CODES import android.provider.Settings +import com.danielstone.materialaboutlibrary.model.MaterialAboutCard import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial import pl.szczodrzynski.edziennik.MainActivity import pl.szczodrzynski.edziennik.R @@ -29,8 +30,8 @@ class SettingsSyncCard(util: SettingsUtil) : SettingsCard(util) { override fun buildCard() = util.createCard( R.string.settings_card_sync_title, - items = getItems(), - itemsMore = getItemsMore() + items = ::getItems, + itemsMore = ::getItemsMore, ) private fun getQuietHours(): String { @@ -63,7 +64,7 @@ class SettingsSyncCard(util: SettingsUtil) : SettingsCard(util) { } } - override fun getItems() = listOfNotNull( + override fun getItems(card: MaterialAboutCard) = listOfNotNull( util.createPropertyActionItem( text = R.string.settings_sync_sync_interval_text, subText = R.string.settings_sync_sync_interval_subtext_disabled, @@ -156,7 +157,7 @@ class SettingsSyncCard(util: SettingsUtil) : SettingsCard(util) { } ) - override fun getItemsMore() = listOfNotNull( + override fun getItemsMore(card: MaterialAboutCard) = listOfNotNull( util.createPropertyItem( text = R.string.settings_sync_updates_text, icon = CommunityMaterial.Icon.cmd_cellphone_arrow_down, diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/cards/SettingsThemeCard.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/cards/SettingsThemeCard.kt index 59c2590f..ccf884fa 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/cards/SettingsThemeCard.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/settings/cards/SettingsThemeCard.kt @@ -4,6 +4,7 @@ package pl.szczodrzynski.edziennik.ui.settings.cards +import com.danielstone.materialaboutlibrary.model.MaterialAboutCard import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial import pl.szczodrzynski.edziennik.R @@ -20,11 +21,11 @@ class SettingsThemeCard(util: SettingsUtil) : SettingsCard(util) { override fun buildCard() = util.createCard( R.string.settings_card_theme_title, - items = getItems(), - itemsMore = getItemsMore() + items = ::getItems, + itemsMore = ::getItemsMore, ) - override fun getItems() = listOfNotNull( + override fun getItems(card: MaterialAboutCard) = listOfNotNull( if (Date.getToday().month % 11 == 1) // cool math games util.createPropertyItem( text = R.string.settings_theme_snowfall_text, @@ -76,7 +77,7 @@ class SettingsThemeCard(util: SettingsUtil) : SettingsCard(util) { } ) - override fun getItemsMore() = listOf( + override fun getItemsMore(card: MaterialAboutCard) = listOf( util.createActionItem( text = R.string.settings_theme_mini_drawer_buttons_text, icon = CommunityMaterial.Icon2.cmd_format_list_checks diff --git a/app/src/main/res/layout/dialog_config_agenda.xml b/app/src/main/res/layout/dialog_config_agenda.xml index b51464e2..3258f656 100644 --- a/app/src/main/res/layout/dialog_config_agenda.xml +++ b/app/src/main/res/layout/dialog_config_agenda.xml @@ -11,7 +11,7 @@ + type="pl.szczodrzynski.edziennik.config.ProfileConfig" /> @@ -46,7 +46,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="8dp" - android:checked="@={config.agendaTeacherAbsence}" + android:checked="@={config.ui.agendaTeacherAbsence}" android:minHeight="32dp" android:text="@string/agenda_config_teacher_absence" /> @@ -54,7 +54,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="8dp" - android:checked="@={config.agendaCompactMode}" + android:checked="@={config.ui.agendaCompactMode}" android:enabled="@{isAgendaMode}" android:minHeight="32dp" android:text="@string/agenda_config_compact_mode" @@ -73,7 +73,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="8dp" - android:checked="@={config.agendaGroupByType}" + android:checked="@={config.ui.agendaGroupByType}" android:enabled="@{isAgendaMode}" android:minHeight="32dp" android:text="@string/agenda_config_group_by_type" @@ -101,6 +101,15 @@ android:minHeight="32dp" android:text="@string/agenda_config_event_sharing_enabled" /> + + diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index a78eb068..fd589d1d 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -898,10 +898,6 @@ Zählen Sie die Zeit in Sekunden herunter Zählen Sie die Note 0 nicht zum Durchschnitt Dieses E-Register ist noch nicht implementiert - Sie erhalten keine geteilten Ereignisse mehr und können sie nicht mehr teilen. - Sie erhalten geteilte Ereignisse von anderen Personen in Ihrer Klasse - Teile Tests in deiner Klasse - Aktivieren Sie die Ereignisfreigabe Zeigen Sie die Abwesenheiten von Lehrern im Zeitplan an Schwarzes Brett Anwesenheiten diff --git a/app/src/main/res/values-en/strings.xml b/app/src/main/res/values-en/strings.xml index 5dad0cb3..c8af89c2 100644 --- a/app/src/main/res/values-en/strings.xml +++ b/app/src/main/res/values-en/strings.xml @@ -900,10 +900,6 @@ Count time in seconds Don\'t count 0 grade to average This e-register isn\'t implemented yet. - You won\'t receive shared events anymore and you won\'t be able to share them. - You will receive shared events from other people in your class. - Share exams in your class - Enable Event sharing Show teacher absences in Agenda Notice board Attendances diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 0abf9423..03511a9e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -969,10 +969,6 @@ Odliczaj czas w sekundach Nie wliczaj oceny 0 do średniej Ten e-dziennik nie został jeszcze zaimplementowany w aplikacji. - Nie będziesz już otrzymywać udostępnionych sprawdzianów i nie będziesz mógł ich też udostępnić. - Będziesz otrzymywać udostępnione sprawdziany od innych osób z twojej klasy. - Udostępniaj sprawdziany w swojej klasie - Włącz Udostępnianie wydarzeń Pokazuj nieobecności nauczycieli w Terminarzu Tablica ogłoszeń Obecności/nieobecności @@ -1553,4 +1549,5 @@ {cmd-share-variant} udostępnione przez Ciebie Domyślnie udostępniaj wydarzenia Ustaw tworzone wydarzenia domyślnie jako udostępnione + Rejestracja