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 73dbe8f5f67..43d68e76c01 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 @@ -69,8 +69,10 @@ TiC.PROPERTY_MODAL, TiC.PROPERTY_WINDOW_PIXEL_FORMAT, TiC.PROPERTY_FLAG_SECURE, - TiC.PROPERTY_BAR_COLOR + TiC.PROPERTY_BAR_COLOR, + TiC.PROPERTY_STATUS_BAR_COLOR }) + public class WindowProxy extends TiWindowProxy implements TiActivityWindow { private static final String TAG = "WindowProxy"; @@ -320,6 +322,12 @@ public void windowCreated(TiBaseActivity activity, Bundle savedInstanceState) } } + if (hasProperty(TiC.PROPERTY_STATUS_BAR_COLOR)) { + int colorInt = TiColorHelper.parseColor( + TiConvert.toString(getProperty(TiC.PROPERTY_STATUS_BAR_COLOR)), activity); + win.setStatusBarColor(colorInt); + } + // Handle titleAttributes property. if (hasProperty(TiC.PROPERTY_TITLE_ATTRIBUTES)) { KrollDict innerAttributes = getProperties().getKrollDict(TiC.PROPERTY_TITLE_ATTRIBUTES); @@ -446,6 +454,14 @@ public void onPropertyChanged(String name, Object value) } } + if (name.equals(TiC.PROPERTY_STATUS_BAR_COLOR)) { + if (windowActivity != null && windowActivity.get() != null) { + AppCompatActivity activity = windowActivity.get(); + int colorInt = TiColorHelper.parseColor(TiConvert.toString(value), activity); + activity.getWindow().setStatusBarColor(colorInt); + } + } + 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 c7da4f79aa8..040d9a003fd 100644 --- a/android/titanium/src/java/org/appcelerator/titanium/TiC.java +++ b/android/titanium/src/java/org/appcelerator/titanium/TiC.java @@ -305,6 +305,7 @@ public class TiC public static final String PROPERTY_TOUCH_FEEDBACK_COLOR = "touchFeedbackColor"; public static final String PROPERTY_TRANSITION_NAME = "transitionName"; public static final String PROPERTY_BAR_COLOR = "barColor"; + public static final String PROPERTY_STATUS_BAR_COLOR = "statusBarColor"; public static final String PROPERTY_BASE_URL = "baseUrl"; public static final String PROPERTY_BASE_URL_WEBVIEW = "baseURL"; public static final String PROPERTY_BIG_TEXT = "bigText"; diff --git a/apidoc/Titanium/UI/Window.yml b/apidoc/Titanium/UI/Window.yml index bbc3aef2a6f..9ebae2d4a9a 100644 --- a/apidoc/Titanium/UI/Window.yml +++ b/apidoc/Titanium/UI/Window.yml @@ -1353,6 +1353,12 @@ properties: platforms: [iphone, ipad, macos] since: {iphone: "3.1.3", ipad: "3.1.3", macos: "9.2.0"} + - name: statusBarColor + summary: The color of the status bar (top bar) for this window. + type: [Number] + platforms: [android] + since: {android: "12.5.0"} + - name: sustainedPerformanceMode summary: Maintain a sustainable level of performance. description: |