diff options
author | Jan Holesovsky <kendy@collabora.com> | 2019-02-13 13:22:25 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2019-02-13 13:22:25 +0100 |
commit | e79f5f7ec689facbd96f3fbeee3cfa72aded7201 (patch) | |
tree | 7332d67fbffb393dd5aafb2bf74d8ac31fd3ad1c | |
parent | 7088b77471e3fa6cddacc3bd28217d8088b446ee (diff) |
android: Create the html, js and css and copy it to the right place.
Change-Id: I3efbba0ae369387796e2d08b3003e4f469610dda
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | Makefile.am | 11 | ||||
-rw-r--r-- | android/README | 7 | ||||
-rw-r--r-- | android/app/src/main/java/org/libreoffice/androidapp/MainActivity.java | 2 | ||||
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | loleaflet/Makefile.am | 23 | ||||
-rw-r--r-- | loleaflet/html/loleaflet.html.m4 | 1 |
7 files changed, 34 insertions, 18 deletions
diff --git a/.gitignore b/.gitignore index a5c7420b4..aa2c717fb 100644 --- a/.gitignore +++ b/.gitignore @@ -91,6 +91,10 @@ pocolib-symlink ICU.dat ios/Mobile/Assets.xcassets/AppIcon.appiconset +# android stuff +/android/app/src/main/assets/dist +/android/app/src/main/cpp/CMakeLists.txt + # backup and temporary editor files: the only convenience rules allowed here. *~ .*sw? diff --git a/Makefile.am b/Makefile.am index 62f74125c..401ad72e6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,14 +1,12 @@ ETAGS=ctags -e -if ENABLE_IOSAPP - -SUBDIRS = loleaflet - -else +if ENABLE_MOBILEAPP if ENABLE_GTKAPP - SUBDIRS = gtk loleaflet +else +SUBDIRS = loleaflet +endif else @@ -392,4 +390,3 @@ endif build-nocheck: all-am endif -endif diff --git a/android/README b/android/README index 83b1debde..b1580fdb3 100644 --- a/android/README +++ b/android/README @@ -28,7 +28,12 @@ ./autogen.sh && ./configure CC=~/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi21-clang CXX=~/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi21-clang++ --host=arm-linux-androideabi --enable-androidapp --with-lo-builddir=/local/libreoffice/master-android --with-poco-includes=/opt/poco-android/include --with-poco-libs=/opt/poco-android/lib --disable-setcap --enable-silent-rules --enable-debug -* Build it +* Build the JavaScript, HTML and CSS files + + # just run 'make' + make + +* Build the actual app + Start Android Studio + Open this 'android' subdir as a project diff --git a/android/app/src/main/java/org/libreoffice/androidapp/MainActivity.java b/android/app/src/main/java/org/libreoffice/androidapp/MainActivity.java index 121e9cc9c..9388372b4 100644 --- a/android/app/src/main/java/org/libreoffice/androidapp/MainActivity.java +++ b/android/app/src/main/java/org/libreoffice/androidapp/MainActivity.java @@ -32,7 +32,7 @@ public class MainActivity extends AppCompatActivity { browserSettings.setJavaScriptEnabled(true); browser.addJavascriptInterface(new JavaScriptInterface(), "MainHandler"); - browser.loadUrl("file:///android_asset/html/index.html"); + browser.loadUrl("file:///android_asset/dist/loleaflet.html"); Button jsButton = findViewById(R.id.js_button); jsButton.setOnClickListener(new View.OnClickListener() { diff --git a/configure.ac b/configure.ac index b1ce4a7fb..32cf66d8f 100644 --- a/configure.ac +++ b/configure.ac @@ -485,16 +485,20 @@ AS_IF([test "$ENABLE_GTKAPP" = true], AM_CONDITIONAL([ENABLE_DEBUG], [test "$ENABLE_DEBUG" = "true"]) mobile_app= +ENABLE_MOBILEAPP= MOBILEAPP=0 AC_MSG_CHECKING([Is this a mobile app]) if test "$enable_gtkapp" = "yes" -o "$enable_iosapp" = "yes" -o "$enable_androidapp"; then AC_MSG_RESULT([Yes]) mobile_app=true; MOBILEAPP=1 + ENABLE_MOBILEAPP=true else AC_MSG_RESULT([No]) fi AC_DEFINE_UNQUOTED([MOBILEAPP],[$MOBILEAPP],[Define to 1 if this is a mobileapp (eg. Android) build.]) +AC_SUBST(ENABLE_MOBILEAPP) +AM_CONDITIONAL([ENABLE_MOBILEAPP], [test "$ENABLE_MOBILEAPP" = "true"]) ENABLE_SSL=true if test "$enable_ssl" != "no" -a "$mobile_app" != "true"; then diff --git a/loleaflet/Makefile.am b/loleaflet/Makefile.am index 2732e1928..dcdcf31fc 100644 --- a/loleaflet/Makefile.am +++ b/loleaflet/Makefile.am @@ -3,11 +3,9 @@ DRAW_VERSION=0.2.4 L10N_PO = $(wildcard $(srcdir)/po/*.po) -if !ENABLE_IOSAPP -if !ENABLE_GTKAPP +if !ENABLE_MOBILEAPP L10N_JSON = $(patsubst $(srcdir)/po/%.po,$(builddir)/dist/l10n/%.json,$(L10N_PO)) endif -endif if ENABLE_IOSAPP L10N_IOS_ALL_JS = $(builddir)/dist/l10n-all.js @@ -111,12 +109,10 @@ NODE_MODULES_JS =\ node_modules/vex-js/js/vex.js \ node_modules/vex-js/js/vex.dialog.js -if !ENABLE_IOSAPP -if !ENABLE_GTKAPP +if !ENABLE_MOBILEAPP NODE_MODULES_JS +=\ node_modules/l10n-for-node/l10n.js endif -endif NODE_MODULES_JS_SRC = $(patsubst %.js,$(builddir)/%.js,$(NODE_MODULES_JS)) NODE_MODULES_JS_DST = $(patsubst %.js,$(builddir)/dist/%.js,$(NODE_MODULES_JS)) @@ -152,11 +148,9 @@ all-local: @$(MAKE) node_modules @$(MAKE) build-loleaflet -if !ENABLE_IOSAPP -if !ENABLE_GTKAPP +if !ENABLE_MOBILEAPP ADMIN_BUNDLE = $(builddir)/dist/admin-bundle.js endif -endif build-loleaflet: | $(LOLEAFLET_L10N_DST) \ $(L10N_JSON) \ @@ -169,6 +163,16 @@ build-loleaflet: | $(LOLEAFLET_L10N_DST) \ $(builddir)/dist/bundle.js \ $(builddir)/dist/loleaflet.html @echo "build loleaflet completed" +if ENABLE_ANDROIDAPP + @rm -rf $(srcdir)/../android/app/src/main/assets/dist + @cp -a $(builddir)/dist $(srcdir)/../android/app/src/main/assets/ + @echo + @echo "Copied JS, HTML and CSS to the Android project (android/app/src/main/assets/dist)." + @echo + @echo " Now you need to build the actual .apk from Android Studio:" + @echo " Just open the 'android' subdir as a project there and build." + @echo +endif $(builddir)/dist/admin-bundle.js: $(LOLEAFLET_ADMIN_DST) \ $(LOLEAFLET_PREFIX)/dist/admin-src.js @@ -244,6 +248,7 @@ $(builddir)/dist/loleaflet.html: $(srcdir)/html/loleaflet.html.m4 $(LOLEAFLET_HT @m4 -E -DDEBUG=$(ENABLE_DEBUG) \ -DIOSAPP=$(ENABLE_IOSAPP) \ -DGTKAPP=$(ENABLE_GTKAPP) \ + -DANDROIDAPP=$(ENABLE_ANDROIDAPP) \ -DMOBILEAPPNAME="$(MOBILE_APP_NAME)" \ -DLOLEAFLET_CSS="$(subst $(SPACE),$(COMMA),$(LOLEAFLET_CSS_M4))" \ -DLOLEAFLET_JS="$(subst $(SPACE),$(COMMA),$(GLOBAL_JS) $(NODE_MODULES_JS) \ diff --git a/loleaflet/html/loleaflet.html.m4 b/loleaflet/html/loleaflet.html.m4 index 96bd3704e..fbfa87b03 100644 --- a/loleaflet/html/loleaflet.html.m4 +++ b/loleaflet/html/loleaflet.html.m4 @@ -16,6 +16,7 @@ dnl# Define MOBILEAPP as true if this is either for the iOS app or for the gtk+ define([MOBILEAPP],[]) ifelse(IOSAPP,[true],[define([MOBILEAPP],[true])]) ifelse(GTKAPP,[true],[define([MOBILEAPP],[true])]) +ifelse(ANDROIDAPP,[true],[define([MOBILEAPP],[true])]) ifelse(MOBILEAPP,[], // Start listening for Host_PostmessageReady message and save the |