搜书大师 v23.2版本的 MD5 值为:5ee433f6456b6278bd6e80a5d44df55e
以下内容为反编译后的 WebBookDetailAct.java 源代码,内容仅作参考
package com.flyersoft.WB;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Rect;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.CheckBox;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.ScrollView;
import android.widget.Spinner;
import android.widget.SpinnerAdapter;
import android.widget.TextView;
import androidx.appcompat.app.AlertDialog;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.facebook.drawee.view.SimpleDraweeView;
import com.flyersoft.WB.DownloadTask;
import com.flyersoft.WB.DownloadTaskBrowser;
import com.flyersoft.WB.S;
import com.flyersoft.WB.WB;
import com.flyersoft.WB.collect.AutoCollect;
import com.flyersoft.components.m;
import com.flyersoft.discuss.TS;
import com.flyersoft.discuss.z;
import com.flyersoft.seekbooks.ActivityMain;
import com.flyersoft.seekbooks.ActivityTxt;
import com.flyersoft.seekbooks.PrefChapters;
import com.flyersoft.seekbooks.R;
import com.ksdk.ssds.manager.b;
import com.lygame.aaa.e50;
import com.lygame.aaa.g50;
import com.lygame.aaa.o50;
import com.lygame.aaa.q50;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
public class WebBookDetailAct extends SwipeBaseHeaderActivity implements View.OnClickListener, View.OnLongClickListener {
static DownloadTaskBrowser.CacheWebView cacheWeb;
public static Activity fromAct;
public static Handler fromActHandler;
public static ArrayList<S.WebBook> fromBooks;
private static HashMap<String, Integer> reload_urls = new HashMap<>();
public static WebBookDetailAct selfPref;
public static boolean speedTested;
public static ArrayList<S.WebBook> testBooks;
public static AlertDialog testDlg;
public static ListView testLv;
public static boolean testStart;
public static ArrayList<S.WebBook> testedBooks;
public static ArrayList<TestInfo> testedList;
int MAX_COUNT;
Spinner SourceSp;
S.WebBook book;
public S.BookSite chapterSite;
SimpleDraweeView coverView;
TextView desTv;
TextView downloadB;
m.c errorDlg;
boolean fromOuterApp;
TextView lastUpdate;
boolean noad;
ProgressBar progresBar;
ProgressDialog progressDlg;
RecyclerView rv;
View speedTest;
TextView titleTv;
String urlForOpen;
Handler handler = new Handler(Looper.getMainLooper()) {
@Override
public void handleMessage(Message msg) {
if (msg.what == 2100) {
WebBookDetailAct.doOnFinish((DownloadTask.Result) msg.obj);
}
if (msg.what == 2101) {
WebBookDetailAct.doOnError((DownloadTask.Result) msg.obj);
}
}
};
public ArrayList<S.WebChapter> chapters = new ArrayList<>();
class BookRvViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
ViewGroup base;
int position;
TextView tv;
public BookRvViewHolder(View itemView, int viewType) {
super(itemView);
ViewGroup viewGroup = (ViewGroup) itemView;
this.base = viewGroup;
viewGroup.setBackgroundColor(e50.K2());
this.base.setLayoutParams(new RecyclerView.LayoutParams(-1, -2));
TextView textView = new TextView(WebBookDetailAct.this);
this.tv = textView;
this.base.addView(textView, -1, -2);
if (e50.M2) {
this.tv.setTextColor(viewType == 0 ? -4473925 : -7829368);
} else {
this.tv.setTextColor(viewType == 0 ? -10066330 : -7829368);
}
int k0 = e50.k0(24.0f);
this.tv.setPadding(k0, e50.k0(8.0f), k0, e50.k0(8.0f));
this.tv.setBackgroundResource(e50.w3(WebBookDetailAct.this));
if (viewType > 0) {
this.base.setOnClickListener(this);
}
}
@Override
public void onClick(View v) {
if (o50.G1(WebBookDetailAct.this.chapters)) {
return;
}
int size = WebBookDetailAct.this.chapters.size();
WebBookDetailAct webBookDetailAct = WebBookDetailAct.this;
int i = webBookDetailAct.MAX_COUNT;
if (size <= i || this.position != i + 1) {
webBookDetailAct.openBook(this.position - 1);
} else {
webBookDetailAct.showAllChapters();
}
}
}
public class ChaptersAdapter extends RecyclerView.Adapter {
RecyclerView.ViewHolder topHolder;
ChaptersAdapter() {
}
@Override
public int getItemCount() {
return WebBookDetailAct.this.ChapterAdapterItemCount();
}
@Override
public int getItemViewType(int position) {
return position;
}
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
int i;
String str;
BookRvViewHolder bookRvViewHolder = (BookRvViewHolder) holder;
bookRvViewHolder.position = position;
if (position == 0) {
bookRvViewHolder.setIsRecyclable(false);
if (this.topHolder == null) {
this.topHolder = bookRvViewHolder;
WebBookDetailAct webBookDetailAct = WebBookDetailAct.this;
webBookDetailAct.desTv = bookRvViewHolder.tv;
webBookDetailAct.fillDescription();
return;
}
return;
}
int size = WebBookDetailAct.this.chapters.size();
WebBookDetailAct webBookDetailAct2 = WebBookDetailAct.this;
int i2 = webBookDetailAct2.MAX_COUNT;
if (size > i2 && position == i2 + 1) {
bookRvViewHolder.tv.getPaint().setFakeBoldText(true);
TextView textView = bookRvViewHolder.tv;
WebBookDetailAct webBookDetailAct3 = WebBookDetailAct.this;
if (webBookDetailAct3.book.site.webReadLevel > 1) {
str = webBookDetailAct3.getString(R.string.qitazhangjie);
} else {
str = WebBookDetailAct.this.getString(R.string.xianshisuoyhouzhangjie) + WebBookDetailAct.this.chapters.size() + "章)";
}
textView.setText(str);
return;
}
ArrayList<S.WebChapter> arrayList = webBookDetailAct2.chapters;
if (arrayList != null && (i = position - 1) < arrayList.size()) {
bookRvViewHolder.tv.getPaint().setFakeBoldText(false);
bookRvViewHolder.tv.setText(WebBookDetailAct.this.chapters.get(i).name);
} else {
bookRvViewHolder.tv.setText("");
}
}
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
RecyclerView.ViewHolder viewHolder;
return (viewType != 0 || (viewHolder = this.topHolder) == null) ? new BookRvViewHolder(new LinearLayout(WebBookDetailAct.this), viewType) : viewHolder;
}
}
public static class TestInfo {
int chapter_count;
String err;
String lastChapter;
long load_time;
S.BookSite site;
public TestInfo(S.BookSite site, String lastChapter, String err, long load_time, int chapter_count) {
this.site = site;
this.lastChapter = lastChapter;
this.err = err;
this.load_time = load_time;
this.chapter_count = chapter_count;
}
}
public static class TestListAdapter extends BaseAdapter {
@Override
public int getCount() {
return WebBookDetailAct.testedList.size();
}
@Override
public Object getItem(int position) {
return Integer.valueOf(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
String str;
String str2;
TextView textView = convertView == null ? new TextView(WebBookDetailAct.fromAct) : (TextView) convertView;
textView.setTextColor(e50.M2());
textView.setTextSize(e50.o8 ? 15.0f : 13.0f);
TestInfo testInfo = WebBookDetailAct.testedList.get(position);
if (testInfo.err == null) {
StringBuilder sb = new StringBuilder();
sb.append("<b>");
sb.append(testInfo.site.name());
sb.append("</b> ");
if (testInfo.chapter_count == 0) {
str2 = "<font color=\"#888888\">" + e50.S1().getString(R.string.duquzhangjiexinxishibai) + "</font>";
} else {
str2 = testInfo.lastChapter;
}
sb.append(str2);
sb.append("<br><font color=\"#888888\">连接速度: ");
sb.append(testInfo.load_time);
sb.append("毫秒, 共");
sb.append(testInfo.chapter_count);
sb.append("章");
str = sb.toString();
} else {
str = "<b>" + testInfo.site.name() + "</b><br><font color=\"#888888\">" + e50.S1().getString(R.string.error) + ": " + testInfo.err + "</font>";
}
textView.setMaxLines(3);
textView.setText(Html.fromHtml(e50.W0(str)));
textView.setBackgroundResource(e50.w3(WebBookDetailAct.fromAct));
return textView;
}
}
public WebBookDetailAct() {
this.MAX_COUNT = e50.o8 ? 20 : 10;
}
public int ChapterAdapterItemCount() {
return (o50.G1(this.chapters) || this.chapters.size() > this.MAX_COUNT) ? this.MAX_COUNT + 2 : this.chapters.size() + 1;
}
private void addToShelf(boolean confirm) {
ArrayList<S.WebChapter> arrayList = this.chapters;
if (arrayList != null && arrayList.size() != 0) {
S.WebBook webBook = this.book;
webBook.chapters = this.chapters;
WB.addToShelf(this, null, webBook, null, confirm, confirm, new WB.AfterAdd() {
@Override
public void OnAdded() {
WebBookDetailAct.this.setAddTitle();
}
});
if (confirm) {
return;
}
o50.p2(this, getString(R.string.yifangru) + WB.getLastAddShelf() + getString(R.string.changanuanzeshujia));
return;
}
o50.p2(this, getString(R.string.downloading_content));
}
public void clearCachedWebViews() {
DownloadTaskBrowser.destroyWebView(cacheWeb);
}
public static void clearTestResults() {
testStart = false;
speedTested = false;
testLv = null;
testDlg = null;
testedList = null;
testedBooks = null;
fromBooks = null;
testBooks = null;
}
public static void continueTestUrls() {
ArrayList<S.WebBook> arrayList = testBooks;
if (arrayList != null && arrayList.size() > 0) {
S.WebBook webBook = testBooks.get(0);
testBooks.remove(0);
getBookChapters(webBook, webBook.url, true, true, 0);
return;
}
if (testStart && testTasksFinished()) {
testStart = false;
WebBookDetailAct webBookDetailAct = selfPref;
if (webBookDetailAct == fromAct) {
webBookDetailAct.progresBar.setVisibility(8);
}
Handler handler = fromActHandler;
if (handler != null) {
handler.sendEmptyMessage(DownloadTask.SCAN_FINISHED);
}
speedTested = true;
AlertDialog alertDialog = testDlg;
if (alertDialog != null) {
alertDialog.dismiss();
createTestInfoDlg(e50.S1().getString(R.string.saomiaowancheng), true);
WebBookDetailAct webBookDetailAct2 = selfPref;
if (webBookDetailAct2 == fromAct) {
webBookDetailAct2.setSourceList();
}
}
}
}
private void createProgressDlg(String title, String info) {
ProgressDialog progressDialog = this.progressDlg;
if (progressDialog != null) {
progressDialog.setTitle(title);
this.progressDlg.setMessage(info);
} else {
ProgressDialog g0 = e50.g0(this, title, info, true, true);
this.progressDlg = g0;
g0.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
WebBookDetailAct.this.progressDlg = null;
}
});
}
}
public static void createTestInfoDlg(String title, boolean finished) {
if (!finished) {
testedList = new ArrayList<>();
testedBooks = new ArrayList<>();
}
ListView listView = new ListView(fromAct);
testLv = listView;
listView.setPadding(e50.k0(28.0f), e50.k0(28.0f), e50.k0(28.0f), e50.k0(28.0f));
testLv.setDividerHeight(0);
testLv.setVerticalScrollBarEnabled(false);
testLv.setAdapter((ListAdapter) new TestListAdapter());
testLv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
DownloadTaskAsync.stopAllTasks("WebBookDetail TestInfoDlg");
WebBookDetailAct.testBooks.clear();
AlertDialog alertDialog = WebBookDetailAct.testDlg;
if (alertDialog != null) {
alertDialog.dismiss();
}
WebBookDetailAct.testDlg = null;
S.WebBook webBook = WebBookDetailAct.testedBooks.get(position);
Activity activity = WebBookDetailAct.fromAct;
WebBookDetailAct webBookDetailAct = WebBookDetailAct.selfPref;
if (activity == webBookDetailAct) {
if (webBookDetailAct.book != webBook) {
webBookDetailAct.book = webBook;
webBookDetailAct.setSourceList();
WebBookDetailAct.selfPref.fillBookInfo(true);
return;
}
return;
}
if (WebBookDetailAct.fromAct == ActivityMain.e) {
if (q50.H(webBook.name).equals(webBook.site.siteTag)) {
return;
}
ActivityMain.e.x0(webBook.name, webBook.site.siteTag, webBook.url, true, 0, true, null);
} else {
Activity activity2 = WebBookDetailAct.fromAct;
ActivityTxt activityTxt = ActivityTxt.a;
if (activity2 == activityTxt) {
activityTxt.Xg(webBook.site.siteTag, webBook.url, false);
}
}
}
});
AlertDialog.Builder builder = new AlertDialog.Builder(fromAct, e50.p5() ? R.style.AlertDialogStyleNight : R.style.AlertDialogStyleDay);
builder.setTitle(title).setView(testLv).setCancelable(false);
if (!finished) {
builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
DownloadTaskAsync.stopAllTasks("WebBookDetail Test cancel");
WebBookDetailAct.testBooks.clear();
WebBookDetailAct.testDlg = null;
}
});
} else {
builder.setPositiveButton(R.string.ok, (DialogInterface.OnClickListener) null);
}
AlertDialog create = builder.create();
testDlg = create;
create.show();
}
public static void doOnError(DownloadTask.Result result) {
Activity activity = fromAct;
if (activity == null || activity.isFinishing()) {
return;
}
WebBookDetailAct webBookDetailAct = selfPref;
if (webBookDetailAct == fromAct) {
webBookDetailAct.progresBar.setVisibility(8);
}
S.WebBook webBook = result.taskBook;
if (result.fromSpeedTest) {
webBook.site.tag = 1;
String str = "<b>" + webBook.site.name() + "</b><br><font color=\"#888888\">" + e50.S1().getString(R.string.error) + ": " + result.err + "</font>";
updateTestInfo(webBook, new TestInfo(webBook.site, null, result.err, 0L, 0));
continueTestUrls();
return;
}
o50.p2(fromAct, result.err);
}
public static void doOnFinish(DownloadTask.Result result) {
WebBookDetailAct webBookDetailAct;
ArrayList<S.WebChapter> arrayList;
WebBookDetailAct webBookDetailAct2;
S.BookSite bookSite;
String str;
Activity activity = fromAct;
if (activity == null || activity.isFinishing()) {
return;
}
S.WebBook webBook = result.taskBook;
boolean z = result.fromSpeedTest;
WebBookDetailAct webBookDetailAct3 = selfPref;
if (webBookDetailAct3 == fromAct) {
webBookDetailAct3.progresBar.setVisibility(8);
}
webBook.site.last_url = !o50.F1(result.final_url) ? result.final_url : result.url;
ArrayList<S.WebChapter> chapterList = S.getChapterList(result.html, webBook.site);
if (!z && selfPref == fromAct && (str = (bookSite = webBook.site).bookTags) != null) {
S.WebBook bookInfo = S.getBookInfo(result.html, bookSite, str, true, true);
if (o50.F1(bookInfo.coverUrl) && o50.F1(bookInfo.description)) {
if (o50.F1(webBook.author) && !o50.F1(bookInfo.author)) {
webBook.author = bookInfo.author;
}
} else {
if (!o50.F1(bookInfo.coverUrl)) {
S.getCoverUrl(webBook, webBook.site, bookInfo.coverUrl);
}
if (!o50.F1(bookInfo.description)) {
webBook.description = bookInfo.description;
}
if (!o50.F1(bookInfo.author)) {
webBook.author = bookInfo.author;
}
if (!o50.F1(bookInfo.updateTime)) {
webBook.updateTime = bookInfo.updateTime;
}
if (!o50.F1(bookInfo.category)) {
webBook.category = bookInfo.category;
}
selfPref.fillBookInfo(false);
}
}
if (chapterList.size() == 1 && chapterList.get(0).name.equals(S.CHAPTER_URL_TAG) && !chapterList.get(0).url.equals(result.url)) {
getBookChapters(webBook, chapterList.get(0).url, false, z, 0);
return;
}
if (!S.sameChapterList(webBook.chapters, chapterList)) {
webBook.chapters.addAll(chapterList);
}
boolean z2 = !o50.F1(webBook.site.nextChapterTag);
if (z2) {
chapterList = webBook.chapters;
webBook.loadedUrls.add(result.url);
String nextChapterUrl = S.getNextChapterUrl(result.html, webBook.site, webBook.loadedUrls);
if (!o50.F1(nextChapterUrl)) {
e50.N5("*hasNextChapterUrl: " + nextChapterUrl, Integer.valueOf(chapterList.size()));
getBookChapters(webBook, nextChapterUrl, false, z, 0);
return;
}
S.deleteDuplicatedChapters(chapterList);
}
if (!z && (webBookDetailAct2 = selfPref) == fromAct) {
if (webBook != webBookDetailAct2.book) {
return;
}
if (!z2 && webBookDetailAct2.chapters.size() > chapterList.size()) {
WebBookDetailAct webBookDetailAct4 = selfPref;
if (webBookDetailAct4.chapterSite == webBook.site) {
chapterList = webBookDetailAct4.chapters;
}
}
}
if (chapterList.size() == 0 && webBook.site.javascriptTOC && DownloadTaskBrowser.reloadCacheWB(result.cacheWB, result.url, reload_urls, 300)) {
return;
}
if (!z && selfPref == fromAct) {
if (chapterList.size() > 0 && (arrayList = (webBookDetailAct = selfPref).chapters) != chapterList) {
if (z2) {
arrayList.addAll(chapterList);
} else {
webBookDetailAct.chapters = chapterList;
}
WebBookDetailAct webBookDetailAct5 = selfPref;
webBookDetailAct5.chapterSite = webBook.site;
webBookDetailAct5.updateChapterList();
m.c cVar = selfPref.errorDlg;
if (cVar != null) {
cVar.a();
}
} else if (chapterList.size() == 0 && selfPref.chapters.size() == 0) {
selfPref.showErrorBookInfo();
}
}
if (z) {
S.BookSite bookSite2 = webBook.site;
if (bookSite2.tag == null) {
bookSite2.tag = 1;
S.BookSite bookSite3 = webBook.site;
bookSite3.load_time = result.load_time;
updateTestInfo(webBook, new TestInfo(bookSite3, chapterList.size() == 0 ? null : chapterList.get(chapterList.size() - 1).name, null, result.load_time, chapterList.size()));
}
continueTestUrls();
}
}
public void doTestUrls() {
testBooks = new ArrayList<>();
Iterator<S.WebBook> it = this.book.sources.iterator();
while (it.hasNext()) {
S.WebBook next = it.next();
S.BookSite bookSite = next.site;
bookSite.load_time = 0L;
bookSite.tag = null;
testBooks.add(next);
}
fromBooks = this.book.sources;
fromAct = this;
fromActHandler = this.handler;
startTestUrls();
createTestInfoDlg(getString(R.string.zhengzaisaomiaoshuyuan), false);
}
public void fillDescription() {
if (this.desTv != null) {
String H0 = e50.H0(this.book.description);
if (H0.length() > 140) {
this.desTv.setText(Html.fromHtml(H0.substring(0, 130) + "...<font color='#55A772'> 查看全部</font>"));
this.desTv.setTag(null);
this.desTv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String H02 = e50.H0(WebBookDetailAct.this.book.description);
if (WebBookDetailAct.this.desTv.getTag() == null) {
WebBookDetailAct.this.desTv.setText(H02);
WebBookDetailAct.this.desTv.setTag(1);
return;
}
WebBookDetailAct.this.desTv.setText(Html.fromHtml(H02.substring(0, 130) + "...<font color='#55A772'> 查看全部</font>"));
WebBookDetailAct.this.desTv.setTag(null);
}
});
return;
}
this.desTv.setText(H0);
this.desTv.setOnClickListener(null);
}
}
public static void getBookChapters(final S.WebBook taskBook, final String url, boolean first, final boolean fromSpeedTest, int delayed) {
DownloadTaskBrowser.CacheWebView cacheWebView;
Activity activity = fromAct;
if (activity == null || activity.isFinishing()) {
return;
}
WebBookDetailAct webBookDetailAct = selfPref;
if (webBookDetailAct == fromAct) {
if (!fromSpeedTest) {
webBookDetailAct.chapters.clear();
selfPref.rv.getAdapter().notifyDataSetChanged();
}
selfPref.progresBar.setVisibility(0);
}
if (taskBook.tsBook != null) {
getTsBookChapters(taskBook, fromSpeedTest);
return;
}
taskBook.site.firstExecute = first;
DownloadTask.Result result = new DownloadTask.Result();
result.callback = new DownloadTask.Callback() {
@Override
public void onCancel() {
Activity activity2 = WebBookDetailAct.fromAct;
if (activity2 == null || activity2.isFinishing()) {
return;
}
if (WebBookDetailAct.selfPref == WebBookDetailAct.fromAct) {
WebBookDetailAct.selfPref.progresBar.setVisibility(8);
}
e50.N5("*canceled: " + S.WebBook.this.site.name() + b.b + S.WebBook.this.site.siteTag);
if (fromSpeedTest) {
S.WebBook.this.site.tag = 1;
WebBookDetailAct.continueTestUrls();
}
}
@Override
public void onError(DownloadTask.Result result2, String err) {
result2.taskBook = S.WebBook.this;
result2.fromSpeedTest = fromSpeedTest;
Handler handler = WebBookDetailAct.fromActHandler;
handler.sendMessage(handler.obtainMessage(DownloadTask.DOWNLOAD_ERROR, result2));
}
@Override
public void onFinish(DownloadTask.Result result2) {
result2.taskBook = S.WebBook.this;
result2.fromSpeedTest = fromSpeedTest;
Handler handler = WebBookDetailAct.fromActHandler;
handler.sendMessage(handler.obtainMessage(DownloadTask.DOWNLOAD_FINISHED, result2));
}
@Override
public void onProgress(DownloadTask.Result result2, int progress, int total) {
}
};
if (taskBook.site.javascriptTOC) {
DownloadTaskBrowser.CacheWebView cacheWebView2 = cacheWeb;
if (cacheWebView2 == null || cacheWebView2.destroyed) {
cacheWebView2 = DownloadTaskBrowser.createDownloadWebView();
}
cacheWebView2.delayed = taskBook.site.TOCDelay;
cacheWebView = cacheWebView2;
} else {
cacheWebView = null;
}
DownloadTask.download(cacheWebView, result, true, delayed, url, null, taskBook.site.userAgent);
}
private static void getTsBookChapters(final S.WebBook taskBook, final boolean fromSpeedTest) {
final long currentTimeMillis = System.currentTimeMillis();
TS.getBookInfo(taskBook.tsBook, new TS.OnBookResult() {
@Override
public void result(String error, TS.Book book, boolean includeChapters) {
String str;
Activity activity = WebBookDetailAct.fromAct;
if (activity == null || activity.isFinishing()) {
return;
}
if (error != null) {
if (fromSpeedTest) {
taskBook.site.tag = 1;
S.WebBook webBook = taskBook;
WebBookDetailAct.updateTestInfo(webBook, new TestInfo(webBook.site, null, error, 0L, 0));
WebBookDetailAct.continueTestUrls();
return;
}
o50.p2(WebBookDetailAct.selfPref, error);
WebBookDetailAct.selfPref.hideProgressDlg();
return;
}
if (!fromSpeedTest) {
if (!includeChapters) {
S.fillWebBookFromTsBook(WebBookDetailAct.selfPref.book, book);
WebBookDetailAct.selfPref.fillBookInfo(false);
return;
} else {
S.addTsChaptersToWebChapters(WebBookDetailAct.selfPref.chapters, book.chapters);
WebBookDetailAct.selfPref.updateChapterList();
WebBookDetailAct.selfPref.hideProgressDlg();
WebBookDetailAct.selfPref.progresBar.setVisibility(8);
return;
}
}
if (includeChapters) {
taskBook.site.tag = 1;
S.WebBook webBook2 = taskBook;
S.BookSite bookSite = webBook2.site;
if (book.chapters.size() == 0) {
str = null;
} else {
ArrayList<TS.Chapter> arrayList = book.chapters;
str = arrayList.get(arrayList.size() - 1).name;
}
WebBookDetailAct.updateTestInfo(webBook2, new TestInfo(bookSite, str, null, System.currentTimeMillis() - currentTimeMillis, book.chapters.size()));
WebBookDetailAct.continueTestUrls();
}
}
});
}
private void getTsChapterContent(final S.WebBook book, final int id) {
TS.getChapter(book.chapters.get(id).tsChapter, new TS.OnChapterResult() {
@Override
public void result(String error, TS.Chapter chapter) {
Activity activity = WebBookDetailAct.fromAct;
if (activity == null || activity.isFinishing()) {
return;
}
WebBookDetailAct.this.hideProgressDlg();
e50.N5("*getChapter: " + chapter.url);
if (error == null) {
if (o50.F1(chapter.text)) {
o50.n2(WebBookDetailAct.this, e50.S1().getString(R.string.get_content_failed));
return;
} else {
book.chapters.get(id).html = chapter.text;
WebBookDetailAct.this.openInReader(book, id);
return;
}
}
o50.p2(WebBookDetailAct.this, error);
}
});
}
private g50.e inShelf() {
g50.e F = g50.F(q50.Q(this.book));
if (F != null) {
return F;
}
S.WebBook webBook = this.book;
return g50.F(g50.j0(webBook.name, webBook.author));
}
private void initChapterAdapter() {
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.chapterRv);
this.rv = recyclerView;
recyclerView.setLayoutManager(new LinearLayoutManager(this, 1, false));
this.rv.addItemDecoration(new RecyclerView.ItemDecoration() {
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
int childAdapterPosition = parent.getChildAdapterPosition(view);
outRect.bottom = e50.k0((childAdapterPosition == 0 || childAdapterPosition == WebBookDetailAct.this.ChapterAdapterItemCount() + (-1)) ? 8.0f : 1.0f);
}
});
this.rv.setAdapter(new ChaptersAdapter());
}
public void openBook(final int chapter_id) {
if (e50.k7(this, "请注意, 优化阅读需要应用获取本地存储空间的权限以缓存书籍信息, 是否进行权限设置?")) {
boolean z = e50.y2;
this.noad = !z;
if (!z) {
ScrollView scrollView = (ScrollView) LayoutInflater.from(this).inflate(R.layout.do_event_confirm, (ViewGroup) null);
TextView textView = (TextView) scrollView.findViewById(R.id.ofTextView);
final CheckBox checkBox = (CheckBox) scrollView.findViewById(R.id.ofNeverAskAgain);
textView.setText(Html.fromHtml(e50.s1("关于优化阅读.htm")));
checkBox.setChecked(true);
new m.c(this).B(scrollView).v(R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
e50.y2 = checkBox.isChecked();
WebBookDetailAct.this.openBook2(chapter_id);
}
}).o(R.string.cancel, null).C();
return;
}
openBook2(chapter_id);
}
}
public void openBook2(int chapter_id) {
ArrayList<S.WebChapter> arrayList;
if (this.book.site.webReadLevel < 2 && ((arrayList = this.chapters) == null || arrayList.size() == 0)) {
o50.p2(this, getString(R.string.duquzhangjieliebiaozhong));
return;
}
if (chapter_id >= this.chapters.size()) {
chapter_id = 0;
}
S.WebBook webBook = this.book;
webBook.chapters = this.chapters;
startRead(webBook, chapter_id);
}
public boolean openInReader(S.WebBook book, int chapterId) {
Intent intent;
Intent intent2;
if (book.site.javascriptContent) {
e50.V1 = q50.Q(book);
q50.X(book, false);
intent = new Intent(this, (Class<?>) ActivityTxt.class);
intent.putExtra("bookFile", e50.V1);
if (chapterId != -1) {
e50.g2 = chapterId;
e50.f2 = 0L;
intent.putExtra("online_book", e50.V1);
intent.putExtra("chapter", chapterId);
intent.putExtra("position", 0L);
}
} else if (chapterId == -1) {
String Q = q50.Q(book);
String str = q50.R(book) + b.b + book.site.siteTag;
if (o50.A1(Q) && o50.B1(str)) {
e50.V1 = Q;
q50.X(book, false);
intent2 = new Intent(this, (Class<?>) ActivityTxt.class);
intent2.putExtra("bookFile", e50.V1);
} else {
intent2 = null;
}
intent = intent2;
} else {
e50.V1 = q50.Q(book);
e50.g2 = chapterId;
e50.f2 = 0L;
q50.X(book, false);
intent = new Intent(this, (Class<?>) ActivityTxt.class);
intent.putExtra("online_book", e50.V1);
intent.putExtra("bookFile", e50.V1);
intent.putExtra("chapter", chapterId);
intent.putExtra("position", 0L);
}
if (intent == null) {
return false;
}
e50.s6("before TXT2:");
e50.S(false);
hideProgressDlg();
intent.putExtra("fromOuterApp", this.fromOuterApp);
if (this.noad) {
intent.putExtra("noad", true);
}
startActivityForResult(intent, 1);
WB.notifyRecentListChanged(e50.V1);
e50.D(e50.V1);
DownloadTaskAsync.stopAllTasks("book detail before open");
if (S.store != null) {
Iterator<S.WebBook> it = book.sources.iterator();
while (true) {
if (!it.hasNext()) {
break;
}
S.WebBook next = it.next();
if (next.site == S.store) {
o50.i2(S.getStoreUrlFile(next.name, next.author), next.url);
break;
}
}
}
return true;
}
private void setSpeedTestEvents() {
this.speedTest.setVisibility(this.book.sources.size() > 1 ? 0 : 8);
this.speedTest.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
WebBookDetailAct.this.doTestUrls();
}
});
this.speedTest.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
WebBookDetailAct webBookDetailAct = WebBookDetailAct.this;
o50.p2(webBookDetailAct, webBookDetailAct.getString(R.string.saomiaoshuyuan));
return false;
}
});
}
public void showAllChapters() {
new PrefChapters(this, 0, new PrefChapters.k() {
@Override
public void onGetChapter(int chapterId, int splitIndex, long position, boolean fromChapterList) {
WebBookDetailAct.this.openBook(chapterId);
}
}, true).show();
}
private void showErrorBookInfo() {
if (this.errorDlg != null) {
return;
}
m.c cVar = new m.c(this);
this.errorDlg = cVar;
cVar.m(e50.W0("暂未能有效获取书籍信息, 请稍等. 可打开网页版查看, 或五秒后重试.")).r(getString(R.string.dakaiwangyeban), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
WebBookDetailAct.this.clearCachedWebViews();
WebBookDetailAct webBookDetailAct = WebBookDetailAct.this;
o50.b2(webBookDetailAct, webBookDetailAct.book.url);
}
}).v(R.string.cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
WebBookDetailAct.this.clearCachedWebViews();
}
}).o(R.string.chongshi, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
WebBookDetailAct.this.fillBookInfo(true);
WebBookDetailAct.this.progresBar.setVisibility(0);
}
}).u(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
WebBookDetailAct.this.errorDlg = null;
}
});
if (this.book.sources.size() > 1) {
this.errorDlg.m(e50.W0("暂未能有效获取书籍信息, 请稍等, 或五秒后重试, 或查看其它") + (this.book.sources.size() - 1) + getString(R.string.weinenghouqushuji3));
this.errorDlg.r(getString(R.string.chakanqitashuyuan), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
WebBookDetailAct.this.doTestUrls();
}
});
}
this.errorDlg.d(false).C();
}
public static void startTestUrls() {
reload_urls.clear();
int i = e50.k8;
if (i < 5) {
i = 5;
}
int i2 = 0;
while (testBooks.size() > 0 && i2 < i) {
S.WebBook webBook = testBooks.get(0);
testBooks.remove(0);
getBookChapters(webBook, webBook.url, true, true, o50.R1(i2 * 100));
i2++;
testStart = true;
}
}
public static boolean testTasksFinished() {
ArrayList<S.WebBook> arrayList = fromBooks;
if (arrayList == null) {
return true;
}
Iterator<S.WebBook> it = arrayList.iterator();
while (it.hasNext()) {
if (it.next().site.tag == null) {
return false;
}
}
return true;
}
public static void updateTestInfo(S.WebBook taskBook, TestInfo t) {
if (testLv != null) {
int size = testedList.size();
if (t.err == null) {
for (int i = 0; i < testedList.size(); i++) {
if (testedList.get(i).err != null || ((testedList.get(i).chapter_count == 0 && t.chapter_count > 0) || (testedList.get(i).load_time > t.load_time && t.chapter_count > 0))) {
size = i;
break;
}
}
}
testedList.add(size, t);
testedBooks.add(size, taskBook);
((BaseAdapter) testLv.getAdapter()).notifyDataSetChanged();
}
}
public void fillBookInfo(boolean updateChapters) {
String str = "";
if (!o50.F1(this.book.category)) {
str = "" + this.book.category + " ";
}
if (!o50.F1(this.book.charCount)) {
str = str + getString(R.string.zishu) + this.book.charCount + " ";
}
if (!o50.F1(this.book.updateTime)) {
str = str + "最近更新: " + this.book.updateTime + " ";
}
String trim = str.trim();
findViewById(R.id.other).setVisibility(o50.F1(trim) ? 8 : 0);
((TextView) findViewById(R.id.other)).setText(trim);
this.lastUpdate.setVisibility(8);
((TextView) findViewById(R.id.title)).setText(this.book.name);
((TextView) findViewById(R.id.author)).setText(this.book.author);
((TextView) findViewById(R.id.author)).setTextColor(e50.L2());
fillDescription();
e50.N5("coverUrl: " + this.book.coverUrl);
this.coverView.setImageURI(this.book.coverUrl);
this.downloadB.setVisibility(this.book.site.downloadable ? 0 : 8);
fromAct = this;
fromActHandler = this.handler;
if (updateChapters) {
S.WebBook webBook = this.book;
getBookChapters(webBook, webBook.url, true, false, 0);
}
}
public void hideProgressDlg() {
this.progresBar.setVisibility(8);
try {
ProgressDialog progressDialog = this.progressDlg;
if (progressDialog != null) {
progressDialog.dismiss();
}
} catch (Exception e) {
e50.S0(e);
}
this.progressDlg = null;
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (e50.sa) {
Intent intent = new Intent(this, (Class<?>) WebBookDetailAct.class);
intent.putExtra("fromOuterApp", this.fromOuterApp);
startActivity(intent);
finish();
}
}
public void onAuthorClick(View view) {
WB.doWebSearchWithSelect(this, this.book.author);
}
@Override
public void onBackPressed() {
clearCachedWebViews();
super.onBackPressed();
}
@Override
public void onClick(View v) {
if (v.getId() == R.id.head_back) {
clearCachedWebViews();
finish();
}
if (v.getId() == R.id.head_menu) {
new m(this, v, new String[]{"内部浏览器打开", "外部浏览器打开", getString(R.string.sousuoxiangguanwangye), getString(R.string.sousuobenshushuping)}, new m.d() {
@Override
public void onClick(int which) {
String str;
if (which == 0) {
WebBookDetailAct webBookDetailAct = WebBookDetailAct.this;
S.WebBook webBook = webBookDetailAct.book;
z.openWebUrl(webBookDetailAct, webBook.url, webBook.name);
}
if (which == 1) {
WebBookDetailAct webBookDetailAct2 = WebBookDetailAct.this;
o50.b2(webBookDetailAct2, webBookDetailAct2.book.url);
}
if (which == 2) {
WebBookDetailAct webBookDetailAct3 = WebBookDetailAct.this;
StringBuilder sb = new StringBuilder();
sb.append("http://www.baidu.com/s?ie=utf-8&wd=");
sb.append(WebBookDetailAct.this.book.name);
if (o50.F1(WebBookDetailAct.this.book.author)) {
str = "";
} else {
str = " " + WebBookDetailAct.this.book.author;
}
sb.append(str);
webBookDetailAct3.startActivity(new Intent("android.intent.action.VIEW", Uri.parse(sb.toString())));
}
if (which == 3) {
WebBookDetailAct.this.startActivity(new Intent("android.intent.action.VIEW", Uri.parse("http://www.baidu.com/s?ie=utf-8&wd=" + WebBookDetailAct.this.book.name + " 书评")));
}
}
}).z(e50.k0(40.0f), -e50.k0(40.0f));
}
if (v.getId() == R.id.read) {
openBook(-1);
}
if (v.getId() == R.id.addshelf) {
if (!e50.k7(this, "请注意, 加入书架需要应用获取本地存储空间的权限以缓存书籍信息, 是否进行权限设置?")) {
return;
}
g50.e inShelf = inShelf();
if (inShelf != null) {
g50.p(inShelf);
if (inShelf.i.equals(e50.i8)) {
WB.notifyShelfListChanged();
}
setAddTitle();
} else {
addToShelf(false);
}
}
if (v.getId() == R.id.addseeklist) {
S.WebBook webBook = this.book;
z.showShuPing(this, webBook.name, webBook.author, "", "");
}
if (v == this.lastUpdate) {
openBook(this.chapters.size() - 1);
}
if (v == this.coverView) {
o50.b2(this, this.book.url);
}
if (v == this.downloadB) {
BrowserAct.loadDownloadPage(this, this.book, e50.W0("点击书籍下载链接可下载"));
}
}
@Override
public void onCreate(Bundle savedInstanceState) {
TS.Book book;
if (!o50.D1(selfPref)) {
selfPref.finish();
}
selfPref = this;
super.onCreate(savedInstanceState);
setContentView(R.layout.web_book_detail);
if (getIntent().getExtras() != null && getIntent().getBooleanExtra("fromDiscoveryBook", false) && (book = AutoCollect.discoveryBook) != null) {
this.book = S.tsBook2WebBook(book);
AutoCollect.discoveryBook = null;
} else {
this.book = S.curBook;
}
if (this.book == null) {
finish();
return;
}
findViewById(R.id.head_back).setOnClickListener(this);
findViewById(R.id.head_button1).setVisibility(8);
findViewById(R.id.head_menu).setVisibility(0);
findViewById(R.id.head_menu).setOnClickListener(this);
findViewById(R.id.read).setOnClickListener(this);
findViewById(R.id.addshelf).setOnClickListener(this);
findViewById(R.id.addshelf).setOnLongClickListener(this);
findViewById(R.id.addseeklist).setOnClickListener(this);
findViewById(R.id.cover).setOnClickListener(this);
this.coverView = (SimpleDraweeView) findViewById(R.id.cover);
this.SourceSp = (Spinner) findViewById(R.id.sourceSp);
this.progresBar = (ProgressBar) findViewById(R.id.head_progress);
this.speedTest = findViewById(R.id.speedCheck);
initChapterAdapter();
TextView textView = (TextView) findViewById(R.id.head_title);
this.titleTv = textView;
textView.setText(R.string.book_detail);
TextView textView2 = (TextView) findViewById(R.id.latestUpdate);
this.lastUpdate = textView2;
textView2.setOnClickListener(this);
TextView textView3 = (TextView) findViewById(R.id.download);
this.downloadB = textView3;
textView3.setOnClickListener(this);
this.downloadB.setVisibility(8);
if (e50.M2) {
ArrayList arrayList = new ArrayList();
arrayList.add(findViewById(R.id.addshelf));
arrayList.add(findViewById(R.id.read));
arrayList.add(findViewById(R.id.addseeklist));
e50.c1(findViewById(R.id.base), arrayList);
}
findViewById(R.id.base).setBackgroundColor(e50.K2());
findViewById(R.id.infoLay).setBackgroundColor(e50.K2());
findViewById(R.id.readLay).setBackgroundColor(e50.K2());
setAddTitle();
clearTestResults();
setSourceList();
fillBookInfo(true);
if (getIntent().getExtras() == null || !getIntent().getExtras().containsKey("fromOuterApp")) {
return;
}
this.fromOuterApp = getIntent().getExtras().getBoolean("fromOuterApp");
}
@Override
public boolean onLongClick(View v) {
if (v.getId() != R.id.addshelf) {
return false;
}
addToShelf(true);
return true;
}
@Override
public void onStop() {
super.onStop();
}
void setAddTitle() {
((TextView) findViewById(R.id.addshelf)).setText(e50.W0(inShelf() != null ? "从书架移除" : "加入书架"));
((TextView) findViewById(R.id.addseeklist)).setText(e50.W0("查看书评"));
}
public void setSourceList() {
S.WebBook webBook = this.book;
if (webBook != null && webBook.sources != null) {
((TextView) findViewById(R.id.source)).setText(getString(R.string.web_sources) + " (" + this.book.sources.size() + ")");
CharSequence[] charSequenceArr = new CharSequence[this.book.sources.size()];
S.BookSite bookSite = null;
int i = 0;
int i2 = 1;
for (int i3 = 0; i3 < this.book.sources.size(); i3++) {
if (speedTested && this.book.sources.get(i3).site.load_time > 0) {
charSequenceArr[i3] = Html.fromHtml(this.book.sources.get(i3).site.name() + " <small><font color=\"#888888\">(" + this.book.sources.get(i3).site.load_time + "毫秒)</font></small>");
} else {
S.BookSite bookSite2 = this.book.sources.get(i3).site;
if (bookSite == null) {
bookSite = bookSite2;
} else if (bookSite == bookSite2) {
i2++;
} else {
bookSite = bookSite2;
i2 = 1;
}
StringBuilder sb = new StringBuilder();
sb.append(bookSite2.name());
sb.append(i2 > 1 ? " " + i2 : "");
charSequenceArr[i3] = sb.toString();
if (i2 == 2) {
charSequenceArr[i3 - 1] = bookSite2.name() + " 1";
}
}
}
ArrayAdapter arrayAdapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item, charSequenceArr);
arrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
this.SourceSp.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
if (e50.M2) {
for (int i4 = 0; i4 < parent.getChildCount(); i4++) {
if (parent.getChildAt(i4) instanceof TextView) {
((TextView) parent.getChildAt(i4)).setTextColor(e50.M2());
}
}
}
if (position < WebBookDetailAct.this.book.sources.size()) {
S.WebBook webBook2 = WebBookDetailAct.this.book;
if (webBook2 != webBook2.sources.get(position)) {
WebBookDetailAct webBookDetailAct = WebBookDetailAct.this;
webBookDetailAct.book = webBookDetailAct.book.sources.get(position);
WebBookDetailAct.this.fillBookInfo(true);
WebBookDetailAct.this.progresBar.setVisibility(0);
}
}
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
this.SourceSp.setAdapter((SpinnerAdapter) arrayAdapter);
while (i < this.book.sources.size() && this.book.sources.get(i) != this.book) {
i++;
}
this.SourceSp.setSelection(i);
setSpeedTestEvents();
return;
}
finish();
}
public void startRead(final S.WebBook book, final int chapterId) {
int i = book.site.webReadLevel;
if (i > 1) {
new m.c(this).y(R.string.tip).m(getString(R.string.butigongyouhuatishi)).v(R.string.dakaiwangyeban, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
String str;
if (book.chapters.size() == 0) {
str = book.url;
} else {
ArrayList<S.WebChapter> arrayList = book.chapters;
int i2 = chapterId;
if (i2 <= 0) {
i2 = 0;
}
str = arrayList.get(i2).url;
}
o50.b2(WebBookDetailAct.this, str);
}
}).o(R.string.cancel, null).C();
} else if (i == 1) {
new m.c(this).y(R.string.tip).m(getString(R.string.butigongyouhuatishi2)).v(R.string.dakaiwangyeban, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
int i2 = chapterId;
if (i2 <= 0) {
i2 = 0;
}
o50.b2(WebBookDetailAct.this, book.chapters.get(i2).url);
}
}).p(getString(R.string.qiangzhiyouhua), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
WebBookDetailAct.this.startRead2(book, chapterId);
}
}).C();
} else {
startRead2(book, chapterId);
}
}
public void startRead2(final S.WebBook book, final int chapterId) {
if ((book.site.javascriptContent || chapterId == -1) && openInReader(book, chapterId)) {
return;
}
if (chapterId == -1) {
SharedPreferences sharedPreferences = getSharedPreferences(e50.r0, 0);
String lowerCase = q50.Q(book).toLowerCase();
if (sharedPreferences.contains(lowerCase)) {
chapterId = e50.P2(sharedPreferences.getString(lowerCase, "0"));
}
}
if (chapterId <= 0 || chapterId >= book.chapters.size()) {
chapterId = 0;
}
this.urlForOpen = book.chapters.get(chapterId).url;
createProgressDlg("", getString(R.string.downloading_content) + "\n" + book.chapters.get(chapterId).name);
if (book.tsBook != null) {
getTsChapterContent(book, chapterId);
return;
}
DownloadTask.Result result = new DownloadTask.Result();
result.callback = new DownloadTask.Callback() {
@Override
public void onCancel() {
WebBookDetailAct.this.hideProgressDlg();
}
@Override
public void onError(DownloadTask.Result result2, String err) {
if (result2.url.equals(WebBookDetailAct.this.urlForOpen)) {
WebBookDetailAct.this.hideProgressDlg();
o50.n2(WebBookDetailAct.this, err);
}
}
@Override
public void onFinish(DownloadTask.Result result2) {
WebBookDetailAct webBookDetailAct = WebBookDetailAct.this;
if (webBookDetailAct.progressDlg == null || !result2.url.equals(webBookDetailAct.urlForOpen)) {
return;
}
WebBookDetailAct.this.hideProgressDlg();
S.BookSite bookSite = book.site;
bookSite.last_url = result2.final_url;
String chapterContent = S.getChapterContent(result2.html, bookSite);
S.WebChapter webChapter = book.chapters.get(chapterId);
if (o50.F1(chapterContent) && !S.isVipChapter(webChapter.name)) {
o50.n2(WebBookDetailAct.this, e50.S1().getString(R.string.get_content_failed));
return;
}
if (o50.F1(book.site.nextContentTag)) {
webChapter.html = chapterContent;
}
WebBookDetailAct.this.openInReader(book, chapterId);
}
@Override
public void onProgress(DownloadTask.Result result2, int progress, int total) {
}
};
DownloadTask.download(null, result, this.urlForOpen, null, book.site.userAgent);
}
public void updateChapterList() {
this.rv.getAdapter().notifyDataSetChanged();
this.rv.scrollToPosition(0);
this.lastUpdate.setVisibility(this.chapters.size() <= 0 ? 8 : 0);
if (this.chapters.size() > 0) {
S.WebBook webBook = this.book;
g50.e F = g50.F(g50.j0(webBook.name, webBook.author));
if (F != null) {
g50.p(F);
S.WebBook webBook2 = this.book;
webBook2.chapters = this.chapters;
WB.addToShelf(this, null, webBook2, F.i, false, false, null);
}
TextView textView = this.lastUpdate;
StringBuilder sb = new StringBuilder();
sb.append(getString(R.string.latest_chapter));
sb.append(": ");
sb.append(this.chapters.get(r2.size() - 1).name);
textView.setText(sb.toString());
}
}
}