Merge branch 'better-poll-voting'

This commit is contained in:
sk 2022-12-10 22:40:46 +01:00
commit 0950e2eb7f
1 changed files with 2 additions and 0 deletions

View File

@ -89,10 +89,12 @@ public class PollOptionStatusDisplayItem extends StatusDisplayItem{
button.setBackground(progressBg); button.setBackground(progressBg);
itemView.setSelected(item.isMostVoted); itemView.setSelected(item.isMostVoted);
icon.setSelected(item.poll.ownVotes.contains(item.poll.options.indexOf(item.option))); icon.setSelected(item.poll.ownVotes.contains(item.poll.options.indexOf(item.option)));
icon.setVisibility(item.poll.voted && item.poll.ownVotes.isEmpty() ? View.GONE : View.VISIBLE);
percent.setText(String.format(Locale.getDefault(), "%d%%", Math.round(item.votesFraction*100f))); percent.setText(String.format(Locale.getDefault(), "%d%%", Math.round(item.votesFraction*100f)));
}else{ }else{
itemView.setSelected(item.poll.selectedOptions!=null && item.poll.selectedOptions.contains(item.option)); itemView.setSelected(item.poll.selectedOptions!=null && item.poll.selectedOptions.contains(item.option));
button.setBackgroundResource(R.drawable.bg_poll_option_clickable); button.setBackgroundResource(R.drawable.bg_poll_option_clickable);
icon.setVisibility(View.VISIBLE);
} }
} }