From cdd044fb91787058e3b2f562eb794b78cb8c648d Mon Sep 17 00:00:00 2001 From: Uwe Trottmann Date: Thu, 14 Mar 2024 15:58:58 +0100 Subject: [PATCH] Episodes: allow to re-watch, move more options menu to watched box --- CHANGELOG.md | 1 + .../shows/episodes/EpisodesAdapter.kt | 16 ++-------------- .../shows/episodes/EpisodesFragment.kt | 6 +----- app/src/main/res/layout/item_episode.xml | 13 ------------- 4 files changed, 4 insertions(+), 32 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f9aa9bfc3..ff90b836cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ Version 72 * ๐Ÿ”ง Lists: add option to watch next episode, update to shows more options menu. * ๐Ÿ”ง Lists: replace favorite with set next watched button to match Shows section. * ๐Ÿ”จ Overview: prevent skipping already watched episodes which would remove existing number of times watched. +* ๐Ÿ”จ Episodes: allow to re-watch from episode list, integrate all options into watched button. #### 72.0.5 ๐Ÿงช *2024-03-08* diff --git a/app/src/main/java/com/battlelancer/seriesguide/shows/episodes/EpisodesAdapter.kt b/app/src/main/java/com/battlelancer/seriesguide/shows/episodes/EpisodesAdapter.kt index fbc96b9dd7..844d2faab4 100644 --- a/app/src/main/java/com/battlelancer/seriesguide/shows/episodes/EpisodesAdapter.kt +++ b/app/src/main/java/com/battlelancer/seriesguide/shows/episodes/EpisodesAdapter.kt @@ -14,9 +14,9 @@ import androidx.recyclerview.widget.ListAdapter import androidx.recyclerview.widget.RecyclerView import com.battlelancer.seriesguide.R import com.battlelancer.seriesguide.databinding.ItemEpisodeBinding -import com.battlelancer.seriesguide.shows.database.SgEpisode2Info import com.battlelancer.seriesguide.settings.DisplaySettings.isDisplayExactDate import com.battlelancer.seriesguide.settings.DisplaySettings.preventSpoilers +import com.battlelancer.seriesguide.shows.database.SgEpisode2Info import com.battlelancer.seriesguide.util.TextTools import com.battlelancer.seriesguide.util.TimeTools import java.text.NumberFormat @@ -66,7 +66,6 @@ class EpisodesAdapter( interface ClickListener { fun onItemClick(position: Int) - fun onWatchedBoxClick(episodeId: Long, isWatched: Boolean) fun onPopupMenuClick( v: View, episodeId: Long, episodeNumber: Int, releaseTimeMs: Long, watchedFlag: Int, isCollected: Boolean @@ -96,20 +95,9 @@ class EpisodeViewHolder( clickListener.onItemClick(absoluteAdapterPosition) } binding.watchedBoxEpisode.setOnClickListener { view -> - episode?.let { - val box = view as WatchedBox - // disable button, will be re-enabled on data reload once action completes - box.isEnabled = false - clickListener.onWatchedBoxClick(it.id, !EpisodeTools.isWatched( - box.episodeFlag - ) - ) - } - } - binding.imageViewContextMenu.setOnClickListener { v -> episode?.let { clickListener.onPopupMenuClick( - v, + view, it.id, it.episodenumber, it.firstReleasedMs, diff --git a/app/src/main/java/com/battlelancer/seriesguide/shows/episodes/EpisodesFragment.kt b/app/src/main/java/com/battlelancer/seriesguide/shows/episodes/EpisodesFragment.kt index e5c972272f..bd2c3092f3 100644 --- a/app/src/main/java/com/battlelancer/seriesguide/shows/episodes/EpisodesFragment.kt +++ b/app/src/main/java/com/battlelancer/seriesguide/shows/episodes/EpisodesFragment.kt @@ -183,10 +183,6 @@ class EpisodesFragment : Fragment() { showDetails(position) } - override fun onWatchedBoxClick(episodeId: Long, isWatched: Boolean) { - onFlagEpisodeWatched(episodeId, isWatched) - } - override fun onPopupMenuClick( v: View, episodeId: Long, @@ -204,7 +200,7 @@ class EpisodesFragment : Fragment() { EpisodeTools.isWatched( watchedFlag ) - findItem(R.id.menu_action_episodes_watched).isVisible = !isWatched + // To allow re-watching set watched is always visible findItem(R.id.menu_action_episodes_not_watched).isVisible = isWatched findItem(R.id.menu_action_episodes_watched_up_to).isVisible = !isWatched val isSkipped = diff --git a/app/src/main/res/layout/item_episode.xml b/app/src/main/res/layout/item_episode.xml index dd547e7237..22ca7db560 100644 --- a/app/src/main/res/layout/item_episode.xml +++ b/app/src/main/res/layout/item_episode.xml @@ -83,19 +83,6 @@ android:layout_marginLeft="29dp" android:contentDescription="@string/state_in_collection" app:srcCompat="@drawable/ic_collected_24dp" /> - - \ No newline at end of file