See SO answer.
You can pan (click background), zoom (mousewheel), drag nodes around. Middle click to add more nodes (at mouse).
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; |
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) { |
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"; } | |
} |
class DrawableBitmapResourceDecoder implements ResourceDecoder<Drawable, Bitmap> { | |
private final BitmapPool pool; | |
public DrawableBitmapResourceDecoder(Context context) { | |
this(Glide.get(context).getBitmapPool()); | |
} | |
public DrawableBitmapResourceDecoder(BitmapPool pool) { | |
this.pool = pool; | |
} | |
@Override public Resource<Bitmap> decode(Drawable drawable, int width, int height) throws IOException { |
class BitmapBitmapResourceDecoder implements ResourceDecoder<Bitmap, Bitmap> { | |
private final BitmapPool pool; | |
public BitmapBitmapResourceDecoder(Context context) { | |
this(Glide.get(context).getBitmapPool()); | |
} | |
public BitmapBitmapResourceDecoder(BitmapPool pool) { | |
this.pool = pool; | |
} | |
@Override public Resource<Bitmap> decode(Bitmap source, int width, int height) throws IOException { |
package net.twisterrob.android.view; | |
import android.content.Context; | |
import android.util.AttributeSet; | |
import android.widget.FrameLayout; | |
public class SquareFrameLayout extends FrameLayout { | |
public SquareFrameLayout(Context context) { | |
super(context); | |
} |
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 { |
package problems.tushar; | |
import java.util.*; | |
import java.util.function.Predicate; | |
import java.util.stream.*; | |
import static problems.tushar.TravelingSalesmanHeldKarpX.Algo.*; | |
import static problems.tushar.TravelingSalesmanHeldKarpX.Utils.*; | |
/** |
// TODO add <meta-data android:value="GlideModule" android:name="....OkHttpProgressGlideModule" /> | |
// TODO add <meta-data android:value="GlideModule" tools:node="remove" android:name="com.bumptech.glide.integration.okhttp.OkHttpGlideModule" /> | |
// or not use 'okhttp@aar' in Gradle depdendencies | |
public class OkHttpProgressGlideModule implements GlideModule { | |
@Override public void applyOptions(Context context, GlideBuilder builder) { } | |
@Override public void registerComponents(Context context, Glide glide) { | |
OkHttpClient client = new OkHttpClient(); | |
client.networkInterceptors().add(createInterceptor(new DispatchingProgressListener())); | |
glide.register(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory(client)); | |
} |
See SO answer.
You can pan (click background), zoom (mousewheel), drag nodes around. Middle click to add more nodes (at mouse).