mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-19 22:39:18 +01:00
Trying to give write permissions on SD card
This commit is contained in:
parent
6846ce5bfb
commit
a81f6c3ac4
@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.ui.setting;
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.preference.Preference;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
@ -61,6 +62,13 @@ public class SettingsDownloadsFragment extends SettingsNestedFragment {
|
||||
if (requestCode == DOWNLOAD_DIR_CODE && resultCode == Activity.RESULT_OK) {
|
||||
Uri uri = data.getData();
|
||||
preferences.setDownloadsDirectory(uri.getPath());
|
||||
|
||||
// Persist access permissions.
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
getActivity().getContentResolver().takePersistableUriPermission(uri,
|
||||
Intent.FLAG_GRANT_READ_URI_PERMISSION |
|
||||
Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user