[TIMOB-26459] Android: Add support for translucent status bar and navigation bar
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2018-10-25T14:05:44.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 7.5.0 |
Components | Android |
Labels | android, navigationbar, statusbar, translucent, window |
Reporter | Joshua Quick |
Assignee | Joshua Quick |
Created | 2018-10-18T00:52:15.000+0000 |
Updated | 2018-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
File | Date | Size |
---|---|---|
AndroidTranslucentBars.png | 2018-10-18T01:03:57.000+0000 | 22519 |
PR (master): https://github.com/appcelerator/titanium_mobile/pull/10383
*FR Passed* Waiting on Jenkins to merge
Verified the fix on SDK 7.5.0.v20181025085349.Works as expected.