优化发现书籍显示

master^2
fengyuecanzhu 2 years ago
parent b45f95ce13
commit f7c47d5783
No known key found for this signature in database
GPG Key ID: 04B78AD06A9D6E6C
  1. 1
      .idea/misc.xml
  2. 2
      app/src/main/java/xyz/fycz/myreader/ui/activity/BookDetailedActivity.java
  3. 8
      app/src/main/java/xyz/fycz/myreader/ui/adapter/holder/FindBookHolder.java

@ -22,6 +22,7 @@
<entry key="..\:/android/FYReader/app/src/main/res/layout/item_change_source.xml" value="0.22826086956521738" /> <entry key="..\:/android/FYReader/app/src/main/res/layout/item_change_source.xml" value="0.22826086956521738" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/item_chapter.xml" value="0.2296195652173913" /> <entry key="..\:/android/FYReader/app/src/main/res/layout/item_chapter.xml" value="0.2296195652173913" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/item_find_source.xml" value="0.12132725430597771" /> <entry key="..\:/android/FYReader/app/src/main/res/layout/item_find_source.xml" value="0.12132725430597771" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/item_search_book.xml" value="0.109375" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/item_search_word1.xml" value="0.2296195652173913" /> <entry key="..\:/android/FYReader/app/src/main/res/layout/item_search_word1.xml" value="0.2296195652173913" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/item_source_edit.xml" value="0.22826086956521738" /> <entry key="..\:/android/FYReader/app/src/main/res/layout/item_source_edit.xml" value="0.22826086956521738" />
<entry key="..\:/android/FYReader/app/src/main/res/layout/item_subscribe_source.xml" value="0.2" /> <entry key="..\:/android/FYReader/app/src/main/res/layout/item_subscribe_source.xml" value="0.2" />

@ -426,7 +426,7 @@ public class BookDetailedActivity extends BaseActivity<ActivityBookDetailBinding
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) {
binding.pbLoading.setVisibility(View.VISIBLE); binding.pbLoading.setVisibility(View.VISIBLE);
BookInfoCrawler bic = (BookInfoCrawler) rc; BookInfoCrawler bic = (BookInfoCrawler) rc;
BookApi.getBookInfo(mBook, bic).compose(RxUtils::toSimpleSingle).subscribe(new MyObserver<Book>() { BookApi.getBookInfo(mBook, bic).compose(RxUtils::toSimpleSingle).subscribe(new MyObserver<Book>() {

@ -106,12 +106,14 @@ public class FindBookHolder extends ViewHolderImpl<Book> {
} else { } else {
data.setNewestChapterTitle(""); data.setNewestChapterTitle("");
tvNewestChapter.setText(""); tvNewestChapter.setText("");
tvNewestChapter.setVisibility(View.GONE);
} }
if (!StringHelper.isEmpty(data.getDesc())) { if (!StringHelper.isEmpty(data.getDesc())) {
tvDesc.setText(String.format("简介:%s", data.getDesc())); tvDesc.setText(String.format("简介:%s", data.getDesc()));
} else { } else {
data.setDesc(""); data.setDesc("");
tvDesc.setText(""); tvDesc.setText("");
tvDesc.setVisibility(View.GONE);
} }
if (!StringHelper.isEmpty(source.getSourceName()) && !"未知书源".equals(source.getSourceName())) if (!StringHelper.isEmpty(source.getSourceName()) && !"未知书源".equals(source.getSourceName()))
tvSource.setText(String.format("书源:%s", source.getSourceName())); tvSource.setText(String.format("书源:%s", source.getSourceName()));
@ -132,10 +134,16 @@ public class FindBookHolder extends ViewHolderImpl<Book> {
private void initOtherInfo(Book book, ReadCrawler rc) { private void initOtherInfo(Book book, ReadCrawler rc) {
//简介 //简介
if (StringHelper.isEmpty(tvDesc.getText().toString())) { if (StringHelper.isEmpty(tvDesc.getText().toString())) {
tvNewestChapter.setVisibility(View.VISIBLE);
tvDesc.setText(String.format("简介:%s", book.getDesc())); tvDesc.setText(String.format("简介:%s", book.getDesc()));
} else {
tvNewestChapter.setVisibility(View.GONE);
} }
if (StringHelper.isEmpty(tvNewestChapter.getText().toString())) { if (StringHelper.isEmpty(tvNewestChapter.getText().toString())) {
tvNewestChapter.setVisibility(View.VISIBLE);
tvNewestChapter.setText(getContext().getString(R.string.newest_chapter, book.getNewestChapterTitle())); tvNewestChapter.setText(getContext().getString(R.string.newest_chapter, book.getNewestChapterTitle()));
} else {
tvNewestChapter.setVisibility(View.GONE);
} }
if (!StringHelper.isEmpty(book.getAuthor())) { if (!StringHelper.isEmpty(book.getAuthor())) {
tvAuthor.setText(book.getAuthor()); tvAuthor.setText(book.getAuthor());

Loading…
Cancel
Save