From d3bf2d09f740221771806789b00bf915c9f5f2e3 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Fri, 26 Jan 2024 14:51:36 +0100 Subject: initial commit --- mobile-kt/.gitignore | 2 + mobile-kt/Makefile | 17 ++ mobile-kt/WORKSPACE | 25 +++ mobile-kt/app/AndroidManifest.xml | 54 +++++++ mobile-kt/app/BUILD | 18 +++ mobile-kt/app/res/drawable/logo.png | Bin 0 -> 8963 bytes mobile-kt/app/res/layout/main.xml | 43 +++++ mobile-kt/app/res/menu/settings.xml | 11 ++ mobile-kt/app/res/values-de/strings.xml | 66 ++++++++ mobile-kt/app/res/values-ja/strings.xml | 66 ++++++++ mobile-kt/app/res/values/dimens.xml | 4 + mobile-kt/app/res/values/strings.xml | 66 ++++++++ mobile-kt/app/res/values/styles.xml | 11 ++ mobile-kt/app/res/xml/settings.xml | 45 ++++++ mobile-kt/app/src/DNSProxyConnection.java | 43 +++++ mobile-kt/app/src/DNSProxyRunner.java | 43 +++++ mobile-kt/app/src/DNSProxyService.java | 171 ++++++++++++++++++++ mobile-kt/app/src/MainActivity.kt | 35 +++++ mobile-kt/app/src/SettingsActivity.java | 132 ++++++++++++++++ mobile-kt/app/src/WifiListenerReceiver.java | 50 ++++++ mobile-kt/app/src/WifiListenerService.java | 236 ++++++++++++++++++++++++++++ mobile-kt/nix/android-composition.nix | 14 ++ mobile-kt/nix/androidsdk-fixup.py | 24 +++ mobile-kt/nix/androidsdk.nix | 29 ++++ 24 files changed, 1205 insertions(+) create mode 100644 mobile-kt/.gitignore create mode 100644 mobile-kt/Makefile create mode 100644 mobile-kt/WORKSPACE create mode 100644 mobile-kt/app/AndroidManifest.xml create mode 100644 mobile-kt/app/BUILD create mode 100644 mobile-kt/app/res/drawable/logo.png create mode 100644 mobile-kt/app/res/layout/main.xml create mode 100644 mobile-kt/app/res/menu/settings.xml create mode 100644 mobile-kt/app/res/values-de/strings.xml create mode 100644 mobile-kt/app/res/values-ja/strings.xml create mode 100644 mobile-kt/app/res/values/dimens.xml create mode 100644 mobile-kt/app/res/values/strings.xml create mode 100644 mobile-kt/app/res/values/styles.xml create mode 100644 mobile-kt/app/res/xml/settings.xml create mode 100644 mobile-kt/app/src/DNSProxyConnection.java create mode 100644 mobile-kt/app/src/DNSProxyRunner.java create mode 100644 mobile-kt/app/src/DNSProxyService.java create mode 100644 mobile-kt/app/src/MainActivity.kt create mode 100644 mobile-kt/app/src/SettingsActivity.java create mode 100644 mobile-kt/app/src/WifiListenerReceiver.java create mode 100644 mobile-kt/app/src/WifiListenerService.java create mode 100644 mobile-kt/nix/android-composition.nix create mode 100755 mobile-kt/nix/androidsdk-fixup.py create mode 100644 mobile-kt/nix/androidsdk.nix (limited to 'mobile-kt') diff --git a/mobile-kt/.gitignore b/mobile-kt/.gitignore new file mode 100644 index 0000000..306c83d --- /dev/null +++ b/mobile-kt/.gitignore @@ -0,0 +1,2 @@ +/bazel-* +/result diff --git a/mobile-kt/Makefile b/mobile-kt/Makefile new file mode 100644 index 0000000..a314992 --- /dev/null +++ b/mobile-kt/Makefile @@ -0,0 +1,17 @@ +build: app/java/src/*.java + bazel build //app:image-sync + +dev: + #bazel mobile-install //app/java:dnsproxy --start_app #--debug_app --java_debug + $(MAKE) build && $(MAKE) install && adb shell am start -n org.pihole.dnsproxy/org.pihole.dnsproxy.MainActivity + +install: + #bazel mobile-install //app/java:dnsproxy + adb install bazel-bin/app/java/dnsproxy.apk + +emulate: + # avdmanager create --name dnsproxy -k "system-images;android-28;google_apis_playstore;x86_64" + emulator @dnsproxy -no-boot-anim + +adb_logcat: + adb logcat --pid=$(adb shell pidof -s org.pihole.dnsproxy) diff --git a/mobile-kt/WORKSPACE b/mobile-kt/WORKSPACE new file mode 100644 index 0000000..158184a --- /dev/null +++ b/mobile-kt/WORKSPACE @@ -0,0 +1,25 @@ +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + + +# Android + +android_sdk_repository( + name = "androidsdk", +) + + +# Kotlin + +rules_kotlin_version = "1.9.0" +rules_kotlin_sha = "5766f1e599acf551aa56f49dab9ab9108269b03c557496c54acaf41f98e2b8d6" +http_archive( + name = "rules_kotlin", + urls = ["https://github.com/bazelbuild/rules_kotlin/releases/download/v%s/rules_kotlin-v%s.tar.gz" % (rules_kotlin_version, rules_kotlin_version)], + sha256 = rules_kotlin_sha, +) + +load("@rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories") +kotlin_repositories() + +load("@rules_kotlin//kotlin:core.bzl", "kt_register_toolchains") +kt_register_toolchain() diff --git a/mobile-kt/app/AndroidManifest.xml b/mobile-kt/app/AndroidManifest.xml new file mode 100644 index 0000000..0c417b7 --- /dev/null +++ b/mobile-kt/app/AndroidManifest.xml @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mobile-kt/app/BUILD b/mobile-kt/app/BUILD new file mode 100644 index 0000000..c3e38c2 --- /dev/null +++ b/mobile-kt/app/BUILD @@ -0,0 +1,18 @@ +android_library( + name = "main", + manifest = "AndroidManifest.xml", + resource_files = glob(["res/**"]), +) + +load("@rules_kotlin//kotlin:android.bzl", "kt_android_library") +kt_android_library( + name = "main_kt", + srcs = glob(["src/*.kt"]), + deps = [":main"], +) + +android_binary( + name = "image-sync", + manifest = "AndroidManifest.xml", + deps = [":main", ":main_kt"], +) diff --git a/mobile-kt/app/res/drawable/logo.png b/mobile-kt/app/res/drawable/logo.png new file mode 100644 index 0000000..154b579 Binary files /dev/null and b/mobile-kt/app/res/drawable/logo.png differ diff --git a/mobile-kt/app/res/layout/main.xml b/mobile-kt/app/res/layout/main.xml new file mode 100644 index 0000000..d3bbcf5 --- /dev/null +++ b/mobile-kt/app/res/layout/main.xml @@ -0,0 +1,43 @@ + + + + + +