Add normal preview support
This commit is contained in:
1 parent
6659fefc21
commit
2c4daa447e
15 files changed
+380
-158
No files matched your search
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright 2016 Hippo Seven
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.hippo.drawable;
|
||||
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.v7.graphics.drawable.DrawableWrapper;
|
||||
|
||||
import com.hippo.yorozuya.MathUtils;
|
||||
|
||||
public class PreciselyClipDrawable extends DrawableWrapper {
|
||||
|
||||
private final boolean mClip;
|
||||
private RectF mScale;
|
||||
private Rect mTemp;
|
||||
|
||||
public PreciselyClipDrawable(Drawable drawable, int offsetX, int offsetY, int width, int height) {
|
||||
super(drawable);
|
||||
float originWidth = drawable.getIntrinsicWidth();
|
||||
float originHeight = drawable.getIntrinsicHeight();
|
||||
|
||||
if (originWidth <= 0 || originHeight <= 0) {
|
||||
// Can not clip
|
||||
mClip = false;
|
||||
} else {
|
||||
mClip = true;
|
||||
mScale = new RectF();
|
||||
mScale.set(MathUtils.clamp(offsetX / originWidth, 0.0f, 1.0f),
|
||||
MathUtils.clamp(offsetY / originHeight, 0.0f, 1.0f),
|
||||
MathUtils.clamp((offsetX + width) / originWidth, 0.0f, 1.0f),
|
||||
MathUtils.clamp((offsetY + height) / originHeight, 0.0f, 1.0f));
|
||||
mTemp = new Rect();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onBoundsChange(Rect bounds) {
|
||||
if (mClip) {
|
||||
if (!mScale.isEmpty()) {
|
||||
mTemp.left = (int) ((mScale.left * bounds.right - mScale.right * bounds.left) /
|
||||
(mScale.left * (1 - mScale.right) - mScale.right * (1 - mScale.left)));
|
||||
mTemp.right = (int) (((1 - mScale.right) * bounds.left - (1 - mScale.left) * bounds.right) /
|
||||
(mScale.left * (1 - mScale.right) - mScale.right * (1 - mScale.left)));
|
||||
mTemp.top = (int) ((mScale.top * bounds.bottom - mScale.bottom * bounds.top) /
|
||||
(mScale.top * (1 - mScale.bottom) - mScale.bottom * (1 - mScale.top)));
|
||||
mTemp.bottom = (int) (((1 - mScale.bottom) * bounds.top - (1 - mScale.top) * bounds.bottom) /
|
||||
(mScale.top * (1 - mScale.bottom) - mScale.bottom * (1 - mScale.top)));
|
||||
super.onBoundsChange(mTemp);
|
||||
}
|
||||
} else {
|
||||
super.onBoundsChange(bounds);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIntrinsicWidth() {
|
||||
if (mClip) {
|
||||
return (int) (super.getIntrinsicWidth() * mScale.width());
|
||||
} else {
|
||||
return super.getIntrinsicWidth();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIntrinsicHeight() {
|
||||
if (mClip) {
|
||||
return (int) (super.getIntrinsicHeight() * mScale.height());
|
||||
} else {
|
||||
return super.getIntrinsicHeight();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Canvas canvas) {
|
||||
if (mClip) {
|
||||
if (!mScale.isEmpty()) {
|
||||
int saveCount = canvas.save();
|
||||
canvas.clipRect(getBounds());
|
||||
super.draw(canvas);
|
||||
canvas.restoreToCount(saveCount);
|
||||
}
|
||||
} else {
|
||||
super.draw(canvas);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -36,7 +36,6 @@ import com.hippo.ehviewer.client.EhClient;
|
||||
import com.hippo.ehviewer.client.EhCookieStore;
|
||||
import com.hippo.ehviewer.client.EhEngine;
|
||||
import com.hippo.ehviewer.client.data.GalleryDetail;
|
||||
import com.hippo.ehviewer.client.data.LargePreviewSet;
|
||||
import com.hippo.ehviewer.download.DownloadManager;
|
||||
import com.hippo.ehviewer.spider.SpiderDen;
|
||||
import com.hippo.ehviewer.ui.CommonOperations;
|
||||
@@ -75,8 +74,6 @@ public class EhApplication extends SceneApplication implements Thread.UncaughtEx
|
||||
private BitmapHelper mBitmapHelper;
|
||||
private Conaco<Bitmap> mConaco;
|
||||
private LruCache<Long, GalleryDetail> mGalleryDetailCache;
|
||||
private LruCache<String, LargePreviewSet> mLargePreviewSetCache;
|
||||
private LruCache<Long, Integer> mPreviewPagesCache;
|
||||
private SimpleDiskCache mSpiderInfoCache;
|
||||
private DownloadManager mDownloadManager;
|
||||
|
||||
@@ -131,12 +128,6 @@ public class EhApplication extends SceneApplication implements Thread.UncaughtEx
|
||||
if (null != mGalleryDetailCache) {
|
||||
mGalleryDetailCache.evictAll();
|
||||
}
|
||||
if (null != mLargePreviewSetCache) {
|
||||
mLargePreviewSetCache.evictAll();
|
||||
}
|
||||
if (null != mPreviewPagesCache) {
|
||||
mPreviewPagesCache.evictAll();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -269,26 +260,6 @@ public class EhApplication extends SceneApplication implements Thread.UncaughtEx
|
||||
return application.mGalleryDetailCache;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public static LruCache<String, LargePreviewSet> getLargePreviewSetCache(@NonNull Context context) {
|
||||
EhApplication application = ((EhApplication) context.getApplicationContext());
|
||||
if (application.mLargePreviewSetCache == null) {
|
||||
// Max size 50, 3 min timeout
|
||||
application.mLargePreviewSetCache = new LruCache<>(50);
|
||||
}
|
||||
return application.mLargePreviewSetCache;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public static LruCache<Long, Integer> getPreviewPagesCache(@NonNull Context context) {
|
||||
EhApplication application = ((EhApplication) context.getApplicationContext());
|
||||
if (application.mPreviewPagesCache == null) {
|
||||
// Max size 50, 3 min timeout
|
||||
application.mPreviewPagesCache = new LruCache<>(50);
|
||||
}
|
||||
return application.mPreviewPagesCache;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public static SimpleDiskCache getSpiderInfoCache(@NonNull Context context) {
|
||||
EhApplication application = ((EhApplication) context.getApplicationContext());
|
||||
|
||||
@@ -45,7 +45,7 @@ public class EhClient {
|
||||
public static final int METHOD_GET_GALLERY_LIST = 1;
|
||||
public static final int METHOD_FILL_GALLERY_LIST_BY_API = 2;
|
||||
public static final int METHOD_GET_GALLERY_DETAIL = 3;
|
||||
public static final int METHOD_GET_LARGE_PREVIEW_SET = 4;
|
||||
public static final int METHOD_GET_PREVIEW_SET = 4;
|
||||
public static final int METHOD_GET_RATE_GALLERY = 5;
|
||||
public static final int METHOD_GET_COMMENT_GALLERY = 6;
|
||||
public static final int METHOD_GET_GALLERY_TOKEN = 7;
|
||||
@@ -155,8 +155,8 @@ public class EhClient {
|
||||
return EhEngine.fillGalleryListByApi(this, mOkHttpClient, (List<GalleryInfo>) params[0]);
|
||||
case METHOD_GET_GALLERY_DETAIL:
|
||||
return EhEngine.getGalleryDetail(this, mOkHttpClient, (String) params[0]);
|
||||
case METHOD_GET_LARGE_PREVIEW_SET:
|
||||
return EhEngine.getLargePreviewSet(this, mOkHttpClient, (String) params[0]);
|
||||
case METHOD_GET_PREVIEW_SET:
|
||||
return EhEngine.getPreviewSet(this, mOkHttpClient, (String) params[0]);
|
||||
case METHOD_GET_RATE_GALLERY:
|
||||
return EhEngine.rateGallery(this, mOkHttpClient, (Long) params[0], (String) params[1], (Float) params[2]);
|
||||
case METHOD_GET_COMMENT_GALLERY:
|
||||
|
||||
@@ -27,7 +27,7 @@ import com.hippo.ehviewer.Settings;
|
||||
import com.hippo.ehviewer.client.data.GalleryComment;
|
||||
import com.hippo.ehviewer.client.data.GalleryDetail;
|
||||
import com.hippo.ehviewer.client.data.GalleryInfo;
|
||||
import com.hippo.ehviewer.client.data.LargePreviewSet;
|
||||
import com.hippo.ehviewer.client.data.PreviewSet;
|
||||
import com.hippo.ehviewer.client.exception.CancelledException;
|
||||
import com.hippo.ehviewer.client.exception.EhException;
|
||||
import com.hippo.ehviewer.client.exception.ParseException;
|
||||
@@ -309,7 +309,7 @@ public class EhEngine {
|
||||
}
|
||||
|
||||
|
||||
public static Pair<LargePreviewSet, Integer> getLargePreviewSet(
|
||||
public static Pair<PreviewSet, Integer> getPreviewSet(
|
||||
EhClient.Task task, OkHttpClient okHttpClient, String url) throws Exception {
|
||||
Log.d(TAG, url);
|
||||
Request request = new EhRequestBuilder(url, task.getEhConfig()).build();
|
||||
@@ -326,9 +326,8 @@ public class EhEngine {
|
||||
code = response.code();
|
||||
headers = response.headers();
|
||||
body = response.body().string();
|
||||
Document document = Jsoup.parse(body);
|
||||
return Pair.create(GalleryDetailParser.parseLargePreviewSet(document, body),
|
||||
GalleryDetailParser.parsePreviewPages(document, body));
|
||||
return Pair.create(GalleryDetailParser.parsePreviewSet(body),
|
||||
GalleryDetailParser.parsePreviewPages(body));
|
||||
} catch (Exception e) {
|
||||
throwException(call, code, headers, body, e);
|
||||
throw e;
|
||||
|
||||
@@ -37,8 +37,7 @@ public class GalleryDetail extends GalleryInfo {
|
||||
public GalleryTagGroup[] tags;
|
||||
public GalleryComment[] comments;
|
||||
public int previewPages;
|
||||
public LargePreviewSet previewSet;
|
||||
|
||||
public PreviewSet previewSet;
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
@@ -94,7 +93,7 @@ public class GalleryDetail extends GalleryInfo {
|
||||
this.comments = null;
|
||||
}
|
||||
this.previewPages = in.readInt();
|
||||
this.previewSet = in.readParcelable(LargePreviewSet.class.getClassLoader());
|
||||
this.previewSet = in.readParcelable(PreviewSet.class.getClassLoader());
|
||||
}
|
||||
|
||||
public static final Creator<GalleryDetail> CREATOR = new Creator<GalleryDetail>() {
|
||||
|
||||
@@ -19,11 +19,27 @@ package com.hippo.ehviewer.client.data;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import com.hippo.widget.LoadImageView;
|
||||
|
||||
public class GalleryPreview implements Parcelable {
|
||||
|
||||
public String imageUrl;
|
||||
public String pageUrl;
|
||||
public int index;
|
||||
String imageKey;
|
||||
String imageUrl;
|
||||
String pageUrl;
|
||||
int position;
|
||||
int offsetX = Integer.MIN_VALUE;
|
||||
int offsetY = Integer.MIN_VALUE;
|
||||
int clipWidth = Integer.MIN_VALUE;
|
||||
int clipHeight = Integer.MIN_VALUE;
|
||||
|
||||
public int getPosition() {
|
||||
return position;
|
||||
}
|
||||
|
||||
public void load(LoadImageView view) {
|
||||
view.setClip(offsetX, offsetY, clipWidth, clipHeight);
|
||||
view.load(imageKey, imageUrl);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
@@ -34,7 +50,11 @@ public class GalleryPreview implements Parcelable {
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeString(this.imageUrl);
|
||||
dest.writeString(this.pageUrl);
|
||||
dest.writeInt(this.index);
|
||||
dest.writeInt(this.position);
|
||||
dest.writeInt(this.offsetX);
|
||||
dest.writeInt(this.offsetY);
|
||||
dest.writeInt(this.clipWidth);
|
||||
dest.writeInt(this.clipHeight);
|
||||
}
|
||||
|
||||
public GalleryPreview() {
|
||||
@@ -43,14 +63,20 @@ public class GalleryPreview implements Parcelable {
|
||||
protected GalleryPreview(Parcel in) {
|
||||
this.imageUrl = in.readString();
|
||||
this.pageUrl = in.readString();
|
||||
this.index = in.readInt();
|
||||
this.position = in.readInt();
|
||||
this.offsetX = in.readInt();
|
||||
this.offsetY = in.readInt();
|
||||
this.clipWidth = in.readInt();
|
||||
this.clipHeight = in.readInt();
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<GalleryPreview> CREATOR = new Parcelable.Creator<GalleryPreview>() {
|
||||
@Override
|
||||
public GalleryPreview createFromParcel(Parcel source) {
|
||||
return new GalleryPreview(source);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GalleryPreview[] newArray(int size) {
|
||||
return new GalleryPreview[size];
|
||||
}
|
||||
|
||||
@@ -19,38 +19,56 @@ package com.hippo.ehviewer.client.data;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import com.hippo.ehviewer.client.EhCacheKeyFactory;
|
||||
import com.hippo.widget.LoadImageView;
|
||||
import com.hippo.yorozuya.IntList;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class LargePreviewSet implements Parcelable {
|
||||
public class LargePreviewSet extends PreviewSet {
|
||||
|
||||
private final IntList mIndexList;
|
||||
private final IntList mPositionList;
|
||||
private final ArrayList<String> mImageUrlList;
|
||||
private final ArrayList<String> mPageUrlList;
|
||||
|
||||
public int size() {
|
||||
return mImageUrlList.size();
|
||||
}
|
||||
|
||||
public void addItem(int index, String imageUrl, String pageUrl) {
|
||||
mIndexList.add(index);
|
||||
mPositionList.add(index);
|
||||
mImageUrlList.add(imageUrl);
|
||||
mPageUrlList.add(pageUrl);
|
||||
}
|
||||
|
||||
public int getIndexAt(int index) {
|
||||
return mIndexList.get(index);
|
||||
@Override
|
||||
public int size() {
|
||||
return mImageUrlList.size();
|
||||
}
|
||||
|
||||
public String getImageUrlAt(int index) {
|
||||
return mImageUrlList.get(index);
|
||||
@Override
|
||||
public int getPosition(int index) {
|
||||
return mPositionList.get(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPageUrlAt(int index) {
|
||||
return mPageUrlList.get(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GalleryPreview getGalleryPreview(long gid, int index) {
|
||||
GalleryPreview galleryPreview = new GalleryPreview();
|
||||
galleryPreview.position = mPositionList.get(index);
|
||||
galleryPreview.imageKey = EhCacheKeyFactory.getLargePreviewKey(gid, galleryPreview.position);
|
||||
galleryPreview.imageUrl = mImageUrlList.get(index);
|
||||
galleryPreview.pageUrl = mPageUrlList.get(index);
|
||||
return galleryPreview;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(LoadImageView view, long gid, int index) {
|
||||
view.resetClip();
|
||||
view.load(EhCacheKeyFactory.getLargePreviewKey(gid, mPositionList.get(index)),
|
||||
mImageUrlList.get(index));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
@@ -58,19 +76,19 @@ public class LargePreviewSet implements Parcelable {
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeParcelable(this.mIndexList, flags);
|
||||
dest.writeParcelable(this.mPositionList, flags);
|
||||
dest.writeStringList(this.mImageUrlList);
|
||||
dest.writeStringList(this.mPageUrlList);
|
||||
}
|
||||
|
||||
public LargePreviewSet() {
|
||||
mIndexList = new IntList();
|
||||
mPositionList = new IntList();
|
||||
mImageUrlList = new ArrayList<>();
|
||||
mPageUrlList = new ArrayList<>();
|
||||
}
|
||||
|
||||
protected LargePreviewSet(Parcel in) {
|
||||
this.mIndexList = in.readParcelable(IntList.class.getClassLoader());
|
||||
this.mPositionList = in.readParcelable(IntList.class.getClassLoader());
|
||||
this.mImageUrlList = in.createStringArrayList();
|
||||
this.mPageUrlList = in.createStringArrayList();
|
||||
}
|
||||
|
||||
@@ -16,40 +16,121 @@
|
||||
|
||||
package com.hippo.ehviewer.client.data;
|
||||
|
||||
import android.os.Parcel;
|
||||
|
||||
import com.hippo.widget.LoadImageView;
|
||||
import com.hippo.yorozuya.IntList;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class NormalPreviewSet {
|
||||
public class NormalPreviewSet extends PreviewSet {
|
||||
|
||||
private final IntList mIndexList = new IntList();
|
||||
private final ArrayList<String> mImageUrlList = new ArrayList<>();
|
||||
private final IntList mXOffsetList = new IntList();
|
||||
private final IntList mYOffsetList = new IntList();
|
||||
private final IntList mWidthList = new IntList();
|
||||
private final IntList mHeightList = new IntList();
|
||||
private final ArrayList<String> mPageUrlList = new ArrayList<>();
|
||||
private IntList mPositionList = new IntList();
|
||||
private ArrayList<String> mImageKeyList = new ArrayList<>();
|
||||
private ArrayList<String> mImageUrlList = new ArrayList<>();
|
||||
private IntList mOffsetXList = new IntList();
|
||||
private IntList mOffsetYList = new IntList();
|
||||
private IntList mClipWidthList = new IntList();
|
||||
private IntList mClipHeightList = new IntList();
|
||||
private ArrayList<String> mPageUrlList = new ArrayList<>();
|
||||
|
||||
public void addItem(int index, String imageUrl, int xOffset, int yOffset, int width,
|
||||
private String getImageKey(String imageUrl) {
|
||||
int index = imageUrl.indexOf('/');
|
||||
if (index >= 0) {
|
||||
return imageUrl.substring(index + 1);
|
||||
} else {
|
||||
return imageUrl;
|
||||
}
|
||||
}
|
||||
|
||||
public void addItem(int position, String imageUrl, int xOffset, int yOffset, int width,
|
||||
int height, String pageUrl) {
|
||||
mIndexList.add(index);
|
||||
mPositionList.add(position);
|
||||
mImageKeyList.add(getImageKey(imageUrl));
|
||||
mImageUrlList.add(imageUrl);
|
||||
mXOffsetList.add(xOffset);
|
||||
mYOffsetList.add(yOffset);
|
||||
mWidthList.add(width);
|
||||
mHeightList.add(height);
|
||||
mOffsetXList.add(xOffset);
|
||||
mOffsetYList.add(yOffset);
|
||||
mClipWidthList.add(width);
|
||||
mClipHeightList.add(height);
|
||||
mPageUrlList.add(pageUrl);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return mIndexList.size();
|
||||
return mPositionList.size();
|
||||
}
|
||||
|
||||
public int getIndexAt(int index) {
|
||||
return mIndexList.get(index);
|
||||
@Override
|
||||
public int getPosition(int index) {
|
||||
return mPositionList.get(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPageUrlAt(int index) {
|
||||
return mPageUrlList.get(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GalleryPreview getGalleryPreview(long gid, int index) {
|
||||
GalleryPreview galleryPreview = new GalleryPreview();
|
||||
galleryPreview.position = mPositionList.get(index);
|
||||
galleryPreview.imageKey = mImageKeyList.get(index);
|
||||
galleryPreview.imageUrl = mImageUrlList.get(index);
|
||||
galleryPreview.pageUrl = mPageUrlList.get(index);
|
||||
galleryPreview.offsetX = mOffsetXList.get(index);
|
||||
galleryPreview.offsetY = mOffsetYList.get(index);
|
||||
galleryPreview.clipWidth = mClipWidthList.get(index);
|
||||
galleryPreview.clipHeight = mClipHeightList.get(index);
|
||||
return galleryPreview;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(LoadImageView view, long gid, int index) {
|
||||
view.setClip(mOffsetXList.get(index), mOffsetYList.get(index),
|
||||
mClipWidthList.get(index), mClipHeightList.get(index));
|
||||
view.load(mImageKeyList.get(index), mImageUrlList.get(index));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeParcelable(this.mPositionList, flags);
|
||||
dest.writeStringList(this.mImageKeyList);
|
||||
dest.writeStringList(this.mImageUrlList);
|
||||
dest.writeParcelable(this.mOffsetXList, flags);
|
||||
dest.writeParcelable(this.mOffsetYList, flags);
|
||||
dest.writeParcelable(this.mClipWidthList, flags);
|
||||
dest.writeParcelable(this.mClipHeightList, flags);
|
||||
dest.writeStringList(this.mPageUrlList);
|
||||
}
|
||||
|
||||
public NormalPreviewSet() {
|
||||
}
|
||||
|
||||
protected NormalPreviewSet(Parcel in) {
|
||||
this.mPositionList = in.readParcelable(IntList.class.getClassLoader());
|
||||
this.mImageKeyList = in.createStringArrayList();
|
||||
this.mImageUrlList = in.createStringArrayList();
|
||||
this.mOffsetXList = in.readParcelable(IntList.class.getClassLoader());
|
||||
this.mOffsetYList = in.readParcelable(IntList.class.getClassLoader());
|
||||
this.mClipWidthList = in.readParcelable(IntList.class.getClassLoader());
|
||||
this.mClipHeightList = in.readParcelable(IntList.class.getClassLoader());
|
||||
this.mPageUrlList = in.createStringArrayList();
|
||||
}
|
||||
|
||||
public static final Creator<NormalPreviewSet> CREATOR = new Creator<NormalPreviewSet>() {
|
||||
@Override
|
||||
public NormalPreviewSet createFromParcel(Parcel source) {
|
||||
return new NormalPreviewSet(source);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NormalPreviewSet[] newArray(int size) {
|
||||
return new NormalPreviewSet[size];
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright 2016 Hippo Seven
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.hippo.ehviewer.client.data;
|
||||
|
||||
import android.os.Parcelable;
|
||||
|
||||
import com.hippo.widget.LoadImageView;
|
||||
|
||||
public abstract class PreviewSet implements Parcelable {
|
||||
|
||||
public abstract int size();
|
||||
|
||||
public abstract int getPosition(int index);
|
||||
|
||||
public abstract String getPageUrlAt(int index);
|
||||
|
||||
public abstract GalleryPreview getGalleryPreview(long gid, int index);
|
||||
|
||||
public abstract void load(LoadImageView view, long gid, int index);
|
||||
}
|
||||
@@ -25,6 +25,7 @@ import com.hippo.ehviewer.client.data.GalleryDetail;
|
||||
import com.hippo.ehviewer.client.data.GalleryTagGroup;
|
||||
import com.hippo.ehviewer.client.data.LargePreviewSet;
|
||||
import com.hippo.ehviewer.client.data.NormalPreviewSet;
|
||||
import com.hippo.ehviewer.client.data.PreviewSet;
|
||||
import com.hippo.ehviewer.client.exception.EhException;
|
||||
import com.hippo.ehviewer.client.exception.OffensiveException;
|
||||
import com.hippo.ehviewer.client.exception.ParseException;
|
||||
@@ -129,7 +130,7 @@ public class GalleryDetailParser {
|
||||
galleryDetail.tags = parseTagGroups(document);
|
||||
galleryDetail.comments = parseComments(document);
|
||||
galleryDetail.previewPages = parsePreviewPages(document, body);
|
||||
galleryDetail.previewSet = parseLargePreviewSet(document, body);
|
||||
galleryDetail.previewSet = parsePreviewSet(body);
|
||||
return galleryDetail;
|
||||
}
|
||||
|
||||
@@ -377,10 +378,18 @@ public class GalleryDetailParser {
|
||||
}
|
||||
}
|
||||
|
||||
public static PreviewSet parsePreviewSet(String body) throws ParseException {
|
||||
try {
|
||||
return parseLargePreviewSet(body);
|
||||
} catch (ParseException e) {
|
||||
return parseNormalPreviewSet(body);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse large previews with regular expressions
|
||||
*/
|
||||
public static LargePreviewSet parseLargePreviewSet(Document document, String body) throws ParseException {
|
||||
private static LargePreviewSet parseLargePreviewSet(Document document, String body) throws ParseException {
|
||||
try {
|
||||
LargePreviewSet largePreviewSet = new LargePreviewSet();
|
||||
Element gdt = document.getElementById("gdt");
|
||||
@@ -407,7 +416,7 @@ public class GalleryDetailParser {
|
||||
/**
|
||||
* Parse large previews with regular expressions
|
||||
*/
|
||||
public static LargePreviewSet parseLargePreviewSet(String body) throws ParseException {
|
||||
private static LargePreviewSet parseLargePreviewSet(String body) throws ParseException {
|
||||
Matcher m = LARGE_PREVIEW_PATTERN.matcher(body);
|
||||
LargePreviewSet largePreviewSet = new LargePreviewSet();
|
||||
|
||||
@@ -426,7 +435,7 @@ public class GalleryDetailParser {
|
||||
/**
|
||||
* Parse normal previews with regular expressions
|
||||
*/
|
||||
public static NormalPreviewSet parseNormalPreviewSet(String body) throws ParseException {
|
||||
private static NormalPreviewSet parseNormalPreviewSet(String body) throws ParseException {
|
||||
Matcher m = NORMAL_PREVIEW_PATTERN.matcher(body);
|
||||
NormalPreviewSet normalPreviewSet = new NormalPreviewSet();
|
||||
while (m.find()) {
|
||||
|
||||
@@ -37,8 +37,7 @@ import com.hippo.ehviewer.client.EhConfig;
|
||||
import com.hippo.ehviewer.client.EhRequestBuilder;
|
||||
import com.hippo.ehviewer.client.EhUrl;
|
||||
import com.hippo.ehviewer.client.data.GalleryInfo;
|
||||
import com.hippo.ehviewer.client.data.LargePreviewSet;
|
||||
import com.hippo.ehviewer.client.data.NormalPreviewSet;
|
||||
import com.hippo.ehviewer.client.data.PreviewSet;
|
||||
import com.hippo.ehviewer.client.exception.Image509Exception;
|
||||
import com.hippo.ehviewer.client.exception.ParseException;
|
||||
import com.hippo.ehviewer.client.parser.GalleryDetailParser;
|
||||
@@ -680,23 +679,12 @@ public class SpiderQueen implements Runnable {
|
||||
}
|
||||
|
||||
private void readPreviews(String body, SpiderInfo spiderInfo) throws ParseException {
|
||||
try {
|
||||
NormalPreviewSet previewSet = GalleryDetailParser.parseNormalPreviewSet(body);
|
||||
spiderInfo.previewPerPage = previewSet.size();
|
||||
for (int i = 0, n = previewSet.size(); i < n; i++) {
|
||||
GalleryPageUrlParser.Result result = GalleryPageUrlParser.parse(previewSet.getPageUrlAt(i));
|
||||
if (result != null) {
|
||||
spiderInfo.pTokenMap.put(result.page, result.pToken);
|
||||
}
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
LargePreviewSet previewSet = GalleryDetailParser.parseLargePreviewSet(body);
|
||||
spiderInfo.previewPerPage = previewSet.size();
|
||||
for (int i = 0, n = previewSet.size(); i < n; i++) {
|
||||
GalleryPageUrlParser.Result result = GalleryPageUrlParser.parse(previewSet.getPageUrlAt(i));
|
||||
if (result != null) {
|
||||
spiderInfo.pTokenMap.put(result.page, result.pToken);
|
||||
}
|
||||
PreviewSet previewSet = GalleryDetailParser.parsePreviewSet(body);
|
||||
spiderInfo.previewPerPage = previewSet.size();
|
||||
for (int i = 0, n = previewSet.size(); i < n; i++) {
|
||||
GalleryPageUrlParser.Result result = GalleryPageUrlParser.parse(previewSet.getPageUrlAt(i));
|
||||
if (result != null) {
|
||||
spiderInfo.pTokenMap.put(result.page, result.pToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1098,7 +1098,7 @@ public class DownloadsScene extends ToolbarScene
|
||||
return;
|
||||
}
|
||||
DownloadInfo info = mList.get(position);
|
||||
holder.thumb.load(EhCacheKeyFactory.getThumbKey(info.gid), info.thumb, true);
|
||||
holder.thumb.load(EhCacheKeyFactory.getThumbKey(info.gid), info.thumb);
|
||||
holder.title.setText(EhUtils.getSuitableTitle(info));
|
||||
holder.uploader.setText(info.uploader);
|
||||
holder.rating.setRating(info.rating);
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.hippo.ehviewer.ui.scene;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
@@ -69,8 +70,8 @@ import com.hippo.ehviewer.client.data.GalleryComment;
|
||||
import com.hippo.ehviewer.client.data.GalleryDetail;
|
||||
import com.hippo.ehviewer.client.data.GalleryInfo;
|
||||
import com.hippo.ehviewer.client.data.GalleryTagGroup;
|
||||
import com.hippo.ehviewer.client.data.LargePreviewSet;
|
||||
import com.hippo.ehviewer.client.data.ListUrlBuilder;
|
||||
import com.hippo.ehviewer.client.data.PreviewSet;
|
||||
import com.hippo.ehviewer.client.parser.RateGalleryParser;
|
||||
import com.hippo.ehviewer.dao.DownloadInfo;
|
||||
import com.hippo.ehviewer.dao.Filter;
|
||||
@@ -102,7 +103,6 @@ import com.hippo.yorozuya.ViewUtils;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public class GalleryDetailScene extends BaseScene implements View.OnClickListener,
|
||||
com.hippo.ehviewer.download.DownloadManager.DownloadInfoListener,
|
||||
@@ -715,7 +715,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
|
||||
if (ACTION_GALLERY_INFO.equals(mAction) && mGalleryInfo != null) {
|
||||
GalleryInfo gi = mGalleryInfo;
|
||||
mThumb.load(EhCacheKeyFactory.getThumbKey(gi.gid), gi.thumb, true);
|
||||
mThumb.load(EhCacheKeyFactory.getThumbKey(gi.gid), gi.thumb);
|
||||
mTitle.setText(EhUtils.getSuitableTitle(gi));
|
||||
mUploader.setText(gi.uploader);
|
||||
mCategory.setText(EhUtils.getCategory(gi.category));
|
||||
@@ -756,7 +756,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
Resources resources = getResources2();
|
||||
AssertUtils.assertNotNull(resources);
|
||||
|
||||
mThumb.load(EhCacheKeyFactory.getThumbKey(gd.gid), gd.thumb, true);
|
||||
mThumb.load(EhCacheKeyFactory.getThumbKey(gd.gid), gd.thumb);
|
||||
mTitle.setText(EhUtils.getSuitableTitle(gd));
|
||||
mUploader.setText(gd.uploader);
|
||||
mCategory.setText(EhUtils.getCategory(gd.category));
|
||||
@@ -861,6 +861,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
private void bindPreviews(GalleryDetail gd) {
|
||||
LayoutInflater inflater = getLayoutInflater2();
|
||||
Resources resources = getResources2();
|
||||
@@ -869,7 +870,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
}
|
||||
|
||||
mGridLayout.removeAllViews();
|
||||
LargePreviewSet previewSet = gd.previewSet;
|
||||
PreviewSet previewSet = gd.previewSet;
|
||||
if (gd.previewPages <= 0 || previewSet == null || previewSet.size() == 0) {
|
||||
mPreviewText.setText(R.string.no_previews);
|
||||
return;
|
||||
@@ -886,14 +887,12 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
View view = inflater.inflate(R.layout.item_gallery_preview, mGridLayout, false);
|
||||
mGridLayout.addView(view);
|
||||
|
||||
int index = previewSet.getIndexAt(i);
|
||||
String imageUrl = previewSet.getImageUrlAt(i);
|
||||
LoadImageView image = (LoadImageView) view.findViewById(R.id.image);
|
||||
image.load(EhCacheKeyFactory.getLargePreviewKey(gd.gid, index), imageUrl, true);
|
||||
previewSet.load(image, gd.gid, i);
|
||||
image.setTag(R.id.index, i);
|
||||
image.setOnClickListener(this);
|
||||
TextView text = (TextView) view.findViewById(R.id.text);
|
||||
text.setText(String.format(Locale.US, "%d", index + 1));
|
||||
text.setText(Integer.toString(previewSet.getPosition(i) + 1));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1602,9 +1601,6 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
|
||||
// Put gallery detail to cache
|
||||
EhApplication.getGalleryDetailCache(getApplication()).put(result.gid, result);
|
||||
EhApplication.getLargePreviewSetCache(getApplication()).put(
|
||||
EhCacheKeyFactory.getLargePreviewSetKey(result.gid, 0), result.previewSet);
|
||||
EhApplication.getPreviewPagesCache(getApplication()).put(result.gid, result.previewPages);
|
||||
|
||||
// Add history
|
||||
EhDB.putHistoryInfo(result);
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.hippo.ehviewer.ui.scene;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
@@ -37,13 +38,12 @@ import com.hippo.easyrecyclerview.EasyRecyclerView;
|
||||
import com.hippo.easyrecyclerview.MarginItemDecoration;
|
||||
import com.hippo.ehviewer.EhApplication;
|
||||
import com.hippo.ehviewer.R;
|
||||
import com.hippo.ehviewer.client.EhCacheKeyFactory;
|
||||
import com.hippo.ehviewer.client.EhClient;
|
||||
import com.hippo.ehviewer.client.EhRequest;
|
||||
import com.hippo.ehviewer.client.EhUrl;
|
||||
import com.hippo.ehviewer.client.data.GalleryInfo;
|
||||
import com.hippo.ehviewer.client.data.GalleryPreview;
|
||||
import com.hippo.ehviewer.client.data.LargePreviewSet;
|
||||
import com.hippo.ehviewer.client.data.PreviewSet;
|
||||
import com.hippo.ehviewer.client.exception.EhException;
|
||||
import com.hippo.ehviewer.ui.GalleryActivity;
|
||||
import com.hippo.ehviewer.ui.MainActivity;
|
||||
@@ -54,7 +54,6 @@ import com.hippo.widget.Slider;
|
||||
import com.hippo.widget.recyclerview.AutoGridLayoutManager;
|
||||
import com.hippo.yorozuya.AssertUtils;
|
||||
import com.hippo.yorozuya.LayoutUtils;
|
||||
import com.hippo.yorozuya.SimpleHandler;
|
||||
import com.hippo.yorozuya.ViewUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -229,7 +228,7 @@ public class GalleryPreviewsScene extends ToolbarScene implements EasyRecyclerVi
|
||||
Intent intent = new Intent(context, GalleryActivity.class);
|
||||
intent.setAction(GalleryActivity.ACTION_EH);
|
||||
intent.putExtra(GalleryActivity.KEY_GALLERY_INFO, mGalleryInfo);
|
||||
intent.putExtra(GalleryActivity.KEY_PAGE, p.index);
|
||||
intent.putExtra(GalleryActivity.KEY_PAGE, p.getPosition());
|
||||
startActivity(intent);
|
||||
}
|
||||
return true;
|
||||
@@ -263,11 +262,12 @@ public class GalleryPreviewsScene extends ToolbarScene implements EasyRecyclerVi
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressLint("SetTextI18n")
|
||||
public void onBindViewHolder(GalleryPreviewHolder holder, int position) {
|
||||
if (null != mHelper && null != mGalleryInfo) {
|
||||
if (null != mHelper) {
|
||||
GalleryPreview preview = mHelper.getDataAt(position);
|
||||
holder.image.load(EhCacheKeyFactory.getLargePreviewKey(mGalleryInfo.gid, preview.index), preview.imageUrl);
|
||||
holder.text.setText(String.format(Locale.US, "%d", preview.index + 1));
|
||||
preview.load(holder.image);
|
||||
holder.text.setText(Integer.toString(preview.getPosition() + 1));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -287,24 +287,11 @@ public class GalleryPreviewsScene extends ToolbarScene implements EasyRecyclerVi
|
||||
return;
|
||||
}
|
||||
|
||||
final LargePreviewSet previewSet = EhApplication.getLargePreviewSetCache(
|
||||
getContext()).get(EhCacheKeyFactory.getLargePreviewSetKey(mGalleryInfo.gid, page));
|
||||
final Integer pages = EhApplication.getPreviewPagesCache(getContext()).get(mGalleryInfo.gid);
|
||||
if (previewSet != null && pages != null) {
|
||||
SimpleHandler.getInstance().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
onGetLargePreviewSetSuccess(Pair.create(previewSet, pages), taskId);
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
String url = EhUrl.getGalleryDetailUrl(mGalleryInfo.gid, mGalleryInfo.token, page, false);
|
||||
EhRequest request = new EhRequest();
|
||||
request.setMethod(EhClient.METHOD_GET_LARGE_PREVIEW_SET);
|
||||
request.setCallback(new GetLargePreviewSetListener(getContext(),
|
||||
activity.getStageId(), getTag(), taskId, mGalleryInfo.gid, page));
|
||||
request.setMethod(EhClient.METHOD_GET_PREVIEW_SET);
|
||||
request.setCallback(new GetPreviewSetListener(getContext(),
|
||||
activity.getStageId(), getTag(), taskId));
|
||||
request.setArgs(url);
|
||||
mClient.execute(request);
|
||||
}
|
||||
@@ -336,17 +323,13 @@ public class GalleryPreviewsScene extends ToolbarScene implements EasyRecyclerVi
|
||||
}
|
||||
}
|
||||
|
||||
private void onGetLargePreviewSetSuccess(Pair<LargePreviewSet, Integer> result, int taskId) {
|
||||
if (mHelper != null && mHelper.isCurrentTask(taskId) && isViewCreated()) {
|
||||
LargePreviewSet previewSet = result.first;
|
||||
private void onGetPreviewSetSuccess(Pair<PreviewSet, Integer> result, int taskId) {
|
||||
if (null != mHelper && mHelper.isCurrentTask(taskId) && null != mGalleryInfo) {
|
||||
PreviewSet previewSet = result.first;
|
||||
int size = previewSet.size();
|
||||
ArrayList<GalleryPreview> list = new ArrayList<>(size);
|
||||
for (int i = 0; i < size; i++) {
|
||||
GalleryPreview preview = new GalleryPreview();
|
||||
preview.imageUrl = previewSet.getImageUrlAt(i);
|
||||
preview.pageUrl = previewSet.getPageUrlAt(i);
|
||||
preview.index = previewSet.getIndexAt(i);
|
||||
list.add(preview);
|
||||
list.add(previewSet.getGalleryPreview(mGalleryInfo.gid, i));
|
||||
}
|
||||
|
||||
mHelper.setPages(taskId, result.second);
|
||||
@@ -354,34 +337,26 @@ public class GalleryPreviewsScene extends ToolbarScene implements EasyRecyclerVi
|
||||
}
|
||||
}
|
||||
|
||||
private void onGetLargePreviewSetFailure(Exception e, int taskId) {
|
||||
if (mHelper != null && mHelper.isCurrentTask(taskId) && isViewCreated()) {
|
||||
private void onGetPreviewSetFailure(Exception e, int taskId) {
|
||||
if (mHelper != null && mHelper.isCurrentTask(taskId)) {
|
||||
mHelper.onGetException(taskId, e);
|
||||
}
|
||||
}
|
||||
|
||||
private static class GetLargePreviewSetListener extends EhCallback<GalleryPreviewsScene, Pair<LargePreviewSet, Integer>> {
|
||||
private static class GetPreviewSetListener extends EhCallback<GalleryPreviewsScene, Pair<PreviewSet, Integer>> {
|
||||
|
||||
private final int mTaskId;
|
||||
private final long mGid;
|
||||
private final int mPage;
|
||||
|
||||
public GetLargePreviewSetListener(Context context, int stageId, String sceneTag, int taskId, long gid, int page) {
|
||||
public GetPreviewSetListener(Context context, int stageId, String sceneTag, int taskId) {
|
||||
super(context, stageId, sceneTag);
|
||||
mTaskId = taskId;
|
||||
mGid = gid;
|
||||
mPage = page;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Pair<LargePreviewSet, Integer> result) {
|
||||
EhApplication.getLargePreviewSetCache(getApplication()).put(
|
||||
EhCacheKeyFactory.getLargePreviewSetKey(mGid, mPage), result.first);
|
||||
EhApplication.getPreviewPagesCache(getApplication()).put(mGid, result.second);
|
||||
|
||||
public void onSuccess(Pair<PreviewSet, Integer> result) {
|
||||
GalleryPreviewsScene scene = getScene();
|
||||
if (scene != null) {
|
||||
scene.onGetLargePreviewSetSuccess(result, mTaskId);
|
||||
scene.onGetPreviewSetSuccess(result, mTaskId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -389,7 +364,7 @@ public class GalleryPreviewsScene extends ToolbarScene implements EasyRecyclerVi
|
||||
public void onFailure(Exception e) {
|
||||
GalleryPreviewsScene scene = getScene();
|
||||
if (scene != null) {
|
||||
scene.onGetLargePreviewSetFailure(e, mTaskId);
|
||||
scene.onGetPreviewSetFailure(e, mTaskId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ import com.hippo.conaco.ConacoTask;
|
||||
import com.hippo.conaco.DataContainer;
|
||||
import com.hippo.conaco.Unikery;
|
||||
import com.hippo.conaco.ValueHolder;
|
||||
import com.hippo.drawable.PreciselyClipDrawable;
|
||||
import com.hippo.ehviewer.EhApplication;
|
||||
import com.hippo.ehviewer.R;
|
||||
|
||||
@@ -49,6 +50,11 @@ public class LoadImageView extends FixedAspectImageView implements Unikery<Bitma
|
||||
private DataContainer mContainer;
|
||||
private boolean mUseNetwork;
|
||||
|
||||
private int mOffsetX = Integer.MIN_VALUE;
|
||||
private int mOffsetY = Integer.MIN_VALUE;
|
||||
private int mClipWidth = Integer.MIN_VALUE;
|
||||
private int mClipHeight = Integer.MIN_VALUE;
|
||||
|
||||
private ValueHolder<Bitmap> mHolder;
|
||||
|
||||
private boolean mFailed;
|
||||
@@ -152,6 +158,20 @@ public class LoadImageView extends FixedAspectImageView implements Unikery<Bitma
|
||||
load(key, url, null, true);
|
||||
}
|
||||
|
||||
public void setClip(int offsetX, int offsetY, int clipWidth, int clipHeight) {
|
||||
mOffsetX = offsetX;
|
||||
mOffsetY = offsetY;
|
||||
mClipWidth = clipWidth;
|
||||
mClipHeight = clipHeight;
|
||||
}
|
||||
|
||||
public void resetClip() {
|
||||
mOffsetX = Integer.MIN_VALUE;
|
||||
mOffsetY = Integer.MIN_VALUE;
|
||||
mClipWidth = Integer.MIN_VALUE;
|
||||
mClipHeight = Integer.MIN_VALUE;
|
||||
}
|
||||
|
||||
public void load(String key, String url, boolean useNetwork) {
|
||||
load(key, url, null, useNetwork);
|
||||
}
|
||||
@@ -252,6 +272,10 @@ public class LoadImageView extends FixedAspectImageView implements Unikery<Bitma
|
||||
Bitmap bitmap = holder.getValue();
|
||||
Drawable drawable = new BitmapDrawable(getResources(), bitmap);
|
||||
|
||||
if (Integer.MIN_VALUE != mOffsetX) {
|
||||
drawable = new PreciselyClipDrawable(drawable, mOffsetX, mOffsetY, mClipWidth, mClipHeight);
|
||||
}
|
||||
|
||||
if ((source == Conaco.Source.DISK || source == Conaco.Source.NETWORK)) {
|
||||
Drawable[] layers = new Drawable[2];
|
||||
layers[0] = new ColorDrawable(Color.TRANSPARENT);
|
||||
|
||||
Reference in new issue
Block a user