Back to project page iwannawatch-android.
The source code is released under:
MIT License
If you think the Android project iwannawatch-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.meoyawn.iwannawatch.adapters; /*from w w w . j a v a 2 s. com*/ import android.content.Context; import android.database.Cursor; import android.view.LayoutInflater; import com.meoyawn.iwannawatch.R; import com.meoyawn.iwannawatch.models.Movie; import org.jetbrains.annotations.NotNull; import lombok.Getter; import static nl.qbusict.cupboard.CupboardFactory.cupboard; /** * Created by adel on 3/1/14 */ public class CursorMoviesAdapter extends BaseMoviesAdapter { @NotNull @Getter Cursor cursor; public CursorMoviesAdapter(Context context, LayoutInflater inflater, @NotNull Cursor cursor) { super(context, inflater); this.cursor = cursor; } @Override public int getCount() { return cursor.getCount(); } @Override public Movie getItem(int position) { cursor.moveToPosition(position); return cupboard().withCursor(cursor).get(Movie.class); } @Override protected int getItemLayoutRes() { return R.layout.movie_item_grid; } public void setCursor(@NotNull Cursor cursor) { this.cursor.close(); this.cursor = cursor; notifyDataSetChanged(); } }