diff --git a/F-Droid/res/layout/swap_activity.xml b/F-Droid/res/layout/swap_activity.xml
index 9551080ab..09530ced4 100644
--- a/F-Droid/res/layout/swap_activity.xml
+++ b/F-Droid/res/layout/swap_activity.xml
@@ -10,6 +10,7 @@
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:titleTextAppearance="@style/SwapTheme.Wizard.Text"
+ titleTextAppearance="@style/SwapTheme.Wizard.Text"
android:minHeight="?attr/actionBarSize"
android:background="?attr/colorPrimary" />
diff --git a/F-Droid/res/layout/swap_blank.xml b/F-Droid/res/layout/swap_blank.xml
index d945c89cb..13092597b 100644
--- a/F-Droid/res/layout/swap_blank.xml
+++ b/F-Droid/res/layout/swap_blank.xml
@@ -1,5 +1,9 @@
+
@@ -39,7 +45,8 @@
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
android:padding="20dp"
- android:paddingStart="30dp"
+ android:paddingLeft="30dp"
+ android:paddingRight="30dp"
android:paddingEnd="30dp"
android:textAlignment="center"
android:text="@string/swap_intro"
@@ -65,6 +72,7 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
+ android:paddingLeft="15dp"
android:paddingStart="15dp"
android:layout_weight="1.00">
@@ -84,7 +92,7 @@
-
@@ -135,7 +144,7 @@
-
@@ -191,10 +200,12 @@
android:id="@+id/btn_send_fdroid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:drawableLeft="@drawable/ic_fdroid_grey"
android:drawableStart="@drawable/ic_fdroid_grey"
android:text="@string/swap_send_fdroid"
android:drawablePadding="10dp"
- android:paddingStart="25dp"
+ android:paddingLeft="25dp"
+ android:paddingRight="25dp"
android:paddingEnd="25dp"
android:background="@android:color/transparent" />
@@ -202,10 +213,12 @@
android:id="@+id/btn_qr_scanner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:drawableLeft="@drawable/ic_qr_grey"
android:drawableStart="@drawable/ic_qr_grey"
android:text="@string/swap_scan_qr_code"
android:drawablePadding="10dp"
- android:paddingStart="25dp"
+ android:paddingLeft="25dp"
+ android:paddingRight="25dp"
android:paddingEnd="25dp"
android:background="@android:color/transparent" />
diff --git a/F-Droid/res/layout/swap_bluetooth_header.xml b/F-Droid/res/layout/swap_bluetooth_header.xml
deleted file mode 100644
index e74261ef9..000000000
--- a/F-Droid/res/layout/swap_bluetooth_header.xml
+++ /dev/null
@@ -1,72 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/F-Droid/res/values/styles.xml b/F-Droid/res/values/styles.xml
index 42f835d37..15a1c5821 100644
--- a/F-Droid/res/values/styles.xml
+++ b/F-Droid/res/values/styles.xml
@@ -34,13 +34,11 @@
-
-
-
-
-
-
diff --git a/F-Droid/src/org/fdroid/fdroid/localrepo/SwapService.java b/F-Droid/src/org/fdroid/fdroid/localrepo/SwapService.java
index f5d074e76..aac4008dc 100644
--- a/F-Droid/src/org/fdroid/fdroid/localrepo/SwapService.java
+++ b/F-Droid/src/org/fdroid/fdroid/localrepo/SwapService.java
@@ -66,6 +66,7 @@ import java.util.TimerTask;
* TODO: Remove peers from list of peers when no longer "visible".
* TODO: Show feedback for "Setting up (wifi|bluetooth)" in start swap view.
* 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.
*
*/
public class SwapService extends Service {
diff --git a/F-Droid/src/org/fdroid/fdroid/localrepo/type/WifiSwap.java b/F-Droid/src/org/fdroid/fdroid/localrepo/type/WifiSwap.java
index 80dc2bc99..ec00bddf9 100644
--- a/F-Droid/src/org/fdroid/fdroid/localrepo/type/WifiSwap.java
+++ b/F-Droid/src/org/fdroid/fdroid/localrepo/type/WifiSwap.java
@@ -43,6 +43,8 @@ public class WifiSwap extends SwapType {
public void start() {
Log.d(TAG, "Preparing swap webserver.");
+ sendBroadcast(SwapService.EXTRA_STARTING);
+
Runnable webServer = new Runnable() {
// Tell Eclipse this is not a leak because of Looper use.
@SuppressLint("HandlerLeak")
@@ -66,7 +68,6 @@ public class WifiSwap extends SwapType {
};
try {
Log.d(TAG, "Starting swap webserver...");
- sendBroadcast(SwapService.EXTRA_STARTING);
localHttpd.start();
setConnected(true);
Log.d(TAG, "Swap webserver started.");
@@ -92,12 +93,12 @@ public class WifiSwap extends SwapType {
public void stop() {
if (webServerThreadHandler == null) {
Log.i(TAG, "null handler in stopWebServer");
- return;
+ } else {
+ Log.d(TAG, "Sending message to swap webserver to stop it.");
+ Message msg = webServerThreadHandler.obtainMessage();
+ msg.obj = webServerThreadHandler.getLooper().getThread().getName() + " says stop";
+ webServerThreadHandler.sendMessage(msg);
}
- Log.d(TAG, "Sending message to swap webserver to stop it.");
- Message msg = webServerThreadHandler.obtainMessage();
- msg.obj = webServerThreadHandler.getLooper().getThread().getName() + " says stop";
- webServerThreadHandler.sendMessage(msg);
bonjourBroadcast.stop();
}
diff --git a/F-Droid/src/org/fdroid/fdroid/net/WifiStateChangeService.java b/F-Droid/src/org/fdroid/fdroid/net/WifiStateChangeService.java
index ae6aeb5e8..bbce857b4 100644
--- a/F-Droid/src/org/fdroid/fdroid/net/WifiStateChangeService.java
+++ b/F-Droid/src/org/fdroid/fdroid/net/WifiStateChangeService.java
@@ -163,11 +163,11 @@ public class WifiStateChangeService extends Service {
WifiStateChangeService.this.stopSelf();
Intent swapService = new Intent(WifiStateChangeService.this, SwapService.class);
- bindService(swapService, new ServiceConnection() {
+ getApplicationContext().bindService(swapService, new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
- ((SwapService.Binder)service).getService().restartWifiIfEnabled();
- unbindService(this);
+ ((SwapService.Binder) service).getService().restartWifiIfEnabled();
+ getApplicationContext().unbindService(this);
}
@Override
diff --git a/F-Droid/src/org/fdroid/fdroid/net/bluetooth/BluetoothConstants.java b/F-Droid/src/org/fdroid/fdroid/net/bluetooth/BluetoothConstants.java
index 96b8c9810..35d7024cf 100644
--- a/F-Droid/src/org/fdroid/fdroid/net/bluetooth/BluetoothConstants.java
+++ b/F-Droid/src/org/fdroid/fdroid/net/bluetooth/BluetoothConstants.java
@@ -12,7 +12,7 @@ public class BluetoothConstants {
// This can be an offline process, as long as it can be reproduced by other people who
// want to do so.
// This UUID is just from mashing random hex characters on the keyboard.
- return UUID.fromString("cd59ba31-5729-b3bb-cb29-732b59eu6gaa");
+ return UUID.fromString("cd59ba31-5729-b3bb-cb29-732b59eb61aa");
}
}
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 f179fe925..3a575ac61 100644
--- a/F-Droid/src/org/fdroid/fdroid/views/swap/StartSwapView.java
+++ b/F-Droid/src/org/fdroid/fdroid/views/swap/StartSwapView.java
@@ -11,6 +11,7 @@ import android.support.annotation.ColorRes;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.content.LocalBroadcastManager;
+import android.support.v7.widget.SwitchCompat;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Log;
@@ -26,7 +27,6 @@ import android.widget.ImageView;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.ScrollView;
-import android.widget.Switch;
import android.widget.TextView;
import org.fdroid.fdroid.FDroidApp;
@@ -168,6 +168,7 @@ public class StartSwapView extends ScrollView implements SwapWorkflowActivity.In
}
});
+ // TODO: Unregister this receiver at the right time.
LocalBroadcastManager.getInstance(getContext()).registerReceiver(new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
@@ -211,7 +212,7 @@ public class StartSwapView extends ScrollView implements SwapWorkflowActivity.In
int textResource = getManager().isBluetoothDiscoverable() ? R.string.swap_visible_bluetooth : R.string.swap_not_visible_bluetooth;
textBluetoothVisible.setText(textResource);
- final Switch bluetoothSwitch = ((Switch) findViewById(R.id.switch_bluetooth));
+ final SwitchCompat bluetoothSwitch = ((SwitchCompat) findViewById(R.id.switch_bluetooth));
bluetoothSwitch.setChecked(getManager().isBluetoothDiscoverable());
bluetoothSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
@@ -265,7 +266,7 @@ public class StartSwapView extends ScrollView implements SwapWorkflowActivity.In
viewWifiId = (TextView)findViewById(R.id.device_id_wifi);
viewWifiNetwork = (TextView)findViewById(R.id.wifi_network);
- final Switch wifiSwitch = (Switch)findViewById(R.id.switch_wifi);
+ final SwitchCompat wifiSwitch = (SwitchCompat)findViewById(R.id.switch_wifi);
wifiSwitch.setChecked(getManager().isBonjourDiscoverable());
wifiSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
@@ -281,6 +282,8 @@ public class StartSwapView extends ScrollView implements SwapWorkflowActivity.In
});
final TextView textWifiVisible = (TextView)findViewById(R.id.wifi_visible);
+ int textResource = getManager().isBonjourDiscoverable() ? R.string.swap_visible_wifi : R.string.swap_not_visible_wifi;
+ textWifiVisible.setText(textResource);
// TODO: Unregister receiver correctly...
LocalBroadcastManager.getInstance(getContext()).registerReceiver(new BroadcastReceiver() {