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