Commit 5003c8a5 authored by Natalie Chouinard's avatar Natalie Chouinard Committed by Commit Bot

Use SL RadioButton for Search Engine pref

The AppCompat bug that made this workaround necessary (see original bug:
https://crbug.com/474695) was fixed >4 years. Cleaning up now that it's
no longer applicable.

Tested UI on KitKat, Lollipop and Pie.

Change-Id: I6fb6b73a2c96d8d4fab0ef28710503011e86e77a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1747030Reviewed-by: default avatarFinnur Thorarinsson <finnur@chromium.org>
Reviewed-by: default avatarTheresa  <twellington@chromium.org>
Commit-Queue: Natalie Chouinard <chouinard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#686135}
parent 672ca55f
......@@ -12,7 +12,7 @@
android:focusable="true"
android:padding="6dp">
<android.widget.RadioButton
<RadioButton
android:id="@+id/radiobutton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
......
......@@ -6,7 +6,6 @@ package org.chromium.chrome.browser.preferences;
import android.content.Context;
import android.content.res.Resources;
import android.os.Build;
import android.support.annotation.IntDef;
import android.support.annotation.StringRes;
import android.text.SpannableString;
......@@ -364,18 +363,8 @@ public class SearchEngineAdapter extends BaseAdapter
view.setOnClickListener(this);
view.setTag(position);
// TODO(finnur): There's a tinting bug in the AppCompat lib (see http://crbug.com/474695),
// which causes the first radiobox to always appear selected, even if it is not. It is being
// addressed, but in the meantime we should use the native RadioButton instead.
RadioButton radioButton = (RadioButton) view.findViewById(R.id.radiobutton);
// On Lollipop this removes the redundant animation ring on selection but on older versions
// it would cause the radio button to disappear.
// TODO(finnur): Remove the encompassing if statement once we go back to using the AppCompat
// control.
RadioButton radioButton = view.findViewById(R.id.radiobutton);
final boolean selected = position == mSelectedSearchEnginePosition;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
radioButton.setBackgroundResource(0);
}
radioButton.setChecked(selected);
TextView description = (TextView) view.findViewById(R.id.name);
......
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