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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenuIconRowFooter.java

Issue 2891493004: Tooltip for home page menu buttons (Closed)
Patch Set: refine descriptions of commit and tooltip strings Created 3 years, 7 months 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/appmenu/AppMenuIconRowFooter.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenuIconRowFooter.java b/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenuIconRowFooter.java
index 2d2dd1e5deb58adc3caf57b7f1b875a56539f95e..a47148394529fe121acbc6aa45001dad866d2bef 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenuIconRowFooter.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenuIconRowFooter.java
@@ -5,6 +5,7 @@
package org.chromium.chrome.browser.appmenu;
import android.content.Context;
+import android.content.res.Resources;
import android.util.AttributeSet;
import android.view.View;
import android.widget.LinearLayout;
@@ -15,12 +16,14 @@ import org.chromium.chrome.browser.ChromeActivity;
import org.chromium.chrome.browser.bookmarks.BookmarkBridge;
import org.chromium.chrome.browser.download.DownloadUtils;
import org.chromium.chrome.browser.tab.Tab;
+import org.chromium.chrome.browser.util.AccessibilityUtil;
import org.chromium.chrome.browser.widget.TintedImageButton;
/**
* A {@link LinearLayout} that displays a horizontal row of icons for page actions.
*/
-public class AppMenuIconRowFooter extends LinearLayout implements View.OnClickListener {
+public class AppMenuIconRowFooter
+ extends LinearLayout implements View.OnClickListener, View.OnLongClickListener {
private ChromeActivity mActivity;
private AppMenu mAppMenu;
@@ -37,21 +40,25 @@ public class AppMenuIconRowFooter extends LinearLayout implements View.OnClickLi
@Override
protected void onFinishInflate() {
super.onFinishInflate();
-
mForwardButton = (TintedImageButton) findViewById(R.id.forward_menu_id);
mForwardButton.setOnClickListener(this);
+ mForwardButton.setOnLongClickListener(this);
mBookmarkButton = (TintedImageButton) findViewById(R.id.bookmark_this_page_id);
mBookmarkButton.setOnClickListener(this);
+ mBookmarkButton.setOnLongClickListener(this);
mDownloadButton = (TintedImageButton) findViewById(R.id.offline_page_id);
mDownloadButton.setOnClickListener(this);
+ mDownloadButton.setOnLongClickListener(this);
mPageInfoButton = (TintedImageButton) findViewById(R.id.info_menu_id);
mPageInfoButton.setOnClickListener(this);
+ mPageInfoButton.setOnLongClickListener(this);
mReloadButton = (TintedImageButton) findViewById(R.id.reload_menu_id);
mReloadButton.setOnClickListener(this);
+ mReloadButton.setOnLongClickListener(this);
}
/**
@@ -83,6 +90,27 @@ public class AppMenuIconRowFooter extends LinearLayout implements View.OnClickLi
mAppMenu.dismiss();
}
+ @Override
+ public boolean onLongClick(View v) {
+ String description = null;
+ Context context = getContext();
+ Resources resources = context.getResources();
+ final int itemId = v.getId();
+
+ if (itemId == R.id.forward_menu_id) {
+ description = resources.getString(R.string.menu_forward);
+ } else if (itemId == R.id.bookmark_this_page_id) {
+ description = resources.getString(R.string.menu_bookmark);
+ } else if (itemId == R.id.offline_page_id) {
+ description = resources.getString(R.string.menu_download);
+ } else if (itemId == R.id.info_menu_id) {
+ description = resources.getString(R.string.menu_page_info);
+ } else if (itemId == R.id.reload_menu_id) {
+ description = resources.getString(R.string.menu_refresh);
+ }
+ return AccessibilityUtil.showAccessibilityToast(context, v, description);
+ }
+
/**
* Called when the current tab's load state has changed.
* @param isLoading Whether the tab is currently loading.

Powered by Google App Engine
This is Rietveld 408576698