diff options
author | Andrew Dolgov <[email protected]> | 2018-03-15 13:42:20 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2018-03-15 13:42:20 +0300 |
commit | a8f3cc815c82bd7a78d7d74ecdf270052565d59c (patch) | |
tree | a36f0a5448e4f5bceaedaa8429ab9b98c0c2ef13 /org.fox.ttrss/src/main/java/org | |
parent | c9372162fb437d903fa12639dec7104faa1b8137 (diff) |
article fragment: add UI element to select attachments
Diffstat (limited to 'org.fox.ttrss/src/main/java/org')
3 files changed, 44 insertions, 17 deletions
diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleFragment.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleFragment.java index 33beb30a..ee72eefe 100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleFragment.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/ArticleFragment.java @@ -253,6 +253,22 @@ public class ArticleFragment extends StateSavedFragment { } + ImageView attachments = view.findViewById(R.id.attachments); + + if (attachments != null) { + if (m_article.attachments != null && m_article.attachments.size() > 0) { + attachments.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View v) { + m_activity.displayAttachments(m_article); + } + }); + + } else { + attachments.setVisibility(View.GONE); + } + } + ImageView share = view.findViewById(R.id.share); if (share != null) { 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 3e7cc24f..3482cec1 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 @@ -1079,14 +1079,19 @@ public class HeadlinesFragment extends StateSavedFragment { } if (holder.attachmentsView != null) { - holder.attachmentsView.setVisibility(article.attachments != null && article.attachments.size() > 0 ? View.VISIBLE : View.GONE); + if (article.attachments != null && article.attachments.size() > 0) { + holder.attachmentsView.setVisibility(View.VISIBLE); - holder.attachmentsView.setOnClickListener(new OnClickListener() { - @Override - public void onClick(View v) { - m_activity.displayAttachments(article); - } - }); + holder.attachmentsView.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View v) { + m_activity.displayAttachments(article); + } + }); + + } else { + holder.attachmentsView.setVisibility(View.GONE); + } } if (holder.excerptView != null) { diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineArticleFragment.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineArticleFragment.java index 0d409d9f..8ad84302 100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineArticleFragment.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/offline/OfflineArticleFragment.java @@ -33,7 +33,6 @@ import android.widget.TextView; import com.shamanland.fab.ShowHideOnScroll; -import org.fox.ttrss.ArticleFragment; import org.fox.ttrss.CommonActivity; import org.fox.ttrss.R; import org.fox.ttrss.util.ImageCacheService; @@ -206,11 +205,11 @@ public class OfflineArticleFragment extends Fragment { if (m_cursor.isFirst()) { m_contentView = view.findViewById(R.id.article_scrollview); - m_customViewContainer = (FrameLayout) view.findViewById(R.id.article_fullscreen_video); + m_customViewContainer = view.findViewById(R.id.article_fullscreen_video); final String link = m_cursor.getString(m_cursor.getColumnIndex("link")); - NotifyingScrollView scrollView = (NotifyingScrollView) view.findViewById(R.id.article_scrollview); + NotifyingScrollView scrollView = view.findViewById(R.id.article_scrollview); m_fab = view.findViewById(R.id.article_fab); if (scrollView != null && m_activity.isSmallScreen()) { @@ -258,7 +257,7 @@ public class OfflineArticleFragment extends Fragment { int articleFontSize = Integer.parseInt(m_prefs.getString("article_font_size_sp", "16")); int articleSmallFontSize = Math.max(10, Math.min(18, articleFontSize - 2)); - TextView title = (TextView)view.findViewById(R.id.title); + TextView title = view.findViewById(R.id.title); if (title != null) { @@ -287,7 +286,14 @@ public class OfflineArticleFragment extends Fragment { } - ImageView share = (ImageView)view.findViewById(R.id.share); + + ImageView attachments = view.findViewById(R.id.attachments); + + if (attachments != null) { + attachments.setVisibility(View.GONE); + } + + ImageView share = view.findViewById(R.id.share); if (share != null) { share.setOnClickListener(new OnClickListener() { @@ -299,19 +305,19 @@ public class OfflineArticleFragment extends Fragment { } - TextView comments = (TextView)view.findViewById(R.id.comments); + TextView comments = view.findViewById(R.id.comments); if (comments != null) { comments.setVisibility(View.GONE); } - TextView note = (TextView)view.findViewById(R.id.note); + TextView note = view.findViewById(R.id.note); if (note != null) { note.setVisibility(View.GONE); } - m_web = (WebView)view.findViewById(R.id.article_content); + m_web = view.findViewById(R.id.article_content); if (m_web != null) { if (CommonActivity.THEME_DARK.equals(m_prefs.getString("theme", CommonActivity.THEME_DEFAULT))) { @@ -464,7 +470,7 @@ public class OfflineArticleFragment extends Fragment { } - TextView dv = (TextView)view.findViewById(R.id.date); + TextView dv = view.findViewById(R.id.date); if (dv != null) { dv.setTextSize(TypedValue.COMPLEX_UNIT_SP, articleSmallFontSize); @@ -474,7 +480,7 @@ public class OfflineArticleFragment extends Fragment { dv.setText(df.format(d)); } - TextView tagv = (TextView)view.findViewById(R.id.tags); + TextView tagv = view.findViewById(R.id.tags); if (tagv != null) { tagv.setTextSize(TypedValue.COMPLEX_UNIT_SP, articleSmallFontSize); |