FileDocCategorySizeDatePackage
ApnPreference.javaAPI DocAndroid 1.5 API4524Wed May 06 22:42:48 BST 2009com.android.settings

ApnPreference

public 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
Constructors Summary
public ApnPreference(android.content.Context context, android.util.AttributeSet attrs, int defStyle)

param
context
param
attrs
param
defStyle


               
           
        super(context, attrs, defStyle);
        init();
    
public ApnPreference(android.content.Context context, android.util.AttributeSet attrs)

param
context
param
attrs

        super(context, attrs);
        init();
    
public ApnPreference(android.content.Context context)

param
context

        super(context);
        init();
    
Methods Summary
public booleangetSelectable()

        return mSelectable;
    
public android.view.ViewgetView(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 voidinit()

        setLayoutResource(R.layout.apn_preference_layout);
    
public booleanisChecked()

        return getKey().equals(mSelectedKey);
    
public voidonCheckedChanged(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 voidonClick(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 voidsetChecked(boolean checked)

        mSelectedKey = getKey();
    
public voidsetSelectable(boolean selectable)

        mSelectable = selectable;