2013-06-04 09:37:53 +02:00
|
|
|
package com.thejoshwa.ultrasonic.androidapp.view;
|
|
|
|
|
|
|
|
import android.content.Context;
|
|
|
|
import android.view.View;
|
|
|
|
import android.view.ViewGroup;
|
|
|
|
import android.widget.ArrayAdapter;
|
|
|
|
|
|
|
|
import com.thejoshwa.ultrasonic.androidapp.service.DownloadFile;
|
|
|
|
|
2013-12-04 07:36:02 +01:00
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
public class SongListAdapter extends ArrayAdapter<DownloadFile>
|
|
|
|
{
|
|
|
|
Context context;
|
|
|
|
|
|
|
|
public SongListAdapter(Context context, final List<DownloadFile> entries)
|
|
|
|
{
|
|
|
|
super(context, android.R.layout.simple_list_item_1, entries);
|
|
|
|
this.context = context;
|
|
|
|
}
|
2013-06-04 09:37:53 +02:00
|
|
|
|
2013-12-04 07:36:02 +01:00
|
|
|
@Override
|
|
|
|
public View getView(final int position, final View convertView, final ViewGroup parent)
|
|
|
|
{
|
|
|
|
final SongView view;
|
|
|
|
view = convertView != null && convertView instanceof SongView ? (SongView) convertView : new SongView(this.context);
|
|
|
|
final DownloadFile downloadFile = getItem(position);
|
|
|
|
view.setSong(downloadFile.getSong(), false);
|
|
|
|
return view;
|
|
|
|
}
|
|
|
|
}
|