android: Create the html, js and css and copy it to the right place.

Change-Id: I3efbba0ae369387796e2d08b3003e4f469610dda
private/mmeeks/thread-png
Jan Holesovsky 2019-02-13 13:22:25 +01:00
parent 7088b77471
commit e79f5f7ec6
7 changed files with 34 additions and 18 deletions

4
.gitignore vendored
View File

@ -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?

View File

@ -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

View File

@ -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

View File

@ -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() {

View File

@ -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

View File

@ -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) \

View File

@ -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