Skip to content

Commit

Permalink
Merge branch 'master-lzh-release-tci' into release-tci
Browse files Browse the repository at this point in the history
  • Loading branch information
Haleydu committed Nov 30, 2020
2 parents 655c299 + 3033f11 commit 8466a34
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.RectF;
import android.util.Log;

import com.facebook.cache.common.CacheKey;
import com.facebook.cache.common.SimpleCacheKey;
Expand Down Expand Up @@ -263,25 +265,31 @@ public void decodeJMTTImage(Bitmap sourceBitmap, CloseableReference<Bitmap> refe
String url = mImage.getUrl();
int scramble_id = 220980;
int chapterId = 0;
if (url.startsWith("file://Cimoc/download/72/")){
if (url.contains("/Cimoc/download/72/")){
chapterId = Integer.parseInt(Objects.requireNonNull(StringUtils.match("/-photo-(\\d*)/", url, 1)));
}
if((url.contains("media/photos")
&& Integer.parseInt(url.substring(url.indexOf("photos/") + 7, url.lastIndexOf("/"))) > scramble_id)
|| chapterId > scramble_id) {
Bitmap resultBitmap = reference.get();
float rows = 10;
float chunkHeight = mHeight / rows;
Canvas canvas = new Canvas(resultBitmap);
int rows = 10;
int remainder = mHeight % rows;
//Canvas canvas = new Canvas(resultBitmap);
for (int x = 0; x < 10; x++) {
// 要裁剪的区域
Rect crop = new Rect(0, mHeight - (int) (chunkHeight * (x + 1)), mWidth, mHeight - (int) (chunkHeight * x));
// 裁剪后应放置到新图片对象的区域
Rect splic = new Rect(0, (int) chunkHeight * x, mWidth, (int) chunkHeight * (x + 1));
canvas.drawBitmap(sourceBitmap, crop, splic, null);
int chunkHeight = (int)Math.floor(mHeight / rows);
int py = chunkHeight * (x);
int y = mHeight - chunkHeight * (x + 1) - remainder;

if (x == 0) {
chunkHeight = chunkHeight + remainder;
} else {
py = py + remainder;
}
int[] pixels = new int[(chunkHeight) * mWidth];
sourceBitmap.getPixels(pixels, 0, mWidth, 0, y, mWidth, chunkHeight);
resultBitmap.setPixels(pixels, 0, mWidth, 0, py, mWidth, chunkHeight);
}
jmttIsDone=true;
}
}

}
13 changes: 9 additions & 4 deletions app/src/main/java/com/hiroshi/cimoc/source/MH50.java
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,9 @@ private String decrypt(String code) {

//根据文件名获取图片url,参考common.js中getChapterImage函数
private String getImageUrlByKey(String key, String domain, String chapter) {
if (key.startsWith("http://images.dmzj.com")) {
if (Pattern.matches("\\^https?://(images.dmzj.com|imgsmall.dmzj.com)/i", key)) {
try {
return domain +"/showImage.php?url=" + key;
return domain + "/showImage.php?url=" + URLEncoder.encode(key, "utf-8");
} catch (Exception e) {
return null;
}
Expand All @@ -159,9 +159,14 @@ private String getImageUrlByKey(String key, String domain, String chapter) {
return null;
}
}
if (key.startsWith("http") || key.startsWith("ftp")) {
return key;
if (Pattern.matches("\\^https?://(manhua.qpic.cn|mhimg.eshanyao.com|dd.wstts.com)/i",key)){
try {
return "https://manga.mipcdn.com/i/s"+URLEncoder.encode(key,"utf-8");
} catch (Exception e) {
return null;
}
}
if (key.startsWith("http") || key.startsWith("ftp")) return key;
return domain + "/" + chapter + key;
}

Expand Down

0 comments on commit 8466a34

Please sign in to comment.