diff options
author | Daniel Sandler <dsandler@android.com> | 2012-04-27 04:56:08 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-04-27 04:56:08 -0700 |
commit | c2ee231b5e55f2a6914de2fe7fa3324c9d0aa4ed (patch) | |
tree | 22701f0e7f4271fc0d2937c42589742b1d10f5cd /packages | |
parent | 7e279bc91ae1d9a59f00724a2c28ab840bd73423 (diff) | |
parent | d7e96866568cc94305db1455f4e9a9b8ada70618 (diff) | |
download | frameworks_base-c2ee231b5e55f2a6914de2fe7fa3324c9d0aa4ed.zip frameworks_base-c2ee231b5e55f2a6914de2fe7fa3324c9d0aa4ed.tar.gz frameworks_base-c2ee231b5e55f2a6914de2fe7fa3324c9d0aa4ed.tar.bz2 |
Merge "Lights out improvements." into jb-dev
Diffstat (limited to 'packages')
3 files changed, 95 insertions, 4 deletions
diff --git a/packages/SystemUI/res/layout/status_bar.xml b/packages/SystemUI/res/layout/status_bar.xml index 0ba8cce..f565e75 100644 --- a/packages/SystemUI/res/layout/status_bar.xml +++ b/packages/SystemUI/res/layout/status_bar.xml @@ -29,6 +29,17 @@ android:fitsSystemWindows="true" > + <ImageView + android:id="@+id/notification_lights_out" + android:layout_width="@dimen/status_bar_icon_size" + android:layout_height="match_parent" + android:paddingLeft="6dip" + android:paddingBottom="2dip" + android:src="@drawable/ic_sysbar_lights_out_dot_small" + android:scaleType="center" + android:visibility="gone" + /> + <LinearLayout android:id="@+id/icons" android:layout_width="match_parent" android:layout_height="match_parent" @@ -38,6 +49,7 @@ > <LinearLayout + android:id="@+id/notification_icon_area" android:layout_width="0dip" android:layout_height="match_parent" android:layout_weight="1" diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java index 73c5d3a..8d9fcce 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java @@ -250,7 +250,7 @@ public class NavigationBarView extends LinearLayout { } else { navButtons.animate() .alpha(lightsOut ? 0f : 1f) - .setDuration(lightsOut ? 600 : 200) + .setDuration(lightsOut ? 750 : 250) .start(); lowLights.setOnTouchListener(mLightsOutListener); @@ -260,8 +260,7 @@ public class NavigationBarView extends LinearLayout { } lowLights.animate() .alpha(lightsOut ? 1f : 0f) - .setStartDelay(lightsOut ? 500 : 0) - .setDuration(lightsOut ? 1000 : 300) + .setDuration(lightsOut ? 750 : 250) .setInterpolator(new AccelerateInterpolator(2.0f)) .setListener(lightsOut ? null : new AnimatorListenerAdapter() { @Override diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index 80ee64f..8586185 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -16,6 +16,9 @@ package com.android.systemui.statusbar.phone; +import android.animation.Animator; +import android.animation.AnimatorListenerAdapter; +import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.app.ActivityManager; import android.app.ActivityManagerNative; @@ -55,6 +58,7 @@ import android.view.ViewGroup.LayoutParams; import android.view.Window; import android.view.WindowManager; import android.view.WindowManagerImpl; +import android.view.animation.AccelerateInterpolator; import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.widget.ImageView; @@ -207,6 +211,8 @@ public class PhoneStatusBar extends BaseStatusBar { int[] mAbsPos = new int[2]; Runnable mPostCollapseCleanup = null; + private AnimatorSet mLightsOutAnimation; + private AnimatorSet mLightsOnAnimation; // for disabling the status bar int mDisabled = 0; @@ -935,7 +941,26 @@ public class PhoneStatusBar extends BaseStatusBar { mClearButton.setAlpha(clearable ? 1.0f : 0.0f); } mClearButton.setEnabled(clearable); - + + final View nlo = mStatusBarView.findViewById(R.id.notification_lights_out); + final boolean showDot = (any&&!areLightsOn()); + if (showDot != (nlo.getAlpha() == 1.0f)) { + if (showDot) { + nlo.setAlpha(0f); + nlo.setVisibility(View.VISIBLE); + } + nlo.animate() + .alpha(showDot?1:0) + .setDuration(showDot?750:250) + .setInterpolator(new AccelerateInterpolator(2.0f)) + .setListener(showDot ? null : new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator _a) { + nlo.setVisibility(View.GONE); + } + }) + .start(); + } } public void showClock(boolean show) { @@ -1372,6 +1397,10 @@ public class PhoneStatusBar extends BaseStatusBar { final int hitSize = statusBarSize*2; final int y = (int)event.getRawY(); if (action == MotionEvent.ACTION_DOWN) { + if (!areLightsOn()) { + setLightsOn(true); + } + if (!mExpanded) { mViewDelta = statusBarSize - y; } else { @@ -1470,16 +1499,64 @@ public class PhoneStatusBar extends BaseStatusBar { final boolean lightsOut = (0 != (vis & View.SYSTEM_UI_FLAG_LOW_PROFILE)); if (lightsOut) { animateCollapse(); + if (mTicking) { + mTicker.halt(); + } } + if (mNavigationBarView != null) { mNavigationBarView.setLowProfile(lightsOut); } + + setStatusBarLowProfile(lightsOut); } notifyUiVisibilityChanged(); } } + private void setStatusBarLowProfile(boolean lightsOut) { + if (mLightsOutAnimation == null) { + final View notifications = mStatusBarView.findViewById(R.id.notification_icon_area); + final View systemIcons = mStatusBarView.findViewById(R.id.statusIcons); + final View signal = mStatusBarView.findViewById(R.id.signal_cluster); + final View battery = mStatusBarView.findViewById(R.id.battery); + final View clock = mStatusBarView.findViewById(R.id.clock); + + mLightsOutAnimation = new AnimatorSet(); + mLightsOutAnimation.playTogether( + ObjectAnimator.ofFloat(notifications, View.ALPHA, 0), + ObjectAnimator.ofFloat(systemIcons, View.ALPHA, 0), + ObjectAnimator.ofFloat(signal, View.ALPHA, 0), + ObjectAnimator.ofFloat(battery, View.ALPHA, 0.5f), + ObjectAnimator.ofFloat(clock, View.ALPHA, 0.5f) + ); + mLightsOutAnimation.setDuration(750); + + mLightsOnAnimation = new AnimatorSet(); + mLightsOnAnimation.playTogether( + ObjectAnimator.ofFloat(notifications, View.ALPHA, 1), + ObjectAnimator.ofFloat(systemIcons, View.ALPHA, 1), + ObjectAnimator.ofFloat(signal, View.ALPHA, 1), + ObjectAnimator.ofFloat(battery, View.ALPHA, 1), + ObjectAnimator.ofFloat(clock, View.ALPHA, 1) + ); + mLightsOnAnimation.setDuration(250); + } + + mLightsOutAnimation.cancel(); + mLightsOnAnimation.cancel(); + + final Animator a = lightsOut ? mLightsOutAnimation : mLightsOnAnimation; + a.start(); + + setAreThereNotifications(); + } + + private boolean areLightsOn() { + return 0 == (mSystemUiVisibility & View.SYSTEM_UI_FLAG_LOW_PROFILE); + } + public void setLightsOn(boolean on) { Log.v(TAG, "setLightsOn(" + on + ")"); if (on) { @@ -1580,6 +1657,9 @@ public class PhoneStatusBar extends BaseStatusBar { } private void tick(StatusBarNotification n) { + // no ticking in lights-out mode + if (!areLightsOn()) return; + // Show the ticker if one is requested. Also don't do this // until status bar window is attached to the window manager, // because... well, what's the point otherwise? And trying to |