update CopyDialog
This commit is contained in:
parent
08a72523d7
commit
dd9c6266db
|
@ -2,13 +2,8 @@ package com.simplemobiletools.filemanager.dialogs
|
||||||
|
|
||||||
import android.support.v4.util.Pair
|
import android.support.v4.util.Pair
|
||||||
import android.support.v7.app.AlertDialog
|
import android.support.v7.app.AlertDialog
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.WindowManager
|
|
||||||
import com.simplemobiletools.commons.asynctasks.CopyMoveTask
|
import com.simplemobiletools.commons.asynctasks.CopyMoveTask
|
||||||
import com.simplemobiletools.commons.extensions.humanizePath
|
import com.simplemobiletools.commons.extensions.*
|
||||||
import com.simplemobiletools.commons.extensions.isPathOnSD
|
|
||||||
import com.simplemobiletools.commons.extensions.scanFiles
|
|
||||||
import com.simplemobiletools.commons.extensions.toast
|
|
||||||
import com.simplemobiletools.filemanager.Config
|
import com.simplemobiletools.filemanager.Config
|
||||||
import com.simplemobiletools.filemanager.R
|
import com.simplemobiletools.filemanager.R
|
||||||
import com.simplemobiletools.filemanager.activities.SimpleActivity
|
import com.simplemobiletools.filemanager.activities.SimpleActivity
|
||||||
|
@ -20,7 +15,7 @@ class CopyDialog(val activity: SimpleActivity, val files: ArrayList<File>, val c
|
||||||
|
|
||||||
init {
|
init {
|
||||||
val context = activity
|
val context = activity
|
||||||
val view = LayoutInflater.from(context).inflate(R.layout.copy_item, null)
|
val view = activity.layoutInflater.inflate(R.layout.copy_item, null)
|
||||||
val sourcePath = files[0].parent.trimEnd('/')
|
val sourcePath = files[0].parent.trimEnd('/')
|
||||||
var destinationPath = ""
|
var destinationPath = ""
|
||||||
view.source.text = "${context.humanizePath(sourcePath)}/"
|
view.source.text = "${context.humanizePath(sourcePath)}/"
|
||||||
|
@ -39,14 +34,10 @@ class CopyDialog(val activity: SimpleActivity, val files: ArrayList<File>, val c
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
AlertDialog.Builder(context)
|
AlertDialog.Builder(context)
|
||||||
.setTitle(context.resources.getString(if (files.size == 1) R.string.copy_item else R.string.copy_items))
|
|
||||||
.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_items)
|
||||||
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)
|
||||||
|
|
Loading…
Reference in New Issue