diff --git a/app/bibleview-js/src/components/BibleView.vue b/app/bibleview-js/src/components/BibleView.vue index 3e73a9eac9..ea0c995ab5 100644 --- a/app/bibleview-js/src/components/BibleView.vue +++ b/app/bibleview-js/src/components/BibleView.vue @@ -54,6 +54,11 @@
+
+
+ {{ pageNumber }} +
+
{ const isLoading = computed(() => documents.length === 0 || loadingCount.value > 0); function scrollUpDown(up = false) { - let amount = - window.innerHeight - - calculatedConfig.value.topOffset - - appSettings.bottomOffset; + let amount = calculatedConfig.value.pageHeight; if (documentType.value !== "bible" || (documentType.value === "bible" && !config.topMargin)) { amount -= 1.5*lineHeight.value; // 1.5 times because last line might be otherwise displayed partially } doScrolling(window.scrollY + (up ? -amount : amount), 0) } +const pageNumber = computed(() => { + const num = (scrollY.value - scrollYAtStart.value) / calculatedConfig.value.pageHeight; + return num.toFixed(1); +}); + setupEventBusListener("scroll_down", () => scrollUpDown()); setupEventBusListener("scroll_up", () => scrollUpDown(true)); @@ -588,6 +595,34 @@ a { width: 0; } +.pagenumber { + z-index: 5; + position: fixed; + right: 2mm; + margin-bottom: 2mm; + bottom: 0; + width: 1cm; + height: 0.5cm; + font-size: 70%; + font-weight: bold; + color: var(--text-color); + background: rgba(207, 207, 207, 0.71); + .noAnimation & { + background-color: var(--background-color); + border-width: 1px; + border-style: solid; + border-color: var(--text-color); + } + border-radius: 0.5cm; + justify-content: center; + .pagenumber-text { + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + } +} + .prev-page-button { @extend .next-page-button; left: 0; diff --git a/app/bibleview-js/src/composables/config.ts b/app/bibleview-js/src/composables/config.ts index eb9480f154..563c9c5bc0 100644 --- a/app/bibleview-js/src/composables/config.ts +++ b/app/bibleview-js/src/composables/config.ts @@ -85,6 +85,7 @@ export type Config = { maxWidth: number, }, topMargin: number, + showPageNumber: boolean, } export type BibleModalButtonId = "BOOKMARK"|"BOOKMARK_NOTES"|"MY_NOTES"|"SHARE"|"COMPARE"|"SPEAK" @@ -169,6 +170,7 @@ export function useConfig(documentType: Ref) { maxWidth: 300, }, topMargin: 0, + showPageNumber: false, }); const rtl = new URLSearchParams(window.location.search).get("rtl") === "true"; const nightMode = new URLSearchParams(window.location.search).get("night") === "true"; @@ -229,8 +231,9 @@ export function useConfig(documentType: Ref) { const marginLeft = margin + (leftPadding - rightPadding)/2; const marginRight = margin + (rightPadding - leftPadding)/2; + const pageHeight = window.innerHeight - topOffset - appSettings.bottomOffset; - return {topOffset, topMargin, marginLeft, marginRight}; + return {topOffset, topMargin, marginLeft, marginRight, pageHeight}; }); window.bibleViewDebug.config = config; diff --git a/app/bibleview-js/src/composables/infinite-scroll.ts b/app/bibleview-js/src/composables/infinite-scroll.ts index 1ccd3ce9c3..3092906743 100644 --- a/app/bibleview-js/src/composables/infinite-scroll.ts +++ b/app/bibleview-js/src/composables/infinite-scroll.ts @@ -21,7 +21,7 @@ * @author Martin Denham [mjdenham at gmail dot com] */ -import {computed, nextTick, onMounted, watch} from "vue"; +import {computed, nextTick, onMounted, ref, watch} from "vue"; import {filterNotNull, setupWindowEventListener} from "@/utils"; import {UseAndroid} from "@/composables/android"; import {AnyDocument, isOsisDocument} from "@/types/documents"; diff --git a/app/bibleview-js/src/composables/scroll.ts b/app/bibleview-js/src/composables/scroll.ts index 7d1b65d0df..9177905aa2 100644 --- a/app/bibleview-js/src/composables/scroll.ts +++ b/app/bibleview-js/src/composables/scroll.ts @@ -17,7 +17,7 @@ import {computed, nextTick, ref, Ref, watch} from "vue"; import {setupEventBusListener} from "@/eventbus"; -import {isInViewport} from "@/utils"; +import {isInViewport, setupWindowEventListener} from "@/utils"; import {AppSettings, CalculatedConfig, Config} from "@/composables/config"; import {useOrdinalHighlight} from "@/composables/ordinal-highlight"; import {Nullable} from "@/types/common"; @@ -179,6 +179,11 @@ export function useScroll( } } + const scrollY = ref(0); + setupWindowEventListener('scroll', () => scrollY.value = window.scrollY); + + const scrollYAtStart = ref(0); + async function setupContent( { jumpToOrdinal = null, @@ -210,6 +215,7 @@ export function useScroll( console.log("scrolling to beginning of document (now)"); scrollToId(null, {now: true, force: true}); } + scrollYAtStart.value = window.scrollY; console.log("Content is set ready!"); } @@ -217,6 +223,6 @@ export function useScroll( setupEventBusListener("set_offsets", setToolbarOffset) setupEventBusListener("scroll_to_verse", scrollToId) setupEventBusListener("setup_content", setupContent) - return {scrollToId, isScrolling, doScrolling} + return {scrollToId, isScrolling, doScrolling, scrollYAtStart, scrollY} } diff --git a/app/schemas/net.bible.android.database.WorkspaceDatabase/4.json b/app/schemas/net.bible.android.database.WorkspaceDatabase/4.json new file mode 100644 index 0000000000..2821c803e3 --- /dev/null +++ b/app/schemas/net.bible.android.database.WorkspaceDatabase/4.json @@ -0,0 +1,1003 @@ +{ + "formatVersion": 1, + "database": { + "version": 4, + "identityHash": "aa0999529b96f6f21ce256fb56ad141c", + "entities": [ + { + "tableName": "Workspace", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`name` TEXT NOT NULL, `contentsText` TEXT, `id` BLOB NOT NULL, `orderNumber` INTEGER NOT NULL DEFAULT 0, `unPinnedWeight` REAL DEFAULT NULL, `maximizedWindowId` BLOB, `primaryTargetLinksWindowId` BLOB DEFAULT NULL, `text_display_settings_strongsMode` INTEGER DEFAULT NULL, `text_display_settings_showMorphology` INTEGER DEFAULT NULL, `text_display_settings_showFootNotes` INTEGER DEFAULT NULL, `text_display_settings_expandXrefs` INTEGER DEFAULT NULL, `text_display_settings_showXrefs` INTEGER DEFAULT NULL, `text_display_settings_showRedLetters` INTEGER DEFAULT NULL, `text_display_settings_showSectionTitles` INTEGER DEFAULT NULL, `text_display_settings_showVerseNumbers` INTEGER DEFAULT NULL, `text_display_settings_showVersePerLine` INTEGER DEFAULT NULL, `text_display_settings_showBookmarks` INTEGER DEFAULT NULL, `text_display_settings_showMyNotes` INTEGER DEFAULT NULL, `text_display_settings_justifyText` INTEGER DEFAULT NULL, `text_display_settings_hyphenation` INTEGER DEFAULT NULL, `text_display_settings_topMargin` INTEGER DEFAULT NULL, `text_display_settings_fontSize` INTEGER DEFAULT NULL, `text_display_settings_fontFamily` TEXT DEFAULT NULL, `text_display_settings_lineSpacing` INTEGER DEFAULT NULL, `text_display_settings_bookmarksHideLabels` TEXT DEFAULT NULL, `text_display_settings_showPageNumber` INTEGER DEFAULT NULL, `text_display_settings_margin_size_marginLeft` INTEGER DEFAULT NULL, `text_display_settings_margin_size_marginRight` INTEGER DEFAULT NULL, `text_display_settings_margin_size_maxWidth` INTEGER DEFAULT NULL, `text_display_settings_colors_dayTextColor` INTEGER DEFAULT NULL, `text_display_settings_colors_dayBackground` INTEGER DEFAULT NULL, `text_display_settings_colors_dayNoise` INTEGER DEFAULT NULL, `text_display_settings_colors_nightTextColor` INTEGER DEFAULT NULL, `text_display_settings_colors_nightBackground` INTEGER DEFAULT NULL, `text_display_settings_colors_nightNoise` INTEGER DEFAULT NULL, `workspace_settings_enableTiltToScroll` INTEGER DEFAULT 0, `workspace_settings_enableReverseSplitMode` INTEGER DEFAULT 0, `workspace_settings_autoPin` INTEGER DEFAULT 1, `workspace_settings_speakSettings` TEXT DEFAULT NULL, `workspace_settings_recentLabels` TEXT DEFAULT NULL, `workspace_settings_autoAssignLabels` TEXT DEFAULT NULL, `workspace_settings_autoAssignPrimaryLabel` BLOB DEFAULT NULL, `workspace_settings_hideCompareDocuments` TEXT DEFAULT NULL, `workspace_settings_limitAmbiguousModalSize` INTEGER DEFAULT 0, `workspace_settings_workspaceColor` INTEGER DEFAULT NULL, PRIMARY KEY(`id`))", + "fields": [ + { + "fieldPath": "name", + "columnName": "name", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "contentsText", + "columnName": "contentsText", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "id", + "columnName": "id", + "affinity": "BLOB", + "notNull": true + }, + { + "fieldPath": "orderNumber", + "columnName": "orderNumber", + "affinity": "INTEGER", + "notNull": true, + "defaultValue": "0" + }, + { + "fieldPath": "unPinnedWeight", + "columnName": "unPinnedWeight", + "affinity": "REAL", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "maximizedWindowId", + "columnName": "maximizedWindowId", + "affinity": "BLOB", + "notNull": false + }, + { + "fieldPath": "primaryTargetLinksWindowId", + "columnName": "primaryTargetLinksWindowId", + "affinity": "BLOB", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.strongsMode", + "columnName": "text_display_settings_strongsMode", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.showMorphology", + "columnName": "text_display_settings_showMorphology", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.showFootNotes", + "columnName": "text_display_settings_showFootNotes", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.expandXrefs", + "columnName": "text_display_settings_expandXrefs", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.showXrefs", + "columnName": "text_display_settings_showXrefs", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.showRedLetters", + "columnName": "text_display_settings_showRedLetters", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.showSectionTitles", + "columnName": "text_display_settings_showSectionTitles", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.showVerseNumbers", + "columnName": "text_display_settings_showVerseNumbers", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.showVersePerLine", + "columnName": "text_display_settings_showVersePerLine", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.showBookmarks", + "columnName": "text_display_settings_showBookmarks", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.showMyNotes", + "columnName": "text_display_settings_showMyNotes", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.justifyText", + "columnName": "text_display_settings_justifyText", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.hyphenation", + "columnName": "text_display_settings_hyphenation", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.topMargin", + "columnName": "text_display_settings_topMargin", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.fontSize", + "columnName": "text_display_settings_fontSize", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.fontFamily", + "columnName": "text_display_settings_fontFamily", + "affinity": "TEXT", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.lineSpacing", + "columnName": "text_display_settings_lineSpacing", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.bookmarksHideLabels", + "columnName": "text_display_settings_bookmarksHideLabels", + "affinity": "TEXT", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.showPageNumber", + "columnName": "text_display_settings_showPageNumber", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.marginSize.marginLeft", + "columnName": "text_display_settings_margin_size_marginLeft", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.marginSize.marginRight", + "columnName": "text_display_settings_margin_size_marginRight", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.marginSize.maxWidth", + "columnName": "text_display_settings_margin_size_maxWidth", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.colors.dayTextColor", + "columnName": "text_display_settings_colors_dayTextColor", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.colors.dayBackground", + "columnName": "text_display_settings_colors_dayBackground", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.colors.dayNoise", + "columnName": "text_display_settings_colors_dayNoise", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.colors.nightTextColor", + "columnName": "text_display_settings_colors_nightTextColor", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.colors.nightBackground", + "columnName": "text_display_settings_colors_nightBackground", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.colors.nightNoise", + "columnName": "text_display_settings_colors_nightNoise", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "workspaceSettings.enableTiltToScroll", + "columnName": "workspace_settings_enableTiltToScroll", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "0" + }, + { + "fieldPath": "workspaceSettings.enableReverseSplitMode", + "columnName": "workspace_settings_enableReverseSplitMode", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "0" + }, + { + "fieldPath": "workspaceSettings.autoPin", + "columnName": "workspace_settings_autoPin", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "1" + }, + { + "fieldPath": "workspaceSettings.speakSettings", + "columnName": "workspace_settings_speakSettings", + "affinity": "TEXT", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "workspaceSettings.recentLabels", + "columnName": "workspace_settings_recentLabels", + "affinity": "TEXT", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "workspaceSettings.autoAssignLabels", + "columnName": "workspace_settings_autoAssignLabels", + "affinity": "TEXT", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "workspaceSettings.autoAssignPrimaryLabel", + "columnName": "workspace_settings_autoAssignPrimaryLabel", + "affinity": "BLOB", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "workspaceSettings.hideCompareDocuments", + "columnName": "workspace_settings_hideCompareDocuments", + "affinity": "TEXT", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "workspaceSettings.limitAmbiguousModalSize", + "columnName": "workspace_settings_limitAmbiguousModalSize", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "0" + }, + { + "fieldPath": "workspaceSettings.workspaceColor", + "columnName": "workspace_settings_workspaceColor", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "id" + ] + }, + "indices": [], + "foreignKeys": [] + }, + { + "tableName": "Window", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`workspaceId` BLOB NOT NULL, `isSynchronized` INTEGER NOT NULL, `isPinMode` INTEGER NOT NULL, `isLinksWindow` INTEGER NOT NULL, `id` BLOB NOT NULL, `orderNumber` INTEGER NOT NULL, `targetLinksWindowId` BLOB DEFAULT NULL, `syncGroup` INTEGER NOT NULL DEFAULT 0, `window_layout_state` TEXT NOT NULL, `window_layout_weight` REAL NOT NULL, PRIMARY KEY(`id`), FOREIGN KEY(`workspaceId`) REFERENCES `Workspace`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "workspaceId", + "columnName": "workspaceId", + "affinity": "BLOB", + "notNull": true + }, + { + "fieldPath": "isSynchronized", + "columnName": "isSynchronized", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "isPinMode", + "columnName": "isPinMode", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "isLinksWindow", + "columnName": "isLinksWindow", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "id", + "columnName": "id", + "affinity": "BLOB", + "notNull": true + }, + { + "fieldPath": "orderNumber", + "columnName": "orderNumber", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "targetLinksWindowId", + "columnName": "targetLinksWindowId", + "affinity": "BLOB", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "syncGroup", + "columnName": "syncGroup", + "affinity": "INTEGER", + "notNull": true, + "defaultValue": "0" + }, + { + "fieldPath": "windowLayout.state", + "columnName": "window_layout_state", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "windowLayout.weight", + "columnName": "window_layout_weight", + "affinity": "REAL", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "id" + ] + }, + "indices": [ + { + "name": "index_Window_workspaceId", + "unique": false, + "columnNames": [ + "workspaceId" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_Window_workspaceId` ON `${TABLE_NAME}` (`workspaceId`)" + } + ], + "foreignKeys": [ + { + "table": "Workspace", + "onDelete": "CASCADE", + "onUpdate": "NO ACTION", + "columns": [ + "workspaceId" + ], + "referencedColumns": [ + "id" + ] + } + ] + }, + { + "tableName": "HistoryItem", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`windowId` BLOB NOT NULL, `createdAt` INTEGER NOT NULL, `document` TEXT NOT NULL, `key` TEXT NOT NULL, `anchorOrdinal` INTEGER DEFAULT NULL, `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, FOREIGN KEY(`windowId`) REFERENCES `Window`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "windowId", + "columnName": "windowId", + "affinity": "BLOB", + "notNull": true + }, + { + "fieldPath": "createdAt", + "columnName": "createdAt", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "document", + "columnName": "document", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "key", + "columnName": "key", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "anchorOrdinal", + "columnName": "anchorOrdinal", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "id", + "columnName": "id", + "affinity": "INTEGER", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": true, + "columnNames": [ + "id" + ] + }, + "indices": [ + { + "name": "index_HistoryItem_windowId", + "unique": false, + "columnNames": [ + "windowId" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_HistoryItem_windowId` ON `${TABLE_NAME}` (`windowId`)" + } + ], + "foreignKeys": [ + { + "table": "Window", + "onDelete": "CASCADE", + "onUpdate": "NO ACTION", + "columns": [ + "windowId" + ], + "referencedColumns": [ + "id" + ] + } + ] + }, + { + "tableName": "PageManager", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`windowId` BLOB NOT NULL, `currentCategoryName` TEXT NOT NULL, `bible_document` TEXT, `bible_verse_versification` TEXT NOT NULL, `bible_verse_bibleBook` INTEGER NOT NULL, `bible_verse_chapterNo` INTEGER NOT NULL, `bible_verse_verseNo` INTEGER NOT NULL, `commentary_document` TEXT, `commentary_anchorOrdinal` INTEGER DEFAULT NULL, `dictionary_document` TEXT, `dictionary_key` TEXT, `dictionary_anchorOrdinal` INTEGER DEFAULT NULL, `general_book_document` TEXT, `general_book_key` TEXT, `general_book_anchorOrdinal` INTEGER DEFAULT NULL, `map_document` TEXT, `map_key` TEXT, `map_anchorOrdinal` INTEGER DEFAULT NULL, `text_display_settings_strongsMode` INTEGER DEFAULT NULL, `text_display_settings_showMorphology` INTEGER DEFAULT NULL, `text_display_settings_showFootNotes` INTEGER DEFAULT NULL, `text_display_settings_expandXrefs` INTEGER DEFAULT NULL, `text_display_settings_showXrefs` INTEGER DEFAULT NULL, `text_display_settings_showRedLetters` INTEGER DEFAULT NULL, `text_display_settings_showSectionTitles` INTEGER DEFAULT NULL, `text_display_settings_showVerseNumbers` INTEGER DEFAULT NULL, `text_display_settings_showVersePerLine` INTEGER DEFAULT NULL, `text_display_settings_showBookmarks` INTEGER DEFAULT NULL, `text_display_settings_showMyNotes` INTEGER DEFAULT NULL, `text_display_settings_justifyText` INTEGER DEFAULT NULL, `text_display_settings_hyphenation` INTEGER DEFAULT NULL, `text_display_settings_topMargin` INTEGER DEFAULT NULL, `text_display_settings_fontSize` INTEGER DEFAULT NULL, `text_display_settings_fontFamily` TEXT DEFAULT NULL, `text_display_settings_lineSpacing` INTEGER DEFAULT NULL, `text_display_settings_bookmarksHideLabels` TEXT DEFAULT NULL, `text_display_settings_showPageNumber` INTEGER DEFAULT NULL, `text_display_settings_margin_size_marginLeft` INTEGER DEFAULT NULL, `text_display_settings_margin_size_marginRight` INTEGER DEFAULT NULL, `text_display_settings_margin_size_maxWidth` INTEGER DEFAULT NULL, `text_display_settings_colors_dayTextColor` INTEGER DEFAULT NULL, `text_display_settings_colors_dayBackground` INTEGER DEFAULT NULL, `text_display_settings_colors_dayNoise` INTEGER DEFAULT NULL, `text_display_settings_colors_nightTextColor` INTEGER DEFAULT NULL, `text_display_settings_colors_nightBackground` INTEGER DEFAULT NULL, `text_display_settings_colors_nightNoise` INTEGER DEFAULT NULL, PRIMARY KEY(`windowId`), FOREIGN KEY(`windowId`) REFERENCES `Window`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "windowId", + "columnName": "windowId", + "affinity": "BLOB", + "notNull": true + }, + { + "fieldPath": "currentCategoryName", + "columnName": "currentCategoryName", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "biblePage.document", + "columnName": "bible_document", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "biblePage.verse.versification", + "columnName": "bible_verse_versification", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "biblePage.verse.bibleBook", + "columnName": "bible_verse_bibleBook", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "biblePage.verse.chapterNo", + "columnName": "bible_verse_chapterNo", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "biblePage.verse.verseNo", + "columnName": "bible_verse_verseNo", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "commentaryPage.document", + "columnName": "commentary_document", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "commentaryPage.anchorOrdinal", + "columnName": "commentary_anchorOrdinal", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "dictionaryPage.document", + "columnName": "dictionary_document", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "dictionaryPage.key", + "columnName": "dictionary_key", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "dictionaryPage.anchorOrdinal", + "columnName": "dictionary_anchorOrdinal", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "generalBookPage.document", + "columnName": "general_book_document", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "generalBookPage.key", + "columnName": "general_book_key", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "generalBookPage.anchorOrdinal", + "columnName": "general_book_anchorOrdinal", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "mapPage.document", + "columnName": "map_document", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "mapPage.key", + "columnName": "map_key", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "mapPage.anchorOrdinal", + "columnName": "map_anchorOrdinal", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.strongsMode", + "columnName": "text_display_settings_strongsMode", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.showMorphology", + "columnName": "text_display_settings_showMorphology", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.showFootNotes", + "columnName": "text_display_settings_showFootNotes", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.expandXrefs", + "columnName": "text_display_settings_expandXrefs", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.showXrefs", + "columnName": "text_display_settings_showXrefs", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.showRedLetters", + "columnName": "text_display_settings_showRedLetters", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.showSectionTitles", + "columnName": "text_display_settings_showSectionTitles", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.showVerseNumbers", + "columnName": "text_display_settings_showVerseNumbers", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.showVersePerLine", + "columnName": "text_display_settings_showVersePerLine", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.showBookmarks", + "columnName": "text_display_settings_showBookmarks", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.showMyNotes", + "columnName": "text_display_settings_showMyNotes", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.justifyText", + "columnName": "text_display_settings_justifyText", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.hyphenation", + "columnName": "text_display_settings_hyphenation", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.topMargin", + "columnName": "text_display_settings_topMargin", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.fontSize", + "columnName": "text_display_settings_fontSize", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.fontFamily", + "columnName": "text_display_settings_fontFamily", + "affinity": "TEXT", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.lineSpacing", + "columnName": "text_display_settings_lineSpacing", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.bookmarksHideLabels", + "columnName": "text_display_settings_bookmarksHideLabels", + "affinity": "TEXT", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.showPageNumber", + "columnName": "text_display_settings_showPageNumber", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.marginSize.marginLeft", + "columnName": "text_display_settings_margin_size_marginLeft", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.marginSize.marginRight", + "columnName": "text_display_settings_margin_size_marginRight", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.marginSize.maxWidth", + "columnName": "text_display_settings_margin_size_maxWidth", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.colors.dayTextColor", + "columnName": "text_display_settings_colors_dayTextColor", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.colors.dayBackground", + "columnName": "text_display_settings_colors_dayBackground", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.colors.dayNoise", + "columnName": "text_display_settings_colors_dayNoise", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.colors.nightTextColor", + "columnName": "text_display_settings_colors_nightTextColor", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.colors.nightBackground", + "columnName": "text_display_settings_colors_nightBackground", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + }, + { + "fieldPath": "textDisplaySettings.colors.nightNoise", + "columnName": "text_display_settings_colors_nightNoise", + "affinity": "INTEGER", + "notNull": false, + "defaultValue": "NULL" + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "windowId" + ] + }, + "indices": [ + { + "name": "index_PageManager_windowId", + "unique": true, + "columnNames": [ + "windowId" + ], + "orders": [], + "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_PageManager_windowId` ON `${TABLE_NAME}` (`windowId`)" + } + ], + "foreignKeys": [ + { + "table": "Window", + "onDelete": "CASCADE", + "onUpdate": "NO ACTION", + "columns": [ + "windowId" + ], + "referencedColumns": [ + "id" + ] + } + ] + }, + { + "tableName": "LogEntry", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`tableName` TEXT NOT NULL, `entityId1` BLOB NOT NULL, `entityId2` BLOB NOT NULL, `type` TEXT NOT NULL, `lastUpdated` INTEGER NOT NULL DEFAULT 0, `sourceDevice` TEXT NOT NULL, PRIMARY KEY(`tableName`, `entityId1`, `entityId2`))", + "fields": [ + { + "fieldPath": "tableName", + "columnName": "tableName", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "entityId1", + "columnName": "entityId1", + "affinity": "BLOB", + "notNull": true + }, + { + "fieldPath": "entityId2", + "columnName": "entityId2", + "affinity": "BLOB", + "notNull": true + }, + { + "fieldPath": "type", + "columnName": "type", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "lastUpdated", + "columnName": "lastUpdated", + "affinity": "INTEGER", + "notNull": true, + "defaultValue": "0" + }, + { + "fieldPath": "sourceDevice", + "columnName": "sourceDevice", + "affinity": "TEXT", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "tableName", + "entityId1", + "entityId2" + ] + }, + "indices": [ + { + "name": "index_LogEntry_lastUpdated", + "unique": false, + "columnNames": [ + "lastUpdated" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_LogEntry_lastUpdated` ON `${TABLE_NAME}` (`lastUpdated`)" + }, + { + "name": "index_LogEntry_sourceDevice", + "unique": false, + "columnNames": [ + "sourceDevice" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_LogEntry_sourceDevice` ON `${TABLE_NAME}` (`sourceDevice`)" + } + ], + "foreignKeys": [] + }, + { + "tableName": "SyncConfiguration", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`keyName` TEXT NOT NULL, `stringValue` TEXT, `longValue` INTEGER, `booleanValue` INTEGER, PRIMARY KEY(`keyName`))", + "fields": [ + { + "fieldPath": "keyName", + "columnName": "keyName", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "stringValue", + "columnName": "stringValue", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "longValue", + "columnName": "longValue", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "booleanValue", + "columnName": "booleanValue", + "affinity": "INTEGER", + "notNull": false + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "keyName" + ] + }, + "indices": [], + "foreignKeys": [] + }, + { + "tableName": "SyncStatus", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`sourceDevice` TEXT NOT NULL, `patchNumber` INTEGER NOT NULL, `sizeBytes` INTEGER NOT NULL, `appliedDate` INTEGER NOT NULL, PRIMARY KEY(`sourceDevice`, `patchNumber`))", + "fields": [ + { + "fieldPath": "sourceDevice", + "columnName": "sourceDevice", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "patchNumber", + "columnName": "patchNumber", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "sizeBytes", + "columnName": "sizeBytes", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "appliedDate", + "columnName": "appliedDate", + "affinity": "INTEGER", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "sourceDevice", + "patchNumber" + ] + }, + "indices": [], + "foreignKeys": [] + } + ], + "views": [], + "setupQueries": [ + "CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)", + "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'aa0999529b96f6f21ce256fb56ad141c')" + ] + } +} \ No newline at end of file diff --git a/app/src/main/java/net/bible/android/database/WorkspaceEntities.kt b/app/src/main/java/net/bible/android/database/WorkspaceEntities.kt index a1a6e18c78..f652e76a34 100644 --- a/app/src/main/java/net/bible/android/database/WorkspaceEntities.kt +++ b/app/src/main/java/net/bible/android/database/WorkspaceEntities.kt @@ -164,6 +164,7 @@ class WorkspaceEntities { @ColumnInfo(defaultValue = "NULL") var fontFamily: String? = null, @ColumnInfo(defaultValue = "NULL") var lineSpacing: Int? = null, @ColumnInfo(defaultValue = "NULL") var bookmarksHideLabels: List? = null, + @ColumnInfo(defaultValue = "NULL") var showPageNumber: Boolean? = null, ) { enum class Types { FONTSIZE, @@ -186,6 +187,7 @@ class WorkspaceEntities { BOOKMARKS_SHOW, BOOKMARKS_HIDELABELS, MYNOTES, + PAGENUMBER, } fun getValue(type: Types): Any? = when(type) { @@ -209,6 +211,7 @@ class WorkspaceEntities { Types.FONTFAMILY -> fontFamily Types.BOOKMARKS_SHOW -> showBookmarks Types.BOOKMARKS_HIDELABELS -> bookmarksHideLabels + Types.PAGENUMBER -> showPageNumber } fun setValue(type: Types, value: Any?) { @@ -233,6 +236,7 @@ class WorkspaceEntities { Types.LINE_SPACING -> lineSpacing = value as Int? Types.BOOKMARKS_SHOW -> showBookmarks = value as Boolean? Types.BOOKMARKS_HIDELABELS -> bookmarksHideLabels = value as List? + Types.PAGENUMBER -> showPageNumber = value as Boolean? } } @@ -289,6 +293,7 @@ class WorkspaceEntities { lineSpacing = 16, showBookmarks = true, bookmarksHideLabels = emptyList(), + showPageNumber = false ) fun actual(pageManagerEntity: PageManager?, workspaceEntity: Workspace?): TextDisplaySettings { diff --git a/app/src/main/java/net/bible/android/database/migrations/WorkspacesMigrations.kt b/app/src/main/java/net/bible/android/database/migrations/WorkspacesMigrations.kt index 67b9c4a15a..3ebf683a04 100644 --- a/app/src/main/java/net/bible/android/database/migrations/WorkspacesMigrations.kt +++ b/app/src/main/java/net/bible/android/database/migrations/WorkspacesMigrations.kt @@ -25,9 +25,15 @@ private val removeFavouriteLabels = makeMigration(2..3) { _db -> _db.execSQL("ALTER TABLE Workspace DROP COLUMN workspace_settings_favouriteLabels") } +private val addPageNumber = makeMigration(3..4) { _db -> + _db.execSQL("ALTER TABLE `Workspace` ADD COLUMN `text_display_settings_showPageNumber` INTEGER DEFAULT NULL") + _db.execSQL("ALTER TABLE `PageManager` ADD COLUMN `text_display_settings_showPageNumber` INTEGER DEFAULT NULL") +} + val workspacesMigrations: Array = arrayOf( resetMaximizedWindowId, removeFavouriteLabels, + addPageNumber ) -const val WORKSPACE_DATABASE_VERSION = 3 +const val WORKSPACE_DATABASE_VERSION = 4 diff --git a/app/src/main/java/net/bible/android/view/activity/page/OptionsMenuItems.kt b/app/src/main/java/net/bible/android/view/activity/page/OptionsMenuItems.kt index c98b650541..519fd7d2cd 100644 --- a/app/src/main/java/net/bible/android/view/activity/page/OptionsMenuItems.kt +++ b/app/src/main/java/net/bible/android/view/activity/page/OptionsMenuItems.kt @@ -210,6 +210,7 @@ open class Preference(val settings: SettingsBundle, TextDisplaySettings.Types.LINE_SPACING -> R.string.line_spacing_title TextDisplaySettings.Types.BOOKMARKS_SHOW -> R.string.prefs_show_bookmarks_title TextDisplaySettings.Types.BOOKMARKS_HIDELABELS -> R.string.bookmark_settings_hide_labels_title + TextDisplaySettings.Types.PAGENUMBER -> R.string.page_number_title } return application.getString(id) } diff --git a/app/src/main/java/net/bible/android/view/activity/settings/TextDisplaySettings.kt b/app/src/main/java/net/bible/android/view/activity/settings/TextDisplaySettings.kt index 03401982f1..08d9ede653 100644 --- a/app/src/main/java/net/bible/android/view/activity/settings/TextDisplaySettings.kt +++ b/app/src/main/java/net/bible/android/view/activity/settings/TextDisplaySettings.kt @@ -126,6 +126,7 @@ fun getPrefItem(settings: SettingsBundle, type: Types): OptionsMenuItemInterface Types.TOPMARGIN -> TopMarginPreference(settings) Types.LINE_SPACING -> LineSpacingPreference(settings) Types.BOOKMARKS_HIDELABELS -> HideLabelsPreference(settings, Types.BOOKMARKS_HIDELABELS) + Types.PAGENUMBER -> ItemPreference(settings, Types.PAGENUMBER) } class TextDisplaySettingsFragment: PreferenceFragmentCompat() { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 23d9b3cc8c..2431f1887a 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1246,4 +1246,6 @@ Chapter Page Disabled + Relative page number + Show page number overlay. Page number is relative to the starting position. diff --git a/app/src/main/res/xml/text_display_settings.xml b/app/src/main/res/xml/text_display_settings.xml index 3f1178a8cc..fab54bca87 100644 --- a/app/src/main/res/xml/text_display_settings.xml +++ b/app/src/main/res/xml/text_display_settings.xml @@ -123,6 +123,11 @@ android:title="@string/prefs_hyphenation_title" android:summary="@string/prefs_hyphenation_summary" /> +