OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.chromoting; | 5 package org.chromium.chromoting; |
6 | 6 |
7 import android.graphics.Rect; | |
8 import android.view.MotionEvent; | 7 import android.view.MotionEvent; |
9 | 8 |
| 9 import org.chromium.chromoting.jni.Client; |
| 10 |
10 /** | 11 /** |
11 * This interface allows multiple styles of touchscreen UI to be implemented and
dynamically | 12 * This interface allows multiple styles of touchscreen UI to be implemented and
dynamically |
12 * switched. The DesktopView passes the low-level touchscreen events and other e
vents via this | 13 * switched. The DesktopView passes the low-level touchscreen events and other e
vents via this |
13 * interface. The implementation recognizes and processes the touchscreen gestur
es, and then | 14 * interface. The implementation recognizes and processes the touchscreen gestur
es, and then |
14 * performs actions on the DesktopView (such as panning/zooming the display, inj
ecting input, or | 15 * performs actions on the DesktopView (such as panning/zooming the display, inj
ecting input, or |
15 * showing/hiding UI elements). All methods are called on the main UI thread. | 16 * showing/hiding UI elements). All methods are called on the main UI thread. |
16 */ | 17 */ |
17 public interface TouchInputHandlerInterface { | 18 public interface TouchInputHandlerInterface { |
18 // These constants must match those in the generated struct protocol::MouseE
vent_MouseButton. | 19 // These constants must match those in the generated struct protocol::MouseE
vent_MouseButton. |
19 int BUTTON_UNDEFINED = 0; | 20 int BUTTON_UNDEFINED = 0; |
20 int BUTTON_LEFT = 1; | 21 int BUTTON_LEFT = 1; |
21 int BUTTON_MIDDLE = 2; | 22 int BUTTON_MIDDLE = 2; |
22 int BUTTON_RIGHT = 3; | 23 int BUTTON_RIGHT = 3; |
23 | 24 |
24 /** | 25 /** |
| 26 * Initializes the instance. Implementations can assume this function will b
e called exactly |
| 27 * once after constructor but before other functions. |
| 28 */ |
| 29 void init(Desktop desktop, Client client); |
| 30 |
| 31 /** |
25 * Processes a touch event. This should be called by the View in its onTouch
Event() handler. | 32 * Processes a touch event. This should be called by the View in its onTouch
Event() handler. |
26 */ | 33 */ |
27 boolean onTouchEvent(MotionEvent event); | 34 boolean onTouchEvent(MotionEvent event); |
28 | 35 |
29 /** | 36 /** |
30 * Called whenever the client display area changes size. The caller will han
dle repainting | 37 * Called whenever the client display area changes size. The caller will han
dle repainting |
31 * after this method returns. | 38 * after this method returns. |
32 */ | 39 */ |
33 void onClientSizeChanged(int width, int height); | 40 void onClientSizeChanged(int width, int height); |
34 | 41 |
35 /** | 42 /** |
36 * Called when the host screen size is changed. The caller will handle repai
nting after this | 43 * Called when the host screen size is changed. The caller will handle repai
nting after this |
37 * method returns. | 44 * method returns. |
38 */ | 45 */ |
39 void onHostSizeChanged(int width, int height); | 46 void onHostSizeChanged(int width, int height); |
40 | 47 |
41 /** | 48 /** |
42 * Called when the visibility of the soft input method has changed. | |
43 * The innerBounds parameter describes the amount of space used by SystemUI
along each edge of | |
44 * the screen. The status bar is typically shown along the top, soft input
UI is generally | |
45 * shown at the bottom. The navigation bar is shown along the bottom for ta
blets and along the | |
46 * right side for phones in landscape mode (it shown at the bottom in portra
it mode). | |
47 */ | |
48 void onSoftInputMethodVisibilityChanged(boolean inputMethodVisible, Rect inn
erBounds); | |
49 | |
50 /** | |
51 * Whilst an animation is in progress, this method is called repeatedly unti
l the animation is | 49 * Whilst an animation is in progress, this method is called repeatedly unti
l the animation is |
52 * cancelled. After this method returns, the DesktopView will schedule a rep
aint. | 50 * cancelled. After this method returns, the DesktopView will schedule a rep
aint. |
53 */ | 51 */ |
54 void processAnimation(); | 52 void processAnimation(); |
55 | |
56 /** Sets the underlying strategy to use when translating and forwarding loca
l touch input. */ | |
57 void setInputStrategy(InputStrategyInterface inputStrategy); | |
58 } | 53 } |
OLD | NEW |