mirror of
				https://github.com/SimpleMobileTools/Simple-File-Manager.git
				synced 2025-06-05 22:09:15 +02:00 
			
		
		
		
	request WRITE_EXTERNAL_STORAGE + cleanup
This commit is contained in:
		| @@ -23,7 +23,7 @@ public class Utils { | ||||
|     } | ||||
|  | ||||
|     public static boolean hasStoragePermission(Context cxt) { | ||||
|         return ContextCompat.checkSelfPermission(cxt, Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED; | ||||
|         return ContextCompat.checkSelfPermission(cxt, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED; | ||||
|     } | ||||
|  | ||||
|     public static boolean isNameValid(String name) { | ||||
|   | ||||
| @@ -12,7 +12,6 @@ import android.support.annotation.Nullable; | ||||
| import android.support.design.widget.CoordinatorLayout; | ||||
| import android.support.design.widget.Snackbar; | ||||
| import android.support.v4.widget.SwipeRefreshLayout; | ||||
| import android.support.v7.app.AlertDialog; | ||||
| import android.util.SparseBooleanArray; | ||||
| import android.view.ActionMode; | ||||
| import android.view.LayoutInflater; | ||||
| @@ -24,7 +23,6 @@ import android.view.ViewGroup; | ||||
| import android.webkit.MimeTypeMap; | ||||
| import android.widget.AdapterView; | ||||
| import android.widget.ListView; | ||||
| import android.widget.TextView; | ||||
|  | ||||
| import com.simplemobiletools.filemanager.Config; | ||||
| import com.simplemobiletools.filemanager.Constants; | ||||
| @@ -63,10 +61,7 @@ public class ItemsFragment extends android.support.v4.app.Fragment | ||||
|     private ItemInteractionListener mListener; | ||||
|     private List<String> mToBeDeleted; | ||||
|     private String mPath; | ||||
|     private String mCopyDestinationPath; | ||||
|     private Snackbar mSnackbar; | ||||
|     private AlertDialog mCopyDialog; | ||||
|     private TextView mDestinationView; | ||||
|     private Config mConfig; | ||||
|  | ||||
|     private boolean mShowHidden; | ||||
| @@ -112,7 +107,6 @@ public class ItemsFragment extends android.support.v4.app.Fragment | ||||
|  | ||||
|     private void fillItems() { | ||||
|         mPath = getArguments().getString(Constants.PATH); | ||||
|         mCopyDestinationPath = mPath; | ||||
|         final List<FileDirItem> newItems = getItems(mPath); | ||||
|         Collections.sort(newItems); | ||||
|         if (mItems != null && newItems.toString().equals(mItems.toString())) { | ||||
| @@ -378,11 +372,6 @@ public class ItemsFragment extends android.support.v4.app.Fragment | ||||
|             public void onSuccess() { | ||||
|                 fillItems(); | ||||
|             } | ||||
|  | ||||
|             @Override | ||||
|             public void onCancel() { | ||||
|                 mCopyDestinationPath = mPath; | ||||
|             } | ||||
|         }); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -51,7 +51,7 @@ class MainActivity : SimpleActivity(), ItemsFragment.ItemInteractionListener, Br | ||||
|         if (Utils.hasStoragePermission(applicationContext)) { | ||||
|             initRootFileManager() | ||||
|         } else { | ||||
|             ActivityCompat.requestPermissions(this, arrayOf(Manifest.permission.READ_EXTERNAL_STORAGE), STORAGE_PERMISSION) | ||||
|             ActivityCompat.requestPermissions(this, arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE), STORAGE_PERMISSION) | ||||
|         } | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -38,8 +38,7 @@ class CopyDialog(val activity: Activity, val files: List<File>, val path: String | ||||
|                 .setTitle(mContext.resources.getString(R.string.create_new)) | ||||
|                 .setView(view) | ||||
|                 .setPositiveButton(R.string.ok, null) | ||||
|                 .setNegativeButton(R.string.cancel, { dialog, which -> dialogDismissed() }) | ||||
|                 .setOnCancelListener { dialogDismissed() } | ||||
|                 .setNegativeButton(R.string.cancel, null) | ||||
|                 .create().apply { | ||||
|             window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) | ||||
|             show() | ||||
| @@ -75,13 +74,7 @@ class CopyDialog(val activity: Activity, val files: List<File>, val path: String | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private fun dialogDismissed() { | ||||
|         listener.onCancel() | ||||
|     } | ||||
|  | ||||
|     interface OnCopyListener { | ||||
|         fun onSuccess() | ||||
|  | ||||
|         fun onCancel() | ||||
|     } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user