This commit is contained in:
tom79 2019-11-19 18:11:49 +01:00
parent c61d656489
commit b54ed2fa78
5 changed files with 20 additions and 2 deletions

View File

@ -518,6 +518,11 @@ public class API {
poll.setExpired(resobj.getBoolean("expired"));
poll.setMultiple(resobj.getBoolean("multiple"));
poll.setVotes_count(resobj.getInt("votes_count"));
if( resobj.has("voters_count")){
poll.setVoters_count(resobj.getInt("voters_count"));
}else{
poll.setVoters_count(resobj.getInt("votes_count"));
}
poll.setVoted(resobj.getBoolean("voted"));
JSONArray options = resobj.getJSONArray("options");
List<PollOptions> pollOptions = new ArrayList<>();

View File

@ -40,6 +40,7 @@ public class Poll implements Parcelable {
private boolean expired;
private boolean multiple;
private int votes_count;
private int voters_count;
private boolean voted;
private List<PollOptions> optionsList;
@ -138,4 +139,12 @@ public class Poll implements Parcelable {
dest.writeByte(this.voted ? (byte) 1 : (byte) 0);
dest.writeTypedList(this.optionsList);
}
public int getVoters_count() {
return voters_count;
}
public void setVoters_count(int voters_count) {
this.voters_count = voters_count;
}
}

View File

@ -627,7 +627,7 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On
}
});
holder.poll_container.setVisibility(View.VISIBLE);
holder.number_votes.setText(context.getResources().getQuantityString(R.plurals.number_of_vote, status.getPoll().getVotes_count(), status.getPoll().getVotes_count()));
holder.number_votes.setText(context.getResources().getQuantityString(R.plurals.number_of_voters, status.getPoll().getVoters_count(), status.getPoll().getVoters_count()));
holder.remaining_time.setText(context.getString(R.string.poll_finish_at, Helper.dateToStringPoll(poll.getExpires_at())));
} else {
holder.poll_container.setVisibility(View.GONE);

View File

@ -894,7 +894,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
}
});
holder.poll_container.setVisibility(View.VISIBLE);
holder.number_votes.setText(context.getResources().getQuantityString(R.plurals.number_of_vote, poll.getVotes_count(), poll.getVotes_count()));
holder.number_votes.setText(context.getResources().getQuantityString(R.plurals.number_of_voters, poll.getVoters_count(), poll.getVoters_count()));
holder.remaining_time.setText(context.getString(R.string.poll_finish_at, Helper.dateToStringPoll(poll.getExpires_at())));
} else {
holder.poll_container.setVisibility(View.GONE);

View File

@ -1032,6 +1032,10 @@
<item quantity="other">%d votes</item>
</plurals>
<plurals name="number_of_voters">
<item quantity="one">%d voter</item>
<item quantity="other">%d voters</item>
</plurals>
<string-array name="poll_choice_type">
<item>Single choice</item>
<item>Multiple choices</item>