mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +01:00
Merge pull request #414 from domdomegg/temp-share-413
Check ShareActionprovider is not null
This commit is contained in:
commit
5ca53e7a58
3 changed files with 10 additions and 5 deletions
|
|
@ -2,3 +2,4 @@
|
||||||
-keep class org.apache.http.** { *; }
|
-keep class org.apache.http.** { *; }
|
||||||
-dontwarn org.apache.http.**
|
-dontwarn org.apache.http.**
|
||||||
-keep class fr.free.nrw.commons.upload.MwVolleyApi$Page {*;}
|
-keep class fr.free.nrw.commons.upload.MwVolleyApi$Page {*;}
|
||||||
|
-keep class android.support.v7.widget.ShareActionProvider { *; }
|
||||||
|
|
@ -222,10 +222,14 @@ public class MediaDetailPagerFragment extends Fragment implements ViewPager.OnPa
|
||||||
|
|
||||||
// Set ShareActionProvider Intent
|
// Set ShareActionProvider Intent
|
||||||
ShareActionProvider mShareActionProvider = (ShareActionProvider) MenuItemCompat.getActionProvider(menu.findItem(R.id.menu_share_current_image));
|
ShareActionProvider mShareActionProvider = (ShareActionProvider) MenuItemCompat.getActionProvider(menu.findItem(R.id.menu_share_current_image));
|
||||||
Intent shareIntent = new Intent(Intent.ACTION_SEND);
|
// On some phones null is returned for some reason:
|
||||||
shareIntent.setType("text/plain");
|
// https://github.com/commons-app/apps-android-commons/issues/413
|
||||||
shareIntent.putExtra(Intent.EXTRA_TEXT, m.getDisplayTitle() + " \n" + m.getDescriptionUrl());
|
if(mShareActionProvider != null) {
|
||||||
mShareActionProvider.setShareIntent(shareIntent);
|
Intent shareIntent = new Intent(Intent.ACTION_SEND);
|
||||||
|
shareIntent.setType("text/plain");
|
||||||
|
shareIntent.putExtra(Intent.EXTRA_TEXT, m.getDisplayTitle() + " \n" + m.getDescriptionUrl());
|
||||||
|
mShareActionProvider.setShareIntent(shareIntent);
|
||||||
|
}
|
||||||
|
|
||||||
if(m instanceof Contribution) {
|
if(m instanceof Contribution) {
|
||||||
Contribution c = (Contribution)m;
|
Contribution c = (Contribution)m;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
android:id="@+id/menu_share_current_image"
|
android:id="@+id/menu_share_current_image"
|
||||||
app:actionProviderClass="android.support.v7.widget.ShareActionProvider"
|
app:actionProviderClass="android.support.v7.widget.ShareActionProvider"
|
||||||
android:title="@string/menu_share"
|
android:title="@string/menu_share"
|
||||||
app:showAsAction="ifRoom|withText" />
|
app:showAsAction="ifRoom" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/menu_browser_current_image"
|
android:id="@+id/menu_browser_current_image"
|
||||||
android:title="@string/menu_open_in_browser"
|
android:title="@string/menu_open_in_browser"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue