jenkins-bot has submitted this change and it was merged.

Change subject: Fix custom overflow button when it's shown from the real 
overflow menu.
......................................................................


Fix custom overflow button when it's shown from the real overflow menu.

...also remove the hacky long-press handling from the overflow button,
since we now have a title for it.

Bug: T145911
Change-Id: Iaec085445e2f840a90704f2a42a0b9c4f26f95cd
---
M app/src/main/java/org/wikipedia/MainActivity.java
M app/src/main/java/org/wikipedia/MainFragment.java
M app/src/main/java/org/wikipedia/feed/FeedFragment.java
3 files changed, 10 insertions(+), 36 deletions(-)

Approvals:
  BearND: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/app/src/main/java/org/wikipedia/MainActivity.java 
b/app/src/main/java/org/wikipedia/MainActivity.java
index ea35ded..2e1e14e 100644
--- a/app/src/main/java/org/wikipedia/MainActivity.java
+++ b/app/src/main/java/org/wikipedia/MainActivity.java
@@ -3,7 +3,6 @@
 import android.content.Context;
 import android.content.Intent;
 import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
 import android.view.View;
 
 import org.wikipedia.activity.SingleFragmentActivityWithToolbar;
@@ -47,10 +46,11 @@
         }
     }
 
-    @Nullable
+    @NonNull
     @Override
-    public View getOverflowMenuButton() {
-        return getToolbar().findViewById(R.id.menu_overflow_button);
+    public View getOverflowMenuAnchor() {
+        View view = getToolbar().findViewById(R.id.menu_overflow_button);
+        return view == null ? getToolbar() : view;
     }
 
     @Override
diff --git a/app/src/main/java/org/wikipedia/MainFragment.java 
b/app/src/main/java/org/wikipedia/MainFragment.java
index 73e486d..fc2159f 100644
--- a/app/src/main/java/org/wikipedia/MainFragment.java
+++ b/app/src/main/java/org/wikipedia/MainFragment.java
@@ -79,7 +79,7 @@
         void onTabChanged(@NonNull NavTab tab);
         void onSearchOpen();
         void onSearchClose(boolean shouldFinishActivity);
-        @Nullable View getOverflowMenuButton();
+        @Nullable View getOverflowMenuAnchor();
     }
 
     public static MainFragment newInstance() {
@@ -258,11 +258,11 @@
                 Constants.ACTIVITY_REQUEST_GALLERY);
     }
 
-    @Nullable
+    @NonNull
     @Override
-    public View getOverflowMenuButton() {
+    public View getOverflowMenuAnchor() {
         Callback callback = callback();
-        return callback == null ? null : callback.getOverflowMenuButton();
+        return callback == null ? viewPager : callback.getOverflowMenuAnchor();
     }
 
     @Override public void onLoading() {
diff --git a/app/src/main/java/org/wikipedia/feed/FeedFragment.java 
b/app/src/main/java/org/wikipedia/feed/FeedFragment.java
index 3195a70..79b093c 100644
--- a/app/src/main/java/org/wikipedia/feed/FeedFragment.java
+++ b/app/src/main/java/org/wikipedia/feed/FeedFragment.java
@@ -69,7 +69,7 @@
         void onFeedShareImage(FeaturedImageCard card);
         void onFeedDownloadImage(FeaturedImage image);
         void onFeaturedImageSelected(FeaturedImageCard card);
-        @Nullable View getOverflowMenuButton();
+        @NonNull View getOverflowMenuAnchor();
     }
 
     @NonNull public static FeedFragment newInstance() {
@@ -140,12 +140,6 @@
     public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
         super.onCreateOptionsMenu(menu, inflater);
         inflater.inflate(R.menu.menu_feed, menu);
-        swipeRefreshLayout.post(new Runnable() {
-            @Override
-            public void run() {
-                setUpOverflowButton();
-            }
-        });
     }
 
     @Override
@@ -180,10 +174,7 @@
                 if (callback == null) {
                     return false;
                 }
-                View overflowButton = callback.getOverflowMenuButton();
-                if (overflowButton != null) {
-                    showOverflowMenu(overflowButton);
-                }
+                showOverflowMenu(callback.getOverflowMenuAnchor());
                 return true;
             default:
                 return super.onOptionsItemSelected(item);
@@ -306,23 +297,6 @@
             }
         });
         snackbar.show();
-    }
-
-    private void setUpOverflowButton() {
-        Callback callback = getCallback();
-        if (callback == null) {
-            return;
-        }
-        View overflowButton = callback.getOverflowMenuButton();
-        if (overflowButton != null) {
-            overflowButton.setOnLongClickListener(new 
View.OnLongClickListener() {
-                @Override
-                public boolean onLongClick(View view) {
-                    showOverflowMenu(view);
-                    return true;
-                }
-            });
-        }
     }
 
     private void showOverflowMenu(@NonNull View anchor) {

-- 
To view, visit https://gerrit.wikimedia.org/r/311467
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iaec085445e2f840a90704f2a42a0b9c4f26f95cd
Gerrit-PatchSet: 3
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Dbrant <dbr...@wikimedia.org>
Gerrit-Reviewer: BearND <bsitzm...@wikimedia.org>
Gerrit-Reviewer: Brion VIBBER <br...@wikimedia.org>
Gerrit-Reviewer: Mholloway <mhollo...@wikimedia.org>
Gerrit-Reviewer: Niedzielski <sniedziel...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to