Commit 7281542f authored by Vincent Boisselle's avatar Vincent Boisselle Committed by Commit Bot

Set a content description specific to the feed for the menu button.

We cannot set the content description in the XML layout because ListMenuButton will override the content description after inflate.

We are also not using the setContentDescriptionContext() function as the intermediate to set the content description because we already have our own translated string for the content description: https://source.chromium.org/chromium/chromium/src/+/master:chrome/browser/ui/android/strings/android_chrome_strings.grd;l=2328;drc=21b75b6a0fdbf4b8ed44d3d7823c25c0b668a852?originalUrl=https:%2F%2Fcs.chromium.org%2F

Bug: 10845970
Change-Id: I361a8c7275d5cec11d10f4e3a33c6a4922ffc653
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2208602
Commit-Queue: Vincent Boisselle <vincb@google.com>
Reviewed-by: default avatarDavid Trainor <dtrainor@chromium.org>
Reviewed-by: default avatarTheresa  <twellington@chromium.org>
Cr-Commit-Position: refs/heads/master@{#770390}
parent 72474d27
......@@ -30,7 +30,7 @@
android:padding="15dp"
android:background="@null"
android:src="@drawable/ic_more_vert_24dp"
android:contentDescription="@string/accessibility_ntp_feed_menu_button"
app:menuMaxWidth="@dimen/feed_header_menu_max_width"
app:tint="@color/default_icon_color_tint_list"
tools:ignore="ContentDescription" />
app:tint="@color/default_icon_color_tint_list" />
</org.chromium.chrome.browser.ntp.snippets.SectionHeaderView>
......@@ -8,6 +8,7 @@ import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.text.TextUtils;
import android.util.AttributeSet;
import org.chromium.base.ApiCompatibilityUtils;
......@@ -19,6 +20,10 @@ import org.chromium.ui.widget.ChromeImageButton;
/**
* A menu button meant to be used with modern lists throughout Chrome. Will automatically show and
* anchor a popup on press and will rely on a delegate for positioning and content of the popup.
* You can define your own content description for accessibility through the
* android:contentDescription parameter in the XML layout of the ListMenuButton. The default content
* description that corresponds to
* context.getString(R.string.accessibility_list_menu_button, "") is used otherwise.
*/
public class ListMenuButton
extends ChromeImageButton implements AnchoredPopupWindow.LayoutObserver {
......@@ -175,7 +180,7 @@ public class ListMenuButton
@Override
protected void onFinishInflate() {
super.onFinishInflate();
setContentDescriptionContext("");
if (TextUtils.isEmpty(getContentDescription())) setContentDescriptionContext("");
setOnClickListener((view) -> showMenu());
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment