diff --git a/app/ui/src/main/java/com/fsck/k9/ui/settings/SettingsActionItem.kt b/app/ui/src/main/java/com/fsck/k9/ui/settings/SettingsActionItem.kt index 241ca6b4d..981905219 100644 --- a/app/ui/src/main/java/com/fsck/k9/ui/settings/SettingsActionItem.kt +++ b/app/ui/src/main/java/com/fsck/k9/ui/settings/SettingsActionItem.kt @@ -3,13 +3,18 @@ package com.fsck.k9.ui.settings import com.fsck.k9.ui.R import com.xwray.groupie.kotlinandroidextensions.Item import com.xwray.groupie.kotlinandroidextensions.ViewHolder -import kotlinx.android.synthetic.main.text_list_item.* +import kotlinx.android.synthetic.main.text_icon_list_item.* +import android.util.TypedValue -internal class SettingsActionItem(val text: String, val action: SettingsAction) : Item() { +internal class SettingsActionItem(val text: String, val action: SettingsAction, val icon: Int) : Item() { - override fun getLayout(): Int = R.layout.text_list_item + override fun getLayout(): Int = R.layout.text_icon_list_item override fun bind(viewHolder: ViewHolder, position: Int) { viewHolder.text.text = text + + val outValue = TypedValue() + viewHolder.icon.context.theme.resolveAttribute(icon, outValue, true) + viewHolder.icon.setImageResource(outValue.resourceId) } } diff --git a/app/ui/src/main/java/com/fsck/k9/ui/settings/SettingsActivity.kt b/app/ui/src/main/java/com/fsck/k9/ui/settings/SettingsActivity.kt index 1d4104524..e054c0e3f 100644 --- a/app/ui/src/main/java/com/fsck/k9/ui/settings/SettingsActivity.kt +++ b/app/ui/src/main/java/com/fsck/k9/ui/settings/SettingsActivity.kt @@ -58,8 +58,16 @@ class SettingsActivity : K9Activity() { private fun populateSettingsList(accounts: List) { settingsAdapter.clear() + val miscSection = Section().apply { + val item = SettingsActionItem(getString(R.string.about_action), SettingsAction.ABOUT_SCREEN, R.attr.iconSettingsAbout) + add(item) + } + settingsAdapter.add(miscSection) + val generalSection = Section().apply { - add(SettingsActionItem(getString(R.string.general_settings_title), SettingsAction.GENERAL_SETTINGS)) + val item = SettingsActionItem(getString(R.string.general_settings_title), + SettingsAction.GENERAL_SETTINGS, R.attr.iconSettingsGeneral) + add(item) } settingsAdapter.add(generalSection) @@ -67,15 +75,11 @@ class SettingsActivity : K9Activity() { for (account in accounts) { add(AccountItem(account)) } - add(SettingsActionItem(getString(R.string.add_account_action), SettingsAction.ADD_ACCOUNT)) + val item = SettingsActionItem(getString(R.string.add_account_action), SettingsAction.ADD_ACCOUNT, R.attr.iconSettingsAccountAdd) + add(item) } + accountSection.setHeader(SettingsDividerItem(getString(R.string.accounts_title))) settingsAdapter.add(accountSection) - - //TODO: add header and/or divider - val miscSection = Section().apply { - add(SettingsActionItem(getString(R.string.about_action), SettingsAction.ABOUT_SCREEN)) - } - settingsAdapter.add(miscSection) } override fun onOptionsItemSelected(item: MenuItem): Boolean { diff --git a/app/ui/src/main/java/com/fsck/k9/ui/settings/SettingsDividerItem.kt b/app/ui/src/main/java/com/fsck/k9/ui/settings/SettingsDividerItem.kt new file mode 100644 index 000000000..9cdc929b5 --- /dev/null +++ b/app/ui/src/main/java/com/fsck/k9/ui/settings/SettingsDividerItem.kt @@ -0,0 +1,14 @@ +package com.fsck.k9.ui.settings + +import com.fsck.k9.ui.R +import com.xwray.groupie.kotlinandroidextensions.Item +import com.xwray.groupie.kotlinandroidextensions.ViewHolder +import kotlinx.android.synthetic.main.text_divider_list_item.* + +internal class SettingsDividerItem(val text: String) : Item() { + override fun getLayout(): Int = R.layout.text_divider_list_item + + override fun bind(viewHolder: ViewHolder, position: Int) { + viewHolder.text.text = text + } +} diff --git a/app/ui/src/main/res/drawable-anydpi/ic_account_dark.xml b/app/ui/src/main/res/drawable-anydpi/ic_account_dark.xml new file mode 100644 index 000000000..31a4de144 --- /dev/null +++ b/app/ui/src/main/res/drawable-anydpi/ic_account_dark.xml @@ -0,0 +1,7 @@ + + + diff --git a/app/ui/src/main/res/drawable-anydpi/ic_account_light.xml b/app/ui/src/main/res/drawable-anydpi/ic_account_light.xml new file mode 100644 index 000000000..4fa8d1d22 --- /dev/null +++ b/app/ui/src/main/res/drawable-anydpi/ic_account_light.xml @@ -0,0 +1,8 @@ + + + diff --git a/app/ui/src/main/res/drawable-anydpi/ic_account_plus_dark.xml b/app/ui/src/main/res/drawable-anydpi/ic_account_plus_dark.xml new file mode 100644 index 000000000..a0077b7b7 --- /dev/null +++ b/app/ui/src/main/res/drawable-anydpi/ic_account_plus_dark.xml @@ -0,0 +1,7 @@ + + + diff --git a/app/ui/src/main/res/drawable-anydpi/ic_account_plus_light.xml b/app/ui/src/main/res/drawable-anydpi/ic_account_plus_light.xml new file mode 100644 index 000000000..1aff5ace2 --- /dev/null +++ b/app/ui/src/main/res/drawable-anydpi/ic_account_plus_light.xml @@ -0,0 +1,8 @@ + + + \ No newline at end of file diff --git a/app/ui/src/main/res/layout/account_list_item.xml b/app/ui/src/main/res/layout/account_list_item.xml index b0673b983..eb06f4db1 100644 --- a/app/ui/src/main/res/layout/account_list_item.xml +++ b/app/ui/src/main/res/layout/account_list_item.xml @@ -7,31 +7,42 @@ android:clickable="true" android:focusable="true" android:gravity="center_vertical" - android:minHeight="?android:attr/listPreferredItemHeightSmall" - android:orientation="vertical"> + android:orientation="horizontal" + android:paddingLeft="8dp"> - + - + android:orientation="vertical" + android:paddingLeft="24dp" + android:paddingRight="16dp"> + + + + + diff --git a/app/ui/src/main/res/layout/text_list_item.xml b/app/ui/src/main/res/layout/text_divider_list_item.xml similarity index 53% rename from app/ui/src/main/res/layout/text_list_item.xml rename to app/ui/src/main/res/layout/text_divider_list_item.xml index 816ae3782..8fde784fb 100644 --- a/app/ui/src/main/res/layout/text_list_item.xml +++ b/app/ui/src/main/res/layout/text_divider_list_item.xml @@ -4,16 +4,14 @@ android:id="@+id/text" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="?android:attr/selectableItemBackground" - android:clickable="true" android:ellipsize="end" - android:focusable="true" android:gravity="center_vertical" - android:minHeight="?android:attr/listPreferredItemHeightSmall" - android:paddingBottom="8dp" + android:paddingBottom="4dp" android:paddingLeft="16dp" android:paddingRight="16dp" - android:paddingTop="8dp" + android:paddingTop="4dp" android:singleLine="true" - android:textAppearance="?android:attr/textAppearanceListItem" - tools:text="List item with simple text" /> + android:textAppearance="?android:attr/textAppearanceSmall" + android:textColor="?attr/colorAccent" + android:textStyle="bold" + tools:text="Divider" /> diff --git a/app/ui/src/main/res/layout/text_icon_list_item.xml b/app/ui/src/main/res/layout/text_icon_list_item.xml new file mode 100644 index 000000000..78b203297 --- /dev/null +++ b/app/ui/src/main/res/layout/text_icon_list_item.xml @@ -0,0 +1,35 @@ + + + + + + + diff --git a/app/ui/src/main/res/values/attrs.xml b/app/ui/src/main/res/values/attrs.xml index 4c6add7c8..1cd82728d 100644 --- a/app/ui/src/main/res/values/attrs.xml +++ b/app/ui/src/main/res/values/attrs.xml @@ -52,6 +52,10 @@ + + + + diff --git a/app/ui/src/main/res/values/themes.xml b/app/ui/src/main/res/values/themes.xml index 248b713a1..a65236f4f 100644 --- a/app/ui/src/main/res/values/themes.xml +++ b/app/ui/src/main/res/values/themes.xml @@ -72,6 +72,10 @@ @drawable/ic_widgets_light @drawable/ic_shield_light @drawable/ic_bug_light + @drawable/ic_info_outline_light + @drawable/ic_cog_light + @drawable/ic_account_light + @drawable/ic_account_plus_light @android:color/primary_text_light @android:color/secondary_text_light #8038B8E2 @@ -164,6 +168,10 @@ @drawable/ic_widgets_dark @drawable/ic_shield_dark @drawable/ic_bug_dark + @drawable/ic_info_outline_dark + @drawable/ic_cog_dark + @drawable/ic_account_dark + @drawable/ic_account_plus_dark @android:color/primary_text_dark @android:color/secondary_text_dark #8038B8E2