If you think the Android project TAQueue 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.familybiz.greg.taqueue.view.queue;
//www.java2s.comimport android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import com.familybiz.greg.taqueue.MainActivity;
import com.familybiz.greg.taqueue.R;
/**
* Created by Greg Anderson
*/publicclass ColorableStudentArrayAdapter extends ArrayAdapter<String> {
privateint[] mColors;
public ColorableStudentArrayAdapter(Context context, int resource) {
super(context, resource);
mColors = getContext().getResources().getIntArray(R.array.ta_colors);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
TextView textView = (TextView)super.getView(position, convertView, parent);
// Check if student is being helped
String nameLocation = super.getItem(position);
String[] items = MainActivity.getNameAndLocation(nameLocation);
String name = items[0];
String location = items[1];
int taLocation = QueueFragment.indexOfHelpingTA(name, location);
if (taLocation != -1)
textView.setBackgroundColor(mColors[taLocation]);
else
textView.setBackgroundColor(getContext().getResources().getColor(R.color.light_background_color));
return textView;
}
}