applying the new edittext hint to some dialogs

This commit is contained in:
tibbi 2021-03-05 11:04:33 +01:00
parent 53fcc4aabf
commit df7cdc681c
10 changed files with 166 additions and 142 deletions

View file

@ -6,7 +6,7 @@ buildscript {
propMinSdkVersion = 21
propTargetSdkVersion = propCompileSdkVersion
propVersionCode = 1
propVersionName = '5.34.7'
propVersionName = '5.34.8'
kotlin_version = '1.4.31'
}

View file

@ -20,8 +20,7 @@ class RenameItemDialog(val activity: BaseSimpleActivity, val path: String, val c
val extension = fullName.substring(dotAt + 1)
rename_item_extension.setText(extension)
} else {
rename_item_extension_label.beGone()
rename_item_extension.beGone()
rename_item_hint.beGone()
}
rename_item_name.setText(name)
@ -29,59 +28,59 @@ class RenameItemDialog(val activity: BaseSimpleActivity, val path: String, val c
}
AlertDialog.Builder(activity)
.setPositiveButton(R.string.ok, null)
.setNegativeButton(R.string.cancel, null)
.create().apply {
activity.setupDialogStuff(view, this, R.string.rename) {
showKeyboard(view.rename_item_name)
getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
if (ignoreClicks) {
return@setOnClickListener
}
.setPositiveButton(R.string.ok, null)
.setNegativeButton(R.string.cancel, null)
.create().apply {
activity.setupDialogStuff(view, this, R.string.rename) {
showKeyboard(view.rename_item_name)
getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
if (ignoreClicks) {
return@setOnClickListener
}
var newName = view.rename_item_name.value
val newExtension = view.rename_item_extension.value
var newName = view.rename_item_name.value
val newExtension = view.rename_item_extension.value
if (newName.isEmpty()) {
activity.toast(R.string.empty_name)
return@setOnClickListener
}
if (newName.isEmpty()) {
activity.toast(R.string.empty_name)
return@setOnClickListener
}
if (!newName.isAValidFilename()) {
activity.toast(R.string.invalid_name)
return@setOnClickListener
}
if (!newName.isAValidFilename()) {
activity.toast(R.string.invalid_name)
return@setOnClickListener
}
val updatedPaths = ArrayList<String>()
updatedPaths.add(path)
if (!newExtension.isEmpty()) {
newName += ".$newExtension"
}
val updatedPaths = ArrayList<String>()
updatedPaths.add(path)
if (!newExtension.isEmpty()) {
newName += ".$newExtension"
}
if (!activity.getDoesFilePathExist(path)) {
activity.toast(String.format(activity.getString(R.string.source_file_doesnt_exist), path))
return@setOnClickListener
}
if (!activity.getDoesFilePathExist(path)) {
activity.toast(String.format(activity.getString(R.string.source_file_doesnt_exist), path))
return@setOnClickListener
}
val newPath = "${path.getParentPath()}/$newName"
if (activity.getDoesFilePathExist(newPath)) {
activity.toast(R.string.name_taken)
return@setOnClickListener
}
val newPath = "${path.getParentPath()}/$newName"
if (activity.getDoesFilePathExist(newPath)) {
activity.toast(R.string.name_taken)
return@setOnClickListener
}
updatedPaths.add(newPath)
ignoreClicks = true
activity.renameFile(path, newPath) {
ignoreClicks = false
if (it) {
callback(newPath)
dismiss()
} else {
activity.toast(R.string.unknown_error_occurred)
}
updatedPaths.add(newPath)
ignoreClicks = true
activity.renameFile(path, newPath) {
ignoreClicks = false
if (it) {
callback(newPath)
dismiss()
} else {
activity.toast(R.string.unknown_error_occurred)
}
}
}
}
}
}
}

View file

@ -5,16 +5,22 @@
android:layout_height="match_parent"
android:paddingTop="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MyEditText
android:id="@+id/add_blocked_number_edittext"
<com.simplemobiletools.commons.views.MyTextInputLayout
android:id="@+id/add_blocked_number_hint"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/activity_margin"
android:layout_marginTop="@dimen/small_margin"
android:layout_marginEnd="@dimen/activity_margin"
android:hint="@string/number"
android:inputType="phone"
android:textCursorDrawable="@null"
android:textSize="@dimen/bigger_text_size" />
android:layout_marginTop="@dimen/medium_margin"
android:hint="@string/number">
<com.simplemobiletools.commons.views.MyEditText
android:id="@+id/add_blocked_number_edittext"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/activity_margin"
android:layout_marginEnd="@dimen/activity_margin"
android:inputType="phone"
android:textCursorDrawable="@null"
android:textSize="@dimen/bigger_text_size" />
</com.simplemobiletools.commons.views.MyTextInputLayout>
</RelativeLayout>

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/export_settings_wrapper"
android:layout_width="match_parent"
android:layout_height="match_parent">
@ -18,34 +17,33 @@
android:id="@+id/export_settings_path_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/small_margin"
android:text="@string/path"
android:textSize="@dimen/smaller_text_size"/>
android:textSize="@dimen/smaller_text_size" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/export_settings_path"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="@dimen/medium_margin"
android:layout_marginBottom="@dimen/small_margin"
android:paddingStart="@dimen/small_margin"
android:paddingTop="@dimen/small_margin"
android:paddingEnd="@dimen/small_margin"
android:paddingBottom="@dimen/activity_margin"/>
android:paddingBottom="@dimen/activity_margin" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/export_settings_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/filename"
android:textSize="@dimen/smaller_text_size"/>
<com.simplemobiletools.commons.views.MyEditText
android:id="@+id/export_settings_filename"
<com.simplemobiletools.commons.views.MyTextInputLayout
android:id="@+id/export_settings_hint"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/small_margin"
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.MyEditText
android:id="@+id/export_settings_filename"
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" />
</com.simplemobiletools.commons.views.MyTextInputLayout>
</LinearLayout>
</ScrollView>

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<com.simplemobiletools.commons.views.MyScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
<com.simplemobiletools.commons.views.MyScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/dialog_scrollview"
android:layout_width="match_parent"
android:layout_height="wrap_content">
@ -19,13 +18,13 @@
android:id="@+id/dialog_tab_simple"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/simple_renaming"/>
android:text="@string/simple_renaming" />
<com.google.android.material.tabs.TabItem
android:id="@+id/dialog_tab_pattern"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/pattern_renaming"/>
android:text="@string/pattern_renaming" />
</com.google.android.material.tabs.TabLayout>
@ -33,7 +32,7 @@
android:id="@+id/dialog_tab_view_pager"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/dialog_tab_layout"/>
android:layout_below="@+id/dialog_tab_layout" />
</RelativeLayout>
</com.simplemobiletools.commons.views.MyScrollView>

View file

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rename_item_holder"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -10,7 +9,8 @@
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/rename_item_path"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/tiny_margin" />
<com.simplemobiletools.commons.views.MyEditText
android:id="@+id/rename_item_name"
@ -19,21 +19,22 @@
android:layout_marginBottom="@dimen/activity_margin"
android:singleLine="true"
android:textCursorDrawable="@null"
android:textSize="@dimen/normal_text_size"/>
android:textSize="@dimen/normal_text_size" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/rename_item_extension_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/extension"/>
<com.simplemobiletools.commons.views.MyEditText
android:id="@+id/rename_item_extension"
<com.simplemobiletools.commons.views.MyTextInputLayout
android:id="@+id/rename_item_hint"
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:hint="@string/extension">
<com.simplemobiletools.commons.views.MyEditText
android:id="@+id/rename_item_extension"
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" />
</com.simplemobiletools.commons.views.MyTextInputLayout>
</LinearLayout>

View file

@ -1,26 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rename_items_holder"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MyEditText
android:id="@+id/rename_items_value"
<com.simplemobiletools.commons.views.MyTextInputLayout
android:id="@+id/rename_items_hint"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/activity_margin"
android:hint="@string/string_to_add"
android:singleLine="true"
android:textCursorDrawable="@null"
android:textSize="@dimen/normal_text_size"/>
android:hint="@string/string_to_add">
<com.simplemobiletools.commons.views.MyEditText
android:id="@+id/rename_items_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" />
</com.simplemobiletools.commons.views.MyTextInputLayout>
<RadioGroup
android:id="@+id/rename_items_radio_group"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/rename_items_value">
android:layout_below="@+id/rename_items_hint">
<com.simplemobiletools.commons.views.MyCompatRadioButton
android:id="@+id/rename_items_radio_append"
@ -29,7 +34,7 @@
android:checked="true"
android:paddingTop="@dimen/normal_margin"
android:paddingBottom="@dimen/normal_margin"
android:text="@string/append_filenames"/>
android:text="@string/append_filenames" />
<com.simplemobiletools.commons.views.MyCompatRadioButton
android:id="@+id/rename_items_radio_prepend"
@ -37,6 +42,6 @@
android:layout_height="wrap_content"
android:paddingTop="@dimen/normal_margin"
android:paddingBottom="@dimen/normal_margin"
android:text="@string/prepend_filenames"/>
android:text="@string/prepend_filenames" />
</RadioGroup>
</RelativeLayout>

View file

@ -1,30 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/rename_items_holder"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MyEditText
android:id="@+id/rename_items_value"
<com.simplemobiletools.commons.views.MyTextInputLayout
android:id="@+id/rename_items_hint"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/activity_margin"
android:hint="IMG_%Y%M%D_%h%m%s.jpg"
android:singleLine="true"
android:textCursorDrawable="@null"
android:textSize="@dimen/normal_text_size"
tools:ignore="HardcodedText"/>
tools:ignore="HardcodedText">
<com.simplemobiletools.commons.views.MyEditText
android:id="@+id/rename_items_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" />
</com.simplemobiletools.commons.views.MyTextInputLayout>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/rename_items_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/rename_items_value"
android:layout_below="@+id/rename_items_hint"
android:alpha="0.8"
android:text="@string/rename_date_time_pattern"
android:textSize="@dimen/normal_text_size"/>
android:textSize="@dimen/normal_text_size" />
</RelativeLayout>

View file

@ -1,30 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<com.simplemobiletools.commons.views.RenamePatternTab
xmlns:android="http://schemas.android.com/apk/res/android"
<com.simplemobiletools.commons.views.RenamePatternTab xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/rename_items_holder"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MyEditText
android:id="@+id/rename_items_value"
<com.simplemobiletools.commons.views.MyTextInputLayout
android:id="@+id/rename_items_hint"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/activity_margin"
android:hint="IMG_%Y%M%D_%h%m%s.jpg"
android:singleLine="true"
android:textCursorDrawable="@null"
android:textSize="@dimen/normal_text_size"
tools:ignore="HardcodedText"/>
tools:ignore="HardcodedText">
<com.simplemobiletools.commons.views.MyEditText
android:id="@+id/rename_items_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" />
</com.simplemobiletools.commons.views.MyTextInputLayout>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/rename_items_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/rename_items_value"
android:layout_below="@+id/rename_items_hint"
android:alpha="0.8"
android:text="@string/rename_date_time_pattern"
android:textSize="@dimen/normal_text_size"/>
android:textSize="@dimen/normal_text_size" />
</com.simplemobiletools.commons.views.RenamePatternTab>

View file

@ -1,26 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<com.simplemobiletools.commons.views.RenameSimpleTab
xmlns:android="http://schemas.android.com/apk/res/android"
<com.simplemobiletools.commons.views.RenameSimpleTab xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rename_simple_holder"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MyEditText
android:id="@+id/rename_simple_value"
<com.simplemobiletools.commons.views.MyTextInputLayout
android:id="@+id/rename_simple_hint"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/activity_margin"
android:hint="@string/string_to_add"
android:singleLine="true"
android:textCursorDrawable="@null"
android:textSize="@dimen/normal_text_size"/>
android:hint="@string/string_to_add">
<com.simplemobiletools.commons.views.MyEditText
android:id="@+id/rename_simple_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" />
</com.simplemobiletools.commons.views.MyTextInputLayout>
<RadioGroup
android:id="@+id/rename_simple_radio_group"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/rename_simple_value">
android:layout_below="@+id/rename_simple_hint">
<com.simplemobiletools.commons.views.MyCompatRadioButton
android:id="@+id/rename_simple_radio_append"
@ -29,7 +34,7 @@
android:checked="true"
android:paddingTop="@dimen/normal_margin"
android:paddingBottom="@dimen/normal_margin"
android:text="@string/append_filenames"/>
android:text="@string/append_filenames" />
<com.simplemobiletools.commons.views.MyCompatRadioButton
android:id="@+id/rename_simple_radio_prepend"
@ -37,6 +42,6 @@
android:layout_height="wrap_content"
android:paddingTop="@dimen/normal_margin"
android:paddingBottom="@dimen/normal_margin"
android:text="@string/prepend_filenames"/>
android:text="@string/prepend_filenames" />
</RadioGroup>
</com.simplemobiletools.commons.views.RenameSimpleTab>