summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorDaniel Sandler <dsandler@google.com>2011-01-20 02:53:43 -0500
committerDaniel Sandler <dsandler@google.com>2011-01-20 03:07:02 -0500
commitadd26204231e2e40cf4a44774a3858cf05282539 (patch)
tree4ff4a292ecfd1a42dcf4461062e6f2a19eecbd9d /packages
parent9b462dc0d466e73c5580a655b224662687404ad4 (diff)
downloadframeworks_base-add26204231e2e40cf4a44774a3858cf05282539.zip
frameworks_base-add26204231e2e40cf4a44774a3858cf05282539.tar.gz
frameworks_base-add26204231e2e40cf4a44774a3858cf05282539.tar.bz2
Simplify and smooth notification panel animation.
Bug: 3322970 Change-Id: I3e658cfb542d605b13f6b7d935e32e5b8766078f
Diffstat (limited to 'packages')
-rw-r--r--packages/SystemUI/res/layout-xlarge/status_bar_notification_panel.xml13
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java40
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java2
3 files changed, 25 insertions, 30 deletions
diff --git a/packages/SystemUI/res/layout-xlarge/status_bar_notification_panel.xml b/packages/SystemUI/res/layout-xlarge/status_bar_notification_panel.xml
index 26e045c..33dda03 100644
--- a/packages/SystemUI/res/layout-xlarge/status_bar_notification_panel.xml
+++ b/packages/SystemUI/res/layout-xlarge/status_bar_notification_panel.xml
@@ -18,20 +18,13 @@
<com.android.systemui.statusbar.tablet.NotificationPanel
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:systemui="http://schemas.android.com/apk/res/com.android.systemui"
+ android:id="@+id/panel_root"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:gravity="right"
+ android:background="@drawable/notify_panel_bg_protect_tiled"
>
- <View
- android:id="@+id/scrim"
- android:background="@drawable/notify_panel_bg_protect_tiled"
- android:layout_width="512dp"
- android:layout_height="match_parent"
- android:layout_alignParentTop="true"
- android:layout_alignParentRight="true"
- />
-
<RelativeLayout
android:id="@+id/content_parent"
android:layout_height="wrap_content"
@@ -88,7 +81,7 @@
android:layout_alignTop="@id/content_parent"
android:layout_alignLeft="@id/content_parent"
android:layout_marginLeft="100dip"
- android:layout_marginTop="-100dip"
+ android:layout_marginTop="50dip"
/>
</com.android.systemui.statusbar.tablet.NotificationPanel>
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java
index 973bff9..0d30db5 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/NotificationPanel.java
@@ -54,7 +54,7 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel,
ViewGroup mContentFrame;
Rect mContentArea = new Rect();
View mSettingsView;
- View mScrim, mGlow;
+ View mGlow;
ViewGroup mContentParent;
Choreographer mChoreo = new Choreographer();
@@ -79,7 +79,6 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel,
mModeToggle = findViewById(R.id.mode_toggle);
mModeToggle.setOnClickListener(this);
- mScrim = findViewById(R.id.scrim);
mGlow = findViewById(R.id.glow);
mSettingsButton = (ImageView)findViewById(R.id.settings_button);
@@ -192,18 +191,21 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel,
AnimatorSet mContentAnim;
// should group this into a multi-property animation
- final int OPEN_DURATION = 136;
+ final int OPEN_DURATION = 250;
final int CLOSE_DURATION = 250;
// the panel will start to appear this many px from the end
- final int HYPERSPACE_OFFRAMP = 30;
+ final int HYPERSPACE_OFFRAMP = 100;
Choreographer() {
}
void createAnimation(boolean appearing) {
- Animator bgAnim = ObjectAnimator.ofFloat(mScrim,
- "alpha", mScrim.getAlpha(), appearing ? 1 : 0);
+ // mVisible: previous state; appearing: new state
+
+ View root = findViewById(R.id.panel_root);
+ Animator bgAnim = ObjectAnimator.ofInt(root.getBackground(), "alpha",
+ mVisible ? 255 : 0, appearing ? 255 : 0);
float start, end;
@@ -213,34 +215,33 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel,
if (appearing) {
// we want to go from near-the-top to the top, unless we're half-open in the right
// general vicinity
- start = (y < HYPERSPACE_OFFRAMP)
- ? y
- : HYPERSPACE_OFFRAMP;
+ start = (y < HYPERSPACE_OFFRAMP) ? y : HYPERSPACE_OFFRAMP;
end = 0;
} else {
start = y;
end = y + HYPERSPACE_OFFRAMP;
}
- Animator posAnim = ObjectAnimator.ofFloat(mContentParent, "translationY", start, end);
+ Animator posAnim = ObjectAnimator.ofFloat(mContentParent, "translationY",
+ start, end);
posAnim.setInterpolator(appearing
- ? new android.view.animation.DecelerateInterpolator(2.0f)
- : new android.view.animation.AccelerateInterpolator(2.0f));
+ ? new android.view.animation.DecelerateInterpolator(1.0f)
+ : new android.view.animation.AccelerateInterpolator(1.0f));
- Animator glowAnim = ObjectAnimator.ofFloat(mGlow, "alpha",
- mGlow.getAlpha(), appearing ? 1.0f : 0.0f);
+ Animator glowAnim = ObjectAnimator.ofInt(mGlow.getBackground(), "alpha",
+ mVisible ? 255 : 0, appearing ? 255 : 0);
glowAnim.setInterpolator(appearing
? new android.view.animation.AccelerateInterpolator(1.0f)
: new android.view.animation.DecelerateInterpolator(1.0f));
mContentAnim = new AnimatorSet();
mContentAnim
- .play(ObjectAnimator.ofFloat(mContentParent, "alpha", mContentParent.getAlpha(),
- appearing ? 1.0f : 0.0f))
- .with(glowAnim)
+ .play(ObjectAnimator.ofFloat(mContentParent, "alpha",
+ mContentParent.getAlpha(), appearing ? 1.0f : 0.0f))
.with(bgAnim)
+ .with(glowAnim)
.with(posAnim)
;
- mContentAnim.setDuration(appearing ? OPEN_DURATION : CLOSE_DURATION);
+ mContentAnim.setDuration((DEBUG?10:1)*(appearing ? OPEN_DURATION : CLOSE_DURATION));
mContentAnim.addListener(this);
}
@@ -250,13 +251,13 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel,
createAnimation(appearing);
mContentParent.setLayerType(View.LAYER_TYPE_HARDWARE, null);
+ mGlow.setLayerType(View.LAYER_TYPE_HARDWARE, null);
mContentAnim.start();
mVisible = appearing;
}
void jumpTo(boolean appearing) {
-// setBgAlpha(appearing ? 255 : 0);
mContentParent.setTranslationY(appearing ? 0 : mPanelHeight);
}
@@ -286,6 +287,7 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel,
setVisibility(View.GONE);
}
mContentParent.setLayerType(View.LAYER_TYPE_NONE, null);
+ mGlow.setLayerType(View.LAYER_TYPE_NONE, null);
mContentAnim = null;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
index 6db74d1..a3a58ed 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
@@ -189,7 +189,7 @@ public class TabletStatusBar extends StatusBar implements
mStatusBarView.setIgnoreChildren(0, mNotificationTrigger, mNotificationPanel);
WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
- 720, // ViewGroup.LayoutParams.MATCH_PARENT,
+ 512, // ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL,
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN