实现追更,多网站收藏,已稳定
Android平台
Step 1. Add the JitPack repository to your build file
allprojects { repositories { ... maven { url 'https://jitpack.io' } } }
Step 2. Add the dependency
dependencies { implementation 'com.github.Zzzia:EasyBook:2.1'}
IDEA平台
将release内的压缩包下载下来,解压后依次添加依赖,一共有7个jar。由于使用okHttp,需要Kotlin插件。
使用说明:(具体可参照项目内简单示例或我写的加载目录:
EasyBook.getCatalog(book)
.subscribe(new Subscriber<List<Catalog>>() { @Override
public void onFinish(List<Catalog> catalogs) { //加载结果,返回该书籍所有目录
}
...
});
加载某一章节内容:
EasyBook.getContent(book,catalog)
.subscribe(new Subscriber<List<String>>() { @Override
public void onFinish(List<String> strings) { //返回该章节所有内容,按行保存在集合内,需要自行调整格式
}
...
});
下载书籍:
EasyBook.download(book)
.setSavePath("/sdcard/book")//设置保存的路径
.setThreadCount(150)//设置下载的线程数
.setType(Type.EPUB)//设置下载格式,如epub或txt
.subscribe(new Subscriber<File>() { @Override
public void onFinish(File file) { //下载完成后的文件
}
...
});
销毁线程(解决内存泄漏):
Disposable disposable;void onCreate(){
disposable = EasyBook.search("天行").subscribe(...);
}void onDestroy(){
disposable.dispose();
}
添加自己的站点解析:
//添加一个自己解析的站点类,叫Zhuishushenqi,需要继承SiteSiteCollection.getInstance().addSite(Zhuishushenqi());
作者:Zzzia
链接:https://www.jianshu.com/p/1777f2681eb0
作者:Zzzia
链接:https://www.jianshu.com/p/1777f2681eb0
點擊查看更多內容
為 TA 點贊
評論
評論
共同學習,寫下你的評論
評論加載中...
作者其他優質文章
正在加載中
感謝您的支持,我會繼續努力的~
掃碼打賞,你說多少就多少
贊賞金額會直接到老師賬戶
支付方式
打開微信掃一掃,即可進行掃碼打賞哦