From ce70d91844d2e4fb987617d2924ae5b73096e5c3 Mon Sep 17 00:00:00 2001 From: Daniel Sandler Date: Thu, 2 Sep 2010 11:59:41 -0400 Subject: [PATCH] Lights out. Not yet wired up to FLAG_FULLSCREEN; right now you must invoke it manually by longpressing on the clock area. Bug: 2905073 Change-Id: I43a005f2e4c08edb3673aef523bcaa1e088e8a71 --- packages/SystemUI/proguard.flags | 1 + packages/SystemUI/res/anim/lights_out_in.xml | 25 ++++++++++++ packages/SystemUI/res/anim/lights_out_out.xml | 25 ++++++++++++ packages/SystemUI/res/anim/status_bar_in.xml | 25 ++++++++++++ packages/SystemUI/res/anim/status_bar_out.xml | 25 ++++++++++++ .../SystemUI/res/layout-xlarge/status_bar.xml | 25 ++++++++++-- .../tablet/TabletStatusBarService.java | 40 +++++++++++++++++++ 7 files changed, 162 insertions(+), 4 deletions(-) create mode 100644 packages/SystemUI/res/anim/lights_out_in.xml create mode 100644 packages/SystemUI/res/anim/lights_out_out.xml create mode 100644 packages/SystemUI/res/anim/status_bar_in.xml create mode 100644 packages/SystemUI/res/anim/status_bar_out.xml diff --git a/packages/SystemUI/proguard.flags b/packages/SystemUI/proguard.flags index 72bd77666aff7..5e48461d4b6ed 100644 --- a/packages/SystemUI/proguard.flags +++ b/packages/SystemUI/proguard.flags @@ -2,4 +2,5 @@ public void notificationIconsClicked(android.view.View); public void systemInfoClicked(android.view.View); public void recentButtonClicked(android.view.View); + public void toggleLightsOut(android.view.View); } diff --git a/packages/SystemUI/res/anim/lights_out_in.xml b/packages/SystemUI/res/anim/lights_out_in.xml new file mode 100644 index 0000000000000..0f0e7ce35c0d9 --- /dev/null +++ b/packages/SystemUI/res/anim/lights_out_in.xml @@ -0,0 +1,25 @@ + + + + + + + diff --git a/packages/SystemUI/res/anim/lights_out_out.xml b/packages/SystemUI/res/anim/lights_out_out.xml new file mode 100644 index 0000000000000..cb895d9cc9bbe --- /dev/null +++ b/packages/SystemUI/res/anim/lights_out_out.xml @@ -0,0 +1,25 @@ + + + + + + + diff --git a/packages/SystemUI/res/anim/status_bar_in.xml b/packages/SystemUI/res/anim/status_bar_in.xml new file mode 100644 index 0000000000000..48663f4cae444 --- /dev/null +++ b/packages/SystemUI/res/anim/status_bar_in.xml @@ -0,0 +1,25 @@ + + + + + + + diff --git a/packages/SystemUI/res/anim/status_bar_out.xml b/packages/SystemUI/res/anim/status_bar_out.xml new file mode 100644 index 0000000000000..b3f895341bb8d --- /dev/null +++ b/packages/SystemUI/res/anim/status_bar_out.xml @@ -0,0 +1,25 @@ + + + + + + + diff --git a/packages/SystemUI/res/layout-xlarge/status_bar.xml b/packages/SystemUI/res/layout-xlarge/status_bar.xml index 1d04f6780c141..f4040d91b2ecd 100644 --- a/packages/SystemUI/res/layout-xlarge/status_bar.xml +++ b/packages/SystemUI/res/layout-xlarge/status_bar.xml @@ -19,13 +19,16 @@ --> - + - + + + + + 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 a7ecb86d17963..5dc46d0c8a191 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarService.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarService.java @@ -33,6 +33,8 @@ import android.os.IBinder; import android.os.Message; import android.os.RemoteException; import android.util.Slog; +import android.view.animation.Animation; +import android.view.animation.AnimationUtils; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; @@ -82,6 +84,9 @@ public class TabletStatusBarService extends StatusBarService { ImageView mSignalMeter; ImageView mSignalIcon; + View mBarContents; + View mCurtains; + NotificationIconArea.IconLayout mIconLayout; KickerController mKicker; @@ -150,6 +155,19 @@ public class TabletStatusBarService extends StatusBarService { final View sb = View.inflate(this, R.layout.status_bar, null); mStatusBarView = sb; + mBarContents = sb.findViewById(R.id.bar_contents); + mCurtains = sb.findViewById(R.id.lights_out); + View systemInfo = sb.findViewById(R.id.systemInfo); + View.OnLongClickListener toggle = new View.OnLongClickListener() { + public boolean onLongClick(View v) { + toggleLightsOut(v); + return true; + } + }; + + systemInfo.setOnLongClickListener(toggle); + mCurtains.setOnLongClickListener(toggle); + // the more notifications icon mNotificationIconArea = (NotificationIconArea)sb.findViewById(R.id.notificationIcons); @@ -719,6 +737,28 @@ public class TabletStatusBarService extends StatusBarService { return true; } + + protected void setLightsOut(boolean out) { + if (out) { + mCurtains.setAnimation(AnimationUtils.loadAnimation((Context)this, + R.anim.lights_out_in)); + mCurtains.setVisibility(View.VISIBLE); + mBarContents.setAnimation(AnimationUtils.loadAnimation((Context)this, + R.anim.status_bar_out)); + mBarContents.setVisibility(View.GONE); + } else { + mCurtains.setAnimation(AnimationUtils.loadAnimation((Context)this, + R.anim.lights_out_out)); + mCurtains.setVisibility(View.GONE); + mBarContents.setAnimation(AnimationUtils.loadAnimation((Context)this, + R.anim.status_bar_in)); + mBarContents.setVisibility(View.VISIBLE); + } + } + + public void toggleLightsOut(View v) { + setLightsOut(mCurtains.getVisibility() != View.VISIBLE); + } }