Search in sources :

Example 1 with Status

use of com.chad.baserecyclerviewadapterhelper.entity.Status in project BaseRecyclerViewAdapterHelper by CymChad.

the class DefAdpater method onBindViewHolder.

@Override
public void onBindViewHolder(ViewHolder holder, int position) {
    Status status = sampleData.get(position);
    holder.name.setText(status.getUserName());
    holder.text.setText(status.getText());
    holder.date.setText(status.getCreatedAt());
}
Also used : Status(com.chad.baserecyclerviewadapterhelper.entity.Status)

Example 2 with Status

use of com.chad.baserecyclerviewadapterhelper.entity.Status in project BaseRecyclerViewAdapterHelper by CymChad.

the class DataServer method addData.

public static List<Status> addData(List list, int dataSize) {
    for (int i = 0; i < dataSize; i++) {
        Status status = new Status();
        status.setUserName("Chad" + i);
        status.setCreatedAt("04/05/" + i);
        status.setRetweet(i % 2 == 0);
        status.setUserAvatar("https://avatars1.githubusercontent.com/u/7698209?v=3&s=460");
        status.setText("Powerful and flexible RecyclerAdapter https://github.com/CymChad/BaseRecyclerViewAdapterHelper");
        list.add(status);
    }
    return list;
}
Also used : Status(com.chad.baserecyclerviewadapterhelper.entity.Status)

Example 3 with Status

use of com.chad.baserecyclerviewadapterhelper.entity.Status 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)

Example 4 with Status

use of com.chad.baserecyclerviewadapterhelper.entity.Status in project BaseRecyclerViewAdapterHelper by CymChad.

the class DataServer method getSampleData.

public static List<Status> getSampleData(int lenth) {
    List<Status> list = new ArrayList<>();
    for (int i = 0; i < lenth; i++) {
        Status status = new Status();
        status.setUserName("Chad" + i);
        status.setCreatedAt("04/05/" + i);
        status.setRetweet(i % 2 == 0);
        status.setUserAvatar("https://avatars1.githubusercontent.com/u/7698209?v=3&s=460");
        status.setText("BaseRecyclerViewAdpaterHelper https://www.recyclerview.org");
        list.add(status);
    }
    return list;
}
Also used : Status(com.chad.baserecyclerviewadapterhelper.entity.Status) ArrayList(java.util.ArrayList)

Aggregations

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