Skip to content

Commit a87ec6c

Browse files
author
Mahavir Jain
authored
Merge pull request #32 from codetoart/master
cannot modify text epubs fixed
2 parents 71ef6ca + 532e5b4 commit a87ec6c

File tree

6 files changed

+7
-4
lines changed

6 files changed

+7
-4
lines changed

folioreader/src/main/java/com/folioreader/activity/FolioActivity.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import android.os.Handler;
2626
import android.support.v4.app.Fragment;
2727
import android.support.v7.app.AppCompatActivity;
28-
import android.support.v7.widget.RecyclerView;
2928
import android.support.v7.widget.Toolbar;
3029
import android.view.View;
3130
import android.view.animation.LinearInterpolator;
@@ -239,7 +238,10 @@ public void onConfigChange() {
239238
((FolioPageFragment) page).reload();
240239
if (position < mSpineReferences.size()) {
241240
page = getFragment(position + 1);
242-
((FolioPageFragment) page).reload();
241+
if(page!=null) {
242+
((FolioPageFragment) page).reload();
243+
}
244+
243245
}
244246
}
245247

folioreader/src/main/java/com/folioreader/fragments/FolioPageFragment.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -607,14 +607,15 @@ private String getHtmlContent(String htmlContent) {
607607
ArrayList<Highlight> highlights =
608608
(ArrayList<Highlight>) HighlightTable.getAllHighlight(getActivity().
609609
getApplication(), mBook.getTitle(), mPosition);
610+
610611
for (Highlight highlight : highlights) {
611612
String highlightStr =
612613
"<highlight id=\"" + highlight.getHighlightId() +
613614
"\" onclick=\"callHighlightURL(this);\" class=\"" +
614615
highlight.getType() + "\">" + highlight.getContent() + "</highlight>";
615616
String searchStr = highlight.getContentPre() +
616617
"" + highlight.getContent() + "" + highlight.getContentPost();
617-
htmlContent = htmlContent.replace(searchStr, highlightStr);
618+
htmlContent = htmlContent.replaceFirst(searchStr, highlightStr);
618619
}
619620
return htmlContent;
620621
}

sample/res/raw/nuevounitled.epub

149 KB
Binary file not shown.
34.9 KB
Binary file not shown.
214 KB
Binary file not shown.

sample/src/main/java/comfolioreader/android/sample/HomeActivity.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public void onClick(View v) {
4949
if (ContextCompat.checkSelfPermission(HomeActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
5050
ActivityCompat.requestPermissions(HomeActivity.this, WRITE_EXTERNAL_STORAGE_PERMS, GALLERY_REQUEST);
5151
} else {
52-
openEpub(FolioActivity.EpubSourceType.ASSESTS,"nuevounitled.epub",0);
52+
openEpub(FolioActivity.EpubSourceType.ASSESTS,"1rosecsem1.epub",0);
5353
}
5454
}
5555
});

0 commit comments

Comments
 (0)