resolve merge conflicts of 5134b8aa2f to sc-v2-dev [DO NOT MERGE] am: 344a521e83
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15659313 Change-Id: I638ea31778ceb0ec5509367e8f0b31662c9733c2
This commit is contained in:
@@ -451,6 +451,12 @@ public class SwipeHelper implements Gefingerpoken {
|
|||||||
anim.addListener(new AnimatorListenerAdapter() {
|
anim.addListener(new AnimatorListenerAdapter() {
|
||||||
private boolean mCancelled;
|
private boolean mCancelled;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAnimationStart(Animator animation) {
|
||||||
|
super.onAnimationStart(animation);
|
||||||
|
mCallback.onBeginDrag(animView);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationCancel(Animator animation) {
|
public void onAnimationCancel(Animator animation) {
|
||||||
mCancelled = true;
|
mCancelled = true;
|
||||||
|
|||||||
@@ -85,23 +85,26 @@ public abstract class StackScrollerDecorView extends ExpandableView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the content of this view to be visible in an animated way.
|
* @param visible True if we should animate contents visible
|
||||||
*
|
|
||||||
* @param contentVisible True if the content should be visible or false if it should be hidden.
|
|
||||||
*/
|
*/
|
||||||
public void setContentVisible(boolean contentVisible) {
|
public void setContentVisible(boolean visible) {
|
||||||
setContentVisible(contentVisible, true /* animate */);
|
setContentVisible(visible, true /* animate */, null /* runAfter */);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the content of this view to be visible.
|
* @param visible True if the contents should be visible
|
||||||
* @param contentVisible True if the content should be visible or false if it should be hidden.
|
* @param animate True if we should fade to new visibility
|
||||||
* @param animate Should an animation be performed.
|
* @param runAfter Runnable to run after visibility updates
|
||||||
*/
|
*/
|
||||||
private void setContentVisible(boolean contentVisible, boolean animate) {
|
public void setContentVisible(boolean visible, boolean animate, Runnable runAfter) {
|
||||||
if (mContentVisible != contentVisible) {
|
if (mContentVisible != visible) {
|
||||||
mContentAnimating = animate;
|
mContentAnimating = animate;
|
||||||
mContentVisible = contentVisible;
|
mContentVisible = visible;
|
||||||
setViewVisible(mContent, contentVisible, animate, mContentVisibilityEndRunnable);
|
Runnable endRunnable = runAfter == null ? mContentVisibilityEndRunnable : () -> {
|
||||||
|
mContentVisibilityEndRunnable.run();
|
||||||
|
runAfter.run();
|
||||||
|
};
|
||||||
|
setViewVisible(mContent, visible, animate, endRunnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mContentAnimating) {
|
if (!mContentAnimating) {
|
||||||
@@ -113,6 +116,10 @@ public abstract class StackScrollerDecorView extends ExpandableView {
|
|||||||
return mContentVisible;
|
return mContentVisible;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setVisible(boolean nowVisible, boolean animate) {
|
||||||
|
setVisible(nowVisible, animate, null);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make this view visible. If {@code false} is passed, the view will fade out it's content
|
* Make this view visible. If {@code false} is passed, the view will fade out it's content
|
||||||
* and set the view Visibility to GONE. If only the content should be changed
|
* and set the view Visibility to GONE. If only the content should be changed
|
||||||
@@ -121,7 +128,7 @@ public abstract class StackScrollerDecorView extends ExpandableView {
|
|||||||
* @param nowVisible should the view be visible
|
* @param nowVisible should the view be visible
|
||||||
* @param animate should the change be animated.
|
* @param animate should the change be animated.
|
||||||
*/
|
*/
|
||||||
public void setVisible(boolean nowVisible, boolean animate) {
|
public void setVisible(boolean nowVisible, boolean animate, Runnable runAfter) {
|
||||||
if (mIsVisible != nowVisible) {
|
if (mIsVisible != nowVisible) {
|
||||||
mIsVisible = nowVisible;
|
mIsVisible = nowVisible;
|
||||||
if (animate) {
|
if (animate) {
|
||||||
@@ -132,10 +139,10 @@ public abstract class StackScrollerDecorView extends ExpandableView {
|
|||||||
} else {
|
} else {
|
||||||
setWillBeGone(true);
|
setWillBeGone(true);
|
||||||
}
|
}
|
||||||
setContentVisible(nowVisible, true /* animate */);
|
setContentVisible(nowVisible, true /* animate */, runAfter);
|
||||||
} else {
|
} else {
|
||||||
setVisibility(nowVisible ? VISIBLE : GONE);
|
setVisibility(nowVisible ? VISIBLE : GONE);
|
||||||
setContentVisible(nowVisible, false /* animate */);
|
setContentVisible(nowVisible, false /* animate */, runAfter);
|
||||||
setWillBeGone(false);
|
setWillBeGone(false);
|
||||||
notifyHeightChanged(false /* needsAnimation */);
|
notifyHeightChanged(false /* needsAnimation */);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ public class NotificationRoundnessManager {
|
|||||||
private Runnable mRoundingChangedCallback;
|
private Runnable mRoundingChangedCallback;
|
||||||
private ExpandableNotificationRow mTrackedHeadsUp;
|
private ExpandableNotificationRow mTrackedHeadsUp;
|
||||||
private float mAppearFraction;
|
private float mAppearFraction;
|
||||||
|
private boolean mIsDismissAllInProgress;
|
||||||
|
|
||||||
private ExpandableView mSwipedView = null;
|
private ExpandableView mSwipedView = null;
|
||||||
private ExpandableView mViewBeforeSwipedView = null;
|
private ExpandableView mViewBeforeSwipedView = null;
|
||||||
@@ -162,6 +163,10 @@ public class NotificationRoundnessManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setDismissAllInProgress(boolean isClearingAll) {
|
||||||
|
mIsDismissAllInProgress = isClearingAll;
|
||||||
|
}
|
||||||
|
|
||||||
private float getRoundness(ExpandableView view, boolean top) {
|
private float getRoundness(ExpandableView view, boolean top) {
|
||||||
if (view == null) {
|
if (view == null) {
|
||||||
return 0f;
|
return 0f;
|
||||||
@@ -171,6 +176,11 @@ public class NotificationRoundnessManager {
|
|||||||
|| view == mViewAfterSwipedView) {
|
|| view == mViewAfterSwipedView) {
|
||||||
return 1f;
|
return 1f;
|
||||||
}
|
}
|
||||||
|
if (view instanceof ExpandableNotificationRow
|
||||||
|
&& ((ExpandableNotificationRow) view).canViewBeDismissed()
|
||||||
|
&& mIsDismissAllInProgress) {
|
||||||
|
return 1.0f;
|
||||||
|
}
|
||||||
if ((view.isPinned()
|
if ((view.isPinned()
|
||||||
|| (view.isHeadsUpAnimatingAway()) && !mExpanded)) {
|
|| (view.isHeadsUpAnimatingAway()) && !mExpanded)) {
|
||||||
return 1.0f;
|
return 1.0f;
|
||||||
|
|||||||
@@ -139,6 +139,10 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
|
|||||||
private static final boolean DEBUG_REMOVE_ANIMATION = SystemProperties.getBoolean(
|
private static final boolean DEBUG_REMOVE_ANIMATION = SystemProperties.getBoolean(
|
||||||
"persist.debug.nssl.dismiss", false /* default */);
|
"persist.debug.nssl.dismiss", false /* default */);
|
||||||
|
|
||||||
|
// Delay in milli-seconds before shade closes for clear all.
|
||||||
|
private final int DELAY_BEFORE_SHADE_CLOSE = 200;
|
||||||
|
private boolean mShadeNeedsToClose = false;
|
||||||
|
|
||||||
private static final float RUBBER_BAND_FACTOR_NORMAL = 0.35f;
|
private static final float RUBBER_BAND_FACTOR_NORMAL = 0.35f;
|
||||||
private static final float RUBBER_BAND_FACTOR_AFTER_EXPAND = 0.15f;
|
private static final float RUBBER_BAND_FACTOR_AFTER_EXPAND = 0.15f;
|
||||||
private static final float RUBBER_BAND_FACTOR_ON_PANEL_EXPAND = 0.21f;
|
private static final float RUBBER_BAND_FACTOR_ON_PANEL_EXPAND = 0.21f;
|
||||||
@@ -253,7 +257,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
|
|||||||
protected FooterView mFooterView;
|
protected FooterView mFooterView;
|
||||||
protected EmptyShadeView mEmptyShadeView;
|
protected EmptyShadeView mEmptyShadeView;
|
||||||
private boolean mDismissAllInProgress;
|
private boolean mDismissAllInProgress;
|
||||||
private boolean mFadeNotificationsOnDismiss;
|
|
||||||
private FooterDismissListener mFooterDismissListener;
|
private FooterDismissListener mFooterDismissListener;
|
||||||
private boolean mFlingAfterUpEvent;
|
private boolean mFlingAfterUpEvent;
|
||||||
|
|
||||||
@@ -1205,7 +1208,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
|
|||||||
@ShadeViewRefactor(RefactorComponent.COORDINATOR)
|
@ShadeViewRefactor(RefactorComponent.COORDINATOR)
|
||||||
private void clampScrollPosition() {
|
private void clampScrollPosition() {
|
||||||
int scrollRange = getScrollRange();
|
int scrollRange = getScrollRange();
|
||||||
if (scrollRange < mOwnScrollY) {
|
if (scrollRange < mOwnScrollY && !mAmbientState.isDismissAllInProgress()) {
|
||||||
boolean animateStackY = false;
|
boolean animateStackY = false;
|
||||||
if (scrollRange < getScrollAmountToScrollBoundary()
|
if (scrollRange < getScrollAmountToScrollBoundary()
|
||||||
&& mAnimateStackYForContentHeightChange) {
|
&& mAnimateStackYForContentHeightChange) {
|
||||||
@@ -1721,6 +1724,11 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
|
|||||||
|
|
||||||
@ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
|
@ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
|
||||||
public void dismissViewAnimated(View child, Runnable endRunnable, int delay, long duration) {
|
public void dismissViewAnimated(View child, Runnable endRunnable, int delay, long duration) {
|
||||||
|
if (child instanceof SectionHeaderView) {
|
||||||
|
((StackScrollerDecorView) child).setContentVisible(
|
||||||
|
false /* visible */, true /* animate */, endRunnable);
|
||||||
|
return;
|
||||||
|
}
|
||||||
mSwipeHelper.dismissChild(child, 0, endRunnable, delay, true, duration,
|
mSwipeHelper.dismissChild(child, 0, endRunnable, delay, true, duration,
|
||||||
true /* isDismissAll */);
|
true /* isDismissAll */);
|
||||||
}
|
}
|
||||||
@@ -4062,6 +4070,19 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
|
|||||||
runAnimationFinishedRunnables();
|
runAnimationFinishedRunnables();
|
||||||
clearTransient();
|
clearTransient();
|
||||||
clearHeadsUpDisappearRunning();
|
clearHeadsUpDisappearRunning();
|
||||||
|
|
||||||
|
if (mAmbientState.isDismissAllInProgress()) {
|
||||||
|
setDismissAllInProgress(false);
|
||||||
|
|
||||||
|
if (mShadeNeedsToClose) {
|
||||||
|
mShadeNeedsToClose = false;
|
||||||
|
postDelayed(
|
||||||
|
() -> {
|
||||||
|
mShadeController.animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_NONE);
|
||||||
|
},
|
||||||
|
DELAY_BEFORE_SHADE_CLOSE /* delayMillis */);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
|
@ShadeViewRefactor(RefactorComponent.STATE_RESOLVER)
|
||||||
@@ -4430,6 +4451,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
|
|||||||
public void setDismissAllInProgress(boolean dismissAllInProgress) {
|
public void setDismissAllInProgress(boolean dismissAllInProgress) {
|
||||||
mDismissAllInProgress = dismissAllInProgress;
|
mDismissAllInProgress = dismissAllInProgress;
|
||||||
mAmbientState.setDismissAllInProgress(dismissAllInProgress);
|
mAmbientState.setDismissAllInProgress(dismissAllInProgress);
|
||||||
|
mController.getNoticationRoundessManager().setDismissAllInProgress(dismissAllInProgress);
|
||||||
handleDismissAllClipping();
|
handleDismissAllClipping();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4973,64 +4995,129 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
|
|||||||
mHeadsUpAppearanceController = headsUpAppearanceController;
|
mHeadsUpAppearanceController = headsUpAppearanceController;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
|
private boolean isVisible(View child) {
|
||||||
@VisibleForTesting
|
boolean hasClipBounds = child.getClipBounds(mTmpRect);
|
||||||
void clearNotifications(@SelectedRows int selection, boolean closeShade) {
|
return child.getVisibility() == View.VISIBLE
|
||||||
// animate-swipe all dismissable notifications, then animate the shade closed
|
&& (!hasClipBounds || mTmpRect.height() > 0);
|
||||||
int numChildren = getChildCount();
|
}
|
||||||
|
|
||||||
final ArrayList<View> viewsToHide = new ArrayList<>(numChildren);
|
private boolean shouldHideParent(View view, @SelectedRows int selection) {
|
||||||
final ArrayList<ExpandableNotificationRow> viewsToRemove = new ArrayList<>(numChildren);
|
final boolean silentSectionWillBeGone =
|
||||||
for (int i = 0; i < numChildren; i++) {
|
!mController.hasNotifications(ROWS_GENTLE, false /* clearable */);
|
||||||
final View child = getChildAt(i);
|
|
||||||
if (child instanceof ExpandableNotificationRow) {
|
// The only SectionHeaderView we have is the silent section header.
|
||||||
ExpandableNotificationRow row = (ExpandableNotificationRow) child;
|
if (view instanceof SectionHeaderView && silentSectionWillBeGone) {
|
||||||
boolean parentVisible = false;
|
return true;
|
||||||
boolean hasClipBounds = child.getClipBounds(mTmpRect);
|
}
|
||||||
if (includeChildInDismissAll(row, selection)) {
|
if (view instanceof ExpandableNotificationRow) {
|
||||||
viewsToRemove.add(row);
|
ExpandableNotificationRow row = (ExpandableNotificationRow) view;
|
||||||
if (child.getVisibility() == View.VISIBLE
|
if (isVisible(row) && includeChildInDismissAll(row, selection)) {
|
||||||
&& (!hasClipBounds || mTmpRect.height() > 0)) {
|
return true;
|
||||||
viewsToHide.add(child);
|
}
|
||||||
parentVisible = true;
|
}
|
||||||
}
|
return false;
|
||||||
} else if (child.getVisibility() == View.VISIBLE
|
}
|
||||||
&& (!hasClipBounds || mTmpRect.height() > 0)) {
|
|
||||||
parentVisible = true;
|
private boolean isChildrenVisible(ExpandableNotificationRow parent) {
|
||||||
}
|
List<ExpandableNotificationRow> children = parent.getAttachedChildren();
|
||||||
List<ExpandableNotificationRow> children = row.getAttachedChildren();
|
return isVisible(parent)
|
||||||
if (children != null) {
|
&& children != null
|
||||||
for (ExpandableNotificationRow childRow : children) {
|
&& parent.areChildrenExpanded();
|
||||||
if (includeChildInDismissAll(row, selection)) {
|
}
|
||||||
viewsToRemove.add(childRow);
|
|
||||||
if (parentVisible && row.areChildrenExpanded()) {
|
// Similar to #getRowsToDismissInBackend, but filters for visible views.
|
||||||
hasClipBounds = childRow.getClipBounds(mTmpRect);
|
private ArrayList<View> getVisibleViewsToAnimateAway(@SelectedRows int selection) {
|
||||||
if (childRow.getVisibility() == View.VISIBLE
|
final int viewCount = getChildCount();
|
||||||
&& (!hasClipBounds || mTmpRect.height() > 0)) {
|
final ArrayList<View> viewsToHide = new ArrayList<>(viewCount);
|
||||||
viewsToHide.add(childRow);
|
|
||||||
}
|
for (int i = 0; i < viewCount; i++) {
|
||||||
}
|
final View view = getChildAt(i);
|
||||||
|
|
||||||
|
if (shouldHideParent(view, selection)) {
|
||||||
|
viewsToHide.add(view);
|
||||||
|
}
|
||||||
|
if (view instanceof ExpandableNotificationRow) {
|
||||||
|
ExpandableNotificationRow parent = (ExpandableNotificationRow) view;
|
||||||
|
|
||||||
|
if (isChildrenVisible(parent)) {
|
||||||
|
for (ExpandableNotificationRow child : parent.getAttachedChildren()) {
|
||||||
|
if (isVisible(child) && includeChildInDismissAll(child, selection)) {
|
||||||
|
viewsToHide.add(child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return viewsToHide;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ArrayList<ExpandableNotificationRow> getRowsToDismissInBackend(
|
||||||
|
@SelectedRows int selection) {
|
||||||
|
final int childCount = getChildCount();
|
||||||
|
final ArrayList<ExpandableNotificationRow> viewsToRemove = new ArrayList<>(childCount);
|
||||||
|
|
||||||
|
for (int i = 0; i < childCount; i++) {
|
||||||
|
final View view = getChildAt(i);
|
||||||
|
if (!(view instanceof ExpandableNotificationRow)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
ExpandableNotificationRow parent = (ExpandableNotificationRow) view;
|
||||||
|
if (includeChildInDismissAll(parent, selection)) {
|
||||||
|
viewsToRemove.add(parent);
|
||||||
|
}
|
||||||
|
List<ExpandableNotificationRow> children = parent.getAttachedChildren();
|
||||||
|
if (isVisible(parent) && children != null) {
|
||||||
|
for (ExpandableNotificationRow child : children) {
|
||||||
|
if (includeChildInDismissAll(parent, selection)) {
|
||||||
|
viewsToRemove.add(child);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return viewsToRemove;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Collects a list of visible rows, and animates them away in a staggered fashion as if they
|
||||||
|
* were dismissed. Notifications are dismissed in the backend via onDismissAllAnimationsEnd.
|
||||||
|
*/
|
||||||
|
@ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
|
||||||
|
@VisibleForTesting
|
||||||
|
void clearNotifications(@SelectedRows int selection, boolean closeShade) {
|
||||||
|
// Animate-swipe all dismissable notifications, then animate the shade closed
|
||||||
|
final ArrayList<View> viewsToAnimateAway = getVisibleViewsToAnimateAway(selection);
|
||||||
|
final ArrayList<ExpandableNotificationRow> rowsToDismissInBackend =
|
||||||
|
getRowsToDismissInBackend(selection);
|
||||||
if (mDismissListener != null) {
|
if (mDismissListener != null) {
|
||||||
mDismissListener.onDismiss(selection);
|
mDismissListener.onDismiss(selection);
|
||||||
}
|
}
|
||||||
|
final Runnable dismissInBackend = () -> {
|
||||||
if (viewsToRemove.isEmpty()) {
|
onDismissAllAnimationsEnd(rowsToDismissInBackend, selection);
|
||||||
if (closeShade && mShadeController != null) {
|
};
|
||||||
mShadeController.animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_NONE);
|
if (viewsToAnimateAway.isEmpty()) {
|
||||||
}
|
dismissInBackend.run();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// Disable normal animations
|
||||||
|
setDismissAllInProgress(true);
|
||||||
|
mShadeNeedsToClose = closeShade;
|
||||||
|
|
||||||
performDismissAllAnimations(
|
// Decrease the delay for every row we animate to give the sense of
|
||||||
viewsToHide,
|
// accelerating the swipes
|
||||||
closeShade,
|
final int rowDelayDecrement = 5;
|
||||||
() -> onDismissAllAnimationsEnd(viewsToRemove, selection));
|
int currentDelay = 60;
|
||||||
|
int totalDelay = 0;
|
||||||
|
final int numItems = viewsToAnimateAway.size();
|
||||||
|
for (int i = numItems - 1; i >= 0; i--) {
|
||||||
|
View view = viewsToAnimateAway.get(i);
|
||||||
|
Runnable endRunnable = null;
|
||||||
|
if (i == 0) {
|
||||||
|
endRunnable = dismissInBackend;
|
||||||
|
}
|
||||||
|
dismissViewAnimated(view, endRunnable, totalDelay, ANIMATION_DURATION_SWIPE);
|
||||||
|
currentDelay = Math.max(30, currentDelay - rowDelayDecrement);
|
||||||
|
totalDelay += currentDelay;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean includeChildInDismissAll(
|
private boolean includeChildInDismissAll(
|
||||||
@@ -5039,63 +5126,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
|
|||||||
return canChildBeDismissed(row) && matchesSelection(row, selection);
|
return canChildBeDismissed(row) && matchesSelection(row, selection);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Given a list of rows, animates them away in a staggered fashion as if they were dismissed.
|
|
||||||
* Doesn't actually dismiss them, though -- that must be done in the onAnimationComplete
|
|
||||||
* handler.
|
|
||||||
*
|
|
||||||
* @param hideAnimatedList List of rows to animated away. Should only be views that are
|
|
||||||
* currently visible, or else the stagger will look funky.
|
|
||||||
* @param closeShade Whether to close the shade after the stagger animation completes.
|
|
||||||
* @param onAnimationComplete Called after the entire animation completes (including the shade
|
|
||||||
* closing if appropriate). The rows must be dismissed for real here.
|
|
||||||
*/
|
|
||||||
@ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
|
|
||||||
private void performDismissAllAnimations(
|
|
||||||
final ArrayList<View> hideAnimatedList,
|
|
||||||
final boolean closeShade,
|
|
||||||
final Runnable onAnimationComplete) {
|
|
||||||
|
|
||||||
final Runnable onSlideAwayAnimationComplete = () -> {
|
|
||||||
if (closeShade) {
|
|
||||||
mShadeController.addPostCollapseAction(() -> {
|
|
||||||
setDismissAllInProgress(false);
|
|
||||||
onAnimationComplete.run();
|
|
||||||
});
|
|
||||||
mShadeController.animateCollapsePanels(
|
|
||||||
CommandQueue.FLAG_EXCLUDE_NONE);
|
|
||||||
} else {
|
|
||||||
setDismissAllInProgress(false);
|
|
||||||
onAnimationComplete.run();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
if (hideAnimatedList.isEmpty()) {
|
|
||||||
onSlideAwayAnimationComplete.run();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// let's disable our normal animations
|
|
||||||
setDismissAllInProgress(true);
|
|
||||||
|
|
||||||
// Decrease the delay for every row we animate to give the sense of
|
|
||||||
// accelerating the swipes
|
|
||||||
int rowDelayDecrement = 10;
|
|
||||||
int currentDelay = 140;
|
|
||||||
int totalDelay = 180;
|
|
||||||
int numItems = hideAnimatedList.size();
|
|
||||||
for (int i = numItems - 1; i >= 0; i--) {
|
|
||||||
View view = hideAnimatedList.get(i);
|
|
||||||
Runnable endRunnable = null;
|
|
||||||
if (i == 0) {
|
|
||||||
endRunnable = onSlideAwayAnimationComplete;
|
|
||||||
}
|
|
||||||
dismissViewAnimated(view, endRunnable, totalDelay, ANIMATION_DURATION_SWIPE);
|
|
||||||
currentDelay = Math.max(50, currentDelay - rowDelayDecrement);
|
|
||||||
totalDelay += currentDelay;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Register a {@link View.OnClickListener} to be invoked when the Manage button is clicked. */
|
/** Register a {@link View.OnClickListener} to be invoked when the Manage button is clicked. */
|
||||||
public void setManageButtonClickListener(@Nullable OnClickListener listener) {
|
public void setManageButtonClickListener(@Nullable OnClickListener listener) {
|
||||||
mManageButtonClickListener = listener;
|
mManageButtonClickListener = listener;
|
||||||
@@ -5114,6 +5144,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
|
|||||||
mFooterDismissListener.onDismiss();
|
mFooterDismissListener.onDismiss();
|
||||||
}
|
}
|
||||||
clearNotifications(ROWS_ALL, true /* closeShade */);
|
clearNotifications(ROWS_ALL, true /* closeShade */);
|
||||||
|
footerView.setSecondaryVisible(false /* visible */, true /* animate */);
|
||||||
});
|
});
|
||||||
setFooterView(footerView);
|
setFooterView(footerView);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1152,6 +1152,10 @@ public class NotificationStackScrollLayoutController {
|
|||||||
mZenModeController.areNotificationsHiddenInShade());
|
mZenModeController.areNotificationsHiddenInShade());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean areNotificationsHiddenInShade() {
|
||||||
|
return mZenModeController.areNotificationsHiddenInShade();
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isShowingEmptyShadeView() {
|
public boolean isShowingEmptyShadeView() {
|
||||||
return mShowEmptyShadeView;
|
return mShowEmptyShadeView;
|
||||||
}
|
}
|
||||||
@@ -1200,6 +1204,10 @@ public class NotificationStackScrollLayoutController {
|
|||||||
* Return whether there are any clearable notifications
|
* Return whether there are any clearable notifications
|
||||||
*/
|
*/
|
||||||
public boolean hasActiveClearableNotifications(@SelectedRows int selection) {
|
public boolean hasActiveClearableNotifications(@SelectedRows int selection) {
|
||||||
|
return hasNotifications(selection, true /* clearable */);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasNotifications(@SelectedRows int selection, boolean isClearable) {
|
||||||
if (mDynamicPrivacyController.isInLockedDownShade()) {
|
if (mDynamicPrivacyController.isInLockedDownShade()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1210,8 +1218,11 @@ public class NotificationStackScrollLayoutController {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
final ExpandableNotificationRow row = (ExpandableNotificationRow) child;
|
final ExpandableNotificationRow row = (ExpandableNotificationRow) child;
|
||||||
if (row.canViewBeDismissed() &&
|
final boolean matchClearable =
|
||||||
NotificationStackScrollLayout.matchesSelection(row, selection)) {
|
isClearable ? row.canViewBeDismissed() : !row.canViewBeDismissed();
|
||||||
|
final boolean inSection =
|
||||||
|
NotificationStackScrollLayout.matchesSelection(row, selection);
|
||||||
|
if (matchClearable && inSection) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -366,6 +366,20 @@ public class StackScrollAlgorithm {
|
|||||||
return stackHeight / stackEndHeight;
|
return stackHeight / stackEndHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean hasOngoingNotifs(StackScrollAlgorithmState algorithmState) {
|
||||||
|
for (int i = 0; i < algorithmState.visibleChildren.size(); i++) {
|
||||||
|
View child = algorithmState.visibleChildren.get(i);
|
||||||
|
if (!(child instanceof ExpandableNotificationRow)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
final ExpandableNotificationRow row = (ExpandableNotificationRow) child;
|
||||||
|
if (!row.canViewBeDismissed()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO(b/172289889) polish shade open from HUN
|
// TODO(b/172289889) polish shade open from HUN
|
||||||
/**
|
/**
|
||||||
* Populates the {@link ExpandableViewState} for a single child.
|
* Populates the {@link ExpandableViewState} for a single child.
|
||||||
@@ -430,7 +444,9 @@ public class StackScrollAlgorithm {
|
|||||||
+ view.getIntrinsicHeight();
|
+ view.getIntrinsicHeight();
|
||||||
final boolean noSpaceForFooter = footerEnd > ambientState.getStackEndHeight();
|
final boolean noSpaceForFooter = footerEnd > ambientState.getStackEndHeight();
|
||||||
((FooterView.FooterViewState) viewState).hideContent =
|
((FooterView.FooterViewState) viewState).hideContent =
|
||||||
isShelfShowing || noSpaceForFooter;
|
isShelfShowing || noSpaceForFooter
|
||||||
|
|| (ambientState.isDismissAllInProgress()
|
||||||
|
&& !hasOngoingNotifs(algorithmState));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (view != ambientState.getTrackedHeadsUpRow()) {
|
if (view != ambientState.getTrackedHeadsUpRow()) {
|
||||||
@@ -467,7 +483,6 @@ public class StackScrollAlgorithm {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clip height of view right before shelf.
|
// Clip height of view right before shelf.
|
||||||
viewState.height = (int) (getMaxAllowedChildHeight(view) * expansionFraction);
|
viewState.height = (int) (getMaxAllowedChildHeight(view) * expansionFraction);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public class StackStateAnimator {
|
|||||||
public static final int ANIMATION_DURATION_WAKEUP = 500;
|
public static final int ANIMATION_DURATION_WAKEUP = 500;
|
||||||
public static final int ANIMATION_DURATION_GO_TO_FULL_SHADE = 448;
|
public static final int ANIMATION_DURATION_GO_TO_FULL_SHADE = 448;
|
||||||
public static final int ANIMATION_DURATION_APPEAR_DISAPPEAR = 464;
|
public static final int ANIMATION_DURATION_APPEAR_DISAPPEAR = 464;
|
||||||
public static final int ANIMATION_DURATION_SWIPE = 260;
|
public static final int ANIMATION_DURATION_SWIPE = 200;
|
||||||
public static final int ANIMATION_DURATION_DIMMED_ACTIVATED = 220;
|
public static final int ANIMATION_DURATION_DIMMED_ACTIVATED = 220;
|
||||||
public static final int ANIMATION_DURATION_CLOSE_REMOTE_INPUT = 150;
|
public static final int ANIMATION_DURATION_CLOSE_REMOTE_INPUT = 150;
|
||||||
public static final int ANIMATION_DURATION_HEADS_UP_APPEAR = 400;
|
public static final int ANIMATION_DURATION_HEADS_UP_APPEAR = 400;
|
||||||
|
|||||||
@@ -312,17 +312,11 @@ public class StatusBarNotificationPresenter implements NotificationPresenter,
|
|||||||
private void onNotificationRemoved(String key, StatusBarNotification old, int reason) {
|
private void onNotificationRemoved(String key, StatusBarNotification old, int reason) {
|
||||||
if (SPEW) Log.d(TAG, "removeNotification key=" + key + " old=" + old);
|
if (SPEW) Log.d(TAG, "removeNotification key=" + key + " old=" + old);
|
||||||
|
|
||||||
if (old != null) {
|
if (old != null && CLOSE_PANEL_WHEN_EMPTIED && !hasActiveNotifications()
|
||||||
if (CLOSE_PANEL_WHEN_EMPTIED && !hasActiveNotifications()
|
&& !mNotificationPanel.isTracking() && !mNotificationPanel.isQsExpanded()
|
||||||
&& !mNotificationPanel.isTracking() && !mNotificationPanel.isQsExpanded()) {
|
&& mStatusBarStateController.getState() == StatusBarState.SHADE_LOCKED
|
||||||
if (mStatusBarStateController.getState() == StatusBarState.SHADE
|
|
||||||
&& reason != NotificationListenerService.REASON_CLICK) {
|
|
||||||
mCommandQueue.animateCollapsePanels();
|
|
||||||
} else if (mStatusBarStateController.getState() == StatusBarState.SHADE_LOCKED
|
|
||||||
&& !isCollapsing()) {
|
&& !isCollapsing()) {
|
||||||
mStatusBarStateController.setState(StatusBarState.KEYGUARD);
|
mStatusBarStateController.setState(StatusBarState.KEYGUARD);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user