add margin inbetween pages at the pdf viewer

This commit is contained in:
tibbi
2022-12-10 22:45:46 +01:00
parent db7d806c6f
commit f53025c2d2
2 changed files with 3 additions and 1 deletions

View File

@ -65,7 +65,7 @@ android {
dependencies {
implementation 'com.github.SimpleMobileTools:Simple-Commons:b452494768'
implementation 'com.github.tibbi:PdfViewPager:dd7da8173c'
implementation 'com.github.tibbi:PdfViewPager:d2af24208d'
implementation 'com.github.Stericson:RootTools:df729dcb13'
implementation 'com.github.Stericson:RootShell:1.6'
implementation 'com.alexvasilkov:gesture-views:2.5.2'

View File

@ -9,6 +9,7 @@ import android.print.PrintManager
import android.view.View
import android.view.WindowManager
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.viewpager2.widget.MarginPageTransformer
import androidx.viewpager2.widget.ViewPager2
import androidx.viewpager2.widget.ViewPager2.OnPageChangeCallback
import com.simplemobiletools.commons.extensions.*
@ -110,6 +111,7 @@ class PDFViewerActivity : SimpleActivity() {
val errorHandler = PdfErrorHandler { throwable -> showErrorToast(throwable.toString()) }
pdf_viewer.setPageTransformer(MarginPageTransformer(resources.getDimension(R.dimen.activity_margin).toInt()))
pdf_viewer.orientation = ViewPager2.ORIENTATION_VERTICAL
pdf_viewer.adapter = PDFPagerAdapter(this, clickListener, errorHandler, uri.toString(), getProperBackgroundColor())
pdf_viewer.registerOnPageChangeCallback(object : OnPageChangeCallback() {