Compare commits

...

No commits in common. '869a9d889ac8c3e12360a3432c892cab6e410b8c' and '819e070286636d6f3fa6c7fb05fc0ec6fc60ba3b' have entirely different histories.

38
.gitignore vendored

@ -1,8 +1,30 @@
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
### IntelliJ IDEA ###
out/
!**/src/main/**/out/
!**/src/test/**/out/
.idea
/*.iml
### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
### VS Code ###
.vscode/
### Mac OS ###
.DS_Store

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
<option value="$PROJECT_DIR$/basemvplib" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
</GradleProjectSettings>
</option>
</component>
</project>

@ -1,33 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="NullableNotNullManager">
<option name="myDefaultNullable" value="android.support.annotation.Nullable" />
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
<option name="myNullables">
<value>
<list size="7">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
<item index="2" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" />
<item index="3" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
<item index="4" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
<item index="5" class="java.lang.String" itemvalue="androidx.annotation.Nullable" />
<item index="6" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNullable" />
</list>
</value>
</option>
<option name="myNotNulls">
<value>
<list size="6">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
<item index="4" class="java.lang.String" itemvalue="androidx.annotation.NonNull" />
<item index="5" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNonNull" />
</list>
</value>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
</project>

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/MONKOVEL.iml" filepath="$PROJECT_DIR$/.idea/MONKOVEL.iml" />
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
<module fileurl="file://$PROJECT_DIR$/basemvplib/basemvplib.iml" filepath="$PROJECT_DIR$/basemvplib/basemvplib.iml" />
</modules>
</component>
</project>

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
</set>
</option>
</component>
</project>

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

@ -1,9 +1,209 @@
# MONKOVEL
一款可以优雅的阅读本地小说以及大量网络小说的APP
# APP预览以及体验
http://blog.csdn.net/github_38075367/article/details/76255230
# 项目基本介绍
http://blog.csdn.net/github_38075367/article/details/77075477
#
你要商业?不建议,盗版小说请勿传播,仅供学习使用。<br/>
你要修改请修改我的Logo/应用名移除预留QQ修改包名谢谢
![](IMG/Pasted%20image%2020241011225855.png)
![](IMG/Pasted%20image%2020241011225913.png)
![](IMG/Pasted%20image%2020241013113954.png)
### 基础
- MyHttpRequest
- `parse()`(解析流)
- `parseUri()`请求的内容存储到uri
- `getUri()`返回uri
- MyHttpResponse
- `sendRedirect(String uri)`判断资源是否存在不存在返回404 ,存在返回目标资源)
- `getResponseMessage(String code, String message)`(构造响应消息)
- MyHttpServer
- `start()`(循环接收浏览器请求,并且处理请求)
- Test`
- `main()`(主方法测试类)
###### MyHttpRequest
```C#
import java.io.IOException;
import java.io.InputStream;
public class MyHttpRequest {
private InputStream inputStream;
private String uri;
public MyHttpRequest(InputStream inputStream) {
this.inputStream = inputStream;
}
/**
* 解析流
*/
public void parse(){
try {
byte[] bytes = new byte[1024];
inputStream.read(bytes);
String request = new String(bytes);
parseUri(request);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
/**
* 请求判断
*/
public void parseUri(String request) {
int index1,index2;
index1 = request.indexOf(" ");//找空格下标
index2 = request.indexOf(" ",index1+1);//找空格下标2
uri = request.substring(index1+1,index2);//输出资源位置
System.out.println(uri);
}
public String getUri() {
return this.uri;
}
}
```
###### MyHttpResponse
```C#
import java.io.*;
public class MyHttpResponse {
private int statusCode;
private String statusMessage;
private OutputStream outputStream;
public MyHttpResponse(OutputStream outputStream){
this.outputStream = outputStream;
}
public void sendRedirect(String uri){
//判断资源是否存在
// 不存在返回404
// 存在返回目标资源
File file = new File(System.getProperty("user.dir")+"/WebContent" + uri);
if (file.exists()){
try {
FileInputStream fileInputStream = new FileInputStream(file);
byte[] bytes = new byte[(int)file.length()];
fileInputStream.read(bytes);
String result = new String(bytes);
// System.out.println(result);
String response = getResponseMessage("200,",result);
this.outputStream.write(response.getBytes());
} catch (IOException e) {
throw new RuntimeException(e);
}
}else {
try {
String error = getResponseMessage("404","404 File Not Found!");
this.outputStream.write(error.getBytes());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
public String getResponseMessage(String code, String message){
return "HTTP/1.1 " + code + "\r\n" +
"Content-Type: text/html\r\n" +
"Content-Length: " + message.length() +
"\r\n" +
"\r\n" +
message;
}
}
```
###### MyHttpServer
```C#
import java.io.InputStream;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;
public class MyHttpServer {
private int port = 8080;
public void receiving()
{
try{
//create socket service
ServerSocket serverSocket = new ServerSocket(port);
while(true){
//获取连接对象
Socket socket = serverSocket.accept();
//获取链接对象输入流
InputStream inputStream = socket.getInputStream();
//创建request
MyHttpRequest request = new MyHttpRequest(inputStream);
//解析请求
request.parse();
//创建响应
OutputStream outputStream = socket.getOutputStream();
MyHttpResponse response = new MyHttpResponse(outputStream);
//进行响应
response.sendRedirect(request.getUri());
}
//loop accept requests
}catch (Exception e){
}
}
}
```
###### Test
```C#
public class Test {
public static void main(String[] args) {
System.out.println("server startup successfully");
MyHttpServer server = new MyHttpServer();
server.receiving();
}
}
```
### 进阶
![](IMG/Pasted%20image%2020241012213802.png)
![](IMG/Pasted%20image%2020241012213832.png)
Tomcat的两个重要身份
1. http服务器
2. Tomcat是一个Servlet容器
使用Servlet规范来实现Tomcat
- AbstractHttpServletRequest *(implements HttpServletRequest)*
- AbstractHttpServletResponse *(implements HttpServletResponse)*
- ResponseServletOutputStream *(extends ServletOutputStream)*
- `write(int b)`
- `getBytes()`
- `getPos()`
- MyHttpRequest *(extends AbstractHttpServletRequest)*
- `parse()`(解析流)
- `parseMessageLine()`(请求行解析)
- `getMethod()`(返回请求方式)
- `getRequestURL()`(返回请求地址,通常为**appName/Servlet**
- `getProtocol()`(返回协议)
- MyHttpResponse *(extends AbstractHttpServletResponse)*
- `public MyHttpResponse(MyHttpRequest request, OutputStream outputStream)`(构造方法)
- `setStatus(int i, String s)`
- `getStatus()`
- `addHeader(String s, String s1)`
- `ResponseServletOutputStream getOutputStream()`servlet的doGet所write的消息体
- `complete()`(完成响应,调用下面三个方法)
- `sendResponseMsgLine()`
- `sendResponseMsgHeader()`
- `sendResponseMsgBody()`
- Tomcat (添加线程池)
- `main(String[] args)`启动Tomcat
- `deployApps()`(利用反射部署指定目录下的应用)
- `start()`(循环接收浏览器请求,并且处理请求)
- `getAllFilePath()`(递归的获得项目内所有文件)
- `getContextMap()`(添加应用映射)
- SocketProcessor *(implements Runnable)*
- `run()`调用processSocket
- `processSocket(Socket socket)`(处理请求)
- Context
- `addUrlPatternMapping(String pattern, Servlet servlet)`添加应用下Servlet映射
- `getByUrlPatternMapping(String urlPattern)` 得到Servlet对象
- DefaultServlet *(extends HttpServlet)*

1
app/.gitignore vendored

@ -1 +0,0 @@
/build

@ -1,83 +0,0 @@
apply plugin: 'com.android.application'
apply plugin: 'org.greenrobot.greendao'
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.monke.monkeybook"
minSdkVersion 17
targetSdkVersion 26
versionCode 16
versionName "1.3.6"
manifestPlaceholders = [UMENG_CHANNEL_VALUE: "pugongying"]
}
lintOptions {
abortOnError false
}
buildTypes {
release {
buildConfigField "boolean", "IS_RELEASE", "true"
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
buildConfigField "boolean", "IS_RELEASE", "false"
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
// signingConfig signingConfigs.config
}
}
}
repositories{
flatDir{
dirs 'libs'
}
}
dependencies {
api fileTree(include: ['*.jar'], dir: 'libs')
testImplementation 'junit:junit:4.12'
api 'com.android.support:appcompat-v7:28.0.0'
api 'com.android.support:design:28.0.0'
api 'com.android.support:cardview-v7:28.0.0'
api 'com.android.support:support-compat:28.0.0'
api project(':basemvplib')
//GreenDao
api 'org.greenrobot:greendao:3.0.1'
api 'org.greenrobot:greendao-generator:3.0.0'
//JSOUP
api 'org.jsoup:jsoup:1.10.2'
//
api 'com.zhangmonke:ImmerseLayout:1.1.1'
//ProgressBar
api 'com.zhangmonke:MProgressBar:1.0.1'
//Glide
api 'com.github.bumptech.glide:glide:3.7.0'
//AutofitTextView
api 'me.grantland:autofittextview:0.2.1'
//
api 'tyrantgit:explosionfield:1.0.1'
//View
api 'com.daimajia.easing:library:2.0@aar'
api 'com.daimajia.androidanimations:library:2.2@aar'
//CircleImageView
api 'de.hdodenhof:circleimageview:2.1.0'
//SwitchButton
api 'com.kyleduo.switchbutton:library:1.4.4'
api 'com.victor:lib:1.0.4'
api files('libs/commons-codec-1.10-sources.jar')
api files('libs/juniversalchardet-1.0.3.jar')
api files('libs/umeng-analytics-v6.1.1.jar')
api files('libs/utdid4all-1.0.4.jar')
}
greendao {
schemaVersion 1
daoPackage 'com.monke.monkeybook.dao'
targetGenDir 'src/main/java'
}

Binary file not shown.

@ -1,206 +0,0 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in D:\CodeTool\Android\Android_SDK/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
#
# 对于一些基本指令的添加
#
#############################################
# 代码混淆压缩比在0~7之间默认为5一般不做修改
-optimizationpasses 5
# 混合时不使用大小写混合,混合后的类名为小写
-dontusemixedcaseclassnames
# 指定不去忽略非公共库的类
-dontskipnonpubliclibraryclasses
# 这句话能够使我们的项目混淆后产生映射文件
# 包含有类名->混淆后类名的映射关系
-verbose
# 指定不去忽略非公共库的类成员
-dontskipnonpubliclibraryclassmembers
# 不做预校验preverify是proguard的四个步骤之一Android不需要preverify去掉这一步能够加快混淆速度
-dontpreverify
# 保留Annotation不混淆
-keepattributes *Annotation*,InnerClasses
# 避免混淆泛型
-keepattributes Signature
# 抛出异常时保留代码行号
-keepattributes SourceFile,LineNumberTable
# 指定混淆是采用的算法,后面的参数是一个过滤器
# 这个过滤器是谷歌推荐的算法,一般不做更改
-optimizations !code/simplification/cast,!field/*,!class/merging/*
#############################################
#
# Android开发中一些需要保留的公共部分
#
#############################################
# 保留我们使用的四大组件自定义的Application等等这些类不被混淆
# 因为这些子类都有可能被外部调用
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Appliction
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class * extends android.view.View
-keep public class com.android.vending.licensing.ILicensingService
# 保留support下的所有类及其内部类
-keep class android.support.** {*;}
# 保留继承的
-keep public class * extends android.support.v4.**
-keep public class * extends android.support.v7.**
-keep public class * extends android.support.annotation.**
# 保留R下面的资源
-keep class **.R$* {*;}
# 保留本地native方法不被混淆
-keepclasseswithmembernames class * {
native <methods>;
}
# 保留在Activity中的方法参数是view的方法
# 这样以来我们在layout中写的onClick就不会被影响
-keepclassmembers class * extends android.app.Activity{
public void *(android.view.View);
}
# 保留枚举类不被混淆
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
# 保留我们自定义控件继承自View不被混淆
-keep public class * extends android.view.View{
*** get*();
void set*(***);
public <init>(android.content.Context);
public <init>(android.content.Context, android.util.AttributeSet);
public <init>(android.content.Context, android.util.AttributeSet, int);
}
# 保留Parcelable序列化类不被混淆
-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}
# 保留Serializable序列化的类不被混淆
-keepclassmembers class * implements java.io.Serializable {
static final long serialVersionUID;
private static final java.io.ObjectStreamField[] serialPersistentFields;
!static !transient <fields>;
!private <fields>;
!private <methods>;
private void writeObject(java.io.ObjectOutputStream);
private void readObject(java.io.ObjectInputStream);
java.lang.Object writeReplace();
java.lang.Object readResolve();
}
# 对于带有回调函数的onXXEvent、**On*Listener的,不能被混淆
-keepclassmembers class * {
void *(**On*Event);
void *(**On*Listener);
}
# webView处理项目中没有使用到webView忽略即可
-keepclassmembers class fqcn.of.javascript.interface.for.webview {
public *;
}
-keepclassmembers class * extends android.webkit.webViewClient {
public void *(android.webkit.WebView, java.lang.String, android.graphics.Bitmap);
public boolean *(android.webkit.WebView, java.lang.String);
}
-keepclassmembers class * extends android.webkit.webViewClient {
public void *(android.webkit.webView, jav.lang.String);
}
# 移除Log类打印各个等级日志的代码打正式包的时候可以做为禁log使用这里可以作为禁止log打印的功能使用
# 记得proguard-android.txt中一定不要加-dontoptimize才起作用
# 另外的一种实现方案是通过BuildConfig.DEBUG的变量来控制
#-assumenosideeffects class android.util.Log {
# public static int v(...);
# public static int i(...);
# public static int w(...);
# public static int d(...);
# public static int e(...);
#}
### greenDAO 3
-keep class org.greenrobot.greendao.**{ *; }
-keepclassmembers class * extends org.greenrobot.greendao.AbstractDao {
public static java.lang.String TABLENAME;
}
-keep class **$Properties
-dontwarn org.greenrobot.greendao.database.**
-dontwarn rx.**
-dontwarn okio.**
-dontwarn retrofit2.**
-dontwarn javax.annotation.**
-keep class retrofit2.**{*;}
-keep class okhttp3.**{*;}
-keep class okio.**{*;}
-keep class com.hwangjr.rxbus.**{*;}
-dontwarn org.apache.log4j.lf5.viewer.**
-dontnote org.apache.log4j.lf5.viewer.**
-dontwarn freemarker.**
-dontnote org.python.core.**
-dontwarn com.hwangjr.rxbus.**
-keep class com.monke.monkeybook.widget.**{*;}
-keep class com.monke.monkeybook.bean.**{*;}
-keep class android.support.**{*;}
-keep class me.grantland.widget.**{*;}
-keep class de.hdodenhof.circleimageview.**{*;}
-keep class retrofit2.**{*;}
-keep class tyrant.explosionfield.**{*;}
-keep class tyrantgit.explosionfield.**{*;}
-keep class freemarker.**{*;}
##JSOUP
-keep class org.jsoup.**{ *; }
-keep class com.monke.mprogressbar.**{ *; }
##友盟统计
-keepclassmembers class * {
public <init> (org.json.JSONObject);
}
-keep public class com.monke.monkeybook.R$*{
public static final int *;
}
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
##百度自动更新
-keep class com.baidu.**{*;}

@ -1,13 +0,0 @@
package com.monke.monkeybook;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
}

@ -1,75 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.monke.monkeybook">
<application
android:name=".MApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/CAppTheme"
tools:replace="android:theme"
android:networkSecurityConfig="@xml/network_security_config">
<activity
android:name=".view.impl.WelcomeActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".view.impl.MainActivity"
android:launchMode="singleTask"
android:screenOrientation="portrait" />
<activity
android:name=".view.impl.SearchActivity"
android:configChanges="locale|keyboardHidden|orientation|screenSize"
android:screenOrientation="portrait"
android:theme="@style/CAppTransparentTheme"
android:windowSoftInputMode="stateHidden|adjustPan" />
<service android:name=".service.DownloadService" />
<activity
android:name=".view.impl.LibraryActivity"
android:screenOrientation="portrait"
android:theme="@style/CAppTransparentTheme" />
<activity
android:name=".view.impl.ChoiceBookActivity"
android:screenOrientation="portrait" />
<activity
android:name=".view.impl.BookDetailActivity"
android:screenOrientation="portrait"
android:theme="@style/CAppTransparentTheme" />
<activity
android:name=".view.impl.ReadBookActivity"
android:launchMode="singleTask"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.VIEW"></action>
<category android:name="android.intent.category.DEFAULT"></category>
<data android:mimeType="text/plain"></data>
</intent-filter>
</activity>
<activity
android:name=".view.impl.ImportBookActivity"
android:screenOrientation="portrait"
android:theme="@style/CAppTransparentTheme" />
<meta-data
android:name="UMENG_CHANNEL_VALUE"
android:value="${UMENG_CHANNEL_VALUE}" />
</application>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
</manifest>

@ -1,35 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook;
import java.util.HashMap;
import java.util.Map;
public class BitIntentDataManager {
public static Map<String,Object> bigData;
private static BitIntentDataManager instance = null;
public static BitIntentDataManager getInstance(){
if(instance == null){
synchronized (BitIntentDataManager.class){
if(instance == null){
instance = new BitIntentDataManager();
}
}
}
return instance;
}
private BitIntentDataManager(){
bigData = new HashMap<>();
}
public Object getData(String key){
return bigData.get(key);
}
public void putData(String key,Object data){
bigData.put(key,data);
}
public void cleanData(String key){
bigData.remove(key);
}
}

@ -1,125 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook;
import com.monke.monkeybook.base.observer.SimpleObserver;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import io.reactivex.Observable;
import io.reactivex.ObservableEmitter;
import io.reactivex.ObservableOnSubscribe;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
public class ErrorAnalyContentManager {
private ErrorAnalyContentManager(){
}
private static ErrorAnalyContentManager instance;
public static ErrorAnalyContentManager getInstance(){
if(instance == null){
synchronized (ErrorAnalyContentManager.class){
if(instance == null){
instance = new ErrorAnalyContentManager();
}
}
}
return instance;
}
public void writeNewErrorUrl(final String url){
Observable.create(new ObservableOnSubscribe<Boolean>() {
@Override
public void subscribe(ObservableEmitter<Boolean> e) throws Exception {
String filePath = MApplication.getInstance().getExternalFilesDir("").getPath();
File dir = new File(filePath);
if(!dir.exists()){
dir.mkdirs();
}
File file2 = new File(filePath,"ErrorAnalyUrlsDetail.txt");
if(!file2.exists()) {
file2.createNewFile();
}
FileOutputStream fileOutputStream2 = new FileOutputStream(file2,true);
fileOutputStream2.write((url+" \r\n").getBytes());
fileOutputStream2.flush();
fileOutputStream2.close();
///////////////////////////////////////////////////////////////////////
File file1 = new File(filePath,"ErrorAnalyUrls.txt");
if(!file1.exists()) {
file1.createNewFile();
}
FileInputStream inputStream = new FileInputStream(file1);
byte[] bytes = new byte[1024];
ByteArrayOutputStream arrayOutputStream = new ByteArrayOutputStream();
while (inputStream.read(bytes) != -1) {
arrayOutputStream.write(bytes, 0, bytes.length);
}
inputStream.close();
arrayOutputStream.close();
String content = new String(arrayOutputStream.toByteArray());
if(!content.contains(url.substring(0,url.indexOf('/',8)))){
FileOutputStream fileOutputStream1 = new FileOutputStream(file1,true);
fileOutputStream1.write((url.substring(0,url.indexOf('/',8))+" \r\n").getBytes());
fileOutputStream1.flush();
fileOutputStream1.close();
}
e.onNext(true);
e.onComplete();
}
})
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new SimpleObserver<Boolean>() {
@Override
public void onNext(Boolean value) {
}
@Override
public void onError(Throwable e) {
}
});
}
public void writeMayByNetError(final String url){
Observable.create(new ObservableOnSubscribe<Boolean>() {
@Override
public void subscribe(ObservableEmitter<Boolean> e) throws Exception {
String filePath = MApplication.getInstance().getExternalFilesDir("").getPath();
File dir = new File(filePath);
if(!dir.exists()){
dir.mkdirs();
}
File file = new File(filePath,"ErrorNetUrl.txt");
if(!file.exists()) {
file.createNewFile();
}
FileOutputStream fileOutputStream2 = new FileOutputStream(file,true);
fileOutputStream2.write((url+" \r\n").getBytes());
fileOutputStream2.flush();
fileOutputStream2.close();
e.onNext(true);
e.onComplete();
}
})
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new SimpleObserver<Boolean>() {
@Override
public void onNext(Boolean value) {
}
@Override
public void onError(Throwable e) {
}
});
}
}

@ -1,38 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook;
import android.app.Application;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import com.monke.monkeybook.service.DownloadService;
import com.umeng.analytics.MobclickAgent;
public class MApplication extends Application {
private static MApplication instance;
@Override
public void onCreate() {
super.onCreate();
if (BuildConfig.IS_RELEASE) {
String channel = "debug";
try {
ApplicationInfo appInfo = getPackageManager()
.getApplicationInfo(getPackageName(),
PackageManager.GET_META_DATA);
channel = appInfo.metaData.getString("UMENG_CHANNEL_VALUE");
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
MobclickAgent.startWithConfigure(new MobclickAgent.UMAnalyticsConfig(this, getString(R.string.umeng_key), channel, MobclickAgent.EScenarioType.E_UM_NORMAL, true));
}
instance = this;
ProxyManager.initProxy();
startService(new Intent(this, DownloadService.class));
}
public static MApplication getInstance() {
return instance;
}
}

@ -1,67 +0,0 @@
package com.monke.monkeybook;
import android.content.SharedPreferences;
import org.jsoup.helper.StringUtil;
import java.util.regex.Pattern;
public class ProxyManager {
public static final String SP_KEY_PROXY_HTTP = "proxy_http";
public static final String SP_KEY_PROXY_STATE = "proxy_state";
public static final String PROXY_HTTP_DEFAULT = "";
public static final boolean PROXY_STATE_DEFAULT = false;
public static boolean proxyState;
public static String proxyHttp;
private static final String PROXY_HTTP_MATCH = "(http|ftp|https):\\/\\/[\\w\\-_]+(\\.[\\w\\-_]+)+([\\w\\-\\.,@?^=%&amp;:/~\\+#]*[\\w\\-\\@?^=%&amp;/~\\+#])?";//http正则表达式
public static final String PROXY_PACKAGENAME_ENCODE = "代理包名加密key"; //代理包名加密key
public static String packageName; //加密后的包名
public static void saveProxyState(boolean state) {
proxyState = state;
SharedPreferences.Editor editor = MApplication.getInstance().getSharedPreferences("CONFIG", 0).edit();
editor.putBoolean(SP_KEY_PROXY_STATE, proxyState);
editor.commit();
}
private static void initProxyState() {
try {
packageName = MApplication.getInstance().getPackageManager().getPackageInfo(MApplication.getInstance().getPackageName(), 0).packageName;
} catch (Exception e) {
e.printStackTrace();
System.out.println("=================包名获取失败,可能会影响代理请求功能=================");
}
proxyState = MApplication.getInstance().getSharedPreferences("CONFIG", 0).getBoolean(SP_KEY_PROXY_STATE, PROXY_STATE_DEFAULT);
}
public static void saveProxyHttp(String http) {
proxyHttp = http;
SharedPreferences.Editor editor = MApplication.getInstance().getSharedPreferences("CONFIG", 0).edit();
editor.putString(SP_KEY_PROXY_HTTP, proxyHttp);
editor.commit();
}
private static void initProxyHttp() {
proxyHttp = MApplication.getInstance().getSharedPreferences("CONFIG", 0).getString(SP_KEY_PROXY_HTTP, PROXY_HTTP_DEFAULT);
}
public static void initProxy() {
initProxyHttp();
initProxyState();
hasProxy();
}
public static boolean hasProxy() {
if (!proxyState) {
return false;
}
Pattern pattern = Pattern.compile(PROXY_HTTP_MATCH);
if (!StringUtil.isBlank(proxyHttp) && pattern.matcher(proxyHttp).matches()) {
return true;
} else {
saveProxyState(false);
return false;
}
}
}

@ -1,177 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook;
import android.content.SharedPreferences;
import android.graphics.Color;
import com.monke.monkeybook.utils.DensityUtil;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class ReadBookControl {
public static final int DEFAULT_TEXT = 2;
public static final int DEFAULT_BG = 1;
private static List<Map<String,Integer>> textKind;
private static List<Map<String,Integer>> textDrawable;
private int textSize;
private int textExtra;
private int textColor;
private int textBackground;
private int textKindIndex = DEFAULT_TEXT;
private int textDrawableIndex = DEFAULT_BG;
private Boolean canClickTurn = true;
private Boolean canKeyTurn = true;
private SharedPreferences preference;
private static ReadBookControl readBookControl;
public static ReadBookControl getInstance(){
if(readBookControl == null){
synchronized (ReadBookControl.class){
if(readBookControl == null){
readBookControl = new ReadBookControl();
}
}
}
return readBookControl;
}
private ReadBookControl(){
if(null == textKind){
textKind = new ArrayList<>();
Map<String,Integer> temp1 = new HashMap<>();
temp1.put("textSize", 14);
temp1.put("textExtra", DensityUtil.dp2px(MApplication.getInstance(),6.5f));
textKind.add(temp1);
Map<String,Integer> temp2 = new HashMap<>();
temp2.put("textSize", 16);
temp2.put("textExtra", DensityUtil.dp2px(MApplication.getInstance(),8));
textKind.add(temp2);
Map<String,Integer> temp3 = new HashMap<>();
temp3.put("textSize", 17);
temp3.put("textExtra", DensityUtil.dp2px(MApplication.getInstance(),9));
textKind.add(temp3);
Map<String,Integer> temp4 = new HashMap<>();
temp4.put("textSize", 20);
temp4.put("textExtra", DensityUtil.dp2px(MApplication.getInstance(),11));
textKind.add(temp4);
Map<String,Integer> temp5 = new HashMap<>();
temp5.put("textSize", 22);
temp5.put("textExtra", DensityUtil.dp2px(MApplication.getInstance(),13));
textKind.add(temp5);
}
if(null == textDrawable){
textDrawable = new ArrayList<>();
Map<String,Integer> temp1 = new HashMap<>();
temp1.put("textColor",Color.parseColor("#3E3D3B"));
temp1.put("textBackground",R.drawable.shape_bg_readbook_white);
textDrawable.add(temp1);
Map<String,Integer> temp2 = new HashMap<>();
temp2.put("textColor",Color.parseColor("#5E432E"));
temp2.put("textBackground",R.drawable.bg_readbook_yellow);
textDrawable.add(temp2);
Map<String,Integer> temp3 = new HashMap<>();
temp3.put("textColor",Color.parseColor("#22482C"));
temp3.put("textBackground",R.drawable.bg_readbook_green);
textDrawable.add(temp3);
Map<String,Integer> temp4 = new HashMap<>();
temp4.put("textColor",Color.parseColor("#808080"));
temp4.put("textBackground",R.drawable.bg_readbook_black);
textDrawable.add(temp4);
}
preference = MApplication.getInstance().getSharedPreferences("CONFIG", 0);
this.textKindIndex = preference.getInt("textKindIndex",DEFAULT_TEXT);
this.textSize = textKind.get(textKindIndex).get("textSize");
this.textExtra = textKind.get(textKindIndex).get("textExtra");
this.textDrawableIndex = preference.getInt("textDrawableIndex",DEFAULT_BG);
this.textColor = textDrawable.get(textDrawableIndex).get("textColor");
this.textBackground = textDrawable.get(textDrawableIndex).get("textBackground");
this.canClickTurn = preference.getBoolean("canClickTurn",true);
this.canKeyTurn = preference.getBoolean("canClickTurn",true);
}
public int getTextSize() {
return textSize;
}
public int getTextExtra() {
return textExtra;
}
public int getTextColor() {
return textColor;
}
public int getTextBackground() {
return textBackground;
}
public int getTextKindIndex() {
return textKindIndex;
}
public void setTextKindIndex(int textKindIndex) {
this.textKindIndex = textKindIndex;
SharedPreferences.Editor editor = preference.edit();
editor.putInt("textKindIndex",textKindIndex);
editor.commit();
this.textSize = textKind.get(textKindIndex).get("textSize");
this.textExtra = textKind.get(textKindIndex).get("textExtra");
}
public int getTextDrawableIndex() {
return textDrawableIndex;
}
public void setTextDrawableIndex(int textDrawableIndex) {
this.textDrawableIndex = textDrawableIndex;
SharedPreferences.Editor editor = preference.edit();
editor.putInt("textDrawableIndex",textDrawableIndex);
editor.commit();
this.textColor = textDrawable.get(textDrawableIndex).get("textColor");
this.textBackground = textDrawable.get(textDrawableIndex).get("textBackground");
}
public static List<Map<String, Integer>> getTextKind() {
return textKind;
}
public static List<Map<String, Integer>> getTextDrawable() {
return textDrawable;
}
public Boolean getCanKeyTurn() {
return canKeyTurn;
}
public void setCanKeyTurn(Boolean canKeyTurn) {
this.canKeyTurn = canKeyTurn;
SharedPreferences.Editor editor = preference.edit();
editor.putBoolean("canKeyTurn",canKeyTurn);
editor.commit();
}
public Boolean getCanClickTurn() {
return canClickTurn;
}
public void setCanClickTurn(Boolean canClickTurn) {
this.canClickTurn = canClickTurn;
SharedPreferences.Editor editor = preference.edit();
editor.putBoolean("canClickTurn",canClickTurn);
editor.commit();
}
}

@ -1,20 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.base;
import com.monke.basemvplib.IPresenter;
import com.monke.basemvplib.impl.BaseActivity;
import com.umeng.analytics.MobclickAgent;
public abstract class MBaseActivity<T extends IPresenter> extends BaseActivity<T>{
@Override
protected void onResume() {
super.onResume();
MobclickAgent.onResume(this);
}
@Override
protected void onPause() {
super.onPause();
MobclickAgent.onPause(this);
}
}

@ -1,40 +0,0 @@
package com.monke.monkeybook.base;
import com.monke.basemvplib.EncodoConverter;
import com.monke.basemvplib.impl.RetryIntercepter;
import java.util.concurrent.TimeUnit;
import okhttp3.OkHttpClient;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import retrofit2.converter.scalars.ScalarsConverterFactory;
public class MBaseModelImpl {
protected OkHttpClient.Builder clientBuilder = new OkHttpClient.Builder()
.connectTimeout(10, TimeUnit.SECONDS)
.writeTimeout(10, TimeUnit.SECONDS)
.readTimeout(10, TimeUnit.SECONDS)
.addInterceptor(new ProxyInterceptor());
protected Retrofit getRetrofitObject(String url) {
return new Retrofit.Builder().baseUrl(url)
//增加返回值为字符串的支持(以实体类返回)
.addConverterFactory(ScalarsConverterFactory.create())
//增加返回值为Oservable<T>的支持
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.client(clientBuilder.build())
.build();
}
protected Retrofit getRetrofitString(String url, String encode) {
return new Retrofit.Builder().baseUrl(url)
//增加返回值为字符串的支持(以实体类返回)
.addConverterFactory(EncodoConverter.create(encode))
//增加返回值为Oservable<T>的支持
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.client(clientBuilder.build())
.build();
}
}

@ -1,54 +0,0 @@
package com.monke.monkeybook.base;
import com.monke.monkeybook.ProxyManager;
import com.monke.monkeybook.utils.aes.AESUtil;
import org.jsoup.helper.StringUtil;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.UUID;
import okhttp3.HttpUrl;
import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;
public class ProxyInterceptor implements Interceptor {
public ProxyInterceptor() {
}
@Override
public Response intercept(Chain chain) throws IOException {
Request oldRequest = chain.request();
if (ProxyManager.hasProxy()) { //如果是代理模式则优先请求代理服务器,失败再自行本地请求
//获取request的创建者builder
Request.Builder builder = oldRequest.newBuilder();
String oldUrl = oldRequest.url().toString();
if (!StringUtil.isBlank(oldUrl)) {
oldUrl = URLEncoder.encode(oldUrl, "utf-8");
}
try {
String temp = ProxyManager.packageName + UUID.randomUUID().toString() + System.currentTimeMillis();
String key = AESUtil.aesEncode(temp.trim(), ProxyManager.PROXY_PACKAGENAME_ENCODE);
try {
key = URLEncoder.encode(key,"utf-8");
} catch (Exception e) {
key = temp.trim();
}
HttpUrl newBaseUrl = HttpUrl.parse(ProxyManager.proxyHttp).newBuilder()
.setQueryParameter("proxyUrl", oldUrl)
.setQueryParameter("proxyPackagename", key)
.build();
Response response = chain.proceed(builder.url(newBaseUrl).build());
if (response.isSuccessful()) {
return response;
}
} catch (Exception e) {
}
}
Response oldResponse = chain.proceed(oldRequest);
return oldResponse;
}
}

@ -1,38 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.base.observer;
import com.monke.monkeybook.utils.NetworkUtil;
public class SimpleObserClass<T> {
private int code;
private T t;
public SimpleObserClass(T t){
this(t,NetworkUtil.SUCCESS);
}
public SimpleObserClass(T t,int code){
this.t = t;
this.code = code;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public Boolean success(){
return code == NetworkUtil.SUCCESS;
}
public T getT() {
return t;
}
public void setT(T t) {
this.t = t;
}
}

@ -1,18 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.base.observer;
import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;
public abstract class SimpleObserver<T> implements Observer<T> {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onComplete() {
}
}

@ -1,144 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.bean;
import android.os.Parcel;
import android.os.Parcelable;
import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Transient;
import org.greenrobot.greendao.annotation.Generated;
import java.util.ArrayList;
import java.util.List;
/**
*
*/
@Entity
public class BookContentBean implements Parcelable{
@Id
private String durChapterUrl; //对应BookInfoBean noteUrl;
private int durChapterIndex; //当前章节 (包括番外)
private String durCapterContent; //当前章节内容
private String tag; //来源 某个网站/本地
@Transient
private Boolean isRight = true;
@Transient
private List<String> lineContent = new ArrayList<>();
@Transient
private float lineSize;
public BookContentBean(){
}
public float getLineSize() {
return lineSize;
}
public void setLineSize(float lineSize) {
this.lineSize = lineSize;
}
protected BookContentBean(Parcel in) {
durChapterUrl = in.readString();
durChapterIndex = in.readInt();
durCapterContent = in.readString();
tag = in.readString();
lineContent = in.createStringArrayList();
isRight = in.readByte()!=0;
}
@Generated(hash = 1355824386)
public BookContentBean(String durChapterUrl, int durChapterIndex,
String durCapterContent, String tag) {
this.durChapterUrl = durChapterUrl;
this.durChapterIndex = durChapterIndex;
this.durCapterContent = durCapterContent;
this.tag = tag;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(durChapterUrl);
dest.writeInt(durChapterIndex);
dest.writeString(durCapterContent);
dest.writeString(tag);
dest.writeStringList(lineContent);
dest.writeByte((byte) (isRight ? 1 : 0));
}
@Override
public int describeContents() {
return 0;
}
@Transient
public static final Creator<BookContentBean> CREATOR = new Creator<BookContentBean>() {
@Override
public BookContentBean createFromParcel(Parcel in) {
return new BookContentBean(in);
}
@Override
public BookContentBean[] newArray(int size) {
return new BookContentBean[size];
}
};
public String getDurChapterUrl() {
return durChapterUrl;
}
public void setDurChapterUrl(String durChapterUrl) {
this.durChapterUrl = durChapterUrl;
}
public int getDurChapterIndex() {
return durChapterIndex;
}
public void setDurChapterIndex(int durChapterIndex) {
this.durChapterIndex = durChapterIndex;
}
public String getDurCapterContent() {
return durCapterContent;
}
public void setDurCapterContent(String durCapterContent) {
this.durCapterContent = durCapterContent;
if(durCapterContent==null || durCapterContent.length()==0)
this.isRight = false;
}
public String getTag() {
return tag;
}
public void setTag(String tag) {
this.tag = tag;
}
public List<String> getLineContent() {
return lineContent;
}
public void setLineContent(List<String> lineContent) {
this.lineContent = lineContent;
}
public Boolean getRight() {
return isRight;
}
public void setRight(Boolean right) {
isRight = right;
}
}

@ -1,213 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.bean;
import android.os.Parcel;
import android.os.Parcelable;
import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Transient;
import org.greenrobot.greendao.annotation.Generated;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/**
*
*/
@Entity
public class BookInfoBean implements Parcelable,Cloneable{
@Transient
public static final long REFRESH_DUR = 10*60*1000;
private String name; //小说名
private String tag;
@Id
private String noteUrl; //如果是来源网站 则小说根地址 /如果是本地 则是小说本地MD5
private String chapterUrl; //章节目录地址
@Transient
private List<ChapterListBean> chapterlist = new ArrayList<>(); //章节列表
private long finalRefreshData; //章节最后更新时间
private String coverUrl; //小说封面
private String author;//作者
private String introduce; //简介
private String origin; //来源
public BookInfoBean(){
}
protected BookInfoBean(Parcel in) {
name = in.readString();
tag = in.readString();
noteUrl = in.readString();
chapterUrl = in.readString();
chapterlist = in.createTypedArrayList(ChapterListBean.CREATOR);
finalRefreshData = in.readLong();
coverUrl = in.readString();
author = in.readString();
introduce = in.readString();
origin = in.readString();
}
@Generated(hash = 1627552162)
public BookInfoBean(String name, String tag, String noteUrl, String chapterUrl,
long finalRefreshData, String coverUrl, String author, String introduce,
String origin) {
this.name = name;
this.tag = tag;
this.noteUrl = noteUrl;
this.chapterUrl = chapterUrl;
this.finalRefreshData = finalRefreshData;
this.coverUrl = coverUrl;
this.author = author;
this.introduce = introduce;
this.origin = origin;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(name);
dest.writeString(tag);
dest.writeString(noteUrl);
dest.writeString(chapterUrl);
dest.writeTypedList(chapterlist);
dest.writeLong(finalRefreshData);
dest.writeString(coverUrl);
dest.writeString(author);
dest.writeString(introduce);
dest.writeString(origin);
}
@Override
public int describeContents() {
return 0;
}
@Transient
public static final Creator<BookInfoBean> CREATOR = new Creator<BookInfoBean>() {
@Override
public BookInfoBean createFromParcel(Parcel in) {
return new BookInfoBean(in);
}
@Override
public BookInfoBean[] newArray(int size) {
return new BookInfoBean[size];
}
};
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getTag() {
return tag;
}
public void setTag(String tag) {
this.tag = tag;
}
public String getNoteUrl() {
return noteUrl;
}
public void setNoteUrl(String noteUrl) {
this.noteUrl = noteUrl;
}
public String getChapterUrl() {
return chapterUrl;
}
public void setChapterUrl(String chapterUrl) {
this.chapterUrl = chapterUrl;
}
public List<ChapterListBean> getChapterlist() {
return chapterlist;
}
public void setChapterlist(List<ChapterListBean> chapterlist) {
this.chapterlist = chapterlist;
}
public void addChapterlist(List<ChapterListBean> chapterlist){
this.chapterlist.addAll(chapterlist);
}
public long getFinalRefreshData() {
return finalRefreshData;
}
public void setFinalRefreshData(long finalRefreshData) {
this.finalRefreshData = finalRefreshData;
}
public String getCoverUrl() {
return coverUrl;
}
public void setCoverUrl(String coverUrl) {
this.coverUrl = coverUrl;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public String getIntroduce() {
return introduce;
}
public void setIntroduce(String introduce) {
this.introduce = introduce;
}
public String getOrigin() {
return this.origin;
}
public void setOrigin(String origin) {
this.origin = origin;
}
@Override
protected Object clone() throws CloneNotSupportedException {
BookInfoBean bookInfoBean = (BookInfoBean) super.clone();
bookInfoBean.name = name;
bookInfoBean.tag = tag;
bookInfoBean.noteUrl = noteUrl;
bookInfoBean.chapterUrl = chapterUrl;
bookInfoBean.coverUrl = coverUrl;
bookInfoBean.author = author;
bookInfoBean.introduce = introduce;
bookInfoBean.origin = origin;
if(chapterlist!=null){
List<ChapterListBean> newList = new ArrayList<>();
Iterator<ChapterListBean> iterator = chapterlist.iterator();
while(iterator.hasNext()){
newList.add((ChapterListBean) iterator.next().clone());
}
bookInfoBean.setChapterlist(newList);
}
return bookInfoBean;
}
}

@ -1,144 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.bean;
import android.os.Parcel;
import android.os.Parcelable;
import com.monke.monkeybook.widget.contentswitchview.BookContentView;
import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Transient;
/**
* item Bean
*/
@Entity
public class BookShelfBean implements Parcelable,Cloneable{
@Transient
public static final long REFRESH_TIME = 5*60*1000; //更新时间间隔 至少
@Transient
public static final String LOCAL_TAG = "loc_book";
@Id
private String noteUrl; //对应BookInfoBean noteUrl;
private int durChapter; //当前章节 (包括番外)
private int durChapterPage = BookContentView.DURPAGEINDEXBEGIN; // 当前章节位置 用页码
private long finalDate; //最后阅读时间
private String tag;
@Transient
private BookInfoBean bookInfoBean = new BookInfoBean();
public BookShelfBean(){
}
protected BookShelfBean(Parcel in) {
noteUrl = in.readString();
durChapter = in.readInt();
durChapterPage = in.readInt();
finalDate = in.readLong();
tag = in.readString();
bookInfoBean = in.readParcelable(BookInfoBean.class.getClassLoader());
}
@Generated(hash = 2028192361)
public BookShelfBean(String noteUrl, int durChapter, int durChapterPage, long finalDate,
String tag) {
this.noteUrl = noteUrl;
this.durChapter = durChapter;
this.durChapterPage = durChapterPage;
this.finalDate = finalDate;
this.tag = tag;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(noteUrl);
dest.writeInt(durChapter);
dest.writeInt(durChapterPage);
dest.writeLong(finalDate);
dest.writeString(tag);
dest.writeParcelable(bookInfoBean, flags);
}
@Override
public int describeContents() {
return 0;
}
@Transient
public static final Creator<BookShelfBean> CREATOR = new Creator<BookShelfBean>() {
@Override
public BookShelfBean createFromParcel(Parcel in) {
return new BookShelfBean(in);
}
@Override
public BookShelfBean[] newArray(int size) {
return new BookShelfBean[size];
}
};
public String getNoteUrl() {
return noteUrl;
}
public void setNoteUrl(String noteUrl) {
this.noteUrl = noteUrl;
}
public int getDurChapter() {
return durChapter;
}
public void setDurChapter(int durChapter) {
this.durChapter = durChapter;
}
public int getDurChapterPage() {
return durChapterPage;
}
public void setDurChapterPage(int durChapterPage) {
this.durChapterPage = durChapterPage;
}
public long getFinalDate() {
return finalDate;
}
public void setFinalDate(long finalDate) {
this.finalDate = finalDate;
}
public String getTag() {
return tag;
}
public void setTag(String tag) {
this.tag = tag;
}
public BookInfoBean getBookInfoBean() {
return bookInfoBean;
}
public void setBookInfoBean(BookInfoBean bookInfoBean) {
this.bookInfoBean = bookInfoBean;
}
@Override
public Object clone() throws CloneNotSupportedException {
BookShelfBean bookShelfBean = (BookShelfBean) super.clone();
bookShelfBean.noteUrl = noteUrl;
bookShelfBean.tag = tag;
bookShelfBean.bookInfoBean = (BookInfoBean) bookInfoBean.clone();
return bookShelfBean;
}
}

@ -1,152 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.bean;
import android.os.Parcel;
import android.os.Parcelable;
import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Transient;
import org.greenrobot.greendao.annotation.Generated;
/**
*
*/
@Entity
public class ChapterListBean implements Parcelable,Cloneable{
private String noteUrl; //对应BookInfoBean noteUrl;
private int durChapterIndex; //当前章节数
@Id
private String durChapterUrl; //当前章节对应的文章地址
private String durChapterName; //当前章节名称
private String tag;
private Boolean hasCache = false;
@Transient
private BookContentBean bookContentBean = new BookContentBean();
protected ChapterListBean(Parcel in) {
noteUrl = in.readString();
durChapterIndex = in.readInt();
durChapterUrl = in.readString();
durChapterName = in.readString();
tag = in.readString();
bookContentBean = in.readParcelable(BookContentBean.class.getClassLoader());
hasCache = in.readByte() != 0;
}
@Generated(hash = 1225922702)
public ChapterListBean(String noteUrl, int durChapterIndex, String durChapterUrl,
String durChapterName, String tag, Boolean hasCache) {
this.noteUrl = noteUrl;
this.durChapterIndex = durChapterIndex;
this.durChapterUrl = durChapterUrl;
this.durChapterName = durChapterName;
this.tag = tag;
this.hasCache = hasCache;
}
@Generated(hash = 1096893365)
public ChapterListBean() {
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(noteUrl);
dest.writeInt(durChapterIndex);
dest.writeString(durChapterUrl);
dest.writeString(durChapterName);
dest.writeString(tag);
dest.writeParcelable(bookContentBean, flags);
dest.writeByte((byte)(hasCache?1:0));
}
@Override
public int describeContents() {
return 0;
}
public BookContentBean getBookContentBean() {
return bookContentBean;
}
public void setBookContentBean(BookContentBean bookContentBean) {
this.bookContentBean = bookContentBean;
}
public Boolean getHasCache() {
return this.hasCache;
}
public void setHasCache(Boolean hasCache) {
this.hasCache = hasCache;
}
public String getTag() {
return this.tag;
}
public void setTag(String tag) {
this.tag = tag;
}
public String getDurChapterName() {
return this.durChapterName;
}
public void setDurChapterName(String durChapterName) {
this.durChapterName = durChapterName;
}
public String getDurChapterUrl() {
return this.durChapterUrl;
}
public void setDurChapterUrl(String durChapterUrl) {
this.durChapterUrl = durChapterUrl;
}
public int getDurChapterIndex() {
return this.durChapterIndex;
}
public void setDurChapterIndex(int durChapterIndex) {
this.durChapterIndex = durChapterIndex;
}
public String getNoteUrl() {
return this.noteUrl;
}
public void setNoteUrl(String noteUrl) {
this.noteUrl = noteUrl;
}
@Transient
public static final Creator<ChapterListBean> CREATOR = new Creator<ChapterListBean>() {
@Override
public ChapterListBean createFromParcel(Parcel in) {
return new ChapterListBean(in);
}
@Override
public ChapterListBean[] newArray(int size) {
return new ChapterListBean[size];
}
};
@Override
protected Object clone() throws CloneNotSupportedException {
ChapterListBean chapterListBean = (ChapterListBean) super.clone();
chapterListBean.noteUrl = noteUrl;
chapterListBean.durChapterUrl = durChapterUrl;
chapterListBean.durChapterName = durChapterName;
chapterListBean.tag = tag;
chapterListBean.hasCache = hasCache;
chapterListBean.bookContentBean = new BookContentBean();
return chapterListBean;
}
}

@ -1,137 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.bean;
import android.os.Parcel;
import android.os.Parcelable;
import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Transient;
import org.greenrobot.greendao.annotation.Generated;
@Entity
public class DownloadChapterBean implements Parcelable {
private String noteUrl;
private int durChapterIndex; //当前章节数
@Id
private String durChapterUrl; //当前章节对应的文章地址
private String durChapterName; //当前章节名称
private String tag;
private String bookName;
private String coverUrl; //小说封面
protected DownloadChapterBean(Parcel in) {
noteUrl = in.readString();
durChapterIndex = in.readInt();
durChapterUrl = in.readString();
durChapterName = in.readString();
tag = in.readString();
bookName = in.readString();
coverUrl = in.readString();
}
@Generated(hash = 757008458)
public DownloadChapterBean(String noteUrl, int durChapterIndex, String durChapterUrl,
String durChapterName, String tag, String bookName, String coverUrl) {
this.noteUrl = noteUrl;
this.durChapterIndex = durChapterIndex;
this.durChapterUrl = durChapterUrl;
this.durChapterName = durChapterName;
this.tag = tag;
this.bookName = bookName;
this.coverUrl = coverUrl;
}
@Generated(hash = 301211198)
public DownloadChapterBean() {
}
@Transient
public static final Creator<DownloadChapterBean> CREATOR = new Creator<DownloadChapterBean>() {
@Override
public DownloadChapterBean createFromParcel(Parcel in) {
return new DownloadChapterBean(in);
}
@Override
public DownloadChapterBean[] newArray(int size) {
return new DownloadChapterBean[size];
}
};
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(noteUrl);
dest.writeInt(durChapterIndex);
dest.writeString(durChapterUrl);
dest.writeString(durChapterName);
dest.writeString(tag);
dest.writeString(bookName);
dest.writeString(coverUrl);
}
public String getNoteUrl() {
return noteUrl;
}
public void setNoteUrl(String noteUrl) {
this.noteUrl = noteUrl;
}
public int getDurChapterIndex() {
return durChapterIndex;
}
public void setDurChapterIndex(int durChapterIndex) {
this.durChapterIndex = durChapterIndex;
}
public String getDurChapterUrl() {
return durChapterUrl;
}
public void setDurChapterUrl(String durChapterUrl) {
this.durChapterUrl = durChapterUrl;
}
public String getDurChapterName() {
return durChapterName;
}
public void setDurChapterName(String durChapterName) {
this.durChapterName = durChapterName;
}
public String getTag() {
return tag;
}
public void setTag(String tag) {
this.tag = tag;
}
public String getBookName() {
return bookName;
}
public void setBookName(String bookName) {
this.bookName = bookName;
}
public String getCoverUrl() {
return coverUrl;
}
public void setCoverUrl(String coverUrl) {
this.coverUrl = coverUrl;
}
}

@ -1,54 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.bean;
import android.os.Parcel;
import android.os.Parcelable;
import java.util.ArrayList;
import java.util.List;
/**
*
*/
public class DownloadChapterListBean implements Parcelable {
private List<DownloadChapterBean> data;
public DownloadChapterListBean(List<DownloadChapterBean> result) {
this.data = result;
}
protected DownloadChapterListBean(Parcel in) {
if(data == null)
data = new ArrayList<>();
in.readTypedList(data,DownloadChapterBean.CREATOR);
}
public static final Creator<DownloadChapterListBean> CREATOR = new Creator<DownloadChapterListBean>() {
@Override
public DownloadChapterListBean createFromParcel(Parcel in) {
return new DownloadChapterListBean(in);
}
@Override
public DownloadChapterListBean[] newArray(int size) {
return new DownloadChapterListBean[size];
}
};
public List<DownloadChapterBean> getData() {
return data;
}
public void setData(List<DownloadChapterBean> data) {
this.data = data;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeTypedList(data);
}
}

@ -1,28 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.bean;
import java.util.List;
/**
* Data bean
*/
public class LibraryBean {
private List<LibraryNewBookBean> libraryNewBooks;
private List<LibraryKindBookListBean> kindBooks;
public List<LibraryNewBookBean> getLibraryNewBooks() {
return libraryNewBooks;
}
public void setLibraryNewBooks(List<LibraryNewBookBean> libraryNewBooks) {
this.libraryNewBooks = libraryNewBooks;
}
public List<LibraryKindBookListBean> getKindBooks() {
return kindBooks;
}
public void setKindBooks(List<LibraryKindBookListBean> kindBooks) {
this.kindBooks = kindBooks;
}
}

@ -1,37 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.bean;
import java.util.List;
/**
*
*/
public class LibraryKindBookListBean {
private String kindName;
private String kindUrl;
private List<SearchBookBean> books;
public String getKindName() {
return kindName;
}
public void setKindName(String kindName) {
this.kindName = kindName;
}
public List<SearchBookBean> getBooks() {
return books;
}
public void setBooks(List<SearchBookBean> books) {
this.books = books;
}
public String getKindUrl() {
return kindUrl;
}
public void setKindUrl(String kindUrl) {
this.kindUrl = kindUrl;
}
}

@ -1,48 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.bean;
public class LibraryNewBookBean {
private String name;
private String url;
private String tag;
private String orgin;
public LibraryNewBookBean(String name, String url, String tag, String orgin) {
this.name = name;
this.url = url;
this.tag = tag;
this.orgin = orgin;
}
public String getOrgin() {
return orgin;
}
public void setOrgin(String orgin) {
this.orgin = orgin;
}
public String getTag() {
return tag;
}
public void setTag(String tag) {
this.tag = tag;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
}

@ -1,28 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.bean;
public class LocBookShelfBean {
private Boolean isNew;
private BookShelfBean bookShelfBean;
public LocBookShelfBean(Boolean isNew,BookShelfBean bookShelfBean){
this.isNew = isNew;
this.bookShelfBean = bookShelfBean;
}
public Boolean getNew() {
return isNew;
}
public void setNew(Boolean aNew) {
isNew = aNew;
}
public BookShelfBean getBookShelfBean() {
return bookShelfBean;
}
public void setBookShelfBean(BookShelfBean bookShelfBean) {
this.bookShelfBean = bookShelfBean;
}
}

@ -1,30 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.bean;
import java.util.List;
public class ReadBookContentBean {
private List<BookContentBean> bookContentList;
private int pageIndex;
public ReadBookContentBean(List<BookContentBean> bookContentList,int pageIndex){
this.bookContentList = bookContentList;
this.pageIndex = pageIndex;
}
public List<BookContentBean> getBookContentList() {
return bookContentList;
}
public void setBookContentList(List<BookContentBean> bookContentList) {
this.bookContentList = bookContentList;
}
public int getPageIndex() {
return pageIndex;
}
public void setPageIndex(int pageIndex) {
this.pageIndex = pageIndex;
}
}

@ -1,180 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.bean;
import android.os.Parcel;
import android.os.Parcelable;
public class SearchBookBean implements Parcelable{
private String noteUrl;
private String coverUrl;
private String name;
private String author;
private long words;
private String state;
private String lastChapter;
private Boolean isAdd = false;
private String tag;
private String kind;
private String origin;
private String desc;
public SearchBookBean(){
}
protected SearchBookBean(Parcel in) {
noteUrl = in.readString();
coverUrl = in.readString();
name = in.readString();
author = in.readString();
words = in.readLong();
state = in.readString();
lastChapter = in.readString();
isAdd = in.readByte() != 0;
tag = in.readString();
kind = in.readString();
origin = in.readString();
desc = in.readString();
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(noteUrl);
dest.writeString(coverUrl);
dest.writeString(name);
dest.writeString(author);
dest.writeLong(words);
dest.writeString(state);
dest.writeString(lastChapter);
dest.writeByte((byte)(isAdd?1:0));
dest.writeString(tag);
dest.writeString(kind);
dest.writeString(origin);
dest.writeString(desc);
}
@Override
public int describeContents() {
return 0;
}
public static final Creator<SearchBookBean> CREATOR = new Creator<SearchBookBean>() {
@Override
public SearchBookBean createFromParcel(Parcel in) {
return new SearchBookBean(in);
}
@Override
public SearchBookBean[] newArray(int size) {
return new SearchBookBean[size];
}
};
public String getNoteUrl() {
return noteUrl;
}
public void setNoteUrl(String noteUrl) {
this.noteUrl = noteUrl;
}
public String getCoverUrl() {
return coverUrl;
}
public void setCoverUrl(String coverUrl) {
this.coverUrl = coverUrl;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public Boolean getAdd() {
return isAdd;
}
public void setAdd(Boolean add) {
isAdd = add;
}
public long getWords() {
return words;
}
public void setWords(long words) {
this.words = words;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getLastChapter() {
return lastChapter==null?"":lastChapter;
}
public void setLastChapter(String lastChapter) {
this.lastChapter = lastChapter;
}
public String getKind() {
return kind;
}
public void setKind(String kind) {
this.kind = kind;
}
public String getTag() {
return tag;
}
public void setTag(String tag) {
this.tag = tag;
}
public String getOrigin() {
return origin;
}
public void setOrigin(String origin) {
this.origin = origin;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
}

@ -1,57 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.bean;
import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Unique;
import org.greenrobot.greendao.annotation.Generated;
@Entity
public class SearchHistoryBean {
@Id(autoincrement = true)
private Long id = null;
private int type;
private String content;
private long date;
public long getDate() {
return this.date;
}
public void setDate(long date) {
this.date = date;
}
public String getContent() {
return this.content;
}
public void setContent(String content) {
this.content = content;
}
public int getType() {
return this.type;
}
public void setType(int type) {
this.type = type;
}
public Long getId() {
return this.id;
}
public void setId(Long id) {
this.id = id;
}
public SearchHistoryBean(int type, String content, long date) {
this.type = type;
this.content = content;
this.date = date;
}
@Generated(hash = 488115752)
public SearchHistoryBean(Long id, int type, String content, long date) {
this.id = id;
this.type = type;
this.content = content;
this.date = date;
}
@Generated(hash = 1570282321)
public SearchHistoryBean() {
}
}

@ -1,29 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.bean;
public class WebChapterBean<T> {
private T data;
private Boolean next;
public WebChapterBean(T data,Boolean next){
this.data = data;
this.next = next;
}
public T getData() {
return data;
}
public void setData(T data) {
this.data = data;
}
public Boolean getNext() {
return next;
}
public void setNext(Boolean next) {
this.next = next;
}
}

@ -1,28 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.bean;
public class WebContentBean {
private String url;
private String content;
public WebContentBean(String url,String content){
this.url = url;
this.content = content;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
}

@ -1,43 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.cache;
import android.content.Context;
import android.content.SharedPreferences;
/**
* 使SP
*/
public class ACache {
private SharedPreferences preference;
private ACache(Context ctx){
preference = ctx.getSharedPreferences("ACache",0);
}
public static ACache get(Context ctx) {
return new ACache(ctx);
}
public void put(String key, String value) {
try{
SharedPreferences.Editor editor = preference.edit();
editor.putString(key, value);
editor.commit();
}catch (Exception e){
}
}
/**
* String
*
* @param key
* @return String
*/
public String getAsString(String key) {
try{
return preference.getString(key,null);
}catch (Exception e){
return null;
}
}
}

@ -1,25 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.common;
public class RxBusTag {
public final static String HAD_ADD_BOOK = "rxbus_add_book";
public final static String HAD_REMOVE_BOOK = "rxbus_remove_book";
public final static String UPDATE_BOOK_PROGRESS = "rxbus_update_book_progress";
public final static String PAUSE_DOWNLOAD_LISTENER = "rxbus_pause_download_listener";
public final static String PROGRESS_DOWNLOAD_LISTENER = "rxbus_progress_download_listener";
public final static String FINISH_DOWNLOAD_LISTENER = "rxbus_finish_download_listener";
public final static String PAUSE_DOWNLOAD = "rxbus_pause_download";
public final static String START_DOWNLOAD = "rxbus_start_download";
public final static String CANCEL_DOWNLOAD = "rxbus_cancel_download";
public final static String ADD_DOWNLOAD_TASK = "rxbus_add_download_task";
}

@ -1,44 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.common.api;
import io.reactivex.Observable;
import retrofit2.http.GET;
import retrofit2.http.Headers;
import retrofit2.http.Url;
/**
* API ( )
*/
public interface IEasouApi {
@GET
@Headers({"Accept:text/html,application/xhtml+xml,application/xml",
"User-Agent:Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3",
"Accept-Charset:UTF-8",
"Connection:close",
"Cache-Control:no-cache"})
Observable<String> getBookInfo(@Url String url);
@GET
@Headers({"Accept:text/html,application/xhtml+xml,application/xml",
"User-Agent:Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3",
"Accept-Charset:UTF-8",
"Connection:close",
"Cache-Control:no-cache"})
Observable<String> searchBook(@Url String url);
@GET
@Headers({"Accept:text/html,application/xhtml+xml,application/xml",
"User-Agent:Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3",
"Accept-Charset:UTF-8",
"Connection:close",
"Cache-Control:no-cache"})
Observable<String> getBookContent(@Url String url);
@GET
@Headers({"Accept:text/html,application/xhtml+xml,application/xml",
"User-Agent:Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3",
"Accept-Charset:UTF-8",
"Connection:close",
"Cache-Control:no-cache"})
Observable<String> getChapterList(@Url String url);
}

@ -1,61 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.common.api;
import io.reactivex.Observable;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Headers;
import retrofit2.http.Query;
import retrofit2.http.Url;
public interface IGxwztvApi {
@GET
@Headers({"Accept:text/html,application/xhtml+xml,application/xml",
"User-Agent:Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3",
"Accept-Charset:UTF-8",
"Connection:close",
"Cache-Control:no-cache"})
Observable<String> getBookInfo(@Url String url);
@GET("/search.htm")
@Headers({"Accept:text/html,application/xhtml+xml,application/xml",
"User-Agent:Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3",
"Accept-Charset:UTF-8",
"Connection:close",
"Cache-Control:no-cache"})
Observable<String> searchBook(@Query("keyword")String content, @Query("pn")int page);
@GET
@Headers({"Accept:text/html,application/xhtml+xml,application/xml",
"User-Agent:Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3",
"Accept-Charset:UTF-8",
"Connection:close",
"Cache-Control:no-cache"})
Observable<String> getBookContent(@Url String url);
@GET
@Headers({"Accept:text/html,application/xhtml+xml,application/xml",
"User-Agent:Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3",
"Accept-Charset:UTF-8",
"Connection:close",
"Cache-Control:no-cache"})
Observable<String> getChapterList(@Url String url);
@GET
@Headers({"Accept:text/html,application/xhtml+xml,application/xml",
"User-Agent:Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3",
"Accept-Charset:UTF-8",
"Connection:close",
"Cache-Control:no-cache"})
Observable<String> getKindBooks(@Url String url);
@GET
@Headers({"Accept:text/html,application/xhtml+xml,application/xml",
"User-Agent:Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3",
"Accept-Charset:UTF-8",
"Connection:close",
"Cache-Control:no-cache"})
Observable<String> getLibraryData(@Url String url);
}

@ -1,43 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.common.api;
import io.reactivex.Observable;
import retrofit2.http.GET;
import retrofit2.http.Headers;
import retrofit2.http.Query;
import retrofit2.http.Url;
public interface ILingdiankanshuApi {
@GET
@Headers({"Accept:text/html,application/xhtml+xml,application/xml",
"User-Agent:Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3",
"Accept-Charset:UTF-8",
"Connection:close",
"Cache-Control:no-cache"})
Observable<String> getBookInfo(@Url String url);
@GET("/cse/search")
@Headers({"Accept:text/html,application/xhtml+xml,application/xml",
"User-Agent:Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3",
"Accept-Charset:UTF-8",
"Connection:close",
"Cache-Control:no-cache"})
Observable<String> searchBook(@Query("q") String content, @Query("p") int page, @Query("s") String time);
@GET
@Headers({"Accept:text/html,application/xhtml+xml,application/xml",
"User-Agent:Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3",
"Accept-Charset:UTF-8",
"Connection:close",
"Cache-Control:no-cache"})
Observable<String> getBookContent(@Url String url);
@GET
@Headers({"Accept:text/html,application/xhtml+xml,application/xml",
"User-Agent:Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3",
"Accept-Charset:UTF-8",
"Connection:close",
"Cache-Control:no-cache"})
Observable<String> getChapterList(@Url String url);
}

@ -1,143 +0,0 @@
package com.monke.monkeybook.dao;
import android.database.Cursor;
import android.database.sqlite.SQLiteStatement;
import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.Property;
import org.greenrobot.greendao.internal.DaoConfig;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.database.DatabaseStatement;
import com.monke.monkeybook.bean.BookContentBean;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
* DAO for table "BOOK_CONTENT_BEAN".
*/
public class BookContentBeanDao extends AbstractDao<BookContentBean, String> {
public static final String TABLENAME = "BOOK_CONTENT_BEAN";
/**
* Properties of entity BookContentBean.<br/>
* Can be used for QueryBuilder and for referencing column names.
*/
public static class Properties {
public final static Property DurChapterUrl = new Property(0, String.class, "durChapterUrl", true, "DUR_CHAPTER_URL");
public final static Property DurChapterIndex = new Property(1, int.class, "durChapterIndex", false, "DUR_CHAPTER_INDEX");
public final static Property DurCapterContent = new Property(2, String.class, "durCapterContent", false, "DUR_CAPTER_CONTENT");
public final static Property Tag = new Property(3, String.class, "tag", false, "TAG");
};
public BookContentBeanDao(DaoConfig config) {
super(config);
}
public BookContentBeanDao(DaoConfig config, DaoSession daoSession) {
super(config, daoSession);
}
/** Creates the underlying database table. */
public static void createTable(Database db, boolean ifNotExists) {
String constraint = ifNotExists? "IF NOT EXISTS ": "";
db.execSQL("CREATE TABLE " + constraint + "\"BOOK_CONTENT_BEAN\" (" + //
"\"DUR_CHAPTER_URL\" TEXT PRIMARY KEY NOT NULL ," + // 0: durChapterUrl
"\"DUR_CHAPTER_INDEX\" INTEGER NOT NULL ," + // 1: durChapterIndex
"\"DUR_CAPTER_CONTENT\" TEXT," + // 2: durCapterContent
"\"TAG\" TEXT);"); // 3: tag
}
/** Drops the underlying database table. */
public static void dropTable(Database db, boolean ifExists) {
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"BOOK_CONTENT_BEAN\"";
db.execSQL(sql);
}
@Override
protected final void bindValues(DatabaseStatement stmt, BookContentBean entity) {
stmt.clearBindings();
String durChapterUrl = entity.getDurChapterUrl();
if (durChapterUrl != null) {
stmt.bindString(1, durChapterUrl);
}
stmt.bindLong(2, entity.getDurChapterIndex());
String durCapterContent = entity.getDurCapterContent();
if (durCapterContent != null) {
stmt.bindString(3, durCapterContent);
}
String tag = entity.getTag();
if (tag != null) {
stmt.bindString(4, tag);
}
}
@Override
protected final void bindValues(SQLiteStatement stmt, BookContentBean entity) {
stmt.clearBindings();
String durChapterUrl = entity.getDurChapterUrl();
if (durChapterUrl != null) {
stmt.bindString(1, durChapterUrl);
}
stmt.bindLong(2, entity.getDurChapterIndex());
String durCapterContent = entity.getDurCapterContent();
if (durCapterContent != null) {
stmt.bindString(3, durCapterContent);
}
String tag = entity.getTag();
if (tag != null) {
stmt.bindString(4, tag);
}
}
@Override
public String readKey(Cursor cursor, int offset) {
return cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0);
}
@Override
public BookContentBean readEntity(Cursor cursor, int offset) {
BookContentBean entity = new BookContentBean( //
cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0), // durChapterUrl
cursor.getInt(offset + 1), // durChapterIndex
cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // durCapterContent
cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3) // tag
);
return entity;
}
@Override
public void readEntity(Cursor cursor, BookContentBean entity, int offset) {
entity.setDurChapterUrl(cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0));
entity.setDurChapterIndex(cursor.getInt(offset + 1));
entity.setDurCapterContent(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
entity.setTag(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
}
@Override
protected final String updateKeyAfterInsert(BookContentBean entity, long rowId) {
return entity.getDurChapterUrl();
}
@Override
public String getKey(BookContentBean entity) {
if(entity != null) {
return entity.getDurChapterUrl();
} else {
return null;
}
}
@Override
protected final boolean isEntityUpdateable() {
return true;
}
}

@ -1,213 +0,0 @@
package com.monke.monkeybook.dao;
import android.database.Cursor;
import android.database.sqlite.SQLiteStatement;
import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.Property;
import org.greenrobot.greendao.internal.DaoConfig;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.database.DatabaseStatement;
import com.monke.monkeybook.bean.BookInfoBean;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
* DAO for table "BOOK_INFO_BEAN".
*/
public class BookInfoBeanDao extends AbstractDao<BookInfoBean, String> {
public static final String TABLENAME = "BOOK_INFO_BEAN";
/**
* Properties of entity BookInfoBean.<br/>
* Can be used for QueryBuilder and for referencing column names.
*/
public static class Properties {
public final static Property Name = new Property(0, String.class, "name", false, "NAME");
public final static Property Tag = new Property(1, String.class, "tag", false, "TAG");
public final static Property NoteUrl = new Property(2, String.class, "noteUrl", true, "NOTE_URL");
public final static Property ChapterUrl = new Property(3, String.class, "chapterUrl", false, "CHAPTER_URL");
public final static Property FinalRefreshData = new Property(4, long.class, "finalRefreshData", false, "FINAL_REFRESH_DATA");
public final static Property CoverUrl = new Property(5, String.class, "coverUrl", false, "COVER_URL");
public final static Property Author = new Property(6, String.class, "author", false, "AUTHOR");
public final static Property Introduce = new Property(7, String.class, "introduce", false, "INTRODUCE");
public final static Property Origin = new Property(8, String.class, "origin", false, "ORIGIN");
};
public BookInfoBeanDao(DaoConfig config) {
super(config);
}
public BookInfoBeanDao(DaoConfig config, DaoSession daoSession) {
super(config, daoSession);
}
/** Creates the underlying database table. */
public static void createTable(Database db, boolean ifNotExists) {
String constraint = ifNotExists? "IF NOT EXISTS ": "";
db.execSQL("CREATE TABLE " + constraint + "\"BOOK_INFO_BEAN\" (" + //
"\"NAME\" TEXT," + // 0: name
"\"TAG\" TEXT," + // 1: tag
"\"NOTE_URL\" TEXT PRIMARY KEY NOT NULL ," + // 2: noteUrl
"\"CHAPTER_URL\" TEXT," + // 3: chapterUrl
"\"FINAL_REFRESH_DATA\" INTEGER NOT NULL ," + // 4: finalRefreshData
"\"COVER_URL\" TEXT," + // 5: coverUrl
"\"AUTHOR\" TEXT," + // 6: author
"\"INTRODUCE\" TEXT," + // 7: introduce
"\"ORIGIN\" TEXT);"); // 8: origin
}
/** Drops the underlying database table. */
public static void dropTable(Database db, boolean ifExists) {
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"BOOK_INFO_BEAN\"";
db.execSQL(sql);
}
@Override
protected final void bindValues(DatabaseStatement stmt, BookInfoBean entity) {
stmt.clearBindings();
String name = entity.getName();
if (name != null) {
stmt.bindString(1, name);
}
String tag = entity.getTag();
if (tag != null) {
stmt.bindString(2, tag);
}
String noteUrl = entity.getNoteUrl();
if (noteUrl != null) {
stmt.bindString(3, noteUrl);
}
String chapterUrl = entity.getChapterUrl();
if (chapterUrl != null) {
stmt.bindString(4, chapterUrl);
}
stmt.bindLong(5, entity.getFinalRefreshData());
String coverUrl = entity.getCoverUrl();
if (coverUrl != null) {
stmt.bindString(6, coverUrl);
}
String author = entity.getAuthor();
if (author != null) {
stmt.bindString(7, author);
}
String introduce = entity.getIntroduce();
if (introduce != null) {
stmt.bindString(8, introduce);
}
String origin = entity.getOrigin();
if (origin != null) {
stmt.bindString(9, origin);
}
}
@Override
protected final void bindValues(SQLiteStatement stmt, BookInfoBean entity) {
stmt.clearBindings();
String name = entity.getName();
if (name != null) {
stmt.bindString(1, name);
}
String tag = entity.getTag();
if (tag != null) {
stmt.bindString(2, tag);
}
String noteUrl = entity.getNoteUrl();
if (noteUrl != null) {
stmt.bindString(3, noteUrl);
}
String chapterUrl = entity.getChapterUrl();
if (chapterUrl != null) {
stmt.bindString(4, chapterUrl);
}
stmt.bindLong(5, entity.getFinalRefreshData());
String coverUrl = entity.getCoverUrl();
if (coverUrl != null) {
stmt.bindString(6, coverUrl);
}
String author = entity.getAuthor();
if (author != null) {
stmt.bindString(7, author);
}
String introduce = entity.getIntroduce();
if (introduce != null) {
stmt.bindString(8, introduce);
}
String origin = entity.getOrigin();
if (origin != null) {
stmt.bindString(9, origin);
}
}
@Override
public String readKey(Cursor cursor, int offset) {
return cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2);
}
@Override
public BookInfoBean readEntity(Cursor cursor, int offset) {
BookInfoBean entity = new BookInfoBean( //
cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0), // name
cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // tag
cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // noteUrl
cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // chapterUrl
cursor.getLong(offset + 4), // finalRefreshData
cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // coverUrl
cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // author
cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // introduce
cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8) // origin
);
return entity;
}
@Override
public void readEntity(Cursor cursor, BookInfoBean entity, int offset) {
entity.setName(cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0));
entity.setTag(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
entity.setNoteUrl(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
entity.setChapterUrl(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
entity.setFinalRefreshData(cursor.getLong(offset + 4));
entity.setCoverUrl(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5));
entity.setAuthor(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6));
entity.setIntroduce(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7));
entity.setOrigin(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8));
}
@Override
protected final String updateKeyAfterInsert(BookInfoBean entity, long rowId) {
return entity.getNoteUrl();
}
@Override
public String getKey(BookInfoBean entity) {
if(entity != null) {
return entity.getNoteUrl();
} else {
return null;
}
}
@Override
protected final boolean isEntityUpdateable() {
return true;
}
}

@ -1,141 +0,0 @@
package com.monke.monkeybook.dao;
import android.database.Cursor;
import android.database.sqlite.SQLiteStatement;
import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.Property;
import org.greenrobot.greendao.internal.DaoConfig;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.database.DatabaseStatement;
import com.monke.monkeybook.bean.BookShelfBean;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
* DAO for table "BOOK_SHELF_BEAN".
*/
public class BookShelfBeanDao extends AbstractDao<BookShelfBean, String> {
public static final String TABLENAME = "BOOK_SHELF_BEAN";
/**
* Properties of entity BookShelfBean.<br/>
* Can be used for QueryBuilder and for referencing column names.
*/
public static class Properties {
public final static Property NoteUrl = new Property(0, String.class, "noteUrl", true, "NOTE_URL");
public final static Property DurChapter = new Property(1, int.class, "durChapter", false, "DUR_CHAPTER");
public final static Property DurChapterPage = new Property(2, int.class, "durChapterPage", false, "DUR_CHAPTER_PAGE");
public final static Property FinalDate = new Property(3, long.class, "finalDate", false, "FINAL_DATE");
public final static Property Tag = new Property(4, String.class, "tag", false, "TAG");
};
public BookShelfBeanDao(DaoConfig config) {
super(config);
}
public BookShelfBeanDao(DaoConfig config, DaoSession daoSession) {
super(config, daoSession);
}
/** Creates the underlying database table. */
public static void createTable(Database db, boolean ifNotExists) {
String constraint = ifNotExists? "IF NOT EXISTS ": "";
db.execSQL("CREATE TABLE " + constraint + "\"BOOK_SHELF_BEAN\" (" + //
"\"NOTE_URL\" TEXT PRIMARY KEY NOT NULL ," + // 0: noteUrl
"\"DUR_CHAPTER\" INTEGER NOT NULL ," + // 1: durChapter
"\"DUR_CHAPTER_PAGE\" INTEGER NOT NULL ," + // 2: durChapterPage
"\"FINAL_DATE\" INTEGER NOT NULL ," + // 3: finalDate
"\"TAG\" TEXT);"); // 4: tag
}
/** Drops the underlying database table. */
public static void dropTable(Database db, boolean ifExists) {
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"BOOK_SHELF_BEAN\"";
db.execSQL(sql);
}
@Override
protected final void bindValues(DatabaseStatement stmt, BookShelfBean entity) {
stmt.clearBindings();
String noteUrl = entity.getNoteUrl();
if (noteUrl != null) {
stmt.bindString(1, noteUrl);
}
stmt.bindLong(2, entity.getDurChapter());
stmt.bindLong(3, entity.getDurChapterPage());
stmt.bindLong(4, entity.getFinalDate());
String tag = entity.getTag();
if (tag != null) {
stmt.bindString(5, tag);
}
}
@Override
protected final void bindValues(SQLiteStatement stmt, BookShelfBean entity) {
stmt.clearBindings();
String noteUrl = entity.getNoteUrl();
if (noteUrl != null) {
stmt.bindString(1, noteUrl);
}
stmt.bindLong(2, entity.getDurChapter());
stmt.bindLong(3, entity.getDurChapterPage());
stmt.bindLong(4, entity.getFinalDate());
String tag = entity.getTag();
if (tag != null) {
stmt.bindString(5, tag);
}
}
@Override
public String readKey(Cursor cursor, int offset) {
return cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0);
}
@Override
public BookShelfBean readEntity(Cursor cursor, int offset) {
BookShelfBean entity = new BookShelfBean( //
cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0), // noteUrl
cursor.getInt(offset + 1), // durChapter
cursor.getInt(offset + 2), // durChapterPage
cursor.getLong(offset + 3), // finalDate
cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4) // tag
);
return entity;
}
@Override
public void readEntity(Cursor cursor, BookShelfBean entity, int offset) {
entity.setNoteUrl(cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0));
entity.setDurChapter(cursor.getInt(offset + 1));
entity.setDurChapterPage(cursor.getInt(offset + 2));
entity.setFinalDate(cursor.getLong(offset + 3));
entity.setTag(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
}
@Override
protected final String updateKeyAfterInsert(BookShelfBean entity, long rowId) {
return entity.getNoteUrl();
}
@Override
public String getKey(BookShelfBean entity) {
if(entity != null) {
return entity.getNoteUrl();
} else {
return null;
}
}
@Override
protected final boolean isEntityUpdateable() {
return true;
}
}

@ -1,171 +0,0 @@
package com.monke.monkeybook.dao;
import android.database.Cursor;
import android.database.sqlite.SQLiteStatement;
import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.Property;
import org.greenrobot.greendao.internal.DaoConfig;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.database.DatabaseStatement;
import com.monke.monkeybook.bean.ChapterListBean;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
* DAO for table "CHAPTER_LIST_BEAN".
*/
public class ChapterListBeanDao extends AbstractDao<ChapterListBean, String> {
public static final String TABLENAME = "CHAPTER_LIST_BEAN";
/**
* Properties of entity ChapterListBean.<br/>
* Can be used for QueryBuilder and for referencing column names.
*/
public static class Properties {
public final static Property NoteUrl = new Property(0, String.class, "noteUrl", false, "NOTE_URL");
public final static Property DurChapterIndex = new Property(1, int.class, "durChapterIndex", false, "DUR_CHAPTER_INDEX");
public final static Property DurChapterUrl = new Property(2, String.class, "durChapterUrl", true, "DUR_CHAPTER_URL");
public final static Property DurChapterName = new Property(3, String.class, "durChapterName", false, "DUR_CHAPTER_NAME");
public final static Property Tag = new Property(4, String.class, "tag", false, "TAG");
public final static Property HasCache = new Property(5, Boolean.class, "hasCache", false, "HAS_CACHE");
};
public ChapterListBeanDao(DaoConfig config) {
super(config);
}
public ChapterListBeanDao(DaoConfig config, DaoSession daoSession) {
super(config, daoSession);
}
/** Creates the underlying database table. */
public static void createTable(Database db, boolean ifNotExists) {
String constraint = ifNotExists? "IF NOT EXISTS ": "";
db.execSQL("CREATE TABLE " + constraint + "\"CHAPTER_LIST_BEAN\" (" + //
"\"NOTE_URL\" TEXT," + // 0: noteUrl
"\"DUR_CHAPTER_INDEX\" INTEGER NOT NULL ," + // 1: durChapterIndex
"\"DUR_CHAPTER_URL\" TEXT PRIMARY KEY NOT NULL ," + // 2: durChapterUrl
"\"DUR_CHAPTER_NAME\" TEXT," + // 3: durChapterName
"\"TAG\" TEXT," + // 4: tag
"\"HAS_CACHE\" INTEGER);"); // 5: hasCache
}
/** Drops the underlying database table. */
public static void dropTable(Database db, boolean ifExists) {
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"CHAPTER_LIST_BEAN\"";
db.execSQL(sql);
}
@Override
protected final void bindValues(DatabaseStatement stmt, ChapterListBean entity) {
stmt.clearBindings();
String noteUrl = entity.getNoteUrl();
if (noteUrl != null) {
stmt.bindString(1, noteUrl);
}
stmt.bindLong(2, entity.getDurChapterIndex());
String durChapterUrl = entity.getDurChapterUrl();
if (durChapterUrl != null) {
stmt.bindString(3, durChapterUrl);
}
String durChapterName = entity.getDurChapterName();
if (durChapterName != null) {
stmt.bindString(4, durChapterName);
}
String tag = entity.getTag();
if (tag != null) {
stmt.bindString(5, tag);
}
Boolean hasCache = entity.getHasCache();
if (hasCache != null) {
stmt.bindLong(6, hasCache ? 1L: 0L);
}
}
@Override
protected final void bindValues(SQLiteStatement stmt, ChapterListBean entity) {
stmt.clearBindings();
String noteUrl = entity.getNoteUrl();
if (noteUrl != null) {
stmt.bindString(1, noteUrl);
}
stmt.bindLong(2, entity.getDurChapterIndex());
String durChapterUrl = entity.getDurChapterUrl();
if (durChapterUrl != null) {
stmt.bindString(3, durChapterUrl);
}
String durChapterName = entity.getDurChapterName();
if (durChapterName != null) {
stmt.bindString(4, durChapterName);
}
String tag = entity.getTag();
if (tag != null) {
stmt.bindString(5, tag);
}
Boolean hasCache = entity.getHasCache();
if (hasCache != null) {
stmt.bindLong(6, hasCache ? 1L: 0L);
}
}
@Override
public String readKey(Cursor cursor, int offset) {
return cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2);
}
@Override
public ChapterListBean readEntity(Cursor cursor, int offset) {
ChapterListBean entity = new ChapterListBean( //
cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0), // noteUrl
cursor.getInt(offset + 1), // durChapterIndex
cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // durChapterUrl
cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // durChapterName
cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // tag
cursor.isNull(offset + 5) ? null : cursor.getShort(offset + 5) != 0 // hasCache
);
return entity;
}
@Override
public void readEntity(Cursor cursor, ChapterListBean entity, int offset) {
entity.setNoteUrl(cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0));
entity.setDurChapterIndex(cursor.getInt(offset + 1));
entity.setDurChapterUrl(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
entity.setDurChapterName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
entity.setTag(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
entity.setHasCache(cursor.isNull(offset + 5) ? null : cursor.getShort(offset + 5) != 0);
}
@Override
protected final String updateKeyAfterInsert(ChapterListBean entity, long rowId) {
return entity.getDurChapterUrl();
}
@Override
public String getKey(ChapterListBean entity) {
if(entity != null) {
return entity.getDurChapterUrl();
} else {
return null;
}
}
@Override
protected final boolean isEntityUpdateable() {
return true;
}
}

@ -1,111 +0,0 @@
package com.monke.monkeybook.dao;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.util.Log;
import org.greenrobot.greendao.AbstractDaoMaster;
import org.greenrobot.greendao.database.StandardDatabase;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.database.DatabaseOpenHelper;
import org.greenrobot.greendao.identityscope.IdentityScopeType;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
* Master of DAO (schema version 1): knows all DAOs.
*/
public class DaoMaster extends AbstractDaoMaster {
public static final int SCHEMA_VERSION = 1;
/** Creates underlying database table using DAOs. */
public static void createAllTables(Database db, boolean ifNotExists) {
BookContentBeanDao.createTable(db, ifNotExists);
BookInfoBeanDao.createTable(db, ifNotExists);
BookShelfBeanDao.createTable(db, ifNotExists);
ChapterListBeanDao.createTable(db, ifNotExists);
DownloadChapterBeanDao.createTable(db, ifNotExists);
SearchHistoryBeanDao.createTable(db, ifNotExists);
}
/** Drops underlying database table using DAOs. */
public static void dropAllTables(Database db, boolean ifExists) {
BookContentBeanDao.dropTable(db, ifExists);
BookInfoBeanDao.dropTable(db, ifExists);
BookShelfBeanDao.dropTable(db, ifExists);
ChapterListBeanDao.dropTable(db, ifExists);
DownloadChapterBeanDao.dropTable(db, ifExists);
SearchHistoryBeanDao.dropTable(db, ifExists);
}
/**
* WARNING: Drops all table on Upgrade! Use only during development.
* Convenience method using a {@link DevOpenHelper}.
*/
public static DaoSession newDevSession(Context context, String name) {
Database db = new DevOpenHelper(context, name).getWritableDb();
DaoMaster daoMaster = new DaoMaster(db);
return daoMaster.newSession();
}
public DaoMaster(SQLiteDatabase db) {
this(new StandardDatabase(db));
}
public DaoMaster(Database db) {
super(db, SCHEMA_VERSION);
registerDaoClass(BookContentBeanDao.class);
registerDaoClass(BookInfoBeanDao.class);
registerDaoClass(BookShelfBeanDao.class);
registerDaoClass(ChapterListBeanDao.class);
registerDaoClass(DownloadChapterBeanDao.class);
registerDaoClass(SearchHistoryBeanDao.class);
}
public DaoSession newSession() {
return new DaoSession(db, IdentityScopeType.Session, daoConfigMap);
}
public DaoSession newSession(IdentityScopeType type) {
return new DaoSession(db, type, daoConfigMap);
}
/**
* Calls {@link #createAllTables(Database, boolean)} in {@link #onCreate(Database)} -
*/
public static abstract class OpenHelper extends DatabaseOpenHelper {
public OpenHelper(Context context, String name) {
super(context, name, SCHEMA_VERSION);
}
public OpenHelper(Context context, String name, CursorFactory factory) {
super(context, name, factory, SCHEMA_VERSION);
}
@Override
public void onCreate(Database db) {
Log.i("greenDAO", "Creating tables for schema version " + SCHEMA_VERSION);
createAllTables(db, false);
}
}
/** WARNING: Drops all table on Upgrade! Use only during development. */
public static class DevOpenHelper extends OpenHelper {
public DevOpenHelper(Context context, String name) {
super(context, name);
}
public DevOpenHelper(Context context, String name, CursorFactory factory) {
super(context, name, factory);
}
@Override
public void onUpgrade(Database db, int oldVersion, int newVersion) {
Log.i("greenDAO", "Upgrading schema from version " + oldVersion + " to " + newVersion + " by dropping all tables");
dropAllTables(db, true);
onCreate(db);
}
}
}

@ -1,118 +0,0 @@
package com.monke.monkeybook.dao;
import java.util.Map;
import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.AbstractDaoSession;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.identityscope.IdentityScopeType;
import org.greenrobot.greendao.internal.DaoConfig;
import com.monke.monkeybook.bean.BookContentBean;
import com.monke.monkeybook.bean.BookInfoBean;
import com.monke.monkeybook.bean.BookShelfBean;
import com.monke.monkeybook.bean.ChapterListBean;
import com.monke.monkeybook.bean.DownloadChapterBean;
import com.monke.monkeybook.bean.SearchHistoryBean;
import com.monke.monkeybook.dao.BookContentBeanDao;
import com.monke.monkeybook.dao.BookInfoBeanDao;
import com.monke.monkeybook.dao.BookShelfBeanDao;
import com.monke.monkeybook.dao.ChapterListBeanDao;
import com.monke.monkeybook.dao.DownloadChapterBeanDao;
import com.monke.monkeybook.dao.SearchHistoryBeanDao;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
* {@inheritDoc}
*
* @see org.greenrobot.greendao.AbstractDaoSession
*/
public class DaoSession extends AbstractDaoSession {
private final DaoConfig bookContentBeanDaoConfig;
private final DaoConfig bookInfoBeanDaoConfig;
private final DaoConfig bookShelfBeanDaoConfig;
private final DaoConfig chapterListBeanDaoConfig;
private final DaoConfig downloadChapterBeanDaoConfig;
private final DaoConfig searchHistoryBeanDaoConfig;
private final BookContentBeanDao bookContentBeanDao;
private final BookInfoBeanDao bookInfoBeanDao;
private final BookShelfBeanDao bookShelfBeanDao;
private final ChapterListBeanDao chapterListBeanDao;
private final DownloadChapterBeanDao downloadChapterBeanDao;
private final SearchHistoryBeanDao searchHistoryBeanDao;
public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
daoConfigMap) {
super(db);
bookContentBeanDaoConfig = daoConfigMap.get(BookContentBeanDao.class).clone();
bookContentBeanDaoConfig.initIdentityScope(type);
bookInfoBeanDaoConfig = daoConfigMap.get(BookInfoBeanDao.class).clone();
bookInfoBeanDaoConfig.initIdentityScope(type);
bookShelfBeanDaoConfig = daoConfigMap.get(BookShelfBeanDao.class).clone();
bookShelfBeanDaoConfig.initIdentityScope(type);
chapterListBeanDaoConfig = daoConfigMap.get(ChapterListBeanDao.class).clone();
chapterListBeanDaoConfig.initIdentityScope(type);
downloadChapterBeanDaoConfig = daoConfigMap.get(DownloadChapterBeanDao.class).clone();
downloadChapterBeanDaoConfig.initIdentityScope(type);
searchHistoryBeanDaoConfig = daoConfigMap.get(SearchHistoryBeanDao.class).clone();
searchHistoryBeanDaoConfig.initIdentityScope(type);
bookContentBeanDao = new BookContentBeanDao(bookContentBeanDaoConfig, this);
bookInfoBeanDao = new BookInfoBeanDao(bookInfoBeanDaoConfig, this);
bookShelfBeanDao = new BookShelfBeanDao(bookShelfBeanDaoConfig, this);
chapterListBeanDao = new ChapterListBeanDao(chapterListBeanDaoConfig, this);
downloadChapterBeanDao = new DownloadChapterBeanDao(downloadChapterBeanDaoConfig, this);
searchHistoryBeanDao = new SearchHistoryBeanDao(searchHistoryBeanDaoConfig, this);
registerDao(BookContentBean.class, bookContentBeanDao);
registerDao(BookInfoBean.class, bookInfoBeanDao);
registerDao(BookShelfBean.class, bookShelfBeanDao);
registerDao(ChapterListBean.class, chapterListBeanDao);
registerDao(DownloadChapterBean.class, downloadChapterBeanDao);
registerDao(SearchHistoryBean.class, searchHistoryBeanDao);
}
public void clear() {
bookContentBeanDaoConfig.getIdentityScope().clear();
bookInfoBeanDaoConfig.getIdentityScope().clear();
bookShelfBeanDaoConfig.getIdentityScope().clear();
chapterListBeanDaoConfig.getIdentityScope().clear();
downloadChapterBeanDaoConfig.getIdentityScope().clear();
searchHistoryBeanDaoConfig.getIdentityScope().clear();
}
public BookContentBeanDao getBookContentBeanDao() {
return bookContentBeanDao;
}
public BookInfoBeanDao getBookInfoBeanDao() {
return bookInfoBeanDao;
}
public BookShelfBeanDao getBookShelfBeanDao() {
return bookShelfBeanDao;
}
public ChapterListBeanDao getChapterListBeanDao() {
return chapterListBeanDao;
}
public DownloadChapterBeanDao getDownloadChapterBeanDao() {
return downloadChapterBeanDao;
}
public SearchHistoryBeanDao getSearchHistoryBeanDao() {
return searchHistoryBeanDao;
}
}

@ -1,41 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.dao;
import android.database.sqlite.SQLiteDatabase;
import com.monke.monkeybook.MApplication;
public class DbHelper {
private DaoMaster.DevOpenHelper mHelper;
private SQLiteDatabase db;
private DaoMaster mDaoMaster;
private DaoSession mDaoSession;
private DbHelper(){
mHelper = new DaoMaster.DevOpenHelper(MApplication.getInstance(), "monkebook_db", null);
db = mHelper.getWritableDatabase();
// 注意:该数据库连接属于 DaoMaster所以多个 Session 指的是相同的数据库连接。
mDaoMaster = new DaoMaster(db);
mDaoSession = mDaoMaster.newSession();
}
private static DbHelper instance;
public static DbHelper getInstance(){
if(null == instance){
synchronized (DbHelper.class){
if(null == instance){
instance = new DbHelper();
}
}
}
return instance;
}
public DaoSession getmDaoSession() {
return mDaoSession;
}
public SQLiteDatabase getDb() {
return db;
}
}

@ -1,185 +0,0 @@
package com.monke.monkeybook.dao;
import android.database.Cursor;
import android.database.sqlite.SQLiteStatement;
import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.Property;
import org.greenrobot.greendao.internal.DaoConfig;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.database.DatabaseStatement;
import com.monke.monkeybook.bean.DownloadChapterBean;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
* DAO for table "DOWNLOAD_CHAPTER_BEAN".
*/
public class DownloadChapterBeanDao extends AbstractDao<DownloadChapterBean, String> {
public static final String TABLENAME = "DOWNLOAD_CHAPTER_BEAN";
/**
* Properties of entity DownloadChapterBean.<br/>
* Can be used for QueryBuilder and for referencing column names.
*/
public static class Properties {
public final static Property NoteUrl = new Property(0, String.class, "noteUrl", false, "NOTE_URL");
public final static Property DurChapterIndex = new Property(1, int.class, "durChapterIndex", false, "DUR_CHAPTER_INDEX");
public final static Property DurChapterUrl = new Property(2, String.class, "durChapterUrl", true, "DUR_CHAPTER_URL");
public final static Property DurChapterName = new Property(3, String.class, "durChapterName", false, "DUR_CHAPTER_NAME");
public final static Property Tag = new Property(4, String.class, "tag", false, "TAG");
public final static Property BookName = new Property(5, String.class, "bookName", false, "BOOK_NAME");
public final static Property CoverUrl = new Property(6, String.class, "coverUrl", false, "COVER_URL");
};
public DownloadChapterBeanDao(DaoConfig config) {
super(config);
}
public DownloadChapterBeanDao(DaoConfig config, DaoSession daoSession) {
super(config, daoSession);
}
/** Creates the underlying database table. */
public static void createTable(Database db, boolean ifNotExists) {
String constraint = ifNotExists? "IF NOT EXISTS ": "";
db.execSQL("CREATE TABLE " + constraint + "\"DOWNLOAD_CHAPTER_BEAN\" (" + //
"\"NOTE_URL\" TEXT," + // 0: noteUrl
"\"DUR_CHAPTER_INDEX\" INTEGER NOT NULL ," + // 1: durChapterIndex
"\"DUR_CHAPTER_URL\" TEXT PRIMARY KEY NOT NULL ," + // 2: durChapterUrl
"\"DUR_CHAPTER_NAME\" TEXT," + // 3: durChapterName
"\"TAG\" TEXT," + // 4: tag
"\"BOOK_NAME\" TEXT," + // 5: bookName
"\"COVER_URL\" TEXT);"); // 6: coverUrl
}
/** Drops the underlying database table. */
public static void dropTable(Database db, boolean ifExists) {
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"DOWNLOAD_CHAPTER_BEAN\"";
db.execSQL(sql);
}
@Override
protected final void bindValues(DatabaseStatement stmt, DownloadChapterBean entity) {
stmt.clearBindings();
String noteUrl = entity.getNoteUrl();
if (noteUrl != null) {
stmt.bindString(1, noteUrl);
}
stmt.bindLong(2, entity.getDurChapterIndex());
String durChapterUrl = entity.getDurChapterUrl();
if (durChapterUrl != null) {
stmt.bindString(3, durChapterUrl);
}
String durChapterName = entity.getDurChapterName();
if (durChapterName != null) {
stmt.bindString(4, durChapterName);
}
String tag = entity.getTag();
if (tag != null) {
stmt.bindString(5, tag);
}
String bookName = entity.getBookName();
if (bookName != null) {
stmt.bindString(6, bookName);
}
String coverUrl = entity.getCoverUrl();
if (coverUrl != null) {
stmt.bindString(7, coverUrl);
}
}
@Override
protected final void bindValues(SQLiteStatement stmt, DownloadChapterBean entity) {
stmt.clearBindings();
String noteUrl = entity.getNoteUrl();
if (noteUrl != null) {
stmt.bindString(1, noteUrl);
}
stmt.bindLong(2, entity.getDurChapterIndex());
String durChapterUrl = entity.getDurChapterUrl();
if (durChapterUrl != null) {
stmt.bindString(3, durChapterUrl);
}
String durChapterName = entity.getDurChapterName();
if (durChapterName != null) {
stmt.bindString(4, durChapterName);
}
String tag = entity.getTag();
if (tag != null) {
stmt.bindString(5, tag);
}
String bookName = entity.getBookName();
if (bookName != null) {
stmt.bindString(6, bookName);
}
String coverUrl = entity.getCoverUrl();
if (coverUrl != null) {
stmt.bindString(7, coverUrl);
}
}
@Override
public String readKey(Cursor cursor, int offset) {
return cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2);
}
@Override
public DownloadChapterBean readEntity(Cursor cursor, int offset) {
DownloadChapterBean entity = new DownloadChapterBean( //
cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0), // noteUrl
cursor.getInt(offset + 1), // durChapterIndex
cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // durChapterUrl
cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // durChapterName
cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // tag
cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // bookName
cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6) // coverUrl
);
return entity;
}
@Override
public void readEntity(Cursor cursor, DownloadChapterBean entity, int offset) {
entity.setNoteUrl(cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0));
entity.setDurChapterIndex(cursor.getInt(offset + 1));
entity.setDurChapterUrl(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
entity.setDurChapterName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
entity.setTag(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
entity.setBookName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5));
entity.setCoverUrl(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6));
}
@Override
protected final String updateKeyAfterInsert(DownloadChapterBean entity, long rowId) {
return entity.getDurChapterUrl();
}
@Override
public String getKey(DownloadChapterBean entity) {
if(entity != null) {
return entity.getDurChapterUrl();
} else {
return null;
}
}
@Override
protected final boolean isEntityUpdateable() {
return true;
}
}

@ -1,136 +0,0 @@
package com.monke.monkeybook.dao;
import android.database.Cursor;
import android.database.sqlite.SQLiteStatement;
import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.Property;
import org.greenrobot.greendao.internal.DaoConfig;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.database.DatabaseStatement;
import com.monke.monkeybook.bean.SearchHistoryBean;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
* DAO for table "SEARCH_HISTORY_BEAN".
*/
public class SearchHistoryBeanDao extends AbstractDao<SearchHistoryBean, Long> {
public static final String TABLENAME = "SEARCH_HISTORY_BEAN";
/**
* Properties of entity SearchHistoryBean.<br/>
* Can be used for QueryBuilder and for referencing column names.
*/
public static class Properties {
public final static Property Id = new Property(0, Long.class, "id", true, "_id");
public final static Property Type = new Property(1, int.class, "type", false, "TYPE");
public final static Property Content = new Property(2, String.class, "content", false, "CONTENT");
public final static Property Date = new Property(3, long.class, "date", false, "DATE");
};
public SearchHistoryBeanDao(DaoConfig config) {
super(config);
}
public SearchHistoryBeanDao(DaoConfig config, DaoSession daoSession) {
super(config, daoSession);
}
/** Creates the underlying database table. */
public static void createTable(Database db, boolean ifNotExists) {
String constraint = ifNotExists? "IF NOT EXISTS ": "";
db.execSQL("CREATE TABLE " + constraint + "\"SEARCH_HISTORY_BEAN\" (" + //
"\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id
"\"TYPE\" INTEGER NOT NULL ," + // 1: type
"\"CONTENT\" TEXT," + // 2: content
"\"DATE\" INTEGER NOT NULL );"); // 3: date
}
/** Drops the underlying database table. */
public static void dropTable(Database db, boolean ifExists) {
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"SEARCH_HISTORY_BEAN\"";
db.execSQL(sql);
}
@Override
protected final void bindValues(DatabaseStatement stmt, SearchHistoryBean entity) {
stmt.clearBindings();
Long id = entity.getId();
if (id != null) {
stmt.bindLong(1, id);
}
stmt.bindLong(2, entity.getType());
String content = entity.getContent();
if (content != null) {
stmt.bindString(3, content);
}
stmt.bindLong(4, entity.getDate());
}
@Override
protected final void bindValues(SQLiteStatement stmt, SearchHistoryBean entity) {
stmt.clearBindings();
Long id = entity.getId();
if (id != null) {
stmt.bindLong(1, id);
}
stmt.bindLong(2, entity.getType());
String content = entity.getContent();
if (content != null) {
stmt.bindString(3, content);
}
stmt.bindLong(4, entity.getDate());
}
@Override
public Long readKey(Cursor cursor, int offset) {
return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0);
}
@Override
public SearchHistoryBean readEntity(Cursor cursor, int offset) {
SearchHistoryBean entity = new SearchHistoryBean( //
cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id
cursor.getInt(offset + 1), // type
cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // content
cursor.getLong(offset + 3) // date
);
return entity;
}
@Override
public void readEntity(Cursor cursor, SearchHistoryBean entity, int offset) {
entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
entity.setType(cursor.getInt(offset + 1));
entity.setContent(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
entity.setDate(cursor.getLong(offset + 3));
}
@Override
protected final Long updateKeyAfterInsert(SearchHistoryBean entity, long rowId) {
entity.setId(rowId);
return rowId;
}
@Override
public Long getKey(SearchHistoryBean entity) {
if(entity != null) {
return entity.getId();
} else {
return null;
}
}
@Override
protected final boolean isEntityUpdateable() {
return true;
}
}

@ -1,9 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.listener;
import com.monke.monkeybook.bean.BookShelfBean;
public interface OnGetChapterListListener {
public void success(BookShelfBean bookShelfBean);
public void error();
}

@ -1,31 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.model;
import com.monke.monkeybook.bean.BookContentBean;
import com.monke.monkeybook.bean.BookShelfBean;
import com.monke.monkeybook.bean.SearchBookBean;
import com.monke.monkeybook.listener.OnGetChapterListListener;
import java.util.List;
import io.reactivex.Observable;
public interface IEasouBookModel {
/**
*
*/
Observable<List<SearchBookBean>> searchBook(String content, int page, int rankKind);
/**
*
*/
Observable<BookShelfBean> getBookInfo(final BookShelfBean bookShelfBean);
/**
*
*/
void getChapterList(final BookShelfBean bookShelfBean, OnGetChapterListListener getChapterListListener);
/**
*
*/
Observable<BookContentBean> getBookContent(final String durChapterUrl, final int durChapterIndex);
}

@ -1,23 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.model;
import com.monke.monkeybook.bean.LibraryBean;
import com.monke.monkeybook.bean.SearchBookBean;
import com.monke.monkeybook.cache.ACache;
import java.util.List;
import io.reactivex.Observable;
public interface IGxwztvBookModel extends IStationBookModel {
Observable<List<SearchBookBean>> getKindBook(String url, int page);
/**
*
*/
Observable<LibraryBean> getLibraryData(ACache aCache);
/**
*
*/
Observable<LibraryBean> analyLibraryData(String data);
}

@ -1,11 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.model;
import com.monke.monkeybook.bean.LocBookShelfBean;
import java.io.File;
import io.reactivex.Observable;
public interface IImportBookModel {
Observable<LocBookShelfBean> importBook(File book);
}

@ -1,32 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.model;
import com.monke.monkeybook.bean.BookContentBean;
import com.monke.monkeybook.bean.BookShelfBean;
import com.monke.monkeybook.bean.SearchBookBean;
import com.monke.monkeybook.listener.OnGetChapterListListener;
import java.util.List;
import io.reactivex.Observable;
public interface IStationBookModel {
/**
*
*/
Observable<List<SearchBookBean>> searchBook(String content, int page);
/**
*
*/
Observable<BookShelfBean> getBookInfo(final BookShelfBean bookShelfBean);
/**
*
*/
void getChapterList(final BookShelfBean bookShelfBean, OnGetChapterListListener getChapterListListener);
/**
*
*/
Observable<BookContentBean> getBookContent(final String durChapterUrl, final int durChapterIndex);
}

@ -1,35 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.model;
import com.monke.monkeybook.bean.BookContentBean;
import com.monke.monkeybook.bean.BookShelfBean;
import com.monke.monkeybook.bean.SearchBookBean;
import com.monke.monkeybook.listener.OnGetChapterListListener;
import java.util.List;
import io.reactivex.Observable;
public interface IWebBookModel {
/**
*
*/
Observable<BookShelfBean> getBookInfo(final BookShelfBean bookShelfBean);
/**
*
*/
void getChapterList(final BookShelfBean bookShelfBean,OnGetChapterListListener getChapterListListener);
/**
*
*/
Observable<BookContentBean> getBookContent(final String durChapterUrl, final int durChapterIndex, String tag);
/**
*
*/
Observable<List<SearchBookBean>> getKindBook(String url,int page);
/**
*
*/
Observable<List<SearchBookBean>> searchOtherBook(String content,int page,String tag);
}

@ -1,7 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.model;
public interface IWebContentModel {
String analyBookcontent(String s,String realUrl) throws Exception;
}

@ -1,37 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.model.impl;
import com.monke.monkeybook.model.IWebContentModel;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.TextNode;
import java.util.List;
public class Content17duxsModelImpl implements IWebContentModel{
public static final String TAG = "http://www.17duxs.com";
public static Content17duxsModelImpl getInstance() {
return new Content17duxsModelImpl();
}
private Content17duxsModelImpl() {
}
@Override
public String analyBookcontent(String s, String realUrl) throws Exception {
Document doc = Jsoup.parse(s);
List<TextNode> contentEs = doc.getElementById("content").textNodes();
StringBuilder content = new StringBuilder();
for (int i = 0; i < contentEs.size(); i++) {
String temp = contentEs.get(i).text().trim();
temp = temp.replaceAll(" ","").replaceAll(" ","");
if (temp.length() > 0) {
content.append("\u3000\u3000" + temp);
if (i < contentEs.size() - 1) {
content.append("\r\n");
}
}
}
return content.toString();
}
}

@ -1,40 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.model.impl;
import com.monke.monkeybook.model.IWebContentModel;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.nodes.TextNode;
import java.util.List;
public class Content17kModelImpl implements IWebContentModel {
public static final String TAG = "http://www.17k.com";
public static Content17kModelImpl getInstance() {
return new Content17kModelImpl();
}
private Content17kModelImpl() {
}
@Override
public String analyBookcontent(String s, String realUrl) throws Exception {
Document doc = Jsoup.parse(s);
Element all = doc.getElementById("chapterContentWapper");
List<TextNode> contentEs = all.getAllElements().get(0).textNodes();
StringBuilder content = new StringBuilder();
for (int i = 0; i < contentEs.size(); i++) {
String temp = contentEs.get(i).text().trim();
temp = temp.replaceAll(" ","").replaceAll(" ","");
if (temp.length() > 0) {
content.append("\u3000\u3000" + temp);
if (i < contentEs.size() - 1) {
content.append("\r\n");
}
}
}
return content.toString();
}
}

@ -1,37 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.model.impl;
import com.monke.monkeybook.model.IWebContentModel;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.TextNode;
import java.util.List;
public class Content3dllcModelImpl implements IWebContentModel{
public static final String TAG = "http://www.3dllc.cc";
public static Content3dllcModelImpl getInstance() {
return new Content3dllcModelImpl();
}
private Content3dllcModelImpl() {
}
@Override
public String analyBookcontent(String s, String realUrl) throws Exception {
Document doc = Jsoup.parse(s);
List<TextNode> contentEs = doc.getElementById("content").textNodes();
StringBuilder content = new StringBuilder();
for (int i = 0; i < contentEs.size(); i++) {
String temp = contentEs.get(i).text().trim();
temp = temp.replaceAll(" ","").replaceAll(" ","");
if (temp.length() > 0) {
content.append("\u3000\u3000" + temp);
if (i < contentEs.size() - 1) {
content.append("\r\n");
}
}
}
return content.toString();
}
}

@ -1,37 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.model.impl;
import com.monke.monkeybook.model.IWebContentModel;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.TextNode;
import java.util.List;
public class Content44pqModelImpl implements IWebContentModel{
public static final String TAG = "http://www.44pq.net";
public static Content44pqModelImpl getInstance() {
return new Content44pqModelImpl();
}
private Content44pqModelImpl() {
}
@Override
public String analyBookcontent(String s, String realUrl) throws Exception {
Document doc = Jsoup.parse(s);
List<TextNode> contentEs = doc.getElementById("content").textNodes();
StringBuilder content = new StringBuilder();
for (int i = 0; i < contentEs.size(); i++) {
String temp = contentEs.get(i).text().trim();
temp = temp.replaceAll(" ","").replaceAll(" ","");
if (temp.length() > 0) {
content.append("\u3000\u3000" + temp);
if (i < contentEs.size() - 1) {
content.append("\r\n");
}
}
}
return content.toString();
}
}

@ -1,37 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.model.impl;
import com.monke.monkeybook.model.IWebContentModel;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.TextNode;
import java.util.List;
public class Content630bookCCModelImpl implements IWebContentModel{
public static final String TAG = "http://www.630book.cc";
public static Content630bookCCModelImpl getInstance() {
return new Content630bookCCModelImpl();
}
private Content630bookCCModelImpl() {
}
@Override
public String analyBookcontent(String s, String realUrl) throws Exception {
Document doc = Jsoup.parse(s);
List<TextNode> contentEs = doc.getElementById("content").textNodes();
StringBuilder content = new StringBuilder();
for (int i = 0; i < contentEs.size(); i++) {
String temp = contentEs.get(i).text().trim();
temp = temp.replaceAll(" ","").replaceAll(" ","");
if (temp.length() > 0) {
content.append("\u3000\u3000" + temp);
if (i < contentEs.size() - 1) {
content.append("\r\n");
}
}
}
return content.toString();
}
}

@ -1,37 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.model.impl;
import com.monke.monkeybook.model.IWebContentModel;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.TextNode;
import java.util.List;
public class Content92zwModelImpl implements IWebContentModel{
public static final String TAG = "http://www.92zw.la";
public static Content92zwModelImpl getInstance() {
return new Content92zwModelImpl();
}
private Content92zwModelImpl() {
}
@Override
public String analyBookcontent(String s, String realUrl) throws Exception {
Document doc = Jsoup.parse(s);
List<TextNode> contentEs = doc.getElementById("contents").textNodes();
StringBuilder content = new StringBuilder();
for (int i = 0; i < contentEs.size(); i++) {
String temp = contentEs.get(i).text().trim();
temp = temp.replaceAll(" ","").replaceAll(" ","");
if (temp.length() > 0) {
content.append("\u3000\u3000" + temp);
if (i < contentEs.size() - 1) {
content.append("\r\n");
}
}
}
return content.toString();
}
}

@ -1,37 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.model.impl;
import com.monke.monkeybook.model.IWebContentModel;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.TextNode;
import java.util.List;
public class ContentAszwModelImpl implements IWebContentModel{
public static final String TAG = "http://www.aszw.org";
public static ContentAszwModelImpl getInstance() {
return new ContentAszwModelImpl();
}
private ContentAszwModelImpl() {
}
@Override
public String analyBookcontent(String s, String realUrl) throws Exception {
Document doc = Jsoup.parse(s);
List<TextNode> contentEs = doc.getElementById("contents").textNodes();
StringBuilder content = new StringBuilder();
for (int i = 0; i < contentEs.size(); i++) {
String temp = contentEs.get(i).text().trim();
temp = temp.replaceAll(" ","").replaceAll(" ","");
if (temp.length() > 0) {
content.append("\u3000\u3000" + temp);
if (i < contentEs.size() - 1) {
content.append("\r\n");
}
}
}
return content.toString();
}
}

@ -1,37 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.model.impl;
import com.monke.monkeybook.model.IWebContentModel;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.TextNode;
import java.util.List;
public class ContentBaishukuModelImpl implements IWebContentModel{
public static final String TAG = "http://baishuku.com";
public static ContentBaishukuModelImpl getInstance() {
return new ContentBaishukuModelImpl();
}
private ContentBaishukuModelImpl() {
}
@Override
public String analyBookcontent(String s, String realUrl) throws Exception {
Document doc = Jsoup.parse(s);
List<TextNode> contentEs = doc.getElementById("content").textNodes();
StringBuilder content = new StringBuilder();
for (int i = 0; i < contentEs.size(); i++) {
String temp = contentEs.get(i).text().trim();
temp = temp.replaceAll(" ","").replaceAll(" ","");
if (temp.length() > 0) {
content.append("\u3000\u3000" + temp);
if (i < contentEs.size() - 1) {
content.append("\r\n");
}
}
}
return content.toString();
}
}

@ -1,37 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.model.impl;
import com.monke.monkeybook.model.IWebContentModel;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.TextNode;
import java.util.List;
public class ContentBxwx9ModelImpl implements IWebContentModel{
public static final String TAG = "http://www.bxwx9.org";
public static ContentBxwx9ModelImpl getInstance() {
return new ContentBxwx9ModelImpl();
}
private ContentBxwx9ModelImpl() {
}
@Override
public String analyBookcontent(String s, String realUrl) throws Exception {
Document doc = Jsoup.parse(s);
List<TextNode> contentEs = doc.getElementById("content").textNodes();
StringBuilder content = new StringBuilder();
for (int i = 0; i < contentEs.size(); i++) {
String temp = contentEs.get(i).text().trim();
temp = temp.replaceAll(" ","").replaceAll(" ","");
if (temp.length() > 0) {
content.append("\u3000\u3000" + temp);
if (i < contentEs.size() - 1) {
content.append("\r\n");
}
}
}
return content.toString();
}
}

@ -1,44 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.model.impl;
import com.monke.monkeybook.ErrorAnalyContentManager;
import com.monke.monkeybook.bean.BookContentBean;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.TextNode;
import java.util.List;
public class ContentCommendModelImpl {
public static ContentCommendModelImpl getInstance() {
return new ContentCommendModelImpl();
}
private ContentCommendModelImpl() {
}
public BookContentBean analyBookcontent(BookContentBean bookContentBean, String s, String realUrl) throws Exception {
ErrorAnalyContentManager.getInstance().writeNewErrorUrl(realUrl);
try{
Document doc = Jsoup.parse(s);
List<TextNode> contentEs = doc.getElementById("content").textNodes();
StringBuilder content = new StringBuilder();
for (int i = 0; i < contentEs.size(); i++) {
String temp = contentEs.get(i).text().trim();
temp = temp.replaceAll(" ","").replaceAll(" ","");
if (temp.length() > 0) {
content.append("\u3000\u3000" + temp);
if (i < contentEs.size() - 1) {
content.append("\r\n");
}
}
}
bookContentBean.setDurCapterContent(content.toString());
}catch (Exception e){
e.printStackTrace();
bookContentBean.setDurCapterContent(realUrl.substring(0, realUrl.indexOf('/', 8)) + "站点暂时不支持解析请反馈给Monke QQ:1105075896,半小时内解决,超级效率的程序员");
bookContentBean.setRight(false);
}
return bookContentBean;
}
}

@ -1,37 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.model.impl;
import com.monke.monkeybook.model.IWebContentModel;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.TextNode;
import java.util.List;
public class ContentDhzwModelImpl implements IWebContentModel{
public static final String TAG = "http://www.dhzw.org";
public static ContentDhzwModelImpl getInstance() {
return new ContentDhzwModelImpl();
}
private ContentDhzwModelImpl() {
}
@Override
public String analyBookcontent(String s, String realUrl) throws Exception {
Document doc = Jsoup.parse(s);
List<TextNode> contentEs = doc.getElementById("BookText").textNodes();
StringBuilder content = new StringBuilder();
for (int i = 0; i < contentEs.size(); i++) {
String temp = contentEs.get(i).text().trim();
temp = temp.replaceAll(" ","").replaceAll(" ","");
if (temp.length() > 0) {
content.append("\u3000\u3000" + contentEs.get(i).text().trim().replaceAll(" ",""));
if (i < contentEs.size() - 1) {
content.append("\r\n");
}
}
}
return content.toString();
}
}

@ -1,38 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.model.impl;
import com.monke.monkeybook.model.IWebContentModel;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.TextNode;
import java.util.List;
public class ContentEasouModelImpl implements IWebContentModel {
public static final String TAG = "http://book.easou.com";
public static ContentEasouModelImpl getInstance(){
return new ContentEasouModelImpl();
}
private ContentEasouModelImpl(){
}
@Override
public String analyBookcontent(String s, String realUrl) throws Exception{
Document doc = Jsoup.parse(s);
List<TextNode> contentEs = doc.getElementsByClass("show").get(0).textNodes();
StringBuilder content = new StringBuilder();
for (int i = 0; i < contentEs.size(); i++) {
String temp = contentEs.get(i).text().trim();
temp = temp.replaceAll(" ","").replaceAll(" ","");
if (temp.length() > 0) {
content.append("\u3000\u3000" + temp);
if (i < contentEs.size() - 1) {
content.append("\r\n");
}
}
}
return content.toString();
}
}

@ -1,41 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.model.impl;
import com.monke.monkeybook.model.IWebContentModel;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.TextNode;
import java.util.List;
/**
*
*/
public class ContentFuheishuModelImpl implements IWebContentModel{
public static final String TAG = "http://fuheishu.com";
public static ContentFuheishuModelImpl getInstance(){
return new ContentFuheishuModelImpl();
}
private ContentFuheishuModelImpl(){
}
@Override
public String analyBookcontent(String s, String realUrl) throws Exception{
Document doc = Jsoup.parse(s);
String bookId = realUrl.substring(realUrl.indexOf("/",21)+1,realUrl.indexOf(".html"));
List<TextNode> contentTNs = doc.getElementById("content"+bookId).textNodes();
StringBuilder stringBuilder = new StringBuilder();
for(int i=0;i<contentTNs.size();i++){
String temp = contentTNs.get(i).text().trim();
temp = temp.replaceAll(" ","").replaceAll(" ","");
if (temp.length() > 0) {
stringBuilder.append("\u3000\u3000" + temp);
if (i < contentTNs.size() - 1) {
stringBuilder.append("\r\n");
}
}
}
return stringBuilder.toString();
}
}

@ -1,37 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.model.impl;
import com.monke.monkeybook.model.IWebContentModel;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.TextNode;
import java.util.List;
public class ContentKewaishuModelImpl implements IWebContentModel{
public static final String TAG = "http://www.kewaishu.org";
public static ContentKewaishuModelImpl getInstance() {
return new ContentKewaishuModelImpl();
}
private ContentKewaishuModelImpl() {
}
@Override
public String analyBookcontent(String s, String realUrl) throws Exception {
Document doc = Jsoup.parse(s);
List<TextNode> contentEs = doc.getElementById("content").getElementsByTag("p").get(0).textNodes();
StringBuilder content = new StringBuilder();
for (int i = 0; i < contentEs.size(); i++) {
String temp = contentEs.get(i).text().trim();
temp = temp.replaceAll(" ","").replaceAll(" ","");
if (temp.length() > 0) {
content.append("\u3000\u3000" + temp);
if (i < contentEs.size() - 1) {
content.append("\r\n");
}
}
}
return content.toString();
}
}

@ -1,37 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.model.impl;
import com.monke.monkeybook.model.IWebContentModel;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.TextNode;
import java.util.List;
public class ContentLeduwoModelImpl implements IWebContentModel{
public static final String TAG = "http://leduwo.com";
public static ContentLeduwoModelImpl getInstance() {
return new ContentLeduwoModelImpl();
}
private ContentLeduwoModelImpl() {
}
@Override
public String analyBookcontent(String s, String realUrl) throws Exception {
Document doc = Jsoup.parse(s);
List<TextNode> contentEs = doc.getElementById("content").textNodes();
StringBuilder content = new StringBuilder();
for (int i = 0; i < contentEs.size(); i++) {
String temp = contentEs.get(i).text().trim();
temp = temp.replaceAll(" ","").replaceAll(" ","");
if (temp.length() > 0) {
content.append("\u3000\u3000" + temp);
if (i < contentEs.size() - 1) {
content.append("\r\n");
}
}
}
return content.toString();
}
}

@ -1,37 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.model.impl;
import com.monke.monkeybook.model.IWebContentModel;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.TextNode;
import java.util.List;
public class ContentLewen8ModelImpl implements IWebContentModel{
public static final String TAG = "http://www.lewen8.com";
public static ContentLewen8ModelImpl getInstance() {
return new ContentLewen8ModelImpl();
}
private ContentLewen8ModelImpl() {
}
@Override
public String analyBookcontent(String s, String realUrl) throws Exception {
Document doc = Jsoup.parse(s);
List<TextNode> contentEs = doc.getElementById("content").textNodes();
StringBuilder content = new StringBuilder();
for (int i = 0; i < contentEs.size(); i++) {
String temp = contentEs.get(i).text().trim();
temp = temp.replaceAll(" ","").replaceAll(" ","");
if (temp.length() > 0) {
content.append("\u3000\u3000" + temp);
if (i < contentEs.size() - 1) {
content.append("\r\n");
}
}
}
return content.toString();
}
}

@ -1,38 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.model.impl;
import com.monke.monkeybook.model.IWebContentModel;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.TextNode;
import java.util.List;
public class ContentPbtxtModelImpl implements IWebContentModel{
public static final String TAG = "http://www.pbtxt.com";
public static ContentPbtxtModelImpl getInstance(){
return new ContentPbtxtModelImpl();
}
private ContentPbtxtModelImpl(){
}
@Override
public String analyBookcontent(String s, String realUrl) throws Exception{
Document doc = Jsoup.parse(s);
String bookId = realUrl.substring(realUrl.indexOf("/",21)+1,realUrl.indexOf(".html"));
List<TextNode> contentTNs = doc.getElementById("content"+bookId).textNodes();
StringBuilder stringBuilder = new StringBuilder();
for(int i=0;i<contentTNs.size();i++){
String temp = contentTNs.get(i).text().trim();
temp = temp.replaceAll(" ","").replaceAll(" ","");
if (temp.length() > 0) {
stringBuilder.append("\u3000\u3000" + temp);
if (i < contentTNs.size() - 1) {
stringBuilder.append("\r\n");
}
}
}
return stringBuilder.toString();
}
}

@ -1,37 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.model.impl;
import com.monke.monkeybook.model.IWebContentModel;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.TextNode;
import java.util.List;
public class ContentPpxsModelImpl implements IWebContentModel{
public static final String TAG = "http://www.ppxs.net";
public static ContentPpxsModelImpl getInstance() {
return new ContentPpxsModelImpl();
}
private ContentPpxsModelImpl() {
}
@Override
public String analyBookcontent(String s, String realUrl) throws Exception {
Document doc = Jsoup.parse(s);
List<TextNode> contentEs = doc.getElementById("booktext").textNodes();
StringBuilder content = new StringBuilder();
for (int i = 0; i < contentEs.size(); i++) {
String temp = contentEs.get(i).text().trim();
temp = temp.replaceAll(" ","").replaceAll(" ","");
if (temp.length() > 0) {
content.append("\u3000\u3000" + temp);
if (i < contentEs.size() - 1) {
content.append("\r\n");
}
}
}
return content.toString();
}
}

@ -1,37 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.model.impl;
import com.monke.monkeybook.model.IWebContentModel;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.TextNode;
import java.util.List;
public class ContentQulaModelImpl implements IWebContentModel{
public static final String TAG = "http://www.qu.la";
public static ContentQulaModelImpl getInstance() {
return new ContentQulaModelImpl();
}
private ContentQulaModelImpl() {
}
@Override
public String analyBookcontent(String s, String realUrl) throws Exception {
Document doc = Jsoup.parse(s);
List<TextNode> contentEs = doc.getElementById("content").textNodes();
StringBuilder content = new StringBuilder();
for (int i = 0; i < contentEs.size(); i++) {
String temp = contentEs.get(i).text().trim();
temp = temp.replaceAll(" ","").replaceAll(" ","");
if (temp.length() > 0) {
content.append("\u3000\u3000" + temp);
if (i < contentEs.size() - 1) {
content.append("\r\n");
}
}
}
return content.toString();
}
}

@ -1,37 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.model.impl;
import com.monke.monkeybook.model.IWebContentModel;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.TextNode;
import java.util.List;
public class ContentQzreadModelImpl implements IWebContentModel{
public static final String TAG = "http://www.qzread.com";
public static ContentQzreadModelImpl getInstance() {
return new ContentQzreadModelImpl();
}
private ContentQzreadModelImpl() {
}
@Override
public String analyBookcontent(String s, String realUrl) throws Exception {
Document doc = Jsoup.parse(s);
List<TextNode> contentEs = doc.getElementsByClass("txt").get(0).getElementsByTag("p").get(0).textNodes();
StringBuilder content = new StringBuilder();
for (int i = 0; i < contentEs.size(); i++) {
String temp = contentEs.get(i).text().trim();
temp = temp.replaceAll(" ","").replaceAll(" ","");
if (temp.length() > 0) {
content.append("\u3000\u3000" + temp);
if (i < contentEs.size() - 1) {
content.append("\r\n");
}
}
}
return content.toString();
}
}

@ -1,37 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.model.impl;
import com.monke.monkeybook.model.IWebContentModel;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.TextNode;
import java.util.List;
public class ContentRanwenaModelImpl implements IWebContentModel{
public static final String TAG = "http://www.ranwena.com";
public static ContentRanwenaModelImpl getInstance() {
return new ContentRanwenaModelImpl();
}
private ContentRanwenaModelImpl() {
}
@Override
public String analyBookcontent(String s, String realUrl) throws Exception {
Document doc = Jsoup.parse(s);
List<TextNode> contentEs = doc.getElementById("content").textNodes();
StringBuilder content = new StringBuilder();
for (int i = 0; i < contentEs.size(); i++) {
String temp = contentEs.get(i).text().trim();
temp = temp.replaceAll(" ","").replaceAll(" ","");
if (temp.length() > 0) {
content.append("\u3000\u3000" + temp);
if (i < contentEs.size() - 1) {
content.append("\r\n");
}
}
}
return content.toString();
}
}

@ -1,28 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.model.impl;
import com.monke.monkeybook.model.IWebContentModel;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
public class ContentShulouModelImpl implements IWebContentModel{
public static final String TAG = "http://www.shulou.cc";
public static ContentShulouModelImpl getInstance(){
return new ContentShulouModelImpl();
}
private ContentShulouModelImpl(){
}
@Override
public String analyBookcontent(String s, String realUrl) throws Exception{
Document doc = Jsoup.parse(s);
Element contentE = doc.getElementById("content");
String contentString = contentE.toString();
contentString = contentString.replaceAll(" ", "").replaceAll("\n", "").replaceAll("&nbsp;", "").replaceAll("<divid=\"content\">", "").replaceAll("</div>", "").replaceAll("<p></p>","").replaceAll("<br><br>", "\r\n\u3000\u3000");
contentString = "\u3000\u3000" + contentString;
return contentString;
}
}

@ -1,37 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.model.impl;
import com.monke.monkeybook.model.IWebContentModel;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.TextNode;
import java.util.List;
public class ContentSnwx8ModelImpl implements IWebContentModel{
public static final String TAG = "http://www.snwx8.com";
public static ContentSnwx8ModelImpl getInstance() {
return new ContentSnwx8ModelImpl();
}
private ContentSnwx8ModelImpl() {
}
@Override
public String analyBookcontent(String s, String realUrl) throws Exception {
Document doc = Jsoup.parse(s);
List<TextNode> contentEs = doc.getElementById("BookText").textNodes();
StringBuilder content = new StringBuilder();
for(int i=0;i<contentEs.size();i++){
String temp = contentEs.get(i).text().trim();
temp = temp.replaceAll(" ","").replaceAll(" ","");
if(temp.length()>0){
content.append("\u3000\u3000" + temp);
if (i < contentEs.size() - 1) {
content.append("\r\n");
}
}
}
return content.toString();
}
}

@ -1,37 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.model.impl;
import com.monke.monkeybook.model.IWebContentModel;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.TextNode;
import java.util.List;
public class ContentSuimengModelImpl implements IWebContentModel{
public static final String TAG = "http://www.suimeng.la";
public static ContentSuimengModelImpl getInstance() {
return new ContentSuimengModelImpl();
}
private ContentSuimengModelImpl() {
}
@Override
public String analyBookcontent(String s, String realUrl) throws Exception {
Document doc = Jsoup.parse(s);
List<TextNode> contentEs = doc.getElementById("ccontent").textNodes();
StringBuilder content = new StringBuilder();
for (int i = 0; i < contentEs.size(); i++) {
String temp = contentEs.get(i).text().trim();
temp = temp.replaceAll(" ","").replaceAll(" ","");
if (temp.length() > 0) {
content.append("\u3000\u3000" + temp);
if (i < contentEs.size() - 1) {
content.append("\r\n");
}
}
}
return content.toString();
}
}

@ -1,40 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.model.impl;
import com.monke.monkeybook.model.IWebContentModel;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.TextNode;
import java.util.List;
/**
*
*/
public class ContentSyzwwModelImpl implements IWebContentModel{
public static final String TAG = "http://www.syzww.net";
public static ContentSyzwwModelImpl getInstance() {
return new ContentSyzwwModelImpl();
}
private ContentSyzwwModelImpl() {
}
@Override
public String analyBookcontent(String s, String realUrl) throws Exception {
Document doc = Jsoup.parse(s);
List<TextNode> contentEs = doc.getElementById("content").textNodes();
StringBuilder content = new StringBuilder();
for (int i = 0; i < contentEs.size(); i++) {
String temp = contentEs.get(i).text().trim();
temp = temp.replaceAll(" ","").replaceAll(" ","");
if (temp.length() > 0) {
content.append("\u3000\u3000" + temp);
if (i < contentEs.size() - 1) {
content.append("\r\n");
}
}
}
return content.toString();
}
}

@ -1,40 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.model.impl;
import com.monke.monkeybook.model.IWebContentModel;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
public class ContentVodtwModelImpl implements IWebContentModel {
public static final String TAG = "http://www.vodtw.com";
public static ContentVodtwModelImpl getInstance() {
return new ContentVodtwModelImpl();
}
private ContentVodtwModelImpl() {
}
@Override
public String analyBookcontent(String s, String realUrl) throws Exception {
Document doc = Jsoup.parse(s);
Element contentE = doc.getElementById("BookText");
StringBuilder content = new StringBuilder();
Elements contentEs = contentE.getElementsByTag("p");
for (int i = 0; i < contentEs.size(); i++) {
String temp = contentEs.get(i).text().trim();
temp = temp.replaceAll(" ","").replaceAll(" ","");
if (temp.length() > 0) {
content.append("\u3000\u3000" + temp);
if (i < contentEs.size() - 1) {
content.append("\r\n");
}
}
}
return content.toString();
}
}

@ -1,37 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.model.impl;
import com.monke.monkeybook.model.IWebContentModel;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.TextNode;
import java.util.List;
public class ContentWxguanModelImpl implements IWebContentModel{
public static final String TAG = "http://www.wxguan.com";
public static ContentWxguanModelImpl getInstance() {
return new ContentWxguanModelImpl();
}
private ContentWxguanModelImpl() {
}
@Override
public String analyBookcontent(String s, String realUrl) throws Exception {
Document doc = Jsoup.parse(s);
List<TextNode> contentEs = doc.getElementById("content").textNodes();
StringBuilder content = new StringBuilder();
for (int i = 0; i < contentEs.size(); i++) {
String temp = contentEs.get(i).text().trim();
temp = temp.replaceAll(" ","").replaceAll(" ","");
if (temp.length() > 0) {
content.append("\u3000\u3000" + temp);
if (i < contentEs.size() - 1) {
content.append("\r\n");
}
}
}
return content.toString();
}
}

@ -1,37 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.model.impl;
import com.monke.monkeybook.model.IWebContentModel;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.select.Elements;
public class ContentXqingdouCCModelImpl implements IWebContentModel {
public static final String TAG = "http://www.xqingdou.cc";
public static ContentXqingdouCCModelImpl getInstance() {
return new ContentXqingdouCCModelImpl();
}
private ContentXqingdouCCModelImpl() {
}
@Override
public String analyBookcontent(String s, String realUrl) throws Exception{
Document doc = Jsoup.parse(s);
Elements contentEs = doc.getElementById("chapter_content").getElementsByTag("p");
StringBuilder content = new StringBuilder();
for (int i = 0; i < contentEs.size(); i++) {
String temp = contentEs.get(i).text().trim();
temp = temp.replaceAll(" ","").replaceAll(" ","");
if (temp.length() > 0) {
content.append("\u3000\u3000" + temp);
if (i < contentEs.size() - 1) {
content.append("\r\n");
}
}
}
return content.toString();
}
}

@ -1,37 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.model.impl;
import com.monke.monkeybook.model.IWebContentModel;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.select.Elements;
public class ContentXqingdouModelImpl implements IWebContentModel {
public static final String TAG = "http://www.xqingdou.com";
public static ContentXqingdouModelImpl getInstance() {
return new ContentXqingdouModelImpl();
}
private ContentXqingdouModelImpl() {
}
@Override
public String analyBookcontent(String s, String realUrl) throws Exception{
Document doc = Jsoup.parse(s);
Elements contentEs = doc.getElementById("chapter_content").getElementsByTag("p");
StringBuilder content = new StringBuilder();
for (int i = 0; i < contentEs.size(); i++) {
String temp = contentEs.get(i).text().trim();
temp = temp.replaceAll(" ","").replaceAll(" ","");
if (temp.length() > 0) {
content.append("\u3000\u3000" + temp);
if (i < contentEs.size() - 1) {
content.append("\r\n");
}
}
}
return content.toString();
}
}

@ -1,60 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.model.impl;
import com.monke.monkeybook.model.IWebContentModel;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.nodes.TextNode;
import org.jsoup.select.Elements;
import java.util.List;
public class ContentYb3ModelImpl implements IWebContentModel{
public static final String TAG = "http://www.yb3.cc";
public static ContentYb3ModelImpl getInstance() {
return new ContentYb3ModelImpl();
}
private ContentYb3ModelImpl() {
}
@Override
public String analyBookcontent(String s, String realUrl) throws Exception {
Document doc = Jsoup.parse(s);
Element contentE = doc.getElementById("content");
List<TextNode> contentTextNodes = contentE.textNodes();
StringBuilder content = new StringBuilder();
if(contentTextNodes!=null && contentTextNodes.size()>0){
for (int i = 0; i < contentTextNodes.size(); i++) {
if (contentTextNodes.get(i).text().trim().length() > 0) {
content.append("\u3000\u3000" + contentTextNodes.get(i).text().trim());
if (i < contentTextNodes.size() - 1) {
content.append("\r\n");
}
}
}
}else{
Elements contentEs = contentE.children();
for (int i = 0; i < contentEs.size(); i++) {
if (contentEs.get(i).text().toString().trim().replaceAll(" ","").length() > 0) {
List<TextNode> tempTextNodes = contentEs.get(i).textNodes();
if(tempTextNodes!=null && tempTextNodes.size()>0){
for (int j = 0; j < tempTextNodes.size(); j++) {
String temp = tempTextNodes.get(j).text().trim();
temp = temp.replaceAll(" ","").replaceAll(" ","");
if (temp.length() > 0) {
content.append("\u3000\u3000" + temp);
content.append("\r\n");
}
}
}else{
content.append("\u3000\u3000" + contentEs.get(i).text().trim().replaceAll(" ",""));
content.append("\r\n");
}
}
}
}
return content.toString();
}
}

@ -1,36 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.model.impl;
import com.monke.monkeybook.model.IWebContentModel;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.select.Elements;
public class ContentZhulangModelImpl implements IWebContentModel{
public static final String TAG = "http://book.zhulang.com";
public static ContentZhulangModelImpl getInstance() {
return new ContentZhulangModelImpl();
}
private ContentZhulangModelImpl() {
}
@Override
public String analyBookcontent(String s, String realUrl) throws Exception {
Document doc = Jsoup.parse(s);
Elements contentEs = doc.getElementById("read-content").children();
StringBuilder content = new StringBuilder();
for (int i = 3; i < contentEs.size()-1; i++) {
String temp = contentEs.get(i).text().trim();
temp = temp.replaceAll(" ","").replaceAll(" ","");
if (temp.length() > 0) {
content.append("\u3000\u3000" + temp);
if (i < contentEs.size() - 1) {
content.append("\r\n");
}
}
}
return content.toString();
}
}

@ -1,353 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.model.impl;
import com.monke.monkeybook.ErrorAnalyContentManager;
import com.monke.monkeybook.base.MBaseModelImpl;
import com.monke.monkeybook.base.observer.SimpleObserver;
import com.monke.monkeybook.bean.BookContentBean;
import com.monke.monkeybook.bean.BookInfoBean;
import com.monke.monkeybook.bean.BookShelfBean;
import com.monke.monkeybook.bean.ChapterListBean;
import com.monke.monkeybook.bean.LibraryBean;
import com.monke.monkeybook.bean.LibraryKindBookListBean;
import com.monke.monkeybook.bean.LibraryNewBookBean;
import com.monke.monkeybook.bean.SearchBookBean;
import com.monke.monkeybook.bean.WebChapterBean;
import com.monke.monkeybook.cache.ACache;
import com.monke.monkeybook.common.api.IGxwztvApi;
import com.monke.monkeybook.listener.OnGetChapterListListener;
import com.monke.monkeybook.model.IGxwztvBookModel;
import com.monke.monkeybook.presenter.impl.LibraryPresenterImpl;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.nodes.TextNode;
import org.jsoup.select.Elements;
import java.util.ArrayList;
import java.util.List;
import io.reactivex.Observable;
import io.reactivex.ObservableEmitter;
import io.reactivex.ObservableOnSubscribe;
import io.reactivex.ObservableSource;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.functions.Function;
import io.reactivex.schedulers.Schedulers;
public class GxwztvBookModelImpl extends MBaseModelImpl implements IGxwztvBookModel {
public static final String TAG = "http://www.gxwztv.com";
public static GxwztvBookModelImpl getInstance() {
return new GxwztvBookModelImpl();
}
/**
*
*/
@Override
public Observable<LibraryBean> getLibraryData(final ACache aCache) {
return getRetrofitObject(TAG).create(IGxwztvApi.class).getLibraryData("").flatMap(new Function<String, ObservableSource<LibraryBean>>() {
@Override
public ObservableSource<LibraryBean> apply(String s) throws Exception {
if (s != null && s.length() > 0 && aCache != null) {
aCache.put(LibraryPresenterImpl.LIBRARY_CACHE_KEY, s);
}
return analyLibraryData(s);
}
});
}
/**
*
*/
@Override
public Observable<LibraryBean> analyLibraryData(final String data) {
return Observable.create(new ObservableOnSubscribe<LibraryBean>() {
@Override
public void subscribe(ObservableEmitter<LibraryBean> e) throws Exception {
LibraryBean result = new LibraryBean();
Document doc = Jsoup.parse(data);
Element contentE = doc.getElementsByClass("container").get(0);
//解析最新书籍
Elements newBookEs = contentE.getElementsByClass("list-group-item text-nowrap modal-open");
List<LibraryNewBookBean> libraryNewBooks = new ArrayList<LibraryNewBookBean>();
for (int i = 0; i < newBookEs.size(); i++) {
Element itemE = newBookEs.get(i).getElementsByTag("a").get(0);
LibraryNewBookBean item = new LibraryNewBookBean(itemE.text(), TAG + itemE.attr("href"), TAG, "gxwztv.com");
libraryNewBooks.add(item);
}
result.setLibraryNewBooks(libraryNewBooks);
//////////////////////////////////////////////////////////////////////
List<LibraryKindBookListBean> kindBooks = new ArrayList<LibraryKindBookListBean>();
//解析男频女频
Elements hotEs = contentE.getElementsByClass("col-xs-12");
for (int i = 1; i < hotEs.size(); i++) {
LibraryKindBookListBean kindItem = new LibraryKindBookListBean();
kindItem.setKindName(hotEs.get(i).getElementsByClass("panel-title").get(0).text());
Elements bookEs = hotEs.get(i).getElementsByClass("panel-body").get(0).getElementsByTag("li");
List<SearchBookBean> books = new ArrayList<SearchBookBean>();
for (int j = 0; j < bookEs.size(); j++) {
SearchBookBean searchBookBean = new SearchBookBean();
searchBookBean.setOrigin("gxwztv.com");
searchBookBean.setTag(TAG);
searchBookBean.setName(bookEs.get(j).getElementsByTag("span").get(0).text());
searchBookBean.setNoteUrl(TAG + bookEs.get(j).getElementsByTag("a").get(0).attr("href"));
searchBookBean.setCoverUrl(bookEs.get(j).getElementsByTag("img").get(0).attr("src"));
books.add(searchBookBean);
}
kindItem.setBooks(books);
kindBooks.add(kindItem);
}
//解析部分分类推荐
Elements kindEs = contentE.getElementsByClass("panel panel-info index-category-qk");
for (int i = 0; i < kindEs.size(); i++) {
LibraryKindBookListBean kindItem = new LibraryKindBookListBean();
kindItem.setKindName(kindEs.get(i).getElementsByClass("panel-title").get(0).text());
kindItem.setKindUrl(TAG + kindEs.get(i).getElementsByClass("listMore").get(0).getElementsByTag("a").get(0).attr("href"));
List<SearchBookBean> books = new ArrayList<SearchBookBean>();
Element firstBookE = kindEs.get(i).getElementsByTag("dl").get(0);
SearchBookBean firstBook = new SearchBookBean();
firstBook.setTag(TAG);
firstBook.setOrigin("gxwztv.com");
firstBook.setName(firstBookE.getElementsByTag("a").get(1).text());
firstBook.setNoteUrl(TAG + firstBookE.getElementsByTag("a").get(0).attr("href"));
firstBook.setCoverUrl(firstBookE.getElementsByTag("a").get(0).getElementsByTag("img").get(0).attr("src"));
firstBook.setKind(kindItem.getKindName());
books.add(firstBook);
Elements otherBookEs = kindEs.get(i).getElementsByClass("book_textList").get(0).getElementsByTag("li");
for (int j = 0; j < otherBookEs.size(); j++) {
SearchBookBean item = new SearchBookBean();
item.setTag(TAG);
item.setOrigin("gxwztv.com");
item.setKind(kindItem.getKindName());
item.setNoteUrl(TAG+otherBookEs.get(j).getElementsByTag("a").get(0).attr("href"));
item.setName(otherBookEs.get(j).getElementsByTag("a").get(0).text());
books.add(item);
}
kindItem.setBooks(books);
kindBooks.add(kindItem);
}
//////////////
result.setKindBooks(kindBooks);
e.onNext(result);
e.onComplete();
}
});
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
@Override
public Observable<List<SearchBookBean>> searchBook(String content, int page) {
return getRetrofitObject(TAG).create(IGxwztvApi.class).searchBook(content, page).flatMap(new Function<String, ObservableSource<List<SearchBookBean>>>() {
@Override
public ObservableSource<List<SearchBookBean>> apply(String s) throws Exception {
return analySearchBook(s);
}
});
}
public Observable<List<SearchBookBean>> analySearchBook(final String s) {
return Observable.create(new ObservableOnSubscribe<List<SearchBookBean>>() {
@Override
public void subscribe(ObservableEmitter<List<SearchBookBean>> e) throws Exception {
try {
Document doc = Jsoup.parse(s);
Elements booksE = doc.getElementById("novel-list").getElementsByClass("list-group-item clearfix");
if (null != booksE && booksE.size() >= 2) {
List<SearchBookBean> books = new ArrayList<SearchBookBean>();
for (int i = 1; i < booksE.size(); i++) {
SearchBookBean item = new SearchBookBean();
item.setTag(TAG);
item.setAuthor(booksE.get(i).getElementsByClass("col-xs-2").get(0).text());
item.setKind(booksE.get(i).getElementsByClass("col-xs-1").get(0).text());
item.setLastChapter(booksE.get(i).getElementsByClass("col-xs-4").get(0).getElementsByTag("a").get(0).text());
item.setOrigin("gxwztv.com");
item.setName(booksE.get(i).getElementsByClass("col-xs-3").get(0).getElementsByTag("a").get(0).text());
item.setNoteUrl(TAG + booksE.get(i).getElementsByClass("col-xs-3").get(0).getElementsByTag("a").get(0).attr("href"));
item.setCoverUrl("noimage");
books.add(item);
}
e.onNext(books);
} else {
e.onNext(new ArrayList<SearchBookBean>());
}
} catch (Exception ex) {
ex.printStackTrace();
e.onNext(new ArrayList<SearchBookBean>());
}
e.onComplete();
}
});
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
@Override
public Observable<BookShelfBean> getBookInfo(final BookShelfBean bookShelfBean) {
return getRetrofitObject(TAG).create(IGxwztvApi.class).getBookInfo(bookShelfBean.getNoteUrl().replace(TAG, "")).flatMap(new Function<String, ObservableSource<BookShelfBean>>() {
@Override
public ObservableSource<BookShelfBean> apply(String s) throws Exception {
return analyBookInfo(s, bookShelfBean);
}
});
}
private Observable<BookShelfBean> analyBookInfo(final String s, final BookShelfBean bookShelfBean) {
return Observable.create(new ObservableOnSubscribe<BookShelfBean>() {
@Override
public void subscribe(ObservableEmitter<BookShelfBean> e) throws Exception {
bookShelfBean.setTag(TAG);
bookShelfBean.setBookInfoBean(analyBookinfo(s, bookShelfBean.getNoteUrl()));
e.onNext(bookShelfBean);
e.onComplete();
}
});
}
private BookInfoBean analyBookinfo(String s, String novelUrl) {
BookInfoBean bookInfoBean = new BookInfoBean();
bookInfoBean.setNoteUrl(novelUrl); //id
bookInfoBean.setTag(TAG);
Document doc = Jsoup.parse(s);
Element resultE = doc.getElementsByClass("panel panel-warning").get(0);
bookInfoBean.setCoverUrl(resultE.getElementsByClass("panel-body").get(0).getElementsByClass("img-thumbnail").get(0).attr("src"));
bookInfoBean.setName(resultE.getElementsByClass("active").get(0).text());
bookInfoBean.setAuthor(resultE.getElementsByClass("col-xs-12 list-group-item no-border").get(0).getElementsByTag("small").get(0).text());
Element introduceE = resultE.getElementsByClass("panel panel-default mt20").get(0);
String introduce = "";
if (introduceE.getElementById("all") != null) {
introduce = introduceE.getElementById("all").text().replace("[收起]", "");
} else {
introduce = introduceE.getElementById("shot").text();
}
bookInfoBean.setIntroduce("\u3000\u3000" + introduce);
bookInfoBean.setChapterUrl(TAG + resultE.getElementsByClass("list-group-item tac").get(0).getElementsByTag("a").get(0).attr("href"));
bookInfoBean.setOrigin("gxwztv.com");
return bookInfoBean;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
@Override
public void getChapterList(final BookShelfBean bookShelfBean, final OnGetChapterListListener getChapterListListener) {
getRetrofitObject(TAG).create(IGxwztvApi.class).getChapterList(bookShelfBean.getBookInfoBean().getChapterUrl().replace(TAG, "")).flatMap(new Function<String, ObservableSource<WebChapterBean<BookShelfBean>>>() {
@Override
public ObservableSource<WebChapterBean<BookShelfBean>> apply(String s) throws Exception {
return analyChapterList(s, bookShelfBean);
}
})
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new SimpleObserver<WebChapterBean<BookShelfBean>>() {
@Override
public void onNext(WebChapterBean<BookShelfBean> value) {
if (getChapterListListener != null) {
getChapterListListener.success(value.getData());
}
}
@Override
public void onError(Throwable e) {
e.printStackTrace();
if (getChapterListListener != null) {
getChapterListListener.error();
}
}
});
}
private Observable<WebChapterBean<BookShelfBean>> analyChapterList(final String s, final BookShelfBean bookShelfBean) {
return Observable.create(new ObservableOnSubscribe<WebChapterBean<BookShelfBean>>() {
@Override
public void subscribe(ObservableEmitter<WebChapterBean<BookShelfBean>> e) throws Exception {
bookShelfBean.setTag(TAG);
WebChapterBean<List<ChapterListBean>> temp = analyChapterlist(s, bookShelfBean.getNoteUrl());
bookShelfBean.getBookInfoBean().setChapterlist(temp.getData());
e.onNext(new WebChapterBean<BookShelfBean>(bookShelfBean, temp.getNext()));
e.onComplete();
}
});
}
private WebChapterBean<List<ChapterListBean>> analyChapterlist(String s, String novelUrl) {
Document doc = Jsoup.parse(s);
Elements chapterlist = doc.getElementById("chapters-list").getElementsByTag("a");
List<ChapterListBean> chapterBeans = new ArrayList<ChapterListBean>();
for (int i = 0; i < chapterlist.size(); i++) {
ChapterListBean temp = new ChapterListBean();
temp.setDurChapterUrl(TAG + chapterlist.get(i).attr("href")); //id
temp.setDurChapterIndex(i);
temp.setDurChapterName(chapterlist.get(i).text());
temp.setNoteUrl(novelUrl);
temp.setTag(TAG);
chapterBeans.add(temp);
}
Boolean next = false;
return new WebChapterBean<List<ChapterListBean>>(chapterBeans, next);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
@Override
public Observable<BookContentBean> getBookContent(final String durChapterUrl, final int durChapterIndex) {
return getRetrofitObject(TAG).create(IGxwztvApi.class).getBookContent(durChapterUrl.replace(TAG, "")).flatMap(new Function<String, ObservableSource<BookContentBean>>() {
@Override
public ObservableSource<BookContentBean> apply(String s) throws Exception {
return analyBookContent(s, durChapterUrl, durChapterIndex);
}
});
}
private Observable<BookContentBean> analyBookContent(final String s, final String durChapterUrl, final int durChapterIndex) {
return Observable.create(new ObservableOnSubscribe<BookContentBean>() {
@Override
public void subscribe(ObservableEmitter<BookContentBean> e) throws Exception {
BookContentBean bookContentBean = new BookContentBean();
bookContentBean.setDurChapterIndex(durChapterIndex);
bookContentBean.setDurChapterUrl(durChapterUrl);
bookContentBean.setTag(TAG);
try {
Document doc = Jsoup.parse(s);
List<TextNode> contentEs = doc.getElementById("txtContent").textNodes();
StringBuilder content = new StringBuilder();
for (int i = 0; i < contentEs.size(); i++) {
String temp = contentEs.get(i).text().trim();
temp = temp.replaceAll(" ", "").replaceAll(" ", "");
if (temp.length() > 0) {
content.append("\u3000\u3000" + temp);
if (i < contentEs.size() - 1) {
content.append("\r\n");
}
}
}
bookContentBean.setDurCapterContent(content.toString());
bookContentBean.setRight(true);
} catch (Exception ex) {
ex.printStackTrace();
ErrorAnalyContentManager.getInstance().writeNewErrorUrl(durChapterUrl);
bookContentBean.setDurCapterContent(durChapterUrl.substring(0, durChapterUrl.indexOf('/', 8)) + "站点暂时不支持解析请反馈给Monke QQ:1105075896,半小时内解决,超级效率的程序员");
bookContentBean.setRight(false);
}
e.onNext(bookContentBean);
e.onComplete();
}
});
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
*
*/
@Override
public Observable<List<SearchBookBean>> getKindBook(String url, int page) {
url = url + page + ".htm";
return getRetrofitObject(GxwztvBookModelImpl.TAG).create(IGxwztvApi.class).getKindBooks(url.replace(GxwztvBookModelImpl.TAG, "")).flatMap(new Function<String, ObservableSource<List<SearchBookBean>>>() {
@Override
public ObservableSource<List<SearchBookBean>> apply(String s) throws Exception {
return analySearchBook(s);
}
});
}
}

@ -1,185 +0,0 @@
//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook.model.impl;
import com.monke.monkeybook.base.MBaseModelImpl;
import com.monke.monkeybook.bean.BookShelfBean;
import com.monke.monkeybook.bean.ChapterListBean;
import com.monke.monkeybook.bean.LocBookShelfBean;
import com.monke.monkeybook.dao.BookInfoBeanDao;
import com.monke.monkeybook.dao.BookShelfBeanDao;
import com.monke.monkeybook.dao.ChapterListBeanDao;
import com.monke.monkeybook.dao.DbHelper;
import com.monke.monkeybook.model.IImportBookModel;
import org.mozilla.universalchardet.UniversalDetector;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import io.reactivex.Observable;
import io.reactivex.ObservableEmitter;
import io.reactivex.ObservableOnSubscribe;
public class ImportBookModelImpl extends MBaseModelImpl implements IImportBookModel {
public static ImportBookModelImpl getInstance() {
return new ImportBookModelImpl();
}
@Override
public Observable<LocBookShelfBean> importBook(final File book) {
return Observable.create(new ObservableOnSubscribe<LocBookShelfBean>() {
@Override
public void subscribe(ObservableEmitter<LocBookShelfBean> e) throws Exception {
MessageDigest md = MessageDigest.getInstance("MD5");
FileInputStream in = new FileInputStream(book);
byte[] buffer = new byte[2048];
int len;
while ((len = in.read(buffer, 0, 2048)) != -1) {
md.update(buffer, 0, len);
}
in.close();
in = null;
String md5 = new BigInteger(1, md.digest()).toString(16);
BookShelfBean bookShelfBean = null;
List<BookShelfBean> temp = DbHelper.getInstance().getmDaoSession().getBookShelfBeanDao().queryBuilder().where(BookShelfBeanDao.Properties.NoteUrl.eq(md5)).build().list();
Boolean isNew = true;
if (temp!=null && temp.size()>0) {
isNew = false;
bookShelfBean = temp.get(0);
bookShelfBean.setBookInfoBean(DbHelper.getInstance().getmDaoSession().getBookInfoBeanDao().queryBuilder().where(BookInfoBeanDao.Properties.NoteUrl.eq(bookShelfBean.getNoteUrl())).build().list().get(0));
} else {
bookShelfBean = new BookShelfBean();
bookShelfBean.setFinalDate(System.currentTimeMillis());
bookShelfBean.setDurChapter(0);
bookShelfBean.setDurChapterPage(0);
bookShelfBean.setTag(BookShelfBean.LOCAL_TAG);
bookShelfBean.setNoteUrl(md5);
bookShelfBean.getBookInfoBean().setAuthor("佚名");
bookShelfBean.getBookInfoBean().setName(book.getName().replace(".txt", "").replace(".TXT", ""));
bookShelfBean.getBookInfoBean().setFinalRefreshData(System.currentTimeMillis());
bookShelfBean.getBookInfoBean().setCoverUrl("");
bookShelfBean.getBookInfoBean().setNoteUrl(md5);
bookShelfBean.getBookInfoBean().setTag(BookShelfBean.LOCAL_TAG);
saveChapter(book, md5);
DbHelper.getInstance().getmDaoSession().getBookInfoBeanDao().insertOrReplace(bookShelfBean.getBookInfoBean());
DbHelper.getInstance().getmDaoSession().getBookShelfBeanDao().insertOrReplace(bookShelfBean);
}
bookShelfBean.getBookInfoBean().setChapterlist(DbHelper.getInstance().getmDaoSession().getChapterListBeanDao().queryBuilder().where(ChapterListBeanDao.Properties.NoteUrl.eq(bookShelfBean.getNoteUrl())).orderAsc(ChapterListBeanDao.Properties.DurChapterIndex).build().list());
e.onNext(new LocBookShelfBean(isNew,bookShelfBean));
e.onComplete();
}
});
}
private Boolean isAdded(BookShelfBean temp, List<BookShelfBean> shelfs) {
if (shelfs == null || shelfs.size() == 0) {
return false;
} else {
int a = 0;
for (int i = 0; i < shelfs.size(); i++) {
if (temp.getNoteUrl().equals(shelfs.get(i).getNoteUrl())) {
break;
} else {
a++;
}
}
if (a == shelfs.size()) {
return false;
} else
return true;
}
}
private void saveChapter(File book, String md5) throws IOException {
String regex = "第.{1,7}章.{0,}";
String encoding;
FileInputStream fis = new FileInputStream(book);
byte[] buf = new byte[4096];
UniversalDetector detector = new UniversalDetector(null);
int nread;
while ((nread = fis.read(buf)) > 0 && !detector.isDone()) {
detector.handleData(buf, 0, nread);
}
detector.dataEnd();
encoding = detector.getDetectedCharset();
if (encoding == null || encoding.length() == 0)
encoding = "utf-8";
fis.close();
fis = null;
int chapterPageIndex = 0;
String title = null;
StringBuilder contentBuilder = new StringBuilder();
fis = new FileInputStream(book);
InputStreamReader inputreader = new InputStreamReader(fis, encoding);
BufferedReader buffreader = new BufferedReader(inputreader);
String line;
while ((line = buffreader.readLine()) != null) {
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(line);
if (m.find()) {
String temp = line.trim().substring(0,line.trim().indexOf("第"));
if(temp!= null && temp.trim().length()>0){
contentBuilder.append(temp);
}
if (contentBuilder.toString().length() > 0) {
if(contentBuilder.toString().replaceAll(" ","").trim().length()>0){
saveDurChapterContent(md5, chapterPageIndex, title, contentBuilder.toString());
chapterPageIndex++;
}
contentBuilder.delete(0, contentBuilder.length());
}
title = line.trim().substring(line.trim().indexOf("第"));
} else {
if (line.trim().length() == 0) {
if (contentBuilder.length() > 0) {
contentBuilder.append("\r\n\u3000\u3000");
} else {
contentBuilder.append("\r\u3000\u3000");
}
} else {
contentBuilder.append(line);
if (title == null) {
title = line.trim();
}
}
}
}
if (contentBuilder.length() > 0) {
saveDurChapterContent(md5, chapterPageIndex, title, contentBuilder.toString());
contentBuilder.delete(0, contentBuilder.length());
title = null;
}
buffreader.close();
inputreader.close();
fis.close();
fis = null;
}
private void saveDurChapterContent(String md5, int chapterPageIndex, String name, String content) {
ChapterListBean chapterListBean = new ChapterListBean();
chapterListBean.setNoteUrl(md5);
chapterListBean.setDurChapterIndex(chapterPageIndex);
chapterListBean.setTag(BookShelfBean.LOCAL_TAG);
chapterListBean.setDurChapterUrl(md5 + "_" + chapterPageIndex);
chapterListBean.setDurChapterName(name);
chapterListBean.getBookContentBean().setDurChapterUrl(chapterListBean.getDurChapterUrl());
chapterListBean.getBookContentBean().setTag(BookShelfBean.LOCAL_TAG);
chapterListBean.getBookContentBean().setDurChapterIndex(chapterListBean.getDurChapterIndex());
chapterListBean.getBookContentBean().setDurCapterContent(content);
DbHelper.getInstance().getmDaoSession().getBookContentBeanDao().insertOrReplace(chapterListBean.getBookContentBean());
DbHelper.getInstance().getmDaoSession().getChapterListBeanDao().insertOrReplace(chapterListBean);
}
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save