From 48c6ec87cf91d252aa5fb5738e496b11319dd931 Mon Sep 17 00:00:00 2001 From: macdonst Date: Fri, 8 Jun 2012 13:03:12 -0400 Subject: [PATCH 1/4] CB-878: Splash screen in Android fullscreen mode showing not correct --- framework/src/org/apache/cordova/DroidGap.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/framework/src/org/apache/cordova/DroidGap.java b/framework/src/org/apache/cordova/DroidGap.java index ddd50a6e..c30a19bd 100755 --- a/framework/src/org/apache/cordova/DroidGap.java +++ b/framework/src/org/apache/cordova/DroidGap.java @@ -1432,6 +1432,8 @@ public class DroidGap extends Activity implements CordovaInterface { // Create and show the dialog splashDialog = new Dialog(this, android.R.style.Theme_Translucent_NoTitleBar); + splashDialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, + WindowManager.LayoutParams.FLAG_FULLSCREEN); splashDialog.setContentView(root); splashDialog.setCancelable(false); splashDialog.show(); From 6c1a2e1230e2ed59fb7b817e7cc2e52ab93dda7f Mon Sep 17 00:00:00 2001 From: macdonst Date: Fri, 8 Jun 2012 13:59:32 -0400 Subject: [PATCH 2/4] CB-878: Splash screen in Android fullscreen mode showing not correct --- .../src/org/apache/cordova/DroidGap.java | 50 ++++++++++--------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/framework/src/org/apache/cordova/DroidGap.java b/framework/src/org/apache/cordova/DroidGap.java index 33d641e1..18a47e9c 100755 --- a/framework/src/org/apache/cordova/DroidGap.java +++ b/framework/src/org/apache/cordova/DroidGap.java @@ -160,7 +160,7 @@ public class DroidGap extends Activity implements CordovaInterface { protected IPlugin activityResultCallback = null; protected boolean activityResultKeepRunning; - // Default background color for activity + // Default background color for activity // (this is not the color for the webview, which is set in HTML) private int backgroundColor = Color.BLACK; @@ -183,7 +183,7 @@ public class DroidGap extends Activity implements CordovaInterface { /** * Sets the authentication token. - * + * * @param authenticationToken * @param host * @param realm @@ -199,7 +199,7 @@ public class DroidGap extends Activity implements CordovaInterface { * * @param host * @param realm - * + * * @return the authentication token or null if did not exist */ public AuthenticationToken removeAuthenticationToken(String host, String realm) { @@ -220,7 +220,7 @@ public class DroidGap extends Activity implements CordovaInterface { * * @param host * @param realm - * + * * @return the authentication token */ public AuthenticationToken getAuthenticationToken(String host, String realm) { @@ -239,9 +239,9 @@ public class DroidGap extends Activity implements CordovaInterface { } } - /** - * Called when the activity is first created. - * + /** + * Called when the activity is first created. + * * @param savedInstanceState */ @SuppressWarnings("deprecation") @@ -273,7 +273,7 @@ public class DroidGap extends Activity implements CordovaInterface { /** * Get the Android activity. - * + * * @return */ public Activity getActivity() { @@ -323,7 +323,7 @@ public class DroidGap extends Activity implements CordovaInterface { /** * Load the url into the webview. - * + * * @param url */ public void loadUrl(String url) { @@ -771,7 +771,7 @@ public class DroidGap extends Activity implements CordovaInterface { /** * Called when a key is released. (Key UP) - * + * * @param keyCode * @param event */ @@ -817,7 +817,7 @@ public class DroidGap extends Activity implements CordovaInterface { } /** - * Launch an activity for which you would like a result when it finished. When this activity exits, + * Launch an activity for which you would like a result when it finished. When this activity exits, * your onActivityResult() method will be called. * * @param command The command object @@ -860,12 +860,12 @@ public class DroidGap extends Activity implements CordovaInterface { } /** - * Report an error to the host application. These errors are unrecoverable (i.e. the main resource is unavailable). + * Report an error to the host application. These errors are unrecoverable (i.e. the main resource is unavailable). * The errorCode parameter corresponds to one of the ERROR_* constants. * * @param errorCode The error code corresponding to an ERROR_* value. * @param description A String describing the error. - * @param failingUrl The url that failed to load. + * @param failingUrl The url that failed to load. */ public void onReceivedError(final int errorCode, final String description, final String failingUrl) { final DroidGap me = this; @@ -901,7 +901,7 @@ public class DroidGap extends Activity implements CordovaInterface { /** * Display an error dialog and optionally exit application. - * + * * @param title * @param message * @param button @@ -948,7 +948,7 @@ public class DroidGap extends Activity implements CordovaInterface { return false; } - /* + /* * Hook in DroidGap for menu plugins * */ @@ -972,7 +972,7 @@ public class DroidGap extends Activity implements CordovaInterface { /** * Get Activity context. - * + * * @return */ public Context getContext() { @@ -981,7 +981,7 @@ public class DroidGap extends Activity implements CordovaInterface { /** * Override the backbutton. - * + * * @param override */ public void bindBackButton(boolean override) { @@ -990,7 +990,7 @@ public class DroidGap extends Activity implements CordovaInterface { /** * Determine of backbutton is overridden. - * + * * @return */ public boolean isBackButtonBound() { @@ -999,7 +999,7 @@ public class DroidGap extends Activity implements CordovaInterface { /** * Load the specified URL in the Cordova webview or a new browser instance. - * + * * NOTE: If openExternal is false, only URLs listed in whitelist can be loaded. * * @param url The url to load. @@ -1046,8 +1046,12 @@ public class DroidGap extends Activity implements CordovaInterface { // Create and show the dialog splashDialog = new Dialog(this, android.R.style.Theme_Translucent_NoTitleBar); - splashDialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, - WindowManager.LayoutParams.FLAG_FULLSCREEN); + // check to see if the splash screen should be full screen + if ((getWindow().getAttributes().flags & WindowManager.LayoutParams.FLAG_FULLSCREEN) + == WindowManager.LayoutParams.FLAG_FULLSCREEN) { + splashDialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, + WindowManager.LayoutParams.FLAG_FULLSCREEN); + } splashDialog.setContentView(root); splashDialog.setCancelable(false); splashDialog.show(); @@ -1062,8 +1066,8 @@ public class DroidGap extends Activity implements CordovaInterface { } /** - * Called when a message is sent to plugin. - * + * Called when a message is sent to plugin. + * * @param id The message id * @param data The message data * @return Object or null From 95b48705fea2cac0f2561f84d3f1ecf017357b58 Mon Sep 17 00:00:00 2001 From: macdonst Date: Fri, 8 Jun 2012 14:03:20 -0400 Subject: [PATCH 3/4] Adding getContext, startActivity to CordovaInterface --- .../apache/cordova/api/CordovaInterface.java | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/framework/src/org/apache/cordova/api/CordovaInterface.java b/framework/src/org/apache/cordova/api/CordovaInterface.java index fa6e1f8a..0242aa79 100755 --- a/framework/src/org/apache/cordova/api/CordovaInterface.java +++ b/framework/src/org/apache/cordova/api/CordovaInterface.java @@ -19,6 +19,7 @@ package org.apache.cordova.api; import android.app.Activity; +import android.content.Context; import android.content.Intent; /** @@ -28,39 +29,46 @@ import android.content.Intent; public interface CordovaInterface { /** - * Launch an activity for which you would like a result when it finished. When this activity exits, + * Launch an activity for which you would like a result when it finished. When this activity exits, * your onActivityResult() method will be called. - * + * * @param command The command object * @param intent The intent to start * @param requestCode The request code that is passed to callback to identify the activity */ abstract public void startActivityForResult(IPlugin command, Intent intent, int requestCode); + /** + * Launch an activity for which you would not like a result when it finished. + * + * @param intent The intent to start + */ + abstract public void startActivity(Intent intent); + /** * Set the plugin to be called when a sub-activity exits. - * + * * @param plugin The plugin on which onActivityResult is to be called */ abstract public void setActivityResultCallback(IPlugin plugin); /** * Causes the Activity to override the back button behavior. - * + * * @param override */ public abstract void bindBackButton(boolean override); /** * A hook required to check if the Back Button is bound. - * + * * @return */ public abstract boolean isBackButtonBound(); /** * Get the Android activity. - * + * * @return */ public abstract Activity getActivity(); @@ -69,12 +77,13 @@ public interface CordovaInterface { public abstract void cancelLoadUrl(); /** - * Called when a message is sent to plugin. - * + * Called when a message is sent to plugin. + * * @param id The message id * @param data The message data * @return Object or null */ public Object onMessage(String id, Object data); + abstract public Context getContext(); } From 47211f6cb31116de702e31f965944afb0d896ffb Mon Sep 17 00:00:00 2001 From: macdonst Date: Fri, 8 Jun 2012 14:38:58 -0400 Subject: [PATCH 4/4] Revert: Adding getContext, startActivity to CordovaInterface --- .../src/org/apache/cordova/api/CordovaInterface.java | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/framework/src/org/apache/cordova/api/CordovaInterface.java b/framework/src/org/apache/cordova/api/CordovaInterface.java index 0242aa79..46b692b9 100755 --- a/framework/src/org/apache/cordova/api/CordovaInterface.java +++ b/framework/src/org/apache/cordova/api/CordovaInterface.java @@ -19,7 +19,6 @@ package org.apache.cordova.api; import android.app.Activity; -import android.content.Context; import android.content.Intent; /** @@ -38,13 +37,6 @@ public interface CordovaInterface { */ abstract public void startActivityForResult(IPlugin command, Intent intent, int requestCode); - /** - * Launch an activity for which you would not like a result when it finished. - * - * @param intent The intent to start - */ - abstract public void startActivity(Intent intent); - /** * Set the plugin to be called when a sub-activity exits. * @@ -84,6 +76,4 @@ public interface CordovaInterface { * @return Object or null */ public Object onMessage(String id, Object data); - - abstract public Context getContext(); }