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

AirplaneModeTile

public class AirplaneModeTile extends com.android.systemui.qs.QSTile
Quick settings tile: Airplane mode

Fields Summary
private final AnimationIcon
mEnable
private final AnimationIcon
mDisable
private final com.android.systemui.qs.GlobalSetting
mSetting
private boolean
mListening
private final android.content.BroadcastReceiver
mReceiver
Constructors Summary
public AirplaneModeTile(Host host)


       
        super(host);

        mSetting = new GlobalSetting(mContext, mHandler, Global.AIRPLANE_MODE_ON) {
            @Override
            protected void handleValueChanged(int value) {
                handleRefreshState(value);
            }
        };
    
Methods Summary
protected java.lang.StringcomposeChangeAnnouncement()

        if (mState.value) {
            return mContext.getString(R.string.accessibility_quick_settings_airplane_changed_on);
        } else {
            return mContext.getString(R.string.accessibility_quick_settings_airplane_changed_off);
        }
    
public voidhandleClick()

        setEnabled(!mState.value);
        mEnable.setAllowAnimation(true);
        mDisable.setAllowAnimation(true);
    
protected voidhandleUpdateState(BooleanState state, java.lang.Object arg)

        final int value = arg instanceof Integer ? (Integer)arg : mSetting.getValue();
        final boolean airplaneMode = value != 0;
        state.value = airplaneMode;
        state.visible = true;
        state.label = mContext.getString(R.string.quick_settings_airplane_mode_label);
        if (airplaneMode) {
            state.icon = mEnable;
            state.contentDescription =  mContext.getString(
                    R.string.accessibility_quick_settings_airplane_on);
        } else {
            state.icon = mDisable;
            state.contentDescription =  mContext.getString(
                    R.string.accessibility_quick_settings_airplane_off);
        }
    
protected BooleanStatenewTileState()

        return new BooleanState();
    
private voidsetEnabled(boolean enabled)

        final ConnectivityManager mgr =
                (ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
        mgr.setAirplaneMode(enabled);
    
public voidsetListening(boolean listening)

        if (mListening == listening) return;
        mListening = listening;
        if (listening) {
            final IntentFilter filter = new IntentFilter();
            filter.addAction(Intent.ACTION_AIRPLANE_MODE_CHANGED);
            mContext.registerReceiver(mReceiver, filter);
        } else {
            mContext.unregisterReceiver(mReceiver);
        }
        mSetting.setListening(listening);