Add more progress bars and check marks + general layout improvements
This commit is contained in:
parent
cb005e1cf6
commit
16bc87969d
6 changed files with 65 additions and 2 deletions
|
@ -1,6 +1,8 @@
|
||||||
package dev.jdtech.jellyfin.adapters
|
package dev.jdtech.jellyfin.adapters
|
||||||
|
|
||||||
|
import android.util.TypedValue
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.recyclerview.widget.DiffUtil
|
import androidx.recyclerview.widget.DiffUtil
|
||||||
import androidx.recyclerview.widget.ListAdapter
|
import androidx.recyclerview.widget.ListAdapter
|
||||||
|
@ -15,6 +17,14 @@ class EpisodeListAdapter(private val onClickListener: OnClickListener) :
|
||||||
RecyclerView.ViewHolder(binding.root) {
|
RecyclerView.ViewHolder(binding.root) {
|
||||||
fun bind(episode: BaseItemDto) {
|
fun bind(episode: BaseItemDto) {
|
||||||
binding.episode = episode
|
binding.episode = episode
|
||||||
|
if (episode.userData?.playedPercentage != null) {
|
||||||
|
binding.progressBar.layoutParams.width = TypedValue.applyDimension(
|
||||||
|
TypedValue.COMPLEX_UNIT_DIP,
|
||||||
|
(episode.userData?.playedPercentage?.times(.84))!!.toFloat(), binding.progressBar.context.resources.displayMetrics).toInt()
|
||||||
|
binding.progressBar.visibility = View.VISIBLE
|
||||||
|
} else {
|
||||||
|
binding.progressBar.visibility = View.GONE
|
||||||
|
}
|
||||||
binding.executePendingBindings()
|
binding.executePendingBindings()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package dev.jdtech.jellyfin.fragments
|
package dev.jdtech.jellyfin.fragments
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.util.TypedValue
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
|
@ -33,6 +34,16 @@ class EpisodeBottomSheetFragment : BottomSheetDialogFragment() {
|
||||||
binding.lifecycleOwner = this
|
binding.lifecycleOwner = this
|
||||||
binding.viewModel = viewModel
|
binding.viewModel = viewModel
|
||||||
|
|
||||||
|
viewModel.item.observe(viewLifecycleOwner, { episode ->
|
||||||
|
if (episode.userData?.playedPercentage != null) {
|
||||||
|
binding.progressBar.layoutParams.width = TypedValue.applyDimension(
|
||||||
|
TypedValue.COMPLEX_UNIT_DIP,
|
||||||
|
(episode.userData?.playedPercentage?.times(1.26))!!.toFloat(), context?.resources?.displayMetrics
|
||||||
|
).toInt()
|
||||||
|
binding.progressBar.visibility = View.VISIBLE
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
return binding.root
|
return binding.root
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -5,6 +5,8 @@
|
||||||
|
|
||||||
<data>
|
<data>
|
||||||
|
|
||||||
|
<import type="android.view.View" />
|
||||||
|
|
||||||
<variable
|
<variable
|
||||||
name="item"
|
name="item"
|
||||||
type="org.jellyfin.sdk.model.api.BaseItemDto" />
|
type="org.jellyfin.sdk.model.api.BaseItemDto" />
|
||||||
|
@ -57,5 +59,19 @@
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
tools:text="9" />
|
tools:text="9" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/played_icon"
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="24dp"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:layout_marginEnd="8dp"
|
||||||
|
android:background="@drawable/circle_background"
|
||||||
|
android:contentDescription="@string/episode_watched_indicator"
|
||||||
|
android:padding="4dp"
|
||||||
|
android:src="@drawable/ic_check"
|
||||||
|
android:visibility="@{item.userData.played == true ? View.VISIBLE : View.GONE}"
|
||||||
|
app:layout_constraintEnd_toEndOf="@id/item_image"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/item_image" />
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
</layout>
|
</layout>
|
|
@ -28,6 +28,19 @@
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:shapeAppearance="@style/roundedImageView" />
|
app:shapeAppearance="@style/roundedImageView" />
|
||||||
|
|
||||||
|
<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="@id/episode_image"
|
||||||
|
tools:layout_width="50dp"
|
||||||
|
tools:visibility="visible" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/episode_name"
|
android:id="@+id/episode_name"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
|
|
@ -43,6 +43,19 @@
|
||||||
app:layout_constraintEnd_toEndOf="@id/episode_image"
|
app:layout_constraintEnd_toEndOf="@id/episode_image"
|
||||||
app:layout_constraintTop_toTopOf="@id/episode_image" />
|
app:layout_constraintTop_toTopOf="@id/episode_image" />
|
||||||
|
|
||||||
|
<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="@id/episode_image"
|
||||||
|
tools:layout_width="50dp"
|
||||||
|
tools:visibility="visible" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/episode_title"
|
android:id="@+id/episode_title"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
|
|
@ -21,16 +21,16 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="24dp"
|
android:layout_marginStart="24dp"
|
||||||
|
android:layout_marginBottom="12dp"
|
||||||
|
android:text="@{section.name}"
|
||||||
android:textAppearance="@style/TextAppearance.MaterialComponents.Subtitle1"
|
android:textAppearance="@style/TextAppearance.MaterialComponents.Subtitle1"
|
||||||
android:textSize="18sp"
|
android:textSize="18sp"
|
||||||
android:text="@{section.name}"
|
|
||||||
tools:text="Next Up" />
|
tools:text="Next Up" />
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/items_recycler_view"
|
android:id="@+id/items_recycler_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="16dp"
|
|
||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
android:layoutAnimation="@anim/overview_media_animation"
|
android:layoutAnimation="@anim/overview_media_animation"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
|
|
Loading…
Reference in a new issue