Skip to content

Commit 9dafec1

Browse files
committed
materialize the Export clips dialog too
1 parent a9b409a commit 9dafec1

File tree

3 files changed

+64
-6
lines changed

3 files changed

+64
-6
lines changed

app/src/main/kotlin/com/simplemobiletools/keyboard/dialogs/ExportClipsDialog.kt

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.simplemobiletools.keyboard.dialogs
22

33
import androidx.appcompat.app.AlertDialog
4+
import androidx.appcompat.widget.AppCompatEditText
45
import com.simplemobiletools.commons.activities.BaseSimpleActivity
56
import com.simplemobiletools.commons.dialogs.ConfirmationDialog
67
import com.simplemobiletools.commons.dialogs.FilePickerDialog
@@ -20,8 +21,14 @@ class ExportClipsDialog(
2021
activity.internalStoragePath
2122
}
2223

23-
val view = activity.layoutInflater.inflate(R.layout.dialog_export_clips, null).apply {
24-
export_clips_filename.setText("${activity.getString(R.string.app_launcher_name)}_${activity.getCurrentFormattedDateTime()}")
24+
val layoutId = if (activity.baseConfig.isUsingSystemTheme) {
25+
R.layout.dialog_export_clips_material
26+
} else {
27+
R.layout.dialog_export_clips
28+
}
29+
30+
val view = activity.layoutInflater.inflate(layoutId, null).apply {
31+
findViewById<AppCompatEditText>(R.id.export_clips_filename).setText("${activity.getString(R.string.app_launcher_name)}_${activity.getCurrentFormattedDateTime()}")
2532

2633
if (hidePath) {
2734
export_clips_path_label.beGone()
@@ -42,8 +49,9 @@ class ExportClipsDialog(
4249
.setNegativeButton(R.string.cancel, null)
4350
.apply {
4451
activity.setupDialogStuff(view, this, R.string.export_clipboard_items) { alertDialog ->
52+
alertDialog.showKeyboard(view.findViewById(R.id.export_clips_filename))
4553
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
46-
val filename = view.export_clips_filename.value
54+
val filename = view.findViewById<AppCompatEditText>(R.id.export_clips_filename).value
4755
if (filename.isEmpty()) {
4856
activity.toast(R.string.filename_cannot_be_empty)
4957
return@setOnClickListener

app/src/main/res/layout/dialog_export_clips.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@
3030
android:paddingTop="@dimen/small_margin"
3131
android:paddingBottom="@dimen/activity_margin" />
3232

33-
<com.simplemobiletools.commons.views.MyTextInputLayout
33+
<com.google.android.material.textfield.TextInputLayout
3434
android:id="@+id/export_clips_hint"
3535
android:layout_width="match_parent"
3636
android:layout_height="wrap_content"
3737
android:hint="@string/filename_without_txt">
3838

39-
<com.simplemobiletools.commons.views.MyEditText
39+
<com.google.android.material.textfield.TextInputEditText
4040
android:id="@+id/export_clips_filename"
4141
android:layout_width="match_parent"
4242
android:layout_height="wrap_content"
@@ -45,6 +45,6 @@
4545
android:textCursorDrawable="@null"
4646
android:textSize="@dimen/normal_text_size" />
4747

48-
</com.simplemobiletools.commons.views.MyTextInputLayout>
48+
</com.google.android.material.textfield.TextInputLayout>
4949
</LinearLayout>
5050
</ScrollView>
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:id="@+id/export_clips_wrapper"
4+
android:layout_width="match_parent"
5+
android:layout_height="match_parent">
6+
7+
<LinearLayout
8+
android:id="@+id/export_clips_holder"
9+
android:layout_width="match_parent"
10+
android:layout_height="wrap_content"
11+
android:orientation="vertical"
12+
android:paddingLeft="@dimen/activity_margin"
13+
android:paddingTop="@dimen/activity_margin"
14+
android:paddingRight="@dimen/activity_margin">
15+
16+
<com.simplemobiletools.commons.views.MyTextView
17+
android:id="@+id/export_clips_path_label"
18+
android:layout_width="wrap_content"
19+
android:layout_height="wrap_content"
20+
android:layout_marginStart="@dimen/small_margin"
21+
android:text="@string/path"
22+
android:textSize="@dimen/smaller_text_size" />
23+
24+
<com.simplemobiletools.commons.views.MyTextView
25+
android:id="@+id/export_clips_path"
26+
android:layout_width="match_parent"
27+
android:layout_height="wrap_content"
28+
android:layout_marginBottom="@dimen/small_margin"
29+
android:paddingStart="@dimen/small_margin"
30+
android:paddingTop="@dimen/small_margin"
31+
android:paddingBottom="@dimen/activity_margin" />
32+
33+
<com.simplemobiletools.commons.views.MyTextInputLayout
34+
android:id="@+id/export_clips_hint"
35+
android:layout_width="match_parent"
36+
android:layout_height="wrap_content"
37+
android:hint="@string/filename_without_txt">
38+
39+
<com.simplemobiletools.commons.views.MyEditText
40+
android:id="@+id/export_clips_filename"
41+
android:layout_width="match_parent"
42+
android:layout_height="wrap_content"
43+
android:layout_marginBottom="@dimen/activity_margin"
44+
android:singleLine="true"
45+
android:textCursorDrawable="@null"
46+
android:textSize="@dimen/normal_text_size" />
47+
48+
</com.simplemobiletools.commons.views.MyTextInputLayout>
49+
</LinearLayout>
50+
</ScrollView>

0 commit comments

Comments
 (0)