mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-07 23:03:11 +08:00
CB-883: SplashScreen without show() method, only hide()
This commit is contained in:
parent
6c594b6f5f
commit
5c7783305a
@ -1088,23 +1088,26 @@ public class DroidGap extends Activity implements CordovaInterface {
|
|||||||
* Shows the splash screen over the full Activity
|
* Shows the splash screen over the full Activity
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
protected void showSplashScreen(int time) {
|
protected void showSplashScreen(final int time) {
|
||||||
|
final DroidGap that = this;
|
||||||
|
|
||||||
|
Runnable runnable = new Runnable() {
|
||||||
|
public void run() {
|
||||||
// Get reference to display
|
// Get reference to display
|
||||||
Display display = getWindowManager().getDefaultDisplay();
|
Display display = getWindowManager().getDefaultDisplay();
|
||||||
|
|
||||||
// Create the layout for the dialog
|
// Create the layout for the dialog
|
||||||
LinearLayout root = new LinearLayout(this);
|
LinearLayout root = new LinearLayout(that.getActivity());
|
||||||
root.setMinimumHeight(display.getHeight());
|
root.setMinimumHeight(display.getHeight());
|
||||||
root.setMinimumWidth(display.getWidth());
|
root.setMinimumWidth(display.getWidth());
|
||||||
root.setOrientation(LinearLayout.VERTICAL);
|
root.setOrientation(LinearLayout.VERTICAL);
|
||||||
root.setBackgroundColor(this.getIntegerProperty("backgroundColor", Color.BLACK));
|
root.setBackgroundColor(that.getIntegerProperty("backgroundColor", Color.BLACK));
|
||||||
root.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
|
root.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
|
||||||
ViewGroup.LayoutParams.FILL_PARENT, 0.0F));
|
ViewGroup.LayoutParams.FILL_PARENT, 0.0F));
|
||||||
root.setBackgroundResource(this.splashscreen);
|
root.setBackgroundResource(that.splashscreen);
|
||||||
|
|
||||||
// Create and show the dialog
|
// Create and show the dialog
|
||||||
splashDialog = new Dialog(this, android.R.style.Theme_Translucent_NoTitleBar);
|
splashDialog = new Dialog(that, android.R.style.Theme_Translucent_NoTitleBar);
|
||||||
// check to see if the splash screen should be full screen
|
// check to see if the splash screen should be full screen
|
||||||
if ((getWindow().getAttributes().flags & WindowManager.LayoutParams.FLAG_FULLSCREEN)
|
if ((getWindow().getAttributes().flags & WindowManager.LayoutParams.FLAG_FULLSCREEN)
|
||||||
== WindowManager.LayoutParams.FLAG_FULLSCREEN) {
|
== WindowManager.LayoutParams.FLAG_FULLSCREEN) {
|
||||||
@ -1123,6 +1126,9 @@ public class DroidGap extends Activity implements CordovaInterface {
|
|||||||
}
|
}
|
||||||
}, time);
|
}, time);
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
this.runOnUiThread(runnable);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a message is sent to plugin.
|
* Called when a message is sent to plugin.
|
||||||
|
@ -31,8 +31,9 @@ public class SplashScreen extends Plugin {
|
|||||||
String result = "";
|
String result = "";
|
||||||
|
|
||||||
if (action.equals("hide")) {
|
if (action.equals("hide")) {
|
||||||
//((DroidGap)this.ctx).removeSplashScreen();
|
|
||||||
this.webView.postMessage("splashscreen", "hide");
|
this.webView.postMessage("splashscreen", "hide");
|
||||||
|
} else if (action.equals("show")){
|
||||||
|
this.webView.postMessage("splashscreen", "show");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
status = PluginResult.Status.INVALID_ACTION;
|
status = PluginResult.Status.INVALID_ACTION;
|
||||||
|
Loading…
Reference in New Issue
Block a user