FMListItemView.java 1.4 KB
Newer Older
徐健 committed
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
package com.yidianling.fm;

import android.content.Context;
import android.text.TextUtils;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.ydl.ydl_image.module.GlideApp;
import com.yidianling.fm.response.FM;


/**
 * fm列表项
 * Created by softrice on 15/12/11.
 */
public class FMListItemView extends LinearLayout {

//    @BindView(R.id.sdv_head)
    private ImageView sdv_head;
//    @BindView(R.id.tv_title)
    private TextView tv_title;
//    @BindView(R.id.tv_anchor)
    private TextView tv_anchor;
//    @BindView(R.id.tv_listen_num)
    private TextView tv_listen_num;

    public FMListItemView(Context context) {
        super(context);
30
        inflate(context, R.layout.fm_ui_fm_list_item, this);
徐健 committed
31 32 33 34 35 36 37 38 39 40 41
        sdv_head = findViewById(R.id.sdv_head);
        tv_title = findViewById(R.id.tv_title);
        tv_anchor = findViewById(R.id.tv_anchor);
        tv_listen_num = findViewById(R.id.tv_listen_num);
    }


    public void setData(FM fm) {
        if (!TextUtils.isEmpty(fm.getImageUrl())) {
            GlideApp.with(getContext())
                    .load(fm.getImageUrl())
徐健 committed
42
                    .placeholder(R.drawable.platform_default_img)
徐健 committed
43 44 45 46 47 48 49
                    .into(sdv_head);
        }
        tv_title.setText(fm.getName());
        tv_anchor.setText("主播:" + fm.getAuthor());
        tv_listen_num.setText("收听:" + fm.getHits());
    }
}