diff options
author | John Spurlock <jspurlock@google.com> | 2014-05-14 17:34:02 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-05-14 17:34:03 +0000 |
commit | a7e089f28c494f3c34e77f924b273acdbcf3ddd2 (patch) | |
tree | a0da374ac510dde642b9d3042c70b831d215e603 /packages/SystemUI/src | |
parent | 162043076b201483eaeef5c7c3da0619f26f1b11 (diff) | |
parent | 444eb2e13032c78b23b4a371ce6164faf1a3512b (diff) | |
download | frameworks_base-a7e089f28c494f3c34e77f924b273acdbcf3ddd2.zip frameworks_base-a7e089f28c494f3c34e77f924b273acdbcf3ddd2.tar.gz frameworks_base-a7e089f28c494f3c34e77f924b273acdbcf3ddd2.tar.bz2 |
Merge "Add QS rotation tile toggle animation."
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); + } } } |