ApnPreferencepublic class ApnPreference extends android.preference.Preference implements CompoundButton.OnCheckedChangeListener, android.view.View.OnClickListener
Fields Summary |
---|
static final String | TAG | private static String | mSelectedKey | private static android.widget.CompoundButton | mCurrentChecked | private boolean | mProtectFromCheckedChange | private boolean | mSelectable |
Methods Summary |
---|
public boolean | getSelectable()
return mSelectable;
| public android.view.View | getView(android.view.View convertView, android.view.ViewGroup parent)
View view = super.getView(convertView, parent);
View widget = view.findViewById(R.id.apn_radiobutton);
if ((widget != null) && widget instanceof RadioButton) {
RadioButton rb = (RadioButton) widget;
if (mSelectable) {
rb.setOnCheckedChangeListener(this);
boolean isChecked = getKey().equals(mSelectedKey);
if (isChecked) {
mCurrentChecked = rb;
mSelectedKey = getKey();
}
mProtectFromCheckedChange = true;
rb.setChecked(isChecked);
mProtectFromCheckedChange = false;
} else {
rb.setVisibility(View.GONE);
}
}
View textLayout = view.findViewById(R.id.text_layout);
if ((textLayout != null) && textLayout instanceof RelativeLayout) {
textLayout.setOnClickListener(this);
}
return view;
| private void | init()
setLayoutResource(R.layout.apn_preference_layout);
| public boolean | isChecked()
return getKey().equals(mSelectedKey);
| public void | onCheckedChanged(android.widget.CompoundButton buttonView, boolean isChecked)
Log.i(TAG, "ID: " + getKey() + " :" + isChecked);
if (mProtectFromCheckedChange) {
return;
}
if (isChecked) {
if (mCurrentChecked != null) {
mCurrentChecked.setChecked(false);
}
mCurrentChecked = buttonView;
mSelectedKey = getKey();
callChangeListener(mSelectedKey);
} else {
mCurrentChecked = null;
mSelectedKey = null;
}
| public void | onClick(android.view.View v)
if ((v != null) && (R.id.text_layout == v.getId())) {
Context context = getContext();
if (context != null) {
int pos = Integer.parseInt(getKey());
Uri url = ContentUris.withAppendedId(Telephony.Carriers.CONTENT_URI, pos);
context.startActivity(new Intent(Intent.ACTION_EDIT, url));
}
}
| public void | setChecked(boolean checked)
mSelectedKey = getKey();
| public void | setSelectable(boolean selectable)
mSelectable = selectable;
|
|