Skip to content

Commit

Permalink
Episodes: allow to re-watch, move more options menu to watched box
Browse files Browse the repository at this point in the history
  • Loading branch information
UweTrottmann committed Mar 14, 2024
1 parent 4a51b6d commit cdd044f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 32 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 =
Expand Down
13 changes: 0 additions & 13 deletions app/src/main/res/layout/item_episode.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,19 +83,6 @@
android:layout_marginLeft="29dp"
android:contentDescription="@string/state_in_collection"
app:srcCompat="@drawable/ic_collected_24dp" />

<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/imageViewContextMenu"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/description_menu_overflow"
android:paddingLeft="@dimen/default_padding"
android:scaleType="centerInside"
app:srcCompat="@drawable/ic_more_vert_black_20dp"
tools:ignore="RtlSymmetry" />
</RelativeLayout>

</FrameLayout>

0 comments on commit cdd044f

Please sign in to comment.