From 9f7d720e6142a5643df61d5fb601a0491b0adda0 Mon Sep 17 00:00:00 2001 From: Long Do Date: Thu, 2 Jun 2022 12:47:24 +0700 Subject: [PATCH] Update spacing --- .../java/lee/module/pdfview/pdf/PdfView.kt | 6 +++++ .../res/drawable/pv_divider_vertical_16.xml | 5 ++++ .../main/res/layout/activity_pv_pdf_view.xml | 4 ++-- pdfview/src/main/res/layout/pv_pdf_item.xml | 24 +++++-------------- 4 files changed, 19 insertions(+), 20 deletions(-) create mode 100644 pdfview/src/main/res/drawable/pv_divider_vertical_16.xml diff --git a/pdfview/src/main/java/lee/module/pdfview/pdf/PdfView.kt b/pdfview/src/main/java/lee/module/pdfview/pdf/PdfView.kt index f307c4c..0312733 100644 --- a/pdfview/src/main/java/lee/module/pdfview/pdf/PdfView.kt +++ b/pdfview/src/main/java/lee/module/pdfview/pdf/PdfView.kt @@ -5,7 +5,10 @@ import android.graphics.pdf.PdfRenderer import android.net.Uri import android.util.AttributeSet import android.widget.Toast +import androidx.core.content.ContextCompat +import androidx.recyclerview.widget.DividerItemDecoration import androidx.recyclerview.widget.RecyclerView +import lee.module.pdfview.R class PdfView @JvmOverloads constructor( context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0 @@ -13,6 +16,9 @@ class PdfView @JvmOverloads constructor( init { layoutManager = PreloadLayoutManager(context) + addItemDecoration(DividerItemDecoration(context, VERTICAL).apply { + setDrawable(ContextCompat.getDrawable(context, R.drawable.pv_divider_vertical_16)!!) + }) } fun setPdfRenderer(renderer: PdfRenderer) { diff --git a/pdfview/src/main/res/drawable/pv_divider_vertical_16.xml b/pdfview/src/main/res/drawable/pv_divider_vertical_16.xml new file mode 100644 index 0000000..c60109f --- /dev/null +++ b/pdfview/src/main/res/drawable/pv_divider_vertical_16.xml @@ -0,0 +1,5 @@ + + + + diff --git a/pdfview/src/main/res/layout/activity_pv_pdf_view.xml b/pdfview/src/main/res/layout/activity_pv_pdf_view.xml index f00d875..a6a83c2 100644 --- a/pdfview/src/main/res/layout/activity_pv_pdf_view.xml +++ b/pdfview/src/main/res/layout/activity_pv_pdf_view.xml @@ -5,5 +5,5 @@ android:layout_height="match_parent" android:background="@android:color/darker_gray" android:clipToPadding="false" - android:paddingTop="8dp" - android:paddingBottom="8dp" /> + android:paddingTop="16dp" + android:paddingBottom="16dp" /> diff --git a/pdfview/src/main/res/layout/pv_pdf_item.xml b/pdfview/src/main/res/layout/pv_pdf_item.xml index 7c91711..9491876 100644 --- a/pdfview/src/main/res/layout/pv_pdf_item.xml +++ b/pdfview/src/main/res/layout/pv_pdf_item.xml @@ -1,20 +1,8 @@ - - - - - + android:layout_height="match_parent" + android:layout_gravity="center" + android:background="@android:color/white" + android:minHeight="100dp" />