use the new design for Save As dialog

This commit is contained in:
tibbi 2023-01-15 11:25:09 +01:00
parent 4baca371f0
commit e37bb095db
3 changed files with 46 additions and 38 deletions

View File

@ -64,7 +64,7 @@ android {
} }
dependencies { dependencies {
implementation 'com.github.SimpleMobileTools:Simple-Commons:449b24c6a4' implementation 'com.github.SimpleMobileTools:Simple-Commons:3aade6f350'
implementation 'com.github.tibbi:PdfViewPager:d2af24208d' implementation 'com.github.tibbi:PdfViewPager:d2af24208d'
implementation 'com.github.Stericson:RootTools:df729dcb13' implementation 'com.github.Stericson:RootTools:df729dcb13'
implementation 'com.github.Stericson:RootShell:1.6' implementation 'com.github.Stericson:RootShell:1.6'

View File

@ -20,7 +20,7 @@ class SaveAsDialog(
var realPath = path.getParentPath() var realPath = path.getParentPath()
val view = activity.layoutInflater.inflate(R.layout.dialog_save_as, null).apply { val view = activity.layoutInflater.inflate(R.layout.dialog_save_as, null).apply {
save_as_path.text = activity.humanizePath(realPath) folder_value.setText(activity.humanizePath(realPath))
val fullName = path.getFilenameFromPath() val fullName = path.getFilenameFromPath()
val dotAt = fullName.lastIndexOf(".") val dotAt = fullName.lastIndexOf(".")
@ -29,18 +29,17 @@ class SaveAsDialog(
if (dotAt > 0) { if (dotAt > 0) {
name = fullName.substring(0, dotAt) name = fullName.substring(0, dotAt)
val extension = fullName.substring(dotAt + 1) val extension = fullName.substring(dotAt + 1)
save_as_extension.setText(extension) extension_value.setText(extension)
} }
save_as_name.setText(name) filename_value.setText(name)
if (hidePath) { if (hidePath) {
save_as_path_label.beGone() folder_hint.beGone()
save_as_path.beGone()
} else { } else {
save_as_path.setOnClickListener { folder_value.setOnClickListener {
FilePickerDialog(activity, realPath, false, false, true, true, showFavoritesButton = true) { FilePickerDialog(activity, realPath, false, false, true, true, showFavoritesButton = true) {
save_as_path.text = activity.humanizePath(it) folder_value.setText(activity.humanizePath(it))
realPath = it realPath = it
} }
} }
@ -52,10 +51,10 @@ class SaveAsDialog(
.setNegativeButton(R.string.cancel, null) .setNegativeButton(R.string.cancel, null)
.apply { .apply {
activity.setupDialogStuff(view, this, R.string.save_as) { alertDialog -> activity.setupDialogStuff(view, this, R.string.save_as) { alertDialog ->
alertDialog.showKeyboard(view.save_as_name) alertDialog.showKeyboard(view.filename_value)
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener { alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
val filename = view.save_as_name.value val filename = view.filename_value.value
val extension = view.save_as_extension.value val extension = view.extension_value.value
if (filename.isEmpty()) { if (filename.isEmpty()) {
activity.toast(R.string.filename_cannot_be_empty) activity.toast(R.string.filename_cannot_be_empty)

View File

@ -6,43 +6,52 @@
android:orientation="vertical" android:orientation="vertical"
android:padding="@dimen/activity_margin"> android:padding="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextInputLayout
android:id="@+id/save_as_path_label" android:id="@+id/folder_hint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/path"
android:textSize="@dimen/smaller_text_size" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/save_as_path"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/activity_margin" android:layout_marginBottom="@dimen/activity_margin"
android:paddingTop="@dimen/small_margin" android:hint="@string/path">
android:paddingEnd="@dimen/small_margin" />
<com.simplemobiletools.commons.views.MyEditText <com.google.android.material.textfield.TextInputEditText
android:id="@+id/save_as_name" android:id="@+id/folder_value"
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/filename_hint"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/activity_margin" android:layout_marginBottom="@dimen/activity_margin"
android:singleLine="true" android:hint="@string/filename">
android:textCursorDrawable="@null"
android:textSize="@dimen/normal_text_size" />
<com.simplemobiletools.commons.views.MyTextView <com.google.android.material.textfield.TextInputEditText
android:id="@+id/save_as_extension_label" android:id="@+id/filename_value"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/extension" /> android:inputType="textCapSentences"
android:singleLine="true"
android:textCursorDrawable="@null"
android:textSize="@dimen/bigger_text_size" />
<com.simplemobiletools.commons.views.MyEditText </com.simplemobiletools.commons.views.MyTextInputLayout>
android:id="@+id/save_as_extension"
<com.simplemobiletools.commons.views.MyTextInputLayout
android:id="@+id/extension_hint"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/activity_margin" android:hint="@string/extension">
android:singleLine="true"
android:textCursorDrawable="@null"
android:textSize="@dimen/normal_text_size" />
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/extension_value"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:textCursorDrawable="@null"
android:textSize="@dimen/bigger_text_size" />
</com.simplemobiletools.commons.views.MyTextInputLayout>
</LinearLayout> </LinearLayout>