Skip to content

Commit

Permalink
Update example to PSPDFKit for Android 2024.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
PSPDFKit authored and PSPDFKit committed Oct 17, 2024
1 parent 496efe2 commit 6733209
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
id("kotlin-android")
id("org.jetbrains.kotlin.plugin.compose")
id("com.google.devtools.ksp")
}
Expand Down Expand Up @@ -50,7 +50,7 @@ dependencies {

// PSPDFKit is integrated from the PSPDFKit Maven repository. See the `repositories` block at the beginning
// of this file, which shows how to set up the repository in your app.
implementation("com.pspdfkit:pspdfkit:2024.6.0")
implementation("com.pspdfkit:pspdfkit:2024.7.0")


implementation("androidx.datastore:datastore-preferences:1.1.1")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ package com.pspdfkit.example.ui.screens.pdf

import android.content.Context
import android.widget.Toast
import androidx.activity.compose.BackHandler
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.expandVertically
import androidx.compose.animation.fadeIn
Expand Down Expand Up @@ -145,7 +146,7 @@ fun PdfUI(pdf: File, context: Context, theme: Int, isDark: Boolean, navigateTo:
documentState = documentState,
colorScheme = uiColors,
navigationIcon = {
IconButton(onClick = { navigateTo.invoke() }) {
IconButton(onClick = { if (documentState.isDefaultViewerActive()) navigateTo.invoke() else documentState.exitCurrentState() }) {
Icon(imageVector = Icons.AutoMirrored.Outlined.ArrowBack, contentDescription = "Back", tint = it)
}
},
Expand All @@ -156,6 +157,9 @@ fun PdfUI(pdf: File, context: Context, theme: Int, isDark: Boolean, navigateTo:
}
}
}
BackHandler(true) {
if (documentState.isDefaultViewerActive()) navigateTo.invoke() else documentState.exitCurrentState()
}
}

// Here we can customise the specific views for example the main toolbar.
Expand Down

0 comments on commit 6733209

Please sign in to comment.