|
717 | 717 | group.lastFocus.setFocus(true) |
718 | 718 | end if |
719 | 719 | else if btn.id = "watchedButton" |
720 | | - print "watchedButton pressed" |
721 | 720 | movie = group.itemContent |
722 | | - watchedButton = group.findNode("watchedButton") |
723 | | - if isValid(movie) and isValid(movie.watched) and isValid(movie.id) and isValid(watchedButton) |
724 | | - if movie.watched |
| 721 | + if isValid(movie) and isValid(movie.id) |
| 722 | + startLoadingSpinner() |
| 723 | + if isValid(movie.watched) and movie.watched |
725 | 724 | UnmarkItemWatched(movie.id) |
726 | | - movie.watched = false |
727 | | - watchedButton.selected = false |
728 | 725 | else |
729 | 726 | MarkItemWatched(movie.id) |
730 | | - movie.watched = true |
731 | | - watchedButton.selected = true |
732 | | - |
733 | | - ' Remove Resume button when marking as watched (MovieDetails only) |
734 | | - if group.subtype() = "MovieDetails" |
735 | | - buttons = group.findNode("buttons") |
736 | | - if isValid(buttons) |
737 | | - resumeButton = buttons.findNode("resumeButton") |
738 | | - if isValid(resumeButton) |
739 | | - ' Reset tick values before removing |
740 | | - resumeButton.playbackPositionTicks = 0 |
741 | | - resumeButton.runtimeTicks = 0 |
742 | | - buttons.removeChild(resumeButton) |
743 | | - |
744 | | - ' Adjust focus index since we removed button at index 0 |
745 | | - ' All other buttons shifted left by 1, so decrement focus index |
746 | | - if buttons.buttonFocused > 0 |
747 | | - buttons.buttonFocused = buttons.buttonFocused - 1 |
748 | | - end if |
749 | | - ' Focus the target button directly (setFocus on the group doesn't reliably |
750 | | - ' update visuals when focus is already on a sibling child) |
751 | | - focusTarget = buttons.getChild(buttons.buttonFocused) |
752 | | - if isValid(focusTarget) |
753 | | - focusTarget.setFocus(true) |
754 | | - end if |
755 | | - end if |
756 | | - end if |
757 | | - end if |
758 | 727 | end if |
| 728 | + ' Refresh from server to get authoritative state |
| 729 | + group.refreshMovieDetailsData = not group.refreshMovieDetailsData |
759 | 730 | end if |
760 | 731 | else if btn.id = "favoriteButton" |
761 | 732 | print "favoriteButton pressed" |
762 | 733 | movie = group.itemContent |
763 | 734 | favoriteButton = group.findNode("favoriteButton") |
764 | 735 | if isValid(movie) and isValid(movie.favorite) and isValid(movie.id) and isValid(favoriteButton) |
| 736 | + startLoadingSpinner() |
765 | 737 | if movie.favorite |
766 | 738 | UnmarkItemFavorite(movie.id) |
767 | 739 | movie.favorite = false |
|
771 | 743 | movie.favorite = true |
772 | 744 | favoriteButton.selected = true |
773 | 745 | end if |
| 746 | + stopLoadingSpinner() |
| 747 | + end if |
| 748 | + else if btn.id = "refreshButton" |
| 749 | + ' Trigger data refresh for the current screen |
| 750 | + if isValid(group) |
| 751 | + group.refreshMovieDetailsData = not group.refreshMovieDetailsData |
774 | 752 | end if |
775 | 753 | else if btn.id = "deleteButton" |
776 | 754 | print "deleteButton pressed" |
|
0 commit comments