diff --git a/app/phone/src/main/java/dev/jdtech/jellyfin/BindingAdapters.kt b/app/phone/src/main/java/dev/jdtech/jellyfin/BindingAdapters.kt index b47711db..70654131 100644 --- a/app/phone/src/main/java/dev/jdtech/jellyfin/BindingAdapters.kt +++ b/app/phone/src/main/java/dev/jdtech/jellyfin/BindingAdapters.kt @@ -4,10 +4,7 @@ import android.view.View import android.widget.ImageView import androidx.annotation.DrawableRes import androidx.databinding.BindingAdapter -import androidx.recyclerview.widget.RecyclerView import coil.load -import dev.jdtech.jellyfin.adapters.HomeEpisodeListAdapter -import dev.jdtech.jellyfin.adapters.ViewItemListAdapter import dev.jdtech.jellyfin.api.JellyfinApi import dev.jdtech.jellyfin.models.FindroidEpisode import dev.jdtech.jellyfin.models.FindroidItem @@ -20,12 +17,6 @@ import org.jellyfin.sdk.model.api.ImageType import java.util.UUID import dev.jdtech.jellyfin.core.R as CoreR -@BindingAdapter("items") -fun bindItems(recyclerView: RecyclerView, data: List?) { - val adapter = recyclerView.adapter as ViewItemListAdapter - adapter.submitList(data) -} - @BindingAdapter("itemImage") fun bindItemImage(imageView: ImageView, item: BaseItemDto) { val itemId = @@ -69,12 +60,6 @@ fun bindPersonImage(imageView: ImageView, person: BaseItemPerson) { .posterDescription(person.name) } -@BindingAdapter("homeEpisodes") -fun bindHomeEpisodes(recyclerView: RecyclerView, data: List?) { - val adapter = recyclerView.adapter as HomeEpisodeListAdapter - adapter.submitList(data) -} - @BindingAdapter("cardItemImage") fun bindCardItemImage(imageView: ImageView, item: FindroidItem) { val imageType = when (item) { diff --git a/app/phone/src/main/java/dev/jdtech/jellyfin/adapters/FavoritesListAdapter.kt b/app/phone/src/main/java/dev/jdtech/jellyfin/adapters/FavoritesListAdapter.kt index ff85370b..e58152d9 100644 --- a/app/phone/src/main/java/dev/jdtech/jellyfin/adapters/FavoritesListAdapter.kt +++ b/app/phone/src/main/java/dev/jdtech/jellyfin/adapters/FavoritesListAdapter.kt @@ -20,7 +20,6 @@ class FavoritesListAdapter( onClickListener: ViewItemListAdapter.OnClickListener, onEpisodeClickListener: HomeEpisodeListAdapter.OnClickListener, ) { - binding.section = section if (section.id == Constants.FAVORITE_TYPE_MOVIES || section.id == Constants.FAVORITE_TYPE_SHOWS) { binding.itemsRecyclerView.adapter = ViewItemListAdapter(onClickListener, fixedWidth = true) @@ -31,7 +30,6 @@ class FavoritesListAdapter( (binding.itemsRecyclerView.adapter as HomeEpisodeListAdapter).submitList(section.items) } binding.sectionName.text = section.name.asString(binding.root.resources) - binding.executePendingBindings() } } diff --git a/app/phone/src/main/java/dev/jdtech/jellyfin/adapters/ViewListAdapter.kt b/app/phone/src/main/java/dev/jdtech/jellyfin/adapters/ViewListAdapter.kt index 6e2021d4..dde85512 100644 --- a/app/phone/src/main/java/dev/jdtech/jellyfin/adapters/ViewListAdapter.kt +++ b/app/phone/src/main/java/dev/jdtech/jellyfin/adapters/ViewListAdapter.kt @@ -31,24 +31,22 @@ class ViewListAdapter( onItemClickListener: ViewItemListAdapter.OnClickListener, ) { val view = dataItem.view - binding.view = view binding.viewName.text = binding.viewName.context.resources.getString(CoreR.string.latest_library, view.name) binding.itemsRecyclerView.adapter = ViewItemListAdapter(onItemClickListener, fixedWidth = true) + (binding.itemsRecyclerView.adapter as ViewItemListAdapter).submitList(view.items) binding.viewAll.setOnClickListener { onClickListener.onClick(view) } - binding.executePendingBindings() } } class NextUpViewHolder(private var binding: NextUpSectionBinding) : RecyclerView.ViewHolder(binding.root) { fun bind(section: HomeItem.Section, onClickListener: HomeEpisodeListAdapter.OnClickListener) { - binding.section = section.homeSection binding.sectionName.text = section.homeSection.name.asString(binding.sectionName.context.resources) binding.itemsRecyclerView.adapter = HomeEpisodeListAdapter(onClickListener) - binding.executePendingBindings() + (binding.itemsRecyclerView.adapter as HomeEpisodeListAdapter).submitList(section.homeSection.items) } } diff --git a/app/phone/src/main/res/layout/favorite_section.xml b/app/phone/src/main/res/layout/favorite_section.xml index 9fab4b6a..d6b85384 100644 --- a/app/phone/src/main/res/layout/favorite_section.xml +++ b/app/phone/src/main/res/layout/favorite_section.xml @@ -1,39 +1,29 @@ - + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="12dp" + android:orientation="vertical"> - + - - - - - - - - - - \ No newline at end of file + android:clipToPadding="false" + android:orientation="horizontal" + android:paddingHorizontal="12dp" + app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" + tools:listitem="@layout/home_episode_item" /> + \ No newline at end of file diff --git a/app/phone/src/main/res/layout/next_up_section.xml b/app/phone/src/main/res/layout/next_up_section.xml index b8e4d2ce..327460a5 100644 --- a/app/phone/src/main/res/layout/next_up_section.xml +++ b/app/phone/src/main/res/layout/next_up_section.xml @@ -1,40 +1,29 @@ - + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="12dp" + android:orientation="vertical"> - + - - - - - - - - - - \ No newline at end of file + android:clipToPadding="false" + android:orientation="horizontal" + android:paddingHorizontal="12dp" + app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" + tools:listitem="@layout/home_episode_item" /> + \ No newline at end of file diff --git a/app/phone/src/main/res/layout/view_item.xml b/app/phone/src/main/res/layout/view_item.xml index 6cd442e5..06caa5d6 100644 --- a/app/phone/src/main/res/layout/view_item.xml +++ b/app/phone/src/main/res/layout/view_item.xml @@ -1,58 +1,46 @@ - + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="12dp"> - - - - - - + android:layout_marginStart="24dp" + android:ellipsize="end" + android:maxLines="1" + android:textAppearance="@style/TextAppearance.Material3.TitleMedium" + android:textSize="18sp" + app:layout_constraintBaseline_toBaselineOf="@id/view_all" + app:layout_constraintEnd_toStartOf="@id/view_all" + app:layout_constraintStart_toStartOf="parent" + tools:text="Movies" /> - +