diff --git a/.idea/assetWizardSettings.xml b/.idea/assetWizardSettings.xml
deleted file mode 100644
index e75312f..0000000
--- a/.idea/assetWizardSettings.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser
deleted file mode 100644
index 7d5178e..0000000
Binary files a/.idea/caches/build_file_checksums.ser and /dev/null differ
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index 23a89bb..106519c 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -7,7 +7,7 @@
-
+
-
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
deleted file mode 100644
index 6560a98..0000000
--- a/.idea/inspectionProfiles/Project_Default.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 190586c..794aa67 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,4 +1,4 @@
-
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
index 86610f9..c9f6d5e 100644
--- a/.idea/modules.xml
+++ b/.idea/modules.xml
@@ -2,7 +2,7 @@
-
+
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
index 35eb1dd..94a25f7 100644
--- a/.idea/vcs.xml
+++ b/.idea/vcs.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index 21c59f6..fefb304 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -44,7 +44,7 @@ def getVersionName(){
def hun = (version / 100).toInteger()
def ten = (version / 10).toInteger() % 10
def one = version % 10
- return hun + "." + ten + "." + one + "-beta"
+ return hun + "." + ten + "." + one
}
def versionN = getVersionName()
diff --git a/app/src/main/assets/updatelog.fy b/app/src/main/assets/updatelog.fy
index b02b6df..7a2ef9a 100644
--- a/app/src/main/assets/updatelog.fy
+++ b/app/src/main/assets/updatelog.fy
@@ -1,3 +1,9 @@
+2021.05.17
+风月读书v2.0.1
+更新内容:
+1、修复第三方书源阅读界面换源后无法加载目录的bug
+2、优化阅读界面换源
+
2021.05.16
风月读书v2.0.0
更新内容:
diff --git a/app/src/main/java/xyz/fycz/myreader/entity/SharedBook.java b/app/src/main/java/xyz/fycz/myreader/entity/SharedBook.java
index 2b68c77..5e34779 100644
--- a/app/src/main/java/xyz/fycz/myreader/entity/SharedBook.java
+++ b/app/src/main/java/xyz/fycz/myreader/entity/SharedBook.java
@@ -13,6 +13,7 @@ public class SharedBook {
private String desc;
private String imgUrl;
private String chapterUrl;
+ private String infoUrl;
private String source;
public String getName() {
@@ -63,6 +64,14 @@ public class SharedBook {
this.chapterUrl = chapterUrl;
}
+ public String getInfoUrl() {
+ return infoUrl;
+ }
+
+ public void setInfoUrl(String infoUrl) {
+ this.infoUrl = infoUrl;
+ }
+
public String getSource() {
return source;
}
@@ -84,6 +93,7 @@ public class SharedBook {
sharedBook.setDesc(desc);
sharedBook.setImgUrl(book.getImgUrl());
sharedBook.setChapterUrl(book.getChapterUrl());
+ sharedBook.setInfoUrl(book.getInfoUrl());
sharedBook.setSource(book.getSource());
return sharedBook;
}
@@ -96,6 +106,7 @@ public class SharedBook {
book.setDesc(sharedBook.desc);
book.setImgUrl(sharedBook.imgUrl);
book.setChapterUrl(sharedBook.chapterUrl);
+ book.setInfoUrl(sharedBook.infoUrl);
book.setSource(sharedBook.source);
return book;
}
diff --git a/app/src/main/java/xyz/fycz/myreader/model/SearchEngine.java b/app/src/main/java/xyz/fycz/myreader/model/SearchEngine.java
index eaed847..0845f4e 100644
--- a/app/src/main/java/xyz/fycz/myreader/model/SearchEngine.java
+++ b/app/src/main/java/xyz/fycz/myreader/model/SearchEngine.java
@@ -2,6 +2,8 @@ package xyz.fycz.myreader.model;
import androidx.annotation.NonNull;
+
+import io.reactivex.Observable;
import io.reactivex.Observer;
import io.reactivex.Scheduler;
import io.reactivex.android.schedulers.AndroidSchedulers;
@@ -43,12 +45,19 @@ public class SearchEngine {
private int searchSuccessNum;
private int searchFinishNum;
+ private boolean isRead = false;//是否在阅读界面换源
+
private OnSearchListener searchListener;
public SearchEngine() {
threadsNum = SharedPreUtils.getInstance().getInt(App.getmContext().getString(R.string.threadNum), 8);
}
+ public SearchEngine(boolean isRead) {
+ this();
+ this.isRead = isRead;
+ }
+
public void setOnSearchListener(OnSearchListener searchListener) {
this.searchListener = searchListener;
}
@@ -183,6 +192,7 @@ public class SearchEngine {
ReadCrawler crawler = mSourceList.get(searchSiteIndex);
String searchKey = title;
BookApi.search(searchKey, crawler)
+ .flatMap(bookMap -> getBookInfo(bookMap, crawler))
.subscribeOn(scheduler)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer>() {
@@ -228,7 +238,7 @@ public class SearchEngine {
}
- public synchronized void getBookInfo(Book book, BookInfoCrawler bic, OnGetBookInfoListener listener){
+ public void getBookInfo(Book book, BookInfoCrawler bic, OnGetBookInfoListener listener) {
BookApi.getBookInfo(book, bic)
.subscribeOn(scheduler)
.observeOn(AndroidSchedulers.mainThread())
@@ -255,6 +265,19 @@ public class SearchEngine {
});
}
+ public Observable> getBookInfo(ConMVMap bookMap, ReadCrawler rc) {
+ return Observable.create(emitter -> {
+ if (isRead && rc instanceof BookInfoCrawler) {
+ List books = bookMap.values();
+ for (Book book : books) {
+ BookApi.getBookInfo(book, (BookInfoCrawler) rc).subscribe();
+ }
+ }
+ emitter.onNext(bookMap);
+ emitter.onComplete();
+ });
+ }
+
/************************************************************************/
public interface OnSearchListener {
@@ -269,15 +292,15 @@ public class SearchEngine {
}
- public interface OnGetBookInfoListener{
+ public interface OnGetBookInfoListener {
void loadFinish(Boolean isSuccess);
}
- public interface OnGetBookChaptersListener{
+ public interface OnGetBookChaptersListener {
void loadFinish(List chapters, Boolean isSuccess);
}
- public interface OnGetChapterContentListener{
+ public interface OnGetChapterContentListener {
void loadFinish(String content, Boolean isSuccess);
}
}
diff --git a/app/src/main/java/xyz/fycz/myreader/ui/activity/BookDetailedActivity.java b/app/src/main/java/xyz/fycz/myreader/ui/activity/BookDetailedActivity.java
index dafac65..972666e 100644
--- a/app/src/main/java/xyz/fycz/myreader/ui/activity/BookDetailedActivity.java
+++ b/app/src/main/java/xyz/fycz/myreader/ui/activity/BookDetailedActivity.java
@@ -94,7 +94,7 @@ public class BookDetailedActivity extends BaseActivity {
private static final String TAG = BookDetailedActivity.class.getSimpleName();
private Book mBook;
- private ArrayList aBooks;
+ private List aBooks;
private BookService mBookService;
private ChapterService mChapterService;
private ReadCrawler mReadCrawler;
@@ -156,7 +156,7 @@ public class BookDetailedActivity extends BaseActivity {
super.initData(savedInstanceState);
mBookService = BookService.getInstance();
mChapterService = ChapterService.getInstance();
- if (!initBook()){
+ if (!initBook()) {
ToastUtils.showError("无法获取书籍!");
finish();
return;
@@ -568,7 +568,14 @@ public class BookDetailedActivity extends BaseActivity {
mBookService.addBook(mBook);
}
Intent intent = new Intent(this, ReadActivity.class);
- BitIntentDataManager.getInstance().putData(intent, mBook);
+ aBooks = mSourceDialog.getaBooks();
+ if (aBooks != null) {
+ aBooks.set(mSourceDialog.getSourceIndex(), mBook);
+ BitIntentDataManager.getInstance().putData(intent, aBooks);
+ intent.putExtra(APPCONST.SOURCE_INDEX, mSourceDialog.getSourceIndex());
+ } else {
+ BitIntentDataManager.getInstance().putData(intent, mBook);
+ }
intent.putExtra("isCollected", isCollected);
startActivityForResult(intent, APPCONST.REQUEST_READ);
}
diff --git a/app/src/main/java/xyz/fycz/myreader/ui/activity/ReadActivity.java b/app/src/main/java/xyz/fycz/myreader/ui/activity/ReadActivity.java
index 27c3d43..699c18b 100644
--- a/app/src/main/java/xyz/fycz/myreader/ui/activity/ReadActivity.java
+++ b/app/src/main/java/xyz/fycz/myreader/ui/activity/ReadActivity.java
@@ -126,6 +126,7 @@ public class ReadActivity extends BaseActivity implements ColorPickerDialogListe
/***************************variable*****************************/
private Book mBook;
+ private List aBooks;
private ArrayList mChapters = new ArrayList<>();
private ChapterService mChapterService;
private BookService mBookService;
@@ -324,7 +325,10 @@ public class ReadActivity extends BaseActivity implements ColorPickerDialogListe
mPageLoader = binding.readPvContent.getPageLoader(mBook, mReadCrawler, mSetting);
//Dialog
- mSourceDialog = new SourceExchangeDialog(this, mBook);
+ mSourceDialog = new SourceExchangeDialog(this, mBook, true);
+ if (aBooks != null) {
+ mSourceDialog.setABooks(aBooks);
+ }
}
@Override
@@ -479,10 +483,13 @@ public class ReadActivity extends BaseActivity implements ColorPickerDialogListe
mBookService.updateBook(mBook, bookTem);
}
mBook = bookTem;
+ aBooks = mSourceDialog.getaBooks();
+ aBooks.set(pos, mBook);
toggleMenu(true);
Intent intent = new Intent(this, ReadActivity.class)
- .putExtra("hasChangeSource", true);
- BitIntentDataManager.getInstance().putData(intent, mBook);
+ .putExtra("hasChangeSource", true)
+ .putExtra(APPCONST.SOURCE_INDEX, pos);
+ BitIntentDataManager.getInstance().putData(intent, aBooks);
if (!isCollected) {
intent.putExtra("isCollected", false);
}
@@ -910,7 +917,16 @@ public class ReadActivity extends BaseActivity implements ColorPickerDialogListe
addLocalBook(path);
} else {
//路径为空,说明不是直接打开txt文件
- mBook = (Book) BitIntentDataManager.getInstance().getData(getIntent());
+ Object obj = BitIntentDataManager.getInstance().getData(getIntent());
+ if (obj instanceof Book) {
+ mBook = (Book) obj;
+ } else if (obj instanceof List) {
+ aBooks = (List) obj;
+ int bookPos = getIntent().getIntExtra(APPCONST.SOURCE_INDEX, 0);
+ if (aBooks.size() > bookPos) {
+ mBook = aBooks.get(bookPos);
+ }
+ }
//mBook为空,说明是从快捷方式启动
if (mBook == null) {
String bookId = SharedPreUtils.getInstance().getString(getString(R.string.lastRead), "");
diff --git a/app/src/main/java/xyz/fycz/myreader/ui/adapter/SourceExchangeAdapter.java b/app/src/main/java/xyz/fycz/myreader/ui/adapter/SourceExchangeAdapter.java
index df73b74..d16b914 100644
--- a/app/src/main/java/xyz/fycz/myreader/ui/adapter/SourceExchangeAdapter.java
+++ b/app/src/main/java/xyz/fycz/myreader/ui/adapter/SourceExchangeAdapter.java
@@ -4,6 +4,7 @@ import xyz.fycz.myreader.base.adapter.BaseListAdapter;
import xyz.fycz.myreader.base.adapter.IViewHolder;
import xyz.fycz.myreader.greendao.entity.Book;
import xyz.fycz.myreader.ui.adapter.holder.SourceExchangeHolder;
+import xyz.fycz.myreader.ui.dialog.SourceExchangeDialog;
import java.util.List;
@@ -12,8 +13,14 @@ import java.util.List;
* @date 2020/9/30 18:42
*/
public class SourceExchangeAdapter extends BaseListAdapter {
+ private SourceExchangeDialog dialog;
+
+ public SourceExchangeAdapter(SourceExchangeDialog dialog) {
+ this.dialog = dialog;
+ }
+
@Override
protected IViewHolder createViewHolder(int viewType) {
- return new SourceExchangeHolder();
+ return new SourceExchangeHolder(dialog);
}
}
diff --git a/app/src/main/java/xyz/fycz/myreader/ui/adapter/holder/SourceExchangeHolder.java b/app/src/main/java/xyz/fycz/myreader/ui/adapter/holder/SourceExchangeHolder.java
index 9a5d67f..36d7bcb 100644
--- a/app/src/main/java/xyz/fycz/myreader/ui/adapter/holder/SourceExchangeHolder.java
+++ b/app/src/main/java/xyz/fycz/myreader/ui/adapter/holder/SourceExchangeHolder.java
@@ -7,6 +7,7 @@ import xyz.fycz.myreader.R;
import xyz.fycz.myreader.base.adapter.ViewHolderImpl;
import xyz.fycz.myreader.greendao.entity.Book;
import xyz.fycz.myreader.model.sourceAnalyzer.BookSourceManager;
+import xyz.fycz.myreader.ui.dialog.SourceExchangeDialog;
/**
* @author fengyue
@@ -16,6 +17,12 @@ public class SourceExchangeHolder extends ViewHolderImpl {
TextView sourceTvTitle;
TextView sourceTvChapter;
ImageView sourceIv;
+ private SourceExchangeDialog dialog;
+
+ public SourceExchangeHolder(SourceExchangeDialog dialog) {
+ this.dialog = dialog;
+ }
+
@Override
protected int getItemLayoutId() {
return R.layout.item_change_source;
@@ -32,7 +39,7 @@ public class SourceExchangeHolder extends ViewHolderImpl {
public void onBind(Book data, int pos) {
sourceTvTitle.setText(BookSourceManager.getSourceNameByStr(data.getSource()));
sourceTvChapter.setText(data.getNewestChapterTitle());
- if (Boolean.parseBoolean(data.getNewestChapterId()))
+ if (data.getSource() != null && data.getSource().equals(dialog.getmShelfBook().getSource()))
sourceIv.setVisibility(View.VISIBLE);
else
sourceIv.setVisibility(View.GONE);
diff --git a/app/src/main/java/xyz/fycz/myreader/ui/dialog/SourceExchangeDialog.java b/app/src/main/java/xyz/fycz/myreader/ui/dialog/SourceExchangeDialog.java
index 5cab1f3..5a7ea25 100644
--- a/app/src/main/java/xyz/fycz/myreader/ui/dialog/SourceExchangeDialog.java
+++ b/app/src/main/java/xyz/fycz/myreader/ui/dialog/SourceExchangeDialog.java
@@ -47,6 +47,8 @@ public class SourceExchangeDialog extends Dialog {
private int sourceIndex = -1;
+ private boolean isRead;//是否在阅读界面换源
+
/***************************************************************************/
public SourceExchangeDialog(@NonNull Activity activity, Book bookBean) {
super(activity);
@@ -54,6 +56,11 @@ public class SourceExchangeDialog extends Dialog {
mShelfBook = bookBean;
}
+ public SourceExchangeDialog(@NonNull Activity activity, Book bookBean, boolean isRead) {
+ this(activity, bookBean);
+ this.isRead = isRead;
+ }
+
public void setShelfBook(Book mShelfBook) {
this.mShelfBook = mShelfBook;
}
@@ -65,12 +72,19 @@ public class SourceExchangeDialog extends Dialog {
public void setSourceIndex(int sourceIndex){
this.sourceIndex = sourceIndex;
}
-
+ public int getSourceIndex() {
+ return sourceIndex;
+ }
public void setOnSourceChangeListener(OnSourceChangeListener listener) {
this.listener = listener;
}
public List getaBooks(){return aBooks;}
+
+ public Book getmShelfBook() {
+ return mShelfBook;
+ }
+
/*****************************Initialization********************************/
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -121,11 +135,11 @@ public class SourceExchangeDialog extends Dialog {
aBooks = new ArrayList<>();
}
- mAdapter = new SourceExchangeAdapter();
+ mAdapter = new SourceExchangeAdapter(this);
binding.dialogRvContent.setLayoutManager(new LinearLayoutManager(mActivity));
binding.dialogRvContent.setAdapter(mAdapter);
- searchEngine = new SearchEngine();
+ searchEngine = new SearchEngine(isRead);
searchEngine.initSearchEngine(ReadCrawlerUtil.getEnableReadCrawlers());
}
diff --git a/app/src/main/java/xyz/fycz/myreader/util/help/JsExtensions.java b/app/src/main/java/xyz/fycz/myreader/util/help/JsExtensions.java
index e6972b4..f7dea3e 100644
--- a/app/src/main/java/xyz/fycz/myreader/util/help/JsExtensions.java
+++ b/app/src/main/java/xyz/fycz/myreader/util/help/JsExtensions.java
@@ -32,6 +32,7 @@ import xyz.fycz.myreader.util.utils.MD5Utils;
import xyz.fycz.myreader.util.utils.OkHttpUtils;
import xyz.fycz.myreader.util.utils.StringUtils;
+@Keep
@SuppressWarnings({"unused"})
public interface JsExtensions {
String TAG = JsExtensions.class.getSimpleName();
diff --git a/app/version_code.properties b/app/version_code.properties
index 7922af9..df87806 100644
--- a/app/version_code.properties
+++ b/app/version_code.properties
@@ -1,2 +1,2 @@
-#Sat May 15 22:50:54 CST 2021
-VERSION_CODE=199
+#Sun May 16 15:57:24 CST 2021
+VERSION_CODE=200