@@ -0,0 +1,3318 @@
+package com.beepscore.android.spotifystreamer;%0A%0Aimport android.app.Activity;%0Aimport android.view.LayoutInflater;%0Aimport android.view.View;%0Aimport android.view.ViewGroup;%0Aimport android.widget.ArrayAdapter;%0Aimport android.widget.ImageView;%0Aimport android.widget.TextView;%0A%0Aimport com.squareup.picasso.Picasso;%0A%0Aimport java.util.List;%0A%0Aimport kaaes.spotify.webapi.android.models.AlbumSimple;%0Aimport kaaes.spotify.webapi.android.models.Image;%0Aimport kaaes.spotify.webapi.android.models.Track;%0A%0A/**%0A * Created by stevebaker on 7/7/15.%0A * Reference%0A * https://github.com/udacity/android-custom-arrayadapter%0A */%0Apublic class TracksArrayAdapter extends ArrayAdapter%3CTrack%3E %7B%0A%0A    /**%0A     * Custom constructor (it doesn't mirror a superclass constructor).%0A     * @param context The current context. Used to inflate the layout file.%0A     * @param tracksList A List of Track objects to display%0A     */%0A    public TracksArrayAdapter(Activity context, List%3CTrack%3E tracksList) %7B%0A        // Initialize the ArrayAdapter's internal storage for the context and the list.%0A        // ArrayAdapter uses the second argument when populating a single TextView.%0A        // ArtistsArrayAdapter is not going to use the second argument, so it can be any value. Here, we used 0.%0A        super(context, 0, tracksList);%0A    %7D%0A%0A    /**%0A     * Provides a view for an AdapterView (ListView, GridView, etc.)%0A     *%0A     * @param position    The AdapterView position that is requesting a view%0A     * @param convertView The recycled view to populate.%0A     *                    (search online for %22android view recycling%22 to learn more)%0A     * @param parent The parent ViewGroup that is used for inflation.%0A     * @return The View for the position in the AdapterView.%0A     */%0A    @Override%0A    public View getView(int position, View convertView, ViewGroup parent) %7B%0A        // Gets the Track object from the ArrayAdapter at the appropriate position%0A        Track track = getItem(position);%0A%0A        // Adapters recycle views to AdapterViews.%0A        // If this is a new View object we're getting, then inflate the layout.%0A        // If not, this view already has the layout inflated from a previous call to getView,%0A        // and we modify the View widgets as usual.%0A        if (convertView == null) %7B%0A            convertView = LayoutInflater.from(getContext()).inflate(R.layout.tracks_list_item, parent, false);%0A        %7D%0A%0A        ImageView imageView = (ImageView) convertView.findViewById(R.id.list_item_imageview);%0A        loadTrackImageView(track, imageView);%0A%0A        TextView trackNameView = (TextView) convertView.findViewById(R.id.list_item_textview);%0A        trackNameView.setText(track.name);%0A%0A        return convertView;%0A    %7D%0A%0A    private void loadTrackImageView(Track track, ImageView imageView) %7B%0A        // https://github.com/kaaes/spotify-web-api-android/blob/master/src/main/java/kaaes/spotify/webapi/android/models/Image.java%0A        AlbumSimple album = track.album;%0A        List%3CImage%3E images = album.images;%0A%0A        if (images.size() %3E 0) %7B%0A            // get the last image because images is sorted decreasing size%0A            Image lastImage = images.get(images.size() - 1);%0A            String lastImageUrlString = lastImage.url;%0A            Picasso.with(getContext()).load(lastImageUrlString).into(imageView);%0A        %7D%0A    %7D%0A%0A%7D%0A

Add TracksArrayAdapter.