- added developer preference to disable splash screen

- disable splash screen on login screen
This commit is contained in:
Philipp Schaefer
2013-07-24 00:49:21 +02:00
parent e2ab17fa81
commit f342aeab0a
7 changed files with 38 additions and 8 deletions

View File

@ -464,8 +464,7 @@ 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);
showSplashScreen();
url = addUrlParam(url);
loadIITC();
iitc_view.loadUrl(url);
@ -483,8 +482,6 @@ public class IITC_Mobile extends Activity {
}
public void toggleFullscreen() {
// TODO: Figure out how to handle this with new back stack?
if (fullscreen_mode) {
if (fullscreen_actionbar)
this.getActionBar().show();
@ -546,6 +543,7 @@ public class IITC_Mobile extends Activity {
public void loginSucceeded() {
// garbage collection
mLogin = null;
showSplashScreen();
}
// disable/enable some menu buttons...
@ -578,4 +576,11 @@ public class IITC_Mobile extends Activity {
dialogStack.remove(id);
}
}
public void showSplashScreen() {
if (!sharedPref.getBoolean("pref_disable_splash", false)) {
findViewById(R.id.iitc_webview).setVisibility(View.GONE);
findViewById(R.id.imageLoading).setVisibility(View.VISIBLE);
}
}
}

View File

@ -10,6 +10,7 @@ import android.net.http.SslError;
import android.os.Environment;
import android.preference.PreferenceManager;
import android.util.Log;
import android.view.View;
import android.webkit.SslErrorHandler;
import android.webkit.WebResourceResponse;
import android.webkit.WebSettings;
@ -150,8 +151,11 @@ public class IITC_WebViewClient extends WebViewClient {
@Override
public void onPageFinished(WebView view, String url) {
Log.d("iitcm", "injecting iitc..");
view.loadUrl("javascript: " + this.js);
if (url.startsWith("http://www.ingress.com/intel")
|| url.startsWith("https://www.ingress.com/intel")) {
Log.d("iitcm", "injecting iitc..");
view.loadUrl("javascript: " + this.js);
}
super.onPageFinished(view, url);
}
@ -288,6 +292,18 @@ public class IITC_WebViewClient extends WebViewClient {
return js;
}
@Override
public void onLoadResource(WebView view, String url) {
if(url.contains("css/basic.css")) {
Log.d("iitcm", "basic.css received...should be ingress intel login");
// get rid of loading screen to log in
IITC_Mobile iitc = (IITC_Mobile) context;
iitc.findViewById(R.id.iitc_webview).setVisibility(View.VISIBLE);
iitc.findViewById(R.id.imageLoading).setVisibility(View.GONE);
}
super.onLoadResource(view, url);
}
// Check every external resource if its okay to load it and maybe replace
// it
// with our own content. This is used to block loading Niantic resources