allow managing visible contact fields at the Edit screen too

This commit is contained in:
tibbi 2022-02-05 12:02:47 +01:00
parent 1907003b75
commit 21fdc744cd
3 changed files with 21 additions and 6 deletions

View File

@ -28,6 +28,7 @@ import com.simplemobiletools.commons.helpers.*
import com.simplemobiletools.commons.models.RadioItem import com.simplemobiletools.commons.models.RadioItem
import com.simplemobiletools.contacts.pro.R import com.simplemobiletools.contacts.pro.R
import com.simplemobiletools.contacts.pro.dialogs.CustomLabelDialog import com.simplemobiletools.contacts.pro.dialogs.CustomLabelDialog
import com.simplemobiletools.contacts.pro.dialogs.ManageVisibleFieldsDialog
import com.simplemobiletools.contacts.pro.dialogs.MyDatePickerDialog import com.simplemobiletools.contacts.pro.dialogs.MyDatePickerDialog
import com.simplemobiletools.contacts.pro.dialogs.SelectGroupsDialog import com.simplemobiletools.contacts.pro.dialogs.SelectGroupsDialog
import com.simplemobiletools.contacts.pro.extensions.* import com.simplemobiletools.contacts.pro.extensions.*
@ -289,6 +290,13 @@ class EditContactActivity : ContactActivity() {
deleteContact() deleteContact()
true true
} }
findItem(R.id.manage_visible_fields).setOnMenuItemClickListener {
ManageVisibleFieldsDialog(this@EditContactActivity) {
initContact()
}
true
}
} }
contact_toolbar.setNavigationOnClickListener { contact_toolbar.setNavigationOnClickListener {

View File

@ -56,6 +56,9 @@ class ManageVisibleFieldsDialog(val activity: BaseSimpleActivity, val callback:
val hasSomethingChanged = activity.config.showContactFields != result val hasSomethingChanged = activity.config.showContactFields != result
activity.config.showContactFields = result activity.config.showContactFields = result
callback(hasSomethingChanged)
if (hasSomethingChanged) {
callback(true)
}
} }
} }

View File

@ -1,23 +1,27 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" <menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">
<item <item
android:id="@+id/save" android:id="@+id/save"
android:icon="@drawable/ic_check_vector" android:icon="@drawable/ic_check_vector"
android:title="@string/save" android:title="@string/save"
app:showAsAction="always"/> app:showAsAction="always" />
<item <item
android:id="@+id/share" android:id="@+id/share"
android:icon="@drawable/ic_share_vector" android:icon="@drawable/ic_share_vector"
android:title="@string/share" android:title="@string/share"
app:showAsAction="always"/> app:showAsAction="always" />
<item <item
android:id="@+id/delete" android:id="@+id/delete"
android:icon="@drawable/ic_delete_vector" android:icon="@drawable/ic_delete_vector"
android:title="@string/delete" android:title="@string/delete"
app:showAsAction="always"/> app:showAsAction="always" />
<item <item
android:id="@+id/open_with" android:id="@+id/open_with"
android:title="@string/open_with" android:title="@string/open_with"
app:showAsAction="never"/> app:showAsAction="never" />
<item
android:id="@+id/manage_visible_fields"
android:title="@string/manage_shown_contact_fields"
app:showAsAction="never" />
</menu> </menu>