Skip to content

Instantly share code, notes, and snippets.

@webserveis
Created September 28, 2016 19:27
Show Gist options
  • Save webserveis/0d00ddb5b9535f8856512a267e724e23 to your computer and use it in GitHub Desktop.
Save webserveis/0d00ddb5b9535f8856512a267e724e23 to your computer and use it in GitHub Desktop.
package app.descubrirosona.lite.adapters;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import io.realm.RealmObject;
import io.realm.RealmResults;
public abstract class RealmRecyclerViewAdapter<T extends RealmObject, VH extends RecyclerView.ViewHolder>
extends RecyclerView.Adapter<VH> {
private RealmResults<T> realmResults;
protected Context context;
public RealmRecyclerViewAdapter(Context context, RealmResults<T> realmResults) {
if (context == null) {
throw new IllegalArgumentException("Context cannot be null");
}
if (realmResults == null) {
throw new IllegalArgumentException("RealmResults cannot be null");
}
this.realmResults = realmResults;
this.context = context;
}
@Override
public int getItemCount() {
return realmResults.size();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment