// Path: app/src/main/java/com/bean/simplenews/api/Urls.java
// public class Urls {
// 
//     //http://c.m.163.com/nc/article/headline/T1348647909107/0-20.html
//     public static final int PAGE_SIZE = 20;
//     public static final String CATEGORY_TOP = "headline";
//     public static final String CATEGORY_COMMON = "list";
// 
//     public static final String TOP_ID = "T1348647909107";
//     public static final String NBA_ID = "T1348649145984";
//     public static final String TEC_ID = "T1348649580692";
//     public static final String FIN_ID = "T1348648756099";
//     public static final String CAR_ID = "T1348654060988";
//     public static final String JOKE_ID = "T1350383429665";
// }
// 
// Path: app/src/main/java/com/bean/simplenews/common/base/BaseApp.java
// public class BaseApp extends Application{
// 
//     //private static Typeface typeFace;
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
//         //typeFace = Typeface.createFromAsset(getAssets(),"fonts/1mRegular.ttf");
//     }
// 
//     /*public static Typeface getTypeface(){
//         return typeFace;
//     }*/
// }
// 
// Path: app/src/main/java/com/bean/simplenews/module/news/model/bean/NewsBean.java
// public class NewsBean implements Serializable {
// 
//     private String docid;
//     private String title;
//     private String imgsrc;  //图片地址
//     private String ptime;   //时间
//     private String replyCount;
// 
//     public String getDocid() {
//         return docid;
//     }
//     public void setDocid(String docid) {
//         this.docid = docid;
//     }
//     public String getTitle() {
//         return title;
//     }
//     public void setTitle(String title) {
//         this.title = title;
//     }
//     public String getImgsrc() {
//         return imgsrc;
//     }
//     public void setImgsrc(String imgsrc) {
//         this.imgsrc = imgsrc;
//     }
//     public String getPtime() {
//         return ptime.substring(5, 10);
//     }
//     public void setPtime(String ptime) {
//         this.ptime = ptime;
//     }
//     public String getReplyCount() {
//         return replyCount;
//     }
//     public void setReplyCount(String replyCount) {
//         this.replyCount = replyCount;
//     }
// }
// 
// Path: app/src/main/java/com/bean/simplenews/util/ImageLoaderUtils.java
// public class ImageLoaderUtils {
// 
//     public static void display(Context context, ImageView imageView, String url, int placeholder, int error) {
//         if(imageView == null) {
//             throw new IllegalArgumentException("argument error");
//         }
//         Glide.with(context).load(url).placeholder(placeholder)
//                 .error(error).crossFade().into(imageView);
//     }
// 
//     public static void display(Context context, ImageView imageView, String url) {
//         if(imageView == null) {
//             throw new IllegalArgumentException("argument error");
//         }
//         Glide.with(context).load(url).placeholder(R.drawable.ic_image_loading)
//                 .error(R.drawable.ic_image_loadfail).crossFade().into(imageView);
//     }
// 
// 
// }


import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.bean.simplenews.R;
import com.bean.simplenews.api.Urls;
import com.bean.simplenews.common.base.BaseApp;
import com.bean.simplenews.module.news.model.bean.NewsBean;
import com.bean.simplenews.util.ImageLoaderUtils;
import java.util.List;
            View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.news_header, parent, false);
            return new HeaderViewHolder(view);
        } else if (viewType == TYPE_ITEM) {
            View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.news_item, parent, false);
            return new ItemViewHolder(v);
        } else {
            View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.news_footer, null);
            view.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
            return new FooterViewHolder(view);
        }
    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
        if (holder instanceof HeaderViewHolder) {
            NewsBean news = mData.get(position);
            if (news == null) {
                return;
            }
            ImageLoaderUtils.display(mContext, ((HeaderViewHolder) holder).mImage, news.getImgsrc());
            ((HeaderViewHolder) holder).mTitle.setText(news.getTitle());
        }
        if (holder instanceof ItemViewHolder) {
            NewsBean news = mData.get(position);
            if (news == null) {
                return;
            }
            ((ItemViewHolder) holder).mTitle.setText(news.getTitle());
            ((ItemViewHolder) holder).mTime.setText(news.getPtime());
            ((ItemViewHolder) holder).mCount.setText(news.getReplyCount());
// Path: app/src/main/java/com/bean/simplenews/api/Urls.java
// public class Urls {
// 
//     //http://c.m.163.com/nc/article/headline/T1348647909107/0-20.html
//     public static final int PAGE_SIZE = 20;
//     public static final String CATEGORY_TOP = "headline";
//     public static final String CATEGORY_COMMON = "list";
// 
//     public static final String TOP_ID = "T1348647909107";
//     public static final String NBA_ID = "T1348649145984";
//     public static final String TEC_ID = "T1348649580692";
//     public static final String FIN_ID = "T1348648756099";
//     public static final String CAR_ID = "T1348654060988";
//     public static final String JOKE_ID = "T1350383429665";
// }
// 
// Path: app/src/main/java/com/bean/simplenews/common/base/BaseApp.java
// public class BaseApp extends Application{
// 
//     //private static Typeface typeFace;
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
//         //typeFace = Typeface.createFromAsset(getAssets(),"fonts/1mRegular.ttf");
//     }
// 
//     /*public static Typeface getTypeface(){
//         return typeFace;
//     }*/
// }
// 
// Path: app/src/main/java/com/bean/simplenews/module/news/model/bean/NewsBean.java
// public class NewsBean implements Serializable {
// 
//     private String docid;
//     private String title;
//     private String imgsrc;  //图片地址
//     private String ptime;   //时间
//     private String replyCount;
// 
//     public String getDocid() {
//         return docid;
//     }
//     public void setDocid(String docid) {
//         this.docid = docid;
//     }
//     public String getTitle() {
//         return title;
//     }
//     public void setTitle(String title) {
//         this.title = title;
//     }
//     public String getImgsrc() {
//         return imgsrc;
//     }
//     public void setImgsrc(String imgsrc) {
//         this.imgsrc = imgsrc;
//     }
//     public String getPtime() {
//         return ptime.substring(5, 10);
//     }
//     public void setPtime(String ptime) {
//         this.ptime = ptime;
//     }
//     public String getReplyCount() {
//         return replyCount;
//     }
//     public void setReplyCount(String replyCount) {
//         this.replyCount = replyCount;
//     }
// }
// 
// Path: app/src/main/java/com/bean/simplenews/util/ImageLoaderUtils.java
// public class ImageLoaderUtils {
// 
//     public static void display(Context context, ImageView imageView, String url, int placeholder, int error) {
//         if(imageView == null) {
//             throw new IllegalArgumentException("argument error");
//         }
//         Glide.with(context).load(url).placeholder(placeholder)
//                 .error(error).crossFade().into(imageView);
//     }
// 
//     public static void display(Context context, ImageView imageView, String url) {
//         if(imageView == null) {
//             throw new IllegalArgumentException("argument error");
//         }
//         Glide.with(context).load(url).placeholder(R.drawable.ic_image_loading)
//                 .error(R.drawable.ic_image_loadfail).crossFade().into(imageView);
//     }
// 
// 
// }


// Path: app/src/main/java/com/bean/simplenews/module/news/NewsAdapter.java
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.bean.simplenews.R;
import com.bean.simplenews.api.Urls;
import com.bean.simplenews.common.base.BaseApp;
import com.bean.simplenews.module.news.model.bean.NewsBean;
import com.bean.simplenews.util.ImageLoaderUtils;
import java.util.List;

            View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.news_header, parent, false);
            return new HeaderViewHolder(view);
        } else if (viewType == TYPE_ITEM) {
            View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.news_item, parent, false);
            return new ItemViewHolder(v);
        } else {
            View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.news_footer, null);
            view.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
            return new FooterViewHolder(view);
        }
    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
        if (holder instanceof HeaderViewHolder) {
            NewsBean news = mData.get(position);
            if (news == null) {
                return;
            }
            ImageLoaderUtils.display(mContext, ((HeaderViewHolder) holder).mImage, news.getImgsrc());
            ((HeaderViewHolder) holder).mTitle.setText(news.getTitle());
        }
        if (holder instanceof ItemViewHolder) {
            NewsBean news = mData.get(position);
            if (news == null) {
                return;
            }
            ((ItemViewHolder) holder).mTitle.setText(news.getTitle());
            ((ItemViewHolder) holder).mTime.setText(news.getPtime());
            ((ItemViewHolder) holder).mCount.setText(news.getReplyCount());
            ImageLoaderUtils.display(mContext, ((ItemViewHolder) holder).mNewsImg, news.getImgsrc());