Improve Home Continue Watching section
This commit is contained in:
parent
beb753129f
commit
27a515f27f
3 changed files with 39 additions and 9 deletions
|
@ -1,6 +1,8 @@
|
|||
package dev.jdtech.jellyfin.adapters
|
||||
|
||||
import android.util.TypedValue
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.DiffUtil
|
||||
import androidx.recyclerview.widget.ListAdapter
|
||||
|
@ -13,6 +15,19 @@ class HomeEpisodeListAdapter : ListAdapter<BaseItemDto, HomeEpisodeListAdapter.E
|
|||
RecyclerView.ViewHolder(binding.root) {
|
||||
fun bind(episode: BaseItemDto) {
|
||||
binding.episode = episode
|
||||
if (episode.userData?.playedPercentage != null) {
|
||||
binding.progressBar.layoutParams.width = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
|
||||
(episode.userData?.playedPercentage?.times(2.24))!!.toFloat(), binding.progressBar.context.resources.displayMetrics).toInt()
|
||||
binding.progressBar.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
if (episode.type == "Movie") {
|
||||
binding.primaryName.text = episode.name
|
||||
binding.secondaryName.visibility = View.GONE
|
||||
} else if (episode.type == "Episode") {
|
||||
binding.primaryName.text = episode.seriesName
|
||||
}
|
||||
|
||||
binding.executePendingBindings()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -306,7 +306,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="24dp"
|
||||
android:text="@{String.format(@string/episode_name_extended, viewModel.nextUp.parentIndexNumber, viewModel.nextUp.indexNumber, viewModel.nextUp.name)}"
|
||||
android:textAppearance="@style/TextAppearance.MaterialComponents.Body1"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
|
||||
tools:text="The Girl Flautist" />
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -20,35 +20,50 @@
|
|||
android:id="@+id/episode_image"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintDimensionRatio="H,16:9"
|
||||
android:scaleType="centerCrop"
|
||||
app:episodeImage="@{episode}"
|
||||
app:layout_constraintDimensionRatio="H,16:9"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:shapeAppearanceOverlay="@style/roundedImageView" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/series_name"
|
||||
android:id="@+id/primary_name"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@{episode.seriesName}"
|
||||
android:textAppearance="@style/TextAppearance.MaterialComponents.Body1"
|
||||
android:singleLine="true"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/episode_image"
|
||||
tools:text="Wonder Egg Priority" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/secondary_name"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:text="@{String.format(@string/episode_name_extended, episode.parentIndexNumber, episode.indexNumber, episode.name)}"
|
||||
android:textAppearance="@style/TextAppearance.MaterialComponents.Caption"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/series_name"
|
||||
app:layout_constraintTop_toBottomOf="@id/primary_name"
|
||||
tools:text="The Girl Flautist" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/progress_bar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="4dp"
|
||||
android:layout_marginHorizontal="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:background="@drawable/button_setup_background"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="@id/episode_image"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
tools:layout_width="50dp"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</layout>
|
Loading…
Reference in a new issue