pull/21/head
fengyuecanzhu 3 years ago
parent a774c7056b
commit 420725d5d2
  1. 10
      app/src/main/java/xyz/fycz/myreader/greendao/entity/Book.java
  2. 3
      app/src/main/java/xyz/fycz/myreader/greendao/entity/Chapter.java
  3. 3
      app/src/main/java/xyz/fycz/myreader/ui/adapter/holder/SourceExchangeHolder.java
  4. 3
      app/src/main/java/xyz/fycz/myreader/ui/dialog/SourceExchangeDialog.java

@ -306,8 +306,11 @@ public class Book implements Serializable, RuleDataInterface {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Book book = (Book) o;
boolean flag = chapterUrl == null ?
(infoUrl == null || infoUrl.equals(book.infoUrl)) :
chapterUrl.equals(book.chapterUrl);
return name.equals(book.name) &&
chapterUrl.equals(book.chapterUrl) &&
flag && author != null &&
author.equals(book.author) &&
source.equals(book.source);
}
@ -396,6 +399,9 @@ public class Book implements Serializable, RuleDataInterface {
if (variableMap == null && !TextUtils.isEmpty(variable)) {
variableMap = GsonExtensionsKt.getGSON().fromJson(variable, MAP_STRING);
}
if (variableMap == null) {
variableMap = new HashMap<>();
}
return variableMap;
}
@ -487,4 +493,6 @@ public class Book implements Serializable, RuleDataInterface {
}
return bookTem;
}
public void setReverseToc(boolean reverseToc){}
}

@ -159,6 +159,9 @@ public class Chapter implements RuleDataInterface {
if (variableMap == null && !TextUtils.isEmpty(variable)) {
variableMap = GsonExtensionsKt.getGSON().fromJson(variable, MAP_STRING);
}
if (variableMap == null) {
variableMap = new HashMap<>();
}
return variableMap;
}

@ -42,7 +42,8 @@ public class SourceExchangeHolder extends ViewHolderImpl<Book> {
public void onBind(RecyclerView.ViewHolder holder, Book data, int pos) {
sourceTvTitle.setText(BookSourceManager.getSourceNameByStr(data.getSource()));
sourceTvChapter.setText(data.getNewestChapterTitle());
if (data.getSource() != null && data.getSource().equals(dialog.getmShelfBook().getSource())) {
if ((data.getInfoUrl() != null && data.getInfoUrl().equals(dialog.getmShelfBook().getInfoUrl())||
data.getChapterUrl() != null && data.getChapterUrl().equals(dialog.getmShelfBook().getChapterUrl()))) {
sourceIv.setVisibility(View.VISIBLE);
dialog.setSourceIndex(pos);
} else {

@ -205,7 +205,8 @@ public class SourceExchangeDialog extends Dialog {
searchEngine.stopSearch();
return;
}
if (mShelfBook.getSource().equals(newBook.getSource())) return;
if ((mShelfBook.getInfoUrl() != null && mShelfBook.getInfoUrl().equals(newBook.getInfoUrl())||
mShelfBook.getChapterUrl() != null && mShelfBook.getChapterUrl().equals(newBook.getChapterUrl()))) return;
mShelfBook = newBook;
listener.onSourceChanged(newBook, pos);
mAdapter.getItem(pos).setNewestChapterId("true");

Loading…
Cancel
Save