diff --git a/packages/SettingsLib/RadioButtonPreference/res/layout/preference_radio.xml b/packages/SettingsLib/RadioButtonPreference/res/layout/preference_radio.xml index dcb014d6ed573..b4b4c633b73ff 100644 --- a/packages/SettingsLib/RadioButtonPreference/res/layout/preference_radio.xml +++ b/packages/SettingsLib/RadioButtonPreference/res/layout/preference_radio.xml @@ -65,7 +65,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" - android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Subhead" + android:textAppearance="?android:attr/textAppearanceListItem" android:ellipsize="marquee" android:fadingEdge="horizontal"/> @@ -79,7 +79,7 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" - android:textAppearance="@android:style/TextAppearance.DeviceDefault.Small" + android:textAppearance="?android:attr/textAppearanceSmall" android:textAlignment="viewStart" android:textColor="?android:attr/textColorSecondary"/> @@ -88,7 +88,7 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" - android:textAppearance="@android:style/TextAppearance.DeviceDefault.Small" + android:textAppearance="?android:attr/textAppearanceSmall" android:textAlignment="viewEnd" android:textColor="?android:attr/textColorSecondary" android:maxLines="1" diff --git a/packages/SettingsLib/RadioButtonPreference/src/com/android/settingslib/widget/RadioButtonPreference.java b/packages/SettingsLib/RadioButtonPreference/src/com/android/settingslib/widget/RadioButtonPreference.java index 08287ac628d52..05e008c39ef4c 100644 --- a/packages/SettingsLib/RadioButtonPreference/src/com/android/settingslib/widget/RadioButtonPreference.java +++ b/packages/SettingsLib/RadioButtonPreference/src/com/android/settingslib/widget/RadioButtonPreference.java @@ -22,7 +22,6 @@ import android.util.AttributeSet; import android.view.View; import android.widget.TextView; -import androidx.core.content.res.TypedArrayUtils; import androidx.preference.CheckBoxPreference; import androidx.preference.PreferenceViewHolder; @@ -58,32 +57,29 @@ public class RadioButtonPreference extends CheckBoxPreference { /** * Perform inflation from XML and apply a class-specific base style. * - * @param context The {@link Context} this is associated with, through which it can - * access the current theme, resources, {@link SharedPreferences}, etc. - * @param attrs The attributes of the XML tag that is inflating the preference - * @param defStyleAttr An attribute in the current theme that contains a reference to a style - * resource that supplies default values for the view. Can be 0 to not - * look for defaults. + * @param context The {@link Context} this is associated with, through which it can + * access the current theme, resources, {@link SharedPreferences}, etc. + * @param attrs The attributes of the XML tag that is inflating the preference + * @param defStyle An attribute in the current theme that contains a reference to a style + * resource that supplies default values for the view. Can be 0 to not + * look for defaults. */ public RadioButtonPreference(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); - setWidgetLayoutResource(R.layout.preference_widget_radiobutton); - setLayoutResource(R.layout.preference_radio); - setIconSpaceReserved(false); + init(); } /** * Perform inflation from XML and apply a class-specific base style. * - * @param context The {@link Context} this is associated with, through which it can - * access the current theme, resources, {@link SharedPreferences}, etc. - * @param attrs The attributes of the XML tag that is inflating the preference + * @param context The {@link Context} this is associated with, through which it can + * access the current theme, resources, {@link SharedPreferences}, etc. + * @param attrs The attributes of the XML tag that is inflating the preference */ public RadioButtonPreference(Context context, AttributeSet attrs) { - this(context, attrs, TypedArrayUtils.getAttr(context, - androidx.preference.R.attr.preferenceStyle, - android.R.attr.preferenceStyle)); + super(context, attrs); + init(); } /** @@ -158,4 +154,10 @@ public class RadioButtonPreference extends CheckBoxPreference { } mAppendixVisibility = visibility; } + + private void init() { + setWidgetLayoutResource(R.layout.preference_widget_radiobutton); + setLayoutResource(R.layout.preference_radio); + setIconSpaceReserved(false); + } }