From 5c3e14d8def20aa0fdc5bb7a70c73edc78cbb467 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Wed, 11 Oct 2023 11:02:40 +0000 Subject: [PATCH] qml: replace Send/ScanDialog with java bases zxing qr scan activity. --- .gitignore | 3 +- contrib/android/Dockerfile | 2 +- contrib/android/buildozer_qml.spec | 22 ++++- contrib/android/make_apk.sh | 2 +- .../qml/android_res/layout/scanner_layout.xml | 29 ++++++ electrum/gui/qml/components/ScanDialog.qml | 51 ---------- electrum/gui/qml/components/SendDialog.qml | 82 ---------------- .../gui/qml/components/WalletMainView.qml | 71 ++++++-------- electrum/gui/qml/components/main.qml | 4 +- .../electrum/qr/SimpleScannerActivity.java | 61 ++++++++++-- electrum/gui/qml/qeapp.py | 2 + electrum/gui/qml/qeqrscanner.py | 96 +++++++++++++++++++ 12 files changed, 234 insertions(+), 191 deletions(-) create mode 100644 electrum/gui/qml/android_res/layout/scanner_layout.xml delete mode 100644 electrum/gui/qml/components/ScanDialog.qml delete mode 100644 electrum/gui/qml/components/SendDialog.qml create mode 100644 electrum/gui/qml/qeqrscanner.py diff --git a/.gitignore b/.gitignore index 8ac25d80a..9ade38ca3 100644 --- a/.gitignore +++ b/.gitignore @@ -12,8 +12,7 @@ electrum/locale/ packages env/ .buildozer -.buildozer_kivy/ -.buildozer_qml/ +.buildozer_*/ bin/ /app.fil .idea diff --git a/contrib/android/Dockerfile b/contrib/android/Dockerfile index 7a7cca23d..5c80325be 100644 --- a/contrib/android/Dockerfile +++ b/contrib/android/Dockerfile @@ -198,7 +198,7 @@ RUN cd /opt \ && git fetch --all \ # commit: from branch accumulator/qt6-wip (note: careful with force-pushing! see #8162) \ # - && git checkout "3b3733dbf5f461e197ba83887ac0d3b6d0f1c396^{commit}" \ + && git checkout "f2741f0b7b6a4ac52fc6cb0dc9ac706e2287be02^{commit}" \ && /opt/venv/bin/python3 -m pip install --no-build-isolation --no-dependencies -e . # build env vars diff --git a/contrib/android/buildozer_qml.spec b/contrib/android/buildozer_qml.spec index 2f85c3eb0..99f64a9c3 100644 --- a/contrib/android/buildozer_qml.spec +++ b/contrib/android/buildozer_qml.spec @@ -138,9 +138,25 @@ android.add_jars = .buildozer/android/platform/*/build/libs_collections/Electrum # (list) List of Java files to add to the android project (can be java or a # directory containing the files) -# android.add_src = ... -# android.add_activities = ... -android.gradle_dependencies = com.android.support:support-compat:28.0.0 +android.add_src = electrum/gui/qml/java_classes/ + +android.gradle_dependencies = + com.android.support:support-compat:28.0.0, + me.dm7.barcodescanner:zxing:1.9.8 + +android.add_activities = org.electrum.qr.SimpleScannerActivity + +# (list) Put these files or directories in the apk res directory. +# The option may be used in three ways, the value may contain one or zero ':' +# Some examples: +# 1) A file to add to resources, legal resource names contain ['a-z','0-9','_'] +# android.add_resources = my_icons/all-inclusive.png:drawable/all_inclusive.png +# 2) A directory, here 'legal_icons' must contain resources of one kind +# android.add_resources = legal_icons:drawable +# 3) A directory, here 'legal_resources' must contain one or more directories, +# each of a resource kind: drawable, xml, etc... +# android.add_resources = legal_resources +android.add_resources = electrum/gui/qml/android_res/layout:layout # (str) python-for-android branch to use, if not master, useful to try # not yet merged features. diff --git a/contrib/android/make_apk.sh b/contrib/android/make_apk.sh index 977148bfb..88625b0a9 100755 --- a/contrib/android/make_apk.sh +++ b/contrib/android/make_apk.sh @@ -45,7 +45,7 @@ info "apk building phase starts." # FIXME: changing "APP_PACKAGE_NAME" seems to require a clean rebuild of ".buildozer/", # to avoid that, maybe change "APP_PACKAGE_DOMAIN" instead. # So, in particular, to build a testnet apk, simply uncomment: -#export APP_PACKAGE_DOMAIN=org.electrum.testnet +export APP_PACKAGE_DOMAIN=org.electrum.testnet if [ $CI ]; then # override log level specified in buildozer.spec to "debug": diff --git a/electrum/gui/qml/android_res/layout/scanner_layout.xml b/electrum/gui/qml/android_res/layout/scanner_layout.xml new file mode 100644 index 000000000..a00bb04e9 --- /dev/null +++ b/electrum/gui/qml/android_res/layout/scanner_layout.xml @@ -0,0 +1,29 @@ + + + + + + + + +