From efc67fd7e8818af6dad291d88c9f999eb3ff82d7 Mon Sep 17 00:00:00 2001 From: sk Date: Fri, 6 Oct 2023 17:26:59 +0200 Subject: [PATCH] remove inset poll styles closes sk22#801 --- .../PollOptionStatusDisplayItem.java | 16 ++++--------- .../res/color/poll_option_progress_inset.xml | 5 ---- .../main/res/color/poll_option_text_inset.xml | 5 ---- .../bg_poll_option_clickable_inset.xml | 16 ------------- .../drawable/bg_poll_option_voted_inset.xml | 23 ------------------- 5 files changed, 5 insertions(+), 60 deletions(-) delete mode 100644 mastodon/src/main/res/color/poll_option_progress_inset.xml delete mode 100644 mastodon/src/main/res/color/poll_option_text_inset.xml delete mode 100644 mastodon/src/main/res/drawable/bg_poll_option_clickable_inset.xml delete mode 100644 mastodon/src/main/res/drawable/bg_poll_option_voted_inset.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 ee3357e66..a1eae6f99 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 @@ -68,7 +68,7 @@ public class PollOptionStatusDisplayItem extends StatusDisplayItem{ private final TextView text, percent; private final View button; private final ImageView icon; - private final Drawable progressBg, progressBgInset; + private final Drawable progressBg; public Holder(Activity activity, ViewGroup parent){ super(activity, R.layout.display_item_poll_option, parent); @@ -77,7 +77,6 @@ public class PollOptionStatusDisplayItem extends StatusDisplayItem{ icon=findViewById(R.id.icon); button=findViewById(R.id.button); progressBg=activity.getResources().getDrawable(R.drawable.bg_poll_option_voted, activity.getTheme()).mutate(); - progressBgInset=activity.getResources().getDrawable(R.drawable.bg_poll_option_voted_inset, activity.getTheme()).mutate(); itemView.setOnClickListener(this::onButtonClick); button.setOutlineProvider(OutlineProviders.roundedRect(20)); button.setClipToOutline(true); @@ -93,22 +92,17 @@ public class PollOptionStatusDisplayItem extends StatusDisplayItem{ item.showResults ? R.drawable.ic_poll_option_button : R.drawable.ic_fluent_radio_button_24_selector )); if(item.showResults){ - Drawable bg=item.inset ? progressBgInset : progressBg; + Drawable bg=progressBg; bg.setLevel(Math.round(10000f*item.votesFraction)); button.setBackground(bg); itemView.setSelected(item.poll.ownVotes!=null && item.poll.ownVotes.contains(item.optionIndex)); percent.setText(String.format(Locale.getDefault(), "%d%%", Math.round(item.votesFraction*100f))); }else{ itemView.setSelected(item.poll.selectedOptions!=null && item.poll.selectedOptions.contains(item.option)); - button.setBackgroundResource(item.inset ? R.drawable.bg_poll_option_clickable_inset : R.drawable.bg_poll_option_clickable); - } - if(item.inset){ - text.setTextColor(itemView.getContext().getColorStateList(R.color.poll_option_text_inset)); - percent.setTextColor(itemView.getContext().getColorStateList(R.color.poll_option_text_inset)); - }else{ - text.setTextColor(UiUtils.getThemeColor(itemView.getContext(), android.R.attr.textColorPrimary)); - percent.setTextColor(UiUtils.getThemeColor(itemView.getContext(), R.attr.colorM3OnSecondaryContainer)); + button.setBackgroundResource(R.drawable.bg_poll_option_clickable); } + text.setTextColor(UiUtils.getThemeColor(itemView.getContext(), android.R.attr.textColorPrimary)); + percent.setTextColor(UiUtils.getThemeColor(itemView.getContext(), R.attr.colorM3OnSecondaryContainer)); } @Override diff --git a/mastodon/src/main/res/color/poll_option_progress_inset.xml b/mastodon/src/main/res/color/poll_option_progress_inset.xml deleted file mode 100644 index 3fd78b91e..000000000 --- a/mastodon/src/main/res/color/poll_option_progress_inset.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/mastodon/src/main/res/color/poll_option_text_inset.xml b/mastodon/src/main/res/color/poll_option_text_inset.xml deleted file mode 100644 index ef1f151e6..000000000 --- a/mastodon/src/main/res/color/poll_option_text_inset.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/mastodon/src/main/res/drawable/bg_poll_option_clickable_inset.xml b/mastodon/src/main/res/drawable/bg_poll_option_clickable_inset.xml deleted file mode 100644 index 29dd2b1fc..000000000 --- a/mastodon/src/main/res/drawable/bg_poll_option_clickable_inset.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/mastodon/src/main/res/drawable/bg_poll_option_voted_inset.xml b/mastodon/src/main/res/drawable/bg_poll_option_voted_inset.xml deleted file mode 100644 index 1bc8c099b..000000000 --- a/mastodon/src/main/res/drawable/bg_poll_option_voted_inset.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file