private void deletefiles() { if (mFileListFilter.size() > 0) { final ArrayList<FileBean> mDelFiles = new ArrayList<FileBean>(); for (int i = 0; i < mFileListFilter.size(); i++) { FileBean tmpInfo = mFileListFilter.get(i); if (tmpInfo.isChecked()) { mDelFiles.add(tmpInfo); } } if (mDelFiles.size() > 0) { new AlertDialog.Builder(m_act) .setTitle(m_act.getString(R.string.msg_dialog_info_title)) .setMessage(m_act.getString(R.string.msg_delselectfile)) .setPositiveButton( m_act.getString(R.string.ok), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { SysEng.getInstance().addEvent(new delFileEvent(m_act, mDelFiles)); } }) .setNegativeButton(m_act.getString(R.string.cancel), null) .show(); return; } } Toast.makeText(m_act, m_act.getString(R.string.msg_please_del_operate_file), Toast.LENGTH_SHORT) .show(); }
public void onItemClick(AdapterView<?> parent, View view, int position, long id) { FileBean temp = mFileListFilter.get(position); if (temp != null) { final File mFile = temp.getFile(); SysEng.getInstance().addEvent(new FavoriteFileEvent(m_act, temp, 1)); // 如果该文件是可读的,我们进去查看文件 if (mFile.isDirectory()) { if (mFile.canRead()) { FileManager.getInstance().setFilePath(mFile.getPath()); KMainPage.mKMainPage.ChangePage(KMainPage.Local, null); } else { // 如果该文件不可读,我们给出提示不能访问,防止用户操作系统文件造成系统崩溃等 Toast.makeText(m_act, "该文件夹不存在或权限不够!", Toast.LENGTH_SHORT).show(); } } else { if (mFile.canRead()) { if (!mFile.exists()) { Toast.makeText(m_act, "未找到该文件!", Toast.LENGTH_SHORT).show(); return; } SysEng.getInstance().addHandlerEvent(new openDefFileEvent(m_act, mFile.getPath())); } else { // 如果该文件不可读,我们给出提示不能访问,防止用户操作系统文件造成系统崩溃等 Toast.makeText(m_act, "对不起,访问权限不够!", Toast.LENGTH_SHORT).show(); } } } }
private void SelectAll() { if (mFileListFilter.size() >= 1) { boolean check = !mFileListFilter.get(0).isChecked(); for (int i = 0; i < mFileListFilter.size(); i++) { FileBean tmpInfo = mFileListFilter.get(i); tmpInfo.setChecked(check); } fileAdapter.notifyDataSetChanged(); } }