Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,33 @@ private void updateFrom(final SponsorBlockSegment sponsorBlockSegment) {
final String endText = millisecondsToString(sponsorBlockSegment.endTime);
itemSegmentEndTimeTextView.setText(endText);

// Update vote button states
if (sponsorBlockSegment.category == SponsorBlockCategory.PENDING
|| sponsorBlockSegment.uuid.equals("TEMP")
|| sponsorBlockSegment.uuid.equals("")) {
itemSegmentVoteUpImageView.setVisibility(View.INVISIBLE);
itemSegmentVoteDownImageView.setVisibility(View.INVISIBLE);
} else {
itemSegmentVoteUpImageView.setVisibility(View.VISIBLE);
itemSegmentVoteDownImageView.setVisibility(View.VISIBLE);

// Update button states based on current vote
final int selectedColor =
context.getColor(R.color.sponsor_block_vote_button_selected);
final int defaultColor =
context.getColor(android.R.color.darker_gray);

if (hasUpVoted) {
itemSegmentVoteUpImageView.setColorFilter(selectedColor);
itemSegmentVoteDownImageView.setColorFilter(defaultColor);
} else if (hasDownVoted) {
itemSegmentVoteUpImageView.setColorFilter(defaultColor);
itemSegmentVoteDownImageView.setColorFilter(selectedColor);
} else {
// Reset to default colors when no vote
itemSegmentVoteUpImageView.setColorFilter(defaultColor);
itemSegmentVoteDownImageView.setColorFilter(defaultColor);
}
}
}

Expand Down Expand Up @@ -281,6 +303,11 @@ private void vote(final int value) {
Toast.makeText(context,
toastMessage,
Toast.LENGTH_SHORT).show();

// Update button states after voting
if (currentSponsorBlockSegment != null) {
updateFrom(currentSponsorBlockSegment);
}
}, throwable -> {
if (throwable instanceof NullPointerException) {
return;
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,8 @@
<color name="preview_segment">#008fd6</color>
<color name="filler_segment">#7300ff</color>
<color name="pending_segment">#ffffff</color>

<!-- Vote button colors -->
<color name="sponsor_block_vote_button_selected">#CD201F</color>

</resources>