Skip to content

Commit

Permalink
fix list order
Browse files Browse the repository at this point in the history
  • Loading branch information
Haleydu committed Aug 30, 2020
1 parent cedc12d commit 984ad2c
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
2 changes: 2 additions & 0 deletions app/src/main/java/com/hiroshi/cimoc/parser/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ public interface Parser {
/**
* 解析章节列表,新增函数
*
* 使用了Lists.reverse(list)后要把TYPE加入interpretationUtils的isReverseOrder函数
*
* @param html 页面源代码
* @param comic 漫画名
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import androidx.recyclerview.widget.RecyclerView;

import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
Expand Down Expand Up @@ -41,6 +40,8 @@

import butterknife.OnClick;

import static com.hiroshi.cimoc.utils.interpretationUtils.isReverseOrder;

/**
* Created by Hiroshi on 2016/7/2.
*/
Expand Down Expand Up @@ -343,7 +344,11 @@ public void onChapterLoadSuccess(List<Chapter> list) {
@Override
public void onPreLoadSuccess(List<Chapter> list, Comic comic) {
hideProgressBar();
mDetailAdapter.addAll(Lists.reverse(list));
if (isReverseOrder(comic)){
mDetailAdapter.addAll(Lists.reverse(list));
}else {
mDetailAdapter.addAll(list);
}
mDetailAdapter.setInfo(comic.getCover(), comic.getTitle(), comic.getAuthor(),
comic.getIntro(), comic.getFinish(), comic.getUpdate(), comic.getLast());

Expand Down
27 changes: 27 additions & 0 deletions app/src/main/java/com/hiroshi/cimoc/utils/interpretationUtils.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.hiroshi.cimoc.utils;

import com.hiroshi.cimoc.model.Comic;
import com.hiroshi.cimoc.source.CCMH;
import com.hiroshi.cimoc.source.Cartoonmad;
import com.hiroshi.cimoc.source.Comic18;
import com.hiroshi.cimoc.source.CopyMH;
import com.hiroshi.cimoc.source.MH50;
import com.hiroshi.cimoc.source.Manhuatai;
import com.hiroshi.cimoc.source.MiGu;
import com.hiroshi.cimoc.source.Tencent;

public class interpretationUtils {

public static boolean isReverseOrder(Comic comic){
int type = comic.getSource();
return type == MH50.TYPE ||
type == MiGu.TYPE ||
type == CCMH.TYPE ||
type == Cartoonmad.TYPE ||
type == Comic18.TYPE ||
type == Manhuatai.TYPE ||
type == Tencent.TYPE ||
type == CopyMH.TYPE;
}
}

0 comments on commit 984ad2c

Please sign in to comment.