Skip to content

Commit

Permalink
Upping version of PSPDFKIT to 2024.3.1 which adds proper stylus handl…
Browse files Browse the repository at this point in the history
…ing and palm rejection. Can now draw annotations with the stylus while moving the page or switching pages with a finger.

Hide PSPDFKit Strikethrough and Underline in text-selection popup. Closes #137. Closes #123
Fix for “Can't edit selected annotation”. Where tapping on the same annotation twice didn’t open edit dialog. Closes #118.
Potentially fixed an issue where text highlights were split when there was a tiny gap in a sentence.
Upping versionCode ot 79
  • Loading branch information
Dima-Android committed Jun 25, 2024
1 parent 249df62 commit 3abcc2c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,13 @@ class PdfReaderViewModel @Inject constructor(
@Subscribe(threadMode = ThreadMode.MAIN)
fun onEvent(pdfAnnotationCommentResult: PdfAnnotationCommentResult) {
setComment(pdfAnnotationCommentResult.annotationKey, pdfAnnotationCommentResult.comment)
if (isTablet) {
// Fix for a bug where selecting an already selected annotation again didn't trigger Annotation Edit Popup/Screen.
// Unfortunately PSPDFKIT's onAnnotationSelected method is not triggered when user is selecting the same annotation again. Because technically the same annotation just stays selected.
// That's why after finishing annotation editing we have to make PSPDFKIT to deselect the currently selected annotation.
// Drawback to this is that of course visually annotation gets deselected as well.
this.fragment.clearSelectedAnnotations()
}
}

@Subscribe(threadMode = ThreadMode.MAIN)
Expand Down Expand Up @@ -432,7 +439,7 @@ class PdfReaderViewModel @Inject constructor(

private fun loadRawDocument() {
this.rawDocument =
PdfDocumentLoader.openDocument(context, this.document.documentSource.fileUri)
PdfDocumentLoader.openDocument(context, this.document.documentSource.fileUri!!)
}

private fun setupInteractionListeners() {
Expand Down Expand Up @@ -1204,9 +1211,6 @@ class PdfReaderViewModel @Inject constructor(
}

private fun _select(key: AnnotationKey?, didSelectInDocument: Boolean) {
if (key == viewState.selectedAnnotationKey) {
return
}
val existing = viewState.selectedAnnotationKey
if (existing != null) {
if (viewState.sortedKeys.contains(existing)) {
Expand Down Expand Up @@ -1557,7 +1561,7 @@ class PdfReaderViewModel @Inject constructor(


fun selectAnnotationFromDocument(key: AnnotationKey) {
if (!viewState.sidebarEditingEnabled && key != viewState.selectedAnnotationKey) {
if (!viewState.sidebarEditingEnabled) {
_select(key = key, didSelectInDocument = true)
}
}
Expand Down Expand Up @@ -1634,6 +1638,7 @@ class PdfReaderViewModel @Inject constructor(
.invertColors(isCalculatedThemeDark)
.themeMode(themeMode)
.showNoteEditorForNewNoteAnnotations(false)
.textSelectionPopupToolbarEnabled(false)
// .disableFormEditing()
// .disableAnnotationRotation()
// .setSelectedAnnotationResizeEnabled(false)
Expand Down Expand Up @@ -1898,7 +1903,7 @@ class PdfReaderViewModel @Inject constructor(
val pdfAnnotation =
document.annotation(annotationToReselect.page, annotationToReselect.key)
if (pdfAnnotation != null) {
fragment.setSelectedAnnotation(pdfAnnotation)
// fragment.setSelectedAnnotation(pdfAnnotation)
}
}
setupInteractionListeners()
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/BuildConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ object BuildConfig {
const val compileSdkVersion = 34
const val targetSdk = 33

val versionCode = 78 // Must be updated on every build
val versionCode = 79 // Must be updated on every build
val version = Version(
major = 1,
minor = 0,
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/Libs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ object Libs {

const val androidJUnitRunner = "androidx.test.runner.AndroidJUnitRunner"

const val pspdfkit = "com.pspdfkit:pspdfkit:8.10.0"
const val pspdfkit = "com.pspdfkit:pspdfkit:2024.3.1"
const val googleServices = "com.google.gms:google-services:4.3.13"
const val realmGradlePlugin = "io.realm:realm-gradle-plugin:10.15.1"
const val materialDesign = "com.google.android.material:material:1.10.0"
Expand Down

0 comments on commit 3abcc2c

Please sign in to comment.