mirror of
https://github.com/apache/cordova-android.git
synced 2025-01-19 23:42:53 +08:00
Ticket 106 - Simplify splash screen logic based upon idea from vadim.
This commit is contained in:
parent
8d73b364f2
commit
21a34a8980
@ -16,12 +16,12 @@ import android.content.Intent;
|
|||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.Picture;
|
|
||||||
import android.media.AudioManager;
|
import android.media.AudioManager;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
@ -31,7 +31,6 @@ import android.webkit.JsPromptResult;
|
|||||||
import android.webkit.WebSettings;
|
import android.webkit.WebSettings;
|
||||||
import android.webkit.WebStorage;
|
import android.webkit.WebStorage;
|
||||||
import android.webkit.WebView;
|
import android.webkit.WebView;
|
||||||
import android.webkit.WebView.PictureListener;
|
|
||||||
import android.webkit.WebViewClient;
|
import android.webkit.WebViewClient;
|
||||||
import android.webkit.GeolocationPermissions.Callback;
|
import android.webkit.GeolocationPermissions.Callback;
|
||||||
import android.webkit.WebSettings.LayoutAlgorithm;
|
import android.webkit.WebSettings.LayoutAlgorithm;
|
||||||
@ -111,8 +110,8 @@ public class DroidGap extends PhonegapActivity {
|
|||||||
protected WebView appView;
|
protected WebView appView;
|
||||||
protected WebViewClient webViewClient;
|
protected WebViewClient webViewClient;
|
||||||
|
|
||||||
private LinearLayout root;
|
protected LinearLayout root;
|
||||||
boolean bound = false;
|
public boolean bound = false;
|
||||||
public CallbackServer callbackServer;
|
public CallbackServer callbackServer;
|
||||||
protected PluginManager pluginManager;
|
protected PluginManager pluginManager;
|
||||||
protected boolean cancelLoadUrl = false;
|
protected boolean cancelLoadUrl = false;
|
||||||
@ -235,7 +234,8 @@ public class DroidGap extends PhonegapActivity {
|
|||||||
// Bind PhoneGap objects to JavaScript
|
// Bind PhoneGap objects to JavaScript
|
||||||
this.bindBrowser(this.appView);
|
this.bindBrowser(this.appView);
|
||||||
|
|
||||||
// Add web view
|
// Add web view but make it invisible while loading URL
|
||||||
|
this.appView.setVisibility(View.INVISIBLE);
|
||||||
root.addView(this.appView);
|
root.addView(this.appView);
|
||||||
setContentView(root);
|
setContentView(root);
|
||||||
|
|
||||||
@ -302,8 +302,7 @@ public class DroidGap extends PhonegapActivity {
|
|||||||
// If spashscreen
|
// If spashscreen
|
||||||
this.splashscreen = this.getIntegerProperty("splashscreen", 0);
|
this.splashscreen = this.getIntegerProperty("splashscreen", 0);
|
||||||
if (this.splashscreen != 0) {
|
if (this.splashscreen != 0) {
|
||||||
this.appView.setBackgroundColor(0);
|
root.setBackgroundResource(this.splashscreen);
|
||||||
this.appView.setBackgroundResource(splashscreen);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If hideLoadingDialogOnPageLoad
|
// If hideLoadingDialogOnPageLoad
|
||||||
@ -1009,16 +1008,8 @@ public class DroidGap extends PhonegapActivity {
|
|||||||
// from the JS side when the JS gets to that code.
|
// from the JS side when the JS gets to that code.
|
||||||
appView.loadUrl("javascript:try{ PhoneGap.onNativeReady.fire();}catch(e){_nativeReady = true;}");
|
appView.loadUrl("javascript:try{ PhoneGap.onNativeReady.fire();}catch(e){_nativeReady = true;}");
|
||||||
|
|
||||||
// If splash screen is showing, clear it
|
// Make app view visible
|
||||||
if (this.ctx.splashscreen != 0) {
|
appView.setVisibility(View.VISIBLE);
|
||||||
this.ctx.splashscreen = 0;
|
|
||||||
appView.setPictureListener(new PictureListener(){
|
|
||||||
public void onNewPicture(WebView viewtwo, Picture picture) {
|
|
||||||
appView.setBackgroundResource(0);
|
|
||||||
appView.setPictureListener(null);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Stop "app loading" spinner if showing
|
// Stop "app loading" spinner if showing
|
||||||
if (this.ctx.hideLoadingDialogOnPageLoad) {
|
if (this.ctx.hideLoadingDialogOnPageLoad) {
|
||||||
|
Loading…
Reference in New Issue
Block a user