Add method to remove conversation from DeckAdapter by position

This makes the following patch to remove old conversations much more
efficient.
This commit is contained in:
Steven Luo 2011-08-16 02:10:44 -07:00 committed by Sebastian Kaspari
parent fafbe1ca4a
commit c8266fbe62
1 changed files with 13 additions and 5 deletions

View File

@ -172,18 +172,26 @@ public class DeckAdapter extends BaseAdapter
/**
* Remove an item
*
* @param channel
* @param position
*/
public void removeItem(String target)
public void removeItem(int position)
{
int position = getPositionByName(target);
if (position != -1) {
if (position >= 0 && position < conversations.size()) {
conversations.remove(position);
notifyDataSetChanged();
}
}
/**
* Remove an item
*
* @param target
*/
public void removeItem(String target)
{
removeItem(getPositionByName(target));
}
/**
* Set single channel view
*