diff --git a/android/android_project/AndroidManifest.xml b/android/android_project/AndroidManifest.xml
new file mode 100644
index 00000000..3fcd3b46
--- /dev/null
+++ b/android/android_project/AndroidManifest.xml
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/android/android_project/README.md b/android/android_project/README.md
new file mode 100644
index 00000000..70273da3
--- /dev/null
+++ b/android/android_project/README.md
@@ -0,0 +1,36 @@
+This is template for DlangUI Android project.
+============================================
+
+Copy this directory to some DlangUI project's directory to allow Android builds.
+
+Currently only armv7a architecture is supported.
+
+
+Probably you will want to change android package name in AndroidManifest.xml and application display name in res/values/strings.xml
+
+
+Modify android_app.mk, android_build_config.mk
+
+android_app.mk
+==============
+
+Update LOCAL_SRC_FILES to include all your project's files.
+
+
+android_build_config.mk
+=======================
+
+Update paths to Android NDK, SDK, DlangUI source directory.
+
+Default values:
+export DLANGUI_DIR=$HOME/src/d/dlangui
+export NDK=$HOME/android-ndk-r11c
+export SDK=$HOME/android-sdk-linux
+export LDC=$HOME/ldc2-android-arm-0.17.0-alpha2-linux-x86_64
+export NDK_ARCH=x86_64
+
+
+Use LDC cross compiler for armv7a build according instructions
+
+https://wiki.dlang.org/Build_LDC_for_Android#Build_a_sample_OpenGL_Android_app_ported_to_D
+
diff --git a/android/android_project/android_app.mk b/android/android_project/android_app.mk
new file mode 100644
index 00000000..4874206e
--- /dev/null
+++ b/android/android_project/android_app.mk
@@ -0,0 +1,15 @@
+# List application source files here
+
+# application library name ("app" -> libapp.so)
+LOCAL_MODULE=dlangui-activity
+
+# applicatino source files: put list of your source files here
+LOCAL_SRC_FILES="\
+../src/app.d \
+"
+
+# Additional libraries to link
+LOCAL_LDLIBS=""
+
+# Android SDK target
+ANDROID_TARGET="android-19"
diff --git a/android/android_project/android_build_config.mk b/android/android_project/android_build_config.mk
new file mode 100644
index 00000000..d44305f1
--- /dev/null
+++ b/android/android_project/android_build_config.mk
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+#=========================================================================
+# Modify this file to specify DLANGUI, Android NDK, SDK and LDC2 locations.
+
+export DLANGUI_DIR=$HOME/src/d/dlangui
+export NDK=$HOME/android-ndk-r11c
+export SDK=$HOME/android-sdk-linux
+export LDC=$HOME/ldc2-android-arm-0.17.0-alpha2-linux-x86_64
+export NDK_ARCH=x86_64
+export JAVA_HOME=/usr/lib/jvm/java-8-oracle/
diff --git a/android/android_project/build_apk.sh b/android/android_project/build_apk.sh
new file mode 100755
index 00000000..df6f2b8c
--- /dev/null
+++ b/android/android_project/build_apk.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+# load settings for paths
+. ./android_build_config.mk
+
+echo ""
+echo "===================================="
+echo "DlangUI Build for Android native app"
+echo "===================================="
+echo "DLANGUI_DIR: $DLANGUI_DIR"
+echo "NDK: $NDK"
+echo "SDK: $SDK"
+echo "LDC: $LDC"
+
+# dlangui sources
+. $DLANGUI_DIR/android/dlangui_source_files.mk
+
+# local application sources
+. ./android_app.mk
+
+warn () {
+ echo "$0:" "$@" >&2
+}
+die () {
+ rc=$1
+ shift
+ warn "$@"
+ exit $rc
+}
+
+# LDC2 arm build
+. $DLANGUI_DIR/android/android_ldc_armv7a.mk
+
+
+echo "Updating ant project..."
+#=========================================================
+$SDK/tools/android update project -p . -s --target $ANDROID_TARGET || die 3 "Android Project update is failed"
+
+echo "Building APK..."
+#=========================================================
+ant debug || die 4 "Android APK creation is failed"
+
+echo "Successful."
diff --git a/android/android_project/deploy_apk.sh b/android/android_project/deploy_apk.sh
new file mode 100755
index 00000000..15c9183e
--- /dev/null
+++ b/android/android_project/deploy_apk.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+. ./android_build_config.mk
+
+$SDK/platform-tools/adb install -r bin/NativeActivity-debug.apk
diff --git a/android/android_project/res/values/strings.xml b/android/android_project/res/values/strings.xml
new file mode 100644
index 00000000..8d1c1e6d
--- /dev/null
+++ b/android/android_project/res/values/strings.xml
@@ -0,0 +1,4 @@
+
+
+ DlangUI App
+
diff --git a/android/android_project/watch_logs.sh b/android/android_project/watch_logs.sh
new file mode 100755
index 00000000..7ad96032
--- /dev/null
+++ b/android/android_project/watch_logs.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+. ./android_build_config.mk
+
+$SDK/platform-tools/adb logcat | less
diff --git a/examples/android/jni/app.d b/examples/android/jni/app.d
index 7b9d28f7..e0380ffe 100644
--- a/examples/android/jni/app.d
+++ b/examples/android/jni/app.d
@@ -29,10 +29,10 @@ extern (C) int UIAppMain(string[] args) {
colCount: 2
layoutWidth: fill
TextWidget { text: "param 1" }
- EditLine { id: edit1; text: "some text"; layoutWidth: fill }
+ EditLine { id: edit1; text: "some text"; layoutWidth: fill; margins: 3pt }
TextWidget { text: "param 2" }
- EditLine { id: edit2; text: "some text for param2"; layoutWidth: fill }
- TextWidget { text: "some radio buttons" }
+ EditLine { id: edit2; text: "some text for param2"; layoutWidth: fill; margins: 3pt }
+ TextWidget { text: "Radio buttons" }
// arrange some radio buttons vertically
VerticalLayout {
layoutWidth: fill
@@ -40,11 +40,15 @@ extern (C) int UIAppMain(string[] args) {
RadioButton { id: rb2; text: "Item 2" }
RadioButton { id: rb3; text: "Item 3" }
}
- TextWidget { text: "Switch:" }
- SwitchWidget { checked: true }
- TextWidget { text: "and checkboxes" }
+ TextWidget { text: "Switches:" }
+ VerticalLayout {
+ SwitchWidget { checked: true }
+ SwitchWidget { checked: false }
+ SwitchWidget { checked: true; enabled: false }
+ }
+ TextWidget { text: "Checkboxes:" }
// arrange some checkboxes horizontally
- HorizontalLayout {
+ VerticalLayout {
layoutWidth: fill
CheckBox { id: cb1; text: "checkbox 1" }
CheckBox { id: cb2; text: "checkbox 2" }
diff --git a/src/dlangui/platforms/android/androidapp.d b/src/dlangui/platforms/android/androidapp.d
index 39fd2f18..61ce76cf 100644
--- a/src/dlangui/platforms/android/androidapp.d
+++ b/src/dlangui/platforms/android/androidapp.d
@@ -441,6 +441,9 @@ class AndroidPlatform : Platform {
break;
}
}
+ if (_windows.length == 0) {
+ _appstate.destroyRequested = true;
+ }
}
@property AndroidWindow activeWindow() {