Add user feedback for when WiFi is being disabled.
On some devices this can take some time (i.e. a second) and the UI needs to be disabled for that time. This should stop users quickly stopping and starting regularly, queuing up many "start jmdns, stop jmdns, start jmdns" calls.
This commit is contained in:
parent
8364aa15f1
commit
1eae135929
@ -322,6 +322,7 @@
|
||||
<string name="swap_not_visible_bluetooth">Not visible via Bluetooth</string>
|
||||
<string name="swap_visible_wifi">Visible via Wi-Fi</string>
|
||||
<string name="swap_setting_up_wifi">Setting up Wi-Fi…</string>
|
||||
<string name="swap_stopping_wifi">Stopping Wi-Fi…</string>
|
||||
<string name="swap_not_visible_wifi">Not visible via Wi-Fi</string>
|
||||
<string name="swap_wifi_device_name">Device Name</string>
|
||||
<string name="swap_cant_find_peers">Can\'t find who you\'re looking for?</string>
|
||||
|
@ -487,6 +487,7 @@ public class SwapService extends Service {
|
||||
public static final String WIFI_STATE_CHANGE = "org.fdroid.fdroid.WIFI_STATE_CHANGE";
|
||||
public static final String EXTRA_STARTING = "STARTING";
|
||||
public static final String EXTRA_STARTED = "STARTED";
|
||||
public static final String EXTRA_STOPPING = "STOPPING";
|
||||
public static final String EXTRA_STOPPED = "STOPPED";
|
||||
|
||||
private static final int NOTIFICATION = 1;
|
||||
|
@ -91,6 +91,7 @@ public class WifiSwap extends SwapType {
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
sendBroadcast(SwapService.EXTRA_STOPPING);
|
||||
if (webServerThreadHandler == null) {
|
||||
Log.i(TAG, "null handler in stopWebServer");
|
||||
} else {
|
||||
|
@ -323,10 +323,15 @@ public class StartSwapView extends ScrollView implements SwapWorkflowActivity.In
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (intent.hasExtra(SwapService.EXTRA_STARTING)) {
|
||||
Utils.debugLog(TAG, "WiFi service is starting (setting toggle to visible, but disabled).");
|
||||
Utils.debugLog(TAG, "WiFi service is starting (setting toggle to checked, but disabled).");
|
||||
textWifiVisible.setText(R.string.swap_setting_up_wifi);
|
||||
wifiSwitch.setEnabled(false);
|
||||
wifiSwitch.setChecked(true);
|
||||
} else if (intent.hasExtra(SwapService.EXTRA_STOPPING)) {
|
||||
Utils.debugLog(TAG, "WiFi service is stopping (setting toggle to unchecked and disabled).");
|
||||
textWifiVisible.setText(R.string.swap_stopping_wifi);
|
||||
wifiSwitch.setEnabled(false);
|
||||
wifiSwitch.setChecked(false);
|
||||
} else {
|
||||
wifiSwitch.setEnabled(true);
|
||||
if (intent.hasExtra(SwapService.EXTRA_STARTED)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user