From 3085bdf5fc59bea47a8bd4c806556021d5964bb5 Mon Sep 17 00:00:00 2001 From: Uwe Trottmann Date: Thu, 23 Nov 2023 13:07:25 +0100 Subject: [PATCH] Movie details: group most buttons in chain. Use smaller headline text for title on large layouts as well. --- .../movies/details/MovieDetailsFragment.kt | 100 ++++++++--------- .../res/layout-w1024dp/fragment_movie.xml | 54 ++-------- .../main/res/layout-w590dp/fragment_movie.xml | 80 ++++---------- app/src/main/res/layout/buttons_movie.xml | 102 ++++++++++++------ app/src/main/res/layout/fragment_movie.xml | 64 ++--------- 5 files changed, 152 insertions(+), 248 deletions(-) diff --git a/app/src/main/java/com/battlelancer/seriesguide/movies/details/MovieDetailsFragment.kt b/app/src/main/java/com/battlelancer/seriesguide/movies/details/MovieDetailsFragment.kt index 68b8514486..4f33cd9f24 100644 --- a/app/src/main/java/com/battlelancer/seriesguide/movies/details/MovieDetailsFragment.kt +++ b/app/src/main/java/com/battlelancer/seriesguide/movies/details/MovieDetailsFragment.kt @@ -108,38 +108,45 @@ class MovieDetailsFragment : Fragment(), MovieActionsContract { binding.textViewMovieGenresLabel.isGone = true binding.labelMovieLastUpdated.isGone = true - // trailer button - binding.buttonMovieTrailer.setOnClickListener { - trailerYoutubeId?.let { ServiceUtils.openYoutube(it, requireContext()) } - } - binding.buttonMovieTrailer.isGone = true - binding.buttonMovieTrailer.isEnabled = false - - // similar movies button - binding.buttonMovieSimilar.apply { - setOnClickListener { - movieDetails?.tmdbMovie() - ?.title - ?.let { - startActivity(SimilarMoviesActivity.intent(requireContext(), tmdbId, it)) - } + // some action buttons + binding.containerMovieButtons.apply { + root.isGone = true + // trailer button + buttonMovieTrailer.apply { + setOnClickListener { + trailerYoutubeId?.let { ServiceUtils.openYoutube(it, requireContext()) } + } + isEnabled = false + } + // similar movies button + buttonMovieSimilar.apply { + setOnClickListener { + movieDetails?.tmdbMovie() + ?.title + ?.let { + startActivity( + SimilarMoviesActivity.intent( + requireContext(), + tmdbId, + it + ) + ) + } + } } - isGone = true + buttonMovieCheckIn.setOnClickListener { onButtonCheckInClick() } + TooltipCompat.setTooltipText( + buttonMovieCheckIn, + buttonMovieCheckIn.contentDescription + ) + StreamingSearch.initButtons( + buttonMovieStreamingSearch, + buttonMovieStreamingSearchInfo, + parentFragmentManager + ) } - - // important action buttons - binding.containerMovieButtons.root.isGone = true - binding.containerMovieButtons.buttonMovieCheckIn.setOnClickListener { onButtonCheckInClick() } - StreamingSearch.initButtons( - binding.containerMovieButtons.buttonMovieStreamingSearch, - binding.containerMovieButtons.buttonMovieStreamingSearchInfo, - parentFragmentManager - ) + // ratings binding.containerRatings.root.isGone = true - TooltipCompat.setTooltipText( - binding.containerMovieButtons.buttonMovieCheckIn, - binding.containerMovieButtons.buttonMovieCheckIn.contentDescription - ) // language button binding.buttonMovieLanguage.isGone = true @@ -151,9 +158,6 @@ class MovieDetailsFragment : Fragment(), MovieActionsContract { MovieLocalizationDialogFragment.show(parentFragmentManager) } - // comments button - binding.buttonMovieComments.isGone = true - // cast and crew setCastVisibility(false) setCrewVisibility(false) @@ -192,7 +196,7 @@ class MovieDetailsFragment : Fragment(), MovieActionsContract { model.watchProvider.observe(viewLifecycleOwner) { watchInfo -> StreamingSearch.configureButton( binding.containerMovieButtons.buttonMovieStreamingSearch, - watchInfo + watchInfo, true ) } @@ -344,11 +348,6 @@ class MovieDetailsFragment : Fragment(), MovieActionsContract { } binding.textViewMovieDate.text = releaseAndRuntime.toString() - // show trailer button (but trailer is loaded separately, just for animation) - binding.buttonMovieTrailer.isGone = false - // movie title should be available now, can show similar movies button - binding.buttonMovieSimilar.isGone = false - // hide check-in if not connected to trakt or hexagon is enabled val isConnectedToTrakt = TraktCredentials.get(requireContext()).hasCredentials() val hideCheckIn = !isConnectedToTrakt || HexagonSettings.isEnabled(requireContext()) @@ -437,7 +436,18 @@ class MovieDetailsFragment : Fragment(), MovieActionsContract { } } - // show button bar + // trakt comments link + binding.containerMovieButtons.buttonMovieComments.apply { + setOnClickListener { v -> + val tmdbId = tmdbId + if (tmdbId > 0) { + val i = TraktCommentsActivity.intentMovie(requireContext(), movieTitle, tmdbId) + Utils.startActivityWithAnimation(activity, i, v) + } + } + } + + // show buttons after configuring them binding.containerMovieButtons.root.isGone = false // language button @@ -496,16 +506,6 @@ class MovieDetailsFragment : Fragment(), MovieActionsContract { binding.textMovieLastUpdated.text = TimeTools.formatToLocalDateAndTime(requireContext(), movieDetails.lastUpdatedMillis) - // trakt comments link - binding.buttonMovieComments.setOnClickListener { v -> - val tmdbId = tmdbId - if (tmdbId > 0) { - val i = TraktCommentsActivity.intentMovie(requireContext(), movieTitle, tmdbId) - Utils.startActivityWithAnimation(activity, i, v) - } - } - binding.buttonMovieComments.isGone = false - // load poster, cache on external storage if (tmdbMovie.poster_path.isNullOrEmpty()) { binding.frameLayoutMoviePoster.isClickable = false @@ -791,7 +791,7 @@ class MovieDetailsFragment : Fragment(), MovieActionsContract { ) { if (videoId != null) { this@MovieDetailsFragment.trailerYoutubeId = videoId - binding.buttonMovieTrailer.isEnabled = true + binding.containerMovieButtons.buttonMovieTrailer.isEnabled = true } } diff --git a/app/src/main/res/layout-w1024dp/fragment_movie.xml b/app/src/main/res/layout-w1024dp/fragment_movie.xml index 45760442e6..1a501f77fb 100644 --- a/app/src/main/res/layout-w1024dp/fragment_movie.xml +++ b/app/src/main/res/layout-w1024dp/fragment_movie.xml @@ -1,4 +1,8 @@ + + + + -