From ee222fa07ecf8ca1ba03f8adf05cebeef0889574 Mon Sep 17 00:00:00 2001 From: Mark Raynsford Date: Thu, 4 Apr 2024 11:27:26 +0000 Subject: [PATCH] Use the correct chapter numbering mode Fix: https://ebce-lyrasis.atlassian.net/browse/PP-1126 --- README-CHANGES.xml | 10 ++++++++-- .../r2/demo/DemoFileSelectionFragment.kt | 4 +++- .../java/org/librarysimplified/r2/demo/DemoModel.kt | 5 ----- .../org/librarysimplified/r2/views/SR2ReaderModel.kt | 4 +++- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/README-CHANGES.xml b/README-CHANGES.xml index 283dc2a..795e50e 100644 --- a/README-CHANGES.xml +++ b/README-CHANGES.xml @@ -92,8 +92,14 @@ - - + + + + + + + + diff --git a/org.librarysimplified.r2.demo/src/main/java/org/librarysimplified/r2/demo/DemoFileSelectionFragment.kt b/org.librarysimplified.r2.demo/src/main/java/org/librarysimplified/r2/demo/DemoFileSelectionFragment.kt index a5b93e1..fcfac65 100644 --- a/org.librarysimplified.r2.demo/src/main/java/org/librarysimplified/r2/demo/DemoFileSelectionFragment.kt +++ b/org.librarysimplified.r2.demo/src/main/java/org/librarysimplified/r2/demo/DemoFileSelectionFragment.kt @@ -11,6 +11,7 @@ import android.widget.CheckBox import androidx.fragment.app.Fragment import org.librarysimplified.r2.api.SR2PageNumberingMode import org.librarysimplified.r2.api.SR2ScrollingMode +import org.librarysimplified.r2.views.SR2ReaderModel class DemoFileSelectionFragment : Fragment(R.layout.demo_file_selection) { @@ -45,12 +46,13 @@ class DemoFileSelectionFragment : Fragment(R.layout.demo_file_selection) { } this.demoLoaderPerChapterPageNumbering.setOnCheckedChangeListener { _, isChecked -> - DemoModel.perChapterNumbering = when (isChecked) { + SR2ReaderModel.perChapterNumbering = when (isChecked) { true -> SR2PageNumberingMode.PER_CHAPTER false -> SR2PageNumberingMode.WHOLE_BOOK } } + SR2ReaderModel.perChapterNumbering = SR2PageNumberingMode.WHOLE_BOOK return layout } diff --git a/org.librarysimplified.r2.demo/src/main/java/org/librarysimplified/r2/demo/DemoModel.kt b/org.librarysimplified.r2.demo/src/main/java/org/librarysimplified/r2/demo/DemoModel.kt index 4d45b11..e97e1d9 100644 --- a/org.librarysimplified.r2.demo/src/main/java/org/librarysimplified/r2/demo/DemoModel.kt +++ b/org.librarysimplified.r2.demo/src/main/java/org/librarysimplified/r2/demo/DemoModel.kt @@ -1,7 +1,6 @@ package org.librarysimplified.r2.demo import android.content.Context -import org.librarysimplified.r2.api.SR2PageNumberingMode import org.librarysimplified.r2.api.SR2ScrollingMode import java.io.File @@ -19,10 +18,6 @@ object DemoModel { var scrollMode: SR2ScrollingMode = SR2ScrollingMode.SCROLLING_MODE_PAGINATED - @Volatile - var perChapterNumbering: SR2PageNumberingMode = - SR2PageNumberingMode.PER_CHAPTER - val database: DemoDatabase get() = this.databaseField diff --git a/org.librarysimplified.r2.views/src/main/java/org/librarysimplified/r2/views/SR2ReaderModel.kt b/org.librarysimplified.r2.views/src/main/java/org/librarysimplified/r2/views/SR2ReaderModel.kt index 4b5090c..b70b5b7 100644 --- a/org.librarysimplified.r2.views/src/main/java/org/librarysimplified/r2/views/SR2ReaderModel.kt +++ b/org.librarysimplified.r2.views/src/main/java/org/librarysimplified/r2/views/SR2ReaderModel.kt @@ -50,11 +50,13 @@ object SR2ReaderModel { var searchTerm: String = "" + @Volatile var scrollMode: SR2ScrollingMode = SR2ScrollingMode.SCROLLING_MODE_PAGINATED + @Volatile var perChapterNumbering: SR2PageNumberingMode = - SR2PageNumberingMode.PER_CHAPTER + SR2PageNumberingMode.WHOLE_BOOK private val viewCommandSource = PublishSubject.create()