Skip to content

Commit

Permalink
Merge pull request #32 from codetoart/master
Browse files Browse the repository at this point in the history
cannot modify text epubs fixed
  • Loading branch information
Mahavir Jain committed Oct 26, 2016
2 parents 71ef6ca + 532e5b4 commit a87ec6c
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 4 deletions.
Expand Up @@ -25,7 +25,6 @@
import android.os.Handler;
import android.support.v4.app.Fragment;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.animation.LinearInterpolator;
Expand Down Expand Up @@ -239,7 +238,10 @@ public void onConfigChange() {
((FolioPageFragment) page).reload();
if (position < mSpineReferences.size()) {
page = getFragment(position + 1);
((FolioPageFragment) page).reload();
if(page!=null) {
((FolioPageFragment) page).reload();
}

}
}

Expand Down
Expand Up @@ -607,14 +607,15 @@ private String getHtmlContent(String htmlContent) {
ArrayList<Highlight> highlights =
(ArrayList<Highlight>) HighlightTable.getAllHighlight(getActivity().
getApplication(), mBook.getTitle(), mPosition);

for (Highlight highlight : highlights) {
String highlightStr =
"<highlight id=\"" + highlight.getHighlightId() +
"\" onclick=\"callHighlightURL(this);\" class=\"" +
highlight.getType() + "\">" + highlight.getContent() + "</highlight>";
String searchStr = highlight.getContentPre() +
"" + highlight.getContent() + "" + highlight.getContentPost();
htmlContent = htmlContent.replace(searchStr, highlightStr);
htmlContent = htmlContent.replaceFirst(searchStr, highlightStr);
}
return htmlContent;
}
Expand Down
Binary file added sample/res/raw/nuevounitled.epub
Binary file not shown.
Binary file added sample/src/main/assets/1rosecsem1.epub
Binary file not shown.
Binary file added sample/src/main/assets/The Silver Chair2.epub
Binary file not shown.
Expand Up @@ -49,7 +49,7 @@ public void onClick(View v) {
if (ContextCompat.checkSelfPermission(HomeActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(HomeActivity.this, WRITE_EXTERNAL_STORAGE_PERMS, GALLERY_REQUEST);
} else {
openEpub(FolioActivity.EpubSourceType.ASSESTS,"nuevounitled.epub",0);
openEpub(FolioActivity.EpubSourceType.ASSESTS,"1rosecsem1.epub",0);
}
}
});
Expand Down

0 comments on commit a87ec6c

Please sign in to comment.