diff options
author | John Spurlock <jspurlock@google.com> | 2014-05-14 13:32:14 -0400 |
---|---|---|
committer | John Spurlock <jspurlock@google.com> | 2014-05-14 13:32:14 -0400 |
commit | 444eb2e13032c78b23b4a371ce6164faf1a3512b (patch) | |
tree | 1f9f15fad07b0eb79eb89e3f98e9a6c6d625e2b0 /packages/SystemUI/src | |
parent | 54b6fd0cbe48fc0980da0617352785c973c60c86 (diff) | |
download | frameworks_base-444eb2e13032c78b23b4a371ce6164faf1a3512b.zip frameworks_base-444eb2e13032c78b23b4a371ce6164faf1a3512b.tar.gz frameworks_base-444eb2e13032c78b23b4a371ce6164faf1a3512b.tar.bz2 |
Add QS rotation tile toggle animation.
Change-Id: Ic7e6e36759ef17ab35d639d22bbd2f6bf2470272
Diffstat (limited to 'packages/SystemUI/src')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/qs/QSTile.java | 3 | ||||
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/qs/tiles/RotationLockTile.java | 26 |
2 files changed, 24 insertions, 5 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSTile.java b/packages/SystemUI/src/com/android/systemui/qs/QSTile.java index a2a7bc3..05f308d 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSTile.java @@ -18,6 +18,7 @@ package com.android.systemui.qs; import android.content.Context; import android.content.Intent; +import android.graphics.drawable.Drawable; import android.graphics.drawable.VectorDrawable; import android.os.Handler; import android.os.Looper; @@ -225,7 +226,7 @@ public abstract class QSTile<TState extends State> implements Disposable { public static class State { public boolean visible; public int iconId; - public VectorDrawable icon; + public Drawable icon; public String label; public String contentDescription; diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/RotationLockTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/RotationLockTile.java index 1f00824..d075299 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/RotationLockTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/RotationLockTile.java @@ -17,6 +17,8 @@ package com.android.systemui.qs.tiles; import android.content.res.Configuration; +import android.graphics.drawable.AnimationDrawable; +import android.graphics.drawable.Drawable; import com.android.systemui.R; import com.android.systemui.qs.QSTile; @@ -48,7 +50,7 @@ public class RotationLockTile extends QSTile<QSTile.BooleanState> { @Override protected void handleClick() { if (mController == null) return; - mController.setRotationLocked(mState.value); + mController.setRotationLocked(!mState.value); } @Override @@ -56,7 +58,19 @@ public class RotationLockTile extends QSTile<QSTile.BooleanState> { if (mController == null) return; final boolean rotationLocked = mController.isRotationLocked(); state.visible = mController.isRotationLockAffordanceVisible(); - state.value = !rotationLocked; + if (state.value != rotationLocked) { + state.value = rotationLocked; + final AnimationDrawable d = (AnimationDrawable) mContext.getDrawable(rotationLocked + ? R.drawable.ic_rotate_locked_anim + : R.drawable.ic_rotate_unlocked_anim); + state.icon = d; + mUiHandler.post(new Runnable() { + @Override + public void run() { + d.start(); + } + }); + } if (rotationLocked) { final int lockOrientation = mController.getRotationLockOrientation(); final int label = lockOrientation == Configuration.ORIENTATION_PORTRAIT @@ -64,11 +78,15 @@ public class RotationLockTile extends QSTile<QSTile.BooleanState> { : lockOrientation == Configuration.ORIENTATION_LANDSCAPE ? R.string.quick_settings_rotation_locked_landscape_label : R.string.quick_settings_rotation_locked_label; - state.iconId = R.drawable.ic_qs_rotation_lock; state.label = mContext.getString(label); + if (state.icon == null) { + state.icon = mContext.getDrawable(R.drawable.ic_rotate_24_15); + } } else { - state.iconId = R.drawable.ic_qs_rotation; state.label = mContext.getString(R.string.quick_settings_rotation_unlocked_label); + if (state.icon == null) { + state.icon = mContext.getDrawable(R.drawable.ic_rotate_24_01); + } } } |