@@ -0,0 +1,2976 @@
+package com.iitp.njack.iitp_connect.core.facebook.feed;%0A%0Aimport android.databinding.DataBindingUtil;%0Aimport android.support.annotation.NonNull;%0Aimport android.support.v7.util.DiffUtil;%0Aimport android.support.v7.widget.RecyclerView;%0Aimport android.view.LayoutInflater;%0Aimport android.view.ViewGroup;%0A%0Aimport com.bumptech.glide.Glide;%0Aimport com.iitp.njack.iitp_connect.R;%0Aimport com.iitp.njack.iitp_connect.data.facebook.FacebookPost;%0A%0Aimport java.util.List;%0A%0Apublic class FacebookFeedAdapter extends RecyclerView.Adapter%3CFacebookFeedViewHolder%3E %7B%0A    private final FacebookFeedViewModel facebookFeedViewModel;%0A    private List%3CFacebookPost%3E facebookPosts;%0A    private Glide glide;%0A%0A    public FacebookFeedAdapter(FacebookFeedViewModel facebookFeedViewModel, Glide glide) %7B%0A        this.facebookFeedViewModel = facebookFeedViewModel;%0A        this.glide = glide;%0A    %7D%0A%0A    @NonNull%0A    @Override%0A    public FacebookFeedViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int position) %7B%0A        FacebookFeedViewHolder facebookFeedViewHolder =%0A            new FacebookFeedViewHolder(DataBindingUtil.inflate(LayoutInflater.from(viewGroup.getContext()),%0A                R.layout.facebook_post_item, viewGroup, false), viewGroup.getContext(), glide);%0A%0A        facebookFeedViewHolder.setClickAction(facebookFeedViewModel::openFacebookPostDetails);%0A        return facebookFeedViewHolder;%0A    %7D%0A%0A    @Override%0A    public void onBindViewHolder(@NonNull FacebookFeedViewHolder facebookFeedViewHolder, int position) %7B%0A        facebookFeedViewHolder.bind(facebookPosts.get(position));%0A    %7D%0A%0A    @Override%0A    public int getItemCount() %7B%0A        return facebookPosts != null ? facebookPosts.size() : 0;%0A    %7D%0A%0A    protected void setFacebookPosts(final List%3CFacebookPost%3E newFacebookPosts) %7B%0A        if (facebookPosts == null) %7B%0A            facebookPosts = newFacebookPosts;%0A            notifyItemRangeInserted(0, newFacebookPosts.size());%0A        %7D else %7B%0A            DiffUtil.DiffResult result = DiffUtil.calculateDiff(new DiffUtil.Callback() %7B%0A                @Override%0A                public int getOldListSize() %7B%0A                    return facebookPosts.size();%0A                %7D%0A%0A                @Override%0A                public int getNewListSize() %7B%0A                    return newFacebookPosts.size();%0A                %7D%0A%0A                @Override%0A                public boolean areItemsTheSame(int oldItemPosition, int newItemPosition) %7B%0A                    return facebookPosts.get(oldItemPosition).getId() ==%0A                        newFacebookPosts.get(newItemPosition).getId();%0A                %7D%0A%0A                @Override%0A                public boolean areContentsTheSame(int oldItemPosition, int newItemPosition) %7B%0A                    return facebookPosts.get(oldItemPosition).equals(newFacebookPosts.get(newItemPosition));%0A                %7D%0A            %7D);%0A            facebookPosts = newFacebookPosts;%0A            result.dispatchUpdatesTo(this);%0A        %7D%0A    %7D%0A%7D%0A

Implement fb feed adapter (#230)