Move RadioButtonPreference to generic widget package

Bug: 34280137
Test: no regression
Change-Id: Ib59efe767af83d182fba1ea1651026ddbb9ce6d5
This commit is contained in:
Fan Zhang
2017-01-13 17:11:42 -08:00
parent c7804c130b
commit 64c83afa8b
3 changed files with 12 additions and 8 deletions

View File

@@ -17,15 +17,15 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/location_mode_screen_title"> android:title="@string/location_mode_screen_title">
<com.android.settings.location.RadioButtonPreference <com.android.settings.widget.RadioButtonPreference
android:key="high_accuracy" android:key="high_accuracy"
android:title="@string/location_mode_high_accuracy_title" android:title="@string/location_mode_high_accuracy_title"
android:summary="@string/location_mode_high_accuracy_description" /> android:summary="@string/location_mode_high_accuracy_description" />
<com.android.settings.location.RadioButtonPreference <com.android.settings.widget.RadioButtonPreference
android:key="battery_saving" android:key="battery_saving"
android:title="@string/location_mode_battery_saving_title" android:title="@string/location_mode_battery_saving_title"
android:summary="@string/location_mode_battery_saving_description" /> android:summary="@string/location_mode_battery_saving_description" />
<com.android.settings.location.RadioButtonPreference <com.android.settings.widget.RadioButtonPreference
android:key="sensors_only" android:key="sensors_only"
android:title="@string/location_mode_sensors_only_title" android:title="@string/location_mode_sensors_only_title"
android:summary="@string/location_mode_sensors_only_description" /> android:summary="@string/location_mode_sensors_only_description" />

View File

@@ -21,6 +21,7 @@ import android.support.v7.preference.PreferenceScreen;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent; import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.R; import com.android.settings.R;
import com.android.settings.widget.RadioButtonPreference;
/** /**
* A page with 3 radio buttons to choose the location mode. * A page with 3 radio buttons to choose the location mode.

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2013 The Android Open Source Project * Copyright (C) 2017 The Android Open Source Project
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -14,9 +14,10 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.settings.location; package com.android.settings.widget;
import android.content.Context; import android.content.Context;
import android.support.v4.content.res.TypedArrayUtils;
import android.support.v7.preference.CheckBoxPreference; import android.support.v7.preference.CheckBoxPreference;
import android.support.v7.preference.PreferenceViewHolder; import android.support.v7.preference.PreferenceViewHolder;
import android.util.AttributeSet; import android.util.AttributeSet;
@@ -36,7 +37,7 @@ import com.android.settings.R;
*/ */
public class RadioButtonPreference extends CheckBoxPreference { public class RadioButtonPreference extends CheckBoxPreference {
public interface OnClickListener { public interface OnClickListener {
public abstract void onRadioButtonClicked(RadioButtonPreference emiter); void onRadioButtonClicked(RadioButtonPreference emiter);
} }
private OnClickListener mListener = null; private OnClickListener mListener = null;
@@ -47,14 +48,16 @@ public class RadioButtonPreference extends CheckBoxPreference {
} }
public RadioButtonPreference(Context context, AttributeSet attrs) { public RadioButtonPreference(Context context, AttributeSet attrs) {
this(context, attrs, com.android.internal.R.attr.checkBoxPreferenceStyle); this(context, attrs, TypedArrayUtils.getAttr(context,
android.support.v7.preference.R.attr.preferenceStyle,
android.R.attr.preferenceStyle));
} }
public RadioButtonPreference(Context context) { public RadioButtonPreference(Context context) {
this(context, null); this(context, null);
} }
void setOnClickListener(OnClickListener listener) { public void setOnClickListener(OnClickListener listener) {
mListener = listener; mListener = listener;
} }