some comments and brackets

This commit is contained in:
Philipp Schaefer 2013-05-14 19:17:12 +02:00
parent 6a1032c7aa
commit 0e8fac893e

View File

@ -124,15 +124,20 @@ public class IITC_WebView extends WebView {
}
}
@TargetApi(16)
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
private boolean isConnectedToWifi() {
ConnectivityManager conMan = (ConnectivityManager) getContext()
.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo wifi = conMan.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
// since jelly bean you can mark wifi networks as mobile hotspots
// settings -> data usage -> menu -> mobile hotspots
// ConnectivityManager.isActiveNetworkMeter returns if the currently used wifi-network
// is ticked as mobile hotspot or not.
// --> IITC_WebView.isConnectedToWifi should return 'false' if connected to mobile hotspot
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
return wifi.getState() == NetworkInfo.State.CONNECTED && !conMan.isActiveNetworkMetered();
return ((wifi.getState() == NetworkInfo.State.CONNECTED) && !conMan.isActiveNetworkMetered());
}
return wifi.getState() == NetworkInfo.State.CONNECTED;
return (wifi.getState() == NetworkInfo.State.CONNECTED);
}
public void disableJS(boolean val) {