|
|
@ -106,6 +106,7 @@ public class BookDetailedActivity extends BaseActivity { |
|
|
|
private BookGroupDialog mBookGroupDia; |
|
|
|
private BookGroupDialog mBookGroupDia; |
|
|
|
private List<String> tagList = new ArrayList<>(); |
|
|
|
private List<String> tagList = new ArrayList<>(); |
|
|
|
private Disposable chaptersDis; |
|
|
|
private Disposable chaptersDis; |
|
|
|
|
|
|
|
private boolean thirdSource; |
|
|
|
|
|
|
|
|
|
|
|
@SuppressLint("HandlerLeak") |
|
|
|
@SuppressLint("HandlerLeak") |
|
|
|
private Handler mHandler = new Handler() { |
|
|
|
private Handler mHandler = new Handler() { |
|
|
@ -174,6 +175,7 @@ public class BookDetailedActivity extends BaseActivity { |
|
|
|
} |
|
|
|
} |
|
|
|
mBookGroupDia = new BookGroupDialog(this); |
|
|
|
mBookGroupDia = new BookGroupDialog(this); |
|
|
|
mReadCrawler = ReadCrawlerUtil.getReadCrawler(mBook.getSource()); |
|
|
|
mReadCrawler = ReadCrawlerUtil.getReadCrawler(mBook.getSource()); |
|
|
|
|
|
|
|
thirdSource = mReadCrawler instanceof ThirdCrawler; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void initTagList() { |
|
|
|
private void initTagList() { |
|
|
@ -208,7 +210,7 @@ public class BookDetailedActivity extends BaseActivity { |
|
|
|
binding.ic.bookDetailRvCatalog.setLayoutManager(new LinearLayoutManager(this)); |
|
|
|
binding.ic.bookDetailRvCatalog.setLayoutManager(new LinearLayoutManager(this)); |
|
|
|
binding.ic.bookDetailRvCatalog.setAdapter(mCatalogAdapter); |
|
|
|
binding.ic.bookDetailRvCatalog.setAdapter(mCatalogAdapter); |
|
|
|
|
|
|
|
|
|
|
|
initChapters(false); |
|
|
|
if (!thirdSource) initChapters(false); |
|
|
|
|
|
|
|
|
|
|
|
mCatalogAdapter.setOnItemClickListener((view, pos) -> { |
|
|
|
mCatalogAdapter.setOnItemClickListener((view, pos) -> { |
|
|
|
mBook.setHisttoryChapterNum(mChapters.size() - pos - 1); |
|
|
|
mBook.setHisttoryChapterNum(mChapters.size() - pos - 1); |
|
|
@ -401,7 +403,7 @@ public class BookDetailedActivity extends BaseActivity { |
|
|
|
BookSource source = BookSourceManager.getBookSourceByStr(mBook.getSource()); |
|
|
|
BookSource source = BookSourceManager.getBookSourceByStr(mBook.getSource()); |
|
|
|
binding.ih.bookDetailSource.setText(String.format("书源:%s", source.getSourceName())); |
|
|
|
binding.ih.bookDetailSource.setText(String.format("书源:%s", source.getSourceName())); |
|
|
|
ReadCrawler rc = ReadCrawlerUtil.getReadCrawler(source); |
|
|
|
ReadCrawler rc = ReadCrawlerUtil.getReadCrawler(source); |
|
|
|
if (rc instanceof BookInfoCrawler && StringHelper.isEmpty(mBook.getImgUrl())) { |
|
|
|
if ((rc instanceof BookInfoCrawler && StringHelper.isEmpty(mBook.getImgUrl())) || thirdSource) { |
|
|
|
binding.pbLoading.setVisibility(View.VISIBLE); |
|
|
|
binding.pbLoading.setVisibility(View.VISIBLE); |
|
|
|
BookInfoCrawler bic = (BookInfoCrawler) rc; |
|
|
|
BookInfoCrawler bic = (BookInfoCrawler) rc; |
|
|
|
CommonApi.getBookInfo(mBook, bic).compose(RxUtils::toSimpleSingle).subscribe(new MyObserver<Book>() { |
|
|
|
CommonApi.getBookInfo(mBook, bic).compose(RxUtils::toSimpleSingle).subscribe(new MyObserver<Book>() { |
|
|
@ -410,6 +412,9 @@ public class BookDetailedActivity extends BaseActivity { |
|
|
|
if (!App.isDestroy(BookDetailedActivity.this)) { |
|
|
|
if (!App.isDestroy(BookDetailedActivity.this)) { |
|
|
|
mHandler.sendMessage(mHandler.obtainMessage(4)); |
|
|
|
mHandler.sendMessage(mHandler.obtainMessage(4)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (thirdSource){ |
|
|
|
|
|
|
|
initChapters(false); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -477,7 +482,8 @@ public class BookDetailedActivity extends BaseActivity { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onError(Throwable e) { |
|
|
|
public void onError(Throwable e) { |
|
|
|
binding.pbLoading.setVisibility(View.GONE); |
|
|
|
binding.pbLoading.setVisibility(View.GONE); |
|
|
|
ToastUtils.showError("最新章节加载失败!"); |
|
|
|
mCatalogAdapter.clear(); |
|
|
|
|
|
|
|
ToastUtils.showError("最新章节加载失败,请尝试重新加载!"); |
|
|
|
if (App.isDebug()) e.printStackTrace(); |
|
|
|
if (App.isDebug()) e.printStackTrace(); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|