diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 7a393c98f..864064189 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -29,8 +29,8 @@ android { applicationId = "com.github.andreyasadchy.xtra" minSdk = 21 targetSdk = 35 - versionCode = 270 - versionName = "2.40.3" + versionCode = 271 + versionName = "2.40.4" } buildTypes { diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/ui/videos/followed/FollowedVideosFragment.kt b/app/src/main/java/com/github/andreyasadchy/xtra/ui/videos/followed/FollowedVideosFragment.kt index f70712d5b..ccfed18dd 100644 --- a/app/src/main/java/com/github/andreyasadchy/xtra/ui/videos/followed/FollowedVideosFragment.kt +++ b/app/src/main/java/com/github/andreyasadchy/xtra/ui/videos/followed/FollowedVideosFragment.kt @@ -9,7 +9,6 @@ import androidx.fragment.app.viewModels import androidx.lifecycle.Lifecycle import androidx.lifecycle.lifecycleScope import androidx.lifecycle.repeatOnLifecycle -import androidx.navigation.fragment.navArgs import androidx.paging.PagingData import androidx.paging.PagingDataAdapter import androidx.recyclerview.widget.RecyclerView @@ -21,7 +20,6 @@ import com.github.andreyasadchy.xtra.model.ui.Video import com.github.andreyasadchy.xtra.ui.common.FragmentHost import com.github.andreyasadchy.xtra.ui.common.Scrollable import com.github.andreyasadchy.xtra.ui.common.Sortable -import com.github.andreyasadchy.xtra.ui.games.GamePagerFragmentArgs import com.github.andreyasadchy.xtra.ui.videos.BaseVideosAdapter import com.github.andreyasadchy.xtra.ui.videos.BaseVideosFragment import com.github.andreyasadchy.xtra.ui.videos.VideosAdapter @@ -41,7 +39,6 @@ class FollowedVideosFragment : BaseVideosFragment(), Scrollable, Sortable, Video private var _binding: CommonRecyclerViewLayoutBinding? = null private val binding get() = _binding!! - private val args: GamePagerFragmentArgs by navArgs() private val viewModel: FollowedVideosViewModel by viewModels() private lateinit var pagingAdapter: PagingDataAdapter @@ -65,7 +62,7 @@ class FollowedVideosFragment : BaseVideosFragment(), Scrollable, Sortable, Video override fun initialize() { viewLifecycleOwner.lifecycleScope.launch { if (viewModel.filter.value == null) { - val sortValues = args.channelId?.let { viewModel.getSortChannel(it)?.takeIf { it.saveSort == true } } ?: viewModel.getSortChannel("followed_videos") + val sortValues = viewModel.getSortChannel("followed_videos") viewModel.setFilter( sort = sortValues?.videoSort, type = sortValues?.videoType, @@ -96,6 +93,7 @@ class FollowedVideosFragment : BaseVideosFragment(), Scrollable, Sortable, Video sortBar.root.setOnClickListener { VideosSortDialog.newInstance( sort = viewModel.sort, + period = viewModel.period, type = viewModel.type, saveDefault = requireContext().prefs().getBoolean(C.SORT_DEFAULT_FOLLOWED_VIDEOS, false) ).show(childFragmentManager, null) diff --git a/app/src/main/java/com/github/andreyasadchy/xtra/ui/videos/followed/FollowedVideosViewModel.kt b/app/src/main/java/com/github/andreyasadchy/xtra/ui/videos/followed/FollowedVideosViewModel.kt index 8907e4f35..75cb962aa 100644 --- a/app/src/main/java/com/github/andreyasadchy/xtra/ui/videos/followed/FollowedVideosViewModel.kt +++ b/app/src/main/java/com/github/andreyasadchy/xtra/ui/videos/followed/FollowedVideosViewModel.kt @@ -44,6 +44,8 @@ class FollowedVideosViewModel @Inject constructor( val sort: String get() = filter.value?.sort ?: VideosSortDialog.SORT_TIME + val period: String + get() = filter.value?.period ?: VideosSortDialog.PERIOD_ALL val type: String get() = filter.value?.type ?: VideosSortDialog.VIDEO_TYPE_ALL @@ -83,11 +85,12 @@ class FollowedVideosViewModel @Inject constructor( } fun setFilter(sort: String?, type: String?) { - filter.value = Filter(sort, type) + filter.value = Filter(sort, null, type) } class Filter( val sort: String?, + val period: String?, val type: String?, ) }