From 351d574b90a7a09c93cae3b0d31c1293e6131cf7 Mon Sep 17 00:00:00 2001 From: Alexander Danilov Date: Fri, 20 Sep 2019 01:42:43 +0300 Subject: [PATCH 1/2] IITCm: use the Android intent resolver when sending screenshots https://developer.android.com/training/sharing/send#using-android-intent-resolver --- .../org/exarhteam/iitc_mobile/share/ShareActivity.java | 9 ++++----- mobile/app/src/main/res/values/strings.xml | 1 + 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mobile/app/src/main/java/org/exarhteam/iitc_mobile/share/ShareActivity.java b/mobile/app/src/main/java/org/exarhteam/iitc_mobile/share/ShareActivity.java index d1cf4baa8..2048d80f7 100644 --- a/mobile/app/src/main/java/org/exarhteam/iitc_mobile/share/ShareActivity.java +++ b/mobile/app/src/main/java/org/exarhteam/iitc_mobile/share/ShareActivity.java @@ -35,11 +35,10 @@ public static Intent forFile(final Context context, final File file, final Strin final Uri uri = Build.VERSION.SDK_INT >= Build.VERSION_CODES.N ? FileProvider.getUriForFile(context, BuildConfig.APPLICATION_ID + ".provider", file) : Uri.fromFile(file); - return new Intent(context, ShareActivity.class) - .putExtra(EXTRA_TYPE, TYPE_FILE) - .putExtra("uri", uri) - .putExtra("type", type) - .addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); + return new Intent().setAction(Intent.ACTION_SEND) + .putExtra(Intent.EXTRA_STREAM, uri) + .addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) + .setType(type); } public static Intent forPosition(final Context context, final double lat, final double lng, final int zoom, diff --git a/mobile/app/src/main/res/values/strings.xml b/mobile/app/src/main/res/values/strings.xml index 334142e6c..df6e56a1e 100644 --- a/mobile/app/src/main/res/values/strings.xml +++ b/mobile/app/src/main/res/values/strings.xml @@ -174,5 +174,6 @@ Be careful: Javascript from external sources may contain harmful code (spyware etc.)!

Are you sure you want to proceed?]]> + Send to... From 84eb4400262889c1a260ee6c8dcec2932e9dc17e Mon Sep 17 00:00:00 2001 From: johndoe Date: Sat, 21 Sep 2019 18:59:27 +0300 Subject: [PATCH 2/2] IITCm: use the Android Sharesheet when sending screenshots https://developer.android.com/training/sharing/send#using-android-system-sharesheet --- .../java/org/exarhteam/iitc_mobile/share/ShareActivity.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mobile/app/src/main/java/org/exarhteam/iitc_mobile/share/ShareActivity.java b/mobile/app/src/main/java/org/exarhteam/iitc_mobile/share/ShareActivity.java index 2048d80f7..10f2e4d94 100644 --- a/mobile/app/src/main/java/org/exarhteam/iitc_mobile/share/ShareActivity.java +++ b/mobile/app/src/main/java/org/exarhteam/iitc_mobile/share/ShareActivity.java @@ -35,10 +35,12 @@ public static Intent forFile(final Context context, final File file, final Strin final Uri uri = Build.VERSION.SDK_INT >= Build.VERSION_CODES.N ? FileProvider.getUriForFile(context, BuildConfig.APPLICATION_ID + ".provider", file) : Uri.fromFile(file); - return new Intent().setAction(Intent.ACTION_SEND) + Intent shareIntent = new Intent().setAction(Intent.ACTION_SEND) .putExtra(Intent.EXTRA_STREAM, uri) .addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) .setType(type); + String title = context.getString(R.string.send_to); + return Intent.createChooser(shareIntent, title); } public static Intent forPosition(final Context context, final double lat, final double lng, final int zoom,