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 557e5cb8..8f6f583f 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 @@ -860,7 +860,6 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener, if (showFlavorImage && article.flavorImage == null) { Elements imgs = article.articleDoc.select("img"); - Element firstImg = null; for (Element tmp : imgs) { try { @@ -868,8 +867,6 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener, continue; } - if (firstImg != null) firstImg = tmp; - if (Integer.valueOf(tmp.attr("width")) > FLAVOR_IMG_MIN_WIDTH && Integer.valueOf(tmp.attr("width")) > FLAVOR_IMG_MIN_HEIGHT) { article.flavorImage = tmp; break; @@ -880,10 +877,8 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener, } } - Log.d(TAG, "" + firstImg); - if (article.flavorImage == null) - article.flavorImage = firstImg; + article.flavorImage = imgs.first(); } if (holder.textImage != null) { @@ -903,6 +898,32 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener, Log.d(TAG, "num selected: " + getSelectedArticles().size()); } }); + ViewCompat.setTransitionName(holder.textImage, "TRANSITION:ARTICLE_IMAGES_PAGER"); + + if (article.flavorImage != null) { + final String imgSrcFirst = article.flavorImage.attr("src"); + + holder.textImage.setOnLongClickListener(new View.OnLongClickListener() { + @Override + public boolean onLongClick(View v) { + + Intent intent = new Intent(m_activity, ArticleImagesPagerActivity.class); + intent.putExtra("firstSrc", imgSrcFirst); + intent.putExtra("title", article.title); + intent.putExtra("content", article.content); + + ActivityOptionsCompat options = + ActivityOptionsCompat.makeSceneTransitionAnimation(m_activity, + holder.textImage, // The view which starts the transition + "TRANSITION:ARTICLE_IMAGES_PAGER" // The transitionName of the view we’re transitioning to + ); + ActivityCompat.startActivity(m_activity, intent, options.toBundle()); + + return true; + } + }); + + } }