From e09794c23253cf1bba9bf0cbca13f2d1b4d1bfd9 Mon Sep 17 00:00:00 2001 From: f321x Date: Mon, 22 Dec 2025 14:44:32 +0100 Subject: [PATCH 1/2] android: bump barcode scanner version Bumps the BarcodeScannerView and zxing++ version which allows us to remove the 16kb page alignment patch as this is now done upstream. Ref https://github.com/spesmilo/electrum/commit/87d82f38c559ef27c7f749dac565a92d984148da --- contrib/android/barcode_16kb.patch | 9 --------- contrib/android/make_barcode_scanner.sh | 5 ++--- 2 files changed, 2 insertions(+), 12 deletions(-) delete mode 100644 contrib/android/barcode_16kb.patch diff --git a/contrib/android/barcode_16kb.patch b/contrib/android/barcode_16kb.patch deleted file mode 100644 index bb9ea2044..000000000 --- a/contrib/android/barcode_16kb.patch +++ /dev/null @@ -1,9 +0,0 @@ -diff --git a/wrappers/aar/zxingcpp/src/main/cpp/CMakeLists.txt b/wrappers/aar/zxingcpp/src/main/cpp/CMakeLists.txt -index 11332e48..78f514f1 100644 ---- a/wrappers/aar/zxingcpp/src/main/cpp/CMakeLists.txt -+++ b/wrappers/aar/zxingcpp/src/main/cpp/CMakeLists.txt -@@ -13,3 +13,4 @@ add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../core ZXing EXCLUD - add_library(zxingcpp_android SHARED ZxingCpp.cpp) - - target_link_libraries(zxingcpp_android PRIVATE ZXing::ZXing jnigraphics) -+target_link_options(zxingcpp_android PRIVATE "-Wl,-z,max-page-size=16384") diff --git a/contrib/android/make_barcode_scanner.sh b/contrib/android/make_barcode_scanner.sh index 7c3f70eb8..d0847b5b0 100755 --- a/contrib/android/make_barcode_scanner.sh +++ b/contrib/android/make_barcode_scanner.sh @@ -12,13 +12,13 @@ # https://github.com/markusfisch/zxing-cpp/blob/master/wrappers/aar/build.gradle -BARCODE_SCANNER_VIEW_COMMIT_HASH="a4928bf83c0aae8ecb80e665d93f10b70232455b" # 1.6.3 +BARCODE_SCANNER_VIEW_COMMIT_HASH="0bdb69269c252bb6daef2f871b76403c8b051945" # 1.6.5 BARCODE_SCANNER_VIEW_REPO="https://github.com/markusfisch/BarcodeScannerView.git" CAMERA_VIEW_COMMIT_HASH="745597d05bc6abfdb3637a09a8ecaf30fdce7b6e" # 1.10.0 CAMERA_VIEW_REPO="https://github.com/markusfisch/CameraView.git" -ZXING_CPP_COMMIT_HASH="0741a597409ff69a96a326f3a65fe6440d87ad99" # v2.2.0.5 using kotlin-stdlib 1.8.22 +ZXING_CPP_COMMIT_HASH="79f5adc6250e90de0bd635eb9181c5f8a18affda" # v2.3.0.4 using kotlin-stdlib 1.8.22 ZXING_CPP_REPO="https://github.com/markusfisch/zxing-cpp.git" @@ -65,7 +65,6 @@ else info "Building zxing-cpp for $ZXING_CPP_BUILD_ID..." ZXING_CPP_DIR="$BUILDDIR/zxing-cpp" clone_or_update_repo "$ZXING_CPP_REPO" "$ZXING_CPP_COMMIT_HASH" "$ZXING_CPP_DIR" - apply_patch "${CONTRIB_ANDROID}/barcode_16kb.patch" "$ZXING_CPP_DIR" cd "$ZXING_CPP_DIR/wrappers/aar" chmod +x gradlew From d1368db313c0a6b17ad79424a09b3c081239c2b8 Mon Sep 17 00:00:00 2001 From: f321x Date: Mon, 22 Dec 2025 15:02:01 +0100 Subject: [PATCH 2/2] android: qr scanner: allow tap to focus Allow tap to focus in the android qr scanner as some devices don't support autofocus. This should allow them to focus on some qr code. --- .../org/electrum/qr/SimpleScannerActivity.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/electrum/gui/qml/java_classes/org/electrum/qr/SimpleScannerActivity.java b/electrum/gui/qml/java_classes/org/electrum/qr/SimpleScannerActivity.java index d6db0973e..476c375c4 100644 --- a/electrum/gui/qml/java_classes/org/electrum/qr/SimpleScannerActivity.java +++ b/electrum/gui/qml/java_classes/org/electrum/qr/SimpleScannerActivity.java @@ -95,7 +95,10 @@ public class SimpleScannerActivity extends Activity { private void startCamera() { if (mScannerView == null) { mScannerView = new BarcodeScannerView(this); - mScannerView.setCropRatio(0.75f); // Set crop ratio to 75% (this defines the square area shown in the scanner view) + // Set crop ratio to 75% (this defines the square area shown in the scanner view) + mScannerView.setCropRatio(0.75f); + // allow tap to focus (note: some devices don't support autofocus which is enabled by default) + mScannerView.setTapToFocus(); // by default only Format.QR_CODE is set ViewGroup contentFrame = (ViewGroup) findViewById(R.id.content_frame); contentFrame.addView(mScannerView); @@ -172,7 +175,7 @@ public class SimpleScannerActivity extends Activity { // Get the root view and set up insets listener getWindow().getDecorView().setOnApplyWindowInsetsListener((v, insets) -> { android.graphics.Insets systemBars = insets.getInsets(WindowInsets.Type.systemBars()); - + // Apply padding to content frame to keep scanner focus area centered ViewGroup contentFrame = findViewById(R.id.content_frame); if (contentFrame != null) { @@ -195,7 +198,7 @@ public class SimpleScannerActivity extends Activity { ); } - // Apply bottom margin to paste button for navigation bar + // Apply bottom margin to paste button for navigation bar Button pasteButton = findViewById(R.id.paste_btn); if (pasteButton != null) { ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) pasteButton.getLayoutParams();