[Libreoffice-commits] core.git: Branch 'feature/tiled-editing' - 5 commits - android/experimental android/mobile-config.py
Tomaž Vajngerl
tomaz.vajngerl at collabora.co.uk
Fri Jan 16 02:08:26 PST 2015
android/experimental/LOAndroid3/Makefile | 2 -
android/experimental/LOAndroid3/src/java/org/libreoffice/LOEvent.java | 8 +++++
android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java | 14 ++++++++
android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java | 3 +
android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java | 16 ++++++++++
android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java | 15 +++++++++
android/experimental/LOAndroid3/src/java/org/libreoffice/MockTileProvider.java | 5 +++
android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java | 3 +
android/mobile-config.py | 1
9 files changed, 65 insertions(+), 2 deletions(-)
New commits:
commit 49255bdc4137f5c5a8bbf67444175c32503a3924
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Fri Jan 16 19:03:39 2015 +0900
android: Add key events in TileProvider & pass key events to LOK
Change-Id: Id0a93f1c4199082b3c67802955082d04831ec124
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java
index 32cb43c..3b7f657 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitThread.java
@@ -147,6 +147,9 @@ public class LOKitThread extends Thread implements TileProvider.TileInvalidation
case LOEvent.TOUCH:
touch(event.mTouchType, event.mMotionEvent);
break;
+ case LOEvent.KEY_PRESS:
+ mTileProvider.keyPress(event.mKeyEvent);
+ break;
}
}
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java
index b7dee3b..0970bbb 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java
@@ -3,6 +3,7 @@ package org.libreoffice;
import android.graphics.Bitmap;
import android.graphics.RectF;
import android.util.Log;
+import android.view.KeyEvent;
import org.libreoffice.kit.DirectBufferAllocator;
import org.libreoffice.kit.Document;
@@ -272,6 +273,11 @@ public class LOKitTileProvider implements TileProvider, Document.MessageCallback
this.tileInvalidationCallback = tileInvalidationCallback;
}
+ @Override
+ public void keyPress(KeyEvent keyEvent) {
+ mOffice.postKeyEvent(Office.KEY_PRESS, keyEvent.getKeyCode());
+ }
+
@Override
protected void finalize() throws Throwable {
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/MockTileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/MockTileProvider.java
index 16772d0..15332a7 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/MockTileProvider.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/MockTileProvider.java
@@ -1,6 +1,7 @@
package org.libreoffice;
import android.graphics.Bitmap;
+import android.view.KeyEvent;
import org.mozilla.gecko.gfx.BufferedCairoImage;
import org.mozilla.gecko.gfx.CairoImage;
@@ -87,6 +88,10 @@ public class MockTileProvider implements TileProvider {
}
@Override
+ public void keyPress(KeyEvent keyEvent) {
+ }
+
+ @Override
public void changePart(int partIndex) {
}
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java
index faa55a8..da0d0f4 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/TileProvider.java
@@ -3,6 +3,7 @@ package org.libreoffice;
import android.graphics.Bitmap;
import android.graphics.RectF;
+import android.view.KeyEvent;
import org.mozilla.gecko.gfx.CairoImage;
import org.mozilla.gecko.gfx.IntSize;
@@ -33,6 +34,8 @@ public interface TileProvider {
void registerInvalidationCallback(TileProvider.TileInvalidationCallback tileInvalidationCallback);
+ void keyPress(KeyEvent keyEvent);
+
/**
* Callback to retrieve invalidation calls
*/
commit 743bdfda78a84a2830c024a608bdf2a22ba4420c
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Fri Jan 16 19:01:04 2015 +0900
android: Add needed services for editing.
Change-Id: I29acea58b4e18efcf33b51361812c3f7532282ab
diff --git a/android/experimental/LOAndroid3/Makefile b/android/experimental/LOAndroid3/Makefile
index a19fadc..e700daa 100644
--- a/android/experimental/LOAndroid3/Makefile
+++ b/android/experimental/LOAndroid3/Makefile
@@ -14,7 +14,7 @@ BOOTSTRAPDIR=../../Bootstrap
include $(BOOTSTRAPDIR)/Makefile.shared
native-code.cxx: $(SRCDIR)/solenv/bin/native-code.py
- $< -j -g core -g writer -g calc -g draw > $@
+ $< -j -g core -g writer -g calc -g draw -g edit > $@
build-ant: android_version_setup copy-stuff link-so properties
#
diff --git a/android/mobile-config.py b/android/mobile-config.py
index 9981840..93e08c6 100755
--- a/android/mobile-config.py
+++ b/android/mobile-config.py
@@ -23,7 +23,6 @@ main_xcd_discard = [
# no conventional UI; reverse sorted by size
'org.openoffice.Office.UI/GenericCommands',
- 'org.openoffice.Office/Accelerators',
'org.openoffice.Office.UI/DrawImpressCommands',
'org.openoffice.Office.UI/Sidebar',
'org.openoffice.Office.UI/ChartCommands',
commit 4904c3426d9785a12ca5f709f999700eca10b70f
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Fri Jan 16 18:06:44 2015 +0900
android: Add some comments.
Change-Id: I77372ae2b1c7c4332dc4a8c244c67a82f9551e22
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java
index 03b9aaf..5206694 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java
@@ -49,6 +49,9 @@ public class LOKitShell {
// EVENTS
+ /**
+ * Make sure LOKitThread is running and send event to it.
+ */
public static void sendEvent(LOEvent event) {
if (LibreOfficeMainActivity.mAppContext != null && LibreOfficeMainActivity.mAppContext.getLOKitThread() != null) {
LibreOfficeMainActivity.mAppContext.getLOKitThread().queueEvent(event);
@@ -59,10 +62,16 @@ public class LOKitShell {
LOKitShell.sendEvent(new LOEvent(LOEvent.THUMBNAIL, task));
}
+ /**
+ * Send touch event to LOKitThread.
+ */
public static void sentTouchEvent(String touchType, MotionEvent motionEvent) {
LOKitShell.sendEvent(new LOEvent(LOEvent.TOUCH, "SingleTap", motionEvent));
}
+ /**
+ * Send key press event to LOKitThread.
+ */
public static void sendKeyPressEvent(KeyEvent event) {
LOKitShell.sendEvent(new LOEvent(LOEvent.KEY_PRESS, event));
}
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java
index 7eda1f1..b7dee3b 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java
@@ -15,6 +15,9 @@ import org.mozilla.gecko.gfx.IntSize;
import java.nio.ByteBuffer;
+/**
+ * LOKit implementation of TileProvider.
+ */
public class LOKitTileProvider implements TileProvider, Document.MessageCallback {
private static final String LOGTAG = LOKitTileProvider.class.getSimpleName();
private static int TILE_SIZE = 256;
@@ -261,6 +264,9 @@ public class LOKitTileProvider implements TileProvider, Document.MessageCallback
return mDocument != null && mDocument.getDocumentType() == Document.DOCTYPE_TEXT;
}
+ /**
+ * Register the tile invalidation callback.
+ */
@Override
public void registerInvalidationCallback(TileInvalidationCallback tileInvalidationCallback) {
this.tileInvalidationCallback = tileInvalidationCallback;
@@ -284,6 +290,9 @@ public class LOKitTileProvider implements TileProvider, Document.MessageCallback
return mDocument.getPart();
}
+ /**
+ * Process the retrieved messages from LOK
+ */
@Override
public void messageRetrieved(int signalNumber, String payload) {
switch (signalNumber) {
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java
index b79217d..5efbc68 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java
@@ -192,6 +192,10 @@ public class LibreOfficeMainActivity extends LOAbout {
return mDocumentPartViewListAdapter;
}
+ /**
+ * Show software keyboard.
+ * Force the request on main thread.
+ */
public void showSoftKeyboard() {
Log.i(LOGTAG, "SoftKeyboard show request..");
@@ -241,6 +245,10 @@ public class LibreOfficeMainActivity extends LOAbout {
}
}
+
+ /**
+ * Listen to key presses and send event to LOK.
+ */
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
LOKitShell.sendKeyPressEvent(event);
commit f8bd734413fcd7d610a9636cacb9ba51f3555859
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Fri Jan 16 17:45:48 2015 +0900
android: add missing break
Change-Id: I5e9598249457c62d3ccc9c5f754526c1fbe969bf
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java
index 9334536..7eda1f1 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java
@@ -305,6 +305,7 @@ public class LOKitTileProvider implements TileProvider, Document.MessageCallback
tileInvalidationCallback.invalidate(rect);
}
}
+ break;
}
}
}
commit 4a413ccaaa2bb2245d517ff95e09c9a4d2f7bf61
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date: Fri Jan 16 17:44:27 2015 +0900
android: add key_press event and send them to LOKitThread
Change-Id: I306fbe12e0a91e28bb2308074ded03b768173440
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOEvent.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOEvent.java
index 7ec346b..809988d 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOEvent.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOEvent.java
@@ -1,5 +1,6 @@
package org.libreoffice;
+import android.view.KeyEvent;
import android.view.MotionEvent;
import org.mozilla.gecko.gfx.ComposedTileLayer;
@@ -17,6 +18,7 @@ public class LOEvent implements Comparable<LOEvent> {
public static final int THUMBNAIL = 8;
public static final int TILE_RERENDER = 9;
public static final int TOUCH = 10;
+ public static final int KEY_PRESS = 11;
public final int mType;
public int mPriority = 0;
@@ -31,6 +33,7 @@ public class LOEvent implements Comparable<LOEvent> {
public SubTile mTile;
public String mTouchType;
public MotionEvent mMotionEvent;
+ public KeyEvent mKeyEvent;
public LOEvent(int type) {
mType = type;
@@ -85,6 +88,11 @@ public class LOEvent implements Comparable<LOEvent> {
mMotionEvent = motionEvent;
}
+ public LOEvent(int type, KeyEvent keyEvent) {
+ mType = type;
+ mKeyEvent = keyEvent;
+ }
+
public String getTypeString() {
if (mTypeString == null) {
return "Event type: " + mType;
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java
index e894690..03b9aaf 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java
@@ -3,6 +3,7 @@ package org.libreoffice;
import android.os.Handler;
import android.util.DisplayMetrics;
+import android.view.KeyEvent;
import android.view.MotionEvent;
@@ -61,4 +62,8 @@ public class LOKitShell {
public static void sentTouchEvent(String touchType, MotionEvent motionEvent) {
LOKitShell.sendEvent(new LOEvent(LOEvent.TOUCH, "SingleTap", motionEvent));
}
+
+ public static void sendKeyPressEvent(KeyEvent event) {
+ LOKitShell.sendEvent(new LOEvent(LOEvent.KEY_PRESS, event));
+ }
}
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java
index a40d78c..b79217d 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java
@@ -9,6 +9,7 @@ import android.os.Handler;
import android.support.v4.widget.DrawerLayout;
import android.util.DisplayMetrics;
import android.util.Log;
+import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
@@ -239,6 +240,12 @@ public class LibreOfficeMainActivity extends LOAbout {
mDrawerLayout.closeDrawer(mDrawerList);
}
}
+
+ @Override
+ public boolean onKeyDown(int keyCode, KeyEvent event) {
+ LOKitShell.sendKeyPressEvent(event);
+ return super.onKeyDown(keyCode, event);
+ }
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list