Skip to content

Commit e104a76

Browse files
committed
feat(android): expose uiFlags
1 parent 48871ce commit e104a76

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

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

Lines changed: 16 additions & 1 deletion
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+
"uiFlags"
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("uiFlags")) {
333+
win.getDecorView().setSystemUiVisibility(TiConvert.toInt(getProperty("uiFlags")));
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,16 @@ public void onPropertyChanged(String name, Object value)
462467
}
463468
}
464469

470+
Log.i("---", " test: " + name);
471+
472+
if (name.equals("uiFlags")) {
473+
if (windowActivity != null && windowActivity.get() != null) {
474+
AppCompatActivity activity = windowActivity.get();
475+
Log.i("---", " test: " + value);
476+
activity.getWindow().getDecorView().setSystemUiVisibility(TiConvert.toInt(value));
477+
}
478+
}
479+
465480
if (name.equals(TiC.PROPERTY_TITLE_ATTRIBUTES)) {
466481
if (windowActivity != null && windowActivity.get() != null) {
467482
// Get a reference to the ActionBar.

apidoc/Titanium/UI/Window.yml

Lines changed: 10 additions & 0 deletions
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
1544+
list of additional flags that you can assign to this property. You can use e.g. 8192 (SYSTEM_UI_FLAG_LIGHT_STATUS_BAR) to set
1545+
the statusbar 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)