mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-07 03:22:27 +02:00
Deactivates display plugin when qt app goes to background
This commit is contained in:
parent
da69c9d077
commit
5e337e90a3
4 changed files with 8 additions and 29 deletions
|
@ -27,10 +27,7 @@ public class SplashActivity extends Activity {
|
|||
}
|
||||
|
||||
public void onAppLoadedComplete() {
|
||||
// Give interface more time so textures don't fail(got deleted) on Adreno (joystick)
|
||||
new Handler(getMainLooper()).postDelayed(() -> {
|
||||
startActivity(new Intent(this, HomeActivity.class));
|
||||
new Handler(getMainLooper()).postDelayed(() -> SplashActivity.this.finish(), 1000);
|
||||
}, 500);
|
||||
startActivity(new Intent(this, HomeActivity.class));
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,9 +11,7 @@
|
|||
#include "AndroidHelper.h"
|
||||
#include <QDebug>
|
||||
|
||||
AndroidHelper::AndroidHelper() :
|
||||
_accountManager ()
|
||||
{
|
||||
AndroidHelper::AndroidHelper() {
|
||||
}
|
||||
|
||||
AndroidHelper::~AndroidHelper() {
|
||||
|
@ -38,11 +36,3 @@ void AndroidHelper::goBackFromAndroidActivity() {
|
|||
void AndroidHelper::notifyLoginComplete(bool success) {
|
||||
emit loginComplete(success);
|
||||
}
|
||||
|
||||
void AndroidHelper::setInBackground(bool background) {
|
||||
inBackground = background;
|
||||
}
|
||||
|
||||
bool AndroidHelper::isInBackground() {
|
||||
return inBackground;
|
||||
}
|
||||
|
|
|
@ -26,8 +26,6 @@ public:
|
|||
void requestActivity(const QString &activityName);
|
||||
void notifyLoadComplete();
|
||||
void goBackFromAndroidActivity();
|
||||
void setInBackground(bool background);
|
||||
bool isInBackground();
|
||||
|
||||
void notifyLoginComplete(bool success);
|
||||
|
||||
|
@ -45,8 +43,6 @@ signals:
|
|||
private:
|
||||
AndroidHelper();
|
||||
~AndroidHelper();
|
||||
QSharedPointer<AccountManager> _accountManager;
|
||||
bool inBackground;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -4330,13 +4330,7 @@ void setupCpuMonitorThread() {
|
|||
|
||||
void Application::idle() {
|
||||
PerformanceTimer perfTimer("idle");
|
||||
|
||||
#if defined(Q_OS_ANDROID)
|
||||
if (AndroidHelper::instance().isInBackground()) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// Update the deadlock watchdog
|
||||
updateHeartbeat();
|
||||
|
||||
|
@ -8183,13 +8177,15 @@ void Application::openAndroidActivity(const QString& activityName) {
|
|||
void Application::enterBackground() {
|
||||
QMetaObject::invokeMethod(DependencyManager::get<AudioClient>().data(),
|
||||
"stop", Qt::BlockingQueuedConnection);
|
||||
AndroidHelper::instance().setInBackground(true);
|
||||
getActiveDisplayPlugin()->deactivate();
|
||||
}
|
||||
|
||||
void Application::enterForeground() {
|
||||
QMetaObject::invokeMethod(DependencyManager::get<AudioClient>().data(),
|
||||
"start", Qt::BlockingQueuedConnection);
|
||||
AndroidHelper::instance().setInBackground(false);
|
||||
if (!getActiveDisplayPlugin() || !getActiveDisplayPlugin()->activate()) {
|
||||
qWarning() << "Could not re-activate display plugin";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in a new issue