adding a crashfix at the pdf reader

This commit is contained in:
tibbi 2022-12-30 23:18:33 +01:00
parent ede372b4f1
commit 1f717f050c
2 changed files with 9 additions and 2 deletions

View File

@ -113,7 +113,14 @@ class PDFViewerActivity : SimpleActivity() {
pdf_viewer.setPageTransformer(MarginPageTransformer(resources.getDimension(R.dimen.activity_margin).toInt())) pdf_viewer.setPageTransformer(MarginPageTransformer(resources.getDimension(R.dimen.activity_margin).toInt()))
pdf_viewer.orientation = ViewPager2.ORIENTATION_VERTICAL pdf_viewer.orientation = ViewPager2.ORIENTATION_VERTICAL
pdf_viewer.adapter = PDFPagerAdapter(this, clickListener, errorHandler, uri.toString(), getProperBackgroundColor()) try {
pdf_viewer.adapter = PDFPagerAdapter(this, clickListener, errorHandler, uri.toString(), getProperBackgroundColor())
} catch (e: Exception) {
showErrorToast(e)
finish()
return
}
pdf_viewer.registerOnPageChangeCallback(object : OnPageChangeCallback() { pdf_viewer.registerOnPageChangeCallback(object : OnPageChangeCallback() {
override fun onPageSelected(position: Int) { override fun onPageSelected(position: Int) {
updatePageCounter(position) updatePageCounter(position)

View File

@ -9,7 +9,7 @@ buildscript {
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:7.3.0' classpath 'com.android.tools.build:gradle:7.3.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong