From eba6cc905d7d3338970507bc92aff1837be2f4ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mickae=CC=88l=20Menu?= Date: Fri, 22 May 2020 19:03:58 +0200 Subject: [PATCH 1/2] Add new accessible fonts from Readium CSS --- .../src/main/java/org/readium/r2/testapp/epub/UserSettings.kt | 2 +- r2-testapp/src/main/res/values/strings.xml | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/r2-testapp/src/main/java/org/readium/r2/testapp/epub/UserSettings.kt b/r2-testapp/src/main/java/org/readium/r2/testapp/epub/UserSettings.kt index 29dcfafc..7c06f4eb 100644 --- a/r2-testapp/src/main/java/org/readium/r2/testapp/epub/UserSettings.kt +++ b/r2-testapp/src/main/java/org/readium/r2/testapp/epub/UserSettings.kt @@ -35,7 +35,7 @@ class UserSettings(var preferences: SharedPreferences, val context: Context, pri lateinit var resourcePager: R2ViewPager private val appearanceValues = listOf("readium-default-on", "readium-sepia-on", "readium-night-on") - private val fontFamilyValues = listOf("Original", "PT Serif", "Roboto", "Source Sans Pro", "Vollkorn", "OpenDyslexic") + private val fontFamilyValues = listOf("Original", "PT Serif", "Roboto", "Source Sans Pro", "Vollkorn", "OpenDyslexic", "AccessibleDfA", "IA Writer Duospace") private val textAlignmentValues = listOf("justify", "start") private val columnCountValues = listOf("auto", "1", "2") diff --git a/r2-testapp/src/main/res/values/strings.xml b/r2-testapp/src/main/res/values/strings.xml index 690b3f6b..4b2ccdc0 100644 --- a/r2-testapp/src/main/res/values/strings.xml +++ b/r2-testapp/src/main/res/values/strings.xml @@ -142,6 +142,8 @@ Source Sans Pro Vollkorn OpenDyslexic + AccessibleDfA + IA Writer Duospace From 1e654d1f784261868cb4306ba2701fbf25c6e827 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mickae=CC=88l=20Menu?= Date: Mon, 25 May 2020 15:14:14 +0200 Subject: [PATCH 2/2] Simplify serving resources from the Server Use a fixed 8080 HTTP port in DEBUG mode to help development --- .../readium/r2/testapp/library/LibraryActivity.kt | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/r2-testapp/src/main/java/org/readium/r2/testapp/library/LibraryActivity.kt b/r2-testapp/src/main/java/org/readium/r2/testapp/library/LibraryActivity.kt index f3501b54..f8a0617e 100644 --- a/r2-testapp/src/main/java/org/readium/r2/testapp/library/LibraryActivity.kt +++ b/r2-testapp/src/main/java/org/readium/r2/testapp/library/LibraryActivity.kt @@ -133,12 +133,12 @@ open class LibraryActivity : AppCompatActivity(), BooksAdapter.RecyclerViewClick preferences = getSharedPreferences("org.readium.r2.settings", Context.MODE_PRIVATE) - val s = ServerSocket(0) + val s = ServerSocket(if (DEBUG) 8080 else 0) s.localPort s.close() localPort = s.localPort - server = Server(localPort) + server = Server(localPort, applicationContext) val properties = Properties() val inputStream = this.assets.open("configs/config.properties") @@ -642,12 +642,6 @@ open class LibraryActivity : AppCompatActivity(), BooksAdapter.RecyclerViewClick if (DEBUG) Timber.e(e) } if (server.isAlive) { - - // Add Resources from R2Navigator - server.loadReadiumCSSResources(assets) - server.loadR2ScriptResources(assets) - server.loadR2FontResources(assets, applicationContext) - // // Add your own resources here // server.loadCustomResource(assets.open("scripts/test.js"), "test.js") // server.loadCustomResource(assets.open("styles/test.css"), "test.css") @@ -656,8 +650,6 @@ open class LibraryActivity : AppCompatActivity(), BooksAdapter.RecyclerViewClick server.loadCustomResource(assets.open("Search/mark.js"), "mark.js", Injectable.Script) server.loadCustomResource(assets.open("Search/search.js"), "search.js", Injectable.Script) server.loadCustomResource(assets.open("Search/mark.css"), "mark.css", Injectable.Style) - server.loadCustomResource(assets.open("scripts/crypto-sha256.js"), "crypto-sha256.js", Injectable.Script) - server.loadCustomResource(assets.open("scripts/highlight.js"), "highlight.js", Injectable.Script) isServerStarted = true }