diff --git a/android/src/org/kde/kasts/KastsActivity.java b/android/src/org/kde/kasts/KastsActivity.java index 414d58bd..b578dc0f 100755 --- a/android/src/org/kde/kasts/KastsActivity.java +++ b/android/src/org/kde/kasts/KastsActivity.java @@ -41,6 +41,7 @@ public class KastsActivity extends QtActivity public long position; public long duration; public float playbackSpeed; + public int state = 2; // add more variables here } @@ -57,6 +58,16 @@ public class KastsActivity extends QtActivity MediaMetadataCompat.Builder metadata = new MediaMetadataCompat.Builder(); + switch(mediaData.state) + { + case 0: + mPBuilder.setState(PlaybackStateCompat.STATE_PLAYING, mediaData.position, mediaData.playbackSpeed); + case 1: + mPBuilder.setState(PlaybackStateCompat.STATE_PAUSED, mediaData.position, mediaData.playbackSpeed); + case 2: + mPBuilder.setState(PlaybackStateCompat.STATE_STOPPED, mediaData.position, mediaData.playbackSpeed); + } + metadata.putString(MediaMetadataCompat.METADATA_KEY_TITLE, "The title"); metadata.putString(MediaMetadataCompat.METADATA_KEY_AUTHOR, "Author"); metadata.putString(MediaMetadataCompat.METADATA_KEY_ARTIST, "Author"); @@ -194,15 +205,9 @@ public class KastsActivity extends QtActivity public static void setSessionState(int state) { //TODO: set state in mediadata - switch(state) - { - case 0: - mPBuilder.setState(PlaybackStateCompat.STATE_PLAYING, mediaData.position, mediaData.playbackSpeed); - case 1: - mPBuilder.setState(PlaybackStateCompat.STATE_PAUSED, mediaData.position, mediaData.playbackSpeed); - case 2: - mPBuilder.setState(PlaybackStateCompat.STATE_STOPPED, mediaData.position, mediaData.playbackSpeed); - } + + mediaData.state = state; + activity.updateNotification(); }