diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-01-30 22:15:03 +0900 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-02-09 08:12:08 +0100 |
commit | 48ae33bd8513678c898c5ba692351be2e95a7e83 (patch) | |
tree | c4e600bf88aae0f6c9c002cc0aff1d88a3255c08 /android | |
parent | 1eb411480643cbba748b268e5c760552253b2f8a (diff) |
android: gather text selection handles inside TextSelection
Change-Id: I7bd13bea6aa58f7a1be4b9cfbc32f9d59c0b9e14
Diffstat (limited to 'android')
3 files changed, 8 insertions, 12 deletions
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java index f1eb759cb24e..42ffac8f4a8b 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java @@ -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)); diff --git a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/TextSelection.java b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/TextSelection.java index 241ce14704eb..2ae15390312d 100644 --- a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/TextSelection.java +++ b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/TextSelection.java @@ -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) { diff --git a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/TextSelectionHandle.java b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/TextSelectionHandle.java index b554465eef46..6f85db964233 100644 --- a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/TextSelectionHandle.java +++ b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/TextSelectionHandle.java @@ -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 }; |