Fix issue #114 - Allow to display counters in timelines

This commit is contained in:
Thomas 2022-09-13 17:40:23 +02:00
parent 4e480812bf
commit 05074439c9
3 changed files with 25 additions and 6 deletions

View File

@ -323,6 +323,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
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<RecyclerView.ViewHolder>
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 -----

View File

@ -905,6 +905,7 @@
<string name="SET_NOTIF_VALIDATION" translatable="false">SET_NOTIF_VALIDATION</string>
<string name="SET_DISPLAY_BOOKMARK" translatable="false">SET_DISPLAY_BOOKMARK</string>
<string name="SET_NOTIF_VALIDATION_FAV" translatable="false">SET_NOTIF_VALIDATION_FAV</string>
<string name="SET_DISPLAY_COUNTER_FAV_BOOST" translatable="false">SET_DISPLAY_COUNTER_FAV_BOOST</string>
<string name="SET_NOTIF_SILENT" translatable="false">SET_NOTIF_SILENT</string>
<string name="SET_EXPAND_CW" translatable="false">SET_EXPAND_CW</string>
<string name="SET_DISPLAY_ALL_NOTIFICATIONS_TYPE" translatable="false">SET_DISPLAY_ALL_NOTIFICATIONS_TYPE</string>
@ -1446,4 +1447,5 @@
<string name="set_single_topbar">When enabled, the app will only have a single bar for timelines</string>
<string name="set_timelines_in_a_list_title">Timelines in a list</string>
<string name="set_timelines_in_a_list">When enabled, all pinned timelines will be displayed in a drop-down menu</string>
<string name="set_display_counter">Display counters for messages</string>
</resources>

View File

@ -31,6 +31,12 @@
app:singleLineTitle="false"
app:key="@string/SET_NOTIF_VALIDATION_FAV"
app:title="@string/set_share_validation_fav" />
<SwitchPreferenceCompat
android:defaultValue="false"
app:iconSpaceReserved="false"
app:key="@string/SET_DISPLAY_COUNTER_FAV_BOOST"
app:singleLineTitle="false"
app:title="@string/set_display_counter" />
<SeekBarPreference
app:iconSpaceReserved="false"
app:showSeekBarValue="true"