admin
2021-06-11 ae4dc86b64bd8ef85bc832106741fb98e8d516da
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
package com.tejia.lijin.app.ui.mine;
 
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.bumptech.glide.Glide;
import com.tejia.lijin.app.R;
 
import java.util.ArrayList;
import java.util.HashMap;
 
public class FreeChargeDetailsAdapter extends BaseAdapter {
 
    private ArrayList<HashMap<String, String>> mlist;
    private LayoutInflater mInflater;
    private FreeChargeDetailsActivity mcontext;
 
 
    public FreeChargeDetailsAdapter(FreeChargeDetailsActivity context, ArrayList<HashMap<String, String>> list) {
        mlist = list;
        mInflater = LayoutInflater.from(context);
        mcontext = context;
    }
 
    @Override
    public int getCount() {
        return mlist == null ? 0 : 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 holder = null;
        if (convertView == null) {
            holder = new ViewHolder();
            convertView = mInflater.inflate(R.layout.item_helpcentere_content, null);
            holder.helpcenter_info_img = convertView.findViewById(R.id.helpcenter_info_img);
            holder.helpcenter_money_info = convertView.findViewById(R.id.helpcenter_money_info);
            holder.helpcenter_desc_info = convertView.findViewById(R.id.helpcenter_desc_info);
            holder.helpcenter_createtime = convertView.findViewById(R.id.helpcenter_createtime);
            convertView.setTag(holder);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }
        Glide.with(mcontext)//加载图片
                .load(mlist.get(position).get("picture") + "")
                .into(holder.helpcenter_info_img);
        holder.helpcenter_money_info.setText(mlist.get(position).get("title") + "");
        holder.helpcenter_desc_info.setText(mlist.get(position).get("actualPay") + "");
        holder.helpcenter_createtime.setText(mlist.get(position).get("actualCount") + "");
        if (position > 1 && position >= mlist.size() - 1) {
            mcontext.fullScrollClick(1221);//回到顶部
        }
        return convertView;
    }
 
//    @Override
//    public void fullScrollClick(int postion) {
//        if (postion == 10002) {//activity 结束
//            mcontext = null;
//            mlist = null;
//            mInflater = null;
//        }
//    }
 
 
    /*控件缓存类*/
    class ViewHolder {
        ImageView helpcenter_info_img;//商品图像
        TextView helpcenter_money_info;//标题
        TextView helpcenter_desc_info;//付款金额
        TextView helpcenter_createtime;//购买件数
    }
}