Kaydet (Commit) 48ae33bd authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl Kaydeden (comit) Miklos Vajna

android: gather text selection handles inside TextSelection

Change-Id: I7bd13bea6aa58f7a1be4b9cfbc32f9d59c0b9e14
üst 1eb41148
......@@ -125,11 +125,7 @@ public class LibreOfficeMainActivity extends LOAbout {
sLOKitThread.clearQueue();
}
TextSelectionHandle startHandle = (TextSelectionHandle) findViewById(R.id.start_handle);
TextSelectionHandle middleHandle = (TextSelectionHandle) findViewById(R.id.middle_handle);
TextSelectionHandle endHandle = (TextSelectionHandle) findViewById(R.id.end_handle);
mTextSelection = new TextSelection(startHandle, middleHandle, endHandle);
mTextSelection = new TextSelection(mAppContext);
mLayerClient = new GeckoLayerClient(this);
mLayerClient.setZoomConstraints(new ZoomConstraints(true));
......
......@@ -4,6 +4,7 @@
package org.mozilla.gecko;
import android.app.Activity;
import android.graphics.RectF;
import android.util.Log;
import android.view.View;
......@@ -12,6 +13,7 @@ import org.json.JSONArray;
import org.json.JSONObject;
import org.libreoffice.LOKitShell;
import org.libreoffice.LibreOfficeMainActivity;
import org.libreoffice.R;
import org.mozilla.gecko.gfx.Layer;
import org.mozilla.gecko.gfx.LayerView;
import org.mozilla.gecko.util.FloatUtils;
......@@ -29,12 +31,10 @@ public class TextSelection extends Layer {
private float mViewTop;
private float mViewZoom;
public TextSelection(TextSelectionHandle startHandle,
TextSelectionHandle middleHandle,
TextSelectionHandle endHandle) {
mStartHandle = startHandle;
mMiddleHandle = middleHandle;
mEndHandle = endHandle;
public TextSelection(Activity context) {
mStartHandle = (TextSelectionHandle) context.findViewById(R.id.start_handle);
mMiddleHandle = (TextSelectionHandle) context.findViewById(R.id.middle_handle);
mEndHandle = (TextSelectionHandle) context.findViewById(R.id.end_handle);
// Only register listeners if we have valid start/middle/end handles
if (mStartHandle == null || mMiddleHandle == null || mEndHandle == null) {
......
......@@ -22,7 +22,7 @@ import android.widget.ImageView;
import android.widget.RelativeLayout;
public class TextSelectionHandle extends ImageView implements View.OnTouchListener {
private static final String LOGTAG = "GeckoTextSelectionHandle";
private static final String LOGTAG = TextSelectionHandle.class.getSimpleName();
public enum HandleType { START, MIDDLE, END };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment