Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat(android): expose uiFlags #14166

Merged
merged 4 commits into from
Jan 5, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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,
"uiFlags"
m1ga marked this conversation as resolved.
Show resolved Hide resolved
})

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

if (hasProperty("uiFlags")) {
m1ga marked this conversation as resolved.
Show resolved Hide resolved
win.getDecorView().setSystemUiVisibility(TiConvert.toInt(getProperty("uiFlags")));
}

// Handle titleAttributes property.
if (hasProperty(TiC.PROPERTY_TITLE_ATTRIBUTES)) {
KrollDict innerAttributes = getProperties().getKrollDict(TiC.PROPERTY_TITLE_ATTRIBUTES);
Expand Down Expand Up @@ -462,6 +467,13 @@ public void onPropertyChanged(String name, Object value)
}
}

if (name.equals("uiFlags")) {
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.
Expand Down
10 changes: 10 additions & 0 deletions apidoc/Titanium/UI/Window.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
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
the statusbar text color to a dark color.
m1ga marked this conversation as resolved.
Show resolved Hide resolved
platforms: [android]
type: Number
since: "12.7.0"

- name: windowSoftInputMode
summary: |
Determines whether a window's soft input area (ie software keyboard) is visible
Expand Down
Loading