Skip to content

Instantly share code, notes, and snippets.

View yairkukielka's full-sized avatar

Yair Kukielka yairkukielka

  • Open Assessment Technologies
  • Madrid
View GitHub Profile
public class GlueItemsAdapter extends RecyclerArrayAdapter<GlueItem, GlueItemsAdapter.Holder> {
public GlueItemsAdapter(LayoutInflater inflater) {
super(inflater);
}
@Override
protected Holder onCreateViewHolder(LayoutInflater inflater, ViewGroup parent, int viewType) {
return new Holder(inflater.inflate(android.R.layout.simple_list_item_1, parent, false));
@mttkay
mttkay / Pager.java
Created November 4, 2015 15:46
A simple Rx based pager
public class Pager<I, O> {
private static final Observable FINISH_SEQUENCE = Observable.never();
private PublishSubject<Observable<I>> pages;
private Observable<I> nextPage = finish();
private Subscription subscription = Subscriptions.empty();
private final PagingFunction<I> pagingFunction;
private final Func1<I, O> pageTransformer;
import java.util.Arrays;
import java.util.List;
import javax.xml.ws.Response;
import rx.Observable;
import rx.subjects.BehaviorSubject;
public final class Demo {
interface Response {
@futtetennista
futtetennista / ThreadPoolIdlingResource.java
Last active October 12, 2016 23:53
Code taken from Espresso's AsyncTaskPoolMonitor and adapter to be used as an idling resource for any ThreadPoolExecutor
/*
* Copyright (C) 2013 Google, 2014 Stefano Dacchille
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software