some comments and brackets
This commit is contained in:
parent
6a1032c7aa
commit
0e8fac893e
@ -124,15 +124,20 @@ public class IITC_WebView extends WebView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TargetApi(16)
|
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
|
||||||
private boolean isConnectedToWifi() {
|
private boolean isConnectedToWifi() {
|
||||||
ConnectivityManager conMan = (ConnectivityManager) getContext()
|
ConnectivityManager conMan = (ConnectivityManager) getContext()
|
||||||
.getSystemService(Context.CONNECTIVITY_SERVICE);
|
.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||||
NetworkInfo wifi = conMan.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
|
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) {
|
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) {
|
public void disableJS(boolean val) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user