Improve community rating visually
This commit is contained in:
parent
9d61aff59f
commit
b3af3e5aeb
5 changed files with 28 additions and 21 deletions
|
@ -34,7 +34,8 @@ class EpisodeBottomSheetFragment : BottomSheetDialogFragment() {
|
|||
|
||||
binding.playButton.setOnClickListener {
|
||||
viewModel.mediaSources.value?.get(0)?.id?.let { mediaSourceId ->
|
||||
navigateToPlayerActivity(args.episodeId,
|
||||
navigateToPlayerActivity(
|
||||
args.episodeId,
|
||||
mediaSourceId,
|
||||
viewModel.item.value!!.userData!!.playbackPositionTicks.div(10000)
|
||||
)
|
||||
|
@ -64,6 +65,10 @@ class EpisodeBottomSheetFragment : BottomSheetDialogFragment() {
|
|||
).toInt()
|
||||
binding.progressBar.visibility = View.VISIBLE
|
||||
}
|
||||
binding.communityRating.visibility = when (episode.communityRating != null) {
|
||||
false -> View.GONE
|
||||
true -> View.VISIBLE
|
||||
}
|
||||
})
|
||||
|
||||
viewModel.played.observe(viewLifecycleOwner, {
|
||||
|
@ -89,7 +94,11 @@ class EpisodeBottomSheetFragment : BottomSheetDialogFragment() {
|
|||
return binding.root
|
||||
}
|
||||
|
||||
private fun navigateToPlayerActivity(itemId: UUID, mediaSourceId: String, playbackPosition: Long) {
|
||||
private fun navigateToPlayerActivity(
|
||||
itemId: UUID,
|
||||
mediaSourceId: String,
|
||||
playbackPosition: Long
|
||||
) {
|
||||
findNavController().navigate(
|
||||
EpisodeBottomSheetFragmentDirections.actionEpisodeBottomSheetFragmentToPlayerActivity(
|
||||
itemId,
|
||||
|
|
|
@ -53,6 +53,10 @@ class MediaInfoFragment : Fragment() {
|
|||
if (item.trailerCount != null && item.trailerCount!! < 1) {
|
||||
binding.trailerButton.visibility = View.GONE
|
||||
}
|
||||
binding.communityRating.visibility = when (item.communityRating != null) {
|
||||
true -> View.VISIBLE
|
||||
false -> View.GONE
|
||||
}
|
||||
})
|
||||
|
||||
viewModel.actors.observe(viewLifecycleOwner, { actors ->
|
||||
|
|
|
@ -20,12 +20,12 @@
|
|||
android:id="@+id/holder"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:importantForAccessibility="no"
|
||||
android:src="@drawable/ic_minus_fat"
|
||||
app:tint="?attr/colorOnBackground"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:importantForAccessibility="no"/>
|
||||
app:tint="?attr/colorOnBackground" />
|
||||
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
android:id="@+id/episode_image"
|
||||
|
@ -69,7 +69,6 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:gravity="bottom"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="@id/episode_name"
|
||||
app:layout_constraintTop_toBottomOf="@id/episode_name">
|
||||
|
@ -93,20 +92,18 @@
|
|||
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
|
||||
tools:text="26 min" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:importantForAccessibility="no"
|
||||
android:src="@drawable/ic_star"
|
||||
app:tint="#F2C94C" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/community_rating"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawablePadding="4dp"
|
||||
android:gravity="bottom"
|
||||
android:text="@{viewModel.item.communityRating.toString()}"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
|
||||
app:drawableStartCompat="@drawable/ic_star"
|
||||
app:drawableTint="@color/yellow"
|
||||
tools:text="8.8" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
|
|
|
@ -74,8 +74,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="24dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:gravity="bottom">
|
||||
android:layout_marginBottom="16dp">
|
||||
|
||||
|
||||
<TextView
|
||||
|
@ -105,19 +104,16 @@
|
|||
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
|
||||
tools:text="PG-13" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:importantForAccessibility="no"
|
||||
android:src="@drawable/ic_star"
|
||||
app:tint="#F2C94C" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/community_rating"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawablePadding="4dp"
|
||||
android:gravity="bottom"
|
||||
android:text="@{viewModel.item.communityRating.toString()}"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
|
||||
app:drawableStartCompat="@drawable/ic_star"
|
||||
app:drawableTint="@color/yellow"
|
||||
tools:text="7.3" />
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
@ -14,4 +14,5 @@
|
|||
<color name="black">#FF000000</color>
|
||||
<color name="white">#FFFFFFFF</color>
|
||||
<color name="red">#EB5757</color>
|
||||
<color name="yellow">#F2C94C</color>
|
||||
</resources>
|
Loading…
Reference in a new issue