Update sort
This commit is contained in:
parent
2c43747f29
commit
4dc079b93c
|
|
@ -15,9 +15,13 @@ public class Sorter implements Comparator<Item> {
|
||||||
@Override
|
@Override
|
||||||
public int compare(Item o1, Item o2) {
|
public int compare(Item o1, Item o2) {
|
||||||
try {
|
try {
|
||||||
return Integer.valueOf(Utils.removeExt(o1.getDisplayName())).compareTo(Integer.valueOf(Utils.removeExt(o2.getDisplayName())));
|
return Integer.compare(getDigit(o1.getDisplayName()), getDigit(o2.getDisplayName()));
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
return o1.getDisplayName().compareToIgnoreCase(o2.getDisplayName());
|
return o1.getDisplayName().compareToIgnoreCase(o2.getDisplayName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int getDigit(String text) throws NumberFormatException {
|
||||||
|
return Integer.parseInt(Utils.removeExt(text).replaceAll("\\D+", ""));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ import android.webkit.ValueCallback;
|
||||||
import android.webkit.WebView;
|
import android.webkit.WebView;
|
||||||
import android.webkit.WebViewClient;
|
import android.webkit.WebViewClient;
|
||||||
|
|
||||||
import com.github.catvod.crawler.SpiderDebug;
|
|
||||||
import com.github.catvod.spider.Init;
|
import com.github.catvod.spider.Init;
|
||||||
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
|
|
@ -56,18 +55,15 @@ public class Utils {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String fixUrl(String base, String src) {
|
public static String fixUrl(String base, String src) {
|
||||||
try {
|
if (src.startsWith("//")) {
|
||||||
if (src.startsWith("//")) {
|
Uri parse = Uri.parse(base);
|
||||||
Uri parse = Uri.parse(base);
|
return parse.getScheme() + ":" + src;
|
||||||
src = parse.getScheme() + ":" + src;
|
} else if (!src.contains("://")) {
|
||||||
} else if (!src.contains("://")) {
|
Uri parse = Uri.parse(base);
|
||||||
Uri parse = Uri.parse(base);
|
return parse.getScheme() + "://" + parse.getHost() + src;
|
||||||
src = parse.getScheme() + "://" + parse.getHost() + src;
|
} else {
|
||||||
}
|
return src;
|
||||||
} catch (Exception e) {
|
|
||||||
SpiderDebug.log(e);
|
|
||||||
}
|
}
|
||||||
return src;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String removeExt(String text) {
|
public static String removeExt(String text) {
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -1 +1 @@
|
||||||
31931cd4ecb016c3263b041528b132ad
|
1da9b9d6b4241ada175c741d4b4b9cf9
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue