summaryrefslogtreecommitdiff
path: root/android/experimental
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.com>2014-06-30 23:34:15 +0200
committerTomaž Vajngerl <tomaz.vajngerl@collabora.com>2014-07-01 09:12:21 +0200
commitb046b687f9caa71db29ce16e0d211d530648d141 (patch)
treef81fe55cc2c2f5380023e8a5f85dd78ace858c85 /android/experimental
parentca61fdcac919f799b5273c24932adc0cbd8300e2 (diff)
lok bootstrap: nicer function names, clean-up
+ prevent lokandroid JNI functions to be removed from the library + basic use of lok Office / Document in LibreOfficeMainActivity Change-Id: I7bfe53738cf821b2270ab3e024cc506a7cff42f0
Diffstat (limited to 'android/experimental')
-rw-r--r--android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java44
1 files changed, 15 insertions, 29 deletions
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java
index a4ae79c5882b..2345aea1f58b 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LibreOfficeMainActivity.java
@@ -11,12 +11,16 @@ import android.view.MotionEvent;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
+import android.os.Environment;
+import java.io.File;
import org.mozilla.gecko.gfx.GeckoSoftwareLayerClient;
import org.mozilla.gecko.gfx.LayerController;
import org.mozilla.gecko.gfx.LayerView;
-import org.libreoffice.android.LibreOfficeKit;
+import org.libreoffice.kit.LibreOfficeKit;
+import org.libreoffice.kit.Office;
+import org.libreoffice.kit.Document;
import com.sun.star.frame.XComponentLoader;
import com.sun.star.lang.XMultiComponentFactory;
@@ -76,48 +80,30 @@ public class LibreOfficeMainActivity extends Activity {
try {
// enable debugging messages as the first thing
LibreOfficeKit.putenv("SAL_LOG=+WARN+INFO-INFO.legacy.osl");
-
LibreOfficeKit.init(this);
- setContentView(R.layout.activity_main);
-
- Log.w(LOGTAG, "zerdatime " + SystemClock.uptimeMillis() + " - onCreate");
-
- /*
- String input = "/assets/test1.odt";
-
- String[] argv = { "lo-document-loader", input };
-
- LibreOfficeKit.setCommandArgs(argv);
-
- Bootstrap.initVCL();
+ Log.w(LOGTAG, "LOK Handle:" + handle);
+ Office office = new Office(LibreOfficeKit.getLibreOfficeKitHandle());
- context = com.sun.star.comp.helper.Bootstrap.defaultBootstrap_InitialComponentContext();
+ File file = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
+ String input = file.getPath() + "/test.odt";
+ Document document = office.documentLoad(input);
+ if (document == null) {
+ Log.w(LOGTAG, "LOK Document error:" + office.getErrorNative());
+ }
- Log.i(LOGTAG, "context is" + (context!=null ? " not" : "") + " null");
-
- mcf = context.getServiceManager();
-
- Log.i(LOGTAG, "mcf is" + (mcf!=null ? " not" : "") + " null");
-
- Object desktop = mcf.createInstanceWithContext("com.sun.star.frame.Desktop", context);
- Log.i(LOGTAG, "desktop is" + (desktop!=null ? " not" : "") + " null");
-
- componentLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, desktop);
- Log.i(LOGTAG, "componentLoader is" + (componentLoader!=null ? " not" : "") + " null");
- */
} catch (Exception e) {
e.printStackTrace(System.err);
- //finish();
+ finish();
}
setContentView(R.layout.activity_main);
+ Log.w(LOGTAG, "zerdatime " + SystemClock.uptimeMillis() + " - onCreate");
// setup gecko layout
mGeckoLayout = (RelativeLayout) findViewById(R.id.gecko_layout);
mMainLayout = (LinearLayout) findViewById(R.id.main_layout);
-
if (mLayerController == null) {
mLayerController = new LayerController(this);