Merge "Replaced Quick Settings Auto-Rotate Icons to Use Animations" into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
e75676adfe
@@ -57,6 +57,7 @@ import javax.inject.Inject;
|
||||
/** Quick settings tile: Rotation **/
|
||||
public class RotationLockTile extends QSTileImpl<BooleanState> implements
|
||||
BatteryController.BatteryStateChangeCallback {
|
||||
private static final String EMPTY_SECONDARY_STRING = "";
|
||||
|
||||
private final Icon mIcon = ResourceIcon.get(com.android.internal.R.drawable.ic_qs_auto_rotate);
|
||||
private final RotationLockController mController;
|
||||
@@ -144,13 +145,15 @@ public class RotationLockTile extends QSTileImpl<BooleanState> implements
|
||||
&& mController.isCameraRotationEnabled();
|
||||
state.value = !rotationLocked;
|
||||
state.label = mContext.getString(R.string.quick_settings_rotation_unlocked_label);
|
||||
state.icon = mIcon;
|
||||
state.icon = ResourceIcon.get(R.drawable.qs_auto_rotate_icon_off);
|
||||
state.contentDescription = getAccessibilityString(rotationLocked);
|
||||
if (!rotationLocked && cameraRotation) {
|
||||
state.secondaryLabel = mContext.getResources().getString(
|
||||
R.string.rotation_lock_camera_rotation_on);
|
||||
if (!rotationLocked) {
|
||||
state.secondaryLabel = cameraRotation ? mContext.getResources().getString(
|
||||
R.string.rotation_lock_camera_rotation_on)
|
||||
: EMPTY_SECONDARY_STRING;
|
||||
state.icon = ResourceIcon.get(R.drawable.qs_auto_rotate_icon_on);
|
||||
} else {
|
||||
state.secondaryLabel = "";
|
||||
state.secondaryLabel = EMPTY_SECONDARY_STRING;
|
||||
}
|
||||
state.stateDescription = state.secondaryLabel;
|
||||
|
||||
|
||||
@@ -36,9 +36,11 @@ import com.android.systemui.R;
|
||||
import com.android.systemui.SysuiTestCase;
|
||||
import com.android.systemui.classifier.FalsingManagerFake;
|
||||
import com.android.systemui.plugins.ActivityStarter;
|
||||
import com.android.systemui.plugins.qs.QSTile;
|
||||
import com.android.systemui.plugins.statusbar.StatusBarStateController;
|
||||
import com.android.systemui.qs.QSTileHost;
|
||||
import com.android.systemui.qs.logging.QSLogger;
|
||||
import com.android.systemui.qs.tileimpl.QSTileImpl;
|
||||
import com.android.systemui.statusbar.policy.BatteryController;
|
||||
import com.android.systemui.statusbar.policy.DeviceStateRotationLockSettingController;
|
||||
import com.android.systemui.statusbar.policy.RotationLockController;
|
||||
@@ -194,6 +196,26 @@ public class RotationLockTileTest extends SysuiTestCase {
|
||||
assertEquals("", mLockTile.getState().secondaryLabel.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIcon_whenDisabled_isOffState() {
|
||||
QSTile.BooleanState state = new QSTile.BooleanState();
|
||||
disableAutoRotation();
|
||||
|
||||
mLockTile.handleUpdateState(state, /* arg= */ null);
|
||||
|
||||
assertEquals(state.icon, QSTileImpl.ResourceIcon.get(R.drawable.qs_auto_rotate_icon_off));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIcon_whenEnabled_isOnState() {
|
||||
QSTile.BooleanState state = new QSTile.BooleanState();
|
||||
enableAutoRotation();
|
||||
|
||||
mLockTile.handleUpdateState(state, /* arg= */ null);
|
||||
|
||||
assertEquals(state.icon, QSTileImpl.ResourceIcon.get(R.drawable.qs_auto_rotate_icon_on));
|
||||
}
|
||||
|
||||
private void enableAutoRotation() {
|
||||
when(mRotationPolicyWrapper.isRotationLocked()).thenReturn(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user