The following Java code snippet does it.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.setStatusBarColor(Color.BLUE);
}
Wondering where and how to add this code. Should this be exposed as a platform specific API? Would appreciate any help in implementing this.
Looks like it should be implemented on the Qt side first, then expose it to the application's QML somehow:
https://github.com/qt/qtbase/tree/dev/src/android/jar/src/org/qtproject/qt5/android
I'd suggest reporting it to Qt http://bugreports.qt.io then discuss with them what's the best approach API-wise.
in kirigami gallery i'm using this ugly jni code in main.cpp:
#ifdef Q_OS_ANDROID
QtAndroid::runOnAndroidThread([=]() { QAndroidJniObject window = QtAndroid::androidActivity().callObjectMethod("getWindow", "()Landroid/view/Window;"); window.callMethod<void>("addFlags", "(I)V", FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.callMethod<void>("clearFlags", "(I)V", FLAG_TRANSLUCENT_STATUS); window.callMethod<void>("setStatusBarColor", "(I)V", QColor("#2196f3").rgba()); window.callMethod<void>("setNavigationBarColor", "(I)V", QColor("#2196f3").rgba()); });
#endif
perhaps, could be moved somewhere in Kirigami.Theme
and we will also eventually need api for having the system bars going over our window as well i guess (like in a photo viewer often you see the photo under the top panel)