Skip to content

Instantly share code, notes, and snippets.

@ninadmg
ninadmg / SingleThreadScheduler.java
Created May 15, 2017 09:32
a single thread Scheduler that can be used for realm read and writes
public class SingleThreadScheduler {
private static final SingleThreadScheduler ourInstance = new SingleThreadScheduler();
private static Scheduler scheduler = Schedulers.from(Executors.newSingleThreadExecutor());
/**Returns a single thread Scheduler that can be used for realm read and writes
*
* @return returns a Scheduler that works on single thread
*/
public static Scheduler disk()
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.BitmapShader;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.RectF;
import android.graphics.Shader;
// enables hardware accelerated rounded corners
// original idea here : http://www.curious-creature.org/2012/12/11/android-recipe-1-image-with-rounded-corners/