Android Open Source - iwannawatch-android Cursor Movies Adapter






From Project

Back to project page iwannawatch-android.

License

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.

Java Source Code

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();
    }
}




Java Source Code List

com.meoyawn.iwannawatch.AppModule.java
com.meoyawn.iwannawatch.App.java
com.meoyawn.iwannawatch.CrashReportingTree.java
com.meoyawn.iwannawatch.DynamicHeightImageView.java
com.meoyawn.iwannawatch.MainActivity.java
com.meoyawn.iwannawatch.MainFragment.java
com.meoyawn.iwannawatch.MovieView.java
com.meoyawn.iwannawatch.adapters.BaseMoviesAdapter.java
com.meoyawn.iwannawatch.adapters.CursorMoviesAdapter.java
com.meoyawn.iwannawatch.adapters.DynamicMoviesAdapter.java
com.meoyawn.iwannawatch.doers.DatabaseHelper.java
com.meoyawn.iwannawatch.doers.TheMovieDbApi.java
com.meoyawn.iwannawatch.models.Movie.java
com.meoyawn.iwannawatch.models.Search.java
com.meoyawn.iwannawatch.qualifiers.Delete.java
com.meoyawn.iwannawatch.qualifiers.Done.java