1. 程式人生 > >MVP(登入判斷+xlistview+二維碼)

MVP(登入判斷+xlistview+二維碼)

1.主頁面佈局

<?xml version="1.0" encoding="utf-8"?>
<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=".Activity.MainActivity"
    android:orientation="vertical">
    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:layout_marginLeft="100dp"
        >
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="賬號:"
            android:textSize="30sp"/>
        <EditText
            android:id="@+id/etname"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:hint="請輸入賬號"/>
    </LinearLayout>
    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:layout_marginLeft="100dp"
        android:layout_marginTop="50dp"
        >
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="密碼:"
            android:textSize="30sp"/>
        <EditText
            android:id="@+id/etpass"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:hint="請輸入密碼"/>
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:gravity="center"
        android:layout_marginTop="50dp">
        <CheckBox
            android:id="@+id/check_jz"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            />
        <TextView
            android:id="@+id/textView_jz"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="記住密碼"
            android:textSize="20dp"

            />

        <CheckBox
            android:id="@+id/check_zd"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"

            />
        <TextView
            android:id="@+id/textView_zd"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="自動登入"
            android:textSize="20dp"

            />

    </LinearLayout>
    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
       android:layout_marginTop="80dp"
        android:layout_gravity="center"
        >
        <Button
            android:id="@+id/login"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="登入"/>

    </LinearLayout>




</LinearLayout>

1.2.登入切換Fragment佈局

<?xml version="1.0" encoding="utf-8"?>
<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=".Activity.loginActivity"
    android:orientation="vertical">
    <android.support.v4.view.ViewPager
        android:id="@+id/viewpage1"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="9"/>
    <RadioGroup
        android:id="@+id/radio1"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:gravity="center"
        android:orientation="horizontal"
        >
        <RadioButton
            android:id="@+id/but1"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:gravity="center"
            android:text="首頁"
            android:button="@null"
            />
        <RadioButton
            android:id="@+id/but2"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:gravity="center"
            android:text="我的"
            android:button="@null"

            />

    </RadioGroup>



</LinearLayout>

1.3Xlistview佈局

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <me.maxwin.view.XListView
        android:id="@+id/xlistview"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">
    <TextView
        android:id="@+id/title1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="22sss"/>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        >
        <ImageView
            android:id="@+id/icon1"
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:src="@mipmap/ic_launcher"/>
        <ImageView
            android:id="@+id/icon2"
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:src="@mipmap/ic_launcher"/>
        <ImageView
            android:id="@+id/icon3"
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:src="@mipmap/ic_launcher"/>

    </LinearLayout>

</LinearLayout>

1.4二維碼佈局

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">
    <TextView
        android:id="@+id/title1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="22sss"/>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        >
        <ImageView
            android:id="@+id/icon1"
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:src="@mipmap/ic_launcher"/>
        <ImageView
            android:id="@+id/icon2"
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:src="@mipmap/ic_launcher"/>
        <ImageView
            android:id="@+id/icon3"
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:src="@mipmap/ic_launcher"/>

    </LinearLayout>

</LinearLayout>

2.工具類

package com.bw.ymy.mvp_text1.Nituls;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;

public class Nutils {

    public  static String getRequest(String urlstr)
    {
        String result="";
        try {
            URL url=new URL(urlstr);
            HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
            urlConnection.setReadTimeout(3000);
            urlConnection.setConnectTimeout(3000);
            int responseCode = urlConnection.getResponseCode();
            if(responseCode==200){
                result=Stream2String(urlConnection.getInputStream());
            }
        } catch (MalformedURLException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return  result;
    }

    private static String Stream2String(InputStream inputStream)throws  IOException {
        StringBuilder stringBuilder = new StringBuilder();
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
        for (String tmp=bufferedReader.readLine();tmp!=null;tmp=bufferedReader.readLine()){
            stringBuilder.append(tmp);
        }
        return stringBuilder.toString();


    }
}

3.M

package com.bw.ymy.mvp_text1.model;

import com.bw.ymy.mvp_text1.MyCallback.Mycallback;
//建立介面
public interface IModel {

     void getRequest(String dataUrl, String param, Class clazz, Mycallback callBack);
}


////介面
package com.bw.ymy.mvp_text1.model;

import android.os.AsyncTask;

import com.bw.ymy.mvp_text1.MyCallback.Mycallback;
import com.bw.ymy.mvp_text1.Nituls.Nutils;
import com.google.gson.Gson;

//繼承介面
public class ImodelImpl implements IModel {


    public <T> T getRequest(String urlstr,String param,Class clazz)
    {
        return (T)new Gson().fromJson(Nutils.getRequest(urlstr),clazz);
    }
    @Override
    public void getRequest(final String dataUrl, final String param, final Class clazz, final Mycallback callBack) {

        new AsyncTask<String,Void,Object>()
        {
            @Override
            protected Object doInBackground(String... strings) {
                return getRequest(dataUrl,param,clazz);
            }

            @Override
            protected void onPostExecute(Object o) {
                callBack.onSuccess(o);
            }
        }.execute(dataUrl);

    }
}

3.V

package com.bw.ymy.mvp_text1.view;

public interface IView <T>{
    void  getRequest(T data);
}

3.P

//介面
package com.bw.ymy.mvp_text1.presenter;

public interface Ipresenter {

    void getRequest(String urlstr,String param,Class clazz);
}

//繼承介面
package com.bw.ymy.mvp_text1.presenter;

import com.bw.ymy.mvp_text1.MyCallback.Mycallback;
import com.bw.ymy.mvp_text1.model.ImodelImpl;
import com.bw.ymy.mvp_text1.view.IView;

public class Ipresentermpi implements Ipresenter {

    private IView mIview;
    private ImodelImpl ipresenter;

    public Ipresentermpi(IView mIview) {
        this.mIview = mIview;
        ipresenter=new ImodelImpl();
    }

    @Override
    public void getRequest(String urlstr, String param, Class clazz) {

        ipresenter.getRequest(urlstr, param, clazz, new Mycallback() {
            @Override
            public void onSuccess(Object data) {
                mIview.getRequest(data);
            }
        });

    }
    public void detach(){
        if(mIview!=null) {
            mIview = null;
        }
        if(ipresenter!=null) {
            ipresenter = null;
        }
    }
}

4.主頁面

package com.bw.ymy.mvp_text1.Activity;

import android.content.Intent;
import android.content.SharedPreferences;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.Toast;

import com.bw.ymy.mvp_text1.Bean.DengBean;
import com.bw.ymy.mvp_text1.R;
import com.bw.ymy.mvp_text1.presenter.Ipresentermpi;
import com.bw.ymy.mvp_text1.view.IView;

public class MainActivity extends AppCompatActivity implements View.OnClickListener,IView
{

    private EditText etname,etpass;
    private CheckBox checkBox1,checkBox2;
    private Button login;
    private SharedPreferences sharedPreferences;
    private SharedPreferences.Editor editor;
    private Ipresentermpi ipresentermpi;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        //獲取資源id
        etname=findViewById(R.id.etname);
        etpass=findViewById(R.id.etpass);
        checkBox1=findViewById(R.id.check_jz);
        checkBox2=findViewById(R.id.check_zd);
        login=findViewById(R.id.login);

        //
        ipresentermpi=new Ipresentermpi(this);

        login.setOnClickListener(this);

          //判斷輸入密碼是否六位   否則登入按鈕開關不顯示
        etpass.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {

            }

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {
                //按鈕可以點選,並且改變顏色
                login.setEnabled((s.length()>=6));
            }

            @Override
            public void afterTextChanged(Editable s) {
            

            }
        });


        sharedPreferences=getSharedPreferences("User",MODE_MULTI_PROCESS);
        editor=sharedPreferences.edit();
            //判斷記住密碼
        boolean    j=sharedPreferences.getBoolean("j",false);
        if(j)
        {
            String name=sharedPreferences.getString("name",null);
            String pass=sharedPreferences.getString("pass",null);
            etname.setText(name);
            etpass.setText(pass);
            checkBox2.setChecked(true);

        }
        //判斷自動登入
        boolean    z=sharedPreferences.getBoolean("z",false);
        if(z){
            String phone =etname.getText().toString();
            String pwd = etpass.getText().toString();

            checkBox1.setChecked(true);
            //iPersenter.getRequest("http://www.xieast.com/api/user/login.php?username="+phone+"&password="+pwd,null,DengBean.class);
            ipresentermpi.getRequest("http://www.xieast.com/api/user/login.php?username="+phone+"&password="+pwd,null,DengBean.class);

        }
        checkBox2.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                if(isChecked)
                {
                    checkBox2.setChecked(true);
                }else
                {
                    editor.clear();
                    editor.commit();
                }
            }
        });
    }
    @Override
    public void onClick(View v) {

        switch (v.getId())
        {
            case  R.id.login:
                String name=etname.getText().toString();
                String  pass=etpass.getText().toString();

                if(checkBox1.isChecked())
                {
                    editor.putString("name",name);
                    editor.putString("pass",pass);
                    editor.putBoolean("j",true);
                    editor.commit();
                }else
                {
                    editor.clear();
                    editor.commit();
                }
                if(checkBox2.isChecked())
                {
                    editor.putBoolean("z",true);
                    editor.commit();
                }
                ipresentermpi.getRequest("http://www.xieast.com/api/user/login.php?username="+name+"&password="+pass,null,DengBean.class);
                break;
            default:
                break;
        }
    }

    @Override
    public void getRequest(Object data) {

        DengBean dengBean= (DengBean) data;
        if(((DengBean) data).getCode()==100)
        {
            Toast.makeText(MainActivity.this,dengBean.getMsg()+"",Toast.LENGTH_LONG).show();
            Intent intent=new Intent(MainActivity.this,com.bw.ymy.mvp_text1.Activity.login.class);
            intent.putExtra("name",dengBean.getData().getName());
            startActivity(intent);
        }else
        {
            Toast.makeText(MainActivity.this,dengBean.getMsg()+"",Toast.LENGTH_SHORT).show();
        }

    }

        //解綁
    @Override
    protected void onDestroy() {
        super.onDestroy();
        ipresentermpi.detach();
    }
}

4.1Fragment切換頁面

package com.bw.ymy.mvp_text1.Activity;

import android.content.Intent;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.RadioGroup;

import com.bw.ymy.mvp_text1.Fragment.one;
import com.bw.ymy.mvp_text1.Fragment.two;
import com.bw.ymy.mvp_text1.R;

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

public class login extends FragmentActivity {
    private ViewPager viewPager1;
    private RadioGroup radio1;
    private List<Fragment> list;

    //傳到第二個頁面所定義的名字
    private String name;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);

        //跳轉到二維碼的名字
        Intent intent=getIntent();
        name=intent.getStringExtra("name");

        //獲取資源id
        viewPager1 = (ViewPager) findViewById(R.id.viewpage1);
        radio1 = (RadioGroup) findViewById(R.id.radio1);
        //新增
        list = new ArrayList<Fragment>();
              list.add(new one());
              list.add(new two());

        viewPager1.setAdapter(new FragmentStatePagerAdapter(getSupportFragmentManager()) {
            @Override
            public Fragment getItem(int i) {
                return list.get(i);
            }

            @Override
            public int getCount() {
                return list.size();
            }
        });
        //點選事件
        radio1.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup group, int checkedId) {
                switch (checkedId) {
                    case R.id.but1:
                        viewPager1.setCurrentItem(0);
                        break;
                    case R.id.but2:
                        viewPager1.setCurrentItem(1);
                        break;
                }
            }
        });
    }




    //傳過去的名字
    public String cc() {
        return name;
    }
}

4.2Fragment1頁面

package com.bw.ymy.mvp_text1.Fragment;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.bw.ymy.mvp_text1.Bean.User;
import com.bw.ymy.mvp_text1.MyBase;
import com.bw.ymy.mvp_text1.R;
import com.bw.ymy.mvp_text1.presenter.Ipresentermpi;
import com.bw.ymy.mvp_text1.view.IView;

import me.maxwin.view.XListView;

public class one extends Fragment implements IView {

    private XListView xListView;
    private Ipresentermpi ipresentermpi;
    private MyBase adapter;
    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return inflater.inflate(R.layout.one,container,false);
    }

    @Override
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        xListView=view.findViewById(R.id.xlistview);
        ipresentermpi=new Ipresentermpi(this);
        ipresentermpi.getRequest("http://www.xieast.com/api/news/news.php",null,User.class);
        adapter=new MyBase(getActivity());
        xListView.setAdapter(adapter);
    }


    //獲取集合
    @Override
    public void getRequest(Object data) {
        User user= (User) data;
        if(user.getCode()==1)
        {
            adapter.setList(user.getData());
        }
    }
}

4.3  Fragment2 頁面

package com.bw.ymy.mvp_text1.Fragment;

import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.Toast;

import com.bw.ymy.mvp_text1.Activity.MainActivity;
import com.bw.ymy.mvp_text1.Activity.login;
import com.bw.ymy.mvp_text1.R;

import java.lang.ref.WeakReference;

import cn.bingoogolapple.qrcode.zxing.QRCodeEncoder;

public class two extends Fragment {
    private ImageView image;
    private Button back;
    private SharedPreferences sharedPreferences;
    private SharedPreferences.Editor editor;

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return inflater.inflate(R.layout.two,container,false);
    }

    @Override
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);

        image=view.findViewById(R.id.image);
        back=view.findViewById(R.id.back);
        sharedPreferences=getActivity().getSharedPreferences("User",Context.MODE_MULTI_PROCESS);
        editor=sharedPreferences.edit();
        //點選返回
        back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent=new Intent(getActivity(),MainActivity.class);
                startActivity(intent);
                getActivity().finish();
                editor.clear();
                editor.commit();

            }
        });
        shengcheng();
    }


    //上個頁面名字傳過來生成二維碼
    private void shengcheng() {

        String cc=((login)getActivity()).cc();
        QRTask qrTask=new QRTask(getActivity(),image,cc);
        qrTask.execute(cc);
        Toast.makeText(getActivity(),"s"+cc,Toast.LENGTH_LONG).show();
    }
    static class  QRTask extends AsyncTask<String,Void,Bitmap>
    {
        private WeakReference<Context> mcontext;
        private  WeakReference<ImageView> mimage;
        public  QRTask(Context context,ImageView imageView,String name)
        {
            mcontext=new WeakReference<>(context);
            mimage=new WeakReference<>(imageView);
        }

        @Override
        protected Bitmap doInBackground(String... params) {

            String str=params[0];
            if(TextUtils.isEmpty(str))
            {
                return null;
            }
            int size=300;
            return QRCodeEncoder.syncEncodeQRCode(str,size);
        }

        @Override
        protected void onPostExecute(Bitmap bitmap) {

            if(bitmap!=null)
            {
                mimage.get().setImageBitmap(bitmap);
            }else
            {
                Toast.makeText(mcontext.get(),"失敗",Toast.LENGTH_LONG).show();
            }

        }
    }
}

5.建立Callback

package com.bw.ymy.mvp_text1.MyCallback;

public interface Mycallback<T> {
    void  onSuccess(T data);
}

6.Adapter

package com.bw.ymy.mvp_text1;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.bw.ymy.mvp_text1.Bean.User;
import com.nostra13.universalimageloader.core.ImageLoader;

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

public class MyBase extends BaseAdapter {
    private Context context;
    private List<User.DataBean> data;

    public MyBase(Context context) {
        this.context = context;
        data = new ArrayList<>();
    }

    public void setList(List<User.DataBean> data) {
        this.data = data;
        notifyDataSetChanged();
    }

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

    @Override
    public User.DataBean 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 holder;
        if (convertView == null) {
            convertView = LayoutInflater.from(context).inflate(R.layout.item1, parent, false);
            holder = new ViewHolder();
            holder.text1 = convertView.findViewById(R.id.title1);
            holder.icon1 = convertView.findViewById(R.id.icon1);
            holder.icon2 = convertView.findViewById(R.id.icon2);
            holder.icon3 = convertView.findViewById(R.id.icon3);
           ImageLoader.getInstance().displayImage(getItem(position).getThumbnail_pic_s(), holder.icon1);
            ImageLoader.getInstance().displayImage(getItem(position).getThumbnail_pic_s02(), holder.icon2);
            ImageLoader.getInstance().displayImage(getItem(position).getThumbnail_pic_s03(), holder.icon3);
            convertView.setTag(holder);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }
        holder.text1.setText(data.get(position).getTitle());
        return convertView;
    }

    class ViewHolder {
        TextView text1;
        ImageView icon1, icon2, icon3;
    }
}

7.登入Bean類

package com.bw.ymy.mvp_text1.Bean;

public class DengBean {

    /**
     * msg : 登入成功
     * code : 100
     * data : {"id":1,"name":"admin","mobile":13800138000}
     */

    private String msg;
    private int code;
    private DataBean data;

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public DataBean getData() {
        return data;
    }

    public void setData(DataBean data) {
        this.data = data;
    }

    public static class DataBean {
        /**
         * id : 1
         * name : admin
         * mobile : 13800138000
         */

        private int id;
        private String name;
        private long mobile;

        public int getId() {
            return id;
        }

        public void setId(int id) {
            this.id = id;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public long getMobile() {
            return mobile;
        }

        public void setMobile(long mobile) {
            this.mobile = mobile;
        }
    }
}

Xlistview類

package com.bw.ymy.mvp_text1.Bean;

import java.util.List;

public class User {

    /**
     * msg : 成功的返回
     * code : 1
     * data : [{"uniquekey":"1326bf3c4505783d4a964f81b6220e9d","title":"美國被特朗普坑慘了!又有3個鐵桿盟友公開唱對臺戲!","date":"2018-05-12 07:25","category":"頭條","author_name":"大國軍情","url":"http://mini.eastday.com/mobile/180512072544020.html","thumbnail_pic_s":"http://04.imgmini.eastday.com/mobile/20180512/20180512_fe1bf1b6ec00098f9455c84dc81e6763_cover_mwpm_03200403.jpg","thumbnail_pic_s02":"http://04.imgmini.eastday.com/mobile/20180512/20180512_3f636fca330f2311583896aed3185196_cover_mwpm_03200403.jpg","thumbnail_pic_s03":"http://04.imgmini.eastday.com/mobile/20180512/20180512_793fab03dadcd417bf2d8e5e1e48a0f5_cover_mwpm_03200403.jpg"},{"uniquekey":"9db153b507c10bbbed1d26c29c030eef","title":"第71屆戛納電影節:賈樟柯電影《江湖兒女》首映","date":"2018-05-12 07:25","category":"頭條","author_name":"新華網","url":"http://mini.eastday.com/mobile/180512072505095.html","thumbnail_pic_s":"http://01.imgmini.eastday.com/mobile/20180512/20180512072505_0fe08f494e7c090764244e3581b3e5ca_5_mwpm_03200403.jpg","thumbnail_pic_s02":"http://01.imgmini.eastday.com/mobile/20180512/20180512072505_0fe08f494e7c090764244e3581b3e5ca_1_mwpm_03200403.jpg","thumbnail_pic_s03":"http://01.imgmini.eastday.com/mobile/20180512/20180512072505_0fe08f494e7c090764244e3581b3e5ca_3_mwpm_03200403.jpg"},{"uniquekey":"4f47eb31b188cfa90881260bb2b11aa8","title":"以色列發射60枚火箭彈對伊朗進行報復,中東小霸王稱號保不住了","date":"2018-05-12 07:24","category":"頭條","author_name":"遇見優佳","url":"http://mini.eastday.com/mobile/180512072412903.html","thumbnail_pic_s":"http://06.imgmini.eastday.com/mobile/20180512/20180512_38f5183808987be3783b180740d12a2a_cover_mwpm_03200403.jpg","thumbnail_pic_s02":"http://06.imgmini.eastday.com/mobile/20180512/20180512_a3d9f98eb0e3fe36574581f00fa0f898_cover_mwpm_03200403.jpg","thumbnail_pic_s03":"http://06.imgmini.eastday.com/mobile/20180512/20180512_37fa1339af2e64cfd2dc85191950e8ba_cover_mwpm_03200403.jpg"},{"uniquekey":"a3ef77503b9924d7ad6957a5af5da5d1","title":"蘇丹駐華大使送別招待會在公共外交文化交流中心舉行","date":"2018-05-12 07:22","category":"頭條","author_name":"國際線上","url":"http://mini.eastday.com/mobile/180512072229596.html","thumbnail_pic_s":"http://00.imgmini.eastday.com/mobile/20180512/20180512072229_a296d945ae7fe08eed7d78060ce3f5c2_6_mwpm_03200403.jpg","thumbnail_pic_s02":"http://00.imgmini.eastday.com/mobile/20180512/20180512072229_a296d945ae7fe08eed7d78060ce3f5c2_7_mwpm_03200403.jpg","thumbnail_pic_s03":"http://00.imgmini.eastday.com/mobile/20180512/20180512072229_a296d945ae7fe08eed7d78060ce3f5c2_5_mwpm_03200403.jpg"},{"uniquekey":"b447b3941c73a35e587273a8a1b05c2d","title":"十九屆三中全會以來推進黨和國家機構改革述評","date":"2018-05-12 07:17","category":"頭條","author_name":"中國新聞網","url":"http://mini.eastday.com/mobile/180512071745564.html","thumbnail_pic_s":"http://00.imgmini.eastday.com/mobile/20180512/20180512071745_6accdc1c2a1356851f0bf51247a8f256_9_mwpm_03200403.jpg","thumbnail_pic_s02":"http://00.imgmini.eastday.com/mobile/20180512/20180512071745_6accdc1c2a1356851f0bf51247a8f256_8_mwpm_03200403.jpg","thumbnail_pic_s03":"http://00.imgmini.eastday.com/mobile/20180512/20180512071745_6accdc1c2a1356851f0bf51247a8f256_4_mwpm_03200403.jpg"},{"uniquekey":"fc91bd75121e2e84a6cb3d239ddb9846","title":"太反常!特朗普聲稱退出伊核協議以來,伊朗的表現讓美軍不適應","date":"2018-05-12 07:15","category":"頭條","author_name":"阿爾法軍事","url":"http://mini.eastday.com/mobile/180512071539046.html","thumbnail_pic_s":"http://01.imgmini.eastday.com/mobile/20180512/20180512_85e54ca8649794d2c3fdf06faf04fa87_cover_mwpm_03200403.jpg","thumbnail_pic_s02":"http://01.imgmini.eastday.com/mobile/20180512/20180512_e8df98afa3707e436d1793e66d5bc063_cover_mwpm_03200403.jpg","thumbnail_pic_s03":"http://01.imgmini.eastday.com/mobile/20180512/20180512_a1d1e3735f424eba66244a7842b2f7bf_cover_mwpm_03200403.jpg"},{"uniquekey":"ebed0b6a189873fa375a47ee8463c9be","title":"滬正在全面消除無證餐飲店鋪 \u201c共享餐廳\u201d最快6月運營","date":"2018-05-12 07:13","category":"頭條","author_name":"東方網","url":"http://mini.eastday.com/mobile/180512071324017.html","thumbnail_pic_s":"http://06.imgmini.eastday.com/mobile/20180512/20180512071324_ae237ccc4fcee20ec4909588b5b7609f_1_mwpm_03200403.jpg"},{"uniquekey":"8a88eb5466a46cf6d975579ccb658e29","title":"特朗普嘲諷奧巴馬:他花18億救人,我讓朝鮮免費放人","date":"2018-05-12 07:09","category":"頭條","author_name":"解放網","url":"http://mini.eastday.com/mobile/180512070940666.html","thumbnail_pic_s":"http://05.imgmini.eastday.com/mobile/20180512/20180512070940_3108dd32b82c16f350b949340f95a647_1_mwpm_03200403.jpg"},{"uniquekey":"6113c546a13e9292ced28b0199a23108","title":"身在國外,這五點我必須說清楚!","date":"2018-05-12 07:03","category":"頭條","author_name":"新華網","url":"http://mini.eastday.com/mobile/180512070344831.html","thumbnail_pic_s":"http://02.imgmini.eastday.com/mobile/20180512/20180512070344_7f0366d60dea69d79c1f0432600b5f20_4_mwpm_03200403.jpg","thumbnail_pic_s02":"http://02.imgmini.eastday.com/mobile/20180512/20180512070344_7f0366d60dea69d79c1f0432600b5f20_2_mwpm_03200403.jpg","thumbnail_pic_s03":"http://02.imgmini.eastday.com/mobile/20180512/20180512070344_7f0366d60dea69d79c1f0432600b5f20_3_mwpm_03200403.jpg"},{"uniquekey":"ca9d43ed0e6875692164bea6cc898065","title":"再\u201c讀\u201d汶川|究竟是一種什麼樣的力量,讓中國人如此勇敢地面對可怕的災難?","date":"2018-05-12 06:59","category":"頭條","author_name":"解放網","url":"http://mini.eastday.com/mobile/180512065922743.html","thumbnail_pic_s":"http://03.imgmini.eastday.com/mobile/20180512/20180512065922_e367e5443f66512176376bd05ed65f9a_1_mwpm_03200403.jpg"},{"uniquekey":"da0a52bc92c10e81d16a4e728701cffc","title":"十年對比:通往汶川的唯一通道十年之變","date":"2018-05-12 06:50","category":"頭條","author_name":"中國網","url":"http://mini.eastday.com/mobile/180512065018882.html","thumbnail_pic_s":"http://03.imgmini.eastday.com/mobile/20180512/20180512065018_01abef975bd32ccc728ac4e4e6a7ec6e_2_mwpm_03200403.jpg","thumbnail_pic_s02":"http://03.imgmini.eastday.com/mobile/20180512/20180512065018_9cfcb8c2869e997daf379bb7ce19180e_6_mwpm_03200403.jpg","thumbnail_pic_s03":"http://03.imgmini.eastday.com/mobile/20180512/20180512065018_0b79422343a8c1c37ec8121cd0c7a11c_5_mwpm_03200403.jpg"},{"uniquekey":"fa498034a3f9cd9fa2f5e0a2fbfd4da4","title":"全國第一!上海的馬路邊,應該容得下更多街頭藝人","date":"2018-05-12 06:49","category":"頭條","author_name":"解放網","url":"http://mini.eastday.com/mobile/180512064903130.html","thumbnail_pic_s":"http://05.imgmini.eastday.com/mobile/20180512/20180512064903_6a2e203b71d2710aded08d300ab29eeb_1_mwpm_03200403.jpg"},{"uniquekey":"e1b21b938c2fc3a7345ca5bd93ab3d8e","title":"被吐槽演技差的宋茜這回動真格的,吳亦凡黃子韜們也跟上節奏了!","date":"2018-05-12 06:46","category":"頭條","author_name":"網易越娛樂","url":"http://mini.eastday.com/mobile/180512064621690.html","thumbnail_pic_s":"http://04.imgmini.eastday.com/mobile/20180512/20180512064621_bab229c7b39e6fa7e59dd27703ddfb38_2_mwpm_03200403.jpg","thumbnail_pic_s02":"http://04.imgmini.eastday.com/mobile/20180512/20180512064621_bab229c7b39e6fa7e59dd27703ddfb38_3_mwpm_03200403.jpg","thumbnail_pic_s03":"http://04.imgmini.eastday.com/mobile/20180512/20180512064621_bab229c7b39e6fa7e59dd27703ddfb38_1_mwpm_03200403.jpg"},{"uniquekey":"526a4c110dedc726aa4e53afbcbea23d","title":"美國重新制裁伊朗 德國經濟界擔憂遭連累","date":"2018-05-12 06:38","category":"頭條","author_name":"解放網","url":"http://mini.eastday.com/mobile/180512063843828.html","thumbnail_pic_s":"http://09.imgmini.eastday.com/mobile/20180512/20180512063843_59894e298ee0432f1d141cb347f356c8_1_mwpm_03200403.jpg"},{"uniquekey":"e0a21ea66ac913345a3ddeef2de9acea","title":"馬哈蒂爾宣佈特赦前副總理安華 二十年前送其入獄","date":"2018-05-12 06:38","category":"頭條","author_name":"解放網","url":"http://mini.eastday.com/mobile/180512063843353.html","thumbnail_pic_s":"http://06.imgmini.eastday.com/mobile/20180512/20180512063843_b6081361df8e6cd58b6d52035cb3ee3a_1_mwpm_03200403.jpg"},{"uniquekey":"06c93effa61afee08c768604e97de4d2","title":"日本二手店驚現陳水扁競選外套 臺網友酸:穿上之後手都不會抖了","date":"2018-05-12 06:38","category":"頭條","author_name":"解放網","url":"http://mini.eastday.com/mobile/180512063843086.html","thumbnail_pic_s":"http://03.imgmini.eastday.com/mobile/20180512/20180512063843_a198728f6df54faf3ac82f9eff70a209_1_mwpm_03200403.jpg"},{"uniquekey":"ed31cf77aaf7073879898beaed6b172d","title":"10年過去了,他們還好嗎","date":"2018-05-12 06:19","category":"頭條","author_name":"人民網","url":"http://mini.eastday.com/mobile/180512061919917.html","thumbnail_pic_s":"http://04.imgmini.eastday.com/mobile/20180512/20180512061919_eae4ad26c428cc7f961a1d6cf6e4264e_2_mwpm_03200403.jpg","thumbnail_pic_s02":"http://04.imgmini.eastday.com/mobile/20180512/20180512061919_eae4ad26c428cc7f961a1d6cf6e4264e_7_mwpm_03200403.jpg","thumbnail_pic_s03":"http://04.imgmini.eastday.com/mobile/20180512/20180512061919_eae4ad26c428cc7f961a1d6cf6e4264e_4_mwpm_03200403.jpg"},{"uniquekey":"fa422c905b7767276acd999a9439b43c","title":"新聞早餐:打撈人員發現疑似殺空姐嫌犯屍體 將做DNA鑑定","date":"2018-05-12 06:15","category":"頭條","author_name":"新聞早餐","url":"http://mini.eastday.com/mobile/180512061559294.html","thumbnail_pic_s":"http://02.imgmini.eastday.com/mobile/20180512/20180512_418566db5b32e600bc27d0bc8cb0a6a6_cover_mwpm_03200403.jpg","thumbnail_pic_s02":"http://02.imgmini.eastday.com/mobile/20180512/20180512_8d766fd5086f98ec8741ed44505ce35c_cover_mwpm_03200403.jpg","thumbnail_pic_s03":"http://02.imgmini.eastday.com/mobile/20180512/20180512_509df6c0c45109a6989bc86c663d02cd_cover_mwpm_03200403.jpg"},{"uniquekey":"92ee0d2a31867a8f215b0517d99a9409","title":"難忘救援經歷 回憶激勵前行 ","date":"2018-05-12 06:07","category":"頭條","author_name":"大眾網","url":"http://mini.eastday.com/mobile/180512060745166.html","thumbnail_pic_s":"http://07.imgmini.eastday.com/mobile/20180512/20180512060745_78550703b206b53ace6a0c51b1d737d4_1_mwpm_03200403.jpg"},{"uniquekey":"164f8861bd6628737684dcff49f376d2","title":"回望汶川(下)| 房子差不多修好了,那麼人呢?","date":"2018-05-12 06:07","category":"頭條","author_name":"解放網","url":"http://mini.eastday.com/mobile/180512060707642.html","thumbnail_pic_s":"http://04.imgmini.eastday.com/mobile/20180512/20180512060707_4f667adcf6d62ec0b177add95ac037e9_1_mwpm_03200403.jpg"},{"uniquekey":"a8832fbcd574b6675c0cf3a0d37937bc","title":"竟為\u201c兩岸一家親\u201d向深綠道歉,謀求連任臺北市長的柯文哲向蔡英文\u201c折腰認錯\u201d","date":"2018-05-12 06:07","category":"頭條","author_name":"解放網","url":"http://mini.eastday.com/mobile/180512060707366.html","thumbnail_pic_s":"http://07.imgmini.eastday.com/mobile/20180512/20180512060707_72a977a668e79cc22e88db944b2871ce_1_mwpm_03200403.jpg"},{"uniquekey":"92f7d43683b6d8b300ecb8888148d70e","title":"【鉤沉】\u201c摸著石頭過河\u201d,是鄧小平的原創嗎","date":"2018-05-12 06:07","category":"頭條","author_name":"解放網","url":"http://mini.eastday.com/mobile/180512060706828.html","thumbnail_pic_s":"http://09.imgmini.eastday.com/mobile/20180512/20180512060706_82f81c098284dc2144d47776df34b478_1_mwpm_03200403.jpg"},{"uniquekey":"4ca3a79d5762fb1d130daeadfb1f7be9","title":"忠誠守護 老人被埋170小時 家中狗狗掙脫繩索陪伴不離","date":"2018-05-12 06:01","category":"頭條","author_name":"中青線上","url":"http://mini.eastday.com/mobile/180512060138223.html","thumbnail_pic_s":"http://03.imgmini.eastday.com/mobile/20180512/20180512060138_731141065c8389f053e98fd09959e9b2_2_mwpm_03200403.jpg","thumbnail_pic_s02":"http://03.imgmini.eastday.com/mobile/20180512/20180512060138_731141065c8389f053e98fd09959e9b2_1_mwpm_03200403.jpg","thumbnail_pic_s03":"http://03.imgmini.eastday.com/mobile/20180512/20180512060138_731141065c8389f053e98fd09959e9b2_3_mwpm_03200403.jpg"},{"uniquekey":"e93a1d8243a9037b1da76adc7a793739","title":"西安再添世界500強企業 將為大西安人才發展戰略提供新動能","date":"2018-05-12 05:37","category":"頭條","author_name":"人民網","url":"http://mini.eastday.com/mobile/180512053736878.html","thumbnail_pic_s":"http://07.imgmini.eastday.com/mobile/20180512/20180512053736_8f66fb9da7fc1f943a0ce8e61a694391_3_mwpm_03200403.jpg","thumbnail_pic_s02":"http://07.imgmini.eastday.com/mobile/20180512/20180512053736_8f66fb9da7fc1f943a0ce8e61a694391_4_mwpm_03200403.jpg","thumbnail_pic_s03":"http://07.imgmini.eastday.com/mobile/20180512/20180512053736_8f66fb9da7fc1f943a0ce8e61a694391_1_mwpm_03200403.jpg"},{"uniquekey":"b006b13ae3d14707f881eb92fc914ecd","title":"高速車道突然飛來輪胎 司機握緊方向盤救了一車遊客","date":"2018-05-12 05:36","category":"頭條","author_name":"中國新聞網","url":"http://mini.eastday.com/mobile/180512053627582.html","thumbnail_pic_s":"http://02.imgmini.eastday.com/mobile/20180512/20180512053627_9945660161d740d7ed793166d7227a70_1_mwpm_03200403.jpg","thumbnail_pic_s02":"http://02.imgmini.eastday.com/mobile/20180512/20180512053627_9945660161d740d7ed793166d7227a70_2_mwpm_03200403.jpg"},{"uniquekey":"94eee6750d18b56e69e7f21639e3e5f1","title":"早讀|上海將籌建\u201c中共一大紀念館\u201d","date":"2018-05-12 05:36","category":"頭條","author_name":"解放網","url":"http://mini.eastday.com/mobile/180512053610949.html","thumbnail_pic_s":"http://01.imgmini.eastday.com/mobile/20180512/20180512053610_4bc3792a8ae8dfa412a4da9f45478910_1_mwpm_03200403.jpg"},{"uniquekey":"fb1c5b67794834d0a6103a20b64854c0","title":"中國電子商務快速發展 給世界帶來巨大商機","date":"2018-05-12 05:23","category":"頭條","author_name":"西安晚報","url":"http://mini.eastday.com/mobile/180512052309026.html","thumbnail_pic_s":"http://02.imgmini.eastday.com/mobile/20180512/20180512052309_d81eabc5f596d49d94d73f8b3fbc6a8c_1_mwpm_03200403.jpg"},{"uniquekey":"4aa30f5d94850ca14205845bc5847c5a","title":"\u201c竹簡\u201d寄情 感恩父母","date":"2018-05-12 05:15","category":"頭條","author_name":"大眾網","url":"http://mini.eastday.com/mobile/180512051537520.html","thumbnail_pic_s":"http://04.imgmini.eastday.com/mobile/20180512/20180512051537_1f79912ff681c7cc4a96a6f97f967479_1_mwpm_03200403.jpg"},{"uniquekey":"e491de85803b55c5412ad0fbb2346a87","title":"北京海運進出口貨物七成走天津","date":"2018-05-12 05:07","category":"頭條","author_name":"光明網","url":"http://mini.eastday.com/mobile/180512050734360.html","thumbnail_pic_s":"http://09.imgmini.eastday.com/mobile/20180512/20180512050734_de8eae16975f2ddf8223b7c549096c70_3_mwpm_03200403.jpg","thumbnail_pic_s02":"http://09.imgmini.eastday.com/mobile/20180512/20180512050734_de8eae16975f2ddf8223b7c549096c70_1_mwpm_03200403.jpg","thumbnail_pic_s03":"http://09.imgmini.eastday.com/mobile/20180512/20180512050734_de8eae16975f2ddf8223b7c549096c70_2_mwpm_03200403.jpg"},{"uniquekey":"2f2995abb898f94aeacecd6537013404","title":"生活中誘發痔瘡的五個原因不可忽略, 痔瘡的治療方法","date":"2018-05-12 04:56","category":"頭條","author_name":"鳳凰網","url":"http://mini.eastday.com/mobile/180512045657878.html","thumbnail_pic_s":"http://02.imgmini.eastday.com/mobile/20180512/20180512045657_15014004f9669c5aee78579be692dd66_1_mwpm_03200403.jpg","thumbnail_pic_s02":"http://02.imgmini.eastday.com/mobile/20180512/20180512045657_15014004f9669c5aee78579be692dd66_2_mwpm_03200403.jpg"}]
     */

    private String msg;
    private int code;
    private List<DataBean> data;

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public List<DataBean> getData() {
        return data;
    }

    public void setData(List<DataBean> data) {
        this.data = data;
    }

    public static class DataBean {
        /**
         * uniquekey : 1326bf3c4505783d4a964f81b6220e9d
         * title : 美國被特朗普坑慘了!又有3個鐵桿盟友公開唱對臺戲!
         * date : 2018-05-12 07:25
         * category : 頭條
         * author_name : 大國軍情
         * url : http://mini.eastday.com/mobile/180512072544020.html
         * thumbnail_pic_s : http://04.imgmini.eastday.com/mobile/20180512/20180512_fe1bf1b6ec00098f9455c84dc81e6763_cover_mwpm_03200403.jpg
         * thumbnail_pic_s02 : http://04.imgmini.eastday.com/mobile/20180512/20180512_3f636fca330f2311583896aed3185196_cover_mwpm_03200403.jpg
         * thumbnail_pic_s03 : http://04.imgmini.eastday.com/mobile/20180512/20180512_793fab03dadcd417bf2d8e5e1e48a0f5_cover_mwpm_03200403.jpg
         */

        private String uniquekey;
        private String title;
        private String date;
        private String category;
        private String author_name;
        private String url;
        private String thumbnail_pic_s;
        private String thumbnail_pic_s02;
        private String thumbnail_pic_s03;

        public String getUniquekey() {
            return uniquekey;
        }

        public void setUniquekey(String uniquekey) {
            this.uniquekey = uniquekey;
        }

        public String getTitle() {
            return title;
        }

        public void setTitle(String title) {
            this.title = title;
        }

        public String getDate() {
            return date;
        }

        public void setDate(String date) {
            this.date = date;
        }

        public String getCategory() {
            return category;
        }

        public void setCategory(String category) {
            this.category = category;
        }

        public String getAuthor_name() {
            return author_name;
        }

        public void setAuthor_name(String author_name) {
            this.author_name = author_name;
        }

        public String getUrl() {
            return url;
        }

        public void setUrl(String url) {
            this.url = url;
        }

        public String getThumbnail_pic_s() {
            return thumbnail_pic_s;
        }

        public void setThumbnail_pic_s(String thumbnail_pic_s) {
            this.thumbnail_pic_s = thumbnail_pic_s;
        }

        public String getThumbnail_pic_s02() {
            return thumbnail_pic_s02;
        }

        public void setThumbnail_pic_s02(String thumbnail_pic_s02) {
            this.thumbnail_pic_s02 = thumbnail_pic_s02;
        }

        public String getThumbnail_pic_s03() {
            return thumbnail_pic_s03;
        }

        public void setThumbnail_pic_s03(String thumbnail_pic_s03) {
            this.thumbnail_pic_s03 = thumbnail_pic_s03;
        }
    }
}

App

package com.bw.ymy.mvp_text1;

import android.app.Application;
import android.graphics.Bitmap;

import com.nostra13.universalimageloader.cache.disc.impl.ext.LruDiskCache;
import com.nostra13.universalimageloader.cache.disc.naming.HashCodeFileNameGenerator;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;

import java.io.IOException;

public class App extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        try {
            ImageLoader.getInstance().init(new ImageLoaderConfiguration.Builder(this)

                    //快取
                    .diskCache(new LruDiskCache(getCacheDir(),new HashCodeFileNameGenerator(),50*1024*1024))
                    .diskCacheSize(50*1024*1024)
                    //數量
                    .memoryCacheSizePercentage(10)
                    .defaultDisplayImageOptions(new DisplayImageOptions.Builder()
                            //色彩模式
                            .bitmapConfig(Bitmap.Config.RGB_565)
                            .cacheOnDisk(true)
                            .cacheInMemory(true)
                            .showImageOnLoading(R.mipmap.ic_launcher)
                            .showImageOnFail(R.mipmap.ic_launcher)
                            .showImageForEmptyUri(R.mipmap.ic_launcher)
                            .build())
                    .build());
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}