From d5f70ccad4d690b29fbfc01d84ed7f59848904f4 Mon Sep 17 00:00:00 2001 From: Dorian Zedler Date: Tue, 24 Jul 2018 15:24:15 +0200 Subject: [PATCH] the volume control buttons now dontrol the media volume directly --- android-sources/src/StayAwake.java | 1 + main.cpp | 3 +++ speedclimbing_stopwatch.pro | 5 ++++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/android-sources/src/StayAwake.java b/android-sources/src/StayAwake.java index 8fc70e6..e99750e 100644 --- a/android-sources/src/StayAwake.java +++ b/android-sources/src/StayAwake.java @@ -4,5 +4,6 @@ public class StayAwake extends org.qtproject.qt5.android.bindings.QtActivity { public void onCreate(android.os.Bundle savedInstanceState){ super.onCreate(savedInstanceState); this.getWindow().addFlags(android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); + //this.getWindow().setVolumeControlStream(android.view.AudioManager.STREAM_MUSIC); } } diff --git a/main.cpp b/main.cpp index 9a9039d..259b549 100644 --- a/main.cpp +++ b/main.cpp @@ -44,6 +44,9 @@ int main(int argc, char *argv[]) QGuiApplication app(argc, argv); + QAndroidJniObject jactivity=QtAndroid::androidActivity(); + if(jactivity.isValid()) + jactivity.callMethod("setVolumeControlStream","(I)V",3); connectToDatabase(); diff --git a/speedclimbing_stopwatch.pro b/speedclimbing_stopwatch.pro index c9c7946..061ba3d 100644 --- a/speedclimbing_stopwatch.pro +++ b/speedclimbing_stopwatch.pro @@ -1,4 +1,8 @@ QT += quick sql + +android { + QT += androidextras +} CONFIG += c++11 # The following define makes your compiler emit warnings if you use @@ -42,7 +46,6 @@ DISTFILES += \ android { ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android-sources - Qt += androidextras } HEADERS += \