diff options
| author | Andrew Dolgov <fox@fakecake.org> | 2026-02-18 20:44:11 +0300 |
|---|---|---|
| committer | Andrew Dolgov <fox@fakecake.org> | 2026-02-18 20:44:11 +0300 |
| commit | 296024e2af8d56355f29c6298f5cae4eb6ad52e6 (patch) | |
| tree | 6f78bf8ebe482579e920c82b6b31f952d5058268 /org.fox.ttrss | |
| parent | c0bf40f2d1ce3dd26ffcccecdb762a5fea607fc3 (diff) | |
| download | tt-rss-android-296024e2af8d56355f29c6298f5cae4eb6ad52e6.tar.gz tt-rss-android-296024e2af8d56355f29c6298f5cae4eb6ad52e6.tar.xz | |
show comments in place of author, move author to feed title like article pager view
Diffstat (limited to 'org.fox.ttrss')
| -rwxr-xr-x | org.fox.ttrss/src/main/java/org/fox/ttrss/HeadlinesFragment.java | 31 | ||||
| -rwxr-xr-x | org.fox.ttrss/src/main/res/layout/headlines_row.xml | 4 |
2 files changed, 20 insertions, 15 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 538e76d6..11325713 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 @@ -7,7 +7,6 @@ import android.content.Intent; import android.content.SharedPreferences; import android.content.res.ColorStateList; import android.graphics.Point; -import android.graphics.Typeface; import android.graphics.drawable.Drawable; import android.media.MediaPlayer; import android.net.ConnectivityManager; @@ -572,7 +571,7 @@ public class HeadlinesFragment extends androidx.fragment.app.Fragment { public TextView excerptView; public ImageView flavorImageView; public ImageView flavorVideoKindView; - public TextView authorView; + public TextView commentsView; public TextView dateView; public CheckBox selectionBoxView; public MaterialButton menuButtonView; @@ -602,7 +601,7 @@ public class HeadlinesFragment extends androidx.fragment.app.Fragment { excerptView = v.findViewById(R.id.excerpt); flavorImageView = v.findViewById(R.id.flavor_image); flavorVideoKindView = v.findViewById(R.id.flavor_video_kind); - authorView = v.findViewById(R.id.author); + commentsView = v.findViewById(R.id.comments); dateView = v.findViewById(R.id.date); selectionBoxView = v.findViewById(R.id.selected); menuButtonView = v.findViewById(R.id.article_menu_button); @@ -1091,7 +1090,7 @@ public class HeadlinesFragment extends androidx.fragment.app.Fragment { updateAttachmentsView(article, holder); updateLinkHost(article, holder); updateExcerptView(article, holder); - updateAuthorView(article, holder); + updateCommentsView(article, holder); updateDateView(article, holder); updateSelectedView(article, holder); @@ -1291,7 +1290,14 @@ public class HeadlinesFragment extends androidx.fragment.app.Fragment { if (holder.feedTitleView != null) { if (article.feed_title != null && m_feed != null && (m_feed.is_cat || m_feed.id < 0)) { holder.feedTitleView.setTextSize(TypedValue.COMPLEX_UNIT_SP, m_headlineSmallFontSize); - holder.feedTitleView.setText(article.feed_title); + + String feedTitle = article.feed_title; + + if (article.author != null && !article.author.isEmpty()) { + feedTitle += " (" + getString(R.string.author_formatted, article.author) + ")"; + } + + holder.feedTitleView.setText(feedTitle); if (holder.feedIcon != null) { String ttrssUrl = m_prefs.getString("ttrss_url", "").trim(); @@ -1336,16 +1342,15 @@ public class HeadlinesFragment extends androidx.fragment.app.Fragment { } } - private void updateAuthorView(final Article article, final ArticleViewHolder holder) { - String articleAuthor = article.author != null ? article.author : ""; - - if (holder.authorView != null) { - holder.authorView.setTextSize(TypedValue.COMPLEX_UNIT_SP, m_headlineSmallFontSize); + private void updateCommentsView(final Article article, final ArticleViewHolder holder) { + if (holder.commentsView != null) { + holder.commentsView.setTextSize(TypedValue.COMPLEX_UNIT_SP, m_headlineSmallFontSize); - if (!articleAuthor.isEmpty()) { - holder.authorView.setText(getString(R.string.author_formatted, articleAuthor)); + if (article.comments_count > 0) { + String articleComments = getResources().getQuantityString(R.plurals.article_comments, article.comments_count, article.comments_count); + holder.commentsView.setText(articleComments); } else { - holder.authorView.setText(""); + holder.commentsView.setText(""); } } } diff --git a/org.fox.ttrss/src/main/res/layout/headlines_row.xml b/org.fox.ttrss/src/main/res/layout/headlines_row.xml index 7f0077fa..38c5dbe5 100755 --- a/org.fox.ttrss/src/main/res/layout/headlines_row.xml +++ b/org.fox.ttrss/src/main/res/layout/headlines_row.xml @@ -216,7 +216,7 @@ android:focusable="false" /> <TextView - android:id="@+id/author" + android:id="@+id/comments" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_weight="1" @@ -224,7 +224,7 @@ android:fontFamily="sans-serif-light" android:gravity="center_vertical" android:singleLine="true" - tools:text="by Author" + tools:text="12 comments" android:textColor="?colorSecondary" android:textSize="12sp" android:textStyle="italic" /> |
