FeedbackMessageView.java 3.47 KB
package net.hockeyapp.android.views;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.Resources;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.LinearLayout;
import android.widget.TextView;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Iterator;
import java.util.List;
import net.hockeyapp.android.R.color;
import net.hockeyapp.android.R.id;
import net.hockeyapp.android.R.layout;
import net.hockeyapp.android.objects.FeedbackAttachment;
import net.hockeyapp.android.objects.FeedbackMessage;
import net.hockeyapp.android.tasks.AttachmentDownloader;

public class FeedbackMessageView
  extends LinearLayout
{
  @SuppressLint({"SimpleDateFormat"})
  private static final SimpleDateFormat a = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
  @SuppressLint({"SimpleDateFormat"})
  private static final SimpleDateFormat b = new SimpleDateFormat("d MMM h:mm a");
  private TextView c;
  private TextView d;
  private TextView e;
  private AttachmentListView f;
  private FeedbackMessage g;
  private final Context h;
  
  public FeedbackMessageView(Context paramContext, AttributeSet paramAttributeSet)
  {
    super(paramContext, paramAttributeSet);
    this.h = paramContext;
    LayoutInflater.from(paramContext).inflate(R.layout.hockeyapp_view_feedback_message, this);
    this.c = ((TextView)findViewById(R.id.label_author));
    this.d = ((TextView)findViewById(R.id.label_date));
    this.e = ((TextView)findViewById(R.id.label_text));
    this.f = ((AttachmentListView)findViewById(R.id.list_attachments));
  }
  
  public void setFeedbackMessage(FeedbackMessage paramFeedbackMessage)
  {
    this.g = paramFeedbackMessage;
    try
    {
      paramFeedbackMessage = a.parse(this.g.getCreatedAt());
      this.d.setText(b.format(paramFeedbackMessage));
      this.c.setText(this.g.getName());
      this.e.setText(this.g.getText());
      this.f.removeAllViews();
      paramFeedbackMessage = this.g.getFeedbackAttachments().iterator();
      while (paramFeedbackMessage.hasNext())
      {
        FeedbackAttachment localFeedbackAttachment = (FeedbackAttachment)paramFeedbackMessage.next();
        AttachmentView localAttachmentView = new AttachmentView(this.h, this.f, localFeedbackAttachment, false);
        AttachmentDownloader.getInstance().download(localFeedbackAttachment, localAttachmentView);
        this.f.addView(localAttachmentView);
      }
    }
    catch (ParseException paramFeedbackMessage)
    {
      for (;;)
      {
        paramFeedbackMessage.printStackTrace();
      }
    }
  }
  
  public void setIndex(int paramInt)
  {
    if (paramInt % 2 == 0)
    {
      setBackgroundColor(getResources().getColor(R.color.hockeyapp_background_light));
      this.c.setTextColor(getResources().getColor(R.color.hockeyapp_text_white));
      this.d.setTextColor(getResources().getColor(R.color.hockeyapp_text_white));
    }
    for (;;)
    {
      this.e.setTextColor(getResources().getColor(R.color.hockeyapp_text_black));
      return;
      setBackgroundColor(getResources().getColor(R.color.hockeyapp_background_white));
      this.c.setTextColor(getResources().getColor(R.color.hockeyapp_text_light));
      this.d.setTextColor(getResources().getColor(R.color.hockeyapp_text_light));
    }
  }
}


/* Location:              /home/merong/decompile/hackery-dex2jar.jar!/net/hockeyapp/android/views/FeedbackMessageView.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */