diff options
author | Joe Onorato <joeo@google.com> | 2010-09-12 17:03:19 -0400 |
---|---|---|
committer | Joe Onorato <joeo@google.com> | 2010-09-12 17:06:01 -0400 |
commit | f63b0f44eb53f535a65bd83dbc1d8b95abc501da (patch) | |
tree | 3ce4d9acada556c3f7658e420ba21602466776fd /packages/SystemUI/src/com/android/systemui | |
parent | 9305647eb61bb60a1f42481a0c0d208dc9bbe965 (diff) | |
download | frameworks_base-f63b0f44eb53f535a65bd83dbc1d8b95abc501da.zip frameworks_base-f63b0f44eb53f535a65bd83dbc1d8b95abc501da.tar.gz frameworks_base-f63b0f44eb53f535a65bd83dbc1d8b95abc501da.tar.bz2 |
Connect my plumbing to dsandler's awesome lights out mode.
It took a little bit of refactoring to move the authoritative state
about whether the lights are on or not into the StatusBarManagerService,
so that if the system ui process crashes, the bar comes up in the
right mode.
Change-Id: I95cfaf8f78ca4443ded5262272ea755d44dc5d17
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarService.java | 73 |
1 files changed, 43 insertions, 30 deletions
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 b33af99..5ba1fab 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarService.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBarService.java @@ -150,15 +150,12 @@ public class TabletStatusBarService extends StatusBarService { 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); + + systemInfo.setOnLongClickListener(new SetLightsOnListener(false)); + + SetLightsOnListener on = new SetLightsOnListener(true); + mCurtains.setOnClickListener(on); + mCurtains.setOnLongClickListener(on); // the more notifications icon mNotificationIconArea = (NotificationIconArea)sb.findViewById(R.id.notificationIcons); @@ -492,11 +489,22 @@ public class TabletStatusBarService extends StatusBarService { } public void setLightsOn(boolean on) { - //Slog.d(TAG, "setLightsOn on=" + on); - if (!on) { + if (on) { + 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); + } else { animateCollapse(); + 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); } - // TODO: implement lights out mode } public void notificationIconsClicked(View v) { @@ -738,26 +746,31 @@ 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 class SetLightsOnListener implements View.OnLongClickListener, + View.OnClickListener { + private boolean mOn; + + SetLightsOnListener(boolean on) { + mOn = on; + } + + public void onClick(View v) { + try { + mBarService.setLightsOn(mOn); + } catch (RemoteException ex) { + // system process + } + } + + public boolean onLongClick(View v) { + try { + mBarService.setLightsOn(mOn); + } catch (RemoteException ex) { + // system process + } + return true; } - } - public void toggleLightsOut(View v) { - setLightsOut(mCurtains.getVisibility() != View.VISIBLE); } } |