iitcm should only handle ingress intel links...send intent for other urls

This commit is contained in:
Philipp Schaefer 2013-04-11 17:40:44 +02:00
parent 00feade73e
commit 4fd5e9e9b5
2 changed files with 20 additions and 2 deletions

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.cradle.iitc_mobile" package="com.cradle.iitc_mobile"
android:versionCode="8" android:versionCode="9"
android:versionName="0.2.7" > android:versionName="0.2.8" >
<uses-sdk <uses-sdk
android:minSdkVersion="14" android:minSdkVersion="14"

View File

@ -1,9 +1,12 @@
package com.cradle.iitc_mobile; package com.cradle.iitc_mobile;
import android.content.Context; import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.net.Uri;
import android.net.http.SslError; import android.net.http.SslError;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.util.Log;
import android.webkit.SslErrorHandler; import android.webkit.SslErrorHandler;
import android.webkit.WebResourceResponse; import android.webkit.WebResourceResponse;
import android.webkit.WebView; import android.webkit.WebView;
@ -22,8 +25,10 @@ public class IITC_WebViewClient extends WebViewClient {
private WebResourceResponse iitcjs; private WebResourceResponse iitcjs;
private String js = null; private String js = null;
Context context;
public IITC_WebViewClient(Context c) { public IITC_WebViewClient(Context c) {
this.context = c;
try { try {
loadIITC_JS(c); loadIITC_JS(c);
} catch(IOException e) { } catch(IOException e) {
@ -109,4 +114,17 @@ public class IITC_WebViewClient extends WebViewClient {
return super.shouldInterceptRequest(view, url); return super.shouldInterceptRequest(view, url);
} }
} }
// start non-ingress-intel-urls in another app...
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (url.contains("ingress.com/intel")) {
return false;
} else {
Log.d("iitcm", "no ingress intel link, start external app to load url");
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
context.startActivity(intent);
return true;
}
}
} }