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 {
implementation 'com.github.SimpleMobileTools:Simple-Commons:449b24c6a4'
implementation 'com.github.SimpleMobileTools:Simple-Commons:3aade6f350'
implementation 'com.github.tibbi:PdfViewPager:d2af24208d'
implementation 'com.github.Stericson:RootTools:df729dcb13'
implementation 'com.github.Stericson:RootShell:1.6'

View File

@ -20,7 +20,7 @@ class SaveAsDialog(
var realPath = path.getParentPath()
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 dotAt = fullName.lastIndexOf(".")
@ -29,18 +29,17 @@ class SaveAsDialog(
if (dotAt > 0) {
name = fullName.substring(0, dotAt)
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) {
save_as_path_label.beGone()
save_as_path.beGone()
folder_hint.beGone()
} else {
save_as_path.setOnClickListener {
folder_value.setOnClickListener {
FilePickerDialog(activity, realPath, false, false, true, true, showFavoritesButton = true) {
save_as_path.text = activity.humanizePath(it)
folder_value.setText(activity.humanizePath(it))
realPath = it
}
}
@ -52,10 +51,10 @@ class SaveAsDialog(
.setNegativeButton(R.string.cancel, null)
.apply {
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 {
val filename = view.save_as_name.value
val extension = view.save_as_extension.value
val filename = view.filename_value.value
val extension = view.extension_value.value
if (filename.isEmpty()) {
activity.toast(R.string.filename_cannot_be_empty)

View File

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