From bc9bd557bb857ac5164647ae4ec044450ee0441e Mon Sep 17 00:00:00 2001 From: HapeLee <1321903405@qq.com> Date: Thu, 28 Aug 2025 14:15:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=9B=AE=E5=BD=95=E6=9C=80?= =?UTF-8?q?=E5=90=8E=E4=B8=80=E9=A1=B9=E8=A7=86=E5=9B=BE=E8=A2=AB=E9=81=AE?= =?UTF-8?q?=E6=8C=A1=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kazusa/ui/book/toc/ChapterListFragment.kt | 18 ++- .../main/res/layout/fragment_chapter_list.xml | 113 ++++++++++-------- 2 files changed, 77 insertions(+), 54 deletions(-) diff --git a/app/src/main/java/io/legato/kazusa/ui/book/toc/ChapterListFragment.kt b/app/src/main/java/io/legato/kazusa/ui/book/toc/ChapterListFragment.kt index f8540e0bb..28fcfe780 100644 --- a/app/src/main/java/io/legato/kazusa/ui/book/toc/ChapterListFragment.kt +++ b/app/src/main/java/io/legato/kazusa/ui/book/toc/ChapterListFragment.kt @@ -4,6 +4,7 @@ import android.annotation.SuppressLint import android.app.Activity.RESULT_OK import android.content.Intent import android.graphics.Canvas +import android.graphics.Rect import android.os.Bundle import android.view.View import androidx.core.content.ContextCompat @@ -27,7 +28,7 @@ import io.legato.kazusa.model.CacheBook import io.legato.kazusa.ui.widget.recycler.UpLinearLayoutManager import io.legato.kazusa.ui.widget.recycler.VerticalDivider import io.legato.kazusa.utils.VibrationUtils -import io.legato.kazusa.utils.applyNavigationBarMargin +import io.legato.kazusa.utils.applyNavigationBarPadding import io.legato.kazusa.utils.dpToPx import io.legato.kazusa.utils.observeEvent import io.legato.kazusa.utils.themeColor @@ -147,11 +148,24 @@ class ChapterListFragment : VMBaseFragment(R.layout.fragment_chapt binding.recyclerView.layoutManager = mLayoutManager binding.recyclerView.addItemDecoration(VerticalDivider(requireContext())) + binding.recyclerView.addItemDecoration(object : RecyclerView.ItemDecoration() { + override fun getItemOffsets( + outRect: Rect, + view: View, + parent: RecyclerView, + state: RecyclerView.State + ) { + if (parent.getChildAdapterPosition(view) == state.itemCount - 1) { + outRect.bottom = 80.dpToPx() + } + } + }) + binding.recyclerView.adapter = adapter } private fun initView() = binding.run { - cdBase.applyNavigationBarMargin() + llBase.applyNavigationBarPadding() btnChapterTop.setOnClickListener { mLayoutManager.scrollToPositionWithOffset(0, 0) } diff --git a/app/src/main/res/layout/fragment_chapter_list.xml b/app/src/main/res/layout/fragment_chapter_list.xml index 8fc39ab4f..0574726c5 100644 --- a/app/src/main/res/layout/fragment_chapter_list.xml +++ b/app/src/main/res/layout/fragment_chapter_list.xml @@ -13,68 +13,77 @@ app:layout_constraintTop_toTopOf="parent" app:layout_constraintBottom_toBottomOf="parent" /> - - + android:layout_height="wrap_content" + android:layout_marginHorizontal="16dp" + android:layout_marginVertical="8dp" + app:cardBackgroundColor="?attr/colorSurfaceContainer" + app:cardElevation="4dp" + app:strokeWidth="0dp"> - + android:gravity="center" + android:orientation="horizontal" + android:paddingVertical="8dp" + android:paddingStart="16dp" + android:paddingEnd="10dp"> - + - + - + + + + + + + - - \ No newline at end of file