From ccd082d66307c39b31b6f44ef97db5c0fe272c23 Mon Sep 17 00:00:00 2001 From: Hrishikesh Kadam Date: Tue, 13 Nov 2018 20:55:05 +0530 Subject: [PATCH] Prepare version 0.5.2 Last Read Locator Search Locator --- KNOWN_ISSUES.md | 9 ++- README.md | 68 ++++++------------- build.gradle | 8 +-- folioreader/AndroidManifest.xml | 3 +- folioreader/build.gradle | 2 +- .../res/xml/network_security_config.xml | 0 .../com/folioreader/loaders/SearchLoader.kt | 3 - .../ui/folio/activity/FolioActivity.kt | 13 ++-- .../folioreader/android/ExampleUnitTest.kt | 18 ----- sample/build.gradle | 4 +- sample/src/main/AndroidManifest.xml | 1 - 11 files changed, 44 insertions(+), 85 deletions(-) rename {sample/src/main => folioreader}/res/xml/network_security_config.xml (100%) diff --git a/KNOWN_ISSUES.md b/KNOWN_ISSUES.md index d190e7263..4e711890b 100644 --- a/KNOWN_ISSUES.md +++ b/KNOWN_ISSUES.md @@ -3,6 +3,13 @@ This is a list of major known issues. For the latest list of all issues see the [Github Issues page](https://github.com/FolioReader/FolioReader-Android/issues) +## Media Overlay + +From version 0.5.1, Media Overlay would not work as the streamer implementation is not done yet in r2-streamer-kotlin. + ## TTS -From version 5.0.2, TTS is disabled temporarily till the fix is complete. \ No newline at end of file +From version 0.5.2, TTS is disabled. +In previous versions, sentences were formed by changing the DOM structure. +To implement TTS without changing DOM would require NLP to extract sentences. +As of now, no major reading systems other than Google Play Books implements TTS bug free. \ No newline at end of file diff --git a/README.md b/README.md index b0009cd6b..ba630ef4d 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![Build Status](https://api.travis-ci.org/FolioReader/FolioReader-Android.svg?branch=master)](https://travis-ci.org/FolioReader/FolioReader-Android) -FolioReader-Android is an ePub reader written in Java. +FolioReader-Android is an ePub reader written in Java and Kotlin. ### Features @@ -13,17 +13,17 @@ FolioReader-Android is an ePub reader written in Java. - [x] List / Edit / Delete Highlights - [x] Handle Internal and External Links - [x] Portrait / Landscape -- [x] Reading Time Left / Pages left +- [ ] Reading Time Left / Pages left - [x] In-App Dictionary -- [x] Media Overlays (Sync text rendering with audio playback) -- [x] TTS - Text to Speech Support +- [ ] Media Overlays (Sync text rendering with audio playback) +- [ ] TTS - Text to Speech Support - [ ] Parse epub cover image - [ ] PDF support - [x] Book Search - [x] Add Notes to a Highlight - [ ] Better Documentation -- [x] Last Read Position Listener -- [x] Horizontal reading +- [x] Last Read Locator +- [x] Horizontal Reading - [x] Distraction Free Reading ## Demo @@ -31,9 +31,9 @@ FolioReader-Android is an ePub reader written in Java. ![Custom fonts](https://cloud.githubusercontent.com/assets/1277242/19012915/0661c7b2-87e0-11e6-81d6-8c71051e1074.gif) ##### Day and Night Mode ![Day night mode](https://cloud.githubusercontent.com/assets/1277242/19012914/f42059c4-87df-11e6-97f8-29e61a79e8aa.gif) -##### Text Highlighting +##### Text Highlighting ![Highlight](https://cloud.githubusercontent.com/assets/1277242/19012904/c2700c3a-87df-11e6-97ed-507765b3ddf0.gif) -##### Media Overlays +##### Media Overlays ![Media Overlay](https://cloud.githubusercontent.com/assets/1277242/19012908/d61f3ce2-87df-11e6-8652-d72b6a1ad9a3.gif) ### Gradle @@ -44,7 +44,7 @@ Add following dependency to your root project `build.gradle` file: allprojects { repositories { ... - maven { url "https://dl.bintray.com/mobisystech/maven" } + jcenter() maven { url "https://jitpack.io" } ... } @@ -56,39 +56,14 @@ Add following dependency to your app module `build.gradle` file: ```groovy dependencies { ... - implementation "com.folioreader:folioreader:0.5.1" + implementation "com.folioreader:folioreader:0.5.2" ... } ``` +### Enable Multidex support -### AndroidManifest - -Starting with Android 9.0 (API level 28), cleartext support is disabled by default. - -{your-app-module}/res/xml/network_security_config.xml - -```xml - - - - 127.0.0.1 - localhost - - -``` - -Then add network_security_config.xml in your app module's AndroidManifest.xml - -```xml - - - ... - - ... - - -``` +Enable Multidex support as explained in this [Android Doc](https://developer.android.com/studio/build/multidex) ### Usage @@ -100,22 +75,17 @@ FolioReader folioReader = FolioReader.get(); Call the function `openBook()`: -##### opening book from assets - +##### opening book from assets - ```java folioReader.openBook("file:///android_asset/TheSilverChair.epub"); ``` -##### opening book from raw - +##### opening book from raw - ```java folioReader.openBook(R.raw.adventures); ``` -
- -**Note: From v0.4.1 you don't need to specify permissions and `FolioActivity` tag in AndroidManifest.xml** - -
## WIKI @@ -126,21 +96,21 @@ folioReader.openBook(R.raw.adventures); * [Highlight Action](https://github.com/FolioReader/FolioReader-Android/wiki/Highlight-Action) * [Highlight Event](https://github.com/FolioReader/FolioReader-Android/wiki/Highlight-Event) * [Providing External Highlight](https://github.com/FolioReader/FolioReader-Android/wiki/Providing-External-Highlight) -* [ReadPosition](https://github.com/FolioReader/FolioReader-Android/wiki/ReadPosition) - * [Get ReadPosition](https://github.com/FolioReader/FolioReader-Android/wiki/Get-ReadPosition) - * [Set ReadPosition](https://github.com/FolioReader/FolioReader-Android/wiki/Set-ReadPosition) +* [ReadLocator](https://github.com/FolioReader/FolioReader-Android/wiki/ReadLocator) + * [Get ReadLocator](https://github.com/FolioReader/FolioReader-Android/wiki/Get-ReadLocator) + * [Set ReadLocator](https://github.com/FolioReader/FolioReader-Android/wiki/Set-ReadLocator) * [Clean up code](https://github.com/FolioReader/FolioReader-Android/wiki/Clean-up-code) ## Reporting Issue -Please follow [Issue Template](https://github.com/FolioReader/FolioReader-Android/blob/master/.github/ISSUE_TEMPLATE.md) to report any issue. +Please follow [Issue Template](https://github.com/FolioReader/FolioReader-Android/blob/master/.github/ISSUE_TEMPLATE.md) to report any issue. ## Share your application If you are using FolioReader in your application, share your application link in [this issue](https://github.com/FolioReader/FolioReader-Android/issues/291) ### Credits 1. SwipeLayout -2. r2-streamer-java +2. r2-streamer-kotlin 3. Pearson Dictionaries 4. rangy diff --git a/build.gradle b/build.gradle index f98c79ab9..e0e50a52a 100644 --- a/build.gradle +++ b/build.gradle @@ -37,14 +37,14 @@ allprojects { } ext { - folioreaderSdkVersion = "0.5.1" - r2StreamerKotlinVersion = "1.0.3-6.dev" - r2SharedKotlinVersion = "1.0.3-3.dev" + folioreaderSdkVersion = "0.5.2" + r2StreamerKotlinVersion = "1.0.3-7" + r2SharedKotlinVersion = "1.0.3-4" projectVersionCode = 1 projectVersionName = "1.0" - androidMinSdkVersion = 19 + androidMinSdkVersion = 21 androidCompileSdkVersion = 28 androidTargetSdkVersion = 28 androidSupportLibVersion = "28.0.0" diff --git a/folioreader/AndroidManifest.xml b/folioreader/AndroidManifest.xml index b9ac4d38f..5402a08e4 100644 --- a/folioreader/AndroidManifest.xml +++ b/folioreader/AndroidManifest.xml @@ -10,11 +10,12 @@ { //Thread.sleep(6000) - /*val objectMapper = ObjectMapper() - objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) - locatorList = objectMapper.readValue(stringBuilder.toString())*/ val locatorType = object : TypeToken>() {}.type locatorList = Gson().fromJson(stringBuilder.toString(), locatorType) Log.d(LOG_TAG, "-> loadInBackground -> " + stringBuilder.toString()) diff --git a/folioreader/src/main/java/com/folioreader/ui/folio/activity/FolioActivity.kt b/folioreader/src/main/java/com/folioreader/ui/folio/activity/FolioActivity.kt index eb90a2f7f..3f42094cb 100644 --- a/folioreader/src/main/java/com/folioreader/ui/folio/activity/FolioActivity.kt +++ b/folioreader/src/main/java/com/folioreader/ui/folio/activity/FolioActivity.kt @@ -461,6 +461,9 @@ class FolioActivity : AppCompatActivity(), FolioActivityCallback, MediaControlle val cbzParser = CbzParser() cbzParser.parse(path!!, "") } + else -> { + null + } } val portNumber = intent.getIntExtra(Config.INTENT_PORT, Constants.PORT_NUMBER) @@ -470,11 +473,11 @@ class FolioActivity : AppCompatActivity(), FolioActivityCallback, MediaControlle r2StreamerServer!!.start() } - fun onBookInitFailure() { + private fun onBookInitFailure() { //TODO -> Fail gracefully } - fun onBookInitSuccess() { + private fun onBookInitSuccess() { val publication = pubBox!!.publication spine = publication.spine @@ -525,7 +528,7 @@ class FolioActivity : AppCompatActivity(), FolioActivityCallback, MediaControlle } } - fun initDistractionFreeMode(savedInstanceState: Bundle?) { + private fun initDistractionFreeMode(savedInstanceState: Bundle?) { Log.v(LOG_TAG, "-> initDistractionFreeMode") window.decorView.setOnSystemUiVisibilityChangeListener(this) @@ -673,7 +676,7 @@ class FolioActivity : AppCompatActivity(), FolioActivityCallback, MediaControlle } } - fun showSystemUI() { + private fun showSystemUI() { Log.v(LOG_TAG, "-> showSystemUI") if (Build.VERSION.SDK_INT >= 16) { @@ -689,7 +692,7 @@ class FolioActivity : AppCompatActivity(), FolioActivityCallback, MediaControlle } } - fun hideSystemUI() { + private fun hideSystemUI() { Log.v(LOG_TAG, "-> hideSystemUI") if (Build.VERSION.SDK_INT >= 16) { diff --git a/folioreader/src/test/java/com/folioreader/android/ExampleUnitTest.kt b/folioreader/src/test/java/com/folioreader/android/ExampleUnitTest.kt index 21b401854..09a7afded 100644 --- a/folioreader/src/test/java/com/folioreader/android/ExampleUnitTest.kt +++ b/folioreader/src/test/java/com/folioreader/android/ExampleUnitTest.kt @@ -2,8 +2,6 @@ package com.folioreader.android import org.junit.Assert.assertEquals import org.junit.Test -import org.readium.r2.shared.Locations -import org.readium.r2.shared.Locator /** * Example local unit test, which will execute on the development machine (host). @@ -16,20 +14,4 @@ class ExampleUnitTest { fun addition_isCorrect() { assertEquals(4, (2 + 2).toLong()) } - - @Test - fun testNullability() { - - var locator = Locator("", 0, "", Locations(), null) - - //var string: String = locator.text?.before + locator.text?.hightlight + locator.text?.after - - var string: String = StringBuilder() - .append(locator.text?.before) - .append(locator.text?.hightlight ?: "") - .append(locator.text?.after ?: "") - .toString() - - println(string) - } } \ No newline at end of file diff --git a/sample/build.gradle b/sample/build.gradle index f09a4956f..3086d57c0 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -56,6 +56,8 @@ dependencies { androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' + implementation 'com.android.support:multidex:1.0.3' + implementation project(':folioreader') //implementation "com.folioreader:folioreader:$folioreaderSdkVersion" @@ -63,6 +65,4 @@ dependencies { implementation "com.fasterxml.jackson.core:jackson-annotations:$jacksonVersion" implementation "com.fasterxml.jackson.core:jackson-databind:$jacksonVersion" implementation "com.fasterxml.jackson.module:jackson-module-kotlin:$jacksonVersion" - - implementation 'com.android.support:multidex:1.0.3' } diff --git a/sample/src/main/AndroidManifest.xml b/sample/src/main/AndroidManifest.xml index 69d76eb05..e3a83f276 100644 --- a/sample/src/main/AndroidManifest.xml +++ b/sample/src/main/AndroidManifest.xml @@ -8,7 +8,6 @@ android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:largeHeap="true" - android:networkSecurityConfig="@xml/network_security_config" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme">