diff --git a/app/phone/src/main/java/dev/jdtech/jellyfin/adapters/CollectionListAdapter.kt b/app/phone/src/main/java/dev/jdtech/jellyfin/adapters/CollectionListAdapter.kt index 871cf23241..2075e314df 100644 --- a/app/phone/src/main/java/dev/jdtech/jellyfin/adapters/CollectionListAdapter.kt +++ b/app/phone/src/main/java/dev/jdtech/jellyfin/adapters/CollectionListAdapter.kt @@ -10,7 +10,7 @@ import dev.jdtech.jellyfin.databinding.CollectionItemBinding import dev.jdtech.jellyfin.models.FindroidCollection class CollectionListAdapter( - private val onClickListener: OnClickListener, + private val onClickListener: (collection: FindroidCollection) -> Unit, ) : ListAdapter(DiffCallback) { class CollectionViewHolder(private var binding: CollectionItemBinding) : RecyclerView.ViewHolder(binding.root) { @@ -43,12 +43,8 @@ class CollectionListAdapter( override fun onBindViewHolder(holder: CollectionViewHolder, position: Int) { val collection = getItem(position) holder.itemView.setOnClickListener { - onClickListener.onClick(collection) + onClickListener(collection) } holder.bind(collection) } - - class OnClickListener(val clickListener: (collection: FindroidCollection) -> Unit) { - fun onClick(collection: FindroidCollection) = clickListener(collection) - } } diff --git a/app/phone/src/main/java/dev/jdtech/jellyfin/adapters/EpisodeListAdapter.kt b/app/phone/src/main/java/dev/jdtech/jellyfin/adapters/EpisodeListAdapter.kt index 923a47c6b3..4df73fbbce 100644 --- a/app/phone/src/main/java/dev/jdtech/jellyfin/adapters/EpisodeListAdapter.kt +++ b/app/phone/src/main/java/dev/jdtech/jellyfin/adapters/EpisodeListAdapter.kt @@ -22,7 +22,7 @@ private const val ITEM_VIEW_TYPE_HEADER = 0 private const val ITEM_VIEW_TYPE_EPISODE = 1 class EpisodeListAdapter( - private val onClickListener: OnClickListener, + private val onClickListener: (item: FindroidEpisode) -> Unit, ) : ListAdapter(DiffCallback) { @@ -109,7 +109,7 @@ class EpisodeListAdapter( ITEM_VIEW_TYPE_EPISODE -> { val item = getItem(position) as EpisodeItem.Episode holder.itemView.setOnClickListener { - onClickListener.onClick(item.episode) + onClickListener(item.episode) } (holder as EpisodeViewHolder).bind(item.episode) } @@ -122,8 +122,4 @@ class EpisodeListAdapter( is EpisodeItem.Episode -> ITEM_VIEW_TYPE_EPISODE } } - - class OnClickListener(val clickListener: (item: FindroidEpisode) -> Unit) { - fun onClick(item: FindroidEpisode) = clickListener(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 e58152d9aa..75a6757907 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 @@ -8,25 +8,24 @@ import androidx.recyclerview.widget.RecyclerView import dev.jdtech.jellyfin.Constants import dev.jdtech.jellyfin.databinding.FavoriteSectionBinding import dev.jdtech.jellyfin.models.FavoriteSection +import dev.jdtech.jellyfin.models.FindroidItem class FavoritesListAdapter( - private val onClickListener: ViewItemListAdapter.OnClickListener, - private val onEpisodeClickListener: HomeEpisodeListAdapter.OnClickListener, + private val onItemClickListener: (item: FindroidItem) -> Unit, ) : ListAdapter(DiffCallback) { class SectionViewHolder(private var binding: FavoriteSectionBinding) : RecyclerView.ViewHolder(binding.root) { fun bind( section: FavoriteSection, - onClickListener: ViewItemListAdapter.OnClickListener, - onEpisodeClickListener: HomeEpisodeListAdapter.OnClickListener, + onItemClickListener: (item: FindroidItem) -> Unit, ) { if (section.id == Constants.FAVORITE_TYPE_MOVIES || section.id == Constants.FAVORITE_TYPE_SHOWS) { binding.itemsRecyclerView.adapter = - ViewItemListAdapter(onClickListener, fixedWidth = true) + ViewItemListAdapter(onItemClickListener, fixedWidth = true) (binding.itemsRecyclerView.adapter as ViewItemListAdapter).submitList(section.items) } else if (section.id == Constants.FAVORITE_TYPE_EPISODES) { binding.itemsRecyclerView.adapter = - HomeEpisodeListAdapter(onEpisodeClickListener) + HomeEpisodeListAdapter(onItemClickListener) (binding.itemsRecyclerView.adapter as HomeEpisodeListAdapter).submitList(section.items) } binding.sectionName.text = section.name.asString(binding.root.resources) @@ -58,6 +57,6 @@ class FavoritesListAdapter( override fun onBindViewHolder(holder: SectionViewHolder, position: Int) { val collection = getItem(position) - holder.bind(collection, onClickListener, onEpisodeClickListener) + holder.bind(collection, onItemClickListener) } } diff --git a/app/phone/src/main/java/dev/jdtech/jellyfin/adapters/HomeEpisodeListAdapter.kt b/app/phone/src/main/java/dev/jdtech/jellyfin/adapters/HomeEpisodeListAdapter.kt index 1676637bfb..70cbe36511 100644 --- a/app/phone/src/main/java/dev/jdtech/jellyfin/adapters/HomeEpisodeListAdapter.kt +++ b/app/phone/src/main/java/dev/jdtech/jellyfin/adapters/HomeEpisodeListAdapter.kt @@ -16,7 +16,7 @@ import dev.jdtech.jellyfin.models.FindroidMovie import dev.jdtech.jellyfin.models.isDownloaded import dev.jdtech.jellyfin.core.R as CoreR -class HomeEpisodeListAdapter(private val onClickListener: OnClickListener) : ListAdapter(DiffCallback) { +class HomeEpisodeListAdapter(private val onClickListener: (item: FindroidItem) -> Unit) : ListAdapter(DiffCallback) { class EpisodeViewHolder( private var binding: HomeEpisodeItemBinding, private val parent: ViewGroup, @@ -77,12 +77,8 @@ class HomeEpisodeListAdapter(private val onClickListener: OnClickListener) : Lis override fun onBindViewHolder(holder: EpisodeViewHolder, position: Int) { val item = getItem(position) holder.itemView.setOnClickListener { - onClickListener.onClick(item) + onClickListener(item) } holder.bind(item) } - - class OnClickListener(val clickListener: (item: FindroidItem) -> Unit) { - fun onClick(item: FindroidItem) = clickListener(item) - } } diff --git a/app/phone/src/main/java/dev/jdtech/jellyfin/adapters/ServerGridAdapter.kt b/app/phone/src/main/java/dev/jdtech/jellyfin/adapters/ServerGridAdapter.kt index 00ab31f823..53f5c9af63 100644 --- a/app/phone/src/main/java/dev/jdtech/jellyfin/adapters/ServerGridAdapter.kt +++ b/app/phone/src/main/java/dev/jdtech/jellyfin/adapters/ServerGridAdapter.kt @@ -9,8 +9,8 @@ import dev.jdtech.jellyfin.databinding.ServerItemBinding import dev.jdtech.jellyfin.models.Server class ServerGridAdapter( - private val onClickListener: OnClickListener, - private val onLongClickListener: OnLongClickListener, + private val onClickListener: (server: Server) -> Unit, + private val onLongClickListener: (server: Server) -> Boolean, ) : ListAdapter(DiffCallback) { class ServerViewHolder(private var binding: ServerItemBinding) : RecyclerView.ViewHolder(binding.root) { @@ -39,19 +39,11 @@ class ServerGridAdapter( override fun onBindViewHolder(holder: ServerViewHolder, position: Int) { val server = getItem(position) holder.itemView.setOnClickListener { - onClickListener.onClick(server) + onClickListener(server) } holder.itemView.setOnLongClickListener { - onLongClickListener.onLongClick(server) + onLongClickListener(server) } holder.bind(server) } - - class OnClickListener(val clickListener: (server: Server) -> Unit) { - fun onClick(server: Server) = clickListener(server) - } - - class OnLongClickListener(val clickListener: (server: Server) -> Boolean) { - fun onLongClick(server: Server) = clickListener(server) - } } diff --git a/app/phone/src/main/java/dev/jdtech/jellyfin/adapters/ViewItemListAdapter.kt b/app/phone/src/main/java/dev/jdtech/jellyfin/adapters/ViewItemListAdapter.kt index 5ef80297d9..95970a4dc4 100644 --- a/app/phone/src/main/java/dev/jdtech/jellyfin/adapters/ViewItemListAdapter.kt +++ b/app/phone/src/main/java/dev/jdtech/jellyfin/adapters/ViewItemListAdapter.kt @@ -15,7 +15,7 @@ import dev.jdtech.jellyfin.models.isDownloaded import dev.jdtech.jellyfin.core.R as CoreR class ViewItemListAdapter( - private val onClickListener: OnClickListener, + private val onClickListener: (item: FindroidItem) -> Unit, private val fixedWidth: Boolean = false, ) : ListAdapter(DiffCallback) { @@ -63,12 +63,8 @@ class ViewItemListAdapter( override fun onBindViewHolder(holder: ItemViewHolder, position: Int) { val item = getItem(position) holder.itemView.setOnClickListener { - onClickListener.onClick(item) + onClickListener(item) } holder.bind(item, fixedWidth) } - - class OnClickListener(val clickListener: (item: FindroidItem) -> Unit) { - fun onClick(item: FindroidItem) = clickListener(item) - } } diff --git a/app/phone/src/main/java/dev/jdtech/jellyfin/adapters/ViewItemPagingAdapter.kt b/app/phone/src/main/java/dev/jdtech/jellyfin/adapters/ViewItemPagingAdapter.kt index 43c6224de0..3d566276b0 100644 --- a/app/phone/src/main/java/dev/jdtech/jellyfin/adapters/ViewItemPagingAdapter.kt +++ b/app/phone/src/main/java/dev/jdtech/jellyfin/adapters/ViewItemPagingAdapter.kt @@ -15,7 +15,7 @@ import dev.jdtech.jellyfin.models.isDownloaded import dev.jdtech.jellyfin.core.R as CoreR class ViewItemPagingAdapter( - private val onClickListener: OnClickListener, + private val onClickListener: (item: FindroidItem) -> Unit, private val fixedWidth: Boolean = false, ) : PagingDataAdapter(DiffCallback) { @@ -65,13 +65,9 @@ class ViewItemPagingAdapter( val item = getItem(position) if (item != null) { holder.itemView.setOnClickListener { - onClickListener.onClick(item) + onClickListener(item) } holder.bind(item, fixedWidth) } } - - class OnClickListener(val clickListener: (item: FindroidItem) -> Unit) { - fun onClick(item: FindroidItem) = clickListener(item) - } } 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 dde855121b..c85c716778 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 @@ -8,6 +8,7 @@ import androidx.recyclerview.widget.RecyclerView import dev.jdtech.jellyfin.databinding.CardOfflineBinding import dev.jdtech.jellyfin.databinding.NextUpSectionBinding import dev.jdtech.jellyfin.databinding.ViewItemBinding +import dev.jdtech.jellyfin.models.FindroidItem import dev.jdtech.jellyfin.models.HomeItem import dev.jdtech.jellyfin.models.View import dev.jdtech.jellyfin.core.R as CoreR @@ -17,18 +18,17 @@ private const val ITEM_VIEW_TYPE_VIEW = 1 private const val ITEM_VIEW_TYPE_OFFLINE_CARD = 2 class ViewListAdapter( - private val onClickListener: OnClickListener, - private val onItemClickListener: ViewItemListAdapter.OnClickListener, - private val onNextUpClickListener: HomeEpisodeListAdapter.OnClickListener, - private val onOnlineClickListener: OnClickListenerOfflineCard, + private val onClickListener: (view: View) -> Unit, + private val onItemClickListener: (item: FindroidItem) -> Unit, + private val onOnlineClickListener: () -> Unit, ) : ListAdapter(DiffCallback) { class ViewViewHolder(private var binding: ViewItemBinding) : RecyclerView.ViewHolder(binding.root) { fun bind( dataItem: HomeItem.ViewItem, - onClickListener: OnClickListener, - onItemClickListener: ViewItemListAdapter.OnClickListener, + onClickListener: (view: View) -> Unit, + onItemClickListener: (item: FindroidItem) -> Unit, ) { val view = dataItem.view binding.viewName.text = binding.viewName.context.resources.getString(CoreR.string.latest_library, view.name) @@ -36,14 +36,17 @@ class ViewListAdapter( ViewItemListAdapter(onItemClickListener, fixedWidth = true) (binding.itemsRecyclerView.adapter as ViewItemListAdapter).submitList(view.items) binding.viewAll.setOnClickListener { - onClickListener.onClick(view) + onClickListener(view) } } } class NextUpViewHolder(private var binding: NextUpSectionBinding) : RecyclerView.ViewHolder(binding.root) { - fun bind(section: HomeItem.Section, onClickListener: HomeEpisodeListAdapter.OnClickListener) { + fun bind( + section: HomeItem.Section, + onClickListener: (item: FindroidItem) -> Unit, + ) { binding.sectionName.text = section.homeSection.name.asString(binding.sectionName.context.resources) binding.itemsRecyclerView.adapter = HomeEpisodeListAdapter(onClickListener) (binding.itemsRecyclerView.adapter as HomeEpisodeListAdapter).submitList(section.homeSection.items) @@ -51,9 +54,9 @@ class ViewListAdapter( } class OfflineCardViewHolder(private var binding: CardOfflineBinding) : RecyclerView.ViewHolder(binding.root) { - fun bind(onClickListener: OnClickListenerOfflineCard) { + fun bind(onClickListener: () -> Unit) { binding.onlineButton.setOnClickListener { - onClickListener.onClick() + onClickListener() } } } @@ -103,7 +106,7 @@ class ViewListAdapter( when (holder.itemViewType) { ITEM_VIEW_TYPE_NEXT_UP -> { val view = getItem(position) as HomeItem.Section - (holder as NextUpViewHolder).bind(view, onNextUpClickListener) + (holder as NextUpViewHolder).bind(view, onItemClickListener) } ITEM_VIEW_TYPE_VIEW -> { val view = getItem(position) as HomeItem.ViewItem @@ -123,12 +126,4 @@ class ViewListAdapter( is HomeItem.ViewItem -> ITEM_VIEW_TYPE_VIEW } } - - class OnClickListener(val clickListener: (view: View) -> Unit) { - fun onClick(view: View) = clickListener(view) - } - - class OnClickListenerOfflineCard(val clickListener: () -> Unit) { - fun onClick() = clickListener() - } } diff --git a/app/phone/src/main/java/dev/jdtech/jellyfin/fragments/CollectionFragment.kt b/app/phone/src/main/java/dev/jdtech/jellyfin/fragments/CollectionFragment.kt index 0b5bd6c40c..69b57fedac 100644 --- a/app/phone/src/main/java/dev/jdtech/jellyfin/fragments/CollectionFragment.kt +++ b/app/phone/src/main/java/dev/jdtech/jellyfin/fragments/CollectionFragment.kt @@ -14,8 +14,6 @@ import androidx.navigation.fragment.findNavController import androidx.navigation.fragment.navArgs import dagger.hilt.android.AndroidEntryPoint import dev.jdtech.jellyfin.adapters.FavoritesListAdapter -import dev.jdtech.jellyfin.adapters.HomeEpisodeListAdapter -import dev.jdtech.jellyfin.adapters.ViewItemListAdapter import dev.jdtech.jellyfin.databinding.FragmentFavoriteBinding import dev.jdtech.jellyfin.dialogs.ErrorDialogFragment import dev.jdtech.jellyfin.models.FindroidEpisode @@ -42,14 +40,9 @@ class CollectionFragment : Fragment() { ): View { binding = FragmentFavoriteBinding.inflate(inflater, container, false) - binding.favoritesRecyclerView.adapter = FavoritesListAdapter( - ViewItemListAdapter.OnClickListener { item -> - navigateToMediaItem(item) - }, - HomeEpisodeListAdapter.OnClickListener { item -> - navigateToMediaItem(item) - }, - ) + binding.favoritesRecyclerView.adapter = FavoritesListAdapter { item -> + navigateToMediaItem(item) + } viewLifecycleOwner.lifecycleScope.launch { viewLifecycleOwner.repeatOnLifecycle(Lifecycle.State.STARTED) { diff --git a/app/phone/src/main/java/dev/jdtech/jellyfin/fragments/DownloadsFragment.kt b/app/phone/src/main/java/dev/jdtech/jellyfin/fragments/DownloadsFragment.kt index 1e37baf67e..9887717dfe 100644 --- a/app/phone/src/main/java/dev/jdtech/jellyfin/fragments/DownloadsFragment.kt +++ b/app/phone/src/main/java/dev/jdtech/jellyfin/fragments/DownloadsFragment.kt @@ -15,8 +15,6 @@ import com.google.android.material.snackbar.Snackbar import dagger.hilt.android.AndroidEntryPoint import dev.jdtech.jellyfin.AppPreferences import dev.jdtech.jellyfin.adapters.FavoritesListAdapter -import dev.jdtech.jellyfin.adapters.HomeEpisodeListAdapter -import dev.jdtech.jellyfin.adapters.ViewItemListAdapter import dev.jdtech.jellyfin.databinding.FragmentDownloadsBinding import dev.jdtech.jellyfin.models.FindroidItem import dev.jdtech.jellyfin.models.FindroidMovie @@ -43,14 +41,9 @@ class DownloadsFragment : Fragment() { ): View { binding = FragmentDownloadsBinding.inflate(inflater, container, false) - binding.downloadsRecyclerView.adapter = FavoritesListAdapter( - ViewItemListAdapter.OnClickListener { item -> - navigateToMediaItem(item) - }, - HomeEpisodeListAdapter.OnClickListener { item -> - navigateToMediaItem(item) - }, - ) + binding.downloadsRecyclerView.adapter = FavoritesListAdapter { item -> + navigateToMediaItem(item) + } viewLifecycleOwner.lifecycleScope.launch { viewLifecycleOwner.repeatOnLifecycle(Lifecycle.State.STARTED) { diff --git a/app/phone/src/main/java/dev/jdtech/jellyfin/fragments/FavoriteFragment.kt b/app/phone/src/main/java/dev/jdtech/jellyfin/fragments/FavoriteFragment.kt index 814c7a6b95..d8512c36e1 100644 --- a/app/phone/src/main/java/dev/jdtech/jellyfin/fragments/FavoriteFragment.kt +++ b/app/phone/src/main/java/dev/jdtech/jellyfin/fragments/FavoriteFragment.kt @@ -13,8 +13,6 @@ import androidx.lifecycle.repeatOnLifecycle import androidx.navigation.fragment.findNavController import dagger.hilt.android.AndroidEntryPoint import dev.jdtech.jellyfin.adapters.FavoritesListAdapter -import dev.jdtech.jellyfin.adapters.HomeEpisodeListAdapter -import dev.jdtech.jellyfin.adapters.ViewItemListAdapter import dev.jdtech.jellyfin.databinding.FragmentFavoriteBinding import dev.jdtech.jellyfin.dialogs.ErrorDialogFragment import dev.jdtech.jellyfin.models.FindroidEpisode @@ -41,14 +39,9 @@ class FavoriteFragment : Fragment() { ): View { binding = FragmentFavoriteBinding.inflate(inflater, container, false) - binding.favoritesRecyclerView.adapter = FavoritesListAdapter( - ViewItemListAdapter.OnClickListener { item -> - navigateToMediaItem(item) - }, - HomeEpisodeListAdapter.OnClickListener { item -> - navigateToMediaItem(item) - }, - ) + binding.favoritesRecyclerView.adapter = FavoritesListAdapter { item -> + navigateToMediaItem(item) + } viewLifecycleOwner.lifecycleScope.launch { viewLifecycleOwner.repeatOnLifecycle(Lifecycle.State.STARTED) { diff --git a/app/phone/src/main/java/dev/jdtech/jellyfin/fragments/HomeFragment.kt b/app/phone/src/main/java/dev/jdtech/jellyfin/fragments/HomeFragment.kt index 103b2a4464..471f74094d 100644 --- a/app/phone/src/main/java/dev/jdtech/jellyfin/fragments/HomeFragment.kt +++ b/app/phone/src/main/java/dev/jdtech/jellyfin/fragments/HomeFragment.kt @@ -20,8 +20,6 @@ import androidx.lifecycle.repeatOnLifecycle import androidx.navigation.fragment.findNavController import dagger.hilt.android.AndroidEntryPoint import dev.jdtech.jellyfin.AppPreferences -import dev.jdtech.jellyfin.adapters.HomeEpisodeListAdapter -import dev.jdtech.jellyfin.adapters.ViewItemListAdapter import dev.jdtech.jellyfin.adapters.ViewListAdapter import dev.jdtech.jellyfin.databinding.FragmentHomeBinding import dev.jdtech.jellyfin.dialogs.ErrorDialogFragment @@ -146,14 +144,11 @@ class HomeFragment : Fragment() { } binding.viewsRecyclerView.adapter = ViewListAdapter( - onClickListener = ViewListAdapter.OnClickListener { navigateToLibraryFragment(it) }, - onItemClickListener = ViewItemListAdapter.OnClickListener { + onClickListener = { navigateToLibraryFragment(it) }, + onItemClickListener = { navigateToMediaItem(it) }, - onNextUpClickListener = HomeEpisodeListAdapter.OnClickListener { item -> - navigateToMediaItem(item) - }, - onOnlineClickListener = ViewListAdapter.OnClickListenerOfflineCard { + onOnlineClickListener = { appPreferences.offlineMode = false activity?.restart() }, diff --git a/app/phone/src/main/java/dev/jdtech/jellyfin/fragments/LibraryFragment.kt b/app/phone/src/main/java/dev/jdtech/jellyfin/fragments/LibraryFragment.kt index e3a45ffb96..c5a3c2577b 100644 --- a/app/phone/src/main/java/dev/jdtech/jellyfin/fragments/LibraryFragment.kt +++ b/app/phone/src/main/java/dev/jdtech/jellyfin/fragments/LibraryFragment.kt @@ -115,7 +115,7 @@ class LibraryFragment : Fragment() { binding.itemsRecyclerView.adapter = ViewItemPagingAdapter( - ViewItemPagingAdapter.OnClickListener { item -> + { item -> navigateToItem(item) }, ) diff --git a/app/phone/src/main/java/dev/jdtech/jellyfin/fragments/MediaFragment.kt b/app/phone/src/main/java/dev/jdtech/jellyfin/fragments/MediaFragment.kt index 2cda75fe39..3586d90f3e 100644 --- a/app/phone/src/main/java/dev/jdtech/jellyfin/fragments/MediaFragment.kt +++ b/app/phone/src/main/java/dev/jdtech/jellyfin/fragments/MediaFragment.kt @@ -47,11 +47,9 @@ class MediaFragment : Fragment() { binding = FragmentMediaBinding.inflate(inflater, container, false) binding.viewsRecyclerView.adapter = - CollectionListAdapter( - CollectionListAdapter.OnClickListener { library -> - navigateToLibraryFragment(library) - }, - ) + CollectionListAdapter { library -> + navigateToLibraryFragment(library) + } viewLifecycleOwner.lifecycleScope.launch { viewLifecycleOwner.repeatOnLifecycle(Lifecycle.State.STARTED) { diff --git a/app/phone/src/main/java/dev/jdtech/jellyfin/fragments/PersonDetailFragment.kt b/app/phone/src/main/java/dev/jdtech/jellyfin/fragments/PersonDetailFragment.kt index a7fdf4e6bb..222da60f24 100644 --- a/app/phone/src/main/java/dev/jdtech/jellyfin/fragments/PersonDetailFragment.kt +++ b/app/phone/src/main/java/dev/jdtech/jellyfin/fragments/PersonDetailFragment.kt @@ -120,7 +120,7 @@ internal class PersonDetailFragment : Fragment() { private fun adapter() = ViewItemListAdapter( fixedWidth = true, - onClickListener = ViewItemListAdapter.OnClickListener { navigateToMediaItem(it) }, + onClickListener = { navigateToMediaItem(it) }, ) private fun setupOverviewExpansion() = binding.overview.post { diff --git a/app/phone/src/main/java/dev/jdtech/jellyfin/fragments/SearchResultFragment.kt b/app/phone/src/main/java/dev/jdtech/jellyfin/fragments/SearchResultFragment.kt index 5303d25e10..4e385a0a85 100644 --- a/app/phone/src/main/java/dev/jdtech/jellyfin/fragments/SearchResultFragment.kt +++ b/app/phone/src/main/java/dev/jdtech/jellyfin/fragments/SearchResultFragment.kt @@ -14,8 +14,6 @@ import androidx.navigation.fragment.findNavController import androidx.navigation.fragment.navArgs import dagger.hilt.android.AndroidEntryPoint import dev.jdtech.jellyfin.adapters.FavoritesListAdapter -import dev.jdtech.jellyfin.adapters.HomeEpisodeListAdapter -import dev.jdtech.jellyfin.adapters.ViewItemListAdapter import dev.jdtech.jellyfin.databinding.FragmentSearchResultBinding import dev.jdtech.jellyfin.dialogs.ErrorDialogFragment import dev.jdtech.jellyfin.models.FindroidEpisode @@ -43,14 +41,9 @@ class SearchResultFragment : Fragment() { ): View { binding = FragmentSearchResultBinding.inflate(inflater, container, false) - binding.searchResultsRecyclerView.adapter = FavoritesListAdapter( - ViewItemListAdapter.OnClickListener { item -> - navigateToMediaItem(item) - }, - HomeEpisodeListAdapter.OnClickListener { item -> - navigateToMediaItem(item) - }, - ) + binding.searchResultsRecyclerView.adapter = FavoritesListAdapter { item -> + navigateToMediaItem(item) + } viewLifecycleOwner.lifecycleScope.launch { viewLifecycleOwner.repeatOnLifecycle(Lifecycle.State.STARTED) { diff --git a/app/phone/src/main/java/dev/jdtech/jellyfin/fragments/SeasonFragment.kt b/app/phone/src/main/java/dev/jdtech/jellyfin/fragments/SeasonFragment.kt index fcc7e973e2..5ab629e8e0 100644 --- a/app/phone/src/main/java/dev/jdtech/jellyfin/fragments/SeasonFragment.kt +++ b/app/phone/src/main/java/dev/jdtech/jellyfin/fragments/SeasonFragment.kt @@ -85,11 +85,9 @@ class SeasonFragment : Fragment() { } binding.episodesRecyclerView.adapter = - EpisodeListAdapter( - EpisodeListAdapter.OnClickListener { episode -> - navigateToEpisodeBottomSheetFragment(episode) - }, - ) + EpisodeListAdapter { episode -> + navigateToEpisodeBottomSheetFragment(episode) + } } override fun onResume() { diff --git a/app/phone/src/main/java/dev/jdtech/jellyfin/fragments/ServerSelectFragment.kt b/app/phone/src/main/java/dev/jdtech/jellyfin/fragments/ServerSelectFragment.kt index ae50710a0c..a78311e678 100644 --- a/app/phone/src/main/java/dev/jdtech/jellyfin/fragments/ServerSelectFragment.kt +++ b/app/phone/src/main/java/dev/jdtech/jellyfin/fragments/ServerSelectFragment.kt @@ -33,10 +33,10 @@ class ServerSelectFragment : Fragment() { binding.serversRecyclerView.adapter = ServerGridAdapter( - ServerGridAdapter.OnClickListener { server -> + onClickListener = { server -> viewModel.connectToServer(server) }, - ServerGridAdapter.OnLongClickListener { server -> + onLongClickListener = { server -> DeleteServerDialogFragment(viewModel, server).show( parentFragmentManager, "deleteServer", diff --git a/app/phone/src/main/java/dev/jdtech/jellyfin/fragments/ShowFragment.kt b/app/phone/src/main/java/dev/jdtech/jellyfin/fragments/ShowFragment.kt index f544aa13bf..2be8b0baeb 100644 --- a/app/phone/src/main/java/dev/jdtech/jellyfin/fragments/ShowFragment.kt +++ b/app/phone/src/main/java/dev/jdtech/jellyfin/fragments/ShowFragment.kt @@ -120,7 +120,7 @@ class ShowFragment : Fragment() { binding.seasonsRecyclerView.adapter = ViewItemListAdapter( - ViewItemListAdapter.OnClickListener { season -> + { season -> if (season is FindroidSeason) navigateToSeasonFragment(season) }, fixedWidth = true,