Commit 6f6c553f authored by Geoffrey Métais's avatar Geoffrey Métais

Option to disable coverArt as lockscreen wallpaper

parent d74653b3
......@@ -375,6 +375,8 @@
<string name="player_touch_disable_all">Disable all Touch controls</string>
<string name="tv_ui_title">Android TV interface</string>
<string name="tv_ui_summary">Change UI to TV adapted theme</string>
<string name="lockscreen_cover_title">Media cover on Lockscreen</string>
<string name="lockscreen_cover_summary">When available, set the current media cover art as lockscreen wallpaper</string>
<!--Accessibility-->
<string name="more_actions">More Actions</string>
......
......@@ -28,6 +28,11 @@
android:title="@string/player_touch_title"
android:entries="@array/touch_entries"
android:entryValues="@array/touch_values"/>
<CheckBoxPreference
android:defaultValue="true"
android:key="lockscreen_cover"
android:summary="@string/lockscreen_cover_summary"
android:title="@string/lockscreen_cover_title" />
<CheckBoxPreference
android:defaultValue="false"
android:key="dialog_confirm_resume"
......
......@@ -839,11 +839,14 @@ public class PlaybackService extends Service implements IVLCVout.Callback {
if (mMediaPlayer.getVLCVout().areViewsAttached())
return;
try {
boolean coverOnLockscreen = mSettings.getBoolean("lockscreen_cover", true);
MediaMetadataCompat metaData = mMediaSession.getController().getMetadata();
String title = metaData.getString(MediaMetadataCompat.METADATA_KEY_TITLE);
String artist = metaData.getString(MediaMetadataCompat.METADATA_KEY_ALBUM_ARTIST);
String album = metaData.getString(MediaMetadataCompat.METADATA_KEY_ALBUM);
Bitmap cover = metaData.getBitmap(MediaMetadataCompat.METADATA_KEY_ALBUM_ART);
Bitmap cover = coverOnLockscreen ?
metaData.getBitmap(MediaMetadataCompat.METADATA_KEY_ALBUM_ART) :
AudioUtil.getCover(this, getCurrentMedia(), 512);
if (cover == null)
cover = BitmapFactory.decodeResource(VLCApplication.getAppContext().getResources(), R.drawable.icon);
Notification notification;
......@@ -1118,7 +1121,7 @@ public class PlaybackService extends Service implements IVLCVout.Callback {
String title = media.getNowPlaying();
if (title == null)
title = media.getTitle();
Bitmap cover = AudioUtil.getCover(this, media, 512);
boolean coverOnLockscreen = mSettings.getBoolean("lockscreen_cover", true);
MediaMetadataCompat.Builder bob = new MediaMetadataCompat.Builder();
bob.putString(MediaMetadataCompat.METADATA_KEY_TITLE, title)
.putString(MediaMetadataCompat.METADATA_KEY_GENRE, MediaUtils.getMediaGenre(this, media))
......@@ -1126,8 +1129,11 @@ public class PlaybackService extends Service implements IVLCVout.Callback {
.putString(MediaMetadataCompat.METADATA_KEY_ALBUM_ARTIST, MediaUtils.getMediaReferenceArtist(this, media))
.putString(MediaMetadataCompat.METADATA_KEY_ALBUM, MediaUtils.getMediaAlbum(this, media))
.putLong(MediaMetadataCompat.METADATA_KEY_DURATION, media.getLength());
if (cover != null && cover.getConfig() != null) //In case of format not supported
if (coverOnLockscreen) {
Bitmap cover = AudioUtil.getCover(this, media, 512);
if (cover != null && cover.getConfig() != null) //In case of format not supported
bob.putBitmap(MediaMetadataCompat.METADATA_KEY_ALBUM_ART, cover.copy(cover.getConfig(), false));
}
mMediaSession.setMetadata(bob.build());
//Send metadata to Pebble watch
......
......@@ -29,7 +29,6 @@ import android.os.Bundle;
import android.support.v7.preference.Preference;
import android.support.v7.preference.TwoStatePreference;
import org.videolan.libvlc.util.AndroidUtil;
import org.videolan.vlc.PlaybackService;
import org.videolan.vlc.R;
import org.videolan.vlc.util.AndroidDevices;
......@@ -59,6 +58,7 @@ public class PreferencesUi extends BasePreferenceFragment {
findPreference("enable_steal_remote_control").setVisible(false);
findPreference(KEY_ENABLE_TOUCH_PLAYER).setVisible(AndroidDevices.hasTsp());
findPreference("tv_ui").setVisible(AndroidDevices.hasTsp());
findPreference("lockscreen_cover").setVisible(false);
}
@Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment