admin
2021-05-13 4a8f1bec26519a25f073739534e653a4f7c9e11d
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
package com.tejia.lijin.app.ui.recommend;
 
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.tejia.lijin.app.R;
 
import java.util.ArrayList;
import java.util.HashMap;
 
 
public class ChoicenessFreightFreeAdapter extends BaseAdapter {
    private ArrayList<HashMap<String, String>> mlist;
    private LayoutInflater mInflater;
    private Context mcontext;
 
    public ChoicenessFreightFreeAdapter(Context 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;
        if (convertView == null) {
            holder = new ViewHolder();
            convertView = mInflater.inflate(R.layout.item_choicenessfreightfree_img, null);
            holder.choicenessfreightfree_img = convertView.findViewById(R.id.choicenessfreightfree_img);
            holder.choicenessfreightfree_title = convertView.findViewById(R.id.choicenessfreightfree_title);
            convertView.setTag(holder);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }
        HashMap<String, String> map = mlist.get(position);
        holder.choicenessfreightfree_title.setText(map.get("name") + "");
        if (map.get("boolean") != null && map.get("boolean").equals("true")) {
            holder.choicenessfreightfree_img.setVisibility(View.VISIBLE);
            //.setColorFilter(getResources().getColor(R.color.mq_indicator_selected));
            holder.choicenessfreightfree_title.setTextColor(mcontext.getResources().getColor(R.color.main_text_color));//Color.parseColor("#ffe5005c"));
        } else {
            holder.choicenessfreightfree_img.setVisibility(View.GONE);
            holder.choicenessfreightfree_title.setTextColor(mcontext.getResources().getColor(R.color.gray2));
        }
 
 
        return convertView;
    }
 
    /*控件缓存类*/
    class ViewHolder {
        ImageView choicenessfreightfree_img;//商品图像
        TextView choicenessfreightfree_title;//标题
    }
}