Android Open Source - Movie-Mania Actors Adapter






From Project

Back to project page Movie-Mania.

License

The source code is released under:

MIT License

If you think the Android project Movie-Mania 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.appacitive.moviemania.app;
/*  ww w.j  a  v  a 2  s.c o  m*/
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.appacitive.core.AppacitiveObject;
import com.squareup.picasso.Picasso;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by sathley on 4/25/2014.
 */
public class ActorsAdapter extends BaseAdapter {

    List<Actor> mActorList = new ArrayList<Actor>();
    Context mContext;
    public ActorsAdapter(Context context, List<Actor> actors)
    {
        this.mActorList = actors;
        this.mContext = context;
    }
    @Override
    public int getCount() {
        return mActorList.size();
    }

    @Override
    public Object getItem(int i) {
        return mActorList.get(i);
    }

    @Override
    public long getItemId(int i) {
        return 0;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        LayoutInflater li = LayoutInflater.from(mContext);
        View actorItem = li.inflate(R.layout.actors_list_item, null, false);
        ImageView posterView = (ImageView) actorItem.findViewById(R.id.image_actor);
        TextView nameView = (TextView) actorItem.findViewById(R.id.actor_name);

        Actor actor = (Actor)getItem(i);
        nameView.setText(actor.mName);
        Picasso.with(mContext)
                .load(actor.mUrl)
//                .placeholder(R.drawable.placeholder)
                .into(posterView);

        return actorItem;
    }
}




Java Source Code List

com.appacitive.moviemania.app.Actor.java
com.appacitive.moviemania.app.ActorsAdapter.java
com.appacitive.moviemania.app.DetailsActivity.java
com.appacitive.moviemania.app.MainActivity.java
com.appacitive.moviemania.app.MovieAdapter.java
com.appacitive.moviemania.app.Movie.java