左晓为主开发手持机充值管理机
zuoxiao
2023-12-08 4852766718706c559a51913fc9629dbb8da306a6
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
package com.dayu.recharge.adapter;
 
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
 
import com.dayu.recharge.R;
import com.dayu.recharge.dbBean.RechargeBean;
import com.dayu.recharge.utils.DateUtil;
 
import java.util.List;
 
/**
 * Created by zuoxiao on 2018/12/24.
 */
 
public class RechargeAdapter extends BaseAdapter {
 
    List<RechargeBean> rechargeList;
    Context mContext;
 
    public RechargeAdapter(Context context, List<RechargeBean> rechargeList) {
        mContext = context;
        this.rechargeList = rechargeList;
    }
 
    @Override
    public int getCount() {
        if (rechargeList == null) {
            return 0;
        }
        return rechargeList.size();
    }
 
    @Override
    public Object getItem(int position) {
        return 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 = View.inflate(mContext, R.layout.item_recharge, null);
            holder.userName = (TextView) convertView.findViewById(R.id.userName);
            holder.userNo = (TextView) convertView.findViewById(R.id.userNo);
            holder.morny = (TextView) convertView.findViewById(R.id.morny);
            holder.date = (TextView) convertView.findViewById(R.id.date);
 
            convertView.setTag(holder);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }
        holder.userName.setText("用户名:" + rechargeList.get(position).getUserName());
        holder.userNo.setText("用户编号:" + rechargeList.get(position).getInitPeasantCode());
        holder.morny.setText("充值金额:" + rechargeList.get(position).getMorny());
        holder.date.setText("日期:" + DateUtil.dateToStamp(rechargeList.get(position).getDate(), DateUtil.type1));
        return convertView;
    }
 
    class ViewHolder {
 
        TextView userName;
        TextView userNo;
        TextView morny;
        TextView date;
    }
}