Loading packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +52 −1 Original line number Original line Diff line number Diff line Loading @@ -516,7 +516,7 @@ public class NotificationStackScrollLayout extends ViewGroup switch (action & MotionEvent.ACTION_MASK) { switch (action & MotionEvent.ACTION_MASK) { case MotionEvent.ACTION_DOWN: { case MotionEvent.ACTION_DOWN: { if (getChildCount() == 0) { if (getChildCount() == 0 || !isInContentBounds(ev)) { return false; return false; } } boolean isBeingDragged = !mScroller.isFinished(); boolean isBeingDragged = !mScroller.isFinished(); Loading Loading @@ -1140,6 +1140,13 @@ public class NotificationStackScrollLayout extends ViewGroup return mIsBeingDragged; return mIsBeingDragged; } } /** * @return Whether the specified motion event is actually happening over the content. */ private boolean isInContentBounds(MotionEvent event) { return event.getY() < getHeight() - getEmptyBottomMargin(); } private void setIsBeingDragged(boolean isDragged) { private void setIsBeingDragged(boolean isDragged) { mIsBeingDragged = isDragged; mIsBeingDragged = isDragged; if (isDragged) { if (isDragged) { Loading Loading @@ -1308,6 +1315,33 @@ public class NotificationStackScrollLayout extends ViewGroup .animateDimmed() .animateDimmed() }; }; static int[] LENGTHS = new int[] { // ANIMATION_TYPE_ADD StackStateAnimator.ANIMATION_DURATION_STANDARD, // ANIMATION_TYPE_REMOVE StackStateAnimator.ANIMATION_DURATION_STANDARD, // ANIMATION_TYPE_REMOVE_SWIPED_OUT StackStateAnimator.ANIMATION_DURATION_STANDARD, // ANIMATION_TYPE_TOP_PADDING_CHANGED StackStateAnimator.ANIMATION_DURATION_STANDARD, // ANIMATION_TYPE_START_DRAG StackStateAnimator.ANIMATION_DURATION_STANDARD, // ANIMATION_TYPE_SNAP_BACK StackStateAnimator.ANIMATION_DURATION_STANDARD, // ANIMATION_TYPE_ACTIVATED_CHILD StackStateAnimator.ANIMATION_DURATION_DIMMED_ACTIVATED, // ANIMATION_TYPE_DIMMED StackStateAnimator.ANIMATION_DURATION_DIMMED_ACTIVATED, }; static int ANIMATION_TYPE_ADD = 0; static int ANIMATION_TYPE_ADD = 0; static int ANIMATION_TYPE_REMOVE = 1; static int ANIMATION_TYPE_REMOVE = 1; static int ANIMATION_TYPE_REMOVE_SWIPED_OUT = 2; static int ANIMATION_TYPE_REMOVE_SWIPED_OUT = 2; Loading @@ -1321,12 +1355,29 @@ public class NotificationStackScrollLayout extends ViewGroup final View changingView; final View changingView; final int animationType; final int animationType; final AnimationFilter filter; final AnimationFilter filter; final long length; AnimationEvent(View view, int type) { AnimationEvent(View view, int type) { eventStartTime = AnimationUtils.currentAnimationTimeMillis(); eventStartTime = AnimationUtils.currentAnimationTimeMillis(); changingView = view; changingView = view; animationType = type; animationType = type; filter = FILTERS[type]; filter = FILTERS[type]; length = LENGTHS[type]; } /** * Combines the length of several animation events into a single value. * * @param events The events of the lengths to combine. * @return The combined length. This is just the maximum of all length. */ static long combineLength(ArrayList<AnimationEvent> events) { long length = 0; int size = events.size(); for (int i = 0; i < size; i++) { length = Math.max(length, events.get(i).length); } return length; } } } } Loading packages/SystemUI/src/com/android/systemui/statusbar/stack/StackStateAnimator.java +6 −2 Original line number Original line Diff line number Diff line Loading @@ -39,7 +39,9 @@ import java.util.Stack; */ */ public class StackStateAnimator { public class StackStateAnimator { private static final int ANIMATION_DURATION = 360; public static final int ANIMATION_DURATION_STANDARD = 360; public static final int ANIMATION_DURATION_DIMMED_ACTIVATED = 220; private static final int TAG_ANIMATOR_TRANSLATION_Y = R.id.translation_y_animator_tag; private static final int TAG_ANIMATOR_TRANSLATION_Y = R.id.translation_y_animator_tag; private static final int TAG_ANIMATOR_TRANSLATION_Z = R.id.translation_z_animator_tag; private static final int TAG_ANIMATOR_TRANSLATION_Z = R.id.translation_z_animator_tag; private static final int TAG_ANIMATOR_SCALE = R.id.scale_animator_tag; private static final int TAG_ANIMATOR_SCALE = R.id.scale_animator_tag; Loading @@ -63,6 +65,7 @@ public class StackStateAnimator { private Stack<AnimatorListenerAdapter> mAnimationListenerPool private Stack<AnimatorListenerAdapter> mAnimationListenerPool = new Stack<AnimatorListenerAdapter>(); = new Stack<AnimatorListenerAdapter>(); private AnimationFilter mAnimationFilter = new AnimationFilter(); private AnimationFilter mAnimationFilter = new AnimationFilter(); private long mCurrentLength; public StackStateAnimator(NotificationStackScrollLayout hostLayout) { public StackStateAnimator(NotificationStackScrollLayout hostLayout) { mHostLayout = hostLayout; mHostLayout = hostLayout; Loading @@ -82,6 +85,7 @@ public class StackStateAnimator { int childCount = mHostLayout.getChildCount(); int childCount = mHostLayout.getChildCount(); mAnimationFilter.applyCombination(mNewEvents); mAnimationFilter.applyCombination(mNewEvents); mCurrentLength = NotificationStackScrollLayout.AnimationEvent.combineLength(mNewEvents); for (int i = 0; i < childCount; i++) { for (int i = 0; i < childCount; i++) { final ExpandableView child = (ExpandableView) mHostLayout.getChildAt(i); final ExpandableView child = (ExpandableView) mHostLayout.getChildAt(i); StackScrollState.ViewState viewState = finalState.getViewStateForView(child); StackScrollState.ViewState viewState = finalState.getViewStateForView(child); Loading Loading @@ -410,7 +414,7 @@ public class StackStateAnimator { */ */ private long cancelAnimatorAndGetNewDuration(ValueAnimator previousAnimator, private long cancelAnimatorAndGetNewDuration(ValueAnimator previousAnimator, boolean newAnimationNeeded) { boolean newAnimationNeeded) { long newDuration = ANIMATION_DURATION; long newDuration = mCurrentLength; if (previousAnimator != null) { if (previousAnimator != null) { if (!newAnimationNeeded) { if (!newAnimationNeeded) { // This is only an update, no new event came in. lets just take the remaining // This is only an update, no new event came in. lets just take the remaining Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +52 −1 Original line number Original line Diff line number Diff line Loading @@ -516,7 +516,7 @@ public class NotificationStackScrollLayout extends ViewGroup switch (action & MotionEvent.ACTION_MASK) { switch (action & MotionEvent.ACTION_MASK) { case MotionEvent.ACTION_DOWN: { case MotionEvent.ACTION_DOWN: { if (getChildCount() == 0) { if (getChildCount() == 0 || !isInContentBounds(ev)) { return false; return false; } } boolean isBeingDragged = !mScroller.isFinished(); boolean isBeingDragged = !mScroller.isFinished(); Loading Loading @@ -1140,6 +1140,13 @@ public class NotificationStackScrollLayout extends ViewGroup return mIsBeingDragged; return mIsBeingDragged; } } /** * @return Whether the specified motion event is actually happening over the content. */ private boolean isInContentBounds(MotionEvent event) { return event.getY() < getHeight() - getEmptyBottomMargin(); } private void setIsBeingDragged(boolean isDragged) { private void setIsBeingDragged(boolean isDragged) { mIsBeingDragged = isDragged; mIsBeingDragged = isDragged; if (isDragged) { if (isDragged) { Loading Loading @@ -1308,6 +1315,33 @@ public class NotificationStackScrollLayout extends ViewGroup .animateDimmed() .animateDimmed() }; }; static int[] LENGTHS = new int[] { // ANIMATION_TYPE_ADD StackStateAnimator.ANIMATION_DURATION_STANDARD, // ANIMATION_TYPE_REMOVE StackStateAnimator.ANIMATION_DURATION_STANDARD, // ANIMATION_TYPE_REMOVE_SWIPED_OUT StackStateAnimator.ANIMATION_DURATION_STANDARD, // ANIMATION_TYPE_TOP_PADDING_CHANGED StackStateAnimator.ANIMATION_DURATION_STANDARD, // ANIMATION_TYPE_START_DRAG StackStateAnimator.ANIMATION_DURATION_STANDARD, // ANIMATION_TYPE_SNAP_BACK StackStateAnimator.ANIMATION_DURATION_STANDARD, // ANIMATION_TYPE_ACTIVATED_CHILD StackStateAnimator.ANIMATION_DURATION_DIMMED_ACTIVATED, // ANIMATION_TYPE_DIMMED StackStateAnimator.ANIMATION_DURATION_DIMMED_ACTIVATED, }; static int ANIMATION_TYPE_ADD = 0; static int ANIMATION_TYPE_ADD = 0; static int ANIMATION_TYPE_REMOVE = 1; static int ANIMATION_TYPE_REMOVE = 1; static int ANIMATION_TYPE_REMOVE_SWIPED_OUT = 2; static int ANIMATION_TYPE_REMOVE_SWIPED_OUT = 2; Loading @@ -1321,12 +1355,29 @@ public class NotificationStackScrollLayout extends ViewGroup final View changingView; final View changingView; final int animationType; final int animationType; final AnimationFilter filter; final AnimationFilter filter; final long length; AnimationEvent(View view, int type) { AnimationEvent(View view, int type) { eventStartTime = AnimationUtils.currentAnimationTimeMillis(); eventStartTime = AnimationUtils.currentAnimationTimeMillis(); changingView = view; changingView = view; animationType = type; animationType = type; filter = FILTERS[type]; filter = FILTERS[type]; length = LENGTHS[type]; } /** * Combines the length of several animation events into a single value. * * @param events The events of the lengths to combine. * @return The combined length. This is just the maximum of all length. */ static long combineLength(ArrayList<AnimationEvent> events) { long length = 0; int size = events.size(); for (int i = 0; i < size; i++) { length = Math.max(length, events.get(i).length); } return length; } } } } Loading
packages/SystemUI/src/com/android/systemui/statusbar/stack/StackStateAnimator.java +6 −2 Original line number Original line Diff line number Diff line Loading @@ -39,7 +39,9 @@ import java.util.Stack; */ */ public class StackStateAnimator { public class StackStateAnimator { private static final int ANIMATION_DURATION = 360; public static final int ANIMATION_DURATION_STANDARD = 360; public static final int ANIMATION_DURATION_DIMMED_ACTIVATED = 220; private static final int TAG_ANIMATOR_TRANSLATION_Y = R.id.translation_y_animator_tag; private static final int TAG_ANIMATOR_TRANSLATION_Y = R.id.translation_y_animator_tag; private static final int TAG_ANIMATOR_TRANSLATION_Z = R.id.translation_z_animator_tag; private static final int TAG_ANIMATOR_TRANSLATION_Z = R.id.translation_z_animator_tag; private static final int TAG_ANIMATOR_SCALE = R.id.scale_animator_tag; private static final int TAG_ANIMATOR_SCALE = R.id.scale_animator_tag; Loading @@ -63,6 +65,7 @@ public class StackStateAnimator { private Stack<AnimatorListenerAdapter> mAnimationListenerPool private Stack<AnimatorListenerAdapter> mAnimationListenerPool = new Stack<AnimatorListenerAdapter>(); = new Stack<AnimatorListenerAdapter>(); private AnimationFilter mAnimationFilter = new AnimationFilter(); private AnimationFilter mAnimationFilter = new AnimationFilter(); private long mCurrentLength; public StackStateAnimator(NotificationStackScrollLayout hostLayout) { public StackStateAnimator(NotificationStackScrollLayout hostLayout) { mHostLayout = hostLayout; mHostLayout = hostLayout; Loading @@ -82,6 +85,7 @@ public class StackStateAnimator { int childCount = mHostLayout.getChildCount(); int childCount = mHostLayout.getChildCount(); mAnimationFilter.applyCombination(mNewEvents); mAnimationFilter.applyCombination(mNewEvents); mCurrentLength = NotificationStackScrollLayout.AnimationEvent.combineLength(mNewEvents); for (int i = 0; i < childCount; i++) { for (int i = 0; i < childCount; i++) { final ExpandableView child = (ExpandableView) mHostLayout.getChildAt(i); final ExpandableView child = (ExpandableView) mHostLayout.getChildAt(i); StackScrollState.ViewState viewState = finalState.getViewStateForView(child); StackScrollState.ViewState viewState = finalState.getViewStateForView(child); Loading Loading @@ -410,7 +414,7 @@ public class StackStateAnimator { */ */ private long cancelAnimatorAndGetNewDuration(ValueAnimator previousAnimator, private long cancelAnimatorAndGetNewDuration(ValueAnimator previousAnimator, boolean newAnimationNeeded) { boolean newAnimationNeeded) { long newDuration = ANIMATION_DURATION; long newDuration = mCurrentLength; if (previousAnimator != null) { if (previousAnimator != null) { if (!newAnimationNeeded) { if (!newAnimationNeeded) { // This is only an update, no new event came in. lets just take the remaining // This is only an update, no new event came in. lets just take the remaining Loading