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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/input/PopupTouchHandleDrawable.java

Issue 701823002: Separate out Touch Selection Orientation enum (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « content/public/android/BUILD.gn ('k') | ui/touch_selection/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/android/java/src/org/chromium/content/browser/input/PopupTouchHandleDrawable.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/input/PopupTouchHandleDrawable.java b/content/public/android/java/src/org/chromium/content/browser/input/PopupTouchHandleDrawable.java
index 02fa6a1f2a1f1f7211b48cc68bb03d24417d396b..b9f465c19b7427115cec56a9b0aeb827a2b44618 100644
--- a/content/public/android/java/src/org/chromium/content/browser/input/PopupTouchHandleDrawable.java
+++ b/content/public/android/java/src/org/chromium/content/browser/input/PopupTouchHandleDrawable.java
@@ -17,6 +17,7 @@ import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.base.CalledByNative;
import org.chromium.base.JNINamespace;
import org.chromium.content.browser.PositionObserver;
+import org.chromium.ui.touch_selection.TouchHandleOrientation;
import java.lang.ref.WeakReference;
@@ -58,12 +59,7 @@ public class PopupTouchHandleDrawable extends View {
private final int[] mTempScreenCoords = new int[2];
- @SuppressLint("RtlHardcoded")
- static final int LEFT = 0;
- static final int CENTER = 1;
- @SuppressLint("RtlHardcoded")
- static final int RIGHT = 2;
- private int mOrientation = -1;
+ private int mOrientation = TouchHandleOrientation.UNDEFINED;
// Length of the delay before fading in after the last page movement.
private static final int FADE_IN_DELAY_MS = 300;
@@ -146,35 +142,40 @@ public class PopupTouchHandleDrawable extends View {
return handled;
}
+ @CalledByNative
private void setOrientation(int orientation) {
- assert orientation >= LEFT && orientation <= RIGHT;
+ assert (orientation >= TouchHandleOrientation.LEFT
+ && orientation <= TouchHandleOrientation.UNDEFINED);
if (mOrientation == orientation) return;
- final boolean hadValidOrientation = mOrientation != -1;
+ final boolean hadValidOrientation = mOrientation != TouchHandleOrientation.UNDEFINED;
mOrientation = orientation;
final int oldAdjustedPositionX = getAdjustedPositionX();
final int oldAdjustedPositionY = getAdjustedPositionY();
switch (orientation) {
- case LEFT: {
+ case TouchHandleOrientation.LEFT: {
mDrawable = HandleViewResources.getLeftHandleDrawable(mContext);
mHotspotX = (mDrawable.getIntrinsicWidth() * 3) / 4f;
break;
}
- case RIGHT: {
+ case TouchHandleOrientation.RIGHT: {
mDrawable = HandleViewResources.getRightHandleDrawable(mContext);
mHotspotX = mDrawable.getIntrinsicWidth() / 4f;
break;
}
- case CENTER:
- default: {
+ case TouchHandleOrientation.CENTER: {
mDrawable = HandleViewResources.getCenterHandleDrawable(mContext);
mHotspotX = mDrawable.getIntrinsicWidth() / 2f;
break;
}
+
+ case TouchHandleOrientation.UNDEFINED:
+ default:
+ break;
}
mHotspotY = 0;
@@ -347,21 +348,6 @@ public class PopupTouchHandleDrawable extends View {
}
@CalledByNative
- private void setRightOrientation() {
- setOrientation(RIGHT);
- }
-
- @CalledByNative
- private void setLeftOrientation() {
- setOrientation(LEFT);
- }
-
- @CalledByNative
- private void setCenterOrientation() {
- setOrientation(CENTER);
- }
-
- @CalledByNative
private void setFocus(float focusX, float focusY) {
int x = (int) focusX - Math.round(mHotspotX);
int y = (int) focusY - Math.round(mHotspotY);
« no previous file with comments | « content/public/android/BUILD.gn ('k') | ui/touch_selection/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698