You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by bo...@apache.org on 2012/04/25 19:52:33 UTC

[1/5] android commit: Tweaking the DroidGap to use the new SplashScreen

Updated Branches:
  refs/heads/CordovaWebView 17c919edd -> 13ba1e490


Tweaking the DroidGap to use the new SplashScreen


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/commit/13ba1e49
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/tree/13ba1e49
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/diff/13ba1e49

Branch: refs/heads/CordovaWebView
Commit: 13ba1e49003a458760523e63451a3514c8e28701
Parents: 17c919e c846111
Author: Joe Bowser <bo...@apache.org>
Authored: Wed Apr 25 10:41:47 2012 -0700
Committer: Joe Bowser <bo...@apache.org>
Committed: Wed Apr 25 10:41:47 2012 -0700

----------------------------------------------------------------------
 framework/res/xml/plugins.xml                      |    1 +
 framework/src/org/apache/cordova/DroidGap.java     |   88 +++++++++------
 framework/src/org/apache/cordova/SplashScreen.java |   23 ++++
 3 files changed, 75 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/13ba1e49/framework/src/org/apache/cordova/DroidGap.java
----------------------------------------------------------------------
diff --cc framework/src/org/apache/cordova/DroidGap.java
index 0203dba,107eb52..b40f708
--- a/framework/src/org/apache/cordova/DroidGap.java
+++ b/framework/src/org/apache/cordova/DroidGap.java
@@@ -1125,13 -1404,47 +1096,56 @@@ public class DroidGap extends Activity 
        return this.bound;
      }
  
 +    public boolean backHistory() {
 +      return appView.backHistory();
 +    }
 +
 +    public void showWebPage(String url, boolean openExternal,
 +        boolean clearHistory, HashMap<String, Object> params) {
 +      appView.showWebPage(url, openExternal, clearHistory, params);
 +    }
 +
+     protected Dialog splashDialog;
+     
+     /**
+      * Removes the Dialog that displays the splash screen
+      */
+     public void removeSplashScreen() {
+         if (splashDialog != null) {
+             splashDialog.dismiss();
+             splashDialog = null;
+         }
+     }
+      
+     /**
+      * Shows the splash screen over the full Activity
+      */
+     protected void showSplashScreen(int time) {
+         // Get reference to display
+         Display display = getWindowManager().getDefaultDisplay();
+         
+         // Create the layout for the dialog
+         LinearLayout root = new LinearLayout(this);
+         root.setMinimumHeight(display.getHeight());
+         root.setMinimumWidth(display.getWidth());
+         root.setOrientation(LinearLayout.VERTICAL);
+         root.setBackgroundColor(this.getIntegerProperty("backgroundColor", Color.BLACK));
+         root.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, 
+                 ViewGroup.LayoutParams.FILL_PARENT, 0.0F));
+         root.setBackgroundResource(this.splashscreen);
+ 
+         // Create and show the dialog
+         splashDialog = new Dialog(this, android.R.style.Theme_Translucent_NoTitleBar);       
+         splashDialog.setContentView(root);
+         splashDialog.setCancelable(false);
+         splashDialog.show();
+      
+         // Set Runnable to remove splash screen just in case
+         final Handler handler = new Handler();
+         handler.postDelayed(new Runnable() {
+           public void run() {
+             removeSplashScreen();
+           }
+         }, time);
+     }
  }