updating the dialog colors

This commit is contained in:
tibbi 2016-12-19 23:47:18 +01:00
parent d0276c01de
commit 0efab3ef60
11 changed files with 66 additions and 67 deletions

View file

@ -3,6 +3,7 @@ package com.simplemobiletools.gallery.activities
import android.os.Bundle import android.os.Bundle
import android.view.View import android.view.View
import android.widget.AdapterView import android.widget.AdapterView
import com.simplemobiletools.commons.extensions.updateTextColors
import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.R
import kotlinx.android.synthetic.main.activity_settings.* import kotlinx.android.synthetic.main.activity_settings.*

View file

@ -1,35 +1,34 @@
package com.simplemobiletools.gallery.dialogs package com.simplemobiletools.gallery.dialogs
import android.app.Activity
import android.app.AlertDialog
import android.content.DialogInterface import android.content.DialogInterface
import android.support.v7.app.AlertDialog
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.ViewGroup
import com.simplemobiletools.commons.extensions.setupDialogStuff
import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.R
import com.simplemobiletools.gallery.activities.SimpleActivity
import com.simplemobiletools.gallery.helpers.* import com.simplemobiletools.gallery.helpers.*
import kotlinx.android.synthetic.main.dialog_change_sorting.view.* import kotlinx.android.synthetic.main.dialog_change_sorting.view.*
class ChangeSortingDialog(val activity: Activity, val isDirectorySorting: Boolean, val callback: () -> Unit) : DialogInterface.OnClickListener { class ChangeSortingDialog(val activity: SimpleActivity, val isDirectorySorting: Boolean, val callback: () -> Unit) : DialogInterface.OnClickListener {
companion object { companion object {
private var currSorting = 0 private var currSorting = 0
lateinit var config: Config lateinit var config: Config
lateinit var view: View lateinit var view: ViewGroup
} }
init { init {
config = Config.newInstance(activity) config = Config.newInstance(activity)
view = LayoutInflater.from(activity).inflate(R.layout.dialog_change_sorting, null) view = LayoutInflater.from(activity).inflate(R.layout.dialog_change_sorting, null) as ViewGroup
val dialog = AlertDialog.Builder(activity) AlertDialog.Builder(activity)
.setTitle(R.string.sort_by)
.setView(view) .setView(view)
.setPositiveButton(R.string.ok, this) .setPositiveButton(R.string.ok, this)
.setNegativeButton(R.string.cancel, null) .setNegativeButton(R.string.cancel, null)
.create() .create().apply {
activity.setupDialogStuff(view, this, R.string.sort_by)
dialog.setCanceledOnTouchOutside(true) }
dialog.show()
currSorting = if (isDirectorySorting) config.directorySorting else config.sorting currSorting = if (isDirectorySorting) config.directorySorting else config.sorting
setupSortRadio() setupSortRadio()

View file

@ -1,9 +1,10 @@
package com.simplemobiletools.gallery.dialogs package com.simplemobiletools.gallery.dialogs
import android.app.AlertDialog
import android.support.v4.util.Pair import android.support.v4.util.Pair
import android.support.v7.app.AlertDialog
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.WindowManager import android.view.ViewGroup
import com.simplemobiletools.commons.extensions.setupDialogStuff
import com.simplemobiletools.filepicker.asynctasks.CopyMoveTask import com.simplemobiletools.filepicker.asynctasks.CopyMoveTask
import com.simplemobiletools.filepicker.extensions.humanizePath import com.simplemobiletools.filepicker.extensions.humanizePath
import com.simplemobiletools.filepicker.extensions.isPathOnSD import com.simplemobiletools.filepicker.extensions.isPathOnSD
@ -17,9 +18,12 @@ import java.io.File
import java.util.* import java.util.*
class CopyDialog(val activity: SimpleActivity, val files: ArrayList<File>, val copyMoveListener: CopyMoveTask.CopyMoveListener) { class CopyDialog(val activity: SimpleActivity, val files: ArrayList<File>, val copyMoveListener: CopyMoveTask.CopyMoveListener) {
companion object {
lateinit var view: ViewGroup
}
init { init {
val view = LayoutInflater.from(activity).inflate(R.layout.dialog_copy_move, null) view = LayoutInflater.from(activity).inflate(R.layout.dialog_copy_move, null) as ViewGroup
val sourcePath = files[0].parent.trimEnd('/') val sourcePath = files[0].parent.trimEnd('/')
var destinationPath = "" var destinationPath = ""
@ -33,14 +37,11 @@ class CopyDialog(val activity: SimpleActivity, val files: ArrayList<File>, val c
} }
AlertDialog.Builder(activity) AlertDialog.Builder(activity)
.setTitle(R.string.copy_move)
.setView(view) .setView(view)
.setPositiveButton(R.string.ok, null) .setPositiveButton(R.string.ok, null)
.setNegativeButton(R.string.cancel, null) .setNegativeButton(R.string.cancel, null)
.create().apply { .create().apply {
window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) activity.setupDialogStuff(view, this, R.string.copy_move)
setCanceledOnTouchOutside(true)
show()
getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener({ getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener({
if (destinationPath == context.resources.getString(R.string.select_destination) || destinationPath.isEmpty()) { if (destinationPath == context.resources.getString(R.string.select_destination) || destinationPath.isEmpty()) {
context.toast(R.string.please_select_destination) context.toast(R.string.please_select_destination)

View file

@ -1,9 +1,11 @@
package com.simplemobiletools.gallery.dialogs package com.simplemobiletools.gallery.dialogs
import android.app.AlertDialog
import android.os.Environment import android.os.Environment
import android.support.v7.app.AlertDialog
import android.support.v7.widget.RecyclerView import android.support.v7.widget.RecyclerView
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.ViewGroup
import com.simplemobiletools.commons.extensions.setupDialogStuff
import com.simplemobiletools.filepicker.dialogs.FilePickerDialog import com.simplemobiletools.filepicker.dialogs.FilePickerDialog
import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.R
import com.simplemobiletools.gallery.activities.SimpleActivity import com.simplemobiletools.gallery.activities.SimpleActivity
@ -14,29 +16,27 @@ import kotlinx.android.synthetic.main.dialog_album_picker.view.*
import java.util.* import java.util.*
class PickAlbumDialog(val activity: SimpleActivity, val callback: (path: String) -> Unit) { class PickAlbumDialog(val activity: SimpleActivity, val callback: (path: String) -> Unit) {
var dialog: AlertDialog
var directoriesGrid: RecyclerView var directoriesGrid: RecyclerView
init { init {
val view = LayoutInflater.from(activity).inflate(R.layout.dialog_album_picker, null) val view = LayoutInflater.from(activity).inflate(R.layout.dialog_album_picker, null) as ViewGroup
directoriesGrid = view.directories_grid directoriesGrid = view.directories_grid
dialog = AlertDialog.Builder(activity) AlertDialog.Builder(activity)
.setTitle(R.string.select_destination)
.setView(view) .setView(view)
.setNeutralButton(R.string.other_folder, { dialogInterface, i -> showOtherFolder() }) .setNeutralButton(R.string.other_folder, { dialogInterface, i -> showOtherFolder() })
.setPositiveButton(R.string.ok, null) .setPositiveButton(R.string.ok, null)
.create() .create().apply {
activity.setupDialogStuff(view, this, R.string.select_destination)
dialog.setCanceledOnTouchOutside(true) GetDirectoriesAsynctask(activity, false, false, ArrayList<String>()) {
dialog.show() val adapter = DirectoryAdapter(activity, it, null) {
GetDirectoriesAsynctask(activity, false, false, ArrayList<String>()) { callback.invoke(it.path)
val adapter = DirectoryAdapter(activity, it, null) { dismiss()
callback.invoke(it.path) }
dialog.dismiss() directoriesGrid.adapter = adapter
} }.execute()
directoriesGrid.adapter = adapter }
}.execute()
} }
fun showOtherFolder() { fun showOtherFolder() {

View file

@ -1,8 +1,10 @@
package com.simplemobiletools.gallery.dialogs package com.simplemobiletools.gallery.dialogs
import android.app.AlertDialog import android.support.v7.app.AlertDialog
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.ViewGroup
import android.view.WindowManager import android.view.WindowManager
import com.simplemobiletools.commons.extensions.setupDialogStuff
import com.simplemobiletools.filepicker.extensions.* import com.simplemobiletools.filepicker.extensions.*
import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.R
import com.simplemobiletools.gallery.activities.SimpleActivity import com.simplemobiletools.gallery.activities.SimpleActivity
@ -13,20 +15,17 @@ import java.util.*
class RenameDirectoryDialog(val activity: SimpleActivity, val dir: File, val callback: (changedPaths: ArrayList<String>) -> Unit) { class RenameDirectoryDialog(val activity: SimpleActivity, val dir: File, val callback: (changedPaths: ArrayList<String>) -> Unit) {
init { init {
val view = LayoutInflater.from(activity).inflate(R.layout.rename_directory, null) val view = LayoutInflater.from(activity).inflate(R.layout.rename_directory, null) as ViewGroup
view.directory_name.setText(dir.name) view.directory_name.setText(dir.name)
view.directory_path.text = "${activity.humanizePath(dir.parent)}/" view.directory_path.text = "${activity.humanizePath(dir.parent)}/"
AlertDialog.Builder(activity) AlertDialog.Builder(activity)
.setTitle(R.string.rename_folder)
.setView(view) .setView(view)
.setPositiveButton(R.string.ok, null) .setPositiveButton(R.string.ok, null)
.setNegativeButton(R.string.cancel, null) .setNegativeButton(R.string.cancel, null)
.create().apply { .create().apply {
window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
setCanceledOnTouchOutside(true) activity.setupDialogStuff(view, this, R.string.rename_folder)
show()
getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener({ getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener({
val newDirName = view.directory_name.value val newDirName = view.directory_name.value
if (newDirName.isEmpty()) { if (newDirName.isEmpty()) {

View file

@ -1,8 +1,10 @@
package com.simplemobiletools.gallery.dialogs package com.simplemobiletools.gallery.dialogs
import android.app.AlertDialog import android.support.v7.app.AlertDialog
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.ViewGroup
import android.view.WindowManager import android.view.WindowManager
import com.simplemobiletools.commons.extensions.setupDialogStuff
import com.simplemobiletools.filepicker.extensions.* import com.simplemobiletools.filepicker.extensions.*
import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.R
import com.simplemobiletools.gallery.activities.SimpleActivity import com.simplemobiletools.gallery.activities.SimpleActivity
@ -13,7 +15,7 @@ import java.io.File
class RenameFileDialog(val activity: SimpleActivity, val file: File, val callback: (newFile: File) -> Unit) { class RenameFileDialog(val activity: SimpleActivity, val file: File, val callback: (newFile: File) -> Unit) {
init { init {
val view = LayoutInflater.from(activity).inflate(R.layout.rename_file, null) val view = LayoutInflater.from(activity).inflate(R.layout.rename_file, null) as ViewGroup
val fullName = file.name val fullName = file.name
val dotAt = fullName.lastIndexOf(".") val dotAt = fullName.lastIndexOf(".")
var name = fullName var name = fullName
@ -28,14 +30,12 @@ class RenameFileDialog(val activity: SimpleActivity, val file: File, val callbac
view.file_path.text = "${activity.humanizePath(file.parent)}/" view.file_path.text = "${activity.humanizePath(file.parent)}/"
AlertDialog.Builder(activity) AlertDialog.Builder(activity)
.setTitle(R.string.rename_file)
.setView(view) .setView(view)
.setPositiveButton(R.string.ok, null) .setPositiveButton(R.string.ok, null)
.setNegativeButton(R.string.cancel, null) .setNegativeButton(R.string.cancel, null)
.create().apply { .create().apply {
window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
setCanceledOnTouchOutside(true) activity.setupDialogStuff(view, this, R.string.rename_file)
show()
getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener({ getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener({
val filename = view.file_name.value val filename = view.file_name.value
val extension = view.file_extension.value val extension = view.file_extension.value

View file

@ -1,12 +1,13 @@
package com.simplemobiletools.gallery.dialogs package com.simplemobiletools.gallery.dialogs
import android.app.AlertDialog
import android.graphics.Point import android.graphics.Point
import android.support.v7.app.AlertDialog
import android.text.Editable import android.text.Editable
import android.text.TextWatcher import android.text.TextWatcher
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.WindowManager import android.view.WindowManager
import android.widget.EditText import android.widget.EditText
import com.simplemobiletools.commons.extensions.setupDialogStuff
import com.simplemobiletools.filepicker.extensions.toast import com.simplemobiletools.filepicker.extensions.toast
import com.simplemobiletools.filepicker.extensions.value import com.simplemobiletools.filepicker.extensions.value
import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.R
@ -69,14 +70,12 @@ class ResizeDialog(val activity: SimpleActivity, val size: Point, val callback:
}) })
AlertDialog.Builder(activity) AlertDialog.Builder(activity)
.setTitle(R.string.resize_and_save)
.setView(view) .setView(view)
.setPositiveButton(R.string.ok, null) .setPositiveButton(R.string.ok, null)
.setNegativeButton(R.string.cancel, null) .setNegativeButton(R.string.cancel, null)
.create().apply { .create().apply {
window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
setCanceledOnTouchOutside(true) activity.setupDialogStuff(view, this, R.string.resize_and_save)
show()
getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener({ getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener({
val width = getViewValue(widthView) val width = getViewValue(widthView)
val height = getViewValue(heightView) val height = getViewValue(heightView)

View file

@ -1,9 +1,10 @@
package com.simplemobiletools.gallery.dialogs package com.simplemobiletools.gallery.dialogs
import android.app.Activity import android.app.Activity
import android.app.AlertDialog import android.support.v7.app.AlertDialog
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.WindowManager import android.view.WindowManager
import com.simplemobiletools.commons.extensions.setupDialogStuff
import com.simplemobiletools.filepicker.dialogs.FilePickerDialog import com.simplemobiletools.filepicker.dialogs.FilePickerDialog
import com.simplemobiletools.filepicker.extensions.* import com.simplemobiletools.filepicker.extensions.*
import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.R
@ -43,14 +44,12 @@ class SaveAsDialog(val activity: Activity, val path: String, val callback: (save
} }
AlertDialog.Builder(activity) AlertDialog.Builder(activity)
.setTitle(R.string.save_as)
.setView(view) .setView(view)
.setPositiveButton(R.string.ok, null) .setPositiveButton(R.string.ok, null)
.setNegativeButton(R.string.cancel, null) .setNegativeButton(R.string.cancel, null)
.create().apply { .create().apply {
window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
setCanceledOnTouchOutside(true) activity.setupDialogStuff(view, this, R.string.save_as)
show()
getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener({ getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener({
val filename = view.file_name.value val filename = view.file_name.value
val extension = view.file_extension.value val extension = view.file_extension.value

View file

@ -19,7 +19,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<RadioButton <com.simplemobiletools.commons.views.MyCompatRadioButton
android:id="@+id/sorting_dialog_radio_name" android:id="@+id/sorting_dialog_radio_name"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -27,7 +27,7 @@
android:paddingTop="@dimen/medium_padding" android:paddingTop="@dimen/medium_padding"
android:text="@string/name"/> android:text="@string/name"/>
<RadioButton <com.simplemobiletools.commons.views.MyCompatRadioButton
android:id="@+id/sorting_dialog_radio_size" android:id="@+id/sorting_dialog_radio_size"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -35,7 +35,7 @@
android:paddingTop="@dimen/medium_padding" android:paddingTop="@dimen/medium_padding"
android:text="@string/size"/> android:text="@string/size"/>
<RadioButton <com.simplemobiletools.commons.views.MyCompatRadioButton
android:id="@+id/sorting_dialog_radio_last_modified" android:id="@+id/sorting_dialog_radio_last_modified"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -43,7 +43,7 @@
android:paddingTop="@dimen/medium_padding" android:paddingTop="@dimen/medium_padding"
android:text="@string/last_modified"/> android:text="@string/last_modified"/>
<RadioButton <com.simplemobiletools.commons.views.MyCompatRadioButton
android:id="@+id/sorting_dialog_radio_date_taken" android:id="@+id/sorting_dialog_radio_date_taken"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -65,7 +65,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<RadioButton <com.simplemobiletools.commons.views.MyCompatRadioButton
android:id="@+id/sorting_dialog_radio_ascending" android:id="@+id/sorting_dialog_radio_ascending"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -73,7 +73,7 @@
android:paddingTop="@dimen/medium_padding" android:paddingTop="@dimen/medium_padding"
android:text="@string/ascending"/> android:text="@string/ascending"/>
<RadioButton <com.simplemobiletools.commons.views.MyCompatRadioButton
android:id="@+id/sorting_dialog_radio_descending" android:id="@+id/sorting_dialog_radio_descending"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View file

@ -49,14 +49,14 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:checkedButton="@+id/dialog_radio_copy"> android:checkedButton="@+id/dialog_radio_copy">
<RadioButton <com.simplemobiletools.commons.views.MyCompatRadioButton
android:id="@+id/dialog_radio_copy" android:id="@+id/dialog_radio_copy"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/medium_padding" android:layout_marginBottom="@dimen/medium_padding"
android:text="@string/copy"/> android:text="@string/copy"/>
<RadioButton <com.simplemobiletools.commons.views.MyCompatRadioButton
android:id="@+id/dialog_radio_move" android:id="@+id/dialog_radio_move"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View file

@ -1,10 +1,11 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout
android:id="@+id/rename_file_holder" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:id="@+id/rename_file_holder"
android:layout_height="match_parent" android:layout_width="match_parent"
android:orientation="vertical" android:layout_height="match_parent"
android:padding="@dimen/activity_margin"> android:orientation="vertical"
android:padding="@dimen/activity_margin">
<TextView <TextView
android:id="@+id/file_path" android:id="@+id/file_path"