Added episode links (#931)

This commit is contained in:
natimks
2025-04-10 11:53:37 -03:00
committed by GitHub
parent 5556d73c5a
commit 228e9d07d0
9 changed files with 606 additions and 47 deletions

View File

@ -46,6 +46,7 @@ import com.michaldrabik.ui_base.utilities.viewBinding
import com.michaldrabik.ui_comments.CommentView
import com.michaldrabik.ui_episodes.R
import com.michaldrabik.ui_episodes.databinding.ViewEpisodeDetailsBinding
import com.michaldrabik.ui_episodes.details.links.EpisodeLinksBottomSheet
import com.michaldrabik.ui_model.Comment
import com.michaldrabik.ui_model.Episode
import com.michaldrabik.ui_model.Ids
@ -75,14 +76,14 @@ class EpisodeDetailsBottomSheet : BaseBottomSheetFragment(R.layout.view_episode_
companion object {
fun createBundle(
ids: Ids,
showIds: Ids,
episode: Episode,
seasonEpisodesIds: List<Int>?,
isWatched: Boolean,
showTabs: Boolean,
): Bundle {
val options = Options(
ids = ids,
showIds = showIds,
episode = episode,
seasonEpisodesIds = seasonEpisodesIds,
isWatched = isWatched,
@ -129,7 +130,7 @@ class EpisodeDetailsBottomSheet : BaseBottomSheetFragment(R.layout.view_episode_
private fun setupView() {
binding.run {
val (ids, episode, _, isWatched, showTabs) = options
val (showIds, episode, _, isWatched, showTabs) = options
episodeDetailsTitle.text = when (episode.title) {
"Episode ${episode.number}" -> String.format(
ENGLISH,
@ -149,51 +150,13 @@ class EpisodeDetailsBottomSheet : BaseBottomSheetFragment(R.layout.view_episode_
episode.commentCount,
)
episodeDetailsCommentsButton.onClick {
viewModel.loadComments(ids.trakt, episode.season, episode.number)
viewModel.loadComments(showIds.trakt, episode.season, episode.number)
}
episodeDetailsPostCommentButton.onClick { openPostCommentSheet() }
episodeDetailsLinksButton.onClick { openLinksSheet() }
}
}
private fun openRateDialog() {
setFragmentResultListener(NavigationArgs.REQUEST_RATING) { _, bundle ->
when (bundle.optionalParcelable<Operation>(NavigationArgs.RESULT)) {
Operation.SAVE -> renderSnackbar(MessageEvent.Info(R.string.textRateSaved))
Operation.REMOVE -> renderSnackbar(MessageEvent.Info(R.string.textRateRemoved))
else -> Timber.w("Unknown result.")
}
viewModel.loadRatings(options.episode)
setFragmentResult(REQUEST_EPISODE_DETAILS, bundleOf(NavigationArgs.ACTION_RATING_CHANGED to true))
}
val bundle = RatingsBottomSheet.createBundle(
id = options.episode.ids.trakt,
type = Type.EPISODE,
seasonNumber = options.episode.season,
episodeNumber = options.episode.number,
)
navigateTo(R.id.actionEpisodeDetailsDialogToRate, bundle)
}
private fun openPostCommentSheet(comment: Comment? = null) {
setFragmentResultListener(REQUEST_COMMENT) { _, bundle ->
renderSnackbar(MessageEvent.Info(R.string.textCommentPosted))
when (bundle.getString(ARG_COMMENT_ACTION)) {
ACTION_NEW_COMMENT -> {
val newComment = bundle.getParcelable<Comment>(ARG_COMMENT)!!
viewModel.addNewComment(newComment)
}
}
}
val bundle = when {
comment != null -> bundleOf(
ARG_COMMENT_ID to comment.getReplyId(),
ARG_REPLY_USER to comment.user.username,
)
else -> bundleOf(ARG_EPISODE_ID to options.episode.ids.trakt.id)
}
navigateTo(R.id.actionEpisodeDetailsDialogToPostComment, bundle)
}
@SuppressLint("SetTextI18n")
private fun render(uiState: EpisodeDetailsUiState) {
uiState.run {
@ -455,6 +418,53 @@ class EpisodeDetailsBottomSheet : BaseBottomSheetFragment(R.layout.view_episode_
.show()
}
private fun openRateDialog() {
setFragmentResultListener(NavigationArgs.REQUEST_RATING) { _, bundle ->
when (bundle.optionalParcelable<Operation>(NavigationArgs.RESULT)) {
Operation.SAVE -> renderSnackbar(MessageEvent.Info(R.string.textRateSaved))
Operation.REMOVE -> renderSnackbar(MessageEvent.Info(R.string.textRateRemoved))
else -> Timber.w("Unknown result.")
}
viewModel.loadRatings(options.episode)
setFragmentResult(REQUEST_EPISODE_DETAILS, bundleOf(NavigationArgs.ACTION_RATING_CHANGED to true))
}
val bundle = RatingsBottomSheet.createBundle(
id = options.episode.ids.trakt,
type = Type.EPISODE,
seasonNumber = options.episode.season,
episodeNumber = options.episode.number,
)
navigateTo(R.id.actionEpisodeDetailsDialogToRate, bundle)
}
private fun openPostCommentSheet(comment: Comment? = null) {
setFragmentResultListener(REQUEST_COMMENT) { _, bundle ->
renderSnackbar(MessageEvent.Info(R.string.textCommentPosted))
when (bundle.getString(ARG_COMMENT_ACTION)) {
ACTION_NEW_COMMENT -> {
val newComment = bundle.getParcelable<Comment>(ARG_COMMENT)!!
viewModel.addNewComment(newComment)
}
}
}
val bundle = when {
comment != null -> bundleOf(
ARG_COMMENT_ID to comment.getReplyId(),
ARG_REPLY_USER to comment.user.username,
)
else -> bundleOf(ARG_EPISODE_ID to options.episode.ids.trakt.id)
}
navigateTo(R.id.actionEpisodeDetailsDialogToPostComment, bundle)
}
private fun openLinksSheet() {
val bundle = EpisodeLinksBottomSheet.createBundle(
showIds = options.showIds,
episode = options.episode,
)
navigateTo(R.id.actionEpisodeDetailsDialogToLink, bundle)
}
private val tabSelectedListener = object : TabLayout.OnTabSelectedListener {
override fun onTabSelected(tab: TabLayout.Tab?) {
binding.episodeDetailsTabs.removeOnTabSelectedListener(this)
@ -469,7 +479,7 @@ class EpisodeDetailsBottomSheet : BaseBottomSheetFragment(R.layout.view_episode_
@Parcelize
private data class Options(
val ids: Ids,
val showIds: Ids,
val episode: Episode,
val seasonEpisodesIds: List<Int>?,
val isWatched: Boolean,

View File

@ -0,0 +1,145 @@
package com.michaldrabik.ui_episodes.details.links
import android.content.ActivityNotFoundException
import android.content.Intent
import android.os.Bundle
import android.os.Parcelable
import android.view.View
import androidx.core.net.toUri
import androidx.core.os.bundleOf
import com.michaldrabik.ui_base.BaseBottomSheetFragment
import com.michaldrabik.ui_base.utilities.extensions.onClick
import com.michaldrabik.ui_base.utilities.extensions.openWebUrl
import com.michaldrabik.ui_base.utilities.extensions.requireParcelable
import com.michaldrabik.ui_base.utilities.viewBinding
import com.michaldrabik.ui_episodes.R
import com.michaldrabik.ui_episodes.databinding.ViewEpisodeLinksBinding
import com.michaldrabik.ui_model.Episode
import com.michaldrabik.ui_model.Ids
import com.michaldrabik.ui_navigation.java.NavigationArgs
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.parcelize.Parcelize
@AndroidEntryPoint
class EpisodeLinksBottomSheet : BaseBottomSheetFragment(R.layout.view_episode_links) {
@Parcelize
data class Options(
val showIds: Ids,
val ids: Ids,
val season: Int,
val episodeNumber: Int,
) : Parcelable
companion object {
fun createBundle(
showIds: Ids,
episode: Episode,
): Bundle {
val options = Options(
showIds = showIds,
ids = episode.ids,
season = episode.season,
episodeNumber = episode.number,
)
return bundleOf(NavigationArgs.ARG_OPTIONS to options)
}
}
private val binding by viewBinding(ViewEpisodeLinksBinding::bind)
private val options by lazy { requireParcelable<Options>(NavigationArgs.ARG_OPTIONS) }
private val showIds by lazy { options.showIds }
private val ids by lazy { options.ids }
private val season by lazy { options.season }
private val episodeNumber by lazy { options.episodeNumber }
override fun getTheme(): Int = R.style.CustomBottomSheetDialog
override fun onViewCreated(
view: View,
savedInstanceState: Bundle?,
) {
super.onViewCreated(view, savedInstanceState)
setupView()
}
private fun setupView() {
with(binding) {
val searchQuery = "${showIds.slug.id} season $season episode $episodeNumber"
viewEpisodeLinksGoogle.onClick {
openWebUrl("https://www.google.com/search?q=$searchQuery")
}
viewEpisodeLinksDuckDuck.onClick {
openWebUrl("https://duckduckgo.com/?q=$searchQuery")
}
viewEpisodeLinksButtonClose.onClick {
closeSheet()
}
}
setTraktLink()
setTmdbLink()
setTvdbLink()
setImdbLink()
}
private fun setTraktLink() {
binding.viewEpisodeLinksTrakt.run {
if (ids.trakt.id == -1L) {
alpha = 0.5F
isEnabled = false
} else {
onClick { openWebUrl("https://trakt.tv/shows/${showIds.trakt.id}/seasons/$season/episodes/$episodeNumber") }
}
}
}
private fun setTmdbLink() {
binding.viewEpisodeLinksTmdb.run {
if (ids.tmdb.id == -1L) {
alpha = 0.5F
isEnabled = false
} else {
onClick {
openWebUrl("https://www.themoviedb.org/tv/${showIds.tmdb.id}/season/$season/episode/$episodeNumber")
}
}
}
}
private fun setTvdbLink() {
binding.viewEpisodeLinksTvdb.run {
if (ids.tvdb.id == -1L) {
alpha = 0.5F
isEnabled = false
} else {
onClick {
openWebUrl("https://thetvdb.com/series/${showIds.tvdb.id}/episodes/${ids.tvdb.id}")
}
}
}
}
private fun setImdbLink() {
binding.viewEpisodeLinksImdb.run {
if (ids.imdb.id.isBlank()) {
alpha = 0.5F
isEnabled = false
} else {
onClick {
val i = Intent(Intent.ACTION_VIEW)
i.data = "imdb:///title/${ids.imdb.id}".toUri()
try {
startActivity(i)
} catch (e: ActivityNotFoundException) {
// IMDb App not installed. Start in web browser
openWebUrl("https://www.imdb.com/title/${ids.imdb.id}")
}
}
}
}
}
}

View File

@ -282,6 +282,15 @@
</FrameLayout>
<com.google.android.material.chip.Chip
android:id="@+id/episodeDetailsLinksButton"
style="@style/ShowlyChip.Button"
android:layout_marginStart="@dimen/spaceSmall"
android:text="@string/textLink"
app:chipBackgroundColor="?colorSheetBackground"
app:chipIcon="@drawable/ic_link"
/>
</LinearLayout>
<TextView

View File

@ -0,0 +1,147 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:custom="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/viewEpisodeLinksRoot"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_bottom_sheet_secondary"
android:clipChildren="false"
android:clipToPadding="false"
android:focusableInTouchMode="true"
android:paddingTop="@dimen/spaceMedium"
android:paddingBottom="@dimen/spaceNormal"
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout"
>
<androidx.constraintlayout.widget.Guideline
android:id="@+id/viewEpisodeLinksGuideline"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.5"
/>
<TextView
android:id="@+id/viewEpisodeLinksTitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/spaceNormal"
android:layout_marginEnd="@dimen/spaceNormal"
android:gravity="start"
android:text="@string/textLink"
android:textAlignment="viewStart"
android:textAllCaps="true"
android:textColor="?android:attr/textColorPrimary"
android:textSize="20sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
/>
<com.michaldrabik.ui_base.common.sheets.links.views.LinkItemView
android:id="@+id/viewEpisodeLinksTrakt"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/spaceNormal"
android:layout_marginTop="@dimen/spaceMedium"
android:layout_marginEnd="@dimen/spaceSmall"
app:layout_constraintEnd_toStartOf="@id/viewEpisodeLinksGuideline"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/viewEpisodeLinksTitle"
custom:icon="@drawable/ic_trakt"
custom:text="Trakt.tv"
/>
<com.michaldrabik.ui_base.common.sheets.links.views.LinkItemView
android:id="@+id/viewEpisodeLinksImdb"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/spaceNormal"
android:layout_marginTop="@dimen/spaceMedium"
android:layout_marginEnd="@dimen/spaceSmall"
app:layout_constraintEnd_toStartOf="@id/viewEpisodeLinksGuideline"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/viewEpisodeLinksTrakt"
custom:icon="@drawable/ic_imdb"
custom:text="IMDb"
/>
<com.michaldrabik.ui_base.common.sheets.links.views.LinkItemView
android:id="@+id/viewEpisodeLinksTmdb"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/spaceSmall"
android:layout_marginTop="@dimen/spaceMedium"
android:layout_marginEnd="@dimen/spaceNormal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/viewEpisodeLinksGuideline"
app:layout_constraintTop_toBottomOf="@id/viewEpisodeLinksTitle"
custom:icon="@drawable/ic_tmdb"
custom:text="TMDB"
/>
<com.michaldrabik.ui_base.common.sheets.links.views.LinkItemView
android:id="@+id/viewEpisodeLinksGoogle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/spaceNormal"
android:layout_marginTop="@dimen/spaceMedium"
android:layout_marginEnd="@dimen/spaceSmall"
app:layout_constraintEnd_toStartOf="@id/viewEpisodeLinksGuideline"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/viewEpisodeLinksImdb"
custom:icon="@drawable/ic_google"
custom:text="Google"
/>
<com.michaldrabik.ui_base.common.sheets.links.views.LinkItemView
android:id="@+id/viewEpisodeLinksTvdb"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/spaceSmall"
android:layout_marginTop="@dimen/spaceMedium"
android:layout_marginEnd="@dimen/spaceNormal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/viewEpisodeLinksGuideline"
app:layout_constraintTop_toBottomOf="@id/viewEpisodeLinksTmdb"
custom:icon="@drawable/ic_tvdb"
custom:text="TVDB"
/>
<com.michaldrabik.ui_base.common.sheets.links.views.LinkItemView
android:id="@+id/viewEpisodeLinksDuckDuck"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/spaceSmall"
android:layout_marginTop="@dimen/spaceMedium"
android:layout_marginEnd="@dimen/spaceNormal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/viewEpisodeLinksGuideline"
app:layout_constraintTop_toBottomOf="@id/viewEpisodeLinksTvdb"
custom:icon="@drawable/ic_duckduck"
custom:text="DuckDuckGo"
/>
<com.google.android.material.button.MaterialButton
android:id="@+id/viewEpisodeLinksButtonClose"
style="@style/RoundMaterialButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/spaceNormal"
android:layout_marginTop="@dimen/spaceNormal"
android:layout_marginEnd="@dimen/spaceNormal"
android:backgroundTint="@color/selector_main_button"
android:gravity="center"
android:text="@string/textClose"
android:textColor="?attr/textColorOnSurface"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/viewEpisodeLinksGoogle"
app:rippleColor="?android:attr/textColorPrimary"
/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,232 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:custom="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/viewLinksRoot"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_bottom_sheet_secondary"
android:clipChildren="false"
android:clipToPadding="false"
android:focusableInTouchMode="true"
android:paddingTop="@dimen/spaceMedium"
android:paddingBottom="@dimen/spaceNormal"
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout"
>
<androidx.constraintlayout.widget.Guideline
android:id="@+id/viewLinksGuideline"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.5"
/>
<TextView
android:id="@+id/viewLinksTitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/spaceNormal"
android:layout_marginEnd="@dimen/spaceNormal"
android:gravity="start"
android:text="@string/textLink"
android:textAlignment="viewStart"
android:textAllCaps="true"
android:textColor="?android:attr/textColorPrimary"
android:textSize="20sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
/>
<com.michaldrabik.ui_base.common.sheets.links.views.LinkItemView
android:id="@+id/viewLinksWebsite"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/spaceNormal"
android:layout_marginTop="@dimen/spaceNormal"
android:layout_marginEnd="@dimen/spaceSmall"
app:layout_constraintEnd_toStartOf="@id/viewLinksGuideline"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/viewLinksTitle"
custom:icon="@drawable/ic_link_color"
custom:text="Website"
/>
<com.michaldrabik.ui_base.common.sheets.links.views.LinkItemView
android:id="@+id/viewLinksTrakt"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/spaceNormal"
android:layout_marginTop="@dimen/spaceMedium"
android:layout_marginEnd="@dimen/spaceSmall"
app:layout_constraintEnd_toStartOf="@id/viewLinksGuideline"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/viewLinksWebsite"
custom:icon="@drawable/ic_trakt"
custom:text="Trakt.tv"
/>
<com.michaldrabik.ui_base.common.sheets.links.views.LinkItemView
android:id="@+id/viewLinksImdb"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/spaceNormal"
android:layout_marginTop="@dimen/spaceMedium"
android:layout_marginEnd="@dimen/spaceSmall"
app:layout_constraintEnd_toStartOf="@id/viewLinksGuideline"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/viewLinksTrakt"
custom:icon="@drawable/ic_imdb"
custom:text="IMDb"
/>
<com.michaldrabik.ui_base.common.sheets.links.views.LinkItemView
android:id="@+id/viewLinksTmdb"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/spaceNormal"
android:layout_marginTop="@dimen/spaceMedium"
android:layout_marginEnd="@dimen/spaceSmall"
app:layout_constraintEnd_toStartOf="@id/viewLinksGuideline"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/viewLinksImdb"
custom:icon="@drawable/ic_tmdb"
custom:text="TMDB"
/>
<com.michaldrabik.ui_base.common.sheets.links.views.LinkItemView
android:id="@+id/viewLinksTvdb"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/spaceNormal"
android:layout_marginTop="@dimen/spaceMedium"
android:layout_marginEnd="@dimen/spaceSmall"
app:layout_constraintEnd_toStartOf="@id/viewLinksGuideline"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/viewLinksTmdb"
custom:icon="@drawable/ic_tvdb"
custom:text="TVDB"
/>
<com.michaldrabik.ui_base.common.sheets.links.views.LinkItemView
android:id="@+id/viewLinksJustWatch"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/spaceNormal"
android:layout_marginTop="@dimen/spaceMedium"
android:layout_marginEnd="@dimen/spaceSmall"
app:layout_constraintEnd_toStartOf="@id/viewLinksGuideline"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/viewLinksTvdb"
custom:icon="@drawable/ic_justwatch"
custom:text="JustWatch"
/>
<com.michaldrabik.ui_base.common.sheets.links.views.LinkItemView
android:id="@+id/viewLinksGoogle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/spaceSmall"
android:layout_marginTop="@dimen/spaceNormal"
android:layout_marginEnd="@dimen/spaceNormal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/viewLinksGuideline"
app:layout_constraintTop_toBottomOf="@id/viewLinksTitle"
custom:icon="@drawable/ic_google"
custom:text="Google"
/>
<com.michaldrabik.ui_base.common.sheets.links.views.LinkItemView
android:id="@+id/viewLinksDuckDuck"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/spaceSmall"
android:layout_marginTop="@dimen/spaceMedium"
android:layout_marginEnd="@dimen/spaceNormal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/viewLinksGuideline"
app:layout_constraintTop_toBottomOf="@id/viewLinksGoogle"
custom:icon="@drawable/ic_duckduck"
custom:text="DuckDuckGo"
/>
<com.michaldrabik.ui_base.common.sheets.links.views.LinkItemView
android:id="@+id/viewLinksWiki"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/spaceSmall"
android:layout_marginTop="@dimen/spaceMedium"
android:layout_marginEnd="@dimen/spaceNormal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/viewLinksGuideline"
app:layout_constraintTop_toBottomOf="@id/viewLinksDuckDuck"
custom:icon="@drawable/ic_wikipedia"
custom:text="Wikipedia"
/>
<com.michaldrabik.ui_base.common.sheets.links.views.LinkItemView
android:id="@+id/viewLinksYouTube"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/spaceSmall"
android:layout_marginTop="@dimen/spaceMedium"
android:layout_marginEnd="@dimen/spaceNormal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/viewLinksGuideline"
app:layout_constraintTop_toBottomOf="@id/viewLinksWiki"
custom:icon="@drawable/ic_youtube"
custom:text="YouTube"
/>
<com.michaldrabik.ui_base.common.sheets.links.views.LinkItemView
android:id="@+id/viewLinksTwitter"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/spaceSmall"
android:layout_marginTop="@dimen/spaceMedium"
android:layout_marginEnd="@dimen/spaceNormal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/viewLinksGuideline"
app:layout_constraintTop_toBottomOf="@id/viewLinksYouTube"
custom:icon="@drawable/ic_twitter"
custom:text="Twitter"
/>
<com.michaldrabik.ui_base.common.sheets.links.views.LinkItemView
android:id="@+id/viewLinksGif"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/spaceSmall"
android:layout_marginTop="@dimen/spaceMedium"
android:layout_marginEnd="@dimen/spaceNormal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/viewLinksGuideline"
app:layout_constraintTop_toBottomOf="@id/viewLinksTwitter"
custom:icon="@drawable/ic_giphy"
custom:text="Giphy"
/>
<com.google.android.material.button.MaterialButton
android:id="@+id/viewLinksButtonClose"
style="@style/RoundMaterialButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/spaceNormal"
android:layout_marginTop="@dimen/spaceNormal"
android:layout_marginEnd="@dimen/spaceNormal"
android:backgroundTint="@color/selector_main_button"
android:gravity="center"
android:text="@string/textClose"
android:textColor="?attr/textColorOnSurface"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/viewLinksJustWatch"
app:rippleColor="?android:attr/textColorPrimary"
/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -336,6 +336,11 @@
app:destination="@id/episodeDetailsDialog"
app:launchSingleTop="true"
/>
<action
android:id="@+id/actionEpisodeDetailsToLink"
app:destination="@+id/episodeLinksDialog"
app:launchSingleTop="true"
/>
<action
android:id="@+id/actionShowDetailsFragmentToRemoveTraktHidden"
app:destination="@id/removeTraktHiddenDialog"
@ -931,6 +936,11 @@
app:destination="@id/ratingDialog"
app:launchSingleTop="true"
/>
<action
android:id="@+id/actionEpisodeDetailsDialogToLink"
app:destination="@+id/episodeLinksDialog"
app:launchSingleTop="true"
/>
</dialog>
<dialog
@ -999,6 +1009,12 @@
android:label="dialogPersonLinks"
/>
<dialog
android:id="@+id/episodeLinksDialog"
android:name="com.michaldrabik.ui_episodes.details.links.EpisodeLinksBottomSheet"
android:label="dialogEpisodeLinks"
/>
<dialog
android:id="@+id/showItemContextDialog"
android:name="com.michaldrabik.ui_base.common.sheets.context_menu.show.ShowContextMenuBottomSheet"

View File

@ -388,7 +388,7 @@ class ProgressMainFragment :
when (event) {
is OpenEpisodeDetails -> {
val bundle = EpisodeDetailsBottomSheet.createBundle(
ids = event.show.ids,
showIds = event.show.ids,
episode = event.episode,
seasonEpisodesIds = null,
isWatched = event.isWatched,

View File

@ -250,7 +250,7 @@ class ShowDetailsEpisodesFragment :
}
val bundle = EpisodeDetailsBottomSheet.createBundle(
ids = show.ids,
showIds = show.ids,
episode = episode,
seasonEpisodesIds = season.episodes.map { it.number },
isWatched = isWatched,

View File

@ -99,7 +99,7 @@ class ShowDetailsNextEpisodeFragment :
private fun openDetails(episodeBundle: NextEpisodeBundle) {
val (show, episode) = episodeBundle.nextEpisode
val bundle = EpisodeDetailsBottomSheet.createBundle(
ids = show.ids,
showIds = show.ids,
episode = episode,
seasonEpisodesIds = null,
isWatched = episodeBundle.isWatched,