remove the custom write permissions dialog

This commit is contained in:
tibbi 2016-11-12 15:45:55 +01:00
parent 7ab4c01010
commit 8d3b54b661
10 changed files with 4 additions and 71 deletions

View file

@ -13,9 +13,9 @@ import android.view.Menu
import android.view.MenuItem
import com.simplemobiletools.filemanager.Constants
import com.simplemobiletools.filemanager.R
import com.simplemobiletools.filemanager.dialogs.WritePermissionDialog
import com.simplemobiletools.filemanager.fragments.ItemsFragment
import com.simplemobiletools.filepicker.dialogs.StoragePickerDialog
import com.simplemobiletools.filepicker.dialogs.WritePermissionDialog
import com.simplemobiletools.filepicker.extensions.*
import com.simplemobiletools.filepicker.models.FileDirItem
import com.simplemobiletools.filepicker.views.Breadcrumbs
@ -133,7 +133,7 @@ class MainActivity : SimpleActivity(), ItemsFragment.ItemInteractionListener, Br
fun checkStupidAndroidFiveSDCardWritePermission(pickedPath: String): Boolean {
return if (applicationContext.needsStupidWritePermissions(pickedPath) && mConfig.treeUri.isEmpty()) {
WritePermissionDialog(this, object : WritePermissionDialog.OnWritePermissionListener {
WritePermissionDialog(this, object : WritePermissionDialog.OnConfirmedListener {
override fun onConfirmed() {
val intent = Intent(Intent.ACTION_OPEN_DOCUMENT_TREE)
startActivityForResult(intent, OPEN_DOCUMENT_TREE_AND_CHANGE_PATH)

View file

@ -11,6 +11,7 @@ import com.simplemobiletools.filemanager.R
import com.simplemobiletools.filemanager.activities.MainActivity
import com.simplemobiletools.filemanager.asynctasks.CopyTask
import com.simplemobiletools.filepicker.dialogs.FilePickerDialog
import com.simplemobiletools.filepicker.dialogs.WritePermissionDialog
import com.simplemobiletools.filepicker.extensions.*
import kotlinx.android.synthetic.main.copy_item.view.*
import java.io.File
@ -72,7 +73,7 @@ class CopyDialog(val activity: Activity, val files: ArrayList<File>, val copyLis
}
if (context.needsStupidWritePermissions(destinationPath) && config.treeUri.isEmpty()) {
WritePermissionDialog(activity, object : WritePermissionDialog.OnWritePermissionListener {
WritePermissionDialog(activity, object : WritePermissionDialog.OnConfirmedListener {
override fun onConfirmed() {
val intent = Intent(Intent.ACTION_OPEN_DOCUMENT_TREE)
activity.startActivityForResult(intent, MainActivity.OPEN_DOCUMENT_TREE)

View file

@ -1,31 +0,0 @@
package com.simplemobiletools.filemanager.dialogs
import android.content.Context
import android.support.v7.app.AlertDialog
import android.view.LayoutInflater
import com.simplemobiletools.filemanager.R
class WritePermissionDialog(val context: Context, val listener: OnWritePermissionListener) {
var dialog: AlertDialog? = null
init {
val view = LayoutInflater.from(context).inflate(R.layout.dialog_write_permission, null)
dialog = AlertDialog.Builder(context)
.setTitle(context.resources.getString(R.string.confirm_storage_access_title))
.setView(view)
.setPositiveButton(R.string.ok, { dialog, which -> dialogConfirmed() })
.create()
dialog?.show()
}
private fun dialogConfirmed() {
dialog?.dismiss()
listener.onConfirmed()
}
interface OnWritePermissionListener {
fun onConfirmed()
}
}

View file

@ -1,25 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/dialog_holder"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="@dimen/activity_margin">
<TextView
android:id="@+id/dialog_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/activity_margin"
android:text="@string/confirm_storage_access_text"/>
<ImageView
android:id="@+id/dialog_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:scaleType="fitCenter"
android:src="@mipmap/write_storage"/>
</LinearLayout>

View file

@ -39,8 +39,6 @@
<string name="ok">OK</string>
<string name="cancel">Abbrechen</string>
<string name="press_back_again">Drücke erneut zum Schließen</string>
<string name="confirm_storage_access_title">Confirm external storage access</string>
<string name="confirm_storage_access_text">Please choose the root folder of the SD card to grant write access on the next screen</string>
<!-- File and directory properties -->
<string name="name">Name</string>

View file

@ -39,8 +39,6 @@
<string name="ok">OK</string>
<string name="cancel">Annulla</string>
<string name="press_back_again">Premi di nuovo indietro per uscire</string>
<string name="confirm_storage_access_title">Confirm external storage access</string>
<string name="confirm_storage_access_text">Please choose the root folder of the SD card to grant write access on the next screen</string>
<!-- File and directory properties -->
<string name="name">Nome</string>

View file

@ -39,8 +39,6 @@
<string name="ok">OK</string>
<string name="cancel">Cancel</string>
<string name="press_back_again">Press back again to exit</string>
<string name="confirm_storage_access_title">Confirm external storage access</string>
<string name="confirm_storage_access_text">Please choose the root folder of the SD card to grant write access on the next screen</string>
<!-- File and directory properties -->
<string name="name">Name</string>

View file

@ -39,8 +39,6 @@
<string name="ok">OK</string>
<string name="cancel">Cancelar</string>
<string name="press_back_again">prima novamente para sair</string>
<string name="confirm_storage_access_title">Confirmação de acesso ao armazenamento externo</string>
<string name="confirm_storage_access_text">Por favor escolha a pasta raiz do cartão SD para conceder o acesso no próximo ecrã</string>
<!-- File and directory properties -->
<string name="name">Nome</string>

View file

@ -39,8 +39,6 @@
<string name="ok">OK</string>
<string name="cancel">Cancel</string>
<string name="press_back_again">Press back again to exit</string>
<string name="confirm_storage_access_title">Confirm external storage access</string>
<string name="confirm_storage_access_text">Please choose the root folder of the SD card to grant write access on the next screen</string>
<!-- File and directory properties -->
<string name="name">Name</string>

View file

@ -39,8 +39,6 @@
<string name="ok">OK</string>
<string name="cancel">Cancel</string>
<string name="press_back_again">Press back again to exit</string>
<string name="confirm_storage_access_title">Confirm external storage access</string>
<string name="confirm_storage_access_text">Please choose the root folder of the SD card to grant write access on the next screen</string>
<!-- File and directory properties -->
<string name="name">Name</string>