Commit f15ffdff authored by Anthony Vallee-Dubois's avatar Anthony Vallee-Dubois Committed by Commit Bot

Add the device language icon to the explicit language ask prompt

Bug: 895485
Change-Id: I57b740831956d1ed9985aa580b7fa24e7b085f7e
Reviewed-on: https://chromium-review.googlesource.com/c/1280852Reviewed-by: default avatarTheresa <twellington@chromium.org>
Commit-Queue: anthonyvd <anthonyvd@chromium.org>
Cr-Commit-Position: refs/heads/master@{#599727}
parent a549c5a8
...@@ -38,4 +38,14 @@ ...@@ -38,4 +38,14 @@
android:singleLine="true" android:singleLine="true"
android:layout_alignStart="@+id/ui_language_representation" android:layout_alignStart="@+id/ui_language_representation"
android:layout_below="@+id/ui_language_representation" /> android:layout_below="@+id/ui_language_representation" />
<ImageView
android:id="@+id/device_language_icon"
android:importantForAccessibility="no"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_mobile_friendly_grey600_24dp"
android:layout_alignParentEnd="true"
android:layout_marginEnd="@dimen/list_item_default_margin"
android:visibility="invisible" />
</RelativeLayout> </RelativeLayout>
...@@ -13,8 +13,10 @@ import android.view.View; ...@@ -13,8 +13,10 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.CheckBox; import android.widget.CheckBox;
import android.widget.CompoundButton; import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import org.chromium.base.LocaleUtils;
import org.chromium.chrome.R; import org.chromium.chrome.R;
import org.chromium.chrome.browser.ChromeActivity; import org.chromium.chrome.browser.ChromeActivity;
import org.chromium.chrome.browser.ChromeFeatureList; import org.chromium.chrome.browser.ChromeFeatureList;
...@@ -49,6 +51,7 @@ public class LanguageAskPrompt implements ModalDialogView.Controller { ...@@ -49,6 +51,7 @@ public class LanguageAskPrompt implements ModalDialogView.Controller {
private TextView mLanguageNameTextView; private TextView mLanguageNameTextView;
private TextView mNativeNameTextView; private TextView mNativeNameTextView;
private CheckBox mCheckbox; private CheckBox mCheckbox;
private ImageView mDeviceLanguageIcon;
private String mCode; private String mCode;
private HashSet<String> mLanguagesUpdate; private HashSet<String> mLanguagesUpdate;
...@@ -60,6 +63,7 @@ public class LanguageAskPrompt implements ModalDialogView.Controller { ...@@ -60,6 +63,7 @@ public class LanguageAskPrompt implements ModalDialogView.Controller {
mNativeNameTextView = mNativeNameTextView =
((TextView) itemView.findViewById(R.id.native_language_representation)); ((TextView) itemView.findViewById(R.id.native_language_representation));
mCheckbox = ((CheckBox) itemView.findViewById(R.id.language_ask_checkbox)); mCheckbox = ((CheckBox) itemView.findViewById(R.id.language_ask_checkbox));
mDeviceLanguageIcon = ((ImageView) itemView.findViewById(R.id.device_language_icon));
mCheckbox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { mCheckbox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override @Override
public void onCheckedChanged(CompoundButton button, boolean isChecked) { public void onCheckedChanged(CompoundButton button, boolean isChecked) {
...@@ -93,6 +97,9 @@ public class LanguageAskPrompt implements ModalDialogView.Controller { ...@@ -93,6 +97,9 @@ public class LanguageAskPrompt implements ModalDialogView.Controller {
mCode = code; mCode = code;
mLanguagesUpdate = languagesUpdate; mLanguagesUpdate = languagesUpdate;
mCheckbox.setChecked(mLanguagesUpdate.contains(mCode)); mCheckbox.setChecked(mLanguagesUpdate.contains(mCode));
mDeviceLanguageIcon.setVisibility(LocaleUtils.getDefaultLocaleString().equals(code)
? View.VISIBLE
: View.INVISIBLE);
} }
} }
......
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