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
3 // found in the LICENSE file.
5 package org
.chromium
.chromoting
;
7 import android
.view
.MotionEvent
;
10 * This interface allows multiple styles of touchscreen UI to be implemented and dynamically
11 * switched. The DesktopView passes the low-level touchscreen events and other events via this
12 * interface. The implementation recognizes and processes the touchscreen gestures, and then
13 * performs actions on the DesktopView (such as panning/zooming the display, injecting input, or
14 * showing/hiding UI elements). All methods are called on the main UI thread.
16 public interface TouchInputHandler
{
17 // These constants must match those in the generated struct protoc::MouseEvent_MouseButton.
18 int BUTTON_UNDEFINED
= 0;
20 int BUTTON_MIDDLE
= 2;
24 * Processes a touch event. This should be called by the View in its onTouchEvent() handler.
26 boolean onTouchEvent(MotionEvent event
);
29 * Called when the screen configuration is changed, such as when the screen is rotated or an
30 * external display is plugged in. This is not called if the client display area changes as a
31 * result of showing/hiding UI elements such as a keyboard. For example, an implementation
32 * could set a flag to reset the zoom level when the screen is rotated, but not when the
33 * software keyboard appears. After this is called, the onClientSizeChanged() method will
34 * shortly be called with the dimensions of the new client display area.
36 void onScreenConfigurationChanged();
39 * Called whenever the client display area changes size. The caller will handle repainting
40 * after this method returns.
42 void onClientSizeChanged(int width
, int height
);
45 * Called when the host screen size is changed. The caller will handle repainting after this
48 void onHostSizeChanged(int width
, int height
);
51 * Whilst an animation is in progress, this method is called repeatedly until the animation is
52 * cancelled. After this method returns, the DesktopView will schedule a repaint.
54 void processAnimation();