mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-22 08:53:24 +08:00
fixed CB-11078 Empty string for BackgroundColor preference crashes application
This closes #316
This commit is contained in:
parent
74ae6651c8
commit
d54a42f0f0
@ -175,9 +175,14 @@ public class CordovaActivity extends Activity {
|
|||||||
setContentView(appView.getView());
|
setContentView(appView.getView());
|
||||||
|
|
||||||
if (preferences.contains("BackgroundColor")) {
|
if (preferences.contains("BackgroundColor")) {
|
||||||
int backgroundColor = preferences.getInteger("BackgroundColor", Color.BLACK);
|
try {
|
||||||
// Background of activity:
|
int backgroundColor = preferences.getInteger("BackgroundColor", Color.BLACK);
|
||||||
appView.getView().setBackgroundColor(backgroundColor);
|
// Background of activity:
|
||||||
|
appView.getView().setBackgroundColor(backgroundColor);
|
||||||
|
}
|
||||||
|
catch (NumberFormatException e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
appView.getView().requestFocusFromTouch();
|
appView.getView().requestFocusFromTouch();
|
||||||
|
@ -42,4 +42,7 @@ public class CordovaActivityTest extends BaseCordovaIntegrationTest {
|
|||||||
String onPageFinishedUrl = testActivity.onPageFinishedUrl.take();
|
String onPageFinishedUrl = testActivity.onPageFinishedUrl.take();
|
||||||
assertEquals(MainTestActivity.START_URL, onPageFinishedUrl);
|
assertEquals(MainTestActivity.START_URL, onPageFinishedUrl);
|
||||||
}
|
}
|
||||||
|
protected void createViews() {
|
||||||
|
assertTrue(testView instanceof SystemWebView);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
<preference name="useBrowserHistory" value="true" />
|
<preference name="useBrowserHistory" value="true" />
|
||||||
<preference name="exit-on-suspend" value="false" />
|
<preference name="exit-on-suspend" value="false" />
|
||||||
<preference name="showTitle" value="true" />
|
<preference name="showTitle" value="true" />
|
||||||
|
<preference name="BackgroundColor" value="" />
|
||||||
<feature name="Activity">
|
<feature name="Activity">
|
||||||
<param name="android-package" value="org.apache.cordova.test.ActivityPlugin" />
|
<param name="android-package" value="org.apache.cordova.test.ActivityPlugin" />
|
||||||
</feature>
|
</feature>
|
||||||
|
Loading…
Reference in New Issue
Block a user