Added Java->C++ native calls for the session.
This commit is contained in:
parent
0b74106888
commit
deff19a53a
@ -7,7 +7,7 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.kde.kasts"
|
||||
android:versionName="0.0.1"
|
||||
android:versionCode="1628971416"
|
||||
android:versionCode="1628976648"
|
||||
android:installLocation="auto">
|
||||
|
||||
<supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
|
||||
|
@ -175,6 +175,8 @@ public class KastsActivity extends QtActivity
|
||||
|
||||
mSession.setActive(true);
|
||||
|
||||
play();
|
||||
|
||||
//Update variables of mediaData;
|
||||
activity.updateNotification();
|
||||
|
||||
@ -197,6 +199,13 @@ public class KastsActivity extends QtActivity
|
||||
//JNI call to audiomanager stop
|
||||
mSession.setActive(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSkipToNext() {
|
||||
super.onPause();
|
||||
|
||||
//JNI to audiomanager next
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -249,4 +258,10 @@ public class KastsActivity extends QtActivity
|
||||
|
||||
activity.updateNotification();
|
||||
}
|
||||
|
||||
private static native void play();
|
||||
private static native void pause();
|
||||
private static native void stop();
|
||||
private static native void next();
|
||||
private static native void seek(long position);
|
||||
}
|
||||
|
@ -8,6 +8,54 @@
|
||||
#include "audiomanager.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QAndroidJniObject>
|
||||
#include <QAndroidJniEnvironment>
|
||||
|
||||
static void play(JNIEnv *env, jobject thiz)
|
||||
{
|
||||
Q_UNUSED(env)
|
||||
Q_UNUSED(thiz)
|
||||
// audio manager play
|
||||
}
|
||||
static void pause(JNIEnv *env, jobject thiz)
|
||||
{
|
||||
Q_UNUSED(env)
|
||||
Q_UNUSED(thiz)
|
||||
// audio manager pause
|
||||
}
|
||||
static void stop(JNIEnv *env, jobject thiz)
|
||||
{
|
||||
Q_UNUSED(env)
|
||||
Q_UNUSED(thiz)
|
||||
//audio manager previous
|
||||
}
|
||||
static void next(JNIEnv *env, jobject thiz)
|
||||
{
|
||||
Q_UNUSED(env)
|
||||
Q_UNUSED(thiz)
|
||||
// audio manager next
|
||||
}
|
||||
static void seek(JNIEnv *env, jobject thiz, jlong position)
|
||||
{
|
||||
Q_UNUSED(env)
|
||||
Q_UNUSED(thiz)
|
||||
// implement seek
|
||||
}
|
||||
void registerNativeMethods() {
|
||||
JNINativeMethod methods[] {{"play", "()V", reinterpret_cast<void *>(play)},
|
||||
{"pause", "()V", reinterpret_cast<void *>(pause)},
|
||||
{"stop", "()V", reinterpret_cast<void *>(stop)},
|
||||
{"next", "()V", reinterpret_cast<void *>(next)},
|
||||
{"seek", "(J)V", reinterpret_cast<void *>(seek)}};
|
||||
|
||||
QAndroidJniObject javaClass("org/kde/kasts/KastsActivity");
|
||||
QAndroidJniEnvironment env;
|
||||
jclass objectClass = env->GetObjectClass(javaClass.object<jobject>());
|
||||
env->RegisterNatives(objectClass,
|
||||
methods,
|
||||
sizeof(methods) / sizeof(methods[0]));
|
||||
env->DeleteLocalRef(objectClass);
|
||||
}
|
||||
|
||||
MediaSessionClient::MediaSessionClient(AudioManager *audioPlayer, QObject *parent)
|
||||
: QObject(parent)
|
||||
@ -60,7 +108,7 @@ void MediaSessionClient::setSessionMetadata()
|
||||
if (entry->authors().count() > 0) {
|
||||
for (auto &author : entry->authors()) {
|
||||
authorString.append(author->name());
|
||||
(entry->authors().count > 1)
|
||||
if(entry->authors().count() > 1)
|
||||
authorString.append(QStringLiteral(", "));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user