Java Code Examples for com.chad.library.adapter.base.BaseQuickAdapter#equals()
The following examples show how to use
com.chad.library.adapter.base.BaseQuickAdapter#equals() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SelectFileByBrowserActivity.java From FilePicker with MIT License | 5 votes |
@Override public void onItemClick(BaseQuickAdapter adapter, View view, int position) { if (adapter.equals(mAdapter)) { EssFile item = mAdapter.getData().get(position); if (item.isDirectory()) { //点击文件夹 //保存当前的垂直滚动位置 mBreadAdapter.getData().get(mBreadAdapter.getData().size() - 1).setPrePosition(mRecyclerView.computeVerticalScrollOffset()); executeListTask(mSelectedFileList, mCurFolder + item.getName() + File.separator, SelectOptions.getInstance().getFileTypes(), SelectOptions.getInstance().getSortType()); } else { //选中某文件后,判断是否单选 if (SelectOptions.getInstance().isSingle) { mSelectedFileList.add(item); Intent result = new Intent(); result.putParcelableArrayListExtra(Const.EXTRA_RESULT_SELECTION, mSelectedFileList); setResult(RESULT_OK, result); super.onBackPressed(); return; } if (mAdapter.getData().get(position).isChecked()) { int index = findFileIndex(item); if (index != -1) { mSelectedFileList.remove(index); } } else { if (mSelectedFileList.size() >= SelectOptions.getInstance().maxCount) { //超出最大可选择数量后 Snackbar.make(mRecyclerView, "您最多只能选择" + SelectOptions.getInstance().maxCount + "个。", Snackbar.LENGTH_SHORT).show(); return; } mSelectedFileList.add(item); } mAdapter.getData().get(position).setChecked(!mAdapter.getData().get(position).isChecked()); mAdapter.notifyItemChanged(position, ""); mCountMenuItem.setTitle(String.format(getString(R.string.selected_file_count), String.valueOf(mSelectedFileList.size()), String.valueOf(SelectOptions.getInstance().maxCount))); } } }
Example 2
Source File: SelectFileByBrowserActivity.java From FilePicker with MIT License | 5 votes |
@Override public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) { if (adapter.equals(mBreadAdapter) && view.getId() == R.id.btn_bread) { //点击某个路径时 String queryPath = FileUtils.getBreadModelListByPosition(mSdCardList, mBreadAdapter.getData(), position); if (mCurFolder.equals(queryPath)) { return; } executeListTask(mSelectedFileList, queryPath, SelectOptions.getInstance().getFileTypes(), SelectOptions.getInstance().getSortType()); } }
Example 3
Source File: SelectPictureActivity.java From FilePicker with MIT License | 5 votes |
@Override public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) { EssFile item = mMediaAdapter.getItem(position); if (!adapter.equals(mMediaAdapter)) { return; } if (view.getId() == R.id.check_view) { if (mSelectedFileList.size() >= SelectOptions.getInstance().maxCount && !item.isChecked()) { mMediaAdapter.notifyItemChanged(position, ""); Snackbar.make(mRecyclerView, "您最多只能选择" + SelectOptions.getInstance().maxCount + "个。", Snackbar.LENGTH_SHORT).show(); return; } boolean addSuccess = mSelectedFileList.add(mMediaAdapter.getItem(position)); if (addSuccess) { mMediaAdapter.getData().get(position).setChecked(true); } else { //已经有了就删掉 mSelectedFileList.remove(item); mMediaAdapter.getData().get(position).setChecked(false); } mMediaAdapter.notifyItemChanged(position, ""); mCountMenuItem.setTitle(String.format(getString(R.string.selected_file_count), String.valueOf(mSelectedFileList.size()), String.valueOf(mMaxCount))); } else if (view.getId() == R.id.media_thumbnail) { //预览 // TODO: 2018/3/7 预览照片 } else if (view.getId() == R.id.capture) { //照相 // TODO: 2018/3/7 自定义相机照相 } }
Example 4
Source File: SelectFileByBrowserActivity.java From AndroidDownload with Apache License 2.0 | 5 votes |
@Override public void onItemClick(BaseQuickAdapter adapter, View view, int position) { if (adapter.equals(mAdapter)) { EssFile item = mAdapter.getData().get(position); if (item.isDirectory()) { //点击文件夹 //保存当前的垂直滚动位置 mBreadAdapter.getData().get(mBreadAdapter.getData().size() - 1).setPrePosition(mRecyclerView.computeVerticalScrollOffset()); executeListTask(mSelectedFileList, mCurFolder + item.getName() + File.separator, SelectOptions.getInstance().getFileTypes(), SelectOptions.getInstance().getSortType()); } else { //选中某文件后,判断是否单选 if (SelectOptions.getInstance().isSingle) { mSelectedFileList.add(item); Intent result = new Intent(); result.putParcelableArrayListExtra(Const.EXTRA_RESULT_SELECTION, mSelectedFileList); setResult(RESULT_OK, result); super.onBackPressed(); return; } if (mAdapter.getData().get(position).isChecked()) { int index = findFileIndex(item); if (index != -1) { mSelectedFileList.remove(index); } } else { if (mSelectedFileList.size() >= SelectOptions.getInstance().maxCount) { //超出最大可选择数量后 Snackbar.make(mRecyclerView, "您最多只能选择" + SelectOptions.getInstance().maxCount + "个。", Snackbar.LENGTH_SHORT).show(); return; } mSelectedFileList.add(item); } mAdapter.getData().get(position).setChecked(!mAdapter.getData().get(position).isChecked()); mAdapter.notifyItemChanged(position, ""); mCountMenuItem.setTitle(String.format(getString(R.string.selected_file_count), String.valueOf(mSelectedFileList.size()), String.valueOf(SelectOptions.getInstance().maxCount))); } } }
Example 5
Source File: SelectFileByBrowserActivity.java From AndroidDownload with Apache License 2.0 | 5 votes |
@Override public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) { if (adapter.equals(mBreadAdapter) && view.getId() == R.id.btn_bread) { //点击某个路径时 String queryPath = FileUtils.getBreadModelListByPosition(mSdCardList, mBreadAdapter.getData(), position); if (mCurFolder.equals(queryPath)) { return; } executeListTask(mSelectedFileList, queryPath, SelectOptions.getInstance().getFileTypes(),SelectOptions.getInstance().getSortType()); } }
Example 6
Source File: SelectPictureActivity.java From AndroidDownload with Apache License 2.0 | 5 votes |
@Override public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) { EssFile item = mMediaAdapter.getItem(position); if (!adapter.equals(mMediaAdapter)) { return; } if (view.getId() == R.id.check_view) { if (mSelectedFileList.size() >= SelectOptions.getInstance().maxCount && !item.isChecked()) { mMediaAdapter.notifyItemChanged(position, ""); Snackbar.make(mRecyclerView, "您最多只能选择" + SelectOptions.getInstance().maxCount + "个。", Snackbar.LENGTH_SHORT).show(); return; } boolean addSuccess = mSelectedFileList.add(mMediaAdapter.getItem(position)); if (addSuccess) { mMediaAdapter.getData().get(position).setChecked(true); } else { //已经有了就删掉 mSelectedFileList.remove(item); mMediaAdapter.getData().get(position).setChecked(false); } mMediaAdapter.notifyItemChanged(position, ""); mCountMenuItem.setTitle(String.format(getString(R.string.selected_file_count), String.valueOf(mSelectedFileList.size()), String.valueOf(mMaxCount))); } else if (view.getId() == R.id.media_thumbnail) { //预览 // TODO: 2018/3/7 预览照片 } else if (view.getId() == R.id.capture) { //照相 // TODO: 2018/3/7 自定义相机照相 } }
Example 7
Source File: SelectFloderByBrowserActivity.java From AndroidDownload with Apache License 2.0 | 5 votes |
@Override public void onItemClick(BaseQuickAdapter adapter, View view, int position) { if (adapter.equals(mAdapter)) { EssFile item = mAdapter.getData().get(position); if (item.isDirectory()) { mSelectedFileList.clear(); mSelectedFileList.add(item); //点击文件夹 //保存当前的垂直滚动位置 mBreadAdapter.getData().get(mBreadAdapter.getData().size() - 1).setPrePosition(mRecyclerView.computeVerticalScrollOffset()); executeListTask(mSelectedFileList, mCurFolder + item.getName() + File.separator, SelectOptions.getInstance().getFileTypes(), SelectOptions.getInstance().getSortType()); } } }
Example 8
Source File: SelectFloderByBrowserActivity.java From AndroidDownload with Apache License 2.0 | 5 votes |
@Override public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) { if (adapter.equals(mBreadAdapter) && view.getId() == R.id.btn_bread) { //点击某个路径时 String queryPath = FileUtils.getBreadModelListByPosition(mSdCardList, mBreadAdapter.getData(), position); if (mCurFolder.equals(queryPath)) { return; } executeListTask(mSelectedFileList, queryPath, SelectOptions.getInstance().getFileTypes(),SelectOptions.getInstance().getSortType()); } }