// Path: app/src/main/java/com/lijizhi/studydemo/entity/GirlData.java
// public class GirlData {
//     //地址
//     private String imgUrl;
// 
//     public String getImgUrl() {
//         return imgUrl;
//     }
// 
//     public void setImgUrl(String imgUrl) {
//         this.imgUrl = imgUrl;
//     }
// }
// 
// Path: app/src/main/java/com/lijizhi/studydemo/utils/PicassoUtils.java
// public class PicassoUtils {
// 
//     //默认加载图片
//     public static void loadImaheView(Context mContext, String url, ImageView imageView) {
//         Picasso.with(mContext).load(url).into(imageView);
//     }
// 
//     //默认加载图片(指定大小)
//     public static void loadImageViewSize(Context mContext, String url, int width, int height, ImageView imageView) {
//         Picasso.with(mContext).load(url).config(Bitmap.Config.RGB_565).resize(width, height).centerCrop().into(imageView);
//     }
// 
//     //加载图片有默认图片
//     public static void loadImageViewHolder(Context mContext, String url, int loadImg,
//                                            int errorImg, ImageView imageView) {
//         Picasso.with(mContext).load(url).placeholder(loadImg).error(errorImg)
//                 .into(imageView);
//     }
// 
//     //裁剪图片
//     public static void loadImageViewCrop(Context mContext, String url,ImageView imageView){
//         Picasso.with(mContext).load(url).transform(new CropSquareTransformation()).into(imageView);
//     }
// 
//     //按比例裁剪 矩形
//     public static class CropSquareTransformation implements Transformation {
//         @Override
//         public Bitmap transform(Bitmap source) {
//             int size = Math.min(source.getWidth(), source.getHeight());
//             int x = (source.getWidth() - size) / 2;
//             int y = (source.getHeight() - size) / 2;
//             Bitmap result = Bitmap.createBitmap(source, x, y, size, size);
//             if (result != source) {
//                 //回收
//                 source.recycle();
//             }
//             return result;
//         }
// 
//         @Override public String key() {
//             return "lgl";
//         }
//     }
// 
// }


import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import com.lijizhi.studydemo.R;
import com.lijizhi.studydemo.entity.GirlData;
import com.lijizhi.studydemo.utils.PicassoUtils;
import java.util.List;
import static android.support.v7.appcompat.R.attr.height;

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

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

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

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder viewHolder = null;
        if(convertView == null){
            viewHolder = new ViewHolder();
            convertView = inflater.inflate(R.layout.girl_item,null);
            viewHolder.imageView = (ImageView) convertView.findViewById(R.id.imageview);
            convertView.setTag(viewHolder);
        }else {
            viewHolder = (ViewHolder) convertView.getTag();
        }

        data = mList.get(position);
        //解析图片
// Path: app/src/main/java/com/lijizhi/studydemo/entity/GirlData.java
// public class GirlData {
//     //地址
//     private String imgUrl;
// 
//     public String getImgUrl() {
//         return imgUrl;
//     }
// 
//     public void setImgUrl(String imgUrl) {
//         this.imgUrl = imgUrl;
//     }
// }
// 
// Path: app/src/main/java/com/lijizhi/studydemo/utils/PicassoUtils.java
// public class PicassoUtils {
// 
//     //默认加载图片
//     public static void loadImaheView(Context mContext, String url, ImageView imageView) {
//         Picasso.with(mContext).load(url).into(imageView);
//     }
// 
//     //默认加载图片(指定大小)
//     public static void loadImageViewSize(Context mContext, String url, int width, int height, ImageView imageView) {
//         Picasso.with(mContext).load(url).config(Bitmap.Config.RGB_565).resize(width, height).centerCrop().into(imageView);
//     }
// 
//     //加载图片有默认图片
//     public static void loadImageViewHolder(Context mContext, String url, int loadImg,
//                                            int errorImg, ImageView imageView) {
//         Picasso.with(mContext).load(url).placeholder(loadImg).error(errorImg)
//                 .into(imageView);
//     }
// 
//     //裁剪图片
//     public static void loadImageViewCrop(Context mContext, String url,ImageView imageView){
//         Picasso.with(mContext).load(url).transform(new CropSquareTransformation()).into(imageView);
//     }
// 
//     //按比例裁剪 矩形
//     public static class CropSquareTransformation implements Transformation {
//         @Override
//         public Bitmap transform(Bitmap source) {
//             int size = Math.min(source.getWidth(), source.getHeight());
//             int x = (source.getWidth() - size) / 2;
//             int y = (source.getHeight() - size) / 2;
//             Bitmap result = Bitmap.createBitmap(source, x, y, size, size);
//             if (result != source) {
//                 //回收
//                 source.recycle();
//             }
//             return result;
//         }
// 
//         @Override public String key() {
//             return "lgl";
//         }
//     }
// 
// }


// Path: app/src/main/java/com/lijizhi/studydemo/adapter/GridAdapter.java
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import com.lijizhi.studydemo.R;
import com.lijizhi.studydemo.entity.GirlData;
import com.lijizhi.studydemo.utils.PicassoUtils;
import java.util.List;
import static android.support.v7.appcompat.R.attr.height;


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

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

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

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder viewHolder = null;
        if(convertView == null){
            viewHolder = new ViewHolder();
            convertView = inflater.inflate(R.layout.girl_item,null);
            viewHolder.imageView = (ImageView) convertView.findViewById(R.id.imageview);
            convertView.setTag(viewHolder);
        }else {
            viewHolder = (ViewHolder) convertView.getTag();
        }

        data = mList.get(position);
        //解析图片
        String url = data.getImgUrl();