package com.kickstarter.ui.view_holders;

import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.kickstarter.KsrApplication;
import com.kickstarter.R;
import com.kickstarter.libs.CommentUtils;
import com.kickstarter.libs.CurrentUser;
import com.kickstarter.libs.DateTimeUtils;
import com.kickstarter.libs.Presenter;
import com.kickstarter.models.Comment;
import com.kickstarter.models.Project;
import com.kickstarter.presenters.CommentFeedPresenter;
import com.squareup.picasso.Picasso;

import javax.inject.Inject;

import butterknife.ButterKnife;
import butterknife.InjectView;

public class CommentListViewHolder extends RecyclerView.ViewHolder {
  protected Comment comment;
  protected View view;
  protected Presenter presenter;

  protected @InjectView(R.id.avatar) ImageView avatar;
  protected @InjectView(R.id.creator_label) TextView creatorLabel;
  protected @InjectView(R.id.user_label) TextView userLabelTextView;
  protected @InjectView(R.id.name) TextView name;
  protected @InjectView(R.id.post_date) TextView postDate;
  protected @InjectView(R.id.comment_body) TextView commentBody;
  @Inject CurrentUser currentUser;  //check if backed project


  public CommentListViewHolder(final View view, final CommentFeedPresenter presenter) {
    super(view);
    this.view = view;
    this.presenter = presenter;

    ((KsrApplication) view.getContext().getApplicationContext()).component().inject(this);
    ButterKnife.inject(this, view);
  }

  public void onBind(final Comment comment, final Project project) {
    this.comment = comment;

    if (CommentUtils.isUserAuthor(comment, currentUser.getUser())) {
      // todo: create current user textview
    }
    if (CommentUtils.isUserAuthor(comment, project.creator())) {
      creatorLabel.setVisibility(View.VISIBLE);
    }
    else {
      creatorLabel.setVisibility(View.GONE);
    }

    Picasso.with(view.getContext()).load(comment.author().avatar().small()).into(avatar);
    name.setText(comment.author().name());
    postDate.setText(DateTimeUtils.relativeDateInWords(comment.createdAt(), false, true));
    commentBody.setText(comment.body());

    // todo: set creator_label VISIBLE if creator's comment
  }
}

@@ -1690,77 +1690,77 @@
 nt, 
-currentUser.getUser())) %7B%0A      // todo: create current user textview
+project.creator())) %7B%0A      creatorLabel.setVisibility(View.VISIBLE);
 %0A   
@@ -1762,24 +1762,29 @@
 ;%0A    %7D%0A    
+else 
 if (CommentU
@@ -1814,48 +1814,57 @@
 nt, 
-project.creator())) %7B%0A      creatorLabel
+currentUser.getUser())) %7B%0A      userLabelTextView
 .set
@@ -1947,24 +1947,74 @@
 View.GONE);%0A
+      userLabelTextView.setVisibility(View.GONE);%0A
     %7D%0A%0A    P
@@ -2276,69 +2276,8 @@
 ());
-%0A%0A    // todo: set creator_label VISIBLE if creator's comment
 %0A  %7D

Update comment label logic