From e46731454d423325feeabf1d306788250abb6f7e Mon Sep 17 00:00:00 2001 From: Vavassor Date: Tue, 7 Mar 2017 23:52:17 -0500 Subject: [PATCH] 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. --- .../tusky/NotificationsAdapter.java | 2 +- .../keylesspalace/tusky/StatusViewHolder.java | 16 ++++++++-------- .../com/keylesspalace/tusky/ThreadAdapter.java | 2 +- .../com/keylesspalace/tusky/TimelineAdapter.java | 2 +- ..._inactive.xml => favourite_inactive_dark.xml} | 0 .../res/drawable/favourite_inactive_light.xml | 9 +++++++++ ...log_disabled.xml => reblog_disabled_dark.xml} | 0 .../main/res/drawable/reblog_disabled_light.xml | 9 +++++++++ ...log_inactive.xml => reblog_inactive_dark.xml} | 0 .../main/res/drawable/reblog_inactive_light.xml | 9 +++++++++ app/src/main/res/layout/item_status.xml | 8 ++++---- .../main/res/layout/item_status_notification.xml | 4 ++-- app/src/main/res/values/attrs.xml | 7 +++---- app/src/main/res/values/colors.xml | 4 ++-- app/src/main/res/values/styles.xml | 14 ++++++-------- 15 files changed, 55 insertions(+), 31 deletions(-) rename app/src/main/res/drawable/{favourite_inactive.xml => favourite_inactive_dark.xml} (100%) create mode 100644 app/src/main/res/drawable/favourite_inactive_light.xml rename app/src/main/res/drawable/{reblog_disabled.xml => reblog_disabled_dark.xml} (100%) create mode 100644 app/src/main/res/drawable/reblog_disabled_light.xml rename app/src/main/res/drawable/{reblog_inactive.xml => reblog_inactive_dark.xml} (100%) create mode 100644 app/src/main/res/drawable/reblog_inactive_light.xml diff --git a/app/src/main/java/com/keylesspalace/tusky/NotificationsAdapter.java b/app/src/main/java/com/keylesspalace/tusky/NotificationsAdapter.java index 8425805d..c8306542 100644 --- a/app/src/main/java/com/keylesspalace/tusky/NotificationsAdapter.java +++ b/app/src/main/java/com/keylesspalace/tusky/NotificationsAdapter.java @@ -91,7 +91,7 @@ class NotificationsAdapter extends RecyclerView.Adapter implements AdapterItemRe case MENTION: { StatusViewHolder holder = (StatusViewHolder) viewHolder; Status status = notification.getStatus(); - holder.setupWithStatus(status, statusListener, position); + holder.setupWithStatus(status, statusListener); break; } case FAVOURITE: diff --git a/app/src/main/java/com/keylesspalace/tusky/StatusViewHolder.java b/app/src/main/java/com/keylesspalace/tusky/StatusViewHolder.java index 12eee0ab..09521551 100644 --- a/app/src/main/java/com/keylesspalace/tusky/StatusViewHolder.java +++ b/app/src/main/java/com/keylesspalace/tusky/StatusViewHolder.java @@ -16,7 +16,6 @@ package com.keylesspalace.tusky; import android.content.Context; -import android.media.Image; import android.support.annotation.Nullable; import android.support.v7.widget.RecyclerView; import android.text.SpannableStringBuilder; @@ -31,11 +30,8 @@ import android.widget.ImageView; import android.widget.TextView; import android.widget.ToggleButton; -import com.android.volley.toolbox.ImageLoader; -import com.android.volley.toolbox.NetworkImageView; import com.squareup.picasso.Picasso; import com.varunest.sparkbutton.SparkButton; -import com.varunest.sparkbutton.SparkButtonBuilder; import com.varunest.sparkbutton.SparkEventListener; import java.util.Date; @@ -198,11 +194,15 @@ class StatusViewHolder extends RecyclerView.ViewHolder { reblogButton.setEnabled(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); } else { - reblogButton.setInactiveImage(R.drawable.reblog_disabled); - reblogButton.setActiveImage(R.drawable.reblog_disabled); + int disabledId = ThemeUtils.getDrawableId(reblogButton.getContext(), + 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); } - void setupWithStatus(Status status, StatusActionListener listener, int position) { + void setupWithStatus(Status status, StatusActionListener listener) { setDisplayName(status.getDisplayName()); setUsername(status.getUsername()); setCreatedAt(status.getCreatedAt()); diff --git a/app/src/main/java/com/keylesspalace/tusky/ThreadAdapter.java b/app/src/main/java/com/keylesspalace/tusky/ThreadAdapter.java index a53e2b66..3e9ed57b 100644 --- a/app/src/main/java/com/keylesspalace/tusky/ThreadAdapter.java +++ b/app/src/main/java/com/keylesspalace/tusky/ThreadAdapter.java @@ -45,7 +45,7 @@ class ThreadAdapter extends RecyclerView.Adapter implements AdapterItemRemover { public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) { StatusViewHolder holder = (StatusViewHolder) viewHolder; Status status = statuses.get(position); - holder.setupWithStatus(status, statusActionListener, position); + holder.setupWithStatus(status, statusActionListener); } @Override diff --git a/app/src/main/java/com/keylesspalace/tusky/TimelineAdapter.java b/app/src/main/java/com/keylesspalace/tusky/TimelineAdapter.java index 4bf1c598..792afd40 100644 --- a/app/src/main/java/com/keylesspalace/tusky/TimelineAdapter.java +++ b/app/src/main/java/com/keylesspalace/tusky/TimelineAdapter.java @@ -64,7 +64,7 @@ class TimelineAdapter extends RecyclerView.Adapter implements AdapterItemRemover if (position < statuses.size()) { StatusViewHolder holder = (StatusViewHolder) viewHolder; Status status = statuses.get(position); - holder.setupWithStatus(status, statusListener, position); + holder.setupWithStatus(status, statusListener); } else { FooterViewHolder holder = (FooterViewHolder) viewHolder; holder.setState(footerState); diff --git a/app/src/main/res/drawable/favourite_inactive.xml b/app/src/main/res/drawable/favourite_inactive_dark.xml similarity index 100% rename from app/src/main/res/drawable/favourite_inactive.xml rename to app/src/main/res/drawable/favourite_inactive_dark.xml diff --git a/app/src/main/res/drawable/favourite_inactive_light.xml b/app/src/main/res/drawable/favourite_inactive_light.xml new file mode 100644 index 00000000..62f63cac --- /dev/null +++ b/app/src/main/res/drawable/favourite_inactive_light.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/reblog_disabled.xml b/app/src/main/res/drawable/reblog_disabled_dark.xml similarity index 100% rename from app/src/main/res/drawable/reblog_disabled.xml rename to app/src/main/res/drawable/reblog_disabled_dark.xml diff --git a/app/src/main/res/drawable/reblog_disabled_light.xml b/app/src/main/res/drawable/reblog_disabled_light.xml new file mode 100644 index 00000000..970e207f --- /dev/null +++ b/app/src/main/res/drawable/reblog_disabled_light.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/reblog_inactive.xml b/app/src/main/res/drawable/reblog_inactive_dark.xml similarity index 100% rename from app/src/main/res/drawable/reblog_inactive.xml rename to app/src/main/res/drawable/reblog_inactive_dark.xml diff --git a/app/src/main/res/drawable/reblog_inactive_light.xml b/app/src/main/res/drawable/reblog_inactive_light.xml new file mode 100644 index 00000000..7b649791 --- /dev/null +++ b/app/src/main/res/drawable/reblog_inactive_light.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/layout/item_status.xml b/app/src/main/res/layout/item_status.xml index fce82c2b..b6bde113 100644 --- a/app/src/main/res/layout/item_status.xml +++ b/app/src/main/res/layout/item_status.xml @@ -251,7 +251,7 @@ + android:layout_height="32dp" + style="?attr/image_button_style" /> + + app:srcCompat="@drawable/ic_repeat_24dp" /> - - - - + + + diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index ed4b7a89..4cb6dc0b 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -49,13 +49,13 @@ #000000 #000000 #000000 - #000000 + #4f5f5f #FFFFFF #FFFFFF #FFFFFF #f6f7f7 #000000 - #2F2F2F + #4F4F4F #4F4F4F #56a7e1 #BFBFBF diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index a62b68a7..df0430db 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -34,10 +34,9 @@ @color/toolbar_background_dark @color/toolbar_icon_dark @style/AppTheme.ImageButton.Dark - @color/status_reblog_button_dark - @color/status_reblog_button_marked_dark - @color/status_reblog_button_disabled_dark - @color/status_favourite_button_dark + @drawable/reblog_inactive_dark + @drawable/reblog_disabled_dark + @drawable/favourite_inactive_dark @color/status_favourite_button_marked_dark @drawable/toggle_small @color/color_background_dark @@ -95,10 +94,9 @@ @color/toolbar_background_light @color/toolbar_icon_light @style/AppTheme.ImageButton.Light - @color/status_reblog_button_light - @color/status_reblog_button_marked_light - @color/status_reblog_button_disabled_light - @color/status_favourite_button_light + @drawable/reblog_inactive_light + @drawable/reblog_disabled_light + @drawable/favourite_inactive_light @color/status_favourite_button_marked_light @drawable/toggle_small_light @color/sensitive_media_warning_background_light