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

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

Issue 2272793003: [Remoting Android] New touch feedback texture (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reviewer's Feedback Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
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 15ba26708d735e59153a9369cfca8866532f9d57..9cc3536a2f2268d60818a74a9b1a3844da2eb2b8 100644
--- a/remoting/android/java/src/org/chromium/chromoting/DesktopView.java
+++ b/remoting/android/java/src/org/chromium/chromoting/DesktopView.java
@@ -21,7 +21,12 @@ import org.chromium.chromoting.jni.Client;
*/
public abstract class DesktopView extends SurfaceView {
/** Used to define the animation feedback shown when a user touches the screen. */
- public enum InputFeedbackType { NONE, SMALL_ANIMATION, LARGE_ANIMATION }
+ public enum InputFeedbackType {
+ NONE,
+ SHORT_TOUCH_ANIMATION,
+ LONG_TOUCH_ANIMATION,
+ LONG_TRACKPAD_ANIMATION
+ }
protected final RenderData mRenderData;
protected final TouchInputHandler mInputHandler;
@@ -38,8 +43,9 @@ public abstract class DesktopView extends SurfaceView {
protected final Event.Raisable<SizeChangedEventParameter> mOnHostSizeChanged =
new Event.Raisable<>();
- private final int mSmallFeedbackPixelRadius;
- private final int mLargeFeedbackPixelRadius;
+ private final int mLongTrackpadAnimationRadius;
+ private final int mShortTouchAnimationRadius;
+ private final int mLongTouchAnimationRadius;
/** The parent Desktop activity. */
private final Desktop mDesktop;
@@ -58,11 +64,14 @@ public abstract class DesktopView extends SurfaceView {
// Give this view keyboard focus, allowing us to customize the soft keyboard's settings.
setFocusableInTouchMode(true);
- mSmallFeedbackPixelRadius = getResources()
- .getDimensionPixelSize(R.dimen.feedback_animation_radius_small);
+ mLongTrackpadAnimationRadius =
+ getResources().getDimensionPixelSize(R.dimen.long_trackpad_animation_radius);
+
+ mShortTouchAnimationRadius =
+ getResources().getDimensionPixelSize(R.dimen.short_touch_animation_radius);
- mLargeFeedbackPixelRadius = getResources()
- .getDimensionPixelSize(R.dimen.feedback_animation_radius_large);
+ mLongTouchAnimationRadius =
+ getResources().getDimensionPixelSize(R.dimen.long_touch_animation_radius);
}
// TODO(yuweih): move showActionBar and showKeyboard out of this abstract class.
@@ -124,14 +133,16 @@ public abstract class DesktopView extends SurfaceView {
* Returns the radius of the given feedback type.
* 0.0f will be returned if no feedback should be shown.
*/
- protected final float getFeedbackRadius(InputFeedbackType feedbackToShow) {
+ protected final float getFeedbackRadius(InputFeedbackType feedbackToShow, float scaleFactor) {
switch (feedbackToShow) {
case NONE:
return 0.0f;
- case SMALL_ANIMATION:
- return mSmallFeedbackPixelRadius;
- case LARGE_ANIMATION:
- return mLargeFeedbackPixelRadius;
+ case SHORT_TOUCH_ANIMATION:
+ return mShortTouchAnimationRadius / scaleFactor;
+ case LONG_TOUCH_ANIMATION:
+ return mLongTouchAnimationRadius / scaleFactor;
+ case LONG_TRACKPAD_ANIMATION:
+ return mLongTrackpadAnimationRadius;
joedow 2016/08/24 19:11:06 A comment here on why this value isn't being norma
Yuwei 2016/08/24 20:05:43 Done.
default:
// Unreachable, but required by Google Java style and findbugs.
assert false : "Unreached";

Powered by Google App Engine
This is Rietveld 408576698