Skip to content

Commit fc1ae75

Browse files
docs: Update changelog and version history for v1.2.4
- Enhanced 1.2.4 changelog with comprehensive page navigation fixes - Updated version history with detailed upgrade guide - Added documentation for all callback reliability improvements - Included technical details for animation completion handling
1 parent 001c37b commit fc1ae75

File tree

2 files changed

+49
-6
lines changed

2 files changed

+49
-6
lines changed

docs/CHANGELOG.md

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ All notable changes to AndroidPDFPreview will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
## [1.2.4] - 2025-10-28 - Critical Bug Fix: Page Calculation Accuracy with Page Snap
8+
## [1.2.4] - 2025-10-29 - Critical Bug Fix: Page Navigation Callbacks & Page Snap Accuracy
99

1010
### Fixed
1111

@@ -21,6 +21,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2121
- Consistent page detection across scroll gestures, animations, and callbacks
2222
- Improved reliability with `pageSnap=true` configuration
2323

24+
- **🔄 Page Change Callback Reliability**
25+
- Fixed `onPageChanged()` callback not firing after scroll/animation completion
26+
- Added `loadPageByOffset()` calls in animation completion handlers (`handleAnimationEnd()` and `performFling()`)
27+
- Ensures page change detection occurs after all navigation operations settle
28+
- `onPageChanged()` now fires reliably for manual scroll, fling, and programmatic navigation
29+
30+
- **⚡ Intermediate Callback Prevention**
31+
- Prevented `onPageScrolled()` from reporting intermediate page numbers during page snap animations
32+
- Added animation state check in `updateScrollUIElements()` to skip callbacks during active animations
33+
- Eliminates confusing page number reports during smooth page transitions
34+
- Cleaner callback sequence with only final page positions reported
35+
36+
- **🎯 JumpTo Page Snapping**
37+
- Added page snapping to non-animated `jumpTo()` calls when `pageSnap=true` is enabled
38+
- Ensures pages are properly centered after programmatic navigation
39+
- Consistent behavior between animated and non-animated page jumps
40+
- Fixed initial load page positioning issues
41+
2442
### Technical Details
2543

2644
- **Page Calculation Algorithm Fix**:
@@ -29,14 +47,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2947
- Matches the exact logic used in `loadPageByOffset()` for page change detection
3048
- Eliminates discrepancies between scroll callbacks and actual page changes
3149

50+
- **Animation Completion Handling**:
51+
- `PdfAnimator.handleAnimationEnd()` now calls `loadPageByOffset()` to detect page changes
52+
- `PdfAnimator.performFling()` calls `loadPageByOffset()` when fling animations complete
53+
- Ensures `onPageChanged()` fires after all animation types (page snap, zoom, fling)
54+
- Proper callback sequencing: animation → page detection → callback firing
55+
3256
- **Page Snap Compatibility**:
3357
- Fixed callback accuracy when `pageSnap=true` is enabled
3458
- Page numbers remain stable during snap animations
3559
- No more incorrect page reporting during scroll deceleration
60+
- Animation state tracking prevents intermediate callback reports
3661

3762
### Migration Guide
3863

39-
No code changes required. This is an internal bug fix that improves callback accuracy.
64+
No code changes required. This is an internal bug fix that improves callback accuracy and reliability.
4065

4166
**What's Fixed:**
4267

@@ -48,6 +73,12 @@ pdfView.configureView {
4873
override fun onPageScrolled(page: Int, positionOffset: Float) {
4974
// ✅ NOW ACCURATE: No more jumping between wrong page numbers
5075
// ✅ STABLE: Consistent page numbers during snap animations
76+
// ✅ NO INTERMEDIATE: Only reports final page positions
77+
}
78+
79+
override fun onPageChanged(page: Int, pageCount: Int) {
80+
// ✅ NOW FIRES: After scroll/animation completion on new pages
81+
// ✅ RELIABLE: Works for all navigation methods (scroll, fling, jumpTo)
5182
}
5283
})
5384
}
@@ -57,7 +88,17 @@ pdfView.configureView {
5788

5889
- `positionOffset` conversion (`docLen * positionOffset`) didn't account for viewport size
5990
- Screen-center calculation (`-(offset - screenCenter)`) provides accurate page detection
60-
- Inconsistent algorithms caused callback/page change detection mismatch
91+
- Animation completion didn't trigger page change detection
92+
- Page snap animations caused intermediate callback reports
93+
- Missing `loadPageByOffset()` calls in animation end handlers
94+
95+
**Affected Components:**
96+
97+
- `PDFView.updateScrollUIElements()` - Fixed page calculation and animation state checks
98+
- `PdfAnimator.handleAnimationEnd()` - Added page change detection after animations
99+
- `PdfAnimator.performFling()` - Added page change detection after flings
100+
- `PDFView.jumpTo()` - Added page snapping for non-animated jumps
101+
- `PDFView.loadComplete()` - Enhanced initial load page positioning
61102

62103
```gradle
63104
dependencies {

docs/VERSION_HISTORY.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ This document provides a quick overview of all AndroidPDFPreview releases.
1515

1616
| Version | Release Date | Type | Key Features |
1717
|-----------|--------------|-------|------------------------------------------------------------------------------------|
18-
| **1.2.4** | 2025-10-28 | Patch | Critical bug fix: page calculation accuracy with page snap enabled |
18+
| **1.2.4** | 2025-10-29 | Patch | Critical bug fix: page navigation callbacks & page snap accuracy with improved reliability |
1919
| **1.2.3** | 2025-10-28 | Patch | Critical bug fix: page navigation callbacks now fire correctly after manual scroll |
2020
| **1.2.2** | 2025-10-24 | Minor | Performance optimization: smart tile loading, scroll pre-rendering, zoom listener |
2121
| **1.2.1** | 2025-10-03 | Minor | Fix password retry issue & update PDFium to chromium/7442 |
@@ -72,8 +72,10 @@ dependencies {
7272
- **Benefits**:
7373
- `onPageScrolled()` reports accurate page numbers during page snap animations
7474
- No more page number jumping with `pageSnap=true` configuration
75-
- Consistent page detection across all scroll scenarios
76-
- Improved callback reliability during scroll deceleration
75+
- `onPageChanged()` callback now fires reliably after scroll/animation completion
76+
- Prevents intermediate page callbacks during smooth animations
77+
- Improved page centering for initial load and programmatic navigation
78+
- Consistent callback behavior across all navigation methods
7779

7880
```gradle
7981
// Old

0 commit comments

Comments
 (0)