From 8d3b54b661879e311ab2ab72d1f9bb89f6ef772a Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 12 Nov 2016 15:45:55 +0100 Subject: [PATCH] remove the custom write permissions dialog --- .../filemanager/activities/MainActivity.kt | 4 +-- .../filemanager/dialogs/CopyDialog.kt | 3 +- .../dialogs/WritePermissionDialog.kt | 31 ------------------- .../res/layout/dialog_write_permission.xml | 25 --------------- app/src/main/res/values-de/strings.xml | 2 -- app/src/main/res/values-it/strings.xml | 2 -- app/src/main/res/values-ja/strings.xml | 2 -- app/src/main/res/values-pt-rPT/strings.xml | 2 -- app/src/main/res/values-sv/strings.xml | 2 -- app/src/main/res/values/strings.xml | 2 -- 10 files changed, 4 insertions(+), 71 deletions(-) delete mode 100644 app/src/main/kotlin/com/simplemobiletools/filemanager/dialogs/WritePermissionDialog.kt delete mode 100644 app/src/main/res/layout/dialog_write_permission.xml diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/activities/MainActivity.kt index 5c42021c..36dfd2b7 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/activities/MainActivity.kt @@ -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) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/dialogs/CopyDialog.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/dialogs/CopyDialog.kt index a08c5b3d..cbb93f00 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/dialogs/CopyDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/dialogs/CopyDialog.kt @@ -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, 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) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/dialogs/WritePermissionDialog.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/dialogs/WritePermissionDialog.kt deleted file mode 100644 index ca0f9c8d..00000000 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/dialogs/WritePermissionDialog.kt +++ /dev/null @@ -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() - } -} diff --git a/app/src/main/res/layout/dialog_write_permission.xml b/app/src/main/res/layout/dialog_write_permission.xml deleted file mode 100644 index 5cb3ae03..00000000 --- a/app/src/main/res/layout/dialog_write_permission.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 3552156e..4c36956e 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -39,8 +39,6 @@ OK Abbrechen Drücke erneut zum Schließen - Confirm external storage access - Please choose the root folder of the SD card to grant write access on the next screen Name diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index a5a0c104..4f72555c 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -39,8 +39,6 @@ OK Annulla Premi di nuovo indietro per uscire - Confirm external storage access - Please choose the root folder of the SD card to grant write access on the next screen Nome diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 597331e9..e26d981f 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -39,8 +39,6 @@ OK Cancel Press back again to exit - Confirm external storage access - Please choose the root folder of the SD card to grant write access on the next screen Name diff --git a/app/src/main/res/values-pt-rPT/strings.xml b/app/src/main/res/values-pt-rPT/strings.xml index 64d191a6..27bf2638 100644 --- a/app/src/main/res/values-pt-rPT/strings.xml +++ b/app/src/main/res/values-pt-rPT/strings.xml @@ -39,8 +39,6 @@ OK Cancelar prima novamente para sair - Confirmação de acesso ao armazenamento externo - Por favor escolha a pasta raiz do cartão SD para conceder o acesso no próximo ecrã Nome diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 779c13f3..b2e236cd 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -39,8 +39,6 @@ OK Cancel Press back again to exit - Confirm external storage access - Please choose the root folder of the SD card to grant write access on the next screen Name diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 948893f5..806752ae 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -39,8 +39,6 @@ OK Cancel Press back again to exit - Confirm external storage access - Please choose the root folder of the SD card to grant write access on the next screen Name