Merge pull request #1071 from TomHennen/cacheallimages
Cache all images (should reduce lag displaying lists of episodes)
This commit is contained in:
commit
b332942f16
|
@ -42,6 +42,7 @@ import de.danoeh.antennapod.core.feed.EventDistributor;
|
|||
import de.danoeh.antennapod.core.feed.Feed;
|
||||
import de.danoeh.antennapod.core.feed.MediaType;
|
||||
import de.danoeh.antennapod.core.feed.SimpleChapter;
|
||||
import de.danoeh.antennapod.core.glide.ApGlideSettings;
|
||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.core.service.playback.PlaybackService;
|
||||
import de.danoeh.antennapod.core.storage.DBReader;
|
||||
|
@ -561,7 +562,7 @@ public class AudioplayerActivity extends MediaplayerActivity implements ItemDesc
|
|||
.load(media.getImageUri())
|
||||
.placeholder(R.color.light_gray)
|
||||
.error(R.color.light_gray)
|
||||
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.fitCenter()
|
||||
.dontAnimate()
|
||||
.into(butShowCover);
|
||||
|
|
|
@ -37,6 +37,7 @@ import de.danoeh.antennapod.core.dialog.DownloadRequestErrorDialogCreator;
|
|||
import de.danoeh.antennapod.core.feed.EventDistributor;
|
||||
import de.danoeh.antennapod.core.feed.Feed;
|
||||
import de.danoeh.antennapod.core.feed.FeedItem;
|
||||
import de.danoeh.antennapod.core.glide.ApGlideSettings;
|
||||
import de.danoeh.antennapod.core.storage.DBReader;
|
||||
import de.danoeh.antennapod.core.storage.DownloadRequestException;
|
||||
import de.danoeh.antennapod.core.storage.DownloadRequester;
|
||||
|
@ -129,7 +130,7 @@ public class DefaultOnlineFeedViewActivity extends OnlineFeedViewActivity {
|
|||
.load(feed.getImage().getDownload_url())
|
||||
.placeholder(R.color.light_gray)
|
||||
.error(R.color.light_gray)
|
||||
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.fitCenter()
|
||||
.dontAnimate()
|
||||
.into(cover);
|
||||
|
|
|
@ -34,6 +34,7 @@ import de.danoeh.antennapod.core.dialog.ConfirmationDialog;
|
|||
import de.danoeh.antennapod.core.dialog.DownloadRequestErrorDialogCreator;
|
||||
import de.danoeh.antennapod.core.feed.Feed;
|
||||
import de.danoeh.antennapod.core.feed.FeedPreferences;
|
||||
import de.danoeh.antennapod.core.glide.ApGlideSettings;
|
||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.core.storage.DBReader;
|
||||
import de.danoeh.antennapod.core.storage.DBWriter;
|
||||
|
@ -129,7 +130,7 @@ public class FeedInfoActivity extends ActionBarActivity {
|
|||
.load(feed.getImageUri())
|
||||
.placeholder(R.color.light_gray)
|
||||
.error(R.color.light_gray)
|
||||
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.fitCenter()
|
||||
.dontAnimate()
|
||||
.into(imgvCover);
|
||||
|
|
|
@ -24,6 +24,7 @@ import java.lang.ref.WeakReference;
|
|||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.core.feed.FeedItem;
|
||||
import de.danoeh.antennapod.core.feed.FeedMedia;
|
||||
import de.danoeh.antennapod.core.glide.ApGlideSettings;
|
||||
import de.danoeh.antennapod.core.storage.DownloadRequester;
|
||||
import de.danoeh.antennapod.core.util.Converter;
|
||||
|
||||
|
@ -154,7 +155,7 @@ public class AllEpisodesListAdapter extends BaseAdapter {
|
|||
|
||||
Glide.with(context)
|
||||
.load(item.getImageUri())
|
||||
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.fitCenter()
|
||||
.dontAnimate()
|
||||
.into(new CoverTarget(item.getFeed().getImageUri(), holder.placeholder, holder.cover));
|
||||
|
@ -183,7 +184,7 @@ public class AllEpisodesListAdapter extends BaseAdapter {
|
|||
if(fallbackUri != null && txtvPlaceholder != null && imgvCover != null) {
|
||||
Glide.with(context)
|
||||
.load(fallbackUri)
|
||||
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.fitCenter()
|
||||
.dontAnimate()
|
||||
.into(new CoverTarget(null, txtvPlaceholder, imgvCover));
|
||||
|
|
|
@ -15,6 +15,7 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
|||
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.core.feed.FeedItem;
|
||||
import de.danoeh.antennapod.core.glide.ApGlideSettings;
|
||||
import de.danoeh.antennapod.core.util.Converter;
|
||||
|
||||
/**
|
||||
|
@ -93,7 +94,7 @@ public class DownloadedEpisodesListAdapter extends BaseAdapter {
|
|||
.load(item.getImageUri())
|
||||
.placeholder(R.color.light_gray)
|
||||
.error(R.color.light_gray)
|
||||
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.fitCenter()
|
||||
.dontAnimate()
|
||||
.into(holder.imageView);
|
||||
|
|
|
@ -28,6 +28,7 @@ import java.util.List;
|
|||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.activity.MainActivity;
|
||||
import de.danoeh.antennapod.core.feed.Feed;
|
||||
import de.danoeh.antennapod.core.glide.ApGlideSettings;
|
||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.fragment.AddFeedFragment;
|
||||
import de.danoeh.antennapod.fragment.AllEpisodesFragment;
|
||||
|
@ -264,7 +265,7 @@ public class NavListAdapter extends BaseAdapter
|
|||
.load(feed.getImageUri())
|
||||
.placeholder(R.color.light_gray)
|
||||
.error(R.color.light_gray)
|
||||
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.fitCenter()
|
||||
.dontAnimate()
|
||||
.into(holder.image);
|
||||
|
|
|
@ -25,6 +25,7 @@ import java.lang.ref.WeakReference;
|
|||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.core.feed.FeedItem;
|
||||
import de.danoeh.antennapod.core.feed.FeedMedia;
|
||||
import de.danoeh.antennapod.core.glide.ApGlideSettings;
|
||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.core.storage.DownloadRequester;
|
||||
import de.danoeh.antennapod.core.util.Converter;
|
||||
|
@ -157,7 +158,7 @@ public class QueueListAdapter extends BaseAdapter {
|
|||
|
||||
Glide.with(context)
|
||||
.load(item.getImageUri())
|
||||
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.fitCenter()
|
||||
.dontAnimate()
|
||||
.into(new CoverTarget(item.getFeed().getImageUri(), holder.placeholder, holder.cover));
|
||||
|
@ -186,7 +187,7 @@ public class QueueListAdapter extends BaseAdapter {
|
|||
if(fallbackUri != null && txtvPlaceholder != null && imgvCover != null) {
|
||||
Glide.with(context)
|
||||
.load(fallbackUri)
|
||||
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.fitCenter()
|
||||
.dontAnimate()
|
||||
.into(new CoverTarget(null, txtvPlaceholder, imgvCover));
|
||||
|
|
|
@ -16,6 +16,7 @@ import de.danoeh.antennapod.core.feed.Feed;
|
|||
import de.danoeh.antennapod.core.feed.FeedComponent;
|
||||
import de.danoeh.antennapod.core.feed.FeedItem;
|
||||
import de.danoeh.antennapod.core.feed.SearchResult;
|
||||
import de.danoeh.antennapod.core.glide.ApGlideSettings;
|
||||
|
||||
/**
|
||||
* List adapter for search activity.
|
||||
|
@ -78,7 +79,7 @@ public class SearchlistAdapter extends BaseAdapter {
|
|||
.load(feed.getImageUri())
|
||||
.placeholder(R.color.light_gray)
|
||||
.error(R.color.light_gray)
|
||||
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.fitCenter()
|
||||
.dontAnimate()
|
||||
.into(holder.cover);
|
||||
|
@ -95,7 +96,7 @@ public class SearchlistAdapter extends BaseAdapter {
|
|||
.load(item.getFeed().getImageUri())
|
||||
.placeholder(R.color.light_gray)
|
||||
.error(R.color.light_gray)
|
||||
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.fitCenter()
|
||||
.dontAnimate()
|
||||
.into(holder.cover);
|
||||
|
|
|
@ -16,6 +16,7 @@ import org.apache.commons.lang3.StringUtils;
|
|||
import java.util.List;
|
||||
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.core.glide.ApGlideSettings;
|
||||
import de.danoeh.antennapod.core.gpoddernet.model.GpodnetPodcast;
|
||||
|
||||
/**
|
||||
|
@ -54,7 +55,7 @@ public class PodcastListAdapter extends ArrayAdapter<GpodnetPodcast> {
|
|||
.load(podcast.getLogoUrl())
|
||||
.placeholder(R.color.light_gray)
|
||||
.error(R.color.light_gray)
|
||||
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.fitCenter()
|
||||
.dontAnimate()
|
||||
.into(holder.image);
|
||||
|
|
|
@ -17,6 +17,7 @@ import de.danoeh.antennapod.BuildConfig;
|
|||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.activity.AudioplayerActivity;
|
||||
import de.danoeh.antennapod.activity.AudioplayerActivity.AudioplayerContentFragment;
|
||||
import de.danoeh.antennapod.core.glide.ApGlideSettings;
|
||||
import de.danoeh.antennapod.core.util.playback.Playable;
|
||||
|
||||
/**
|
||||
|
@ -85,7 +86,7 @@ public class CoverFragment extends Fragment implements
|
|||
.load(media.getImageUri())
|
||||
.placeholder(R.color.light_gray)
|
||||
.error(R.color.light_gray)
|
||||
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.dontAnimate()
|
||||
.into(imgvCover);
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ import com.bumptech.glide.Glide;
|
|||
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.core.glide.ApGlideSettings;
|
||||
import de.danoeh.antennapod.core.service.playback.PlaybackService;
|
||||
import de.danoeh.antennapod.core.util.Converter;
|
||||
import de.danoeh.antennapod.core.util.playback.Playable;
|
||||
|
@ -202,7 +203,7 @@ public class ExternalPlayerFragment extends Fragment {
|
|||
.load(media.getImageUri())
|
||||
.placeholder(R.color.light_gray)
|
||||
.error(R.color.light_gray)
|
||||
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.fitCenter()
|
||||
.dontAnimate()
|
||||
.into(imgvCover);
|
||||
|
|
|
@ -49,6 +49,7 @@ import de.danoeh.antennapod.core.feed.EventDistributor;
|
|||
import de.danoeh.antennapod.core.feed.FeedItem;
|
||||
import de.danoeh.antennapod.core.feed.FeedMedia;
|
||||
import de.danoeh.antennapod.core.feed.QueueEvent;
|
||||
import de.danoeh.antennapod.core.glide.ApGlideSettings;
|
||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||
import de.danoeh.antennapod.core.service.download.Downloader;
|
||||
import de.danoeh.antennapod.core.storage.DBReader;
|
||||
|
@ -341,7 +342,7 @@ public class ItemFragment extends Fragment implements LoaderManager.LoaderCallba
|
|||
.load(item.getImageUri())
|
||||
.placeholder(R.color.light_gray)
|
||||
.error(R.color.light_gray)
|
||||
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.fitCenter()
|
||||
.dontAnimate()
|
||||
.into(imgvCover);
|
||||
|
|
|
@ -57,6 +57,7 @@ import de.danoeh.antennapod.core.feed.FeedItem;
|
|||
import de.danoeh.antennapod.core.feed.FeedItemFilter;
|
||||
import de.danoeh.antennapod.core.feed.FeedMedia;
|
||||
import de.danoeh.antennapod.core.feed.QueueEvent;
|
||||
import de.danoeh.antennapod.core.glide.ApGlideSettings;
|
||||
import de.danoeh.antennapod.core.glide.FastBlurTransformation;
|
||||
import de.danoeh.antennapod.core.service.download.DownloadService;
|
||||
import de.danoeh.antennapod.core.service.download.Downloader;
|
||||
|
@ -519,7 +520,7 @@ public class ItemlistFragment extends ListFragment {
|
|||
.load(feed.getImageUri())
|
||||
.placeholder(R.color.image_readability_tint)
|
||||
.error(R.color.image_readability_tint)
|
||||
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.transform(new FastBlurTransformation(getActivity()))
|
||||
.dontAnimate()
|
||||
.into(imgvBackground);
|
||||
|
@ -528,7 +529,7 @@ public class ItemlistFragment extends ListFragment {
|
|||
.load(feed.getImageUri())
|
||||
.placeholder(R.color.light_gray)
|
||||
.error(R.color.light_gray)
|
||||
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.fitCenter()
|
||||
.dontAnimate()
|
||||
.into(imgvCover);
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
package de.danoeh.antennapod.core.glide;
|
||||
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||
|
||||
/**
|
||||
* The settings that AntennaPod will use for various Glide options
|
||||
*/
|
||||
public class ApGlideSettings {
|
||||
|
||||
public static final DiskCacheStrategy AP_DISK_CACHE_STRATEGY = DiskCacheStrategy.ALL;
|
||||
}
|
|
@ -46,6 +46,7 @@ import de.danoeh.antennapod.core.feed.Chapter;
|
|||
import de.danoeh.antennapod.core.feed.FeedItem;
|
||||
import de.danoeh.antennapod.core.feed.FeedMedia;
|
||||
import de.danoeh.antennapod.core.feed.MediaType;
|
||||
import de.danoeh.antennapod.core.glide.ApGlideSettings;
|
||||
import de.danoeh.antennapod.core.gpoddernet.model.GpodnetEpisodeAction;
|
||||
import de.danoeh.antennapod.core.gpoddernet.model.GpodnetEpisodeAction.Action;
|
||||
import de.danoeh.antennapod.core.preferences.GpodnetPreferences;
|
||||
|
@ -801,7 +802,7 @@ public class PlaybackService extends Service {
|
|||
icon = Glide.with(PlaybackService.this)
|
||||
.load(info.playable.getImageUri())
|
||||
.asBitmap()
|
||||
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
|
||||
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
|
||||
.into(-1, -1) // this resizing would not be exact, so we have
|
||||
// scale the bitmap ourselves
|
||||
.get();
|
||||
|
|
Loading…
Reference in New Issue