fix #459, show a Dialpad menu button in case the FAB is hidden

This commit is contained in:
tibbi 2019-12-05 10:28:40 +01:00
parent 255782b167
commit 2410669e2d
2 changed files with 14 additions and 2 deletions

View File

@ -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) {

View File

@ -17,6 +17,11 @@
android:icon="@drawable/ic_filter_vector"
android:title="@string/filter"
app:showAsAction="ifRoom"/>
<item
android:id="@+id/dialpad"
android:icon="@drawable/ic_dialpad_vector"
android:title="@string/dialpad"
app:showAsAction="ifRoom"/>
<item
android:id="@+id/import_contacts"
android:title="@string/import_contacts_from_vcf"