| Index: chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenuHandler.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenuHandler.java b/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenuHandler.java
|
| index 29078598fb9c1cb2b837ea9a283d6e2e7bfa8cea..133da63286f8753bfb8d94e62efb48adea4470da 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenuHandler.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenuHandler.java
|
| @@ -10,6 +10,7 @@ import android.content.res.TypedArray;
|
| import android.graphics.Point;
|
| import android.graphics.Rect;
|
| import android.graphics.drawable.Drawable;
|
| +import android.os.Handler;
|
| import android.view.ContextThemeWrapper;
|
| import android.view.Menu;
|
| import android.view.MenuItem;
|
| @@ -37,6 +38,12 @@ public class AppMenuHandler {
|
| private final Activity mActivity;
|
|
|
| /**
|
| + * The resource id of the menu item to highlight when the menu next opens. A value of 0 means
|
| + * no item will be highlighted. This value will be cleared after the menu is opened.
|
| + */
|
| + private int mHighlightMenuId;
|
| +
|
| + /**
|
| * Constructs an AppMenuHandler object.
|
| * @param activity Activity that is using the AppMenu.
|
| * @param delegate Delegate used to check the desired AppMenu properties on show.
|
| @@ -52,6 +59,13 @@ public class AppMenuHandler {
|
| mHardwareButtonMenuAnchor = activity.findViewById(R.id.menu_anchor_stub);
|
| assert mHardwareButtonMenuAnchor != null
|
| : "Using AppMenu requires to have menu_anchor_stub view";
|
| +
|
| + new Handler().postDelayed(new Runnable() {
|
| + @Override
|
| + public void run() {
|
| + setMenuHighlight(R.id.offline_page_id);
|
| + }
|
| + }, 2000);
|
| }
|
|
|
| /**
|
| @@ -65,16 +79,23 @@ public class AppMenuHandler {
|
| if (mAppMenu != null) mAppMenu.menuItemContentChanged(menuRowId);
|
| }
|
|
|
| + public void setMenuHighlight(int highlightItemId) {
|
| + if (mHighlightMenuId == highlightItemId) return;
|
| + mHighlightMenuId = highlightItemId;
|
| + boolean highlighting = mHighlightMenuId != 0;
|
| + for (AppMenuObserver observer : mObservers) observer.onMenuHighlightChanged(highlighting);
|
| + }
|
| +
|
| /**
|
| * Show the app menu.
|
| - * @param anchorView Anchor view (usually a menu button) to be used for the popup, if
|
| - * null is passed then hardware menu button anchor will be used.
|
| - * @param startDragging Whether dragging is started. For example, if the app menu is
|
| - * showed by tapping on a button, this should be false. If it is
|
| - * showed by start dragging down on the menu button, this should
|
| - * be true. Note that if anchorView is null, this must
|
| - * be false since we no longer support hardware menu button
|
| - * dragging.
|
| + * @param anchorView Anchor view (usually a menu button) to be used for the popup, if
|
| + * null is passed then hardware menu button anchor will be used.
|
| + * @param startDragging Whether dragging is started. For example, if the app menu is
|
| + * showed by tapping on a button, this should be false. If it is
|
| + * showed by start dragging down on the menu button, this should
|
| + * be true. Note that if anchorView is null, this must
|
| + * be false since we no longer support hardware menu button
|
| + * dragging.
|
| * @return True, if the menu is shown, false, if menu is not shown, example reasons:
|
| * the menu is not yet available to be shown, or the menu is already showing.
|
| */
|
| @@ -136,9 +157,10 @@ public class AppMenuHandler {
|
| }
|
| Point pt = new Point();
|
| mActivity.getWindowManager().getDefaultDisplay().getSize(pt);
|
| - mAppMenu.show(wrapper, anchorView, isByPermanentButton,
|
| - rotation, appRect, pt.y, mDelegate.getFooterResourceId());
|
| + mAppMenu.show(wrapper, anchorView, isByPermanentButton, rotation, appRect, pt.y,
|
| + mDelegate.getFooterResourceId(), mHighlightMenuId);
|
| mAppMenuDragHelper.onShow(startDragging);
|
| + setMenuHighlight(0);
|
| RecordUserAction.record("MobileMenuShow");
|
| return true;
|
| }
|
|
|