incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bows...@apache.org
Subject android commit: A quick stab at CB-510
Date Thu, 10 May 2012 23:44:02 GMT
Updated Branches:
  refs/heads/CordovaWebView a705b7274 -> f3e70c79e


A quick stab at CB-510


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/f3e70c79
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/tree/f3e70c79
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/diff/f3e70c79

Branch: refs/heads/CordovaWebView
Commit: f3e70c79eb64d44e09d59fbb7fc708e80f3e3199
Parents: a705b72
Author: Joe Bowser <bowserj@apache.org>
Authored: Thu May 10 16:42:37 2012 -0700
Committer: Joe Bowser <bowserj@apache.org>
Committed: Thu May 10 16:42:37 2012 -0700

----------------------------------------------------------------------
 framework/src/org/apache/cordova/DroidGap.java |   85 +++++++++++--------
 1 files changed, 48 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/f3e70c79/framework/src/org/apache/cordova/DroidGap.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/DroidGap.java b/framework/src/org/apache/cordova/DroidGap.java
index 33499b4..1c832c4 100755
--- a/framework/src/org/apache/cordova/DroidGap.java
+++ b/framework/src/org/apache/cordova/DroidGap.java
@@ -336,6 +336,41 @@ public class DroidGap extends Activity implements CordovaInterface {
         }
     }
     
+    /*
+     * Load the spinner
+     * 
+     */
+    void loadSpinner()
+    {
+      // If loadingDialog property, then show the App loading dialog for first page of app
+      // (This doesn't seem to actually do anything here)
+      String loading = null;
+      if (this.urls.size() == 1) {
+          loading = this.getStringProperty("loadingDialog", null);
+      }
+      else {
+          loading = this.getStringProperty("loadingPageDialog", null);                  
+      }
+      if (loading != null) {
+
+          String title = "";
+          String message = "Loading Application...";
+
+          if (loading.length() > 0) {
+              int comma = loading.indexOf(',');
+              if (comma > 0) {
+                  title = loading.substring(0, comma);
+                  message = loading.substring(comma+1);
+              }
+              else {
+                  title = "";
+                  message = loading;
+              }
+          }
+          this.spinnerStart(title, message);
+      }
+    }
+    
     /**
      * Load the url into the webview.
      * 
@@ -352,6 +387,15 @@ public class DroidGap extends Activity implements CordovaInterface {
         
         // Load URL on UI thread
         final DroidGap me = this;
+        
+        final Runnable loadError = new Runnable() {
+          public void run() {
+            me.appView.stopLoading();
+            LOG.e(TAG, "DroidGap: TIMEOUT ERROR! - calling webViewClient");
+            appView.viewClient.onReceivedError(me.appView, -6, "The connection to the server
was unsuccessful.", url);
+          }
+        };
+        
         this.runOnUiThread(new Runnable() {
             public void run() {
 
@@ -362,34 +406,9 @@ public class DroidGap extends Activity implements CordovaInterface {
 
                 // Handle activity parameters (TODO: Somehow abstract this)
                 me.handleActivityParameters();
-
-                // If loadingDialog property, then show the App loading dialog for first
page of app
-                // (This doesn't seem to actually do anything here)
-                String loading = null;
-                if (me.urls.size() == 1) {
-                    loading = me.getStringProperty("loadingDialog", null);
-                }
-                else {
-                    loading = me.getStringProperty("loadingPageDialog", null);          
       
-                }
-                if (loading != null) {
-
-                    String title = "";
-                    String message = "Loading Application...";
-
-                    if (loading.length() > 0) {
-                        int comma = loading.indexOf(',');
-                        if (comma > 0) {
-                            title = loading.substring(0, comma);
-                            message = loading.substring(comma+1);
-                        }
-                        else {
-                            title = "";
-                            message = loading;
-                        }
-                    }
-                    me.spinnerStart(title, message);
-                }
+                
+                // Then load the spinner
+                me.loadSpinner();
 
                 // Create a timeout timer for loadUrl
                 final int currentLoadUrlTimeout = me.loadUrlTimeout;
@@ -405,15 +424,7 @@ public class DroidGap extends Activity implements CordovaInterface {
 
                         // If timeout, then stop loading and handle error
                         if (me.loadUrlTimeout == currentLoadUrlTimeout) {
-                           
-                           //TURTLES, TURTLES ALL THE WAY DOWN!!!!!
-                           me.runOnUiThread(new Runnable() {
-                             public void run() {
-                               me.appView.stopLoading();
-                               LOG.e(TAG, "DroidGap: TIMEOUT ERROR! - calling webViewClient");
-                               appView.viewClient.onReceivedError(me.appView, -6, "The connection
to the server was unsuccessful.", url);
-                             };
-                           });
+                           me.runOnUiThread(loadError);
                            
                         }
                     }


Mime
View raw message