Skip to content

Commit 500acce

Browse files
committed
Fix regression in screen rotation animation
1 parent 6805c75 commit 500acce

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1302,8 +1302,14 @@ private boolean isAutoplayEnabled() {
13021302
}
13031303

13041304
private void tryAddVideoPlayerView() {
1305-
// do all the null checks in the posted lambda, since the player, the binding and the view
1306-
// could be set or unset before the lambda gets executed on the next main thread cycle
1305+
if (isPlayerAvailable() && getView() != null) {
1306+
// Setup the surface view height, so that it fits the video correctly; this is done also
1307+
// here, and not only in the Handler, to avoid a choppy fullscreen rotation animation.
1308+
setHeightThumbnail();
1309+
}
1310+
1311+
// do all the null checks in the posted lambda, too, since the player, the binding and the
1312+
// view could be set or unset before the lambda gets executed on the next main thread cycle
13071313
new Handler(Looper.getMainLooper()).post(() -> {
13081314
if (!isPlayerAvailable() || getView() == null) {
13091315
return;

0 commit comments

Comments
 (0)