Merge "Refresh tablet notification drawer."

This commit is contained in:
Daniel Sandler
2011-08-02 04:39:46 -07:00
committed by Android (Google) Code Review
36 changed files with 83 additions and 40 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 531 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 532 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 143 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1011 B

After

Width:  |  Height:  |  Size: 107 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 157 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 159 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 463 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 465 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 212 B

After

Width:  |  Height:  |  Size: 98 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 157 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 159 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 722 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 748 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 B

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2010 The Android Open Source Project
<!-- Copyright (C) 2011 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -15,7 +15,7 @@
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/status_bar_veto_pressed" />
<item android:drawable="@drawable/status_bar_veto_normal" />
<item android:state_pressed="true"
android:drawable="@drawable/ic_notify_clear_pressed" />
<item android:drawable="@drawable/ic_notify_clear_normal" />
</selector>

View File

@@ -35,6 +35,18 @@
android:clipChildren="false"
>
<ImageView android:id="@+id/clear_all_button"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:layout_marginTop="1dp"
android:layout_marginRight="20dp"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:src="@drawable/ic_notify_clear"
android:visibility="invisible"
/>
<!-- notification icons & panel access -->
<include layout="@layout/status_bar_notification_area"
android:layout_width="wrap_content"

View File

@@ -22,7 +22,6 @@
android:layout_height="match_parent"
android:layout_width="match_parent"
android:gravity="right"
android:background="@drawable/notify_panel_bg_protect_tiled"
>
<RelativeLayout
@@ -31,12 +30,12 @@
android:layout_width="match_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="-27dip"
android:layout_marginBottom="8dp"
>
<include layout="@layout/status_bar_notification_panel_title"
android:layout_width="471dp"
android:layout_height="465dp"
android:layout_width="478dp"
android:layout_height="224dp"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
/>
@@ -45,11 +44,11 @@
android:id="@+id/content_frame"
android:background="@drawable/notify_panel_notify_bg"
android:layout_height="wrap_content"
android:layout_width="447dp"
android:layout_width="478dp"
android:orientation="vertical"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginTop="352dp"
android:layout_marginTop="178dp"
>
<ScrollView
android:id="@+id/notification_scroller"

View File

@@ -47,19 +47,13 @@
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="?android:attr/textColorSecondary"
/>
<TextView android:id="@+id/clear_all_button"
<ImageView android:id="@+id/clear_all_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_marginTop="4dp"
android:layout_marginBottom="1dp"
android:textSize="14sp"
android:textColor="#ff000000"
android:text="@string/status_bar_clear_all_button"
style="?android:attr/buttonStyle"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:background="@drawable/btn_default_small"
android:src="@drawable/ic_notify_clear"
/>
</LinearLayout>

View File

@@ -3,15 +3,13 @@
android:layout_height="@dimen/notification_height"
>
<ImageButton
<Button
android:id="@+id/veto"
android:layout_width="48dp"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:layout_marginRight="-80dp"
android:src="@drawable/status_bar_veto"
android:scaleType="center"
android:background="@null"
android:paddingRight="8dp"
android:paddingLeft="8dp"

View File

@@ -141,7 +141,7 @@ public class PhoneStatusBar extends StatusBar {
View mExpandedContents;
// top bar
TextView mNoNotificationsTitle;
TextView mClearButton;
View mClearButton;
// drag bar
CloseDragHandle mCloseView;
@@ -301,7 +301,7 @@ public class PhoneStatusBar extends StatusBar {
mExpandedContents = expanded.findViewById(R.id.notificationLinearLayout);
mPile = (ViewGroup)expanded.findViewById(R.id.latestItems);
mNoNotificationsTitle = (TextView)expanded.findViewById(R.id.noNotificationsTitle);
mClearButton = (TextView)expanded.findViewById(R.id.clear_all_button);
mClearButton = expanded.findViewById(R.id.clear_all_button);
mClearButton.setOnClickListener(mClearButtonListener);
mScrollView = (ScrollView)expanded.findViewById(R.id.scroll);
mNotificationLinearLayout = expanded.findViewById(R.id.notificationLinearLayout);
@@ -1984,7 +1984,9 @@ public class PhoneStatusBar extends StatusBar {
final Context context = mContext;
final Resources res = context.getResources();
mClearButton.setText(context.getText(R.string.status_bar_clear_all_button));
if (mClearButton instanceof TextView) {
((TextView)mClearButton).setText(context.getText(R.string.status_bar_clear_all_button));
}
mNoNotificationsTitle.setText(context.getText(R.string.status_bar_no_notifications_title));
loadDimens();

View File

@@ -49,6 +49,7 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel,
Rect mContentArea = new Rect();
View mSettingsView;
ViewGroup mContentParent;
TabletStatusBar mBar;
// amount to slide mContentParent down by when mContentFrame is missing
float mContentFrameMissingTranslation;
@@ -63,6 +64,10 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel,
super(context, attrs, defStyle);
}
public void setBar(TabletStatusBar b) {
mBar = b;
}
@Override
public void onFinishInflate() {
super.onFinishInflate();
@@ -202,15 +207,16 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel,
;
set.setDuration(200);
if (!showing) {
set.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator _a) {
set.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator _a) {
if (!showing) {
mContentFrame.setVisibility(View.GONE);
mContentFrame.setAlpha(1f);
}
});
}
updateClearButton();
}
});
set.start();
}
@@ -247,12 +253,23 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel,
removeSettingsView();
}
}
updateClearButton();
updatePanelModeButtons();
}
});
a.start();
}
public void updateClearButton() {
if (mBar != null) {
final boolean showX
= (isShowing()
&& mNotificationScroller.getVisibility() == View.VISIBLE
&& mNotificationCount > 0);
mBar.getClearButton().setVisibility(showX ? View.VISIBLE : View.INVISIBLE);
}
}
public void updatePanelModeButtons() {
final boolean settingsVisible = (mSettingsView != null);
mSettingsButton.setVisibility(!settingsVisible ? View.VISIBLE : View.INVISIBLE);
@@ -294,11 +311,11 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel,
AnimatorSet mContentAnim;
// should group this into a multi-property animation
final static int OPEN_DURATION = 136;
final static int CLOSE_DURATION = 250;
final static int OPEN_DURATION = 300;
final static int CLOSE_DURATION = 300;
// the panel will start to appear this many px from the end
final int HYPERSPACE_OFFRAMP = 100;
final int HYPERSPACE_OFFRAMP = 200;
Choreographer() {
}
@@ -306,10 +323,6 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel,
void createAnimation(boolean appearing) {
// 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;
// 0: on-screen
@@ -347,7 +360,6 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel,
mContentAnim = new AnimatorSet();
mContentAnim
.play(fadeAnim)
.with(bgAnim)
.with(posAnim)
;
mContentAnim.setDuration((DEBUG?10:1)*(appearing ? OPEN_DURATION : CLOSE_DURATION));
@@ -363,6 +375,9 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel,
mContentAnim.start();
mVisible = appearing;
// we want to start disappearing promptly
if (!mVisible) updateClearButton();
}
public void onAnimationCancel(Animator animation) {
@@ -376,6 +391,9 @@ public class NotificationPanel extends RelativeLayout implements StatusBarPanel,
}
mContentParent.setLayerType(View.LAYER_TYPE_NONE, null);
mContentAnim = null;
// we want to show the X lazily
if (mVisible) updateClearButton();
}
public void onAnimationRepeat(Animator animation) {

View File

@@ -122,6 +122,7 @@ public class TabletStatusBar extends StatusBar implements
View mNotificationTrigger;
NotificationIconArea mNotificationIconArea;
ViewGroup mNavigationArea;
View mClearButton;
boolean mNotificationDNDMode;
NotificationData.Entry mNotificationDNDDummyEntry;
@@ -187,6 +188,7 @@ public class TabletStatusBar extends StatusBar implements
// Notification Panel
mNotificationPanel = (NotificationPanel)View.inflate(context,
R.layout.status_bar_notification_panel, null);
mNotificationPanel.setBar(this);
mNotificationPanel.show(false, false);
mNotificationPanel.setOnTouchListener(
new TouchOutsideListener(MSG_CLOSE_NOTIFICATION_PANEL, mNotificationPanel));
@@ -451,6 +453,10 @@ public class TabletStatusBar extends StatusBar implements
// the more notifications icon
mNotificationIconArea = (NotificationIconArea)sb.findViewById(R.id.notificationIcons);
// the "X" that appears in place of the clock when the panel is showing notifications
mClearButton = sb.findViewById(R.id.clear_all_button);
mClearButton.setOnClickListener(mClearButtonListener);
// where the icons go
mIconLayout = (NotificationIconArea.IconLayout) sb.findViewById(R.id.icons);
mIconLayout.setOnTouchListener(new NotificationIconTouchListener());
@@ -581,6 +587,21 @@ public class TabletStatusBar extends StatusBar implements
return sb;
}
private View.OnClickListener mClearButtonListener = new View.OnClickListener() {
public void onClick(View v) {
try {
mBarService.onClearAllNotifications();
} catch (RemoteException ex) {
// system process is dead if we're here.
}
animateCollapse();
}
};
public View getClearButton() {
return mClearButton;
}
public int getStatusBarHeight() {
return mHeightReceiver.getHeight();
}
@@ -1183,7 +1204,6 @@ public class TabletStatusBar extends StatusBar implements
}
private void setAreThereNotifications() {
final boolean hasClearable = mNotificationData.hasClearableItems();
}
/**