Fix issue #355
This commit is contained in:
parent
c61d656489
commit
b54ed2fa78
|
@ -518,6 +518,11 @@ public class API {
|
||||||
poll.setExpired(resobj.getBoolean("expired"));
|
poll.setExpired(resobj.getBoolean("expired"));
|
||||||
poll.setMultiple(resobj.getBoolean("multiple"));
|
poll.setMultiple(resobj.getBoolean("multiple"));
|
||||||
poll.setVotes_count(resobj.getInt("votes_count"));
|
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"));
|
poll.setVoted(resobj.getBoolean("voted"));
|
||||||
JSONArray options = resobj.getJSONArray("options");
|
JSONArray options = resobj.getJSONArray("options");
|
||||||
List<PollOptions> pollOptions = new ArrayList<>();
|
List<PollOptions> pollOptions = new ArrayList<>();
|
||||||
|
|
|
@ -40,6 +40,7 @@ public class Poll implements Parcelable {
|
||||||
private boolean expired;
|
private boolean expired;
|
||||||
private boolean multiple;
|
private boolean multiple;
|
||||||
private int votes_count;
|
private int votes_count;
|
||||||
|
private int voters_count;
|
||||||
private boolean voted;
|
private boolean voted;
|
||||||
private List<PollOptions> optionsList;
|
private List<PollOptions> optionsList;
|
||||||
|
|
||||||
|
@ -138,4 +139,12 @@ public class Poll implements Parcelable {
|
||||||
dest.writeByte(this.voted ? (byte) 1 : (byte) 0);
|
dest.writeByte(this.voted ? (byte) 1 : (byte) 0);
|
||||||
dest.writeTypedList(this.optionsList);
|
dest.writeTypedList(this.optionsList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getVoters_count() {
|
||||||
|
return voters_count;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVoters_count(int voters_count) {
|
||||||
|
this.voters_count = voters_count;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -627,7 +627,7 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
holder.poll_container.setVisibility(View.VISIBLE);
|
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())));
|
holder.remaining_time.setText(context.getString(R.string.poll_finish_at, Helper.dateToStringPoll(poll.getExpires_at())));
|
||||||
} else {
|
} else {
|
||||||
holder.poll_container.setVisibility(View.GONE);
|
holder.poll_container.setVisibility(View.GONE);
|
||||||
|
|
|
@ -894,7 +894,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
holder.poll_container.setVisibility(View.VISIBLE);
|
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())));
|
holder.remaining_time.setText(context.getString(R.string.poll_finish_at, Helper.dateToStringPoll(poll.getExpires_at())));
|
||||||
} else {
|
} else {
|
||||||
holder.poll_container.setVisibility(View.GONE);
|
holder.poll_container.setVisibility(View.GONE);
|
||||||
|
|
|
@ -1032,6 +1032,10 @@
|
||||||
<item quantity="other">%d votes</item>
|
<item quantity="other">%d votes</item>
|
||||||
</plurals>
|
</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">
|
<string-array name="poll_choice_type">
|
||||||
<item>Single choice</item>
|
<item>Single choice</item>
|
||||||
<item>Multiple choices</item>
|
<item>Multiple choices</item>
|
||||||
|
|
Loading…
Reference in New Issue