Adds envelope icon indicator to direct messages on timelines, so they can be differentiated from private statuses.

main
Vavassor 7 years ago
parent a12390875a
commit 7fc9603cb4
  1. 16
      app/src/main/java/com/keylesspalace/tusky/adapter/StatusViewHolder.java
  2. 10
      app/src/main/res/drawable/reblog_direct_dark.xml
  3. 10
      app/src/main/res/drawable/reblog_direct_light.xml
  4. 1
      app/src/main/res/values/attrs.xml
  5. 2
      app/src/main/res/values/styles.xml

@ -19,6 +19,7 @@ import android.content.Context;
import android.graphics.drawable.Drawable;
import android.preference.PreferenceManager;
import android.support.annotation.DrawableRes;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.RecyclerView;
@ -173,7 +174,7 @@ class StatusViewHolder extends RecyclerView.ViewHolder {
}
/** This should only be called after setReblogged, in order to override the tint correctly. */
private void setRebloggingEnabled(boolean enabled) {
private void setRebloggingEnabled(boolean enabled, Status.Visibility visibility) {
reblogButton.setEnabled(enabled);
if (enabled) {
@ -182,8 +183,14 @@ class StatusViewHolder extends RecyclerView.ViewHolder {
reblogButton.setInactiveImage(inactiveId);
reblogButton.setActiveImage(R.drawable.reblog_active);
} else {
int disabledId = ThemeUtils.getDrawableId(reblogButton.getContext(),
R.attr.status_reblog_disabled_drawable, R.drawable.reblog_disabled_dark);
int disabledId;
if (visibility == Status.Visibility.DIRECT) {
disabledId = ThemeUtils.getDrawableId(reblogButton.getContext(),
R.attr.status_reblog_direct_drawable, R.drawable.reblog_direct_dark);
} else {
disabledId = ThemeUtils.getDrawableId(reblogButton.getContext(),
R.attr.status_reblog_disabled_drawable, R.drawable.reblog_disabled_dark);
}
reblogButton.setInactiveImage(disabledId);
reblogButton.setActiveImage(disabledId);
}
@ -266,6 +273,7 @@ class StatusViewHolder extends RecyclerView.ViewHolder {
}
}
@NonNull
private static String getLabelTypeText(Context context, Status.MediaAttachment.Type type) {
switch (type) {
default:
@ -468,7 +476,7 @@ class StatusViewHolder extends RecyclerView.ViewHolder {
}
setupButtons(listener, realStatus.account.id);
setRebloggingEnabled(status.rebloggingAllowed());
setRebloggingEnabled(status.rebloggingAllowed(), status.getVisibility());
if (realStatus.spoilerText.isEmpty()) {
hideSpoilerText();
} else {

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="@color/status_reblog_button_disabled_dark"
android:pathData="M20,4L4,4c-1.1,0 -1.99,0.9 -1.99,2L2,18c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,6c0,-1.1 -0.9,-2 -2,-2zM20,8l-8,5 -8,-5L4,6l8,5 8,-5v2z" />
</vector>

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="@color/status_reblog_button_disabled_light"
android:pathData="M20,4L4,4c-1.1,0 -1.99,0.9 -1.99,2L2,18c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,6c0,-1.1 -0.9,-2 -2,-2zM20,8l-8,5 -8,-5L4,6l8,5 8,-5v2z" />
</vector>

@ -18,6 +18,7 @@
<attr name="image_button_style" format="reference" />
<attr name="status_reblog_inactive_drawable" format="reference" />
<attr name="status_reblog_disabled_drawable" format="reference" />
<attr name="status_reblog_direct_drawable" format="reference" />
<attr name="status_favourite_active_drawable" format="reference" />
<attr name="status_favourite_inactive_drawable" format="reference" />
<attr name="content_warning_button" format="reference" />

@ -48,6 +48,7 @@
<item name="image_button_style">@style/AppTheme.ImageButton.Dark</item>
<item name="status_reblog_inactive_drawable">@drawable/reblog_inactive_dark</item>
<item name="status_reblog_disabled_drawable">@drawable/reblog_disabled_dark</item>
<item name="status_reblog_direct_drawable">@drawable/reblog_direct_dark</item>
<item name="status_favourite_active_drawable">@drawable/favourite_active_dark</item>
<item name="status_favourite_inactive_drawable">@drawable/favourite_inactive_dark</item>
<item name="content_warning_button">@drawable/toggle_small</item>
@ -125,6 +126,7 @@
<item name="image_button_style">@style/AppTheme.ImageButton.Light</item>
<item name="status_reblog_inactive_drawable">@drawable/reblog_inactive_light</item>
<item name="status_reblog_disabled_drawable">@drawable/reblog_disabled_light</item>
<item name="status_reblog_direct_drawable">@drawable/reblog_direct_light</item>
<item name="status_favourite_active_drawable">@drawable/favourite_active_light</item>
<item name="status_favourite_inactive_drawable">@drawable/favourite_inactive_light</item>
<item name="content_warning_button">@drawable/toggle_small_light</item>

Loading…
Cancel
Save