Home | History | Annotate | Download | only in stack
      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     public int height;
     36     public boolean dimmed;
     37     public boolean dark;
     38     public boolean hideSensitive;
     39     public boolean belowSpeedBump;
     40     public float shadowAlpha;
     41 
     42     /**
     43      * How much the child overlaps with the previous child on top. This is used to
     44      * show the background properly when the child on top is translating away.
     45      */
     46     public int clipTopAmount;
     47 
     48     /**
     49      * The index of the view, only accounting for views not equal to GONE
     50      */
     51     public int notGoneIndex;
     52 
     53     /**
     54      * The location this view is currently rendered at.
     55      *
     56      * <p>See <code>LOCATION_</code> flags.</p>
     57      */
     58     public int location;
     59 
     60     /**
     61      * Whether a child in a group is being clipped at the bottom.
     62      */
     63     public boolean isBottomClipped;
     64 
     65     @Override
     66     public void copyFrom(ViewState viewState) {
     67         super.copyFrom(viewState);
     68         if (viewState instanceof StackViewState) {
     69             StackViewState svs = (StackViewState) viewState;
     70             height = svs.height;
     71             dimmed = svs.dimmed;
     72             shadowAlpha = svs.shadowAlpha;
     73             dark = svs.dark;
     74             hideSensitive = svs.hideSensitive;
     75             belowSpeedBump = svs.belowSpeedBump;
     76             clipTopAmount = svs.clipTopAmount;
     77             notGoneIndex = svs.notGoneIndex;
     78             location = svs.location;
     79             isBottomClipped = svs.isBottomClipped;
     80         }
     81     }
     82 }
     83