OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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.view.View; | 7 import android.view.View; |
8 | 8 |
9 /** | 9 /** |
10 * Helper class for mapping a feedback type to the max radius of the feedback an
imation circle. | 10 * Helper class for mapping a feedback type to the max radius of the feedback an
imation circle. |
(...skipping 13 matching lines...) Expand all Loading... |
24 mLargeFeedbackPixelRadius = view.getResources() | 24 mLargeFeedbackPixelRadius = view.getResources() |
25 .getDimensionPixelSize(R.dimen.feedback_animation_radius_large); | 25 .getDimensionPixelSize(R.dimen.feedback_animation_radius_large); |
26 } | 26 } |
27 | 27 |
28 /** | 28 /** |
29 * @param feedbackToShow the feedback type to be mapped to the radius of the
feedback circle. | 29 * @param feedbackToShow the feedback type to be mapped to the radius of the
feedback circle. |
30 * @param scaleFactor Current scale factor of the desktop canvas. | 30 * @param scaleFactor Current scale factor of the desktop canvas. |
31 * @return the radius of the given feedback type. It may be 0, in which case
nothing needs to | 31 * @return the radius of the given feedback type. It may be 0, in which case
nothing needs to |
32 * be shown. | 32 * be shown. |
33 */ | 33 */ |
34 public float getFeedbackRadius(DesktopView.InputFeedbackType feedbackToShow, | 34 public float getFeedbackRadius(RenderStub.InputFeedbackType feedbackToShow, |
35 float scaleFactor) { | 35 float scaleFactor) { |
36 switch (feedbackToShow) { | 36 switch (feedbackToShow) { |
37 case NONE: | 37 case NONE: |
38 return 0.0f; | 38 return 0.0f; |
39 case SHORT_TOUCH_ANIMATION: | 39 case SHORT_TOUCH_ANIMATION: |
40 return mSmallFeedbackPixelRadius / scaleFactor; | 40 return mSmallFeedbackPixelRadius / scaleFactor; |
41 case LONG_TOUCH_ANIMATION: | 41 case LONG_TOUCH_ANIMATION: |
42 return mLargeFeedbackPixelRadius / scaleFactor; | 42 return mLargeFeedbackPixelRadius / scaleFactor; |
43 case LONG_TRACKPAD_ANIMATION: | 43 case LONG_TRACKPAD_ANIMATION: |
44 // The size of the longpress trackpad animation is supposed to b
e close to the | 44 // The size of the longpress trackpad animation is supposed to b
e close to the |
45 // size of the cursor so it doesn't need to be normalized and sh
ould be scaled | 45 // size of the cursor so it doesn't need to be normalized and sh
ould be scaled |
46 // with the canvas. | 46 // with the canvas. |
47 return mTinyFeedbackPixelRadius; | 47 return mTinyFeedbackPixelRadius; |
48 default: | 48 default: |
49 // Unreachable, but required by Google Java style and findbugs. | 49 // Unreachable, but required by Google Java style and findbugs. |
50 assert false : "Unreached"; | 50 assert false : "Unreached"; |
51 return 0.0f; | 51 return 0.0f; |
52 } | 52 } |
53 } | 53 } |
54 } | 54 } |
OLD | NEW |