Restored geolocation feature
This commit is contained in:
parent
8f9ee4382d
commit
15ad360f0b
@ -56,17 +56,6 @@ public class IITC_Mobile extends Activity {
|
|||||||
StrictMode.setThreadPolicy(policy);
|
StrictMode.setThreadPolicy(policy);
|
||||||
setContentView(R.layout.activity_main);
|
setContentView(R.layout.activity_main);
|
||||||
iitc_view = (IITC_WebView) findViewById(R.id.iitc_webview);
|
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
|
// fetch actionbar, set display flags, title and enable home button
|
||||||
actionBar = this.getActionBar();
|
actionBar = this.getActionBar();
|
||||||
|
@ -2,6 +2,7 @@ package com.cradle.iitc_mobile;
|
|||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.annotation.TargetApi;
|
import android.annotation.TargetApi;
|
||||||
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.net.ConnectivityManager;
|
import android.net.ConnectivityManager;
|
||||||
@ -39,14 +40,23 @@ public class IITC_WebView extends WebView {
|
|||||||
this.js_interface = new IITC_JSInterface(c);
|
this.js_interface = new IITC_JSInterface(c);
|
||||||
this.addJavascriptInterface(js_interface, "android");
|
this.addJavascriptInterface(js_interface, "android");
|
||||||
|
|
||||||
// our webchromeclient should share geolocation with the iitc script
|
|
||||||
// allow access by default
|
|
||||||
this.setWebChromeClient(new WebChromeClient() {
|
this.setWebChromeClient(new WebChromeClient() {
|
||||||
@Override
|
@Override
|
||||||
public void onGeolocationPermissionsShowPrompt(String origin,
|
public void onGeolocationPermissionsShowPrompt(String origin,
|
||||||
GeolocationPermissions.Callback callback) {
|
GeolocationPermissions.Callback callback) {
|
||||||
|
// our webchromeclient should share geolocation with the iitc script
|
||||||
|
// allow access by default
|
||||||
callback.invoke(origin, true, false);
|
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);
|
webclient = new IITC_WebViewClient(c);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user