Skip to content

Commit

Permalink
v2.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
15dd committed Nov 3, 2023
1 parent 290e88e commit 48a4285
Show file tree
Hide file tree
Showing 17 changed files with 87 additions and 74 deletions.
2 changes: 1 addition & 1 deletion .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
## 软件bug请提issues,其他问题请发discussions
<hr>
# 重要事项
- <h3>软件bug请提issues,其他问题请发discussions</h3>
- <h3>本人职三开学了,项目维护和更新会非常慢</h3>
- <h3>本软件目前以维护为主,我接下来计划重写整个项目,只是不知道什么时候能搞好就是了

### 本人职三开学了,项目维护和更新会非常慢
### 最新通知(2023/10/27):由于轻小说文库官方网站更新的原因,导致目前版本的爬虫无效了。虽然可以重新写,但是我没啥空闲时间重写了(现在我连周日都要上一整天课了,一周上六天课)。我暂且定在寒假的时候修复,同时也会重构一部分代码。
# 介绍
<div align="center">
<div align="center">
<img src="./README/logo.png" alt="Logo" width="100" height="100">
Expand All @@ -23,7 +24,7 @@
- 支持阅读进度保存
- 深色模式适配
## 注意
- 本软件是轻小说文库的第三方软件,本软件数据全部来自轻小说文库(www.wenku8.net)
- 本软件是轻小说文库的第三方软件,本软件数据全部来自轻小说文库(www.wenku8.cc)
- 支持的安卓版本:Android 10+ (API 29+)

<h2>觉得好用别忘了star哦,你的star是对我最大的激励</h2>
Expand Down Expand Up @@ -76,7 +77,7 @@

## 常见问题
- Q:为什么软件一直崩溃?<br>
A:首先先看一下网络是否正常,比如没连接上网络,开了vpn之类的。或者打开浏览器访问 https://www.wenku8.net/index.php 。如果能正常访问该网站,而且网络环境没问题的情况下还一直崩溃的话,请提一个issue,并附上报错信息、使用的版本号,以及软件是在什么情况下崩溃的说明。
A:首先先看一下网络是否正常,比如没连接上网络,开了vpn之类的。或者打开浏览器访问 https://www.wenku8.cc/index.php 。如果能正常访问该网站,而且网络环境没问题的情况下还一直崩溃的话,请提一个issue,并附上报错信息、使用的版本号,以及软件是在什么情况下崩溃的说明。
- Q:图片加载失败怎么办?<br>
A:长按图片查看原图

Expand Down
24 changes: 14 additions & 10 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,20 @@ plugins {

android {
namespace 'com.cyh128.wenku8reader'
compileSdk 33

compileSdk 34
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
resources {
excludes += ['META-INF/DEPENDENCIES']
}
}


defaultConfig {
applicationId "com.cyh128.wenku8reader"
minSdk 29
targetSdk 33
versionCode 230829
versionName "2.2.1"
versionCode 231103
versionName "2.2.2"
}

buildTypes {
Expand All @@ -27,23 +29,23 @@ android {
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_19
targetCompatibility JavaVersion.VERSION_19
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
}

dependencies {

implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.9.0'
implementation 'com.google.android.material:material:1.10.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.recyclerview:recyclerview:1.3.1'
implementation 'androidx.recyclerview:recyclerview:1.3.2'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
implementation 'org.jsoup:jsoup:1.16.1'
implementation 'com.squareup.okhttp3:okhttp:5.0.0-alpha.11'
implementation 'com.github.chrisbanes:PhotoView:2.3.0'
implementation 'com.github.bumptech.glide:glide:4.15.1'
implementation 'androidx.sqlite:sqlite-ktx:2.3.1'
implementation 'androidx.sqlite:sqlite-ktx:2.4.0'
implementation 'com.alibaba:fastjson:2.0.37'
implementation 'com.github.youlookwhat:ByRecyclerView:1.3.6'
implementation 'com.github.MZCretin:ExpandableTextView:v1.6.1-x'
Expand All @@ -53,6 +55,8 @@ dependencies {
implementation 'com.github.huburt-Hu:NewbieGuide:v2.4.0'
implementation 'com.github.RickyHal:EColorPicker:1.0.4'

testImplementation 'junit:junit:4.13.2'

debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.12'

}
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,9 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
contentsList = Wenku8Spider.getContents(bookUrl);//小说目录

//获取这本书的aid和bid====================================================================================================
//aid获取 https://www.wenku8.net/book/xxxx.htm
//aid获取 https://www.wenku8.cc/book/xxxx.htm
this.aid = Integer.parseInt(bookUrl.substring(bookUrl.indexOf("book/") + 5, bookUrl.indexOf(".htm")));
//bid获取 https://www.wenku8.net/book/xxxx.htm 如果url没有bid,只有aid,那么就根据它的aid在书架中找到它对应的bid。删除必须用bid
//bid获取 https://www.wenku8.cc/book/xxxx.htm 如果url没有bid,只有aid,那么就根据它的aid在书架中找到它对应的bid。删除必须用bid
getBid();
//end===================================================================================================================

Expand Down Expand Up @@ -269,7 +269,7 @@ public void onScrollChange(View v, int scrollX, int scrollY, int oldScrollX, int
}

private void getBid() throws IOException {
//https://www.wenku8.net/book/xxxx.htm 如果url没有bid,只有aid,那么就根据它的aid在书架中找到它对应的bid。因为删除必须用bid
//https://www.wenku8.cc/book/xxxx.htm 如果url没有bid,只有aid,那么就根据它的aid在书架中找到它对应的bid。因为删除必须用bid
BookCaseFragment.bookcaseList = Wenku8Spider.getBookcase();
for (BookcaseBean bcc : BookCaseFragment.bookcaseList) {
if (Integer.parseInt(bcc.aid) == this.aid) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
new MaterialAlertDialogBuilder(LoginInputActivity.this)
.setCancelable(false)//禁止点击其他区域
.setTitle("网络错误")
.setMessage("可能是以下原因造成的:\n\n1 -> 请检查是否正在连接VPN或代理服务器\n2 -> 未连接上网络\n3 -> 服务器(wenku8.net)出错,(此网站有时会登不上去)\n\n请稍后再试")
.setMessage("可能是以下原因造成的:\n\n1 -> 请检查是否正在连接VPN或代理服务器\n2 -> 未连接上网络\n3 -> 服务器(wenku8.cc)出错,(此网站有时会登不上去)\n\n请稍后再试")
.setPositiveButton("明白", null)
.setIcon(R.drawable.warning)
.show();
Expand All @@ -115,7 +115,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
.setCancelable(false)
.setNegativeButton("取消", null)
.setPositiveButton("前往注册", (dialog, which) -> {
Uri uri = Uri.parse("https://www.wenku8.net/register.php"); //设置跳转的网站
Uri uri = Uri.parse("https://www.wenku8.cc/register.php"); //设置跳转的网站
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public void run() {
new MaterialAlertDialogBuilder(LoginingActivity.this)
.setCancelable(false)//禁止点击其他区域
.setTitle("网络错误")
.setMessage("可能是以下原因造成的:\n\n1 -> 请检查是否正在连接VPN或代理服务器\n2 -> 未连接上网络\n3 -> 服务器(wenku8.net)出错,(此网站有时会登不上去)\n\n请稍后再试")
.setMessage("可能是以下原因造成的:\n\n1 -> 请检查是否正在连接VPN或代理服务器\n2 -> 未连接上网络\n3 -> 服务器(wenku8.cc)出错,(此网站有时会登不上去)\n\n请稍后再试")
.setPositiveButton("重启软件", (dialogInterface, i) -> {
final Intent intent = getPackageManager().getLaunchIntentForPackage(getPackageName());
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int positi
.show();
return;
}
String url = String.format("https://www.wenku8.net/book/%s.htm",novel.bookUrl.substring(novel.bookUrl.indexOf("aid=") + 4, novel.bookUrl.indexOf("&")));
String url = String.format("https://www.wenku8.cc/book/%s.htm",novel.bookUrl.substring(novel.bookUrl.indexOf("aid=") + 4, novel.bookUrl.indexOf("&")));
Intent toContents = new Intent(context, ContentsActivity.class);
toContents.putExtra("bookUrl", url);
context.startActivity(toContents);
Expand All @@ -111,7 +111,7 @@ public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int positi
.show();
return;
}
String url = String.format("https://www.wenku8.net/book/%s.htm",novel.bookUrl.substring(novel.bookUrl.indexOf("aid=") + 4, novel.bookUrl.indexOf("&")));
String url = String.format("https://www.wenku8.cc/book/%s.htm",novel.bookUrl.substring(novel.bookUrl.indexOf("aid=") + 4, novel.bookUrl.indexOf("&")));
Intent toContents = new Intent(context, ContentsActivity.class);
toContents.putExtra("bookUrl", url);
context.startActivity(toContents);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int positi
itemViewHolder.number.setText(String.valueOf(position + 1));

itemViewHolder.itemView.setOnClickListener(v -> {//设置项目点击监听
Log.d("debug", "url:" + novel.bookUrl);
Log.d("debug", "BookListAdapter url:" + novel.bookUrl);

Intent toContents = new Intent(context, ContentsActivity.class);
toContents.putExtra("bookUrl", novel.bookUrl);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ private void setPageData(boolean isFirstPage, List<BookListBean> data) {

private List<BookListBean> getData() {
try {
String url = String.format("https://www.wenku8.net/modules/article/tags.php?t=%s&page=%d&v=%s", URLEncoder.encode(tag, "gbk"), ++pageindex, sort);
String url = String.format("https://www.wenku8.cc/modules/article/tags.php?t=%s&page=%d&v=%s", URLEncoder.encode(tag, "gbk"), ++pageindex, sort);
return Wenku8Spider.parseNovelList(LoginWenku8.getPageHtml(url));
} catch (Exception e) {
pageindex--;
Expand Down
14 changes: 7 additions & 7 deletions app/src/main/java/com/cyh128/wenku8reader/newReader/PageView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,18 @@ class PageView : ViewFlipper, IPageView {
return true
}

override fun onShowPress(e: MotionEvent) {
}

override fun onScroll(
e1: MotionEvent,
e1: MotionEvent?,
e2: MotionEvent,
distanceX: Float,
distanceY: Float
): Boolean {
return false
}

override fun onShowPress(e: MotionEvent) {
}

override fun onLongPress(e: MotionEvent) {
if (pageNum - maxTextPageNum > 0 && imgUrlList.size != 0) { //判断当前页面是否有图片,图片存放列表是否不为空
val intent = Intent(context, PhotoViewActivity::class.java)
Expand All @@ -91,13 +91,13 @@ class PageView : ViewFlipper, IPageView {
}

override fun onFling(
e1: MotionEvent,
e1: MotionEvent?,
e2: MotionEvent,
velocityX: Float,
velocityY: Float
): Boolean {
if (direction == Orientation.horizontal) {
if (e1.x - e2.x > FLIP_DISTANCE) {
if (e1!!.x - e2.x > FLIP_DISTANCE) {
Log.i("debug", "手指向左滑...")
pageToNext(Orientation.horizontal)
return true
Expand All @@ -108,7 +108,7 @@ class PageView : ViewFlipper, IPageView {
return true
}
} else if (direction == Orientation.vertical) {
if (e1.y - e2.y > FLIP_DISTANCE) {
if (e1!!.y - e2.y > FLIP_DISTANCE) {
Log.i("debug", "手指向上滑...")
pageToNext(Orientation.vertical)
return true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import android.os.Bundle;
import android.os.CountDownTimer;
import android.text.Html;
import android.util.Log;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
Expand Down Expand Up @@ -104,26 +105,27 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
toolbar.setBackgroundResource(showBarColor);
bottombar.setBackgroundResource(showBarColor);

UiModeManager uiModeManager = (UiModeManager) getSystemService(Context.UI_MODE_SERVICE);
//getSystemService导致的内存泄漏问题 https://blog.csdn.net/xiabing082/article/details/53993298
UiModeManager uiModeManager = (UiModeManager) getApplicationContext().getSystemService(Context.UI_MODE_SERVICE);
if (uiModeManager.getNightMode() == UiModeManager.MODE_NIGHT_YES) {
isNigntMode = true;
} else {
isNigntMode = false;
}

setBackgroundAndTextColor();//初始化背景颜色的字符串,以便hideBar()调用

bottomSheetDialog = new BottomSheetDialog(this);
bottomSheetView = LayoutInflater.from(this).inflate(R.layout.view_bottom_sheet_act_new_reader, null, false);
bottomSheetDialog.setContentView(bottomSheetView);
bottomSheetDialog.setDismissWithAnimation(true);
//保存设置
bottomSheetDialog.setOnDismissListener(dialog -> {
hideBar();

GlobalConfig.newReaderFontSize = fontSize.getValue() + 20f;
GlobalConfig.newReaderLineSpacing = lineSpacing.getValue();
GlobalConfig.readerBottomTextSize = bottomTextSize.getValue();

DatabaseHelper.SaveReaderSetting();
hideBar();
GlobalConfig.newReaderFontSize = fontSize.getValue() + 20f;
GlobalConfig.newReaderLineSpacing = lineSpacing.getValue();
GlobalConfig.readerBottomTextSize = bottomTextSize.getValue();
DatabaseHelper.SaveReaderSetting();
});


Expand Down Expand Up @@ -381,6 +383,7 @@ public void showBar() {
toolbar.animate().translationY(0).setListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(@NonNull Animator animation) {
Log.d("tag","readeractivity hide:"+hideBarColor);
ImmersionBar.with(ReaderActivity.this)
.statusBarColor(showBarColor)
.navigationBarColor(showBarColor)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public static boolean login(String username, String password) throws IOException
builder.add(key, paramsMap.get(key));
}
RequestBody formBody = builder.build();
Request request = new Request.Builder().url("https://www.wenku8.net/login.php").post(formBody).build();
Request request = new Request.Builder().url("https://www.wenku8.cc/login.php").post(formBody).build();

Response response = okHttpClient.newCall(request).execute();
String html = new String(response.body().bytes(), "gbk");
Expand Down
Loading

0 comments on commit 48a4285

Please sign in to comment.