replace UIL with Glide
This commit is contained in:
parent
e45c7adda6
commit
edc1b66f70
@ -28,7 +28,8 @@ dependencies {
|
||||
compile project(':taskerlocaleapi')
|
||||
compile files('libs/dashclock-api-r1.1.jar')
|
||||
compile 'org.jsoup:jsoup:1.10.2'
|
||||
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.3'
|
||||
compile 'com.github.bumptech.glide:glide:3.8.0'
|
||||
compile 'jp.wasabeef:glide-transformations:2.0.2'
|
||||
compile 'com.android.support:cardview-v7:25.3.1'
|
||||
compile 'com.android.support:support-v4:25.3.1'
|
||||
compile 'com.android.support:appcompat-v7:25.3.1'
|
||||
|
@ -26,11 +26,12 @@ import android.widget.PopupMenu;
|
||||
import android.widget.ProgressBar;
|
||||
|
||||
import com.ToxicBakery.viewpager.transforms.DepthPageTransformer;
|
||||
import com.nostra13.universalimageloader.core.DisplayImageOptions;
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
import com.nostra13.universalimageloader.core.assist.FailReason;
|
||||
import com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer;
|
||||
import com.nostra13.universalimageloader.core.listener.ImageLoadingListener;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||
import com.bumptech.glide.load.resource.drawable.GlideDrawable;
|
||||
import com.bumptech.glide.request.RequestListener;
|
||||
import com.bumptech.glide.request.target.GlideDrawableImageViewTarget;
|
||||
import com.bumptech.glide.request.target.Target;
|
||||
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.nodes.Document;
|
||||
@ -39,6 +40,7 @@ import org.jsoup.select.Elements;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
import it.sephiroth.android.library.imagezoom.ImageViewTouch;
|
||||
import me.relex.circleindicator.CircleIndicator;
|
||||
@ -140,49 +142,41 @@ public class ArticleImagesPagerActivity extends CommonActivity implements Gestur
|
||||
}
|
||||
});
|
||||
|
||||
DisplayImageOptions options = new DisplayImageOptions.Builder()
|
||||
.cacheInMemory(true)
|
||||
.resetViewBeforeLoading(true)
|
||||
.cacheOnDisk(true)
|
||||
.displayer(new FadeInBitmapDisplayer(200))
|
||||
.build();
|
||||
|
||||
final ProgressBar progressBar = (ProgressBar) view.findViewById(R.id.flavor_image_progress);
|
||||
final View errorMessage = view.findViewById(R.id.flavor_image_error);
|
||||
|
||||
ImageLoader.getInstance().displayImage(url, imgView, options, new ImageLoadingListener() {
|
||||
@Override
|
||||
public void onLoadingStarted(String s, View view) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadingFailed(String s, View view, FailReason failReason) {
|
||||
progressBar.setVisibility(View.GONE);
|
||||
errorMessage.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadingComplete(String s, View view, Bitmap bitmap) {
|
||||
if (bitmap != null) {
|
||||
view.setTag(s);
|
||||
}
|
||||
|
||||
progressBar.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadingCancelled(String s, View view) {
|
||||
|
||||
}
|
||||
});
|
||||
final GlideDrawableImageViewTarget glideImage = new GlideDrawableImageViewTarget(imgView);
|
||||
|
||||
container.addView(view, 0);
|
||||
|
||||
if (position == 0) {
|
||||
ActivityCompat.startPostponedEnterTransition(ArticleImagesPagerActivity.this);
|
||||
Glide.with(ArticleImagesPagerActivity.this)
|
||||
.load(url)
|
||||
.dontAnimate()
|
||||
.diskCacheStrategy(DiskCacheStrategy.ALL)
|
||||
.skipMemoryCache(false)
|
||||
.listener(new RequestListener<String, GlideDrawable>() {
|
||||
@Override
|
||||
public boolean onException(Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) {
|
||||
progressBar.setVisibility(View.GONE);
|
||||
errorMessage.setVisibility(View.VISIBLE);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) {
|
||||
progressBar.setVisibility(View.GONE);
|
||||
errorMessage.setVisibility(View.GONE);
|
||||
|
||||
ActivityCompat.startPostponedEnterTransition(ArticleImagesPagerActivity.this);
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.into(glideImage);
|
||||
|
||||
/*if (position == 0) {
|
||||
ActivityCompat.startPostponedEnterTransition(ArticleImagesPagerActivity.this);
|
||||
}*/
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@ -203,18 +197,32 @@ public class ArticleImagesPagerActivity extends CommonActivity implements Gestur
|
||||
|
||||
//Log.d(TAG, "checking: " + url);
|
||||
|
||||
DisplayImageOptions options = new DisplayImageOptions.Builder()
|
||||
/*DisplayImageOptions options = new DisplayImageOptions.Builder()
|
||||
.cacheInMemory(true)
|
||||
.cacheOnDisk(true)
|
||||
.build();
|
||||
|
||||
Bitmap bmp = ImageLoader.getInstance().loadImageSync(url, options);
|
||||
Bitmap bmp = ImageLoader.getInstance().loadImageSync(url, options); */
|
||||
|
||||
try {
|
||||
Bitmap bmp = Glide.with(ArticleImagesPagerActivity.this)
|
||||
.load(url)
|
||||
.asBitmap()
|
||||
.into(-1, -1)
|
||||
.get();
|
||||
|
||||
if (bmp != null && bmp.getWidth() > 128 && bmp.getHeight() > 128) {
|
||||
publishProgress(url, String.valueOf(position));
|
||||
} else {
|
||||
publishProgress(null, String.valueOf(position));
|
||||
}
|
||||
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
} catch (ExecutionException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -32,11 +32,6 @@ import android.view.View;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.nostra13.universalimageloader.cache.disc.impl.ext.LruDiscCache;
|
||||
import com.nostra13.universalimageloader.core.DefaultConfigurationFactory;
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
|
||||
|
||||
import org.fox.ttrss.util.DatabaseHelper;
|
||||
import org.fox.ttrss.widget.SmallWidgetProvider;
|
||||
import org.jsoup.Jsoup;
|
||||
@ -171,7 +166,7 @@ public class CommonActivity extends ActionBarActivity implements SharedPreferenc
|
||||
|
||||
CustomTabsClient.bindCustomTabsService(this, "com.android.chrome", m_customTabServiceConnection);
|
||||
|
||||
if (!ImageLoader.getInstance().isInited()) {
|
||||
/*if (!ImageLoader.getInstance().isInited()) {
|
||||
ImageLoaderConfiguration config;
|
||||
|
||||
try {
|
||||
@ -186,7 +181,7 @@ public class CommonActivity extends ActionBarActivity implements SharedPreferenc
|
||||
.build();
|
||||
}
|
||||
ImageLoader.getInstance().init(config);
|
||||
}
|
||||
}*/
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
@ -56,6 +56,12 @@ import android.widget.TextView;
|
||||
|
||||
import com.amulyakhare.textdrawable.TextDrawable;
|
||||
import com.amulyakhare.textdrawable.util.ColorGenerator;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||
import com.bumptech.glide.load.resource.drawable.GlideDrawable;
|
||||
import com.bumptech.glide.request.RequestListener;
|
||||
import com.bumptech.glide.request.target.GlideDrawableImageViewTarget;
|
||||
import com.bumptech.glide.request.target.Target;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.nhaarman.listviewanimations.appearance.AnimationAdapter;
|
||||
import com.nhaarman.listviewanimations.appearance.simple.SwingBottomInAnimationAdapter;
|
||||
@ -64,15 +70,6 @@ import com.nhaarman.listviewanimations.itemmanipulation.swipedismiss.Dismissable
|
||||
import com.nhaarman.listviewanimations.itemmanipulation.swipedismiss.OnDismissCallback;
|
||||
import com.nhaarman.listviewanimations.itemmanipulation.swipedismiss.undo.TimedUndoAdapter;
|
||||
import com.nhaarman.listviewanimations.itemmanipulation.swipedismiss.undo.UndoAdapter;
|
||||
import com.nostra13.universalimageloader.core.DisplayImageOptions;
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
import com.nostra13.universalimageloader.core.assist.FailReason;
|
||||
import com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer;
|
||||
import com.nostra13.universalimageloader.core.display.RoundedBitmapDisplayer;
|
||||
import com.nostra13.universalimageloader.core.imageaware.ImageAware;
|
||||
import com.nostra13.universalimageloader.core.imageaware.ImageViewAware;
|
||||
import com.nostra13.universalimageloader.core.listener.ImageLoadingListener;
|
||||
import com.nostra13.universalimageloader.core.listener.ImageLoadingProgressListener;
|
||||
import com.shamanland.fab.FloatingActionButton;
|
||||
import com.shamanland.fab.ShowHideOnScroll;
|
||||
|
||||
@ -89,6 +86,8 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import jp.wasabeef.glide.transformations.CropCircleTransformation;
|
||||
|
||||
public class HeadlinesFragment extends Fragment implements OnItemClickListener, OnScrollListener {
|
||||
public enum ArticlesSelection { ALL, NONE, UNREAD }
|
||||
|
||||
@ -122,7 +121,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
||||
private boolean m_compactLayoutMode = false;
|
||||
private int m_listPreviousVisibleItem;
|
||||
private DynamicListView m_list;
|
||||
private ImageLoader m_imageLoader = ImageLoader.getInstance();
|
||||
//private ImageLoader m_imageLoader = ImageLoader.getInstance();
|
||||
private View m_listLoadingView;
|
||||
private View m_topChangedView;
|
||||
private View m_amrFooterView;
|
||||
@ -728,7 +727,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
||||
|
||||
private ColorGenerator m_colorGenerator = ColorGenerator.DEFAULT;
|
||||
private TextDrawable.IBuilder m_drawableBuilder = TextDrawable.builder().round();
|
||||
private final DisplayImageOptions displayImageOptions;
|
||||
//private final DisplayImageOptions displayImageOptions;
|
||||
boolean showFlavorImage;
|
||||
private int m_minimumHeightToEmbed;
|
||||
boolean m_youtubeInstalled;
|
||||
@ -750,12 +749,12 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
||||
theme.resolveAttribute(R.attr.headlineTitleHighScoreUnreadTextColor, tv, true);
|
||||
titleHighScoreUnreadColor = tv.data;
|
||||
|
||||
displayImageOptions = new DisplayImageOptions.Builder()
|
||||
/*displayImageOptions = new DisplayImageOptions.Builder()
|
||||
.cacheInMemory(true)
|
||||
.resetViewBeforeLoading(true)
|
||||
.cacheOnDisk(true)
|
||||
.displayer(new FadeInBitmapDisplayer(500))
|
||||
.build();
|
||||
.build();*/
|
||||
|
||||
List<ApplicationInfo> packages = m_activity.getPackageManager().getInstalledApplications(0);
|
||||
for (ApplicationInfo pi : packages) {
|
||||
@ -790,22 +789,51 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
||||
|
||||
if (article.selected) {
|
||||
holder.textImage.setImageDrawable(m_drawableBuilder.build(" ", 0xff616161));
|
||||
holder.textImage.setTag(null);
|
||||
//holder.textImage.setTag(null);
|
||||
|
||||
holder.textChecked.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
final Drawable textDrawable = m_drawableBuilder.build(tmp, m_colorGenerator.getColor(article.title));
|
||||
|
||||
holder.textImage.setImageDrawable(textDrawable);
|
||||
holder.textImage.setTag(null);
|
||||
//holder.textImage.setTag(null);
|
||||
|
||||
//holder.textChecked.setVisibility(View.GONE);
|
||||
|
||||
if (!showFlavorImage || article.flavorImage == null) {
|
||||
holder.textImage.setImageDrawable(textDrawable);
|
||||
holder.textImage.setTag(null);
|
||||
//holder.textImage.setTag(null);
|
||||
} else {
|
||||
if (!article.flavorImageUri.equals(holder.textImage.getTag())) {
|
||||
|
||||
//final GlideDrawableImageViewTarget glideImage = new GlideDrawableImageViewTarget(holder.textImage);
|
||||
|
||||
Glide.with(HeadlinesFragment.this)
|
||||
.load(article.flavorImageUri)
|
||||
.placeholder(textDrawable)
|
||||
.bitmapTransform(new CropCircleTransformation(getActivity()))
|
||||
.dontAnimate()
|
||||
.diskCacheStrategy(DiskCacheStrategy.ALL)
|
||||
.skipMemoryCache(false)
|
||||
.listener(new RequestListener<String, GlideDrawable>() {
|
||||
@Override
|
||||
public boolean onException(Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) {
|
||||
|
||||
if (resource.getIntrinsicWidth() < THUMB_IMG_MIN_SIZE || resource.getIntrinsicHeight() < THUMB_IMG_MIN_SIZE) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
})
|
||||
.into(holder.textImage);
|
||||
|
||||
|
||||
/* if (!article.flavorImageUri.equals(holder.textImage.getTag())) {
|
||||
|
||||
ImageAware imageAware = new ImageViewAware(holder.textImage, false);
|
||||
|
||||
@ -833,7 +861,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
||||
@Override
|
||||
public void onLoadingComplete(String imageUri, View view, Bitmap bitmap) {
|
||||
if (position == holder.position && bitmap != null) {
|
||||
holder.textImage.setTag(article.flavorImageUri);
|
||||
//holder.textImage.setTag(article.flavorImageUri);
|
||||
|
||||
if (bitmap.getWidth() < THUMB_IMG_MIN_SIZE || bitmap.getHeight() < THUMB_IMG_MIN_SIZE) {
|
||||
holder.textImage.setImageDrawable(textDrawable);
|
||||
@ -848,7 +876,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
} */
|
||||
}
|
||||
|
||||
holder.textChecked.setVisibility(View.GONE);
|
||||
@ -1143,79 +1171,53 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
||||
});
|
||||
}
|
||||
|
||||
if (!article.flavorImageUri.equals(holder.flavorImageView.getTag())) {
|
||||
|
||||
//Log.d(TAG, "IMG: " + article.flavorImageUri + " STREAM: " + article.flavorStreamUri);
|
||||
|
||||
ImageAware imageAware = new ImageViewAware(holder.flavorImageView, false);
|
||||
|
||||
m_imageLoader.displayImage(article.flavorImageUri, imageAware, displayImageOptions, new ImageLoadingListener() {
|
||||
@Override
|
||||
public void onLoadingStarted(String s, View view) {
|
||||
holder.flavorImageLoadingBar.setVisibility(View.VISIBLE);
|
||||
holder.flavorImageLoadingBar.setIndeterminate(false);
|
||||
holder.flavorImageLoadingBar.setProgress(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadingFailed(String s, View view, FailReason failReason) {
|
||||
holder.flavorImageLoadingBar.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadingComplete(String imageUri, View view, Bitmap bitmap) {
|
||||
if (position == holder.position && bitmap != null) {
|
||||
|
||||
holder.flavorImageLoadingBar.setVisibility(View.GONE);
|
||||
|
||||
if (bitmap.getWidth() > FLAVOR_IMG_MIN_SIZE && bitmap.getHeight() > FLAVOR_IMG_MIN_SIZE) {
|
||||
holder.flavorImageView.setTag(article.flavorImageUri);
|
||||
|
||||
holder.flavorImageView.setVisibility(View.VISIBLE);
|
||||
holder.flavorImageOverflow.setVisibility(View.VISIBLE);
|
||||
|
||||
maybeRepositionFlavorImage(view, bitmap, holder);
|
||||
adjustVideoKindView(holder, article);
|
||||
|
||||
} else {
|
||||
holder.flavorImageView.setImageDrawable(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadingCancelled(String s, View view) {
|
||||
holder.flavorImageLoadingBar.setVisibility(View.GONE);
|
||||
}
|
||||
}, new ImageLoadingProgressListener() {
|
||||
@Override
|
||||
public void onProgressUpdate(String s, View view, int current, int total) {
|
||||
if (total != 0) {
|
||||
int p = (int) ((float) current / total * 100);
|
||||
|
||||
holder.flavorImageLoadingBar.setIndeterminate(false);
|
||||
holder.flavorImageLoadingBar.setProgress(p);
|
||||
} else {
|
||||
holder.flavorImageLoadingBar.setIndeterminate(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
} else { // already tagged
|
||||
holder.flavorImageView.setVisibility(View.VISIBLE);
|
||||
holder.flavorImageView.setImageDrawable(null);
|
||||
|
||||
final GlideDrawableImageViewTarget glideImage = new GlideDrawableImageViewTarget(holder.flavorImageView);
|
||||
|
||||
Glide.with(HeadlinesFragment.this)
|
||||
.load(article.flavorImageUri)
|
||||
.dontAnimate()
|
||||
.diskCacheStrategy(DiskCacheStrategy.ALL)
|
||||
.skipMemoryCache(false)
|
||||
.listener(new RequestListener<String, GlideDrawable>() {
|
||||
@Override
|
||||
public boolean onException(Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) {
|
||||
|
||||
holder.flavorImageLoadingBar.setVisibility(View.GONE);
|
||||
holder.flavorImageView.setVisibility(View.GONE);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) {
|
||||
|
||||
holder.flavorImageLoadingBar.setVisibility(View.GONE);
|
||||
|
||||
holder.flavorImageOverflow.setVisibility(View.VISIBLE);
|
||||
|
||||
if (resource.getIntrinsicWidth() > FLAVOR_IMG_MIN_SIZE && resource.getIntrinsicHeight() > FLAVOR_IMG_MIN_SIZE) {
|
||||
|
||||
holder.flavorImageView.setVisibility(View.VISIBLE);
|
||||
holder.flavorImageOverflow.setVisibility(View.VISIBLE);
|
||||
|
||||
maybeRepositionFlavorImage(holder.flavorImageView, resource, holder);
|
||||
adjustVideoKindView(holder, article);
|
||||
|
||||
if (holder.flavorImageEmbedded) {
|
||||
TypedValue tv = new TypedValue();
|
||||
if (m_activity.getTheme().resolveAttribute(R.attr.headlineHeaderBackground, tv, true)) {
|
||||
holder.headlineHeader.setBackgroundColor(tv.data);
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
holder.headlineHeader.setBackgroundDrawable(null);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
})
|
||||
.into(glideImage);
|
||||
}
|
||||
|
||||
holder.flavorImageView.setOnClickListener(new OnClickListener() {
|
||||
@ -1388,16 +1390,16 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
||||
return px;
|
||||
}
|
||||
|
||||
private void maybeRepositionFlavorImage(View view, Bitmap bitmap, HeadlineViewHolder holder) {
|
||||
private void maybeRepositionFlavorImage(View view, GlideDrawable resource, HeadlineViewHolder holder) {
|
||||
RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) view.getLayoutParams();
|
||||
|
||||
int w = bitmap.getWidth();
|
||||
int h = bitmap.getHeight();
|
||||
int w = resource.getIntrinsicWidth();
|
||||
int h = resource.getIntrinsicHeight();
|
||||
float r = h != 0 ? (float)w/h : 0;
|
||||
|
||||
//Log.d(TAG, "XYR: " + pxToDp(w) + " " + pxToDp(h) + " " + r);
|
||||
|
||||
if (bitmap.getHeight() < m_minimumHeightToEmbed || r >= 1.2) {
|
||||
if (h < m_minimumHeightToEmbed || r >= 1.2) {
|
||||
|
||||
lp.addRule(RelativeLayout.BELOW, R.id.headline_header);
|
||||
|
||||
@ -1565,12 +1567,6 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
||||
|
||||
@Override
|
||||
public void onScrollStateChanged(AbsListView view, int scrollState) {
|
||||
if (scrollState == AbsListView.OnScrollListener.SCROLL_STATE_FLING || scrollState == AbsListView.OnScrollListener.SCROLL_STATE_TOUCH_SCROLL) {
|
||||
m_imageLoader.pause();
|
||||
} else {
|
||||
m_imageLoader.resume();
|
||||
}
|
||||
|
||||
if (scrollState == SCROLL_STATE_IDLE && m_prefs.getBoolean("headlines_mark_read_scroll", false)) {
|
||||
if (!m_readArticles.isEmpty()) {
|
||||
m_activity.toggleArticlesUnread(m_readArticles);
|
||||
|
@ -7,6 +7,7 @@ import android.app.Dialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v4.app.Fragment;
|
||||
@ -19,8 +20,8 @@ import android.view.Gravity;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
|
||||
import org.fox.ttrss.types.Article;
|
||||
import org.fox.ttrss.types.ArticleList;
|
||||
@ -241,7 +242,7 @@ public class MasterActivity extends OnlineActivity implements HeadlinesEventList
|
||||
|
||||
public void onFeedSelected(Feed feed, final boolean selectedByUser) {
|
||||
|
||||
ImageLoader.getInstance().clearMemoryCache();
|
||||
//ImageLoader.getInstance().clearMemoryCache();
|
||||
|
||||
FragmentTransaction ft = getSupportFragmentManager()
|
||||
.beginTransaction();
|
||||
@ -486,6 +487,16 @@ public class MasterActivity extends OnlineActivity implements HeadlinesEventList
|
||||
|
||||
Date date = new Date();
|
||||
|
||||
if (isFinishing()) {
|
||||
AsyncTask.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Glide.get(MasterActivity.this).clearDiskCache();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
if (isFinishing() || date.getTime() - m_lastWidgetRefresh > 60*1000) {
|
||||
m_lastWidgetRefresh = date.getTime();
|
||||
|
||||
|
@ -22,9 +22,11 @@ import android.widget.ImageView;
|
||||
import android.widget.MediaController;
|
||||
import android.widget.PopupMenu;
|
||||
|
||||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||||
import com.nostra13.universalimageloader.core.assist.FailReason;
|
||||
import com.nostra13.universalimageloader.core.listener.ImageLoadingListener;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||
import com.bumptech.glide.load.resource.drawable.GlideDrawable;
|
||||
import com.bumptech.glide.request.RequestListener;
|
||||
import com.bumptech.glide.request.target.Target;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@ -71,7 +73,27 @@ public class VideoPlayerActivity extends CommonActivity {
|
||||
|
||||
ViewCompat.setTransitionName(coverView, "gallery:" + m_coverUri);
|
||||
|
||||
ImageLoader imageLoader = ImageLoader.getInstance();
|
||||
Glide.with(this)
|
||||
.load(m_coverUri)
|
||||
.diskCacheStrategy(DiskCacheStrategy.ALL)
|
||||
.skipMemoryCache(false)
|
||||
.listener(new RequestListener<String, GlideDrawable>() {
|
||||
@Override
|
||||
public boolean onException(Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) {
|
||||
ActivityCompat.startPostponedEnterTransition(VideoPlayerActivity.this);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) {
|
||||
ActivityCompat.startPostponedEnterTransition(VideoPlayerActivity.this);
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.into(coverView);
|
||||
|
||||
|
||||
/*ImageLoader imageLoader = ImageLoader.getInstance();
|
||||
imageLoader.displayImage(m_coverUri, coverView, new ImageLoadingListener() {
|
||||
@Override
|
||||
public void onLoadingStarted(String s, View view) {
|
||||
@ -92,7 +114,7 @@ public class VideoPlayerActivity extends CommonActivity {
|
||||
public void onLoadingCancelled(String s, View view) {
|
||||
ActivityCompat.startPostponedEnterTransition(VideoPlayerActivity.this);
|
||||
}
|
||||
});
|
||||
});*/
|
||||
|
||||
|
||||
} else {
|
||||
|
@ -42,7 +42,7 @@
|
||||
android:max="100"
|
||||
android:indeterminate="false" />
|
||||
|
||||
<org.fox.ttrss.util.EnlargingImageView
|
||||
<ImageView
|
||||
android:id="@+id/flavor_image"
|
||||
android:foreground="@drawable/ripple"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -43,7 +43,7 @@
|
||||
android:max="100"
|
||||
android:indeterminate="false" />
|
||||
|
||||
<org.fox.ttrss.util.EnlargingImageView
|
||||
<ImageView
|
||||
android:id="@+id/flavor_image"
|
||||
android:foreground="@drawable/ripple"
|
||||
android:layout_width="match_parent"
|
||||
|
Loading…
Reference in New Issue
Block a user