I want custom Adapter


#1

I inherited TweetTimelineListAdapter and made CustomTweetTimelineAdapter.
But I cant use “setTimelineFilter”.

This is because you must use the TimelineDelegate to inherit the timelinefilter.
However, TimelineDelegate is a private property.
What’s the use of TimelineFilter in CustomAdapter?

public class CustomTweetTimelineAdapter extends TweetTimelineListAdapter {


#2

You can extend TweetTimelineListAdapter or TweetTimelineRecyclerViewAdapter. Don’t use the builder pattern to avoid the issue with TimelineDelegate being private.

Example:

public class CustomRecyclerViewAdapter extends TweetTimelineRecyclerViewAdapter {
    public CustomRecyclerViewAdapter(Context context, Timeline<Tweet> timeline) {
        super(context, timeline);
    }

    public CustomRecyclerViewAdapter(Context context, Timeline<Tweet> timeline, int styleResId, Callback<Tweet> cb) {
        super(context, timeline, styleResId, cb);
    }

    @Override
    public TweetViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {

        // Override View Holder
        return super.onCreateViewHolder(parent, viewType);
    }
}

Instantiation:

final UserTimeline userTimeline = new UserTimeline.Builder().screenName("twitterdev").build();
CustomRecyclerViewAdapter customRecyclerViewAdapter = new CustomRecyclerViewAdapter(this, userTimeline);

… then set your RecyclerView to use customRecyclerViewAdapter


#3

The current structure can not use setTimelineFilter unless you use the Build pattern.

I want use “setTimelineFilter”.
Please reply. Thank you.