-
Notifications
You must be signed in to change notification settings - Fork 19
/
SimpleHolder.java
35 lines (30 loc) · 1.07 KB
/
SimpleHolder.java
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
package com.freegeek.android.materialbanner.simple;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.freegeek.android.materialbanner.R;
import com.freegeek.android.materialbanner.holder.Holder;
/**
* @author Jack Fu <[email protected]>
* @date 2016/9/22
*/
public class SimpleHolder implements Holder<SimpleBannerData> {
private ImageView imageView;
private TextView title;
@Override
public View createView(Context context) {
View view = LayoutInflater.from(context).inflate(R.layout.simple_banner_item,null);
imageView = view.findViewById(R.id.imageView);
title = view.findViewById(R.id.txt_title);
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
return view;
}
@Override
public void updateUI(Context context, int position, SimpleBannerData data) {
title.setText(data.getTitle());
imageView.setImageResource(data.getResId());
}
}