From a7742103e13d54d66260e9cbed69ee5eda5e26db Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Tue, 24 Oct 2017 00:17:15 +0900 Subject: [PATCH] Grant write permission when sharing stignore file --- .../com/nutomic/syncthingandroid/activities/FolderActivity.java | 2 ++ .../java/com/nutomic/syncthingandroid/views/FoldersAdapter.java | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/nutomic/syncthingandroid/activities/FolderActivity.java b/src/main/java/com/nutomic/syncthingandroid/activities/FolderActivity.java index 72dc3bf8..511f090c 100644 --- a/src/main/java/com/nutomic/syncthingandroid/activities/FolderActivity.java +++ b/src/main/java/com/nutomic/syncthingandroid/activities/FolderActivity.java @@ -187,6 +187,8 @@ public class FolderActivity extends SyncthingActivity Intent intent = new Intent(Intent.ACTION_EDIT); Uri uri = Uri.fromFile(ignoreFile); intent.setDataAndType(uri, "text/plain"); + intent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION); + startActivity(intent); } catch (IOException e) { Log.w(TAG, e); diff --git a/src/main/java/com/nutomic/syncthingandroid/views/FoldersAdapter.java b/src/main/java/com/nutomic/syncthingandroid/views/FoldersAdapter.java index 48aefc50..03ff67a1 100644 --- a/src/main/java/com/nutomic/syncthingandroid/views/FoldersAdapter.java +++ b/src/main/java/com/nutomic/syncthingandroid/views/FoldersAdapter.java @@ -53,7 +53,7 @@ public class FoldersAdapter extends ArrayAdapter { binding.openFolder.setOnClickListener(v -> { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(new File(folder.path)), "resource/folder"); - intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + intent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_ACTIVITY_NEW_TASK); if (intent.resolveActivity(getContext().getPackageManager()) != null) { getContext().startActivity(intent); } else {