diff options
-rwxr-xr-x | org.fox.ttrss/src/main/java/org/fox/ttrss/HeadlinesFragment.java | 69 | ||||
-rwxr-xr-x | org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineHeadlinesFragment.java | 81 |
2 files changed, 80 insertions, 70 deletions
diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/HeadlinesFragment.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/HeadlinesFragment.java index a1f8e10d..ca1823f8 100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/HeadlinesFragment.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/HeadlinesFragment.java @@ -1238,51 +1238,56 @@ public class HeadlinesFragment extends Fragment { holder.flavorImageView.setLayoutParams(lp); */ - Glide.with(HeadlinesFragment.this) - .load(article.flavorImageUri) - .dontTransform() - .diskCacheStrategy(DiskCacheStrategy.ALL) - .skipMemoryCache(false) - .listener(new RequestListener<String, GlideDrawable>() { - @Override - public boolean onException(Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) { + try { - holder.flavorImageLoadingBar.setVisibility(View.GONE); - holder.flavorImageView.setVisibility(View.GONE); + Glide.with(HeadlinesFragment.this) + .load(article.flavorImageUri) + .dontTransform() + .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; - } + holder.flavorImageLoadingBar.setVisibility(View.GONE); + holder.flavorImageView.setVisibility(View.GONE); - @Override - public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) { + return false; + } - holder.flavorImageLoadingBar.setVisibility(View.GONE); + @Override + public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) { - if (resource.getIntrinsicWidth() > FLAVOR_IMG_MIN_SIZE && resource.getIntrinsicHeight() > FLAVOR_IMG_MIN_SIZE) { + holder.flavorImageLoadingBar.setVisibility(View.GONE); - //holder.flavorImageView.setVisibility(View.VISIBLE); - holder.flavorImageOverflow.setVisibility(View.VISIBLE); + if (resource.getIntrinsicWidth() > FLAVOR_IMG_MIN_SIZE && resource.getIntrinsicHeight() > FLAVOR_IMG_MIN_SIZE) { - boolean forceDown = article.flavorImage != null && "video".equals(article.flavorImage.tagName().toLowerCase()); + //holder.flavorImageView.setVisibility(View.VISIBLE); + holder.flavorImageOverflow.setVisibility(View.VISIBLE); - RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) holder.flavorImageView.getLayoutParams(); - lp.height = RelativeLayout.LayoutParams.WRAP_CONTENT; - holder.flavorImageView.setLayoutParams(lp); + boolean forceDown = article.flavorImage != null && "video".equals(article.flavorImage.tagName().toLowerCase()); - maybeRepositionFlavorImage(holder.flavorImageView, resource, holder, forceDown); - adjustVideoKindView(holder, article); + RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) holder.flavorImageView.getLayoutParams(); + lp.height = RelativeLayout.LayoutParams.WRAP_CONTENT; + holder.flavorImageView.setLayoutParams(lp); - return false; - } else { + maybeRepositionFlavorImage(holder.flavorImageView, resource, holder, forceDown); + adjustVideoKindView(holder, article); - holder.flavorImageOverflow.setVisibility(View.GONE); - holder.flavorImageView.setVisibility(View.GONE); + return false; + } else { - return true; + holder.flavorImageOverflow.setVisibility(View.GONE); + holder.flavorImageView.setVisibility(View.GONE); + + return true; + } } - } - }) - .into(holder.flavorProgressTarget); + }) + .into(holder.flavorProgressTarget); + } catch (OutOfMemoryError e) { + e.printStackTrace(); + } } if (m_prefs.getBoolean("inline_video_player", false) && article.flavorImage != null && diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineHeadlinesFragment.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineHeadlinesFragment.java index 1a30be7d..92645942 100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineHeadlinesFragment.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineHeadlinesFragment.java @@ -29,6 +29,7 @@ import android.view.Display; import android.view.LayoutInflater; import android.view.MenuInflater; import android.view.MenuItem; +import android.view.Surface; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; @@ -835,61 +836,65 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis } }); + try { - Glide.with(OfflineHeadlinesFragment.this) - .load(afi.flavorImageUri) - .dontTransform() - .diskCacheStrategy(DiskCacheStrategy.NONE) - .skipMemoryCache(false) - .listener(new RequestListener<String, GlideDrawable>() { - @Override - public boolean onException(Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) { + Glide.with(OfflineHeadlinesFragment.this) + .load(afi.flavorImageUri) + .dontTransform() + .diskCacheStrategy(DiskCacheStrategy.NONE) + .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); + holder.flavorImageLoadingBar.setVisibility(View.GONE); + holder.flavorImageView.setVisibility(View.GONE); - return false; - } + return false; + } - @Override - public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) { + @Override + public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) { - holder.flavorImageLoadingBar.setVisibility(View.GONE); + holder.flavorImageLoadingBar.setVisibility(View.GONE); - if (resource.getIntrinsicWidth() > HeadlinesFragment.FLAVOR_IMG_MIN_SIZE && - resource.getIntrinsicHeight() > HeadlinesFragment.FLAVOR_IMG_MIN_SIZE) { + if (resource.getIntrinsicWidth() > HeadlinesFragment.FLAVOR_IMG_MIN_SIZE && + resource.getIntrinsicHeight() > HeadlinesFragment.FLAVOR_IMG_MIN_SIZE) { - holder.flavorImageView.setVisibility(View.VISIBLE); + holder.flavorImageView.setVisibility(View.VISIBLE); - //TODO: not implemented - //holder.flavorImageOverflow.setVisibility(View.VISIBLE); + //TODO: not implemented + //holder.flavorImageOverflow.setVisibility(View.VISIBLE); - /*boolean forceDown = article.flavorImage != null && "video".equals(article.flavorImage.tagName().toLowerCase()); + /*boolean forceDown = article.flavorImage != null && "video".equals(article.flavorImage.tagName().toLowerCase()); - maybeRepositionFlavorImage(holder.flavorImageView, resource, holder, forceDown); - adjustVideoKindView(holder, article);*/ + maybeRepositionFlavorImage(holder.flavorImageView, resource, holder, forceDown); + adjustVideoKindView(holder, article);*/ - /* we don't support image embedding in offline */ + /* we don't support image embedding in offline */ - RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) holder.flavorImageView.getLayoutParams(); - lp.addRule(RelativeLayout.BELOW, R.id.headline_header); - //lp.height = RelativeLayout.LayoutParams.WRAP_CONTENT; - holder.flavorImageView.setLayoutParams(lp); + RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) holder.flavorImageView.getLayoutParams(); + lp.addRule(RelativeLayout.BELOW, R.id.headline_header); + //lp.height = RelativeLayout.LayoutParams.WRAP_CONTENT; + holder.flavorImageView.setLayoutParams(lp); - holder.headlineHeader.setBackgroundDrawable(null); + holder.headlineHeader.setBackgroundDrawable(null); - return false; - } else { + return false; + } else { - holder.flavorImageOverflow.setVisibility(View.GONE); - holder.flavorImageView.setVisibility(View.GONE); + holder.flavorImageOverflow.setVisibility(View.GONE); + holder.flavorImageView.setVisibility(View.GONE); - return true; - } - } - }) - .into(holder.flavorImageView); + return true; + } + } + }) + .into(holder.flavorImageView); + } catch (OutOfMemoryError e) { + e.printStackTrace(); + } } } |