• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package com.android.documentsui;
2 
3 import android.graphics.Point;
4 import android.support.v7.widget.RecyclerView;
5 
6 public class TestInputEvent implements Events.InputEvent {
7 
8     public boolean mouseEvent;
9     public boolean primaryButtonPressed;
10     public boolean secondaryButtonPressed;
11     public boolean shiftKeyDow;
12     public boolean actionDown;
13     public boolean actionUp;
14     public Point location;
15     public int position = Integer.MIN_VALUE;
16 
TestInputEvent()17     public TestInputEvent() {}
18 
TestInputEvent(int position)19     public TestInputEvent(int position) {
20         this.position = position;
21     }
22 
23     @Override
isMouseEvent()24     public boolean isMouseEvent() {
25         return mouseEvent;
26     }
27 
28     @Override
isPrimaryButtonPressed()29     public boolean isPrimaryButtonPressed() {
30         return primaryButtonPressed;
31     }
32 
33     @Override
isSecondaryButtonPressed()34     public boolean isSecondaryButtonPressed() {
35         return secondaryButtonPressed;
36     }
37 
38     @Override
isShiftKeyDown()39     public boolean isShiftKeyDown() {
40         return shiftKeyDow;
41     }
42 
43     @Override
isActionDown()44     public boolean isActionDown() {
45         return actionDown;
46     }
47 
48     @Override
isActionUp()49     public boolean isActionUp() {
50         return actionUp;
51     }
52 
53     @Override
getOrigin()54     public Point getOrigin() {
55         return location;
56     }
57 
58     @Override
isOverItem()59     public boolean isOverItem() {
60         return position != Integer.MIN_VALUE && position != RecyclerView.NO_POSITION;
61     }
62 
63     @Override
getItemPosition()64     public int getItemPosition() {
65         return position;
66     }
67 
tap(int position)68     public static TestInputEvent tap(int position) {
69         return new TestInputEvent(position);
70     }
71 
shiftTap(int position)72     public static TestInputEvent shiftTap(int position) {
73         TestInputEvent e = new TestInputEvent(position);
74         e.shiftKeyDow = true;
75         return e;
76     }
77 
click(int position)78     public static TestInputEvent click(int position) {
79         TestInputEvent e = new TestInputEvent(position);
80         e.mouseEvent = true;
81         return e;
82     }
83 
shiftClick(int position)84     public static TestInputEvent shiftClick(int position) {
85         TestInputEvent e = new TestInputEvent(position);
86         e.mouseEvent = true;
87         e.shiftKeyDow = true;
88         return e;
89     }
90 }
91