Пример #1
0
  /**
   * Checks the file clicked over. Browses inside if it is a directory. Notifies the container
   * activity in any case.
   */
  @Override
  public void onItemClick(AdapterView<?> l, View v, int position, long id) {
    File file = (File) mAdapter.getItem(position);
    if (file != null) {
      /// Click on a directory
      if (file.isDirectory()) {
        // just local updates
        listDirectory(file);
        // notify the click to container Activity
        mContainerActivity.onDirectoryClick(file);
        // save index and top position
        saveIndexAndTopPosition(position);

      } else { /// Click on a file
        ImageView checkBoxV = (ImageView) v.findViewById(R.id.custom_checkbox);
        if (checkBoxV != null) {
          if (((ListView) getListView()).isItemChecked(position)) {
            checkBoxV.setImageResource(R.drawable.ic_checkbox_marked);
          } else {
            checkBoxV.setImageResource(R.drawable.ic_checkbox_blank_outline);
          }
        }
        // notify the change to the container Activity
        mContainerActivity.onFileClick(file);
      }

    } else {
      Log_OC.w(TAG, "Null object in ListAdapter!!");
    }
  }
Пример #2
0
  /** {@inheritDoc} */
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {
    Log_OC.i(TAG, "onActivityCreated() start");

    super.onActivityCreated(savedInstanceState);
    mAdapter = new LocalFileListAdapter(mContainerActivity.getInitialDirectory(), getActivity());
    setListAdapter(mAdapter);

    Log_OC.i(TAG, "onActivityCreated() stop");
  }