blob: eafa825dd89db7438b6d4366eec65d06d507ae9f [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
154 /**
155 * @return The maximum height of this notification.
156 */
Selim Cinekb5605e52015-02-20 18:21:41 +0100157 public int getMaxContentHeight() {
Jorim Jaggi4222d9a2014-04-23 16:13:15 +0200158 return getHeight();
159 }
160
161 /**
Selim Cinekeb3fc3d2017-09-15 13:37:14 -0700162 * @return The minimum content height of this notification. This also respects the temporary
163 * states of the view.
Jorim Jaggi4222d9a2014-04-23 16:13:15 +0200164 */
165 public int getMinHeight() {
Selim Cinekeb3fc3d2017-09-15 13:37:14 -0700166 return getMinHeight(false /* ignoreTemporaryStates */);
167 }
168
169 /**
170 * Get the minimum height of this view.
171 *
172 * @param ignoreTemporaryStates should temporary states be ignored like the guts or heads-up.
173 *
174 * @return The minimum height that this view needs.
175 */
176 public int getMinHeight(boolean ignoreTemporaryStates) {
Jorim Jaggi4222d9a2014-04-23 16:13:15 +0200177 return getHeight();
178 }
Jorim Jaggibe565df2014-04-28 17:51:23 +0200179
180 /**
Selim Cinek567e8452016-03-24 10:54:56 -0700181 * @return The collapsed height of this view. Note that this might be different
182 * than {@link #getMinHeight()} because some elements like groups may have different sizes when
183 * they are system expanded.
Selim Cinek816c8e42015-11-19 12:00:45 -0800184 */
Selim Cinek567e8452016-03-24 10:54:56 -0700185 public int getCollapsedHeight() {
Selim Cinek816c8e42015-11-19 12:00:45 -0800186 return getHeight();
187 }
188
189 /**
Jorim Jaggid552d9d2014-05-07 19:41:13 +0200190 * Sets the notification as dimmed. The default implementation does nothing.
191 *
192 * @param dimmed Whether the notification should be dimmed.
193 * @param fade Whether an animation should be played to change the state.
194 */
195 public void setDimmed(boolean dimmed, boolean fade) {
196 }
197
198 /**
John Spurlockbf370992014-06-17 13:58:31 -0400199 * Sets the notification as dark. The default implementation does nothing.
200 *
201 * @param dark Whether the notification should be dark.
202 * @param fade Whether an animation should be played to change the state.
Jorim Jaggi4e857f42014-11-17 19:14:04 +0100203 * @param delay If fading, the delay of the animation.
John Spurlockbf370992014-06-17 13:58:31 -0400204 */
Jorim Jaggi4e857f42014-11-17 19:14:04 +0100205 public void setDark(boolean dark, boolean fade, long delay) {
206 mDark = dark;
207 }
208
209 public boolean isDark() {
210 return mDark;
John Spurlockbf370992014-06-17 13:58:31 -0400211 }
212
Selim Cinekd9b7dd42017-11-10 17:53:47 -0800213 public boolean isRemoved() {
214 return false;
215 }
216
John Spurlockbf370992014-06-17 13:58:31 -0400217 /**
Jorim Jaggiae441282014-08-01 02:45:18 +0200218 * See {@link #setHideSensitive}. This is a variant which notifies this view in advance about
219 * the upcoming state of hiding sensitive notifications. It gets called at the very beginning
220 * of a stack scroller update such that the updated intrinsic height (which is dependent on
221 * whether private or public layout is showing) gets taken into account into all layout
222 * calculations.
223 */
224 public void setHideSensitiveForIntrinsicHeight(boolean hideSensitive) {
225 }
226
227 /**
228 * Sets whether the notification should hide its private contents if it is sensitive.
229 */
230 public void setHideSensitive(boolean hideSensitive, boolean animated, long delay,
231 long duration) {
232 }
233
234 /**
Jorim Jaggi9cbadd32014-05-01 20:18:31 +0200235 * @return The desired notification height.
236 */
237 public int getIntrinsicHeight() {
Selim Cineka5eaa602014-05-12 21:27:47 +0200238 return getHeight();
Jorim Jaggi9cbadd32014-05-01 20:18:31 +0200239 }
240
241 /**
Jorim Jaggibe565df2014-04-28 17:51:23 +0200242 * Sets the amount this view should be clipped from the top. This is used when an expanded
243 * notification is scrolling in the top or bottom stack.
244 *
245 * @param clipTopAmount The amount of pixels this view should be clipped from top.
246 */
247 public void setClipTopAmount(int clipTopAmount) {
248 mClipTopAmount = clipTopAmount;
Mady Mellorc128f222016-04-26 11:42:46 -0700249 updateClipping();
Jorim Jaggibe565df2014-04-28 17:51:23 +0200250 }
251
Selim Cineka686b2c2016-10-26 13:58:27 -0700252 /**
253 * Set the amount the the notification is clipped on the bottom in addition to the regular
254 * clipping. This is mainly used to clip something in a non-animated way without changing the
255 * actual height of the notification and is purely visual.
256 *
257 * @param clipBottomAmount the amount to clip.
258 */
259 public void setClipBottomAmount(int clipBottomAmount) {
260 mClipBottomAmount = clipBottomAmount;
261 updateClipping();
262 }
263
Selim Cinekeb973562014-05-02 17:07:49 +0200264 public int getClipTopAmount() {
265 return mClipTopAmount;
266 }
267
Selim Cinekb3dadcc2016-11-21 17:21:13 -0800268 public int getClipBottomAmount() {
Selim Cineka686b2c2016-10-26 13:58:27 -0700269 return mClipBottomAmount;
270 }
271
Jorim Jaggibe565df2014-04-28 17:51:23 +0200272 public void setOnHeightChangedListener(OnHeightChangedListener listener) {
273 mOnHeightChangedListener = listener;
274 }
275
276 /**
Jorim Jaggi4222d9a2014-04-23 16:13:15 +0200277 * @return Whether we can expand this views content.
Jorim Jaggibe565df2014-04-28 17:51:23 +0200278 */
Jorim Jaggi4222d9a2014-04-23 16:13:15 +0200279 public boolean isContentExpandable() {
280 return false;
Jorim Jaggibe565df2014-04-28 17:51:23 +0200281 }
282
Selim Cinekb5605e52015-02-20 18:21:41 +0100283 public void notifyHeightChanged(boolean needsAnimation) {
Jorim Jaggi9cbadd32014-05-01 20:18:31 +0200284 if (mOnHeightChangedListener != null) {
Selim Cinekb5605e52015-02-20 18:21:41 +0100285 mOnHeightChangedListener.onHeightChanged(this, needsAnimation);
Jorim Jaggi9cbadd32014-05-01 20:18:31 +0200286 }
287 }
288
Selim Cinekc27437b2014-05-14 10:23:33 +0200289 public boolean isTransparent() {
290 return false;
291 }
292
Jorim Jaggibe565df2014-04-28 17:51:23 +0200293 /**
Selim Cinek8efa6dd2014-05-19 16:27:37 +0200294 * Perform a remove animation on this view.
295 *
Jorim Jaggi60d07c52014-07-31 15:38:21 +0200296 * @param duration The duration of the remove animation.
Selim Cinek8efa6dd2014-05-19 16:27:37 +0200297 * @param translationDirection The direction value from [-1 ... 1] indicating in which the
298 * animation should be performed. A value of -1 means that The
299 * remove animation should be performed upwards,
300 * such that the child appears to be going away to the top. 1
301 * Should mean the opposite.
302 * @param onFinishedRunnable A runnable which should be run when the animation is finished.
303 */
Jorim Jaggi60d07c52014-07-31 15:38:21 +0200304 public abstract void performRemoveAnimation(long duration, float translationDirection,
Selim Cinek8efa6dd2014-05-19 16:27:37 +0200305 Runnable onFinishedRunnable);
306
Jorim Jaggi60d07c52014-07-31 15:38:21 +0200307 public abstract void performAddAnimation(long delay, long duration);
Selim Cinek8efa6dd2014-05-19 16:27:37 +0200308
Selim Cinek281c2022016-10-13 19:14:43 -0700309 /**
Selim Cinekdb167372016-11-17 15:41:17 -0800310 * Set the notification appearance to be below the speed bump.
Selim Cinek281c2022016-10-13 19:14:43 -0700311 * @param below true if it is below.
312 */
Selim Cinekdb167372016-11-17 15:41:17 -0800313 public void setBelowSpeedBump(boolean below) {
Selim Cinek3d2b94bf2014-07-02 22:12:47 +0200314 }
315
Selim Cinekd127d792016-11-01 19:11:41 -0700316 public int getPinnedHeadsUpHeight() {
317 return getIntrinsicHeight();
318 }
319
320
Mady Mellor34958fa2016-02-23 09:52:17 -0800321 /**
322 * Sets the translation of the view.
323 */
324 public void setTranslation(float translation) {
325 setTranslationX(translation);
326 }
327
328 /**
329 * Gets the translation of the view.
330 */
331 public float getTranslation() {
332 return getTranslationX();
333 }
334
Selim Cinek31094df2014-08-14 19:28:15 +0200335 public void onHeightReset() {
Selim Cineke34c6512014-08-14 11:19:41 +0200336 if (mOnHeightChangedListener != null) {
337 mOnHeightChangedListener.onReset(this);
338 }
Selim Cineka5e211b2014-08-11 17:35:48 +0200339 }
340
Selim Cinek8efa6dd2014-05-19 16:27:37 +0200341 /**
Selim Cineke32010a2014-08-20 23:50:41 +0200342 * This method returns the drawing rect for the view which is different from the regular
343 * drawing rect, since we layout all children in the {@link NotificationStackScrollLayout} at
344 * position 0 and usually the translation is neglected. Since we are manually clipping this
345 * view,we also need to subtract the clipTopAmount from the top. This is needed in order to
346 * ensure that accessibility and focusing work correctly.
347 *
348 * @param outRect The (scrolled) drawing bounds of the view.
349 */
350 @Override
351 public void getDrawingRect(Rect outRect) {
352 super.getDrawingRect(outRect);
353 outRect.left += getTranslationX();
354 outRect.right += getTranslationX();
355 outRect.bottom = (int) (outRect.top + getTranslationY() + getActualHeight());
356 outRect.top += getTranslationY() + getClipTopAmount();
357 }
358
Adrian Rooscd55f432015-06-10 16:42:53 -0700359 @Override
360 public void getBoundsOnScreen(Rect outRect, boolean clipToParent) {
361 super.getBoundsOnScreen(outRect, clipToParent);
Adrian Roos98dd7f12016-06-14 15:51:40 -0700362 if (getTop() + getTranslationY() < 0) {
363 // We got clipped to the parent here - make sure we undo that.
364 outRect.top += getTop() + getTranslationY();
365 }
Adrian Roosb44f5482015-06-11 12:19:16 -0700366 outRect.bottom = outRect.top + getActualHeight();
Mady Mellorc128f222016-04-26 11:42:46 -0700367 outRect.top += getClipTopAmount();
Adrian Rooscd55f432015-06-10 16:42:53 -0700368 }
369
Selim Cinek263398f2015-10-21 17:40:23 -0700370 public boolean isSummaryWithChildren() {
Selim Cinekb5605e52015-02-20 18:21:41 +0100371 return false;
372 }
373
374 public boolean areChildrenExpanded() {
375 return false;
376 }
377
Selim Cineka272dfe2015-02-20 18:12:28 +0100378 private void updateClipping() {
Selim Cinek4ffd6362015-12-29 15:12:23 +0100379 if (mClipToActualHeight) {
Mady Mellorc128f222016-04-26 11:42:46 -0700380 int top = getClipTopAmount();
Selim Cinekb3dadcc2016-11-21 17:21:13 -0800381 mClipRect.set(0, top, getWidth(), Math.max(getActualHeight() + getExtraBottomPadding()
Anthony Chen04d1ea72017-04-21 14:30:11 -0700382 - mClipBottomAmount, top));
Selim Cinek4ffd6362015-12-29 15:12:23 +0100383 setClipBounds(mClipRect);
384 } else {
385 setClipBounds(null);
Selim Cinekf92a1fd2015-07-31 16:10:32 -0700386 }
Selim Cinek4ffd6362015-12-29 15:12:23 +0100387 }
388
389 public void setClipToActualHeight(boolean clipToActualHeight) {
390 mClipToActualHeight = clipToActualHeight;
391 updateClipping();
Selim Cineka272dfe2015-02-20 18:12:28 +0100392 }
393
Selim Cinek2cd45df2015-06-09 18:00:07 -0700394 public boolean willBeGone() {
395 return mWillBeGone;
396 }
397
398 public void setWillBeGone(boolean willBeGone) {
399 mWillBeGone = willBeGone;
400 }
401
Selim Cinek9c17b772015-07-07 20:37:09 -0700402 public int getMinClipTopAmount() {
403 return mMinClipTopAmount;
404 }
405
406 public void setMinClipTopAmount(int minClipTopAmount) {
407 mMinClipTopAmount = minClipTopAmount;
408 }
409
Selim Cinek471e31a2015-12-11 13:39:48 -0800410 @Override
411 public void setLayerType(int layerType, Paint paint) {
412 if (hasOverlappingRendering()) {
413 super.setLayerType(layerType, paint);
414 }
415 }
416
417 @Override
418 public boolean hasOverlappingRendering() {
Selim Cineka69f2a62015-12-11 17:28:12 -0800419 // Otherwise it will be clipped
420 return super.hasOverlappingRendering() && getActualHeight() <= getHeight();
Selim Cinek471e31a2015-12-11 13:39:48 -0800421 }
422
Selim Cinek277a8aa2016-01-22 12:12:37 -0800423 public float getShadowAlpha() {
424 return 0.0f;
425 }
426
427 public void setShadowAlpha(float shadowAlpha) {
428 }
429
Selim Cinek42357e02016-02-24 18:48:01 -0800430 /**
Selim Cineka7ed2c12017-01-23 20:47:24 -0800431 * @return an amount between -1 and 1 of increased padding that this child needs. 1 means it
432 * needs a full increased padding while -1 means it needs no padding at all. For 0.0f the normal
433 * padding is applied.
Selim Cinek42357e02016-02-24 18:48:01 -0800434 */
435 public float getIncreasedPaddingAmount() {
436 return 0.0f;
Selim Cinek61633a82016-01-25 15:54:10 -0800437 }
438
Selim Cinek3776fe02016-02-04 13:32:43 -0800439 public boolean mustStayOnScreen() {
440 return false;
441 }
442
Selim Cinek33223572016-02-19 19:32:22 -0800443 public void setFakeShadowIntensity(float shadowIntensity, float outlineAlpha, int shadowYEnd,
444 int outlineTranslation) {
445 }
446
447 public float getOutlineAlpha() {
448 return 0.0f;
449 }
450
451 public int getOutlineTranslation() {
452 return 0;
453 }
454
Adrian Roos14503e22016-03-09 14:01:24 -0800455 public void setChangingPosition(boolean changingPosition) {
456 mChangingPosition = changingPosition;
457 }
458
459 public boolean isChangingPosition() {
460 return mChangingPosition;
461 }
462
Selim Cinekd1395642016-04-28 12:22:42 -0700463 public void setTransientContainer(ViewGroup transientContainer) {
464 mTransientContainer = transientContainer;
465 }
466
467 public ViewGroup getTransientContainer() {
468 return mTransientContainer;
469 }
470
Selim Cineke32010a2014-08-20 23:50:41 +0200471 /**
Mady Mellorb0a82462016-04-30 17:31:02 -0700472 * @return padding used to alter how much of the view is clipped.
473 */
474 public int getExtraBottomPadding() {
475 return 0;
476 }
477
478 /**
479 * @return true if the group's expansion state is changing, false otherwise.
480 */
481 public boolean isGroupExpansionChanging() {
482 return false;
483 }
484
485 public boolean isGroupExpanded() {
486 return false;
487 }
488
Selim Cinek9b9d6e12017-11-30 12:29:47 +0100489 public void setHeadsUpIsVisible() {
490 }
491
Mady Mellorb0a82462016-04-30 17:31:02 -0700492 public boolean isChildInGroup() {
493 return false;
494 }
495
Adrian Roos599be342016-06-13 14:54:39 -0700496 public void setActualHeightAnimating(boolean animating) {}
497
Selim Cinekbbcebde2016-11-09 18:28:20 -0800498 public ExpandableViewState createNewViewState(StackScrollState stackScrollState) {
499 return new ExpandableViewState();
500 }
501
Mady Mellorb0a82462016-04-30 17:31:02 -0700502 /**
Selim Cinek281c2022016-10-13 19:14:43 -0700503 * @return whether the current view doesn't add height to the overall content. This means that
504 * if it is added to a list of items, it's content will still have the same height.
505 * An example is the notification shelf, that is always placed on top of another view.
506 */
507 public boolean hasNoContentHeight() {
508 return false;
509 }
510
511 /**
Selim Cinekeccb5de2016-10-28 15:04:05 -0700512 * @param inShelf whether the view is currently fully in the notification shelf.
513 */
514 public void setInShelf(boolean inShelf) {
515 mInShelf = inShelf;
516 }
517
518 public boolean isInShelf() {
519 return mInShelf;
520 }
521
522 /**
523 * @param transformingInShelf whether the view is currently transforming into the shelf in an
524 * animated way
525 */
526 public void setTransformingInShelf(boolean transformingInShelf) {
527 mTransformingInShelf = transformingInShelf;
528 }
529
530 public boolean isTransformingIntoShelf() {
531 return mTransformingInShelf;
532 }
533
Selim Cinekd127d792016-11-01 19:11:41 -0700534 public boolean isAboveShelf() {
535 return false;
536 }
537
Selim Cinekeccb5de2016-10-28 15:04:05 -0700538 /**
Jorim Jaggibe565df2014-04-28 17:51:23 +0200539 * A listener notifying when {@link #getActualHeight} changes.
540 */
541 public interface OnHeightChangedListener {
Jorim Jaggi30c305c2014-07-01 23:34:41 +0200542
543 /**
544 * @param view the view for which the height changed, or {@code null} if just the top
545 * padding or the padding between the elements changed
Selim Cinekb5605e52015-02-20 18:21:41 +0100546 * @param needsAnimation whether the view height needs to be animated
Jorim Jaggi30c305c2014-07-01 23:34:41 +0200547 */
Selim Cinekb5605e52015-02-20 18:21:41 +0100548 void onHeightChanged(ExpandableView view, boolean needsAnimation);
Selim Cineka5e211b2014-08-11 17:35:48 +0200549
550 /**
551 * Called when the view is reset and therefore the height will change abruptly
552 *
553 * @param view The view which was reset.
554 */
555 void onReset(ExpandableView view);
Jorim Jaggibe565df2014-04-28 17:51:23 +0200556 }
557}