Created
September 28, 2016 19:27
-
-
Save webserveis/0d00ddb5b9535f8856512a267e724e23 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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