summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorDaniel Sandler <dsandler@android.com>2012-04-26 01:10:29 -0400
committerDaniel Sandler <dsandler@android.com>2012-04-26 01:24:18 -0400
commitd7e96866568cc94305db1455f4e9a9b8ada70618 (patch)
treecbd7ba96b050876dbe7e9727bc623d30e0b00fe4 /packages
parent1fa1de527e541c88fb3809279b67b0dc29419bac (diff)
downloadframeworks_base-d7e96866568cc94305db1455f4e9a9b8ada70618.zip
frameworks_base-d7e96866568cc94305db1455f4e9a9b8ada70618.tar.gz
frameworks_base-d7e96866568cc94305db1455f4e9a9b8ada70618.tar.bz2
Lights out improvements.
+ Finally implemented LO in the top status bar. + Tightened up LO animations on nav bar (swap icons for dots all at once rather than in sequence). Bug: 6374406 (status bar lights out) Bug: 5854958 (tighten up) Change-Id: Id1393cef0b4281e062c1704d916843641da19dc4
Diffstat (limited to 'packages')
-rw-r--r--packages/SystemUI/res/layout/status_bar.xml12
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java5
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java82
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