Ok, so I was stuck with this problem for a week and could not come up with a solution. I have an epub book downloaded in android webview. I used jquery pagination to make it horizontal, so now my book scrolls horizontally. But I want to add animation to turn pages. Now each page is a column after pagination. What is the best way to add animation? Using page screening in android or using javascript / jquery.
Here is what I have done so far. This is the code that, after loading the book into a web view,
webview.loadDataWithBaseURL("file://"+Environment.getExternalStorageDirectory()+"/books/", linez, "text/html", "utf-8", null);
Now I used on the page to add js for horizontal pagination. How, where and what needs to be added for a coup?
webview.setWebViewClient(new WebViewClient() {
@SuppressLint("NewApi")
public void onPageFinished(WebView view, String url) {
String js = "";
String data = "";
try{
InputStream is = assetManager.open("initialize.js");
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String jLine="";
while((jLine=br.readLine())!=null){
data =
js+=jLine;
}
is.close();
}
catch(Exception e){
e.printStackTrace();
}
webview.loadUrl("javascript:(" + js + ")()");
}
});
source
share