diff options
author | Christian Schneppe <christian@pix-art.de> | 2018-07-09 21:15:56 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2018-07-09 21:15:56 +0200 |
commit | 71afe8ed86449aeb3795cef48fe815fd23e388d4 (patch) | |
tree | 32f660fe5bde6ef5e3aefe5a2f9cee557ed2dd81 /src/main/java/de/pixart/messenger/ui/ConversationFragment.java | |
parent | 3ac56bcbdb27be63275c00a60eef32cdd985c827 (diff) |
restart file observer when permisson are granted
Diffstat (limited to 'src/main/java/de/pixart/messenger/ui/ConversationFragment.java')
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/ConversationFragment.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java index fa2ba5327..2458e4967 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java @@ -566,6 +566,15 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke return true; } + private static boolean writeGranted(int[] grantResults, String[] permission) { + for (int i = 0; i < grantResults.length; ++i) { + if (Manifest.permission.WRITE_EXTERNAL_STORAGE.equals(permission[i])) { + return grantResults[i] == PackageManager.PERMISSION_GRANTED; + } + } + return false; + } + private static String getFirstDenied(int[] grantResults, String[] permissions) { for (int i = 0; i < grantResults.length; ++i) { if (grantResults[i] == PackageManager.PERMISSION_DENIED) { @@ -1618,6 +1627,11 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke Toast.makeText(getActivity(), res, Toast.LENGTH_SHORT).show(); } } + if (writeGranted(grantResults, permissions)) { + if (activity != null && activity.xmppConnectionService != null) { + activity.xmppConnectionService.restartFileObserver(); + } + } } public void startDownloadable(Message message) { |