コード例 #1
0
 @Override
 void toggleSelection(String id) {
   if (id != null) {
     if (selectedIds.contains(id)) {
       selectedIds.remove(id);
     } else {
       selectedIds.add(id);
     }
   }
 }
コード例 #2
0
  public List<T> getGraphObjectsById(Collection<String> ids) {
    Set<String> idSet = new HashSet<String>();
    idSet.addAll(ids);

    ArrayList<T> result = new ArrayList<T>(idSet.size());
    for (String id : idSet) {
      T graphObject = graphObjectsById.get(id);
      if (graphObject != null) {
        result.add(graphObject);
      }
    }

    return result;
  }
コード例 #3
0
 @Override
 void saveSelectionToBundle(Bundle outBundle, String key) {
   if (!selectedIds.isEmpty()) {
     String ids = TextUtils.join(",", selectedIds);
     outBundle.putString(key, ids);
   }
 }
コード例 #4
0
 @Override
 void readSelectionFromBundle(Bundle inBundle, String key) {
   if (inBundle != null) {
     String ids = inBundle.getString(key);
     if (ids != null) {
       String[] splitIds = TextUtils.split(ids, ",");
       selectedIds.clear();
       Collections.addAll(selectedIds, splitIds);
     }
   }
 }
コード例 #5
0
 @Override
 boolean isEmpty() {
   return selectedIds.isEmpty();
 }
コード例 #6
0
 @Override
 public void clear() {
   selectedIds.clear();
 }
コード例 #7
0
 @Override
 boolean isSelected(String id) {
   return id != null && selectedIds.contains(id);
 }