Skip to content

Commit

Permalink
feat: display boost timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
FineFindus committed Feb 10, 2024
1 parent 6435e9b commit c5b5aa2
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,16 @@ public ImageLoaderRequest getImageRequest(int index){
}

public static class Holder extends StatusDisplayItem.Holder<ReblogOrReplyLineStatusDisplayItem> implements ImageLoaderViewHolder{
private final TextView text, extraText;
private final View separator;
private final TextView text, extraText, boostingTimestamp;
private final View separator, timeSeparator;

public Holder(Activity activity, ViewGroup parent){
super(activity, R.layout.display_item_reblog_or_reply_line, parent);
text=findViewById(R.id.text);
extraText=findViewById(R.id.extra_text);
separator=findViewById(R.id.separator);
boostingTimestamp=findViewById(R.id.boosting_timestamp);
timeSeparator=findViewById(R.id.time_separator);
}

private void bindLine(ReblogOrReplyLineStatusDisplayItem item, TextView text) {
Expand All @@ -144,11 +146,14 @@ private void bindLine(ReblogOrReplyLineStatusDisplayItem item, TextView text) {
if(Build.VERSION.SDK_INT<Build.VERSION_CODES.N)
UiUtils.fixCompoundDrawableTintOnAndroid6(text);
text.setCompoundDrawableTintList(text.getTextColors());
boostingTimestamp.setText(UiUtils.formatRelativeTimestamp(context, item.status.createdAt));
}

@Override
public void onBind(ReblogOrReplyLineStatusDisplayItem item){
bindLine(item, text);
boostingTimestamp.setVisibility(item.status.reblog == null ? View.GONE : View.VISIBLE);
timeSeparator.setVisibility(item.status.reblog == null ? View.GONE : View.VISIBLE);
if (item.extra != null) bindLine(item.extra, extraText);
extraText.setVisibility(item.extra == null ? View.GONE : View.VISIBLE);
separator.setVisibility(item.extra == null ? View.GONE : View.VISIBLE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingHorizontal="16dp"
android:paddingStart="16dp"
android:layout_marginBottom="-4dp">

<TextView
Expand Down Expand Up @@ -49,4 +49,30 @@
android:singleLine="true"
android:ellipsize="middle"/>

<TextView
android:id="@+id/time_separator"
android:visibility="visible"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginHorizontal="6dp"
android:paddingTop="16dp"
android:paddingHorizontal="1dp"
android:textAppearance="@style/m3_title_small"
android:textColor="?colorM3OnSurface"
android:gravity="center_horizontal"
android:importantForAccessibility="no"
android:includeFontPadding="false"
android:text="@string/sk_separator" />

<TextView
android:id="@+id/boosting_timestamp"
android:visibility="visible"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="16dp"
android:textAppearance="@style/m3_title_small"
android:textColor="?colorM3OnSurface"
android:singleLine="true"
android:ellipsize="none"/>

</org.joinmastodon.android.ui.views.HeaderSubtitleLinearLayout>

0 comments on commit c5b5aa2

Please sign in to comment.