diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/ChangeSortingDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/ChangeSortingDialog.kt index f6acd3b8b..f747a1dc5 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/ChangeSortingDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/ChangeSortingDialog.kt @@ -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) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/CopyDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/CopyDialog.kt index 8a3e11e49..44025680f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/CopyDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/CopyDialog.kt @@ -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, 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 = "" diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickAlbumDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickAlbumDialog.kt index aefeb107d..503cd32ce 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickAlbumDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickAlbumDialog.kt @@ -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) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/RenameDirectoryDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/RenameDirectoryDialog.kt index fae3eb0c7..d193d1dae 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/RenameDirectoryDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/RenameDirectoryDialog.kt @@ -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) -> 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) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/RenameFileDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/RenameFileDialog.kt index 88c30f88d..845344a4f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/RenameFileDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/RenameFileDialog.kt @@ -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 diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/SaveAsDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/SaveAsDialog.kt index 46051c573..96543012d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/SaveAsDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/SaveAsDialog.kt @@ -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)