/*
 * Copyright 2017 huxizhijian
 *
 * 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 org.huxizhijian.hhcomicviewer.adapter;

import android.content.Context;
import android.content.Intent;
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 org.huxizhijian.hhcomicviewer.R;
import org.huxizhijian.hhcomicviewer.adapter.entity.ClassifiesEntity;
import org.huxizhijian.hhcomicviewer.ui.recommend.ClassifiesShowActivity;
import org.huxizhijian.sdk.imageloader.ImageLoaderOptions;
import org.huxizhijian.sdk.imageloader.listener.ImageLoaderManager;

import java.util.List;

/**
 * 分类，排行榜显示适配器
 *
 * @author huxizhijian
 * @date 2017/1/8
 */

public class ClassifiesAdapter extends RecyclerView.Adapter<ClassifiesAdapter.ClassifiesViewHolder> {

    private Context mContext;
    private LayoutInflater mInflater;
    private List<ClassifiesEntity> mClassifiesEntities;

    //图片加载工具
    private ImageLoaderManager mImageLoader = ImageLoaderOptions.getImageLoaderManager();

    public ClassifiesAdapter(Context context, List<ClassifiesEntity> classifiesEntities) {
        this.mContext = context;
        this.mClassifiesEntities = classifiesEntities;
        mInflater = LayoutInflater.from(context);
    }

    @Override
    public ClassifiesAdapter.ClassifiesViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new ClassifiesViewHolder(mInflater.inflate(R.layout.item_classifies, parent, false));
    }

    @Override
    public void onBindViewHolder(ClassifiesAdapter.ClassifiesViewHolder holder, final int position) {
        mImageLoader.displayThumbnail(mContext, mClassifiesEntities.get(position).getClassifiesPicUrl(), holder.iv,
                R.mipmap.blank, R.mipmap.blank, 165, 220);
        holder.tv.setText(mClassifiesEntities.get(position).getClassifiesName());
        holder.itemView.setOnClickListener(v -> {
            Intent intent = new Intent(mContext, ClassifiesShowActivity.class);
            intent.putExtra("url", mClassifiesEntities.get(position).getClassifiesUrl());
            intent.putExtra("classifies_name", mClassifiesEntities.get(position).getClassifiesName());
            mContext.startActivity(intent);
        });
    }

    @Override
    public int getItemCount() {
        return mClassifiesEntities.size();
    }

    class ClassifiesViewHolder extends RecyclerView.ViewHolder {

        ImageView iv;
        TextView tv;

        ClassifiesViewHolder(View itemView) {
            super(itemView);
            iv = itemView.findViewById(R.id.imageView_classifies);
            tv = itemView.findViewById(R.id.textView_classifies);
        }
    }

}

@@ -1267,40 +1267,26 @@
 %E5%99%A8%0A *
-%0A * @author huxizhijian%0A * @date
+ Created by wei on
  201
@@ -1290,16 +1290,17 @@
 2017/1/8
+.
 %0A */%0A%0Apu
@@ -2510,12 +2510,98 @@
 ner(
-v -%3E
+new View.OnClickListener() %7B%0A            @Override%0A            public void onClick(View v)
  %7B%0A 
@@ -2611,16 +2611,20 @@
         
+    
 Intent i
@@ -2679,24 +2679,28 @@
 ity.class);%0A
+    
             
@@ -2781,32 +2781,36 @@
 ));%0A            
+    
 intent.putExtra(
@@ -2896,16 +2896,20 @@
         
+   
+ 
 mContext
@@ -2928,24 +2928,38 @@
 ty(intent);%0A
+            %7D%0A
         %7D);%0A
@@ -3262,16 +3262,28 @@
     iv =
+ (ImageView)
  itemVie
@@ -3341,16 +3341,27 @@
     tv =
+ (TextView)
  itemVie

Revert "提交"