Skip to content

Revisit the new fxl navigator and introduce a reflowable one #680

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 62 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
4d36e99
Add a rough reflowable navigator
qnga Dec 8, 2024
d094fda
Add user settings
qnga Dec 8, 2024
7d6c6fd
Upgrade to Readium CSS2 and fix snapping bug
qnga Dec 10, 2024
3a67b27
Implement scroll mode
qnga Dec 10, 2024
52b2a5b
Fix padding and background color
qnga Dec 20, 2024
2b7e402
Use FontFamilyDeclarations
qnga Dec 20, 2024
865d806
Invalidates Webview when stylesheet to inject has changed
qnga Dec 20, 2024
54b0c27
Fix scroll with vertical writings
qnga Dec 20, 2024
c50feea
Factorise nested scroll connections
qnga Dec 20, 2024
ea7e32d
Fix tap offsets
qnga Dec 21, 2024
5b8f7e6
Detect tap on padding
qnga Dec 21, 2024
c4b0a8a
Fix regression in snapping related to padding
qnga Dec 21, 2024
6d7f5b6
Try to fix scroll position of previous pages
qnga Jan 5, 2025
33b1e60
Bump minSdk to 23
qnga Jan 6, 2025
0e6c6f8
Restore default behavior in Scrollable2D: pre/postScroll are called w…
qnga Mar 28, 2025
c60089d
Implement a different nested scroll strategy
qnga Mar 28, 2025
0e166cf
Fix restore location in reflowable
qnga Mar 29, 2025
45228ed
Fix taps in reflowable
qnga Mar 29, 2025
90205b1
Cosmetic changes in demo
qnga Mar 30, 2025
735cf0c
Add missing ExperimentalReadiumApi markers and fix licenses
qnga Mar 30, 2025
e657294
Rename NavigatorFactory to RenditionFactory
qnga Mar 30, 2025
0cae14b
Untie reflowable and fixed navigators
qnga Mar 30, 2025
83ae72a
Various Compose fixes
qnga Mar 30, 2025
9bb7944
Introduce ReflowableResourceState to fix readyToScroll
qnga Mar 30, 2025
2b9aeab
Remove glitch on location restoration
qnga Mar 30, 2025
302ab99
Refactor ReflowableResource
qnga Mar 31, 2025
354de42
Various changes in reflowable preferences and preference editor
qnga Mar 31, 2025
87449da
Redesign reflowable scroll. Breaks FXL
qnga Apr 9, 2025
39d55b9
Clean up
qnga Apr 9, 2025
3527573
Repair FXL
qnga Apr 10, 2025
de0889a
Ugrade Readium CSS to 2.0.0-beta08
qnga Apr 10, 2025
1cb097d
Clean up
qnga Apr 10, 2025
855bed8
Fix Readium CSS upgrade
qnga Apr 11, 2025
32875e8
Add virtual column when necessary
qnga Apr 11, 2025
ab2c42a
Fix snapping issue due to padding included in page size
qnga Apr 11, 2025
cb8cfa7
Fix snapping issue
qnga Apr 11, 2025
adefc50
Fix location restoration on preference or orientation change
qnga Apr 12, 2025
a287779
Remove Progression sealed class
qnga Apr 12, 2025
15cb734
Better fix location restoration on preference change
qnga Apr 13, 2025
64097e8
Small fixes and cosmetic changes
qnga Apr 13, 2025
88d464a
Renaming
qnga Apr 13, 2025
daef1b5
Cosmetic changes in fixed layout
qnga Apr 13, 2025
7942a9f
Cosmetic changes
qnga Apr 16, 2025
0aced63
Fix fixed layout scroll after changing preferences
qnga Apr 18, 2025
4af0f63
Fix crash in two columns mode
qnga Apr 18, 2025
944d275
Merge branch 'develop' into compose-reflowable
qnga Apr 18, 2025
ce7b8f5
Small fixes
qnga Apr 18, 2025
c1d5b1d
Fix scroll issue in fixed layout
qnga Apr 20, 2025
d74659c
Commit missing file
qnga Apr 20, 2025
3e507fd
Simplify scroll dispatching by directly using ScrollableState and Fli…
qnga Apr 24, 2025
78381a9
Various big cosmetic changes
qnga Apr 26, 2025
35a7411
Fix scroll behavior in RTL mode
qnga Apr 27, 2025
2b8d47b
Refactoring + fix thread safety in webapis
qnga May 2, 2025
0c77906
Update Readium CSS to 2.0.0-beta-13
qnga May 30, 2025
1b594c3
Make Readium CSS stuff internal
qnga May 30, 2025
245790e
Fix multi columns and allow more than two columns
qnga May 30, 2025
34fc3c3
Add table of contents to demo
qnga Jun 2, 2025
b762353
Introduce different types for Preferences API and Overflow
qnga Jun 4, 2025
1f407ec
Modularize
qnga Jun 4, 2025
9c38ed6
Merge remote-tracking branch 'origin/develop' into compose-reflowable
qnga Jun 5, 2025
aaf2d31
Fix GitHub action
qnga Jun 5, 2025
88f6221
Fix scroll mode, broken since the fix for multicolumns
qnga Jun 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,21 +74,21 @@ jobs:
runs-on: macos-latest
if: ${{ !github.event.pull_request.draft }}
env:
scripts: ${{ 'readium/navigators/web/scripts' }}
scripts: ${{ 'readium/navigators/web/internals/scripts' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
package_json_file: readium/navigators/web/scripts/package.json
package_json_file: readium/navigators/web/internals/scripts/package.json
run_install: false
- name: Setup cache
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
cache-dependency-path: readium/navigators/web/scripts/pnpm-lock.yaml
cache-dependency-path: readium/navigators/web/internals/scripts/pnpm-lock.yaml
- name: Install dependencies
run: pnpm --dir "$scripts" install --frozen-lockfile
- name: Lint
Expand All @@ -98,4 +98,4 @@ jobs:
- name: Check if bundled scripts are up-to-date
run: |
make scripts-new
git diff --exit-code --name-only readium/navigators/web/src/main/assets/*
git diff --exit-code --name-only readium/navigators/web/internals/src/main/assets/*
4 changes: 4 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
SCRIPTS_PATH := readium/navigator/src/main/assets/_scripts
SCRIPTS_NAVIGATOR_WEB_PATH := readium/navigators/web/scripts
SCRIPTS_NAVIGATOR_WEB_PATH := readium/navigators/web/internals/scripts

help:
@echo "Usage: make <target>\n\n\
Expand Down Expand Up @@ -38,7 +38,8 @@ scripts-new:
pnpm run format; \
pnpm run lint; \
pnpm run bundle; \
mv dist/* ../src/main/assets/readium/navigators/web/
rm -r ../src/main/assets/readium/navigator/web/internals/generated/*; \
mv dist/* ../src/main/assets/readium/navigator/web/internals/generated/

.PHONY: scripts
scripts: scripts-legacy scripts-new
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ android {
compileSdk = (property("android.compileSdk") as String).toInt()

defaultConfig {
minSdk = (property("android.minSdk") as String).toInt()
minSdk = 23
targetSdk = (property("android.targetSdk") as String).toInt()

applicationId = "org.readium.navigator.demo"
Expand Down Expand Up @@ -56,14 +56,15 @@ android {
assets.srcDirs("src/main/assets")
}
}
namespace = "org.readium.navigator.demo"
namespace = "org.readium.demo.navigator"
}

dependencies {
implementation(project(":readium:readium-shared"))
implementation(project(":readium:readium-streamer"))
implementation(project(":readium:readium-navigator"))
implementation(project(":readium:navigators:readium-navigator-web"))
implementation(project(":readium:navigators:web:readium-navigator-web-reflowable"))
implementation(project(":readium:navigators:web:readium-navigator-web-fixedlayout"))
implementation(project(":readium:adapters:pdfium"))

coreLibraryDesugaring(libs.desugar.jdk.libs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@android:style/Theme.Material.Light.NoActionBar">
<activity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* available in the top-level LICENSE file of the project.
*/

package org.readium.navigator.demo
package org.readium.demo.navigator

import android.net.Uri
import android.os.Bundle
Expand All @@ -17,7 +17,7 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.core.view.WindowCompat
import androidx.fragment.app.FragmentActivity
import org.readium.navigator.demo.util.Theme
import org.readium.demo.navigator.util.Theme
import org.readium.r2.shared.util.toAbsoluteUrl

class DemoActivity : FragmentActivity() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* available in the top-level LICENSE file of the project.
*/

package org.readium.navigator.demo
package org.readium.demo.navigator

import androidx.activity.compose.BackHandler
import androidx.compose.foundation.layout.Box
Expand All @@ -22,15 +22,15 @@ import androidx.compose.runtime.collectAsState
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.core.view.WindowInsetsControllerCompat
import org.readium.navigator.demo.reader.Reader
import org.readium.navigator.demo.util.Fullscreenable
import org.readium.demo.navigator.reader.Reader
import org.readium.demo.navigator.util.Fullscreenable

@Composable
fun Scaffold(
fullscreenState: State<Boolean>,
insetsController: WindowInsetsControllerCompat,
snackbarHostState: SnackbarHostState,
content: @Composable () -> Unit
content: @Composable () -> Unit,
) {
Fullscreenable(
fullscreenState = fullscreenState,
Expand All @@ -56,7 +56,7 @@ fun MainContent(
viewmodel: DemoViewModel,
launchBookSelection: () -> Unit,
snackbarHostState: SnackbarHostState,
fullscreenState: MutableState<Boolean>
fullscreenState: MutableState<Boolean>,
) {
val viewmodelState = viewmodel.state.collectAsState().value

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* available in the top-level LICENSE file of the project.
*/

package org.readium.navigator.demo
package org.readium.demo.navigator

import android.app.Application
import androidx.lifecycle.AndroidViewModel
Expand All @@ -13,14 +13,14 @@ import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.launch
import org.readium.navigator.demo.reader.ReaderOpener
import org.readium.navigator.demo.reader.ReaderState
import org.readium.demo.navigator.reader.ReaderOpener
import org.readium.demo.navigator.reader.ReaderState
import org.readium.r2.shared.util.AbsoluteUrl
import org.readium.r2.shared.util.toDebugDescription
import timber.log.Timber

class DemoViewModel(
application: Application
application: Application,
) : AndroidViewModel(application) {

sealed interface State {
Expand All @@ -32,11 +32,11 @@ class DemoViewModel(
State

data class Error(
val error: org.readium.r2.shared.util.Error
val error: org.readium.r2.shared.util.Error,
) : State

data class Reader(
val readerState: ReaderState<*, *>
val readerState: ReaderState<*, *, *>,
) : State
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
package org.readium.navigator.demo.persistence
/*
* Copyright 2024 Readium Foundation. All rights reserved.
* Use of this source code is governed by the BSD-style license
* available in the top-level LICENSE file of the project.
*/

package org.readium.demo.navigator.persistence

import org.readium.r2.shared.publication.Locator
import org.readium.r2.shared.util.AbsoluteUrl
Expand Down
Loading