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

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

Issue 2297073002: [Remoting Android] Move feedback type to radius logic out of DesktopView (Closed)
Patch Set: Add mapper 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
(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 /**
8 * Helper class for mapping a feedback type to the max radius of the feedback an imation.
9 */
10 public final class InputFeedbackRadiusMapper {
11 private final int mTinyFeedbackPixelRadius;
12 private final int mSmallFeedbackPixelRadius;
13 private final int mLargeFeedbackPixelRadius;
14
15 public InputFeedbackRadiusMapper(DesktopView view) {
Hzj_jie 2016/08/31 01:31:59 DesktopView -> View
Yuwei 2016/08/31 18:25:34 Done.
16 mTinyFeedbackPixelRadius = view.getResources()
17 .getDimensionPixelSize(R.dimen.feedback_animation_radius_tiny);
18
19 mSmallFeedbackPixelRadius = view.getResources()
20 .getDimensionPixelSize(R.dimen.feedback_animation_radius_small);
21
22 mLargeFeedbackPixelRadius = view.getResources()
23 .getDimensionPixelSize(R.dimen.feedback_animation_radius_large);
24 }
25
26 /**
27 * Returns the radius of the given feedback type.
28 * 0.0f will be returned if no feedback should be shown.
29 */
30 public float getFeedbackRadius(DesktopView.InputFeedbackType feedbackToShow,
Hzj_jie 2016/08/31 01:31:59 Won't InputFeedbackType be in RenderStub? I suppo
Yuwei 2016/08/31 01:36:13 Probably not. I think it makes more sense to be a
Hzj_jie 2016/08/31 01:38:43 No, I mean DesktopView.InputFeedbackType -> Render
Yuwei 2016/08/31 18:25:34 Yep.
31 float scaleFactor) {
32 switch (feedbackToShow) {
33 case NONE:
34 return 0.0f;
35 case SHORT_TOUCH_ANIMATION:
36 return mSmallFeedbackPixelRadius / scaleFactor;
37 case LONG_TOUCH_ANIMATION:
38 return mLargeFeedbackPixelRadius / scaleFactor;
39 case LONG_TRACKPAD_ANIMATION:
40 // The size of the longpress trackpad animation is supposed to b e close to the
41 // size of the cursor so it doesn't need to be normalized and sh ould be scaled
42 // with the canvas.
43 return mTinyFeedbackPixelRadius;
44 default:
45 // Unreachable, but required by Google Java style and findbugs.
46 assert false : "Unreached";
47 return 0.0f;
48 }
49 }
50 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698