private void browseFilesButtonClick(byte fileType) {
   if (adapter != null) {
     savePreviouslyCheckedFileDescriptors();
     savePreviousFilter();
     saveListViewVisiblePosition(adapter.getFileType());
     adapter.clear();
   }
   filesBar.clearCheckAll();
   reloadFiles(fileType);
 }
  @Override
  protected void initComponents(View v) {
    filesBar = findView(v, R.id.fragment_browse_peer_files_bar);
    filesBar.setOnActionListener(
        new OnActionListener() {
          public void onCheckAll(View v, boolean isChecked) {
            if (adapter != null) {
              if (isChecked) {
                adapter.checkAll();
              } else {
                adapter.clearChecked();
              }
            }
          }

          public void onFilter(View v, String str) {
            if (adapter != null) {
              adapter.getFilter().filter(str);
            }
          }

          @Override
          public void onClear() {
            clearPreviousFilter();
          }
        });

    list = findView(v, R.id.fragment_browse_peer_list);
    list.setOverScrollListener(
        new OverScrollListener() {
          @Override
          public void onOverScrolled(int scrollX, int scrollY, boolean clampedX, boolean clampedY) {
            long now = SystemClock.elapsedRealtime();
            if (scrollY < 0 && clampedY && (now - lastAdapterRefresh) > 5000) {
              refreshSelection();
            }
          }
        });

    initRadioButton(v, R.id.fragment_browse_peer_radio_torrents, Constants.FILE_TYPE_TORRENTS);
    initRadioButton(v, R.id.fragment_browse_peer_radio_documents, Constants.FILE_TYPE_DOCUMENTS);
    initRadioButton(v, R.id.fragment_browse_peer_radio_pictures, Constants.FILE_TYPE_PICTURES);
    initRadioButton(v, R.id.fragment_browse_peer_radio_videos, Constants.FILE_TYPE_VIDEOS);
    initRadioButton(v, R.id.fragment_browse_peer_radio_ringtones, Constants.FILE_TYPE_RINGTONES);
    initRadioButton(v, R.id.fragment_browse_peer_radio_audio, Constants.FILE_TYPE_AUDIO);
  }
 private void savePreviousFilter() {
   if (!StringUtils.isNullOrEmpty(filesBar.getText())) {
     previousFilter = filesBar.getText();
   }
 }
 private void restorePreviousFilter() {
   if (previousFilter != null && filesBar != null) {
     filesBar.setText(previousFilter);
   }
 }