Jorim Jaggi | d552d9d | 2014-05-07 19:41:13 +0200 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2014 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 java.util.ArrayList; |
| 22 | |
| 23 | /** |
| 24 | * A global state to track all input states for the algorithm. |
| 25 | */ |
| 26 | public class AmbientState { |
| 27 | private ArrayList<View> mDraggedViews = new ArrayList<View>(); |
| 28 | private int mScrollY; |
| 29 | private boolean mDimmed; |
| 30 | private View mActivatedChild; |
| 31 | |
| 32 | public int getScrollY() { |
| 33 | return mScrollY; |
| 34 | } |
| 35 | |
| 36 | public void setScrollY(int scrollY) { |
| 37 | this.mScrollY = scrollY; |
| 38 | } |
| 39 | |
| 40 | public void onBeginDrag(View view) { |
| 41 | mDraggedViews.add(view); |
| 42 | } |
| 43 | |
| 44 | public void onDragFinished(View view) { |
| 45 | mDraggedViews.remove(view); |
| 46 | } |
| 47 | |
| 48 | public ArrayList<View> getDraggedViews() { |
| 49 | return mDraggedViews; |
| 50 | } |
| 51 | |
| 52 | /** |
| 53 | * @param dimmed Whether we are in a dimmed state (on the lockscreen), where the backgrounds are |
| 54 | * translucent and everything is scaled back a bit. |
| 55 | */ |
| 56 | public void setDimmed(boolean dimmed) { |
| 57 | mDimmed = dimmed; |
| 58 | } |
| 59 | |
| 60 | /** |
| 61 | * In dimmed mode, a child can be activated, which happens on the first tap of the double-tap |
| 62 | * interaction. This child is then scaled normally and its background is fully opaque. |
| 63 | */ |
| 64 | public void setActivatedChild(View activatedChild) { |
| 65 | mActivatedChild = activatedChild; |
| 66 | } |
| 67 | |
| 68 | public boolean isDimmed() { |
| 69 | return mDimmed; |
| 70 | } |
| 71 | |
| 72 | public View getActivatedChild() { |
| 73 | return mActivatedChild; |
| 74 | } |
| 75 | } |