/*
 * Copyright 2011 Azwan Adli Abdullah
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.gh4a.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.gh4a.R;
import com.gh4a.holder.Trend;

public class TrendAdapter extends RootAdapter<Trend> {
    public TrendAdapter(Context context) {
        super(context);
    }

    @Override
    protected View createView(LayoutInflater inflater, ViewGroup parent, int viewType) {
        View v = inflater.inflate(R.layout.row_simple_3, null);
        ViewHolder viewHolder = new ViewHolder();

        viewHolder.tvTitle = (TextView) v.findViewById(R.id.tv_title);
        viewHolder.tvDesc = (TextView) v.findViewById(R.id.tv_desc);
        viewHolder.tvExtra = (TextView) v.findViewById(R.id.tv_extra);

        v.setTag(viewHolder);
        return v;
    }

    @Override
    protected void bindView(View v, Trend trend) {
        ViewHolder viewHolder = (ViewHolder) v.getTag();

        String[] repo = trend.getRepo();
        if (repo != null) {
            viewHolder.tvTitle.setText(repo[0] + "/" + repo[1]);
        } else {
            viewHolder.tvTitle.setText(trend.getTitle());
        }
        viewHolder.tvDesc.setText(trend.getDescription());
        viewHolder.tvExtra.setVisibility(View.GONE);
    }

    private static class ViewHolder {
        public TextView tvTitle;
        public TextView tvDesc;
        public TextView tvExtra;
    }
}

@@ -655,16 +655,131 @@
 ontext;%0A
+import android.graphics.Typeface;%0Aimport android.text.SpannableStringBuilder;%0Aimport android.text.style.StyleSpan;%0A
 import a
@@ -896,16 +896,48 @@
 tView;%0A%0A
+import com.gh4a.Gh4Application;%0A
 import c
@@ -1274,16 +1274,75 @@
  null);%0A
+        Gh4Application app = Gh4Application.get(mContext);%0A
         
@@ -1592,24 +1592,185 @@
 tv_extra);%0A%0A
+        viewHolder.tvTitle.setTypeface(app.condensed);%0A        viewHolder.tvDesc.setTypeface(app.regular);%0A        viewHolder.tvExtra.setVisibility(View.GONE);%0A%0A
         v.se
@@ -2020,58 +2020,257 @@
     
-viewHolder.tvTitle.setText(repo%5B0%5D + %22/%22 + repo%5B1%5D
+SpannableStringBuilder title = new SpannableStringBuilder();%0A            title.append(repo%5B0%5D).append(%22/%22).append(repo%5B1%5D);%0A            title.setSpan(new StyleSpan(Typeface.BOLD), 0, repo%5B0%5D.length(), 0);%0A            viewHolder.tvTitle.setText(title
 );%0A 
@@ -2416,61 +2416,8 @@
 ));%0A
-        viewHolder.tvExtra.setVisibility(View.GONE);%0A
     

Make look of trend list consistent to other lists.