Commit 27321862 authored by Sinan Sahin's avatar Sinan Sahin Committed by Commit Bot

[Context menu redesign] Display URLs always LTR

Forcing it to LTR makes sure the URL is not shown out-of-order when
the first strong character of the URL is RTL.

This CL also updates the RevampedContextMenuHeaderMediator's
constructor to have a ContextMenuParams parameter instead of several
parameters that are possible to extract from the ContextMenuParams.

Bug: 655359
Change-Id: I10373120472d4b8a6c354e454232c13c63c73587
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1676675Reviewed-by: default avatarTheresa <twellington@chromium.org>
Commit-Queue: Sinan Sahin <sinansahin@google.com>
Cr-Commit-Position: refs/heads/master@{#672206}
parent d85d6b10
......@@ -50,8 +50,6 @@
android:orientation="vertical"
android:layout_gravity="center_vertical">
<!-- TODO(sinansahin): Sync with UX to decide on what to do with cases like RTL text on LTR
device and LTR text on RTL device -->
<org.chromium.ui.widget.TextViewWithLeading
android:id="@+id/menu_header_title"
android:layout_width="match_parent"
......@@ -67,6 +65,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAlignment="viewStart"
android:textDirection="ltr"
android:ellipsize="end"
android:maxLines="1"
android:textAppearance="@style/TextAppearance.BlackCaption"
......
......@@ -31,8 +31,7 @@ class RevampedContextMenuHeaderCoordinator {
RevampedContextMenuHeaderCoordinator(Activity activity, ContextMenuParams params) {
mContext = activity;
mModel = buildModel(getTitle(params), getUrl(activity, params));
mMediator = new RevampedContextMenuHeaderMediator(
activity, mModel, params.getUrl(), params.isImage());
mMediator = new RevampedContextMenuHeaderMediator(activity, mModel, params);
}
private PropertyModel buildModel(String title, CharSequence url) {
......
......@@ -33,13 +33,13 @@ class RevampedContextMenuHeaderMediator implements View.OnClickListener {
private String mPlainUrl;
RevampedContextMenuHeaderMediator(
Context context, PropertyModel model, String plainUrl, boolean isImage) {
Context context, PropertyModel model, ContextMenuParams params) {
mContext = context;
mPlainUrl = plainUrl;
mPlainUrl = params.getUrl();
mModel = model;
mModel.set(RevampedContextMenuHeaderProperties.URL_CLICK_LISTENER, this);
if (!isImage) {
if (!params.isImage() && !params.isVideo()) {
LargeIconBridge iconBridge = new LargeIconBridge(Profile.getLastUsedProfile());
iconBridge.getLargeIconForUrl(mPlainUrl,
context.getResources().getDimensionPixelSize(R.dimen.default_favicon_min_size),
......
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