diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java index f2ac715b..a7187e71 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java @@ -56,17 +56,6 @@ public class IITC_Mobile extends Activity { StrictMode.setThreadPolicy(policy); setContentView(R.layout.activity_main); iitc_view = (IITC_WebView) findViewById(R.id.iitc_webview); - iitc_view.setWebChromeClient(new WebChromeClient() - { - @Override - public void onProgressChanged(WebView view, int newProgress) { - super.onProgressChanged(view, newProgress); - - // maximum for newProgress is 100 - // maximum for setProgress is 10,000 - setProgress(newProgress * 100); - } - }); // fetch actionbar, set display flags, title and enable home button actionBar = this.getActionBar(); diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_WebView.java b/mobile/src/com/cradle/iitc_mobile/IITC_WebView.java index 866d1f38..e11e1d09 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_WebView.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_WebView.java @@ -2,6 +2,7 @@ package com.cradle.iitc_mobile; import android.annotation.SuppressLint; import android.annotation.TargetApi; +import android.app.Activity; import android.content.Context; import android.content.SharedPreferences; import android.net.ConnectivityManager; @@ -39,14 +40,23 @@ public class IITC_WebView extends WebView { this.js_interface = new IITC_JSInterface(c); this.addJavascriptInterface(js_interface, "android"); - // our webchromeclient should share geolocation with the iitc script - // allow access by default this.setWebChromeClient(new WebChromeClient() { @Override public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) { + // our webchromeclient should share geolocation with the iitc script + // allow access by default callback.invoke(origin, true, false); } + + @Override + public void onProgressChanged(WebView view, int newProgress) { + super.onProgressChanged(view, newProgress); + + // maximum for newProgress is 100 + // maximum for setProgress is 10,000 + ((Activity) getContext()).setProgress(newProgress * 100); + } }); webclient = new IITC_WebViewClient(c);