| 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.view.MotionEvent; | |
| 8 | |
| 9 import org.chromium.chromoting.jni.Client; | 7 import org.chromium.chromoting.jni.Client; |
| 10 | 8 |
| 11 /** | 9 /** |
| 12 * This interface allows multiple styles of touchscreen UI to be implemented and
dynamically | 10 * This interface allows multiple styles of touchscreen UI to be implemented and
dynamically |
| 13 * switched. The DesktopView passes the low-level touchscreen events and other e
vents via this | 11 * switched. The DesktopView passes the low-level touchscreen events and other e
vents via this |
| 14 * interface. The implementation recognizes and processes the touchscreen gestur
es, and then | 12 * interface. The implementation recognizes and processes the touchscreen gestur
es, and then |
| 15 * performs actions on the DesktopView (such as panning/zooming the display, inj
ecting input, or | 13 * performs actions on the DesktopView (such as panning/zooming the display, inj
ecting input, or |
| 16 * showing/hiding UI elements). All methods are called on the main UI thread. | 14 * showing/hiding UI elements). All methods are called on the main UI thread. |
| 17 */ | 15 */ |
| 18 public interface TouchInputHandlerInterface { | 16 public interface TouchInputHandlerInterface { |
| 19 // These constants must match those in the generated struct protocol::MouseE
vent_MouseButton. | 17 // These constants must match those in the generated struct protocol::MouseE
vent_MouseButton. |
| 20 int BUTTON_UNDEFINED = 0; | 18 int BUTTON_UNDEFINED = 0; |
| 21 int BUTTON_LEFT = 1; | 19 int BUTTON_LEFT = 1; |
| 22 int BUTTON_MIDDLE = 2; | 20 int BUTTON_MIDDLE = 2; |
| 23 int BUTTON_RIGHT = 3; | 21 int BUTTON_RIGHT = 3; |
| 24 | 22 |
| 25 /** | 23 /** |
| 26 * Initializes the instance. Implementations can assume this function will b
e called exactly | 24 * Initializes the instance. Implementations can assume this function will b
e called exactly |
| 27 * once after constructor but before other functions. | 25 * once after constructor but before other functions. |
| 28 */ | 26 */ |
| 29 void init(Desktop desktop, Client client); | 27 void init(Desktop desktop, Client client); |
| 30 | 28 |
| 31 /** | 29 /** |
| 32 * Processes a touch event. This should be called by the View in its onTouch
Event() handler. | |
| 33 */ | |
| 34 boolean onTouchEvent(MotionEvent event); | |
| 35 | |
| 36 /** | |
| 37 * Called whenever the client display area changes size. The caller will han
dle repainting | |
| 38 * after this method returns. | |
| 39 */ | |
| 40 void onClientSizeChanged(int width, int height); | |
| 41 | |
| 42 /** | |
| 43 * Called when the host screen size is changed. The caller will handle repai
nting after this | |
| 44 * method returns. | |
| 45 */ | |
| 46 void onHostSizeChanged(int width, int height); | |
| 47 | |
| 48 /** | |
| 49 * Whilst an animation is in progress, this method is called repeatedly unti
l the animation is | 30 * Whilst an animation is in progress, this method is called repeatedly unti
l the animation is |
| 50 * cancelled. After this method returns, the DesktopView will schedule a rep
aint. | 31 * cancelled. After this method returns, the DesktopView will schedule a rep
aint. |
| 51 */ | 32 */ |
| 52 void processAnimation(); | 33 void processAnimation(); |
| 53 } | 34 } |
| OLD | NEW |