Selim Cinek | 67b2260 | 2014-03-10 15:40:16 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2014 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License |
| 15 | */ |
| 16 | |
Rohan Shah | 20790b8 | 2018-07-02 17:21:04 -0700 | [diff] [blame] | 17 | package com.android.systemui.statusbar.notification.stack; |
Selim Cinek | 67b2260 | 2014-03-10 15:40:16 +0100 | [diff] [blame] | 18 | |
| 19 | import android.content.Context; |
Anthony Chen | 9fe1ee7 | 2017-04-07 13:53:37 -0700 | [diff] [blame] | 20 | import android.content.res.Resources; |
Christoph Studer | 6e3eceb | 2014-04-01 18:40:27 +0200 | [diff] [blame] | 21 | import android.util.Log; |
Selim Cinek | 67b2260 | 2014-03-10 15:40:16 +0100 | [diff] [blame] | 22 | import android.view.View; |
| 23 | import android.view.ViewGroup; |
Gus Prevas | e2d6f04 | 2018-10-17 15:25:30 -0400 | [diff] [blame] | 24 | |
Selim Cinek | 67b2260 | 2014-03-10 15:40:16 +0100 | [diff] [blame] | 25 | import com.android.systemui.R; |
Selim Cinek | cde90e5 | 2016-12-22 21:01:49 +0100 | [diff] [blame] | 26 | import com.android.systemui.statusbar.EmptyShadeView; |
Gus Prevas | e2d6f04 | 2018-10-17 15:25:30 -0400 | [diff] [blame] | 27 | import com.android.systemui.statusbar.NotificationShelf; |
| 28 | import com.android.systemui.statusbar.notification.NotificationUtils; |
Rohan Shah | 20790b8 | 2018-07-02 17:21:04 -0700 | [diff] [blame] | 29 | import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; |
| 30 | import com.android.systemui.statusbar.notification.row.ExpandableView; |
| 31 | import com.android.systemui.statusbar.notification.row.FooterView; |
Selim Cinek | 67b2260 | 2014-03-10 15:40:16 +0100 | [diff] [blame] | 32 | |
Jorim Jaggi | d4a5744 | 2014-04-10 02:45:55 +0200 | [diff] [blame] | 33 | import java.util.ArrayList; |
Selim Cinek | 42357e0 | 2016-02-24 18:48:01 -0800 | [diff] [blame] | 34 | import java.util.HashMap; |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 35 | import java.util.List; |
Jorim Jaggi | d4a5744 | 2014-04-10 02:45:55 +0200 | [diff] [blame] | 36 | |
Selim Cinek | 67b2260 | 2014-03-10 15:40:16 +0100 | [diff] [blame] | 37 | /** |
Rohan Shah | 20790b8 | 2018-07-02 17:21:04 -0700 | [diff] [blame] | 38 | * The Algorithm of the {@link com.android.systemui.statusbar.notification.stack |
Selim Cinek | 67b2260 | 2014-03-10 15:40:16 +0100 | [diff] [blame] | 39 | * .NotificationStackScrollLayout} which can be queried for {@link com.android.systemui.statusbar |
| 40 | * .stack.StackScrollState} |
| 41 | */ |
| 42 | public class StackScrollAlgorithm { |
| 43 | |
Gus Prevas | 0fa58d6 | 2019-01-11 13:58:40 -0500 | [diff] [blame] | 44 | static final boolean ANCHOR_SCROLLING = false; |
| 45 | |
Christoph Studer | 6e3eceb | 2014-04-01 18:40:27 +0200 | [diff] [blame] | 46 | private static final String LOG_TAG = "StackScrollAlgorithm"; |
Dave Mankoff | a4d195d | 2018-11-16 13:33:27 -0500 | [diff] [blame] | 47 | private final ViewGroup mHostView; |
Christoph Studer | 6e3eceb | 2014-04-01 18:40:27 +0200 | [diff] [blame] | 48 | |
Selim Cinek | 67b2260 | 2014-03-10 15:40:16 +0100 | [diff] [blame] | 49 | private int mPaddingBetweenElements; |
Selim Cinek | 61633a8 | 2016-01-25 15:54:10 -0800 | [diff] [blame] | 50 | private int mIncreasedPaddingBetweenElements; |
Gus Prevas | e2d6f04 | 2018-10-17 15:25:30 -0400 | [diff] [blame] | 51 | private int mGapHeight; |
Selim Cinek | 67b2260 | 2014-03-10 15:40:16 +0100 | [diff] [blame] | 52 | private int mCollapsedSize; |
Selim Cinek | 67b2260 | 2014-03-10 15:40:16 +0100 | [diff] [blame] | 53 | |
Selim Cinek | 67b2260 | 2014-03-10 15:40:16 +0100 | [diff] [blame] | 54 | private StackScrollAlgorithmState mTempAlgorithmState = new StackScrollAlgorithmState(); |
Selim Cinek | 1685e63 | 2014-04-08 02:27:49 +0200 | [diff] [blame] | 55 | private boolean mIsExpanded; |
Anthony Chen | 9fe1ee7 | 2017-04-07 13:53:37 -0700 | [diff] [blame] | 56 | private boolean mClipNotificationScrollToTop; |
Selim Cinek | cafa87f | 2016-10-26 17:00:17 -0700 | [diff] [blame] | 57 | private int mStatusBarHeight; |
Selim Cinek | aa9db1f | 2018-02-27 17:35:47 -0800 | [diff] [blame] | 58 | private float mHeadsUpInset; |
Selim Cinek | 99e9adf | 2018-03-15 09:17:47 -0700 | [diff] [blame] | 59 | private int mPinnedZTranslationExtra; |
Selim Cinek | 67b2260 | 2014-03-10 15:40:16 +0100 | [diff] [blame] | 60 | |
Ned Burns | 9eb0633 | 2019-04-23 16:02:12 -0400 | [diff] [blame] | 61 | public StackScrollAlgorithm( |
| 62 | Context context, |
| 63 | ViewGroup hostView) { |
Dave Mankoff | a4d195d | 2018-11-16 13:33:27 -0500 | [diff] [blame] | 64 | mHostView = hostView; |
Selim Cinek | af0dc31 | 2015-12-15 17:01:44 -0800 | [diff] [blame] | 65 | initView(context); |
Selim Cinek | 34c0a8d | 2014-05-12 00:01:43 +0200 | [diff] [blame] | 66 | } |
| 67 | |
Selim Cinek | af0dc31 | 2015-12-15 17:01:44 -0800 | [diff] [blame] | 68 | public void initView(Context context) { |
| 69 | initConstants(context); |
Selim Cinek | 34c0a8d | 2014-05-12 00:01:43 +0200 | [diff] [blame] | 70 | } |
| 71 | |
Selim Cinek | 67b2260 | 2014-03-10 15:40:16 +0100 | [diff] [blame] | 72 | private void initConstants(Context context) { |
Anthony Chen | 9fe1ee7 | 2017-04-07 13:53:37 -0700 | [diff] [blame] | 73 | Resources res = context.getResources(); |
| 74 | mPaddingBetweenElements = res.getDimensionPixelSize( |
Selim Cinek | db16737 | 2016-11-17 15:41:17 -0800 | [diff] [blame] | 75 | R.dimen.notification_divider_height); |
Anthony Chen | 9fe1ee7 | 2017-04-07 13:53:37 -0700 | [diff] [blame] | 76 | mIncreasedPaddingBetweenElements = |
| 77 | res.getDimensionPixelSize(R.dimen.notification_divider_height_increased); |
| 78 | mCollapsedSize = res.getDimensionPixelSize(R.dimen.notification_min_height); |
| 79 | mStatusBarHeight = res.getDimensionPixelSize(R.dimen.status_bar_height); |
| 80 | mClipNotificationScrollToTop = res.getBoolean(R.bool.config_clipNotificationScrollToTop); |
Selim Cinek | aa9db1f | 2018-02-27 17:35:47 -0800 | [diff] [blame] | 81 | mHeadsUpInset = mStatusBarHeight + res.getDimensionPixelSize( |
| 82 | R.dimen.heads_up_status_bar_padding); |
Selim Cinek | 99e9adf | 2018-03-15 09:17:47 -0700 | [diff] [blame] | 83 | mPinnedZTranslationExtra = res.getDimensionPixelSize( |
| 84 | R.dimen.heads_up_pinned_elevation); |
Gus Prevas | e2d6f04 | 2018-10-17 15:25:30 -0400 | [diff] [blame] | 85 | mGapHeight = res.getDimensionPixelSize(R.dimen.notification_section_divider_height); |
Jorim Jaggi | d7c1fae | 2014-08-13 18:27:47 +0200 | [diff] [blame] | 86 | } |
Selim Cinek | 67b2260 | 2014-03-10 15:40:16 +0100 | [diff] [blame] | 87 | |
Dave Mankoff | a4d195d | 2018-11-16 13:33:27 -0500 | [diff] [blame] | 88 | /** |
| 89 | * Updates the state of all children in the hostview based on this algorithm. |
| 90 | */ |
| 91 | public void resetViewStates(AmbientState ambientState) { |
Selim Cinek | 67b2260 | 2014-03-10 15:40:16 +0100 | [diff] [blame] | 92 | // The state of the local variables are saved in an algorithmState to easily subdivide it |
| 93 | // into multiple phases. |
| 94 | StackScrollAlgorithmState algorithmState = mTempAlgorithmState; |
| 95 | |
| 96 | // First we reset the view states to their default values. |
Dave Mankoff | a4d195d | 2018-11-16 13:33:27 -0500 | [diff] [blame] | 97 | resetChildViewStates(); |
Selim Cinek | 67b2260 | 2014-03-10 15:40:16 +0100 | [diff] [blame] | 98 | |
Dave Mankoff | a4d195d | 2018-11-16 13:33:27 -0500 | [diff] [blame] | 99 | initAlgorithmState(mHostView, algorithmState, ambientState); |
Selim Cinek | 1408eb5 | 2014-06-02 14:45:38 +0200 | [diff] [blame] | 100 | |
Dave Mankoff | a4d195d | 2018-11-16 13:33:27 -0500 | [diff] [blame] | 101 | updatePositionsForState(algorithmState, ambientState); |
Selim Cinek | 67b2260 | 2014-03-10 15:40:16 +0100 | [diff] [blame] | 102 | |
Dave Mankoff | a4d195d | 2018-11-16 13:33:27 -0500 | [diff] [blame] | 103 | updateZValuesForState(algorithmState, ambientState); |
Selim Cinek | 3776fe0 | 2016-02-04 13:32:43 -0800 | [diff] [blame] | 104 | |
Dave Mankoff | a4d195d | 2018-11-16 13:33:27 -0500 | [diff] [blame] | 105 | updateHeadsUpStates(algorithmState, ambientState); |
Selim Cinek | 5040f2e | 2019-02-14 18:22:42 -0800 | [diff] [blame] | 106 | updatePulsingStates(algorithmState, ambientState); |
Selim Cinek | eb97356 | 2014-05-02 17:07:49 +0200 | [diff] [blame] | 107 | |
Dave Mankoff | a4d195d | 2018-11-16 13:33:27 -0500 | [diff] [blame] | 108 | updateDimmedActivatedHideSensitive(ambientState, algorithmState); |
| 109 | updateClipping(algorithmState, ambientState); |
| 110 | updateSpeedBumpState(algorithmState, ambientState); |
| 111 | updateShelfState(ambientState); |
| 112 | getNotificationChildrenStates(algorithmState, ambientState); |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 113 | } |
| 114 | |
Dave Mankoff | a4d195d | 2018-11-16 13:33:27 -0500 | [diff] [blame] | 115 | private void resetChildViewStates() { |
| 116 | int numChildren = mHostView.getChildCount(); |
| 117 | for (int i = 0; i < numChildren; i++) { |
| 118 | ExpandableView child = (ExpandableView) mHostView.getChildAt(i); |
| 119 | child.resetViewState(); |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | private void getNotificationChildrenStates(StackScrollAlgorithmState algorithmState, |
Selim Cinek | c25989e | 2018-02-16 16:42:14 -0800 | [diff] [blame] | 124 | AmbientState ambientState) { |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 125 | int childCount = algorithmState.visibleChildren.size(); |
| 126 | for (int i = 0; i < childCount; i++) { |
| 127 | ExpandableView v = algorithmState.visibleChildren.get(i); |
| 128 | if (v instanceof ExpandableNotificationRow) { |
| 129 | ExpandableNotificationRow row = (ExpandableNotificationRow) v; |
Dave Mankoff | a4d195d | 2018-11-16 13:33:27 -0500 | [diff] [blame] | 130 | row.updateChildrenStates(ambientState); |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 131 | } |
| 132 | } |
Selim Cinek | 3d2b94bf | 2014-07-02 22:12:47 +0200 | [diff] [blame] | 133 | } |
| 134 | |
Dave Mankoff | a4d195d | 2018-11-16 13:33:27 -0500 | [diff] [blame] | 135 | private void updateSpeedBumpState(StackScrollAlgorithmState algorithmState, |
| 136 | AmbientState ambientState) { |
Selim Cinek | 3d2b94bf | 2014-07-02 22:12:47 +0200 | [diff] [blame] | 137 | int childCount = algorithmState.visibleChildren.size(); |
Selim Cinek | db16737 | 2016-11-17 15:41:17 -0800 | [diff] [blame] | 138 | int belowSpeedBump = ambientState.getSpeedBumpIndex(); |
Selim Cinek | 3d2b94bf | 2014-07-02 22:12:47 +0200 | [diff] [blame] | 139 | for (int i = 0; i < childCount; i++) { |
Dave Mankoff | a4d195d | 2018-11-16 13:33:27 -0500 | [diff] [blame] | 140 | ExpandableView child = algorithmState.visibleChildren.get(i); |
| 141 | ExpandableViewState childViewState = child.getViewState(); |
Selim Cinek | 3107cfa | 2014-07-22 15:24:29 +0200 | [diff] [blame] | 142 | |
| 143 | // The speed bump can also be gone, so equality needs to be taken when comparing |
| 144 | // indices. |
Selim Cinek | db16737 | 2016-11-17 15:41:17 -0800 | [diff] [blame] | 145 | childViewState.belowSpeedBump = i >= belowSpeedBump; |
Selim Cinek | 3d2b94bf | 2014-07-02 22:12:47 +0200 | [diff] [blame] | 146 | } |
Selim Cinek | db16737 | 2016-11-17 15:41:17 -0800 | [diff] [blame] | 147 | |
| 148 | } |
Dave Mankoff | a4d195d | 2018-11-16 13:33:27 -0500 | [diff] [blame] | 149 | |
| 150 | private void updateShelfState(AmbientState ambientState) { |
Selim Cinek | 281c202 | 2016-10-13 19:14:43 -0700 | [diff] [blame] | 151 | NotificationShelf shelf = ambientState.getShelf(); |
Eliot Courtney | 5d3d2d0 | 2018-01-18 15:59:03 +0900 | [diff] [blame] | 152 | if (shelf != null) { |
Dave Mankoff | a4d195d | 2018-11-16 13:33:27 -0500 | [diff] [blame] | 153 | shelf.updateState(ambientState); |
Eliot Courtney | 5d3d2d0 | 2018-01-18 15:59:03 +0900 | [diff] [blame] | 154 | } |
Selim Cinek | f54090e | 2014-06-17 17:24:51 -0700 | [diff] [blame] | 155 | } |
| 156 | |
Dave Mankoff | a4d195d | 2018-11-16 13:33:27 -0500 | [diff] [blame] | 157 | private void updateClipping(StackScrollAlgorithmState algorithmState, |
| 158 | AmbientState ambientState) { |
Selim Cinek | 355652a | 2016-12-07 13:32:12 -0800 | [diff] [blame] | 159 | float drawStart = !ambientState.isOnKeyguard() ? ambientState.getTopPadding() |
Selim Cinek | 2627d72 | 2018-01-19 12:16:49 -0800 | [diff] [blame] | 160 | + ambientState.getStackTranslation() + ambientState.getExpandAnimationTopChange() |
| 161 | : 0; |
Selim Cinek | 708a6c1 | 2014-05-28 14:16:02 +0200 | [diff] [blame] | 162 | float previousNotificationEnd = 0; |
| 163 | float previousNotificationStart = 0; |
Selim Cinek | 708a6c1 | 2014-05-28 14:16:02 +0200 | [diff] [blame] | 164 | int childCount = algorithmState.visibleChildren.size(); |
| 165 | for (int i = 0; i < childCount; i++) { |
| 166 | ExpandableView child = algorithmState.visibleChildren.get(i); |
Dave Mankoff | a4d195d | 2018-11-16 13:33:27 -0500 | [diff] [blame] | 167 | ExpandableViewState state = child.getViewState(); |
Selim Cinek | 9b9d6e1 | 2017-11-30 12:29:47 +0100 | [diff] [blame] | 168 | if (!child.mustStayOnScreen() || state.headsUpIsVisible) { |
Selim Cinek | 3776fe0 | 2016-02-04 13:32:43 -0800 | [diff] [blame] | 169 | previousNotificationEnd = Math.max(drawStart, previousNotificationEnd); |
| 170 | previousNotificationStart = Math.max(drawStart, previousNotificationStart); |
| 171 | } |
Selim Cinek | 587cbf3 | 2016-01-19 11:36:18 -0800 | [diff] [blame] | 172 | float newYTranslation = state.yTranslation; |
| 173 | float newHeight = state.height; |
Selim Cinek | 708a6c1 | 2014-05-28 14:16:02 +0200 | [diff] [blame] | 174 | float newNotificationEnd = newYTranslation + newHeight; |
Mady Mellor | 53ac1ef | 2016-06-20 13:11:38 -0700 | [diff] [blame] | 175 | boolean isHeadsUp = (child instanceof ExpandableNotificationRow) |
| 176 | && ((ExpandableNotificationRow) child).isPinned(); |
Anthony Chen | 9fe1ee7 | 2017-04-07 13:53:37 -0700 | [diff] [blame] | 177 | if (mClipNotificationScrollToTop |
| 178 | && !state.inShelf && newYTranslation < previousNotificationEnd |
Jorim Jaggi | 0fdf574 | 2016-06-27 11:50:58 -0700 | [diff] [blame] | 179 | && (!isHeadsUp || ambientState.isShadeExpanded())) { |
Mady Mellor | c128f22 | 2016-04-26 11:42:46 -0700 | [diff] [blame] | 180 | // The previous view is overlapping on top, clip! |
| 181 | float overlapAmount = previousNotificationEnd - newYTranslation; |
| 182 | state.clipTopAmount = (int) overlapAmount; |
Selim Cinek | c5baa3e | 2014-10-29 19:04:19 +0100 | [diff] [blame] | 183 | } else { |
Mady Mellor | c128f22 | 2016-04-26 11:42:46 -0700 | [diff] [blame] | 184 | state.clipTopAmount = 0; |
Selim Cinek | 9c17b77 | 2015-07-07 20:37:09 -0700 | [diff] [blame] | 185 | } |
| 186 | |
Selim Cinek | 708a6c1 | 2014-05-28 14:16:02 +0200 | [diff] [blame] | 187 | if (!child.isTransparent()) { |
| 188 | // Only update the previous values if we are not transparent, |
| 189 | // otherwise we would clip to a transparent view. |
Mady Mellor | c128f22 | 2016-04-26 11:42:46 -0700 | [diff] [blame] | 190 | previousNotificationEnd = newNotificationEnd; |
| 191 | previousNotificationStart = newYTranslation; |
Selim Cinek | 708a6c1 | 2014-05-28 14:16:02 +0200 | [diff] [blame] | 192 | } |
| 193 | } |
| 194 | } |
| 195 | |
Selim Cinek | 9c17b77 | 2015-07-07 20:37:09 -0700 | [diff] [blame] | 196 | public static boolean canChildBeDismissed(View v) { |
Selim Cinek | 9e624e7 | 2016-07-20 13:46:49 -0700 | [diff] [blame] | 197 | if (!(v instanceof ExpandableNotificationRow)) { |
| 198 | return false; |
Selim Cinek | 38d429f | 2016-06-03 11:46:56 -0700 | [diff] [blame] | 199 | } |
Selim Cinek | 9e624e7 | 2016-07-20 13:46:49 -0700 | [diff] [blame] | 200 | ExpandableNotificationRow row = (ExpandableNotificationRow) v; |
Nadia Benbernou | 7a18c81 | 2019-02-08 16:23:10 -0500 | [diff] [blame] | 201 | if (row.isBlockingHelperShowingAndTranslationFinished()) { |
| 202 | return true; |
| 203 | } |
Aaron Heuckroth | 1dd67cb | 2018-06-14 14:28:08 -0400 | [diff] [blame] | 204 | if (row.areGutsExposed() || !row.getEntry().hasFinishedInitialization()) { |
Selim Cinek | 9e624e7 | 2016-07-20 13:46:49 -0700 | [diff] [blame] | 205 | return false; |
| 206 | } |
| 207 | return row.canViewBeDismissed(); |
Selim Cinek | 9c17b77 | 2015-07-07 20:37:09 -0700 | [diff] [blame] | 208 | } |
| 209 | |
Selim Cinek | 708a6c1 | 2014-05-28 14:16:02 +0200 | [diff] [blame] | 210 | /** |
Jorim Jaggi | ae44128 | 2014-08-01 02:45:18 +0200 | [diff] [blame] | 211 | * Updates the dimmed, activated and hiding sensitive states of the children. |
Jorim Jaggi | d552d9d | 2014-05-07 19:41:13 +0200 | [diff] [blame] | 212 | */ |
Jorim Jaggi | ae44128 | 2014-08-01 02:45:18 +0200 | [diff] [blame] | 213 | private void updateDimmedActivatedHideSensitive(AmbientState ambientState, |
Dave Mankoff | a4d195d | 2018-11-16 13:33:27 -0500 | [diff] [blame] | 214 | StackScrollAlgorithmState algorithmState) { |
Jorim Jaggi | d552d9d | 2014-05-07 19:41:13 +0200 | [diff] [blame] | 215 | boolean dimmed = ambientState.isDimmed(); |
Jorim Jaggi | ae44128 | 2014-08-01 02:45:18 +0200 | [diff] [blame] | 216 | boolean hideSensitive = ambientState.isHideSensitive(); |
Jorim Jaggi | d552d9d | 2014-05-07 19:41:13 +0200 | [diff] [blame] | 217 | View activatedChild = ambientState.getActivatedChild(); |
| 218 | int childCount = algorithmState.visibleChildren.size(); |
| 219 | for (int i = 0; i < childCount; i++) { |
Dave Mankoff | a4d195d | 2018-11-16 13:33:27 -0500 | [diff] [blame] | 220 | ExpandableView child = algorithmState.visibleChildren.get(i); |
| 221 | ExpandableViewState childViewState = child.getViewState(); |
Jorim Jaggi | d552d9d | 2014-05-07 19:41:13 +0200 | [diff] [blame] | 222 | childViewState.dimmed = dimmed; |
Jorim Jaggi | ae44128 | 2014-08-01 02:45:18 +0200 | [diff] [blame] | 223 | childViewState.hideSensitive = hideSensitive; |
Selim Cinek | b89de4e | 2014-06-10 10:47:05 +0200 | [diff] [blame] | 224 | boolean isActivatedChild = activatedChild == child; |
Jorim Jaggi | 4538cee | 2014-09-09 15:21:38 +0200 | [diff] [blame] | 225 | if (dimmed && isActivatedChild) { |
Selim Cinek | 281c202 | 2016-10-13 19:14:43 -0700 | [diff] [blame] | 226 | childViewState.zTranslation += 2.0f * ambientState.getZDistanceBetweenElements(); |
Jorim Jaggi | d552d9d | 2014-05-07 19:41:13 +0200 | [diff] [blame] | 227 | } |
| 228 | } |
Selim Cinek | eb97356 | 2014-05-02 17:07:49 +0200 | [diff] [blame] | 229 | } |
| 230 | |
| 231 | /** |
Selim Cinek | 61633a8 | 2016-01-25 15:54:10 -0800 | [diff] [blame] | 232 | * Initialize the algorithm state like updating the visible children. |
Jorim Jaggi | d4a5744 | 2014-04-10 02:45:55 +0200 | [diff] [blame] | 233 | */ |
Dave Mankoff | a4d195d | 2018-11-16 13:33:27 -0500 | [diff] [blame] | 234 | private void initAlgorithmState(ViewGroup hostView, StackScrollAlgorithmState state, |
Selim Cinek | 3776fe0 | 2016-02-04 13:32:43 -0800 | [diff] [blame] | 235 | AmbientState ambientState) { |
Selim Cinek | 3776fe0 | 2016-02-04 13:32:43 -0800 | [diff] [blame] | 236 | float bottomOverScroll = ambientState.getOverScrollAmount(false /* onTop */); |
| 237 | |
| 238 | int scrollY = ambientState.getScrollY(); |
| 239 | |
| 240 | // Due to the overScroller, the stackscroller can have negative scroll state. This is |
| 241 | // already accounted for by the top padding and doesn't need an additional adaption |
| 242 | scrollY = Math.max(0, scrollY); |
| 243 | state.scrollY = (int) (scrollY + bottomOverScroll); |
| 244 | |
Gus Prevas | 0fa58d6 | 2019-01-11 13:58:40 -0500 | [diff] [blame] | 245 | if (ANCHOR_SCROLLING) { |
| 246 | state.anchorViewY = (int) (ambientState.getAnchorViewY() - bottomOverScroll); |
| 247 | } |
| 248 | |
Selim Cinek | 3776fe0 | 2016-02-04 13:32:43 -0800 | [diff] [blame] | 249 | //now init the visible children and update paddings |
Jorim Jaggi | d4a5744 | 2014-04-10 02:45:55 +0200 | [diff] [blame] | 250 | int childCount = hostView.getChildCount(); |
| 251 | state.visibleChildren.clear(); |
| 252 | state.visibleChildren.ensureCapacity(childCount); |
Selim Cinek | a7ed2c1 | 2017-01-23 20:47:24 -0800 | [diff] [blame] | 253 | state.paddingMap.clear(); |
Selim Cinek | b036ca4 | 2015-02-20 15:56:28 +0100 | [diff] [blame] | 254 | int notGoneIndex = 0; |
Selim Cinek | 61633a8 | 2016-01-25 15:54:10 -0800 | [diff] [blame] | 255 | ExpandableView lastView = null; |
Selim Cinek | c1d9ab2 | 2019-05-21 18:08:30 -0700 | [diff] [blame] | 256 | int firstHiddenIndex = ambientState.isDozing() |
Selim Cinek | d96ed40 | 2017-07-28 18:19:03 -0700 | [diff] [blame] | 257 | ? (ambientState.hasPulsingNotifications() ? 1 : 0) |
| 258 | : childCount; |
| 259 | |
| 260 | // The goal here is to fill the padding map, by iterating over how much padding each child |
| 261 | // needs. The map is thereby reused, by first filling it with the padding amount and when |
| 262 | // iterating over it again, it's filled with the actual resolved value. |
| 263 | |
Jorim Jaggi | d4a5744 | 2014-04-10 02:45:55 +0200 | [diff] [blame] | 264 | for (int i = 0; i < childCount; i++) { |
Gus Prevas | 0fa58d6 | 2019-01-11 13:58:40 -0500 | [diff] [blame] | 265 | if (ANCHOR_SCROLLING) { |
| 266 | if (i == ambientState.getAnchorViewIndex()) { |
| 267 | state.anchorViewIndex = state.visibleChildren.size(); |
| 268 | } |
| 269 | } |
Jorim Jaggi | be565df | 2014-04-28 17:51:23 +0200 | [diff] [blame] | 270 | ExpandableView v = (ExpandableView) hostView.getChildAt(i); |
Jorim Jaggi | d4a5744 | 2014-04-10 02:45:55 +0200 | [diff] [blame] | 271 | if (v.getVisibility() != View.GONE) { |
Selim Cinek | 281c202 | 2016-10-13 19:14:43 -0700 | [diff] [blame] | 272 | if (v == ambientState.getShelf()) { |
| 273 | continue; |
| 274 | } |
Selim Cinek | d96ed40 | 2017-07-28 18:19:03 -0700 | [diff] [blame] | 275 | if (i >= firstHiddenIndex) { |
| 276 | // we need normal padding now, to be in sync with what the stack calculates |
| 277 | lastView = null; |
Selim Cinek | d96ed40 | 2017-07-28 18:19:03 -0700 | [diff] [blame] | 278 | } |
Dave Mankoff | a4d195d | 2018-11-16 13:33:27 -0500 | [diff] [blame] | 279 | notGoneIndex = updateNotGoneIndex(state, notGoneIndex, v); |
Selim Cinek | d96ed40 | 2017-07-28 18:19:03 -0700 | [diff] [blame] | 280 | float increasedPadding = v.getIncreasedPaddingAmount(); |
Selim Cinek | 42357e0 | 2016-02-24 18:48:01 -0800 | [diff] [blame] | 281 | if (increasedPadding != 0.0f) { |
Selim Cinek | a7ed2c1 | 2017-01-23 20:47:24 -0800 | [diff] [blame] | 282 | state.paddingMap.put(v, increasedPadding); |
Selim Cinek | 61633a8 | 2016-01-25 15:54:10 -0800 | [diff] [blame] | 283 | if (lastView != null) { |
Selim Cinek | a7ed2c1 | 2017-01-23 20:47:24 -0800 | [diff] [blame] | 284 | Float prevValue = state.paddingMap.get(lastView); |
| 285 | float newValue = getPaddingForValue(increasedPadding); |
| 286 | if (prevValue != null) { |
| 287 | float prevPadding = getPaddingForValue(prevValue); |
| 288 | if (increasedPadding > 0) { |
| 289 | newValue = NotificationUtils.interpolate( |
| 290 | prevPadding, |
| 291 | newValue, |
| 292 | increasedPadding); |
| 293 | } else if (prevValue > 0) { |
| 294 | newValue = NotificationUtils.interpolate( |
| 295 | newValue, |
| 296 | prevPadding, |
| 297 | prevValue); |
| 298 | } |
| 299 | } |
| 300 | state.paddingMap.put(lastView, newValue); |
Selim Cinek | 61633a8 | 2016-01-25 15:54:10 -0800 | [diff] [blame] | 301 | } |
Selim Cinek | a7ed2c1 | 2017-01-23 20:47:24 -0800 | [diff] [blame] | 302 | } else if (lastView != null) { |
Selim Cinek | d96ed40 | 2017-07-28 18:19:03 -0700 | [diff] [blame] | 303 | |
| 304 | // Let's now resolve the value to an actual padding |
Selim Cinek | a7ed2c1 | 2017-01-23 20:47:24 -0800 | [diff] [blame] | 305 | float newValue = getPaddingForValue(state.paddingMap.get(lastView)); |
| 306 | state.paddingMap.put(lastView, newValue); |
Selim Cinek | 61633a8 | 2016-01-25 15:54:10 -0800 | [diff] [blame] | 307 | } |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 308 | if (v instanceof ExpandableNotificationRow) { |
| 309 | ExpandableNotificationRow row = (ExpandableNotificationRow) v; |
Selim Cinek | b8f09cf | 2015-03-16 17:09:28 -0700 | [diff] [blame] | 310 | |
| 311 | // handle the notgoneIndex for the children as well |
Dave Mankoff | a4d195d | 2018-11-16 13:33:27 -0500 | [diff] [blame] | 312 | List<ExpandableNotificationRow> children = row.getNotificationChildren(); |
Selim Cinek | 83bc783 | 2015-10-22 13:26:54 -0700 | [diff] [blame] | 313 | if (row.isSummaryWithChildren() && children != null) { |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 314 | for (ExpandableNotificationRow childRow : children) { |
| 315 | if (childRow.getVisibility() != View.GONE) { |
Dave Mankoff | a4d195d | 2018-11-16 13:33:27 -0500 | [diff] [blame] | 316 | ExpandableViewState childState = childRow.getViewState(); |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 317 | childState.notGoneIndex = notGoneIndex; |
| 318 | notGoneIndex++; |
| 319 | } |
| 320 | } |
| 321 | } |
| 322 | } |
Selim Cinek | 61633a8 | 2016-01-25 15:54:10 -0800 | [diff] [blame] | 323 | lastView = v; |
Jorim Jaggi | d4a5744 | 2014-04-10 02:45:55 +0200 | [diff] [blame] | 324 | } |
| 325 | } |
Selim Cinek | 2627d72 | 2018-01-19 12:16:49 -0800 | [diff] [blame] | 326 | ExpandableNotificationRow expandingNotification = ambientState.getExpandingNotification(); |
| 327 | state.indexOfExpandingNotification = expandingNotification != null |
Selim Cinek | c25989e | 2018-02-16 16:42:14 -0800 | [diff] [blame] | 328 | ? expandingNotification.isChildInGroup() |
Dave Mankoff | a4d195d | 2018-11-16 13:33:27 -0500 | [diff] [blame] | 329 | ? state.visibleChildren.indexOf(expandingNotification.getNotificationParent()) |
| 330 | : state.visibleChildren.indexOf(expandingNotification) |
Selim Cinek | 2627d72 | 2018-01-19 12:16:49 -0800 | [diff] [blame] | 331 | : -1; |
Jorim Jaggi | d4a5744 | 2014-04-10 02:45:55 +0200 | [diff] [blame] | 332 | } |
| 333 | |
Selim Cinek | a7ed2c1 | 2017-01-23 20:47:24 -0800 | [diff] [blame] | 334 | private float getPaddingForValue(Float increasedPadding) { |
| 335 | if (increasedPadding == null) { |
| 336 | return mPaddingBetweenElements; |
| 337 | } else if (increasedPadding >= 0.0f) { |
| 338 | return NotificationUtils.interpolate( |
| 339 | mPaddingBetweenElements, |
| 340 | mIncreasedPaddingBetweenElements, |
| 341 | increasedPadding); |
| 342 | } else { |
| 343 | return NotificationUtils.interpolate( |
| 344 | 0, |
| 345 | mPaddingBetweenElements, |
| 346 | 1.0f + increasedPadding); |
| 347 | } |
| 348 | } |
| 349 | |
Dave Mankoff | a4d195d | 2018-11-16 13:33:27 -0500 | [diff] [blame] | 350 | private int updateNotGoneIndex(StackScrollAlgorithmState state, int notGoneIndex, |
Selim Cinek | b8f09cf | 2015-03-16 17:09:28 -0700 | [diff] [blame] | 351 | ExpandableView v) { |
Dave Mankoff | a4d195d | 2018-11-16 13:33:27 -0500 | [diff] [blame] | 352 | ExpandableViewState viewState = v.getViewState(); |
Selim Cinek | b8f09cf | 2015-03-16 17:09:28 -0700 | [diff] [blame] | 353 | viewState.notGoneIndex = notGoneIndex; |
| 354 | state.visibleChildren.add(v); |
| 355 | notGoneIndex++; |
| 356 | return notGoneIndex; |
| 357 | } |
| 358 | |
Jorim Jaggi | d4a5744 | 2014-04-10 02:45:55 +0200 | [diff] [blame] | 359 | /** |
Selim Cinek | 67b2260 | 2014-03-10 15:40:16 +0100 | [diff] [blame] | 360 | * Determine the positions for the views. This is the main part of the algorithm. |
| 361 | * |
Selim Cinek | 67b2260 | 2014-03-10 15:40:16 +0100 | [diff] [blame] | 362 | * @param algorithmState The state in which the current pass of the algorithm is currently in |
Dave Mankoff | a4d195d | 2018-11-16 13:33:27 -0500 | [diff] [blame] | 363 | * @param ambientState The current ambient state |
Selim Cinek | 67b2260 | 2014-03-10 15:40:16 +0100 | [diff] [blame] | 364 | */ |
Dave Mankoff | a4d195d | 2018-11-16 13:33:27 -0500 | [diff] [blame] | 365 | private void updatePositionsForState(StackScrollAlgorithmState algorithmState, |
| 366 | AmbientState ambientState) { |
Gus Prevas | 0fa58d6 | 2019-01-11 13:58:40 -0500 | [diff] [blame] | 367 | if (ANCHOR_SCROLLING) { |
| 368 | float currentYPosition = algorithmState.anchorViewY; |
| 369 | int childCount = algorithmState.visibleChildren.size(); |
| 370 | for (int i = algorithmState.anchorViewIndex; i < childCount; i++) { |
Gus Prevas | 0fa58d6 | 2019-01-11 13:58:40 -0500 | [diff] [blame] | 371 | currentYPosition = updateChild(i, algorithmState, ambientState, currentYPosition, |
| 372 | false /* reverse */); |
| 373 | } |
| 374 | currentYPosition = algorithmState.anchorViewY; |
| 375 | for (int i = algorithmState.anchorViewIndex - 1; i >= 0; i--) { |
Gus Prevas | 0fa58d6 | 2019-01-11 13:58:40 -0500 | [diff] [blame] | 376 | currentYPosition = updateChild(i, algorithmState, ambientState, currentYPosition, |
| 377 | true /* reverse */); |
| 378 | } |
| 379 | } else { |
| 380 | // The y coordinate of the current child. |
| 381 | float currentYPosition = -algorithmState.scrollY; |
| 382 | int childCount = algorithmState.visibleChildren.size(); |
| 383 | for (int i = 0; i < childCount; i++) { |
Gus Prevas | 0fa58d6 | 2019-01-11 13:58:40 -0500 | [diff] [blame] | 384 | currentYPosition = updateChild(i, algorithmState, ambientState, currentYPosition, |
| 385 | false /* reverse */); |
| 386 | } |
Selim Cinek | b8f09cf | 2015-03-16 17:09:28 -0700 | [diff] [blame] | 387 | } |
| 388 | } |
| 389 | |
Gus Prevas | 0fa58d6 | 2019-01-11 13:58:40 -0500 | [diff] [blame] | 390 | /** |
| 391 | * Populates the {@link ExpandableViewState} for a single child. |
| 392 | * |
| 393 | * @param i The index of the child in |
| 394 | * {@link StackScrollAlgorithmState#visibleChildren}. |
| 395 | * @param algorithmState The overall output state of the algorithm. |
| 396 | * @param ambientState The input state provided to the algorithm. |
| 397 | * @param currentYPosition The Y position of the current pass of the algorithm. For a forward |
| 398 | * pass, this should be the top of the child; for a reverse pass, the |
| 399 | * bottom of the child. |
| 400 | * @param reverse Whether we're laying out children in the reverse direction (Y |
| 401 | * positions |
| 402 | * decreasing) instead of the forward direction (Y positions |
| 403 | * increasing). |
| 404 | * @return The Y position after laying out the child. This will be the {@code currentYPosition} |
| 405 | * for the next call to this method, after adjusting for any gaps between children. |
| 406 | */ |
Dave Mankoff | a4d195d | 2018-11-16 13:33:27 -0500 | [diff] [blame] | 407 | protected float updateChild( |
| 408 | int i, |
| 409 | StackScrollAlgorithmState algorithmState, |
| 410 | AmbientState ambientState, |
Gus Prevas | 0fa58d6 | 2019-01-11 13:58:40 -0500 | [diff] [blame] | 411 | float currentYPosition, |
| 412 | boolean reverse) { |
Muyuan Li | 8779802 | 2016-04-07 17:51:25 -0700 | [diff] [blame] | 413 | ExpandableView child = algorithmState.visibleChildren.get(i); |
Ned Burns | 9eb0633 | 2019-04-23 16:02:12 -0400 | [diff] [blame] | 414 | final boolean applyGapHeight = |
| 415 | childNeedsGapHeight(ambientState.getSectionProvider(), algorithmState, i, child); |
Dave Mankoff | a4d195d | 2018-11-16 13:33:27 -0500 | [diff] [blame] | 416 | ExpandableViewState childViewState = child.getViewState(); |
Selim Cinek | bbcebde | 2016-11-09 18:28:20 -0800 | [diff] [blame] | 417 | childViewState.location = ExpandableViewState.LOCATION_UNKNOWN; |
Ned Burns | 9eb0633 | 2019-04-23 16:02:12 -0400 | [diff] [blame] | 418 | |
| 419 | if (applyGapHeight && !reverse) { |
| 420 | currentYPosition += mGapHeight; |
| 421 | } |
| 422 | |
Muyuan Li | 8779802 | 2016-04-07 17:51:25 -0700 | [diff] [blame] | 423 | int paddingAfterChild = getPaddingAfterChild(algorithmState, child); |
| 424 | int childHeight = getMaxAllowedChildHeight(child); |
Gus Prevas | 0fa58d6 | 2019-01-11 13:58:40 -0500 | [diff] [blame] | 425 | if (reverse) { |
| 426 | childViewState.yTranslation = currentYPosition - (childHeight + paddingAfterChild); |
| 427 | if (currentYPosition <= 0) { |
| 428 | childViewState.location = ExpandableViewState.LOCATION_HIDDEN_TOP; |
| 429 | } |
| 430 | } else { |
| 431 | childViewState.yTranslation = currentYPosition; |
Gus Prevas | e2d6f04 | 2018-10-17 15:25:30 -0400 | [diff] [blame] | 432 | } |
Julia Reynolds | ed1c9af | 2018-03-21 15:21:09 -0400 | [diff] [blame] | 433 | boolean isFooterView = child instanceof FooterView; |
Selim Cinek | cde90e5 | 2016-12-22 21:01:49 +0100 | [diff] [blame] | 434 | boolean isEmptyShadeView = child instanceof EmptyShadeView; |
Muyuan Li | 8779802 | 2016-04-07 17:51:25 -0700 | [diff] [blame] | 435 | |
Selim Cinek | db16737 | 2016-11-17 15:41:17 -0800 | [diff] [blame] | 436 | childViewState.location = ExpandableViewState.LOCATION_MAIN_AREA; |
Selim Cinek | 9b9d6e1 | 2017-11-30 12:29:47 +0100 | [diff] [blame] | 437 | float inset = ambientState.getTopPadding() + ambientState.getStackTranslation(); |
Selim Cinek | c25989e | 2018-02-16 16:42:14 -0800 | [diff] [blame] | 438 | if (i <= algorithmState.getIndexOfExpandingNotification()) { |
Selim Cinek | 2627d72 | 2018-01-19 12:16:49 -0800 | [diff] [blame] | 439 | inset += ambientState.getExpandAnimationTopChange(); |
| 440 | } |
Selim Cinek | 9b9d6e1 | 2017-11-30 12:29:47 +0100 | [diff] [blame] | 441 | if (child.mustStayOnScreen() && childViewState.yTranslation >= 0) { |
| 442 | // Even if we're not scrolled away we're in view and we're also not in the |
| 443 | // shelf. We can relax the constraints and let us scroll off the top! |
| 444 | float end = childViewState.yTranslation + childViewState.height + inset; |
| 445 | childViewState.headsUpIsVisible = end < ambientState.getMaxHeadsUpTranslation(); |
| 446 | } |
Julia Reynolds | ed1c9af | 2018-03-21 15:21:09 -0400 | [diff] [blame] | 447 | if (isFooterView) { |
Selim Cinek | db16737 | 2016-11-17 15:41:17 -0800 | [diff] [blame] | 448 | childViewState.yTranslation = Math.min(childViewState.yTranslation, |
| 449 | ambientState.getInnerHeight() - childHeight); |
Selim Cinek | cde90e5 | 2016-12-22 21:01:49 +0100 | [diff] [blame] | 450 | } else if (isEmptyShadeView) { |
| 451 | childViewState.yTranslation = ambientState.getInnerHeight() - childHeight |
| 452 | + ambientState.getStackTranslation() * 0.25f; |
Muyuan Li | 8779802 | 2016-04-07 17:51:25 -0700 | [diff] [blame] | 453 | } else { |
Selim Cinek | 2627d72 | 2018-01-19 12:16:49 -0800 | [diff] [blame] | 454 | clampPositionToShelf(child, childViewState, ambientState); |
Muyuan Li | 8779802 | 2016-04-07 17:51:25 -0700 | [diff] [blame] | 455 | } |
| 456 | |
Gus Prevas | 0fa58d6 | 2019-01-11 13:58:40 -0500 | [diff] [blame] | 457 | if (reverse) { |
| 458 | currentYPosition = childViewState.yTranslation; |
Ned Burns | 9eb0633 | 2019-04-23 16:02:12 -0400 | [diff] [blame] | 459 | if (applyGapHeight) { |
| 460 | currentYPosition -= mGapHeight; |
| 461 | } |
Gus Prevas | 0fa58d6 | 2019-01-11 13:58:40 -0500 | [diff] [blame] | 462 | } else { |
| 463 | currentYPosition = childViewState.yTranslation + childHeight + paddingAfterChild; |
| 464 | if (currentYPosition <= 0) { |
| 465 | childViewState.location = ExpandableViewState.LOCATION_HIDDEN_TOP; |
| 466 | } |
Muyuan Li | 8779802 | 2016-04-07 17:51:25 -0700 | [diff] [blame] | 467 | } |
Selim Cinek | bbcebde | 2016-11-09 18:28:20 -0800 | [diff] [blame] | 468 | if (childViewState.location == ExpandableViewState.LOCATION_UNKNOWN) { |
Muyuan Li | 8779802 | 2016-04-07 17:51:25 -0700 | [diff] [blame] | 469 | Log.wtf(LOG_TAG, "Failed to assign location for child " + i); |
| 470 | } |
| 471 | |
Selim Cinek | 9b9d6e1 | 2017-11-30 12:29:47 +0100 | [diff] [blame] | 472 | childViewState.yTranslation += inset; |
Muyuan Li | 8779802 | 2016-04-07 17:51:25 -0700 | [diff] [blame] | 473 | return currentYPosition; |
| 474 | } |
| 475 | |
Ned Burns | 9eb0633 | 2019-04-23 16:02:12 -0400 | [diff] [blame] | 476 | private boolean childNeedsGapHeight( |
| 477 | SectionProvider sectionProvider, |
| 478 | StackScrollAlgorithmState algorithmState, |
| 479 | int visibleIndex, |
| 480 | View child) { |
| 481 | boolean needsGapHeight = sectionProvider.beginsSection(child) && visibleIndex > 0; |
| 482 | if (ANCHOR_SCROLLING) { |
| 483 | needsGapHeight &= visibleIndex != algorithmState.anchorViewIndex; |
| 484 | } |
| 485 | return needsGapHeight; |
| 486 | } |
| 487 | |
Muyuan Li | 8779802 | 2016-04-07 17:51:25 -0700 | [diff] [blame] | 488 | protected int getPaddingAfterChild(StackScrollAlgorithmState algorithmState, |
Selim Cinek | 61633a8 | 2016-01-25 15:54:10 -0800 | [diff] [blame] | 489 | ExpandableView child) { |
Selim Cinek | 281c202 | 2016-10-13 19:14:43 -0700 | [diff] [blame] | 490 | return algorithmState.getPaddingAfterChild(child); |
Selim Cinek | 61633a8 | 2016-01-25 15:54:10 -0800 | [diff] [blame] | 491 | } |
| 492 | |
Selim Cinek | 5040f2e | 2019-02-14 18:22:42 -0800 | [diff] [blame] | 493 | private void updatePulsingStates(StackScrollAlgorithmState algorithmState, |
| 494 | AmbientState ambientState) { |
| 495 | int childCount = algorithmState.visibleChildren.size(); |
| 496 | for (int i = 0; i < childCount; i++) { |
| 497 | View child = algorithmState.visibleChildren.get(i); |
| 498 | if (!(child instanceof ExpandableNotificationRow)) { |
| 499 | continue; |
| 500 | } |
| 501 | ExpandableNotificationRow row = (ExpandableNotificationRow) child; |
Selim Cinek | c3fec68 | 2019-06-06 18:11:07 -0700 | [diff] [blame] | 502 | if (!row.showingPulsing() || (i == 0 && ambientState.isPulseExpanding())) { |
Selim Cinek | 5040f2e | 2019-02-14 18:22:42 -0800 | [diff] [blame] | 503 | continue; |
| 504 | } |
| 505 | ExpandableViewState viewState = row.getViewState(); |
| 506 | viewState.hidden = false; |
| 507 | } |
| 508 | } |
| 509 | |
Dave Mankoff | a4d195d | 2018-11-16 13:33:27 -0500 | [diff] [blame] | 510 | private void updateHeadsUpStates(StackScrollAlgorithmState algorithmState, |
| 511 | AmbientState ambientState) { |
Selim Cinek | a4baaa3 | 2015-04-20 14:27:54 -0700 | [diff] [blame] | 512 | int childCount = algorithmState.visibleChildren.size(); |
| 513 | ExpandableNotificationRow topHeadsUpEntry = null; |
| 514 | for (int i = 0; i < childCount; i++) { |
| 515 | View child = algorithmState.visibleChildren.get(i); |
| 516 | if (!(child instanceof ExpandableNotificationRow)) { |
| 517 | break; |
| 518 | } |
| 519 | ExpandableNotificationRow row = (ExpandableNotificationRow) child; |
| 520 | if (!row.isHeadsUp()) { |
| 521 | break; |
Selim Cinek | a4baaa3 | 2015-04-20 14:27:54 -0700 | [diff] [blame] | 522 | } |
Dave Mankoff | a4d195d | 2018-11-16 13:33:27 -0500 | [diff] [blame] | 523 | ExpandableViewState childState = row.getViewState(); |
Selim Cinek | 9b9d6e1 | 2017-11-30 12:29:47 +0100 | [diff] [blame] | 524 | if (topHeadsUpEntry == null && row.mustStayOnScreen() && !childState.headsUpIsVisible) { |
Selim Cinek | 3776fe0 | 2016-02-04 13:32:43 -0800 | [diff] [blame] | 525 | topHeadsUpEntry = row; |
Selim Cinek | bbcebde | 2016-11-09 18:28:20 -0800 | [diff] [blame] | 526 | childState.location = ExpandableViewState.LOCATION_FIRST_HUN; |
Selim Cinek | 3776fe0 | 2016-02-04 13:32:43 -0800 | [diff] [blame] | 527 | } |
Selim Cinek | 1f3f544 | 2015-04-10 17:54:46 -0700 | [diff] [blame] | 528 | boolean isTopEntry = topHeadsUpEntry == row; |
Selim Cinek | 3776fe0 | 2016-02-04 13:32:43 -0800 | [diff] [blame] | 529 | float unmodifiedEndLocation = childState.yTranslation + childState.height; |
Selim Cinek | 131c1e2 | 2015-05-11 19:04:49 -0700 | [diff] [blame] | 530 | if (mIsExpanded) { |
Selim Cinek | c3fec68 | 2019-06-06 18:11:07 -0700 | [diff] [blame] | 531 | if (row.mustStayOnScreen() && !childState.headsUpIsVisible |
| 532 | && !row.showingPulsing()) { |
Selim Cinek | 9b9d6e1 | 2017-11-30 12:29:47 +0100 | [diff] [blame] | 533 | // Ensure that the heads up is always visible even when scrolled off |
| 534 | clampHunToTop(ambientState, row, childState); |
Selim Cinek | 459aee3 | 2019-02-20 11:18:56 -0800 | [diff] [blame] | 535 | if (i == 0 && row.isAboveShelf()) { |
Selim Cinek | 9b9d6e1 | 2017-11-30 12:29:47 +0100 | [diff] [blame] | 536 | // the first hun can't get off screen. |
| 537 | clampHunToMaxTranslation(ambientState, row, childState); |
| 538 | childState.hidden = false; |
| 539 | } |
Selim Cinek | d127d79 | 2016-11-01 19:11:41 -0700 | [diff] [blame] | 540 | } |
Selim Cinek | 131c1e2 | 2015-05-11 19:04:49 -0700 | [diff] [blame] | 541 | } |
Selim Cinek | 684a442 | 2015-04-15 16:18:39 -0700 | [diff] [blame] | 542 | if (row.isPinned()) { |
Selim Cinek | aa9db1f | 2018-02-27 17:35:47 -0800 | [diff] [blame] | 543 | childState.yTranslation = Math.max(childState.yTranslation, mHeadsUpInset); |
Selim Cinek | 31aada4 | 2015-12-18 17:51:15 -0800 | [diff] [blame] | 544 | childState.height = Math.max(row.getIntrinsicHeight(), childState.height); |
Selim Cinek | cafa87f | 2016-10-26 17:00:17 -0700 | [diff] [blame] | 545 | childState.hidden = false; |
Dave Mankoff | a4d195d | 2018-11-16 13:33:27 -0500 | [diff] [blame] | 546 | ExpandableViewState topState = |
| 547 | topHeadsUpEntry == null ? null : topHeadsUpEntry.getViewState(); |
Selim Cinek | 61cfd4b | 2017-12-08 12:42:36 -0800 | [diff] [blame] | 548 | if (topState != null && !isTopEntry && (!mIsExpanded |
Selim Cinek | 3776fe0 | 2016-02-04 13:32:43 -0800 | [diff] [blame] | 549 | || unmodifiedEndLocation < topState.yTranslation + topState.height)) { |
Selim Cinek | 684a442 | 2015-04-15 16:18:39 -0700 | [diff] [blame] | 550 | // Ensure that a headsUp doesn't vertically extend further than the heads-up at |
| 551 | // the top most z-position |
Selim Cinek | 31aada4 | 2015-12-18 17:51:15 -0800 | [diff] [blame] | 552 | childState.height = row.getIntrinsicHeight(); |
Selim Cinek | e53e6bb | 2015-04-13 16:14:26 -0700 | [diff] [blame] | 553 | childState.yTranslation = topState.yTranslation + topState.height |
| 554 | - childState.height; |
Selim Cinek | 1f3f544 | 2015-04-10 17:54:46 -0700 | [diff] [blame] | 555 | } |
felkachang | 529bfe6 | 2018-07-04 12:51:44 +0800 | [diff] [blame] | 556 | |
| 557 | // heads up notification show and this row is the top entry of heads up |
| 558 | // notifications. i.e. this row should be the only one row that has input field |
| 559 | // To check if the row need to do translation according to scroll Y |
| 560 | // heads up show full of row's content and any scroll y indicate that the |
| 561 | // translationY need to move up the HUN. |
Gus Prevas | 0fa58d6 | 2019-01-11 13:58:40 -0500 | [diff] [blame] | 562 | // TODO: fix this check for anchor scrolling. |
felkachang | 529bfe6 | 2018-07-04 12:51:44 +0800 | [diff] [blame] | 563 | if (!mIsExpanded && isTopEntry && ambientState.getScrollY() > 0) { |
| 564 | childState.yTranslation -= ambientState.getScrollY(); |
| 565 | } |
Selim Cinek | b8f09cf | 2015-03-16 17:09:28 -0700 | [diff] [blame] | 566 | } |
Selim Cinek | cafa87f | 2016-10-26 17:00:17 -0700 | [diff] [blame] | 567 | if (row.isHeadsUpAnimatingAway()) { |
| 568 | childState.hidden = false; |
| 569 | } |
Selim Cinek | b8f09cf | 2015-03-16 17:09:28 -0700 | [diff] [blame] | 570 | } |
Selim Cinek | 67b2260 | 2014-03-10 15:40:16 +0100 | [diff] [blame] | 571 | } |
| 572 | |
Selim Cinek | 3776fe0 | 2016-02-04 13:32:43 -0800 | [diff] [blame] | 573 | private void clampHunToTop(AmbientState ambientState, ExpandableNotificationRow row, |
Selim Cinek | bbcebde | 2016-11-09 18:28:20 -0800 | [diff] [blame] | 574 | ExpandableViewState childState) { |
Selim Cinek | 3776fe0 | 2016-02-04 13:32:43 -0800 | [diff] [blame] | 575 | float newTranslation = Math.max(ambientState.getTopPadding() |
| 576 | + ambientState.getStackTranslation(), childState.yTranslation); |
| 577 | childState.height = (int) Math.max(childState.height - (newTranslation |
Selim Cinek | 567e845 | 2016-03-24 10:54:56 -0700 | [diff] [blame] | 578 | - childState.yTranslation), row.getCollapsedHeight()); |
Selim Cinek | 3776fe0 | 2016-02-04 13:32:43 -0800 | [diff] [blame] | 579 | childState.yTranslation = newTranslation; |
| 580 | } |
| 581 | |
| 582 | private void clampHunToMaxTranslation(AmbientState ambientState, ExpandableNotificationRow row, |
Selim Cinek | bbcebde | 2016-11-09 18:28:20 -0800 | [diff] [blame] | 583 | ExpandableViewState childState) { |
Selim Cinek | 3776fe0 | 2016-02-04 13:32:43 -0800 | [diff] [blame] | 584 | float newTranslation; |
Selim Cinek | 7e0f948 | 2017-05-22 20:00:56 -0700 | [diff] [blame] | 585 | float maxHeadsUpTranslation = ambientState.getMaxHeadsUpTranslation(); |
| 586 | float maxShelfPosition = ambientState.getInnerHeight() + ambientState.getTopPadding() |
| 587 | + ambientState.getStackTranslation(); |
| 588 | maxHeadsUpTranslation = Math.min(maxHeadsUpTranslation, maxShelfPosition); |
| 589 | float bottomPosition = maxHeadsUpTranslation - row.getCollapsedHeight(); |
Selim Cinek | 3776fe0 | 2016-02-04 13:32:43 -0800 | [diff] [blame] | 590 | newTranslation = Math.min(childState.yTranslation, bottomPosition); |
Selim Cinek | 7e0f948 | 2017-05-22 20:00:56 -0700 | [diff] [blame] | 591 | childState.height = (int) Math.min(childState.height, maxHeadsUpTranslation |
| 592 | - newTranslation); |
Selim Cinek | 3776fe0 | 2016-02-04 13:32:43 -0800 | [diff] [blame] | 593 | childState.yTranslation = newTranslation; |
Selim Cinek | 343e6e2 | 2014-04-11 21:23:30 +0200 | [diff] [blame] | 594 | } |
| 595 | |
| 596 | /** |
Selim Cinek | 281c202 | 2016-10-13 19:14:43 -0700 | [diff] [blame] | 597 | * Clamp the height of the child down such that its end is at most on the beginning of |
| 598 | * the shelf. |
| 599 | * |
Selim Cinek | 281c202 | 2016-10-13 19:14:43 -0700 | [diff] [blame] | 600 | * @param childViewState the view state of the child |
Dave Mankoff | a4d195d | 2018-11-16 13:33:27 -0500 | [diff] [blame] | 601 | * @param ambientState the ambient state |
Selim Cinek | 281c202 | 2016-10-13 19:14:43 -0700 | [diff] [blame] | 602 | */ |
Selim Cinek | 2627d72 | 2018-01-19 12:16:49 -0800 | [diff] [blame] | 603 | private void clampPositionToShelf(ExpandableView child, |
| 604 | ExpandableViewState childViewState, |
Selim Cinek | 281c202 | 2016-10-13 19:14:43 -0700 | [diff] [blame] | 605 | AmbientState ambientState) { |
Eliot Courtney | 5d3d2d0 | 2018-01-18 15:59:03 +0900 | [diff] [blame] | 606 | if (ambientState.getShelf() == null) { |
| 607 | return; |
| 608 | } |
| 609 | |
Selim Cinek | a686b2c | 2016-10-26 13:58:27 -0700 | [diff] [blame] | 610 | int shelfStart = ambientState.getInnerHeight() |
| 611 | - ambientState.getShelf().getIntrinsicHeight(); |
shawnlin | 5be1f7c | 2018-05-21 20:50:54 +0800 | [diff] [blame] | 612 | if (ambientState.isAppearing() && !child.isAboveShelf()) { |
| 613 | // Don't show none heads-up notifications while in appearing phase. |
| 614 | childViewState.yTranslation = Math.max(childViewState.yTranslation, shelfStart); |
| 615 | } |
Selim Cinek | 281c202 | 2016-10-13 19:14:43 -0700 | [diff] [blame] | 616 | childViewState.yTranslation = Math.min(childViewState.yTranslation, shelfStart); |
Selim Cinek | c383fd0 | 2016-10-21 15:31:26 -0700 | [diff] [blame] | 617 | if (childViewState.yTranslation >= shelfStart) { |
Selim Cinek | c25989e | 2018-02-16 16:42:14 -0800 | [diff] [blame] | 618 | childViewState.hidden = !child.isExpandAnimationRunning() && !child.hasExpandingChild(); |
Selim Cinek | eccb5de | 2016-10-28 15:04:05 -0700 | [diff] [blame] | 619 | childViewState.inShelf = true; |
Selim Cinek | 9b9d6e1 | 2017-11-30 12:29:47 +0100 | [diff] [blame] | 620 | childViewState.headsUpIsVisible = false; |
Selim Cinek | c383fd0 | 2016-10-21 15:31:26 -0700 | [diff] [blame] | 621 | } |
Selim Cinek | 281c202 | 2016-10-13 19:14:43 -0700 | [diff] [blame] | 622 | } |
| 623 | |
Muyuan Li | 8779802 | 2016-04-07 17:51:25 -0700 | [diff] [blame] | 624 | protected int getMaxAllowedChildHeight(View child) { |
Selim Cinek | 31aada4 | 2015-12-18 17:51:15 -0800 | [diff] [blame] | 625 | if (child instanceof ExpandableView) { |
Jorim Jaggi | be565df | 2014-04-28 17:51:23 +0200 | [diff] [blame] | 626 | ExpandableView expandableView = (ExpandableView) child; |
Selim Cinek | 8d5727f | 2015-04-28 19:17:32 -0700 | [diff] [blame] | 627 | return expandableView.getIntrinsicHeight(); |
Selim Cinek | 1685e63 | 2014-04-08 02:27:49 +0200 | [diff] [blame] | 628 | } |
Dave Mankoff | a4d195d | 2018-11-16 13:33:27 -0500 | [diff] [blame] | 629 | return child == null ? mCollapsedSize : child.getHeight(); |
Selim Cinek | 1685e63 | 2014-04-08 02:27:49 +0200 | [diff] [blame] | 630 | } |
| 631 | |
Selim Cinek | 67b2260 | 2014-03-10 15:40:16 +0100 | [diff] [blame] | 632 | /** |
Selim Cinek | 67b2260 | 2014-03-10 15:40:16 +0100 | [diff] [blame] | 633 | * Calculate the Z positions for all children based on the number of items in both stacks and |
| 634 | * save it in the resultState |
Dave Mankoff | a4d195d | 2018-11-16 13:33:27 -0500 | [diff] [blame] | 635 | * |
Selim Cinek | 67b2260 | 2014-03-10 15:40:16 +0100 | [diff] [blame] | 636 | * @param algorithmState The state in which the current pass of the algorithm is currently in |
Dave Mankoff | a4d195d | 2018-11-16 13:33:27 -0500 | [diff] [blame] | 637 | * @param ambientState The ambient state of the algorithm |
Selim Cinek | 67b2260 | 2014-03-10 15:40:16 +0100 | [diff] [blame] | 638 | */ |
Dave Mankoff | a4d195d | 2018-11-16 13:33:27 -0500 | [diff] [blame] | 639 | private void updateZValuesForState(StackScrollAlgorithmState algorithmState, |
| 640 | AmbientState ambientState) { |
Jorim Jaggi | d4a5744 | 2014-04-10 02:45:55 +0200 | [diff] [blame] | 641 | int childCount = algorithmState.visibleChildren.size(); |
Selim Cinek | 3322357 | 2016-02-19 19:32:22 -0800 | [diff] [blame] | 642 | float childrenOnTop = 0.0f; |
Selim Cinek | 3776fe0 | 2016-02-04 13:32:43 -0800 | [diff] [blame] | 643 | for (int i = childCount - 1; i >= 0; i--) { |
Selim Cinek | daab6f5 | 2017-04-06 16:46:34 -0700 | [diff] [blame] | 644 | childrenOnTop = updateChildZValue(i, childrenOnTop, |
Dave Mankoff | a4d195d | 2018-11-16 13:33:27 -0500 | [diff] [blame] | 645 | algorithmState, ambientState); |
Muyuan Li | 8779802 | 2016-04-07 17:51:25 -0700 | [diff] [blame] | 646 | } |
| 647 | } |
| 648 | |
Selim Cinek | daab6f5 | 2017-04-06 16:46:34 -0700 | [diff] [blame] | 649 | protected float updateChildZValue(int i, float childrenOnTop, |
Dave Mankoff | a4d195d | 2018-11-16 13:33:27 -0500 | [diff] [blame] | 650 | StackScrollAlgorithmState algorithmState, |
Muyuan Li | 8779802 | 2016-04-07 17:51:25 -0700 | [diff] [blame] | 651 | AmbientState ambientState) { |
| 652 | ExpandableView child = algorithmState.visibleChildren.get(i); |
Dave Mankoff | a4d195d | 2018-11-16 13:33:27 -0500 | [diff] [blame] | 653 | ExpandableViewState childViewState = child.getViewState(); |
Selim Cinek | 281c202 | 2016-10-13 19:14:43 -0700 | [diff] [blame] | 654 | int zDistanceBetweenElements = ambientState.getZDistanceBetweenElements(); |
| 655 | float baseZ = ambientState.getBaseZHeight(); |
Selim Cinek | 9b9d6e1 | 2017-11-30 12:29:47 +0100 | [diff] [blame] | 656 | if (child.mustStayOnScreen() && !childViewState.headsUpIsVisible |
| 657 | && !ambientState.isDozingAndNotPulsing(child) |
Muyuan Li | 8779802 | 2016-04-07 17:51:25 -0700 | [diff] [blame] | 658 | && childViewState.yTranslation < ambientState.getTopPadding() |
| 659 | + ambientState.getStackTranslation()) { |
| 660 | if (childrenOnTop != 0.0f) { |
| 661 | childrenOnTop++; |
| 662 | } else { |
| 663 | float overlap = ambientState.getTopPadding() |
| 664 | + ambientState.getStackTranslation() - childViewState.yTranslation; |
| 665 | childrenOnTop += Math.min(1.0f, overlap / childViewState.height); |
| 666 | } |
Selim Cinek | 281c202 | 2016-10-13 19:14:43 -0700 | [diff] [blame] | 667 | childViewState.zTranslation = baseZ |
| 668 | + childrenOnTop * zDistanceBetweenElements; |
Selim Cinek | c3fec68 | 2019-06-06 18:11:07 -0700 | [diff] [blame] | 669 | } else if (i == 0 && (child.isAboveShelf() || child.showingPulsing())) { |
Selim Cinek | d127d79 | 2016-11-01 19:11:41 -0700 | [diff] [blame] | 670 | // In case this is a new view that has never been measured before, we don't want to |
| 671 | // elevate if we are currently expanded more then the notification |
Eliot Courtney | 5d3d2d0 | 2018-01-18 15:59:03 +0900 | [diff] [blame] | 672 | int shelfHeight = ambientState.getShelf() == null ? 0 : |
| 673 | ambientState.getShelf().getIntrinsicHeight(); |
Selim Cinek | d127d79 | 2016-11-01 19:11:41 -0700 | [diff] [blame] | 674 | float shelfStart = ambientState.getInnerHeight() |
| 675 | - shelfHeight + ambientState.getTopPadding() |
| 676 | + ambientState.getStackTranslation(); |
| 677 | float notificationEnd = childViewState.yTranslation + child.getPinnedHeadsUpHeight() |
| 678 | + mPaddingBetweenElements; |
| 679 | if (shelfStart > notificationEnd) { |
| 680 | childViewState.zTranslation = baseZ; |
| 681 | } else { |
| 682 | float factor = (notificationEnd - shelfStart) / shelfHeight; |
| 683 | factor = Math.min(factor, 1.0f); |
| 684 | childViewState.zTranslation = baseZ + factor * zDistanceBetweenElements; |
| 685 | } |
Muyuan Li | 8779802 | 2016-04-07 17:51:25 -0700 | [diff] [blame] | 686 | } else { |
Selim Cinek | 281c202 | 2016-10-13 19:14:43 -0700 | [diff] [blame] | 687 | childViewState.zTranslation = baseZ; |
Selim Cinek | 67b2260 | 2014-03-10 15:40:16 +0100 | [diff] [blame] | 688 | } |
Selim Cinek | 99e9adf | 2018-03-15 09:17:47 -0700 | [diff] [blame] | 689 | |
| 690 | // We need to scrim the notification more from its surrounding content when we are pinned, |
| 691 | // and we therefore elevate it higher. |
| 692 | // We can use the headerVisibleAmount for this, since the value nicely goes from 0 to 1 when |
| 693 | // expanding after which we have a normal elevation again. |
| 694 | childViewState.zTranslation += (1.0f - child.getHeaderVisibleAmount()) |
| 695 | * mPinnedZTranslationExtra; |
Selim Cinek | daab6f5 | 2017-04-06 16:46:34 -0700 | [diff] [blame] | 696 | return childrenOnTop; |
Selim Cinek | 67b2260 | 2014-03-10 15:40:16 +0100 | [diff] [blame] | 697 | } |
| 698 | |
Selim Cinek | 1685e63 | 2014-04-08 02:27:49 +0200 | [diff] [blame] | 699 | public void setIsExpanded(boolean isExpanded) { |
| 700 | this.mIsExpanded = isExpanded; |
| 701 | } |
| 702 | |
Selim Cinek | 281c202 | 2016-10-13 19:14:43 -0700 | [diff] [blame] | 703 | public class StackScrollAlgorithmState { |
Selim Cinek | 67b2260 | 2014-03-10 15:40:16 +0100 | [diff] [blame] | 704 | |
| 705 | /** |
Gus Prevas | 0fa58d6 | 2019-01-11 13:58:40 -0500 | [diff] [blame] | 706 | * The scroll position of the algorithm (absolute scrolling). |
Selim Cinek | 67b2260 | 2014-03-10 15:40:16 +0100 | [diff] [blame] | 707 | */ |
| 708 | public int scrollY; |
| 709 | |
Gus Prevas | 0fa58d6 | 2019-01-11 13:58:40 -0500 | [diff] [blame] | 710 | /** The index of the anchor view (anchor scrolling). */ |
| 711 | public int anchorViewIndex; |
| 712 | |
| 713 | /** |
| 714 | * The Y position, relative to the top of the screen, of the anchor view (anchor scrolling). |
| 715 | */ |
| 716 | public int anchorViewY; |
| 717 | |
Selim Cinek | 67b2260 | 2014-03-10 15:40:16 +0100 | [diff] [blame] | 718 | /** |
Jorim Jaggi | d4a5744 | 2014-04-10 02:45:55 +0200 | [diff] [blame] | 719 | * The children from the host view which are not gone. |
| 720 | */ |
Jorim Jaggi | be565df | 2014-04-28 17:51:23 +0200 | [diff] [blame] | 721 | public final ArrayList<ExpandableView> visibleChildren = new ArrayList<ExpandableView>(); |
Selim Cinek | 61633a8 | 2016-01-25 15:54:10 -0800 | [diff] [blame] | 722 | |
| 723 | /** |
Selim Cinek | a7ed2c1 | 2017-01-23 20:47:24 -0800 | [diff] [blame] | 724 | * The padding after each child measured in pixels. |
Selim Cinek | 61633a8 | 2016-01-25 15:54:10 -0800 | [diff] [blame] | 725 | */ |
Selim Cinek | a7ed2c1 | 2017-01-23 20:47:24 -0800 | [diff] [blame] | 726 | public final HashMap<ExpandableView, Float> paddingMap = new HashMap<>(); |
Selim Cinek | 2627d72 | 2018-01-19 12:16:49 -0800 | [diff] [blame] | 727 | private int indexOfExpandingNotification; |
Selim Cinek | 281c202 | 2016-10-13 19:14:43 -0700 | [diff] [blame] | 728 | |
| 729 | public int getPaddingAfterChild(ExpandableView child) { |
Selim Cinek | a7ed2c1 | 2017-01-23 20:47:24 -0800 | [diff] [blame] | 730 | Float padding = paddingMap.get(child); |
| 731 | if (padding == null) { |
| 732 | // Should only happen for the last view |
| 733 | return mPaddingBetweenElements; |
| 734 | } |
| 735 | return (int) padding.floatValue(); |
Selim Cinek | 281c202 | 2016-10-13 19:14:43 -0700 | [diff] [blame] | 736 | } |
Selim Cinek | 2627d72 | 2018-01-19 12:16:49 -0800 | [diff] [blame] | 737 | |
| 738 | public int getIndexOfExpandingNotification() { |
| 739 | return indexOfExpandingNotification; |
| 740 | } |
Selim Cinek | 67b2260 | 2014-03-10 15:40:16 +0100 | [diff] [blame] | 741 | } |
| 742 | |
Ned Burns | 9eb0633 | 2019-04-23 16:02:12 -0400 | [diff] [blame] | 743 | /** |
| 744 | * Interface for telling the SSA when a new notification section begins (so it can add in |
| 745 | * appropriate margins). |
| 746 | */ |
| 747 | public interface SectionProvider { |
| 748 | /** |
| 749 | * True if this view starts a new "section" of notifications, such as the gentle |
| 750 | * notifications section. False if sections are not enabled. |
| 751 | */ |
| 752 | boolean beginsSection(View view); |
| 753 | } |
Selim Cinek | 67b2260 | 2014-03-10 15:40:16 +0100 | [diff] [blame] | 754 | } |