Merge "Round notif corners on swipe"
This commit is contained in:
@@ -54,7 +54,8 @@ public abstract class ExpandableOutlineView extends ExpandableView {
|
||||
R.id.bottom_roundess_animator_end_tag,
|
||||
R.id.bottom_roundess_animator_start_tag);
|
||||
private static final AnimationProperties ROUNDNESS_PROPERTIES =
|
||||
new AnimationProperties().setDuration(StackStateAnimator.ANIMATION_DURATION_STANDARD);
|
||||
new AnimationProperties().setDuration(
|
||||
StackStateAnimator.ANIMATION_DURATION_CORNER_RADIUS);
|
||||
private static final Path EMPTY_PATH = new Path();
|
||||
|
||||
private final Rect mOutlineRect = new Rect();
|
||||
|
||||
@@ -69,6 +69,7 @@ public abstract class ExpandableView extends FrameLayout implements Dumpable {
|
||||
private float mContentTranslation;
|
||||
protected boolean mLastInSection;
|
||||
protected boolean mFirstInSection;
|
||||
boolean mIsBeingSwiped;
|
||||
|
||||
public ExpandableView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
@@ -173,6 +174,14 @@ public abstract class ExpandableView extends FrameLayout implements Dumpable {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setIsBeingSwiped(boolean swiped) {
|
||||
mIsBeingSwiped = swiped;
|
||||
}
|
||||
|
||||
public boolean isBeingSwiped() {
|
||||
return mIsBeingSwiped;
|
||||
}
|
||||
|
||||
public boolean isHeadsUpAnimatingAway() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ public class NotificationRoundnessManager {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean updateViewWithoutCallback(ExpandableView view,
|
||||
boolean updateViewWithoutCallback(ExpandableView view,
|
||||
boolean animate) {
|
||||
float topRoundness = getRoundness(view, true /* top */);
|
||||
float bottomRoundness = getRoundness(view, false /* top */);
|
||||
@@ -107,7 +107,9 @@ public class NotificationRoundnessManager {
|
||||
}
|
||||
|
||||
private float getRoundness(ExpandableView view, boolean top) {
|
||||
if ((view.isPinned() || view.isHeadsUpAnimatingAway()) && !mExpanded) {
|
||||
if ((view.isPinned()
|
||||
|| view.isBeingSwiped()
|
||||
|| (view.isHeadsUpAnimatingAway()) && !mExpanded)) {
|
||||
return 1.0f;
|
||||
}
|
||||
if (isFirstInSection(view, true /* include first section */) && top) {
|
||||
|
||||
@@ -4967,7 +4967,13 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
|
||||
mSwipedOutViews.add(v);
|
||||
}
|
||||
|
||||
void onSwipeBegin() {
|
||||
void onSwipeBegin(View v) {
|
||||
if (v instanceof ExpandableView) {
|
||||
ExpandableView ev = (ExpandableView) v;
|
||||
ev.setIsBeingSwiped(true);
|
||||
mController.getNoticationRoundessManager()
|
||||
.updateViewWithoutCallback(ev, true /* animate */);
|
||||
}
|
||||
requestDisallowInterceptTouchEvent(true);
|
||||
updateFirstAndLastBackgroundViews();
|
||||
updateContinuousShadowDrawing();
|
||||
@@ -4975,7 +4981,13 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
|
||||
requestChildrenUpdate();
|
||||
}
|
||||
|
||||
void onSwipeEnd() {
|
||||
void onSwipeEnd(View v) {
|
||||
if (v instanceof ExpandableView) {
|
||||
ExpandableView ev = (ExpandableView) v;
|
||||
ev.setIsBeingSwiped(false);
|
||||
mController.getNoticationRoundessManager()
|
||||
.updateViewWithoutCallback(ev, true /* animate */);
|
||||
}
|
||||
updateFirstAndLastBackgroundViews();
|
||||
}
|
||||
|
||||
|
||||
@@ -395,7 +395,7 @@ public class NotificationStackScrollLayoutController {
|
||||
if (mView.getDismissAllInProgress()) {
|
||||
return;
|
||||
}
|
||||
mView.onSwipeEnd();
|
||||
mView.onSwipeEnd(view);
|
||||
if (view instanceof ExpandableNotificationRow) {
|
||||
ExpandableNotificationRow row = (ExpandableNotificationRow) view;
|
||||
if (row.isHeadsUp()) {
|
||||
@@ -450,12 +450,12 @@ public class NotificationStackScrollLayoutController {
|
||||
@Override
|
||||
public void onBeginDrag(View v) {
|
||||
mFalsingCollector.onNotificationStartDismissing();
|
||||
mView.onSwipeBegin();
|
||||
mView.onSwipeBegin(v);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChildSnappedBack(View animView, float targetLeft) {
|
||||
mView.onSwipeEnd();
|
||||
mView.onSwipeEnd(animView);
|
||||
if (animView instanceof ExpandableNotificationRow) {
|
||||
ExpandableNotificationRow row = (ExpandableNotificationRow) animView;
|
||||
if (row.isPinned() && !canChildBeDismissed(row)
|
||||
|
||||
@@ -42,6 +42,7 @@ import java.util.Stack;
|
||||
public class StackStateAnimator {
|
||||
|
||||
public static final int ANIMATION_DURATION_STANDARD = 360;
|
||||
public static final int ANIMATION_DURATION_CORNER_RADIUS = 200;
|
||||
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_APPEAR_DISAPPEAR = 464;
|
||||
|
||||
Reference in New Issue
Block a user