Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-19081] Android: Add Theme.AppCompat.NoTitleBar to default themes

GitHub Issuen/a
TypeNew Feature
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2015-07-10T07:45:47.000+0000
Affected Version/sRelease 4.0.0
Fix Version/sRelease 5.0.0
ComponentsAndroid
Labelsthemes
ReporterFokke Zandbergen
AssigneeAshraf Abu
Created2015-06-26T12:51:34.000+0000
Updated2015-10-06T14:48:50.000+0000

Description

Every android app we build includes a few [built-in themes](https://github.com/appcelerator/titanium_mobile/blob/master/android/templates/build/theme.xml): * Theme.AppCompat.Fullscreen * Theme.AppCompat.Translucent * Theme.AppCompat.Translucent.NoTitleBar * Theme.AppCompat.Translucent.NoTitleBar.Fullscreen * Theme.Titanium, which extends either Theme.AppCompat directly or Theme.AppCompat.Fullscreen depending on the <fullscreen> setting in tiapp.xml. Strangely enough, it does not include a theme that would cover one of the most common use cases: hiding the Action Bar. Our [guide](http://docs.appcelerator.com/platform/latest/#!/guide/Android_Action_Bar-section-36735509_AndroidActionBar-HidingtheActionBar) explains how to do this using a custom theme, while it could be much simpeler if only we would include one by default. via *tiapp.xml*
 <android xmlns:android="http://schemas.android.com/apk/res/android">
    <manifest>
        <application android:theme="@style/Theme.AppCompat.NoTitleBar"/>
    </manifest>
</android>
or per window:
Ti.UI.createWindow({
  theme: "Theme.AppCompat.NoTitleBar"
}).open();
Ideally, the new themes would follow the same naming convention as the Translucent ones:
	<style name="Theme.AppCompat.NoTitleBar">
		<item name="android:windowNoTitle">true</item>
		<item name="android:windowContentOverlay">@null</item>
		<item name="android:windowActionBar">false</item>
		<!-- AppCompat Compatibility -->
		<item name="windowActionBar">false</item>
	</style>
	
	<style name="Theme.AppCompat.NoTitleBar.Fullscreen">
		<item name="android:windowFullscreen">true</item>
	</style>

	<!-- Legacy Compatibility -->
	<style name="Theme.AppCompat.Fullscreen" parent="@style/Theme.AppCompat.NoTitleBar.Fullscreen" />
As you can see the existing Theme.AppCompat.Fullscreen theme can inherit the new Theme.AppCompat.NoTitleBar so that it is still available under the existing name. With these new themes in place we could also restore the <navbar-hidden> and <fullscreen> elements in tiapp.xml. This would select the Theme.AppCompat.NoTitleBar for <application> or Theme.AppCompat.NoTitleBar.FullScreen theme if <fullscreen> is also true. The attached test app shows how these new themes would work, by adding them via a custom theme.

Attachments

FileDateSize
app.zip2015-06-26T12:50:42.000+00004452

Comments

  1. Fokke Zandbergen 2015-06-26

    PR on master, including restoring <navbar-hidden>: -github.com/appcelerator/titanium_mobile/pull/6934- https://github.com/appcelerator/titanium_mobile/pull/6966
  2. Lokesh Choudhary 2015-08-21

    Verified the addition of Theme.AppCompat.NoTitleBar & Theme.AppCompat.NoTitleBar.FullScreen. Tested with the attached app & via tiapp.xml. Closing. Environment: Appc Studio : 4.2.0.201508062204 Ti SDK : 5.0.0.v20150821030422 Ti CLI : 4.1.5 Alloy : 1.7.5 MAC Yosemite : 10.10.4 Appc NPM : 4.2.0-1 Appc CLI : 5.0.0-12 Node: v0.10.37 Nexus 5 - Android 5.1.1 Node : v0.10.37 Nexus 5 - Android 5.1.1
  3. Fokke Zandbergen 2015-10-06

    [~ralcocer] I'm in doubt if we (I) implemented this correctly. Reading the docs on [fullscreen](http://docs.appcelerator.com/platform/latest/#!/guide/tiapp.xml_and_timodule.xml_Reference-section-29004921_tiapp.xmlandtimodule.xmlReference-fullscreen) should I maybe have left this behaviour unchanged and only restored the [deprecated statusbar-hidden](http://docs.appcelerator.com/platform/latest/#!/guide/tiapp.xml_and_timodule.xml_Reference-section-29004921_tiapp.xmlandtimodule.xmlReference-DeprecatedElements)? Right now fullscreen and statusbar-hidden trigger the same theme and {fullscreen}} has effect on all of the app, not just the launch screen. https://github.com/appcelerator/titanium_mobile/pull/6966/files#diff-0be338fcf98858bee617db31d0efedd3R17

JSON Source