From 05074439c98c0bdb96c462a0951599bc35b7b83a Mon Sep 17 00:00:00 2001 From: Thomas Date: Tue, 13 Sep 2022 17:40:23 +0200 Subject: [PATCH] Fix issue #114 - Allow to display counters in timelines --- .../android/ui/drawer/StatusAdapter.java | 23 ++++++++++++++----- app/src/main/res/values/strings.xml | 2 ++ app/src/main/res/xml/pref_timelines.xml | 6 +++++ 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/app/fedilab/android/ui/drawer/StatusAdapter.java b/app/src/main/java/app/fedilab/android/ui/drawer/StatusAdapter.java index 666b32c2c..fae6470f6 100644 --- a/app/src/main/java/app/fedilab/android/ui/drawer/StatusAdapter.java +++ b/app/src/main/java/app/fedilab/android/ui/drawer/StatusAdapter.java @@ -323,6 +323,7 @@ public class StatusAdapter extends RecyclerView.Adapter boolean fullAttachement = sharedpreferences.getBoolean(context.getString(R.string.SET_FULL_PREVIEW), false); boolean displayBookmark = sharedpreferences.getBoolean(context.getString(R.string.SET_DISPLAY_BOOKMARK), false); boolean long_press_media = sharedpreferences.getBoolean(context.getString(R.string.SET_LONG_PRESS_STORE_MEDIA), false); + boolean displayCounters = sharedpreferences.getBoolean(context.getString(R.string.SET_DISPLAY_COUNTER_FAV_BOOST), false); if (MainActivity.currentAccount != null && MainActivity.currentAccount.api == Account.API.PLEROMA) { if (status.pleroma != null && status.pleroma.emoji_reactions != null && status.pleroma.emoji_reactions.size() > 0) { @@ -934,12 +935,22 @@ public class StatusAdapter extends RecyclerView.Adapter holder.binding.visibilitySmall.setVisibility(View.GONE); } else { holder.binding.visibilitySmall.setImageResource(ressource); - holder.binding.statusInfo.setVisibility(View.GONE); - holder.binding.dateShort.setVisibility(View.VISIBLE); - holder.binding.visibilitySmall.setVisibility(View.VISIBLE); - holder.binding.dateShort.setText(Helper.dateDiff(context, status.created_at)); - holder.binding.time.setVisibility(View.GONE); - Helper.absoluteDateTimeReveal(context, holder.binding.dateShort, status.created_at); + if (displayCounters) { + holder.binding.statusInfo.setVisibility(View.VISIBLE); + holder.binding.dateShort.setVisibility(View.GONE); + holder.binding.visibilitySmall.setVisibility(View.GONE); + holder.binding.reblogsCount.setText(String.valueOf(statusToDeal.reblogs_count)); + holder.binding.favoritesCount.setText(String.valueOf(statusToDeal.favourites_count)); + holder.binding.time.setText(Helper.longDateToString(statusToDeal.created_at)); + holder.binding.time.setVisibility(View.VISIBLE); + } else { + holder.binding.statusInfo.setVisibility(View.GONE); + holder.binding.dateShort.setVisibility(View.VISIBLE); + holder.binding.visibilitySmall.setVisibility(View.VISIBLE); + holder.binding.dateShort.setText(Helper.dateDiff(context, statusToDeal.created_at)); + holder.binding.time.setVisibility(View.GONE); + Helper.absoluteDateTimeReveal(context, holder.binding.dateShort, statusToDeal.created_at); + } } //---- SPOILER TEXT ----- diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index dac70c019..e02528b9e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -905,6 +905,7 @@ SET_NOTIF_VALIDATION SET_DISPLAY_BOOKMARK SET_NOTIF_VALIDATION_FAV + SET_DISPLAY_COUNTER_FAV_BOOST SET_NOTIF_SILENT SET_EXPAND_CW SET_DISPLAY_ALL_NOTIFICATIONS_TYPE @@ -1446,4 +1447,5 @@ When enabled, the app will only have a single bar for timelines Timelines in a list When enabled, all pinned timelines will be displayed in a drop-down menu + Display counters for messages diff --git a/app/src/main/res/xml/pref_timelines.xml b/app/src/main/res/xml/pref_timelines.xml index bf408875c..e1809c3d8 100644 --- a/app/src/main/res/xml/pref_timelines.xml +++ b/app/src/main/res/xml/pref_timelines.xml @@ -31,6 +31,12 @@ app:singleLineTitle="false" app:key="@string/SET_NOTIF_VALIDATION_FAV" app:title="@string/set_share_validation_fav" /> +