From 4bf541932a0f2b5bcff62f9d121be9352983b006 Mon Sep 17 00:00:00 2001 From: Eva Tatarka Date: Mon, 7 Nov 2022 13:57:13 -0500 Subject: [PATCH] Handle config changes for video playback (#2754) Fixes #2419 --- app/src/main/AndroidManifest.xml | 3 ++- .../tusky/view/ExposedPlayPauseVideoView.kt | 11 +++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 659786e1b..1df0b7807 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -103,7 +103,8 @@ android:configChanges="orientation|screenSize" /> + android:theme="@style/TuskyBaseTheme" + android:configChanges="orientation|screenSize|keyboardHidden|screenLayout|smallestScreenSize" /> diff --git a/app/src/main/java/com/keylesspalace/tusky/view/ExposedPlayPauseVideoView.kt b/app/src/main/java/com/keylesspalace/tusky/view/ExposedPlayPauseVideoView.kt index 444e71dc1..95605b18f 100644 --- a/app/src/main/java/com/keylesspalace/tusky/view/ExposedPlayPauseVideoView.kt +++ b/app/src/main/java/com/keylesspalace/tusky/view/ExposedPlayPauseVideoView.kt @@ -12,6 +12,7 @@ class ExposedPlayPauseVideoView @JvmOverloads constructor( VideoView(context, attrs, defStyleAttr) { private var listener: PlayPauseListener? = null + private var playing = false fun setPlayPauseListener(listener: PlayPauseListener) { this.listener = listener @@ -19,12 +20,18 @@ class ExposedPlayPauseVideoView @JvmOverloads constructor( override fun start() { super.start() - listener?.onPlay() + if (!playing) { + playing = true + listener?.onPlay() + } } override fun pause() { super.pause() - listener?.onPause() + if (playing) { + playing = false + listener?.onPause() + } } interface PlayPauseListener {