diff --git a/F-Droid/res/values/strings.xml b/F-Droid/res/values/strings.xml
index 7a27fd60e..545e9cb01 100644
--- a/F-Droid/res/values/strings.xml
+++ b/F-Droid/res/values/strings.xml
@@ -364,14 +364,16 @@
May work
Promising
Best bet
- Your device is
- Select from devices below, or press \"Scan\" from the menu to find more devices.
- Bonded
- Currently bonding…
- Unknown device
- Loading…
- TRY TO INSTALL
- An error occurred while connecting to device, we can\'t seem to swap with it :(
+ Your device is
+ Select from devices below, or press \"Scan\" from the menu to find more devices.
+ Bonded
+ Currently bonding…
+ Unknown device
+ Loading…
+ TRY TO INSTALL
+ An error occurred while connecting to device, we can\'t seem to swap with it :(
+ Swapping not enabled
+ Before swapping, your device must be made visible.
Do you want to install this application?
It will get access to:
diff --git a/F-Droid/src/org/fdroid/fdroid/localrepo/SwapService.java b/F-Droid/src/org/fdroid/fdroid/localrepo/SwapService.java
index 48f84af94..2efbbfe67 100644
--- a/F-Droid/src/org/fdroid/fdroid/localrepo/SwapService.java
+++ b/F-Droid/src/org/fdroid/fdroid/localrepo/SwapService.java
@@ -58,8 +58,7 @@ import java.util.TimerTask;
/**
* Central service which manages all of the different moving parts of swap which are required
- * to enable p2p swapping of apps. Currently manages WiFi and NFC. Will manage Bluetooth in
- * the future.
+ * to enable p2p swapping of apps.
*
* TODO: Show "Waiting for other device to finish setting up swap" when only F-Droid shown in swap
* TODO: Handle "not connected to wifi" more gracefully. For example, Bonjour discovery falls over.
@@ -68,6 +67,7 @@ import java.util.TimerTask;
* TODO: Feedback for "Setting up (wifi|bluetooth)" in start swap view is not as immediate as I had hoped.
* TODO: Turn off bluetooth after cancelling/timing out if we turned it on.
* TODO: Disable the Scan QR button unless visible via something. Could equally show relevant feedback.
+ * TODO: Implement "Send F-Droid" on the main page.
*
* TODO: Starting wifi after cancelling swap and beginning again doesn't work properly
* TODO: Scan QR hangs when updating repoo. Swapper was 2.3.3 and Swappee was 5.0
diff --git a/F-Droid/src/org/fdroid/fdroid/views/swap/StartSwapView.java b/F-Droid/src/org/fdroid/fdroid/views/swap/StartSwapView.java
index bf2ae9663..309b80df1 100644
--- a/F-Droid/src/org/fdroid/fdroid/views/swap/StartSwapView.java
+++ b/F-Droid/src/org/fdroid/fdroid/views/swap/StartSwapView.java
@@ -141,7 +141,7 @@ public class StartSwapView extends ScrollView implements SwapWorkflowActivity.In
findViewById(R.id.btn_qr_scanner).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
- getActivity().showSelectApps();
+ getActivity().startQrWorkflow();
}
});
}
diff --git a/F-Droid/src/org/fdroid/fdroid/views/swap/SwapWorkflowActivity.java b/F-Droid/src/org/fdroid/fdroid/views/swap/SwapWorkflowActivity.java
index 943d4e86a..e86d21eaf 100644
--- a/F-Droid/src/org/fdroid/fdroid/views/swap/SwapWorkflowActivity.java
+++ b/F-Droid/src/org/fdroid/fdroid/views/swap/SwapWorkflowActivity.java
@@ -5,6 +5,7 @@ import android.app.ProgressDialog;
import android.content.ComponentName;
import android.bluetooth.BluetoothAdapter;
import android.content.Context;
+import android.content.DialogInterface;
import android.content.Intent;
import android.content.ServiceConnection;
import android.net.Uri;
@@ -17,6 +18,7 @@ import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.NavUtils;
import android.support.v4.content.LocalBroadcastManager;
+import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
@@ -332,6 +334,24 @@ public class SwapWorkflowActivity extends AppCompatActivity {
((ConfirmReceive)inflateInnerView(R.layout.swap_confirm_receive)).setup(config);
}
+ public void startQrWorkflow() {
+ if (!getService().isEnabled()) {
+ new AlertDialog.Builder(this)
+ .setTitle(R.string.swap_not_enabled)
+ .setMessage(R.string.swap_not_enabled_description)
+ .setCancelable(true)
+ .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ // Do nothing. The dialog will get dismissed anyway, which is all we ever wanted...
+ }
+ })
+ .create().show();
+ } else {
+ showSelectApps();
+ }
+ }
+
public void showSelectApps() {
inflateInnerView(R.layout.swap_select_apps);
}