Commit c42dbc15 authored by Timothy Loh's avatar Timothy Loh Committed by Commit Bot

Display modal permission prompts in RTL locales correctly.

This patch fixes modal permission prompts so that in RTL:
- The text direction is RTL as per the locale, instead of following the
  first strong directional character (typically the first character of
  the URL)
- The icon occurs on the right side of the dialog (i.e. before it)

Bug: 774926
Change-Id: I8677cf61c30bdce95113e0e414531c343ed302c2
Reviewed-on: https://chromium-review.googlesource.com/722382Reviewed-by: default avatarBernhard Bauer <bauerb@chromium.org>
Commit-Queue: Timothy Loh <timloh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#509637}
parent f8bb2ba9
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center_vertical" android:gravity="center_vertical"
android:textDirection="locale"
android:textSize="@dimen/dialog_text_size" android:textSize="@dimen/dialog_text_size"
android:paddingBottom="24dp" android:paddingBottom="24dp"
android:drawablePadding="8dp" /> android:drawablePadding="8dp" />
......
...@@ -8,6 +8,7 @@ import android.annotation.SuppressLint; ...@@ -8,6 +8,7 @@ import android.annotation.SuppressLint;
import android.app.Activity; import android.app.Activity;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.support.annotation.IntDef; import android.support.annotation.IntDef;
import android.support.v4.widget.TextViewCompat;
import android.support.v7.app.AlertDialog; import android.support.v7.app.AlertDialog;
import android.support.v7.widget.SwitchCompat; import android.support.v7.widget.SwitchCompat;
import android.text.TextUtils; import android.text.TextUtils;
...@@ -149,8 +150,8 @@ public class PermissionDialogController implements AndroidPermissionRequester.Re ...@@ -149,8 +150,8 @@ public class PermissionDialogController implements AndroidPermissionRequester.Re
messageTextView.setText(prepareMainMessageString(mDialogDelegate)); messageTextView.setText(prepareMainMessageString(mDialogDelegate));
messageTextView.setVisibility(View.VISIBLE); messageTextView.setVisibility(View.VISIBLE);
messageTextView.announceForAccessibility(mDialogDelegate.getMessageText()); messageTextView.announceForAccessibility(mDialogDelegate.getMessageText());
messageTextView.setCompoundDrawablesWithIntrinsicBounds( TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(
mDialogDelegate.getDrawableId(), 0, 0, 0); messageTextView, mDialogDelegate.getDrawableId(), 0, 0, 0);
mSwitchView = (SwitchCompat) view.findViewById(R.id.permission_dialog_persist_toggle); mSwitchView = (SwitchCompat) view.findViewById(R.id.permission_dialog_persist_toggle);
mSwitchView.setChecked(true); mSwitchView.setChecked(true);
......
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