From dd6794cda5bfdb134c3f81950aaaacd30a241dd6 Mon Sep 17 00:00:00 2001 From: why Date: Fri, 22 Dec 2023 00:35:16 +0800 Subject: [PATCH] =?UTF-8?q?[Feat]:=20=E7=AB=A0=E8=8A=82=E6=94=B6=E8=97=8F?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E5=A2=9E=E5=8A=A0=E6=92=A4=E9=94=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/xiaoyv/bangumi/base/BaseListFragment.kt | 9 +++++++-- .../bangumi/ui/media/action/MediaEpCollectDialog.kt | 5 +++-- .../ui/media/detail/chapter/MediaChapterFragment.kt | 3 +++ .../res/layout/fragment_media_action_ep_collect.xml | 10 ++++++++++ .../xiaoyv/common/config/annotation/EpCollectType.kt | 2 ++ 5 files changed, 25 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/xiaoyv/bangumi/base/BaseListFragment.kt b/app/src/main/java/com/xiaoyv/bangumi/base/BaseListFragment.kt index 6e495499..81148722 100644 --- a/app/src/main/java/com/xiaoyv/bangumi/base/BaseListFragment.kt +++ b/app/src/main/java/com/xiaoyv/bangumi/base/BaseListFragment.kt @@ -31,6 +31,11 @@ abstract class BaseListFragment> : */ open val loadingBias: Float = 0.5f + /** + * 刷新时是否滑动到顶部 + */ + open val scrollTopWhenRefresh: Boolean = true + internal val contentAdapter: BaseDifferAdapter by lazy { onCreateContentAdapter() } @@ -75,7 +80,7 @@ abstract class BaseListFragment> : } else { binding.rvContent.adapter = adapterHelper.adapter } - autoInitData() + autoInitData() } @@ -113,7 +118,7 @@ abstract class BaseListFragment> : } contentAdapter.submitList(it) { - if (viewModel.isRefresh) { + if (viewModel.isRefresh && scrollTopWhenRefresh) { layoutManager?.scrollToPositionWithOffset(0, 0) } diff --git a/app/src/main/java/com/xiaoyv/bangumi/ui/media/action/MediaEpCollectDialog.kt b/app/src/main/java/com/xiaoyv/bangumi/ui/media/action/MediaEpCollectDialog.kt index 6730de59..2fa0b7d4 100644 --- a/app/src/main/java/com/xiaoyv/bangumi/ui/media/action/MediaEpCollectDialog.kt +++ b/app/src/main/java/com/xiaoyv/bangumi/ui/media/action/MediaEpCollectDialog.kt @@ -70,7 +70,7 @@ class MediaEpCollectDialog : DialogFragment() { append(entity.titleCn) } binding.tvDesc.text = entity.time - binding.tvComment.text = String.format("讨论:%d", entity.commentCount) + binding.tvComment.text = String.format("讨论:%d,点击查看", entity.commentCount) binding.tvComment.setOnFastLimitClickListener { jumpDetail(entity) @@ -106,7 +106,8 @@ class MediaEpCollectDialog : DialogFragment() { } else -> { - InterestType.TYPE_UNKNOWN + entity.collectType = InterestType.TYPE_UNKNOWN + EpCollectType.TYPE_REMOVE } } diff --git a/app/src/main/java/com/xiaoyv/bangumi/ui/media/detail/chapter/MediaChapterFragment.kt b/app/src/main/java/com/xiaoyv/bangumi/ui/media/detail/chapter/MediaChapterFragment.kt index 77cbadd5..2ae5e4c7 100644 --- a/app/src/main/java/com/xiaoyv/bangumi/ui/media/detail/chapter/MediaChapterFragment.kt +++ b/app/src/main/java/com/xiaoyv/bangumi/ui/media/detail/chapter/MediaChapterFragment.kt @@ -26,6 +26,9 @@ class MediaChapterFragment : BaseListFragment + +