diff options
author | Andrew Dolgov <[email protected]> | 2014-10-16 14:00:08 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2014-10-16 14:00:08 +0400 |
commit | 82fb73043f8ebea4789e6a6789892efdb42eeb0e (patch) | |
tree | fc2e8838d8e38b27ad3a88d9ead2cf0198f03475 | |
parent | 811bc035c0935d321b2cad085853580e44888f62 (diff) |
add flavor image onclick handler
-rw-r--r-- | src/org/fox/ttrss/HeadlinesFragment.java | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/src/org/fox/ttrss/HeadlinesFragment.java b/src/org/fox/ttrss/HeadlinesFragment.java index 155fcfd0..f20ac08d 100644 --- a/src/org/fox/ttrss/HeadlinesFragment.java +++ b/src/org/fox/ttrss/HeadlinesFragment.java @@ -30,6 +30,7 @@ import android.graphics.Typeface; import android.net.Uri; import android.os.Bundle; import android.preference.PreferenceManager; +import android.provider.OpenableColumns; import android.support.v4.app.Fragment; import android.support.v4.widget.SwipeRefreshLayout; import android.text.Html; @@ -659,6 +660,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener, public TextView dateView; public CheckBox selectionBoxView; public ImageView menuButtonView; + public ViewGroup flavorImageHolder; } @@ -751,7 +753,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener, holder.dateView = (TextView) v.findViewById(R.id.date); holder.selectionBoxView = (CheckBox) v.findViewById(R.id.selected); holder.menuButtonView = (ImageView) v.findViewById(R.id.article_menu_button); - + holder.flavorImageHolder = (ViewGroup) v.findViewById(R.id.flavorImageHolder); v.setTag(holder); @@ -852,6 +854,21 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener, if (holder.flavorImageView != null && m_prefs.getBoolean("headlines_show_flavor_image", true)) { holder.flavorImageView.setVisibility(View.GONE); + holder.flavorImageView.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View v) { + try { + Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse((String)v.getTag())); + + startActivity(intent); + + } catch (Exception e) { + e.printStackTrace(); + } + + } + }); + Document doc = Jsoup.parse(articleContent); Element img = doc.select("img").first(); @@ -917,8 +934,9 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener, }); } - } - + } + } else if (holder.flavorImageHolder != null) { + holder.flavorImageHolder.setVisibility(View.GONE); } String articleAuthor = article.author != null ? article.author : ""; |