-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathremoteview.cpp
More file actions
26 lines (22 loc) · 842 Bytes
/
remoteview.cpp
File metadata and controls
26 lines (22 loc) · 842 Bytes
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
#include "remoteview.h"
#include <QGuiApplication>
#include <QScreen>
RemoteView::RemoteView(QQuickItem *parent):QQuickItem (parent),
m_JavaRemoteView("com/tst/simple/RemoteView",
"(Landroid/app/Activity;)V",
QtAndroid::androidActivity().object<jobject>())
{
connect(qGuiApp,&QGuiApplication::applicationStateChanged,this,&RemoteView::appStateChanged);
SetNewAppState(APP_STATE_CREATE);
}
RemoteView::~RemoteView(){
SetNewAppState(APP_STATE_DESTROY);
}
void RemoteView::appStateChanged(Qt::ApplicationState State){
SetNewAppState((State == Qt::ApplicationActive) ? APP_STATE_START : APP_STATE_STOP);
}
void RemoteView::SetNewAppState(APP_STATE NewState){
if(m_JavaRemoteView.isValid()){
m_JavaRemoteView.callMethod<void>("appStateChanged","(I)V",NewState);
}
}