From 2410669e2d4ae239ce48ea28dfa670db5b12feba Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 5 Dec 2019 10:28:40 +0100 Subject: [PATCH] fix #459, show a Dialpad menu button in case the FAB is hidden --- .../contacts/pro/activities/MainActivity.kt | 11 +++++++++-- app/src/main/res/menu/menu.xml | 5 +++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/MainActivity.kt index c6c9b749..93a6d798 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/activities/MainActivity.kt @@ -185,6 +185,8 @@ class MainActivity : SimpleActivity(), RefreshContactsListener { menu.apply { findItem(R.id.sort).isVisible = currentFragment != groups_fragment findItem(R.id.filter).isVisible = currentFragment != groups_fragment + findItem(R.id.dialpad).isVisible = !config.showDialpadButton + setupSearch(this) updateMenuItemColors(this) } @@ -196,6 +198,7 @@ class MainActivity : SimpleActivity(), RefreshContactsListener { when (item.itemId) { R.id.sort -> showSortingDialog() R.id.filter -> showFilterDialog() + R.id.dialpad -> launchDialpad() R.id.import_contacts -> tryImportContacts() R.id.export_contacts -> tryExportContacts() R.id.settings -> startActivity(Intent(applicationContext, SettingsActivity::class.java)) @@ -409,8 +412,7 @@ class MainActivity : SimpleActivity(), RefreshContactsListener { main_tabs_holder.beVisibleIf(skippedTabs < tabsList.size - 1) main_dialpad_button.setOnClickListener { - val intent = Intent(applicationContext, DialpadActivity::class.java) - startActivity(intent) + launchDialpad() } } @@ -437,6 +439,11 @@ class MainActivity : SimpleActivity(), RefreshContactsListener { } } + private fun launchDialpad() { + val intent = Intent(applicationContext, DialpadActivity::class.java) + startActivity(intent) + } + private fun tryImportContacts() { handlePermission(PERMISSION_READ_STORAGE) { if (it) { diff --git a/app/src/main/res/menu/menu.xml b/app/src/main/res/menu/menu.xml index 8eca10f7..1bb9ba9d 100644 --- a/app/src/main/res/menu/menu.xml +++ b/app/src/main/res/menu/menu.xml @@ -17,6 +17,11 @@ android:icon="@drawable/ic_filter_vector" android:title="@string/filter" app:showAsAction="ifRoom"/> +