Skip to content

Commit de5b0f6

Browse files
committed
hide Search, Sort and Filter menu buttons on Groups tab
1 parent 1a54cef commit de5b0f6

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

app/src/main/kotlin/com/simplemobiletools/contacts/activities/MainActivity.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,12 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
154154

155155
override fun onCreateOptionsMenu(menu: Menu): Boolean {
156156
menuInflater.inflate(R.menu.menu, menu)
157+
val currentPage = viewpager?.currentItem
158+
menu.apply {
159+
findItem(R.id.search).isVisible = currentPage != LOCATION_GROUPS_TAB
160+
findItem(R.id.sort).isVisible = currentPage != LOCATION_GROUPS_TAB
161+
findItem(R.id.filter).isVisible = currentPage != LOCATION_GROUPS_TAB
162+
}
157163
setupSearch(menu)
158164
return true
159165
}

app/src/main/kotlin/com/simplemobiletools/contacts/helpers/Constants.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ const val IS_PRIVATE = "is_private"
1616
const val GROUP = "group"
1717
const val FIRST_GROUP_ID = 10000
1818

19-
const val LOCATION_CONTACTS_TAB = 1
20-
const val LOCATION_FAVORITES_TAB = 2
19+
const val LOCATION_CONTACTS_TAB = 0
20+
const val LOCATION_FAVORITES_TAB = 1
21+
const val LOCATION_GROUPS_TAB = 2
2122
const val LOCATION_GROUP_CONTACTS = 3
2223

2324
const val CONTACTS_TAB_MASK = 1

0 commit comments

Comments
 (0)