Skip to content

Commit

Permalink
fix CCTuKu
Browse files Browse the repository at this point in the history
  • Loading branch information
Haleydu committed Jan 21, 2021
1 parent 8284d88 commit a101984
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 33 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ else {
buildVersion = cmdGetCommitNums.execute().text.trim().toInteger()
cmdGetTagname = 'git describe --abbrev=0'

buildVersion = 157
buildVersion = 165
version = cmdGetTagname.execute().text.trim()
}

Expand Down
6 changes: 6 additions & 0 deletions app/src/main/java/com/hiroshi/cimoc/source/CCTuku.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ public List<Chapter> parseChapter(String html, Comic comic, Long sourceComic) {
for (Node node : body.list("#chapter > div > div > ul > li > a")) {
String title = node.text();
String path = node.hrefWithSplit(2);
if (path == null) {
path = "";
}
if (title == null) {
title = "";
}
list.add(new Chapter(Long.parseLong(sourceComic + "000" + i++), sourceComic, title, path));
}
return list;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,13 +243,17 @@ private void initLayoutManager() {

@Override
protected void initData() {
mClickArray = mode == PreferenceManager.READER_MODE_PAGE ?
ClickEvents.getPageClickEventChoice(mPreference) : ClickEvents.getStreamClickEventChoice(mPreference);
mLongClickArray = mode == PreferenceManager.READER_MODE_PAGE ?
ClickEvents.getPageLongClickEventChoice(mPreference) : ClickEvents.getStreamLongClickEventChoice(mPreference);
long id = getIntent().getLongExtra(Extra.EXTRA_ID, -1);
List<Chapter> list = getIntent().getParcelableArrayListExtra(Extra.EXTRA_CHAPTER);
mPresenter.loadInit(id, Objects.requireNonNull(list).toArray(new Chapter[list.size()]));
try {
mClickArray = mode == PreferenceManager.READER_MODE_PAGE ?
ClickEvents.getPageClickEventChoice(mPreference) : ClickEvents.getStreamClickEventChoice(mPreference);
mLongClickArray = mode == PreferenceManager.READER_MODE_PAGE ?
ClickEvents.getPageLongClickEventChoice(mPreference) : ClickEvents.getStreamLongClickEventChoice(mPreference);
long id = getIntent().getLongExtra(Extra.EXTRA_ID, -1);
List<Chapter> list = getIntent().getParcelableArrayListExtra(Extra.EXTRA_CHAPTER);
mPresenter.loadInit(id, Objects.requireNonNull(list).toArray(new Chapter[list.size()]));
}catch (Exception e){
e.printStackTrace();
}
}

@Override
Expand Down
55 changes: 30 additions & 25 deletions app/src/main/java/com/hiroshi/cimoc/ui/adapter/DetailAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,35 +89,40 @@ public void setInfo(String cover, String title, String author, String intro, Boo
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
super.onBindViewHolder(holder, position);
if (position == 0) {
HeaderHolder headerHolder = (HeaderHolder) holder;
AdRequest adRequest = new AdRequest.Builder().build();
headerHolder.mAdView.loadAd(adRequest);
if (title != null) {
if (cover != null) {
headerHolder.mComicImage.setController(mControllerSupplier.get().setUri(cover).build());
try {
if (position == 0) {
HeaderHolder headerHolder = (HeaderHolder) holder;
AdRequest adRequest = new AdRequest.Builder().build();
headerHolder.mAdView.loadAd(adRequest);
if (title != null) {
if (cover != null) {
headerHolder.mComicImage.setController(mControllerSupplier.get().setUri(cover).build());
}
headerHolder.mComicTitle.setText(title);
headerHolder.mComicIntro.setText(intro);
if (finish != null) {
headerHolder.mComicStatus.setText(finish ? "完结" : "连载中");
}
if (update != null) {
headerHolder.mComicUpdate.setText("最后更新:".concat(update));
}
headerHolder.mComicAuthor.setText(author);
}
headerHolder.mComicTitle.setText(title);
headerHolder.mComicIntro.setText(intro);
if (finish != null) {
headerHolder.mComicStatus.setText(finish ? "完结" : "连载中");
} else {
Chapter chapter = mDataSet.get(position - 1);
ChapterHolder viewHolder = (ChapterHolder) holder;
viewHolder.chapterButton.setText(chapter.getTitle());
viewHolder.chapterButton.setDownload(chapter.isComplete());
if (chapter.getPath() !=null &&chapter.getPath().equals(last)) {
viewHolder.chapterButton.setSelected(true);
} else if (viewHolder.chapterButton.isSelected()) {
viewHolder.chapterButton.setSelected(false);
}
if (update != null) {
headerHolder.mComicUpdate.setText("最后更新:".concat(update));
}
headerHolder.mComicAuthor.setText(author);
}
} else {
Chapter chapter = mDataSet.get(position - 1);
ChapterHolder viewHolder = (ChapterHolder) holder;
viewHolder.chapterButton.setText(chapter.getTitle());
viewHolder.chapterButton.setDownload(chapter.isComplete());
if (chapter.getPath().equals(last)) {
viewHolder.chapterButton.setSelected(true);
} else if (viewHolder.chapterButton.isSelected()) {
viewHolder.chapterButton.setSelected(false);
}
} catch (Exception e) {
e.printStackTrace();
}

}

@Override
Expand Down

0 comments on commit a101984

Please sign in to comment.