From 1f6ae902ee8aa2277d855acaf377f35d7e5ffef1 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 21 Jul 2022 12:31:39 +0200 Subject: [PATCH] adding a couple more dialog updates --- .../contacts/pro/activities/MainActivity.kt | 1 + .../pro/dialogs/ExportContactsDialog.kt | 6 +-- .../pro/dialogs/ImportContactsDialog.kt | 7 +-- .../pro/dialogs/SelectContactsDialog.kt | 4 +- .../res/layout/dialog_export_contacts.xml | 49 ++++++++++--------- .../layout/dialog_filter_contact_sources.xml | 5 +- .../res/layout/dialog_import_contacts.xml | 28 +++++------ .../layout/item_add_favorite_with_number.xml | 4 +- .../item_add_favorite_without_number.xml | 2 +- .../res/layout/item_filter_contact_source.xml | 6 ++- 10 files changed, 58 insertions(+), 54 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 713ef22b..2f3433eb 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 @@ -351,6 +351,7 @@ class MainActivity : SimpleActivity(), RefreshContactsListener { view_pager.onGlobalLayout { refreshContacts(ALL_TABS_MASK) + refreshMenuItems() } if (intent?.action == Intent.ACTION_VIEW && intent.data != null) { diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/dialogs/ExportContactsDialog.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/dialogs/ExportContactsDialog.kt index 50330838..05e6c551 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/dialogs/ExportContactsDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/dialogs/ExportContactsDialog.kt @@ -30,17 +30,17 @@ class ExportContactsDialog( init { val view = (activity.layoutInflater.inflate(R.layout.dialog_export_contacts, null) as ViewGroup).apply { - export_contacts_folder.text = activity.humanizePath(realPath) + export_contacts_folder.setText(activity.humanizePath(realPath)) export_contacts_filename.setText("contacts_${activity.getCurrentFormattedDateTime()}") if (hidePath) { - export_contacts_folder_label.beGone() + export_contacts_folder_hint.beGone() export_contacts_folder.beGone() } else { export_contacts_folder.setOnClickListener { activity.hideKeyboard(export_contacts_filename) FilePickerDialog(activity, realPath, false, showFAB = true) { - export_contacts_folder.text = activity.humanizePath(it) + export_contacts_folder.setText(activity.humanizePath(it)) realPath = it } } diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/dialogs/ImportContactsDialog.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/dialogs/ImportContactsDialog.kt index 757ea2f2..02fa5683 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/dialogs/ImportContactsDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/dialogs/ImportContactsDialog.kt @@ -25,14 +25,14 @@ class ImportContactsDialog(val activity: SimpleActivity, val path: String, priva val view = (activity.layoutInflater.inflate(R.layout.dialog_import_contacts, null) as ViewGroup).apply { targetContactSource = activity.config.lastUsedContactSource activity.getPublicContactSource(targetContactSource) { - import_contacts_title.text = it + import_contacts_title.setText(it) if (it.isEmpty()) { ContactsHelper(activity).getContactSources { val localSource = it.firstOrNull { it.name == SMT_PRIVATE } if (localSource != null) { targetContactSource = localSource.name activity.runOnUiThread { - import_contacts_title.text = localSource.publicName + import_contacts_title.setText(localSource.publicName) } } } @@ -43,7 +43,8 @@ class ImportContactsDialog(val activity: SimpleActivity, val path: String, priva activity.showContactSourcePicker(targetContactSource) { targetContactSource = if (it == activity.getString(R.string.phone_storage_hidden)) SMT_PRIVATE else it activity.getPublicContactSource(it) { - import_contacts_title.text = if (it == "") activity.getString(R.string.phone_storage) else it + val title = if (it == "") activity.getString(R.string.phone_storage) else it + import_contacts_title.setText(title) } } } diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/dialogs/SelectContactsDialog.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/dialogs/SelectContactsDialog.kt index e3e42e33..8e4b04b6 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/dialogs/SelectContactsDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/dialogs/SelectContactsDialog.kt @@ -36,7 +36,9 @@ class SelectContactsDialog( } // if selecting multiple contacts is disabled, react on first contact click and dismiss the dialog - val contactClickCallback: ((Contact) -> Unit)? = if (allowSelectMultiple) null else { contact -> + val contactClickCallback: ((Contact) -> Unit)? = if (allowSelectMultiple) { + null + } else { contact -> callback(arrayListOf(contact), arrayListOf()) dialog!!.dismiss() } diff --git a/app/src/main/res/layout/dialog_export_contacts.xml b/app/src/main/res/layout/dialog_export_contacts.xml index e5f45a3d..f73fba31 100644 --- a/app/src/main/res/layout/dialog_export_contacts.xml +++ b/app/src/main/res/layout/dialog_export_contacts.xml @@ -10,42 +10,42 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" - android:paddingStart="@dimen/activity_margin" - android:paddingTop="@dimen/activity_margin" - android:paddingEnd="@dimen/activity_margin"> + android:paddingTop="@dimen/activity_margin"> - - - + android:hint="@string/folder" + android:paddingStart="@dimen/activity_margin" + android:paddingEnd="@dimen/activity_margin"> + + + + + android:layout_marginBottom="@dimen/medium_margin" + android:hint="@string/filename_without_vcf" + android:paddingStart="@dimen/activity_margin" + android:paddingEnd="@dimen/activity_margin"> - + android:textSize="@dimen/bigger_text_size" /> @@ -53,7 +53,9 @@ android:id="@+id/export_contacts_divider" android:layout_width="match_parent" android:layout_height="1px" + android:layout_marginStart="@dimen/activity_margin" android:layout_marginTop="@dimen/medium_margin" + android:layout_marginEnd="@dimen/activity_margin" android:layout_marginBottom="@dimen/medium_margin" android:background="@color/divider_grey" android:importantForAccessibility="no" /> @@ -62,7 +64,8 @@ android:id="@+id/export_contacts_pick_sources_label" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:paddingStart="@dimen/small_margin" + android:paddingStart="@dimen/activity_margin" + android:paddingEnd="@dimen/activity_margin" android:text="@string/include_contact_sources" android:textSize="@dimen/smaller_text_size" /> diff --git a/app/src/main/res/layout/dialog_filter_contact_sources.xml b/app/src/main/res/layout/dialog_filter_contact_sources.xml index 120c85fd..19b4890e 100644 --- a/app/src/main/res/layout/dialog_filter_contact_sources.xml +++ b/app/src/main/res/layout/dialog_filter_contact_sources.xml @@ -1,6 +1,5 @@ - + app:layoutManager="com.simplemobiletools.commons.views.MyLinearLayoutManager" /> diff --git a/app/src/main/res/layout/dialog_import_contacts.xml b/app/src/main/res/layout/dialog_import_contacts.xml index 3f5484c4..7cf81b36 100644 --- a/app/src/main/res/layout/dialog_import_contacts.xml +++ b/app/src/main/res/layout/dialog_import_contacts.xml @@ -1,6 +1,5 @@ - - - + android:layout_marginBottom="@dimen/activity_margin" + android:hint="@string/target_contact_source"> + + + diff --git a/app/src/main/res/layout/item_add_favorite_with_number.xml b/app/src/main/res/layout/item_add_favorite_with_number.xml index 06de1793..64e37d17 100644 --- a/app/src/main/res/layout/item_add_favorite_with_number.xml +++ b/app/src/main/res/layout/item_add_favorite_with_number.xml @@ -15,7 +15,6 @@ android:minHeight="@dimen/min_row_height" android:paddingStart="@dimen/tiny_margin" android:paddingTop="@dimen/normal_margin" - android:paddingEnd="@dimen/activity_margin" android:paddingBottom="@dimen/normal_margin"> diff --git a/app/src/main/res/layout/item_add_favorite_without_number.xml b/app/src/main/res/layout/item_add_favorite_without_number.xml index e562e240..23d47e7e 100644 --- a/app/src/main/res/layout/item_add_favorite_without_number.xml +++ b/app/src/main/res/layout/item_add_favorite_without_number.xml @@ -15,7 +15,6 @@ android:minHeight="@dimen/min_row_height" android:paddingStart="@dimen/tiny_margin" android:paddingTop="@dimen/medium_margin" - android:paddingEnd="@dimen/activity_margin" android:paddingBottom="@dimen/medium_margin"> diff --git a/app/src/main/res/layout/item_filter_contact_source.xml b/app/src/main/res/layout/item_filter_contact_source.xml index a7040588..d4218d60 100644 --- a/app/src/main/res/layout/item_filter_contact_source.xml +++ b/app/src/main/res/layout/item_filter_contact_source.xml @@ -4,13 +4,17 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:background="?attr/selectableItemBackground" - android:padding="@dimen/normal_margin"> + android:paddingStart="@dimen/normal_margin" + android:paddingTop="@dimen/small_margin" + android:paddingEnd="@dimen/normal_margin" + android:paddingBottom="@dimen/small_margin">