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

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: Reviewer's Feedback 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..11968881c01aa4e904712a98795976f673da28cf 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.
@@ -111,6 +120,25 @@ public abstract class AbstractDesktopView extends SurfaceView {
return parameter.handled;
}
+ /**
+ * 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) {
+ switch (feedbackToShow) {
+ case NONE:
+ return 0.0f;
+ case SMALL_ANIMATION:
+ return mSmallFeedbackPixelRadius;
+ case LARGE_ANIMATION:
+ return mLargeFeedbackPixelRadius;
+ default:
+ // Unreachable, but required by Google Java style and findbugs.
+ assert false : "Unreached";
+ return 0.0f;
+ }
+ }
+
/** Triggers a brief animation to indicate the existence and location of an input event. */
public abstract void showInputFeedback(InputFeedbackType feedbackToShow, Point pos);
« no previous file with comments | « remoting/android/java/res/values/dimens.xml ('k') | remoting/android/java/src/org/chromium/chromoting/DesktopView.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698