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.runHooks('iitcLoaded');
|
||||
|
||||
if (typeof android !== 'undefined' && android && android.iitcLoaded) {
|
||||
android.iitcLoaded();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 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
|
||||
android:id="@+id/iitc_webview"
|
||||
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>
|
@ -10,6 +10,7 @@ import android.content.DialogInterface.OnMultiChoiceClickListener;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.webkit.JavascriptInterface;
|
||||
import android.widget.Toast;
|
||||
|
||||
@ -118,6 +119,20 @@ public class IITC_JSInterface {
|
||||
((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
|
||||
@JavascriptInterface
|
||||
public void setLayers(String base_layer, String overlay_layer) {
|
||||
|
@ -22,6 +22,7 @@ import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.webkit.WebSettings;
|
||||
@ -463,6 +464,8 @@ public class IITC_Mobile extends Activity {
|
||||
// inject the iitc-script and load the intel url
|
||||
// plugins are injected onPageFinished
|
||||
public void loadUrl(String url) {
|
||||
findViewById(R.id.imageLoading).setVisibility(View.VISIBLE);
|
||||
findViewById(R.id.iitc_webview).setVisibility(View.GONE);
|
||||
url = addUrlParam(url);
|
||||
loadIITC();
|
||||
iitc_view.loadUrl(url);
|
||||
|
@ -31,13 +31,13 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
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; }"
|
||||
.getBytes());
|
||||
private static final ByteArrayInputStream empty = new ByteArrayInputStream(
|
||||
private static final ByteArrayInputStream EMPTY = new ByteArrayInputStream(
|
||||
"".getBytes());
|
||||
|
||||
private WebResourceResponse iitcjs;
|
||||
private String js = null;
|
||||
private String iitc_path = null;
|
||||
private final Context context;
|
||||
@ -139,8 +139,6 @@ public class IITC_WebViewClient extends WebViewClient {
|
||||
// so it boots correctly.
|
||||
this.js = "$(document).ready(function(){" + js + "});";
|
||||
|
||||
iitcjs = new WebResourceResponse("text/javascript", "UTF-8",
|
||||
new ByteArrayInputStream(this.js.getBytes()));
|
||||
}
|
||||
|
||||
// enable https
|
||||
@ -152,11 +150,8 @@ public class IITC_WebViewClient extends WebViewClient {
|
||||
|
||||
@Override
|
||||
public void onPageFinished(WebView view, String url) {
|
||||
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
if(sharedPrefs.getBoolean("pref_force_desktop", false)) {
|
||||
Log.d("iitcm", "injecting desktop iitc");
|
||||
Log.d("iitcm", "injecting iitc..");
|
||||
view.loadUrl("javascript: " + this.js);
|
||||
}
|
||||
super.onPageFinished(view, url);
|
||||
}
|
||||
|
||||
@ -301,26 +296,21 @@ public class IITC_WebViewClient extends WebViewClient {
|
||||
@Override
|
||||
public WebResourceResponse shouldInterceptRequest(final WebView view,
|
||||
String url) {
|
||||
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
if(!sharedPrefs.getBoolean("pref_force_desktop", false)) {
|
||||
if (url.contains("/css/common.css")) {
|
||||
return new WebResourceResponse("text/css", "UTF-8", style);
|
||||
return new WebResourceResponse("text/css", "UTF-8", STYLE);
|
||||
} else if (url.contains("gen_dashboard.js")) {
|
||||
Log.d("iitcm", "replacing gen_dashboard.js with iitc script");
|
||||
Log.d("iitcm", "injecting iitc...");
|
||||
return this.iitcjs;
|
||||
return new WebResourceResponse("text/javascript", "UTF-8", EMPTY);
|
||||
} else if (url.contains("/css/ap_icons.css")
|
||||
|| url.contains("/css/map_icons.css")
|
||||
|| url.contains("/css/common.css")
|
||||
|| url.contains("/css/misc_icons.css")
|
||||
|| url.contains("/css/style_full.css")
|
||||
|| url.contains("/css/style_mobile.css")
|
||||
|| url.contains("/css/portalrender.css")
|
||||
|| url.contains("/css/portalrender_mobile.css")
|
||||
|| url.contains("js/analytics.js")
|
||||
|| url.contains("google-analytics.com/ga.js")) {
|
||||
return new WebResourceResponse("text/plain", "UTF-8", empty);
|
||||
} else {
|
||||
return super.shouldInterceptRequest(view, url);
|
||||
}
|
||||
return new WebResourceResponse("text/plain", "UTF-8", EMPTY);
|
||||
} else {
|
||||
return super.shouldInterceptRequest(view, url);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user