Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-26459] Android: Add support for translucent status bar and navigation bar

GitHub Issuen/a
TypeNew Feature
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2018-10-25T14:05:44.000+0000
Affected Version/sn/a
Fix Version/sRelease 7.5.0
ComponentsAndroid
Labelsandroid, navigationbar, statusbar, translucent, window
ReporterJoshua Quick
AssigneeJoshua Quick
Created2018-10-18T00:52:15.000+0000
Updated2018-10-25T18:40:15.000+0000

Description

*Summary:* Add support for a translucent top status bar and translucent bottom navigation bar by adding the following constants that can be used by the Ti.UI.Window "windowFlags" property. * Ti.UI.Android.FLAG_TRANSLUCENT_NAVIGATION * Ti.UI.Android.FLAG_TRANSLUCENT_STATUS The above correspond to the following Android 4.4 Java constants... https://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#FLAG_TRANSLUCENT_NAVIGATION https://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#FLAG_TRANSLUCENT_STATUS *Example Usage:*
var window = Ti.UI.createWindow({
	extendSafeArea: true,
	theme: "Theme.AppCompat.NoTitleBar",
	windowFlags: Ti.UI.Android.FLAG_TRANSLUCENT_STATUS | Ti.UI.Android.FLAG_TRANSLUCENT_NAVIGATION,
	backgroundColor: "white",
	borderWidth: "8dp",
	borderColor: "green",
});
window.open();
!AndroidTranslucentBars.png|thumbnail! *Note 1:* Internally, Titanium needs to support/apply these flags to allow *Android P* notches to overlap a fullscreen window. Otherwise the app window will be letterboxed between the notches. So, we might as well as expose the window flags constants for convenience... and they can be used on older Android OS versions (4.4 and higher). *Note 2:* Android 4.4 only supports a translucent navigation bar when the app is shown in portrait form. It is opaque when landscape. This is a limitation on Google's end. Android 5.0 and newer OS versions support a translucent nav bar for all orientations.

Attachments

FileDateSize
AndroidTranslucentBars.png2018-10-18T01:03:57.000+000022519

Comments

  1. Joshua Quick 2018-10-18

    PR (master): https://github.com/appcelerator/titanium_mobile/pull/10383
  2. Josh Longton 2018-10-25

    *FR Passed* Waiting on Jenkins to merge
  3. Keerthi Mahalingam 2018-10-25

    Verified the fix on SDK 7.5.0.v20181025085349.Works as expected.
       Operating System
         Name                        = Mac OS X
         Version                     = 10.13.6
         Architecture                = 64bit
       Node.js
         Node.js Version             = 8.12.0
         npm Version                 = 6.4.1
       Titanium CLI
         CLI Version                 = 5.1.1
       Studio			      =5.1.2.201810080801
       Titanium SDK
         SDK Version                 = 7.5.0.v20181025085349
       Device                        = Samsung s5 Android 6,pixel android 9 
       Emulator		        = Samsung galaxy s6 android 6,nexus 4.4
       

JSON Source