fix: info text overlapping in movie and show fragments

Closes: #358
This commit is contained in:
jarnedemeulemeester 2023-05-13 11:27:24 +02:00
parent 9bbf73d59c
commit 765a31838e
No known key found for this signature in database
GPG key ID: 1E5C6AFBD622E9F5
8 changed files with 252 additions and 623 deletions

View file

@ -309,18 +309,6 @@ class MovieFragment : Fragment() {
}
binding.officialRating.text = item.officialRating
binding.communityRating.text = item.communityRating.toString()
binding.genresLayout.isVisible = item.genres.isNotEmpty()
binding.genres.text = genresString
binding.videoMeta.text = videoString
binding.audio.text = audioString
binding.subtitles.text = subtitleString
binding.subsChip.isVisible = subtitleString.isNotEmpty()
if (appPreferences.displayExtraInfo) {
binding.subtitlesLayout.isVisible = subtitleString.isNotEmpty()
binding.videoMetaLayout.isVisible = videoString.isNotEmpty()
binding.audioLayout.isVisible = audioString.isNotEmpty()
}
videoMetadata.let {
with(binding) {
@ -373,11 +361,26 @@ class MovieFragment : Fragment() {
}
}
}
binding.directorLayout.isVisible = director != null
binding.director.text = director?.name
binding.writersLayout.isVisible = writers.isNotEmpty()
binding.writers.text = writersString
binding.description.text = item.overview
binding.subsChip.isVisible = subtitleString.isNotEmpty()
if (appPreferences.displayExtraInfo) {
binding.info.video.text = videoString
binding.info.videoGroup.isVisible = videoString.isNotEmpty()
binding.info.audio.text = audioString
binding.info.audioGroup.isVisible = audioString.isNotEmpty()
binding.info.subtitles.text = subtitleString
binding.info.subtitlesGroup.isVisible = subtitleString.isNotEmpty()
}
binding.info.description.text = item.overview
binding.info.genres.text = genresString
binding.info.genresGroup.isVisible = item.genres.isNotEmpty()
binding.info.director.text = director?.name
binding.info.directorGroup.isVisible = director != null
binding.info.writers.text = writersString
binding.info.writersGroup.isVisible = writers.isNotEmpty()
val actorsAdapter = binding.peopleRecyclerView.adapter as PersonListAdapter
actorsAdapter.submitList(actors)
bindItemBackdropImage(binding.itemBanner, item)

View file

@ -208,23 +208,15 @@ class ShowFragment : Fragment() {
}
binding.officialRating.text = item.officialRating
binding.communityRating.text = item.communityRating.toString()
binding.genresLayout.isVisible = item.genres.isNotEmpty()
binding.genres.text = genresString
binding.videoMeta.text = videoString
binding.audio.text = audioString
binding.subtitles.text = subtitleString
if (appPreferences.displayExtraInfo) {
binding.subtitlesLayout.isVisible = subtitleString.isNotEmpty()
binding.videoMetaLayout.isVisible = videoString.isNotEmpty()
binding.audioLayout.isVisible = audioString.isNotEmpty()
}
binding.info.description.text = item.overview
binding.info.genres.text = genresString
binding.info.genresGroup.isVisible = item.genres.isNotEmpty()
binding.info.director.text = director?.name
binding.info.directorGroup.isVisible = director != null
binding.info.writers.text = writersString
binding.info.writersGroup.isVisible = writers.isNotEmpty()
binding.directorLayout.isVisible = director != null
binding.director.text = director?.name
binding.writersLayout.isVisible = writers.isNotEmpty()
binding.writers.text = writersString
binding.description.text = item.overview
binding.nextUpLayout.isVisible = nextUp != null
if (nextUp?.indexNumberEnd == null) {
binding.nextUpName.text = getString(

View file

@ -132,17 +132,15 @@
layout="@layout/item_actions"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="24dp"
android:layout_marginBottom="16dp" />
android:layout_marginHorizontal="24dp" />
<LinearLayout
android:id="@+id/player_items_error"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="24dp"
android:layout_marginTop="-12dp"
android:layout_marginBottom="12dp"
android:orientation="horizontal"
android:layout_marginTop="4dp"
android:orientation="vertical"
android:visibility="gone"
tools:visibility="visible">
@ -164,192 +162,9 @@
android:textColor="?attr/colorError" />
</LinearLayout>
<LinearLayout
<include
android:id="@+id/info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="24dp"
android:layout_marginBottom="12dp"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/video_meta_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="12dp"
android:visibility="gone">
<TextView
android:id="@+id/video_meta_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/video"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/video_meta"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="64dp"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="4K HEVC HDR" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/audio_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="12dp"
android:visibility="gone">
<TextView
android:id="@+id/audio_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/audio"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/audio"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="64dp"
android:ellipsize="end"
android:maxLines="3"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="AC-3 Eng 5.1, AC-3 iTA 5.1" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/subtitles_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:visibility="gone">
<TextView
android:id="@+id/subtitles_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/subtitle"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/subtitles"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="64dp"
android:ellipsize="end"
android:maxLines="3"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="English - SUBRIP, SDH - English - SUBRIP" />
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
tools:text="An angel falls. A warrior rises. When Alita awakens with no memory of who she is in a future world she does not recognize, she is taken in by Ido, a compassionate doctor who realizes that somewhere in this abandoned cyborg shell is the heart and soul of a young woman with an extraordinary past." />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/genres_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="12dp">
<TextView
android:id="@+id/genres_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/genres"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/genres"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="64dp"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="Action, Science Fiction, Adventure" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/director_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="12dp">
<TextView
android:id="@+id/director_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/director"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/director"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="64dp"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="Robert Rodriguez" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/writers_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="12dp">
<TextView
android:id="@+id/writers_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/writers"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/writers"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="64dp"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="James Cameron, Laeta Kalogridis, Yukito Kishiro" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
layout="@layout/item_info" />
</LinearLayout>

View file

@ -198,16 +198,14 @@
layout="@layout/item_actions"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="24dp"
android:layout_marginBottom="16dp" />
android:layout_marginHorizontal="24dp" />
<LinearLayout
android:id="@+id/player_items_error"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="24dp"
android:layout_marginTop="-12dp"
android:layout_marginBottom="12dp"
android:layout_marginTop="4dp"
android:orientation="vertical"
android:visibility="gone"
tools:visibility="visible">
@ -230,192 +228,9 @@
android:textColor="?attr/colorError" />
</LinearLayout>
<LinearLayout
<include
android:id="@+id/info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="24dp"
android:layout_marginBottom="12dp"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/video_meta_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="12dp"
android:visibility="gone">
<TextView
android:id="@+id/video_meta_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/video"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/video_meta"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="64dp"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="4K HEVC HDR" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/audio_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="12dp"
android:visibility="gone">
<TextView
android:id="@+id/audio_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/audio"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/audio"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="64dp"
android:ellipsize="end"
android:maxLines="3"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="AC-3 Eng 5.1, AC-3 iTA 5.1" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/subtitles_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:visibility="gone">
<TextView
android:id="@+id/subtitles_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/subtitle"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/subtitles"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="64dp"
android:ellipsize="end"
android:maxLines="3"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="English - SUBRIP, SDH - English - SUBRIP" />
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
tools:text="An angel falls. A warrior rises. When Alita awakens with no memory of who she is in a future world she does not recognize, she is taken in by Ido, a compassionate doctor who realizes that somewhere in this abandoned cyborg shell is the heart and soul of a young woman with an extraordinary past." />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/genres_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="12dp">
<TextView
android:id="@+id/genres_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/genres"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/genres"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="64dp"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="Action, Science Fiction, Adventure" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/director_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="12dp">
<TextView
android:id="@+id/director_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/director"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/director"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="64dp"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="Robert Rodriguez" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/writers_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="12dp">
<TextView
android:id="@+id/writers_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/writers"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/writers"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="64dp"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="James Cameron, Laeta Kalogridis, Yukito Kishiro" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
layout="@layout/item_info" />
<LinearLayout
android:id="@+id/actors"

View file

@ -119,16 +119,14 @@
layout="@layout/item_actions"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="24dp"
android:layout_marginBottom="16dp" />
android:layout_marginHorizontal="24dp" />
<LinearLayout
android:id="@+id/player_items_error"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="24dp"
android:layout_marginTop="-12dp"
android:layout_marginBottom="12dp"
android:layout_marginTop="4dp"
android:orientation="vertical"
android:visibility="gone"
tools:visibility="visible">
@ -151,192 +149,9 @@
android:textColor="?attr/colorError" />
</LinearLayout>
<LinearLayout
<include
android:id="@+id/info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="24dp"
android:layout_marginBottom="12dp"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/video_meta_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="12dp"
android:visibility="gone">
<TextView
android:id="@+id/video_meta_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/video"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/video_meta"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="64dp"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="4K HEVC HDR" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/audio_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="12dp"
android:visibility="gone">
<TextView
android:id="@+id/audio_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/audio"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/audio"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="64dp"
android:ellipsize="end"
android:maxLines="3"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="AC-3 Eng 5.1, AC-3 iTA 5.1" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/subtitles_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:visibility="gone">
<TextView
android:id="@+id/subtitles_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/subtitle"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/subtitles"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="64dp"
android:ellipsize="end"
android:maxLines="3"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="English - SUBRIP, SDH - English - SUBRIP" />
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
tools:text="An angel falls. A warrior rises. When Alita awakens with no memory of who she is in a future world she does not recognize, she is taken in by Ido, a compassionate doctor who realizes that somewhere in this abandoned cyborg shell is the heart and soul of a young woman with an extraordinary past." />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/genres_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="12dp">
<TextView
android:id="@+id/genres_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/genres"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/genres"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="64dp"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="Action, Science Fiction, Adventure" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/director_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="12dp">
<TextView
android:id="@+id/director_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/director"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/director"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="64dp"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="Robert Rodriguez" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/writers_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="12dp">
<TextView
android:id="@+id/writers_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/writers"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/writers"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="64dp"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="James Cameron, Laeta Kalogridis, Yukito Kishiro" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
layout="@layout/item_info" />
<LinearLayout
android:id="@+id/next_up_layout"

View file

@ -0,0 +1,211 @@
<?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:tools="http://schemas.android.com/tools"
android:id="@+id/info"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginHorizontal="24dp"
android:layout_marginBottom="12dp">
<TextView
android:id="@+id/video_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/video"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
android:visibility="gone"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/video"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
android:visibility="gone"
app:layout_constraintBaseline_toBaselineOf="@id/video_title"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@id/titles_barrier"
tools:text="4K HEVC HDR" />
<TextView
android:id="@+id/audio_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/audio"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
android:visibility="gone"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/video"
tools:visibility="visible" />
<TextView
android:id="@+id/audio"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="3"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
android:visibility="gone"
app:layout_constraintBaseline_toBaselineOf="@id/audio_title"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@id/titles_barrier"
tools:text="AC-3 Eng 5.1, AC-3 iTA 5.1"
tools:visibility="visible" />
<TextView
android:id="@+id/subtitles_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/subtitle"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
android:visibility="gone"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/audio"
tools:visibility="visible" />
<TextView
android:id="@+id/subtitles"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="3"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
android:visibility="gone"
app:layout_constraintBaseline_toBaselineOf="@id/subtitles_title"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@id/titles_barrier"
tools:text="English - SUBRIP, SDH - English - SUBRIP"
tools:visibility="visible" />
<TextView
android:id="@+id/description"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/subtitles"
tools:text="An angel falls. A warrior rises. When Alita awakens with no memory of who she is in a future world she does not recognize, she is taken in by Ido, a compassionate doctor who realizes that somewhere in this abandoned cyborg shell is the heart and soul of a young woman with an extraordinary past." />
<TextView
android:id="@+id/genres_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="@string/genres"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/description" />
<TextView
android:id="@+id/genres"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
app:layout_constraintBaseline_toBaselineOf="@id/genres_title"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@id/titles_barrier"
tools:text="Action, Science Fiction, Adventure" />
<TextView
android:id="@+id/director_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/director"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/genres" />
<TextView
android:id="@+id/director"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
app:layout_constraintBaseline_toBaselineOf="@id/director_title"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@id/titles_barrier"
tools:text="Robert Rodriguez" />
<TextView
android:id="@+id/writers_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/writers"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/director" />
<TextView
android:id="@+id/writers"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.Material3.BodyMedium"
app:layout_constraintBaseline_toBaselineOf="@id/writers_title"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@id/titles_barrier"
tools:text="James Cameron, Laeta Kalogridis, Yukito Kishiro" />
<androidx.constraintlayout.widget.Barrier
android:id="@+id/titles_barrier"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="end"
app:barrierMargin="8dp"
app:constraint_referenced_ids="video_title,audio_title,subtitles_title,genres_title,director_title,writers_title" />
<androidx.constraintlayout.widget.Group
android:id="@+id/video_group"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
app:constraint_referenced_ids="video_title, video"
tools:visibility="visible" />
<androidx.constraintlayout.widget.Group
android:id="@+id/audio_group"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
app:constraint_referenced_ids="audio_title, audio"
tools:visibility="visible" />
<androidx.constraintlayout.widget.Group
android:id="@+id/subtitles_group"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
app:constraint_referenced_ids="subtitles_title, subtitles"
tools:visibility="visible" />
<androidx.constraintlayout.widget.Group
android:id="@+id/genres_group"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="visible"
app:constraint_referenced_ids="genres_title, genres" />
<androidx.constraintlayout.widget.Group
android:id="@+id/director_group"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
app:constraint_referenced_ids="director_title, director" />
<androidx.constraintlayout.widget.Group
android:id="@+id/writers_group"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="visible"
app:constraint_referenced_ids="writers_title, writers" />
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -4,7 +4,6 @@ import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import dagger.hilt.android.lifecycle.HiltViewModel
import dev.jdtech.jellyfin.models.FindroidEpisode
import dev.jdtech.jellyfin.models.FindroidMediaStream
import dev.jdtech.jellyfin.models.FindroidSeason
import dev.jdtech.jellyfin.models.FindroidShow
import dev.jdtech.jellyfin.repository.JellyfinRepository
@ -18,7 +17,6 @@ import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import org.jellyfin.sdk.model.api.BaseItemPerson
import org.jellyfin.sdk.model.api.MediaStreamType
@HiltViewModel
class ShowViewModel
@ -40,9 +38,6 @@ constructor(
val writers: List<BaseItemPerson>,
val writersString: String,
val genresString: String,
val videoString: String,
val audioString: String,
val subtitleString: String,
val runTime: String,
val dateString: String,
val nextUp: FindroidEpisode?,
@ -61,9 +56,6 @@ constructor(
private var writers: List<BaseItemPerson> = emptyList()
private var writersString: String = ""
private var genresString: String = ""
private var videoString: String = ""
private var audioString: String = ""
private var subtitleString: String = ""
private var runTime: String = ""
private var dateString: String = ""
var nextUp: FindroidEpisode? = null
@ -81,9 +73,6 @@ constructor(
writers = getWriters(item)
writersString = writers.joinToString(separator = ", ") { it.name.toString() }
genresString = item.genres.joinToString(separator = ", ")
videoString = getMediaString(item, MediaStreamType.VIDEO)
audioString = getMediaString(item, MediaStreamType.AUDIO)
subtitleString = getMediaString(item, MediaStreamType.SUBTITLE)
runTime = "${item.runtimeTicks.div(600000000)} min"
dateString = getDateString(item)
nextUp = getNextUp(itemId)
@ -96,9 +85,6 @@ constructor(
writers,
writersString,
genresString,
videoString,
audioString,
subtitleString,
runTime,
dateString,
nextUp,
@ -138,14 +124,6 @@ constructor(
return writers
}
private suspend fun getMediaString(item: FindroidShow, type: MediaStreamType): String {
val streams: List<FindroidMediaStream>
withContext(Dispatchers.Default) {
streams = item.sources.getOrNull(0)?.mediaStreams?.filter { it.type == type } ?: emptyList()
}
return streams.map { it.displayTitle }.joinToString(separator = ", ")
}
private suspend fun getNextUp(seriesId: UUID): FindroidEpisode? {
val nextUpItems = jellyfinRepository.getNextUp(seriesId)
return nextUpItems.getOrNull(0)

View file

@ -112,7 +112,7 @@ class JellyfinRepositoryOfflineImpl(
}
override suspend fun getSearchItems(searchQuery: String): List<FindroidItem> {
return withContext(Dispatchers.IO) {
return withContext(Dispatchers.IO) {
val movies = database.searchMovies(appPreferences.currentServer!!, searchQuery).map { it.toFindroidMovie(database, jellyfinApi.userId!!) }
val shows = database.searchShows(appPreferences.currentServer!!, searchQuery).map { it.toFindroidShow(database, jellyfinApi.userId!!) }
val episodes = database.searchEpisodes(appPreferences.currentServer!!, searchQuery).map { it.toFindroidEpisode(database, jellyfinApi.userId!!) }