[App] Remove unneeded profile settings.

This commit is contained in:
Kuba Szczodrzyński 2021-03-25 16:45:14 +01:00
parent 549a542879
commit 7a43ef4dee
2 changed files with 2 additions and 24 deletions

View File

@ -24,5 +24,5 @@ abstract class SettingsCard(
protected abstract fun buildCard(): MaterialAboutCard protected abstract fun buildCard(): MaterialAboutCard
protected abstract fun getItems(): List<MaterialAboutItem> protected abstract fun getItems(): List<MaterialAboutItem>
protected abstract fun getItemsMore(): List<MaterialAboutItem> protected open fun getItemsMore(): List<MaterialAboutItem> = listOf()
} }

View File

@ -6,10 +6,8 @@ package pl.szczodrzynski.edziennik.ui.modules.settings.cards
import android.content.Intent import android.content.Intent
import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial import com.mikepenz.iconics.typeface.library.community.material.CommunityMaterial
import eu.szkolny.font.SzkolnyFont
import pl.szczodrzynski.edziennik.R import pl.szczodrzynski.edziennik.R
import pl.szczodrzynski.edziennik.ui.dialogs.profile.ProfileConfigDialog import pl.szczodrzynski.edziennik.ui.dialogs.profile.ProfileConfigDialog
import pl.szczodrzynski.edziennik.ui.dialogs.profile.ProfileRemoveDialog
import pl.szczodrzynski.edziennik.ui.modules.login.LoginActivity import pl.szczodrzynski.edziennik.ui.modules.login.LoginActivity
import pl.szczodrzynski.edziennik.ui.modules.settings.MaterialAboutProfileItem import pl.szczodrzynski.edziennik.ui.modules.settings.MaterialAboutProfileItem
import pl.szczodrzynski.edziennik.ui.modules.settings.SettingsCard import pl.szczodrzynski.edziennik.ui.modules.settings.SettingsCard
@ -20,7 +18,7 @@ class SettingsProfileCard(util: SettingsUtil) : SettingsCard(util) {
override fun buildCard() = util.createCard( override fun buildCard() = util.createCard(
null, null,
items = getItems(), items = getItems(),
itemsMore = getItemsMore() itemsMore = listOf()
) )
private fun getProfileItem(): MaterialAboutProfileItem = util.createProfileItem( private fun getProfileItem(): MaterialAboutProfileItem = util.createProfileItem(
@ -45,26 +43,6 @@ class SettingsProfileCard(util: SettingsUtil) : SettingsCard(util) {
icon = CommunityMaterial.Icon.cmd_account_plus_outline icon = CommunityMaterial.Icon.cmd_account_plus_outline
) { ) {
activity.startActivity(Intent(activity, LoginActivity::class.java)) activity.startActivity(Intent(activity, LoginActivity::class.java))
},
util.createActionItem(
text = R.string.settings_profile_remove_text,
subText = R.string.settings_profile_remove_subtext,
icon = SzkolnyFont.Icon.szf_delete_empty_outline
) {
ProfileRemoveDialog(activity, app.profile.id, app.profile.name, false)
}
)
override fun getItemsMore() = listOf(
util.createPropertyItem(
text = R.string.settings_profile_sync_text,
subText = R.string.settings_profile_sync_subtext,
icon = CommunityMaterial.Icon.cmd_account_convert,
value = app.profile.syncEnabled,
) { _, it ->
app.profile.syncEnabled = it
app.profileSave()
} }
) )
} }