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

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

Issue 2175353003: [Remoting Android] Define feedback animation size in dp (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Set up radius inside AbstractDesktopView Created 4 years, 5 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/AbstractDesktopView.java
diff --git a/remoting/android/java/src/org/chromium/chromoting/AbstractDesktopView.java b/remoting/android/java/src/org/chromium/chromoting/AbstractDesktopView.java
index 3dae8a2c8c83c570a281cac62a7dd0ff54e359c1..524c1c828f0e6364d2083d854163f3e32af07425 100644
--- a/remoting/android/java/src/org/chromium/chromoting/AbstractDesktopView.java
+++ b/remoting/android/java/src/org/chromium/chromoting/AbstractDesktopView.java
@@ -38,6 +38,9 @@ public abstract class AbstractDesktopView extends SurfaceView {
protected final Event.Raisable<SizeChangedEventParameter> mOnHostSizeChanged =
new Event.Raisable<>();
+ protected final int mSmallFeedbackPixelRadius;
+ protected final int mLargeFeedbackPixelRadius;
+
/** The parent Desktop activity. */
private final Desktop mDesktop;
@@ -54,6 +57,12 @@ public abstract class AbstractDesktopView 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);
+
+ mLargeFeedbackPixelRadius = getResources()
+ .getDimensionPixelSize(R.dimen.feedback_animation_radius_large);
}
// TODO(yuweih): move showActionBar and showKeyboard out of this abstract class.
@@ -112,7 +121,28 @@ public abstract class AbstractDesktopView extends SurfaceView {
}
/** Triggers a brief animation to indicate the existence and location of an input event. */
- public abstract void showInputFeedback(InputFeedbackType feedbackToShow, Point pos);
+ public final void showInputFeedback(InputFeedbackType feedbackToShow, Point pos) {
+ float radius;
+ switch (feedbackToShow) {
+ case SMALL_ANIMATION:
+ radius = mSmallFeedbackPixelRadius;
+ break;
+ case LARGE_ANIMATION:
+ radius = mLargeFeedbackPixelRadius;
+ break;
+ default:
+ // Unreachable, but required by Google Java style and findbugs.
+ assert false : "Unreached";
+ radius = 0.0f;
+ }
+ showInputFeedback(radius, pos);
+ }
+
+ /**
+ * Triggers a brief animation to indicate the existence and location of an input event.
+ * Subclass should implement this function to draw the animation on the canvas.
+ */
+ public abstract void showInputFeedback(float feedbackRadius, Point pos);
Lambros 2016/07/26 01:53:58 It's better to keep the original abstract interfac
Yuwei 2016/07/26 18:47:26 I'm not sure whether we want to have different fee
/**
* Informs the view that its transformation matrix (for rendering the remote desktop bitmap)

Powered by Google App Engine
This is Rietveld 408576698