Merge remote-tracking branch 'mastodon/master'
This commit is contained in:
commit
addb1b27bb
3 changed files with 9 additions and 2 deletions
|
@ -16,6 +16,7 @@ public class Poll extends BaseModel{
|
||||||
private boolean expired;
|
private boolean expired;
|
||||||
public boolean multiple;
|
public boolean multiple;
|
||||||
public int votersCount;
|
public int votersCount;
|
||||||
|
public int votesCount;
|
||||||
public boolean voted;
|
public boolean voted;
|
||||||
// @RequiredField
|
// @RequiredField
|
||||||
public List<Integer> ownVotes;
|
public List<Integer> ownVotes;
|
||||||
|
@ -41,10 +42,12 @@ public class Poll extends BaseModel{
|
||||||
", expired="+expired+
|
", expired="+expired+
|
||||||
", multiple="+multiple+
|
", multiple="+multiple+
|
||||||
", votersCount="+votersCount+
|
", votersCount="+votersCount+
|
||||||
|
", votesCount="+votesCount+
|
||||||
", voted="+voted+
|
", voted="+voted+
|
||||||
", ownVotes="+ownVotes+
|
", ownVotes="+ownVotes+
|
||||||
", options="+options+
|
", options="+options+
|
||||||
", emojis="+emojis+
|
", emojis="+emojis+
|
||||||
|
", selectedOptions="+selectedOptions+
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,8 +38,9 @@ public class PollOptionStatusDisplayItem extends StatusDisplayItem{
|
||||||
text=HtmlParser.parseCustomEmoji(option.title, poll.emojis);
|
text=HtmlParser.parseCustomEmoji(option.title, poll.emojis);
|
||||||
emojiHelper.setText(text);
|
emojiHelper.setText(text);
|
||||||
showResults=poll.isExpired() || poll.voted;
|
showResults=poll.isExpired() || poll.voted;
|
||||||
if(showResults && option.votesCount!=null && poll.votersCount>0){
|
int total=poll.votersCount>0 ? poll.votersCount : poll.votesCount;
|
||||||
votesFraction=(float)option.votesCount/(float)poll.votersCount;
|
if(showResults && option.votesCount!=null && total>0){
|
||||||
|
votesFraction=(float)option.votesCount/(float)total;
|
||||||
int mostVotedCount=0;
|
int mostVotedCount=0;
|
||||||
for(Poll.Option opt:poll.options)
|
for(Poll.Option opt:poll.options)
|
||||||
mostVotedCount=Math.max(mostVotedCount, opt.votesCount);
|
mostVotedCount=Math.max(mostVotedCount, opt.votesCount);
|
||||||
|
|
|
@ -736,6 +736,9 @@ public class UiUtils{
|
||||||
TypedArray ta=button.getContext().obtainStyledAttributes(styleRes, new int[]{android.R.attr.background});
|
TypedArray ta=button.getContext().obtainStyledAttributes(styleRes, new int[]{android.R.attr.background});
|
||||||
button.setBackground(ta.getDrawable(0));
|
button.setBackground(ta.getDrawable(0));
|
||||||
ta.recycle();
|
ta.recycle();
|
||||||
|
ta=button.getContext().obtainStyledAttributes(styleRes, new int[]{android.R.attr.textColor});
|
||||||
|
button.setTextColor(ta.getColorStateList(0));
|
||||||
|
ta.recycle();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void performAccountAction(Activity activity, Account account, String accountID, Relationship relationship, Button button, Consumer<Boolean> progressCallback, Consumer<Relationship> resultCallback) {
|
public static void performAccountAction(Activity activity, Account account, String accountID, Relationship relationship, Button button, Consumer<Boolean> progressCallback, Consumer<Relationship> resultCallback) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue