[TIMOB-11341] Android: App build with targetSdkVersion > 11 should use newer themes
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2013-10-19T01:20:57.000+0000 |
Affected Version/s | Release 3.0.0 |
Fix Version/s | 2013 Sprint 21, 2013 Sprint 21 Core, Release 3.2.0 |
Components | Android, Tooling |
Labels | androidbuild, cb-verified, core, insight, qe-closed-3.2.0, triage |
Reporter | Arthur Evans |
Assignee | Chris Barber |
Created | 2012-10-10T01:49:20.000+0000 |
Updated | 2013-12-23T20:34:15.000+0000 |
Description
Setting tool-api-version and targetSdkVersion to something about 11 should let us use the device's built-in themes, but apps still show up in the old themes unless we override the themes explicitly. I added the following to the
tiapp.xml
file:
<android xmlns:android="http://schemas.android.com/apk/res/android">
<tool-api-level>15</tool-api-level>
<manifest>
<uses-sdk targetSdkVersion="15" />
</manifest>
</android>
However, the app still looks old-style on a Nexus 7. For example, menu items are displayed in the options menu, not the action bar, even if showAsAction is set. And for that matter--no action bar.
Testing with the sample code for Action Items from TIMOB-9910.
I think the attribute for the 'uses-sdk' should be 'android:targetSdkVersion' instead of just 'targetSdkVersion'. I tried switching it to that and it works fine for me. Please reopen if there are any other issues.
That works for ordinary windows (since they use the Titanium theme, which should default to the device's default theme). However, windows created with modal: true or any opacity value are hard-coded to the Android Translucent theme, which _doesn't_, include an action bar. To override these, the user has to add entries to tiapp.xml for each of these (and probably create a custom theme that defaults to Translucent in earlier releases, and Holo (or the device default) in later releases. As near as I can tell, we don't actually need the separate translucent theme in newer versions of Android (although I may be mistaken here).
PR: https://github.com/appcelerator/titanium_mobile/pull/4781
Verified fixed on: Mac OSX 10.9 Mavericks Titanium Studio, build: 3.2.0.201312142258 Titanium SDK, build: 3.2.0.v20131216064236 CLI: 3.2.0-cr3 Alloy: 1.3.0-cr Added the code snippet from the description. Ran on device using API set to 15 and set to 10. API15 displayed new theme, API 10 displayed older theme. Closing.
i compiled my app with 3.2 SDK. when opening a date-picker in a modal window i get the very old UI of the date-picker. only when i use date-picker in a normal window i get it in Holo.Light theme
am i missing anything?
This is a theme issue. We need to add some custom themes to the app template. For now, here is the workaround: 1. Create the file /platform/android/res/values/theme.xml:
2. Create the file /platform/android/res/values-v11/theme.xml:
3. In tiapp.xml, add