store dialog holders as views, not viewgroups
This commit is contained in:
parent
5eb44b5bcf
commit
23768d847f
6 changed files with 14 additions and 17 deletions
|
@ -3,7 +3,7 @@ package com.simplemobiletools.gallery.dialogs
|
|||
import android.content.DialogInterface
|
||||
import android.support.v7.app.AlertDialog
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import android.view.View
|
||||
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
||||
import com.simplemobiletools.gallery.R
|
||||
import com.simplemobiletools.gallery.activities.SimpleActivity
|
||||
|
@ -15,12 +15,12 @@ class ChangeSortingDialog(val activity: SimpleActivity, val isDirectorySorting:
|
|||
private var currSorting = 0
|
||||
|
||||
lateinit var config: Config
|
||||
lateinit var view: ViewGroup
|
||||
lateinit var view: View
|
||||
}
|
||||
|
||||
init {
|
||||
config = Config.newInstance(activity)
|
||||
view = LayoutInflater.from(activity).inflate(R.layout.dialog_change_sorting, null) as ViewGroup
|
||||
view = LayoutInflater.from(activity).inflate(R.layout.dialog_change_sorting, null)
|
||||
|
||||
AlertDialog.Builder(activity)
|
||||
.setPositiveButton(R.string.ok, this)
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.simplemobiletools.gallery.dialogs
|
|||
import android.support.v4.util.Pair
|
||||
import android.support.v7.app.AlertDialog
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import android.view.View
|
||||
import com.simplemobiletools.commons.asynctasks.CopyMoveTask
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.gallery.R
|
||||
|
@ -15,11 +15,11 @@ import java.util.*
|
|||
|
||||
class CopyDialog(val activity: SimpleActivity, val files: ArrayList<File>, val copyMoveListener: CopyMoveTask.CopyMoveListener) {
|
||||
companion object {
|
||||
lateinit var view: ViewGroup
|
||||
lateinit var view: View
|
||||
}
|
||||
|
||||
init {
|
||||
view = LayoutInflater.from(activity).inflate(R.layout.dialog_copy_move, null) as ViewGroup
|
||||
view = LayoutInflater.from(activity).inflate(R.layout.dialog_copy_move, null)
|
||||
val sourcePath = files[0].parent.trimEnd('/')
|
||||
var destinationPath = ""
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ 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.dialogs.FilePickerDialog
|
||||
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
||||
import com.simplemobiletools.gallery.R
|
||||
|
@ -19,7 +18,7 @@ class PickAlbumDialog(val activity: SimpleActivity, val callback: (path: String)
|
|||
var directoriesGrid: RecyclerView
|
||||
|
||||
init {
|
||||
val view = LayoutInflater.from(activity).inflate(R.layout.dialog_album_picker, null) as ViewGroup
|
||||
val view = LayoutInflater.from(activity).inflate(R.layout.dialog_album_picker, null)
|
||||
directoriesGrid = view.directories_grid
|
||||
|
||||
AlertDialog.Builder(activity)
|
||||
|
|
|
@ -2,7 +2,6 @@ package com.simplemobiletools.gallery.dialogs
|
|||
|
||||
import android.support.v7.app.AlertDialog
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import android.view.WindowManager
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.gallery.R
|
||||
|
@ -14,9 +13,10 @@ 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) as ViewGroup
|
||||
view.directory_name.setText(dir.name)
|
||||
view.directory_path.text = "${activity.humanizePath(dir.parent)}/"
|
||||
val view = LayoutInflater.from(activity).inflate(R.layout.rename_directory, null).apply {
|
||||
directory_name.setText(dir.name)
|
||||
directory_path.text = "${activity.humanizePath(dir.parent)}/"
|
||||
}
|
||||
|
||||
AlertDialog.Builder(activity)
|
||||
.setPositiveButton(R.string.ok, null)
|
||||
|
|
|
@ -2,7 +2,6 @@ package com.simplemobiletools.gallery.dialogs
|
|||
|
||||
import android.support.v7.app.AlertDialog
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import android.view.WindowManager
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.gallery.R
|
||||
|
@ -14,7 +13,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) as ViewGroup
|
||||
val view = LayoutInflater.from(activity).inflate(R.layout.rename_file, null)
|
||||
val fullName = file.name
|
||||
val dotAt = fullName.lastIndexOf(".")
|
||||
var name = fullName
|
||||
|
|
|
@ -14,8 +14,7 @@ class SaveAsDialog(val activity: Activity, val path: String, val callback: (save
|
|||
|
||||
init {
|
||||
var realPath = File(path).parent.trimEnd('/')
|
||||
val view = LayoutInflater.from(activity).inflate(R.layout.dialog_save_as, null)
|
||||
view.apply {
|
||||
val view = LayoutInflater.from(activity).inflate(R.layout.dialog_save_as, null).apply {
|
||||
file_path.text = activity.humanizePath(realPath)
|
||||
|
||||
val fullName = path.getFilenameFromPath()
|
||||
|
@ -25,7 +24,7 @@ class SaveAsDialog(val activity: Activity, val path: String, val callback: (save
|
|||
if (dotAt > 0) {
|
||||
name = fullName.substring(0, dotAt)
|
||||
val extension = fullName.substring(dotAt + 1)
|
||||
view.file_extension.setText(extension)
|
||||
file_extension.setText(extension)
|
||||
}
|
||||
|
||||
file_name.setText(name)
|
||||
|
|
Loading…
Reference in a new issue