Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3804)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarPhone.java

Issue 1505913003: Add update menu item and app menu icon badge (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rearrange field_trial.. again to facilitate command line testing Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarPhone.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarPhone.java b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarPhone.java
index a8ccf0f355f2eebd2f65e20bda8a5c853d89dd58..37576468ccf7b78b8921166fcd9b0b70ff076fd4 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarPhone.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarPhone.java
@@ -19,12 +19,14 @@ import android.view.TouchDelegate;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
+import android.widget.ImageView;
import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.WindowDelegate;
import org.chromium.chrome.browser.appmenu.AppMenuButtonHelper;
import org.chromium.chrome.browser.ntp.NewTabPage;
+import org.chromium.chrome.browser.omaha.UpdateMenuItemHelper;
import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.util.ColorUtils;
import org.chromium.chrome.browser.util.FeatureUtilities;
@@ -44,6 +46,8 @@ public class LocationBarPhone extends LocationBarLayout {
private View mIncognitoBadge;
private View mUrlActionsContainer;
private TintedImageButton mMenuButton;
+ private ImageView mMenuBadge;
+ private View mMenuButtonWrapper;
private int mIncognitoBadgePadding;
private boolean mVoiceSearchEnabled;
private boolean mUrlFocusChangeInProgress;
@@ -76,10 +80,12 @@ public class LocationBarPhone extends LocationBarLayout {
setTouchDelegate(touchDelegate);
mMenuButton = (TintedImageButton) findViewById(R.id.document_menu_button);
+ mMenuBadge = (ImageView) findViewById(R.id.document_menu_badge);
+ mMenuButtonWrapper = findViewById(R.id.document_menu_button_wrapper);
if (hasVisibleViewsAfterUrlBarWhenUnfocused()) mUrlActionsContainer.setVisibility(VISIBLE);
if (!showMenuButtonInOmnibox()) {
- ((ViewGroup) mMenuButton.getParent()).removeView(mMenuButton);
+ ((ViewGroup) mMenuButtonWrapper.getParent()).removeView(mMenuButtonWrapper);
}
}
@@ -164,7 +170,7 @@ public class LocationBarPhone extends LocationBarLayout {
mDeleteButton.setAlpha(percent);
mMicButton.setAlpha(percent);
- if (showMenuButtonInOmnibox()) mMenuButton.setAlpha(1f - percent);
+ if (showMenuButtonInOmnibox()) mMenuButtonWrapper.setAlpha(1f - percent);
updateDeleteButtonVisibility();
}
@@ -368,4 +374,20 @@ public class LocationBarPhone extends LocationBarLayout {
super.setLayoutDirection(layoutDirection);
updateIncognitoBadgePadding();
}
+
+ /**
+ * Displays the update app menu badge.
+ */
+ public void showAppMenuUpdateBadge() {
+ mMenuBadge.setVisibility(View.VISIBLE);
+ mMenuButton.setImageBitmap(
+ UpdateMenuItemHelper.getInstance().getBadgedMenuButtonBitmap(getContext()));
+ }
+
+ /**
+ * Remove the update menu app menu badge.
+ */
+ public void removeAppMenuUpdateBadge() {
+ mMenuBadge.setVisibility(View.GONE);
+ }
}

Powered by Google App Engine
This is Rietveld 408576698