Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2015 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 | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 18 | |
Mady Mellor | b0a8246 | 2016-04-30 17:31:02 -0700 | [diff] [blame] | 19 | import android.app.Notification; |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 20 | import android.content.Context; |
Selim Cinek | a3d3b91 | 2016-02-02 11:22:06 -0800 | [diff] [blame] | 21 | import android.content.res.Configuration; |
Anthony Chen | 6bf88a0 | 2017-04-10 14:41:44 -0700 | [diff] [blame] | 22 | import android.content.res.Resources; |
Mady Mellor | b0a8246 | 2016-04-30 17:31:02 -0700 | [diff] [blame] | 23 | import android.graphics.drawable.ColorDrawable; |
| 24 | import android.service.notification.StatusBarNotification; |
Selim Cinek | 4237e82 | 2020-03-31 17:22:28 -0700 | [diff] [blame] | 25 | import android.util.ArraySet; |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 26 | import android.util.AttributeSet; |
| 27 | import android.view.LayoutInflater; |
Mady Mellor | b0a8246 | 2016-04-30 17:31:02 -0700 | [diff] [blame] | 28 | import android.view.NotificationHeaderView; |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 29 | import android.view.View; |
| 30 | import android.view.ViewGroup; |
Mady Mellor | b0a8246 | 2016-04-30 17:31:02 -0700 | [diff] [blame] | 31 | import android.widget.RemoteViews; |
Selim Cinek | c897bd3 | 2016-03-18 17:32:31 -0700 | [diff] [blame] | 32 | import android.widget.TextView; |
Selim Cinek | 817abe7 | 2017-05-24 11:08:55 -0700 | [diff] [blame] | 33 | |
| 34 | import com.android.internal.annotations.VisibleForTesting; |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 35 | import com.android.systemui.R; |
Selim Cinek | 7b73a4c | 2016-01-12 18:32:11 -0800 | [diff] [blame] | 36 | import com.android.systemui.statusbar.CrossFadeHelper; |
Mady Mellor | b0a8246 | 2016-04-30 17:31:02 -0700 | [diff] [blame] | 37 | import com.android.systemui.statusbar.NotificationHeaderUtil; |
Gus Prevas | ab33679 | 2018-11-14 13:52:20 -0500 | [diff] [blame] | 38 | import com.android.systemui.statusbar.notification.NotificationUtils; |
| 39 | import com.android.systemui.statusbar.notification.VisualStabilityManager; |
| 40 | import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; |
Rohan Shah | 20790b8 | 2018-07-02 17:21:04 -0700 | [diff] [blame] | 41 | import com.android.systemui.statusbar.notification.row.HybridGroupManager; |
| 42 | import com.android.systemui.statusbar.notification.row.HybridNotificationView; |
Steve Elliott | 936df15 | 2020-04-14 13:59:53 -0400 | [diff] [blame] | 43 | import com.android.systemui.statusbar.notification.row.wrapper.NotificationHeaderViewWrapper; |
Rohan Shah | 20790b8 | 2018-07-02 17:21:04 -0700 | [diff] [blame] | 44 | import com.android.systemui.statusbar.notification.row.wrapper.NotificationViewWrapper; |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 45 | |
| 46 | import java.util.ArrayList; |
| 47 | import java.util.List; |
| 48 | |
| 49 | /** |
| 50 | * A container containing child notifications |
| 51 | */ |
| 52 | public class NotificationChildrenContainer extends ViewGroup { |
| 53 | |
Aaron Heuckroth | 17ce40e | 2018-06-19 15:44:40 -0400 | [diff] [blame] | 54 | @VisibleForTesting |
| 55 | static final int NUMBER_OF_CHILDREN_WHEN_COLLAPSED = 2; |
| 56 | @VisibleForTesting |
| 57 | static final int NUMBER_OF_CHILDREN_WHEN_SYSTEM_EXPANDED = 5; |
Kevin Han | 3cb379c | 2019-12-03 13:31:44 -0800 | [diff] [blame] | 58 | public static final int NUMBER_OF_CHILDREN_WHEN_CHILDREN_EXPANDED = 8; |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 59 | private static final AnimationProperties ALPHA_FADE_IN = new AnimationProperties() { |
| 60 | private AnimationFilter mAnimationFilter = new AnimationFilter().animateAlpha(); |
| 61 | |
| 62 | @Override |
| 63 | public AnimationFilter getAnimationFilter() { |
| 64 | return mAnimationFilter; |
| 65 | } |
| 66 | }.setDuration(200); |
Selim Cinek | 83bc783 | 2015-10-22 13:26:54 -0700 | [diff] [blame] | 67 | |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 68 | private final List<View> mDividers = new ArrayList<>(); |
Kevin Han | 43077f9 | 2020-02-28 12:51:53 -0800 | [diff] [blame] | 69 | private final List<ExpandableNotificationRow> mAttachedChildren = new ArrayList<>(); |
Selim Cinek | c897bd3 | 2016-03-18 17:32:31 -0700 | [diff] [blame] | 70 | private final HybridGroupManager mHybridGroupManager; |
Selim Cinek | 01af334 | 2016-02-09 19:25:31 -0800 | [diff] [blame] | 71 | private int mChildPadding; |
| 72 | private int mDividerHeight; |
Anthony Chen | 6bf88a0 | 2017-04-10 14:41:44 -0700 | [diff] [blame] | 73 | private float mDividerAlpha; |
Mady Mellor | b0a8246 | 2016-04-30 17:31:02 -0700 | [diff] [blame] | 74 | private int mNotificationHeaderMargin; |
Anthony Chen | 6bf88a0 | 2017-04-10 14:41:44 -0700 | [diff] [blame] | 75 | |
Selim Cinek | 01af334 | 2016-02-09 19:25:31 -0800 | [diff] [blame] | 76 | private int mNotificatonTopPadding; |
| 77 | private float mCollapsedBottompadding; |
Selim Cinek | 83bc783 | 2015-10-22 13:26:54 -0700 | [diff] [blame] | 78 | private boolean mChildrenExpanded; |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 79 | private ExpandableNotificationRow mContainingNotification; |
Selim Cinek | c897bd3 | 2016-03-18 17:32:31 -0700 | [diff] [blame] | 80 | private TextView mOverflowNumber; |
| 81 | private ViewState mGroupOverFlowState; |
Selim Cinek | a69f2a6 | 2015-12-11 17:28:12 -0800 | [diff] [blame] | 82 | private int mRealHeight; |
Selim Cinek | 42357e0 | 2016-02-24 18:48:01 -0800 | [diff] [blame] | 83 | private boolean mUserLocked; |
| 84 | private int mActualHeight; |
Selim Cinek | c897bd3 | 2016-03-18 17:32:31 -0700 | [diff] [blame] | 85 | private boolean mNeverAppliedGroupState; |
Mady Mellor | b0a8246 | 2016-04-30 17:31:02 -0700 | [diff] [blame] | 86 | private int mHeaderHeight; |
| 87 | |
Anthony Chen | 6bf88a0 | 2017-04-10 14:41:44 -0700 | [diff] [blame] | 88 | /** |
| 89 | * Whether or not individual notifications that are part of this container will have shadows. |
| 90 | */ |
| 91 | private boolean mEnableShadowOnChildNotifications; |
| 92 | |
Mady Mellor | b0a8246 | 2016-04-30 17:31:02 -0700 | [diff] [blame] | 93 | private NotificationHeaderView mNotificationHeader; |
| 94 | private NotificationViewWrapper mNotificationHeaderWrapper; |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 95 | private NotificationHeaderView mNotificationHeaderLowPriority; |
| 96 | private NotificationViewWrapper mNotificationHeaderWrapperLowPriority; |
Mady Mellor | b0a8246 | 2016-04-30 17:31:02 -0700 | [diff] [blame] | 97 | private NotificationHeaderUtil mHeaderUtil; |
| 98 | private ViewState mHeaderViewState; |
Selim Cinek | b3dadcc | 2016-11-21 17:21:13 -0800 | [diff] [blame] | 99 | private int mClipBottomAmount; |
Selim Cinek | 6743c0b | 2017-01-18 18:24:01 -0800 | [diff] [blame] | 100 | private boolean mIsLowPriority; |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 101 | private OnClickListener mHeaderClickListener; |
Adrian Roos | 6f6e159 | 2017-05-02 16:22:53 -0700 | [diff] [blame] | 102 | private ViewGroup mCurrentHeader; |
Steve Elliott | 936df15 | 2020-04-14 13:59:53 -0400 | [diff] [blame] | 103 | private boolean mIsConversation; |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 104 | |
Anthony Chen | 6bf88a0 | 2017-04-10 14:41:44 -0700 | [diff] [blame] | 105 | private boolean mShowDividersWhenExpanded; |
| 106 | private boolean mHideDividersDuringExpand; |
Selim Cinek | aa9db1f | 2018-02-27 17:35:47 -0800 | [diff] [blame] | 107 | private int mTranslationForHeader; |
| 108 | private int mCurrentHeaderTranslation = 0; |
| 109 | private float mHeaderVisibleAmount = 1.0f; |
Kevin Han | 43077f9 | 2020-02-28 12:51:53 -0800 | [diff] [blame] | 110 | private int mUntruncatedChildCount; |
Anthony Chen | 6bf88a0 | 2017-04-10 14:41:44 -0700 | [diff] [blame] | 111 | |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 112 | public NotificationChildrenContainer(Context context) { |
| 113 | this(context, null); |
| 114 | } |
| 115 | |
| 116 | public NotificationChildrenContainer(Context context, AttributeSet attrs) { |
| 117 | this(context, attrs, 0); |
| 118 | } |
| 119 | |
| 120 | public NotificationChildrenContainer(Context context, AttributeSet attrs, int defStyleAttr) { |
| 121 | this(context, attrs, defStyleAttr, 0); |
| 122 | } |
| 123 | |
| 124 | public NotificationChildrenContainer(Context context, AttributeSet attrs, int defStyleAttr, |
| 125 | int defStyleRes) { |
| 126 | super(context, attrs, defStyleAttr, defStyleRes); |
Steve Elliott | 936df15 | 2020-04-14 13:59:53 -0400 | [diff] [blame] | 127 | mHybridGroupManager = new HybridGroupManager(getContext()); |
dongwan0605.kim | 11e7dec | 2018-05-06 18:04:52 +0900 | [diff] [blame] | 128 | initDimens(); |
Selim Cinek | ed64a14 | 2018-02-06 18:06:01 -0800 | [diff] [blame] | 129 | setClipChildren(false); |
Selim Cinek | 01af334 | 2016-02-09 19:25:31 -0800 | [diff] [blame] | 130 | } |
| 131 | |
| 132 | private void initDimens() { |
Anthony Chen | 6bf88a0 | 2017-04-10 14:41:44 -0700 | [diff] [blame] | 133 | Resources res = getResources(); |
| 134 | mChildPadding = res.getDimensionPixelSize(R.dimen.notification_children_padding); |
| 135 | mDividerHeight = res.getDimensionPixelSize( |
| 136 | R.dimen.notification_children_container_divider_height); |
| 137 | mDividerAlpha = res.getFloat(R.dimen.notification_divider_alpha); |
Anthony Chen | 6bf88a0 | 2017-04-10 14:41:44 -0700 | [diff] [blame] | 138 | mNotificationHeaderMargin = res.getDimensionPixelSize( |
| 139 | R.dimen.notification_children_container_margin_top); |
| 140 | mNotificatonTopPadding = res.getDimensionPixelSize( |
Selim Cinek | 7b83639 | 2015-12-04 20:02:59 -0800 | [diff] [blame] | 141 | R.dimen.notification_children_container_top_padding); |
Selim Cinek | afeed29 | 2017-12-12 17:32:44 -0800 | [diff] [blame] | 142 | mHeaderHeight = mNotificationHeaderMargin + mNotificatonTopPadding; |
Anthony Chen | 6bf88a0 | 2017-04-10 14:41:44 -0700 | [diff] [blame] | 143 | mCollapsedBottompadding = res.getDimensionPixelSize( |
Selim Cinek | ed64a14 | 2018-02-06 18:06:01 -0800 | [diff] [blame] | 144 | com.android.internal.R.dimen.notification_content_margin); |
Anthony Chen | 6bf88a0 | 2017-04-10 14:41:44 -0700 | [diff] [blame] | 145 | mEnableShadowOnChildNotifications = |
| 146 | res.getBoolean(R.bool.config_enableShadowOnChildNotifications); |
| 147 | mShowDividersWhenExpanded = |
| 148 | res.getBoolean(R.bool.config_showDividersWhenGroupNotificationExpanded); |
| 149 | mHideDividersDuringExpand = |
| 150 | res.getBoolean(R.bool.config_hideDividersDuringExpand); |
Selim Cinek | aa9db1f | 2018-02-27 17:35:47 -0800 | [diff] [blame] | 151 | mTranslationForHeader = res.getDimensionPixelSize( |
| 152 | com.android.internal.R.dimen.notification_content_margin) |
| 153 | - mNotificationHeaderMargin; |
dongwan0605.kim | 11e7dec | 2018-05-06 18:04:52 +0900 | [diff] [blame] | 154 | mHybridGroupManager.initDimens(); |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 155 | } |
| 156 | |
| 157 | @Override |
| 158 | protected void onLayout(boolean changed, int l, int t, int r, int b) { |
Kevin Han | 43077f9 | 2020-02-28 12:51:53 -0800 | [diff] [blame] | 159 | int childCount = |
| 160 | Math.min(mAttachedChildren.size(), NUMBER_OF_CHILDREN_WHEN_CHILDREN_EXPANDED); |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 161 | for (int i = 0; i < childCount; i++) { |
Kevin Han | 43077f9 | 2020-02-28 12:51:53 -0800 | [diff] [blame] | 162 | View child = mAttachedChildren.get(i); |
Selim Cinek | fa760d4 | 2016-05-10 15:50:53 -0400 | [diff] [blame] | 163 | // We need to layout all children even the GONE ones, such that the heights are |
| 164 | // calculated correctly as they are used to calculate how many we can fit on the screen |
Selim Cinek | c897bd3 | 2016-03-18 17:32:31 -0700 | [diff] [blame] | 165 | child.layout(0, 0, child.getMeasuredWidth(), child.getMeasuredHeight()); |
Selim Cinek | 7b83639 | 2015-12-04 20:02:59 -0800 | [diff] [blame] | 166 | mDividers.get(i).layout(0, 0, getWidth(), mDividerHeight); |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 167 | } |
Selim Cinek | c897bd3 | 2016-03-18 17:32:31 -0700 | [diff] [blame] | 168 | if (mOverflowNumber != null) { |
Selim Cinek | 09b7dea | 2016-08-30 11:28:19 -0700 | [diff] [blame] | 169 | boolean isRtl = getLayoutDirection() == LAYOUT_DIRECTION_RTL; |
| 170 | int left = (isRtl ? 0 : getWidth() - mOverflowNumber.getMeasuredWidth()); |
| 171 | int right = left + mOverflowNumber.getMeasuredWidth(); |
| 172 | mOverflowNumber.layout(left, 0, right, mOverflowNumber.getMeasuredHeight()); |
Selim Cinek | c897bd3 | 2016-03-18 17:32:31 -0700 | [diff] [blame] | 173 | } |
Mady Mellor | b0a8246 | 2016-04-30 17:31:02 -0700 | [diff] [blame] | 174 | if (mNotificationHeader != null) { |
| 175 | mNotificationHeader.layout(0, 0, mNotificationHeader.getMeasuredWidth(), |
| 176 | mNotificationHeader.getMeasuredHeight()); |
| 177 | } |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 178 | if (mNotificationHeaderLowPriority != null) { |
| 179 | mNotificationHeaderLowPriority.layout(0, 0, |
| 180 | mNotificationHeaderLowPriority.getMeasuredWidth(), |
| 181 | mNotificationHeaderLowPriority.getMeasuredHeight()); |
| 182 | } |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 183 | } |
| 184 | |
| 185 | @Override |
| 186 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 187 | int heightMode = MeasureSpec.getMode(heightMeasureSpec); |
| 188 | boolean hasFixedHeight = heightMode == MeasureSpec.EXACTLY; |
| 189 | boolean isHeightLimited = heightMode == MeasureSpec.AT_MOST; |
Selim Cinek | a69f2a6 | 2015-12-11 17:28:12 -0800 | [diff] [blame] | 190 | int size = MeasureSpec.getSize(heightMeasureSpec); |
Geoffrey Pitsch | 4dd5006 | 2016-12-06 16:41:22 -0500 | [diff] [blame] | 191 | int newHeightSpec = heightMeasureSpec; |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 192 | if (hasFixedHeight || isHeightLimited) { |
Geoffrey Pitsch | 4dd5006 | 2016-12-06 16:41:22 -0500 | [diff] [blame] | 193 | newHeightSpec = MeasureSpec.makeMeasureSpec(size, MeasureSpec.AT_MOST); |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 194 | } |
Selim Cinek | c897bd3 | 2016-03-18 17:32:31 -0700 | [diff] [blame] | 195 | int width = MeasureSpec.getSize(widthMeasureSpec); |
| 196 | if (mOverflowNumber != null) { |
| 197 | mOverflowNumber.measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.AT_MOST), |
| 198 | newHeightSpec); |
| 199 | } |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 200 | int dividerHeightSpec = MeasureSpec.makeMeasureSpec(mDividerHeight, MeasureSpec.EXACTLY); |
Mady Mellor | b0a8246 | 2016-04-30 17:31:02 -0700 | [diff] [blame] | 201 | int height = mNotificationHeaderMargin + mNotificatonTopPadding; |
Kevin Han | 43077f9 | 2020-02-28 12:51:53 -0800 | [diff] [blame] | 202 | int childCount = |
| 203 | Math.min(mAttachedChildren.size(), NUMBER_OF_CHILDREN_WHEN_CHILDREN_EXPANDED); |
Selim Cinek | c897bd3 | 2016-03-18 17:32:31 -0700 | [diff] [blame] | 204 | int collapsedChildren = getMaxAllowedVisibleChildren(true /* likeCollapsed */); |
| 205 | int overflowIndex = childCount > collapsedChildren ? collapsedChildren - 1 : -1; |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 206 | for (int i = 0; i < childCount; i++) { |
Kevin Han | 43077f9 | 2020-02-28 12:51:53 -0800 | [diff] [blame] | 207 | ExpandableNotificationRow child = mAttachedChildren.get(i); |
Selim Cinek | fa760d4 | 2016-05-10 15:50:53 -0400 | [diff] [blame] | 208 | // We need to measure all children even the GONE ones, such that the heights are |
| 209 | // calculated correctly as they are used to calculate how many we can fit on the screen. |
Selim Cinek | c897bd3 | 2016-03-18 17:32:31 -0700 | [diff] [blame] | 210 | boolean isOverflow = i == overflowIndex; |
Selim Cinek | 7927c73 | 2019-03-06 15:21:39 -0800 | [diff] [blame] | 211 | child.setSingleLineWidthIndention(isOverflow && mOverflowNumber != null |
Lucas Dupin | 4c797d6 | 2018-05-07 15:32:13 -0700 | [diff] [blame] | 212 | ? mOverflowNumber.getMeasuredWidth() : 0); |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 213 | child.measure(widthMeasureSpec, newHeightSpec); |
Selim Cinek | 7b83639 | 2015-12-04 20:02:59 -0800 | [diff] [blame] | 214 | // layout the divider |
| 215 | View divider = mDividers.get(i); |
| 216 | divider.measure(widthMeasureSpec, dividerHeightSpec); |
Selim Cinek | fa760d4 | 2016-05-10 15:50:53 -0400 | [diff] [blame] | 217 | if (child.getVisibility() != GONE) { |
| 218 | height += child.getMeasuredHeight() + mDividerHeight; |
| 219 | } |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 220 | } |
Selim Cinek | a69f2a6 | 2015-12-11 17:28:12 -0800 | [diff] [blame] | 221 | mRealHeight = height; |
| 222 | if (heightMode != MeasureSpec.UNSPECIFIED) { |
| 223 | height = Math.min(height, size); |
| 224 | } |
Mady Mellor | b0a8246 | 2016-04-30 17:31:02 -0700 | [diff] [blame] | 225 | |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 226 | int headerHeightSpec = MeasureSpec.makeMeasureSpec(mHeaderHeight, MeasureSpec.EXACTLY); |
Mady Mellor | b0a8246 | 2016-04-30 17:31:02 -0700 | [diff] [blame] | 227 | if (mNotificationHeader != null) { |
Mady Mellor | b0a8246 | 2016-04-30 17:31:02 -0700 | [diff] [blame] | 228 | mNotificationHeader.measure(widthMeasureSpec, headerHeightSpec); |
| 229 | } |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 230 | if (mNotificationHeaderLowPriority != null) { |
| 231 | headerHeightSpec = MeasureSpec.makeMeasureSpec(mHeaderHeight, MeasureSpec.EXACTLY); |
| 232 | mNotificationHeaderLowPriority.measure(widthMeasureSpec, headerHeightSpec); |
| 233 | } |
Mady Mellor | b0a8246 | 2016-04-30 17:31:02 -0700 | [diff] [blame] | 234 | |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 235 | setMeasuredDimension(width, height); |
| 236 | } |
| 237 | |
Selim Cinek | a69f2a6 | 2015-12-11 17:28:12 -0800 | [diff] [blame] | 238 | @Override |
Selim Cinek | 0242fbb | 2016-10-19 13:38:32 -0700 | [diff] [blame] | 239 | public boolean hasOverlappingRendering() { |
| 240 | return false; |
| 241 | } |
| 242 | |
| 243 | @Override |
Selim Cinek | a69f2a6 | 2015-12-11 17:28:12 -0800 | [diff] [blame] | 244 | public boolean pointInView(float localX, float localY, float slop) { |
| 245 | return localX >= -slop && localY >= -slop && localX < ((mRight - mLeft) + slop) && |
| 246 | localY < (mRealHeight + slop); |
| 247 | } |
| 248 | |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 249 | /** |
Kevin Han | 43077f9 | 2020-02-28 12:51:53 -0800 | [diff] [blame] | 250 | * Set the untruncated number of children in the group so that the view can update the UI |
| 251 | * appropriately. Note that this may differ from the number of views attached as truncated |
| 252 | * children will not have views. |
| 253 | */ |
| 254 | public void setUntruncatedChildCount(int childCount) { |
| 255 | mUntruncatedChildCount = childCount; |
| 256 | updateGroupOverflow(); |
| 257 | } |
| 258 | |
| 259 | /** |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 260 | * Add a child notification to this view. |
| 261 | * |
| 262 | * @param row the row to add |
| 263 | * @param childIndex the index to add it at, if -1 it will be added at the end |
| 264 | */ |
| 265 | public void addNotification(ExpandableNotificationRow row, int childIndex) { |
Kevin Han | 43077f9 | 2020-02-28 12:51:53 -0800 | [diff] [blame] | 266 | int newIndex = childIndex < 0 ? mAttachedChildren.size() : childIndex; |
| 267 | mAttachedChildren.add(newIndex, row); |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 268 | addView(row); |
Selim Cinek | 8e0c498 | 2016-02-29 20:03:08 -0800 | [diff] [blame] | 269 | row.setUserLocked(mUserLocked); |
Selim Cinek | 7b83639 | 2015-12-04 20:02:59 -0800 | [diff] [blame] | 270 | |
| 271 | View divider = inflateDivider(); |
| 272 | addView(divider); |
| 273 | mDividers.add(newIndex, divider); |
Selim Cinek | c897bd3 | 2016-03-18 17:32:31 -0700 | [diff] [blame] | 274 | |
Selim Cinek | 2b549f4 | 2016-11-22 16:38:51 -0800 | [diff] [blame] | 275 | row.setContentTransformationAmount(0, false /* isLastChild */); |
Selim Cinek | f93bf3e | 2018-05-08 14:43:21 -0700 | [diff] [blame] | 276 | // It doesn't make sense to keep old animations around, lets cancel them! |
Dave Mankoff | a4d195d | 2018-11-16 13:33:27 -0500 | [diff] [blame] | 277 | ExpandableViewState viewState = row.getViewState(); |
Selim Cinek | f93bf3e | 2018-05-08 14:43:21 -0700 | [diff] [blame] | 278 | if (viewState != null) { |
| 279 | viewState.cancelAnimations(row); |
| 280 | row.cancelAppearDrawing(); |
| 281 | } |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 282 | } |
| 283 | |
| 284 | public void removeNotification(ExpandableNotificationRow row) { |
Kevin Han | 43077f9 | 2020-02-28 12:51:53 -0800 | [diff] [blame] | 285 | int childIndex = mAttachedChildren.indexOf(row); |
| 286 | mAttachedChildren.remove(row); |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 287 | removeView(row); |
Selim Cinek | 7b83639 | 2015-12-04 20:02:59 -0800 | [diff] [blame] | 288 | |
Selim Cinek | 7b73a4c | 2016-01-12 18:32:11 -0800 | [diff] [blame] | 289 | final View divider = mDividers.remove(childIndex); |
Selim Cinek | 7b83639 | 2015-12-04 20:02:59 -0800 | [diff] [blame] | 290 | removeView(divider); |
Selim Cinek | 7b73a4c | 2016-01-12 18:32:11 -0800 | [diff] [blame] | 291 | getOverlay().add(divider); |
| 292 | CrossFadeHelper.fadeOut(divider, new Runnable() { |
| 293 | @Override |
| 294 | public void run() { |
| 295 | getOverlay().remove(divider); |
| 296 | } |
| 297 | }); |
Selim Cinek | 7b83639 | 2015-12-04 20:02:59 -0800 | [diff] [blame] | 298 | |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 299 | row.setSystemChildExpanded(false); |
Selim Cinek | 8e0c498 | 2016-02-29 20:03:08 -0800 | [diff] [blame] | 300 | row.setUserLocked(false); |
Mady Mellor | b0a8246 | 2016-04-30 17:31:02 -0700 | [diff] [blame] | 301 | if (!row.isRemoved()) { |
| 302 | mHeaderUtil.restoreNotificationHeader(row); |
| 303 | } |
| 304 | } |
| 305 | |
| 306 | /** |
| 307 | * @return The number of notification children in the container. |
| 308 | */ |
| 309 | public int getNotificationChildCount() { |
Kevin Han | 43077f9 | 2020-02-28 12:51:53 -0800 | [diff] [blame] | 310 | return mAttachedChildren.size(); |
Mady Mellor | b0a8246 | 2016-04-30 17:31:02 -0700 | [diff] [blame] | 311 | } |
| 312 | |
Steve Elliott | 936df15 | 2020-04-14 13:59:53 -0400 | [diff] [blame] | 313 | public void recreateNotificationHeader(OnClickListener listener, boolean isConversation) { |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 314 | mHeaderClickListener = listener; |
Steve Elliott | 936df15 | 2020-04-14 13:59:53 -0400 | [diff] [blame] | 315 | mIsConversation = isConversation; |
Ned Burns | 1c2b85a4 | 2019-11-14 15:37:03 -0500 | [diff] [blame] | 316 | StatusBarNotification notification = mContainingNotification.getEntry().getSbn(); |
Mady Mellor | b0a8246 | 2016-04-30 17:31:02 -0700 | [diff] [blame] | 317 | final Notification.Builder builder = Notification.Builder.recoverBuilder(getContext(), |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 318 | notification.getNotification()); |
Lucas Dupin | 00be88f | 2019-01-03 17:50:52 -0800 | [diff] [blame] | 319 | RemoteViews header = builder.makeNotificationHeader(); |
Mady Mellor | b0a8246 | 2016-04-30 17:31:02 -0700 | [diff] [blame] | 320 | if (mNotificationHeader == null) { |
| 321 | mNotificationHeader = (NotificationHeaderView) header.apply(getContext(), this); |
| 322 | final View expandButton = mNotificationHeader.findViewById( |
| 323 | com.android.internal.R.id.expand_button); |
| 324 | expandButton.setVisibility(VISIBLE); |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 325 | mNotificationHeader.setOnClickListener(mHeaderClickListener); |
Mady Mellor | b0a8246 | 2016-04-30 17:31:02 -0700 | [diff] [blame] | 326 | mNotificationHeaderWrapper = NotificationViewWrapper.wrap(getContext(), |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 327 | mNotificationHeader, mContainingNotification); |
Mady Mellor | b0a8246 | 2016-04-30 17:31:02 -0700 | [diff] [blame] | 328 | addView(mNotificationHeader, 0); |
| 329 | invalidate(); |
| 330 | } else { |
| 331 | header.reapply(getContext(), mNotificationHeader); |
Mady Mellor | b0a8246 | 2016-04-30 17:31:02 -0700 | [diff] [blame] | 332 | } |
Selim Cinek | 131f1a4 | 2017-06-05 17:50:19 -0700 | [diff] [blame] | 333 | mNotificationHeaderWrapper.onContentUpdated(mContainingNotification); |
Steve Elliott | 936df15 | 2020-04-14 13:59:53 -0400 | [diff] [blame] | 334 | if (mNotificationHeaderWrapper instanceof NotificationHeaderViewWrapper) { |
| 335 | NotificationHeaderViewWrapper headerWrapper = |
| 336 | (NotificationHeaderViewWrapper) mNotificationHeaderWrapper; |
| 337 | if (isConversation) { |
| 338 | headerWrapper.applyConversationSkin(); |
| 339 | } else { |
| 340 | headerWrapper.clearConversationSkin(); |
| 341 | } |
| 342 | } |
| 343 | recreateLowPriorityHeader(builder, isConversation); |
Lucas Dupin | 6ea2787 | 2017-05-30 12:00:04 -0700 | [diff] [blame] | 344 | updateHeaderVisibility(false /* animate */); |
Mady Mellor | b0a8246 | 2016-04-30 17:31:02 -0700 | [diff] [blame] | 345 | updateChildrenHeaderAppearance(); |
| 346 | } |
| 347 | |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 348 | /** |
| 349 | * Recreate the low-priority header. |
| 350 | * |
| 351 | * @param builder a builder to reuse. Otherwise the builder will be recovered. |
| 352 | */ |
Steve Elliott | 936df15 | 2020-04-14 13:59:53 -0400 | [diff] [blame] | 353 | private void recreateLowPriorityHeader(Notification.Builder builder, boolean isConversation) { |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 354 | RemoteViews header; |
Ned Burns | 1c2b85a4 | 2019-11-14 15:37:03 -0500 | [diff] [blame] | 355 | StatusBarNotification notification = mContainingNotification.getEntry().getSbn(); |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 356 | if (mIsLowPriority) { |
| 357 | if (builder == null) { |
| 358 | builder = Notification.Builder.recoverBuilder(getContext(), |
| 359 | notification.getNotification()); |
| 360 | } |
| 361 | header = builder.makeLowPriorityContentView(true /* useRegularSubtext */); |
| 362 | if (mNotificationHeaderLowPriority == null) { |
| 363 | mNotificationHeaderLowPriority = (NotificationHeaderView) header.apply(getContext(), |
| 364 | this); |
| 365 | final View expandButton = mNotificationHeaderLowPriority.findViewById( |
| 366 | com.android.internal.R.id.expand_button); |
| 367 | expandButton.setVisibility(VISIBLE); |
| 368 | mNotificationHeaderLowPriority.setOnClickListener(mHeaderClickListener); |
| 369 | mNotificationHeaderWrapperLowPriority = NotificationViewWrapper.wrap(getContext(), |
| 370 | mNotificationHeaderLowPriority, mContainingNotification); |
| 371 | addView(mNotificationHeaderLowPriority, 0); |
| 372 | invalidate(); |
| 373 | } else { |
| 374 | header.reapply(getContext(), mNotificationHeaderLowPriority); |
| 375 | } |
Selim Cinek | 131f1a4 | 2017-06-05 17:50:19 -0700 | [diff] [blame] | 376 | mNotificationHeaderWrapperLowPriority.onContentUpdated(mContainingNotification); |
Steve Elliott | 936df15 | 2020-04-14 13:59:53 -0400 | [diff] [blame] | 377 | if (mNotificationHeaderWrapper instanceof NotificationHeaderViewWrapper) { |
| 378 | NotificationHeaderViewWrapper headerWrapper = |
| 379 | (NotificationHeaderViewWrapper) mNotificationHeaderWrapper; |
| 380 | if (isConversation) { |
| 381 | headerWrapper.applyConversationSkin(); |
| 382 | } else { |
| 383 | headerWrapper.clearConversationSkin(); |
| 384 | } |
| 385 | } |
Adrian Roos | 6f6e159 | 2017-05-02 16:22:53 -0700 | [diff] [blame] | 386 | resetHeaderVisibilityIfNeeded(mNotificationHeaderLowPriority, calculateDesiredHeader()); |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 387 | } else { |
Selim Cinek | 6fd06b5 | 2017-03-07 15:54:10 -0800 | [diff] [blame] | 388 | removeView(mNotificationHeaderLowPriority); |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 389 | mNotificationHeaderLowPriority = null; |
| 390 | mNotificationHeaderWrapperLowPriority = null; |
| 391 | } |
| 392 | } |
| 393 | |
Mady Mellor | b0a8246 | 2016-04-30 17:31:02 -0700 | [diff] [blame] | 394 | public void updateChildrenHeaderAppearance() { |
| 395 | mHeaderUtil.updateChildrenHeaderAppearance(); |
Selim Cinek | c897bd3 | 2016-03-18 17:32:31 -0700 | [diff] [blame] | 396 | } |
| 397 | |
| 398 | public void updateGroupOverflow() { |
Selim Cinek | c897bd3 | 2016-03-18 17:32:31 -0700 | [diff] [blame] | 399 | int maxAllowedVisibleChildren = getMaxAllowedVisibleChildren(true /* likeCollapsed */); |
Kevin Han | 43077f9 | 2020-02-28 12:51:53 -0800 | [diff] [blame] | 400 | if (mUntruncatedChildCount > maxAllowedVisibleChildren) { |
| 401 | int number = mUntruncatedChildCount - maxAllowedVisibleChildren; |
Steve Elliott | 936df15 | 2020-04-14 13:59:53 -0400 | [diff] [blame] | 402 | mOverflowNumber = mHybridGroupManager.bindOverflowNumber(mOverflowNumber, number, this); |
Selim Cinek | c897bd3 | 2016-03-18 17:32:31 -0700 | [diff] [blame] | 403 | if (mGroupOverFlowState == null) { |
| 404 | mGroupOverFlowState = new ViewState(); |
| 405 | mNeverAppliedGroupState = true; |
| 406 | } |
| 407 | } else if (mOverflowNumber != null) { |
| 408 | removeView(mOverflowNumber); |
Eliot Courtney | bb8af1c | 2018-01-11 16:44:45 +0900 | [diff] [blame] | 409 | if (isShown() && isAttachedToWindow()) { |
Selim Cinek | c897bd3 | 2016-03-18 17:32:31 -0700 | [diff] [blame] | 410 | final View removedOverflowNumber = mOverflowNumber; |
| 411 | addTransientView(removedOverflowNumber, getTransientViewCount()); |
| 412 | CrossFadeHelper.fadeOut(removedOverflowNumber, new Runnable() { |
| 413 | @Override |
| 414 | public void run() { |
| 415 | removeTransientView(removedOverflowNumber); |
| 416 | } |
| 417 | }); |
| 418 | } |
| 419 | mOverflowNumber = null; |
Selim Cinek | c897bd3 | 2016-03-18 17:32:31 -0700 | [diff] [blame] | 420 | mGroupOverFlowState = null; |
| 421 | } |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 422 | } |
| 423 | |
Selim Cinek | a3d3b91 | 2016-02-02 11:22:06 -0800 | [diff] [blame] | 424 | @Override |
| 425 | protected void onConfigurationChanged(Configuration newConfig) { |
| 426 | super.onConfigurationChanged(newConfig); |
Selim Cinek | c897bd3 | 2016-03-18 17:32:31 -0700 | [diff] [blame] | 427 | updateGroupOverflow(); |
Selim Cinek | a3d3b91 | 2016-02-02 11:22:06 -0800 | [diff] [blame] | 428 | } |
| 429 | |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 430 | private View inflateDivider() { |
| 431 | return LayoutInflater.from(mContext).inflate( |
| 432 | R.layout.notification_children_divider, this, false); |
| 433 | } |
| 434 | |
Kevin Han | 43077f9 | 2020-02-28 12:51:53 -0800 | [diff] [blame] | 435 | /** |
| 436 | * Get notification children that are attached currently. |
| 437 | */ |
| 438 | public List<ExpandableNotificationRow> getAttachedChildren() { |
| 439 | return mAttachedChildren; |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 440 | } |
| 441 | |
| 442 | /** |
| 443 | * Apply the order given in the list to the children. |
| 444 | * |
| 445 | * @param childOrder the new list order |
Selim Cinek | a7d4f82 | 2016-12-06 14:34:47 -0800 | [diff] [blame] | 446 | * @param visualStabilityManager |
| 447 | * @param callback |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 448 | * @return whether the list order has changed |
| 449 | */ |
Evan Laird | 9a9a619 | 2019-12-19 10:44:21 -0500 | [diff] [blame] | 450 | public boolean applyChildOrder(List<? extends NotificationListItem> childOrder, |
Selim Cinek | a7d4f82 | 2016-12-06 14:34:47 -0800 | [diff] [blame] | 451 | VisualStabilityManager visualStabilityManager, |
| 452 | VisualStabilityManager.Callback callback) { |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 453 | if (childOrder == null) { |
| 454 | return false; |
| 455 | } |
| 456 | boolean result = false; |
Kevin Han | 43077f9 | 2020-02-28 12:51:53 -0800 | [diff] [blame] | 457 | for (int i = 0; i < mAttachedChildren.size() && i < childOrder.size(); i++) { |
| 458 | ExpandableNotificationRow child = mAttachedChildren.get(i); |
Evan Laird | 9a9a619 | 2019-12-19 10:44:21 -0500 | [diff] [blame] | 459 | ExpandableNotificationRow desiredChild = (ExpandableNotificationRow) childOrder.get(i); |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 460 | if (child != desiredChild) { |
Selim Cinek | a7d4f82 | 2016-12-06 14:34:47 -0800 | [diff] [blame] | 461 | if (visualStabilityManager.canReorderNotification(desiredChild)) { |
Kevin Han | 43077f9 | 2020-02-28 12:51:53 -0800 | [diff] [blame] | 462 | mAttachedChildren.remove(desiredChild); |
| 463 | mAttachedChildren.add(i, desiredChild); |
Selim Cinek | a7d4f82 | 2016-12-06 14:34:47 -0800 | [diff] [blame] | 464 | result = true; |
| 465 | } else { |
Selim Cinek | 0260c75 | 2020-05-11 16:03:52 -0700 | [diff] [blame] | 466 | visualStabilityManager.addReorderingAllowedCallback(callback, |
| 467 | false /* persistent */); |
Selim Cinek | a7d4f82 | 2016-12-06 14:34:47 -0800 | [diff] [blame] | 468 | } |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 469 | } |
| 470 | } |
Selim Cinek | 83bc783 | 2015-10-22 13:26:54 -0700 | [diff] [blame] | 471 | updateExpansionStates(); |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 472 | return result; |
| 473 | } |
| 474 | |
Selim Cinek | 83bc783 | 2015-10-22 13:26:54 -0700 | [diff] [blame] | 475 | private void updateExpansionStates() { |
Selim Cinek | 898d173 | 2016-02-29 19:57:35 -0800 | [diff] [blame] | 476 | if (mChildrenExpanded || mUserLocked) { |
| 477 | // we don't modify it the group is expanded or if we are expanding it |
| 478 | return; |
| 479 | } |
Kevin Han | 43077f9 | 2020-02-28 12:51:53 -0800 | [diff] [blame] | 480 | int size = mAttachedChildren.size(); |
Selim Cinek | 898d173 | 2016-02-29 19:57:35 -0800 | [diff] [blame] | 481 | for (int i = 0; i < size; i++) { |
Kevin Han | 43077f9 | 2020-02-28 12:51:53 -0800 | [diff] [blame] | 482 | ExpandableNotificationRow child = mAttachedChildren.get(i); |
Selim Cinek | 898d173 | 2016-02-29 19:57:35 -0800 | [diff] [blame] | 483 | child.setSystemChildExpanded(i == 0 && size == 1); |
Selim Cinek | 83bc783 | 2015-10-22 13:26:54 -0700 | [diff] [blame] | 484 | } |
| 485 | } |
| 486 | |
| 487 | /** |
| 488 | * |
| 489 | * @return the intrinsic size of this children container, i.e the natural fully expanded state |
| 490 | */ |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 491 | public int getIntrinsicHeight() { |
Selim Cinek | 83bc783 | 2015-10-22 13:26:54 -0700 | [diff] [blame] | 492 | int maxAllowedVisibleChildren = getMaxAllowedVisibleChildren(); |
| 493 | return getIntrinsicHeight(maxAllowedVisibleChildren); |
| 494 | } |
| 495 | |
| 496 | /** |
| 497 | * @return the intrinsic height with a number of children given |
| 498 | * in @param maxAllowedVisibleChildren |
| 499 | */ |
| 500 | private int getIntrinsicHeight(float maxAllowedVisibleChildren) { |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 501 | if (showingAsLowPriority()) { |
| 502 | return mNotificationHeaderLowPriority.getHeight(); |
| 503 | } |
Selim Cinek | aa9db1f | 2018-02-27 17:35:47 -0800 | [diff] [blame] | 504 | int intrinsicHeight = mNotificationHeaderMargin + mCurrentHeaderTranslation; |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 505 | int visibleChildren = 0; |
Kevin Han | 43077f9 | 2020-02-28 12:51:53 -0800 | [diff] [blame] | 506 | int childCount = mAttachedChildren.size(); |
Selim Cinek | 42357e0 | 2016-02-24 18:48:01 -0800 | [diff] [blame] | 507 | boolean firstChild = true; |
| 508 | float expandFactor = 0; |
| 509 | if (mUserLocked) { |
Selim Cinek | f07d062 | 2016-03-21 19:52:52 -0700 | [diff] [blame] | 510 | expandFactor = getGroupExpandFraction(); |
Selim Cinek | 42357e0 | 2016-02-24 18:48:01 -0800 | [diff] [blame] | 511 | } |
Selim Cinek | 7927c73 | 2019-03-06 15:21:39 -0800 | [diff] [blame] | 512 | boolean childrenExpanded = mChildrenExpanded; |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 513 | for (int i = 0; i < childCount; i++) { |
Selim Cinek | 83bc783 | 2015-10-22 13:26:54 -0700 | [diff] [blame] | 514 | if (visibleChildren >= maxAllowedVisibleChildren) { |
| 515 | break; |
| 516 | } |
Selim Cinek | 42357e0 | 2016-02-24 18:48:01 -0800 | [diff] [blame] | 517 | if (!firstChild) { |
| 518 | if (mUserLocked) { |
| 519 | intrinsicHeight += NotificationUtils.interpolate(mChildPadding, mDividerHeight, |
| 520 | expandFactor); |
| 521 | } else { |
Adrian Roos | 6f6e159 | 2017-05-02 16:22:53 -0700 | [diff] [blame] | 522 | intrinsicHeight += childrenExpanded ? mDividerHeight : mChildPadding; |
Selim Cinek | 42357e0 | 2016-02-24 18:48:01 -0800 | [diff] [blame] | 523 | } |
| 524 | } else { |
| 525 | if (mUserLocked) { |
| 526 | intrinsicHeight += NotificationUtils.interpolate( |
| 527 | 0, |
| 528 | mNotificatonTopPadding + mDividerHeight, |
| 529 | expandFactor); |
| 530 | } else { |
Adrian Roos | 6f6e159 | 2017-05-02 16:22:53 -0700 | [diff] [blame] | 531 | intrinsicHeight += childrenExpanded |
Selim Cinek | 42357e0 | 2016-02-24 18:48:01 -0800 | [diff] [blame] | 532 | ? mNotificatonTopPadding + mDividerHeight |
| 533 | : 0; |
| 534 | } |
| 535 | firstChild = false; |
| 536 | } |
Kevin Han | 43077f9 | 2020-02-28 12:51:53 -0800 | [diff] [blame] | 537 | ExpandableNotificationRow child = mAttachedChildren.get(i); |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 538 | intrinsicHeight += child.getIntrinsicHeight(); |
| 539 | visibleChildren++; |
| 540 | } |
Selim Cinek | 42357e0 | 2016-02-24 18:48:01 -0800 | [diff] [blame] | 541 | if (mUserLocked) { |
| 542 | intrinsicHeight += NotificationUtils.interpolate(mCollapsedBottompadding, 0.0f, |
| 543 | expandFactor); |
Adrian Roos | 6f6e159 | 2017-05-02 16:22:53 -0700 | [diff] [blame] | 544 | } else if (!childrenExpanded) { |
Selim Cinek | 83bc783 | 2015-10-22 13:26:54 -0700 | [diff] [blame] | 545 | intrinsicHeight += mCollapsedBottompadding; |
| 546 | } |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 547 | return intrinsicHeight; |
| 548 | } |
| 549 | |
| 550 | /** |
| 551 | * Update the state of all its children based on a linear layout algorithm. |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 552 | * @param parentState the state of the parent |
Selim Cinek | 7927c73 | 2019-03-06 15:21:39 -0800 | [diff] [blame] | 553 | * @param ambientState the ambient state containing ambient information |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 554 | */ |
Dave Mankoff | a4d195d | 2018-11-16 13:33:27 -0500 | [diff] [blame] | 555 | public void updateState(ExpandableViewState parentState, AmbientState ambientState) { |
Kevin Han | 43077f9 | 2020-02-28 12:51:53 -0800 | [diff] [blame] | 556 | int childCount = mAttachedChildren.size(); |
Selim Cinek | aa9db1f | 2018-02-27 17:35:47 -0800 | [diff] [blame] | 557 | int yPosition = mNotificationHeaderMargin + mCurrentHeaderTranslation; |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 558 | boolean firstChild = true; |
Selim Cinek | 83bc783 | 2015-10-22 13:26:54 -0700 | [diff] [blame] | 559 | int maxAllowedVisibleChildren = getMaxAllowedVisibleChildren(); |
Selim Cinek | 91c2a15 | 2016-03-17 15:01:38 -0700 | [diff] [blame] | 560 | int lastVisibleIndex = maxAllowedVisibleChildren - 1; |
Selim Cinek | f07d062 | 2016-03-21 19:52:52 -0700 | [diff] [blame] | 561 | int firstOverflowIndex = lastVisibleIndex + 1; |
Selim Cinek | 42357e0 | 2016-02-24 18:48:01 -0800 | [diff] [blame] | 562 | float expandFactor = 0; |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 563 | boolean expandingToExpandedGroup = mUserLocked && !showingAsLowPriority(); |
Selim Cinek | 42357e0 | 2016-02-24 18:48:01 -0800 | [diff] [blame] | 564 | if (mUserLocked) { |
Selim Cinek | f07d062 | 2016-03-21 19:52:52 -0700 | [diff] [blame] | 565 | expandFactor = getGroupExpandFraction(); |
| 566 | firstOverflowIndex = getMaxAllowedVisibleChildren(true /* likeCollapsed */); |
Selim Cinek | 42357e0 | 2016-02-24 18:48:01 -0800 | [diff] [blame] | 567 | } |
Mady Mellor | b0a8246 | 2016-04-30 17:31:02 -0700 | [diff] [blame] | 568 | |
Adrian Roos | 16fe495 | 2017-05-18 16:10:21 -0700 | [diff] [blame] | 569 | boolean childrenExpandedAndNotAnimating = mChildrenExpanded |
| 570 | && !mContainingNotification.isGroupExpansionChanging(); |
Selim Cinek | c25989e | 2018-02-16 16:42:14 -0800 | [diff] [blame] | 571 | int launchTransitionCompensation = 0; |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 572 | for (int i = 0; i < childCount; i++) { |
Kevin Han | 43077f9 | 2020-02-28 12:51:53 -0800 | [diff] [blame] | 573 | ExpandableNotificationRow child = mAttachedChildren.get(i); |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 574 | if (!firstChild) { |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 575 | if (expandingToExpandedGroup) { |
Mady Mellor | b0a8246 | 2016-04-30 17:31:02 -0700 | [diff] [blame] | 576 | yPosition += NotificationUtils.interpolate(mChildPadding, mDividerHeight, |
| 577 | expandFactor); |
Selim Cinek | 42357e0 | 2016-02-24 18:48:01 -0800 | [diff] [blame] | 578 | } else { |
Adrian Roos | 16fe495 | 2017-05-18 16:10:21 -0700 | [diff] [blame] | 579 | yPosition += mChildrenExpanded ? mDividerHeight : mChildPadding; |
Selim Cinek | 42357e0 | 2016-02-24 18:48:01 -0800 | [diff] [blame] | 580 | } |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 581 | } else { |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 582 | if (expandingToExpandedGroup) { |
Selim Cinek | 42357e0 | 2016-02-24 18:48:01 -0800 | [diff] [blame] | 583 | yPosition += NotificationUtils.interpolate( |
| 584 | 0, |
| 585 | mNotificatonTopPadding + mDividerHeight, |
| 586 | expandFactor); |
| 587 | } else { |
Adrian Roos | 16fe495 | 2017-05-18 16:10:21 -0700 | [diff] [blame] | 588 | yPosition += mChildrenExpanded ? mNotificatonTopPadding + mDividerHeight : 0; |
Selim Cinek | 42357e0 | 2016-02-24 18:48:01 -0800 | [diff] [blame] | 589 | } |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 590 | firstChild = false; |
| 591 | } |
Mady Mellor | b0a8246 | 2016-04-30 17:31:02 -0700 | [diff] [blame] | 592 | |
Dave Mankoff | a4d195d | 2018-11-16 13:33:27 -0500 | [diff] [blame] | 593 | ExpandableViewState childState = child.getViewState(); |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 594 | int intrinsicHeight = child.getIntrinsicHeight(); |
Selim Cinek | b3dadcc | 2016-11-21 17:21:13 -0800 | [diff] [blame] | 595 | childState.height = intrinsicHeight; |
Selim Cinek | c25989e | 2018-02-16 16:42:14 -0800 | [diff] [blame] | 596 | childState.yTranslation = yPosition + launchTransitionCompensation; |
Selim Cinek | b3dadcc | 2016-11-21 17:21:13 -0800 | [diff] [blame] | 597 | childState.hidden = false; |
Mady Mellor | b0a8246 | 2016-04-30 17:31:02 -0700 | [diff] [blame] | 598 | // When the group is expanded, the children cast the shadows rather than the parent |
| 599 | // so use the parent's elevation here. |
Adrian Roos | 16fe495 | 2017-05-18 16:10:21 -0700 | [diff] [blame] | 600 | childState.zTranslation = |
| 601 | (childrenExpandedAndNotAnimating && mEnableShadowOnChildNotifications) |
Selim Cinek | c25989e | 2018-02-16 16:42:14 -0800 | [diff] [blame] | 602 | ? parentState.zTranslation |
Mady Mellor | b0a8246 | 2016-04-30 17:31:02 -0700 | [diff] [blame] | 603 | : 0; |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 604 | childState.dimmed = parentState.dimmed; |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 605 | childState.hideSensitive = parentState.hideSensitive; |
Selim Cinek | db16737 | 2016-11-17 15:41:17 -0800 | [diff] [blame] | 606 | childState.belowSpeedBump = parentState.belowSpeedBump; |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 607 | childState.clipTopAmount = 0; |
Selim Cinek | f07d062 | 2016-03-21 19:52:52 -0700 | [diff] [blame] | 608 | childState.alpha = 0; |
| 609 | if (i < firstOverflowIndex) { |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 610 | childState.alpha = showingAsLowPriority() ? expandFactor : 1.0f; |
Selim Cinek | f07d062 | 2016-03-21 19:52:52 -0700 | [diff] [blame] | 611 | } else if (expandFactor == 1.0f && i <= lastVisibleIndex) { |
| 612 | childState.alpha = (mActualHeight - childState.yTranslation) / childState.height; |
| 613 | childState.alpha = Math.max(0.0f, Math.min(1.0f, childState.alpha)); |
| 614 | } |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 615 | childState.location = parentState.location; |
Selim Cinek | a7d4f82 | 2016-12-06 14:34:47 -0800 | [diff] [blame] | 616 | childState.inShelf = parentState.inShelf; |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 617 | yPosition += intrinsicHeight; |
Selim Cinek | c25989e | 2018-02-16 16:42:14 -0800 | [diff] [blame] | 618 | if (child.isExpandAnimationRunning()) { |
| 619 | launchTransitionCompensation = -ambientState.getExpandAnimationTopChange(); |
| 620 | } |
Selim Cinek | a7d4f82 | 2016-12-06 14:34:47 -0800 | [diff] [blame] | 621 | |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 622 | } |
Selim Cinek | c897bd3 | 2016-03-18 17:32:31 -0700 | [diff] [blame] | 623 | if (mOverflowNumber != null) { |
Kevin Han | 43077f9 | 2020-02-28 12:51:53 -0800 | [diff] [blame] | 624 | ExpandableNotificationRow overflowView = mAttachedChildren.get(Math.min( |
Lucas Dupin | 4c797d6 | 2018-05-07 15:32:13 -0700 | [diff] [blame] | 625 | getMaxAllowedVisibleChildren(true /* likeCollapsed */), childCount) - 1); |
Dave Mankoff | a4d195d | 2018-11-16 13:33:27 -0500 | [diff] [blame] | 626 | mGroupOverFlowState.copyFrom(overflowView.getViewState()); |
Adrian Roos | 6f6e159 | 2017-05-02 16:22:53 -0700 | [diff] [blame] | 627 | |
Selim Cinek | 7927c73 | 2019-03-06 15:21:39 -0800 | [diff] [blame] | 628 | if (!mChildrenExpanded) { |
Lucas Dupin | 4c797d6 | 2018-05-07 15:32:13 -0700 | [diff] [blame] | 629 | HybridNotificationView alignView = overflowView.getSingleLineView(); |
Adrian Roos | 6f6e159 | 2017-05-02 16:22:53 -0700 | [diff] [blame] | 630 | if (alignView != null) { |
| 631 | View mirrorView = alignView.getTextView(); |
Selim Cinek | c897bd3 | 2016-03-18 17:32:31 -0700 | [diff] [blame] | 632 | if (mirrorView.getVisibility() == GONE) { |
Adrian Roos | 6f6e159 | 2017-05-02 16:22:53 -0700 | [diff] [blame] | 633 | mirrorView = alignView.getTitleView(); |
Selim Cinek | c897bd3 | 2016-03-18 17:32:31 -0700 | [diff] [blame] | 634 | } |
| 635 | if (mirrorView.getVisibility() == GONE) { |
Adrian Roos | 6f6e159 | 2017-05-02 16:22:53 -0700 | [diff] [blame] | 636 | mirrorView = alignView; |
Selim Cinek | c897bd3 | 2016-03-18 17:32:31 -0700 | [diff] [blame] | 637 | } |
Lucas Dupin | 4c797d6 | 2018-05-07 15:32:13 -0700 | [diff] [blame] | 638 | mGroupOverFlowState.alpha = mirrorView.getAlpha(); |
Selim Cinek | c897bd3 | 2016-03-18 17:32:31 -0700 | [diff] [blame] | 639 | mGroupOverFlowState.yTranslation += NotificationUtils.getRelativeYOffset( |
| 640 | mirrorView, overflowView); |
Selim Cinek | c897bd3 | 2016-03-18 17:32:31 -0700 | [diff] [blame] | 641 | } |
| 642 | } else { |
Mady Mellor | b0a8246 | 2016-04-30 17:31:02 -0700 | [diff] [blame] | 643 | mGroupOverFlowState.yTranslation += mNotificationHeaderMargin; |
Selim Cinek | c897bd3 | 2016-03-18 17:32:31 -0700 | [diff] [blame] | 644 | mGroupOverFlowState.alpha = 0.0f; |
| 645 | } |
| 646 | } |
Mady Mellor | b0a8246 | 2016-04-30 17:31:02 -0700 | [diff] [blame] | 647 | if (mNotificationHeader != null) { |
| 648 | if (mHeaderViewState == null) { |
| 649 | mHeaderViewState = new ViewState(); |
| 650 | } |
| 651 | mHeaderViewState.initFrom(mNotificationHeader); |
Adrian Roos | 16fe495 | 2017-05-18 16:10:21 -0700 | [diff] [blame] | 652 | mHeaderViewState.zTranslation = childrenExpandedAndNotAnimating |
Selim Cinek | c25989e | 2018-02-16 16:42:14 -0800 | [diff] [blame] | 653 | ? parentState.zTranslation |
Mady Mellor | b0a8246 | 2016-04-30 17:31:02 -0700 | [diff] [blame] | 654 | : 0; |
Selim Cinek | aa9db1f | 2018-02-27 17:35:47 -0800 | [diff] [blame] | 655 | mHeaderViewState.yTranslation = mCurrentHeaderTranslation; |
| 656 | mHeaderViewState.alpha = mHeaderVisibleAmount; |
| 657 | // The hiding is done automatically by the alpha, otherwise we'll pick it up again |
| 658 | // in the next frame with the initFrom call above and have an invisible header |
| 659 | mHeaderViewState.hidden = false; |
Mady Mellor | b0a8246 | 2016-04-30 17:31:02 -0700 | [diff] [blame] | 660 | } |
| 661 | } |
| 662 | |
| 663 | /** |
| 664 | * When moving into the bottom stack, the bottom visible child in an expanded group adjusts its |
| 665 | * height, children in the group after this are gone. |
| 666 | * |
| 667 | * @param child the child who's height to adjust. |
| 668 | * @param parentHeight the height of the parent. |
| 669 | * @param childState the state to update. |
| 670 | * @param yPosition the yPosition of the view. |
| 671 | * @return true if children after this one should be hidden. |
| 672 | */ |
| 673 | private boolean updateChildStateForExpandedGroup(ExpandableNotificationRow child, |
Selim Cinek | bbcebde | 2016-11-09 18:28:20 -0800 | [diff] [blame] | 674 | int parentHeight, ExpandableViewState childState, int yPosition) { |
Mady Mellor | b0a8246 | 2016-04-30 17:31:02 -0700 | [diff] [blame] | 675 | final int top = yPosition + child.getClipTopAmount(); |
| 676 | final int intrinsicHeight = child.getIntrinsicHeight(); |
| 677 | final int bottom = top + intrinsicHeight; |
| 678 | int newHeight = intrinsicHeight; |
| 679 | if (bottom >= parentHeight) { |
| 680 | // Child is either clipped or gone |
| 681 | newHeight = Math.max((parentHeight - top), 0); |
| 682 | } |
| 683 | childState.hidden = newHeight == 0; |
| 684 | childState.height = newHeight; |
| 685 | return childState.height != intrinsicHeight && !childState.hidden; |
Selim Cinek | 83bc783 | 2015-10-22 13:26:54 -0700 | [diff] [blame] | 686 | } |
| 687 | |
Aaron Heuckroth | 17ce40e | 2018-06-19 15:44:40 -0400 | [diff] [blame] | 688 | @VisibleForTesting |
| 689 | int getMaxAllowedVisibleChildren() { |
Selim Cinek | 83bc783 | 2015-10-22 13:26:54 -0700 | [diff] [blame] | 690 | return getMaxAllowedVisibleChildren(false /* likeCollapsed */); |
| 691 | } |
| 692 | |
Aaron Heuckroth | 17ce40e | 2018-06-19 15:44:40 -0400 | [diff] [blame] | 693 | @VisibleForTesting |
| 694 | int getMaxAllowedVisibleChildren(boolean likeCollapsed) { |
Aaron Heuckroth | 17ce40e | 2018-06-19 15:44:40 -0400 | [diff] [blame] | 695 | if (!likeCollapsed && (mChildrenExpanded || mContainingNotification.isUserLocked()) |
| 696 | && !showingAsLowPriority()) { |
Selim Cinek | 83bc783 | 2015-10-22 13:26:54 -0700 | [diff] [blame] | 697 | return NUMBER_OF_CHILDREN_WHEN_CHILDREN_EXPANDED; |
| 698 | } |
Selim Cinek | c3fec68 | 2019-06-06 18:11:07 -0700 | [diff] [blame] | 699 | if (mIsLowPriority |
| 700 | || (!mContainingNotification.isOnKeyguard() && mContainingNotification.isExpanded()) |
| 701 | || (mContainingNotification.isHeadsUpState() |
| 702 | && mContainingNotification.canShowHeadsUp())) { |
Selim Cinek | 83bc783 | 2015-10-22 13:26:54 -0700 | [diff] [blame] | 703 | return NUMBER_OF_CHILDREN_WHEN_SYSTEM_EXPANDED; |
| 704 | } |
| 705 | return NUMBER_OF_CHILDREN_WHEN_COLLAPSED; |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 706 | } |
| 707 | |
Dave Mankoff | a4d195d | 2018-11-16 13:33:27 -0500 | [diff] [blame] | 708 | /** Applies state to children. */ |
| 709 | public void applyState() { |
Kevin Han | 43077f9 | 2020-02-28 12:51:53 -0800 | [diff] [blame] | 710 | int childCount = mAttachedChildren.size(); |
Selim Cinek | 83bc783 | 2015-10-22 13:26:54 -0700 | [diff] [blame] | 711 | ViewState tmpState = new ViewState(); |
Selim Cinek | c897bd3 | 2016-03-18 17:32:31 -0700 | [diff] [blame] | 712 | float expandFraction = 0.0f; |
| 713 | if (mUserLocked) { |
Selim Cinek | f07d062 | 2016-03-21 19:52:52 -0700 | [diff] [blame] | 714 | expandFraction = getGroupExpandFraction(); |
Selim Cinek | c897bd3 | 2016-03-18 17:32:31 -0700 | [diff] [blame] | 715 | } |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 716 | final boolean dividersVisible = mUserLocked && !showingAsLowPriority() |
Anthony Chen | 6bf88a0 | 2017-04-10 14:41:44 -0700 | [diff] [blame] | 717 | || (mChildrenExpanded && mShowDividersWhenExpanded) |
| 718 | || (mContainingNotification.isGroupExpansionChanging() |
| 719 | && !mHideDividersDuringExpand); |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 720 | for (int i = 0; i < childCount; i++) { |
Kevin Han | 43077f9 | 2020-02-28 12:51:53 -0800 | [diff] [blame] | 721 | ExpandableNotificationRow child = mAttachedChildren.get(i); |
Dave Mankoff | a4d195d | 2018-11-16 13:33:27 -0500 | [diff] [blame] | 722 | ExpandableViewState viewState = child.getViewState(); |
Selim Cinek | bbcebde | 2016-11-09 18:28:20 -0800 | [diff] [blame] | 723 | viewState.applyToView(child); |
Selim Cinek | 7b83639 | 2015-12-04 20:02:59 -0800 | [diff] [blame] | 724 | |
| 725 | // layout the divider |
| 726 | View divider = mDividers.get(i); |
| 727 | tmpState.initFrom(divider); |
| 728 | tmpState.yTranslation = viewState.yTranslation - mDividerHeight; |
Anthony Chen | 6bf88a0 | 2017-04-10 14:41:44 -0700 | [diff] [blame] | 729 | float alpha = mChildrenExpanded && viewState.alpha != 0 ? mDividerAlpha : 0; |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 730 | if (mUserLocked && !showingAsLowPriority() && viewState.alpha != 0) { |
Selim Cinek | f07d062 | 2016-03-21 19:52:52 -0700 | [diff] [blame] | 731 | alpha = NotificationUtils.interpolate(0, 0.5f, |
| 732 | Math.min(viewState.alpha, expandFraction)); |
Selim Cinek | 42357e0 | 2016-02-24 18:48:01 -0800 | [diff] [blame] | 733 | } |
Mady Mellor | b0a8246 | 2016-04-30 17:31:02 -0700 | [diff] [blame] | 734 | tmpState.hidden = !dividersVisible; |
Selim Cinek | 42357e0 | 2016-02-24 18:48:01 -0800 | [diff] [blame] | 735 | tmpState.alpha = alpha; |
Selim Cinek | bbcebde | 2016-11-09 18:28:20 -0800 | [diff] [blame] | 736 | tmpState.applyToView(divider); |
Selim Cinek | d9a3f8f | 2016-03-17 19:39:00 -0700 | [diff] [blame] | 737 | // There is no fake shadow to be drawn on the children |
| 738 | child.setFakeShadowIntensity(0.0f, 0.0f, 0, 0); |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 739 | } |
Selim Cinek | 0cfbef4 | 2016-11-09 19:06:36 -0800 | [diff] [blame] | 740 | if (mGroupOverFlowState != null) { |
Selim Cinek | bbcebde | 2016-11-09 18:28:20 -0800 | [diff] [blame] | 741 | mGroupOverFlowState.applyToView(mOverflowNumber); |
Selim Cinek | c897bd3 | 2016-03-18 17:32:31 -0700 | [diff] [blame] | 742 | mNeverAppliedGroupState = false; |
| 743 | } |
Selim Cinek | 0cfbef4 | 2016-11-09 19:06:36 -0800 | [diff] [blame] | 744 | if (mHeaderViewState != null) { |
Selim Cinek | bbcebde | 2016-11-09 18:28:20 -0800 | [diff] [blame] | 745 | mHeaderViewState.applyToView(mNotificationHeader); |
Mady Mellor | b0a8246 | 2016-04-30 17:31:02 -0700 | [diff] [blame] | 746 | } |
Selim Cinek | b3dadcc | 2016-11-21 17:21:13 -0800 | [diff] [blame] | 747 | updateChildrenClipping(); |
| 748 | } |
| 749 | |
| 750 | private void updateChildrenClipping() { |
Selim Cinek | c25989e | 2018-02-16 16:42:14 -0800 | [diff] [blame] | 751 | if (mContainingNotification.hasExpandingChild()) { |
| 752 | return; |
| 753 | } |
Kevin Han | 43077f9 | 2020-02-28 12:51:53 -0800 | [diff] [blame] | 754 | int childCount = mAttachedChildren.size(); |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 755 | int layoutEnd = mContainingNotification.getActualHeight() - mClipBottomAmount; |
Selim Cinek | b3dadcc | 2016-11-21 17:21:13 -0800 | [diff] [blame] | 756 | for (int i = 0; i < childCount; i++) { |
Kevin Han | 43077f9 | 2020-02-28 12:51:53 -0800 | [diff] [blame] | 757 | ExpandableNotificationRow child = mAttachedChildren.get(i); |
Selim Cinek | b3dadcc | 2016-11-21 17:21:13 -0800 | [diff] [blame] | 758 | if (child.getVisibility() == GONE) { |
| 759 | continue; |
| 760 | } |
| 761 | float childTop = child.getTranslationY(); |
| 762 | float childBottom = childTop + child.getActualHeight(); |
| 763 | boolean visible = true; |
| 764 | int clipBottomAmount = 0; |
| 765 | if (childTop > layoutEnd) { |
| 766 | visible = false; |
| 767 | } else if (childBottom > layoutEnd) { |
| 768 | clipBottomAmount = (int) (childBottom - layoutEnd); |
| 769 | } |
| 770 | |
| 771 | boolean isVisible = child.getVisibility() == VISIBLE; |
| 772 | if (visible != isVisible) { |
| 773 | child.setVisibility(visible ? VISIBLE : INVISIBLE); |
| 774 | } |
| 775 | |
| 776 | child.setClipBottomAmount(clipBottomAmount); |
| 777 | } |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 778 | } |
| 779 | |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 780 | /** |
| 781 | * This is called when the children expansion has changed and positions the children properly |
| 782 | * for an appear animation. |
| 783 | * |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 784 | */ |
Dave Mankoff | a4d195d | 2018-11-16 13:33:27 -0500 | [diff] [blame] | 785 | public void prepareExpansionChanged() { |
Selim Cinek | 277a8aa | 2016-01-22 12:12:37 -0800 | [diff] [blame] | 786 | // TODO: do something that makes sense, like placing the invisible views correctly |
| 787 | return; |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 788 | } |
| 789 | |
Dave Mankoff | a4d195d | 2018-11-16 13:33:27 -0500 | [diff] [blame] | 790 | /** Animate to a given state. */ |
| 791 | public void startAnimationToState(AnimationProperties properties) { |
Kevin Han | 43077f9 | 2020-02-28 12:51:53 -0800 | [diff] [blame] | 792 | int childCount = mAttachedChildren.size(); |
Selim Cinek | 83bc783 | 2015-10-22 13:26:54 -0700 | [diff] [blame] | 793 | ViewState tmpState = new ViewState(); |
Selim Cinek | f07d062 | 2016-03-21 19:52:52 -0700 | [diff] [blame] | 794 | float expandFraction = getGroupExpandFraction(); |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 795 | final boolean dividersVisible = mUserLocked && !showingAsLowPriority() |
Anthony Chen | 6bf88a0 | 2017-04-10 14:41:44 -0700 | [diff] [blame] | 796 | || (mChildrenExpanded && mShowDividersWhenExpanded) |
| 797 | || (mContainingNotification.isGroupExpansionChanging() |
| 798 | && !mHideDividersDuringExpand); |
Selim Cinek | e812652 | 2015-12-08 21:21:17 -0800 | [diff] [blame] | 799 | for (int i = childCount - 1; i >= 0; i--) { |
Kevin Han | 43077f9 | 2020-02-28 12:51:53 -0800 | [diff] [blame] | 800 | ExpandableNotificationRow child = mAttachedChildren.get(i); |
Dave Mankoff | a4d195d | 2018-11-16 13:33:27 -0500 | [diff] [blame] | 801 | ExpandableViewState viewState = child.getViewState(); |
Selim Cinek | 0cfbef4 | 2016-11-09 19:06:36 -0800 | [diff] [blame] | 802 | viewState.animateTo(child, properties); |
Selim Cinek | 7b83639 | 2015-12-04 20:02:59 -0800 | [diff] [blame] | 803 | |
| 804 | // layout the divider |
| 805 | View divider = mDividers.get(i); |
| 806 | tmpState.initFrom(divider); |
| 807 | tmpState.yTranslation = viewState.yTranslation - mDividerHeight; |
Selim Cinek | 42357e0 | 2016-02-24 18:48:01 -0800 | [diff] [blame] | 808 | float alpha = mChildrenExpanded && viewState.alpha != 0 ? 0.5f : 0; |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 809 | if (mUserLocked && !showingAsLowPriority() && viewState.alpha != 0) { |
Selim Cinek | f07d062 | 2016-03-21 19:52:52 -0700 | [diff] [blame] | 810 | alpha = NotificationUtils.interpolate(0, 0.5f, |
| 811 | Math.min(viewState.alpha, expandFraction)); |
Selim Cinek | 42357e0 | 2016-02-24 18:48:01 -0800 | [diff] [blame] | 812 | } |
Mady Mellor | b0a8246 | 2016-04-30 17:31:02 -0700 | [diff] [blame] | 813 | tmpState.hidden = !dividersVisible; |
Selim Cinek | 42357e0 | 2016-02-24 18:48:01 -0800 | [diff] [blame] | 814 | tmpState.alpha = alpha; |
Selim Cinek | 0cfbef4 | 2016-11-09 19:06:36 -0800 | [diff] [blame] | 815 | tmpState.animateTo(divider, properties); |
Selim Cinek | d9a3f8f | 2016-03-17 19:39:00 -0700 | [diff] [blame] | 816 | // There is no fake shadow to be drawn on the children |
| 817 | child.setFakeShadowIntensity(0.0f, 0.0f, 0, 0); |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 818 | } |
Selim Cinek | c897bd3 | 2016-03-18 17:32:31 -0700 | [diff] [blame] | 819 | if (mOverflowNumber != null) { |
| 820 | if (mNeverAppliedGroupState) { |
| 821 | float alpha = mGroupOverFlowState.alpha; |
| 822 | mGroupOverFlowState.alpha = 0; |
Selim Cinek | bbcebde | 2016-11-09 18:28:20 -0800 | [diff] [blame] | 823 | mGroupOverFlowState.applyToView(mOverflowNumber); |
Selim Cinek | c897bd3 | 2016-03-18 17:32:31 -0700 | [diff] [blame] | 824 | mGroupOverFlowState.alpha = alpha; |
| 825 | mNeverAppliedGroupState = false; |
| 826 | } |
Selim Cinek | 0cfbef4 | 2016-11-09 19:06:36 -0800 | [diff] [blame] | 827 | mGroupOverFlowState.animateTo(mOverflowNumber, properties); |
Selim Cinek | c897bd3 | 2016-03-18 17:32:31 -0700 | [diff] [blame] | 828 | } |
Mady Mellor | b0a8246 | 2016-04-30 17:31:02 -0700 | [diff] [blame] | 829 | if (mNotificationHeader != null) { |
Selim Cinek | bbcebde | 2016-11-09 18:28:20 -0800 | [diff] [blame] | 830 | mHeaderViewState.applyToView(mNotificationHeader); |
Mady Mellor | b0a8246 | 2016-04-30 17:31:02 -0700 | [diff] [blame] | 831 | } |
Selim Cinek | b3dadcc | 2016-11-21 17:21:13 -0800 | [diff] [blame] | 832 | updateChildrenClipping(); |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 833 | } |
| 834 | |
| 835 | public ExpandableNotificationRow getViewAtPosition(float y) { |
| 836 | // find the view under the pointer, accounting for GONE views |
Kevin Han | 43077f9 | 2020-02-28 12:51:53 -0800 | [diff] [blame] | 837 | final int count = mAttachedChildren.size(); |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 838 | for (int childIdx = 0; childIdx < count; childIdx++) { |
Kevin Han | 43077f9 | 2020-02-28 12:51:53 -0800 | [diff] [blame] | 839 | ExpandableNotificationRow slidingChild = mAttachedChildren.get(childIdx); |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 840 | float childTop = slidingChild.getTranslationY(); |
| 841 | float top = childTop + slidingChild.getClipTopAmount(); |
| 842 | float bottom = childTop + slidingChild.getActualHeight(); |
| 843 | if (y >= top && y <= bottom) { |
| 844 | return slidingChild; |
| 845 | } |
| 846 | } |
| 847 | return null; |
| 848 | } |
| 849 | |
Selim Cinek | 83bc783 | 2015-10-22 13:26:54 -0700 | [diff] [blame] | 850 | public void setChildrenExpanded(boolean childrenExpanded) { |
| 851 | mChildrenExpanded = childrenExpanded; |
Selim Cinek | 898d173 | 2016-02-29 19:57:35 -0800 | [diff] [blame] | 852 | updateExpansionStates(); |
Mady Mellor | b0a8246 | 2016-04-30 17:31:02 -0700 | [diff] [blame] | 853 | if (mNotificationHeader != null) { |
| 854 | mNotificationHeader.setExpanded(childrenExpanded); |
| 855 | } |
Kevin Han | 43077f9 | 2020-02-28 12:51:53 -0800 | [diff] [blame] | 856 | final int count = mAttachedChildren.size(); |
Selim Cinek | ddf1b39 | 2016-05-27 16:33:10 -0700 | [diff] [blame] | 857 | for (int childIdx = 0; childIdx < count; childIdx++) { |
Kevin Han | 43077f9 | 2020-02-28 12:51:53 -0800 | [diff] [blame] | 858 | ExpandableNotificationRow child = mAttachedChildren.get(childIdx); |
Selim Cinek | ddf1b39 | 2016-05-27 16:33:10 -0700 | [diff] [blame] | 859 | child.setChildrenExpanded(childrenExpanded, false); |
| 860 | } |
Selim Cinek | bc34215 | 2018-12-05 18:45:42 -0800 | [diff] [blame] | 861 | updateHeaderTouchability(); |
Selim Cinek | 83bc783 | 2015-10-22 13:26:54 -0700 | [diff] [blame] | 862 | } |
| 863 | |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 864 | public void setContainingNotification(ExpandableNotificationRow parent) { |
| 865 | mContainingNotification = parent; |
| 866 | mHeaderUtil = new NotificationHeaderUtil(mContainingNotification); |
Mady Mellor | b0a8246 | 2016-04-30 17:31:02 -0700 | [diff] [blame] | 867 | } |
| 868 | |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 869 | public ExpandableNotificationRow getContainingNotification() { |
| 870 | return mContainingNotification; |
Adrian Roos | 4a57967 | 2016-05-24 16:54:37 -0700 | [diff] [blame] | 871 | } |
| 872 | |
Mady Mellor | b0a8246 | 2016-04-30 17:31:02 -0700 | [diff] [blame] | 873 | public NotificationHeaderView getHeaderView() { |
| 874 | return mNotificationHeader; |
| 875 | } |
| 876 | |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 877 | public NotificationHeaderView getLowPriorityHeaderView() { |
| 878 | return mNotificationHeaderLowPriority; |
| 879 | } |
| 880 | |
Lucas Dupin | 6ea2787 | 2017-05-30 12:00:04 -0700 | [diff] [blame] | 881 | @VisibleForTesting |
| 882 | public ViewGroup getCurrentHeaderView() { |
| 883 | return mCurrentHeader; |
| 884 | } |
| 885 | |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 886 | private void updateHeaderVisibility(boolean animate) { |
Adrian Roos | 6f6e159 | 2017-05-02 16:22:53 -0700 | [diff] [blame] | 887 | ViewGroup desiredHeader; |
| 888 | ViewGroup currentHeader = mCurrentHeader; |
| 889 | desiredHeader = calculateDesiredHeader(); |
| 890 | |
| 891 | if (currentHeader == desiredHeader) { |
| 892 | return; |
Mady Mellor | b0a8246 | 2016-04-30 17:31:02 -0700 | [diff] [blame] | 893 | } |
Adrian Roos | 6f6e159 | 2017-05-02 16:22:53 -0700 | [diff] [blame] | 894 | |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 895 | if (animate) { |
Adrian Roos | 6f6e159 | 2017-05-02 16:22:53 -0700 | [diff] [blame] | 896 | if (desiredHeader != null && currentHeader != null) { |
| 897 | currentHeader.setVisibility(VISIBLE); |
| 898 | desiredHeader.setVisibility(VISIBLE); |
| 899 | NotificationViewWrapper visibleWrapper = getWrapperForView(desiredHeader); |
| 900 | NotificationViewWrapper hiddenWrapper = getWrapperForView(currentHeader); |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 901 | visibleWrapper.transformFrom(hiddenWrapper); |
| 902 | hiddenWrapper.transformTo(visibleWrapper, () -> updateHeaderVisibility(false)); |
Adrian Roos | 6f6e159 | 2017-05-02 16:22:53 -0700 | [diff] [blame] | 903 | startChildAlphaAnimations(desiredHeader == mNotificationHeader); |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 904 | } else { |
| 905 | animate = false; |
| 906 | } |
| 907 | } |
| 908 | if (!animate) { |
Adrian Roos | 6f6e159 | 2017-05-02 16:22:53 -0700 | [diff] [blame] | 909 | if (desiredHeader != null) { |
| 910 | getWrapperForView(desiredHeader).setVisible(true); |
| 911 | desiredHeader.setVisibility(VISIBLE); |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 912 | } |
Adrian Roos | 6f6e159 | 2017-05-02 16:22:53 -0700 | [diff] [blame] | 913 | if (currentHeader != null) { |
Lucas Dupin | 6ea2787 | 2017-05-30 12:00:04 -0700 | [diff] [blame] | 914 | // Wrapper can be null if we were a low priority notification |
| 915 | // and just destroyed it by calling setIsLowPriority(false) |
| 916 | NotificationViewWrapper wrapper = getWrapperForView(currentHeader); |
| 917 | if (wrapper != null) { |
| 918 | wrapper.setVisible(false); |
| 919 | } |
Adrian Roos | 6f6e159 | 2017-05-02 16:22:53 -0700 | [diff] [blame] | 920 | currentHeader.setVisibility(INVISIBLE); |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 921 | } |
| 922 | } |
Adrian Roos | 6f6e159 | 2017-05-02 16:22:53 -0700 | [diff] [blame] | 923 | |
| 924 | resetHeaderVisibilityIfNeeded(mNotificationHeader, desiredHeader); |
Adrian Roos | 6f6e159 | 2017-05-02 16:22:53 -0700 | [diff] [blame] | 925 | resetHeaderVisibilityIfNeeded(mNotificationHeaderLowPriority, desiredHeader); |
| 926 | |
Lucas Dupin | 6ea2787 | 2017-05-30 12:00:04 -0700 | [diff] [blame] | 927 | mCurrentHeader = desiredHeader; |
Adrian Roos | 6f6e159 | 2017-05-02 16:22:53 -0700 | [diff] [blame] | 928 | } |
| 929 | |
| 930 | private void resetHeaderVisibilityIfNeeded(View header, View desiredHeader) { |
| 931 | if (header == null) { |
| 932 | return; |
| 933 | } |
| 934 | if (header != mCurrentHeader && header != desiredHeader) { |
| 935 | getWrapperForView(header).setVisible(false); |
| 936 | header.setVisibility(INVISIBLE); |
| 937 | } |
| 938 | if (header == desiredHeader && header.getVisibility() != VISIBLE) { |
| 939 | getWrapperForView(header).setVisible(true); |
| 940 | header.setVisibility(VISIBLE); |
| 941 | } |
| 942 | } |
| 943 | |
| 944 | private ViewGroup calculateDesiredHeader() { |
| 945 | ViewGroup desiredHeader; |
Selim Cinek | 7927c73 | 2019-03-06 15:21:39 -0800 | [diff] [blame] | 946 | if (showingAsLowPriority()) { |
Adrian Roos | 6f6e159 | 2017-05-02 16:22:53 -0700 | [diff] [blame] | 947 | desiredHeader = mNotificationHeaderLowPriority; |
| 948 | } else { |
| 949 | desiredHeader = mNotificationHeader; |
| 950 | } |
| 951 | return desiredHeader; |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 952 | } |
| 953 | |
| 954 | private void startChildAlphaAnimations(boolean toVisible) { |
| 955 | float target = toVisible ? 1.0f : 0.0f; |
| 956 | float start = 1.0f - target; |
Kevin Han | 43077f9 | 2020-02-28 12:51:53 -0800 | [diff] [blame] | 957 | int childCount = mAttachedChildren.size(); |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 958 | for (int i = 0; i < childCount; i++) { |
| 959 | if (i >= NUMBER_OF_CHILDREN_WHEN_SYSTEM_EXPANDED) { |
| 960 | break; |
| 961 | } |
Kevin Han | 43077f9 | 2020-02-28 12:51:53 -0800 | [diff] [blame] | 962 | ExpandableNotificationRow child = mAttachedChildren.get(i); |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 963 | child.setAlpha(start); |
| 964 | ViewState viewState = new ViewState(); |
| 965 | viewState.initFrom(child); |
| 966 | viewState.alpha = target; |
| 967 | ALPHA_FADE_IN.setDelay(i * 50); |
| 968 | viewState.animateTo(child, ALPHA_FADE_IN); |
| 969 | } |
| 970 | } |
| 971 | |
| 972 | |
| 973 | private void updateHeaderTransformation() { |
Selim Cinek | 1826d98 | 2017-03-06 20:47:37 -0800 | [diff] [blame] | 974 | if (mUserLocked && showingAsLowPriority()) { |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 975 | float fraction = getGroupExpandFraction(); |
| 976 | mNotificationHeaderWrapper.transformFrom(mNotificationHeaderWrapperLowPriority, |
| 977 | fraction); |
| 978 | mNotificationHeader.setVisibility(VISIBLE); |
| 979 | mNotificationHeaderWrapperLowPriority.transformTo(mNotificationHeaderWrapper, |
| 980 | fraction); |
| 981 | } |
| 982 | |
| 983 | } |
| 984 | |
Adrian Roos | 6f6e159 | 2017-05-02 16:22:53 -0700 | [diff] [blame] | 985 | private NotificationViewWrapper getWrapperForView(View visibleHeader) { |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 986 | if (visibleHeader == mNotificationHeader) { |
| 987 | return mNotificationHeaderWrapper; |
| 988 | } |
| 989 | return mNotificationHeaderWrapperLowPriority; |
Mady Mellor | b0a8246 | 2016-04-30 17:31:02 -0700 | [diff] [blame] | 990 | } |
| 991 | |
| 992 | /** |
| 993 | * Called when a groups expansion changes to adjust the background of the header view. |
| 994 | * |
| 995 | * @param expanded whether the group is expanded. |
| 996 | */ |
| 997 | public void updateHeaderForExpansion(boolean expanded) { |
| 998 | if (mNotificationHeader != null) { |
| 999 | if (expanded) { |
| 1000 | ColorDrawable cd = new ColorDrawable(); |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 1001 | cd.setColor(mContainingNotification.calculateBgColor()); |
Mady Mellor | b0a8246 | 2016-04-30 17:31:02 -0700 | [diff] [blame] | 1002 | mNotificationHeader.setHeaderBackgroundDrawable(cd); |
| 1003 | } else { |
| 1004 | mNotificationHeader.setHeaderBackgroundDrawable(null); |
| 1005 | } |
| 1006 | } |
Selim Cinek | 388df6d | 2015-10-22 13:25:11 -0700 | [diff] [blame] | 1007 | } |
| 1008 | |
Selim Cinek | 83bc783 | 2015-10-22 13:26:54 -0700 | [diff] [blame] | 1009 | public int getMaxContentHeight() { |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 1010 | if (showingAsLowPriority()) { |
| 1011 | return getMinHeight(NUMBER_OF_CHILDREN_WHEN_SYSTEM_EXPANDED, true |
| 1012 | /* likeHighPriority */); |
| 1013 | } |
Selim Cinek | aa9db1f | 2018-02-27 17:35:47 -0800 | [diff] [blame] | 1014 | int maxContentHeight = mNotificationHeaderMargin + mCurrentHeaderTranslation |
| 1015 | + mNotificatonTopPadding; |
Selim Cinek | 42357e0 | 2016-02-24 18:48:01 -0800 | [diff] [blame] | 1016 | int visibleChildren = 0; |
Kevin Han | 43077f9 | 2020-02-28 12:51:53 -0800 | [diff] [blame] | 1017 | int childCount = mAttachedChildren.size(); |
Selim Cinek | 42357e0 | 2016-02-24 18:48:01 -0800 | [diff] [blame] | 1018 | for (int i = 0; i < childCount; i++) { |
| 1019 | if (visibleChildren >= NUMBER_OF_CHILDREN_WHEN_CHILDREN_EXPANDED) { |
| 1020 | break; |
| 1021 | } |
Kevin Han | 43077f9 | 2020-02-28 12:51:53 -0800 | [diff] [blame] | 1022 | ExpandableNotificationRow child = mAttachedChildren.get(i); |
Selim Cinek | e81b82b | 2016-03-04 11:22:28 -0800 | [diff] [blame] | 1023 | float childHeight = child.isExpanded(true /* allowOnKeyguard */) |
Selim Cinek | 42357e0 | 2016-02-24 18:48:01 -0800 | [diff] [blame] | 1024 | ? child.getMaxExpandHeight() |
| 1025 | : child.getShowingLayout().getMinHeight(true /* likeGroupExpanded */); |
| 1026 | maxContentHeight += childHeight; |
| 1027 | visibleChildren++; |
| 1028 | } |
| 1029 | if (visibleChildren > 0) { |
| 1030 | maxContentHeight += visibleChildren * mDividerHeight; |
| 1031 | } |
| 1032 | return maxContentHeight; |
| 1033 | } |
| 1034 | |
| 1035 | public void setActualHeight(int actualHeight) { |
| 1036 | if (!mUserLocked) { |
| 1037 | return; |
| 1038 | } |
| 1039 | mActualHeight = actualHeight; |
Selim Cinek | f07d062 | 2016-03-21 19:52:52 -0700 | [diff] [blame] | 1040 | float fraction = getGroupExpandFraction(); |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 1041 | boolean showingLowPriority = showingAsLowPriority(); |
| 1042 | updateHeaderTransformation(); |
Selim Cinek | f07d062 | 2016-03-21 19:52:52 -0700 | [diff] [blame] | 1043 | int maxAllowedVisibleChildren = getMaxAllowedVisibleChildren(true /* forceCollapsed */); |
Kevin Han | 43077f9 | 2020-02-28 12:51:53 -0800 | [diff] [blame] | 1044 | int childCount = mAttachedChildren.size(); |
Selim Cinek | 42357e0 | 2016-02-24 18:48:01 -0800 | [diff] [blame] | 1045 | for (int i = 0; i < childCount; i++) { |
Kevin Han | 43077f9 | 2020-02-28 12:51:53 -0800 | [diff] [blame] | 1046 | ExpandableNotificationRow child = mAttachedChildren.get(i); |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 1047 | float childHeight; |
| 1048 | if (showingLowPriority) { |
| 1049 | childHeight = child.getShowingLayout().getMinHeight(false /* likeGroupExpanded */); |
| 1050 | } else if (child.isExpanded(true /* allowOnKeyguard */)) { |
| 1051 | childHeight = child.getMaxExpandHeight(); |
| 1052 | } else { |
| 1053 | childHeight = child.getShowingLayout().getMinHeight( |
| 1054 | true /* likeGroupExpanded */); |
| 1055 | } |
Selim Cinek | f07d062 | 2016-03-21 19:52:52 -0700 | [diff] [blame] | 1056 | if (i < maxAllowedVisibleChildren) { |
| 1057 | float singleLineHeight = child.getShowingLayout().getMinHeight( |
| 1058 | false /* likeGroupExpanded */); |
| 1059 | child.setActualHeight((int) NotificationUtils.interpolate(singleLineHeight, |
| 1060 | childHeight, fraction), false); |
| 1061 | } else { |
| 1062 | child.setActualHeight((int) childHeight, false); |
| 1063 | } |
Selim Cinek | 42357e0 | 2016-02-24 18:48:01 -0800 | [diff] [blame] | 1064 | } |
| 1065 | } |
| 1066 | |
Selim Cinek | f07d062 | 2016-03-21 19:52:52 -0700 | [diff] [blame] | 1067 | public float getGroupExpandFraction() { |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 1068 | int visibleChildrenExpandedHeight = showingAsLowPriority() ? getMaxContentHeight() |
| 1069 | : getVisibleChildrenExpandHeight(); |
Selim Cinek | 567e845 | 2016-03-24 10:54:56 -0700 | [diff] [blame] | 1070 | int minExpandHeight = getCollapsedHeight(); |
Selim Cinek | f07d062 | 2016-03-21 19:52:52 -0700 | [diff] [blame] | 1071 | float factor = (mActualHeight - minExpandHeight) |
| 1072 | / (float) (visibleChildrenExpandedHeight - minExpandHeight); |
Selim Cinek | 42357e0 | 2016-02-24 18:48:01 -0800 | [diff] [blame] | 1073 | return Math.max(0.0f, Math.min(1.0f, factor)); |
| 1074 | } |
| 1075 | |
Selim Cinek | f07d062 | 2016-03-21 19:52:52 -0700 | [diff] [blame] | 1076 | private int getVisibleChildrenExpandHeight() { |
Selim Cinek | aa9db1f | 2018-02-27 17:35:47 -0800 | [diff] [blame] | 1077 | int intrinsicHeight = mNotificationHeaderMargin + mCurrentHeaderTranslation |
| 1078 | + mNotificatonTopPadding + mDividerHeight; |
Selim Cinek | 42357e0 | 2016-02-24 18:48:01 -0800 | [diff] [blame] | 1079 | int visibleChildren = 0; |
Kevin Han | 43077f9 | 2020-02-28 12:51:53 -0800 | [diff] [blame] | 1080 | int childCount = mAttachedChildren.size(); |
Selim Cinek | f07d062 | 2016-03-21 19:52:52 -0700 | [diff] [blame] | 1081 | int maxAllowedVisibleChildren = getMaxAllowedVisibleChildren(true /* forceCollapsed */); |
Selim Cinek | 42357e0 | 2016-02-24 18:48:01 -0800 | [diff] [blame] | 1082 | for (int i = 0; i < childCount; i++) { |
Selim Cinek | f07d062 | 2016-03-21 19:52:52 -0700 | [diff] [blame] | 1083 | if (visibleChildren >= maxAllowedVisibleChildren) { |
Selim Cinek | 42357e0 | 2016-02-24 18:48:01 -0800 | [diff] [blame] | 1084 | break; |
| 1085 | } |
Kevin Han | 43077f9 | 2020-02-28 12:51:53 -0800 | [diff] [blame] | 1086 | ExpandableNotificationRow child = mAttachedChildren.get(i); |
Selim Cinek | f07d062 | 2016-03-21 19:52:52 -0700 | [diff] [blame] | 1087 | float childHeight = child.isExpanded(true /* allowOnKeyguard */) |
| 1088 | ? child.getMaxExpandHeight() |
| 1089 | : child.getShowingLayout().getMinHeight(true /* likeGroupExpanded */); |
| 1090 | intrinsicHeight += childHeight; |
Selim Cinek | 42357e0 | 2016-02-24 18:48:01 -0800 | [diff] [blame] | 1091 | visibleChildren++; |
| 1092 | } |
Selim Cinek | 42357e0 | 2016-02-24 18:48:01 -0800 | [diff] [blame] | 1093 | return intrinsicHeight; |
Selim Cinek | 83bc783 | 2015-10-22 13:26:54 -0700 | [diff] [blame] | 1094 | } |
| 1095 | |
| 1096 | public int getMinHeight() { |
Selim Cinek | 7927c73 | 2019-03-06 15:21:39 -0800 | [diff] [blame] | 1097 | return getMinHeight(NUMBER_OF_CHILDREN_WHEN_COLLAPSED, false /* likeHighPriority */); |
Selim Cinek | b55386d | 2015-12-16 17:26:49 -0800 | [diff] [blame] | 1098 | } |
| 1099 | |
Selim Cinek | 567e845 | 2016-03-24 10:54:56 -0700 | [diff] [blame] | 1100 | public int getCollapsedHeight() { |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 1101 | return getMinHeight(getMaxAllowedVisibleChildren(true /* forceCollapsed */), |
| 1102 | false /* likeHighPriority */); |
Selim Cinek | 567e845 | 2016-03-24 10:54:56 -0700 | [diff] [blame] | 1103 | } |
| 1104 | |
Selim Cinek | c7e4cb5 | 2019-06-20 15:41:45 -0700 | [diff] [blame] | 1105 | public int getCollapsedHeightWithoutHeader() { |
| 1106 | return getMinHeight(getMaxAllowedVisibleChildren(true /* forceCollapsed */), |
| 1107 | false /* likeHighPriority */, 0); |
| 1108 | } |
| 1109 | |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 1110 | /** |
| 1111 | * Get the minimum Height for this group. |
| 1112 | * |
| 1113 | * @param maxAllowedVisibleChildren the number of children that should be visible |
| 1114 | * @param likeHighPriority if the height should be calculated as if it were not low priority |
| 1115 | */ |
| 1116 | private int getMinHeight(int maxAllowedVisibleChildren, boolean likeHighPriority) { |
Selim Cinek | c7e4cb5 | 2019-06-20 15:41:45 -0700 | [diff] [blame] | 1117 | return getMinHeight(maxAllowedVisibleChildren, likeHighPriority, mCurrentHeaderTranslation); |
| 1118 | } |
| 1119 | |
| 1120 | /** |
| 1121 | * Get the minimum Height for this group. |
| 1122 | * |
| 1123 | * @param maxAllowedVisibleChildren the number of children that should be visible |
| 1124 | * @param likeHighPriority if the height should be calculated as if it were not low priority |
| 1125 | * @param headerTranslation the translation amount of the header |
| 1126 | */ |
| 1127 | private int getMinHeight(int maxAllowedVisibleChildren, boolean likeHighPriority, |
| 1128 | int headerTranslation) { |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 1129 | if (!likeHighPriority && showingAsLowPriority()) { |
| 1130 | return mNotificationHeaderLowPriority.getHeight(); |
Selim Cinek | 6743c0b | 2017-01-18 18:24:01 -0800 | [diff] [blame] | 1131 | } |
Selim Cinek | c7e4cb5 | 2019-06-20 15:41:45 -0700 | [diff] [blame] | 1132 | int minExpandHeight = mNotificationHeaderMargin + headerTranslation; |
Selim Cinek | 2c58461 | 2016-02-29 16:14:25 -0800 | [diff] [blame] | 1133 | int visibleChildren = 0; |
| 1134 | boolean firstChild = true; |
Kevin Han | 43077f9 | 2020-02-28 12:51:53 -0800 | [diff] [blame] | 1135 | int childCount = mAttachedChildren.size(); |
Selim Cinek | 2c58461 | 2016-02-29 16:14:25 -0800 | [diff] [blame] | 1136 | for (int i = 0; i < childCount; i++) { |
| 1137 | if (visibleChildren >= maxAllowedVisibleChildren) { |
| 1138 | break; |
| 1139 | } |
| 1140 | if (!firstChild) { |
| 1141 | minExpandHeight += mChildPadding; |
| 1142 | } else { |
| 1143 | firstChild = false; |
| 1144 | } |
Kevin Han | 43077f9 | 2020-02-28 12:51:53 -0800 | [diff] [blame] | 1145 | ExpandableNotificationRow child = mAttachedChildren.get(i); |
Selim Cinek | f1f270a | 2016-04-05 19:02:37 -0700 | [diff] [blame] | 1146 | minExpandHeight += child.getSingleLineView().getHeight(); |
Selim Cinek | 2c58461 | 2016-02-29 16:14:25 -0800 | [diff] [blame] | 1147 | visibleChildren++; |
| 1148 | } |
| 1149 | minExpandHeight += mCollapsedBottompadding; |
| 1150 | return minExpandHeight; |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 1151 | } |
Selim Cinek | 9c7712d | 2015-12-08 19:19:48 -0800 | [diff] [blame] | 1152 | |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 1153 | public boolean showingAsLowPriority() { |
| 1154 | return mIsLowPriority && !mContainingNotification.isExpanded(); |
| 1155 | } |
| 1156 | |
Mady Mellor | b0a8246 | 2016-04-30 17:31:02 -0700 | [diff] [blame] | 1157 | public void reInflateViews(OnClickListener listener, StatusBarNotification notification) { |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 1158 | if (mNotificationHeader != null) { |
| 1159 | removeView(mNotificationHeader); |
| 1160 | mNotificationHeader = null; |
| 1161 | } |
| 1162 | if (mNotificationHeaderLowPriority != null) { |
| 1163 | removeView(mNotificationHeaderLowPriority); |
| 1164 | mNotificationHeaderLowPriority = null; |
| 1165 | } |
Steve Elliott | 936df15 | 2020-04-14 13:59:53 -0400 | [diff] [blame] | 1166 | recreateNotificationHeader(listener, mIsConversation); |
Selim Cinek | 01af334 | 2016-02-09 19:25:31 -0800 | [diff] [blame] | 1167 | initDimens(); |
| 1168 | for (int i = 0; i < mDividers.size(); i++) { |
| 1169 | View prevDivider = mDividers.get(i); |
| 1170 | int index = indexOfChild(prevDivider); |
| 1171 | removeView(prevDivider); |
| 1172 | View divider = inflateDivider(); |
| 1173 | addView(divider, index); |
| 1174 | mDividers.set(i, divider); |
| 1175 | } |
Selim Cinek | 4bb5934 | 2016-04-08 19:29:35 -0700 | [diff] [blame] | 1176 | removeView(mOverflowNumber); |
| 1177 | mOverflowNumber = null; |
Selim Cinek | 4bb5934 | 2016-04-08 19:29:35 -0700 | [diff] [blame] | 1178 | mGroupOverFlowState = null; |
| 1179 | updateGroupOverflow(); |
Selim Cinek | 01af334 | 2016-02-09 19:25:31 -0800 | [diff] [blame] | 1180 | } |
Selim Cinek | 42357e0 | 2016-02-24 18:48:01 -0800 | [diff] [blame] | 1181 | |
| 1182 | public void setUserLocked(boolean userLocked) { |
| 1183 | mUserLocked = userLocked; |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 1184 | if (!mUserLocked) { |
| 1185 | updateHeaderVisibility(false /* animate */); |
| 1186 | } |
Kevin Han | 43077f9 | 2020-02-28 12:51:53 -0800 | [diff] [blame] | 1187 | int childCount = mAttachedChildren.size(); |
Selim Cinek | 42357e0 | 2016-02-24 18:48:01 -0800 | [diff] [blame] | 1188 | for (int i = 0; i < childCount; i++) { |
Kevin Han | 43077f9 | 2020-02-28 12:51:53 -0800 | [diff] [blame] | 1189 | ExpandableNotificationRow child = mAttachedChildren.get(i); |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 1190 | child.setUserLocked(userLocked && !showingAsLowPriority()); |
Selim Cinek | 42357e0 | 2016-02-24 18:48:01 -0800 | [diff] [blame] | 1191 | } |
Selim Cinek | bc34215 | 2018-12-05 18:45:42 -0800 | [diff] [blame] | 1192 | updateHeaderTouchability(); |
| 1193 | } |
| 1194 | |
| 1195 | private void updateHeaderTouchability() { |
| 1196 | if (mNotificationHeader != null) { |
| 1197 | mNotificationHeader.setAcceptAllTouches(mChildrenExpanded || mUserLocked); |
| 1198 | } |
Selim Cinek | 42357e0 | 2016-02-24 18:48:01 -0800 | [diff] [blame] | 1199 | } |
Selim Cinek | c897bd3 | 2016-03-18 17:32:31 -0700 | [diff] [blame] | 1200 | |
| 1201 | public void onNotificationUpdated() { |
| 1202 | mHybridGroupManager.setOverflowNumberColor(mOverflowNumber, |
Lucas Dupin | 00be88f | 2019-01-03 17:50:52 -0800 | [diff] [blame] | 1203 | mContainingNotification.getNotificationColor()); |
Selim Cinek | c897bd3 | 2016-03-18 17:32:31 -0700 | [diff] [blame] | 1204 | } |
Adrian Roos | d009ab1 | 2016-05-20 17:58:53 -0700 | [diff] [blame] | 1205 | |
Adrian Roos | 4a57967 | 2016-05-24 16:54:37 -0700 | [diff] [blame] | 1206 | public int getPositionInLinearLayout(View childInGroup) { |
Selim Cinek | aa9db1f | 2018-02-27 17:35:47 -0800 | [diff] [blame] | 1207 | int position = mNotificationHeaderMargin + mCurrentHeaderTranslation |
| 1208 | + mNotificatonTopPadding; |
Adrian Roos | 4a57967 | 2016-05-24 16:54:37 -0700 | [diff] [blame] | 1209 | |
Kevin Han | 43077f9 | 2020-02-28 12:51:53 -0800 | [diff] [blame] | 1210 | for (int i = 0; i < mAttachedChildren.size(); i++) { |
| 1211 | ExpandableNotificationRow child = mAttachedChildren.get(i); |
Adrian Roos | 4a57967 | 2016-05-24 16:54:37 -0700 | [diff] [blame] | 1212 | boolean notGone = child.getVisibility() != View.GONE; |
| 1213 | if (notGone) { |
| 1214 | position += mDividerHeight; |
| 1215 | } |
| 1216 | if (child == childInGroup) { |
| 1217 | return position; |
| 1218 | } |
| 1219 | if (notGone) { |
| 1220 | position += child.getIntrinsicHeight(); |
| 1221 | } |
| 1222 | } |
| 1223 | return 0; |
| 1224 | } |
Selim Cinek | 0242fbb | 2016-10-19 13:38:32 -0700 | [diff] [blame] | 1225 | |
Selim Cinek | 9ed6e04 | 2020-03-26 15:45:51 -0700 | [diff] [blame] | 1226 | public void setShelfIconVisible(boolean iconVisible) { |
Selim Cinek | 0242fbb | 2016-10-19 13:38:32 -0700 | [diff] [blame] | 1227 | if (mNotificationHeaderWrapper != null) { |
| 1228 | NotificationHeaderView header = mNotificationHeaderWrapper.getNotificationHeader(); |
| 1229 | if (header != null) { |
Selim Cinek | 9ed6e04 | 2020-03-26 15:45:51 -0700 | [diff] [blame] | 1230 | header.getIcon().setForceHidden(iconVisible); |
Selim Cinek | 0242fbb | 2016-10-19 13:38:32 -0700 | [diff] [blame] | 1231 | } |
| 1232 | } |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 1233 | if (mNotificationHeaderWrapperLowPriority != null) { |
| 1234 | NotificationHeaderView header |
| 1235 | = mNotificationHeaderWrapperLowPriority.getNotificationHeader(); |
| 1236 | if (header != null) { |
Selim Cinek | 9ed6e04 | 2020-03-26 15:45:51 -0700 | [diff] [blame] | 1237 | header.getIcon().setForceHidden(iconVisible); |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 1238 | } |
| 1239 | } |
Selim Cinek | 0242fbb | 2016-10-19 13:38:32 -0700 | [diff] [blame] | 1240 | } |
Selim Cinek | b3dadcc | 2016-11-21 17:21:13 -0800 | [diff] [blame] | 1241 | |
| 1242 | public void setClipBottomAmount(int clipBottomAmount) { |
| 1243 | mClipBottomAmount = clipBottomAmount; |
| 1244 | updateChildrenClipping(); |
| 1245 | } |
Selim Cinek | 6743c0b | 2017-01-18 18:24:01 -0800 | [diff] [blame] | 1246 | |
| 1247 | public void setIsLowPriority(boolean isLowPriority) { |
| 1248 | mIsLowPriority = isLowPriority; |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 1249 | if (mContainingNotification != null) { /* we're not yet set up yet otherwise */ |
Steve Elliott | 936df15 | 2020-04-14 13:59:53 -0400 | [diff] [blame] | 1250 | recreateLowPriorityHeader(null /* existingBuilder */, mIsConversation); |
Selim Cinek | 414ad33 | 2017-02-24 19:06:12 -0800 | [diff] [blame] | 1251 | updateHeaderVisibility(false /* animate */); |
| 1252 | } |
| 1253 | if (mUserLocked) { |
| 1254 | setUserLocked(mUserLocked); |
| 1255 | } |
| 1256 | } |
| 1257 | |
| 1258 | public NotificationHeaderView getVisibleHeader() { |
| 1259 | NotificationHeaderView header = mNotificationHeader; |
| 1260 | if (showingAsLowPriority()) { |
| 1261 | header = mNotificationHeaderLowPriority; |
| 1262 | } |
| 1263 | return header; |
| 1264 | } |
| 1265 | |
| 1266 | public void onExpansionChanged() { |
| 1267 | if (mIsLowPriority) { |
| 1268 | if (mUserLocked) { |
| 1269 | setUserLocked(mUserLocked); |
| 1270 | } |
| 1271 | updateHeaderVisibility(true /* animate */); |
| 1272 | } |
| 1273 | } |
| 1274 | |
| 1275 | public float getIncreasedPaddingAmount() { |
| 1276 | if (showingAsLowPriority()) { |
| 1277 | return 0.0f; |
| 1278 | } |
| 1279 | return getGroupExpandFraction(); |
Selim Cinek | 6743c0b | 2017-01-18 18:24:01 -0800 | [diff] [blame] | 1280 | } |
Selim Cinek | 817abe7 | 2017-05-24 11:08:55 -0700 | [diff] [blame] | 1281 | |
| 1282 | @VisibleForTesting |
| 1283 | public boolean isUserLocked() { |
| 1284 | return mUserLocked; |
| 1285 | } |
Selim Cinek | 2871bef | 2017-11-22 08:40:00 -0800 | [diff] [blame] | 1286 | |
| 1287 | public void setCurrentBottomRoundness(float currentBottomRoundness) { |
| 1288 | boolean last = true; |
Kevin Han | 43077f9 | 2020-02-28 12:51:53 -0800 | [diff] [blame] | 1289 | for (int i = mAttachedChildren.size() - 1; i >= 0; i--) { |
| 1290 | ExpandableNotificationRow child = mAttachedChildren.get(i); |
Selim Cinek | 2871bef | 2017-11-22 08:40:00 -0800 | [diff] [blame] | 1291 | if (child.getVisibility() == View.GONE) { |
| 1292 | continue; |
| 1293 | } |
| 1294 | float bottomRoundness = last ? currentBottomRoundness : 0.0f; |
| 1295 | child.setBottomRoundness(bottomRoundness, isShown() /* animate */); |
| 1296 | last = false; |
| 1297 | } |
| 1298 | } |
Selim Cinek | aa9db1f | 2018-02-27 17:35:47 -0800 | [diff] [blame] | 1299 | |
| 1300 | public void setHeaderVisibleAmount(float headerVisibleAmount) { |
| 1301 | mHeaderVisibleAmount = headerVisibleAmount; |
| 1302 | mCurrentHeaderTranslation = (int) ((1.0f - headerVisibleAmount) * mTranslationForHeader); |
| 1303 | } |
Selim Cinek | 4237e82 | 2020-03-31 17:22:28 -0700 | [diff] [blame] | 1304 | |
| 1305 | /** |
| 1306 | * Show a set of app opp icons in the layout. |
| 1307 | * |
| 1308 | * @param appOps which app ops to show |
| 1309 | */ |
| 1310 | public void showAppOpsIcons(ArraySet<Integer> appOps) { |
| 1311 | if (mNotificationHeaderWrapper != null) { |
| 1312 | mNotificationHeaderWrapper.showAppOpsIcons(appOps); |
| 1313 | } |
| 1314 | if (mNotificationHeaderWrapperLowPriority != null) { |
| 1315 | mNotificationHeaderWrapperLowPriority.showAppOpsIcons(appOps); |
| 1316 | } |
| 1317 | } |
Selim Cinek | a2b1d37 | 2020-03-31 17:54:19 -0700 | [diff] [blame] | 1318 | |
| 1319 | public void setRecentlyAudiblyAlerted(boolean audiblyAlertedRecently) { |
| 1320 | if (mNotificationHeaderWrapper != null) { |
| 1321 | mNotificationHeaderWrapper.setRecentlyAudiblyAlerted(audiblyAlertedRecently); |
| 1322 | } |
| 1323 | if (mNotificationHeaderWrapperLowPriority != null) { |
| 1324 | mNotificationHeaderWrapperLowPriority.setRecentlyAudiblyAlerted(audiblyAlertedRecently); |
| 1325 | } |
| 1326 | } |
Selim Cinek | b5605e5 | 2015-02-20 18:21:41 +0100 | [diff] [blame] | 1327 | } |