diff --git a/app/src/main/java/com/battlelancer/seriesguide/shows/episodes/EpisodeDetailsFragment.kt b/app/src/main/java/com/battlelancer/seriesguide/shows/episodes/EpisodeDetailsFragment.kt index eadb765867..e4650b03da 100644 --- a/app/src/main/java/com/battlelancer/seriesguide/shows/episodes/EpisodeDetailsFragment.kt +++ b/app/src/main/java/com/battlelancer/seriesguide/shows/episodes/EpisodeDetailsFragment.kt @@ -128,31 +128,32 @@ class EpisodeDetailsFragment : Fragment(), EpisodeActionsContract { bindingRatings!!.textViewRatingsRange.text = getString(R.string.format_rating_range, 10) - StreamingSearch.initButtons( - bindingButtons!!.buttonEpisodeStreamingSearch, - bindingButtons!!.buttonEpisodeStreamingSearchInfo, - parentFragmentManager - ) - - // other bottom buttons - bindingBottom!!.buttonEpisodeShare.setOnClickListener { shareEpisode() } - bindingBottom!!.buttonEpisodeCalendar.setOnClickListener { - val show = show - val episode = episode - if (show != null && episode != null) { - ShareUtils.suggestCalendarEvent( - requireContext(), - show.title, - TextTools.getNextEpisodeString( + // Episode action buttons + bindingButtons!!.apply { + buttonEpisodeShare.setOnClickListener { shareEpisode() } + buttonEpisodeCalendar.setOnClickListener { + val show = show + val episode = episode + if (show != null && episode != null) { + ShareUtils.suggestCalendarEvent( requireContext(), - episode.season, - episode.number, - episodeTitle - ), - episode.firstReleasedMs, - show.runtime - ) + show.title, + TextTools.getNextEpisodeString( + requireContext(), + episode.season, + episode.number, + episodeTitle + ), + episode.firstReleasedMs, + show.runtime + ) + } } + StreamingSearch.initButtons( + buttonEpisodeStreamingSearch, + buttonEpisodeStreamingSearchInfo, + parentFragmentManager + ) } // set up long-press to copy text to clipboard (d-pad friendly vs text selection) @@ -193,7 +194,7 @@ class EpisodeDetailsFragment : Fragment(), EpisodeActionsContract { if (watchInfo != null && b != null) { StreamingSearch.configureButton( b.includeButtons.buttonEpisodeStreamingSearch, - watchInfo + watchInfo, replaceButtonText = true ) } } @@ -611,6 +612,16 @@ class EpisodeDetailsFragment : Fragment(), EpisodeActionsContract { ) ) } + + // Trakt comments + bindingButtons.buttonEpisodeComments.setOnClickListener { v: View? -> + val episodeId = episodeId + if (episodeId > 0) { + val intent = + TraktCommentsActivity.intentEpisode(requireContext(), episodeTitle, episodeId) + Utils.startActivityWithAnimation(requireActivity(), intent, v) + } + } } private fun updateSecondaryButtons(episode: SgEpisode2, show: SgShow2) { @@ -638,16 +649,6 @@ class EpisodeDetailsFragment : Fragment(), EpisodeActionsContract { TmdbTools.buildEpisodeUrl(show.tmdbId, episode.season, episode.number) ) } - - // Trakt comments - bindingBottom.buttonEpisodeComments.setOnClickListener { v: View? -> - val episodeId = episodeId - if (episodeId > 0) { - val intent = - TraktCommentsActivity.intentEpisode(requireContext(), episodeTitle, episodeId) - Utils.startActivityWithAnimation(requireActivity(), intent, v) - } - } } private fun loadTraktRatings() { diff --git a/app/src/main/java/com/battlelancer/seriesguide/shows/overview/OverviewFragment.kt b/app/src/main/java/com/battlelancer/seriesguide/shows/overview/OverviewFragment.kt index 06ec12d959..129cbc8d4b 100644 --- a/app/src/main/java/com/battlelancer/seriesguide/shows/overview/OverviewFragment.kt +++ b/app/src/main/java/com/battlelancer/seriesguide/shows/overview/OverviewFragment.kt @@ -172,6 +172,15 @@ class OverviewFragment() : Fragment(), EpisodeActionsContract { buttonEpisodeWatched.setOnClickListener { onButtonWatchedClick() } buttonEpisodeCollected.setOnClickListener { onButtonCollectedClick() } buttonEpisodeSkip.setOnClickListener { onButtonSkipClicked() } + buttonEpisodeShare.setOnClickListener { shareEpisode() } + buttonEpisodeCalendar.setOnClickListener { createCalendarEvent() } + buttonEpisodeComments.setOnClickListener { + onButtonCommentsClick(buttonEpisodeComments) + } + initButtons( + buttonEpisodeStreamingSearch, buttonEpisodeStreamingSearchInfo, + parentFragmentManager + ) TooltipCompat.setTooltipText( buttonEpisodeCheckin, @@ -185,10 +194,6 @@ class OverviewFragment() : Fragment(), EpisodeActionsContract { buttonEpisodeSkip, buttonEpisodeSkip.contentDescription ) - initButtons( - buttonEpisodeStreamingSearch, buttonEpisodeStreamingSearchInfo, - parentFragmentManager - ) } // ratings @@ -201,14 +206,6 @@ class OverviewFragment() : Fragment(), EpisodeActionsContract { textViewRatingsRange.text = getString(R.string.format_rating_range, 10) } - with(includeServices.includeMore) { - buttonEpisodeShare.setOnClickListener { shareEpisode() } - buttonEpisodeCalendar.setOnClickListener { createCalendarEvent() } - buttonEpisodeComments.setOnClickListener { - onButtonCommentsClick(buttonEpisodeComments) - } - } - // set up long-press to copy text to clipboard (d-pad friendly vs text selection) textViewEpisodeDescription.copyTextToClipboardOnLongClick() textGuestStars.copyTextToClipboardOnLongClick() @@ -244,7 +241,7 @@ class OverviewFragment() : Fragment(), EpisodeActionsContract { this.binding?.let { StreamingSearch.configureButton( it.includeButtons.buttonEpisodeStreamingSearch, - watchInfo + watchInfo, replaceButtonText = true ) } } @@ -527,18 +524,15 @@ class OverviewFragment() : Fragment(), EpisodeActionsContract { } // dvd number - var isShowingMeta = ViewTools.setLabelValueOrHide( + ViewTools.setLabelValueOrHide( binding.labelDvdNumber, binding.textDvdNumber, episode.dvdNumber ) // guest stars - isShowingMeta = isShowingMeta or ViewTools.setLabelValueOrHide( + ViewTools.setLabelValueOrHide( binding.labelGuestStars, binding.textGuestStars, TextTools.splitPipeSeparatedStrings(episode.guestStars) ) - // hide divider if no meta is visible - binding.dividerOverviewEpisodeDetails.visibility = - if (isShowingMeta) View.VISIBLE else View.GONE // Trakt rating binding.includeRatings.also { diff --git a/app/src/main/res/layout/buttons_episode.xml b/app/src/main/res/layout/buttons_episode.xml index 62c54fec5d..68fa694dc2 100644 --- a/app/src/main/res/layout/buttons_episode.xml +++ b/app/src/main/res/layout/buttons_episode.xml @@ -1,5 +1,8 @@ + + + - - -