blob: 1496a41a9b477ba17a723b553d019181d9d844b8 [file] [log] [blame]
Jorim Jaggibe565df2014-04-28 17:51:23 +02001/*
2 * Copyright (C) 2014 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License
15 */
16
17package com.android.systemui.statusbar;
18
19import android.content.Context;
Selim Cinek471e31a2015-12-11 13:39:48 -080020import android.graphics.Paint;
Selim Cineke32010a2014-08-20 23:50:41 +020021import android.graphics.Rect;
Jorim Jaggibe565df2014-04-28 17:51:23 +020022import android.util.AttributeSet;
23import android.view.View;
Selim Cinekc9c00ae2014-05-20 03:33:40 +020024import android.view.ViewGroup;
Selim Cinek24d7cfa2014-05-20 13:50:57 +020025import android.widget.FrameLayout;
Selim Cinekd84a5932015-12-15 11:45:36 -080026
Selim Cinekbbcebde2016-11-09 18:28:20 -080027import com.android.systemui.statusbar.stack.ExpandableViewState;
Anthony Chen04d1ea72017-04-21 14:30:11 -070028import com.android.systemui.statusbar.stack.NotificationStackScrollLayout;
Selim Cinekbbcebde2016-11-09 18:28:20 -080029import com.android.systemui.statusbar.stack.StackScrollState;
Selim Cinek24d7cfa2014-05-20 13:50:57 +020030
31import java.util.ArrayList;
Jorim Jaggibe565df2014-04-28 17:51:23 +020032
33/**
34 * An abstract view for expandable views.
35 */
Selim Cinek24d7cfa2014-05-20 13:50:57 +020036public abstract class ExpandableView extends FrameLayout {
37
Selim Cinekb5605e52015-02-20 18:21:41 +010038 protected OnHeightChangedListener mOnHeightChangedListener;
Chris Wren310df312014-10-31 14:29:46 -040039 private int mActualHeight;
Jorim Jaggibe565df2014-04-28 17:51:23 +020040 protected int mClipTopAmount;
Selim Cinekb3dadcc2016-11-21 17:21:13 -080041 protected int mClipBottomAmount;
Jorim Jaggi4e857f42014-11-17 19:14:04 +010042 private boolean mDark;
Selim Cinek24d7cfa2014-05-20 13:50:57 +020043 private ArrayList<View> mMatchParentViews = new ArrayList<View>();
Selim Cineka272dfe2015-02-20 18:12:28 +010044 private static Rect mClipRect = new Rect();
Selim Cinek2cd45df2015-06-09 18:00:07 -070045 private boolean mWillBeGone;
Selim Cinek9c17b772015-07-07 20:37:09 -070046 private int mMinClipTopAmount = 0;
Selim Cinek4ffd6362015-12-29 15:12:23 +010047 private boolean mClipToActualHeight = true;
Adrian Roos14503e22016-03-09 14:01:24 -080048 private boolean mChangingPosition = false;
Selim Cinekd1395642016-04-28 12:22:42 -070049 private ViewGroup mTransientContainer;
Selim Cinekeccb5de2016-10-28 15:04:05 -070050 private boolean mInShelf;
51 private boolean mTransformingInShelf;
Jorim Jaggibe565df2014-04-28 17:51:23 +020052
53 public ExpandableView(Context context, AttributeSet attrs) {
54 super(context, attrs);
Selim Cinek24d7cfa2014-05-20 13:50:57 +020055 }
56
57 @Override
58 protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
Selim Cinek471e31a2015-12-11 13:39:48 -080059 final int givenSize = MeasureSpec.getSize(heightMeasureSpec);
Selim Cinekd84a5932015-12-15 11:45:36 -080060 int ownMaxHeight = Integer.MAX_VALUE;
Selim Cinek6f145cf2015-05-18 15:16:08 -070061 int heightMode = MeasureSpec.getMode(heightMeasureSpec);
Selim Cineka69f2a62015-12-11 17:28:12 -080062 if (heightMode != MeasureSpec.UNSPECIFIED && givenSize != 0) {
Selim Cinek471e31a2015-12-11 13:39:48 -080063 ownMaxHeight = Math.min(givenSize, ownMaxHeight);
Selim Cinek6f145cf2015-05-18 15:16:08 -070064 }
Selim Cinek24d7cfa2014-05-20 13:50:57 +020065 int newHeightSpec = MeasureSpec.makeMeasureSpec(ownMaxHeight, MeasureSpec.AT_MOST);
66 int maxChildHeight = 0;
67 int childCount = getChildCount();
68 for (int i = 0; i < childCount; i++) {
69 View child = getChildAt(i);
Selim Cinek263398f2015-10-21 17:40:23 -070070 if (child.getVisibility() == GONE) {
Selim Cinekb5605e52015-02-20 18:21:41 +010071 continue;
72 }
Selim Cinek24d7cfa2014-05-20 13:50:57 +020073 int childHeightSpec = newHeightSpec;
74 ViewGroup.LayoutParams layoutParams = child.getLayoutParams();
75 if (layoutParams.height != ViewGroup.LayoutParams.MATCH_PARENT) {
76 if (layoutParams.height >= 0) {
77 // An actual height is set
Selim Cineka69f2a62015-12-11 17:28:12 -080078 childHeightSpec = layoutParams.height > ownMaxHeight
Selim Cinek24d7cfa2014-05-20 13:50:57 +020079 ? MeasureSpec.makeMeasureSpec(ownMaxHeight, MeasureSpec.EXACTLY)
80 : MeasureSpec.makeMeasureSpec(layoutParams.height, MeasureSpec.EXACTLY);
81 }
Jorim Jaggib741f052014-06-03 19:57:26 +020082 child.measure(
83 getChildMeasureSpec(widthMeasureSpec, 0 /* padding */, layoutParams.width),
84 childHeightSpec);
Selim Cinek24d7cfa2014-05-20 13:50:57 +020085 int childHeight = child.getMeasuredHeight();
86 maxChildHeight = Math.max(maxChildHeight, childHeight);
87 } else {
88 mMatchParentViews.add(child);
89 }
90 }
Selim Cineka69f2a62015-12-11 17:28:12 -080091 int ownHeight = heightMode == MeasureSpec.EXACTLY
92 ? givenSize : Math.min(ownMaxHeight, maxChildHeight);
Selim Cinek24d7cfa2014-05-20 13:50:57 +020093 newHeightSpec = MeasureSpec.makeMeasureSpec(ownHeight, MeasureSpec.EXACTLY);
94 for (View child : mMatchParentViews) {
Jorim Jaggib741f052014-06-03 19:57:26 +020095 child.measure(getChildMeasureSpec(
96 widthMeasureSpec, 0 /* padding */, child.getLayoutParams().width),
97 newHeightSpec);
Selim Cinek24d7cfa2014-05-20 13:50:57 +020098 }
99 mMatchParentViews.clear();
100 int width = MeasureSpec.getSize(widthMeasureSpec);
101 setMeasuredDimension(width, ownHeight);
Jorim Jaggibe565df2014-04-28 17:51:23 +0200102 }
103
104 @Override
Jorim Jaggibe565df2014-04-28 17:51:23 +0200105 protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
Selim Cinek24d7cfa2014-05-20 13:50:57 +0200106 super.onLayout(changed, left, top, right, bottom);
Selim Cinekba67acf2015-04-10 17:00:42 -0700107 updateClipping();
Jorim Jaggibe565df2014-04-28 17:51:23 +0200108 }
109
Jorim Jaggi00ebdfe2014-05-02 17:29:56 +0200110 @Override
Selim Cineka69f2a62015-12-11 17:28:12 -0800111 public boolean pointInView(float localX, float localY, float slop) {
112 float top = mClipTopAmount;
113 float bottom = mActualHeight;
114 return localX >= -slop && localY >= top - slop && localX < ((mRight - mLeft) + slop) &&
115 localY < (bottom + slop);
Jorim Jaggi00ebdfe2014-05-02 17:29:56 +0200116 }
117
Jorim Jaggibe565df2014-04-28 17:51:23 +0200118 /**
119 * Sets the actual height of this notification. This is different than the laid out
120 * {@link View#getHeight()}, as we want to avoid layouting during scrolling and expanding.
Jorim Jaggid552d9d2014-05-07 19:41:13 +0200121 *
122 * @param actualHeight The height of this notification.
123 * @param notifyListeners Whether the listener should be informed about the change.
Jorim Jaggibe565df2014-04-28 17:51:23 +0200124 */
Jorim Jaggid552d9d2014-05-07 19:41:13 +0200125 public void setActualHeight(int actualHeight, boolean notifyListeners) {
Jorim Jaggibe565df2014-04-28 17:51:23 +0200126 mActualHeight = actualHeight;
Selim Cineka272dfe2015-02-20 18:12:28 +0100127 updateClipping();
Jorim Jaggid552d9d2014-05-07 19:41:13 +0200128 if (notifyListeners) {
Selim Cinekb5605e52015-02-20 18:21:41 +0100129 notifyHeightChanged(false /* needsAnimation */);
Jorim Jaggid552d9d2014-05-07 19:41:13 +0200130 }
131 }
132
Selim Cinekb0ee18f2017-12-21 16:15:53 -0800133 /**
134 * Set the distance to the top roundness, from where we should start clipping a value above
135 * or equal to 0 is the effective distance, and if a value below 0 is received, there should
136 * be no clipping.
137 */
138 public void setDistanceToTopRoundness(float distanceToTopRoundness) {
139 }
140
Selim Cinekeef84282015-10-30 16:28:00 -0700141 public void setActualHeight(int actualHeight) {
142 setActualHeight(actualHeight, true /* notifyListeners */);
Jorim Jaggibe565df2014-04-28 17:51:23 +0200143 }
144
145 /**
146 * See {@link #setActualHeight}.
147 *
Jorim Jaggi9cbadd32014-05-01 20:18:31 +0200148 * @return The current actual height of this notification.
Jorim Jaggibe565df2014-04-28 17:51:23 +0200149 */
150 public int getActualHeight() {
151 return mActualHeight;
152 }
153
Selim Cinek2627d722018-01-19 12:16:49 -0800154 public boolean isExpandAnimationRunning() {
155 return false;
156 }
157
Jorim Jaggibe565df2014-04-28 17:51:23 +0200158 /**
159 * @return The maximum height of this notification.
160 */
Selim Cinekb5605e52015-02-20 18:21:41 +0100161 public int getMaxContentHeight() {
Jorim Jaggi4222d9a2014-04-23 16:13:15 +0200162 return getHeight();
163 }
164
165 /**
Selim Cinekeb3fc3d2017-09-15 13:37:14 -0700166 * @return The minimum content height of this notification. This also respects the temporary
167 * states of the view.
Jorim Jaggi4222d9a2014-04-23 16:13:15 +0200168 */
169 public int getMinHeight() {
Selim Cinekeb3fc3d2017-09-15 13:37:14 -0700170 return getMinHeight(false /* ignoreTemporaryStates */);
171 }
172
173 /**
174 * Get the minimum height of this view.
175 *
176 * @param ignoreTemporaryStates should temporary states be ignored like the guts or heads-up.
177 *
178 * @return The minimum height that this view needs.
179 */
180 public int getMinHeight(boolean ignoreTemporaryStates) {
Jorim Jaggi4222d9a2014-04-23 16:13:15 +0200181 return getHeight();
182 }
Jorim Jaggibe565df2014-04-28 17:51:23 +0200183
184 /**
Selim Cinek567e8452016-03-24 10:54:56 -0700185 * @return The collapsed height of this view. Note that this might be different
186 * than {@link #getMinHeight()} because some elements like groups may have different sizes when
187 * they are system expanded.
Selim Cinek816c8e42015-11-19 12:00:45 -0800188 */
Selim Cinek567e8452016-03-24 10:54:56 -0700189 public int getCollapsedHeight() {
Selim Cinek816c8e42015-11-19 12:00:45 -0800190 return getHeight();
191 }
192
193 /**
Jorim Jaggid552d9d2014-05-07 19:41:13 +0200194 * Sets the notification as dimmed. The default implementation does nothing.
195 *
196 * @param dimmed Whether the notification should be dimmed.
197 * @param fade Whether an animation should be played to change the state.
198 */
199 public void setDimmed(boolean dimmed, boolean fade) {
200 }
201
202 /**
John Spurlockbf370992014-06-17 13:58:31 -0400203 * Sets the notification as dark. The default implementation does nothing.
204 *
205 * @param dark Whether the notification should be dark.
206 * @param fade Whether an animation should be played to change the state.
Jorim Jaggi4e857f42014-11-17 19:14:04 +0100207 * @param delay If fading, the delay of the animation.
John Spurlockbf370992014-06-17 13:58:31 -0400208 */
Jorim Jaggi4e857f42014-11-17 19:14:04 +0100209 public void setDark(boolean dark, boolean fade, long delay) {
210 mDark = dark;
211 }
212
213 public boolean isDark() {
214 return mDark;
John Spurlockbf370992014-06-17 13:58:31 -0400215 }
216
Selim Cinekd9b7dd42017-11-10 17:53:47 -0800217 public boolean isRemoved() {
218 return false;
219 }
220
John Spurlockbf370992014-06-17 13:58:31 -0400221 /**
Jorim Jaggiae441282014-08-01 02:45:18 +0200222 * See {@link #setHideSensitive}. This is a variant which notifies this view in advance about
223 * the upcoming state of hiding sensitive notifications. It gets called at the very beginning
224 * of a stack scroller update such that the updated intrinsic height (which is dependent on
225 * whether private or public layout is showing) gets taken into account into all layout
226 * calculations.
227 */
228 public void setHideSensitiveForIntrinsicHeight(boolean hideSensitive) {
229 }
230
231 /**
232 * Sets whether the notification should hide its private contents if it is sensitive.
233 */
234 public void setHideSensitive(boolean hideSensitive, boolean animated, long delay,
235 long duration) {
236 }
237
238 /**
Jorim Jaggi9cbadd32014-05-01 20:18:31 +0200239 * @return The desired notification height.
240 */
241 public int getIntrinsicHeight() {
Selim Cineka5eaa602014-05-12 21:27:47 +0200242 return getHeight();
Jorim Jaggi9cbadd32014-05-01 20:18:31 +0200243 }
244
245 /**
Jorim Jaggibe565df2014-04-28 17:51:23 +0200246 * Sets the amount this view should be clipped from the top. This is used when an expanded
247 * notification is scrolling in the top or bottom stack.
248 *
249 * @param clipTopAmount The amount of pixels this view should be clipped from top.
250 */
251 public void setClipTopAmount(int clipTopAmount) {
252 mClipTopAmount = clipTopAmount;
Mady Mellorc128f222016-04-26 11:42:46 -0700253 updateClipping();
Jorim Jaggibe565df2014-04-28 17:51:23 +0200254 }
255
Selim Cineka686b2c2016-10-26 13:58:27 -0700256 /**
257 * Set the amount the the notification is clipped on the bottom in addition to the regular
258 * clipping. This is mainly used to clip something in a non-animated way without changing the
259 * actual height of the notification and is purely visual.
260 *
261 * @param clipBottomAmount the amount to clip.
262 */
263 public void setClipBottomAmount(int clipBottomAmount) {
264 mClipBottomAmount = clipBottomAmount;
265 updateClipping();
266 }
267
Selim Cinekeb973562014-05-02 17:07:49 +0200268 public int getClipTopAmount() {
269 return mClipTopAmount;
270 }
271
Selim Cinekb3dadcc2016-11-21 17:21:13 -0800272 public int getClipBottomAmount() {
Selim Cineka686b2c2016-10-26 13:58:27 -0700273 return mClipBottomAmount;
274 }
275
Jorim Jaggibe565df2014-04-28 17:51:23 +0200276 public void setOnHeightChangedListener(OnHeightChangedListener listener) {
277 mOnHeightChangedListener = listener;
278 }
279
280 /**
Jorim Jaggi4222d9a2014-04-23 16:13:15 +0200281 * @return Whether we can expand this views content.
Jorim Jaggibe565df2014-04-28 17:51:23 +0200282 */
Jorim Jaggi4222d9a2014-04-23 16:13:15 +0200283 public boolean isContentExpandable() {
284 return false;
Jorim Jaggibe565df2014-04-28 17:51:23 +0200285 }
286
Selim Cinekb5605e52015-02-20 18:21:41 +0100287 public void notifyHeightChanged(boolean needsAnimation) {
Jorim Jaggi9cbadd32014-05-01 20:18:31 +0200288 if (mOnHeightChangedListener != null) {
Selim Cinekb5605e52015-02-20 18:21:41 +0100289 mOnHeightChangedListener.onHeightChanged(this, needsAnimation);
Jorim Jaggi9cbadd32014-05-01 20:18:31 +0200290 }
291 }
292
Selim Cinekc27437b2014-05-14 10:23:33 +0200293 public boolean isTransparent() {
294 return false;
295 }
296
Jorim Jaggibe565df2014-04-28 17:51:23 +0200297 /**
Selim Cinek8efa6dd2014-05-19 16:27:37 +0200298 * Perform a remove animation on this view.
299 *
Jorim Jaggi60d07c52014-07-31 15:38:21 +0200300 * @param duration The duration of the remove animation.
Selim Cinek8efa6dd2014-05-19 16:27:37 +0200301 * @param translationDirection The direction value from [-1 ... 1] indicating in which the
302 * animation should be performed. A value of -1 means that The
303 * remove animation should be performed upwards,
304 * such that the child appears to be going away to the top. 1
305 * Should mean the opposite.
306 * @param onFinishedRunnable A runnable which should be run when the animation is finished.
307 */
Jorim Jaggi60d07c52014-07-31 15:38:21 +0200308 public abstract void performRemoveAnimation(long duration, float translationDirection,
Selim Cinek8efa6dd2014-05-19 16:27:37 +0200309 Runnable onFinishedRunnable);
310
Jorim Jaggi60d07c52014-07-31 15:38:21 +0200311 public abstract void performAddAnimation(long delay, long duration);
Selim Cinek8efa6dd2014-05-19 16:27:37 +0200312
Selim Cinek281c2022016-10-13 19:14:43 -0700313 /**
Selim Cinekdb167372016-11-17 15:41:17 -0800314 * Set the notification appearance to be below the speed bump.
Selim Cinek281c2022016-10-13 19:14:43 -0700315 * @param below true if it is below.
316 */
Selim Cinekdb167372016-11-17 15:41:17 -0800317 public void setBelowSpeedBump(boolean below) {
Selim Cinek3d2b94bf2014-07-02 22:12:47 +0200318 }
319
Selim Cinekd127d792016-11-01 19:11:41 -0700320 public int getPinnedHeadsUpHeight() {
321 return getIntrinsicHeight();
322 }
323
324
Mady Mellor34958fa2016-02-23 09:52:17 -0800325 /**
326 * Sets the translation of the view.
327 */
328 public void setTranslation(float translation) {
329 setTranslationX(translation);
330 }
331
332 /**
333 * Gets the translation of the view.
334 */
335 public float getTranslation() {
336 return getTranslationX();
337 }
338
Selim Cinek31094df2014-08-14 19:28:15 +0200339 public void onHeightReset() {
Selim Cineke34c6512014-08-14 11:19:41 +0200340 if (mOnHeightChangedListener != null) {
341 mOnHeightChangedListener.onReset(this);
342 }
Selim Cineka5e211b2014-08-11 17:35:48 +0200343 }
344
Selim Cinek8efa6dd2014-05-19 16:27:37 +0200345 /**
Selim Cineke32010a2014-08-20 23:50:41 +0200346 * This method returns the drawing rect for the view which is different from the regular
347 * drawing rect, since we layout all children in the {@link NotificationStackScrollLayout} at
348 * position 0 and usually the translation is neglected. Since we are manually clipping this
349 * view,we also need to subtract the clipTopAmount from the top. This is needed in order to
350 * ensure that accessibility and focusing work correctly.
351 *
352 * @param outRect The (scrolled) drawing bounds of the view.
353 */
354 @Override
355 public void getDrawingRect(Rect outRect) {
356 super.getDrawingRect(outRect);
357 outRect.left += getTranslationX();
358 outRect.right += getTranslationX();
359 outRect.bottom = (int) (outRect.top + getTranslationY() + getActualHeight());
360 outRect.top += getTranslationY() + getClipTopAmount();
361 }
362
Adrian Rooscd55f432015-06-10 16:42:53 -0700363 @Override
364 public void getBoundsOnScreen(Rect outRect, boolean clipToParent) {
365 super.getBoundsOnScreen(outRect, clipToParent);
Adrian Roos98dd7f12016-06-14 15:51:40 -0700366 if (getTop() + getTranslationY() < 0) {
367 // We got clipped to the parent here - make sure we undo that.
368 outRect.top += getTop() + getTranslationY();
369 }
Adrian Roosb44f5482015-06-11 12:19:16 -0700370 outRect.bottom = outRect.top + getActualHeight();
Mady Mellorc128f222016-04-26 11:42:46 -0700371 outRect.top += getClipTopAmount();
Adrian Rooscd55f432015-06-10 16:42:53 -0700372 }
373
Selim Cinek263398f2015-10-21 17:40:23 -0700374 public boolean isSummaryWithChildren() {
Selim Cinekb5605e52015-02-20 18:21:41 +0100375 return false;
376 }
377
378 public boolean areChildrenExpanded() {
379 return false;
380 }
381
Selim Cinek2627d722018-01-19 12:16:49 -0800382 protected void updateClipping() {
383 if (mClipToActualHeight && shouldClipToActualHeight()) {
Mady Mellorc128f222016-04-26 11:42:46 -0700384 int top = getClipTopAmount();
Selim Cinekb3dadcc2016-11-21 17:21:13 -0800385 mClipRect.set(0, top, getWidth(), Math.max(getActualHeight() + getExtraBottomPadding()
Anthony Chen04d1ea72017-04-21 14:30:11 -0700386 - mClipBottomAmount, top));
Selim Cinek4ffd6362015-12-29 15:12:23 +0100387 setClipBounds(mClipRect);
388 } else {
389 setClipBounds(null);
Selim Cinekf92a1fd2015-07-31 16:10:32 -0700390 }
Selim Cinek4ffd6362015-12-29 15:12:23 +0100391 }
392
Selim Cinek2627d722018-01-19 12:16:49 -0800393 protected boolean shouldClipToActualHeight() {
394 return true;
395 }
396
Selim Cinek4ffd6362015-12-29 15:12:23 +0100397 public void setClipToActualHeight(boolean clipToActualHeight) {
398 mClipToActualHeight = clipToActualHeight;
399 updateClipping();
Selim Cineka272dfe2015-02-20 18:12:28 +0100400 }
401
Selim Cinek2cd45df2015-06-09 18:00:07 -0700402 public boolean willBeGone() {
403 return mWillBeGone;
404 }
405
406 public void setWillBeGone(boolean willBeGone) {
407 mWillBeGone = willBeGone;
408 }
409
Selim Cinek9c17b772015-07-07 20:37:09 -0700410 public int getMinClipTopAmount() {
411 return mMinClipTopAmount;
412 }
413
414 public void setMinClipTopAmount(int minClipTopAmount) {
415 mMinClipTopAmount = minClipTopAmount;
416 }
417
Selim Cinek471e31a2015-12-11 13:39:48 -0800418 @Override
419 public void setLayerType(int layerType, Paint paint) {
420 if (hasOverlappingRendering()) {
421 super.setLayerType(layerType, paint);
422 }
423 }
424
425 @Override
426 public boolean hasOverlappingRendering() {
Selim Cineka69f2a62015-12-11 17:28:12 -0800427 // Otherwise it will be clipped
428 return super.hasOverlappingRendering() && getActualHeight() <= getHeight();
Selim Cinek471e31a2015-12-11 13:39:48 -0800429 }
430
Selim Cinek277a8aa2016-01-22 12:12:37 -0800431 public float getShadowAlpha() {
432 return 0.0f;
433 }
434
435 public void setShadowAlpha(float shadowAlpha) {
436 }
437
Selim Cinek42357e02016-02-24 18:48:01 -0800438 /**
Selim Cineka7ed2c12017-01-23 20:47:24 -0800439 * @return an amount between -1 and 1 of increased padding that this child needs. 1 means it
440 * needs a full increased padding while -1 means it needs no padding at all. For 0.0f the normal
441 * padding is applied.
Selim Cinek42357e02016-02-24 18:48:01 -0800442 */
443 public float getIncreasedPaddingAmount() {
444 return 0.0f;
Selim Cinek61633a82016-01-25 15:54:10 -0800445 }
446
Selim Cinek3776fe02016-02-04 13:32:43 -0800447 public boolean mustStayOnScreen() {
448 return false;
449 }
450
Selim Cinek33223572016-02-19 19:32:22 -0800451 public void setFakeShadowIntensity(float shadowIntensity, float outlineAlpha, int shadowYEnd,
452 int outlineTranslation) {
453 }
454
455 public float getOutlineAlpha() {
456 return 0.0f;
457 }
458
459 public int getOutlineTranslation() {
460 return 0;
461 }
462
Adrian Roos14503e22016-03-09 14:01:24 -0800463 public void setChangingPosition(boolean changingPosition) {
464 mChangingPosition = changingPosition;
465 }
466
467 public boolean isChangingPosition() {
468 return mChangingPosition;
469 }
470
Selim Cinekd1395642016-04-28 12:22:42 -0700471 public void setTransientContainer(ViewGroup transientContainer) {
472 mTransientContainer = transientContainer;
473 }
474
475 public ViewGroup getTransientContainer() {
476 return mTransientContainer;
477 }
478
Selim Cineke32010a2014-08-20 23:50:41 +0200479 /**
Mady Mellorb0a82462016-04-30 17:31:02 -0700480 * @return padding used to alter how much of the view is clipped.
481 */
482 public int getExtraBottomPadding() {
483 return 0;
484 }
485
486 /**
487 * @return true if the group's expansion state is changing, false otherwise.
488 */
489 public boolean isGroupExpansionChanging() {
490 return false;
491 }
492
493 public boolean isGroupExpanded() {
494 return false;
495 }
496
Selim Cinek9b9d6e12017-11-30 12:29:47 +0100497 public void setHeadsUpIsVisible() {
498 }
499
Mady Mellorb0a82462016-04-30 17:31:02 -0700500 public boolean isChildInGroup() {
501 return false;
502 }
503
Adrian Roos599be342016-06-13 14:54:39 -0700504 public void setActualHeightAnimating(boolean animating) {}
505
Selim Cinekbbcebde2016-11-09 18:28:20 -0800506 public ExpandableViewState createNewViewState(StackScrollState stackScrollState) {
507 return new ExpandableViewState();
508 }
509
Mady Mellorb0a82462016-04-30 17:31:02 -0700510 /**
Selim Cinek281c2022016-10-13 19:14:43 -0700511 * @return whether the current view doesn't add height to the overall content. This means that
512 * if it is added to a list of items, it's content will still have the same height.
513 * An example is the notification shelf, that is always placed on top of another view.
514 */
515 public boolean hasNoContentHeight() {
516 return false;
517 }
518
519 /**
Selim Cinekeccb5de2016-10-28 15:04:05 -0700520 * @param inShelf whether the view is currently fully in the notification shelf.
521 */
522 public void setInShelf(boolean inShelf) {
523 mInShelf = inShelf;
524 }
525
526 public boolean isInShelf() {
527 return mInShelf;
528 }
529
530 /**
531 * @param transformingInShelf whether the view is currently transforming into the shelf in an
532 * animated way
533 */
534 public void setTransformingInShelf(boolean transformingInShelf) {
535 mTransformingInShelf = transformingInShelf;
536 }
537
538 public boolean isTransformingIntoShelf() {
539 return mTransformingInShelf;
540 }
541
Selim Cinekd127d792016-11-01 19:11:41 -0700542 public boolean isAboveShelf() {
543 return false;
544 }
545
Selim Cinekeccb5de2016-10-28 15:04:05 -0700546 /**
Jorim Jaggibe565df2014-04-28 17:51:23 +0200547 * A listener notifying when {@link #getActualHeight} changes.
548 */
549 public interface OnHeightChangedListener {
Jorim Jaggi30c305c2014-07-01 23:34:41 +0200550
551 /**
552 * @param view the view for which the height changed, or {@code null} if just the top
553 * padding or the padding between the elements changed
Selim Cinekb5605e52015-02-20 18:21:41 +0100554 * @param needsAnimation whether the view height needs to be animated
Jorim Jaggi30c305c2014-07-01 23:34:41 +0200555 */
Selim Cinekb5605e52015-02-20 18:21:41 +0100556 void onHeightChanged(ExpandableView view, boolean needsAnimation);
Selim Cineka5e211b2014-08-11 17:35:48 +0200557
558 /**
559 * Called when the view is reset and therefore the height will change abruptly
560 *
561 * @param view The view which was reset.
562 */
563 void onReset(ExpandableView view);
Jorim Jaggibe565df2014-04-28 17:51:23 +0200564 }
565}