diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/WindowProxy.java b/android/modules/ui/src/java/ti/modules/titanium/ui/WindowProxy.java index 43d68e76c01..1782c67e97d 100644 --- a/android/modules/ui/src/java/ti/modules/titanium/ui/WindowProxy.java +++ b/android/modules/ui/src/java/ti/modules/titanium/ui/WindowProxy.java @@ -70,7 +70,8 @@ TiC.PROPERTY_WINDOW_PIXEL_FORMAT, TiC.PROPERTY_FLAG_SECURE, TiC.PROPERTY_BAR_COLOR, - TiC.PROPERTY_STATUS_BAR_COLOR + TiC.PROPERTY_STATUS_BAR_COLOR, + TiC.PROPERTY_UI_FLAGS }) public class WindowProxy extends TiWindowProxy implements TiActivityWindow @@ -328,6 +329,10 @@ public void windowCreated(TiBaseActivity activity, Bundle savedInstanceState) win.setStatusBarColor(colorInt); } + if (hasProperty(TiC.PROPERTY_UI_FLAGS)) { + win.getDecorView().setSystemUiVisibility(TiConvert.toInt(getProperty(TiC.PROPERTY_UI_FLAGS))); + } + // Handle titleAttributes property. if (hasProperty(TiC.PROPERTY_TITLE_ATTRIBUTES)) { KrollDict innerAttributes = getProperties().getKrollDict(TiC.PROPERTY_TITLE_ATTRIBUTES); @@ -462,6 +467,13 @@ public void onPropertyChanged(String name, Object value) } } + if (name.equals(TiC.PROPERTY_UI_FLAGS)) { + if (windowActivity != null && windowActivity.get() != null) { + AppCompatActivity activity = windowActivity.get(); + activity.getWindow().getDecorView().setSystemUiVisibility(TiConvert.toInt(value)); + } + } + if (name.equals(TiC.PROPERTY_TITLE_ATTRIBUTES)) { if (windowActivity != null && windowActivity.get() != null) { // Get a reference to the ActionBar. diff --git a/android/titanium/src/java/org/appcelerator/titanium/TiC.java b/android/titanium/src/java/org/appcelerator/titanium/TiC.java index 040d9a003fd..767b79e64fc 100644 --- a/android/titanium/src/java/org/appcelerator/titanium/TiC.java +++ b/android/titanium/src/java/org/appcelerator/titanium/TiC.java @@ -862,6 +862,7 @@ public class TiC public static final String PROPERTY_JOBTITLE = "jobTitle"; public static final String PROPERTY_DEPARTMENT = "department"; public static final String PROPERTY_FIXED_SIZE = "fixedSize"; + public static final String PROPERTY_UI_FLAGS = "uiFlags"; public static final String SIZE_AUTO = "auto"; public static final String URL_APP_PREFIX = "app://"; diff --git a/apidoc/Titanium/UI/Window.yml b/apidoc/Titanium/UI/Window.yml index 9ebae2d4a9a..b17a8f5a30b 100644 --- a/apidoc/Titanium/UI/Window.yml +++ b/apidoc/Titanium/UI/Window.yml @@ -1537,6 +1537,16 @@ properties: since: "3.3.0" availability: creation + - name: uiFlags + summary: Additional UI flags to set on the Activity Window. + description: | + See [WindowManager.LayoutParams](https://developer.android.com/reference/android/view/View#setSystemUiVisibility\(int\)) for a + list of additional flags that can be assigned to this property. For example, you can use `8192` (SYSTEM_UI_FLAG_LIGHT_STATUS_BAR) to set + the status bar text color to a dark color. + platforms: [android] + type: Number + since: "12.7.0" + - name: windowSoftInputMode summary: | Determines whether a window's soft input area (ie software keyboard) is visible