cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From purplecabb...@apache.org
Subject android commit: fixed CB-11078 Empty string for BackgroundColor preference crashes application This closes #316
Date Wed, 03 Aug 2016 05:42:43 GMT
Repository: cordova-android
Updated Branches:
  refs/heads/master 74ae6651c -> d54a42f0f


fixed CB-11078 Empty string for BackgroundColor preference crashes application
This closes #316


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

Branch: refs/heads/master
Commit: d54a42f0f0cfdab18c89e4a29de67c81f48f60b1
Parents: 74ae665
Author: akilawickey <asak999@gmail.com>
Authored: Wed Jul 13 03:46:57 2016 +0530
Committer: Jesse MacFadyen <purplecabbage@gmail.com>
Committed: Tue Aug 2 22:38:58 2016 -0700

----------------------------------------------------------------------
 framework/src/org/apache/cordova/CordovaActivity.java    | 11 ++++++++---
 .../src/org/apache/cordova/test/CordovaActivityTest.java |  3 +++
 test/res/xml/config.xml                                  |  1 +
 3 files changed, 12 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/d54a42f0/framework/src/org/apache/cordova/CordovaActivity.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaActivity.java b/framework/src/org/apache/cordova/CordovaActivity.java
index 868b243..577eb85 100755
--- a/framework/src/org/apache/cordova/CordovaActivity.java
+++ b/framework/src/org/apache/cordova/CordovaActivity.java
@@ -175,9 +175,14 @@ public class CordovaActivity extends Activity {
         setContentView(appView.getView());
 
         if (preferences.contains("BackgroundColor")) {
-            int backgroundColor = preferences.getInteger("BackgroundColor", Color.BLACK);
-            // Background of activity:
-            appView.getView().setBackgroundColor(backgroundColor);
+            try {
+                int backgroundColor = preferences.getInteger("BackgroundColor", Color.BLACK);
+                // Background of activity:
+                appView.getView().setBackgroundColor(backgroundColor);
+            }
+            catch (NumberFormatException e){
+                e.printStackTrace();
+            }
         }
 
         appView.getView().requestFocusFromTouch();

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/d54a42f0/test/androidTest/src/org/apache/cordova/test/CordovaActivityTest.java
----------------------------------------------------------------------
diff --git a/test/androidTest/src/org/apache/cordova/test/CordovaActivityTest.java b/test/androidTest/src/org/apache/cordova/test/CordovaActivityTest.java
index 1eebadb..1533e79 100644
--- a/test/androidTest/src/org/apache/cordova/test/CordovaActivityTest.java
+++ b/test/androidTest/src/org/apache/cordova/test/CordovaActivityTest.java
@@ -42,4 +42,7 @@ public class CordovaActivityTest extends BaseCordovaIntegrationTest {
         String onPageFinishedUrl = testActivity.onPageFinishedUrl.take();
         assertEquals(MainTestActivity.START_URL, onPageFinishedUrl);
     }
+    protected void createViews() {
+        assertTrue(testView instanceof SystemWebView);
+    }
 }

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/d54a42f0/test/res/xml/config.xml
----------------------------------------------------------------------
diff --git a/test/res/xml/config.xml b/test/res/xml/config.xml
index 7da4638..744aeb1 100644
--- a/test/res/xml/config.xml
+++ b/test/res/xml/config.xml
@@ -35,6 +35,7 @@
     <preference name="useBrowserHistory" value="true" />
     <preference name="exit-on-suspend" value="false" />
     <preference name="showTitle" value="true" />
+    <preference name="BackgroundColor" value="" />
     <feature name="Activity">
         <param name="android-package" value="org.apache.cordova.test.ActivityPlugin" />
     </feature>


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message