Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-28087

Android: Add "NoTitleBar" and "Fullscreen" themes which derive from custom app theme

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Low
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: Release 9.3.0
    • Component/s: Android
    • Labels:
    • Story Points:
      5
    • Sprint:
      2020 Sprint 19

      Description

      Summary:
      The only means of opening a window without top title bar is via its "theme" creation property set to 1 of the below. The problem with this is that the below themes inherit from Google's dark AppCompat theme and do not use the theme assi

      • "Theme.AppCompat.NoTitleBar"
      • "Theme.AppCompat.NoTitleBar.Fullscreen"
      • "Theme.AppCompat.Fullscreen"

      The problem with the above is that the above themes inherit from Google's dark "Theme.AppCompat" theme. If you've assigned a custom theme to the <application/> element in the "AndroidManifest.xml", the window won't use it because you told it to use Google AppCompat derived theme instead.

      Reason this is Needed:
      Other than making it easier to remove the title bar, we also want to support Google's Material themed widgets in the near future. These widgets will throw an exception if the activity or app is not using a "Theme.MaterialComponents" derived theme and if most developers are using the "Theme.AppCompat" theme instead (like what our guides suggest), then the app will crash. We'll want to have developers transition off of these older Google themes.

      Recommended Solution:
      Create the following new themes...

      • "Theme.Titanium.NoTitleBar"
      • "Theme.Titanium.Fullscreen"
      • "Theme.Titanium.Translucent.NoTitleBar"
      • "Theme.Titanium.Translucent.Fullscreen"

      (We already have "Theme.Titanium.Translucent" defined which derives from app's theme.)

      Titanium's build system will derive the above themes from the one assigned to the <application/> in the "AndroidManifest.xml" as shown below. If a theme is not assigned, then they will derive from Titanium's default theme.

      <?xml version="1.0" encoding="UTF-8"?>
      <ti:app>
      	<android xmlns:android="http://schemas.android.com/apk/res/android">
      		<manifest>
      			<application android:theme="@style/MyTheme"/>
      		</manifest>
      	</android>
      </ti:app>
      

      Note:
      You can easily work-around this by setting up your own custom NoTitleBar theme like the below. This is easy to do, but doing the above makes removing title bars easier.

      <?xml version="1.0" encoding="UTF-8"?>
      <resources>
      	<!-- Your custom theme. -->
      	<style name="MyTheme" parent="@style/Theme.AppCompat.Light">
      		<item name="colorPrimary">#c91326</item>
      		<item name="colorAccent">#000000</item>
      		<item name="android:textColor">#FF0000</item>
      		<item name="android:textColorPrimary">#000000</item>
      		<item name="android:statusBarColor">#c91326</item>
      		<item name="android:navigationBarColor">#c91326</item>
      	</style>
       
      	<!-- Your custom theme without a title bar. -->
      	<style name="MyTheme.NoTitleBar" parent="@style/MyTheme">
      		<item name="android:windowActionBar">false</item>
      		<item name="android:windowContentOverlay">@null</item>
      		<item name="android:windowNoTitle">true</item>
      		<item name="windowActionBar">false</item>
      		<item name="windowNoTitle">true</item>
      	</style>
       
      	<!-- Your custom theme without a title bar and status bar. -->
      	<style name="MyTheme.Fullscreen" parent="@style/MyTheme.NoTitleBar">
      		<item name="android:windowFullscreen">true</item>
      	</style>
      </resources>
      

        Attachments

          Activity

            People

            • Assignee:
              jquick Joshua Quick
              Reporter:
              jquick Joshua Quick
              Reviewer:
              Gary Mathews
              Tester:
              Samir Mohammed
            • Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                  Git Integration