Add series name to episode sheet with navigation (#173)
Also limit the episode name to 3 lines
This commit is contained in:
parent
86ea79b0b4
commit
e40543c0f7
3 changed files with 48 additions and 5 deletions
|
@ -27,6 +27,7 @@ import dev.jdtech.jellyfin.utils.setTintColorAttribute
|
||||||
import dev.jdtech.jellyfin.viewmodels.EpisodeBottomSheetViewModel
|
import dev.jdtech.jellyfin.viewmodels.EpisodeBottomSheetViewModel
|
||||||
import dev.jdtech.jellyfin.viewmodels.PlayerViewModel
|
import dev.jdtech.jellyfin.viewmodels.PlayerViewModel
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
import org.jellyfin.sdk.model.api.BaseItemKind
|
||||||
import org.jellyfin.sdk.model.api.LocationType
|
import org.jellyfin.sdk.model.api.LocationType
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
@ -190,12 +191,19 @@ class EpisodeBottomSheetFragment : BottomSheetDialogFragment() {
|
||||||
episode.indexNumber,
|
episode.indexNumber,
|
||||||
episode.name
|
episode.name
|
||||||
)
|
)
|
||||||
|
binding.seriesName.text = episode.seriesName
|
||||||
binding.overview.text = episode.overview
|
binding.overview.text = episode.overview
|
||||||
binding.year.text = dateString
|
binding.year.text = dateString
|
||||||
binding.playtime.text = runTime
|
binding.playtime.text = runTime
|
||||||
binding.communityRating.isVisible = episode.communityRating != null
|
binding.communityRating.isVisible = episode.communityRating != null
|
||||||
binding.communityRating.text = episode.communityRating.toString()
|
binding.communityRating.text = episode.communityRating.toString()
|
||||||
binding.missingIcon.isVisible = episode.locationType == LocationType.VIRTUAL
|
binding.missingIcon.isVisible = episode.locationType == LocationType.VIRTUAL
|
||||||
|
|
||||||
|
binding.seriesName.setOnClickListener {
|
||||||
|
if (episode.seriesId != null) {
|
||||||
|
navigateToSeries(episode.seriesId!!, episode.seriesName)
|
||||||
|
}
|
||||||
|
}
|
||||||
bindBaseItemImage(binding.episodeImage, episode)
|
bindBaseItemImage(binding.episodeImage, episode)
|
||||||
}
|
}
|
||||||
binding.loadingIndicator.isVisible = false
|
binding.loadingIndicator.isVisible = false
|
||||||
|
@ -246,4 +254,14 @@ class EpisodeBottomSheetFragment : BottomSheetDialogFragment() {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun navigateToSeries(id: UUID, name: String?) {
|
||||||
|
findNavController().navigate(
|
||||||
|
EpisodeBottomSheetFragmentDirections.actionEpisodeBottomSheetFragmentToMediaInfoFragment(
|
||||||
|
itemId = id,
|
||||||
|
itemName = name,
|
||||||
|
itemType = BaseItemKind.SERIES
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -71,28 +71,50 @@
|
||||||
tools:layout_width="50dp"
|
tools:layout_width="50dp"
|
||||||
tools:visibility="visible" />
|
tools:visibility="visible" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/series_name"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="12dp"
|
||||||
|
android:layout_marginEnd="24dp"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/episode_image"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/episode_image"
|
||||||
|
tools:text="Attack on Titan" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/episode_name"
|
android:id="@+id/episode_name"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="12dp"
|
android:layout_marginStart="12dp"
|
||||||
android:layout_marginEnd="24dp"
|
android:layout_marginEnd="24dp"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:maxLines="3"
|
||||||
android:textAppearance="@style/TextAppearance.Material3.TitleMedium"
|
android:textAppearance="@style/TextAppearance.Material3.TitleMedium"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toEndOf="@id/episode_image"
|
app:layout_constraintStart_toEndOf="@id/episode_image"
|
||||||
app:layout_constraintTop_toTopOf="@id/episode_image"
|
app:layout_constraintTop_toBottomOf="@id/series_name"
|
||||||
tools:text="1. To You, in 2000 Years: The Fall of Shiganshina, Part 1" />
|
tools:text="S1:E1 - To You, in 2000 Years: The Fall of Shiganshina, Part 1" />
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.Barrier
|
||||||
|
android:id="@+id/barrier"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:barrierDirection="bottom"
|
||||||
|
app:constraint_referenced_ids="episode_image,episode_name" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/episode_metadata"
|
android:id="@+id/episode_metadata"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="4dp"
|
||||||
android:layout_marginEnd="24dp"
|
android:layout_marginEnd="24dp"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="@id/episode_image"
|
app:layout_constraintStart_toStartOf="@id/episode_image"
|
||||||
app:layout_constraintTop_toBottomOf="@id/episode_image">
|
app:layout_constraintTop_toBottomOf="@id/barrier">
|
||||||
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/year"
|
android:id="@+id/year"
|
||||||
|
|
|
@ -257,6 +257,9 @@
|
||||||
android:name="isOffline"
|
android:name="isOffline"
|
||||||
app:argType="boolean"
|
app:argType="boolean"
|
||||||
android:defaultValue="false" />
|
android:defaultValue="false" />
|
||||||
|
<action
|
||||||
|
android:id="@+id/action_episodeBottomSheetFragment_to_mediaInfoFragment"
|
||||||
|
app:destination="@id/mediaInfoFragment" />
|
||||||
</dialog>
|
</dialog>
|
||||||
<fragment
|
<fragment
|
||||||
android:id="@+id/favoriteFragment"
|
android:id="@+id/favoriteFragment"
|
||||||
|
|
Loading…
Reference in a new issue