• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 /**
20 * A state of an expandable view
21 */
22 public 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;
27     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;
32     /** The view isn't layouted at all. */
33     public static final int LOCATION_GONE = 0x40;
34     /**
35      * The visible locations of a view.
36      */
37     public static final int VISIBLE_LOCATIONS = LOCATION_FIRST_HUN | LOCATION_MAIN_AREA;
38 
39     public int height;
40     public boolean dimmed;
41     public boolean dark;
42     public boolean hideSensitive;
43     public boolean belowSpeedBump;
44     public float shadowAlpha;
45 
46     /**
47      * 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.
49      */
50     public int clipTopAmount;
51 
52     /**
53      * 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 
64     /**
65      * Whether a child in a group is being clipped at the bottom.
66      */
67     public boolean isBottomClipped;
68 
69     @Override
copyFrom(ViewState viewState)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;
76             shadowAlpha = svs.shadowAlpha;
77             dark = svs.dark;
78             hideSensitive = svs.hideSensitive;
79             belowSpeedBump = svs.belowSpeedBump;
80             clipTopAmount = svs.clipTopAmount;
81             notGoneIndex = svs.notGoneIndex;
82             location = svs.location;
83             isBottomClipped = svs.isBottomClipped;
84         }
85     }
86 }
87