* commit '2fc6e2b57ddfac58ce1fbded6f8a64a0b2fc9d70': Show correct locked orientation on phones
This commit is contained in:
@@ -78,8 +78,7 @@ public class RotationLockTile extends QSTile<QSTile.BooleanState> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
state.value = rotationLocked;
|
state.value = rotationLocked;
|
||||||
final boolean portrait = mContext.getResources().getConfiguration().orientation
|
final boolean portrait = isCurrentOrientationLockPortrait();
|
||||||
!= Configuration.ORIENTATION_LANDSCAPE;
|
|
||||||
final AnimationIcon icon;
|
final AnimationIcon icon;
|
||||||
if (rotationLocked) {
|
if (rotationLocked) {
|
||||||
final int label = portrait ? R.string.quick_settings_rotation_locked_portrait_label
|
final int label = portrait ? R.string.quick_settings_rotation_locked_portrait_label
|
||||||
@@ -98,6 +97,17 @@ public class RotationLockTile extends QSTile<QSTile.BooleanState> {
|
|||||||
R.string.accessibility_rotation_lock_off);
|
R.string.accessibility_rotation_lock_off);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isCurrentOrientationLockPortrait() {
|
||||||
|
int lockOrientation = mController.getRotationLockOrientation();
|
||||||
|
if (lockOrientation == Configuration.ORIENTATION_UNDEFINED) {
|
||||||
|
// Freely rotating device; use current rotation
|
||||||
|
return mContext.getResources().getConfiguration().orientation
|
||||||
|
!= Configuration.ORIENTATION_LANDSCAPE;
|
||||||
|
} else {
|
||||||
|
return lockOrientation != Configuration.ORIENTATION_LANDSCAPE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetricsCategory() {
|
public int getMetricsCategory() {
|
||||||
return MetricsLogger.QS_ROTATIONLOCK;
|
return MetricsLogger.QS_ROTATIONLOCK;
|
||||||
@@ -116,9 +126,7 @@ public class RotationLockTile extends QSTile<QSTile.BooleanState> {
|
|||||||
int idWhenOff) {
|
int idWhenOff) {
|
||||||
int stringID;
|
int stringID;
|
||||||
if (locked) {
|
if (locked) {
|
||||||
final boolean portrait = mContext.getResources().getConfiguration().orientation
|
stringID = isCurrentOrientationLockPortrait() ? idWhenPortrait: idWhenLandscape;
|
||||||
!= Configuration.ORIENTATION_LANDSCAPE;
|
|
||||||
stringID = portrait ? idWhenPortrait: idWhenLandscape;
|
|
||||||
} else {
|
} else {
|
||||||
stringID = idWhenOff;
|
stringID = idWhenOff;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user