com.chad.library.adapter.base.BaseQuickAdapter Java Examples
The following examples show how to use
com.chad.library.adapter.base.BaseQuickAdapter.
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: AxgleFragment.java From v9porn with MIT License | 6 votes |
@Override public void onAttach(Activity activity) { super.onAttach(activity); axgleAdapter = new AxgleAdapter(R.layout.item_axgle); axgleAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() { @Override public void onItemClick(BaseQuickAdapter adapter, View view, int position) { Intent intent = new Intent(getContext(), AxglePlayActivity.class); AxgleVideo axgleVideo = (AxgleVideo) adapter.getItem(position); if (axgleVideo == null) { return; } intent.putExtra(Keys.KEY_INTENT_AXGLE_VIDEO_ITEM, axgleVideo); startActivityWithAnimation(intent); } }); axgleAdapter.setOnLoadMoreListener(new BaseQuickAdapter.RequestLoadMoreListener() { @Override public void onLoadMoreRequested() { loadData(false); } }, recyclerViewAxgle); }
Example #2
Source File: AccountFragment.java From AccountBook with GNU General Public License v3.0 | 6 votes |
/** * 初始化 Adapter */ private void initAdapter() { mRecyclerView.setLayoutManager(new GridLayoutManager(mContext, 5)); mTypeAdapter = new AccountTypeAdapter(R.layout.item_account_type, mCostTypes); mRecyclerView.setAdapter(mTypeAdapter); mRecyclerView.addOnItemTouchListener(new OnItemClickListener() { @Override public void onSimpleItemClick(BaseQuickAdapter adapter, View view, int position) { if(position == adapter.getData().size() - 1){// 自定义 Intent intent = new Intent(mContext, TypeEditActivity.class); intent.putExtra(AppConstants.EXTRA_ACCOUNT_TYPE, mAccount.getType()); startActivityForResult(intent, REQUEST_CODE_TYPE); }else{ setAccountType(position); } } }); }
Example #3
Source File: MainFragment.java From AccountBook with GNU General Public License v3.0 | 6 votes |
private void initAdapter() { mRefreshLayout.setOnRefreshListener(this); mRefreshLayout.setColorSchemeResources( UiUtils.getResourceId(mContext, R.attr.colorAccent, R.color.colorAccent)); mRecyclerView.setLayoutManager(new LinearLayoutManager(mContext)); mAdapter = new AccountListAdapter(new ArrayList<Account>()); mAdapter.setHeaderView(mHeadView); mAdapter.openLoadAnimation(BaseQuickAdapter.SCALEIN); mAdapter.setEmptyView(UiUtils.getEmptyView(mContext, mRecyclerView , UiUtils.getString(R.string.empty_account_data))); mAdapter.setOnLoadMoreListener(this, mRecyclerView); mRecyclerView.setAdapter(mAdapter); mRecyclerView.addOnItemTouchListener(new OnSimpleClickListener(){ @Override public void onItemLongClick(BaseQuickAdapter baseQuickAdapter, View view, int i) { Account account = (Account) baseQuickAdapter.getData().get(i); showOperateAccountDialog(account); } }); }
Example #4
Source File: BaseRecyclerViewAdapterHelperFragment.java From AndroidQuick with MIT License | 6 votes |
private void initAdapter2() { DemoAdapter mDemoAdapter = new DemoAdapter(mCBeanList); View header = getLayoutInflater().inflate(R.layout.item_headerview, (ViewGroup) mRecyclerView.getParent(), false); mDemoAdapter.addHeaderView(header); View footer = getLayoutInflater().inflate(R.layout.item_footerview, (ViewGroup) mRecyclerView.getParent(), false); mDemoAdapter.addFooterView(footer); mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); mRecyclerView.setHasFixedSize(true); mRecyclerView.setAdapter(mDemoAdapter); mRecyclerView.addOnItemTouchListener(new OnItemChildClickListener() { @Override public void onSimpleItemChildClick(BaseQuickAdapter baseQuickAdapter, View view, int i) { CBean bean = (CBean) baseQuickAdapter.getItem(i); switch (view.getId()) { case R.id.iv_img: Toast.makeText(mContext, bean.getText(), Toast.LENGTH_SHORT).show(); break; } } }); }
Example #5
Source File: CategoryFragment.java From enjoyshop with Apache License 2.0 | 6 votes |
private void showCategoryData() { mCategoryAdapter = new CategoryAdapter(categoryFirst); mCategoryAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() { @Override public void onItemClick(BaseQuickAdapter adapter, View view, int position) { Category category = (Category) adapter.getData().get(position); int id = category.getId(); String name = category.getName(); isclick = true; defaultClick(); requestWares(id); } }); mRecyclerView.setAdapter(mCategoryAdapter); mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); mRecyclerView.setItemAnimator(new DefaultItemAnimator()); mRecyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL)); }
Example #6
Source File: BaseListFragment.java From MeiBaseModule with Apache License 2.0 | 6 votes |
@Override protected void initView() { mAdapter = getAdapter(); RecyclerView recyclerView = getRecyclerView(); if (mAdapter == null || recyclerView == null) { return; } recyclerView.setAdapter(mAdapter); if (canLoadMore()) { mAdapter.setEnableLoadMore(true); mAdapter.setOnLoadMoreListener(new BaseQuickAdapter.RequestLoadMoreListener() { @Override public void onLoadMoreRequested() { loadPage(mAdapter.getPageCount() + 1); } }, recyclerView); } //是否首次加载 是否每次显示加载 if (loadOnInit() || !loadOnShow()) { loadPage(DataConstants.FIRST_PAGE); } }
Example #7
Source File: FeedCategoryRightAdapter.java From Focus with GNU General Public License v3.0 | 6 votes |
private void bindItemListener(){ this.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() { @Override public void onItemClick(BaseQuickAdapter adapter, View view, int position) { Website item = FeedCategoryRightAdapter.this.getData().get(position); Help help; if (!StringUtil.trim(item.getExtra()).equals("")){ help = new Help(true,item.getExtra()); }else { help = new Help(false); } FeedListPopView feedListPopView = new FeedListPopView(((FragmentActivity)activity).getSupportFragmentManager(),activity,item.getName(),"",help); new XPopup.Builder(activity) .enableDrag(false) .asCustom(feedListPopView) .show(); } }); }
Example #8
Source File: ScheduleCollectionFragment.java From AcgClub with MIT License | 6 votes |
@Override protected void initData() { mAdapter = new ScheduleCollectionAdapter(getMAppComponent().imageLoader()); rcvScheduleCollection.setLayoutManager(new GridLayoutManager(getContext(), 3)); rcvScheduleCollection.setAdapter(mAdapter); mAdapter.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(BaseQuickAdapter adapter, View view, int position) { ScheduleCache item = (ScheduleCache) adapter.getItem(position); RouterUtils.getInstance() .build(RouterConstants.PATH_SCHEDULE_DETAIL) .withString(IntentConstant.SCHEDULE_DETAIL_URL, item.getScheduleUrl()) .navigation(); } }); getScheduleCollections(); }
Example #9
Source File: CrashCatchActivity.java From DevUtils with Apache License 2.0 | 6 votes |
@Override public void initValues() { super.initValues(); // 初始化布局管理器、适配器 final ButtonAdapter buttonAdapter = new ButtonAdapter(ButtonList.getCrashButtonValues()); vid_bvr_recy.setAdapter(buttonAdapter); buttonAdapter.setOnItemChildClickListener(new OnItemChildClickListener() { @Override public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) { ButtonValue buttonValue = buttonAdapter.getItem(position); switch (buttonValue.type) { case ButtonValue.BTN_CRASH_CLICK_CATCH: // 模拟奔溃 String data = null; data.split(","); break; default: ToastTintUtils.warning("未处理 " + buttonValue.text + " 事件"); break; } } }); }
Example #10
Source File: FeedCategoryRightAdapter.java From Focus with GNU General Public License v3.0 | 6 votes |
private void bindItemListener(){ this.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() { @Override public void onItemClick(BaseQuickAdapter adapter, View view, int position) { Website item = FeedCategoryRightAdapter.this.getData().get(position); Help help; if (!StringUtil.trim(item.getExtra()).equals("")){ help = new Help(true,item.getExtra()); }else { help = new Help(false); } FeedListPopView feedListPopView = new FeedListPopView(((FragmentActivity)activity).getSupportFragmentManager(),activity,item.getName(),"",help); new XPopup.Builder(activity) .enableDrag(false) .asCustom(feedListPopView) .show(); } }); }
Example #11
Source File: AddressDelegate.java From FastWaiMai with MIT License | 6 votes |
@Override public void onItemClick(BaseQuickAdapter adapter, View view, int position) { final MultipleItemEntity entity = (MultipleItemEntity) adapter.getData().get(position); final String name = entity.getField(AddressItemFields.SURNAME); String surname = name.substring(0, 1); String genderText; final String phone = entity.getField(AddressItemFields.PHONE); final Boolean isDefault = entity.getField(AddressItemFields.DEFAULT); final Integer gender = entity.getField(AddressItemFields.GENDER); if(gender == 0){ genderText = "先生"; }else{ genderText = "女士"; } final Bundle bundle = new Bundle(); bundle.putString("address", surname + genderText +"("+phone+")"); getSupportDelegate().setFragmentResult(RESULT_OK, bundle); getSupportDelegate().onDestroy(); getSupportDelegate().pop(); }
Example #12
Source File: TypeCountDetailActivity.java From AccountBook with GNU General Public License v3.0 | 6 votes |
private void initAdapter() { mRefreshLayout.setOnRefreshListener(this); mRefreshLayout.setColorSchemeResources( UiUtils.getResourceId(mContext, R.attr.colorAccent, R.color.colorAccent)); mRecyclerView.setLayoutManager(new LinearLayoutManager(mContext)); mAdapter = new AccountListAdapter(new ArrayList<Account>()); mAdapter.openLoadAnimation(BaseQuickAdapter.SCALEIN); mAdapter.setEmptyView(UiUtils.getEmptyView(mContext, mRecyclerView , UiUtils.getString(R.string.empty_account_data))); mAdapter.setOnLoadMoreListener(this, mRecyclerView); mRecyclerView.setAdapter(mAdapter); mRecyclerView.addOnItemTouchListener(new OnSimpleClickListener(){ @Override public void onItemLongClick(BaseQuickAdapter baseQuickAdapter, View view, int i) { Account account = (Account) baseQuickAdapter.getData().get(i); showOperateAccountDialog(account); } }); }
Example #13
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 #14
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 #15
Source File: MovieBaseFragment.java From FastLib with Apache License 2.0 | 5 votes |
@Override public BaseQuickAdapter<SubjectsEntity, BaseViewHolder> getAdapter() { mAdapter = new SubjectMovieAdapter(ApiConstant.API_MOVIE_TOP.equals(mUrl)); // changeAdapterAnimation(0); // changeAdapterAnimationAlways(true); return mAdapter; }
Example #16
Source File: HomeThreeFragment.java From ImmersionBar with Apache License 2.0 | 5 votes |
@Override protected void initView() { refreshLayout.setEnableLoadmore(false); final LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false); mRv.setLayoutManager(linearLayoutManager); mOneAdapter = new OneAdapter(); mOneAdapter.openLoadAnimation(BaseQuickAdapter.SCALEIN); mRv.setAdapter(mOneAdapter); addHeaderView(); mOneAdapter.setPreLoadNumber(1); mOneAdapter.setNewData(mItemList); }
Example #17
Source File: HistoryActivity.java From Aurora with Apache License 2.0 | 5 votes |
@Override public void setData(List<VideoDaoEntity> list, Boolean isLoadMore) { if (list.size()<10){ adapter.setEnableLoadMore(false); footView.setVisibility(View.VISIBLE); }else { footView.setVisibility(View.GONE); adapter.setEnableLoadMore(true); adapter.setOnLoadMoreListener(new BaseQuickAdapter.RequestLoadMoreListener() { @Override public void onLoadMoreRequested() { User user = BmobUser.getCurrentUser(User.class); if (user == null){ mPresenter.getListFromDb(data.size(),true); }else { mPresenter.getListFromNet(data.size(),user.getObjectId(),true); } } },mRecyclerView); } if (isLoadMore){ adapter.addData(list); adapter.loadMoreComplete(); }else { data.clear(); data.addAll(list); adapter.setNewData(data); } }
Example #18
Source File: DebugDialog.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 5 votes |
private void initView(View contentView) { contentView.findViewById(R.id.rl_debug_native_tab1).setOnClickListener(this); contentView.findViewById(R.id.rl_debug_onLine_tab2).setOnClickListener(this); contentView.findViewById(R.id.tv_debug_ok).setOnClickListener(this); contentView.findViewById(R.id.tv_debug_cancel).setOnClickListener(this); contentView.findViewById(R.id.iv_debug_choice).setOnClickListener(this); tvNativeTitleView = contentView.findViewById(R.id.tv_debug_native_title); vNativeLineView = contentView.findViewById(R.id.v_debug_native_line); tvOnLineTitleView = contentView.findViewById(R.id.tv_debug_onLine_title); vOnLineLineView = contentView.findViewById(R.id.v_debug_onLine_line); tvFirstNameView = contentView.findViewById(R.id.tv_debug_first_name); tvSecondNameView = contentView.findViewById(R.id.tv_debug_second_name); tvThirdNameView = contentView.findViewById(R.id.tv_debug_third_name); etFirstValueView = contentView.findViewById(R.id.et_debug_first_value); etSecondValueView = contentView.findViewById(R.id.et_debug_second_value); etThirdValueView = contentView.findViewById(R.id.et_debug_third_value); if(isHideSecondItemView()){ contentView.findViewById(R.id.rl_second).setVisibility(View.GONE); } recyclerView = contentView.findViewById(R.id.rv_video_path_list); recyclerView.setLayoutManager(new LinearLayoutManager(context)); videoListConfigAdapter = new VideoListConfigAdapter(null); recyclerView.setAdapter(videoListConfigAdapter); videoListConfigAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() { @Override public void onItemClick(BaseQuickAdapter adapter, View view, int position) { VideoInfo videoInfo = (VideoInfo)adapter.getData().get(position); if(videoInfo != null && !TextUtils.isEmpty(videoInfo.videoData)){ etThirdValueView.setText(videoInfo.videoData); recyclerView.setVisibility(View.GONE); } } }); }
Example #19
Source File: BookPresenter.java From FriendBook with GNU General Public License v3.0 | 5 votes |
@Override public void start() { super.start(); if (isViewAttached()) { getView().addOnItemTouchListener(new OnItemClickListener() { @Override public void onSimpleItemClick(BaseQuickAdapter adapter, View view, int position) { AppRouter.showBookDetailActivity(view.getContext(), ((Book) adapter.getItem(position))); } }); } }
Example #20
Source File: SelectPictureActivity.java From FilePicker with MIT License | 5 votes |
@Override public void onItemClick(BaseQuickAdapter adapter, View view, int position) { //单选 mSelectedFileList.add(mMediaAdapter.getData().get(position)); Intent result = new Intent(); result.putParcelableArrayListExtra(Const.EXTRA_RESULT_SELECTION, EssFile.getEssFileList(this, mSelectedFileList)); setResult(RESULT_OK, result); super.onBackPressed(); }
Example #21
Source File: GankFragment.java From Ency with Apache License 2.0 | 5 votes |
@Override protected void initialize() { Bundle args = getArguments(); if (args != null) { type = args.getString("type"); } swipeRefreshLayout.setColorSchemeResources(R.color.colorPrimary); swipeRefreshLayout.setRefreshing(true); swipeRefreshLayout.setOnRefreshListener(this); mPresenter.getGankData(type, PAGE_SIZE, page); mPresenter.getPTP(); gankAdapter = new GankAdapter(resultsBeans); recyclerView.setLayoutManager(new LinearLayoutManager(mContext)); recyclerView.addItemDecoration(new DividerItemDecoration(mContext, DividerItemDecoration.VERTICAL)); recyclerView.setAdapter(gankAdapter); gankAdapter.setPTP(sharePrefManager.getProvincialTrafficPattern()); gankAdapter.setOnLoadMoreListener(this, recyclerView); gankAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() { @Override public void onItemClick(BaseQuickAdapter adapter, View view, int position) { GankBean.ResultsBean bean = (GankBean.ResultsBean) adapter.getData().get(position); WebActivity.open(new WebActivity.Builder() .setGuid(bean.get_id())//微信Item没有id,使用url作为guid .setImgUrl("") .setType(Constants.TYPE_GANK) .setUrl(bean.getUrl()) .setTitle(bean.getDesc()) .setShowLikeIcon(true) .setContext(mContext) ); } }); }
Example #22
Source File: AddressListActivity.java From enjoyshop with Apache License 2.0 | 5 votes |
private void initView() { if (mAdapter == null) { mAdapter = new AddressListAdapter(mAddressDataList); mRecyclerview.setAdapter(mAdapter); mRecyclerview.setLayoutManager(new LinearLayoutManager(AddressListActivity.this)); mRecyclerview.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration .HORIZONTAL)); mAdapter.setOnItemChildClickListener(new BaseQuickAdapter.OnItemChildClickListener() { @Override public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) { Address address = (Address)adapter.getData().get(position); switch (view.getId()) { case R.id.txt_edit: updateAddress(address); break; case R.id.txt_del: delAddress(address); break; case R.id.cb_is_defualt: chooseDefult(mAddressDataList, position); break; default: break; } } }); } }
Example #23
Source File: CollectionWebFragment.java From MaoWanAndoidClient with Apache License 2.0 | 5 votes |
@Override public void onItemClick(BaseQuickAdapter adapter, View view, int position) { WebBookMark webBookMark = (WebBookMark) adapter.getItem(position); HomeArticleData homeArticleData = new HomeArticleData(); assert webBookMark != null; homeArticleData.setTitle(webBookMark.getName()); homeArticleData.setLink(webBookMark.getLink()); StartDetailPage.start(_mActivity,homeArticleData, Constants.PAGE_WEB_NOT_COLLECT,Constants.ACTION_PAGE_DETAIL_ACTIVITY); }
Example #24
Source File: StarCommonListFragment.java From JReadHub with GNU General Public License v3.0 | 5 votes |
@Override public void initView() { mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); mAdapter = new NewsListAdapterWithThirdLib(); mAdapter.isFirstOnly(false); mAdapter.setNotDoAnimationCount(3); mAdapter.openLoadAnimation(BaseQuickAdapter.SCALEIN); mAdapter.setLoadMoreView(new CustomLoadMoreView()); mAdapter.setOnItemClickListener(this); mRecyclerView.setAdapter(mAdapter); mRefreshLayout.setColorSchemeColors(ContextCompat.getColor(getContext(), ResourceUtil.getResource(getActivity(), R.attr.readhubTheme))); }
Example #25
Source File: BaseListActivity.java From BaseProject with Apache License 2.0 | 5 votes |
/** * 子类Activity的列表控件RecyclerView调用mRecyclerView.addOnItemTouchListener(obtainTheRecyclerItemClickListen()) * 则可重写 * @return */ protected OnRecyclerItemClickEventListener obtainTheRecyclerItemClickListen() { if (onRecyclerItemClickEventListener == null) { onRecyclerItemClickEventListener = new OnRecyclerItemClickEventListener() { @Override public void onItemClick(BaseQuickAdapter adapter, View view, int position) { BaseListActivity.this.onItemClick(adapter, view, position); } /** * callback method to be invoked when an item in this view has been * click and held * * @param adapter * @param view The view whihin the AbsListView that was clicked * @param position The position of the view int the adapter * @return true if the callback consumed the long click ,false otherwise */ @Override public void onItemLongClick(BaseQuickAdapter adapter, View view, int position) { BaseListActivity.this.onItemLongClick(adapter,view,position); } @Override public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) { BaseListActivity.this.onItemChildClick(adapter, view, position); } @Override public void onItemChildLongClick(BaseQuickAdapter adapter, View view, int position) { BaseListActivity.this.onItemChildLongClick(adapter, view, position); } }; } return onRecyclerItemClickEventListener; }
Example #26
Source File: StarTopicFragment.java From JReadHub with GNU General Public License v3.0 | 5 votes |
@Override public void initView() { mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); mAdapter = new TopicDetailListAdapterWithThirdLib(); mAdapter.isFirstOnly(false); mAdapter.setNotDoAnimationCount(3); mAdapter.openLoadAnimation(BaseQuickAdapter.SCALEIN); mAdapter.setLoadMoreView(new CustomLoadMoreView()); mRecyclerView.setAdapter(mAdapter); mRefreshLayout.setColorSchemeColors(ContextCompat.getColor(getContext(), ResourceUtil.getResource(getActivity(), R.attr.readhubTheme))); }
Example #27
Source File: MainActivity.java From KUtils with Apache License 2.0 | 5 votes |
private void initAdapter() { mAdapter = new MyAdapter(null);//可以直接传入数据,数据未获取到的情况下可以传null mAdapter.openLoadAnimation(BaseQuickAdapter.ALPHAIN);//设置列表加载动画 mAdapter.isFirstOnly(false);//是否仅在第一次加载列表时展示动画 mRv.setLayoutManager(new LinearLayoutManager(mContext)); mRv.setAdapter(mAdapter); }
Example #28
Source File: ZhihuThirdFragment.java From MeiBaseModule with Apache License 2.0 | 5 votes |
@Override protected MeiBaseAdapter<Chat> getAdapter() { ChatAdapter chatAdapter = new ChatAdapter(); chatAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() { @Override public void onItemClick(BaseQuickAdapter adapter, View view, int position) { // 因为启动的MsgFragment是MainFragment的兄弟Fragment,所以需要MainFragment.start() // 也可以像使用getParentFragment()的方式,拿到父Fragment来操作 或者使用 EventBusActivityScope ((MainFragment) getParentFragment()).start(MsgFragment.newInstance(mAdapter .getItem(position))); } }); return chatAdapter; }
Example #29
Source File: DrawerHelper.java From UIWidget with Apache License 2.0 | 5 votes |
public void initRecyclerView(final Activity mContext, RecyclerView mRecyclerViewDrawer, List<DrawerEntity> list) { final BaseQuickAdapter mAdapterDrawer = new DrawerAdapter(mContext); mRecyclerViewDrawer.setLayoutManager(new LinearLayoutManager(mContext)); mRecyclerViewDrawer.setAdapter(mAdapterDrawer); mRecyclerViewDrawer.addOnItemTouchListener(new OnItemClickListener() { @Override public void onSimpleItemClick(BaseQuickAdapter adapter, View view, int position) { DrawerEntity entity = (DrawerEntity) mAdapterDrawer.getItem(position); WebViewActivity.start(mContext,entity.url); } }); mAdapterDrawer.setNewData(list); }
Example #30
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()); } }