Some changes

This commit is contained in:
Thomas 2023-09-20 18:23:37 +02:00
parent 69adba7493
commit 83c6a438f3
2 changed files with 41 additions and 41 deletions

View file

@ -1333,46 +1333,51 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
holder.binding.app.setVisibility(View.GONE); holder.binding.app.setVisibility(View.GONE);
holder.binding.editTime.setVisibility(View.GONE); holder.binding.editTime.setVisibility(View.GONE);
holder.binding.visibilitySmall.setImageResource(ressource); holder.binding.visibilitySmall.setImageResource(ressource);
if (displayCounters && canBeFederated) { holder.binding.statusInfo.setVisibility(View.GONE);
holder.binding.actionButtonReplyCount.setText(String.valueOf(statusToDeal.replies_count)); holder.binding.dateShort.setVisibility(View.VISIBLE);
holder.binding.statusInfo.setVisibility(View.VISIBLE); holder.binding.visibilitySmall.setVisibility(View.VISIBLE);
holder.binding.dateShort.setVisibility(View.GONE); if (statusToDeal.edited_at != null) {
holder.binding.visibilitySmall.setVisibility(View.GONE); Drawable img = ContextCompat.getDrawable(context, R.drawable.ic_baseline_mode_edit_message_24);
holder.binding.reblogsCount.setText(String.valueOf(statusToDeal.reblogs_count)); img.setBounds(0, 0, (int) (Helper.convertDpToPixel(16, context) * scale + 0.5f), (int) (Helper.convertDpToPixel(16, context) * scale + 0.5f));
holder.binding.favoritesCount.setText(String.valueOf(statusToDeal.favourites_count)); holder.binding.dateShort.setCompoundDrawables(null, null, img, null);
if (originalDateForBoost || status.reblog == null) {
holder.binding.time.setText(Helper.dateDiff(context, statusToDeal.created_at));
} else {
holder.binding.time.setText(Helper.dateDiff(context, status.created_at));
}
if (statusToDeal.edited_at != null) {
Drawable img = ContextCompat.getDrawable(context, R.drawable.ic_baseline_mode_edit_message_24);
img.setBounds(0, 0, (int) (Helper.convertDpToPixel(16, context) * scale + 0.5f), (int) (Helper.convertDpToPixel(16, context) * scale + 0.5f));
holder.binding.time.setCompoundDrawables(null, null, img, null);
} else {
holder.binding.time.setCompoundDrawables(null, null, null, null);
}
Helper.absoluteDateTimeReveal(context, holder.binding.time, statusToDeal.created_at, statusToDeal.edited_at);
holder.binding.visibility.setImageResource(ressource);
holder.binding.time.setVisibility(View.VISIBLE);
} else { } else {
holder.binding.statusInfo.setVisibility(View.GONE); holder.binding.dateShort.setCompoundDrawables(null, null, null, null);
holder.binding.dateShort.setVisibility(View.VISIBLE); }
holder.binding.visibilitySmall.setVisibility(View.VISIBLE); if (originalDateForBoost || status.reblog == null) {
if (statusToDeal.edited_at != null) { holder.binding.dateShort.setText(Helper.dateDiff(context, statusToDeal.created_at));
Drawable img = ContextCompat.getDrawable(context, R.drawable.ic_baseline_mode_edit_message_24); } else {
img.setBounds(0, 0, (int) (Helper.convertDpToPixel(16, context) * scale + 0.5f), (int) (Helper.convertDpToPixel(16, context) * scale + 0.5f)); holder.binding.dateShort.setText(Helper.dateDiff(context, status.created_at));
holder.binding.dateShort.setCompoundDrawables(null, null, img, null); }
holder.binding.time.setVisibility(View.GONE);
Helper.absoluteDateTimeReveal(context, holder.binding.dateShort, statusToDeal.created_at, statusToDeal.edited_at);
if (displayCounters && canBeFederated) {
if (statusToDeal.reblogs_count > 0) {
holder.binding.actionButtonBoostCount.setText(String.valueOf(statusToDeal.reblogs_count));
holder.binding.actionButtonBoostCount.setVisibility(View.VISIBLE);
} else { } else {
holder.binding.dateShort.setCompoundDrawables(null, null, null, null); holder.binding.actionButtonBoostCount.setVisibility(View.GONE);
} }
if (originalDateForBoost || status.reblog == null) { if (statusToDeal.favourites_count > 0) {
holder.binding.dateShort.setText(Helper.dateDiff(context, statusToDeal.created_at)); holder.binding.actionButtonFavoriteCount.setText(String.valueOf(statusToDeal.favourites_count));
holder.binding.actionButtonFavoriteCount.setVisibility(View.VISIBLE);
} else { } else {
holder.binding.dateShort.setText(Helper.dateDiff(context, status.created_at)); holder.binding.actionButtonFavoriteCount.setVisibility(View.GONE);
}
if (statusToDeal.replies_count > 0 && !(context instanceof ContextActivity)) {
holder.binding.actionButtonReplyCount.setText(String.valueOf(statusToDeal.replies_count));
holder.binding.actionButtonReplyCount.setVisibility(View.VISIBLE);
} else {
holder.binding.actionButtonReplyCount.setVisibility(View.GONE);
}
} else {
holder.binding.actionButtonBoostCount.setVisibility(View.GONE);
holder.binding.actionButtonFavoriteCount.setVisibility(View.GONE);
if (statusToDeal.replies_count > 0 && !(context instanceof ContextActivity)) {
holder.binding.actionButtonReplyCount.setVisibility(View.VISIBLE);
} else {
holder.binding.actionButtonReplyCount.setVisibility(View.GONE);
} }
holder.binding.time.setVisibility(View.GONE);
Helper.absoluteDateTimeReveal(context, holder.binding.dateShort, statusToDeal.created_at, statusToDeal.edited_at);
} }
} }
@ -2433,11 +2438,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
}); });
popup.show(); popup.show();
}); });
if (statusToDeal.replies_count > 0 && !(context instanceof ContextActivity)) {
holder.binding.actionButtonReplyCount.setVisibility(View.VISIBLE);
} else {
holder.binding.actionButtonReplyCount.setVisibility(View.GONE);
}
holder.binding.actionButtonReply.setOnLongClickListener(v -> { holder.binding.actionButtonReply.setOnLongClickListener(v -> {
CrossActionHelper.doCrossAction(context, CrossActionHelper.TypeOfCrossAction.REPLY_ACTION, null, statusToDeal); CrossActionHelper.doCrossAction(context, CrossActionHelper.TypeOfCrossAction.REPLY_ACTION, null, statusToDeal);
return true; return true;

View file

@ -658,7 +658,6 @@
android:visibility="gone" android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/action_button_reply" app:layout_constraintStart_toEndOf="@+id/action_button_reply"
android:layout_marginEnd="10dp"
tools:ignore="HardcodedText" tools:ignore="HardcodedText"
tools:visibility="visible" /> tools:visibility="visible" />