mirror of
https://github.com/SimpleMobileTools/Simple-File-Manager.git
synced 2025-06-05 22:09:15 +02:00
update a write permissions check
This commit is contained in:
@ -28,6 +28,7 @@ import com.simplemobiletools.filemanager.Config;
|
|||||||
import com.simplemobiletools.filemanager.Constants;
|
import com.simplemobiletools.filemanager.Constants;
|
||||||
import com.simplemobiletools.filemanager.R;
|
import com.simplemobiletools.filemanager.R;
|
||||||
import com.simplemobiletools.filemanager.Utils;
|
import com.simplemobiletools.filemanager.Utils;
|
||||||
|
import com.simplemobiletools.filemanager.activities.SimpleActivity;
|
||||||
import com.simplemobiletools.filemanager.adapters.ItemsAdapter;
|
import com.simplemobiletools.filemanager.adapters.ItemsAdapter;
|
||||||
import com.simplemobiletools.filemanager.asynctasks.CopyTask;
|
import com.simplemobiletools.filemanager.asynctasks.CopyTask;
|
||||||
import com.simplemobiletools.filemanager.dialogs.CopyDialog;
|
import com.simplemobiletools.filemanager.dialogs.CopyDialog;
|
||||||
@ -370,7 +371,7 @@ public class ItemsFragment extends android.support.v4.app.Fragment
|
|||||||
itemsToCopy.add(new File(item.getPath()));
|
itemsToCopy.add(new File(item.getPath()));
|
||||||
}
|
}
|
||||||
|
|
||||||
new CopyDialog(getActivity(), itemsToCopy, this, new CopyDialog.OnCopyListener() {
|
new CopyDialog((SimpleActivity) getActivity(), itemsToCopy, this, new CopyDialog.OnCopyListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess() {
|
public void onSuccess() {
|
||||||
fillItems();
|
fillItems();
|
||||||
|
@ -1,23 +1,23 @@
|
|||||||
package com.simplemobiletools.filemanager.dialogs
|
package com.simplemobiletools.filemanager.dialogs
|
||||||
|
|
||||||
import android.app.Activity
|
|
||||||
import android.content.Intent
|
|
||||||
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.LayoutInflater
|
||||||
import android.view.WindowManager
|
import android.view.WindowManager
|
||||||
import com.simplemobiletools.filemanager.Config
|
import com.simplemobiletools.filemanager.Config
|
||||||
import com.simplemobiletools.filemanager.Constants
|
|
||||||
import com.simplemobiletools.filemanager.R
|
import com.simplemobiletools.filemanager.R
|
||||||
|
import com.simplemobiletools.filemanager.activities.SimpleActivity
|
||||||
import com.simplemobiletools.filemanager.asynctasks.CopyTask
|
import com.simplemobiletools.filemanager.asynctasks.CopyTask
|
||||||
import com.simplemobiletools.filepicker.dialogs.FilePickerDialog
|
import com.simplemobiletools.filepicker.dialogs.FilePickerDialog
|
||||||
import com.simplemobiletools.filepicker.dialogs.WritePermissionDialog
|
import com.simplemobiletools.filepicker.extensions.humanizePath
|
||||||
import com.simplemobiletools.filepicker.extensions.*
|
import com.simplemobiletools.filepicker.extensions.isPathOnSD
|
||||||
|
import com.simplemobiletools.filepicker.extensions.scanFiles
|
||||||
|
import com.simplemobiletools.filepicker.extensions.toast
|
||||||
import kotlinx.android.synthetic.main.copy_item.view.*
|
import kotlinx.android.synthetic.main.copy_item.view.*
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
class CopyDialog(val activity: Activity, val files: ArrayList<File>, val copyListener: CopyTask.CopyListener, val listener: OnCopyListener) {
|
class CopyDialog(val activity: SimpleActivity, val files: ArrayList<File>, val copyListener: CopyTask.CopyListener, val listener: OnCopyListener) {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
val context = activity
|
val context = activity
|
||||||
@ -72,13 +72,7 @@ class CopyDialog(val activity: Activity, val files: ArrayList<File>, val copyLis
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context.needsStupidWritePermissions(destinationPath) && config.treeUri.isEmpty()) {
|
if (activity.isShowingPermDialog(destinationDir)) {
|
||||||
WritePermissionDialog(activity, object : WritePermissionDialog.OnConfirmedListener {
|
|
||||||
override fun onConfirmed() {
|
|
||||||
val intent = Intent(Intent.ACTION_OPEN_DOCUMENT_TREE)
|
|
||||||
activity.startActivityForResult(intent, Constants.OPEN_DOCUMENT_TREE)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return@setOnClickListener
|
return@setOnClickListener
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user