Search in sources :

Example 1 with AnimationAdapter

use of com.chad.baserecyclerviewadapterhelper.adapter.AnimationAdapter in project BaseRecyclerViewAdapterHelper by CymChad.

the class AnimationUseActivity method initAdapter.

private void initAdapter() {
    mAnimationAdapter = new AnimationAdapter();
    mAnimationAdapter.openLoadAnimation();
    mAnimationAdapter.setNotDoAnimationCount(mFirstPageItemCount);
    mRecyclerView.addOnItemTouchListener(new OnItemChildClickListener() {

        @Override
        public void onSimpleItemChildClick(BaseQuickAdapter adapter, View view, int position) {
            String content = null;
            Status status = (Status) adapter.getItem(position);
            switch(view.getId()) {
                case R.id.img:
                    content = "img:" + status.getUserAvatar();
                    Toast.makeText(AnimationUseActivity.this, content, Toast.LENGTH_LONG).show();
                    break;
                case R.id.tweetName:
                    content = "name:" + status.getUserName();
                    Toast.makeText(AnimationUseActivity.this, content, Toast.LENGTH_LONG).show();
                    break;
                case R.id.tweetText:
                    // you have set clickspan .so there should not solve any click event ,just empty
                    break;
            }
        }
    });
    mRecyclerView.setAdapter(mAnimationAdapter);
}
Also used : Status(com.chad.baserecyclerviewadapterhelper.entity.Status) BaseQuickAdapter(com.chad.library.adapter.base.BaseQuickAdapter) OnItemChildClickListener(com.chad.library.adapter.base.listener.OnItemChildClickListener) ImageView(android.widget.ImageView) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View) AnimationAdapter(com.chad.baserecyclerviewadapterhelper.adapter.AnimationAdapter)

Aggregations

RecyclerView (android.support.v7.widget.RecyclerView)1 View (android.view.View)1 ImageView (android.widget.ImageView)1 AnimationAdapter (com.chad.baserecyclerviewadapterhelper.adapter.AnimationAdapter)1 Status (com.chad.baserecyclerviewadapterhelper.entity.Status)1 BaseQuickAdapter (com.chad.library.adapter.base.BaseQuickAdapter)1 OnItemChildClickListener (com.chad.library.adapter.base.listener.OnItemChildClickListener)1