mirror of
https://github.com/szkolny-eu/szkolny-android.git
synced 2024-11-24 10:54:36 -06:00
[UI] Remove "enable shared events" setting. Reorder settings a bit.
This commit is contained in:
parent
845e09d875
commit
c90ad97f55
@ -49,7 +49,7 @@ interface ProfileDao {
|
||||
@get:Query("SELECT profileId FROM profiles WHERE profileId >= 0 ORDER BY profileId")
|
||||
val idsNow: List<Int>
|
||||
|
||||
@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<Profile>
|
||||
|
||||
@get:Query("SELECT profileId FROM profiles WHERE profileId > 0 ORDER BY profileId ASC LIMIT 1")
|
||||
|
@ -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 = ""
|
||||
|
||||
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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(
|
||||
|
@ -23,6 +23,6 @@ abstract class SettingsCard(
|
||||
}
|
||||
|
||||
protected abstract fun buildCard(): MaterialAboutCard
|
||||
protected abstract fun getItems(): List<MaterialAboutItem>
|
||||
protected open fun getItemsMore(): List<MaterialAboutItem> = listOf()
|
||||
protected abstract fun getItems(card: MaterialAboutCard): List<MaterialAboutItem>
|
||||
protected open fun getItemsMore(card: MaterialAboutCard): List<MaterialAboutItem> = listOf()
|
||||
}
|
||||
|
@ -34,8 +34,8 @@ class SettingsUtil(
|
||||
|
||||
fun createCard(
|
||||
titleRes: Int?,
|
||||
items: List<MaterialAboutItem>,
|
||||
itemsMore: List<MaterialAboutItem>,
|
||||
items: (card: MaterialAboutCard) -> List<MaterialAboutItem>,
|
||||
itemsMore: (card: MaterialAboutCard) -> List<MaterialAboutItem>,
|
||||
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
|
||||
|
@ -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<MaterialAboutItem>()
|
||||
override fun getItemsMore() = listOf<MaterialAboutItem>()
|
||||
|
||||
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(
|
||||
|
@ -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(
|
||||
|
@ -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()
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
<variable
|
||||
name="config"
|
||||
type="pl.szczodrzynski.edziennik.config.ProfileConfigUI" />
|
||||
type="pl.szczodrzynski.edziennik.config.ProfileConfig" />
|
||||
|
||||
<variable
|
||||
name="isAgendaMode"
|
||||
@ -38,7 +38,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:checked="@={config.agendaLessonChanges}"
|
||||
android:checked="@={config.ui.agendaLessonChanges}"
|
||||
android:minHeight="32dp"
|
||||
android:text="@string/agenda_config_lesson_changes" />
|
||||
|
||||
@ -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" />
|
||||
|
||||
<com.google.android.material.checkbox.MaterialCheckBox
|
||||
android:id="@+id/shareByDefault"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:minHeight="32dp"
|
||||
android:checked="@={config.shareByDefault}"
|
||||
android:text="@string/settings_register_share_by_default_text" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@ -120,10 +129,9 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:checked="@={config.agendaElearningMark}"
|
||||
android:checked="@={config.ui.agendaElearningMark}"
|
||||
android:enabled="false"
|
||||
android:minHeight="32dp"
|
||||
android:onClick="@{() -> elearningType.setEnabled(elearningEnabled.isChecked())}"
|
||||
android:text="@string/agenda_config_elearning_mark" />
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
@ -131,7 +139,7 @@
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:enabled="@{config.agendaElearningMark}"
|
||||
android:enabled="@{elearningEnabled.checked}"
|
||||
android:hint="@string/agenda_config_elearning_type">
|
||||
|
||||
<pl.szczodrzynski.edziennik.utils.TextInputDropDown
|
||||
@ -147,7 +155,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:checked="@={config.agendaElearningGroup}"
|
||||
android:checked="@={config.ui.agendaElearningGroup}"
|
||||
android:enabled="false"
|
||||
android:minHeight="32dp"
|
||||
android:text="@string/agenda_config_elearning_group" />
|
||||
|
@ -898,10 +898,6 @@
|
||||
<string name="settings_register_count_in_seconds_text">Zählen Sie die Zeit in Sekunden herunter</string>
|
||||
<string name="settings_register_dont_count_zero_text">Zählen Sie die Note 0 nicht zum Durchschnitt</string>
|
||||
<string name="settings_register_login_not_implemented_text">Dieses E-Register ist noch nicht implementiert</string>
|
||||
<string name="settings_register_shared_events_dialog_disabled_text">Sie erhalten keine geteilten Ereignisse mehr und können sie nicht mehr teilen.</string>
|
||||
<string name="settings_register_shared_events_dialog_enabled_text">Sie erhalten geteilte Ereignisse von anderen Personen in Ihrer Klasse</string>
|
||||
<string name="settings_register_shared_events_subtext">Teile Tests in deiner Klasse</string>
|
||||
<string name="settings_register_shared_events_text">Aktivieren Sie die Ereignisfreigabe</string>
|
||||
<string name="settings_register_show_teacher_absences_text">Zeigen Sie die Abwesenheiten von Lehrern im Zeitplan an</string>
|
||||
<string name="settings_sync_customize_endpoint_announcements">Schwarzes Brett</string>
|
||||
<string name="settings_sync_customize_endpoint_attendance">Anwesenheiten</string>
|
||||
|
@ -900,10 +900,6 @@
|
||||
<string name="settings_register_count_in_seconds_text">Count time in seconds</string>
|
||||
<string name="settings_register_dont_count_zero_text">Don\'t count 0 grade to average</string>
|
||||
<string name="settings_register_login_not_implemented_text">This e-register isn\'t implemented yet.</string>
|
||||
<string name="settings_register_shared_events_dialog_disabled_text">You won\'t receive shared events anymore and you won\'t be able to share them.</string>
|
||||
<string name="settings_register_shared_events_dialog_enabled_text">You will receive shared events from other people in your class.</string>
|
||||
<string name="settings_register_shared_events_subtext">Share exams in your class</string>
|
||||
<string name="settings_register_shared_events_text">Enable Event sharing</string>
|
||||
<string name="settings_register_show_teacher_absences_text">Show teacher absences in Agenda</string>
|
||||
<string name="settings_sync_customize_endpoint_announcements">Notice board</string>
|
||||
<string name="settings_sync_customize_endpoint_attendance">Attendances</string>
|
||||
|
@ -969,10 +969,6 @@
|
||||
<string name="settings_register_count_in_seconds_text">Odliczaj czas w sekundach</string>
|
||||
<string name="settings_register_dont_count_zero_text">Nie wliczaj oceny 0 do średniej</string>
|
||||
<string name="settings_register_login_not_implemented_text">Ten e-dziennik nie został jeszcze zaimplementowany w aplikacji.</string>
|
||||
<string name="settings_register_shared_events_dialog_disabled_text">Nie będziesz już otrzymywać udostępnionych sprawdzianów i nie będziesz mógł ich też udostępnić.</string>
|
||||
<string name="settings_register_shared_events_dialog_enabled_text">Będziesz otrzymywać udostępnione sprawdziany od innych osób z twojej klasy.</string>
|
||||
<string name="settings_register_shared_events_subtext">Udostępniaj sprawdziany w swojej klasie</string>
|
||||
<string name="settings_register_shared_events_text">Włącz Udostępnianie wydarzeń</string>
|
||||
<string name="settings_register_show_teacher_absences_text">Pokazuj nieobecności nauczycieli w Terminarzu</string>
|
||||
<string name="settings_sync_customize_endpoint_announcements">Tablica ogłoszeń</string>
|
||||
<string name="settings_sync_customize_endpoint_attendance">Obecności/nieobecności</string>
|
||||
@ -1553,4 +1549,5 @@
|
||||
<string name="legend_event_shared_sent">{cmd-share-variant} udostępnione przez Ciebie</string>
|
||||
<string name="settings_register_share_by_default_text">Domyślnie udostępniaj wydarzenia</string>
|
||||
<string name="settings_register_share_by_default_subtext">Ustaw tworzone wydarzenia domyślnie jako udostępnione</string>
|
||||
<string name="settings_registration_section">Rejestracja</string>
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user