From 3eee4f115a5796bb9831c20b9de339af534a1c7a Mon Sep 17 00:00:00 2001 From: Peter Serwylo Date: Mon, 4 Aug 2014 08:02:12 +0930 Subject: [PATCH] Make "Open QR scanner" button work for swap connect screen. I did the same as some previous code which copied code from the zxing library and put it in the com.google.zxing namespace (but left the license in tact - is this okay for Apache 2.0 stuff?). The reason was that they encourage copying the relevant two files into your project and modifying as neccesary. In this case, it wasn't about modifying for functionalities sake, but rather for android support libraries sake. The upstream version doesn't support android.support.v4.app.Fragments, only android.app.Fragments. Hooking up the intent integrator from zxing almost removes the need for the refactoring which made FDroid.java responsible for handling "new repo" intents. However, there is still the one case of the user not using the QR code, but rather a web browser to connect to a swap. That is, they will click a link on the other phones web browser, which directs them to initiate the swap. Thus, we still need FDroid.java to be able to distinguish between a "swap" new repo request, and a regular "add repo" new repo request. In the process, I also commented out the "It's not working" button. --- res/layout/swap_wifi_qr.xml | 10 +- .../integration/android/IntentIntegrator.java | 506 ++++++++++++++++++ .../integration/android/IntentResult.java | 95 ++++ src/org/fdroid/fdroid/data/NewRepoConfig.java | 12 +- .../swap/ConfirmReceiveSwapFragment.java | 1 + .../fdroid/views/swap/WifiQrFragment.java | 30 +- 6 files changed, 645 insertions(+), 9 deletions(-) create mode 100644 src/com/google/zxing/integration/android/IntentIntegrator.java create mode 100644 src/com/google/zxing/integration/android/IntentResult.java diff --git a/res/layout/swap_wifi_qr.xml b/res/layout/swap_wifi_qr.xml index 8d67d687c..b916b0332 100644 --- a/res/layout/swap_wifi_qr.xml +++ b/res/layout/swap_wifi_qr.xml @@ -24,22 +24,26 @@ android:layout_below="@+id/textView" android:layout_above="@+id/device_ip_address"/> +