| 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 e9531ce0e5e8f7ebba249abcd6089da3f9a2115c..034a55241c4ad22a2852bf9b332443c6c85fa48a 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
|
| @@ -12,11 +12,13 @@ import android.graphics.Rect;
|
| import android.graphics.drawable.Drawable;
|
| import android.os.SystemClock;
|
| import android.util.AttributeSet;
|
| +import android.view.Gravity;
|
| import android.view.MotionEvent;
|
| import android.view.View;
|
| import android.view.ViewGroup;
|
| import android.widget.FrameLayout;
|
| import android.widget.ProgressBar;
|
| +import android.widget.Toast;
|
|
|
| import org.chromium.chrome.R;
|
| import org.chromium.chrome.browser.Tab;
|
| @@ -222,6 +224,30 @@ 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.
|
| + * @return Whether a toast has been shown successfully.
|
| + */
|
| + protected boolean showAccessibilityToast(View view, int stringResId) {
|
| + if (stringResId == 0) 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.setGravity(
|
| + Gravity.TOP | Gravity.END,
|
| + screenWidth - screenPos[0] - width / 2,
|
| + getHeight());
|
| + toast.show();
|
| + return true;
|
| + }
|
| +
|
| + /**
|
| * @return The provider for toolbar related data.
|
| */
|
| protected ToolbarDataProvider getToolbarDataProvider() {
|
|
|