From 6fd58c96827cb1d2da329cebdc170a1425dd18d7 Mon Sep 17 00:00:00 2001 From: sk Date: Thu, 8 Dec 2022 19:55:46 +0100 Subject: [PATCH] improve semantics for poll options --- .../ui/displayitems/PollOptionStatusDisplayItem.java | 9 +++++++-- .../drawable/ic_fluent_checkbox_checked_24_filled.xml | 3 +++ .../drawable/ic_fluent_checkbox_checked_24_regular.xml | 3 +++ .../drawable/ic_fluent_checkbox_unchecked_24_filled.xml | 3 +++ .../drawable/ic_fluent_checkbox_unchecked_24_regular.xml | 3 +++ .../res/drawable/ic_fluent_radio_button_24_filled.xml | 3 +++ .../res/drawable/ic_fluent_radio_button_24_selector.xml | 8 ++++++++ .../res/drawable/ic_poll_checkbox_filled_selector.xml | 7 +++++++ .../res/drawable/ic_poll_checkbox_regular_selector.xml | 7 +++++++ 9 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 mastodon/src/main/res/drawable/ic_fluent_checkbox_checked_24_filled.xml create mode 100644 mastodon/src/main/res/drawable/ic_fluent_checkbox_checked_24_regular.xml create mode 100644 mastodon/src/main/res/drawable/ic_fluent_checkbox_unchecked_24_filled.xml create mode 100644 mastodon/src/main/res/drawable/ic_fluent_checkbox_unchecked_24_regular.xml create mode 100644 mastodon/src/main/res/drawable/ic_fluent_radio_button_24_filled.xml create mode 100644 mastodon/src/main/res/drawable/ic_fluent_radio_button_24_selector.xml create mode 100644 mastodon/src/main/res/drawable/ic_poll_checkbox_filled_selector.xml create mode 100644 mastodon/src/main/res/drawable/ic_poll_checkbox_regular_selector.xml diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/PollOptionStatusDisplayItem.java b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/PollOptionStatusDisplayItem.java index c16169b041..c00edada30 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/PollOptionStatusDisplayItem.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/PollOptionStatusDisplayItem.java @@ -5,6 +5,7 @@ import android.graphics.drawable.Drawable; import android.view.View; import android.view.ViewGroup; +import android.widget.ImageView; import android.widget.TextView; import org.joinmastodon.android.R; @@ -60,7 +61,8 @@ public ImageLoaderRequest getImageRequest(int index){ public static class Holder extends StatusDisplayItem.Holder implements ImageLoaderViewHolder{ private final TextView text, percent; - private final View icon, button; + private final View button; + private final ImageView icon; private final Drawable progressBg; public Holder(Activity activity, ViewGroup parent){ @@ -76,9 +78,12 @@ public Holder(Activity activity, ViewGroup parent){ @Override public void onBind(PollOptionStatusDisplayItem item){ text.setText(item.text); -// icon.setVisibility(item.showResults ? View.GONE : View.VISIBLE); percent.setVisibility(item.showResults ? View.VISIBLE : View.GONE); itemView.setClickable(!item.showResults); + icon.setImageDrawable(itemView.getContext().getDrawable(item.poll.multiple ? + item.showResults ? R.drawable.ic_poll_checkbox_regular_selector : R.drawable.ic_poll_checkbox_filled_selector : + item.showResults ? R.drawable.ic_poll_option_button : R.drawable.ic_fluent_radio_button_24_selector + )); if(item.showResults){ progressBg.setLevel(Math.round(10000f*item.votesFraction)); button.setBackground(progressBg); diff --git a/mastodon/src/main/res/drawable/ic_fluent_checkbox_checked_24_filled.xml b/mastodon/src/main/res/drawable/ic_fluent_checkbox_checked_24_filled.xml new file mode 100644 index 0000000000..fa9b028b37 --- /dev/null +++ b/mastodon/src/main/res/drawable/ic_fluent_checkbox_checked_24_filled.xml @@ -0,0 +1,3 @@ + + + diff --git a/mastodon/src/main/res/drawable/ic_fluent_checkbox_checked_24_regular.xml b/mastodon/src/main/res/drawable/ic_fluent_checkbox_checked_24_regular.xml new file mode 100644 index 0000000000..033e1a14dc --- /dev/null +++ b/mastodon/src/main/res/drawable/ic_fluent_checkbox_checked_24_regular.xml @@ -0,0 +1,3 @@ + + + diff --git a/mastodon/src/main/res/drawable/ic_fluent_checkbox_unchecked_24_filled.xml b/mastodon/src/main/res/drawable/ic_fluent_checkbox_unchecked_24_filled.xml new file mode 100644 index 0000000000..49398070bd --- /dev/null +++ b/mastodon/src/main/res/drawable/ic_fluent_checkbox_unchecked_24_filled.xml @@ -0,0 +1,3 @@ + + + diff --git a/mastodon/src/main/res/drawable/ic_fluent_checkbox_unchecked_24_regular.xml b/mastodon/src/main/res/drawable/ic_fluent_checkbox_unchecked_24_regular.xml new file mode 100644 index 0000000000..792b978335 --- /dev/null +++ b/mastodon/src/main/res/drawable/ic_fluent_checkbox_unchecked_24_regular.xml @@ -0,0 +1,3 @@ + + + diff --git a/mastodon/src/main/res/drawable/ic_fluent_radio_button_24_filled.xml b/mastodon/src/main/res/drawable/ic_fluent_radio_button_24_filled.xml new file mode 100644 index 0000000000..179f464bc2 --- /dev/null +++ b/mastodon/src/main/res/drawable/ic_fluent_radio_button_24_filled.xml @@ -0,0 +1,3 @@ + + + diff --git a/mastodon/src/main/res/drawable/ic_fluent_radio_button_24_selector.xml b/mastodon/src/main/res/drawable/ic_fluent_radio_button_24_selector.xml new file mode 100644 index 0000000000..80162e2b7e --- /dev/null +++ b/mastodon/src/main/res/drawable/ic_fluent_radio_button_24_selector.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/mastodon/src/main/res/drawable/ic_poll_checkbox_filled_selector.xml b/mastodon/src/main/res/drawable/ic_poll_checkbox_filled_selector.xml new file mode 100644 index 0000000000..1e03f145c1 --- /dev/null +++ b/mastodon/src/main/res/drawable/ic_poll_checkbox_filled_selector.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/mastodon/src/main/res/drawable/ic_poll_checkbox_regular_selector.xml b/mastodon/src/main/res/drawable/ic_poll_checkbox_regular_selector.xml new file mode 100644 index 0000000000..e22f22deaa --- /dev/null +++ b/mastodon/src/main/res/drawable/ic_poll_checkbox_regular_selector.xml @@ -0,0 +1,7 @@ + + + + + + +