blob: f22a4107e205ab88c795e8289592a01f073b7621 [file] [log] [blame]
Selim Cinekb036ca42015-02-20 15:56:28 +01001/*
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
17package com.android.systemui.statusbar.stack;
18
Selim Cinekb036ca42015-02-20 15:56:28 +010019/**
20* A state of an expandable view
21*/
22public class StackViewState extends ViewState {
23
24 // These are flags such that we can create masks for filtering.
25
26 public static final int LOCATION_UNKNOWN = 0x00;
Selim Cinek3776fe02016-02-04 13:32:43 -080027 public static final int LOCATION_FIRST_HUN = 0x01;
28 public static final int LOCATION_HIDDEN_TOP = 0x02;
29 public static final int LOCATION_MAIN_AREA = 0x04;
30 public static final int LOCATION_BOTTOM_STACK_PEEKING = 0x08;
31 public static final int LOCATION_BOTTOM_STACK_HIDDEN = 0x10;
Selim Cinekb036ca42015-02-20 15:56:28 +010032 /** The view isn't layouted at all. */
33 public static final int LOCATION_GONE = 0x40;
Selim Cinekadd95262016-12-06 14:34:47 -080034 /**
35 * The visible locations of a view.
36 */
37 public static final int VISIBLE_LOCATIONS = LOCATION_FIRST_HUN | LOCATION_MAIN_AREA;
Selim Cinekb036ca42015-02-20 15:56:28 +010038
39 public int height;
40 public boolean dimmed;
41 public boolean dark;
42 public boolean hideSensitive;
43 public boolean belowSpeedBump;
Selim Cinek277a8aa2016-01-22 12:12:37 -080044 public float shadowAlpha;
Selim Cinekb036ca42015-02-20 15:56:28 +010045
46 /**
Mady Mellorc128f222016-04-26 11:42:46 -070047 * How much the child overlaps with the previous child on top. This is used to
48 * show the background properly when the child on top is translating away.
Selim Cinekb036ca42015-02-20 15:56:28 +010049 */
50 public int clipTopAmount;
51
52 /**
Selim Cinekb036ca42015-02-20 15:56:28 +010053 * The index of the view, only accounting for views not equal to GONE
54 */
55 public int notGoneIndex;
56
57 /**
58 * The location this view is currently rendered at.
59 *
60 * <p>See <code>LOCATION_</code> flags.</p>
61 */
62 public int location;
63
Mady Mellorb0a82462016-04-30 17:31:02 -070064 /**
65 * Whether a child in a group is being clipped at the bottom.
66 */
67 public boolean isBottomClipped;
68
Selim Cinekb036ca42015-02-20 15:56:28 +010069 @Override
70 public void copyFrom(ViewState viewState) {
71 super.copyFrom(viewState);
72 if (viewState instanceof StackViewState) {
73 StackViewState svs = (StackViewState) viewState;
74 height = svs.height;
75 dimmed = svs.dimmed;
Selim Cinek277a8aa2016-01-22 12:12:37 -080076 shadowAlpha = svs.shadowAlpha;
Selim Cinekb036ca42015-02-20 15:56:28 +010077 dark = svs.dark;
78 hideSensitive = svs.hideSensitive;
79 belowSpeedBump = svs.belowSpeedBump;
80 clipTopAmount = svs.clipTopAmount;
Selim Cinekb036ca42015-02-20 15:56:28 +010081 notGoneIndex = svs.notGoneIndex;
82 location = svs.location;
Mady Mellorb0a82462016-04-30 17:31:02 -070083 isBottomClipped = svs.isBottomClipped;
Selim Cinekb036ca42015-02-20 15:56:28 +010084 }
85 }
86}