5fbde5d5c272e91c096c76197a56a5880e504285.svn-base
2.39 KB
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
package com.ivt.android.me.ui.adapter.mine;
import java.util.ArrayList;
import java.util.List;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import com.ivt.android.me.R;
import com.ivt.android.me.bean.RechargeEntity;
import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.view.annotation.ViewInject;
/**
*
* @author YeMint 2016-5-6 GiveAdapter.java TODO 最后修改人 :无
*/
public class AccountListAdapter extends BaseAdapter {
private List<RechargeEntity> Recharges;
private Context context;
private LayoutInflater inflater;
public AccountListAdapter(Context context) {
// TODO Auto-generated constructor stub
super();
this.context = context;
inflater = LayoutInflater.from(context);
Recharges = new ArrayList<RechargeEntity>();
}
@Override
public int getCount() {
// TODO Auto-generated method stub
if (Recharges.size() > 0) {
return Recharges.size();
} else {
return 0;
}
}
@Override
public Object getItem(int position) {
// TODO Auto-generated method stub
if (Recharges.size() > 0) {
return Recharges.get(position);
} else {
return null;
}
}
@Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return position;
}
@Override
public View getView(int position, View contendView, ViewGroup parent) {
// TODO Auto-generated method stub
final ViewHolder holder;
if (contendView == null) {
contendView = LayoutInflater.from(context).inflate(
R.layout.list_mine_account, null);
holder = new ViewHolder();
ViewUtils.inject(holder, contendView);
contendView.setTag(holder);
} else {
holder = (ViewHolder) contendView.getTag();
}
RechargeEntity user = Recharges.get(position);
holder.account_one.setText(" " + user.getChineseCoin());
holder.bt_one.setText(user.getPrice() + "元");
return contendView;
}
class ViewHolder {
@ViewInject(R.id.account_one)
TextView account_one;
@ViewInject(R.id.bt_one)
TextView bt_one;
}
public void addData(List<RechargeEntity> mList) {
this.Recharges.clear();
if (mList != null) {
if (mList.size() > 0) {
this.Recharges.addAll(mList);
}
}
notifyDataSetChanged();
}
public void addToData(List<RechargeEntity> mList) {
this.Recharges.addAll(mList);
notifyDataSetChanged();
}
}