Selim Cinek | b036ca4 | 2015-02-20 15:56:28 +0100 | [diff] [blame] | 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 | |
Selim Cinek | b036ca4 | 2015-02-20 15:56:28 +0100 | [diff] [blame] | 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; |
Selim Cinek | 3776fe0 | 2016-02-04 13:32:43 -0800 | [diff] [blame] | 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; |
Selim Cinek | b036ca4 | 2015-02-20 15:56:28 +0100 | [diff] [blame] | 32 | /** The view isn't layouted at all. */ |
| 33 | public static final int LOCATION_GONE = 0x40; |
Selim Cinek | add9526 | 2016-12-06 14:34:47 -0800 | [diff] [blame] | 34 | /** |
| 35 | * The visible locations of a view. |
| 36 | */ |
| 37 | public static final int VISIBLE_LOCATIONS = LOCATION_FIRST_HUN | LOCATION_MAIN_AREA; |
Selim Cinek | b036ca4 | 2015-02-20 15:56:28 +0100 | [diff] [blame] | 38 | |
| 39 | public int height; |
| 40 | public boolean dimmed; |
| 41 | public boolean dark; |
| 42 | public boolean hideSensitive; |
| 43 | public boolean belowSpeedBump; |
Selim Cinek | 277a8aa | 2016-01-22 12:12:37 -0800 | [diff] [blame] | 44 | public float shadowAlpha; |
Selim Cinek | b036ca4 | 2015-02-20 15:56:28 +0100 | [diff] [blame] | 45 | |
| 46 | /** |
Mady Mellor | c128f22 | 2016-04-26 11:42:46 -0700 | [diff] [blame] | 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. |
Selim Cinek | b036ca4 | 2015-02-20 15:56:28 +0100 | [diff] [blame] | 49 | */ |
| 50 | public int clipTopAmount; |
| 51 | |
| 52 | /** |
Selim Cinek | b036ca4 | 2015-02-20 15:56:28 +0100 | [diff] [blame] | 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 | |
Mady Mellor | b0a8246 | 2016-04-30 17:31:02 -0700 | [diff] [blame] | 64 | /** |
| 65 | * Whether a child in a group is being clipped at the bottom. |
| 66 | */ |
| 67 | public boolean isBottomClipped; |
| 68 | |
Selim Cinek | b036ca4 | 2015-02-20 15:56:28 +0100 | [diff] [blame] | 69 | @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 Cinek | 277a8aa | 2016-01-22 12:12:37 -0800 | [diff] [blame] | 76 | shadowAlpha = svs.shadowAlpha; |
Selim Cinek | b036ca4 | 2015-02-20 15:56:28 +0100 | [diff] [blame] | 77 | dark = svs.dark; |
| 78 | hideSensitive = svs.hideSensitive; |
| 79 | belowSpeedBump = svs.belowSpeedBump; |
| 80 | clipTopAmount = svs.clipTopAmount; |
Selim Cinek | b036ca4 | 2015-02-20 15:56:28 +0100 | [diff] [blame] | 81 | notGoneIndex = svs.notGoneIndex; |
| 82 | location = svs.location; |
Mady Mellor | b0a8246 | 2016-04-30 17:31:02 -0700 | [diff] [blame] | 83 | isBottomClipped = svs.isBottomClipped; |
Selim Cinek | b036ca4 | 2015-02-20 15:56:28 +0100 | [diff] [blame] | 84 | } |
| 85 | } |
| 86 | } |