Merge "Fix dismiss all clipping for tablet / landscape" into nyc-dev
This commit is contained in:
@@ -329,7 +329,7 @@ public class SwipeHelper implements Gefingerpoken {
|
||||
*/
|
||||
public void dismissChild(final View view, float velocity, boolean useAccelerateInterpolator) {
|
||||
dismissChild(view, velocity, null /* endAction */, 0 /* delay */,
|
||||
useAccelerateInterpolator, 0 /* fixedDuration */);
|
||||
useAccelerateInterpolator, 0 /* fixedDuration */, false /* isDismissAll */);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -341,17 +341,22 @@ public class SwipeHelper implements Gefingerpoken {
|
||||
* @param fixedDuration If not 0, this exact duration will be taken
|
||||
*/
|
||||
public void dismissChild(final View animView, float velocity, final Runnable endAction,
|
||||
long delay, boolean useAccelerateInterpolator, long fixedDuration) {
|
||||
long delay, boolean useAccelerateInterpolator, long fixedDuration,
|
||||
boolean isDismissAll) {
|
||||
final boolean canBeDismissed = mCallback.canChildBeDismissed(animView);
|
||||
float newPos;
|
||||
boolean isLayoutRtl = animView.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL;
|
||||
|
||||
if (velocity < 0
|
||||
|| (velocity == 0 && getTranslation(animView) < 0)
|
||||
// if we use the Menu to dismiss an item in landscape, animate up
|
||||
|| (velocity == 0 && getTranslation(animView) == 0 && mSwipeDirection == Y)
|
||||
// if the language is rtl we prefer swiping to the left
|
||||
|| (velocity == 0 && getTranslation(animView) == 0 && isLayoutRtl)) {
|
||||
// if we use the Menu to dismiss an item in landscape, animate up
|
||||
boolean animateUpForMenu = velocity == 0 && (getTranslation(animView) == 0 || isDismissAll)
|
||||
&& mSwipeDirection == Y;
|
||||
// if the language is rtl we prefer swiping to the left
|
||||
boolean animateLeftForRtl = velocity == 0 && (getTranslation(animView) == 0 || isDismissAll)
|
||||
&& isLayoutRtl;
|
||||
boolean animateLeft = velocity < 0
|
||||
|| (velocity == 0 && getTranslation(animView) < 0 && !isDismissAll);
|
||||
|
||||
if (animateLeft || animateLeftForRtl || animateUpForMenu) {
|
||||
newPos = -getSize(animView);
|
||||
} else {
|
||||
newPos = getSize(animView);
|
||||
|
||||
@@ -986,7 +986,8 @@ public class NotificationStackScrollLayout extends ViewGroup
|
||||
}
|
||||
|
||||
public void dismissViewAnimated(View child, Runnable endRunnable, int delay, long duration) {
|
||||
mSwipeHelper.dismissChild(child, 0, endRunnable, delay, true, duration);
|
||||
mSwipeHelper.dismissChild(child, 0, endRunnable, delay, true, duration,
|
||||
true /* isDismissAll */);
|
||||
}
|
||||
|
||||
public void snapViewIfNeeded(View child) {
|
||||
@@ -3194,9 +3195,6 @@ public class NotificationStackScrollLayout extends ViewGroup
|
||||
disableClipOptimization();
|
||||
}
|
||||
handleDismissAllClipping();
|
||||
if (mCurrIconRow != null && mCurrIconRow.isVisible()) {
|
||||
mCurrIconRow.getNotificationParent().animateTranslateNotification(0 /* left target */);
|
||||
}
|
||||
}
|
||||
|
||||
private void handleDismissAllClipping() {
|
||||
@@ -3639,10 +3637,7 @@ public class NotificationStackScrollLayout extends ViewGroup
|
||||
@Override
|
||||
public Animator getViewTranslationAnimator(View v, float target,
|
||||
AnimatorUpdateListener listener) {
|
||||
if (mDismissAllInProgress) {
|
||||
// When dismissing all, we translate the entire view instead.
|
||||
return super.getViewTranslationAnimator(v, target, listener);
|
||||
} else if (v instanceof ExpandableNotificationRow) {
|
||||
if (v instanceof ExpandableNotificationRow) {
|
||||
return ((ExpandableNotificationRow) v).getTranslateViewAnimator(target, listener);
|
||||
} else {
|
||||
return super.getViewTranslationAnimator(v, target, listener);
|
||||
@@ -3651,22 +3646,12 @@ public class NotificationStackScrollLayout extends ViewGroup
|
||||
|
||||
@Override
|
||||
public void setTranslation(View v, float translate) {
|
||||
if (mDismissAllInProgress) {
|
||||
// When dismissing all, we translate the entire view instead.
|
||||
super.setTranslation(v, translate);
|
||||
} else {
|
||||
((ExpandableView) v).setTranslation(translate);
|
||||
}
|
||||
((ExpandableView) v).setTranslation(translate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getTranslation(View v) {
|
||||
if (mDismissAllInProgress) {
|
||||
// When dismissing all, we translate the entire view instead.
|
||||
return super.getTranslation(v);
|
||||
} else {
|
||||
return ((ExpandableView) v).getTranslation();
|
||||
}
|
||||
return ((ExpandableView) v).getTranslation();
|
||||
}
|
||||
|
||||
public void closeControlsIfOutsideTouch(MotionEvent ev) {
|
||||
|
||||
Reference in New Issue
Block a user