@Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { if (mMode != null) { // mAdapter.checked(position); CheckBox cb = (CheckBox) view.findViewById(R.id.download_checked); cb.setChecked(!cb.isChecked()); } else { DownloadJob item = mAdapter.getItem(position); if (item != null) { startToPlay(item.getEntry()); } } }
@Override public boolean onActionItemClicked(ActionMode mode, MenuItem item) { switch (item.getItemId()) { case R.id.menu_download_delete: int i = 0; for (DownloadJob job : mAdapter.getCheckedJobs()) { mDownloadMan.deleteDownload(job); i++; } AcApp.showToast("删除完毕 - 共" + i + "项"); break; case R.id.menu_download_resume: AcApp.showToast("继续"); for (DownloadJob job : mAdapter.getCheckedJobs()) { if (job.getProgress() != 100) { job.setListener(mDownloadService.mJobListener); job.resume(); mDownloadMan.getProvider().resume(job); } } break; case R.id.menu_download_pause: AcApp.showToast("暂停"); for (DownloadJob job : mAdapter.getCheckedJobs()) { if (DownloadManager.isRunningStatus(job.getStatus())) { job.setListener(mDownloadService.mJobListener); job.pause(); } } break; case R.id.menu_select_all: mAdapter.checkedAll(); break; } return true; }