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(); |
} |