コード例 #1
0
 public static FavoritesSyncFragment newInstance(int mode) {
   FavoritesSyncFragment bf = new FavoritesSyncFragment();
   Bundle settings = new Bundle();
   settings.putInt(PARAM_MODE, mode);
   bf.setArguments(settings);
   return bf;
 }
コード例 #2
0
 public static FavoritesSyncFragment newInstance(int mode, String folderId, String folderName) {
   FavoritesSyncFragment bf = new FavoritesSyncFragment();
   Bundle settings = new Bundle();
   settings.putInt(PARAM_MODE, mode);
   settings.putString(PARAM_FOLDER_ID, folderId);
   settings.putString(PARAM_FOLDER_NAME, folderName);
   bf.setArguments(settings);
   return bf;
 }
コード例 #3
0
  // ///////////////////////////////////////////////////////////////////////////
  // 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();
  }