public void updateWifiConfigWithScanResults(List<ScanResult> scanResults) { List<String> scanResultsStrings = new ArrayList<String>(); synchronized (wifiNetworkStatusLock) { // clear all the savedConfigurations AP status if (!getWifiNetworkStatus().isEmpty()) { App.getTraceUtils().startTrace(TAG, "Clear scan status from AP configs", Log.DEBUG); for (WiFiApConfig conf : getWifiNetworkStatus().values()) { conf.clearScanStatus(); } App.getTraceUtils().stopTrace(TAG, "Clear scan status from AP configs", Log.DEBUG); } if (scanResults != null) { for (ScanResult res : scanResults) { scanResultsStrings.add(res.SSID + " level: " + res.level); String currSSID = ProxyUtils.cleanUpSSID(res.SSID); SecurityType security = ProxyUtils.getSecurity(res); APLNetworkId aplNetworkId = new APLNetworkId(currSSID, security); if (getWifiNetworkStatus().containsKey(aplNetworkId)) { WiFiApConfig conf = getWifiNetworkStatus().get(aplNetworkId); if (conf != null) { conf.updateScanResults(res); } } else { if (getWifiNetworkStatus().getNotConfiguredWifi().containsKey(aplNetworkId)) { getWifiNetworkStatus().getNotConfiguredWifi().remove(aplNetworkId); } getWifiNetworkStatus().getNotConfiguredWifi().put(aplNetworkId, res); } } } else { Timber.w("No ScanResults available for updateWifiConfigWithScanResults"); } } Timber.d("Updating from scanresult: " + TextUtils.join(", ", scanResultsStrings.toArray())); }
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Let's display the progress in the activity title bar, like the // browser app does. getWindow().requestFeature(Window.FEATURE_PROGRESS); setContentView(R.layout.webview); if (Build.VERSION.SDK_INT < 12) ProxyUtils.setWebViewProxy( getApplicationContext(), App.getProxyManager().getCachedConfiguration()); // Only // for mWebView = (WebView) findViewById(R.id.webview); mWebView.getSettings().setJavaScriptEnabled(true); mWebView.getSettings().setDomStorageEnabled(true); mWebView.getSettings().setLoadsImagesAutomatically(true); // mWebView.setBackgroundColor(0x00000000); mWebView.getSettings().setAllowFileAccess(true); mWebView.getSettings().setSupportZoom(true); mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); final Activity activity = this; mWebView.setWebChromeClient( new WebChromeClient() { public void onProgressChanged(WebView view, int progress) { activity.setTitle("Loading..."); // Activities and WebViews measure progress with different // scales. The progress meter will automatically disappear when we reach 100% int activityProgress = progress * 100; App.getLogger() .d(TAG, "webprogress,activityprogress: " + progress + "," + activityProgress); activity.setProgress(activityProgress); if (progress == 100) activity.setTitle(R.string.app_name); } }); mWebView = (WebView) findViewById(R.id.webview); mWebView.setWebViewClient(new LocalWebViewClient()); Bundle extras = getIntent().getExtras(); URL url = (URL) extras.getSerializable("URL"); mWebView.loadUrl(url.toString()); }