Figure out how to set the color of the system bar (i.e. where the notifications and the clock are)
Open, Needs TriagePublic

apol created this task.Oct 31 2015, 11:32 PM
apol updated the task description. (Show Details)
apol raised the priority of this task from to Needs Triage.
apol added a project: Android.
apol moved this task to Backlog on the Android board.
apol added a subscriber: apol.

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.

apol added a comment.Dec 27 2016, 5:46 PM

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.

Ah, I see. Will try to report it to Qt soon.

mart added a subscriber: mart.Nov 14 2018, 3:23 PM

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

mart added a comment.Nov 14 2018, 3:24 PM

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)

vatra added a subscriber: vatra.Nov 14 2018, 3:34 PM

@mart that piece of code is not that ugly ... it does its job ;-)