Skip to content

Commit 4cc7715

Browse files
Integrate local repo of modified r2-streamer-kotlin
1 parent 01d3994 commit 4cc7715

35 files changed

+517
-478
lines changed

.gitignore

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/workspace.xml
5+
/.idea/libraries
6+
.DS_Store
7+
/build
8+
/captures
9+
.externalNativeBuild
10+
111
# Custom
212
_site
313

@@ -37,4 +47,7 @@ out
3747
# Maven
3848
target
3949
release.properties
40-
pom.xml.*
50+
pom.xml.*
51+
52+
# Readium DRM LCP
53+
liblcp.aar

build.gradle

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ allprojects {
2424
repositories {
2525
google()
2626
jcenter()
27+
maven { url 'https://jitpack.io' }
28+
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
2729
}
2830
}
2931

@@ -40,6 +42,12 @@ ext {
4042
ANDROID_LIB_VERSION = '28.0.0-rc01'
4143

4244
CONSTRAINT_LAYOUT_VERSION = "1.1.3"
45+
46+
JACKSON_VERSION = '2.8.6'
47+
48+
//r2 local project implementation variables
49+
kotlin_version = '1.2.61'
50+
support_version = '27.1.1'
4351
}
4452

4553
task clean(type: Delete) {

folioreader/build.gradle

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ android {
7272

7373
lintOptions {
7474
abortOnError false
75+
disable 'LogNotTimber', 'StringFormatInTimber', 'ThrowableNotAtBeginning',
76+
'BinaryOperationInTimber', 'TimberArgCount', 'TimberArgTypes', 'TimberTagLength'
7577
}
7678

7779
checkstyle {
@@ -96,16 +98,37 @@ dependencies {
9698
implementation "com.android.support:support-v4:$ANDROID_LIB_VERSION"
9799
implementation "com.android.support:design:$ANDROID_LIB_VERSION"
98100

101+
implementation 'org.slf4j:slf4j-android:1.7.25'
99102
implementation 'com.daimajia.swipelayout:library:1.2.0@aar'
100103

101104
//Kotlin
102105
implementation "org.jetbrains.kotlin:kotlin-stdlib:$KOTLIN_VERSION"
103106

104107
// r2-streamer
105-
api "org.readium:r2-fetcher:$R2_STREAMER_VERSION"
106-
api "org.readium:r2-parser:$R2_STREAMER_VERSION"
107-
api "org.readium:r2-server:$R2_STREAMER_VERSION"
108+
// api "org.readium:r2-fetcher:$R2_STREAMER_VERSION"
109+
// api "org.readium:r2-parser:$R2_STREAMER_VERSION"
110+
// api "org.readium:r2-server:$R2_STREAMER_VERSION"
108111

109112
implementation 'org.greenrobot:eventbus:3.1.1'
113+
114+
implementation "com.fasterxml.jackson.core:jackson-core:$JACKSON_VERSION"
115+
implementation "com.fasterxml.jackson.core:jackson-annotations:$JACKSON_VERSION"
116+
implementation "com.fasterxml.jackson.core:jackson-databind:$JACKSON_VERSION"
117+
118+
// implementation 'com.github.readium:r2-shared-kotlin:develop-SNAPSHOT'
119+
// implementation 'com.github.readium:r2-streamer-kotlin:develop-SNAPSHOT'
120+
121+
// implementation 'com.github.readium:r2-shared-kotlin:1.0.3'
122+
implementation project(":r2-shared-local")
123+
// implementation('com.github.readium:r2-streamer-kotlin:1.0.3') {
124+
// exclude group: "org.slf4j", module: "slf4j-api"
125+
// }
126+
api(project(':r2-streamer-kotlin-local')) {
127+
exclude group: "org.slf4j", module: "slf4j-api"
128+
}
129+
130+
// required for local implementation of r2-streamer-kotlin
131+
implementation 'org.nanohttpd:nanohttpd:2.3.2-SNAPSHOT'
132+
implementation 'org.nanohttpd:nanohttpd-nanolets:2.3.2-SNAPSHOT'
110133
}
111134
apply from: '../folioreader/bintray/bintrayv1.gradle'
-216 KB
Binary file not shown.
-28.1 KB
Binary file not shown.

folioreader/src/main/java/com/folioreader/Constants.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* Created by mobisys on 10/4/2016.
77
*/
88
public class Constants {
9+
public static final String PUBLICATION = "PUBLICATION";
910
public static final String SELECTED_CHAPTER_POSITION = "selected_chapter_position";
1011
public static final String TYPE = "type";
1112
public static final String CHAPTER_SELECTED = "chapter_selected";

folioreader/src/main/java/com/folioreader/loaders/SearchLoader.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ import com.fasterxml.jackson.databind.DeserializationFeature
1010
import com.fasterxml.jackson.databind.ObjectMapper
1111
import com.folioreader.model.search.SearchItem
1212
import com.folioreader.model.search.SearchItemType
13+
import com.folioreader.r2_streamer_java.SearchQueryResults
1314
import com.folioreader.ui.folio.activity.SearchActivity
1415
import com.folioreader.ui.folio.adapter.ListViewType
1516
import com.folioreader.ui.folio.adapter.SearchAdapter
1617
import com.folioreader.util.AppUtil
17-
import org.readium.r2_streamer.model.searcher.SearchQueryResults
1818
import java.io.BufferedReader
1919
import java.io.InputStream
2020
import java.io.InputStreamReader

folioreader/src/main/java/com/folioreader/model/ReadPosition.java

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import com.folioreader.FolioReader;
66
import com.folioreader.ui.folio.activity.FolioActivity;
77

8-
import org.readium.r2_streamer.model.publication.EpubPublication;
8+
import org.readium.r2.shared.Publication;
99

1010
/**
1111
* Interface contract for last read position
@@ -16,25 +16,15 @@ public interface ReadPosition extends Parcelable {
1616

1717
/**
1818
* Returns the bookId if sent in {@link FolioReader}'s openBook() else logic defined in
19-
* {@link FolioActivity#onLoadPublication(EpubPublication)} will return the bookId.
19+
* {@link FolioActivity#onBookInitSuccess()} will return the bookId.
2020
*/
2121
String getBookId();
2222

23-
/**
24-
* Returns the idref of the spine item.
25-
*/
26-
String getChapterId();
27-
2823
/**
2924
* Returns the href of the manifest item.
3025
*/
3126
String getChapterHref();
3227

33-
/**
34-
* Returns the chapter index from spine tag
35-
*/
36-
int getChapterIndex();
37-
3828
/**
3929
* Returns true if span tag has id
4030
*/

folioreader/src/main/java/com/folioreader/model/ReadPositionImpl.java

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import android.os.Parcelable;
55
import android.util.Log;
66

7+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
78
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
89
import com.fasterxml.jackson.core.JsonProcessingException;
910
import com.fasterxml.jackson.databind.ObjectWriter;
@@ -14,7 +15,8 @@
1415
/**
1516
* Created by Hrishikesh Kadam on 20/04/2018.
1617
*/
17-
@JsonPropertyOrder({"bookId", "chapterId", "chapterHref", "chapterIndex", "usingId", "value"})
18+
@JsonPropertyOrder({"bookId", "chapterHref", "usingId", "value"})
19+
@JsonIgnoreProperties(ignoreUnknown = true)
1820
public class ReadPositionImpl implements ReadPosition, Parcelable {
1921

2022
public static final Creator<ReadPositionImpl> CREATOR = new Creator<ReadPositionImpl>() {
@@ -31,21 +33,16 @@ public ReadPositionImpl[] newArray(int size) {
3133

3234
private static final String LOG_TAG = ReadPositionImpl.class.getSimpleName();
3335
private String bookId;
34-
private String chapterId;
3536
private String chapterHref;
36-
private int chapterIndex = -1;
3737
private boolean usingId;
3838
private String value;
3939

4040
public ReadPositionImpl() {
4141
}
4242

43-
public ReadPositionImpl(String bookId, String chapterId, String chapterHref, int chapterIndex,
44-
boolean usingId, String value) {
43+
public ReadPositionImpl(String bookId, String chapterHref, boolean usingId, String value) {
4544
this.bookId = bookId;
46-
this.chapterId = chapterId;
4745
this.chapterHref = chapterHref;
48-
this.chapterIndex = chapterIndex;
4946
this.usingId = usingId;
5047
this.value = value;
5148
}
@@ -66,19 +63,15 @@ public static ReadPosition createInstance(String jsonString) {
6663

6764
protected ReadPositionImpl(Parcel in) {
6865
bookId = in.readString();
69-
chapterId = in.readString();
7066
chapterHref = in.readString();
71-
chapterIndex = in.readInt();
7267
usingId = in.readByte() != 0;
7368
value = in.readString();
7469
}
7570

7671
@Override
7772
public void writeToParcel(Parcel dest, int flags) {
7873
dest.writeString(bookId);
79-
dest.writeString(chapterId);
8074
dest.writeString(chapterHref);
81-
dest.writeInt(chapterIndex);
8275
dest.writeByte((byte) (usingId ? 1 : 0));
8376
dest.writeString(value);
8477
}
@@ -92,24 +85,6 @@ public void setBookId(String bookId) {
9285
this.bookId = bookId;
9386
}
9487

95-
@Override
96-
public String getChapterId() {
97-
return chapterId;
98-
}
99-
100-
public void setChapterId(String chapterId) {
101-
this.chapterId = chapterId;
102-
}
103-
104-
@Override
105-
public int getChapterIndex() {
106-
return chapterIndex;
107-
}
108-
109-
public void setChapterIndex(int chapterIndex) {
110-
this.chapterIndex = chapterIndex;
111-
}
112-
11388
@Override
11489
public String getChapterHref() {
11590
return chapterHref;

folioreader/src/main/java/com/folioreader/model/TOCLinkWrapper.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import com.folioreader.util.MultiLevelExpIndListAdapter;
44

5-
import org.readium.r2_streamer.model.tableofcontents.TOCLink;
5+
import org.readium.r2.shared.Link;
66

77
import java.util.ArrayList;
88
import java.util.List;
@@ -11,18 +11,18 @@
1111
* Created by Mahavir on 3/10/17.
1212
*/
1313

14-
public class TOCLinkWrapper implements MultiLevelExpIndListAdapter.ExpIndData{
15-
private TOCLink tocLink;
14+
public class TOCLinkWrapper implements MultiLevelExpIndListAdapter.ExpIndData {
15+
private Link tocLink;
1616
private int indentation;
1717
private ArrayList<TOCLinkWrapper> tocLinkWrappers;
1818
private boolean mIsGroup;
1919
private int mGroupSize;
2020

21-
public TOCLinkWrapper(TOCLink tocLink, int indentation) {
21+
public TOCLinkWrapper(Link tocLink, int indentation) {
2222
this.tocLink = tocLink;
2323
this.indentation = indentation;
2424
this.tocLinkWrappers = new ArrayList<>();
25-
this.mIsGroup = (tocLink.getTocLinks()!=null && tocLink.getTocLinks().size()>0);
25+
this.mIsGroup = (tocLink.getChildren().size() > 0);
2626
}
2727

2828
@Override
@@ -44,11 +44,11 @@ public void setIndentation(int indentation) {
4444
this.indentation = indentation;
4545
}
4646

47-
public TOCLink getTocLink() {
47+
public Link getTocLink() {
4848
return tocLink;
4949
}
5050

51-
public void setTocLink(TOCLink tocLink) {
51+
public void setTocLink(Link tocLink) {
5252
this.tocLink = tocLink;
5353
}
5454

0 commit comments

Comments
 (0)