diff options
author | Daniel Sandler <dsandler@google.com> | 2010-11-05 15:00:06 -0400 |
---|---|---|
committer | Daniel Sandler <dsandler@google.com> | 2010-11-05 15:04:35 -0400 |
commit | 06e6630a462b6a5c04c319d781d64896778d351f (patch) | |
tree | 5b47731c48c6415e0e5dd735fbf6a9faae7ed0f7 /packages | |
parent | 91460d7f49e92e13e2acccdf8be10934e9e770fe (diff) | |
download | frameworks_base-06e6630a462b6a5c04c319d781d64896778d351f.zip frameworks_base-06e6630a462b6a5c04c319d781d64896778d351f.tar.gz frameworks_base-06e6630a462b6a5c04c319d781d64896778d351f.tar.bz2 |
Restore user-accessible lights-out control.
Current system area gestures:
tap - no-op (bug 3114340)
swipe up - open system panel
swipe down - lights out
long press - lights out (bug 3134973)
The enter/exit animations have been tweaked to reinforce
this, particularly the swipe down for lights out. (Swiping
up to exit lights out will work, as will any kind of tap in
the lights-out "curtain".)
Change-Id: Ie027d7a0e86a402d06a8a368a5a43050a6bb9e58
Diffstat (limited to 'packages')
5 files changed, 43 insertions, 32 deletions
diff --git a/packages/SystemUI/res/anim/lights_out_in.xml b/packages/SystemUI/res/anim/lights_out_in.xml index 8154ec0..f76a452 100644 --- a/packages/SystemUI/res/anim/lights_out_in.xml +++ b/packages/SystemUI/res/anim/lights_out_in.xml @@ -16,11 +16,11 @@ <set xmlns:android="http://schemas.android.com/apk/res/android" > - <translate android:fromYDelta="100%p" android:toYDelta="0" + <translate android:fromYDelta="-100%p" android:toYDelta="0" android:duration="@android:integer/config_mediumAnimTime" android:interpolator="@anim/hydraulic_brake_interpolator" /> - <alpha android:fromAlpha="0.0" android:toAlpha="1.0" + <alpha android:fromAlpha="0.5" android:toAlpha="1.0" android:duration="@android:integer/config_longAnimTime" /> </set> diff --git a/packages/SystemUI/res/anim/lights_out_out.xml b/packages/SystemUI/res/anim/lights_out_out.xml index b4bc55a..610ac7a 100644 --- a/packages/SystemUI/res/anim/lights_out_out.xml +++ b/packages/SystemUI/res/anim/lights_out_out.xml @@ -16,11 +16,11 @@ <set xmlns:android="http://schemas.android.com/apk/res/android" > - <translate android:toYDelta="100%p" android:fromYDelta="0" + <translate android:toYDelta="-100%p" android:fromYDelta="0" android:duration="@android:integer/config_mediumAnimTime" android:interpolator="@anim/hydraulic_brake_interpolator" /> - <alpha android:toAlpha="0.0" android:fromAlpha="1.0" + <alpha android:toAlpha="0.5" android:fromAlpha="1.0" android:duration="@android:integer/config_longAnimTime" /> </set> diff --git a/packages/SystemUI/res/anim/status_bar_in.xml b/packages/SystemUI/res/anim/status_bar_in.xml index 460fe50..79fe5f1 100644 --- a/packages/SystemUI/res/anim/status_bar_in.xml +++ b/packages/SystemUI/res/anim/status_bar_in.xml @@ -16,11 +16,11 @@ <set xmlns:android="http://schemas.android.com/apk/res/android" > - <translate android:fromYDelta="-100%p" android:toYDelta="0" + <translate android:fromYDelta="100%p" android:toYDelta="0" android:duration="@android:integer/config_longAnimTime" android:interpolator="@anim/hydraulic_brake_interpolator" /> - <alpha android:fromAlpha="0.0" android:toAlpha="1.0" + <alpha android:fromAlpha="0.5" android:toAlpha="1.0" android:duration="@android:integer/config_longAnimTime" /> </set> diff --git a/packages/SystemUI/res/anim/status_bar_out.xml b/packages/SystemUI/res/anim/status_bar_out.xml index 6572ab4..80863cf 100644 --- a/packages/SystemUI/res/anim/status_bar_out.xml +++ b/packages/SystemUI/res/anim/status_bar_out.xml @@ -16,11 +16,11 @@ <set xmlns:android="http://schemas.android.com/apk/res/android" > - <translate android:toYDelta="-100%p" android:fromYDelta="0" + <translate android:toYDelta="100%p" android:fromYDelta="0" android:duration="@android:integer/config_longAnimTime" android:interpolator="@anim/hydraulic_brake_interpolator" /> - <alpha android:toAlpha="0.0" android:fromAlpha="1.0" + <alpha android:toAlpha="0.5" android:fromAlpha="1.0" android:duration="@android:integer/config_longAnimTime" /> </set> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarService.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarService.java index abcfec8..29f0fe2 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarService.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarService.java @@ -75,6 +75,8 @@ public class TabletStatusBarService extends StatusBarService { public static final int MSG_CLOSE_SYSTEM_PANEL = 1011; public static final int MSG_OPEN_RECENTS_PANEL = 1020; public static final int MSG_CLOSE_RECENTS_PANEL = 1021; + public static final int MSG_LIGHTS_ON = 1030; + public static final int MSG_LIGHTS_OUT = 1031; private static final int MAX_IMAGE_LEVEL = 10000; private static final boolean USE_2D_RECENTS = true; @@ -263,8 +265,6 @@ public class TabletStatusBarService extends StatusBarService { mSystemInfo = sb.findViewById(R.id.systemInfo); mRecentButton = sb.findViewById(R.id.recent_apps); -// mSystemInfo.setOnClickListener(mOnClickListener); - mSystemInfo.setOnLongClickListener(new SetLightsOnListener(false)); mSystemInfo.setOnTouchListener(new ClockTouchListener()); mRecentButton = sb.findViewById(R.id.recent_apps); @@ -422,6 +422,15 @@ public class TabletStatusBarService extends StatusBarService { if (DEBUG) Slog.d(TAG, "closing recents panel"); if (mRecentsPanel != null) mRecentsPanel.setVisibility(View.GONE); break; + case MSG_LIGHTS_ON: + setViewVisibility(mCurtains, View.GONE, R.anim.lights_out_out); + setViewVisibility(mBarContents, View.VISIBLE, R.anim.status_bar_in); + break; + case MSG_LIGHTS_OUT: + animateCollapse(); + setViewVisibility(mCurtains, View.VISIBLE, R.anim.lights_out_in); + setViewVisibility(mBarContents, View.GONE, R.anim.status_bar_out); + break; } } } @@ -675,15 +684,12 @@ public class TabletStatusBarService extends StatusBarService { mHandler.sendEmptyMessage(MSG_CLOSE_RECENTS_PANEL); } + // called by StatusBarService + @Override public void setLightsOn(boolean on) { - if (on) { - setViewVisibility(mCurtains, View.GONE, R.anim.lights_out_out); - setViewVisibility(mBarContents, View.VISIBLE, R.anim.status_bar_in); - } else { - animateCollapse(); - setViewVisibility(mCurtains, View.VISIBLE, R.anim.lights_out_in); - setViewVisibility(mBarContents, View.GONE, R.anim.status_bar_out); - } + mHandler.removeMessages(MSG_LIGHTS_OUT); + mHandler.removeMessages(MSG_LIGHTS_ON); + mHandler.sendEmptyMessage(on ? MSG_LIGHTS_ON : MSG_LIGHTS_OUT); } public void setMenuKeyVisible(boolean visible) { @@ -750,26 +756,41 @@ public class TabletStatusBarService extends StatusBarService { } private class ClockTouchListener implements View.OnTouchListener { - VelocityTracker mVT; + VelocityTracker mVT = null; + int mInitX, mInitY; public boolean onTouch (View v, MotionEvent event) { + final int x = (int) event.getX(); + final int y = (int) event.getY(); switch (event.getAction()) { case MotionEvent.ACTION_DOWN: mVT = VelocityTracker.obtain(); - // fall through + mInitX = x; + mInitY = y; + mHandler.sendEmptyMessageDelayed(MSG_LIGHTS_OUT, + ViewConfiguration.getLongPressTimeout()); + break; case MotionEvent.ACTION_OUTSIDE: case MotionEvent.ACTION_MOVE: + final Rect r = new Rect(); + final float radius = mSystemInfo.getHeight() / 2; + if (Math.abs(x - mInitX) > radius || Math.abs(y - mInitY) > radius) { + mHandler.removeMessages(MSG_LIGHTS_OUT); + } if (mVT == null) break; mVT.addMovement(event); mVT.computeCurrentVelocity(1000); if (mVT.getYVelocity() < -200 && mSystemPanel.getVisibility() == View.GONE) { mHandler.removeMessages(MSG_OPEN_SYSTEM_PANEL); mHandler.sendEmptyMessage(MSG_OPEN_SYSTEM_PANEL); + } else if (mVT.getYVelocity() > 200) { + mHandler.sendEmptyMessage(MSG_LIGHTS_OUT); } return true; case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: mVT.recycle(); mVT = null; + mHandler.removeMessages(MSG_LIGHTS_OUT); return true; } return false; @@ -784,8 +805,6 @@ public class TabletStatusBarService extends StatusBarService { onClickDoNotDisturb(); } else if (v == mNotificationTrigger) { onClickNotificationTrigger(); - } else if (v == mSystemInfo) { - onClickSystemInfo(); } else if (v == mRecentButton) { onClickRecentButton(); } @@ -1172,19 +1191,11 @@ public class TabletStatusBarService extends StatusBarService { } public void onClick(View v) { - try { - mBarService.setLightsOn(mOn); - } catch (RemoteException ex) { - // system process - } + setLightsOn(mOn); } public boolean onLongClick(View v) { - try { - mBarService.setLightsOn(mOn); - } catch (RemoteException ex) { - // system process - } + setLightsOn(mOn); return true; } |