Compare commits
No commits in common. '869a9d889ac8c3e12360a3432c892cab6e410b8c' and '819e070286636d6f3fa6c7fb05fc0ec6fc60ba3b' have entirely different histories.
869a9d889a
...
819e070286
@ -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>
|
After Width: | Height: | Size: 151 KiB |
After Width: | Height: | Size: 99 KiB |
After Width: | Height: | Size: 24 KiB |
After Width: | Height: | Size: 194 KiB |
After Width: | Height: | Size: 108 KiB |
After Width: | Height: | Size: 85 KiB |
@ -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.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -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\\-\\.,@?^=%&:/~\\+#]*[\\w\\-\\@?^=%&/~\\+#])?";//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,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,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(" ", "").replaceAll("<divid=\"content\">", "").replaceAll("</div>", "").replaceAll("<p></p>","").replaceAll("<br><br>", "\r\n\u3000\u3000");
|
||||
contentString = "\u3000\u3000" + contentString;
|
||||
return contentString;
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue