Skip to content

Commit

Permalink
Update spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
Long Do committed Jun 2, 2022
1 parent 83eec1d commit 9f7d720
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 20 deletions.
6 changes: 6 additions & 0 deletions pdfview/src/main/java/lee/module/pdfview/pdf/PdfView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,20 @@ 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
) : RecyclerView(context, attrs, defStyleAttr) {

init {
layoutManager = PreloadLayoutManager(context)
addItemDecoration(DividerItemDecoration(context, VERTICAL).apply {
setDrawable(ContextCompat.getDrawable(context, R.drawable.pv_divider_vertical_16)!!)
})
}

fun setPdfRenderer(renderer: PdfRenderer) {
Expand Down
5 changes: 5 additions & 0 deletions pdfview/src/main/res/drawable/pv_divider_vertical_16.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<size android:height="16dp" />
<solid android:color="@android:color/transparent" />
</shape>
4 changes: 2 additions & 2 deletions pdfview/src/main/res/layout/activity_pv_pdf_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
24 changes: 6 additions & 18 deletions pdfview/src/main/res/layout/pv_pdf_item.xml
Original file line number Diff line number Diff line change
@@ -1,20 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
<lee.module.pdfview.pdf.photoview.PhotoView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ivContent"
android:layout_width="match_parent"
android:layout_height="match_parent">

<lee.module.pdfview.pdf.photoview.PhotoView
android:id="@+id/ivContent"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:background="@android:color/white"
android:minHeight="100dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="@android:color/white"
android:minHeight="100dp" />

0 comments on commit 9f7d720

Please sign in to comment.