Chromium Code Reviews| Index: remoting/android/java/src/org/chromium/chromoting/DesktopView.java |
| diff --git a/remoting/android/java/src/org/chromium/chromoting/DesktopView.java b/remoting/android/java/src/org/chromium/chromoting/DesktopView.java |
| index 84b0421361b4ca3e755449ce21c60f481f40630a..41c97f06c27fd9bc4ae541b43dc692a4e49909f9 100644 |
| --- a/remoting/android/java/src/org/chromium/chromoting/DesktopView.java |
| +++ b/remoting/android/java/src/org/chromium/chromoting/DesktopView.java |
| @@ -5,59 +5,37 @@ |
| package org.chromium.chromoting; |
| import android.content.Context; |
| -import android.graphics.Matrix; |
| -import android.graphics.PointF; |
| import android.text.InputType; |
| +import android.util.AttributeSet; |
| import android.view.MotionEvent; |
| import android.view.SurfaceView; |
| import android.view.inputmethod.EditorInfo; |
| import android.view.inputmethod.InputConnection; |
| import android.view.inputmethod.InputMethodManager; |
| -import org.chromium.chromoting.jni.Client; |
| - |
| /** |
| * The abstract class for viewing and interacting with a specific remote host. Handles logic |
|
joedow
2016/09/08 18:32:47
Change the comment here too since it is no longer
Yuwei
2016/09/08 23:09:14
Done.
|
| * for touch input and render data. |
| */ |
| -public abstract class DesktopView extends SurfaceView { |
| - |
| - protected final TouchInputHandler mInputHandler; |
| - |
| - /** |
| - * Subclass should trigger this event when the client view size is changed. |
| - */ |
| - protected final Event.Raisable<SizeChangedEventParameter> mOnClientSizeChanged = |
| - new Event.Raisable<>(); |
| +public class DesktopView extends SurfaceView { |
| - /** |
| - * Subclass should trigger this event when the host (desktop frame) size is changed. |
| - */ |
| - protected final Event.Raisable<SizeChangedEventParameter> mOnHostSizeChanged = |
| - new Event.Raisable<>(); |
| - |
| - /** |
| - * Subclass should trigger this event when a frame is rendered. |
| - */ |
| - protected final Event.Raisable<Void> mOnCanvasRendered = new Event.Raisable<>(); |
| + private final Event.Raisable<TouchEventParameter> mOnTouch = new Event.Raisable<>(); |
| /** The parent Desktop activity. */ |
| - private final Desktop mDesktop; |
| + private Desktop mDesktop; |
| - private final Event.Raisable<TouchEventParameter> mOnTouch = new Event.Raisable<>(); |
| - |
| - public DesktopView(Desktop desktop, Client client) { |
| - super(desktop); |
| - Preconditions.notNull(desktop); |
| - Preconditions.notNull(client); |
| - mDesktop = desktop; |
| - mInputHandler = new TouchInputHandler(this, desktop); |
| - mInputHandler.init(desktop, new InputEventSender(client)); |
| + public DesktopView(Context context, AttributeSet attributeSet) { |
| + super(context, attributeSet); |
| // Give this view keyboard focus, allowing us to customize the soft keyboard's settings. |
| setFocusableInTouchMode(true); |
| } |
| + public void init(Desktop desktop) { |
|
Yuwei
2016/09/07 20:45:40
Maybe we can get rid of this function by casting t
joedow
2016/09/08 18:32:47
Some good reasons to separate c'tor and init is if
Yuwei
2016/09/08 19:12:16
So maybe just keep the init function? Looks like t
Hzj_jie
2016/09/08 21:37:33
If you need to use Desktop instead of Context, you
Yuwei
2016/09/08 23:09:14
Acknowledged.
|
| + Preconditions.notNull(desktop); |
| + mDesktop = desktop; |
| + } |
| + |
| // TODO(yuweih): move showActionBar and showKeyboard out of this abstract class. |
| /** Shows the action bar. */ |
| public final void showActionBar() { |
| @@ -76,22 +54,6 @@ public abstract class DesktopView extends SurfaceView { |
| return mOnTouch; |
| } |
| - /** An {@link Event} which is triggered when the client size is changed. */ |
| - public final Event<SizeChangedEventParameter> onClientSizeChanged() { |
| - return mOnClientSizeChanged; |
| - } |
| - |
| - /** An {@link Event} which is triggered when the host size is changed. */ |
| - public final Event<SizeChangedEventParameter> onHostSizeChanged() { |
| - return mOnHostSizeChanged; |
| - } |
| - |
| - /** An {@link Event} which is triggered when a frame is rendered. */ |
| - public final Event<Void> onCanvasRendered() { |
| - return mOnCanvasRendered; |
| - } |
| - |
| - // View overrides. |
| /** Called when a software keyboard is requested, and specifies its options. */ |
| @Override |
| public final InputConnection onCreateInputConnection(EditorInfo outAttrs) { |
| @@ -117,25 +79,4 @@ public abstract class DesktopView extends SurfaceView { |
| mOnTouch.raise(parameter); |
| return parameter.handled; |
| } |
| - |
| - /** Triggers a brief animation to indicate the existence and location of an input event. */ |
| - public abstract void showInputFeedback(RenderStub.InputFeedbackType feedbackToShow, PointF pos); |
| - |
| - /** |
| - * Informs the view that its transformation matrix (for rendering the remote desktop bitmap) |
| - * has been changed by the TouchInputHandler, which requires repainting. |
| - */ |
| - public abstract void transformationChanged(Matrix matrix); |
| - |
| - /** |
| - * Informs the view that the cursor has been moved by the TouchInputHandler, which requires |
| - * repainting. |
| - */ |
| - public abstract void cursorMoved(PointF position); |
| - |
| - /** |
| - * Informs the view that the cursor visibility has been changed (for different input mode) by |
| - * the TouchInputHandler, which requires repainting. |
| - */ |
| - public abstract void cursorVisibilityChanged(boolean visible); |
| } |