@Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
        //TODO set last message time
        final ChatDescription description = descriptionList.get(position);
        User mainUser = ((GlobalVars)(inboxFragment.getActivity()).getApplication()).getUser();
        final User otherUser;
        if (Objects.equals(mainUser.getUid(), description.getUserid1()))
            otherUser = userMap.get(description.getUserid2());
        else otherUser = userMap.get(description.getUserid1());
        final InboxViewHolder viewHolder = (InboxViewHolder) holder;
        Glide.with(context).load(otherUser.getProfileUrl()).asBitmap().centerCrop().dontAnimate().
                into(new BitmapImageViewTarget(viewHolder.ivProfile) {
                    @Override
                    protected void setResource(Bitmap resource) {
                        RoundedBitmapDrawable circularBitmapDrawable =
                                RoundedBitmapDrawableFactory.create(context.getResources(), resource);
                        circularBitmapDrawable.setCircular(true);
                        viewHolder.ivProfile.setImageDrawable(circularBitmapDrawable);
                        viewHolder.ivProfile.setBorderColor(otherUser.getColorHexDark(context));
                    }
                });
        String lastMessage;
        if (description.lastMessage != null) lastMessage = description.lastMessage.getText();
        else lastMessage = "";
        viewHolder.tvLastMessage.setText(lastMessage);
        viewHolder.tvLastMessage.setEllipsize(TextUtils.TruncateAt.END);
        viewHolder.tvLastMessage.setMaxLines(2);
        viewHolder.tvOtherUserName.setText(otherUser.getFirstName());
        Long seconds = description.getLastMessage().getSentTime().getTime();
        viewHolder.tvTime.setText(TimeFormatter.getTimeDifference(seconds));
        viewHolder.itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent i = new Intent(view.getContext(), MessageActivity.class);
                i.putExtra("otherUser", Parcels.wrap(otherUser));
                i.putExtra("description", Parcels.wrap(description));
                inboxFragment.startActivityForResult(i, InboxFragment.CHANGEDESCRIPTION);
            }
        });
        if (position == 0) holder.itemView.setPadding(0, 200, 0, 0); //not the right way to do this
    }
@Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
       
        final ChatDescription description = descriptionList.get(position);
        User mainUser = ((GlobalVars)(inboxFragment.getActivity()).getApplication()).getUser();
        final User otherUser;
        if (Objects.equals(mainUser.getUid(), description.getUserid1()))
            otherUser = userMap.get(description.getUserid2());
        else otherUser = userMap.get(description.getUserid1());
        final InboxViewHolder viewHolder = (InboxViewHolder) holder;
        Glide.with(context).load(otherUser.getProfileUrl()).asBitmap().centerCrop().dontAnimate().
                into(new BitmapImageViewTarget(viewHolder.ivProfile) {
                    @Override
                    protected void setResource(Bitmap resource) {
                        RoundedBitmapDrawable circularBitmapDrawable =
                                RoundedBitmapDrawableFactory.create(context.getResources(), resource);
                        circularBitmapDrawable.setCircular(true);
                        viewHolder.ivProfile.setImageDrawable(circularBitmapDrawable);
                        viewHolder.ivProfile.setBorderColor(otherUser.getColorHexDark(context));
                    }
                });
        String lastMessage;
        if (description.lastMessage != null) lastMessage = description.lastMessage.getText();
        else lastMessage = "";
        viewHolder.tvLastMessage.setText(lastMessage);
        viewHolder.tvLastMessage.setEllipsize(TextUtils.TruncateAt.END);
        viewHolder.tvLastMessage.setMaxLines(2);
        viewHolder.tvOtherUserName.setText(otherUser.getFirstName());
        Long seconds = description.getLastMessage().getSentTime().getTime();
        viewHolder.tvTime.setText(TimeFormatter.getTimeDifference(seconds));
        viewHolder.itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent i = new Intent(view.getContext(), MessageActivity.class);
                i.putExtra("otherUser", Parcels.wrap(otherUser));
                i.putExtra("description", Parcels.wrap(description));
                inboxFragment.startActivityForResult(i, InboxFragment.CHANGEDESCRIPTION);
            }
        });
        if (position == 0) holder.itemView.setPadding(0, 200, 0, 0);
    }
@override public void onbindviewholder(recyclerview.viewholder holder, int position) { final chatdescription description = descriptionlist.get(position); user mainuser = ((globalvars)(inboxfragment.getactivity()).getapplication()).getuser(); final user otheruser; if (objects.equals(mainuser.getuid(), description.getuserid1())) otheruser = usermap.get(description.getuserid2()); else otheruser = usermap.get(description.getuserid1()); final inboxviewholder viewholder = (inboxviewholder) holder; glide.with(context).load(otheruser.getprofileurl()).asbitmap().centercrop().dontanimate(). into(new bitmapimageviewtarget(viewholder.ivprofile) { @override protected void setresource(bitmap resource) { roundedbitmapdrawable circularbitmapdrawable = roundedbitmapdrawablefactory.create(context.getresources(), resource); circularbitmapdrawable.setcircular(true); viewholder.ivprofile.setimagedrawable(circularbitmapdrawable); viewholder.ivprofile.setbordercolor(otheruser.getcolorhexdark(context)); } }); string lastmessage; if (description.lastmessage != null) lastmessage = description.lastmessage.gettext(); else lastmessage = ""; viewholder.tvlastmessage.settext(lastmessage); viewholder.tvlastmessage.setellipsize(textutils.truncateat.end); viewholder.tvlastmessage.setmaxlines(2); viewholder.tvotherusername.settext(otheruser.getfirstname()); long seconds = description.getlastmessage().getsenttime().gettime(); viewholder.tvtime.settext(timeformatter.gettimedifference(seconds)); viewholder.itemview.setonclicklistener(new view.onclicklistener() { @override public void onclick(view view) { intent i = new intent(view.getcontext(), messageactivity.class); i.putextra("otheruser", parcels.wrap(otheruser)); i.putextra("description", parcels.wrap(description)); inboxfragment.startactivityforresult(i, inboxfragment.changedescription); } }); if (position == 0) holder.itemview.setpadding(0, 200, 0, 0); }