Something wrong with new Share Button
Definitely my fault in #391 - but not sure what I've done wrong. Can't seem to reproduce bug in simulator or on any of my phones :/

If I can't fix this **very** soon we should revert to old one for the time being until we can test for this problem.

Some logs from google groups:

```
USER_COMMENT=Viewing an old uploaded image
ANDROID_VERSION=6.0.1
APP_VERSION_NAME=2.0
BRAND=motorola
PHONE_MODEL=XT1562
CUSTOM_DATA=
STACK_TRACE=java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.widget.ShareActionProvider.setShareIntent(android.content.Intent)' on a null object reference
at fr.free.nrw.commons.media.MediaDetailPagerFragment.onCreateOptionsMenu(MediaDetailPagerFragment.java:228)
at android.support.v4.app.Fragment.performCreateOptionsMenu(Fragment.java:2186)
at android.support.v4.app.FragmentManagerImpl.dispatchCreateOptionsMenu(FragmentManager.java:2250)
at android.support.v4.app.FragmentController.dispatchCreateOptionsMenu(FragmentController.java:328)
at android.support.v4.app.FragmentActivity.onCreatePanelMenu(FragmentActivity.java:363)
at android.support.v7.view.WindowCallbackWrapper.onCreatePanelMenu(WindowCallbackWrapper.java:92)
at android.support.v7.app.AppCompatDelegateImplBase$AppCompatWindowCallbackBase.onCreatePanelMenu(AppCompatDelegateImplBase.java:331)
at android.support.v7.app.AppCompatDelegateImplV9.preparePanel(AppCompatDelegateImplV9.java:1357)
at android.support.v7.app.AppCompatDelegateImplV9.doInvalidatePanelMenu(AppCompatDelegateImplV9.java:1637)
at android.support.v7.app.AppCompatDelegateImplV9$1.run(AppCompatDelegateImplV9.java:129)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858)
at android.view.Choreographer.doCallbacks(Choreographer.java:670)
at android.view.Choreographer.doFrame(Choreographer.java:603)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
at android.os.Handler.handleCallback(Handler.java:746)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5443)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
```

```
USER_COMMENT=
ANDROID_VERSION=5.1
APP_VERSION_NAME=2.0
BRAND=Meizu
PHONE_MODEL=m3 note
CUSTOM_DATA=
STACK_TRACE=java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.widget.ShareActionProvider.setShareIntent(android.content.Intent)' on a null object reference
at fr.free.nrw.commons.media.MediaDetailPagerFragment.onCreateOptionsMenu(MediaDetailPagerFragment.java:228)
at android.support.v4.app.Fragment.performCreateOptionsMenu(Fragment.java:2186)
at android.support.v4.app.FragmentManagerImpl.dispatchCreateOptionsMenu(FragmentManager.java:2250)
at android.support.v4.app.FragmentController.dispatchCreateOptionsMenu(FragmentController.java:328)
at android.support.v4.app.FragmentActivity.onCreatePanelMenu(FragmentActivity.java:363)
at android.support.v7.view.WindowCallbackWrapper.onCreatePanelMenu(WindowCallbackWrapper.java:92)
at android.support.v7.app.AppCompatDelegateImplBase$AppCompatWindowCallbackBase.onCreatePanelMenu(AppCompatDelegateImplBase.java:331)
at android.support.v7.app.AppCompatDelegateImplV9.preparePanel(AppCompatDelegateImplV9.java:1357)
at android.support.v7.app.AppCompatDelegateImplV9.doInvalidatePanelMenu(AppCompatDelegateImplV9.java:1637)
at android.support.v7.app.AppCompatDelegateImplV9$1.run(AppCompatDelegateImplV9.java:129)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:800)
at android.view.Choreographer.doCallbacks(Choreographer.java:603)
at android.view.Choreographer.doFrame(Choreographer.java:571)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:786)
at android.os.Handler.handleCallback(Handler.java:815)
at android.os.Handler.dispatchMessage(Handler.java:104)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5879)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1119)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:885)
```

```
USER_COMMENT=I just watching my uploads
ANDROID_VERSION=5.1
APP_VERSION_NAME=2.0
BRAND=TCL
PHONE_MODEL=5015A


CUSTOM_DATA=
STACK_TRACE=java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.widget.ShareActionProvider.setShareIntent(android.content.Intent)' on a null object reference
at fr.free.nrw.commons.media.MediaDetailPagerFragment.onCreateOptionsMenu(MediaDetailPagerFragment.java:228)
at android.support.v4.app.Fragment.performCreateOptionsMenu(Fragment.java:2186)
at android.support.v4.app.FragmentManagerImpl.dispatchCreateOptionsMenu(FragmentManager.java:2250)
at android.support.v4.app.FragmentController.dispatchCreateOptionsMenu(FragmentController.java:328)
at android.support.v4.app.FragmentActivity.onCreatePanelMenu(FragmentActivity.java:363)
at android.support.v7.view.WindowCallbackWrapper.onCreatePanelMenu(WindowCallbackWrapper.java:92)
at android.support.v7.app.AppCompatDelegateImplBase$AppCompatWindowCallbackBase.onCreatePanelMenu(AppCompatDelegateImplBase.java:331)
at android.support.v7.app.AppCompatDelegateImplV9.preparePanel(AppCompatDelegateImplV9.java:1357)
at android.support.v7.app.AppCompatDelegateImplV9.doInvalidatePanelMenu(AppCompatDelegateImplV9.java:1637)
at android.support.v7.app.AppCompatDelegateImplV9$1.run(AppCompatDelegateImplV9.java:129)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:800)
at android.view.Choreographer.doCallbacks(Choreographer.java:603)
at android.view.Choreographer.doFrame(Choreographer.java:571)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:786)
at android.os.Handler.handleCallback(Handler.java:815)
at android.os.Handler.dispatchMessage(Handler.java:104)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5631)

at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:959)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)
```

```
USER_COMMENT=tapping on a picture in the overview
ANDROID_VERSION=7.1.1
APP_VERSION_NAME=2.0
BRAND=google
PHONE_MODEL=Nexus 5X

CUSTOM_DATA=
STACK_TRACE=java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.widget.ShareActionProvider.setShareIntent(android.content.Intent)' on a null object reference
at fr.free.nrw.commons.media.MediaDetailPagerFragment.onCreateOptionsMenu(MediaDetailPagerFragment.java:228)
at android.support.v4.app.Fragment.performCreateOptionsMenu(Fragment.java:2186)
at android.support.v4.app.FragmentManagerImpl.dispatchCreateOptionsMenu(FragmentManager.java:2250)
at android.support.v4.app.FragmentController.dispatchCreateOptionsMenu(FragmentController.java:328)
at android.support.v4.app.FragmentActivity.onCreatePanelMenu(FragmentActivity.java:363)
at android.support.v7.view.WindowCallbackWrapper.onCreatePanelMenu(WindowCallbackWrapper.java:92)
at android.support.v7.app.AppCompatDelegateImplBase$AppCompatWindowCallbackBase.onCreatePanelMenu(AppCompatDelegateImplBase.java:331)
at android.support.v7.app.AppCompatDelegateImplV9.preparePanel(AppCompatDelegateImplV9.java:1357)
at android.support.v7.app.AppCompatDelegateImplV9.doInvalidatePanelMenu(AppCompatDelegateImplV9.java:1637)
at android.support.v7.app.AppCompatDelegateImplV9$1.run(AppCompatDelegateImplV9.java:129)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:874)
at android.view.Choreographer.doCallbacks(Choreographer.java:686)
at android.view.Choreographer.doFrame(Choreographer.java:618)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:860)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
```
diff --git a/app/proguard-rules.txt b/app/proguard-rules.txt
index e00d3ce50..bbf3a3f0d 100644
--- a/app/proguard-rules.txt
+++ b/app/proguard-rules.txt
@@ -2,3 +2,4 @@
 -keep class org.apache.http.** { *; }
 -dontwarn org.apache.http.**
 -keep class fr.free.nrw.commons.upload.MwVolleyApi$Page {*;}
+-keep class android.support.v7.widget.ShareActionProvider { *; }
\ No newline at end of file
diff --git a/app/src/main/java/fr/free/nrw/commons/media/MediaDetailPagerFragment.java b/app/src/main/java/fr/free/nrw/commons/media/MediaDetailPagerFragment.java
index 260338680..ffe93edc6 100644
--- a/app/src/main/java/fr/free/nrw/commons/media/MediaDetailPagerFragment.java
+++ b/app/src/main/java/fr/free/nrw/commons/media/MediaDetailPagerFragment.java
@@ -222,10 +222,14 @@ public class MediaDetailPagerFragment extends Fragment implements ViewPager.OnPa
 
                     // Set ShareActionProvider Intent
                     ShareActionProvider mShareActionProvider = (ShareActionProvider) MenuItemCompat.getActionProvider(menu.findItem(R.id.menu_share_current_image));
-                    Intent shareIntent = new Intent(Intent.ACTION_SEND);
-                    shareIntent.setType("text/plain");
-                    shareIntent.putExtra(Intent.EXTRA_TEXT, m.getDisplayTitle() + " \n" + m.getDescriptionUrl());
-                    mShareActionProvider.setShareIntent(shareIntent);
+                    // On some phones null is returned for some reason:
+                    // https://github.com/commons-app/apps-android-commons/issues/413
+                    if(mShareActionProvider != null) {
+                        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) {
                         Contribution c = (Contribution)m;
diff --git a/app/src/main/res/menu/fragment_image_detail.xml b/app/src/main/res/menu/fragment_image_detail.xml
index ff040dae5..2d0d2a299 100644
--- a/app/src/main/res/menu/fragment_image_detail.xml
+++ b/app/src/main/res/menu/fragment_image_detail.xml
@@ -6,7 +6,7 @@
         android:id="@+id/menu_share_current_image"
         app:actionProviderClass="android.support.v7.widget.ShareActionProvider"
         android:title="@string/menu_share"
-        app:showAsAction="ifRoom|withText" />
+        app:showAsAction="ifRoom" />
     <item
         android:id="@+id/menu_browser_current_image"
         android:title="@string/menu_open_in_browser"
['app/src/main/java/fr/free/nrw/commons/media/MediaDetailPagerFragment.java', 'app/src/main/res/menu/fragment_image_detail.xml', 'app/proguard-rules.txt']