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.view.View
import android.widget.AdapterView
import com.simplemobiletools.commons.extensions.updateTextColors
import com.simplemobiletools.gallery.R
import kotlinx.android.synthetic.main.activity_settings.*

View file

@ -1,35 +1,34 @@
package com.simplemobiletools.gallery.dialogs
import android.app.Activity
import android.app.AlertDialog
import android.content.DialogInterface
import android.support.v7.app.AlertDialog
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.activities.SimpleActivity
import com.simplemobiletools.gallery.helpers.*
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 {
private var currSorting = 0
lateinit var config: Config
lateinit var view: View
lateinit var view: ViewGroup
}
init {
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)
.setTitle(R.string.sort_by)
AlertDialog.Builder(activity)
.setView(view)
.setPositiveButton(R.string.ok, this)
.setNegativeButton(R.string.cancel, null)
.create()
dialog.setCanceledOnTouchOutside(true)
dialog.show()
.create().apply {
activity.setupDialogStuff(view, this, R.string.sort_by)
}
currSorting = if (isDirectorySorting) config.directorySorting else config.sorting
setupSortRadio()

View file

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

View file

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

View file

@ -1,8 +1,10 @@
package com.simplemobiletools.gallery.dialogs
import android.app.AlertDialog
import android.support.v7.app.AlertDialog
import android.view.LayoutInflater
import android.view.ViewGroup
import android.view.WindowManager
import com.simplemobiletools.commons.extensions.setupDialogStuff
import com.simplemobiletools.filepicker.extensions.*
import com.simplemobiletools.gallery.R
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) {
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_path.text = "${activity.humanizePath(dir.parent)}/"
AlertDialog.Builder(activity)
.setTitle(R.string.rename_folder)
.setView(view)
.setPositiveButton(R.string.ok, null)
.setNegativeButton(R.string.cancel, null)
.create().apply {
window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
setCanceledOnTouchOutside(true)
show()
activity.setupDialogStuff(view, this, R.string.rename_folder)
getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener({
val newDirName = view.directory_name.value
if (newDirName.isEmpty()) {

View file

@ -1,8 +1,10 @@
package com.simplemobiletools.gallery.dialogs
import android.app.AlertDialog
import android.support.v7.app.AlertDialog
import android.view.LayoutInflater
import android.view.ViewGroup
import android.view.WindowManager
import com.simplemobiletools.commons.extensions.setupDialogStuff
import com.simplemobiletools.filepicker.extensions.*
import com.simplemobiletools.gallery.R
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) {
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 dotAt = fullName.lastIndexOf(".")
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)}/"
AlertDialog.Builder(activity)
.setTitle(R.string.rename_file)
.setView(view)
.setPositiveButton(R.string.ok, null)
.setNegativeButton(R.string.cancel, null)
.create().apply {
window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
setCanceledOnTouchOutside(true)
show()
activity.setupDialogStuff(view, this, R.string.rename_file)
getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener({
val filename = view.file_name.value
val extension = view.file_extension.value

View file

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

View file

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

View file

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

View file

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

View file

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