From 198cc7357ca4869d62f6ee1f032f146a79629cf8 Mon Sep 17 00:00:00 2001 From: Peter Serwylo Date: Sat, 12 Sep 2015 20:32:43 +1000 Subject: [PATCH] Update UI in response to WiFi enabling, not Bonjour discovery enabling. The Bonjour stuff takes a while to start, and isn't strictly neccesary in order to swap over WiFi. Rather, it is more of a convenience. Also, it was causing the UI to appear to lag quite a lot. This way, the WiFi swap gets setup almost instantly, and is available to swap - therefore the UI seems much more responsive. --- F-Droid/src/org/fdroid/fdroid/views/swap/StartSwapView.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 e59104af1..5f931458f 100644 --- a/F-Droid/src/org/fdroid/fdroid/views/swap/StartSwapView.java +++ b/F-Droid/src/org/fdroid/fdroid/views/swap/StartSwapView.java @@ -295,6 +295,10 @@ public class StartSwapView extends ScrollView implements SwapWorkflowActivity.In int textResource = getManager().isBonjourDiscoverable() ? R.string.swap_visible_wifi : R.string.swap_not_visible_wifi; textWifiVisible.setText(textResource); + // Note that this is only listening for the WifiSwap, whereas we start both the WifiSwap + // and the Bonjour service at the same time. Technically swap will work fine without + // Bonjour, and that is more of a convenience. Thus, we should show feedback once wifi + // is ready, even if Bonjour is not yet. // TODO: Unregister receiver correctly... LocalBroadcastManager.getInstance(getContext()).registerReceiver(new BroadcastReceiver() { @Override @@ -318,7 +322,7 @@ public class StartSwapView extends ScrollView implements SwapWorkflowActivity.In } uiUpdateWifiNetwork(); } - }, new IntentFilter(SwapService.BONJOUR_STATE_CHANGE)); + }, new IntentFilter(SwapService.WIFI_STATE_CHANGE)); viewWifiNetwork.setOnClickListener(new OnClickListener() { @Override