提交 b7c7c2b2 编写于 作者: S Sam Judd

Move resource into Engine package.

上级 e743a1f0
package com.bumptech.glide.load;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
import java.util.List;
......
package com.bumptech.glide.load;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
import java.io.IOException;
......
package com.bumptech.glide.load;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
import java.io.OutputStream;
......
package com.bumptech.glide.load;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
import java.io.OutputStream;
......
package com.bumptech.glide.load;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
/**
* A class for performing an arbitrary transformation on a bitmap
......
......@@ -5,7 +5,6 @@ import android.os.Looper;
import android.os.MessageQueue;
import android.util.Log;
import com.bumptech.glide.Priority;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.Key;
import com.bumptech.glide.load.ResourceDecoder;
import com.bumptech.glide.load.ResourceEncoder;
......
......@@ -2,7 +2,6 @@ package com.bumptech.glide.load.engine;
import android.os.Handler;
import android.util.Log;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.Key;
import com.bumptech.glide.request.ResourceCallback;
import com.bumptech.glide.util.LogTime;
......
package com.bumptech.glide.load.engine;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.Key;
public interface EngineJobListener {
......
package com.bumptech.glide;
package com.bumptech.glide.load.engine;
import android.os.Looper;
import com.bumptech.glide.load.Key;
......@@ -18,7 +18,7 @@ public abstract class Resource<Z> {
private Key key;
private boolean isCacheable;
public interface ResourceListener {
interface ResourceListener {
public void onResourceReleased(Key key, Resource resource);
}
......@@ -28,16 +28,16 @@ public abstract class Resource<Z> {
protected abstract void recycleInternal();
public void setResourceListener(Key key, ResourceListener listener) {
void setResourceListener(Key key, ResourceListener listener) {
this.key = key;
this.listener = listener;
}
public void setCacheable(boolean isCacheable) {
void setCacheable(boolean isCacheable) {
this.isCacheable = isCacheable;
}
public boolean isCacheable() {
boolean isCacheable() {
return isCacheable;
}
......
......@@ -3,7 +3,6 @@ package com.bumptech.glide.load.engine;
import android.os.SystemClock;
import android.util.Log;
import com.bumptech.glide.Priority;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.Key;
import com.bumptech.glide.load.ResourceDecoder;
import com.bumptech.glide.load.Transformation;
......
......@@ -3,7 +3,6 @@ package com.bumptech.glide.load.engine;
import android.os.SystemClock;
import android.util.Log;
import com.bumptech.glide.Priority;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.Key;
import com.bumptech.glide.load.ResourceDecoder;
import com.bumptech.glide.load.ResourceEncoder;
......
package com.bumptech.glide.load.engine.cache;
import com.bumptech.glide.load.Key;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.util.LruCache;
import static android.content.ComponentCallbacks2.TRIM_MEMORY_BACKGROUND;
......
......@@ -2,7 +2,7 @@ package com.bumptech.glide.load.engine.cache;
import android.content.ComponentCallbacks2;
import com.bumptech.glide.load.Key;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
/**
* An interface for adding and removing resources from an in memory cache
......
package com.bumptech.glide.load.engine.cache;
import com.bumptech.glide.load.Key;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
public class MemoryCacheAdapter implements MemoryCache {
......
package com.bumptech.glide.load.resource;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.load.ResourceDecoder;
import java.io.IOException;
......
package com.bumptech.glide.load.resource.bitmap;
import android.graphics.drawable.BitmapDrawable;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
import com.bumptech.glide.util.Util;
......
package com.bumptech.glide.load.resource.bitmap;
import android.graphics.Bitmap;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.load.ResourceEncoder;
import java.io.OutputStream;
......
package com.bumptech.glide.load.resource.bitmap;
import android.graphics.Bitmap;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
import com.bumptech.glide.util.Util;
......
package com.bumptech.glide.load.resource.bitmap;
import android.graphics.Bitmap;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
import com.bumptech.glide.load.Transformation;
......
......@@ -2,7 +2,7 @@ package com.bumptech.glide.load.resource.bitmap;
import android.graphics.Bitmap;
import android.os.ParcelFileDescriptor;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.load.ResourceDecoder;
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
import com.bumptech.glide.load.DecodeFormat;
......
package com.bumptech.glide.load.resource.bitmap;
import android.graphics.Bitmap;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
import com.bumptech.glide.load.Transformation;
......
......@@ -3,7 +3,7 @@ package com.bumptech.glide.load.resource.bitmap;
import android.graphics.Bitmap;
import android.os.ParcelFileDescriptor;
import android.util.Log;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.load.ResourceDecoder;
import com.bumptech.glide.load.model.ImageVideoWrapper;
......
......@@ -3,7 +3,7 @@ package com.bumptech.glide.load.resource.bitmap;
import android.content.Context;
import android.graphics.Bitmap;
import com.bumptech.glide.Glide;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.load.DecodeFormat;
import com.bumptech.glide.load.ResourceDecoder;
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
......
package com.bumptech.glide.load.resource.bytes;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
public class BytesResource extends Resource<byte[]> {
private byte[] bytes;
......
package com.bumptech.glide.load.resource.gif;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
public class GifDataResource extends Resource<GifData> {
private GifData gifData;
......
package com.bumptech.glide.load.resource.gif;
import android.graphics.Bitmap;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.load.MultiTransformation;
import com.bumptech.glide.load.Transformation;
......
package com.bumptech.glide.load.resource.gif;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
public class GifDrawableResource extends Resource<GifDrawable> {
private Resource<GifData> wrapped;
......
package com.bumptech.glide.load.resource.gif;
import android.graphics.Bitmap;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.gifdecoder.GifDecoder;
import com.bumptech.glide.load.ResourceDecoder;
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
......
package com.bumptech.glide.load.resource.gif;
import android.util.Log;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.load.ResourceEncoder;
import java.io.IOException;
......
package com.bumptech.glide.load.resource.gifbitmap;
import android.graphics.Bitmap;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.load.resource.gif.GifData;
public class GifBitmapWrapper {
......
package com.bumptech.glide.load.resource.gifbitmap;
import android.graphics.Bitmap;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.load.resource.gif.GifData;
public class GifBitmapWrapperResource extends Resource<GifBitmapWrapper> {
......
package com.bumptech.glide.load.resource.gifbitmap;
import android.graphics.Bitmap;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.load.ResourceDecoder;
import com.bumptech.glide.load.model.ImageVideoWrapper;
import com.bumptech.glide.load.resource.bitmap.ImageHeaderParser;
......
package com.bumptech.glide.load.resource.gifbitmap;
import android.graphics.Bitmap;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.load.ResourceEncoder;
import com.bumptech.glide.load.resource.gif.GifData;
......
package com.bumptech.glide.load.resource.gifbitmap;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.load.ResourceDecoder;
import com.bumptech.glide.load.model.ImageVideoWrapper;
......
package com.bumptech.glide.load.resource.gifbitmap;
import android.graphics.Bitmap;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.load.Transformation;
import com.bumptech.glide.load.resource.gif.GifData;
import com.bumptech.glide.load.resource.gif.GifDataTransformation;
......
package com.bumptech.glide.load.resource.transcode;
import android.graphics.Bitmap;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.load.resource.bytes.BytesResource;
import java.io.ByteArrayOutputStream;
......
......@@ -3,7 +3,7 @@ package com.bumptech.glide.load.resource.transcode;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.load.resource.bitmap.BitmapDrawableResource;
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
......
......@@ -2,7 +2,7 @@ package com.bumptech.glide.load.resource.transcode;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.load.resource.gif.GifData;
import com.bumptech.glide.load.resource.gifbitmap.GifBitmapWrapper;
......
package com.bumptech.glide.load.resource.transcode;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.load.resource.bytes.BytesResource;
import com.bumptech.glide.load.resource.gif.GifData;
......
package com.bumptech.glide.load.resource.transcode;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.load.resource.gif.GifData;
import com.bumptech.glide.load.resource.gif.GifDrawable;
import com.bumptech.glide.load.resource.gif.GifDrawableResource;
......
package com.bumptech.glide.load.resource.transcode;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
/**
* Transcodes a resource of one type to a resource of another type.
......
package com.bumptech.glide.load.resource.transcode;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
public class UnitTranscoder implements ResourceTranscoder {
private static final UnitTranscoder UNIT_TRANSCODER = new UnitTranscoder();
......
......@@ -4,7 +4,7 @@ import android.content.Context;
import android.graphics.drawable.Drawable;
import android.util.Log;
import com.bumptech.glide.Priority;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.load.ResourceDecoder;
import com.bumptech.glide.load.ResourceEncoder;
import com.bumptech.glide.load.Transformation;
......
package com.bumptech.glide.request;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
public interface ResourceCallback {
......
......@@ -20,6 +20,7 @@ import com.android.volley.toolbox.NoCache;
import com.bumptech.glide.load.ResourceDecoder;
import com.bumptech.glide.load.ResourceEncoder;
import com.bumptech.glide.load.data.DataFetcher;
import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
import com.bumptech.glide.load.engine.cache.DiskCache;
import com.bumptech.glide.load.engine.cache.MemoryCache;
......
package com.bumptech.glide.load;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
import org.junit.Test;
import java.util.ArrayList;
......
package com.bumptech.glide.load;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
import org.junit.Test;
import java.io.ByteArrayOutputStream;
......
package com.bumptech.glide.load.engine;
import android.os.Handler;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.Key;
import com.bumptech.glide.load.engine.cache.MemoryCache;
import com.bumptech.glide.request.ResourceCallback;
......
package com.bumptech.glide.load.engine;
import com.bumptech.glide.Priority;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.Key;
import com.bumptech.glide.load.ResourceDecoder;
import com.bumptech.glide.load.ResourceEncoder;
......
package com.bumptech.glide.load.engine;
import com.bumptech.glide.Priority;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.Key;
import com.bumptech.glide.load.ResourceDecoder;
import com.bumptech.glide.load.Transformation;
......
package com.bumptech.glide;
package com.bumptech.glide.load.engine;
import com.bumptech.glide.load.Key;
import junit.framework.Assert;
......@@ -8,6 +8,8 @@ import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
......@@ -119,6 +121,14 @@ public class ResourceTest {
resource.release();
}
@Test
public void testCanSetAndGetIsCacheable() {
resource.setCacheable(true);
assertTrue(resource.isCacheable());
resource.setCacheable(false);
assertFalse(resource.isCacheable());
}
private static class MockResource extends Resource<Object> {
int recycled = 0;
@Override
......
package com.bumptech.glide.load.engine;
import com.bumptech.glide.Priority;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.Key;
import com.bumptech.glide.load.ResourceDecoder;
import com.bumptech.glide.load.ResourceEncoder;
......
......@@ -2,7 +2,7 @@ package com.bumptech.glide.load.engine.cache;
import android.content.ComponentCallbacks2;
import com.bumptech.glide.load.Key;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
import org.junit.Test;
import java.io.UnsupportedEncodingException;
......
package com.bumptech.glide.load.resource.bitmap;
import android.graphics.Bitmap;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.tests.Util;
import org.junit.Before;
import org.junit.Test;
......
package com.bumptech.glide.load.resource.bitmap;
import android.graphics.Bitmap;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
import com.bumptech.glide.tests.Util;
import org.junit.Before;
......
package com.bumptech.glide.load.resource.bitmap;
import android.graphics.Bitmap;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
import com.bumptech.glide.tests.Util;
import org.junit.Before;
......
......@@ -2,7 +2,7 @@ package com.bumptech.glide.load.resource.bitmap;
import android.graphics.Bitmap;
import android.os.ParcelFileDescriptor;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.load.ResourceDecoder;
import com.bumptech.glide.load.model.ImageVideoWrapper;
import com.bumptech.glide.tests.Util;
......
package com.bumptech.glide.load.resource.bitmap;
import android.graphics.Bitmap;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.load.DecodeFormat;
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
import com.bumptech.glide.tests.Util;
......
package com.bumptech.glide.load.resource.gif;
import android.graphics.Bitmap;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.load.Transformation;
import org.junit.Before;
import org.junit.Test;
......
package com.bumptech.glide.load.resource.gif;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
......
package com.bumptech.glide.load.resource.gif;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.tests.Util;
import org.junit.Before;
import org.junit.Test;
......
......@@ -2,7 +2,7 @@ package com.bumptech.glide.load.resource.gifbitmap;
import android.graphics.Bitmap;
import android.os.ParcelFileDescriptor;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.load.ResourceDecoder;
import com.bumptech.glide.load.model.ImageVideoWrapper;
import com.bumptech.glide.load.resource.gif.GifData;
......
package com.bumptech.glide.load.resource.gifbitmap;
import android.graphics.Bitmap;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.load.ResourceEncoder;
import com.bumptech.glide.load.resource.gif.GifData;
import org.junit.Before;
......
package com.bumptech.glide.load.resource.gifbitmap;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.load.ResourceDecoder;
import com.bumptech.glide.load.model.ImageVideoWrapper;
import com.bumptech.glide.load.resource.gifbitmap.GifBitmapWrapper;
import com.bumptech.glide.load.resource.gifbitmap.GifBitmapWrapperStreamResourceDecoder;
import org.junit.Before;
import org.junit.Test;
import org.mockito.invocation.InvocationOnMock;
......
package com.bumptech.glide.load.resource.gifbitmap;
import android.graphics.Bitmap;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.load.resource.gif.GifData;
import org.junit.Before;
import org.junit.Test;
......
package com.bumptech.glide.load.resource.gifbitmap;
import android.graphics.Bitmap;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.load.resource.gif.GifData;
import org.junit.Test;
......
package com.bumptech.glide.load.resource.gifbitmap;
import android.graphics.Bitmap;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.load.Transformation;
import com.bumptech.glide.load.resource.gif.GifData;
import org.junit.Before;
......
package com.bumptech.glide.load.resource.transcode;
import android.graphics.Bitmap;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.tests.Util;
import org.junit.Before;
import org.junit.Test;
......
......@@ -2,7 +2,7 @@ package com.bumptech.glide.load.resource.transcode;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
import com.bumptech.glide.tests.Util;
import org.junit.Test;
......
......@@ -2,7 +2,7 @@ package com.bumptech.glide.load.resource.transcode;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.load.resource.gif.GifData;
import com.bumptech.glide.load.resource.gifbitmap.GifBitmapWrapper;
import com.bumptech.glide.tests.Util;
......
package com.bumptech.glide.load.resource.transcode;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.load.resource.gif.GifData;
import com.bumptech.glide.tests.Util;
import org.junit.Before;
......
package com.bumptech.glide.load.resource.transcode;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.load.resource.gif.GifData;
import com.bumptech.glide.load.resource.gif.GifDrawable;
import com.bumptech.glide.tests.Util;
......
package com.bumptech.glide.load.resource.transcode;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.tests.Util;
import org.junit.Test;
......
......@@ -6,7 +6,7 @@ import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import com.bumptech.glide.Priority;
import com.bumptech.glide.Resource;
import com.bumptech.glide.load.engine.Resource;
import com.bumptech.glide.load.ResourceDecoder;
import com.bumptech.glide.load.ResourceEncoder;
import com.bumptech.glide.load.Transformation;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册