diff --git a/src/org/thoughtcrime/securesms/ConversationListAdapter.java b/src/org/thoughtcrime/securesms/ConversationListAdapter.java index 7349b0441..54ecc2ed6 100644 --- a/src/org/thoughtcrime/securesms/ConversationListAdapter.java +++ b/src/org/thoughtcrime/securesms/ConversationListAdapter.java @@ -69,8 +69,12 @@ public class ConversationListAdapter extends CursorAdapter implements AbsListVie } } - public void addToBatchSet(long threadId) { - batchSet.add(threadId); + public void toggleThreadInBatchSet(long threadId) { + if (batchSet.contains(threadId)) { + batchSet.remove(threadId); + } else { + batchSet.add(threadId); + } } public Set getBatchSelections() { diff --git a/src/org/thoughtcrime/securesms/ConversationListFragment.java b/src/org/thoughtcrime/securesms/ConversationListFragment.java index 6ffa43d8a..2e516279b 100644 --- a/src/org/thoughtcrime/securesms/ConversationListFragment.java +++ b/src/org/thoughtcrime/securesms/ConversationListFragment.java @@ -106,7 +106,7 @@ public class ConversationListFragment extends SherlockListFragment headerView.getDistributionType()); } else { ConversationListAdapter adapter = (ConversationListAdapter)getListAdapter(); - adapter.addToBatchSet(headerView.getThreadId()); + adapter.toggleThreadInBatchSet(headerView.getThreadId()); adapter.notifyDataSetChanged(); } } @@ -146,7 +146,7 @@ public class ConversationListFragment extends SherlockListFragment batchMode = true; adapter.initializeBatchMode(true); - adapter.addToBatchSet(((ConversationListItem) v).getThreadId()); + adapter.toggleThreadInBatchSet(((ConversationListItem) v).getThreadId()); adapter.notifyDataSetChanged(); return true;