blob: 0582140b0e87c44102335cd8c49dd353ebee7c75 [file] [log] [blame]
Jorim Jaggid552d9d2014-05-07 19:41:13 +02001/*
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
17package com.android.systemui.statusbar.stack;
18
19import android.view.View;
Selim Cineka32ab602014-06-11 15:06:01 +020020import com.android.systemui.statusbar.ActivatableNotificationView;
Jorim Jaggid552d9d2014-05-07 19:41:13 +020021
22import java.util.ArrayList;
23
24/**
25 * A global state to track all input states for the algorithm.
26 */
27public class AmbientState {
28 private ArrayList<View> mDraggedViews = new ArrayList<View>();
29 private int mScrollY;
30 private boolean mDimmed;
Selim Cineka32ab602014-06-11 15:06:01 +020031 private ActivatableNotificationView mActivatedChild;
Selim Cinek8d9ff9c2014-05-12 15:13:04 +020032 private float mOverScrollTopAmount;
33 private float mOverScrollBottomAmount;
Selim Cinekc27437b2014-05-14 10:23:33 +020034 private int mSpeedBumpIndex = -1;
Selim Cinekf54090e2014-06-17 17:24:51 -070035 private float mScrimAmount;
John Spurlockbf370992014-06-17 13:58:31 -040036 private boolean mDark;
Jorim Jaggid552d9d2014-05-07 19:41:13 +020037
38 public int getScrollY() {
39 return mScrollY;
40 }
41
42 public void setScrollY(int scrollY) {
43 this.mScrollY = scrollY;
44 }
45
46 public void onBeginDrag(View view) {
47 mDraggedViews.add(view);
48 }
49
50 public void onDragFinished(View view) {
51 mDraggedViews.remove(view);
52 }
53
54 public ArrayList<View> getDraggedViews() {
55 return mDraggedViews;
56 }
57
58 /**
59 * @param dimmed Whether we are in a dimmed state (on the lockscreen), where the backgrounds are
60 * translucent and everything is scaled back a bit.
61 */
62 public void setDimmed(boolean dimmed) {
63 mDimmed = dimmed;
64 }
65
John Spurlockbf370992014-06-17 13:58:31 -040066 /** In dark mode, we draw as little as possible, assuming a black background */
67 public void setDark(boolean dark) {
68 mDark = dark;
69 }
70
Jorim Jaggid552d9d2014-05-07 19:41:13 +020071 /**
72 * In dimmed mode, a child can be activated, which happens on the first tap of the double-tap
73 * interaction. This child is then scaled normally and its background is fully opaque.
74 */
Selim Cineka32ab602014-06-11 15:06:01 +020075 public void setActivatedChild(ActivatableNotificationView activatedChild) {
Jorim Jaggid552d9d2014-05-07 19:41:13 +020076 mActivatedChild = activatedChild;
77 }
78
79 public boolean isDimmed() {
80 return mDimmed;
81 }
82
John Spurlockbf370992014-06-17 13:58:31 -040083 public boolean isDark() {
84 return mDark;
85 }
86
Selim Cineka32ab602014-06-11 15:06:01 +020087 public ActivatableNotificationView getActivatedChild() {
Jorim Jaggid552d9d2014-05-07 19:41:13 +020088 return mActivatedChild;
89 }
Selim Cinek8d9ff9c2014-05-12 15:13:04 +020090
91 public void setOverScrollAmount(float amount, boolean onTop) {
92 if (onTop) {
93 mOverScrollTopAmount = amount;
94 } else {
95 mOverScrollBottomAmount = amount;
96 }
97 }
98
Selim Cinekf54090e2014-06-17 17:24:51 -070099 public void setScrimAmount(float scrimAmount) {
100 mScrimAmount = scrimAmount;
101 }
102
103 public float getScrimAmount() {
104 return mScrimAmount;
105 }
106
Selim Cinek8d9ff9c2014-05-12 15:13:04 +0200107 public float getOverScrollAmount(boolean top) {
108 return top ? mOverScrollTopAmount : mOverScrollBottomAmount;
109 }
Selim Cinekc27437b2014-05-14 10:23:33 +0200110
111 public int getSpeedBumpIndex() {
112 return mSpeedBumpIndex;
113 }
114
115 public void setSpeedBumpIndex(int speedBumpIndex) {
116 mSpeedBumpIndex = speedBumpIndex;
117 }
Jorim Jaggid552d9d2014-05-07 19:41:13 +0200118}