Remove interface ImageResource (#4911)
This commit is contained in:
parent
bbbf9cdf23
commit
1cd680a2af
|
@ -337,7 +337,7 @@ public class NavListAdapter extends BaseAdapter
|
||||||
}
|
}
|
||||||
|
|
||||||
Glide.with(context)
|
Glide.with(context)
|
||||||
.load(feed.getImageLocation())
|
.load(feed.getImageUrl())
|
||||||
.apply(new RequestOptions()
|
.apply(new RequestOptions()
|
||||||
.placeholder(R.color.light_gray)
|
.placeholder(R.color.light_gray)
|
||||||
.error(R.color.light_gray)
|
.error(R.color.light_gray)
|
||||||
|
|
|
@ -66,7 +66,7 @@ public abstract class StatisticsListAdapter extends RecyclerView.Adapter<Recycle
|
||||||
StatisticsHolder holder = (StatisticsHolder) h;
|
StatisticsHolder holder = (StatisticsHolder) h;
|
||||||
StatisticsItem statsItem = statisticsData.get(position - 1);
|
StatisticsItem statsItem = statisticsData.get(position - 1);
|
||||||
Glide.with(context)
|
Glide.with(context)
|
||||||
.load(statsItem.feed.getImageLocation())
|
.load(statsItem.feed.getImageUrl())
|
||||||
.apply(new RequestOptions()
|
.apply(new RequestOptions()
|
||||||
.placeholder(R.color.light_gray)
|
.placeholder(R.color.light_gray)
|
||||||
.error(R.color.light_gray)
|
.error(R.color.light_gray)
|
||||||
|
|
|
@ -108,7 +108,7 @@ public class SubscriptionsAdapter extends BaseAdapter implements AdapterView.OnI
|
||||||
boolean textAndImageCombined = feed.isLocalFeed()
|
boolean textAndImageCombined = feed.isLocalFeed()
|
||||||
&& LocalFeedUpdater.getDefaultIconUrl(convertView.getContext()).equals(feed.getImageUrl());
|
&& LocalFeedUpdater.getDefaultIconUrl(convertView.getContext()).equals(feed.getImageUrl());
|
||||||
new CoverLoader(mainActivityRef.get())
|
new CoverLoader(mainActivityRef.get())
|
||||||
.withUri(feed.getImageLocation())
|
.withUri(feed.getImageUrl())
|
||||||
.withPlaceholderView(holder.feedTitle, textAndImageCombined)
|
.withPlaceholderView(holder.feedTitle, textAndImageCombined)
|
||||||
.withCoverView(holder.imageView)
|
.withCoverView(holder.imageView)
|
||||||
.load();
|
.load();
|
||||||
|
|
|
@ -158,7 +158,7 @@ public class CoverFragment extends Fragment {
|
||||||
new RoundedCorners((int) (16 * getResources().getDisplayMetrics().density)));
|
new RoundedCorners((int) (16 * getResources().getDisplayMetrics().density)));
|
||||||
|
|
||||||
RequestBuilder<Drawable> cover = Glide.with(this)
|
RequestBuilder<Drawable> cover = Glide.with(this)
|
||||||
.load(ImageResourceUtils.getEpisodeImageLocation(media))
|
.load(media.getImageLocation())
|
||||||
.error(Glide.with(this)
|
.error(Glide.with(this)
|
||||||
.load(ImageResourceUtils.getFallbackImageLocation(media))
|
.load(ImageResourceUtils.getFallbackImageLocation(media))
|
||||||
.apply(options))
|
.apply(options))
|
||||||
|
|
|
@ -203,7 +203,7 @@ public class FeedInfoFragment extends Fragment implements Toolbar.OnMenuItemClic
|
||||||
Log.d(TAG, "Author is " + feed.getAuthor());
|
Log.d(TAG, "Author is " + feed.getAuthor());
|
||||||
Log.d(TAG, "URL is " + feed.getDownload_url());
|
Log.d(TAG, "URL is " + feed.getDownload_url());
|
||||||
Glide.with(getContext())
|
Glide.with(getContext())
|
||||||
.load(feed.getImageLocation())
|
.load(feed.getImageUrl())
|
||||||
.apply(new RequestOptions()
|
.apply(new RequestOptions()
|
||||||
.placeholder(R.color.light_gray)
|
.placeholder(R.color.light_gray)
|
||||||
.error(R.color.light_gray)
|
.error(R.color.light_gray)
|
||||||
|
@ -212,7 +212,7 @@ public class FeedInfoFragment extends Fragment implements Toolbar.OnMenuItemClic
|
||||||
.dontAnimate())
|
.dontAnimate())
|
||||||
.into(imgvCover);
|
.into(imgvCover);
|
||||||
Glide.with(getContext())
|
Glide.with(getContext())
|
||||||
.load(feed.getImageLocation())
|
.load(feed.getImageUrl())
|
||||||
.apply(new RequestOptions()
|
.apply(new RequestOptions()
|
||||||
.placeholder(R.color.image_readability_tint)
|
.placeholder(R.color.image_readability_tint)
|
||||||
.error(R.color.image_readability_tint)
|
.error(R.color.image_readability_tint)
|
||||||
|
|
|
@ -521,7 +521,7 @@ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItem
|
||||||
|
|
||||||
private void loadFeedImage() {
|
private void loadFeedImage() {
|
||||||
Glide.with(getActivity())
|
Glide.with(getActivity())
|
||||||
.load(feed.getImageLocation())
|
.load(feed.getImageUrl())
|
||||||
.apply(new RequestOptions()
|
.apply(new RequestOptions()
|
||||||
.placeholder(R.color.image_readability_tint)
|
.placeholder(R.color.image_readability_tint)
|
||||||
.error(R.color.image_readability_tint)
|
.error(R.color.image_readability_tint)
|
||||||
|
@ -531,7 +531,7 @@ public class FeedItemlistFragment extends Fragment implements AdapterView.OnItem
|
||||||
.into(imgvBackground);
|
.into(imgvBackground);
|
||||||
|
|
||||||
Glide.with(getActivity())
|
Glide.with(getActivity())
|
||||||
.load(feed.getImageLocation())
|
.load(feed.getImageUrl())
|
||||||
.apply(new RequestOptions()
|
.apply(new RequestOptions()
|
||||||
.placeholder(R.color.light_gray)
|
.placeholder(R.color.light_gray)
|
||||||
.error(R.color.light_gray)
|
.error(R.color.light_gray)
|
||||||
|
|
|
@ -304,7 +304,7 @@ public class ItemFragment extends Fragment {
|
||||||
.dontAnimate();
|
.dontAnimate();
|
||||||
|
|
||||||
Glide.with(getActivity())
|
Glide.with(getActivity())
|
||||||
.load(ImageResourceUtils.getEpisodeImageLocation(item))
|
.load(item.getImageLocation())
|
||||||
.error(Glide.with(getActivity())
|
.error(Glide.with(getActivity())
|
||||||
.load(ImageResourceUtils.getFallbackImageLocation(item))
|
.load(ImageResourceUtils.getFallbackImageLocation(item))
|
||||||
.apply(options))
|
.apply(options))
|
||||||
|
|
|
@ -122,7 +122,7 @@ public class EpisodeItemViewHolder extends RecyclerView.ViewHolder {
|
||||||
if (coverHolder.getVisibility() == View.VISIBLE) {
|
if (coverHolder.getVisibility() == View.VISIBLE) {
|
||||||
new CoverLoader(activity)
|
new CoverLoader(activity)
|
||||||
.withUri(ImageResourceUtils.getEpisodeListImageLocation(item))
|
.withUri(ImageResourceUtils.getEpisodeListImageLocation(item))
|
||||||
.withFallbackUri(item.getFeed().getImageLocation())
|
.withFallbackUri(item.getFeed().getImageUrl())
|
||||||
.withPlaceholderView(placeholder)
|
.withPlaceholderView(placeholder)
|
||||||
.withCoverView(cover)
|
.withCoverView(cover)
|
||||||
.load();
|
.load();
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
package de.danoeh.antennapod.core.asynctask;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Classes that implement this interface provide access to an image resource that can
|
|
||||||
* be loaded by the Picasso library.
|
|
||||||
*/
|
|
||||||
public interface ImageResource {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the location of the image or null if no image is available.
|
|
||||||
* <p/>
|
|
||||||
* The location can either be an URL or a local path
|
|
||||||
*/
|
|
||||||
String getImageLocation();
|
|
||||||
}
|
|
|
@ -9,7 +9,6 @@ import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import de.danoeh.antennapod.core.asynctask.ImageResource;
|
|
||||||
import de.danoeh.antennapod.core.storage.DBWriter;
|
import de.danoeh.antennapod.core.storage.DBWriter;
|
||||||
import de.danoeh.antennapod.core.storage.PodDBAdapter;
|
import de.danoeh.antennapod.core.storage.PodDBAdapter;
|
||||||
import de.danoeh.antennapod.core.util.SortOrder;
|
import de.danoeh.antennapod.core.util.SortOrder;
|
||||||
|
@ -19,7 +18,7 @@ import de.danoeh.antennapod.core.util.SortOrder;
|
||||||
*
|
*
|
||||||
* @author daniel
|
* @author daniel
|
||||||
*/
|
*/
|
||||||
public class Feed extends FeedFile implements ImageResource {
|
public class Feed extends FeedFile {
|
||||||
|
|
||||||
public static final int FEEDFILETYPE_FEED = 0;
|
public static final int FEEDFILETYPE_FEED = 0;
|
||||||
public static final String TYPE_RSS2 = "rss";
|
public static final String TYPE_RSS2 = "rss";
|
||||||
|
@ -491,11 +490,6 @@ public class Feed extends FeedFile implements ImageResource {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getImageLocation() {
|
|
||||||
return imageUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getPageNr() {
|
public int getPageNr() {
|
||||||
return pageNr;
|
return pageNr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,6 @@ import java.util.Set;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import de.danoeh.antennapod.core.asynctask.ImageResource;
|
|
||||||
import de.danoeh.antennapod.core.storage.DBReader;
|
import de.danoeh.antennapod.core.storage.DBReader;
|
||||||
import de.danoeh.antennapod.core.storage.PodDBAdapter;
|
import de.danoeh.antennapod.core.storage.PodDBAdapter;
|
||||||
import de.danoeh.antennapod.core.util.ShownotesProvider;
|
import de.danoeh.antennapod.core.util.ShownotesProvider;
|
||||||
|
@ -27,7 +26,7 @@ import de.danoeh.antennapod.core.util.ShownotesProvider;
|
||||||
*
|
*
|
||||||
* @author daniel
|
* @author daniel
|
||||||
*/
|
*/
|
||||||
public class FeedItem extends FeedComponent implements ShownotesProvider, ImageResource, Serializable {
|
public class FeedItem extends FeedComponent implements ShownotesProvider, Serializable {
|
||||||
|
|
||||||
/** tag that indicates this item is in the queue */
|
/** tag that indicates this item is in the queue */
|
||||||
public static final String TAG_QUEUE = "Queue";
|
public static final String TAG_QUEUE = "Queue";
|
||||||
|
@ -376,14 +375,13 @@ public class FeedItem extends FeedComponent implements ShownotesProvider, ImageR
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getImageLocation() {
|
public String getImageLocation() {
|
||||||
if (imageUrl != null) {
|
if (imageUrl != null) {
|
||||||
return imageUrl;
|
return imageUrl;
|
||||||
} else if (media != null && media.hasEmbeddedPicture()) {
|
} else if (media != null && media.hasEmbeddedPicture()) {
|
||||||
return FeedMedia.FILENAME_PREFIX_EMBEDDED_COVER + media.getLocalMediaUrl();
|
return FeedMedia.FILENAME_PREFIX_EMBEDDED_COVER + media.getLocalMediaUrl();
|
||||||
} else if (feed != null) {
|
} else if (feed != null) {
|
||||||
return feed.getImageLocation();
|
return feed.getImageUrl();
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -175,8 +175,8 @@ public class FeedMedia extends FeedFile implements Playable {
|
||||||
// getImageLocation() also loads embedded images, which we can not send to external devices
|
// getImageLocation() also loads embedded images, which we can not send to external devices
|
||||||
if (item.getImageUrl() != null) {
|
if (item.getImageUrl() != null) {
|
||||||
builder.setIconUri(Uri.parse(item.getImageUrl()));
|
builder.setIconUri(Uri.parse(item.getImageUrl()));
|
||||||
} else if (item.getFeed() != null && item.getFeed().getImageLocation() != null) {
|
} else if (item.getFeed() != null && item.getFeed().getImageUrl() != null) {
|
||||||
builder.setIconUri(Uri.parse(item.getFeed().getImageLocation()));
|
builder.setIconUri(Uri.parse(item.getFeed().getImageUrl()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new MediaBrowserCompat.MediaItem(builder.build(), MediaBrowserCompat.MediaItem.FLAG_PLAYABLE);
|
return new MediaBrowserCompat.MediaItem(builder.build(), MediaBrowserCompat.MediaItem.FLAG_PLAYABLE);
|
||||||
|
|
|
@ -1,12 +1,15 @@
|
||||||
package de.danoeh.antennapod.core.feed.util;
|
package de.danoeh.antennapod.core.feed.util;
|
||||||
|
|
||||||
import de.danoeh.antennapod.core.asynctask.ImageResource;
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import de.danoeh.antennapod.core.feed.FeedItem;
|
import de.danoeh.antennapod.core.feed.FeedItem;
|
||||||
import de.danoeh.antennapod.core.feed.FeedMedia;
|
import de.danoeh.antennapod.core.feed.FeedMedia;
|
||||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||||
|
import de.danoeh.antennapod.core.util.playback.Playable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility class to use the appropriate image resource based on {@link UserPreferences}
|
* Utility class to use the appropriate image resource based on {@link UserPreferences}.
|
||||||
*/
|
*/
|
||||||
public final class ImageResourceUtils {
|
public final class ImageResourceUtils {
|
||||||
|
|
||||||
|
@ -14,48 +17,50 @@ public final class ImageResourceUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns the image location, does prefer the episode cover if available.
|
* returns the image location, does prefer the episode cover if available and enabled in settings.
|
||||||
*/
|
*/
|
||||||
public static String getEpisodeImageLocation(ImageResource resource) {
|
@Nullable
|
||||||
return resource.getImageLocation();
|
public static String getEpisodeListImageLocation(@NonNull Playable playable) {
|
||||||
|
if (UserPreferences.getUseEpisodeCoverSetting()) {
|
||||||
|
return playable.getImageLocation();
|
||||||
|
} else {
|
||||||
|
return getFallbackImageLocation(playable);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns the image location, does prefer the episode cover if available and enabled in settings.
|
* returns the image location, does prefer the episode cover if available and enabled in settings.
|
||||||
*/
|
*/
|
||||||
public static String getEpisodeListImageLocation(ImageResource resource) {
|
@Nullable
|
||||||
|
public static String getEpisodeListImageLocation(@NonNull FeedItem feedItem) {
|
||||||
if (UserPreferences.getUseEpisodeCoverSetting()) {
|
if (UserPreferences.getUseEpisodeCoverSetting()) {
|
||||||
return resource.getImageLocation();
|
return feedItem.getImageLocation();
|
||||||
} else {
|
} else {
|
||||||
return getShowImageLocation(resource);
|
return getFallbackImageLocation(feedItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getFallbackImageLocation(ImageResource resource) {
|
@Nullable
|
||||||
return getShowImageLocation(resource);
|
public static String getFallbackImageLocation(@NonNull Playable playable) {
|
||||||
}
|
if (playable instanceof FeedMedia) {
|
||||||
|
FeedMedia media = (FeedMedia) playable;
|
||||||
private static String getShowImageLocation(ImageResource resource) {
|
|
||||||
|
|
||||||
if (resource instanceof FeedItem) {
|
|
||||||
FeedItem item = (FeedItem) resource;
|
|
||||||
if (item.getFeed() != null) {
|
|
||||||
return item.getFeed().getImageLocation();
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
} else if (resource instanceof FeedMedia) {
|
|
||||||
FeedMedia media = (FeedMedia) resource;
|
|
||||||
FeedItem item = media.getItem();
|
FeedItem item = media.getItem();
|
||||||
if (item != null && item.getFeed() != null) {
|
if (item != null && item.getFeed() != null) {
|
||||||
return item.getFeed().getImageLocation();
|
return item.getFeed().getImageUrl();
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return resource.getImageLocation();
|
return playable.getImageLocation();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public static String getFallbackImageLocation(@NonNull FeedItem feedItem) {
|
||||||
|
if (feedItem.getFeed() != null) {
|
||||||
|
return feedItem.getFeed().getImageUrl();
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,6 @@ import com.bumptech.glide.request.RequestOptions;
|
||||||
import de.danoeh.antennapod.core.R;
|
import de.danoeh.antennapod.core.R;
|
||||||
import de.danoeh.antennapod.core.feed.Feed;
|
import de.danoeh.antennapod.core.feed.Feed;
|
||||||
import de.danoeh.antennapod.core.feed.FeedPreferences;
|
import de.danoeh.antennapod.core.feed.FeedPreferences;
|
||||||
import de.danoeh.antennapod.core.feed.util.ImageResourceUtils;
|
|
||||||
import de.danoeh.antennapod.core.glide.ApGlideSettings;
|
import de.danoeh.antennapod.core.glide.ApGlideSettings;
|
||||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||||
import de.danoeh.antennapod.core.storage.PodDBAdapter;
|
import de.danoeh.antennapod.core.storage.PodDBAdapter;
|
||||||
|
@ -113,7 +112,7 @@ public class NewEpisodesNotification {
|
||||||
try {
|
try {
|
||||||
return Glide.with(context)
|
return Glide.with(context)
|
||||||
.asBitmap()
|
.asBitmap()
|
||||||
.load(ImageResourceUtils.getEpisodeListImageLocation(feed))
|
.load(feed.getImageUrl())
|
||||||
.apply(RequestOptions.diskCacheStrategyOf(ApGlideSettings.AP_DISK_CACHE_STRATEGY))
|
.apply(RequestOptions.diskCacheStrategyOf(ApGlideSettings.AP_DISK_CACHE_STRATEGY))
|
||||||
.apply(new RequestOptions().centerCrop())
|
.apply(new RequestOptions().centerCrop())
|
||||||
.submit(iconSize, iconSize)
|
.submit(iconSize, iconSize)
|
||||||
|
|
|
@ -409,8 +409,8 @@ public class PlaybackService extends MediaBrowserServiceCompat {
|
||||||
.setTitle(feed.getTitle())
|
.setTitle(feed.getTitle())
|
||||||
.setDescription(feed.getDescription())
|
.setDescription(feed.getDescription())
|
||||||
.setSubtitle(feed.getCustomTitle());
|
.setSubtitle(feed.getCustomTitle());
|
||||||
if (feed.getImageLocation() != null) {
|
if (feed.getImageUrl() != null) {
|
||||||
builder.setIconUri(Uri.parse(feed.getImageLocation()));
|
builder.setIconUri(Uri.parse(feed.getImageUrl()));
|
||||||
}
|
}
|
||||||
if (feed.getLink() != null) {
|
if (feed.getLink() != null) {
|
||||||
builder.setMediaUri(Uri.parse(feed.getLink()));
|
builder.setMediaUri(Uri.parse(feed.getLink()));
|
||||||
|
@ -1306,7 +1306,7 @@ public class PlaybackService extends MediaBrowserServiceCompat {
|
||||||
builder.putString(MediaMetadataCompat.METADATA_KEY_DISPLAY_TITLE, p.getEpisodeTitle());
|
builder.putString(MediaMetadataCompat.METADATA_KEY_DISPLAY_TITLE, p.getEpisodeTitle());
|
||||||
builder.putString(MediaMetadataCompat.METADATA_KEY_DISPLAY_SUBTITLE, p.getFeedTitle());
|
builder.putString(MediaMetadataCompat.METADATA_KEY_DISPLAY_SUBTITLE, p.getFeedTitle());
|
||||||
|
|
||||||
String imageLocation = ImageResourceUtils.getEpisodeImageLocation(p);
|
String imageLocation = p.getImageLocation();
|
||||||
|
|
||||||
if (!TextUtils.isEmpty(imageLocation)) {
|
if (!TextUtils.isEmpty(imageLocation)) {
|
||||||
if (UserPreferences.setLockscreenBackground()) {
|
if (UserPreferences.setLockscreenBackground()) {
|
||||||
|
|
|
@ -75,7 +75,7 @@ public class PlaybackServiceNotificationBuilder {
|
||||||
try {
|
try {
|
||||||
icon = Glide.with(context)
|
icon = Glide.with(context)
|
||||||
.asBitmap()
|
.asBitmap()
|
||||||
.load(ImageResourceUtils.getEpisodeImageLocation(playable))
|
.load(playable.getImageLocation())
|
||||||
.apply(RequestOptions.diskCacheStrategyOf(ApGlideSettings.AP_DISK_CACHE_STRATEGY))
|
.apply(RequestOptions.diskCacheStrategyOf(ApGlideSettings.AP_DISK_CACHE_STRATEGY))
|
||||||
.apply(new RequestOptions().centerCrop())
|
.apply(new RequestOptions().centerCrop())
|
||||||
.submit(iconSize, iconSize)
|
.submit(iconSize, iconSize)
|
||||||
|
|
|
@ -6,7 +6,6 @@ import android.os.Parcelable;
|
||||||
import androidx.preference.PreferenceManager;
|
import androidx.preference.PreferenceManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import de.danoeh.antennapod.core.asynctask.ImageResource;
|
|
||||||
import de.danoeh.antennapod.core.feed.Chapter;
|
import de.danoeh.antennapod.core.feed.Chapter;
|
||||||
import de.danoeh.antennapod.core.feed.FeedMedia;
|
import de.danoeh.antennapod.core.feed.FeedMedia;
|
||||||
import de.danoeh.antennapod.core.feed.MediaType;
|
import de.danoeh.antennapod.core.feed.MediaType;
|
||||||
|
@ -19,8 +18,7 @@ import java.util.List;
|
||||||
/**
|
/**
|
||||||
* Interface for objects that can be played by the PlaybackService.
|
* Interface for objects that can be played by the PlaybackService.
|
||||||
*/
|
*/
|
||||||
public interface Playable extends Parcelable,
|
public interface Playable extends Parcelable, ShownotesProvider {
|
||||||
ShownotesProvider, ImageResource {
|
|
||||||
public static final int INVALID_TIME = -1;
|
public static final int INVALID_TIME = -1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -177,6 +175,14 @@ public interface Playable extends Parcelable,
|
||||||
|
|
||||||
void setChapters(List<Chapter> chapters);
|
void setChapters(List<Chapter> chapters);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the location of the image or null if no image is available.
|
||||||
|
* This can be the feed item image URL, the local embedded media image path, the feed image URL,
|
||||||
|
* or the remote media image URL, depending on what's available.
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
String getImageLocation();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides utility methods for Playable objects.
|
* Provides utility methods for Playable objects.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -90,7 +90,7 @@ public abstract class WidgetUpdater {
|
||||||
try {
|
try {
|
||||||
icon = Glide.with(context)
|
icon = Glide.with(context)
|
||||||
.asBitmap()
|
.asBitmap()
|
||||||
.load(ImageResourceUtils.getEpisodeImageLocation(widgetState.media))
|
.load(widgetState.media.getImageLocation())
|
||||||
.apply(RequestOptions.diskCacheStrategyOf(ApGlideSettings.AP_DISK_CACHE_STRATEGY))
|
.apply(RequestOptions.diskCacheStrategyOf(ApGlideSettings.AP_DISK_CACHE_STRATEGY))
|
||||||
.submit(iconSize, iconSize)
|
.submit(iconSize, iconSize)
|
||||||
.get(500, TimeUnit.MILLISECONDS);
|
.get(500, TimeUnit.MILLISECONDS);
|
||||||
|
|
Loading…
Reference in New Issue