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

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

Issue 323823003: [android] Obtain themed text selection handles. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | « no previous file | no next file » | 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/HandleView.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/input/HandleView.java b/content/public/android/java/src/org/chromium/content/browser/input/HandleView.java
index e41efcfdfd053684238c41ed651870883aadae57..f504b066f4b081436f5c7ebe94cc8f79a1bb5d4e 100644
--- a/content/public/android/java/src/org/chromium/content/browser/input/HandleView.java
+++ b/content/public/android/java/src/org/chromium/content/browser/input/HandleView.java
@@ -60,14 +60,6 @@ public class HandleView extends View {
private final View mParent;
private InsertionHandleController.PastePopupMenu mPastePopupWindow;
- private final int mTextSelectHandleLeftRes;
- private final int mTextSelectHandleRightRes;
- private final int mTextSelectHandleRes;
-
- private Drawable mSelectHandleLeft;
- private Drawable mSelectHandleRight;
- private Drawable mSelectHandleCenter;
-
private final Rect mTempRect = new Rect();
static final int LEFT = 0;
@@ -91,19 +83,13 @@ public class HandleView extends View {
HandleView(CursorController controller, int pos, View parent,
PositionObserver parentPositionObserver) {
super(parent.getContext());
- Context context = parent.getContext();
mParent = parent;
+ Context context = mParent.getContext();
mController = controller;
mContainer = new PopupWindow(context, null, android.R.attr.textSelectHandleWindowStyle);
mContainer.setSplitTouchEnabled(true);
mContainer.setClippingEnabled(false);
- TypedArray a = context.obtainStyledAttributes(TEXT_VIEW_HANDLE_ATTRS);
- mTextSelectHandleLeftRes = a.getResourceId(a.getIndex(LEFT), 0);
- mTextSelectHandleRes = a.getResourceId(a.getIndex(CENTER), 0);
- mTextSelectHandleRightRes = a.getResourceId(a.getIndex(RIGHT), 0);
- a.recycle();
-
setOrientation(pos);
// Convert line offset dips to pixels.
@@ -122,45 +108,33 @@ public class HandleView extends View {
}
void setOrientation(int pos) {
- int handleWidth;
+ Context context = mParent.getContext();
+ TypedArray a = context.getTheme().obtainStyledAttributes(TEXT_VIEW_HANDLE_ATTRS);
+ mDrawable = a.getDrawable(pos);
+ a.recycle();
+
+ mIsInsertionHandle = (pos == CENTER);
+
+ int handleWidth = mDrawable.getIntrinsicWidth();
switch (pos) {
case LEFT: {
- if (mSelectHandleLeft == null) {
- mSelectHandleLeft = getContext().getResources().getDrawable(
- mTextSelectHandleLeftRes);
- }
- mDrawable = mSelectHandleLeft;
- handleWidth = mDrawable.getIntrinsicWidth();
mHotspotX = (handleWidth * 3) / 4f;
break;
}
case RIGHT: {
- if (mSelectHandleRight == null) {
- mSelectHandleRight = getContext().getResources().getDrawable(
- mTextSelectHandleRightRes);
- }
- mDrawable = mSelectHandleRight;
- handleWidth = mDrawable.getIntrinsicWidth();
mHotspotX = handleWidth / 4f;
break;
}
case CENTER:
default: {
- if (mSelectHandleCenter == null) {
- mSelectHandleCenter = getContext().getResources().getDrawable(
- mTextSelectHandleRes);
- }
- mDrawable = mSelectHandleCenter;
- handleWidth = mDrawable.getIntrinsicWidth();
mHotspotX = handleWidth / 2f;
- mIsInsertionHandle = true;
break;
}
}
-
mHotspotY = 0;
+
invalidate();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698