1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2024-12-23 19:31:30 +00:00

Grant write permission when sharing stignore file

This commit is contained in:
Felix Ableitner 2017-10-24 00:17:15 +09:00
parent fa49c796ae
commit a7742103e1
2 changed files with 3 additions and 1 deletions

View file

@ -187,6 +187,8 @@ public class FolderActivity extends SyncthingActivity
Intent intent = new Intent(Intent.ACTION_EDIT); Intent intent = new Intent(Intent.ACTION_EDIT);
Uri uri = Uri.fromFile(ignoreFile); Uri uri = Uri.fromFile(ignoreFile);
intent.setDataAndType(uri, "text/plain"); intent.setDataAndType(uri, "text/plain");
intent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
startActivity(intent); startActivity(intent);
} catch (IOException e) { } catch (IOException e) {
Log.w(TAG, e); Log.w(TAG, e);

View file

@ -53,7 +53,7 @@ public class FoldersAdapter extends ArrayAdapter<Folder> {
binding.openFolder.setOnClickListener(v -> { binding.openFolder.setOnClickListener(v -> {
Intent intent = new Intent(Intent.ACTION_VIEW); Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(new File(folder.path)), "resource/folder"); 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) { if (intent.resolveActivity(getContext().getPackageManager()) != null) {
getContext().startActivity(intent); getContext().startActivity(intent);
} else { } else {