Skip to content
This repository has been archived by the owner on Oct 28, 2024. It is now read-only.

Commit

Permalink
fix: button showing wrong text when refreshing
Browse files Browse the repository at this point in the history
  • Loading branch information
FineFindus committed Nov 16, 2023
1 parent 0ef879e commit dca68de
Showing 1 changed file with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

public class PollFooterStatusDisplayItem extends StatusDisplayItem{
public final Poll poll;
public boolean resultsVisible = false;
public boolean resultsVisible=false;

public PollFooterStatusDisplayItem(String parentID, BaseStatusListFragment parentFragment, Poll poll){
super(parentID, parentFragment);
Expand All @@ -39,8 +39,7 @@ public Holder(Activity activity, ViewGroup parent){
resultsButton.setOnClickListener(v-> {
item.resultsVisible = !item.resultsVisible;
item.parentFragment.onPollViewResultsButtonClick(this, item.resultsVisible);
resultsButton.setText(item.resultsVisible ? R.string.sk_poll_view : R.string.sk_poll_results);
setVoteButtonEnabled();
rebind();
});
}

Expand All @@ -56,10 +55,7 @@ public void onBind(PollFooterStatusDisplayItem item){
text+=" "+sep+" "+item.parentFragment.getString(R.string.poll_closed);
}
this.text.setText(text);
setVoteButtonEnabled();
}

private void setVoteButtonEnabled() {
resultsButton.setText(item.resultsVisible ? R.string.sk_poll_view : R.string.sk_poll_results);
voteButton.setVisibility(item.poll.isExpired() || item.poll.voted || (!item.poll.multiple && !GlobalUserPreferences.voteButtonForSingleChoice) ? View.GONE : View.VISIBLE);
voteButton.setEnabled(item.poll.selectedOptions!=null && !item.poll.selectedOptions.isEmpty() && !item.resultsVisible);
}
Expand Down

0 comments on commit dca68de

Please sign in to comment.