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; |
Selim Cinek | a32ab60 | 2014-06-11 15:06:01 +0200 | [diff] [blame^] | 20 | import com.android.systemui.statusbar.ActivatableNotificationView; |
Jorim Jaggi | d552d9d | 2014-05-07 19:41:13 +0200 | [diff] [blame] | 21 | |
| 22 | import java.util.ArrayList; |
| 23 | |
| 24 | /** |
| 25 | * A global state to track all input states for the algorithm. |
| 26 | */ |
| 27 | public class AmbientState { |
| 28 | private ArrayList<View> mDraggedViews = new ArrayList<View>(); |
| 29 | private int mScrollY; |
| 30 | private boolean mDimmed; |
Selim Cinek | a32ab60 | 2014-06-11 15:06:01 +0200 | [diff] [blame^] | 31 | private ActivatableNotificationView mActivatedChild; |
Selim Cinek | 8d9ff9c | 2014-05-12 15:13:04 +0200 | [diff] [blame] | 32 | private float mOverScrollTopAmount; |
| 33 | private float mOverScrollBottomAmount; |
Selim Cinek | c27437b | 2014-05-14 10:23:33 +0200 | [diff] [blame] | 34 | private int mSpeedBumpIndex = -1; |
Jorim Jaggi | d552d9d | 2014-05-07 19:41:13 +0200 | [diff] [blame] | 35 | |
| 36 | public int getScrollY() { |
| 37 | return mScrollY; |
| 38 | } |
| 39 | |
| 40 | public void setScrollY(int scrollY) { |
| 41 | this.mScrollY = scrollY; |
| 42 | } |
| 43 | |
| 44 | public void onBeginDrag(View view) { |
| 45 | mDraggedViews.add(view); |
| 46 | } |
| 47 | |
| 48 | public void onDragFinished(View view) { |
| 49 | mDraggedViews.remove(view); |
| 50 | } |
| 51 | |
| 52 | public ArrayList<View> getDraggedViews() { |
| 53 | return mDraggedViews; |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * @param dimmed Whether we are in a dimmed state (on the lockscreen), where the backgrounds are |
| 58 | * translucent and everything is scaled back a bit. |
| 59 | */ |
| 60 | public void setDimmed(boolean dimmed) { |
| 61 | mDimmed = dimmed; |
| 62 | } |
| 63 | |
| 64 | /** |
| 65 | * In dimmed mode, a child can be activated, which happens on the first tap of the double-tap |
| 66 | * interaction. This child is then scaled normally and its background is fully opaque. |
| 67 | */ |
Selim Cinek | a32ab60 | 2014-06-11 15:06:01 +0200 | [diff] [blame^] | 68 | public void setActivatedChild(ActivatableNotificationView activatedChild) { |
Jorim Jaggi | d552d9d | 2014-05-07 19:41:13 +0200 | [diff] [blame] | 69 | mActivatedChild = activatedChild; |
| 70 | } |
| 71 | |
| 72 | public boolean isDimmed() { |
| 73 | return mDimmed; |
| 74 | } |
| 75 | |
Selim Cinek | a32ab60 | 2014-06-11 15:06:01 +0200 | [diff] [blame^] | 76 | public ActivatableNotificationView getActivatedChild() { |
Jorim Jaggi | d552d9d | 2014-05-07 19:41:13 +0200 | [diff] [blame] | 77 | return mActivatedChild; |
| 78 | } |
Selim Cinek | 8d9ff9c | 2014-05-12 15:13:04 +0200 | [diff] [blame] | 79 | |
| 80 | public void setOverScrollAmount(float amount, boolean onTop) { |
| 81 | if (onTop) { |
| 82 | mOverScrollTopAmount = amount; |
| 83 | } else { |
| 84 | mOverScrollBottomAmount = amount; |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | public float getOverScrollAmount(boolean top) { |
| 89 | return top ? mOverScrollTopAmount : mOverScrollBottomAmount; |
| 90 | } |
Selim Cinek | c27437b | 2014-05-14 10:23:33 +0200 | [diff] [blame] | 91 | |
| 92 | public int getSpeedBumpIndex() { |
| 93 | return mSpeedBumpIndex; |
| 94 | } |
| 95 | |
| 96 | public void setSpeedBumpIndex(int speedBumpIndex) { |
| 97 | mSpeedBumpIndex = speedBumpIndex; |
| 98 | } |
Jorim Jaggi | d552d9d | 2014-05-07 19:41:13 +0200 | [diff] [blame] | 99 | } |