From 500acce178d1e9f21d811f7e9f3b3bfac6c4aeb0 Mon Sep 17 00:00:00 2001 From: Stypox Date: Wed, 24 Aug 2022 15:08:24 +0200 Subject: [PATCH] Fix regression in screen rotation animation --- .../newpipe/fragments/detail/VideoDetailFragment.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java index 594006ab5..9800b2b0a 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java @@ -1302,8 +1302,14 @@ public final class VideoDetailFragment } private void tryAddVideoPlayerView() { - // do all the null checks in the posted lambda, since the player, the binding and the view - // could be set or unset before the lambda gets executed on the next main thread cycle + if (isPlayerAvailable() && getView() != null) { + // Setup the surface view height, so that it fits the video correctly; this is done also + // here, and not only in the Handler, to avoid a choppy fullscreen rotation animation. + setHeightThumbnail(); + } + + // do all the null checks in the posted lambda, too, since the player, the binding and the + // view could be set or unset before the lambda gets executed on the next main thread cycle new Handler(Looper.getMainLooper()).post(() -> { if (!isPlayerAvailable() || getView() == null) { return;