summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/res/layout/status_bar_notification_row.xml2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java59
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java91
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java9
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java13
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/NotificationGuts.java9
6 files changed, 107 insertions, 76 deletions
diff --git a/packages/SystemUI/res/layout/status_bar_notification_row.xml b/packages/SystemUI/res/layout/status_bar_notification_row.xml
index 0cea7ae6d042..62fdd4264841 100644
--- a/packages/SystemUI/res/layout/status_bar_notification_row.xml
+++ b/packages/SystemUI/res/layout/status_bar_notification_row.xml
@@ -65,7 +65,7 @@
android:id="@+id/notification_guts_stub"
android:inflatedId="@+id/notification_guts"
android:layout_width="match_parent"
- android:layout_height="match_parent"
+ android:layout_height="wrap_content"
/>
</com.android.systemui.statusbar.ExpandableNotificationRow>
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
index 11e38ced82d9..3537d3e04504 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
@@ -110,6 +110,7 @@ import com.android.systemui.statusbar.policy.HeadsUpManager;
import com.android.systemui.statusbar.policy.PreviewInflater;
import com.android.systemui.statusbar.policy.RemoteInputView;
import com.android.systemui.statusbar.stack.NotificationStackScrollLayout;
+import com.android.systemui.statusbar.stack.StackStateAnimator;
import java.util.ArrayList;
import java.util.List;
@@ -988,9 +989,7 @@ public abstract class BaseStatusBar extends SystemUI implements
protected SwipeHelper.LongPressListener getNotificationLongClicker() {
return new SwipeHelper.LongPressListener() {
@Override
- public boolean onLongPress(View v, int x, int y) {
- dismissPopups();
-
+ public boolean onLongPress(View v, final int x, final int y) {
if (!(v instanceof ExpandableNotificationRow)) {
return false;
}
@@ -1011,41 +1010,57 @@ public abstract class BaseStatusBar extends SystemUI implements
// Already showing?
if (guts.getVisibility() == View.VISIBLE) {
- Log.e(TAG, "Trying to show notification guts, but already visible");
+ dismissPopups(x, y);
return false;
}
MetricsLogger.action(mContext, MetricsLogger.ACTION_NOTE_CONTROLS);
- guts.setVisibility(View.VISIBLE);
-
- final double horz = Math.max(guts.getWidth() - x, x);
- final double vert = Math.max(guts.getActualHeight() - y, y);
- final float r = (float) Math.hypot(horz, vert);
- final Animator a
- = ViewAnimationUtils.createCircularReveal(guts, x, y, 0, r);
- a.setDuration(400);
- a.setInterpolator(mLinearOutSlowIn);
- a.start();
-
- mNotificationGutsExposed = guts;
+ // ensure that it's layouted but not visible until actually laid out
+ guts.setVisibility(View.INVISIBLE);
+ // Post to ensure the the guts are properly layed out.
+ guts.post(new Runnable() {
+ public void run() {
+ dismissPopups();
+ guts.setVisibility(View.VISIBLE);
+ final double horz = Math.max(guts.getWidth() - x, x);
+ final double vert = Math.max(guts.getHeight() - y, y);
+ final float r = (float) Math.hypot(horz, vert);
+ final Animator a
+ = ViewAnimationUtils.createCircularReveal(guts, x, y, 0, r);
+ a.setDuration(StackStateAnimator.ANIMATION_DURATION_STANDARD);
+ a.setInterpolator(mLinearOutSlowIn);
+ a.start();
+ guts.setExposed(true);
+ mStackScroller.onHeightChanged(null, true /* needsAnimation */);
+ mNotificationGutsExposed = guts;
+ }
+ });
return true;
}
};
}
public void dismissPopups() {
+ dismissPopups(-1, -1);
+ }
+
+ private void dismissPopups(int x, int y) {
if (mNotificationGutsExposed != null) {
final NotificationGuts v = mNotificationGutsExposed;
mNotificationGutsExposed = null;
if (v.getWindowToken() == null) return;
-
- final int x = (v.getLeft() + v.getRight()) / 2;
- final int y = (v.getTop() + v.getActualHeight() / 2);
+ if (x == -1 || y == -1) {
+ x = (v.getLeft() + v.getRight()) / 2;
+ y = (v.getTop() + v.getHeight() / 2);
+ }
+ final double horz = Math.max(v.getWidth() - x, x);
+ final double vert = Math.max(v.getHeight() - y, y);
+ final float r = (float) Math.hypot(horz, vert);
final Animator a = ViewAnimationUtils.createCircularReveal(v,
- x, y, x, 0);
- a.setDuration(200);
+ x, y, r, 0);
+ a.setDuration(StackStateAnimator.ANIMATION_DURATION_STANDARD);
a.setInterpolator(mFastOutLinearIn);
a.addListener(new AnimatorListenerAdapter() {
@Override
@@ -1055,6 +1070,8 @@ public abstract class BaseStatusBar extends SystemUI implements
}
});
a.start();
+ v.setExposed(false);
+ mStackScroller.onHeightChanged(null, true /* needsAnimation */);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
index fc70ce316ee4..a78c59158458 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
@@ -25,7 +25,6 @@ import android.graphics.drawable.Drawable;
import android.os.Build;
import android.service.notification.StatusBarNotification;
import android.util.AttributeSet;
-import android.view.MotionEvent;
import android.view.NotificationHeaderView;
import android.view.View;
import android.view.ViewStub;
@@ -49,7 +48,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
private static final int DEFAULT_DIVIDER_ALPHA = 0x29;
private static final int COLORED_DIVIDER_ALPHA = 0x7B;
- private final LinearInterpolator mLinearInterpolator = new LinearInterpolator();
private final int mNotificationMinHeightLegacy;
private final int mMaxHeadsUpHeightLegacy;
private final int mMaxHeadsUpHeight;
@@ -230,8 +228,8 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
: mMaxHeadsUpHeight;
mRowMinHeight = minHeight;
mMaxViewHeight = mNotificationMaxHeight;
- mPrivateLayout.setHeights(mRowMinHeight, headsUpheight);
- mPublicLayout.setHeights(mRowMinHeight, headsUpheight);
+ mPrivateLayout.setHeights(mRowMinHeight, headsUpheight, mNotificationMaxHeight);
+ mPublicLayout.setHeights(mRowMinHeight, headsUpheight, mNotificationMaxHeight);
}
public StatusBarNotification getStatusBarNotification() {
@@ -555,12 +553,15 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
}
private void updateChildrenVisibility() {
+ mPrivateLayout.setVisibility(!mShowingPublic && !mIsSummaryWithChildren ? VISIBLE
+ : INVISIBLE);
if (mChildrenContainer == null) {
return;
}
- mChildrenContainer.setVisibility(mIsSummaryWithChildren ? VISIBLE : INVISIBLE);
- mNotificationHeader.setVisibility(mIsSummaryWithChildren ? VISIBLE : INVISIBLE);
- mPrivateLayout.setVisibility(!mIsSummaryWithChildren ? VISIBLE : INVISIBLE);
+ mChildrenContainer.setVisibility(!mShowingPublic && mIsSummaryWithChildren ? VISIBLE
+ : INVISIBLE);
+ mNotificationHeader.setVisibility(!mShowingPublic && mIsSummaryWithChildren ? VISIBLE
+ : INVISIBLE);
// The limits might have changed if the view suddenly became a group or vice versa
updateLimits();
}
@@ -722,20 +723,24 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
return getActualHeight();
}
boolean inExpansionState = isExpanded();
- if (mSensitive && mHideSensitiveForIntrinsicHeight) {
- return mRowMinHeight;
+ if (mGuts != null && mGuts.areGutsExposed()) {
+ return mGuts.getHeight();
+ } else if ((isChildInGroup() && !isGroupExpanded())) {
+ return mPrivateLayout.getMinHeight();
+ } else if (mSensitive && mHideSensitiveForIntrinsicHeight) {
+ return getMinHeight();
} else if (mIsSummaryWithChildren && !mOnKeyguard) {
return mChildrenContainer.getIntrinsicHeight();
} else if (mIsHeadsUp) {
if (inExpansionState) {
- return Math.max(mMaxExpandHeight, mHeadsUpHeight);
+ return Math.max(getMaxExpandHeight(), mHeadsUpHeight);
} else {
- return Math.max(mRowMinHeight, mHeadsUpHeight);
+ return Math.max(getMinHeight(), mHeadsUpHeight);
}
- } else if (!inExpansionState || (isChildInGroup() && !isGroupExpanded())) {
- return getMinHeight();
- } else {
+ } else if (inExpansionState) {
return getMaxExpandHeight();
+ } else {
+ return getMinHeight();
}
}
@@ -842,8 +847,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
mPublicLayout.setAlpha(1f);
mPrivateLayout.setAlpha(1f);
mPublicLayout.setVisibility(mShowingPublic ? View.VISIBLE : View.INVISIBLE);
- mPrivateLayout.setVisibility(!mShowingPublic && !mIsSummaryWithChildren ? View.VISIBLE
- : View.INVISIBLE);
+ updateChildrenVisibility();
} else {
animateShowingPublic(delay, duration);
}
@@ -854,27 +858,35 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
}
private void animateShowingPublic(long delay, long duration) {
- final View source = mShowingPublic ? mPrivateLayout : mPublicLayout;
- View target = mShowingPublic ? mPublicLayout : mPrivateLayout;
- source.setVisibility(View.VISIBLE);
- target.setVisibility(View.VISIBLE);
- target.setAlpha(0f);
- source.animate().cancel();
- target.animate().cancel();
- source.animate()
- .alpha(0f)
- .setStartDelay(delay)
- .setDuration(duration)
- .withEndAction(new Runnable() {
- @Override
- public void run() {
- source.setVisibility(View.INVISIBLE);
- }
- });
- target.animate()
- .alpha(1f)
- .setStartDelay(delay)
- .setDuration(duration);
+ View[] privateViews = mIsSummaryWithChildren ?
+ new View[] {mChildrenContainer, mNotificationHeader}
+ : new View[] {mPrivateLayout};
+ View[] publicViews = new View[] {mPublicLayout};
+ View[] hiddenChildren = mShowingPublic ? privateViews : publicViews;
+ View[] shownChildren = mShowingPublic ? publicViews : privateViews;
+ for (final View hiddenView : hiddenChildren) {
+ hiddenView.setVisibility(View.VISIBLE);
+ hiddenView.animate().cancel();
+ hiddenView.animate()
+ .alpha(0f)
+ .setStartDelay(delay)
+ .setDuration(duration)
+ .withEndAction(new Runnable() {
+ @Override
+ public void run() {
+ hiddenView.setVisibility(View.INVISIBLE);
+ }
+ });
+ }
+ for (View showView : shownChildren) {
+ showView.setVisibility(View.VISIBLE);
+ showView.setAlpha(0f);
+ showView.animate().cancel();
+ showView.animate()
+ .alpha(1f)
+ .setStartDelay(delay)
+ .setDuration(duration);
+ }
}
private void updateVetoButton() {
@@ -966,11 +978,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
}
@Override
- protected boolean shouldLimitViewHeight() {
- return !mIsSummaryWithChildren;
- }
-
- @Override
public void setClipTopAmount(int clipTopAmount) {
super.setClipTopAmount(clipTopAmount);
mPrivateLayout.setClipTopAmount(clipTopAmount);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java
index bc7bd5bcca00..d6855a52f0d9 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java
@@ -20,10 +20,10 @@ import android.content.Context;
import android.graphics.Paint;
import android.graphics.Rect;
import android.util.AttributeSet;
-import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
+
import com.android.systemui.R;
import com.android.systemui.statusbar.stack.NotificationStackScrollLayout;
@@ -54,9 +54,8 @@ public abstract class ExpandableView extends FrameLayout {
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
- boolean limitViewHeight = shouldLimitViewHeight();
final int givenSize = MeasureSpec.getSize(heightMeasureSpec);
- int ownMaxHeight = limitViewHeight ? mMaxViewHeight : Integer.MAX_VALUE;
+ int ownMaxHeight = Integer.MAX_VALUE;
int heightMode = MeasureSpec.getMode(heightMeasureSpec);
if (heightMode != MeasureSpec.UNSPECIFIED && givenSize != 0) {
ownMaxHeight = Math.min(givenSize, ownMaxHeight);
@@ -100,10 +99,6 @@ public abstract class ExpandableView extends FrameLayout {
setMeasuredDimension(width, ownHeight);
}
- protected boolean shouldLimitViewHeight() {
- return true;
- }
-
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java
index 6d90329ae833..f3ee0bb3063b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java
@@ -80,6 +80,7 @@ public class NotificationContentView extends FrameLayout {
private boolean mIsChildInGroup;
private int mSmallHeight;
private int mHeadsUpHeight;
+ private int mNotificationMaxHeight;
private StatusBarNotification mStatusBarNotification;
private NotificationGroupManager mGroupManager;
private RemoteInputController mRemoteInputController;
@@ -115,9 +116,10 @@ public class NotificationContentView extends FrameLayout {
setOutlineProvider(mOutlineProvider);
}
- public void setHeights(int smallHeight, int headsUpMaxHeight) {
+ public void setHeights(int smallHeight, int headsUpMaxHeight, int maxHeight) {
mSmallHeight = smallHeight;
mHeadsUpHeight = headsUpMaxHeight;
+ mNotificationMaxHeight = maxHeight;
}
@Override
@@ -137,7 +139,7 @@ public class NotificationContentView extends FrameLayout {
maxChildHeight = Math.max(maxChildHeight, mContractedChild.getMeasuredHeight());
}
if (mExpandedChild != null) {
- int size = maxSize;
+ int size = Math.min(maxSize, mNotificationMaxHeight);
ViewGroup.LayoutParams layoutParams = mExpandedChild.getLayoutParams();
if (layoutParams.height >= 0) {
// An actual height is set
@@ -435,6 +437,9 @@ public class NotificationContentView extends FrameLayout {
if (!noExpandedChild && mContentHeight == mExpandedChild.getHeight()) {
return VISIBLE_TYPE_EXPANDED;
}
+ if (mIsChildInGroup && !isGroupExpanded()) {
+ return VISIBLE_TYPE_SINGLELINE;
+ }
if (mIsHeadsUp && mHeadsUpChild != null) {
if (mContentHeight <= mHeadsUpChild.getHeight() || noExpandedChild) {
@@ -443,9 +448,7 @@ public class NotificationContentView extends FrameLayout {
return VISIBLE_TYPE_EXPANDED;
}
} else {
- if (mIsChildInGroup && !isGroupExpanded()) {
- return VISIBLE_TYPE_SINGLELINE;
- } else if (mContentHeight <= mSmallHeight || noExpandedChild) {
+ if (mContentHeight <= mSmallHeight || noExpandedChild) {
return VISIBLE_TYPE_CONTRACTED;
} else {
return VISIBLE_TYPE_EXPANDED;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationGuts.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationGuts.java
index 79236be87e5e..6850f7ecf122 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationGuts.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationGuts.java
@@ -45,6 +45,7 @@ public class NotificationGuts extends LinearLayout {
private Drawable mBackground;
private int mClipTopAmount;
private int mActualHeight;
+ private boolean mExposed;
public NotificationGuts(Context context, AttributeSet attrs) {
super(context, attrs);
@@ -224,4 +225,12 @@ public class NotificationGuts extends LinearLayout {
// Prevents this view from creating a layer when alpha is animating.
return false;
}
+
+ public void setExposed(boolean exposed) {
+ mExposed = exposed;
+ }
+
+ public boolean areGutsExposed() {
+ return mExposed;
+ }
}