get rid of WebRessourceResponse injecting (fix for #437)
- added some kind of splash screen
This commit is contained in:
parent
b0dd95e694
commit
89846e1a77
@ -501,6 +501,11 @@ function boot() {
|
|||||||
|
|
||||||
window.iitcLoaded = true;
|
window.iitcLoaded = true;
|
||||||
window.runHooks('iitcLoaded');
|
window.runHooks('iitcLoaded');
|
||||||
|
|
||||||
|
if (typeof android !== 'undefined' && android && android.iitcLoaded) {
|
||||||
|
android.iitcLoaded();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// this is the minified load.js script that allows us to easily load
|
// this is the minified load.js script that allows us to easily load
|
||||||
|
BIN
mobile/res/drawable-hdpi/iitc.png
Normal file
BIN
mobile/res/drawable-hdpi/iitc.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 52 KiB |
BIN
mobile/res/drawable-ldpi/iitc.png
Normal file
BIN
mobile/res/drawable-ldpi/iitc.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 52 KiB |
BIN
mobile/res/drawable-mdpi/iitc.png
Normal file
BIN
mobile/res/drawable-mdpi/iitc.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 52 KiB |
BIN
mobile/res/drawable-xhdpi/iitc.png
Normal file
BIN
mobile/res/drawable-xhdpi/iitc.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 52 KiB |
BIN
mobile/res/drawable-xxhdpi/iitc.png
Normal file
BIN
mobile/res/drawable-xxhdpi/iitc.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 52 KiB |
@ -6,6 +6,11 @@
|
|||||||
<com.cradle.iitc_mobile.IITC_WebView
|
<com.cradle.iitc_mobile.IITC_WebView
|
||||||
android:id="@+id/iitc_webview"
|
android:id="@+id/iitc_webview"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent"/>
|
android:layout_height="fill_parent" />
|
||||||
|
<ImageView android:id="@+id/imageLoading"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:background="@android:color/darker_gray"
|
||||||
|
android:src="@drawable/iitc" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
@ -10,6 +10,7 @@ import android.content.DialogInterface.OnMultiChoiceClickListener;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.view.View;
|
||||||
import android.webkit.JavascriptInterface;
|
import android.webkit.JavascriptInterface;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
@ -118,6 +119,20 @@ public class IITC_JSInterface {
|
|||||||
((IITC_Mobile) context).setFocusedDialog(id);
|
((IITC_Mobile) context).setFocusedDialog(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JavascriptInterface
|
||||||
|
public void iitcLoaded() {
|
||||||
|
Log.d("iitcm", "iitc loaded completely");
|
||||||
|
final IITC_Mobile iitc = ((IITC_Mobile) context);
|
||||||
|
|
||||||
|
iitc.runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
iitc.findViewById(R.id.iitc_webview).setVisibility(View.VISIBLE);
|
||||||
|
iitc.findViewById(R.id.imageLoading).setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// get layers and list them in a dialog
|
// get layers and list them in a dialog
|
||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
public void setLayers(String base_layer, String overlay_layer) {
|
public void setLayers(String base_layer, String overlay_layer) {
|
||||||
|
@ -22,6 +22,7 @@ import android.preference.PreferenceManager;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
import android.view.View;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.webkit.WebSettings;
|
import android.webkit.WebSettings;
|
||||||
@ -463,6 +464,8 @@ public class IITC_Mobile extends Activity {
|
|||||||
// inject the iitc-script and load the intel url
|
// inject the iitc-script and load the intel url
|
||||||
// plugins are injected onPageFinished
|
// plugins are injected onPageFinished
|
||||||
public void loadUrl(String url) {
|
public void loadUrl(String url) {
|
||||||
|
findViewById(R.id.imageLoading).setVisibility(View.VISIBLE);
|
||||||
|
findViewById(R.id.iitc_webview).setVisibility(View.GONE);
|
||||||
url = addUrlParam(url);
|
url = addUrlParam(url);
|
||||||
loadIITC();
|
loadIITC();
|
||||||
iitc_view.loadUrl(url);
|
iitc_view.loadUrl(url);
|
||||||
|
@ -31,13 +31,13 @@ import java.util.concurrent.TimeUnit;
|
|||||||
import java.util.concurrent.TimeoutException;
|
import java.util.concurrent.TimeoutException;
|
||||||
|
|
||||||
public class IITC_WebViewClient extends WebViewClient {
|
public class IITC_WebViewClient extends WebViewClient {
|
||||||
private static final ByteArrayInputStream style = new ByteArrayInputStream(
|
|
||||||
|
private static final ByteArrayInputStream STYLE = new ByteArrayInputStream(
|
||||||
"body, #dashboard_container, #map_canvas { background: #000 !important; }"
|
"body, #dashboard_container, #map_canvas { background: #000 !important; }"
|
||||||
.getBytes());
|
.getBytes());
|
||||||
private static final ByteArrayInputStream empty = new ByteArrayInputStream(
|
private static final ByteArrayInputStream EMPTY = new ByteArrayInputStream(
|
||||||
"".getBytes());
|
"".getBytes());
|
||||||
|
|
||||||
private WebResourceResponse iitcjs;
|
|
||||||
private String js = null;
|
private String js = null;
|
||||||
private String iitc_path = null;
|
private String iitc_path = null;
|
||||||
private final Context context;
|
private final Context context;
|
||||||
@ -139,8 +139,6 @@ public class IITC_WebViewClient extends WebViewClient {
|
|||||||
// so it boots correctly.
|
// so it boots correctly.
|
||||||
this.js = "$(document).ready(function(){" + js + "});";
|
this.js = "$(document).ready(function(){" + js + "});";
|
||||||
|
|
||||||
iitcjs = new WebResourceResponse("text/javascript", "UTF-8",
|
|
||||||
new ByteArrayInputStream(this.js.getBytes()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// enable https
|
// enable https
|
||||||
@ -152,11 +150,8 @@ public class IITC_WebViewClient extends WebViewClient {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPageFinished(WebView view, String url) {
|
public void onPageFinished(WebView view, String url) {
|
||||||
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
|
Log.d("iitcm", "injecting iitc..");
|
||||||
if(sharedPrefs.getBoolean("pref_force_desktop", false)) {
|
view.loadUrl("javascript: " + this.js);
|
||||||
Log.d("iitcm", "injecting desktop iitc");
|
|
||||||
view.loadUrl("javascript: " + this.js);
|
|
||||||
}
|
|
||||||
super.onPageFinished(view, url);
|
super.onPageFinished(view, url);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -301,26 +296,21 @@ public class IITC_WebViewClient extends WebViewClient {
|
|||||||
@Override
|
@Override
|
||||||
public WebResourceResponse shouldInterceptRequest(final WebView view,
|
public WebResourceResponse shouldInterceptRequest(final WebView view,
|
||||||
String url) {
|
String url) {
|
||||||
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
|
if (url.contains("/css/common.css")) {
|
||||||
if(!sharedPrefs.getBoolean("pref_force_desktop", false)) {
|
return new WebResourceResponse("text/css", "UTF-8", STYLE);
|
||||||
if (url.contains("/css/common.css")) {
|
} else if (url.contains("gen_dashboard.js")) {
|
||||||
return new WebResourceResponse("text/css", "UTF-8", style);
|
return new WebResourceResponse("text/javascript", "UTF-8", EMPTY);
|
||||||
} else if (url.contains("gen_dashboard.js")) {
|
} else if (url.contains("/css/ap_icons.css")
|
||||||
Log.d("iitcm", "replacing gen_dashboard.js with iitc script");
|
|| url.contains("/css/map_icons.css")
|
||||||
Log.d("iitcm", "injecting iitc...");
|
|| url.contains("/css/common.css")
|
||||||
return this.iitcjs;
|
|| url.contains("/css/misc_icons.css")
|
||||||
} else if (url.contains("/css/ap_icons.css")
|
|| url.contains("/css/style_full.css")
|
||||||
|| url.contains("/css/map_icons.css")
|
|| url.contains("/css/style_mobile.css")
|
||||||
|| url.contains("/css/misc_icons.css")
|
|| url.contains("/css/portalrender.css")
|
||||||
|| url.contains("/css/style_full.css")
|
|| url.contains("/css/portalrender_mobile.css")
|
||||||
|| url.contains("/css/style_mobile.css")
|
|| url.contains("js/analytics.js")
|
||||||
|| url.contains("/css/portalrender.css")
|
|| url.contains("google-analytics.com/ga.js")) {
|
||||||
|| url.contains("js/analytics.js")
|
return new WebResourceResponse("text/plain", "UTF-8", EMPTY);
|
||||||
|| url.contains("google-analytics.com/ga.js")) {
|
|
||||||
return new WebResourceResponse("text/plain", "UTF-8", empty);
|
|
||||||
} else {
|
|
||||||
return super.shouldInterceptRequest(view, url);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
return super.shouldInterceptRequest(view, url);
|
return super.shouldInterceptRequest(view, url);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user