fix timestamp being hidden for long usernames

closes sk22#772
This commit is contained in:
sk 2023-08-27 14:12:23 +02:00
parent 91bf1b277f
commit ef3f96ba74
3 changed files with 52 additions and 17 deletions

View File

@ -139,7 +139,9 @@ public class CustomWelcomeFragment extends InstanceCatalogFragment {
headerView.findViewById(R.id.more).setVisibility(View.GONE);
headerView.findViewById(R.id.visibility).setVisibility(View.GONE);
headerView.findViewById(R.id.unread_indicator).setVisibility(View.GONE);
((TextView) headerView.findViewById(R.id.time_and_username)).setText(R.string.sk_app_username);
headerView.findViewById(R.id.separator).setVisibility(View.GONE);
headerView.findViewById(R.id.time).setVisibility(View.GONE);
((TextView) headerView.findViewById(R.id.username)).setText(R.string.sk_app_username);
((TextView) headerView.findViewById(R.id.name)).setText(R.string.sk_app_name);
((ImageView) headerView.findViewById(R.id.avatar)).setImageDrawable(getActivity().getDrawable(R.mipmap.ic_launcher));
((FragmentStackActivity) getActivity()).invalidateSystemBarColors(this);

View File

@ -132,8 +132,8 @@ public class HeaderStatusDisplayItem extends StatusDisplayItem{
}
public static class Holder extends StatusDisplayItem.Holder<HeaderStatusDisplayItem> implements ImageLoaderViewHolder{
private final TextView name, timeAndUsername, extraText, pronouns;
private final View collapseBtn;
private final TextView name, time, username, extraText, pronouns;
private final View collapseBtn, timeUsernameSeparator;
private final ImageView avatar, more, visibility, deleteNotification, unreadIndicator, markAsRead, collapseBtnIcon;
private final PopupMenu optionsMenu;
private Relationship relationship;
@ -146,7 +146,9 @@ public class HeaderStatusDisplayItem extends StatusDisplayItem{
protected Holder(Activity activity, @LayoutRes int layout, ViewGroup parent){
super(activity, layout, parent);
name=findViewById(R.id.name);
timeAndUsername=findViewById(R.id.time_and_username);
time=findViewById(R.id.time);
username=findViewById(R.id.username);
timeUsernameSeparator=findViewById(R.id.separator);
avatar=findViewById(R.id.avatar);
more=findViewById(R.id.more);
visibility=findViewById(R.id.visibility);
@ -315,10 +317,10 @@ public class HeaderStatusDisplayItem extends StatusDisplayItem{
else if (item.status != null && item.status.editedAt != null)
time=item.parentFragment.getString(R.string.edited_timestamp, UiUtils.formatRelativeTimestamp(itemView.getContext(), item.status.editedAt));
String sepp = item.parentFragment.getString(R.string.sk_separator);
String username = "@" + item.user.acct;
timeAndUsername.setText(time == null ? username :
username + " " + sepp + " " + time);
this.username.setText("@" + item.user.acct);
this.timeUsernameSeparator.setVisibility(time==null ? View.GONE : View.VISIBLE);
this.time.setVisibility(time==null ? View.GONE : View.VISIBLE);
if(time!=null) this.time.setText(time);
deleteNotification.setVisibility(GlobalUserPreferences.enableDeleteNotifications && item.notification!=null && !item.inset ? View.VISIBLE : View.GONE);
if (item.hasVisibilityToggle){

View File

@ -152,20 +152,51 @@
</org.joinmastodon.android.ui.views.HeaderSubtitleLinearLayout>
<TextView
android:id="@+id/time_and_username"
<org.joinmastodon.android.ui.views.HeaderSubtitleLinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/time_and_username"
android:layout_alignBottom="@id/avatar"
android:layout_marginEnd="8dp"
android:layout_toStartOf="@id/buttons"
android:layout_toEndOf="@id/avatar"
android:layout_marginBottom="3sp"
android:layout_marginBottom="3sp">
<TextView
android:id="@+id/username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAlignment="viewStart"
android:singleLine="true"
android:ellipsize="end"
android:textAppearance="@style/m3_body_medium"
android:textColor="?colorM3OnSurfaceVariant"
tools:text="9h ago · \@Gargron@mastodon.social"/>
tools:text="\@Gargron@mastodon.social"/>
<TextView
android:id="@+id/separator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginHorizontal="4sp"
android:textAlignment="viewStart"
android:importantForAccessibility="no"
android:singleLine="true"
android:textAppearance="@style/m3_body_medium"
android:textColor="?colorM3OnSurfaceVariant"
android:text="@string/sk_separator"/>
<TextView
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAlignment="viewStart"
android:singleLine="true"
android:ellipsize="end"
android:textAppearance="@style/m3_body_medium"
android:textColor="?colorM3OnSurfaceVariant"
tools:text="9h ago"/>
</org.joinmastodon.android.ui.views.HeaderSubtitleLinearLayout>
</RelativeLayout>