예제 #1
0
  public boolean onListItemLongClick(GridView l, View v, int position, long id) {
    if (nActions != null || getFolderId() != null) {
      return false;
    }

    Cursor cursor = (Cursor) l.getItemAtPosition(position);
    String documentId = cursor.getString(SyncContentSchema.COLUMN_NODE_ID_ID);

    selectedItems.clear();
    selectedItems.add(documentId);

    // Start the CAB using the ActionMode.Callback defined above
    nActions = new NodeIdActions(SyncFragment.this, selectedItems);
    nActions.setOnFinishModeListener(
        new AbstractActions.onFinishModeListener() {
          @Override
          public void onFinish() {
            nActions = null;
            selectedItems.clear();
            adapter.notifyDataSetChanged();
            ((SyncCursorAdapter) adapter).refresh();
            gv.setAdapter(adapter);
            displayFab(-1, null);
          }
        });

    displayFab(R.drawable.ic_done_all_white, onMultiSelectionFabClickListener());
    getActivity().startActionMode(nActions);
    adapter.notifyDataSetChanged();

    return true;
  }
예제 #2
0
 @Override
 public void selectAll() {
   if (nActions != null && adapter != null) {
     displayFab(R.drawable.ic_close_dark, onCancelMultiSelectionFabClickListener());
     nActions.selectNodes(((SyncCursorAdapter) adapter).getNodes());
     adapter.notifyDataSetChanged();
   }
 }