Remove 'set lockscreen background' setting (#6385)
Users disable the setting and then wonder why other apps (like Android Auto) do not display the cover image, even though it says so in the setting summary.
This commit is contained in:
parent
d5321a147b
commit
8c9b61e599
|
@ -73,12 +73,6 @@
|
|||
android:key="prefCompactNotificationButtons"
|
||||
android:summary="@string/pref_compact_notification_buttons_sum"
|
||||
android:title="@string/pref_compact_notification_buttons_title"/>
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="true"
|
||||
android:enabled="true"
|
||||
android:key="prefLockscreenBackground"
|
||||
android:summary="@string/pref_lockscreen_background_sum"
|
||||
android:title="@string/pref_lockscreen_background_title"/>
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory android:title="@string/behavior">
|
||||
<de.danoeh.antennapod.preferences.MaterialListPreference
|
||||
|
|
|
@ -13,7 +13,6 @@ import android.content.ContentResolver;
|
|||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.media.AudioManager;
|
||||
import android.net.Uri;
|
||||
|
@ -43,7 +42,6 @@ import androidx.annotation.StringRes;
|
|||
import androidx.core.app.NotificationCompat;
|
||||
import androidx.core.app.NotificationManagerCompat;
|
||||
import androidx.media.MediaBrowserServiceCompat;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import de.danoeh.antennapod.core.service.QuickSettingsTileService;
|
||||
import de.danoeh.antennapod.core.util.playback.PlayableUtils;
|
||||
|
@ -221,9 +219,6 @@ public class PlaybackService extends MediaBrowserServiceCompat {
|
|||
EventBus.getDefault().register(this);
|
||||
taskManager = new PlaybackServiceTaskManager(this, taskManagerCallback);
|
||||
|
||||
PreferenceManager.getDefaultSharedPreferences(this)
|
||||
.registerOnSharedPreferenceChangeListener(prefListener);
|
||||
|
||||
recreateMediaSessionIfNeeded();
|
||||
castStateListener = new CastStateListener(this) {
|
||||
@Override
|
||||
|
@ -302,7 +297,6 @@ public class PlaybackService extends MediaBrowserServiceCompat {
|
|||
castStateListener.destroy();
|
||||
|
||||
cancelPositionObserver();
|
||||
PreferenceManager.getDefaultSharedPreferences(this).unregisterOnSharedPreferenceChangeListener(prefListener);
|
||||
if (mediaSession != null) {
|
||||
mediaSession.release();
|
||||
mediaSession = null;
|
||||
|
@ -1244,11 +1238,25 @@ public class PlaybackService extends MediaBrowserServiceCompat {
|
|||
builder.putString(MediaMetadataCompat.METADATA_KEY_DISPLAY_TITLE, p.getEpisodeTitle());
|
||||
builder.putString(MediaMetadataCompat.METADATA_KEY_DISPLAY_SUBTITLE, p.getFeedTitle());
|
||||
|
||||
if (UserPreferences.setLockscreenBackground() && notificationBuilder.isIconCached()) {
|
||||
|
||||
if (notificationBuilder.isIconCached()) {
|
||||
builder.putBitmap(MediaMetadataCompat.METADATA_KEY_ART, notificationBuilder.getCachedIcon());
|
||||
} else if (isCasting && !TextUtils.isEmpty(p.getImageLocation())) {
|
||||
// In the absence of metadata art, the controller dialog takes care of creating it.
|
||||
builder.putString(MediaMetadataCompat.METADATA_KEY_DISPLAY_ICON_URI, p.getImageLocation());
|
||||
} else {
|
||||
String iconUri = p.getImageLocation();
|
||||
if (p instanceof FeedMedia) { // Don't use embedded cover etc, which Android can't load
|
||||
FeedMedia m = (FeedMedia) p;
|
||||
if (m.getItem() != null) {
|
||||
FeedItem item = m.getItem();
|
||||
if (item.getImageUrl() != null) {
|
||||
iconUri = item.getImageUrl();
|
||||
} else if (item.getFeed() != null) {
|
||||
iconUri = item.getFeed().getImageUrl();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!TextUtils.isEmpty(iconUri)) {
|
||||
builder.putString(MediaMetadataCompat.METADATA_KEY_DISPLAY_ICON_URI, iconUri);
|
||||
}
|
||||
}
|
||||
|
||||
if (stateManager.hasReceivedValidStartCommand()) {
|
||||
|
@ -1820,11 +1828,4 @@ public class PlaybackService extends MediaBrowserServiceCompat {
|
|||
}
|
||||
}
|
||||
};
|
||||
|
||||
private final SharedPreferences.OnSharedPreferenceChangeListener prefListener =
|
||||
(sharedPreferences, key) -> {
|
||||
if (UserPreferences.PREF_LOCKSCREEN_BACKGROUND.equals(key)) {
|
||||
updateNotificationAndMediaSession(getPlayable());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -55,7 +55,6 @@ public class UserPreferences {
|
|||
public static final String PREF_SHOW_TIME_LEFT = "showTimeLeft";
|
||||
private static final String PREF_PERSISTENT_NOTIFICATION = "prefPersistNotify";
|
||||
public static final String PREF_COMPACT_NOTIFICATION_BUTTONS = "prefCompactNotificationButtons";
|
||||
public static final String PREF_LOCKSCREEN_BACKGROUND = "prefLockscreenBackground";
|
||||
private static final String PREF_SHOW_DOWNLOAD_REPORT = "prefShowDownloadReport";
|
||||
private static final String PREF_SHOW_AUTO_DOWNLOAD_REPORT = "prefShowAutoDownloadReport";
|
||||
public static final String PREF_DEFAULT_PAGE = "prefDefaultPage";
|
||||
|
@ -291,15 +290,6 @@ public class UserPreferences {
|
|||
return prefs.getBoolean(PREF_PERSISTENT_NOTIFICATION, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the lockscreen background should be set to the current episode's image
|
||||
*
|
||||
* @return {@code true} if the lockscreen background should be set, {@code false} otherwise
|
||||
*/
|
||||
public static boolean setLockscreenBackground() {
|
||||
return prefs.getBoolean(PREF_LOCKSCREEN_BACKGROUND, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if download reports are shown
|
||||
*
|
||||
|
|
|
@ -485,8 +485,6 @@
|
|||
<string name="pref_compact_notification_buttons_sum">Change the playback buttons when the notification is collapsed. The play/pause button is always included.</string>
|
||||
<string name="pref_compact_notification_buttons_dialog_title">Select a maximum of %1$d items</string>
|
||||
<string name="pref_compact_notification_buttons_dialog_error">You can only select a maximum of %1$d items.</string>
|
||||
<string name="pref_lockscreen_background_title">Set Lockscreen Background</string>
|
||||
<string name="pref_lockscreen_background_sum">Set the lockscreen background to the current episode\'s image. As a side effect, this will also show the image in third party apps.</string>
|
||||
<string name="pref_enqueue_location_title">Enqueue Location</string>
|
||||
<string name="pref_enqueue_location_sum">Add episodes to: %1$s</string>
|
||||
<string name="enqueue_location_back">Back</string>
|
||||
|
|
Loading…
Reference in New Issue