Skip to content

Commit f9109eb

Browse files
committed
Use player.getThumbnail() instead of field in VideoPlayerUi
1 parent 4a7af6f commit f9109eb

1 file changed

Lines changed: 7 additions & 13 deletions

File tree

app/src/main/java/org/schabi/newpipe/player/ui/VideoPlayerUi.java

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ public abstract class VideoPlayerUi extends PlayerUi
109109
private final Handler controlsVisibilityHandler = new Handler(Looper.getMainLooper());
110110
@Nullable private SurfaceHolderCallback surfaceHolderCallback;
111111
boolean surfaceIsSetup = false;
112-
@Nullable private Bitmap thumbnail = null;
113112

114113

115114
/*//////////////////////////////////////////////////////////////////////////
@@ -385,9 +384,7 @@ public void destroyPlayer() {
385384
@Override
386385
public void destroy() {
387386
super.destroy();
388-
if (binding != null) {
389-
binding.endScreen.setImageBitmap(null);
390-
}
387+
binding.endScreen.setImageDrawable(null);
391388
deinitPlayerSeekOverlay();
392389
deinitListeners();
393390
}
@@ -422,12 +419,10 @@ protected void setupElementsSize(final int buttonsMinWidth,
422419
public void onBroadcastReceived(final Intent intent) {
423420
super.onBroadcastReceived(intent);
424421
if (Intent.ACTION_CONFIGURATION_CHANGED.equals(intent.getAction())) {
425-
// When the orientation changed, the screen height might be smaller.
426-
// If the end screen thumbnail is not re-scaled,
427-
// it can be larger than the current screen height
428-
// and thus enlarging the whole player.
429-
// This causes the seekbar to be ouf the visible area.
430-
updateEndScreenThumbnail();
422+
// When the orientation changes, the screen height might be smaller. If the end screen
423+
// thumbnail is not re-scaled, it can be larger than the current screen height and thus
424+
// enlarging the whole player. This causes the seekbar to be out of the visible area.
425+
updateEndScreenThumbnail(player.getThumbnail());
431426
}
432427
}
433428
//endregion
@@ -449,11 +444,10 @@ public void onBroadcastReceived(final Intent intent) {
449444
@Override
450445
public void onThumbnailLoaded(@Nullable final Bitmap bitmap) {
451446
super.onThumbnailLoaded(bitmap);
452-
thumbnail = bitmap;
453-
updateEndScreenThumbnail();
447+
updateEndScreenThumbnail(bitmap);
454448
}
455449

456-
private void updateEndScreenThumbnail() {
450+
private void updateEndScreenThumbnail(@Nullable final Bitmap thumbnail) {
457451
if (thumbnail == null) {
458452
// remove end screen thumbnail
459453
binding.endScreen.setImageDrawable(null);

0 commit comments

Comments
 (0)