[Libreoffice-commits] core.git: Branch 'feature/tiled-editing' - 4 commits - android/Bootstrap android/experimental
Tomaž Vajngerl
tomaz.vajngerl at collabora.co.uk
Wed Mar 4 16:47:56 PST 2015
android/Bootstrap/src/org/libreoffice/kit/Document.java | 7 +-
android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java | 24 ++++++++--
android/experimental/LOAndroid3/src/java/org/libreoffice/TextCursorLayer.java | 7 +-
android/experimental/LOAndroid3/src/java/org/libreoffice/TextCursorView.java | 23 ++++++++-
4 files changed, 49 insertions(+), 12 deletions(-)
New commits:
commit ca6ab0342eae5637e85a1e663849a99122f94fc7
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Wed Mar 4 19:22:30 2015 +0900
android: initialize TextCursorView with cursor invisible
Change-Id: I36c359b930a09dbcf51880d9488f335cc38fba45
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/TextCursorView.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/TextCursorView.java
index 2949fd8..f1e9038 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/TextCursorView.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/TextCursorView.java
@@ -35,7 +35,7 @@ public class TextCursorView extends View {
private Paint mCursorPaint = new Paint();
private Paint mSelectionPaint = new Paint();
- private boolean mCursorVisible = true;
+ private boolean mCursorVisible;
public TextCursorView(Context context) {
super(context);
@@ -57,6 +57,10 @@ public class TextCursorView extends View {
postDelayed(cursorAnimation, 500);
mCursorPaint.setColor(Color.BLACK);
+ mCursorPaint.setAlpha(0);
+
+ mCursorVisible = false;
+
mSelectionPaint.setColor(Color.BLUE);
mSelectionPaint.setAlpha(50);
commit c056320547a8105e26c9a83dffead57674032801
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Wed Mar 4 19:18:07 2015 +0900
android: also hide soft keyboard when hiding cursor
Change-Id: I294e1d8382d997b70cb4e5af13cdef5d606885ae
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java
index e089916..7bc5824 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java
@@ -220,6 +220,7 @@ public class InvalidationHandler {
} else if (payload.equals("false")) {
mTextSelection.hideHandle(TextSelectionHandle.HandleType.MIDDLE);
mTextCursorLayer.hideCursor();
+ LibreOfficeMainActivity.mAppContext.hideSoftKeyboard();
}
}
commit 4d87bc2367d2798501c7cfc218b1fdd724e228c3
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Wed Mar 4 19:05:36 2015 +0900
android: add and handle show/hide cursor message from LOK
Change-Id: I42c0971b10e3926f8fca989884da089bec8d59d4
diff --git a/android/Bootstrap/src/org/libreoffice/kit/Document.java b/android/Bootstrap/src/org/libreoffice/kit/Document.java
index 7c996e5..8c20f70 100644
--- a/android/Bootstrap/src/org/libreoffice/kit/Document.java
+++ b/android/Bootstrap/src/org/libreoffice/kit/Document.java
@@ -39,6 +39,7 @@ public class Document {
public static final int CALLBACK_TEXT_SELECTION = 2;
public static final int CALLBACK_TEXT_SELECTION_START = 3;
public static final int CALLBACK_TEXT_SELECTION_END = 4;
+ public static final int CALLBACK_CURSOR_VISIBLE = 5;
/**
* Text selection types
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java
index 5abdcb1..e089916 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java
@@ -50,6 +50,9 @@ public class InvalidationHandler {
case Document.CALLBACK_TEXT_SELECTION_END:
invalidateSelectionEnd(payload);
break;
+ case Document.CALLBACK_CURSOR_VISIBLE:
+ cursorVisibility(payload);
+ break;
}
}
@@ -206,6 +209,20 @@ public class InvalidationHandler {
}
}
+ /**
+ * Handles the cursor visibility message
+ * @param payload
+ */
+ private void cursorVisibility(String payload) {
+ if (payload.equals("true")) {
+ mTextSelection.showHandle(TextSelectionHandle.HandleType.MIDDLE);
+ mTextCursorLayer.showCursor();
+ } else if (payload.equals("false")) {
+ mTextSelection.hideHandle(TextSelectionHandle.HandleType.MIDDLE);
+ mTextCursorLayer.hideCursor();
+ }
+ }
+
public enum OverlayState {
NONE,
CURSOR,
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/TextCursorLayer.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/TextCursorLayer.java
index 92080e9..0fa3764 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/TextCursorLayer.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/TextCursorLayer.java
@@ -44,7 +44,7 @@ public class TextCursorLayer extends Layer {
LOKitShell.getMainHandler().post(new Runnable() {
public void run() {
- mCursorView.repositionWithViewport(context.viewport.left, context.viewport.top, context.zoomFactor);
+ mCursorView.repositionWithViewport(mViewLeft, mViewTop, mViewZoom);
}
});
}
@@ -52,8 +52,6 @@ public class TextCursorLayer extends Layer {
public void showCursor() {
LOKitShell.getMainHandler().post(new Runnable() {
public void run() {
- mCursorView.setVisibility(View.VISIBLE);
-
mViewLeft = 0.0f;
mViewTop = 0.0f;
mViewZoom = 0.0f;
@@ -61,6 +59,7 @@ public class TextCursorLayer extends Layer {
if (layerView != null) {
layerView.addLayer(TextCursorLayer.this);
}
+ mCursorView.showCursor();
}
});
}
@@ -68,7 +67,7 @@ public class TextCursorLayer extends Layer {
public void hideCursor() {
LOKitShell.getMainHandler().post(new Runnable() {
public void run() {
- mCursorView.setVisibility(View.GONE);
+ mCursorView.hideCursor();
}
});
}
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/TextCursorView.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/TextCursorView.java
index 1aa24ce..2949fd8 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/TextCursorView.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/TextCursorView.java
@@ -35,6 +35,8 @@ public class TextCursorView extends View {
private Paint mCursorPaint = new Paint();
private Paint mSelectionPaint = new Paint();
+ private boolean mCursorVisible = true;
+
public TextCursorView(Context context) {
super(context);
initialize();
@@ -55,7 +57,6 @@ public class TextCursorView extends View {
postDelayed(cursorAnimation, 500);
mCursorPaint.setColor(Color.BLACK);
- mCursorPaint.setAlpha(0);
mSelectionPaint.setColor(Color.BLUE);
mSelectionPaint.setAlpha(50);
@@ -114,9 +115,23 @@ public class TextCursorView extends View {
private Runnable cursorAnimation = new Runnable() {
public void run() {
- mCursorPaint.setAlpha(mCursorPaint.getAlpha() == 0 ? 0xFF : 0);
- invalidate();
+ if (mCursorVisible) {
+ mCursorPaint.setAlpha(mCursorPaint.getAlpha() == 0 ? 0xFF : 0);
+ invalidate();
+ }
postDelayed(cursorAnimation, 500);
}
};
+
+ public void showCursor() {
+ mCursorVisible = true;
+ mCursorPaint.setAlpha(0xFF);
+ invalidate();
+ }
+
+ public void hideCursor() {
+ mCursorVisible = false;
+ mCursorPaint.setAlpha(0);
+ invalidate();
+ }
}
\ No newline at end of file
commit a97722114de64c0796e0f824c7699c8627cab663
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Wed Mar 4 18:44:22 2015 +0900
android: rename text selection callback messages
Change-Id: I78c8a984907d1481134426eef164f2587c0f06c6
diff --git a/android/Bootstrap/src/org/libreoffice/kit/Document.java b/android/Bootstrap/src/org/libreoffice/kit/Document.java
index c692099..7c996e5 100644
--- a/android/Bootstrap/src/org/libreoffice/kit/Document.java
+++ b/android/Bootstrap/src/org/libreoffice/kit/Document.java
@@ -36,9 +36,9 @@ public class Document {
*/
public static final int CALLBACK_INVALIDATE_TILES = 0;
public static final int CALLBACK_INVALIDATE_VISIBLE_CURSOR = 1;
- public static final int CALLBACK_INVALIDATE_TEXT_SELECTION = 2;
- public static final int CALLBACK_INVALIDATE_TEXT_SELECTION_START = 3;
- public static final int CALLBACK_INVALIDATE_TEXT_SELECTION_END = 4;
+ public static final int CALLBACK_TEXT_SELECTION = 2;
+ public static final int CALLBACK_TEXT_SELECTION_START = 3;
+ public static final int CALLBACK_TEXT_SELECTION_END = 4;
/**
* Text selection types
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java
index 8efc6f4..5abdcb1 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/InvalidationHandler.java
@@ -41,13 +41,13 @@ public class InvalidationHandler {
case Document.CALLBACK_INVALIDATE_VISIBLE_CURSOR:
invalidateCursor(payload);
break;
- case Document.CALLBACK_INVALIDATE_TEXT_SELECTION:
+ case Document.CALLBACK_TEXT_SELECTION:
invalidateSelection(payload);
break;
- case Document.CALLBACK_INVALIDATE_TEXT_SELECTION_START:
+ case Document.CALLBACK_TEXT_SELECTION_START:
invalidateSelectionStart(payload);
break;
- case Document.CALLBACK_INVALIDATE_TEXT_SELECTION_END:
+ case Document.CALLBACK_TEXT_SELECTION_END:
invalidateSelectionEnd(payload);
break;
}
More information about the Libreoffice-commits
mailing list