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 
17 package com.android.systemui.statusbar.stack;
18 
19 import android.view.View;
20 
21 import com.android.systemui.statusbar.ExpandableView;
22 
23 /**
24 * A state of an expandable view
25 */
26 public class StackViewState extends ViewState {
27 
28     // These are flags such that we can create masks for filtering.
29 
30     public static final int LOCATION_UNKNOWN = 0x00;
31     public static final int LOCATION_FIRST_CARD = 0x01;
32     public static final int LOCATION_TOP_STACK_HIDDEN = 0x02;
33     public static final int LOCATION_TOP_STACK_PEEKING = 0x04;
34     public static final int LOCATION_MAIN_AREA = 0x08;
35     public static final int LOCATION_BOTTOM_STACK_PEEKING = 0x10;
36     public static final int LOCATION_BOTTOM_STACK_HIDDEN = 0x20;
37     /** The view isn't layouted at all. */
38     public static final int LOCATION_GONE = 0x40;
39 
40     public int height;
41     public boolean dimmed;
42     public boolean dark;
43     public boolean hideSensitive;
44     public boolean belowSpeedBump;
45 
46     /**
47      * The amount which the view should be clipped from the top. This is calculated to
48      * perceive consistent shadows.
49      */
50     public int clipTopAmount;
51 
52     /**
53      * How much does the child overlap with the previous view on the top? Can be used for
54      * a clipping optimization
55      */
56     public int topOverLap;
57 
58     /**
59      * The index of the view, only accounting for views not equal to GONE
60      */
61     public int notGoneIndex;
62 
63     /**
64      * The location this view is currently rendered at.
65      *
66      * <p>See <code>LOCATION_</code> flags.</p>
67      */
68     public int location;
69 
70     @Override
copyFrom(ViewState viewState)71     public void copyFrom(ViewState viewState) {
72         super.copyFrom(viewState);
73         if (viewState instanceof StackViewState) {
74             StackViewState svs = (StackViewState) viewState;
75             height = svs.height;
76             dimmed = svs.dimmed;
77             dark = svs.dark;
78             hideSensitive = svs.hideSensitive;
79             belowSpeedBump = svs.belowSpeedBump;
80             clipTopAmount = svs.clipTopAmount;
81             topOverLap = svs.topOverLap;
82             notGoneIndex = svs.notGoneIndex;
83             location = svs.location;
84         }
85     }
86 }
87