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

This commit is contained in:
Vavassor 2017-07-08 15:44:08 -04:00
parent 125c0e7e6c
commit 14d02e72b7
5 changed files with 35 additions and 4 deletions

View file

@ -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 {

View file

@ -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>

View file

@ -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>

View file

@ -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" />

View file

@ -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>