add some things related to kitkat sdcard write permissions

This commit is contained in:
tibbi 2016-11-06 16:26:25 +01:00
parent 165cff24e6
commit 4f74709774
16 changed files with 79 additions and 0 deletions

View file

@ -110,4 +110,12 @@ public class Config {
public void setAutoplayVideos(boolean autoplay) { public void setAutoplayVideos(boolean autoplay) {
mPrefs.edit().putBoolean(Constants.AUTOPLAY_VIDEOS, autoplay).apply(); mPrefs.edit().putBoolean(Constants.AUTOPLAY_VIDEOS, autoplay).apply();
} }
public String getTreeUri() {
return mPrefs.getString(Constants.TREE_URI, "");
}
public void setTreeUri(String uri) {
mPrefs.edit().putString(Constants.TREE_URI, uri).apply();
}
} }

View file

@ -18,6 +18,7 @@ public class Constants {
public static final String HIDDEN_FOLDERS = "hidden_folders"; public static final String HIDDEN_FOLDERS = "hidden_folders";
public static final String SHOW_HIDDEN_FOLDERS = "show_hidden_folders"; public static final String SHOW_HIDDEN_FOLDERS = "show_hidden_folders";
public static final String AUTOPLAY_VIDEOS = "autoplay_videos"; public static final String AUTOPLAY_VIDEOS = "autoplay_videos";
public static final String TREE_URI = "tree_uri";
// sorting // sorting
public static final int SORT_BY_NAME = 1; public static final int SORT_BY_NAME = 1;

View file

@ -0,0 +1,31 @@
package com.simplemobiletools.gallery.dialogs
import android.content.Context
import android.support.v7.app.AlertDialog
import android.view.LayoutInflater
import com.simplemobiletools.gallery.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

@ -0,0 +1,25 @@
<?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>

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

@ -35,6 +35,8 @@
<string name="hide_folder">Ordner verstecken</string> <string name="hide_folder">Ordner verstecken</string>
<string name="unhide_folder">Ordner sichtbar machen</string> <string name="unhide_folder">Ordner sichtbar machen</string>
<string name="hidden">(versteckt)</string> <string name="hidden">(versteckt)</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>
<plurals name="folders_deleted"> <plurals name="folders_deleted">
<item quantity="one">1 Ordner gelöscht</item> <item quantity="one">1 Ordner gelöscht</item>

View file

@ -35,6 +35,8 @@
<string name="hide_folder">Hide folder</string> <string name="hide_folder">Hide folder</string>
<string name="unhide_folder">Unhide folder</string> <string name="unhide_folder">Unhide folder</string>
<string name="hidden">(hidden)</string> <string name="hidden">(hidden)</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>
<plurals name="folders_deleted"> <plurals name="folders_deleted">
<item quantity="one">1 carpeta eliminada</item> <item quantity="one">1 carpeta eliminada</item>

View file

@ -35,6 +35,8 @@
<string name="hide_folder">Hide folder</string> <string name="hide_folder">Hide folder</string>
<string name="unhide_folder">Unhide folder</string> <string name="unhide_folder">Unhide folder</string>
<string name="hidden">(hidden)</string> <string name="hidden">(hidden)</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>
<plurals name="folders_deleted"> <plurals name="folders_deleted">
<item quantity="one">1 cartella eliminata</item> <item quantity="one">1 cartella eliminata</item>

View file

@ -35,6 +35,8 @@
<string name="hide_folder">Hide folder</string> <string name="hide_folder">Hide folder</string>
<string name="unhide_folder">Unhide folder</string> <string name="unhide_folder">Unhide folder</string>
<string name="hidden">(hidden)</string> <string name="hidden">(hidden)</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>
<plurals name="folders_deleted"> <plurals name="folders_deleted">
<item quantity="one">1 フォルダーを削除しました</item> <item quantity="one">1 フォルダーを削除しました</item>

View file

@ -35,6 +35,8 @@
<string name="hide_folder">Hide folder</string> <string name="hide_folder">Hide folder</string>
<string name="unhide_folder">Unhide folder</string> <string name="unhide_folder">Unhide folder</string>
<string name="hidden">(hidden)</string> <string name="hidden">(hidden)</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>
<plurals name="folders_deleted"> <plurals name="folders_deleted">
<item quantity="one">1 pasta eliminada</item> <item quantity="one">1 pasta eliminada</item>

View file

@ -35,6 +35,8 @@
<string name="hide_folder">Hide folder</string> <string name="hide_folder">Hide folder</string>
<string name="unhide_folder">Unhide folder</string> <string name="unhide_folder">Unhide folder</string>
<string name="hidden">(hidden)</string> <string name="hidden">(hidden)</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>
<plurals name="folders_deleted"> <plurals name="folders_deleted">
<item quantity="one">1 mapp borttagen</item> <item quantity="one">1 mapp borttagen</item>

View file

@ -35,6 +35,8 @@
<string name="hide_folder">Hide folder</string> <string name="hide_folder">Hide folder</string>
<string name="unhide_folder">Unhide folder</string> <string name="unhide_folder">Unhide folder</string>
<string name="hidden">(hidden)</string> <string name="hidden">(hidden)</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>
<plurals name="folders_deleted"> <plurals name="folders_deleted">
<item quantity="one">1 folder deleted</item> <item quantity="one">1 folder deleted</item>