1 /*
2  * Copyright (C) 2022 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 android.platform.spectatio.configs;
18 
19 import com.google.gson.annotations.SerializedName;
20 
21 /** Scroll Config for Workflow Task in Spectatio Config JSON Config */
22 public class ScrollConfig {
23     // If task needs scrolling, provide Scroll Action e.g. USE_BUTTON or USE_GESTURE
24     @SerializedName("SCROLL_ACTION")
25     private String mScrollAction;
26 
27     // If task needs scrolling and Scroll Action = USE_GESTURE, provide Scroll Direction
28     // e.g. Horizontal or VERTICAL
29     @SerializedName("SCROLL_DIRECTION")
30     private String mScrollDirection;
31 
32     // If task needs scrolling and Scroll Action = USE_BUTTON, provide Scroll Forward Button
33     @SerializedName("SCROLL_FORWARD")
34     private UiElement mScrollForward;
35 
36     // If task needs scrolling and Scroll Action = USE_BUTTON, provide Scroll Backward Button
37     @SerializedName("SCROLL_BACKWARD")
38     private UiElement mScrollBackward;
39 
40     // If task needs scrolling and Scroll Action = USE_GESTURE, provide Scroll Element
41     @SerializedName("SCROLL_ELEMENT")
42     private UiElement mScrollElement;
43 
44     // If task needs scrolling and Scroll Action = USE_GESTURE, provide Scroll Margin
45     @SerializedName("SCROLL_MARGIN")
46     private String mScrollMargin = "10";
47 
48     // If task needs scrolling and Scroll Action = USE_GESTURE, provide Scroll wait time
49     @SerializedName("SCROLL_WAIT_TIME")
50     private String mScrollWaitTime = "1";
51 
ScrollConfig( String scrollAction, String scrollDirection, UiElement scrollForward, UiElement scrollBackward, UiElement scrollElement)52     public ScrollConfig(
53             String scrollAction,
54             String scrollDirection,
55             UiElement scrollForward,
56             UiElement scrollBackward,
57             UiElement scrollElement) {
58         mScrollAction = scrollAction;
59         mScrollDirection = scrollDirection;
60         mScrollForward = scrollForward;
61         mScrollBackward = scrollBackward;
62         mScrollElement = scrollElement;
63     }
64 
ScrollConfig(String scrollAction, UiElement scrollForward, UiElement scrollBackward)65     public ScrollConfig(String scrollAction, UiElement scrollForward, UiElement scrollBackward) {
66         mScrollAction = scrollAction;
67         mScrollForward = scrollForward;
68         mScrollBackward = scrollBackward;
69     }
70 
ScrollConfig( String scrollAction, String scrollDirection, UiElement scrollElement, String scrollMargin, String scrollWaitTime)71     public ScrollConfig(
72             String scrollAction,
73             String scrollDirection,
74             UiElement scrollElement,
75             String scrollMargin,
76             String scrollWaitTime) {
77         mScrollAction = scrollAction;
78         mScrollDirection = scrollDirection;
79         mScrollElement = scrollElement;
80 
81         if (scrollMargin != null) {
82             mScrollMargin = scrollMargin;
83         }
84         if (scrollWaitTime != null) {
85             mScrollWaitTime = scrollWaitTime;
86         }
87     }
88 
getScrollAction()89     public String getScrollAction() {
90         return mScrollAction;
91     }
92 
getScrollDirection()93     public String getScrollDirection() {
94         return mScrollDirection;
95     }
96 
getScrollForwardButton()97     public UiElement getScrollForwardButton() {
98         return mScrollForward;
99     }
100 
getScrollBackwardButton()101     public UiElement getScrollBackwardButton() {
102         return mScrollBackward;
103     }
104 
getScrollElement()105     public UiElement getScrollElement() {
106         return mScrollElement;
107     }
108 
109     /** Getter Function for ScrollMargin */
getScrollMargin()110     public String getScrollMargin() {
111         return mScrollMargin;
112     }
113 
114     /** Getter Function for ScrollWaitTime */
getScrollWaitTime()115     public String getScrollWaitTime() {
116         return mScrollWaitTime;
117     }
118 }
119