materialize the Export clips dialog too
This commit is contained in:
parent
a9b409a5aa
commit
9dafec1db2
3 changed files with 64 additions and 6 deletions
|
@ -1,6 +1,7 @@
|
|||
package com.simplemobiletools.keyboard.dialogs
|
||||
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.appcompat.widget.AppCompatEditText
|
||||
import com.simplemobiletools.commons.activities.BaseSimpleActivity
|
||||
import com.simplemobiletools.commons.dialogs.ConfirmationDialog
|
||||
import com.simplemobiletools.commons.dialogs.FilePickerDialog
|
||||
|
@ -20,8 +21,14 @@ class ExportClipsDialog(
|
|||
activity.internalStoragePath
|
||||
}
|
||||
|
||||
val view = activity.layoutInflater.inflate(R.layout.dialog_export_clips, null).apply {
|
||||
export_clips_filename.setText("${activity.getString(R.string.app_launcher_name)}_${activity.getCurrentFormattedDateTime()}")
|
||||
val layoutId = if (activity.baseConfig.isUsingSystemTheme) {
|
||||
R.layout.dialog_export_clips_material
|
||||
} else {
|
||||
R.layout.dialog_export_clips
|
||||
}
|
||||
|
||||
val view = activity.layoutInflater.inflate(layoutId, null).apply {
|
||||
findViewById<AppCompatEditText>(R.id.export_clips_filename).setText("${activity.getString(R.string.app_launcher_name)}_${activity.getCurrentFormattedDateTime()}")
|
||||
|
||||
if (hidePath) {
|
||||
export_clips_path_label.beGone()
|
||||
|
@ -42,8 +49,9 @@ class ExportClipsDialog(
|
|||
.setNegativeButton(R.string.cancel, null)
|
||||
.apply {
|
||||
activity.setupDialogStuff(view, this, R.string.export_clipboard_items) { alertDialog ->
|
||||
alertDialog.showKeyboard(view.findViewById(R.id.export_clips_filename))
|
||||
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
|
||||
val filename = view.export_clips_filename.value
|
||||
val filename = view.findViewById<AppCompatEditText>(R.id.export_clips_filename).value
|
||||
if (filename.isEmpty()) {
|
||||
activity.toast(R.string.filename_cannot_be_empty)
|
||||
return@setOnClickListener
|
||||
|
|
|
@ -30,13 +30,13 @@
|
|||
android:paddingTop="@dimen/small_margin"
|
||||
android:paddingBottom="@dimen/activity_margin" />
|
||||
|
||||
<com.simplemobiletools.commons.views.MyTextInputLayout
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/export_clips_hint"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/filename_without_txt">
|
||||
|
||||
<com.simplemobiletools.commons.views.MyEditText
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/export_clips_filename"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -45,6 +45,6 @@
|
|||
android:textCursorDrawable="@null"
|
||||
android:textSize="@dimen/normal_text_size" />
|
||||
|
||||
</com.simplemobiletools.commons.views.MyTextInputLayout>
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
|
50
app/src/main/res/layout/dialog_export_clips_material.xml
Normal file
50
app/src/main/res/layout/dialog_export_clips_material.xml
Normal file
|
@ -0,0 +1,50 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/export_clips_wrapper"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/export_clips_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="@dimen/activity_margin"
|
||||
android:paddingTop="@dimen/activity_margin"
|
||||
android:paddingRight="@dimen/activity_margin">
|
||||
|
||||
<com.simplemobiletools.commons.views.MyTextView
|
||||
android:id="@+id/export_clips_path_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/small_margin"
|
||||
android:text="@string/path"
|
||||
android:textSize="@dimen/smaller_text_size" />
|
||||
|
||||
<com.simplemobiletools.commons.views.MyTextView
|
||||
android:id="@+id/export_clips_path"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/small_margin"
|
||||
android:paddingStart="@dimen/small_margin"
|
||||
android:paddingTop="@dimen/small_margin"
|
||||
android:paddingBottom="@dimen/activity_margin" />
|
||||
|
||||
<com.simplemobiletools.commons.views.MyTextInputLayout
|
||||
android:id="@+id/export_clips_hint"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/filename_without_txt">
|
||||
|
||||
<com.simplemobiletools.commons.views.MyEditText
|
||||
android:id="@+id/export_clips_filename"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/activity_margin"
|
||||
android:singleLine="true"
|
||||
android:textCursorDrawable="@null"
|
||||
android:textSize="@dimen/normal_text_size" />
|
||||
|
||||
</com.simplemobiletools.commons.views.MyTextInputLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
Loading…
Reference in a new issue