Skip to content

Instantly share code, notes, and snippets.

View McGalanes's full-sized avatar

Melwin Magalhães McGalanes

View GitHub Profile
@McGalanes
McGalanes / ImmediateSchedulersRule.java
Created June 2, 2017 11:27
Needed for Tests with RxJava Schedulers
import org.junit.rules.TestRule;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
import io.reactivex.plugins.RxJavaPlugins;
import io.reactivex.schedulers.Schedulers;
public class ImmediateSchedulersRule implements TestRule {
@Override
public class MainActivity extends AppCompatActivity {
//Handler & Thread
int mProgression = 0;
Handler mHandler = null;
private static final int WHAT_PROGRESSION = 1;
private boolean mStarted = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
/**
* @Author McGalanes
* @Email [email protected]
*/
public class LoadMoreAdapter extends RecyclerView.Adapter {
private final int VIEW_ITEM = 1;
private final int VIEW_PROG = 0;
private List<City> mCityList;
public static class CacheUtils {
public static boolean exists(Context context, String filename) {
return new File(context.getCacheDir(), filename).exists();
}
public static void write(Context context, String filename, final byte[] content, final boolean append) {
final File cache = new File(context.getCacheDir(), filename);
try {
/**
* Created by McGalanes on 02/12/2016.
*/
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Point;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.View;