1
0
Fork 0
mirror of https://github.com/gsantner/dandelion synced 2024-11-22 12:22:08 +01:00

Get title for image sharing dialog from resources instead of using hardcoded string. Also do not show multiple permission dialogs stacked

This commit is contained in:
vanitasvitae 2016-10-02 12:55:05 +02:00
parent 036457117c
commit 7ee5e0f39b

View file

@ -141,11 +141,12 @@ public class ContextMenuWebView extends NestedWebView {
}) })
.setNegativeButton(context.getText(android.R.string.no), null) .setNegativeButton(context.getText(android.R.string.no), null)
.show(); .show();
} } else {
parentActivity.requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, parentActivity.requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
MainActivity.REQUEST_CODE__ACCESS_EXTERNAL_STORAGE); MainActivity.REQUEST_CODE__ACCESS_EXTERNAL_STORAGE);
} }
} }
}
if (writeToStoragePermitted) { if (writeToStoragePermitted) {
final Uri local = Uri.parse(Environment.getExternalStorageDirectory() + "/Pictures/Diaspora/" + System.currentTimeMillis() + ".png"); final Uri local = Uri.parse(Environment.getExternalStorageDirectory() + "/Pictures/Diaspora/" + System.currentTimeMillis() + ".png");
new ImageDownloadTask(null, local.getPath()) { new ImageDownloadTask(null, local.getPath()) {
@ -157,7 +158,7 @@ public class ContextMenuWebView extends NestedWebView {
sharingIntent.putExtra(Intent.EXTRA_STREAM, myUri); sharingIntent.putExtra(Intent.EXTRA_STREAM, myUri);
sharingIntent.setType("image/png"); sharingIntent.setType("image/png");
sharingIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); sharingIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
context.startActivity(Intent.createChooser(sharingIntent, "Share image using")); context.startActivity(Intent.createChooser(sharingIntent, getResources().getString(R.string.action_share_dotdotdot)));
} }
}.execute(url); }.execute(url);
} }