validate the inserted resolution
This commit is contained in:
parent
7147ed3b7b
commit
d53000b667
10 changed files with 18 additions and 0 deletions
|
@ -7,6 +7,7 @@ import android.text.TextWatcher
|
|||
import android.view.LayoutInflater
|
||||
import android.view.WindowManager
|
||||
import android.widget.EditText
|
||||
import com.simplemobiletools.filepicker.extensions.toast
|
||||
import com.simplemobiletools.filepicker.extensions.value
|
||||
import com.simplemobiletools.gallery.R
|
||||
import com.simplemobiletools.gallery.activities.SimpleActivity
|
||||
|
@ -77,8 +78,16 @@ class ResizeDialog(val activity: SimpleActivity, val size: Point, val callback:
|
|||
setCanceledOnTouchOutside(true)
|
||||
show()
|
||||
getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener({
|
||||
val width = getViewValue(widthView)
|
||||
val height = getViewValue(heightView)
|
||||
if (width <= 0 || height <= 0) {
|
||||
activity.toast(R.string.invalid_values)
|
||||
return@setOnClickListener
|
||||
}
|
||||
|
||||
val newSize = Point(getViewValue(widthView), getViewValue(heightView))
|
||||
callback.invoke(newSize)
|
||||
dismiss()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,6 +66,7 @@
|
|||
<string name="width">Width</string>
|
||||
<string name="height">Height</string>
|
||||
<string name="keep_aspect_ratio">Keep aspect ratio</string>
|
||||
<string name="invalid_values">Please enter a valid resolution</string>
|
||||
|
||||
<!-- Renaming -->
|
||||
<string name="rename_file">Datei umbenennen</string>
|
||||
|
|
|
@ -66,6 +66,7 @@
|
|||
<string name="width">Width</string>
|
||||
<string name="height">Height</string>
|
||||
<string name="keep_aspect_ratio">Keep aspect ratio</string>
|
||||
<string name="invalid_values">Please enter a valid resolution</string>
|
||||
|
||||
<!-- Renaming -->
|
||||
<string name="rename_file">Renombrar archivo</string>
|
||||
|
|
|
@ -66,6 +66,7 @@
|
|||
<string name="width">Width</string>
|
||||
<string name="height">Height</string>
|
||||
<string name="keep_aspect_ratio">Keep aspect ratio</string>
|
||||
<string name="invalid_values">Please enter a valid resolution</string>
|
||||
|
||||
<!-- Renaming -->
|
||||
<string name="rename_file">Rinomina file</string>
|
||||
|
|
|
@ -66,6 +66,7 @@
|
|||
<string name="width">Width</string>
|
||||
<string name="height">Height</string>
|
||||
<string name="keep_aspect_ratio">Keep aspect ratio</string>
|
||||
<string name="invalid_values">Please enter a valid resolution</string>
|
||||
|
||||
<!-- Renaming -->
|
||||
<string name="rename_file">ファイルの名前を変更</string>
|
||||
|
|
|
@ -66,6 +66,7 @@
|
|||
<string name="width">Width</string>
|
||||
<string name="height">Height</string>
|
||||
<string name="keep_aspect_ratio">Keep aspect ratio</string>
|
||||
<string name="invalid_values">Please enter a valid resolution</string>
|
||||
|
||||
<!-- Renaming -->
|
||||
<string name="rename_file">Renomear ficheiro</string>
|
||||
|
|
|
@ -67,6 +67,7 @@
|
|||
<string name="width">Ширина</string>
|
||||
<string name="height">Высота</string>
|
||||
<string name="keep_aspect_ratio">Сохранить соотношение сторон</string>
|
||||
<string name="invalid_values">Please enter a valid resolution</string>
|
||||
|
||||
<!-- Renaming -->
|
||||
<string name="rename_file">Изменение имени файла</string>
|
||||
|
|
|
@ -66,6 +66,7 @@
|
|||
<string name="width">Width</string>
|
||||
<string name="height">Height</string>
|
||||
<string name="keep_aspect_ratio">Keep aspect ratio</string>
|
||||
<string name="invalid_values">Please enter a valid resolution</string>
|
||||
|
||||
<!-- Renaming -->
|
||||
<string name="rename_file">Döp om fil</string>
|
||||
|
|
|
@ -67,6 +67,7 @@
|
|||
<string name="width">Width</string>
|
||||
<string name="height">Height</string>
|
||||
<string name="keep_aspect_ratio">Keep aspect ratio</string>
|
||||
<string name="invalid_values">Please enter a valid resolution</string>
|
||||
|
||||
<!-- Renaming -->
|
||||
<string name="rename_file">重命名文件</string>
|
||||
|
|
|
@ -66,6 +66,7 @@
|
|||
<string name="width">Width</string>
|
||||
<string name="height">Height</string>
|
||||
<string name="keep_aspect_ratio">Keep aspect ratio</string>
|
||||
<string name="invalid_values">Please enter a valid resolution</string>
|
||||
|
||||
<!-- Renaming -->
|
||||
<string name="rename_file">Rename file</string>
|
||||
|
|
Loading…
Reference in a new issue