Loading packages/SystemUI/src/com/android/systemui/SystemUIFactory.java +5 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ import com.android.systemui.statusbar.policy.SecurityController; import com.android.systemui.statusbar.policy.UserInfoController; import com.android.systemui.statusbar.policy.UserSwitcherController; import com.android.systemui.statusbar.policy.ZenModeController; import com.android.systemui.statusbar.stack.StackScrollAlgorithm; /** * Class factory to provide customizable SystemUI components. Loading Loading @@ -115,4 +116,8 @@ public class SystemUIFactory { public <T> T createInstance(Class<T> classType) { return null; } public StackScrollAlgorithm createStackScrollAlgorithm(Context context) { return new StackScrollAlgorithm(context); } } packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +3 −5 Original line number Diff line number Diff line Loading @@ -54,6 +54,7 @@ import com.android.systemui.ExpandHelper; import com.android.systemui.Interpolators; import com.android.systemui.R; import com.android.systemui.SwipeHelper; import com.android.systemui.SystemUIFactory; import com.android.systemui.classifier.FalsingManager; import com.android.systemui.statusbar.ActivatableNotificationView; import com.android.systemui.statusbar.DismissView; Loading Loading @@ -141,7 +142,7 @@ public class NotificationStackScrollLayout extends ViewGroup /** * The algorithm which calculates the properties for our children */ private final StackScrollAlgorithm mStackScrollAlgorithm; protected final StackScrollAlgorithm mStackScrollAlgorithm; /** * The current State this Layout is in Loading Loading @@ -352,7 +353,7 @@ public class NotificationStackScrollLayout extends ViewGroup mExpandHelper.setScrollAdapter(this); mSwipeHelper = new NotificationSwipeHelper(SwipeHelper.X, this, getContext()); mSwipeHelper.setLongPressListener(mLongPressListener); mStackScrollAlgorithm = new StackScrollAlgorithm(context); mStackScrollAlgorithm = SystemUIFactory.getInstance().createStackScrollAlgorithm(context); initView(context); setWillNotDraw(false); if (DEBUG) { Loading Loading @@ -1053,7 +1054,6 @@ public class NotificationStackScrollLayout extends ViewGroup } boolean isBeingDragged = !mScroller.isFinished(); setIsBeingDragged(isBeingDragged); /* * If being flinged and user touches, stop the fling. isFinished * will be false if being flinged. Loading Loading @@ -1138,7 +1138,6 @@ public class NotificationStackScrollLayout extends ViewGroup } } } mActivePointerId = INVALID_POINTER; endDrag(); } Loading Loading @@ -1320,7 +1319,6 @@ public class NotificationStackScrollLayout extends ViewGroup boolean isTouchEvent) { int newScrollY = scrollY + deltaY; final int top = -maxOverScrollY; final int bottom = maxOverScrollY + scrollRangeY; Loading packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java +102 −89 Original line number Diff line number Diff line Loading @@ -359,14 +359,20 @@ public class StackScrollAlgorithm { // The y coordinate of the current child. float currentYPosition = -algorithmState.scrollY; int childCount = algorithmState.visibleChildren.size(); int paddingAfterChild; for (int i = 0; i < childCount; i++) { currentYPosition = updateChild(i, resultState, algorithmState, ambientState, currentYPosition, bottomStackStart); } } protected float updateChild(int i, StackScrollState resultState, StackScrollAlgorithmState algorithmState, AmbientState ambientState, float currentYPosition, float bottomStackStart) { ExpandableView child = algorithmState.visibleChildren.get(i); StackViewState childViewState = resultState.getViewStateForView(child); childViewState.location = StackViewState.LOCATION_UNKNOWN; paddingAfterChild = getPaddingAfterChild(algorithmState, child); int paddingAfterChild = getPaddingAfterChild(algorithmState, child); int childHeight = getMaxAllowedChildHeight(child); int collapsedHeight = child.getCollapsedHeight(); childViewState.yTranslation = currentYPosition; Loading Loading @@ -416,10 +422,10 @@ public class StackScrollAlgorithm { childViewState.yTranslation += ambientState.getTopPadding() + ambientState.getStackTranslation(); } return currentYPosition; } private int getPaddingAfterChild(StackScrollAlgorithmState algorithmState, protected int getPaddingAfterChild(StackScrollAlgorithmState algorithmState, ExpandableView child) { Float paddingValue = algorithmState.increasedPaddingMap.get(child); return paddingValue == null Loading Loading @@ -513,7 +519,7 @@ public class StackScrollAlgorithm { } } private int getMaxAllowedChildHeight(View child) { protected int getMaxAllowedChildHeight(View child) { if (child instanceof ExpandableView) { ExpandableView expandableView = (ExpandableView) child; return expandableView.getIntrinsicHeight(); Loading Loading @@ -581,7 +587,7 @@ public class StackScrollAlgorithm { * @param childHeight the height of the child * @param ambientState The ambient state of the algorithm */ private void updateFirstChildHeight(ExpandableView child, StackViewState childViewState, protected void updateFirstChildHeight(ExpandableView child, StackViewState childViewState, int childHeight, AmbientState ambientState) { // The starting position of the bottom stack peek Loading @@ -604,6 +610,14 @@ public class StackScrollAlgorithm { int childCount = algorithmState.visibleChildren.size(); float childrenOnTop = 0.0f; for (int i = childCount - 1; i >= 0; i--) { updateChildZValue(i, childCount, childrenOnTop, resultState, algorithmState, ambientState); } } protected void updateChildZValue(int i, int childCount, float childrenOnTop, StackScrollState resultState, StackScrollAlgorithmState algorithmState, AmbientState ambientState) { ExpandableView child = algorithmState.visibleChildren.get(i); StackViewState childViewState = resultState.getViewStateForView(child); if (i > (childCount - 1 - algorithmState.itemsInBottomStack)) { Loading Loading @@ -642,7 +656,6 @@ public class StackScrollAlgorithm { childViewState.zTranslation = mZBasicHeight; } } } private boolean isMaxSizeInitialized(ExpandableView child) { if (child instanceof ExpandableNotificationRow) { Loading @@ -667,7 +680,7 @@ public class StackScrollAlgorithm { this.mIsExpanded = isExpanded; } class StackScrollAlgorithmState { protected class StackScrollAlgorithmState { /** * The scroll position of the algorithm Loading Loading
packages/SystemUI/src/com/android/systemui/SystemUIFactory.java +5 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ import com.android.systemui.statusbar.policy.SecurityController; import com.android.systemui.statusbar.policy.UserInfoController; import com.android.systemui.statusbar.policy.UserSwitcherController; import com.android.systemui.statusbar.policy.ZenModeController; import com.android.systemui.statusbar.stack.StackScrollAlgorithm; /** * Class factory to provide customizable SystemUI components. Loading Loading @@ -115,4 +116,8 @@ public class SystemUIFactory { public <T> T createInstance(Class<T> classType) { return null; } public StackScrollAlgorithm createStackScrollAlgorithm(Context context) { return new StackScrollAlgorithm(context); } }
packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +3 −5 Original line number Diff line number Diff line Loading @@ -54,6 +54,7 @@ import com.android.systemui.ExpandHelper; import com.android.systemui.Interpolators; import com.android.systemui.R; import com.android.systemui.SwipeHelper; import com.android.systemui.SystemUIFactory; import com.android.systemui.classifier.FalsingManager; import com.android.systemui.statusbar.ActivatableNotificationView; import com.android.systemui.statusbar.DismissView; Loading Loading @@ -141,7 +142,7 @@ public class NotificationStackScrollLayout extends ViewGroup /** * The algorithm which calculates the properties for our children */ private final StackScrollAlgorithm mStackScrollAlgorithm; protected final StackScrollAlgorithm mStackScrollAlgorithm; /** * The current State this Layout is in Loading Loading @@ -352,7 +353,7 @@ public class NotificationStackScrollLayout extends ViewGroup mExpandHelper.setScrollAdapter(this); mSwipeHelper = new NotificationSwipeHelper(SwipeHelper.X, this, getContext()); mSwipeHelper.setLongPressListener(mLongPressListener); mStackScrollAlgorithm = new StackScrollAlgorithm(context); mStackScrollAlgorithm = SystemUIFactory.getInstance().createStackScrollAlgorithm(context); initView(context); setWillNotDraw(false); if (DEBUG) { Loading Loading @@ -1053,7 +1054,6 @@ public class NotificationStackScrollLayout extends ViewGroup } boolean isBeingDragged = !mScroller.isFinished(); setIsBeingDragged(isBeingDragged); /* * If being flinged and user touches, stop the fling. isFinished * will be false if being flinged. Loading Loading @@ -1138,7 +1138,6 @@ public class NotificationStackScrollLayout extends ViewGroup } } } mActivePointerId = INVALID_POINTER; endDrag(); } Loading Loading @@ -1320,7 +1319,6 @@ public class NotificationStackScrollLayout extends ViewGroup boolean isTouchEvent) { int newScrollY = scrollY + deltaY; final int top = -maxOverScrollY; final int bottom = maxOverScrollY + scrollRangeY; Loading
packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java +102 −89 Original line number Diff line number Diff line Loading @@ -359,14 +359,20 @@ public class StackScrollAlgorithm { // The y coordinate of the current child. float currentYPosition = -algorithmState.scrollY; int childCount = algorithmState.visibleChildren.size(); int paddingAfterChild; for (int i = 0; i < childCount; i++) { currentYPosition = updateChild(i, resultState, algorithmState, ambientState, currentYPosition, bottomStackStart); } } protected float updateChild(int i, StackScrollState resultState, StackScrollAlgorithmState algorithmState, AmbientState ambientState, float currentYPosition, float bottomStackStart) { ExpandableView child = algorithmState.visibleChildren.get(i); StackViewState childViewState = resultState.getViewStateForView(child); childViewState.location = StackViewState.LOCATION_UNKNOWN; paddingAfterChild = getPaddingAfterChild(algorithmState, child); int paddingAfterChild = getPaddingAfterChild(algorithmState, child); int childHeight = getMaxAllowedChildHeight(child); int collapsedHeight = child.getCollapsedHeight(); childViewState.yTranslation = currentYPosition; Loading Loading @@ -416,10 +422,10 @@ public class StackScrollAlgorithm { childViewState.yTranslation += ambientState.getTopPadding() + ambientState.getStackTranslation(); } return currentYPosition; } private int getPaddingAfterChild(StackScrollAlgorithmState algorithmState, protected int getPaddingAfterChild(StackScrollAlgorithmState algorithmState, ExpandableView child) { Float paddingValue = algorithmState.increasedPaddingMap.get(child); return paddingValue == null Loading Loading @@ -513,7 +519,7 @@ public class StackScrollAlgorithm { } } private int getMaxAllowedChildHeight(View child) { protected int getMaxAllowedChildHeight(View child) { if (child instanceof ExpandableView) { ExpandableView expandableView = (ExpandableView) child; return expandableView.getIntrinsicHeight(); Loading Loading @@ -581,7 +587,7 @@ public class StackScrollAlgorithm { * @param childHeight the height of the child * @param ambientState The ambient state of the algorithm */ private void updateFirstChildHeight(ExpandableView child, StackViewState childViewState, protected void updateFirstChildHeight(ExpandableView child, StackViewState childViewState, int childHeight, AmbientState ambientState) { // The starting position of the bottom stack peek Loading @@ -604,6 +610,14 @@ public class StackScrollAlgorithm { int childCount = algorithmState.visibleChildren.size(); float childrenOnTop = 0.0f; for (int i = childCount - 1; i >= 0; i--) { updateChildZValue(i, childCount, childrenOnTop, resultState, algorithmState, ambientState); } } protected void updateChildZValue(int i, int childCount, float childrenOnTop, StackScrollState resultState, StackScrollAlgorithmState algorithmState, AmbientState ambientState) { ExpandableView child = algorithmState.visibleChildren.get(i); StackViewState childViewState = resultState.getViewStateForView(child); if (i > (childCount - 1 - algorithmState.itemsInBottomStack)) { Loading Loading @@ -642,7 +656,6 @@ public class StackScrollAlgorithm { childViewState.zTranslation = mZBasicHeight; } } } private boolean isMaxSizeInitialized(ExpandableView child) { if (child instanceof ExpandableNotificationRow) { Loading @@ -667,7 +680,7 @@ public class StackScrollAlgorithm { this.mIsExpanded = isExpanded; } class StackScrollAlgorithmState { protected class StackScrollAlgorithmState { /** * The scroll position of the algorithm Loading