| 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.content.Context; | 7 import android.content.Context; |
| 8 import android.graphics.Matrix; | 8 import android.graphics.Matrix; |
| 9 import android.graphics.PointF; | 9 import android.graphics.PointF; |
| 10 import android.text.InputType; | 10 import android.text.InputType; |
| 11 import android.view.MotionEvent; | 11 import android.view.MotionEvent; |
| 12 import android.view.SurfaceView; | 12 import android.view.SurfaceView; |
| 13 import android.view.inputmethod.EditorInfo; | 13 import android.view.inputmethod.EditorInfo; |
| 14 import android.view.inputmethod.InputConnection; | 14 import android.view.inputmethod.InputConnection; |
| 15 import android.view.inputmethod.InputMethodManager; | 15 import android.view.inputmethod.InputMethodManager; |
| 16 | 16 |
| 17 import org.chromium.chromoting.jni.Client; | 17 import org.chromium.chromoting.jni.Client; |
| 18 | 18 |
| 19 /** | 19 /** |
| 20 * The abstract class for viewing and interacting with a specific remote host. H
andles logic | 20 * The abstract class for viewing and interacting with a specific remote host. H
andles logic |
| 21 * for touch input and render data. | 21 * for touch input and render data. |
| 22 */ | 22 */ |
| 23 public abstract class DesktopView extends SurfaceView { | 23 public abstract class DesktopView extends SurfaceView { |
| 24 /** Used to define the animation feedback shown when a user touches the scre
en. */ | |
| 25 public enum InputFeedbackType { | |
| 26 NONE, | |
| 27 SHORT_TOUCH_ANIMATION, | |
| 28 LONG_TOUCH_ANIMATION, | |
| 29 LONG_TRACKPAD_ANIMATION | |
| 30 } | |
| 31 | 24 |
| 32 protected final TouchInputHandler mInputHandler; | 25 protected final TouchInputHandler mInputHandler; |
| 33 | 26 |
| 34 /** | 27 /** |
| 35 * Subclass should trigger this event when the client view size is changed. | 28 * Subclass should trigger this event when the client view size is changed. |
| 36 */ | 29 */ |
| 37 protected final Event.Raisable<SizeChangedEventParameter> mOnClientSizeChang
ed = | 30 protected final Event.Raisable<SizeChangedEventParameter> mOnClientSizeChang
ed = |
| 38 new Event.Raisable<>(); | 31 new Event.Raisable<>(); |
| 39 | 32 |
| 40 /** | 33 /** |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 | 112 |
| 120 /** Called whenever the user attempts to touch the canvas. */ | 113 /** Called whenever the user attempts to touch the canvas. */ |
| 121 @Override | 114 @Override |
| 122 public final boolean onTouchEvent(MotionEvent event) { | 115 public final boolean onTouchEvent(MotionEvent event) { |
| 123 TouchEventParameter parameter = new TouchEventParameter(event); | 116 TouchEventParameter parameter = new TouchEventParameter(event); |
| 124 mOnTouch.raise(parameter); | 117 mOnTouch.raise(parameter); |
| 125 return parameter.handled; | 118 return parameter.handled; |
| 126 } | 119 } |
| 127 | 120 |
| 128 /** Triggers a brief animation to indicate the existence and location of an
input event. */ | 121 /** Triggers a brief animation to indicate the existence and location of an
input event. */ |
| 129 public abstract void showInputFeedback(InputFeedbackType feedbackToShow, Poi
ntF pos); | 122 public abstract void showInputFeedback(RenderStub.InputFeedbackType feedback
ToShow, PointF pos); |
| 130 | 123 |
| 131 /** | 124 /** |
| 132 * Informs the view that its transformation matrix (for rendering the remote
desktop bitmap) | 125 * Informs the view that its transformation matrix (for rendering the remote
desktop bitmap) |
| 133 * has been changed by the TouchInputHandler, which requires repainting. | 126 * has been changed by the TouchInputHandler, which requires repainting. |
| 134 */ | 127 */ |
| 135 public abstract void transformationChanged(Matrix matrix); | 128 public abstract void transformationChanged(Matrix matrix); |
| 136 | 129 |
| 137 /** | 130 /** |
| 138 * Informs the view that the cursor has been moved by the TouchInputHandler,
which requires | 131 * Informs the view that the cursor has been moved by the TouchInputHandler,
which requires |
| 139 * repainting. | 132 * repainting. |
| 140 */ | 133 */ |
| 141 public abstract void cursorMoved(PointF position); | 134 public abstract void cursorMoved(PointF position); |
| 142 | 135 |
| 143 /** | 136 /** |
| 144 * Informs the view that the cursor visibility has been changed (for differe
nt input mode) by | 137 * Informs the view that the cursor visibility has been changed (for differe
nt input mode) by |
| 145 * the TouchInputHandler, which requires repainting. | 138 * the TouchInputHandler, which requires repainting. |
| 146 */ | 139 */ |
| 147 public abstract void cursorVisibilityChanged(boolean visible); | 140 public abstract void cursorVisibilityChanged(boolean visible); |
| 148 } | 141 } |
| OLD | NEW |