/** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.app_left_panel);

    PassCodeDialogFragment f = PassCodeDialogFragment.requestPasscode();
    FragmentDisplayer.replaceFragment(
        this, f, DisplayUtils.getLeftFragmentId(this), UploadFormFragment.TAG, false, false);
  }
  // ///////////////////////////////////////////////////////////////////////////
  // LIST ACTIONS
  // ///////////////////////////////////////////////////////////////////////////
  public void onListItemClick(GridView l, View v, int position, long id) {
    Cursor cursor = (Cursor) l.getItemAtPosition(position);
    String nodeId = cursor.getString(SynchroSchema.COLUMN_NODE_ID_ID);
    String documentName = cursor.getString(SynchroSchema.COLUMN_TITLE_ID);

    if (DisplayUtils.hasCentralPane(getActivity())) {
      FragmentDisplayer.removeFragment(
          getActivity(), 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();
    } else if (nActions == null) {
      if (SynchroManager.isFolder(cursor)) {
        selectedItems.clear();
        if (SynchroManager.getInstance(getActivity()).hasActivateSync(acc)) {
          // GO TO Local subfolder
          Fragment syncFrag = FavoritesSyncFragment.newInstance(getMode(), nodeId, documentName);
          FragmentDisplayer.replaceFragment(
              getActivity(),
              syncFrag,
              DisplayUtils.getLeftFragmentId(getActivity()),
              FavoritesSyncFragment.TAG,
              true);
        } else {
          ((MainActivity) getActivity()).addNavigationFragmentById(nodeId);
        }
      } else {
        // Show properties
        ((MainActivity) getActivity()).addPropertiesFragment(true, nodeId);
        DisplayUtils.switchSingleOrTwo(getActivity(), true);
      }
    }
    adapter.notifyDataSetChanged();
  }