Fixes icons on statuses and notifications not being the right colour on the light theme.

Maybe could be a more elegant solution than drawable duplication but for now fine.
This commit is contained in:
Vavassor 2017-03-07 23:52:17 -05:00
parent 7519ad5455
commit e46731454d
15 changed files with 55 additions and 31 deletions

View File

@ -91,7 +91,7 @@ class NotificationsAdapter extends RecyclerView.Adapter implements AdapterItemRe
case MENTION: { case MENTION: {
StatusViewHolder holder = (StatusViewHolder) viewHolder; StatusViewHolder holder = (StatusViewHolder) viewHolder;
Status status = notification.getStatus(); Status status = notification.getStatus();
holder.setupWithStatus(status, statusListener, position); holder.setupWithStatus(status, statusListener);
break; break;
} }
case FAVOURITE: case FAVOURITE:

View File

@ -16,7 +16,6 @@
package com.keylesspalace.tusky; package com.keylesspalace.tusky;
import android.content.Context; import android.content.Context;
import android.media.Image;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.text.SpannableStringBuilder; import android.text.SpannableStringBuilder;
@ -31,11 +30,8 @@ import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import android.widget.ToggleButton; import android.widget.ToggleButton;
import com.android.volley.toolbox.ImageLoader;
import com.android.volley.toolbox.NetworkImageView;
import com.squareup.picasso.Picasso; import com.squareup.picasso.Picasso;
import com.varunest.sparkbutton.SparkButton; import com.varunest.sparkbutton.SparkButton;
import com.varunest.sparkbutton.SparkButtonBuilder;
import com.varunest.sparkbutton.SparkEventListener; import com.varunest.sparkbutton.SparkEventListener;
import java.util.Date; import java.util.Date;
@ -198,11 +194,15 @@ class StatusViewHolder extends RecyclerView.ViewHolder {
reblogButton.setEnabled(enabled); reblogButton.setEnabled(enabled);
if (enabled) { if (enabled) {
reblogButton.setInactiveImage(R.drawable.reblog_inactive); int inactiveId = ThemeUtils.getDrawableId(reblogButton.getContext(),
R.attr.status_reblog_inactive_drawable, R.drawable.reblog_inactive_dark);
reblogButton.setInactiveImage(inactiveId);
reblogButton.setActiveImage(R.drawable.reblog_active); reblogButton.setActiveImage(R.drawable.reblog_active);
} else { } else {
reblogButton.setInactiveImage(R.drawable.reblog_disabled); int disabledId = ThemeUtils.getDrawableId(reblogButton.getContext(),
reblogButton.setActiveImage(R.drawable.reblog_disabled); R.attr.status_reblog_disabled_drawable, R.drawable.reblog_disabled_dark);
reblogButton.setInactiveImage(disabledId);
reblogButton.setActiveImage(disabledId);
} }
} }
@ -338,7 +338,7 @@ class StatusViewHolder extends RecyclerView.ViewHolder {
container.setOnClickListener(viewThreadListener); container.setOnClickListener(viewThreadListener);
} }
void setupWithStatus(Status status, StatusActionListener listener, int position) { void setupWithStatus(Status status, StatusActionListener listener) {
setDisplayName(status.getDisplayName()); setDisplayName(status.getDisplayName());
setUsername(status.getUsername()); setUsername(status.getUsername());
setCreatedAt(status.getCreatedAt()); setCreatedAt(status.getCreatedAt());

View File

@ -45,7 +45,7 @@ class ThreadAdapter extends RecyclerView.Adapter implements AdapterItemRemover {
public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) { public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) {
StatusViewHolder holder = (StatusViewHolder) viewHolder; StatusViewHolder holder = (StatusViewHolder) viewHolder;
Status status = statuses.get(position); Status status = statuses.get(position);
holder.setupWithStatus(status, statusActionListener, position); holder.setupWithStatus(status, statusActionListener);
} }
@Override @Override

View File

@ -64,7 +64,7 @@ class TimelineAdapter extends RecyclerView.Adapter implements AdapterItemRemover
if (position < statuses.size()) { if (position < statuses.size()) {
StatusViewHolder holder = (StatusViewHolder) viewHolder; StatusViewHolder holder = (StatusViewHolder) viewHolder;
Status status = statuses.get(position); Status status = statuses.get(position);
holder.setupWithStatus(status, statusListener, position); holder.setupWithStatus(status, statusListener);
} else { } else {
FooterViewHolder holder = (FooterViewHolder) viewHolder; FooterViewHolder holder = (FooterViewHolder) viewHolder;
holder.setState(footerState); holder.setState(footerState);

View File

@ -0,0 +1,9 @@
<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_favourite_button_light"
android:pathData="M12,17.27L18.18,21l-1.64,-7.03L22,9.24l-7.19,-0.61L12,2 9.19,8.63 2,9.24l5.46,4.73L5.82,21z"/>
</vector>

View File

@ -0,0 +1,9 @@
<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="M18,8h-1L17,6c0,-2.76 -2.24,-5 -5,-5S7,3.24 7,6v2L6,8c-1.1,0 -2,0.9 -2,2v10c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2L20,10c0,-1.1 -0.9,-2 -2,-2zM12,17c-1.1,0 -2,-0.9 -2,-2s0.9,-2 2,-2 2,0.9 2,2 -0.9,2 -2,2zM15.1,8L8.9,8L8.9,6c0,-1.71 1.39,-3.1 3.1,-3.1 1.71,0 3.1,1.39 3.1,3.1v2z"/>
</vector>

View File

@ -0,0 +1,9 @@
<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_light"
android:pathData="M7,7h10v3l4,-4 -4,-4v3L5,5v6h2L7,7zM17,17L7,17v-3l-4,4 4,4v-3h12v-6h-2v4z"/>
</vector>

View File

@ -251,7 +251,7 @@
<com.varunest.sparkbutton.SparkButton <com.varunest.sparkbutton.SparkButton
android:id="@+id/status_reblog" android:id="@+id/status_reblog"
app:sparkbutton_activeImage="@drawable/reblog_active" app:sparkbutton_activeImage="@drawable/reblog_active"
app:sparkbutton_inActiveImage="@drawable/reblog_inactive" app:sparkbutton_inActiveImage="?attr/status_reblog_inactive_drawable"
app:sparkbutton_iconSize="28dp" app:sparkbutton_iconSize="28dp"
android:layout_gravity="center" android:layout_gravity="center"
app:sparkbutton_primaryColor="@color/status_reblog_button_marked_dark" app:sparkbutton_primaryColor="@color/status_reblog_button_marked_dark"
@ -268,7 +268,7 @@
android:layout_width="32dp" android:layout_width="32dp"
android:layout_height="32dp" android:layout_height="32dp"
app:sparkbutton_activeImage="@drawable/favourite_active" app:sparkbutton_activeImage="@drawable/favourite_active"
app:sparkbutton_inActiveImage="@drawable/favourite_inactive" app:sparkbutton_inActiveImage="?attr/status_favourite_inactive_drawable"
app:sparkbutton_iconSize="28dp" app:sparkbutton_iconSize="28dp"
android:layout_gravity="center" android:layout_gravity="center"
app:sparkbutton_primaryColor="@color/status_favourite_button_marked_light" app:sparkbutton_primaryColor="@color/status_favourite_button_marked_light"
@ -283,9 +283,9 @@
<ImageButton <ImageButton
app:srcCompat="@drawable/ic_more_horiz_24dp" app:srcCompat="@drawable/ic_more_horiz_24dp"
android:id="@+id/status_more" android:id="@+id/status_more"
style="?attr/image_button_style"
android:layout_width="32dp" android:layout_width="32dp"
android:layout_height="32dp" /> android:layout_height="32dp"
style="?attr/image_button_style" />
<Space <Space
android:layout_width="0dp" android:layout_width="0dp"

View File

@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!--This applies only to favourite and reblog notifications.-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical" android:orientation="vertical"
@ -19,8 +20,7 @@
android:id="@+id/notification_icon" android:id="@+id/notification_icon"
android:paddingRight="10dp" android:paddingRight="10dp"
android:paddingLeft="24dp" android:paddingLeft="24dp"
app:srcCompat="@drawable/ic_repeat_24dp" app:srcCompat="@drawable/ic_repeat_24dp" />
android:tint="?attr/colorAccent" />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"

View File

@ -14,10 +14,9 @@
<attr name="toolbar_background_color" format="reference" /> <attr name="toolbar_background_color" format="reference" />
<attr name="toolbar_icon_tint" format="reference" /> <attr name="toolbar_icon_tint" format="reference" />
<attr name="image_button_style" format="reference" /> <attr name="image_button_style" format="reference" />
<attr name="status_reblog_button_tint" format="reference|color" /> <attr name="status_reblog_inactive_drawable" format="reference" />
<attr name="status_reblog_button_marked_tint" format="reference|color" /> <attr name="status_reblog_disabled_drawable" format="reference" />
<attr name="status_reblog_button_disabled_tint" format="reference|color" /> <attr name="status_favourite_inactive_drawable" format="reference" />
<attr name="status_favourite_button_tint" format="reference|color" />
<attr name="status_favourite_button_marked_tint" format="reference|color" /> <attr name="status_favourite_button_marked_tint" format="reference|color" />
<attr name="content_warning_button" format="reference" /> <attr name="content_warning_button" format="reference" />
<attr name="sensitive_media_warning_background_color" format="reference|color" /> <attr name="sensitive_media_warning_background_color" format="reference|color" />

View File

@ -49,13 +49,13 @@
<color name="edit_text_color_light">#000000</color> <color name="edit_text_color_light">#000000</color>
<color name="text_color_primary_light">#000000</color> <color name="text_color_primary_light">#000000</color>
<color name="text_color_secondary_light">#000000</color> <color name="text_color_secondary_light">#000000</color>
<color name="text_color_tertiary_light">#000000</color> <color name="text_color_tertiary_light">#4f5f5f</color>
<color name="text_color_primary_inverse_light">#FFFFFF</color> <color name="text_color_primary_inverse_light">#FFFFFF</color>
<color name="text_color_secondary_inverse_light">#FFFFFF</color> <color name="text_color_secondary_inverse_light">#FFFFFF</color>
<color name="text_color_tertiary_inverse_light">#FFFFFF</color> <color name="text_color_tertiary_inverse_light">#FFFFFF</color>
<color name="toolbar_background_light">#f6f7f7</color> <color name="toolbar_background_light">#f6f7f7</color>
<color name="toolbar_icon_light">#000000</color> <color name="toolbar_icon_light">#000000</color>
<color name="image_button_light">#2F2F2F</color> <color name="image_button_light">#4F4F4F</color>
<color name="status_reblog_button_light">#4F4F4F</color> <color name="status_reblog_button_light">#4F4F4F</color>
<color name="status_reblog_button_marked_light">#56a7e1</color> <color name="status_reblog_button_marked_light">#56a7e1</color>
<color name="status_reblog_button_disabled_light">#BFBFBF</color> <color name="status_reblog_button_disabled_light">#BFBFBF</color>

View File

@ -34,10 +34,9 @@
<item name="toolbar_background_color">@color/toolbar_background_dark</item> <item name="toolbar_background_color">@color/toolbar_background_dark</item>
<item name="toolbar_icon_tint">@color/toolbar_icon_dark</item> <item name="toolbar_icon_tint">@color/toolbar_icon_dark</item>
<item name="image_button_style">@style/AppTheme.ImageButton.Dark</item> <item name="image_button_style">@style/AppTheme.ImageButton.Dark</item>
<item name="status_reblog_button_tint">@color/status_reblog_button_dark</item> <item name="status_reblog_inactive_drawable">@drawable/reblog_inactive_dark</item>
<item name="status_reblog_button_marked_tint">@color/status_reblog_button_marked_dark</item> <item name="status_reblog_disabled_drawable">@drawable/reblog_disabled_dark</item>
<item name="status_reblog_button_disabled_tint">@color/status_reblog_button_disabled_dark</item> <item name="status_favourite_inactive_drawable">@drawable/favourite_inactive_dark</item>
<item name="status_favourite_button_tint">@color/status_favourite_button_dark</item>
<item name="status_favourite_button_marked_tint">@color/status_favourite_button_marked_dark</item> <item name="status_favourite_button_marked_tint">@color/status_favourite_button_marked_dark</item>
<item name="content_warning_button">@drawable/toggle_small</item> <item name="content_warning_button">@drawable/toggle_small</item>
<item name="sensitive_media_warning_background_color">@color/color_background_dark</item> <item name="sensitive_media_warning_background_color">@color/color_background_dark</item>
@ -95,10 +94,9 @@
<item name="toolbar_background_color">@color/toolbar_background_light</item> <item name="toolbar_background_color">@color/toolbar_background_light</item>
<item name="toolbar_icon_tint">@color/toolbar_icon_light</item> <item name="toolbar_icon_tint">@color/toolbar_icon_light</item>
<item name="image_button_style">@style/AppTheme.ImageButton.Light</item> <item name="image_button_style">@style/AppTheme.ImageButton.Light</item>
<item name="status_reblog_button_tint">@color/status_reblog_button_light</item> <item name="status_reblog_inactive_drawable">@drawable/reblog_inactive_light</item>
<item name="status_reblog_button_marked_tint">@color/status_reblog_button_marked_light</item> <item name="status_reblog_disabled_drawable">@drawable/reblog_disabled_light</item>
<item name="status_reblog_button_disabled_tint">@color/status_reblog_button_disabled_light</item> <item name="status_favourite_inactive_drawable">@drawable/favourite_inactive_light</item>
<item name="status_favourite_button_tint">@color/status_favourite_button_light</item>
<item name="status_favourite_button_marked_tint">@color/status_favourite_button_marked_light</item> <item name="status_favourite_button_marked_tint">@color/status_favourite_button_marked_light</item>
<item name="content_warning_button">@drawable/toggle_small_light</item> <item name="content_warning_button">@drawable/toggle_small_light</item>
<item name="sensitive_media_warning_background_color">@color/sensitive_media_warning_background_light</item> <item name="sensitive_media_warning_background_color">@color/sensitive_media_warning_background_light</item>