Minor bug fixes (#652)

* fix mpv external not marking as watched

* fix player always unpausing after seeking

* fix skip intro not leading to control fade

* add swipe behavior to system bars

* adjusted double tap play/pause size
This commit is contained in:
Quickdesh 2022-07-11 03:24:35 +05:30 committed by GitHub
parent 60f3b9fff6
commit d8c2c17631
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 5 deletions

View file

@ -224,7 +224,7 @@ class ExternalIntents(val anime: Anime, val source: AnimeSource) {
}
}
launchIO {
if (cause == "playback_completion") {
if (cause == "playback_completion" || (currentPosition == duration && duration == 0L)) {
saveEpisodeProgress(currentExtEpisode, anime, currentExtEpisode.totalSeconds, currentExtEpisode.totalSeconds)
} else {
saveEpisodeProgress(currentExtEpisode, anime, currentPosition, duration)

View file

@ -615,6 +615,7 @@ class PlayerActivity :
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or
View.SYSTEM_UI_FLAG_LOW_PROFILE
windowInsetsController.hide(WindowInsetsCompat.Type.systemBars())
windowInsetsController.systemBarsBehavior = WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P && preferences.playerFullscreen()) {
window.attributes.layoutInDisplayCutoutMode =
@ -1036,6 +1037,7 @@ class PlayerActivity :
@Suppress("UNUSED_PARAMETER")
fun skipIntro(view: View) {
doubleTapSeek(preferences.introLengthPreference(), isDoubleTap = false)
playerControls.resetControlsFade()
}
private fun refreshUi() {

View file

@ -69,6 +69,7 @@ class PlayerControlsView @JvmOverloads constructor(context: Context, attrs: Attr
}
private var showControls = false
private var wasPausedBeforeSeeking = false
private val nonSeekViewRunnable = Runnable {
binding.topControlsGroup.isVisible = true
@ -78,7 +79,7 @@ class PlayerControlsView @JvmOverloads constructor(context: Context, attrs: Attr
private val hideUiForSeekRunnable = Runnable {
shouldHideUiForSeek = false
activity.player.paused = false
activity.player.paused = wasPausedBeforeSeeking
if (showControls) {
AnimationUtils.loadAnimation(activity, R.anim.fade_in_medium).also { fadeAnimation ->
binding.topControlsGroup.startAnimation(fadeAnimation)
@ -103,6 +104,7 @@ class PlayerControlsView @JvmOverloads constructor(context: Context, attrs: Attr
animationHandler.removeCallbacks(hideUiForSeekRunnable)
if (!(binding.topControlsGroup.visibility == INVISIBLE && binding.middleControlsGroup.visibility == INVISIBLE && binding.bottomControlsGroup.visibility == INVISIBLE)) {
wasPausedBeforeSeeking = activity.player.paused!!
showControls = binding.controlsView.isVisible
binding.topControlsGroup.visibility = INVISIBLE
binding.middleControlsGroup.visibility = INVISIBLE

View file

@ -4,5 +4,5 @@
<gradient android:startColor="#000000"
android:endColor="#20FFFFFF"
android:type="radial"
android:gradientRadius="80dp" />
android:gradientRadius="100dp" />
</shape>

View file

@ -121,8 +121,8 @@
<ImageView
android:id="@+id/playPauseView"
android:layout_width="72dp"
android:layout_height="72dp"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_centerInParent="true"
android:contentDescription="Play/Pause"
android:background="@drawable/ic_play_pause_bg"