reset swap wifi info if it is not connected
Before, it was keeping the last active wifi, which is confusing when you are not connected.
This commit is contained in:
parent
29b78df530
commit
bdc190a7d6
@ -65,10 +65,10 @@ import java.util.Set;
|
|||||||
public class FDroidApp extends Application {
|
public class FDroidApp extends Application {
|
||||||
|
|
||||||
// for the local repo on this device, all static since there is only one
|
// for the local repo on this device, all static since there is only one
|
||||||
public static int port = 8888;
|
public static int port;
|
||||||
public static String ipAddressString = null;
|
public static String ipAddressString;
|
||||||
public static String ssid = "";
|
public static String ssid ;
|
||||||
public static String bssid = "";
|
public static String bssid;
|
||||||
public static final Repo repo = new Repo();
|
public static final Repo repo = new Repo();
|
||||||
public static Set<String> selectedApps = null; // init in SelectLocalAppsFragment
|
public static Set<String> selectedApps = null; // init in SelectLocalAppsFragment
|
||||||
|
|
||||||
@ -132,6 +132,13 @@ public class FDroidApp extends Application {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void initWifiSettings() {
|
||||||
|
port = 8888;
|
||||||
|
ipAddressString = null;
|
||||||
|
ssid = "";
|
||||||
|
bssid = "";
|
||||||
|
}
|
||||||
|
|
||||||
public static void updateLanguage(Context c) {
|
public static void updateLanguage(Context c) {
|
||||||
SharedPreferences prefs = PreferenceManager
|
SharedPreferences prefs = PreferenceManager
|
||||||
.getDefaultSharedPreferences(c);
|
.getDefaultSharedPreferences(c);
|
||||||
@ -231,6 +238,7 @@ public class FDroidApp extends Application {
|
|||||||
// TODO reintroduce PinningTrustManager and MemorizingTrustManager
|
// TODO reintroduce PinningTrustManager and MemorizingTrustManager
|
||||||
|
|
||||||
// initialized the local repo information
|
// initialized the local repo information
|
||||||
|
FDroidApp.initWifiSettings();
|
||||||
WifiManager wifiManager = (WifiManager) getSystemService(WIFI_SERVICE);
|
WifiManager wifiManager = (WifiManager) getSystemService(WIFI_SERVICE);
|
||||||
int wifiState = wifiManager.getWifiState();
|
int wifiState = wifiManager.getWifiState();
|
||||||
if (wifiState == WifiManager.WIFI_STATE_ENABLING
|
if (wifiState == WifiManager.WIFI_STATE_ENABLING
|
||||||
|
@ -43,6 +43,7 @@ public class WifiStateChangeService extends Service {
|
|||||||
wifiManager = (WifiManager) getSystemService(WIFI_SERVICE);
|
wifiManager = (WifiManager) getSystemService(WIFI_SERVICE);
|
||||||
try {
|
try {
|
||||||
while (!wifiManager.isWifiEnabled()) {
|
while (!wifiManager.isWifiEnabled()) {
|
||||||
|
FDroidApp.initWifiSettings();
|
||||||
if (isCancelled())
|
if (isCancelled())
|
||||||
return null;
|
return null;
|
||||||
if (BuildConfig.DEBUG) {
|
if (BuildConfig.DEBUG) {
|
||||||
|
@ -6,6 +6,7 @@ import android.content.Intent;
|
|||||||
import android.net.NetworkInfo;
|
import android.net.NetworkInfo;
|
||||||
import android.net.wifi.WifiManager;
|
import android.net.wifi.WifiManager;
|
||||||
|
|
||||||
|
import org.fdroid.fdroid.FDroidApp;
|
||||||
import org.fdroid.fdroid.net.WifiStateChangeService;
|
import org.fdroid.fdroid.net.WifiStateChangeService;
|
||||||
|
|
||||||
public class WifiStateChangeReceiver extends BroadcastReceiver {
|
public class WifiStateChangeReceiver extends BroadcastReceiver {
|
||||||
@ -15,6 +16,8 @@ public class WifiStateChangeReceiver extends BroadcastReceiver {
|
|||||||
NetworkInfo ni = intent.getParcelableExtra(WifiManager.EXTRA_NETWORK_INFO);
|
NetworkInfo ni = intent.getParcelableExtra(WifiManager.EXTRA_NETWORK_INFO);
|
||||||
if (ni.isConnected()) {
|
if (ni.isConnected()) {
|
||||||
context.startService(new Intent(context, WifiStateChangeService.class));
|
context.startService(new Intent(context, WifiStateChangeService.class));
|
||||||
|
} else {
|
||||||
|
FDroidApp.initWifiSettings();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user