FileDocCategorySizeDatePackage
AccessPointPreference.javaAPI DocAndroid 1.5 API3279Wed May 06 22:42:48 BST 2009com.android.settings.wifi

AccessPointPreference

public class AccessPointPreference extends android.preference.Preference implements AccessPointState.AccessPointStateCallback

Fields Summary
private static final int[]
STATE_ENCRYPTED
private static final int[]
STATE_EMPTY
private static final int
UI_SIGNAL_LEVELS
private WifiSettings
mWifiSettings
private AccessPointState
mState
Constructors Summary
public AccessPointPreference(WifiSettings wifiSettings, AccessPointState state)


         
        super(wifiSettings, null);
        
        mWifiSettings = wifiSettings;
        mState = state;
        
        setWidgetLayoutResource(R.layout.preference_widget_wifi_signal);
        
        state.setCallback(this);
        
        refresh();
    
Methods Summary
public intcompareTo(android.preference.Preference another)

        if (!(another instanceof AccessPointPreference)) {
            // Let normal preferences go before us.
            // NOTE: we should only be compared to Preference in our
            //       category.
            return 1;
        }
        
        return mState.compareTo(((AccessPointPreference) another).mState);
    
public AccessPointStategetAccessPointState()
Returns the {@link AccessPointState} associated with this preference.

return
The {@link AccessPointState}.

        return mState;
    
private intgetUiSignalLevel()

        return mState != null ? WifiManager.calculateSignalLevel(mState.signal, UI_SIGNAL_LEVELS)
                : 0; 
    
protected voidonBindView(android.view.View view)

        super.onBindView(view);

        ImageView signal = (ImageView) view.findViewById(R.id.signal);
        if (mState.seen) {
            signal.setImageResource(R.drawable.wifi_signal);
            signal.setImageState(mState.hasSecurity() ? STATE_ENCRYPTED : STATE_EMPTY, true);
            signal.setImageLevel(getUiSignalLevel());
        } else {
            signal.setImageDrawable(null);
        }
    
public voidrefresh()

        setTitle(mState.getHumanReadableSsid());
        setSummary(mState.getSummarizedStatus());

        notifyChanged();
    
public voidrefreshAccessPointState()

        refresh();
        
        // The ordering of access points could have changed due to the state change, so
        // re-evaluate ordering
        notifyHierarchyChanged();