Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 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. | |
| 4 | |
| 5 package org.chromium.chromoting; | |
| 6 | |
| 7 import android.graphics.Matrix; | |
| 8 import android.graphics.PointF; | |
| 9 | |
| 10 /** | |
| 11 * Interface with a set of functions to control the behavior of the remote host renderer. | |
| 12 */ | |
| 13 public interface RenderStub { | |
| 14 /** Used to define the animation feedback shown when a user touches the scre en. */ | |
| 15 enum InputFeedbackType { | |
| 16 NONE, | |
| 17 SHORT_TOUCH_ANIMATION, | |
| 18 LONG_TOUCH_ANIMATION, | |
| 19 LONG_TRACKPAD_ANIMATION | |
| 20 } | |
| 21 | |
| 22 void setDesktopView(DesktopView view); | |
| 23 | |
| 24 /** Triggers a brief animation to indicate the existence and location of an input event. */ | |
| 25 void showInputFeedback(InputFeedbackType feedbackToShow, PointF pos); | |
| 26 | |
| 27 /** | |
| 28 * Informs the view that its transformation matrix (for rendering the remote desktop bitmap) | |
|
Hzj_jie
2016/08/29 22:52:51
Maybe view -> stub, ditto.
Yuwei
2016/08/30 22:39:12
Done.
| |
| 29 * has been changed by the TouchInputHandler, which requires repainting. | |
| 30 */ | |
| 31 void setTransformation(Matrix matrix); | |
| 32 | |
| 33 /** | |
| 34 * Informs the view that the cursor has been moved by the TouchInputHandler, which requires | |
|
joedow
2016/08/29 22:35:41
I'd remove 'TouchInputHandler' as we could introdu
Yuwei
2016/08/30 22:39:12
Done.
| |
| 35 * repainting. | |
| 36 */ | |
| 37 void moveCursor(PointF pos); | |
| 38 | |
| 39 /** | |
| 40 * Informs the view that the cursor visibility has been changed (for differe nt input mode) by | |
| 41 * the TouchInputHandler, which requires repainting. | |
| 42 */ | |
| 43 void setCursorVisibility(boolean visible); | |
| 44 | |
| 45 /** | |
| 46 * Helper class for mapping a feedback type to the max radius of the feedbac k animation. | |
| 47 */ | |
| 48 final class InputFeedbackRadiusMapper { | |
|
Yuwei
2016/08/29 22:09:42
Not sure whether it is good to make this a subclas
joedow
2016/08/29 22:35:41
I think it is ok here but I'm wondering if it even
Hzj_jie
2016/08/29 22:52:51
The original design is to use a float diameter to
Yuwei
2016/08/29 23:38:21
I think there are two issues:
* Default function i
Yuwei
2016/08/30 22:08:00
I think the question here is whether we want all i
joedow
2016/08/30 23:08:33
My understanding of Lambros' point was that if you
| |
| 49 private final int mTinyFeedbackPixelRadius; | |
| 50 private final int mSmallFeedbackPixelRadius; | |
| 51 private final int mLargeFeedbackPixelRadius; | |
| 52 | |
| 53 public InputFeedbackRadiusMapper(DesktopView view) { | |
| 54 mTinyFeedbackPixelRadius = view.getResources() | |
| 55 .getDimensionPixelSize(R.dimen.feedback_animation_radius_tin y); | |
| 56 | |
| 57 mSmallFeedbackPixelRadius = view.getResources() | |
| 58 .getDimensionPixelSize(R.dimen.feedback_animation_radius_sma ll); | |
| 59 | |
| 60 mLargeFeedbackPixelRadius = view.getResources() | |
| 61 .getDimensionPixelSize(R.dimen.feedback_animation_radius_lar ge); | |
| 62 } | |
| 63 | |
| 64 /** | |
| 65 * Returns the radius of the given feedback type. | |
| 66 * 0.0f will be returned if no feedback should be shown. | |
| 67 */ | |
| 68 public float getFeedbackRadius(InputFeedbackType feedbackToShow, | |
| 69 float scaleFactor) { | |
| 70 switch (feedbackToShow) { | |
| 71 case NONE: | |
| 72 return 0.0f; | |
| 73 case SHORT_TOUCH_ANIMATION: | |
| 74 return mSmallFeedbackPixelRadius / scaleFactor; | |
| 75 case LONG_TOUCH_ANIMATION: | |
| 76 return mLargeFeedbackPixelRadius / scaleFactor; | |
| 77 case LONG_TRACKPAD_ANIMATION: | |
| 78 // The size of the longpress trackpad animation is supposed to be close to the | |
| 79 // size of the cursor so it doesn't need to be normalized an d should be scaled | |
| 80 // with the canvas. | |
| 81 return mTinyFeedbackPixelRadius; | |
| 82 default: | |
| 83 // Unreachable, but required by Google Java style and findbu gs. | |
| 84 assert false : "Unreached"; | |
| 85 return 0.0f; | |
| 86 } | |
| 87 } | |
| 88 } | |
| 89 } | |
| OLD | NEW |