package com.github.mobile.android.gist;

import static android.view.View.GONE;
import static android.view.View.VISIBLE;
import android.text.Html;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;

import com.github.mobile.android.R.id;
import com.github.mobile.android.util.Time;
import com.madgag.android.listviews.ViewHolder;

import java.util.Date;

import org.eclipse.egit.github.core.Gist;

/**
 * Holder for a Gist header view
 */
public class GistHeaderViewHolder implements ViewHolder<Gist> {

    private final TextView created;

    private final TextView updated;

    private final TextView description;

    /**
     * Create view holder
     *
     * @param view
     */
    public GistHeaderViewHolder(final View view) {
        created = (TextView) view.findViewById(id.tv_gist_creation);
        updated = (TextView) view.findViewById(id.tv_gist_updated);
        description = (TextView) view.findViewById(id.tv_gist_description);
    }

    public void updateViewFor(Gist gist) {
        Date createdAt = gist.getCreatedAt();
        if (createdAt != null) {
            created.setText("Created " + Time.relativeTimeFor(createdAt));
            created.setVisibility(VISIBLE);
        } else
            created.setVisibility(GONE);

        Date updatedAt = gist.getUpdatedAt();
        if (updatedAt != null && !updatedAt.equals(createdAt)) {
            updated.setText("Updated " + Time.relativeTimeFor(updatedAt));
            updated.setVisibility(VISIBLE);
        } else
            updated.setVisibility(GONE);

        String desc = gist.getDescription();
        if (!TextUtils.isEmpty(desc))
            description.setText(desc);
        else
            description.setText(Html.fromHtml("<i>No description</i>"));
    }
}

@@ -34,16 +34,125 @@
 .gist;%0A%0A
+import static android.graphics.Typeface.ITALIC;%0Aimport static android.text.Spanned.SPAN_EXCLUSIVE_EXCLUSIVE;%0A
 import s
@@ -242,20 +242,38 @@
 id.text.
-Html
+SpannableStringBuilder
 ;%0Aimport
@@ -297,16 +297,53 @@
 tUtils;%0A
+import android.text.style.StyleSpan;%0A
 import a
@@ -698,16 +698,281 @@
 ist%3E %7B%0A%0A
+    private static final SpannableStringBuilder NO_DESCRIPTION;%0A%0A    static %7B%0A        NO_DESCRIPTION = new SpannableStringBuilder(%22No description%22);%0A        NO_DESCRIPTION.setSpan(new StyleSpan(ITALIC), 0, NO_DESCRIPTION.length(), SPAN_EXCLUSIVE_EXCLUSIVE);%0A    %7D%0A%0A
     priv
@@ -2173,46 +2173,22 @@
 ext(
-Html.fromHtml(%22%3Ci%3ENo description%3C/i%3E%22)
+NO_DESCRIPTION
 );%0A 

Use static spanned constant instead of HTML parsing