add an image about the Kitkat new write permission thing

This commit is contained in:
tibbi 2016-11-05 22:07:04 +01:00
parent 479c3c6c4e
commit 44e268b441
14 changed files with 74 additions and 2 deletions

View file

@ -14,6 +14,7 @@ import android.view.MenuItem
import com.simplemobiletools.filemanager.Constants
import com.simplemobiletools.filemanager.R
import com.simplemobiletools.filemanager.Utils
import com.simplemobiletools.filemanager.dialogs.WritePermissionDialog
import com.simplemobiletools.filemanager.fragments.ItemsFragment
import com.simplemobiletools.filepicker.dialogs.StoragePickerDialog
import com.simplemobiletools.filepicker.extensions.getInternalStoragePath
@ -137,8 +138,12 @@ class MainActivity : SimpleActivity(), ItemsFragment.ItemInteractionListener, Br
fun checkStupidAndroidFiveSDCardWritePermission(pickedPath: String): Boolean {
val file = File(pickedPath)
return if (!file.canWrite() && Utils.needsStupidWritePermissions(applicationContext, pickedPath) && mConfig.treeUri.isEmpty()) {
val intent = Intent(Intent.ACTION_OPEN_DOCUMENT_TREE)
startActivityForResult(intent, OPEN_DOCUMENT_TREE)
WritePermissionDialog(this, object: WritePermissionDialog.OnWritePermissionListener {
override fun onConfirmed() {
val intent = Intent(Intent.ACTION_OPEN_DOCUMENT_TREE)
startActivityForResult(intent, OPEN_DOCUMENT_TREE)
}
})
false
} else
true

View file

@ -0,0 +1,31 @@
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.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

@ -0,0 +1,24 @@
<?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:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="fitCenter"
android:adjustViewBounds="true"
android:src="@mipmap/write_storage"/>
</LinearLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

View file

@ -37,6 +37,8 @@
<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

@ -37,6 +37,8 @@
<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

@ -37,6 +37,8 @@
<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

@ -37,6 +37,8 @@
<string name="ok">OK</string>
<string name="cancel">Cancelar</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">Nome</string>

View file

@ -37,6 +37,8 @@
<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

@ -37,6 +37,8 @@
<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>