blob: 6d92b058b5989ee50364f1f4f18a5498f78689c3 [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;
Jorim Jaggid552d9d2014-05-07 19:41:13 +020035
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 Cineka32ab602014-06-11 15:06:01 +020068 public void setActivatedChild(ActivatableNotificationView activatedChild) {
Jorim Jaggid552d9d2014-05-07 19:41:13 +020069 mActivatedChild = activatedChild;
70 }
71
72 public boolean isDimmed() {
73 return mDimmed;
74 }
75
Selim Cineka32ab602014-06-11 15:06:01 +020076 public ActivatableNotificationView getActivatedChild() {
Jorim Jaggid552d9d2014-05-07 19:41:13 +020077 return mActivatedChild;
78 }
Selim Cinek8d9ff9c2014-05-12 15:13:04 +020079
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 Cinekc27437b2014-05-14 10:23:33 +020091
92 public int getSpeedBumpIndex() {
93 return mSpeedBumpIndex;
94 }
95
96 public void setSpeedBumpIndex(int speedBumpIndex) {
97 mSpeedBumpIndex = speedBumpIndex;
98 }
Jorim Jaggid552d9d2014-05-07 19:41:13 +020099}