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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarLayout.java

Issue 1263573011: Let client specify content description for custom action button (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix corresponding test Created 5 years, 4 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/toolbar/ToolbarLayout.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarLayout.java b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarLayout.java
index a09a837196c37e16b1917c87f5b879cbef7ef70e..5b156f993d9297ec0d550d26b7c0eecb18f7ca60 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarLayout.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarLayout.java
@@ -226,19 +226,18 @@ abstract class ToolbarLayout extends FrameLayout implements Toolbar {
/**
* Shows the content description toast for items on the toolbar.
* @param view The view to anchor the toast.
- * @param stringResId The resource id for the string in the toast.
+ * @param description The string shown in the toast.
* @return Whether a toast has been shown successfully.
*/
- protected boolean showAccessibilityToast(View view, int stringResId) {
- if (stringResId == 0) return false;
+ protected boolean showAccessibilityToast(View view, CharSequence description) {
+ if (description == null) return false;
final int screenWidth = getResources().getDisplayMetrics().widthPixels;
final int[] screenPos = new int[2];
view.getLocationOnScreen(screenPos);
final int width = view.getWidth();
- Toast toast = Toast.makeText(
- getContext(), getResources().getString(stringResId), Toast.LENGTH_SHORT);
+ Toast toast = Toast.makeText(getContext(), description, Toast.LENGTH_SHORT);
toast.setGravity(
Gravity.TOP | Gravity.END,
screenWidth - screenPos[0] - width / 2,
@@ -385,10 +384,12 @@ abstract class ToolbarLayout extends FrameLayout implements Toolbar {
/**
* Adds a custom action button to the {@link ToolbarLayout} if it is supported.
+ * @param description The content description for the button.
+ * @param listener The {@link OnClickListener} to use for clicks to the button.
* @param buttonSource The {@link Bitmap} resource to use as the source for the button.
- * @param listener The {@link OnClickListener} to use for clicks to the button.
*/
- public void addCustomActionButton(Drawable drawable, OnClickListener listener) { }
+ public void addCustomActionButton(Drawable drawable, String description,
+ OnClickListener listener) { }
/**
* Triggered when the content view for the specified tab has changed.

Powered by Google App Engine
This is Rietveld 408576698