// Path: app/src/main/java/io/github/emanual/app/utils/ParseUtils.java
// public class ParseUtils {
// 
//     public static int getArticleId(String filename) {
//         return Integer.parseInt(filename.split("-")[0]);
//     }
// 
//     // [(2013-1-1,0010)]title].md
//     public static String getArticleName(String filename) {
//         String[] s = filename.replaceAll("\\.[Mm]{1}[Dd]{1}", "").split("-");
//         //这是日期开头
//         if (_.isNumber(s[0]) && _.isNumber(s[1]) && _.isNumber(s[2])) {
//             return s[3];
//         } else { //这是文章编号
//             return s[1];
//         }
//     }
// 
//     // http:xxxxx/assets/preview.html?path=/a/b/[(2013-1-1,0010)]title].md
// //	public static String getArticleNameByUrl(String url) {
// //		String[] s = url.split("=")[1].split("/");
// //		return getArticleName(s[s.length - 1]);
// //	}
// 
//     // http:xxxxx/a/b/[(2013-1-1,0010)]title].md
//     public static String getArticleNameByUrl(String url) {
//         String[] s = url.split("/");
//         return getArticleName(s[s.length - 1]);
//     }
// 
//     public static String encodeArticleURL(String url) {
//         try {
//             StringBuilder sb = new StringBuilder(RestClient.URL_Preview
//                     + "?path=");
//             for (String s : url.split("=")[1].split("/")) {
//                 sb.append(URLEncoder.encode(s, "UTF-8")).append("/");
//             }
//             sb.deleteCharAt(sb.length() - 1);
//             return sb.toString();
//         } catch (UnsupportedEncodingException e) {
//             e.printStackTrace();
//         }
//         return url;
//     }
// }


import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import java.util.List;
import butterknife.Bind;
import butterknife.ButterKnife;
import io.github.emanual.app.R;
import io.github.emanual.app.utils.ParseUtils;
        this.context = context;
    }

    @Override
    public int getCount() {
        return data.size();
    }

    @Override
    public Object getItem(int position) {
        return data.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder h = null;
        if (convertView == null) {
            convertView = LayoutInflater.from(context).inflate(
                    R.layout.adapter_articlelist, null);
            h = new ViewHolder(convertView);
            convertView.setTag(h);
        } else {
            h = (ViewHolder) convertView.getTag();

        }
// Path: app/src/main/java/io/github/emanual/app/utils/ParseUtils.java
// public class ParseUtils {
// 
//     public static int getArticleId(String filename) {
//         return Integer.parseInt(filename.split("-")[0]);
//     }
// 
//     // [(2013-1-1,0010)]title].md
//     public static String getArticleName(String filename) {
//         String[] s = filename.replaceAll("\\.[Mm]{1}[Dd]{1}", "").split("-");
//         //这是日期开头
//         if (_.isNumber(s[0]) && _.isNumber(s[1]) && _.isNumber(s[2])) {
//             return s[3];
//         } else { //这是文章编号
//             return s[1];
//         }
//     }
// 
//     // http:xxxxx/assets/preview.html?path=/a/b/[(2013-1-1,0010)]title].md
// //	public static String getArticleNameByUrl(String url) {
// //		String[] s = url.split("=")[1].split("/");
// //		return getArticleName(s[s.length - 1]);
// //	}
// 
//     // http:xxxxx/a/b/[(2013-1-1,0010)]title].md
//     public static String getArticleNameByUrl(String url) {
//         String[] s = url.split("/");
//         return getArticleName(s[s.length - 1]);
//     }
// 
//     public static String encodeArticleURL(String url) {
//         try {
//             StringBuilder sb = new StringBuilder(RestClient.URL_Preview
//                     + "?path=");
//             for (String s : url.split("=")[1].split("/")) {
//                 sb.append(URLEncoder.encode(s, "UTF-8")).append("/");
//             }
//             sb.deleteCharAt(sb.length() - 1);
//             return sb.toString();
//         } catch (UnsupportedEncodingException e) {
//             e.printStackTrace();
//         }
//         return url;
//     }
// }


// Path: app/src/main/java/io/github/emanual/app/ui/adapter/ArticleListAdapter.java
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import java.util.List;
import butterknife.Bind;
import butterknife.ButterKnife;
import io.github.emanual.app.R;
import io.github.emanual.app.utils.ParseUtils;

        this.context = context;
    }

    @Override
    public int getCount() {
        return data.size();
    }

    @Override
    public Object getItem(int position) {
        return data.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder h = null;
        if (convertView == null) {
            convertView = LayoutInflater.from(context).inflate(
                    R.layout.adapter_articlelist, null);
            h = new ViewHolder(convertView);
            convertView.setTag(h);
        } else {
            h = (ViewHolder) convertView.getTag();

        }
        h.title.setText(ParseUtils.getArticleName(data.get(position)));