diff options
author | Daniel Sandler <dsandler@android.com> | 2011-08-11 05:17:03 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-08-11 05:17:03 -0700 |
commit | 0c5c6a6f27b70ca190f95fae2bdb9596ae1167c4 (patch) | |
tree | eac7745e6f4e1fd356afb2acf34f1267e2d3aa4f /packages | |
parent | 6a9a4a078c11f1193498873059ada44c914ba8dd (diff) | |
parent | 0761e4cd95b6968dd4b1659a766ef504d13f6d50 (diff) | |
download | frameworks_base-0c5c6a6f27b70ca190f95fae2bdb9596ae1167c4.zip frameworks_base-0c5c6a6f27b70ca190f95fae2bdb9596ae1167c4.tar.gz frameworks_base-0c5c6a6f27b70ca190f95fae2bdb9596ae1167c4.tar.bz2 |
Merge "Clean up some effects in the phone notification panel."
Diffstat (limited to 'packages')
4 files changed, 59 insertions, 62 deletions
diff --git a/packages/SystemUI/res/layout/status_bar_expanded.xml b/packages/SystemUI/res/layout/status_bar_expanded.xml index dbbaf96..b63afbe 100644 --- a/packages/SystemUI/res/layout/status_bar_expanded.xml +++ b/packages/SystemUI/res/layout/status_bar_expanded.xml @@ -86,6 +86,16 @@ android:layout_height="wrap_content" android:layout_weight="1" > + <TextView android:id="@+id/noNotificationsTitle" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:textAppearance="@android:style/TextAppearance.Large" + android:padding="8dp" + android:layout_gravity="top" + android:gravity="center" + android:text="@string/status_bar_no_notifications_title" + /> + <ScrollView android:id="@+id/scroll" android:layout_width="match_parent" @@ -93,29 +103,12 @@ android:fadingEdge="none" android:overScrollMode="ifContentScrolls" > - <LinearLayout - android:id="@+id/notificationLinearLayout" + <com.android.systemui.statusbar.policy.NotificationRowLayout + android:id="@+id/latestItems" android:layout_width="match_parent" android:layout_height="wrap_content" - android:orientation="vertical" - > - - <TextView android:id="@+id/noNotificationsTitle" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:textAppearance="@android:style/TextAppearance.Large" - android:padding="8dp" - android:gravity="center" - android:text="@string/status_bar_no_notifications_title" - /> - - <com.android.systemui.statusbar.policy.NotificationRowLayout - android:id="@+id/latestItems" - android:layout_width="match_parent" - android:layout_height="wrap_content" - systemui:rowHeight="@dimen/notification_height" - /> - </LinearLayout> + systemui:rowHeight="@dimen/notification_height" + /> </ScrollView> <ImageView diff --git a/packages/SystemUI/src/com/android/systemui/SwipeHelper.java b/packages/SystemUI/src/com/android/systemui/SwipeHelper.java index 6ecfd94..2818f87 100644 --- a/packages/SystemUI/src/com/android/systemui/SwipeHelper.java +++ b/packages/SystemUI/src/com/android/systemui/SwipeHelper.java @@ -43,6 +43,7 @@ public class SwipeHelper { private float SWIPE_ESCAPE_VELOCITY = 100f; // dp/sec private int MAX_ESCAPE_ANIMATION_DURATION = 500; // ms + private int MAX_DISMISS_VELOCITY = 1000; // dp/sec private static final int SNAP_ANIM_LEN = SLOW_ANIMATIONS ? 1000 : 250; // ms public static float ALPHA_FADE_START = 0.8f; // fraction of thumbnail width @@ -281,7 +282,7 @@ public class SwipeHelper { case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: if (mCurrView != null) { - float maxVelocity = 1000; // px/sec + float maxVelocity = MAX_DISMISS_VELOCITY * mDensityScale; mVelocityTracker.computeCurrentVelocity(1000 /* px/sec */, maxVelocity); float escapeVelocity = SWIPE_ESCAPE_VELOCITY * mDensityScale; float velocity = getVelocity(mVelocityTracker); 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 823efae..ba1de7c 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,7 @@ package com.android.systemui.statusbar.phone; +import android.animation.ObjectAnimator; import android.app.ActivityManagerNative; import android.app.Dialog; import android.app.Notification; @@ -137,7 +138,6 @@ public class PhoneStatusBar extends StatusBar { ExpandedView mExpandedView; WindowManager.LayoutParams mExpandedParams; ScrollView mScrollView; - View mNotificationLinearLayout; View mExpandedContents; // top bar TextView mNoNotificationsTitle; @@ -311,16 +311,18 @@ public class PhoneStatusBar extends StatusBar { mExpandedDialog = new ExpandedDialog(context); mExpandedView = expanded; - mExpandedContents = expanded.findViewById(R.id.notificationLinearLayout); mPile = (ViewGroup)expanded.findViewById(R.id.latestItems); + mExpandedContents = mPile; // was: expanded.findViewById(R.id.notificationLinearLayout); mNoNotificationsTitle = (TextView)expanded.findViewById(R.id.noNotificationsTitle); + mNoNotificationsTitle.setAlpha(0f); + mNoNotificationsTitle.setVisibility(View.VISIBLE); mClearButton = expanded.findViewById(R.id.clear_all_button); mClearButton.setOnClickListener(mClearButtonListener); + mClearButton.setAlpha(0f); mDateView = (DateView)expanded.findViewById(R.id.date); mSettingsButton = expanded.findViewById(R.id.settings_button); mSettingsButton.setOnClickListener(mSettingsButtonListener); mScrollView = (ScrollView)expanded.findViewById(R.id.scroll); - mNotificationLinearLayout = expanded.findViewById(R.id.notificationLinearLayout); mTicker = new MyTicker(context, sb); @@ -707,9 +709,10 @@ public class PhoneStatusBar extends StatusBar { mTicker.removeEntry(old); // Recalculate the position of the sliding windows and the titles. - setAreThereNotifications(); updateExpandedViewPos(EXPANDED_LEAVE_ALONE); } + + setAreThereNotifications(); } @Override @@ -1014,13 +1017,37 @@ public class PhoneStatusBar extends StatusBar { } private void setAreThereNotifications() { - mClearButton.setVisibility(mNotificationData.hasClearableItems() - ? View.VISIBLE - : View.INVISIBLE); + final boolean any = mNotificationData.size() > 0; - mNoNotificationsTitle.setVisibility(mNotificationData.size() > 0 - ? View.GONE - : View.VISIBLE); + final boolean clearable = any && mNotificationData.hasClearableItems(); + + if (DEBUG) { + Slog.d(TAG, "setAreThereNotifications: N=" + mNotificationData.size() + + " any=" + any + " clearable=" + clearable); + } + + if (mClearButton.isShown()) { + if (clearable != (mClearButton.getAlpha() == 1.0f)) { + ObjectAnimator.ofFloat(mClearButton, "alpha", + clearable ? 1.0f : 0.0f) + .setDuration(250) + .start(); + } + } else { + mClearButton.setAlpha(clearable ? 1.0f : 0.0f); + } + + if (mNoNotificationsTitle.isShown()) { + if (any != (mNoNotificationsTitle.getAlpha() == 0.0f)) { + ObjectAnimator a = ObjectAnimator.ofFloat(mNoNotificationsTitle, "alpha", + (any ? 0.0f : 0.75f)); + a.setDuration(any ? 0 : 500); + a.setStartDelay(any ? 250 : 1000); + a.start(); + } + } else { + mNoNotificationsTitle.setAlpha(any ? 0.0f : 0.75f); + } } @@ -1662,7 +1689,6 @@ public class PhoneStatusBar extends StatusBar { pw.println(" mTickerView: " + viewInfo(mTickerView)); pw.println(" mScrollView: " + viewInfo(mScrollView) + " scroll " + mScrollView.getScrollX() + "," + mScrollView.getScrollY()); - pw.println("mNotificationLinearLayout: " + viewInfo(mNotificationLinearLayout)); } /* synchronized (mNotificationData) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java index 2a0dfb5..469b462 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java @@ -166,20 +166,16 @@ public class NotificationRowLayout extends ViewGroup implements SwipeHelper.Call mAppearingViews.add(child); child.setPivotY(0); - AnimatorSet a = new AnimatorSet(); - a.playTogether( - ObjectAnimator.ofFloat(child, "alpha", 0f, 1f) -// ,ObjectAnimator.ofFloat(child, "scaleY", 0f, 1f) - ); - a.setDuration(APPEAR_ANIM_LEN); - a.addListener(new AnimatorListenerAdapter() { + final ObjectAnimator alphaFade = ObjectAnimator.ofFloat(child, "alpha", 0f, 1f); + alphaFade.setDuration(APPEAR_ANIM_LEN); + alphaFade.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { mAppearingViews.remove(childF); requestLayout(); // pick up any final changes in position } }); - a.start(); + alphaFade.start(); requestLayout(); // start the container animation } } @@ -195,23 +191,10 @@ public class NotificationRowLayout extends ViewGroup implements SwipeHelper.Call child.setPivotY(0); - //final float velocity = (mSlidingChild == child) - // ? Math.min(mLiftoffVelocity, SWIPE_ANIM_VELOCITY_MIN) - // : SWIPE_ESCAPE_VELOCITY; - final float velocity = 0f; - final TimeAnimator zoom = new TimeAnimator(); - zoom.setTimeListener(new TimeAnimator.TimeListener() { - @Override - public void onTimeUpdate(TimeAnimator animation, long totalTime, long deltaTime) { - childF.setTranslationX(childF.getTranslationX() + deltaTime / 1000f * velocity); - } - }); - final ObjectAnimator alphaFade = ObjectAnimator.ofFloat(child, "alpha", 0f); alphaFade.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { - zoom.cancel(); // it won't end on its own if (DEBUG) Slog.d(TAG, "actually removing child: " + childF); NotificationRowLayout.super.removeView(childF); childF.setAlpha(1f); @@ -220,14 +203,8 @@ public class NotificationRowLayout extends ViewGroup implements SwipeHelper.Call } }); - AnimatorSet a = new AnimatorSet(); - a.playTogether(alphaFade, zoom); - -// ,ObjectAnimator.ofFloat(child, "scaleY", 0f) -// ,ObjectAnimator.ofFloat(child, "translationX", child.getTranslationX() + 300f) - - a.setDuration(DISAPPEAR_ANIM_LEN); - a.start(); + alphaFade.setDuration(DISAPPEAR_ANIM_LEN); + alphaFade.start(); requestLayout(); // start the container animation } else { super.removeView(child); |