refactor: simplify code in 56e5877040
This commit is contained in:
@@ -92,11 +92,7 @@ public class PollOptionStatusDisplayItem extends StatusDisplayItem{
|
|||||||
progressBg.setLevel(Math.round(10000f*item.votesFraction));
|
progressBg.setLevel(Math.round(10000f*item.votesFraction));
|
||||||
button.setBackground(progressBg);
|
button.setBackground(progressBg);
|
||||||
itemView.setSelected(item.isMostVoted);
|
itemView.setSelected(item.isMostVoted);
|
||||||
if(item.poll.ownVotes == null){
|
icon.setSelected(item.poll.ownVotes != null && item.poll.ownVotes.contains(item.poll.options.indexOf(item.option)));
|
||||||
icon.setSelected(false);
|
|
||||||
}else{
|
|
||||||
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);
|
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{
|
||||||
|
|||||||
Reference in New Issue
Block a user