Merge pull request #384 from meskio/383_batch_selection

Add deselect to batch selection mode
This commit is contained in:
Moxie Marlinspike 2013-10-20 16:59:41 -07:00
commit 798e3c0656
2 changed files with 8 additions and 4 deletions

View file

@ -69,9 +69,13 @@ public class ConversationListAdapter extends CursorAdapter implements AbsListVie
}
}
public void addToBatchSet(long threadId) {
public void toggleThreadInBatchSet(long threadId) {
if (batchSet.contains(threadId)) {
batchSet.remove(threadId);
} else {
batchSet.add(threadId);
}
}
public Set<Long> getBatchSelections() {
return batchSet;

View file

@ -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;