From 0e8fac893e8538ab1560a36620fb907f46ffe7b0 Mon Sep 17 00:00:00 2001 From: Philipp Schaefer Date: Tue, 14 May 2013 19:17:12 +0200 Subject: [PATCH] some comments and brackets --- mobile/src/com/cradle/iitc_mobile/IITC_WebView.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_WebView.java b/mobile/src/com/cradle/iitc_mobile/IITC_WebView.java index 7241596e..866d1f38 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_WebView.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_WebView.java @@ -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) {