This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static { | |
System.setOut(new java.io.PrintStream(new java.io.FilterOutputStream(System.out) { | |
int count = 10 * 1024; | |
@Override public void write(int b) throws IOException { | |
if (count > 0) { | |
super.write(b); | |
--count; | |
} | |
} | |
@Override public void write(byte[] b, int off, int len) throws IOException { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DrawableResoureDecoder implements ResourceDecoder<Drawable, Drawable> { | |
@Override public Resource<Drawable> decode(Drawable source, int width, int height) throws IOException { | |
return new DrawableResource<Drawable>(source) { | |
@Override public int getSize() { return 1; } | |
@Override public void recycle() { } | |
}; | |
} | |
@Override public String getId() { return "DrawableDrawableResourceDecoder"; } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.File; | |
import android.content.Context; | |
import com.bumptech.glide.load.engine.cache.*; | |
public final class ExternalCacheDiskCacheFactory implements DiskCache.Factory { | |
private final Context context; | |
private final String diskCacheName; | |
private final int diskCacheSize; | |
public ExternalCacheDiskCacheFactory(Context context, int diskCacheSize) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static boolean isFOSHoldingOnToFile() { | |
return !canDeleteCreatedFile() || !canRenameCreatedFile(); | |
} | |
public static boolean canDeleteCreatedFile() { | |
File temp = null; | |
try { | |
temp = File.createTempFile("canDeleteCreatedFile", null, Robolectric.application.getCacheDir()); | |
if(!temp.delete()) { | |
return false; |
NewerOlder