图片加载用Fresco,网络请求用OKhttp+Retrofit实现

本文介绍了如何在Android应用中结合Fresco库进行图片加载,并利用OKhttp与Retrofit实现网络请求。通过配置AndroidManifest和设置布局,实现了高效的图片显示与后台数据交互。
摘要由CSDN通过智能技术生成

--------------清单文件-------------------

AndroidManifest

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.menglucywhh.wanghuantao171204_zhoukao1">

    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.INTERNET"/>
    <application
        android:name=".appli.IApplication"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/notitleTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>


------------布局--------------

activity_main

    
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.example.menglucywhh.wanghuantao171204_zhoukao1.MainActivity">



    <com.hjm.bottomtabbar.BottomTabBar
        android:id="@+id/bottom_tabbar"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:tab_divider_height="5dp"
        app:tab_font_size="20sp"  />
</LinearLayout>

fragment_shouye
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:orientation="vertical"
    android:layout_height="match_parent">

    <LinearLayout
        android:gravity="center_vertical"
        android:padding="10dp"
        android:background="#FF5001"
        android:layout_weight="1"
        android:layout_width="match_parent"
        android:layout_height="0dp">

        <ImageView
            android:src="@drawable/a_s"
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="30dp" />
        <EditText
            android:textSize="20sp"
            android:textColor="#fff"
            android:padding="10dp"
            android:background="#DC3002"
            android:text="搜索一下"
            android:layout_width="0dp"
            android:layout_weight="4"
            android:layout_height="wrap_content" />
        <ImageView
            android:src="@drawable/a9x"
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="30dp" />
    </LinearLayout>

    <android.support.v7.widget.RecyclerView
        android:id="@+id/shouye_recy"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="9"/>
</LinearLayout>

recy_01
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <com.youth.banner.Banner
        android:id="@+id/banner"
        android:layout_width="match_parent"
        android:layout_height="260dp"/>
</LinearLayout>
recy_01_grid
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:orientation="vertical"
    android:padding="24dp"
    android:layout_marginLeft="30dp"
    android:gravity="center_horizontal"
    android:layout_height="match_parent">

    <com.facebook.drawee.view.SimpleDraweeView
        android:id="@+id/simple_view"
        android:layout_width="60dp"
        android:layout_height="60dp" />
    
    <TextView
        android:id="@+id/text_view"
        android:textSize="18sp"
        android:text="a"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />
</LinearLayout>

recy_02
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:gravity="center"
    android:layout_height="match_parent">

    <android.support.v7.widget.RecyclerView
        android:id="@+id/recy3_recyciew"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>
</LinearLayout>

recy_03
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <com.youth.banner.Banner
        android:id="@+id/banner"
        android:layout_width="match_parent"
        android:layout_height="260dp"/>
</LinearLayout>

------依赖----------
dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    //noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    compile 'com.jakewharton:butterknife:8.8.1'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
    compile 'com.squareup.retrofit2:converter-gson:2.0.0-beta4'
    compile 'com.squareup.retrofit2:retrofit:2.0.0-beta4'
    compile 'com.facebook.fresco:fresco:0.14.1'
    compile 'com.hjm:BottomTabBar:1.1.1'
    compile 'com.youth.banner:banner:1.4.10'
    //noinspection GradleCompatible
    compile 'com.android.support:recyclerview-v7:25.3.1'
    compile 'com.squareup.okhttp3:okhttp:3.9.0'
    compile 'com.google.code.gson:gson:2.8.2'
    compile 'com.github.bumptech.glide:glide:3.7.0'
}

------类--------
MainActivity类
package com.example.menglucywhh.wanghuantao171204_zhoukao1;

import android.graphics.Color;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

import com.example.menglucywhh.wanghuantao171204_zhoukao1.adapter.RecyAdapter;
import com.example.menglucywhh.wanghuantao171204_zhoukao1.bean.OldBean;
import com.example.menglucywhh.wanghuantao171204_zhoukao1.callback.ViewCallBack;
import com.example.menglucywhh.wanghuantao171204_zhoukao1.fragment.ShouyeFragment;
import com.example.menglucywhh.wanghuantao171204_zhoukao1.presenter.MyPresenter;
import com.hjm.bottomtabbar.BottomTabBar;

import butterknife.BindView;
import butterknife.ButterKnife;

public class MainActivity extends AppCompatActivity {

    @BindView(R.id.bottom_tabbar)
    BottomTabBar bottomTabbar;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ButterKnife.bind(this);

        bottomTabbar.init(getSupportFragmentManager())
                .setImgSize(50,50)
                .setFontSize(18)
                .setTabPadding(4,6,10)
                .setChangeColor(Color.RED,Color.DKGRAY)
                .addTabItem("首页",R.drawable.home_, ShouyeFragment.class)
                .addTabItem("分类",R.drawable.classify, ShouyeFragment.class)
                .addTabItem("购物车",R.drawable.cart, ShouyeFragment.class)
                .addTabItem("个人",R.drawable.mine, ShouyeFragment.class)
                .isShowDivider(true)
                .setOnTabChangeListener(new BottomTabBar.OnTabChangeListener() {
                    @Override
                    public void onTabChange(int position, String name) {

                    }
                });




    }


}


新建retrofit包
IGetDataService类
package com.example.menglucywhh.wanghuantao171204_zhoukao1.retrofit;

import com.example.menglucywhh.wanghuantao171204_zhoukao1.bean.OldBean;

import retrofit2.Call;
import retrofit2.http.GET;
import retrofit2.http.Query;



public interface IGetDataService {

  // http://result.eolinker.com/umIPmfS6c83237d9c70c7c9510c9b0f97171a308d13b611?uri=homepage
    @GET("/umIPmfS6c83237d9c70c7c9510c9b0f97171a308d13b611")
    Call<OldBean> get(@Query("uri") String uri);

}

新建presenter包
MyPresenter类
package com.example.menglucywhh.wanghuantao171204_zhoukao1.presenter;

import com.example.menglucywhh.wanghuantao171204_zhoukao1.MainActivity;
import com.example.menglucywhh.wanghuantao171204_zhoukao1.bean.OldBean;
import com.example.menglucywhh.wanghuantao171204_zhoukao1.callback.ModelCallBack;
import com.example.menglucywhh.wanghuantao171204_zhoukao1.callback.ViewCallBack;
import com.example.menglucywhh.wanghuantao171204_zhoukao1.model.MyModel;



public class MyPresenter {

    MyModel myModel = new MyModel();
    ViewCallBack viewCallBack;
    public MyPresenter(ViewCallBack viewCallBack) {
        this.viewCallBack = viewCallBack;
    }

    public void getData() {
        myModel.getData(new ModelCallBack() {
            @Override
            public void success(OldBean oldBean) {
                viewCallBack.success(oldBean);
            }

            @Override
            public void failure() {
                viewCallBack.failure();
            }
        });
    }


    //解除绑定
    public void detach(){
        this.viewCallBack = null;
    }
}

新建okhttp包
AbstractUiCallBack类
package com.example.menglucywhh.wanghuantao171204_zhoukao1.okhttp;

import android.os.Handler;
import android.os.Looper;

import com.google.gson.Gson;

import java.io.IOException;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;

import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.Response;

public abstract  class AbstractUiCallBack<T> implements Callback{

    public abstract void success(T t);

    public abstract void fail(Exception e);


     private Handler handler = null;
    private Class clazz;

    public AbstractUiCallBack(){
        handler = new Handler(Looper.getMainLooper());

        Type type = getClass().getGenericSuperclass();

        Type[] arr = ((ParameterizedType)type).getActualTypeArguments();

        clazz = (Class) arr[0];
    }


    @Override
    public void onFailure(Call call, IOException e) {
        fail(e);
    }

    @Override
    public void onResponse(Call call, Response response) throws IOException {

        try {

          String result = response.body().string();

        Gson gson = new Gson();

        final  T t = (T) gson.fromJson(result,clazz);

        handler.post(new Runnable() {
            @Override
            public void run() {
                success(t);//成功的回调出去
            }
        });
        }catch (Exception e){
            e.printStackTrace();
            fail(e);//失败的回调
        }
    }
}

OkhttpUtils类
package com.example.menglucywhh.wanghuantao171204_zhoukao1.okhttp;

import java.util.Map;
import java.util.concurrent.TimeUnit;

import okhttp3.FormBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;

public class OkhttpUtils {

    private static OkhttpUtils okhttpUtils = null;

    private OkhttpUtils(){

    }

    public static OkHttpClient client;
  public static OkhttpUtils getInstance(){
      if(okhttpUtils==null){
          okhttpUtils = new OkhttpUtils();
        client = new OkHttpClient.Builder()
                .readTimeout(20, TimeUnit.SECONDS)
                .writeTimeout(20,TimeUnit.SECONDS)
                .connectTimeout(20,TimeUnit.SECONDS)
                //.addInterceptor(new MyInterceptor())
                .build();
      }
      return okhttpUtils;
  }

    public void asy(Map<String,String> params,String url,AbstractUiCallBack callBack){
        Request request = null;

        if(params!=null){
            FormBody.Builder builder = new FormBody.Builder();
            for(Map.Entry<String,String> entry : params.entrySet()){
                builder.add(entry.getKey(),entry.getValue());
            }

            FormBody body = builder.build();
            request = new Request.Builder()
                    .url(url)
                    .post(body)
                    .build();
        }else{
            request = new Request.Builder()
                    .url(url)
                    .build();
        }

        client.newCall(request).enqueue(callBack);
    }
}

新建model包
MyModel类
package com.example.menglucywhh.wanghuantao171204_zhoukao1.model;

import com.example.menglucywhh.wanghuantao171204_zhoukao1.appli.IApplication;
import com.example.menglucywhh.wanghuantao171204_zhoukao1.bean.OldBean;
import com.example.menglucywhh.wanghuantao171204_zhoukao1.callback.ModelCallBack;

import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;



public class MyModel {
    public void getData(final ModelCallBack modelCallBack) {
        IApplication.service.get("homepage").enqueue(new Callback<OldBean>() {
            @Override
            public void onResponse(Call<OldBean> call, Response<OldBean> response) {
                OldBean oldBean = response.body();
                modelCallBack.success(oldBean);
            }

            @Override
            public void onFailure(Call<OldBean> call, Throwable t) {
                modelCallBack.failure();

            }
        });
    }
}

新建imageload包
GildeImageLoader类
package com.example.menglucywhh.wanghuantao171204_zhoukao1.imageload;

import android.content.Context;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.youth.banner.loader.ImageLoader;


public class GildeImageLoader extends ImageLoader {
    @Override
    public void displayImage(Context context, Object path, ImageView imageView) {
        Glide.with(context).load(path).into(imageView);
    }
}

新建fragment包
ShouyeFragment类
package com.example.menglucywhh.wanghuantao171204_zhoukao1.fragment;


import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.example.menglucywhh.wanghuantao171204_zhoukao1.R;
import com.example.menglucywhh.wanghuantao171204_zhoukao1.adapter.RecyAdapter;
import com.example.menglucywhh.wanghuantao171204_zhoukao1.bean.OldBean;
import com.example.menglucywhh.wanghuantao171204_zhoukao1.callback.ViewCallBack;
import com.example.menglucywhh.wanghuantao171204_zhoukao1.presenter.MyPresenter;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;



public class ShouyeFragment extends Fragment implements ViewCallBack{
    @BindView(R.id.shouye_recy)
    RecyclerView shouyeRecy;
    Unbinder unbinder;

    List<OldBean.DataBean> list ;
    private MyPresenter myPresenter;
    private RecyAdapter recyAdapter;
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_shouye, container, false);
        unbinder = ButterKnife.bind(this, view);

        //和presenter进行绑定,
        myPresenter = new MyPresenter(this);

        //调用p层的方法
        myPresenter.getData();

        recyAdapter = new RecyAdapter(getActivity());
       shouyeRecy.setLayoutManager(new LinearLayoutManager(getActivity(),LinearLayoutManager.VERTICAL,false));
       shouyeRecy.setAdapter(recyAdapter);
        return view;
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
    }

    //成功的接口回调方法
    @Override
    public void success(OldBean oldBean) {
        // System.out.println(oldBean.getData().getSubjects().get(0).getTitle());

       if(list==null){
           list = new ArrayList<>();
       }
       list.add(oldBean.getData());
        recyAdapter.addData(list);
    }

    @Override
    public void failure() {

    }

    //在合适的时候取消绑定.防止内存泄露

    @Override
    public void onDestroy() {
        super.onDestroy();
        myPresenter.detach();
    }
}

新建callback包
ModelCallBack类
package com.example.menglucywhh.wanghuantao171204_zhoukao1.callback;

import com.example.menglucywhh.wanghuantao171204_zhoukao1.bean.OldBean;

/**
 * Created by Menglucywhh on 2017/12/4.
 */

public interface ModelCallBack {
    public void success(OldBean oldBean);
    public void failure();
}

ViewCallBack类
package com.example.menglucywhh.wanghuantao171204_zhoukao1.callback;

import com.example.menglucywhh.wanghuantao171204_zhoukao1.bean.OldBean;

/**
 * Created by Menglucywhh on 2017/12/4.
 */

public interface ViewCallBack {
    public void success(OldBean oldBean);
    public void failure();
}

新建appli包
IApplication类
package com.example.menglucywhh.wanghuantao171204_zhoukao1.appli;

import android.app.Application;

import com.example.menglucywhh.wanghuantao171204_zhoukao1.retrofit.IGetDataService;
import com.facebook.drawee.backends.pipeline.Fresco;

import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

/**
 * Created by Menglucywhh on 2017/12/4.
 */

public class IApplication extends Application{

    public static IGetDataService service;

    @Override
    public void onCreate() {
        super.onCreate();

        //初始化配置中
        Fresco.initialize(this);

        //http://result.eolinker.com/umIPmfS6c83237d9c70c7c9510c9b0f97171a308d13b611?uri=homepage
        Retrofit retrofit = new Retrofit.Builder()
                .baseUrl("http://result.eolinker.com")
                .addConverterFactory(GsonConverterFactory.create())
                .build();

        service = retrofit.create(IGetDataService.class);


    }
}

新建adapter包
Recy02Adapter类
package com.example.menglucywhh.wanghuantao171204_zhoukao1.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.example.menglucywhh.wanghuantao171204_zhoukao1.R;
import com.example.menglucywhh.wanghuantao171204_zhoukao1.bean.OldBean;
import com.facebook.drawee.view.SimpleDraweeView;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Menglucywhh on 2017/12/4.
 */

public class Recy02Adapter extends RecyclerView.Adapter<Recy02Adapter.MyViewHolder>{

    List<OldBean.DataBean.Ad5Bean> list;
    Context context;
    public Recy02Adapter(Context context){
        this.context = context;
    }

    public void addData(List<OldBean.DataBean.Ad5Bean> data) {
        if (list==null){
            list= new ArrayList<>();
        }
        list.addAll(data);
        notifyDataSetChanged();
    }


    @Override
    public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = View.inflate(context, R.layout.recy_01_grid,null);
        MyViewHolder myviewHolder = new MyViewHolder(view);
        return myviewHolder;
    }

    @Override
    public void onBindViewHolder(MyViewHolder holder, int position) {

        holder.simpleDraweeView.setImageURI(list.get(position).getImage());
        holder.textView.setText(list.get(position).getTitle());
    }

    @Override
    public int getItemCount() {
        return list==null?0:list.size();
    }

    public static class MyViewHolder extends RecyclerView.ViewHolder {

        private final SimpleDraweeView simpleDraweeView;
        private final TextView textView;

        public MyViewHolder(View itemView) {
            super(itemView);
            simpleDraweeView = itemView.findViewById(R.id.simple_view);
            textView = itemView.findViewById(R.id.text_view);
        }
    }
}

RecyAdapter类
package com.example.menglucywhh.wanghuantao171204_zhoukao1.adapter;

import android.content.Context;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;

import com.example.menglucywhh.wanghuantao171204_zhoukao1.R;
import com.example.menglucywhh.wanghuantao171204_zhoukao1.bean.OldBean;
import com.example.menglucywhh.wanghuantao171204_zhoukao1.fragment.ShouyeFragment;
import com.example.menglucywhh.wanghuantao171204_zhoukao1.imageload.GildeImageLoader;
import com.youth.banner.Banner;
import com.youth.banner.loader.ImageLoader;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Menglucywhh on 2017/12/4.
 */

public class RecyAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>{
    int ONE = 0;
    int TWO = 1;
    int THREE = 2;
    Context context;
    private List<OldBean.DataBean> list;
    public RecyAdapter(Context context){
        this.context = context;
    }

    public void addData(List<OldBean.DataBean> data) {
        if (list==null){
            list= new ArrayList<>();
        }
        list.addAll(data);
        //刷新适配器的方法
        notifyDataSetChanged();
    }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        if(viewType==ONE){

        View view = View.inflate(context, R.layout.recy_01,null);
        ViewHolder1 viewHolder1 = new ViewHolder1(view);
        return viewHolder1;
        }else if(viewType==TWO){
            View view = View.inflate(context, R.layout.recy_02,null);
            ViewHolder2 viewHolder2 = new ViewHolder2(view);
            return viewHolder2;
        }else {
            View view = View.inflate(context, R.layout.recy_03,null);
            ViewHolder3 viewHolder3 = new ViewHolder3(view);
            return viewHolder3;
        }
    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
        //判断viewholder
        if(holder instanceof ViewHolder1){
            List<String> images = new ArrayList<>();

            if(list!=null) {
                images.add(list.get(0).getAd1().get(0).getImage());
                images.add(list.get(0).getAd1().get(1).getImage());
                images.add(list.get(0).getAd1().get(2).getImage());
                images.add(list.get(0).getAd1().get(3).getImage());
                ViewHolder1 holder1 = (ViewHolder1) holder;
                //设置图片加载器
                holder1.banner.setImageLoader(new GildeImageLoader());
                //设置图片集合
                holder1.banner.setImages(images);
                //banner设置方法全部调用完毕时最后调用
                holder1.banner.start();
            }
        }else if (holder instanceof ViewHolder2){
            if(list!=null) {
                 ViewHolder2 holder2 = (ViewHolder2) holder;
                 Recy02Adapter recy02Adapter = new Recy02Adapter(context);
                 holder2.recyclerView.setLayoutManager(new GridLayoutManager(context,4));

                 recy02Adapter.addData(list.get(0).getAd5());
                 holder2.recyclerView.setAdapter(recy02Adapter);
            }

        }else{
            List<String> images = new ArrayList<>();
              if(list!=null) {

                  images.add(list.get(0).getSubjects().get(0).getImage());
                  images.add(list.get(0).getSubjects().get(1).getImage());
                  images.add(list.get(0).getSubjects().get(2).getImage());
                  images.add(list.get(0).getSubjects().get(3).getImage());
                  images.add(list.get(0).getSubjects().get(4).getImage());
                  images.add(list.get(0).getSubjects().get(5).getImage());
                ViewHolder3 holder3 = (ViewHolder3) holder;
                //设置图片加载器
                holder3.banner.setImageLoader(new GildeImageLoader());
                //设置图片集合
                holder3.banner.setImages(images);
                //banner设置方法全部调用完毕时最后调用
                holder3.banner.start();
            }


        }
    }

    @Override
    public int getItemCount() {
        return 3;
    }

    @Override
    public int getItemViewType(int position) {
        //判断是哪种条目类型
        if(position==0){
            return ONE;
        }else if(position==1){
            return TWO;
        }else{
            return THREE;
        }
    }



    public static class ViewHolder1 extends RecyclerView.ViewHolder{

        private final Banner banner;

        public ViewHolder1(View itemView) {
            super(itemView);
            banner = itemView.findViewById(R.id.banner);
        }
    }
    public static class ViewHolder2 extends RecyclerView.ViewHolder{


        private final RecyclerView recyclerView;

        public ViewHolder2(View itemView) {
            super(itemView);
            recyclerView = itemView.findViewById(R.id.recy3_recyciew);

        }
    }
    public static class ViewHolder3 extends RecyclerView.ViewHolder{
        private final Banner banner;

        public ViewHolder3(View itemView) {
            super(itemView);
            banner = itemView.findViewById(R.id.banner);
        }
    }
}


新建bean包
OldBean类
package com.example.menglucywhh.wanghuantao171204_zhoukao1.bean;

import java.util.List;

/**
 * Created by Menglucywhh on 2017/12/4.
 */

public class OldBean {

    /**
     * code : 200
     * msg : success
     * data : {"subjects":[{"id":"84","title":"新品上市","detail":"质本天然,探寻自然生命的非凡能量,给\u201c躁动\u201d的肌肤一场新的旅行~~","image":"https://image.yunifang.com/yunifang/images/goods/temp/171011162655217457875119759.jpg","start_time":"2017.05.16 09:26:13","end_time":"2017.10.31 00:00:00","show_number":6,"state":"1","sort":0,"descImage":"https://image.yunifang.com/yunifang/images/goods/temp/17051609265319705925918251.jpg","template":"templateDefault","goodsList":[{"id":"492","goods_name":"盈透美肌黑膜套装(插画版)","shop_price":99.9,"market_price":298,"goods_img":"https://image.yunifang.com/yunifang/images/goods/492/goods_img/171011191068814258195256706.jpg","reservable":false,"efficacy":"以黑吸黑 润透亮颜","stock_number":0,"restrict_purchase_num":0,"goodsName":"PG one热荐:★★★★★","goodsImage":"https://image.yunifang.com/yunifang/images/goods/temp/171011192212214258195254179.jpg","description":"三重植物精粹,三重水润膜力,美时美刻,水润透亮~"},{"id":"2076","goods_name":"鲜嫩美莓面膜套装","shop_price":129.9,"market_price":299,"goods_img":"https://image.yunifang.com/yunifang/images/goods/2076/goods_img/170930212555714134276722977.jpg","reservable":false,"efficacy":"果然水润 嫩颜美莓","stock_number":0,"restrict_purchase_num":0,"goodsName":"水润指数:★★★★☆","goodsImage":"https://image.yunifang.com/yunifang/images/goods/temp/17101119283583452898243380.jpg","description":"畅享鲜果派对,肌肤水嫩鲜活,萃取自然野草莓、黑莓、巴西莓精华,三款搭配持续水嫩鲜活~"},{"id":"1189","goods_name":"清透盈润面膜套装21片","shop_price":79.9,"market_price":297,"goods_img":"https://image.yunifang.com/yunifang/images/goods/1189/goods_img/17093019432252555150652465.jpg","reservable":false,"efficacy":"水感剔透 鲜颜嫩肌","stock_number":0,"restrict_purchase_num":0,"goodsName":"鲜嫩指数:★★★★☆","goodsImage":"https://image.yunifang.com/yunifang/images/goods/temp/17101119312216937168845205.jpg","description":"精选玫瑰、竹萃自然精粹,清洁力、补水力、亮泽度全新升级,另肌肤水感剔透~"},{"id":"1638","goods_name":"全新升级丨嫩肌酵素黑膜礼盒21片","shop_price":139.9,"market_price":299,"goods_img":"https://image.yunifang.com/yunifang/images/goods/1638/goods_img/170905151496114997886544712.jpg","reservable":false,"efficacy":"极地酵素 \u201c酵\u201d醒美肌","stock_number":0,"restrict_purchase_num":0,"goodsName":"推荐指数:★★★☆☆","goodsImage":"https://image.yunifang.com/yunifang/images/goods/temp/170905182614314997886548523.jpg","description":"蕴含南极活性补水酵素精华,持久补水锁水,轻蔬鲜果酵素助力平衡水油~"},{"id":"1830","goods_name":"新品尝鲜|水润茶萃微囊黑面膜20片","shop_price":129.9,"market_price":297,"goods_img":"https://image.yunifang.com/yunifang/images/goods/1830/goods_img/17063017284962337647468682.jpg","reservable":false,"efficacy":"只要一片 水润一天","stock_number":0,"restrict_purchase_num":0,"goodsName":"新品推荐:★★★★★","goodsImage":"https://image.yunifang.com/yunifang/images/goods/temp/1705240026717476518778188.jpg","description":"茶萃微囊精华,开创持续保湿新体验,只要一片,水润一天,持续保湿12小时以上"},{"id":"2091","goods_name":"新品上市丨V7伪妆素颜霜20g","shop_price":79,"market_price":79,"goods_img":"https://image.yunifang.com/yunifang/images/goods/2091/goods_img/170905172822119555059792173.jpg","reservable":false,"efficacy":"即刻提亮 闪亮肤色","stock_number":0,"restrict_purchase_num":0,"goodsName":"遮瑕指数:★★★★☆","goodsImage":"https://image.yunifang.com/yunifang/images/goods/temp/1709051825818467283561992.jpg","description":"如果你是素颜控,这款即刻提亮,闪亮肤色的懒人新品素颜霜你值得拥有~"},{"id":"2039","goods_name":"水润柔嫩黑膜21片","shop_price":89.9,"market_price":297,"goods_img":"https://image.yunifang.com/yunifang/images/goods/2039/goods_img/17093020002498271170145819.jpg","reservable":false,"efficacy":"自然纯粹 水润纯净","stock_number":0,"restrict_purchase_num":0,"goodsName":"补水指数:★★★☆☆","goodsImage":"https://image.yunifang.com/yunifang/images/goods/temp/171011193181418890895139029.jpg","description":"精选龙头竹菁萃、牛油果精粹、黑珍珠精粹,给你自然纯粹,水润纯净体验~"},{"id":"745","goods_name":"全新升级丨晶亮红石榴面膜7片","shop_price":79,"market_price":89,"goods_img":"https://image.yunifang.com/yunifang/images/goods/745/goods_img/17081617418998795654179347.jpg","reservable":false,"efficacy":"深度排浊 一扫黯哑","stock_number":0,"restrict_purchase_num":0,"goodsName":"亮肤指数:★★★★★","goodsImage":"https://image.yunifang.com/yunifang/images/goods/temp/170816184151311258603701437.jpg","description":"萃取红石榴原液,滴滴蕴含鲜活能量,清洁排浊、透亮无瑕,改善粗糙黯哑小能手"},{"id":"1870","goods_name":"新品尝鲜|玉润雪肌黑白膜盒20片","shop_price":129.9,"market_price":297,"goods_img":"https://image.yunifang.com/yunifang/images/goods/1870/goods_img/17071909555120332464127704.jpg","reservable":false,"efficacy":"黑白膜力 美肌如玉","stock_number":0,"restrict_purchase_num":0,"goodsName":"新品推荐:★★★★☆","goodsImage":"https://image.yunifang.com/yunifang/images/goods/temp/1707171037861467283567706.jpg","description":"白膜胶原蛋白精华,昼弹润生态库,黑膜三分子玻尿酸,夜补水先锋。黑白膜力,水肌如玉~"},{"id":"1919","goods_name":"透亮红酒酵力面膜21片","shop_price":129.9,"market_price":239,"goods_img":"https://image.yunifang.com/yunifang/images/goods/1919/goods_img/170630171021217601465422538.jpg","reservable":false,"efficacy":"红酒透亮 酵醒美肌","stock_number":0,"restrict_purchase_num":0,"goodsName":"亮肤指数:★★★★★","goodsImage":"https://image.yunifang.com/yunifang/images/goods/temp/170630224599017601465422520.jpg","description":"全新添加西班牙酵母发酵液,融合法国红酒多酚亮肤成分,加乘亮肤功效~"},{"id":"772","goods_name":"全新升级丨清润莹亮黑膜套装21片","shop_price":99.9,"market_price":297,"goods_img":"https://image.yunifang.com/yunifang/images/goods/772/goods_img/17090514228269026987111180.jpg","reservable":false,"efficacy":"自然莹亮 水感瓷肌","stock_number":0,"restrict_purchase_num":0,"goodsName":"水亮能量:★★★★☆","goodsImage":"https://image.yunifang.com/yunifang/images/goods/temp/1709191414112467283564077.jpg","description":"自然莹亮,水感瓷肌,精选龙头竹、葡萄籽,演绎水亮二重奏~"},{"id":"487","goods_name":"海洋弹性蛋白矿物精华眼霜25g","shop_price":139,"market_price":169,"goods_img":"https://image.yunifang.com/yunifang/images/goods/487/goods_img/170626101843492134395965.jpg","reservable":false,"efficacy":"提拉紧致 润亮双眸","stock_number":0,"restrict_purchase_num":0,"goodsName":"抗皱指数:★★★☆☆","goodsImage":"https://image.yunifang.com/yunifang/images/goods/temp/1706151917130467283566572.jpg","description":"不要等到有皱纹了才想起用眼霜,不要让眼睛放大你的年龄,每一滴自然精粹,都为你打造明亮双眸~"},{"id":"1281","goods_name":"新品眼霜丨红石榴矿物眼霜25g","shop_price":129,"market_price":159,"goods_img":"https://image.yunifang.com/yunifang/images/goods/1281/goods_img/1706261025558117
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值