call layoutInflater on the activity directly

This commit is contained in:
tibbi 2017-12-06 19:05:47 +01:00
parent adc9e99135
commit e69703bd07
10 changed files with 10 additions and 22 deletions

View file

@ -43,7 +43,7 @@ ext {
} }
dependencies { dependencies {
implementation 'com.simplemobiletools:commons:3.1.13' implementation 'com.simplemobiletools:commons:3.2.0'
implementation 'com.davemorrissey.labs:subsampling-scale-image-view:3.8.0' implementation 'com.davemorrissey.labs:subsampling-scale-image-view:3.8.0'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.4.0' implementation 'com.theartofdev.edmodo:android-image-cropper:2.4.0'
implementation 'com.android.support:multidex:1.0.2' implementation 'com.android.support:multidex:1.0.2'

View file

@ -2,7 +2,6 @@ package com.simplemobiletools.gallery.dialogs
import android.content.DialogInterface import android.content.DialogInterface
import android.support.v7.app.AlertDialog import android.support.v7.app.AlertDialog
import android.view.LayoutInflater
import android.view.View import android.view.View
import com.simplemobiletools.commons.activities.BaseSimpleActivity import com.simplemobiletools.commons.activities.BaseSimpleActivity
import com.simplemobiletools.commons.extensions.beVisibleIf import com.simplemobiletools.commons.extensions.beVisibleIf
@ -20,7 +19,7 @@ class ChangeSortingDialog(val activity: BaseSimpleActivity, val isDirectorySorti
private var view: View private var view: View
init { init {
view = LayoutInflater.from(activity).inflate(R.layout.dialog_change_sorting, null).apply { view = activity.layoutInflater.inflate(R.layout.dialog_change_sorting, null).apply {
use_for_this_folder_divider.beVisibleIf(showFolderCheckbox) use_for_this_folder_divider.beVisibleIf(showFolderCheckbox)
sorting_dialog_use_for_this_folder.beVisibleIf(showFolderCheckbox) sorting_dialog_use_for_this_folder.beVisibleIf(showFolderCheckbox)
sorting_dialog_use_for_this_folder.isChecked = config.hasCustomSorting(path) sorting_dialog_use_for_this_folder.isChecked = config.hasCustomSorting(path)

View file

@ -1,7 +1,6 @@
package com.simplemobiletools.gallery.dialogs package com.simplemobiletools.gallery.dialogs
import android.support.v7.app.AlertDialog import android.support.v7.app.AlertDialog
import android.view.LayoutInflater
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.RadioButton import android.widget.RadioButton
import android.widget.RadioGroup import android.widget.RadioGroup
@ -18,7 +17,7 @@ class ExcludeFolderDialog(val activity: BaseSimpleActivity, val selectedPaths: L
var radioGroup: RadioGroup? = null var radioGroup: RadioGroup? = null
init { init {
val view = LayoutInflater.from(activity).inflate(R.layout.dialog_exclude_folder, null).apply { val view = activity.layoutInflater.inflate(R.layout.dialog_exclude_folder, null).apply {
exclude_folder_parent.beVisibleIf(alternativePaths.size > 1) exclude_folder_parent.beVisibleIf(alternativePaths.size > 1)
radioGroup = exclude_folder_radio_group radioGroup = exclude_folder_radio_group

View file

@ -1,8 +1,6 @@
package com.simplemobiletools.gallery.dialogs package com.simplemobiletools.gallery.dialogs
import android.support.v7.app.AlertDialog import android.support.v7.app.AlertDialog
import android.view.LayoutInflater
import android.view.View
import com.simplemobiletools.commons.activities.BaseSimpleActivity import com.simplemobiletools.commons.activities.BaseSimpleActivity
import com.simplemobiletools.commons.extensions.setupDialogStuff import com.simplemobiletools.commons.extensions.setupDialogStuff
import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.R
@ -13,7 +11,7 @@ import com.simplemobiletools.gallery.helpers.VIDEOS
import kotlinx.android.synthetic.main.dialog_filter_media.view.* import kotlinx.android.synthetic.main.dialog_filter_media.view.*
class FilterMediaDialog(val activity: BaseSimpleActivity, val callback: (result: Int) -> Unit) { class FilterMediaDialog(val activity: BaseSimpleActivity, val callback: (result: Int) -> Unit) {
private var view: View = LayoutInflater.from(activity).inflate(R.layout.dialog_filter_media, null) private var view = activity.layoutInflater.inflate(R.layout.dialog_filter_media, null)
init { init {
val filterMedia = activity.config.filterMedia val filterMedia = activity.config.filterMedia

View file

@ -1,18 +1,15 @@
package com.simplemobiletools.gallery.dialogs package com.simplemobiletools.gallery.dialogs
import android.support.v7.app.AlertDialog import android.support.v7.app.AlertDialog
import android.view.LayoutInflater
import android.view.View
import com.simplemobiletools.commons.activities.BaseSimpleActivity import com.simplemobiletools.commons.activities.BaseSimpleActivity
import com.simplemobiletools.commons.extensions.setupDialogStuff 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.extensions.config import com.simplemobiletools.gallery.extensions.config
import com.simplemobiletools.gallery.helpers.* import com.simplemobiletools.gallery.helpers.*
import kotlinx.android.synthetic.main.dialog_manage_extended_details.view.* import kotlinx.android.synthetic.main.dialog_manage_extended_details.view.*
class ManageExtendedDetailsDialog(val activity: BaseSimpleActivity, val callback: (result: Int) -> Unit) { class ManageExtendedDetailsDialog(val activity: BaseSimpleActivity, val callback: (result: Int) -> Unit) {
private var view: View = LayoutInflater.from(activity).inflate(R.layout.dialog_manage_extended_details, null) private var view = activity.layoutInflater.inflate(R.layout.dialog_manage_extended_details, null)
init { init {
val details = activity.config.extendedDetails val details = activity.config.extendedDetails

View file

@ -2,7 +2,6 @@ package com.simplemobiletools.gallery.dialogs
import android.support.v7.app.AlertDialog import android.support.v7.app.AlertDialog
import android.support.v7.widget.GridLayoutManager import android.support.v7.widget.GridLayoutManager
import android.view.LayoutInflater
import com.simplemobiletools.commons.activities.BaseSimpleActivity import com.simplemobiletools.commons.activities.BaseSimpleActivity
import com.simplemobiletools.commons.dialogs.FilePickerDialog import com.simplemobiletools.commons.dialogs.FilePickerDialog
import com.simplemobiletools.commons.extensions.beGoneIf import com.simplemobiletools.commons.extensions.beGoneIf
@ -23,7 +22,7 @@ import kotlinx.android.synthetic.main.dialog_directory_picker.view.*
class PickDirectoryDialog(val activity: BaseSimpleActivity, val sourcePath: String, val callback: (path: String) -> Unit) { class PickDirectoryDialog(val activity: BaseSimpleActivity, val sourcePath: String, val callback: (path: String) -> Unit) {
var dialog: AlertDialog var dialog: AlertDialog
var shownDirectories = ArrayList<Directory>() var shownDirectories = ArrayList<Directory>()
var view = LayoutInflater.from(activity).inflate(R.layout.dialog_directory_picker, null) var view = activity.layoutInflater.inflate(R.layout.dialog_directory_picker, null)
var isGridViewType = activity.config.viewTypeFolders == VIEW_TYPE_GRID var isGridViewType = activity.config.viewTypeFolders == VIEW_TYPE_GRID
init { init {

View file

@ -2,7 +2,6 @@ package com.simplemobiletools.gallery.dialogs
import android.support.v7.app.AlertDialog import android.support.v7.app.AlertDialog
import android.support.v7.widget.GridLayoutManager import android.support.v7.widget.GridLayoutManager
import android.view.LayoutInflater
import com.simplemobiletools.commons.activities.BaseSimpleActivity import com.simplemobiletools.commons.activities.BaseSimpleActivity
import com.simplemobiletools.commons.extensions.beGoneIf import com.simplemobiletools.commons.extensions.beGoneIf
import com.simplemobiletools.commons.extensions.beVisibleIf import com.simplemobiletools.commons.extensions.beVisibleIf
@ -19,7 +18,7 @@ import kotlinx.android.synthetic.main.dialog_medium_picker.view.*
class PickMediumDialog(val activity: BaseSimpleActivity, val path: String, val callback: (path: String) -> Unit) { class PickMediumDialog(val activity: BaseSimpleActivity, val path: String, val callback: (path: String) -> Unit) {
var dialog: AlertDialog var dialog: AlertDialog
var shownMedia = ArrayList<Medium>() var shownMedia = ArrayList<Medium>()
val view = LayoutInflater.from(activity).inflate(R.layout.dialog_medium_picker, null) val view = activity.layoutInflater.inflate(R.layout.dialog_medium_picker, null)
var isGridViewType = activity.config.viewTypeFiles == VIEW_TYPE_GRID var isGridViewType = activity.config.viewTypeFiles == VIEW_TYPE_GRID
init { init {

View file

@ -4,7 +4,6 @@ import android.graphics.Point
import android.support.v7.app.AlertDialog 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.WindowManager import android.view.WindowManager
import android.widget.EditText import android.widget.EditText
import com.simplemobiletools.commons.activities.BaseSimpleActivity import com.simplemobiletools.commons.activities.BaseSimpleActivity
@ -16,7 +15,7 @@ import kotlinx.android.synthetic.main.resize_image.view.*
class ResizeDialog(val activity: BaseSimpleActivity, val size: Point, val callback: (newSize: Point) -> Unit) { class ResizeDialog(val activity: BaseSimpleActivity, val size: Point, val callback: (newSize: Point) -> Unit) {
init { init {
val view = LayoutInflater.from(activity).inflate(R.layout.resize_image, null) val view = activity.layoutInflater.inflate(R.layout.resize_image, null)
val widthView = view.image_width val widthView = view.image_width
val heightView = view.image_height val heightView = view.image_height

View file

@ -1,7 +1,6 @@
package com.simplemobiletools.gallery.dialogs package com.simplemobiletools.gallery.dialogs
import android.support.v7.app.AlertDialog import android.support.v7.app.AlertDialog
import android.view.LayoutInflater
import android.view.WindowManager import android.view.WindowManager
import com.simplemobiletools.commons.activities.BaseSimpleActivity import com.simplemobiletools.commons.activities.BaseSimpleActivity
import com.simplemobiletools.commons.dialogs.ConfirmationDialog import com.simplemobiletools.commons.dialogs.ConfirmationDialog
@ -15,7 +14,7 @@ class SaveAsDialog(val activity: BaseSimpleActivity, val path: String, val appen
init { init {
var realPath = File(path).parent.trimEnd('/') var realPath = File(path).parent.trimEnd('/')
val view = LayoutInflater.from(activity).inflate(R.layout.dialog_save_as, null).apply { val view = activity.layoutInflater.inflate(R.layout.dialog_save_as, null).apply {
save_as_path.text = activity.humanizePath(realPath) save_as_path.text = activity.humanizePath(realPath)
val fullName = path.getFilenameFromPath() val fullName = path.getFilenameFromPath()

View file

@ -1,7 +1,6 @@
package com.simplemobiletools.gallery.dialogs package com.simplemobiletools.gallery.dialogs
import android.support.v7.app.AlertDialog import android.support.v7.app.AlertDialog
import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.WindowManager import android.view.WindowManager
import com.simplemobiletools.commons.activities.BaseSimpleActivity import com.simplemobiletools.commons.activities.BaseSimpleActivity
@ -17,7 +16,7 @@ class SlideshowDialog(val activity: BaseSimpleActivity, val callback: () -> Unit
val view: View val view: View
init { init {
view = LayoutInflater.from(activity).inflate(R.layout.dialog_slideshow, null).apply { view = activity.layoutInflater.inflate(R.layout.dialog_slideshow, null).apply {
interval_value.setOnClickListener { interval_value.setOnClickListener {
val text = interval_value.text val text = interval_value.text
if (text.isNotEmpty()) { if (text.isNotEmpty()) {