blob: ddb5cb8cdd6a3ca09a7fd68e9069cc93d3e60f13 [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 Jaggiae441282014-08-01 02:45:18 +020037 private boolean mHideSensitive;
Jorim Jaggid552d9d2014-05-07 19:41:13 +020038
39 public int getScrollY() {
40 return mScrollY;
41 }
42
43 public void setScrollY(int scrollY) {
44 this.mScrollY = scrollY;
45 }
46
47 public void onBeginDrag(View view) {
48 mDraggedViews.add(view);
49 }
50
51 public void onDragFinished(View view) {
52 mDraggedViews.remove(view);
53 }
54
55 public ArrayList<View> getDraggedViews() {
56 return mDraggedViews;
57 }
58
59 /**
60 * @param dimmed Whether we are in a dimmed state (on the lockscreen), where the backgrounds are
61 * translucent and everything is scaled back a bit.
62 */
63 public void setDimmed(boolean dimmed) {
64 mDimmed = dimmed;
65 }
66
John Spurlockbf370992014-06-17 13:58:31 -040067 /** In dark mode, we draw as little as possible, assuming a black background */
68 public void setDark(boolean dark) {
69 mDark = dark;
70 }
71
Jorim Jaggiae441282014-08-01 02:45:18 +020072 public void setHideSensitive(boolean hideSensitive) {
73 mHideSensitive = hideSensitive;
74 }
75
Jorim Jaggid552d9d2014-05-07 19:41:13 +020076 /**
77 * In dimmed mode, a child can be activated, which happens on the first tap of the double-tap
78 * interaction. This child is then scaled normally and its background is fully opaque.
79 */
Selim Cineka32ab602014-06-11 15:06:01 +020080 public void setActivatedChild(ActivatableNotificationView activatedChild) {
Jorim Jaggid552d9d2014-05-07 19:41:13 +020081 mActivatedChild = activatedChild;
82 }
83
84 public boolean isDimmed() {
85 return mDimmed;
86 }
87
John Spurlockbf370992014-06-17 13:58:31 -040088 public boolean isDark() {
89 return mDark;
90 }
91
Jorim Jaggiae441282014-08-01 02:45:18 +020092 public boolean isHideSensitive() {
93 return mHideSensitive;
94 }
95
Selim Cineka32ab602014-06-11 15:06:01 +020096 public ActivatableNotificationView getActivatedChild() {
Jorim Jaggid552d9d2014-05-07 19:41:13 +020097 return mActivatedChild;
98 }
Selim Cinek8d9ff9c2014-05-12 15:13:04 +020099
100 public void setOverScrollAmount(float amount, boolean onTop) {
101 if (onTop) {
102 mOverScrollTopAmount = amount;
103 } else {
104 mOverScrollBottomAmount = amount;
105 }
106 }
107
Selim Cinekf54090e2014-06-17 17:24:51 -0700108 public void setScrimAmount(float scrimAmount) {
109 mScrimAmount = scrimAmount;
110 }
111
112 public float getScrimAmount() {
113 return mScrimAmount;
114 }
115
Selim Cinek8d9ff9c2014-05-12 15:13:04 +0200116 public float getOverScrollAmount(boolean top) {
117 return top ? mOverScrollTopAmount : mOverScrollBottomAmount;
118 }
Selim Cinekc27437b2014-05-14 10:23:33 +0200119
120 public int getSpeedBumpIndex() {
121 return mSpeedBumpIndex;
122 }
123
124 public void setSpeedBumpIndex(int speedBumpIndex) {
125 mSpeedBumpIndex = speedBumpIndex;
126 }
Jorim Jaggid552d9d2014-05-07 19:41:13 +0200127}