@Override
 public int getItemViewType(int position) {
   Message message = messages.get(position);
   if (LaoSchoolShared.myProfile != null) {
     if (message.getFrom_usr_id() == LaoSchoolShared.myProfile.getId()) {
       return TYPE_CONVERSION_FROM;
     } else return TYPE_CONVERSION_TO;
   } else {
     return TYPE_CONVERSION_FROM;
   }
 }
  @Override
  public void onBindViewHolder(RecyclerViewConversionMessageViewHolder holder, int position) {
    try {

      int viewType = holder.viewType;
      View view = holder.view;
      Message message = messages.get(position);
      if (viewType == TYPE_CONVERSION_TO) {
        ((TextView) (view.findViewById(R.id.txtConversionMessageTo))).setText(message.getContent());
        if (message.getSent_dt() != null)
          ((TextView) (view.findViewById(R.id.txtToSendDate))).setText(message.getSent_dt());
        if (position > 1) {
          Message message1 = messages.get(position - 1);
          if (message.getFrom_usr_id() == message1.getFrom_usr_id()) {
            ((TextView) (view.findViewById(R.id.txtConversionMessageTo)))
                .setBackgroundResource(R.drawable.ic_radius_box);
          } else {
            ((TextView) (view.findViewById(R.id.txtConversionMessageTo)))
                .setBackgroundResource(R.drawable.ic_chat_bubble_blue_lao);
          }
        }

      } else if (viewType == TYPE_CONVERSION_FROM) {
        ((TextView) (view.findViewById(R.id.txtConversionMessageForm)))
            .setText(message.getContent());
        if (message.getSent_dt() != null)
          ((TextView) (view.findViewById(R.id.txtFomSentDate))).setText(message.getSent_dt());

        if (position > 1) {
          Message message1 = messages.get(position - 1);
          if (message.getFrom_usr_id() == message1.getFrom_usr_id()) {
            ((TextView) (view.findViewById(R.id.txtConversionMessageForm)))
                .setBackgroundResource(R.drawable.ic_radius_box_red_lao);
          } else {
            ((TextView) (view.findViewById(R.id.txtConversionMessageForm)))
                .setBackgroundResource(R.drawable.ic_chat_bubble_red_lao_48dp_2x);
          }
        }
      }
    } catch (Exception e) {
      Log.d(TAG, "/onBindViewHolder() error:" + e.getMessage());
    }
  }