Skip to content

Commit 9da41ac

Browse files
authored
feat(message-list): adds an indicator to the selected sort type (#11190)
2 parents 18708eb + 7ae6996 commit 9da41ac

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

legacy/ui/legacy/src/main/java/com/fsck/k9/ui/messagelist/LegacyMessageListFragment.kt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,6 +1177,20 @@ class LegacyMessageListFragment :
11771177

11781178
private fun prepareSortMenu(menu: Menu) {
11791179
menu.findItem(R.id.set_sort).isVisible = true
1180+
val selectedSortItem = menu.findItem(getSelectedSortId())
1181+
selectedSortItem.title = "${resources.getString(R.string.sort_by_indicator)} ${selectedSortItem.title}"
1182+
}
1183+
1184+
private fun getSelectedSortId(): Int {
1185+
return when (this.sortType) {
1186+
SortType.SORT_DATE -> R.id.set_sort_date
1187+
SortType.SORT_ARRIVAL -> R.id.set_sort_arrival
1188+
SortType.SORT_SUBJECT -> R.id.set_sort_subject
1189+
SortType.SORT_SENDER -> R.id.set_sort_sender
1190+
SortType.SORT_UNREAD -> R.id.set_sort_unread
1191+
SortType.SORT_FLAGGED -> R.id.set_sort_flag
1192+
SortType.SORT_ATTACHMENT -> R.id.set_sort_attach
1193+
}
11801194
}
11811195

11821196
private fun prepareDebugMenu(menu: Menu) {

legacy/ui/legacy/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -651,6 +651,7 @@
651651
<string name="sort_by_flag">Star</string>
652652
<string name="sort_by_unread">Read/unread</string>
653653
<string name="sort_by_attach">Attachments</string>
654+
<string name="sort_by_indicator">•</string>
654655

655656
<string name="account_delete_dlg_title">Remove Account</string>
656657

0 commit comments

Comments
 (0)