adding a couple more dialog updates

This commit is contained in:
tibbi 2022-07-21 12:31:39 +02:00
parent d42fe722ee
commit 1f6ae902ee
10 changed files with 58 additions and 54 deletions

View File

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

View File

@ -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
}
}

View File

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

View File

@ -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()
}

View File

@ -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">
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/export_contacts_folder_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/folder"
android:textSize="@dimen/smaller_text_size" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/export_contacts_folder"
<com.simplemobiletools.commons.views.MyTextInputLayout
android:id="@+id/export_contacts_folder_hint"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/activity_margin"
android:layout_marginBottom="@dimen/activity_margin"
android:paddingTop="@dimen/small_margin"
android:paddingEnd="@dimen/small_margin"
android:paddingBottom="@dimen/small_margin" />
android:hint="@string/folder"
android:paddingStart="@dimen/activity_margin"
android:paddingEnd="@dimen/activity_margin">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/export_contacts_folder"
style="@style/UnclickableEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</com.simplemobiletools.commons.views.MyTextInputLayout>
<com.simplemobiletools.commons.views.MyTextInputLayout
android:id="@+id/export_contacts_filename_hint"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/filename_without_vcf">
android:layout_marginBottom="@dimen/medium_margin"
android:hint="@string/filename_without_vcf"
android:paddingStart="@dimen/activity_margin"
android:paddingEnd="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MyEditText
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/export_contacts_filename"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/activity_margin"
android:paddingTop="@dimen/normal_margin"
android:paddingEnd="@dimen/small_margin"
android:inputType="textCapWords"
android:singleLine="true"
android:textCursorDrawable="@null"
android:textSize="@dimen/normal_text_size" />
android:textSize="@dimen/bigger_text_size" />
</com.simplemobiletools.commons.views.MyTextInputLayout>
@ -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" />

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<com.simplemobiletools.commons.views.MyRecyclerView
xmlns:android="http://schemas.android.com/apk/res/android"
<com.simplemobiletools.commons.views.MyRecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/filter_contact_sources_list"
android:layout_width="match_parent"
@ -8,4 +7,4 @@
android:clipToPadding="false"
android:overScrollMode="never"
android:paddingTop="@dimen/medium_margin"
app:layoutManager="com.simplemobiletools.commons.views.MyLinearLayoutManager"/>
app:layoutManager="com.simplemobiletools.commons.views.MyLinearLayoutManager" />

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/import_contacts_holder"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -9,23 +8,18 @@
android:paddingTop="@dimen/activity_margin"
android:paddingEnd="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/import_contacts_source_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/small_margin"
android:text="@string/target_contact_source"
android:textSize="@dimen/smaller_text_size" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/import_contacts_title"
<com.simplemobiletools.commons.views.MyTextInputLayout
android:id="@+id/import_contacts_hint"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/small_margin"
android:background="?attr/selectableItemBackground"
android:paddingTop="@dimen/activity_margin"
android:paddingEnd="@dimen/activity_margin"
android:paddingBottom="@dimen/activity_margin"
tools:text="Phone" />
android:layout_marginBottom="@dimen/activity_margin"
android:hint="@string/target_contact_source">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/import_contacts_title"
style="@style/UnclickableEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</com.simplemobiletools.commons.views.MyTextInputLayout>
</LinearLayout>

View File

@ -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">
<ImageView
@ -49,8 +48,8 @@
android:layout_toStartOf="@+id/contact_checkbox"
android:layout_toEndOf="@+id/contact_tmb"
android:alpha="0.6"
android:maxLines="1"
android:ellipsize="end"
android:maxLines="1"
android:paddingStart="@dimen/medium_margin"
android:paddingEnd="@dimen/activity_margin"
android:textSize="@dimen/bigger_text_size"
@ -62,6 +61,7 @@
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:background="@null"
android:clickable="false"
android:gravity="center_vertical" />

View File

@ -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">
<ImageView
@ -47,6 +46,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:background="@null"
android:layout_centerVertical="true"
android:clickable="false"
android:gravity="center_vertical" />

View File

@ -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">
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
android:id="@+id/filter_contact_source_checkbox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/medium_margin"
android:background="@null"
android:clickable="false"
android:paddingStart="@dimen/small_margin" />