package org.gdg.frisbee.android.adapter;

import android.content.Context;
import android.graphics.Bitmap;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.squareup.picasso.Target;
import com.squareup.picasso.Transformation;
import org.gdg.frisbee.android.R;
import org.gdg.frisbee.android.api.model.Contributor;
import org.gdg.frisbee.android.app.App;
import org.gdg.frisbee.android.graphics.drawable.RoundCornerDrawable;

/**
 * Created with IntelliJ IDEA.
 * User: maui
 * Date: 08.07.13
 * Time: 02:28
 * To change this template use File | Settings | File Templates.
 */
public class ContributorAdapter extends ArrayAdapter<Contributor> {

    private Context mContext;
    private LayoutInflater mInflater;

    public ContributorAdapter(Context context, int textViewResourceId) {
        super(context, textViewResourceId);
        mContext = context;
        mInflater = LayoutInflater.from(mContext);
    }

    @Override
    public View getView(int position, View view, ViewGroup parent) {
        if(view == null)
            view = mInflater.inflate(R.layout.contributor_item, null);

        Contributor contributor = getItem(position);

        TextView name = (TextView)view.findViewById(R.id.contributorName);
        name.setText(contributor.getLogin());
        final ImageView c = (ImageView) view.findViewById(R.id.contributorIcon);
        App.getInstance().getPicasso()
                .load(contributor.getAvatarUrl())
                .into(c);

        return view;
    }
}

@@ -71,66 +71,8 @@
 xt;%0A
-import android.graphics.Bitmap;%0Aimport android.text.Html;%0A
 impo
@@ -99,24 +99,24 @@
 utInflater;%0A
+
 import andro
@@ -265,88 +265,39 @@
 ew;%0A
+%0A
 import 
-com.squareup.picasso.Target;%0Aimport com.squareup.picasso.Transforma
+java.util.Collec
 tion;%0A
+%0A
 impo
@@ -380,16 +380,16 @@
 ibutor;%0A
+
 import o
@@ -423,78 +423,8 @@
 App;
-%0Aimport org.gdg.frisbee.android.graphics.drawable.RoundCornerDrawable;
 %0A%0A/*
@@ -1491,11 +1491,180 @@
 w;%0A    %7D
+%0A%0A    @Override%0A    public void addAll(Collection%3C? extends Contributor%3E contributors) %7B%0A        for (Contributor c : contributors) %7B%0A            add(c);%0A        %7D%0A    %7D
 %0A%7D%0A

fix crash on API 10