summaryrefslogtreecommitdiffstats
path: root/src/qmlandroid/view/qqmlandroidwindow.cpp
blob: 2fee3f2de27e899fd3f44d49eb99d3dd3bd60ce8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include "qqmlandroidwindow_p.h"
#include "qqmlandroidcontext_p.h"
#include "qtqmlandroidfunctions_p.h"

QT_BEGIN_NAMESPACE

QQmlAndroidWindow::QQmlAndroidWindow(QQmlAndroidContext *context) :
    QQmlAndroidContextual(context)
{
    setContext(context);
}

int QQmlAndroidWindow::statusBarColor() const
{
    if (m_statusBarColor.isNull())
        return 0; // TODO
    return m_statusBarColor;
}

void QQmlAndroidWindow::setStatusBarColor(int color)
{
    if (m_statusBarColor.isNull() || m_statusBarColor != color) {
        m_statusBarColor = color;
        QtQmlAndroid::callIntMethod(instance(), "setStatusBarColor", color);
        emit statusBarColorChanged();
    }
}

void QQmlAndroidWindow::onInflate(QAndroidJniObject &instance)
{
    if (!m_statusBarColor.isNull()) {
        // TODO: WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
        instance.callMethod<void>("addFlags", "(I)V", 0x80000000);
        // TODO: WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
        instance.callMethod<void>("clearFlags", "(I)V", 0x04000000);
        instance.callMethod<void>("setStatusBarColor", "(I)V", m_statusBarColor);
    }
}

QT_END_NAMESPACE