Skip to content
This repository has been archived by the owner on Oct 28, 2024. It is now read-only.

Commit

Permalink
remove inset poll styles
Browse files Browse the repository at this point in the history
closes #801
  • Loading branch information
sk22 committed Oct 6, 2023
1 parent 43e7374 commit efc67fd
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public static class Holder extends StatusDisplayItem.Holder<PollOptionStatusDisp
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);
Expand All @@ -77,7 +77,6 @@ public Holder(Activity activity, ViewGroup parent){
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);
Expand All @@ -93,22 +92,17 @@ public void onBind(PollOptionStatusDisplayItem item){
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
Expand Down
5 changes: 0 additions & 5 deletions mastodon/src/main/res/color/poll_option_progress_inset.xml

This file was deleted.

5 changes: 0 additions & 5 deletions mastodon/src/main/res/color/poll_option_text_inset.xml

This file was deleted.

16 changes: 0 additions & 16 deletions mastodon/src/main/res/drawable/bg_poll_option_clickable_inset.xml

This file was deleted.

23 changes: 0 additions & 23 deletions mastodon/src/main/res/drawable/bg_poll_option_voted_inset.xml

This file was deleted.

0 comments on commit efc67fd

Please sign in to comment.