# CommonAdapter **Repository Path**: lixicode/CommonAdapter ## Basic Information - **Project Name**: CommonAdapter - **Description**: @Deprecated //Recommend-->> - **Primary Language**: Android - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: https://github.com/drakeet/MultiType - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2016-05-25 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ![](https://img.shields.io/badge/version-0.3.0.1-orange.svg) [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE) --- # INTRO helpful u, also helpful me! [Change Log](https://github.com/lixi0912/CommonAdapter/wiki/CHANGES-LOG) # How To Use simple example for app module,u can read the fucking source ! complex clickable case ```java mRecycleView.addOnItemTouchListener(new SimpleOnItemClickListener>(mRecycleView) { @Override public void onItemClick(BaseRecycleViewAdapter.ViewHolder holder,View clickView) { //handle the item click Book book = holder.getItem(); if (null != book) { book.setName("u clicked my parent:" + book.getId() + new Random().nextInt(10) + (clickView.getId() == R.id.sub_title_button ? ",by:sub" : "")); holder.notifyItemChange(); } } }); static class MultiTypeHolder extends BaseLayoutInflaterRecycleViewAdapter.ViewHolder { @Bind(R.id.name) TextView btnClickMe; @Bind(R.id.title) TextView tvTitle; @Bind(R.id.sub_title_button) View btnSubTitle; Rect hitRect = new Rect(); public MultiTypeHolder(View content) { super(content); ButterKnife.bind(this, content); } /** * this view has it`s own clickListener */ @OnClick(R.id.name) public void onClick() { String summary = "oh~ u got me!"; Book book = getItem(); book.setSummary(summary); btnClickMe.setText(summary); } /** * return false,this isn`t an itemClick event call */ @Override @Override public View findViewByClickEvent(MotionEvent e) { hitRect.setEmpty(); btnClickMe.getHitRect(hitRect); if (hitRect.contains((int) e.getX(), (int) e.getY())) return null;//callback on holder try { ViewLocationCompat.offsetLocation(itemView, (View) btnSubTitle.getParent(), e); hitRect.setEmpty(); btnSubTitle.getHitRect(hitRect); if (hitRect.contains((int) e.getX(), (int) e.getY())) return btnSubTitle;// callback on SimpleOnItemClickListener } finally { ViewLocationCompat.reverseOffsetLocation(itemView, (View) btnSubTitle.getParent(), e); } return super.findViewByClickEvent(e); } } ``` ## HOW TO USE just to read the fucking source ## SAMPLE see apk folder ## UML ![](./images/CommonAdapter.jpg) ## THANKS 1. Thank [亓斌-RecyclerView添加Header的正确方式](http://blog.csdn.net/qibin0506/article/details/49716795) 2. Thank [liaoinstan-RecyclerView添加onItemClickListener更佳的解决方案](http://blog.csdn.net/liaoinstan/article/details/51200600) 3. Thank [daimajia-AndroidSwipeLayout](https://github.com/daimajia/AndroidSwipeLayout) 4. Thank [drakeet-MultiType](https://github.com/drakeet/MultiType) ## License Copyright (C) 2016 lixi Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.