[TIMOB-14935] Android: Application restarts on 'orientationChange' when applied holo theme on Modal windows
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2013-08-26T22:09:36.000+0000 |
Affected Version/s | Release 3.1.1 |
Fix Version/s | 2013 Sprint 19, 2013 Sprint 19 API |
Components | Android |
Labels | android, holo_theme, orientationChange, triage |
Reporter | Meenakshi Pathak |
Assignee | Ping Wang |
Created | 2013-08-22T10:55:36.000+0000 |
Updated | 2017-03-28T22:52:42.000+0000 |
Description
Application restarts/crashes when we change orientation(either
portrait
to landscape
or landscape
to portrait
) when applied holo theme to the modal windows.
Here is the test case:
1. copy the code in app.js
:
var w = Ti.UI.createWindow({
backgroundColor : '#cecece',
title : 'added by click from label1',
layout : 'vertical'
}),
msg = 'The appointment that you have selected differs from the service date and requires buyer approval. Would you still like to set this appointment?';
var button = Ti.UI.createButton({
title: 'Click to Open modal'
});
button.addEventListener('click', function() {
var wm = Ti.UI.createWindow({
modal : true,
/*transition : true,*/
navBarHidden : true,
tabBarHidden : true,
backgroundColor : 'red',
title : 'Modal window',
layout : 'vertical'
});
wm.open();
var b = Ti.UI.createButton({
title:'Click to open alert'
});
wm.add(b);
b.addEventListener('click',function(){
var d = Titanium.UI.createAlertDialog({
title : 'Pending Appointment',
message : msg,
buttonNames : ['Yes', 'No'],
cancel : 1
});
d.show();
});
});
w.add(button);
var button2 = Ti.UI.createButton({
title: 'Click to Open regular window'
});
button2.addEventListener('click', function() {
var wm = Ti.UI.createWindow({
/*modal : true,*/
transition : true,
navBarHidden : true,
tabBarHidden : true,
backgroundColor : 'blue',
title : 'NOT Modal window',
layout : 'vertical'
});
wm.open();
var b = Ti.UI.createButton({
title:'Click to open alert'
});
wm.add(b);
b.addEventListener('click',function(){
var d = Titanium.UI.createAlertDialog({
title : 'Pending Appointment',
message : msg,
buttonNames : ['Yes', 'No'],
cancel : 1
});
d.show();
});
});
w.add(button2);
w.open();
2. Modify the tiapp.xml for
<android xmlns:android="http://schemas.android.com/apk/res/android">
<tool-api-level>14</tool-api-level>
<manifest>
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="14"/>
<application>
<activity
android:name="org.appcelerator.titanium.TiModalActivity"
android:configChanges="keyboardHidden|orientation"
android:theme="@android:style/Theme.Holo" />
</application>
</manifest>
</android>
3. Tested with placing themes.xml
under platform/android/res/values
and found the same issue.
themes.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="LightTheme" parent="@android:style/Theme.Holo">
</style>
</resources>
Note : In app.js
, two different windows showing two different behaviors in 'orientationChange'. Normal window works fine with holo theme.
if you add orientationModes to the creation of the windows, then normal windows also crash.
Duplicate of TIMOB-10863. Please remove
from tiapp.xml and then the app will work fine. Because for API 13+, by default, Titanium will set
in the tiapp.xml to avoid restarting the app when orientation changes. But in the above test case, this setting is overwritten and that's why the app restarts. Resolve the ticket as Invalid.
Closing ticket as invalid.