Improve layout for edited messages

This commit is contained in:
Thomas 2022-11-01 16:01:53 +01:00
parent 164fe2fb13
commit c3132d9415
4 changed files with 43 additions and 10 deletions

View file

@ -1622,7 +1622,7 @@ public class Helper {
}
public void onFinish() {
tvDate.setText(String.format(Locale.getDefault(), "%s%s", dateDiff(context, date), (dateEdit != null ? "*" : "")));
tvDate.setText(dateDiff(context, date));
}
}.start();
});

View file

@ -486,6 +486,8 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
holder.binding.statusAddCustomEmoji.setVisibility(View.VISIBLE);
holder.binding.statusEmoji.setVisibility(View.VISIBLE);
}
Helper.changeDrawableColor(context, R.drawable.ic_baseline_mode_edit_message_24, R.color.cyanea_accent_reference);
if (theme_icons_color != -1) {
Helper.changeDrawableColor(context, holder.binding.actionButtonReply, theme_icons_color);
Helper.changeDrawableColor(context, holder.binding.cacheIndicator, theme_icons_color);
@ -983,15 +985,17 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
holder.binding.favoritesCount.setText(String.valueOf(status.favourites_count));
if (statusToDeal.edited_at != null) {
holder.binding.time.setText(context.getString(R.string.full_date_edited, Helper.longDateToString(status.created_at), Helper.longDateToString(status.edited_at)));
holder.binding.time.setOnClickListener(v -> {
holder.binding.editTime.setText(context.getString(R.string.edited_message_at, Helper.longDateToString(status.edited_at)));
holder.binding.editTime.setOnClickListener(v -> {
Intent historyIntent = new Intent(context, StatusHistoryActivity.class);
historyIntent.putExtra(Helper.ARG_STATUS_ID, statusToDeal.id);
context.startActivity(historyIntent);
});
holder.binding.editTime.setVisibility(View.VISIBLE);
} else {
holder.binding.time.setText(Helper.longDateToString(status.created_at));
holder.binding.editTime.setVisibility(View.GONE);
}
holder.binding.time.setText(Helper.longDateToString(status.created_at));
holder.binding.time.setVisibility(View.VISIBLE);
holder.binding.dateShort.setVisibility(View.GONE);
holder.binding.visibility.setImageResource(ressource);
@ -1005,10 +1009,13 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
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.dateDiff(context, statusToDeal.created_at));
if (statusToDeal.edited_at != null) {
holder.binding.time.setText(String.format(Locale.getDefault(), "%s%s", Helper.dateDiff(context, statusToDeal.created_at), "*"));
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.setText(Helper.dateDiff(context, statusToDeal.created_at));
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);
@ -1018,10 +1025,13 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
holder.binding.dateShort.setVisibility(View.VISIBLE);
holder.binding.visibilitySmall.setVisibility(View.VISIBLE);
if (statusToDeal.edited_at != null) {
holder.binding.dateShort.setText(String.format(Locale.getDefault(), "%s%s", Helper.dateDiff(context, statusToDeal.created_at), "*"));
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.dateShort.setCompoundDrawables(null, null, img, null);
} else {
holder.binding.dateShort.setText(Helper.dateDiff(context, statusToDeal.created_at));
holder.binding.dateShort.setCompoundDrawables(null, null, null, null);
}
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, statusToDeal.edited_at);
}

View file

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="#FFFFFF"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M3,17.25V21h3.75L17.81,9.94l-3.75,-3.75L3,17.25zM20.71,7.04c0.39,-0.39 0.39,-1.02 0,-1.41l-2.34,-2.34c-0.39,-0.39 -1.02,-0.39 -1.41,0l-1.83,1.83 3.75,3.75 1.83,-1.83z" />
</vector>

View file

@ -399,8 +399,7 @@
android:singleLine="true"
android:text="@string/display_media"
android:textAllCaps="false"
android:visibility="gone"
tools:visibility="visible" />
android:visibility="gone" />
<androidx.appcompat.widget.LinearLayoutCompat
android:id="@+id/media_container"
@ -439,6 +438,20 @@
android:layout_marginTop="6dp"
android:layout_marginEnd="6dp" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/edit_time"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginStart="48dp"
android:layout_marginTop="6dp"
android:alpha="0.8"
android:gravity="center_vertical"
android:padding="6dp"
android:textColor="@color/cyanea_accent_dark_reference"
android:visibility="gone"
tools:text="1 January 2021, 12:00"
tools:visibility="visible" />
<androidx.appcompat.widget.LinearLayoutCompat
android:id="@+id/status_info"
android:layout_width="match_parent"