Merge pull request #4642 from XiangRongLin/hide_thumbnail

Add option to hide thumbnail on lock screen
This commit is contained in:
Stypox 2020-11-20 16:35:10 +01:00 committed by GitHub
commit 06b7072240
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 3 deletions

View file

@ -146,7 +146,11 @@ public final class NotificationUtil {
notificationBuilder.setContentText(player.getUploaderName());
notificationBuilder.setTicker(player.getVideoTitle());
updateActions(notificationBuilder, player);
setLargeIcon(notificationBuilder, player);
final boolean showThumbnail = player.sharedPreferences.getBoolean(
player.context.getString(R.string.show_thumbnail_key), true);
if (showThumbnail) {
setLargeIcon(notificationBuilder, player);
}
}

View file

@ -671,9 +671,13 @@ public class VideoPlayerImpl extends VideoPlayer
super.onUpdateProgress(currentProgress, duration, bufferPercent);
updateProgress(currentProgress, duration, bufferPercent);
final boolean showThumbnail =
sharedPreferences.getBoolean(
context.getString(R.string.show_thumbnail_key),
true);
// setMetadata only updates the metadata when any of the metadata keys are null
mediaSessionManager.setMetadata(getVideoTitle(), getUploaderName(), getThumbnail(),
duration);
mediaSessionManager.setMetadata(getVideoTitle(), getUploaderName(),
showThumbnail ? getThumbnail() : null, duration);
}
@Override