FileDocCategorySizeDatePackage
CellularTile.javaAPI DocAndroid 5.1 API9164Thu Mar 12 22:22:42 GMT 2015com.android.systemui.qs.tiles

CellularTile

public class CellularTile extends com.android.systemui.qs.QSTile
Quick settings tile: Cellular

Fields Summary
private static final android.content.Intent
CELLULAR_SETTINGS
private final com.android.systemui.statusbar.policy.NetworkController
mController
private final com.android.systemui.statusbar.policy.NetworkController.MobileDataController
mDataController
private final CellularDetailAdapter
mDetailAdapter
private final com.android.systemui.statusbar.policy.NetworkController.NetworkSignalChangedCallback
mCallback
Constructors Summary
public CellularTile(Host host)


       
        super(host);
        mController = host.getNetworkController();
        mDataController = mController.getMobileDataController();
        mDetailAdapter = new CellularDetailAdapter();
    
Methods Summary
public com.android.systemui.qs.QSTileViewcreateTileView(android.content.Context context)

        return new SignalTileView(context);
    
public DetailAdaptergetDetailAdapter()

        return mDetailAdapter;
    
protected voidhandleClick()

        if (mDataController.isMobileDataSupported()) {
            showDetail(true);
        } else {
            mHost.startSettingsActivity(CELLULAR_SETTINGS);
        }
    
protected voidhandleUpdateState(SignalState state, java.lang.Object arg)

        state.visible = mController.hasMobileDataFeature();
        if (!state.visible) return;
        final CallbackInfo cb = (CallbackInfo) arg;
        if (cb == null) return;

        final Resources r = mContext.getResources();
        final int iconId = cb.noSim ? R.drawable.ic_qs_no_sim
                : !cb.enabled || cb.airplaneModeEnabled ? R.drawable.ic_qs_signal_disabled
                : cb.mobileSignalIconId > 0 ? cb.mobileSignalIconId
                : R.drawable.ic_qs_signal_no_signal;
        state.icon = ResourceIcon.get(iconId);
        state.isOverlayIconWide = cb.isDataTypeIconWide;
        state.autoMirrorDrawable = !cb.noSim;
        state.overlayIconId = cb.enabled && (cb.dataTypeIconId > 0) ? cb.dataTypeIconId : 0;
        state.filter = iconId != R.drawable.ic_qs_no_sim;
        state.activityIn = cb.enabled && cb.activityIn;
        state.activityOut = cb.enabled && cb.activityOut;

        state.label = cb.enabled
                ? removeTrailingPeriod(cb.enabledDesc)
                : r.getString(R.string.quick_settings_rssi_emergency_only);

        final String signalContentDesc = cb.enabled && (cb.mobileSignalIconId > 0)
                ? cb.signalContentDescription
                : r.getString(R.string.accessibility_no_signal);
        final String dataContentDesc = cb.enabled && (cb.dataTypeIconId > 0) && !cb.wifiEnabled
                ? cb.dataContentDescription
                : r.getString(R.string.accessibility_no_data);
        state.contentDescription = r.getString(
                R.string.accessibility_quick_settings_mobile,
                signalContentDesc, dataContentDesc,
                state.label);
    
protected SignalStatenewTileState()

        return new SignalState();
    
public static java.lang.StringremoveTrailingPeriod(java.lang.String string)

        if (string == null) return null;
        final int length = string.length();
        if (string.endsWith(".")) {
            return string.substring(0, length - 1);
        }
        return string;
    
public voidsetListening(boolean listening)

        if (listening) {
            mController.addNetworkSignalChangedCallback(mCallback);
        } else {
            mController.removeNetworkSignalChangedCallback(mCallback);
        }