Add option to hide thumbnail on lock screen and inside notification
This commit is contained in:
parent
5b6e187b49
commit
7805f8a9b1
|
@ -146,7 +146,11 @@ public final class NotificationUtil {
|
||||||
notificationBuilder.setContentText(player.getUploaderName());
|
notificationBuilder.setContentText(player.getUploaderName());
|
||||||
notificationBuilder.setTicker(player.getVideoTitle());
|
notificationBuilder.setTicker(player.getVideoTitle());
|
||||||
updateActions(notificationBuilder, player);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -671,9 +671,13 @@ public class VideoPlayerImpl extends VideoPlayer
|
||||||
super.onUpdateProgress(currentProgress, duration, bufferPercent);
|
super.onUpdateProgress(currentProgress, duration, bufferPercent);
|
||||||
updateProgress(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
|
// setMetadata only updates the metadata when any of the metadata keys are null
|
||||||
mediaSessionManager.setMetadata(getVideoTitle(), getUploaderName(), getThumbnail(),
|
mediaSessionManager.setMetadata(getVideoTitle(), getUploaderName(),
|
||||||
duration);
|
showThumbnail ? getThumbnail() : null, duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -222,6 +222,8 @@
|
||||||
<string name="feed_update_threshold_key" translatable="false">feed_update_threshold_key</string>
|
<string name="feed_update_threshold_key" translatable="false">feed_update_threshold_key</string>
|
||||||
<string name="feed_update_threshold_default_value" translatable="false">300</string>
|
<string name="feed_update_threshold_default_value" translatable="false">300</string>
|
||||||
|
|
||||||
|
<string name="show_thumbnail_key" translatable="false">show_thumbnail_key</string>
|
||||||
|
|
||||||
<!-- Values will be localized in runtime -->
|
<!-- Values will be localized in runtime -->
|
||||||
<string-array name="feed_update_threshold_options" translatable="false">
|
<string-array name="feed_update_threshold_options" translatable="false">
|
||||||
<item>@string/feed_update_threshold_option_always_update</item>
|
<item>@string/feed_update_threshold_option_always_update</item>
|
||||||
|
|
|
@ -681,4 +681,6 @@
|
||||||
<string name="channel_created_by">Created by %s</string>
|
<string name="channel_created_by">Created by %s</string>
|
||||||
<string name="video_detail_by">By %s</string>
|
<string name="video_detail_by">By %s</string>
|
||||||
<string name="playlist_page_summary">Playlist page</string>
|
<string name="playlist_page_summary">Playlist page</string>
|
||||||
|
<string name="show_thumbnail_title">Show thumbnail</string>
|
||||||
|
<string name="show_thumbnail_summary">Show thumbnail on lock screen as background and inside notifications</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -17,6 +17,13 @@
|
||||||
android:title="@string/notification_colorize_title"
|
android:title="@string/notification_colorize_title"
|
||||||
app:iconSpaceReserved="false" />
|
app:iconSpaceReserved="false" />
|
||||||
|
|
||||||
|
<SwitchPreferenceCompat
|
||||||
|
android:defaultValue="true"
|
||||||
|
android:key="@string/show_thumbnail_key"
|
||||||
|
android:title="@string/show_thumbnail_title"
|
||||||
|
android:summary="@string/show_thumbnail_summary"
|
||||||
|
app:iconSpaceReserved="false" />
|
||||||
|
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:layout="@layout/settings_category_header_layout"
|
android:layout="@layout/settings_category_header_layout"
|
||||||
app:iconSpaceReserved="false">
|
app:iconSpaceReserved="false">
|
||||||
|
|
Loading…
Reference in New Issue