Fix issue #116 - Polls with Misskey not rendered correctly

This commit is contained in:
Thomas 2022-06-01 16:46:19 +02:00
parent 9047181e8f
commit 07af2ea9a5

View file

@ -1059,6 +1059,9 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
holder.binding.poll.rated.removeAllViews(); holder.binding.poll.rated.removeAllViews();
List<Integer> ownvotes = statusToDeal.poll.own_votes; List<Integer> ownvotes = statusToDeal.poll.own_votes;
int j = 0; int j = 0;
if (statusToDeal.poll.voters_count == 0 && statusToDeal.poll.votes_count > 0) {
statusToDeal.poll.voters_count = statusToDeal.poll.votes_count;
}
for (Poll.PollItem pollItem : statusToDeal.poll.options) { for (Poll.PollItem pollItem : statusToDeal.poll.options) {
@NonNull LayoutPollItemBinding pollItemBinding = LayoutPollItemBinding.inflate(inflater, holder.binding.poll.rated, true); @NonNull LayoutPollItemBinding pollItemBinding = LayoutPollItemBinding.inflate(inflater, holder.binding.poll.rated, true);
double value = ((double) (pollItem.votes_count * 100) / (double) statusToDeal.poll.voters_count); double value = ((double) (pollItem.votes_count * 100) / (double) statusToDeal.poll.voters_count);