Methods Summary |
---|
protected java.lang.String | composeChangeAnnouncement()
return getAccessibilityString(mState.value,
R.string.accessibility_rotation_lock_on_portrait_changed,
R.string.accessibility_rotation_lock_on_landscape_changed,
R.string.accessibility_rotation_lock_off_changed);
|
private java.lang.String | getAccessibilityString(boolean locked, int idWhenPortrait, int idWhenLandscape, int idWhenOff)Get the correct accessibility string based on the state
int stringID;
if (locked) {
final boolean portrait = mContext.getResources().getConfiguration().orientation
!= Configuration.ORIENTATION_LANDSCAPE;
stringID = portrait ? idWhenPortrait: idWhenLandscape;
} else {
stringID = idWhenOff;
}
return mContext.getString(stringID);
|
protected void | handleClick()
if (mController == null) return;
final boolean newState = !mState.value;
mController.setRotationLocked(newState);
refreshState(newState ? UserBoolean.USER_TRUE : UserBoolean.USER_FALSE);
|
protected void | handleUpdateState(BooleanState state, java.lang.Object arg)
if (mController == null) return;
final boolean rotationLocked = arg != null ? ((UserBoolean) arg).value
: mController.isRotationLocked();
final boolean userInitiated = arg != null ? ((UserBoolean) arg).userInitiated : false;
state.visible = mController.isRotationLockAffordanceVisible();
state.value = rotationLocked;
final boolean portrait = mContext.getResources().getConfiguration().orientation
!= Configuration.ORIENTATION_LANDSCAPE;
final AnimationIcon icon;
if (rotationLocked) {
final int label = portrait ? R.string.quick_settings_rotation_locked_portrait_label
: R.string.quick_settings_rotation_locked_landscape_label;
state.label = mContext.getString(label);
icon = portrait ? mAutoToPortrait : mAutoToLandscape;
} else {
state.label = mContext.getString(R.string.quick_settings_rotation_unlocked_label);
icon = portrait ? mPortraitToAuto : mLandscapeToAuto;
}
icon.setAllowAnimation(userInitiated);
state.icon = icon;
state.contentDescription = getAccessibilityString(rotationLocked,
R.string.accessibility_rotation_lock_on_portrait,
R.string.accessibility_rotation_lock_on_landscape,
R.string.accessibility_rotation_lock_off);
|
protected BooleanState | newTileState()
return new BooleanState();
|
public void | setListening(boolean listening)
if (mController == null) return;
if (listening) {
mController.addRotationLockControllerCallback(mCallback);
} else {
mController.removeRotationLockControllerCallback(mCallback);
}
|