Finished the location settings

Change-Id: I333fcc74ad387ef6edaa558656d3eaa91feb8fe9
This commit is contained in:
Lifu Tang
2013-08-06 13:31:50 -07:00
parent 2500f7a3f5
commit e631423290
8 changed files with 334 additions and 106 deletions

View File

@@ -37,9 +37,18 @@ import com.android.settings.R;
* uncheck all the other preferences, you should do that by code yourself.
*/
public class RadioButtonPreference extends CheckBoxPreference {
private boolean mValidListener;
public interface OnClickListener {
public abstract void onRadioButtonClicked(RadioButtonPreference emiter);
}
private OnClickListener mListener = null;
public RadioButtonPreference(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
setWidgetLayoutResource(R.layout.preference_widget_radiobutton);
mValidListener = false;
}
public RadioButtonPreference(Context context, AttributeSet attrs) {
@@ -50,6 +59,25 @@ public class RadioButtonPreference extends CheckBoxPreference {
this(context, null);
}
void setOnClickListener(OnClickListener listener) {
mListener = listener;
}
public void pause() {
mValidListener = false;
}
public void resume() {
mValidListener = true;
}
@Override
public void onClick() {
if (mListener != null) {
mListener.onRadioButtonClicked(this);
}
}
@Override
protected void onBindView(View view) {
super.onBindView(view);