summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2013-06-19 12:51:08 +0200
committerDanny Baumann <dannybaumann@web.de>2013-06-19 13:03:35 +0200
commit10d83fd6efc7f4093ec9c61519091534f3e103ab (patch)
treeaffa06a2a95314beb34e3d69339b1b358e69a6fd /packages
parent4d0af804084cf06ce172b4075c7b7af414aea73e (diff)
downloadframeworks_base-10d83fd6efc7f4093ec9c61519091534f3e103ab.zip
frameworks_base-10d83fd6efc7f4093ec9c61519091534f3e103ab.tar.gz
frameworks_base-10d83fd6efc7f4093ec9c61519091534f3e103ab.tar.bz2
Close notification panel when swiping away the last clearable
notification. Change-Id: I4e5114f66e799a7c80e18b38abce5678da460846
Diffstat (limited to 'packages')
-rw-r--r--packages/SystemUI/res/values/ids.xml1
-rw-r--r--packages/SystemUI/src/com/android/systemui/SwipeHelper.java10
-rw-r--r--packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java10
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java20
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/IntruderAlertView.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java5
8 files changed, 46 insertions, 8 deletions
diff --git a/packages/SystemUI/res/values/ids.xml b/packages/SystemUI/res/values/ids.xml
index 2cc3446..f7bc614 100644
--- a/packages/SystemUI/res/values/ids.xml
+++ b/packages/SystemUI/res/values/ids.xml
@@ -19,5 +19,6 @@
<item type="id" name="expandable_tag" />
<item type="id" name="user_expanded_tag" />
<item type="id" name="user_lock_tag" />
+ <item type="id" name="user_cleared_tag" />
<item type="id" name="status_bar_cling_stub" />
</resources>
diff --git a/packages/SystemUI/src/com/android/systemui/SwipeHelper.java b/packages/SystemUI/src/com/android/systemui/SwipeHelper.java
index ceb8654..7be5949 100644
--- a/packages/SystemUI/src/com/android/systemui/SwipeHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/SwipeHelper.java
@@ -257,6 +257,10 @@ public class SwipeHelper implements Gefingerpoken {
* @param velocity The desired pixels/second speed at which the view should move
*/
public void dismissChild(final View view, float velocity) {
+ dismissChild(view, velocity, false);
+ }
+
+ private void dismissChild(final View view, float velocity, final boolean fromUser) {
final View animView = mCallback.getChildContentView(view);
final boolean canAnimViewBeDismissed = mCallback.canChildBeDismissed(view);
float newPos;
@@ -284,7 +288,7 @@ public class SwipeHelper implements Gefingerpoken {
anim.setDuration(duration);
anim.addListener(new AnimatorListenerAdapter() {
public void onAnimationEnd(Animator animation) {
- mCallback.onChildDismissed(view);
+ mCallback.onChildDismissed(view, fromUser);
animView.setLayerType(View.LAYER_TYPE_NONE, null);
}
});
@@ -374,7 +378,7 @@ public class SwipeHelper implements Gefingerpoken {
if (dismissChild) {
// flingadingy
- dismissChild(mCurrView, childSwipedFastEnough ? velocity : 0f);
+ dismissChild(mCurrView, childSwipedFastEnough ? velocity : 0f, true);
} else {
// snappity
mCallback.onDragCancelled(mCurrView);
@@ -395,7 +399,7 @@ public class SwipeHelper implements Gefingerpoken {
void onBeginDrag(View v);
- void onChildDismissed(View v);
+ void onChildDismissed(View v, boolean fromUser);
void onDragCancelled(View v);
}
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java
index 989ada0..b59acad 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java
@@ -212,7 +212,7 @@ public class RecentsHorizontalScrollView extends HorizontalScrollView
mSwipeHelper.dismissChild(v, 0);
}
- public void onChildDismissed(View v) {
+ public void onChildDismissed(View v, boolean fromUser) {
addToRecycledViews(v);
mLinearLayout.removeView(v);
mCallback.handleSwipe(v);
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java
index 0f48751..d6f417d 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java
@@ -220,7 +220,7 @@ public class RecentsVerticalScrollView extends ScrollView
mSwipeHelper.dismissChild(v, 0);
}
- public void onChildDismissed(View v) {
+ public void onChildDismissed(View v, boolean fromUser) {
addToRecycledViews(v);
mLinearLayout.removeView(v);
mCallback.handleSwipe(v);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
index bedc68d..46cbf29 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
@@ -942,6 +942,16 @@ public abstract class BaseStatusBar extends SystemUI implements
updateExpansionStates();
updateNotificationIcons();
+ if (entry.userCleared() && !mNotificationData.hasClearableItems()) {
+ // wait a bit to make the user aware of what's happening
+ mHandler.postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_NONE);
+ }
+ }, 100);
+ }
+
return entry.notification;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java
index 9c947ae..7222c08 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java
@@ -66,6 +66,12 @@ public class NotificationData {
return NotificationData.getUserExpanded(row);
}
/**
+ * Return whether the entry has been manually cleared by the user.
+ */
+ public boolean userCleared() {
+ return NotificationData.getUserCleared(row);
+ }
+ /**
* Set the flag indicating that this was manually expanded by the user.
*/
public boolean setUserExpanded(boolean userExpanded) {
@@ -227,4 +233,18 @@ public class NotificationData {
public static boolean setUserLocked(View row, boolean userLocked) {
return writeBooleanTag(row, R.id.user_lock_tag, userLocked);
}
+
+ /**
+ * Return whether the entry was cleared by the user.
+ */
+ public static boolean getUserCleared(View row) {
+ return readBooleanTag(row, R.id.user_cleared_tag);
+ }
+
+ /**
+ * Set whether the entry is being touched by the user.
+ */
+ public static boolean setUserCleared(View row) {
+ return writeBooleanTag(row, R.id.user_cleared_tag, true);
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/IntruderAlertView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/IntruderAlertView.java
index ee5c863..9cbd853 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/IntruderAlertView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/IntruderAlertView.java
@@ -101,7 +101,7 @@ public class IntruderAlertView extends LinearLayout implements SwipeHelper.Callb
return true;
}
- public void onChildDismissed(View v) {
+ public void onChildDismissed(View v, boolean fromUser) {
Slog.v(TAG, "User swiped intruder to dismiss");
mBar.dismissIntruder();
}
@@ -173,4 +173,4 @@ public class IntruderAlertView extends LinearLayout implements SwipeHelper.Callb
mContentHolder.addView(content);
}
-} \ No newline at end of file
+}
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 89eed1b..9e9dec2 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java
@@ -166,12 +166,15 @@ public class NotificationRowLayout
return NotificationData.setUserLocked(v, userLocked);
}
- public void onChildDismissed(View v) {
+ public void onChildDismissed(View v, boolean fromUser) {
if (DEBUG) Slog.v(TAG, "onChildDismissed: " + v + " mRemoveViews=" + mRemoveViews);
final View veto = v.findViewById(R.id.veto);
if (veto != null && veto.getVisibility() != View.GONE && mRemoveViews) {
veto.performClick();
}
+ if (fromUser) {
+ NotificationData.setUserCleared(v);
+ }
}
public void onBeginDrag(View v) {