예제 #1
0
  // ///////////////////////////////////////////////////////////////////////////
  // LIST ACTIONS
  // ///////////////////////////////////////////////////////////////////////////
  public void onListItemClick(GridView l, View v, int position, long id) {
    Cursor cursor = (Cursor) l.getItemAtPosition(position);
    String nodeId = cursor.getString(SyncContentSchema.COLUMN_NODE_ID_ID);
    String documentName = cursor.getString(SyncContentSchema.COLUMN_TITLE_ID);

    if (DisplayUtils.hasCentralPane(getActivity())) {
      FragmentDisplayer.with(getActivity())
          .remove(DisplayUtils.getCentralFragmentId(getActivity()));
    }

    Boolean hideDetails = false;
    if (!selectedItems.isEmpty()) {
      hideDetails = selectedItems.get(0).equals(nodeId);
    }
    l.setItemChecked(position, true);

    if (nActions != null) {
      nActions.selectNode(nodeId);
      if (selectedItems.size() == 0) {
        hideDetails = true;
      }
    } else {
      selectedItems.clear();
      if (!hideDetails && DisplayUtils.hasCentralPane(getActivity())) {
        selectedItems.add(nodeId);
      }
    }

    if (hideDetails) {
      selectedItems.clear();
      displayTitle();
    } else if (nActions == null) {
      if (SyncContentManager.isFolder(cursor)) {
        selectedItems.clear();
        if (SyncContentManager.getInstance(getActivity()).hasActivateSync(acc)) {
          // GO TO Local subfolder
          SyncFragment.with(getActivity())
              .mode(getMode())
              .folderIdentifier(nodeId)
              .folderName(documentName)
              .display();
        } else {
          DocumentFolderBrowserFragment.with(getActivity())
              .folderIdentifier(nodeId)
              .shortcut(true)
              .display();
        }
      } else {
        if (!ConnectivityUtils.hasInternetAvailable(getActivity())) {
          NodeDetailsFragment.with(getActivity())
              .node(getOfflineNode(nodeId))
              .isFavorite(true)
              .display();
        } else {
          NodeDetailsFragment.with(getActivity()).nodeId(nodeId).isFavorite(true).display();
        }
      }
    }
    adapter.notifyDataSetChanged();
  }
예제 #2
0
 protected static SyncFragment newInstanceByTemplate(Bundle b) {
   SyncFragment cbf = new SyncFragment();
   cbf.setArguments(b);
   return cbf;
 }