@Override public View getView(int position, View convertView, ViewGroup parent) { final Channel item = getItem(position); if (convertView == null) { convertView = mInflater.inflate(R.layout.item_program_layout, null); } TextView name = (TextView) convertView.findViewById(R.id.programe_name); ImageView lock = (ImageView) convertView.findViewById(R.id.programe_lock); if (item.isSelected()) { convertView.setBackgroundColor(selectColor); } else { convertView.setBackgroundColor(Color.TRANSPARENT); } if (item.isLocked()) { lock.setVisibility(View.VISIBLE); } else { lock.setVisibility(View.INVISIBLE); } name.setText(item.getName()); return convertView; }
protected int getCurrentSelected() { for (int index = 0, size = mList.size(); index < size; index++) { Channel program = mList.get(index); if (program.isSelected()) { return index; } } return mList.isEmpty() ? -1 : 0; }
public void reset() { for (Channel program : mList) { program.setSelected(false); } }