예제 #1
0
  private void onClickCopy() {
    ArrayList<Integer> list = mAdapter.getCheckedListIndex();

    if (list.isEmpty()) {
      Toast.makeText(this.getActivity(), R.string.prompt_choicefile, Global.PROMPT_TIME).show();
      return;
    }

    Global.removeAllClipboardFile();
    try {
      for (int i = 0; i < list.size(); i++) {
        int index = list.get(i);
        FileInfo f = mFileList.get(index);
        fileToClipboard(f);
      }
    } catch (Exception e) {
      Global.removeAllClipboardFile();
      e.printStackTrace();
      Log.e("RemoteFileListFragment", "onClickCopy fail.");
      return;
    }

    Common.setClipboard(this);
  }
예제 #2
0
  /* 响应长按menu的点击事件 */
  public boolean onContextItemSelected(MenuItem item) {
    AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();

    Global.removeAllClipboardFile();
    FileInfo f = (FileInfo) mAdapter.getItem(info.position);
    try {
      fileToClipboard(f);
      Common.setClipboard(this);
    } catch (Exception e) {
      e.printStackTrace();
      Log.e("onContextItemSelected", "Long press copy fail:" + e.getMessage());
    }

    return false;
  }