Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Side by Side Diff: remoting/android/java/src/org/chromium/chromoting/DesktopView.java

Issue 2272253004: [Remoting Android] Move mRenderData into TouchInputHandler (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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.PointF; 9 import android.graphics.PointF;
9 import android.text.InputType; 10 import android.text.InputType;
10 import android.view.MotionEvent; 11 import android.view.MotionEvent;
11 import android.view.SurfaceView; 12 import android.view.SurfaceView;
12 import android.view.inputmethod.EditorInfo; 13 import android.view.inputmethod.EditorInfo;
13 import android.view.inputmethod.InputConnection; 14 import android.view.inputmethod.InputConnection;
14 import android.view.inputmethod.InputMethodManager; 15 import android.view.inputmethod.InputMethodManager;
15 16
16 import org.chromium.chromoting.jni.Client; 17 import org.chromium.chromoting.jni.Client;
17 18
18 /** 19 /**
19 * 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
20 * for touch input and render data. 21 * for touch input and render data.
21 */ 22 */
22 public abstract class DesktopView extends SurfaceView { 23 public abstract class DesktopView extends SurfaceView {
23 /** Used to define the animation feedback shown when a user touches the scre en. */ 24 /** Used to define the animation feedback shown when a user touches the scre en. */
24 public enum InputFeedbackType { 25 public enum InputFeedbackType {
25 NONE, 26 NONE,
26 SHORT_TOUCH_ANIMATION, 27 SHORT_TOUCH_ANIMATION,
27 LONG_TOUCH_ANIMATION, 28 LONG_TOUCH_ANIMATION,
28 LONG_TRACKPAD_ANIMATION 29 LONG_TRACKPAD_ANIMATION
29 } 30 }
30 31
31 protected final RenderData mRenderData;
32 protected final TouchInputHandler mInputHandler; 32 protected final TouchInputHandler mInputHandler;
33 33
34 /** 34 /**
35 * Subclass should trigger this event when the client view size is changed. 35 * Subclass should trigger this event when the client view size is changed.
36 */ 36 */
37 protected final Event.Raisable<SizeChangedEventParameter> mOnClientSizeChang ed = 37 protected final Event.Raisable<SizeChangedEventParameter> mOnClientSizeChang ed =
38 new Event.Raisable<>(); 38 new Event.Raisable<>();
39 39
40 /** 40 /**
41 * Subclass should trigger this event when the host (desktop frame) size is changed. 41 * Subclass should trigger this event when the host (desktop frame) size is changed.
42 */ 42 */
43 protected final Event.Raisable<SizeChangedEventParameter> mOnHostSizeChanged = 43 protected final Event.Raisable<SizeChangedEventParameter> mOnHostSizeChanged =
44 new Event.Raisable<>(); 44 new Event.Raisable<>();
45 45
46 private final int mTinyFeedbackPixelRadius; 46 private final int mTinyFeedbackPixelRadius;
47 private final int mSmallFeedbackPixelRadius; 47 private final int mSmallFeedbackPixelRadius;
48 private final int mLargeFeedbackPixelRadius; 48 private final int mLargeFeedbackPixelRadius;
49 49
50 /** The parent Desktop activity. */ 50 /** The parent Desktop activity. */
51 private final Desktop mDesktop; 51 private final Desktop mDesktop;
52 52
53 private final Event.Raisable<TouchEventParameter> mOnTouch = new Event.Raisa ble<>(); 53 private final Event.Raisable<TouchEventParameter> mOnTouch = new Event.Raisa ble<>();
54 54
55 public DesktopView(Desktop desktop, Client client) { 55 public DesktopView(Desktop desktop, Client client) {
56 super(desktop); 56 super(desktop);
57 Preconditions.notNull(desktop); 57 Preconditions.notNull(desktop);
58 Preconditions.notNull(client); 58 Preconditions.notNull(client);
59 mDesktop = desktop; 59 mDesktop = desktop;
60 mRenderData = new RenderData(); 60 mInputHandler = new TouchInputHandler(this, desktop);
61 mInputHandler = new TouchInputHandler(this, desktop, mRenderData);
62 mInputHandler.init(desktop, new InputEventSender(client)); 61 mInputHandler.init(desktop, new InputEventSender(client));
63 62
64 // Give this view keyboard focus, allowing us to customize the soft keyb oard's settings. 63 // Give this view keyboard focus, allowing us to customize the soft keyb oard's settings.
65 setFocusableInTouchMode(true); 64 setFocusableInTouchMode(true);
66 65
67 mTinyFeedbackPixelRadius = 66 mTinyFeedbackPixelRadius =
68 getResources().getDimensionPixelSize(R.dimen.feedback_animation_ radius_tiny); 67 getResources().getDimensionPixelSize(R.dimen.feedback_animation_ radius_tiny);
69 68
70 mSmallFeedbackPixelRadius = 69 mSmallFeedbackPixelRadius =
71 getResources().getDimensionPixelSize(R.dimen.feedback_animation_ radius_small); 70 getResources().getDimensionPixelSize(R.dimen.feedback_animation_ radius_small);
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 } 152 }
154 } 153 }
155 154
156 /** Triggers a brief animation to indicate the existence and location of an input event. */ 155 /** Triggers a brief animation to indicate the existence and location of an input event. */
157 public abstract void showInputFeedback(InputFeedbackType feedbackToShow, Poi ntF pos); 156 public abstract void showInputFeedback(InputFeedbackType feedbackToShow, Poi ntF pos);
158 157
159 /** 158 /**
160 * Informs the view that its transformation matrix (for rendering the remote desktop bitmap) 159 * Informs the view that its transformation matrix (for rendering the remote desktop bitmap)
161 * has been changed by the TouchInputHandler, which requires repainting. 160 * has been changed by the TouchInputHandler, which requires repainting.
162 */ 161 */
163 public abstract void transformationChanged(); 162 public abstract void transformationChanged(Matrix matrix);
164 163
165 /** 164 /**
166 * Informs the view that the cursor has been moved by the TouchInputHandler, which requires 165 * Informs the view that the cursor has been moved by the TouchInputHandler, which requires
167 * repainting. 166 * repainting.
168 */ 167 */
169 public abstract void cursorMoved(); 168 public abstract void cursorMoved(PointF position);
170 169
171 /** 170 /**
172 * Informs the view that the cursor visibility has been changed (for differe nt input mode) by 171 * Informs the view that the cursor visibility has been changed (for differe nt input mode) by
173 * the TouchInputHandler, which requires repainting. 172 * the TouchInputHandler, which requires repainting.
174 */ 173 */
175 public abstract void cursorVisibilityChanged(); 174 public abstract void cursorVisibilityChanged(boolean visible);
176 175
177 /** 176 /**
178 * Starts or stops an animation. Whilst the animation is running, the Deskto pView will 177 * Starts or stops an animation. Whilst the animation is running, the Deskto pView will
179 * periodically call TouchInputHandler.processAnimation() and repaint itself . 178 * periodically call TouchInputHandler.processAnimation() and repaint itself .
180 */ 179 */
181 public abstract void setAnimationEnabled(boolean enabled); 180 public abstract void setAnimationEnabled(boolean enabled);
182 } 181 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698