Methods Summary |
---|
protected java.lang.String | composeChangeAnnouncement()
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 void | handleClick()
setEnabled(!mState.value);
mEnable.setAllowAnimation(true);
mDisable.setAllowAnimation(true);
|
protected void | handleUpdateState(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 BooleanState | newTileState()
return new BooleanState();
|
private void | setEnabled(boolean enabled)
final ConnectivityManager mgr =
(ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
mgr.setAirplaneMode(enabled);
|
public void | setListening(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);
|