redesigning the resizing dialogs
This commit is contained in:
parent
84dd596c58
commit
e0b2a34372
|
@ -11,8 +11,8 @@ import kotlinx.android.synthetic.main.dialog_resize_image.view.*
|
|||
class ResizeDialog(val activity: BaseSimpleActivity, val size: Point, val callback: (newSize: Point) -> Unit) {
|
||||
init {
|
||||
val view = activity.layoutInflater.inflate(R.layout.dialog_resize_image, null)
|
||||
val widthView = view.image_width
|
||||
val heightView = view.image_height
|
||||
val widthView = view.resize_image_width
|
||||
val heightView = view.resize_image_height
|
||||
|
||||
widthView.setText(size.x.toString())
|
||||
heightView.setText(size.y.toString())
|
||||
|
@ -52,7 +52,7 @@ class ResizeDialog(val activity: BaseSimpleActivity, val size: Point, val callba
|
|||
.setNegativeButton(R.string.cancel, null)
|
||||
.apply {
|
||||
activity.setupDialogStuff(view, this, R.string.resize_and_save) { alertDialog ->
|
||||
alertDialog.showKeyboard(view.image_width)
|
||||
alertDialog.showKeyboard(view.resize_image_width)
|
||||
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
|
||||
val width = getViewValue(widthView)
|
||||
val height = getViewValue(heightView)
|
||||
|
|
|
@ -15,7 +15,7 @@ class ResizeWithPathDialog(val activity: BaseSimpleActivity, val size: Point, va
|
|||
init {
|
||||
var realPath = path.getParentPath()
|
||||
val view = activity.layoutInflater.inflate(R.layout.dialog_resize_image_with_path, null).apply {
|
||||
image_path.text = "${activity.humanizePath(realPath).trimEnd('/')}/"
|
||||
folder.setText("${activity.humanizePath(realPath).trimEnd('/')}/")
|
||||
|
||||
val fullName = path.getFilenameFromPath()
|
||||
val dotAt = fullName.lastIndexOf(".")
|
||||
|
@ -24,20 +24,20 @@ class ResizeWithPathDialog(val activity: BaseSimpleActivity, val size: Point, va
|
|||
if (dotAt > 0) {
|
||||
name = fullName.substring(0, dotAt)
|
||||
val extension = fullName.substring(dotAt + 1)
|
||||
image_extension.setText(extension)
|
||||
extension_value.setText(extension)
|
||||
}
|
||||
|
||||
image_name.setText(name)
|
||||
image_path.setOnClickListener {
|
||||
filename_value.setText(name)
|
||||
folder.setOnClickListener {
|
||||
FilePickerDialog(activity, realPath, false, activity.config.shouldShowHidden, true, true) {
|
||||
image_path.text = activity.humanizePath(it)
|
||||
folder.setText(activity.humanizePath(it))
|
||||
realPath = it
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val widthView = view.image_width
|
||||
val heightView = view.image_height
|
||||
val widthView = view.resize_image_width
|
||||
val heightView = view.resize_image_height
|
||||
|
||||
widthView.setText(size.x.toString())
|
||||
heightView.setText(size.y.toString())
|
||||
|
@ -73,7 +73,7 @@ class ResizeWithPathDialog(val activity: BaseSimpleActivity, val size: Point, va
|
|||
.setNegativeButton(R.string.cancel, null)
|
||||
.apply {
|
||||
activity.setupDialogStuff(view, this) { alertDialog ->
|
||||
alertDialog.showKeyboard(view.image_width)
|
||||
alertDialog.showKeyboard(view.resize_image_width)
|
||||
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
|
||||
val width = getViewValue(widthView)
|
||||
val height = getViewValue(heightView)
|
||||
|
@ -84,8 +84,8 @@ class ResizeWithPathDialog(val activity: BaseSimpleActivity, val size: Point, va
|
|||
|
||||
val newSize = Point(getViewValue(widthView), getViewValue(heightView))
|
||||
|
||||
val filename = view.image_name.value
|
||||
val extension = view.image_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)
|
||||
return@setOnClickListener
|
||||
|
|
|
@ -8,52 +8,64 @@
|
|||
android:paddingTop="@dimen/activity_margin"
|
||||
android:paddingRight="@dimen/activity_margin">
|
||||
|
||||
<com.simplemobiletools.commons.views.MyTextView
|
||||
android:id="@+id/image_width_label"
|
||||
<com.simplemobiletools.commons.views.MyTextInputLayout
|
||||
android:id="@+id/resize_image_width_hint"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="@dimen/tiny_margin"
|
||||
android:text="@string/width" />
|
||||
|
||||
<com.simplemobiletools.commons.views.MyEditText
|
||||
android:id="@+id/image_width"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/image_width_label"
|
||||
android:layout_marginBottom="@dimen/activity_margin"
|
||||
android:inputType="number"
|
||||
android:maxLength="6"
|
||||
android:maxLines="1"
|
||||
android:textCursorDrawable="@null"
|
||||
android:textSize="@dimen/normal_text_size" />
|
||||
android:hint="@string/width">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/resize_image_width"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="number"
|
||||
android:maxLength="6"
|
||||
android:maxLines="1"
|
||||
android:textCursorDrawable="@null"
|
||||
android:textSize="@dimen/bigger_text_size" />
|
||||
|
||||
</com.simplemobiletools.commons.views.MyTextInputLayout>
|
||||
|
||||
<com.simplemobiletools.commons.views.MyTextView
|
||||
android:id="@+id/image_height_label"
|
||||
android:id="@+id/resize_image_colon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="50dp"
|
||||
android:layout_toEndOf="@+id/image_width_label"
|
||||
android:paddingStart="@dimen/tiny_margin"
|
||||
android:text="@string/height" />
|
||||
android:layout_alignTop="@+id/resize_image_width_hint"
|
||||
android:layout_alignBottom="@+id/resize_image_width_hint"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:layout_toEndOf="@+id/resize_image_width_hint"
|
||||
android:gravity="center"
|
||||
android:text=":"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<com.simplemobiletools.commons.views.MyEditText
|
||||
android:id="@+id/image_height"
|
||||
<com.simplemobiletools.commons.views.MyTextInputLayout
|
||||
android:id="@+id/resize_image_height_hint"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/image_width_label"
|
||||
android:layout_alignStart="@+id/image_height_label"
|
||||
android:inputType="number"
|
||||
android:maxLength="6"
|
||||
android:maxLines="1"
|
||||
android:textCursorDrawable="@null"
|
||||
android:textSize="@dimen/normal_text_size" />
|
||||
android:layout_alignTop="@+id/resize_image_width_hint"
|
||||
android:layout_alignBottom="@+id/resize_image_width_hint"
|
||||
android:layout_toEndOf="@+id/resize_image_colon"
|
||||
android:hint="@string/height">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/resize_image_height"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="number"
|
||||
android:maxLength="6"
|
||||
android:maxLines="1"
|
||||
android:textCursorDrawable="@null"
|
||||
android:textSize="@dimen/bigger_text_size" />
|
||||
|
||||
</com.simplemobiletools.commons.views.MyTextInputLayout>
|
||||
|
||||
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
|
||||
android:id="@+id/keep_aspect_ratio"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/image_height"
|
||||
android:layout_marginTop="@dimen/activity_margin"
|
||||
android:layout_below="@+id/resize_image_width_hint"
|
||||
android:checked="true"
|
||||
android:paddingTop="@dimen/activity_margin"
|
||||
android:paddingBottom="@dimen/activity_margin"
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/resize_image_with_path_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
@ -9,96 +8,109 @@
|
|||
android:paddingTop="@dimen/activity_margin"
|
||||
android:paddingRight="@dimen/activity_margin">
|
||||
|
||||
<com.simplemobiletools.commons.views.MyTextView
|
||||
android:id="@+id/image_width_label"
|
||||
<com.simplemobiletools.commons.views.MyTextInputLayout
|
||||
android:id="@+id/resize_image_width_hint"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="@dimen/tiny_margin"
|
||||
android:text="@string/width"
|
||||
android:textSize="@dimen/normal_text_size" />
|
||||
android:layout_marginBottom="@dimen/activity_margin"
|
||||
android:hint="@string/width">
|
||||
|
||||
<com.simplemobiletools.commons.views.MyEditText
|
||||
android:id="@+id/image_width"
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/resize_image_width"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="number"
|
||||
android:maxLength="6"
|
||||
android:maxLines="1"
|
||||
android:textCursorDrawable="@null"
|
||||
android:textSize="@dimen/bigger_text_size" />
|
||||
|
||||
</com.simplemobiletools.commons.views.MyTextInputLayout>
|
||||
|
||||
<com.simplemobiletools.commons.views.MyTextView
|
||||
android:id="@+id/resize_image_colon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/resize_image_width_hint"
|
||||
android:layout_alignBottom="@+id/resize_image_width_hint"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:layout_toEndOf="@+id/resize_image_width_hint"
|
||||
android:gravity="center"
|
||||
android:text=":"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<com.simplemobiletools.commons.views.MyTextInputLayout
|
||||
android:id="@+id/resize_image_height_hint"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/image_width_label"
|
||||
android:inputType="number"
|
||||
android:maxLength="6"
|
||||
android:maxLines="1"
|
||||
android:textCursorDrawable="@null"
|
||||
android:textSize="@dimen/normal_text_size" />
|
||||
android:layout_alignTop="@+id/resize_image_width_hint"
|
||||
android:layout_alignBottom="@+id/resize_image_width_hint"
|
||||
android:layout_toEndOf="@+id/resize_image_colon"
|
||||
android:hint="@string/height">
|
||||
|
||||
<com.simplemobiletools.commons.views.MyTextView
|
||||
android:id="@+id/image_height_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="50dp"
|
||||
android:layout_toEndOf="@+id/image_width_label"
|
||||
android:paddingStart="@dimen/tiny_margin"
|
||||
android:text="@string/height"
|
||||
android:textSize="@dimen/normal_text_size" />
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/resize_image_height"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="number"
|
||||
android:maxLength="6"
|
||||
android:maxLines="1"
|
||||
android:textCursorDrawable="@null"
|
||||
android:textSize="@dimen/bigger_text_size" />
|
||||
|
||||
<com.simplemobiletools.commons.views.MyEditText
|
||||
android:id="@+id/image_height"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/image_width_label"
|
||||
android:layout_alignStart="@+id/image_height_label"
|
||||
android:inputType="number"
|
||||
android:maxLength="6"
|
||||
android:maxLines="1"
|
||||
android:textCursorDrawable="@null"
|
||||
android:textSize="@dimen/normal_text_size" />
|
||||
</com.simplemobiletools.commons.views.MyTextInputLayout>
|
||||
|
||||
<com.simplemobiletools.commons.views.MyTextView
|
||||
android:id="@+id/image_path_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/image_height"
|
||||
android:layout_marginStart="@dimen/tiny_margin"
|
||||
android:layout_marginTop="@dimen/activity_margin"
|
||||
android:text="@string/path"
|
||||
android:textSize="@dimen/normal_text_size" />
|
||||
|
||||
<com.simplemobiletools.commons.views.MyTextView
|
||||
android:id="@+id/image_path"
|
||||
<com.simplemobiletools.commons.views.MyTextInputLayout
|
||||
android:id="@+id/folder_hint"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/image_path_label"
|
||||
android:layout_marginStart="@dimen/tiny_margin"
|
||||
android:layout_below="@+id/resize_image_width_hint"
|
||||
android:layout_marginBottom="@dimen/activity_margin"
|
||||
android:paddingTop="@dimen/small_margin"
|
||||
android:paddingEnd="@dimen/small_margin"
|
||||
android:textSize="@dimen/normal_text_size"
|
||||
tools:text="@string/internal" />
|
||||
android:hint="@string/folder">
|
||||
|
||||
<com.simplemobiletools.commons.views.MyEditText
|
||||
android:id="@+id/image_name"
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/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/filename_hint"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/image_path"
|
||||
android:layout_below="@+id/folder_hint"
|
||||
android:layout_marginBottom="@dimen/activity_margin"
|
||||
android:singleLine="true"
|
||||
android:textCursorDrawable="@null"
|
||||
android:textSize="@dimen/normal_text_size" />
|
||||
android:hint="@string/filename">
|
||||
|
||||
<com.simplemobiletools.commons.views.MyTextView
|
||||
android:id="@+id/image_extension_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/image_name"
|
||||
android:layout_marginStart="@dimen/tiny_margin"
|
||||
android:text="@string/extension"
|
||||
android:textSize="@dimen/normal_text_size" />
|
||||
<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/bigger_text_size" />
|
||||
|
||||
<com.simplemobiletools.commons.views.MyEditText
|
||||
android:id="@+id/image_extension"
|
||||
</com.simplemobiletools.commons.views.MyTextInputLayout>
|
||||
|
||||
<com.simplemobiletools.commons.views.MyTextInputLayout
|
||||
android:id="@+id/extension_hint"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/image_extension_label"
|
||||
android:layout_marginBottom="@dimen/activity_margin"
|
||||
android:singleLine="true"
|
||||
android:textCursorDrawable="@null"
|
||||
android:textSize="@dimen/normal_text_size" />
|
||||
android:layout_below="@+id/filename_hint"
|
||||
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:singleLine="true"
|
||||
android:textCursorDrawable="@null"
|
||||
android:textSize="@dimen/bigger_text_size" />
|
||||
|
||||
</com.simplemobiletools.commons.views.MyTextInputLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
|
Loading…
Reference in New Issue