Android Open Source - iwannawatch-android Base 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 .  jav  a 2 s  . c  o m
import android.content.Context;
import android.database.Cursor;
import android.support.v4.widget.CursorAdapter;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.meoyawn.iwannawatch.MovieView;
import com.meoyawn.iwannawatch.models.Movie;

import org.jetbrains.annotations.NotNull;

/**
 * Created by adel on 3/1/14
 */
public abstract class BaseMoviesAdapter extends CursorAdapter {
    private final LayoutInflater inflater;

    public BaseMoviesAdapter(Context context, LayoutInflater inflater) {
        super(context, null, false);
        this.inflater = inflater;
    }

    @Override public abstract int getCount();

    @Override public abstract Movie getItem(int position);

    @Override public View newView(Context context, Cursor cursor, ViewGroup parent) { return null; }

    @Override public void bindView(View view, Context context, Cursor cursor) { }

    @Override public View getView(int position, View convertView, ViewGroup parent) {
        if (convertView == null) {
            convertView = inflater.inflate(getItemLayoutRes(), parent, false);
        }
        @NotNull MovieView movieView = (MovieView) convertView;
        movieView.draw(getItem(position));
        return movieView;
    }

    protected abstract int getItemLayoutRes();
}




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