add indicator for direct and local-only posts

This commit is contained in:
sk 2023-01-24 12:40:23 +01:00
parent 8fa4980ba5
commit 349a1115a6
7 changed files with 30 additions and 12 deletions

View File

@ -80,7 +80,7 @@ public class NotificationsListFragment extends BaseStatusListFragment<Notificati
case POLL -> getString(R.string.poll_ended);
case UPDATE -> getString(R.string.sk_post_edited);
};
HeaderStatusDisplayItem titleItem=extraText!=null ? new HeaderStatusDisplayItem(n.id, n.account, n.createdAt, this, accountID, null, extraText, n, null) : null;
HeaderStatusDisplayItem titleItem=extraText!=null ? new HeaderStatusDisplayItem(n.id, n.account, n.createdAt, this, accountID, n.status, extraText, n, null) : null;
if(n.status!=null){
ArrayList<StatusDisplayItem> items=StatusDisplayItem.buildItems(this, n.status, accountID, n, knownAccounts, titleItem!=null, titleItem==null, n);
if(titleItem!=null){

View File

@ -139,7 +139,8 @@ public class StatusEditHistoryFragment extends StatusListFragment{
action=getString(R.string.edit_multiple_changed);
}
}
items.add(0, new ReblogOrReplyLineStatusDisplayItem(s.id, this, action+" · "+date, Collections.emptyList(), 0, null, null));
String sep = getString(R.string.sk_separator);
items.add(0, new ReblogOrReplyLineStatusDisplayItem(s.id, this, action+" "+sep+" "+date, Collections.emptyList(), 0, null, null));
}
return items;
}

View File

@ -50,6 +50,7 @@ public class Status extends BaseModel implements DisplayItemsParent{
public Card card;
public String language;
public String text;
public boolean localOnly;
public boolean favourited;
public boolean reblogged;

View File

@ -9,7 +9,6 @@ import android.os.Build;
import android.os.Bundle;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
import android.util.TypedValue;
import android.view.Menu;
import android.view.MenuItem;
import android.view.SubMenu;
@ -43,6 +42,7 @@ import org.joinmastodon.android.model.Notification;
import org.joinmastodon.android.model.Relationship;
import org.joinmastodon.android.model.ScheduledStatus;
import org.joinmastodon.android.model.Status;
import org.joinmastodon.android.model.StatusPrivacy;
import org.joinmastodon.android.ui.text.HtmlParser;
import org.joinmastodon.android.ui.utils.CustomEmojiHelper;
import org.joinmastodon.android.ui.utils.UiUtils;
@ -52,6 +52,7 @@ import java.time.Instant;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.time.format.FormatStyle;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
@ -318,7 +319,18 @@ public class HeaderStatusDisplayItem extends StatusDisplayItem{
}
itemView.setPadding(itemView.getPaddingLeft(), itemView.getPaddingTop(), itemView.getPaddingRight(), item.needBottomPadding ? V.dp(16) : 0);
if(TextUtils.isEmpty(item.extraText)){
extraText.setVisibility(View.GONE);
List<String> extraParts = new ArrayList<>();
if (item.status != null && item.status.localOnly)
extraParts.add(item.parentFragment.getString(R.string.sk_inline_local_only));
if (item.status != null && item.status.visibility.equals(StatusPrivacy.DIRECT))
extraParts.add(item.parentFragment.getString(R.string.sk_inline_direct));
if (!extraParts.isEmpty()) {
String sep = item.parentFragment.getString(R.string.sk_separator);
extraText.setText(String.join(" " + sep + " ", extraParts));
extraText.setVisibility(View.VISIBLE);
} else {
extraText.setVisibility(View.GONE);
}
}else{
extraText.setVisibility(View.VISIBLE);
extraText.setText(item.extraText);

View File

@ -39,10 +39,11 @@ public class PollFooterStatusDisplayItem extends StatusDisplayItem{
@Override
public void onBind(PollFooterStatusDisplayItem item){
String text=item.parentFragment.getResources().getQuantityString(R.plurals.x_voters, item.poll.votersCount, item.poll.votersCount);
String sep=item.parentFragment.getString(R.string.sk_separator);
if(item.poll.expiresAt!=null && !item.poll.isExpired()){
text+=" · "+UiUtils.formatTimeLeft(itemView.getContext(), item.poll.expiresAt);
text+=" "+sep+" "+UiUtils.formatTimeLeft(itemView.getContext(), item.poll.expiresAt);
}else if(item.poll.isExpired()){
text+=" · "+item.parentFragment.getString(R.string.poll_closed);
text+=" "+sep+" "+item.parentFragment.getString(R.string.poll_closed);
}
this.text.setText(text);
button.setVisibility(item.poll.isExpired() || item.poll.voted || (!item.poll.multiple && !GlobalUserPreferences.voteButtonForSingleChoice) ? View.GONE : View.VISIBLE);

View File

@ -18,7 +18,7 @@
android:layout_height="36dp"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_marginTop="-6dp"
android:layout_marginTop="-5dp"
android:layout_marginEnd="-9.9dp"
android:background="?android:actionBarItemBackground"
android:contentDescription="@string/more_options"
@ -30,7 +30,7 @@
android:id="@+id/delete_notification"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginTop="-6dp"
android:layout_marginTop="-5dp"
android:layout_toStartOf="@id/more"
android:visibility="gone"
android:background="?android:actionBarItemBackground"
@ -43,7 +43,7 @@
android:id="@+id/visibility"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginTop="-6dp"
android:layout_marginTop="-5dp"
android:layout_toStartOf="@id/delete_notification"
android:background="?android:actionBarItemBackground"
android:scaleType="center"
@ -54,7 +54,7 @@
android:id="@+id/unread_indicator"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginTop="-6dp"
android:layout_marginTop="-5dp"
android:layout_toStartOf="@id/visibility"
android:visibility="gone"
android:tint="?android:colorAccent"
@ -93,7 +93,7 @@
android:id="@+id/extra_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginStart="8sp"
android:ellipsize="end"
android:fontFamily="sans-serif"
android:singleLine="true"
@ -130,7 +130,7 @@
android:layout_marginLeft="4sp"
android:layout_marginRight="4sp"
android:importantForAccessibility="no"
android:text="·"
android:text="@string/sk_separator"
android:textAppearance="@style/m3_title_small" />
<TextView

View File

@ -236,4 +236,7 @@
<string name="sk_settings_show_no_alt_indicator">Indicator for missing alt texts</string>
<string name="sk_updater_enable_pre_releases">Enable pre-releases</string>
<string name="sk_settings_show_new_posts_button">“Show new posts” button</string>
<string name="sk_inline_local_only">local-only</string>
<string name="sk_inline_direct">direct</string>
<string name="sk_separator">·</string>
</resources>