Skip to content

Commit cbb0998

Browse files
m1gahansemannn
andcommitted
feat(android): expose uiFlags (#14166)
* feat(android): expose uiFlags * Update apidoc/Titanium/UI/Window.yml Co-authored-by: Hans Knöchel <[email protected]> * use properties --------- Co-authored-by: Hans Knöchel <[email protected]>
1 parent 14d054a commit cbb0998

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

android/modules/ui/src/java/ti/modules/titanium/ui/WindowProxy.java

+13-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@
7070
TiC.PROPERTY_WINDOW_PIXEL_FORMAT,
7171
TiC.PROPERTY_FLAG_SECURE,
7272
TiC.PROPERTY_BAR_COLOR,
73-
TiC.PROPERTY_STATUS_BAR_COLOR
73+
TiC.PROPERTY_STATUS_BAR_COLOR,
74+
TiC.PROPERTY_UI_FLAGS
7475
})
7576

7677
public class WindowProxy extends TiWindowProxy implements TiActivityWindow
@@ -328,6 +329,10 @@ public void windowCreated(TiBaseActivity activity, Bundle savedInstanceState)
328329
win.setStatusBarColor(colorInt);
329330
}
330331

332+
if (hasProperty(TiC.PROPERTY_UI_FLAGS)) {
333+
win.getDecorView().setSystemUiVisibility(TiConvert.toInt(getProperty(TiC.PROPERTY_UI_FLAGS)));
334+
}
335+
331336
// Handle titleAttributes property.
332337
if (hasProperty(TiC.PROPERTY_TITLE_ATTRIBUTES)) {
333338
KrollDict innerAttributes = getProperties().getKrollDict(TiC.PROPERTY_TITLE_ATTRIBUTES);
@@ -462,6 +467,13 @@ public void onPropertyChanged(String name, Object value)
462467
}
463468
}
464469

470+
if (name.equals(TiC.PROPERTY_UI_FLAGS)) {
471+
if (windowActivity != null && windowActivity.get() != null) {
472+
AppCompatActivity activity = windowActivity.get();
473+
activity.getWindow().getDecorView().setSystemUiVisibility(TiConvert.toInt(value));
474+
}
475+
}
476+
465477
if (name.equals(TiC.PROPERTY_TITLE_ATTRIBUTES)) {
466478
if (windowActivity != null && windowActivity.get() != null) {
467479
// Get a reference to the ActionBar.

android/titanium/src/java/org/appcelerator/titanium/TiC.java

+1
Original file line numberDiff line numberDiff line change
@@ -862,6 +862,7 @@ public class TiC
862862
public static final String PROPERTY_JOBTITLE = "jobTitle";
863863
public static final String PROPERTY_DEPARTMENT = "department";
864864
public static final String PROPERTY_FIXED_SIZE = "fixedSize";
865+
public static final String PROPERTY_UI_FLAGS = "uiFlags";
865866

866867
public static final String SIZE_AUTO = "auto";
867868
public static final String URL_APP_PREFIX = "app://";

apidoc/Titanium/UI/Window.yml

+10
Original file line numberDiff line numberDiff line change
@@ -1537,6 +1537,16 @@ properties:
15371537
since: "3.3.0"
15381538
availability: creation
15391539

1540+
- name: uiFlags
1541+
summary: Additional UI flags to set on the Activity Window.
1542+
description: |
1543+
See [WindowManager.LayoutParams](https://developer.android.com/reference/android/view/View#setSystemUiVisibility\(int\)) for a
1544+
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
1545+
the status bar text color to a dark color.
1546+
platforms: [android]
1547+
type: Number
1548+
since: "12.7.0"
1549+
15401550
- name: windowSoftInputMode
15411551
summary: |
15421552
Determines whether a window's soft input area (ie software keyboard) is visible

0 commit comments

Comments
 (0)