diff --git a/app/build.gradle b/app/build.gradle index 7a4be160..55afe041 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -31,8 +31,8 @@ android { testApplicationId "ac.mdiq.podcini.tests" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - versionCode 3020243 - versionName "6.5.9" + versionCode 3020244 + versionName "6.5.10" applicationId "ac.mdiq.podcini.R" def commit = "" diff --git a/app/src/main/kotlin/ac/mdiq/podcini/playback/service/PlaybackService.kt b/app/src/main/kotlin/ac/mdiq/podcini/playback/service/PlaybackService.kt index c9ce3eaa..b9a301ca 100644 --- a/app/src/main/kotlin/ac/mdiq/podcini/playback/service/PlaybackService.kt +++ b/app/src/main/kotlin/ac/mdiq/podcini/playback/service/PlaybackService.kt @@ -54,7 +54,6 @@ import ac.mdiq.podcini.storage.model.FeedPreferences.AutoDeleteAction import ac.mdiq.podcini.storage.utils.ChapterUtils import ac.mdiq.podcini.storage.utils.EpisodeUtil import ac.mdiq.podcini.storage.utils.EpisodeUtil.hasAlmostEnded -import ac.mdiq.podcini.ui.activity.VideoplayerActivity.Companion.videoMode import ac.mdiq.podcini.ui.activity.starter.MainActivityStarter import ac.mdiq.podcini.ui.activity.starter.VideoPlayerActivityStarter import ac.mdiq.podcini.ui.utils.NotificationUtils @@ -1033,10 +1032,6 @@ class PlaybackService : MediaLibraryService() { // if (curMedia is EpisodeMedia && episode != null) addToQueue(true, episode) } - fun clearCurTempSpeed() { - curState = upsertBlk(curState) { it.curTempSpeed = FeedPreferences.SPEED_USE_GLOBAL } - } - private var eventSink: Job? = null private fun cancelFlowEvents() { eventSink?.cancel() @@ -2549,6 +2544,10 @@ class PlaybackService : MediaLibraryService() { return playbackService?.taskManager?.isSleepTimerActive ?: false } + fun clearCurTempSpeed() { + curState = upsertBlk(curState) { it.curTempSpeed = FeedPreferences.SPEED_USE_GLOBAL } + } + fun playPause() { when (MediaPlayerBase.status) { PlayerStatus.FALLBACK -> toggleFallbackSpeed(1.0f) diff --git a/app/src/main/kotlin/ac/mdiq/podcini/ui/actions/actionbutton/EpisodeActionButton.kt b/app/src/main/kotlin/ac/mdiq/podcini/ui/actions/actionbutton/EpisodeActionButton.kt index f600dab0..cf8f00c6 100644 --- a/app/src/main/kotlin/ac/mdiq/podcini/ui/actions/actionbutton/EpisodeActionButton.kt +++ b/app/src/main/kotlin/ac/mdiq/podcini/ui/actions/actionbutton/EpisodeActionButton.kt @@ -34,14 +34,8 @@ abstract class EpisodeActionButton internal constructor(@JvmField var item: Epis icon.setImageResource(getDrawable()) } - protected fun playVideoIfNeeded(context: Context, media: Playable) { - if (item.feed?.preferences?.videoModePolicy != VideoMode.AUDIO_ONLY - && videoPlayMode != VideoMode.AUDIO_ONLY.code && videoMode != VideoMode.AUDIO_ONLY - && media.getMediaType() == MediaType.VIDEO) - context.startActivity(getPlayerActivityIntent(context, MediaType.VIDEO)) - } - @UnstableApi companion object { + fun forItem(episode: Episode): EpisodeActionButton { val media = episode.media ?: return TTSActionButton(episode) val isDownloadingMedia = when (media.downloadUrl) { @@ -60,5 +54,13 @@ abstract class EpisodeActionButton internal constructor(@JvmField var item: Epis else -> DownloadActionButton(episode) } } + + fun playVideoIfNeeded(context: Context, media: Playable) { + val item = (media as? EpisodeMedia)?.episode + if (item?.feed?.preferences?.videoModePolicy != VideoMode.AUDIO_ONLY + && videoPlayMode != VideoMode.AUDIO_ONLY.code && videoMode != VideoMode.AUDIO_ONLY + && media.getMediaType() == MediaType.VIDEO) + context.startActivity(getPlayerActivityIntent(context, MediaType.VIDEO)) + } } } diff --git a/app/src/main/kotlin/ac/mdiq/podcini/ui/actions/actionbutton/PlayActionButton.kt b/app/src/main/kotlin/ac/mdiq/podcini/ui/actions/actionbutton/PlayActionButton.kt index d89592b7..d09ace11 100644 --- a/app/src/main/kotlin/ac/mdiq/podcini/ui/actions/actionbutton/PlayActionButton.kt +++ b/app/src/main/kotlin/ac/mdiq/podcini/ui/actions/actionbutton/PlayActionButton.kt @@ -3,6 +3,7 @@ package ac.mdiq.podcini.ui.actions.actionbutton import ac.mdiq.podcini.R import ac.mdiq.podcini.playback.PlaybackServiceStarter import ac.mdiq.podcini.playback.base.InTheatre +import ac.mdiq.podcini.playback.service.PlaybackService.Companion.clearCurTempSpeed import ac.mdiq.podcini.playback.service.PlaybackService.Companion.playbackService import ac.mdiq.podcini.storage.database.RealmDB.realm import ac.mdiq.podcini.storage.database.RealmDB.upsertBlk @@ -42,6 +43,7 @@ class PlayActionButton(item: Episode) : EpisodeActionButton(item) { playbackService?.mPlayer?.resume() playbackService?.taskManager?.restartSleepTimer() } else { + clearCurTempSpeed() PlaybackServiceStarter(context, media).callEvenIfRunning(true).start() EventFlow.postEvent(FlowEvent.PlayEvent(item)) } diff --git a/app/src/main/kotlin/ac/mdiq/podcini/ui/actions/actionbutton/PlayLocalActionButton.kt b/app/src/main/kotlin/ac/mdiq/podcini/ui/actions/actionbutton/PlayLocalActionButton.kt index 8a5b9f7f..04c3c40e 100644 --- a/app/src/main/kotlin/ac/mdiq/podcini/ui/actions/actionbutton/PlayLocalActionButton.kt +++ b/app/src/main/kotlin/ac/mdiq/podcini/ui/actions/actionbutton/PlayLocalActionButton.kt @@ -3,6 +3,7 @@ package ac.mdiq.podcini.ui.actions.actionbutton import ac.mdiq.podcini.R import ac.mdiq.podcini.playback.PlaybackServiceStarter import ac.mdiq.podcini.playback.base.InTheatre +import ac.mdiq.podcini.playback.service.PlaybackService.Companion.clearCurTempSpeed import ac.mdiq.podcini.playback.service.PlaybackService.Companion.getPlayerActivityIntent import ac.mdiq.podcini.playback.service.PlaybackService.Companion.playbackService import ac.mdiq.podcini.storage.model.Episode @@ -33,6 +34,7 @@ class PlayLocalActionButton(item: Episode) : EpisodeActionButton(item) { playbackService?.mPlayer?.resume() playbackService?.taskManager?.restartSleepTimer() } else { + clearCurTempSpeed() PlaybackServiceStarter(context, media).callEvenIfRunning(true).start() EventFlow.postEvent(FlowEvent.PlayEvent(item)) } diff --git a/app/src/main/kotlin/ac/mdiq/podcini/ui/actions/actionbutton/StreamActionButton.kt b/app/src/main/kotlin/ac/mdiq/podcini/ui/actions/actionbutton/StreamActionButton.kt index 3f5691ed..7697e174 100644 --- a/app/src/main/kotlin/ac/mdiq/podcini/ui/actions/actionbutton/StreamActionButton.kt +++ b/app/src/main/kotlin/ac/mdiq/podcini/ui/actions/actionbutton/StreamActionButton.kt @@ -4,9 +4,12 @@ import ac.mdiq.podcini.R import ac.mdiq.podcini.net.utils.NetworkUtils.isAllowMobileStreaming import ac.mdiq.podcini.net.utils.NetworkUtils.isStreamingAllowed import ac.mdiq.podcini.playback.PlaybackServiceStarter +import ac.mdiq.podcini.playback.base.InTheatre +import ac.mdiq.podcini.playback.service.PlaybackService.Companion.clearCurTempSpeed import ac.mdiq.podcini.preferences.UsageStatistics import ac.mdiq.podcini.preferences.UsageStatistics.logAction import ac.mdiq.podcini.storage.model.Episode +import ac.mdiq.podcini.storage.model.EpisodeMedia import ac.mdiq.podcini.storage.model.Playable import ac.mdiq.podcini.storage.model.RemoteMedia import ac.mdiq.podcini.util.EventFlow @@ -34,10 +37,7 @@ class StreamActionButton(item: Episode) : EpisodeActionButton(item) { StreamingConfirmationDialog(context, media).show() return } - PlaybackServiceStarter(context, media).shouldStreamThisTime(true).callEvenIfRunning(true).start() - EventFlow.postEvent(FlowEvent.PlayEvent(item)) - - playVideoIfNeeded(context, media) + stream(context, media) } class StreamingConfirmationDialog(private val context: Context, private val playable: Playable) { @@ -46,17 +46,23 @@ class StreamActionButton(item: Episode) : EpisodeActionButton(item) { MaterialAlertDialogBuilder(context) .setTitle(R.string.stream_label) .setMessage(R.string.confirm_mobile_streaming_notification_message) - .setPositiveButton(R.string.confirm_mobile_streaming_button_once) { _: DialogInterface?, _: Int -> stream() } + .setPositiveButton(R.string.confirm_mobile_streaming_button_once) { _: DialogInterface?, _: Int -> stream(context, playable) } .setNegativeButton(R.string.confirm_mobile_streaming_button_always) { _: DialogInterface?, _: Int -> isAllowMobileStreaming = true - stream() + stream(context, playable) } .setNeutralButton(R.string.cancel_label, null) .show() } - @UnstableApi - private fun stream() { - PlaybackServiceStarter(context, playable).callEvenIfRunning(true).shouldStreamThisTime(true).start() + } + + companion object { + + fun stream(context: Context, media: Playable) { + if (media !is EpisodeMedia || !InTheatre.isCurMedia(media)) clearCurTempSpeed() + PlaybackServiceStarter(context, media).shouldStreamThisTime(true).callEvenIfRunning(true).start() + if (media is EpisodeMedia && media.episode != null) EventFlow.postEvent(FlowEvent.PlayEvent(media.episode!!)) + playVideoIfNeeded(context, media) } } } diff --git a/app/src/main/kotlin/ac/mdiq/podcini/ui/dialog/VariableSpeedDialog.kt b/app/src/main/kotlin/ac/mdiq/podcini/ui/dialog/VariableSpeedDialog.kt index 917fb53f..b0685f9c 100644 --- a/app/src/main/kotlin/ac/mdiq/podcini/ui/dialog/VariableSpeedDialog.kt +++ b/app/src/main/kotlin/ac/mdiq/podcini/ui/dialog/VariableSpeedDialog.kt @@ -241,7 +241,6 @@ open class VariableSpeedDialog : BottomSheetDialogFragment() { private fun setPlaybackSpeed(speed: Float, codeArray: BooleanArray? = null) { if (playbackService != null) { -// playbackService!!.setSpeed(speed, codeArray) playbackService!!.isSpeedForward = false playbackService!!.isFallbackSpeed = false diff --git a/app/src/main/kotlin/ac/mdiq/podcini/ui/fragment/QueuesFragment.kt b/app/src/main/kotlin/ac/mdiq/podcini/ui/fragment/QueuesFragment.kt index 91d82109..7c2305c2 100644 --- a/app/src/main/kotlin/ac/mdiq/podcini/ui/fragment/QueuesFragment.kt +++ b/app/src/main/kotlin/ac/mdiq/podcini/ui/fragment/QueuesFragment.kt @@ -105,6 +105,7 @@ import kotlin.math.max private lateinit var spinnerTexts: MutableList private lateinit var queueSpinner: Spinner private lateinit var spinnerAdaptor: ArrayAdapter + private lateinit var queues: List private var displayUpArrow = false private var queueItems: MutableList = mutableListOf() @@ -136,7 +137,7 @@ import kotlin.math.max displayUpArrow = parentFragmentManager.backStackEntryCount != 0 if (savedInstanceState != null) displayUpArrow = savedInstanceState.getBoolean(KEY_UP_ARROW) - val queues = realm.query(PlayQueue::class).find() + queues = realm.query(PlayQueue::class).find() queueNames = queues.map { it.name }.toTypedArray() spinnerTexts = queues.map { "${it.name} : ${it.episodeIds.size}" }.toMutableList() spinnerLayout = inflater.inflate(R.layout.queue_title_spinner, toolbar, false) @@ -588,11 +589,9 @@ import kotlin.math.max newQueue.id = queueNames.size.toLong() newQueue.name = newName upsertBlk(newQueue) {} - val queues = realm.query(PlayQueue::class).find() + queues = realm.query(PlayQueue::class).find() queueNames = queues.map { it.name }.toTypedArray() spinnerTexts.addAll(queues.map { "${it.name} : ${it.episodeIds.size}" }) -// spinnerAdaptor = ArrayAdapter(requireContext(), android.R.layout.simple_spinner_item, spinnerTexts) -// spinnerAdaptor.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item) spinnerAdaptor.notifyDataSetChanged() queueSpinner.adapter = spinnerAdaptor queueSpinner.setSelection(spinnerAdaptor.getPosition(curQueue.name)) diff --git a/changelog.md b/changelog.md index 93b79c29..d7dccbcb 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,8 @@ +# 6.5.10 + +* fixed crash when switching to a newly created queue in Queues view +* reset temp speed when manually playing a new episode to ensure preset speed is used + # 6.5.9 * partially fixed an issue seen on Samsung Android 14 device where after playing the user-started episode, subsequent episode in the queue is not played in foreground service and there is not notification panel and can get stopped by the system. diff --git a/fastlane/metadata/android/en-US/changelogs/3020244.txt b/fastlane/metadata/android/en-US/changelogs/3020244.txt new file mode 100644 index 00000000..dac4fb52 --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/3020244.txt @@ -0,0 +1,4 @@ + Version 6.5.10 brings several changes: + +* fixed crash when switching to a newly created queue in Queues view +* reset temp speed when manually playing a new episode to ensure preset speed is used