ItemHighQualityCommentsLayoutManager.java
2.43 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
package com.wd.display.comp.page;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import com.people.common.statusbar.StatusBarCompat;
import com.people.component.R;
import com.people.component.comp.layoutmanager.ItemContainerManager;
import com.people.component.ui.fragment.TemplateFragment;
import com.people.entity.custom.MenuBean;
import com.people.toolset.ScreenUtils;
import com.wondertek.wheat.ability.tools.ResUtils;
import com.wondertek.wheat.ability.tools.ViewUtils;
/**
* @Description: 优质评论顶部
* @Author: wd
* @Version: 1.0
*/
public class ItemHighQualityCommentsLayoutManager extends ItemContainerManager<MenuBean> {
private TemplateFragment mColumnFragment;
private ImageView ivtopbg,ivback;
@Override
public int getItemViewType() {
return R.layout.page_item_layout_high_quality_comments;
}
@Override
public void prepareItem(View itemView, int position) {
ivtopbg = ViewUtils.findViewById(itemView, R.id.ivtopbg);
ivback = ViewUtils.findViewById(itemView, R.id.title_bar_left_img);
}
@Override
public int bindItem(View itemView, int position, MenuBean data) {
if (data == null) {
return position;
}
//图片高度根据屏幕宽度适配
RelativeLayout.LayoutParams topbgParams = (RelativeLayout.LayoutParams) ivtopbg.getLayoutParams();
topbgParams.height = ScreenUtils.getScreenSize(getFragmentActivity(), true) * 250 / 375;
ivtopbg.setLayoutParams(topbgParams);
//设置返回按钮距离顶部距离
RelativeLayout.LayoutParams backParams = (RelativeLayout.LayoutParams) ivback.getLayoutParams();
//状态栏高度+10
backParams.setMargins(0, (int) (StatusBarCompat.getStatusBarHeight(getFragmentActivity())+ ResUtils.getDimension(R.dimen.rmrb_dp10)),0,0);
ivback.setLayoutParams(backParams);
//点击返回监听
ivback.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
getFragmentActivity().finish();
}
});
//添加内容
if (getFragmentActivity() != null) {
mColumnFragment = TemplateFragment.newInstance(data);
getFragmentActivity().getSupportFragmentManager().beginTransaction().add(R.id.rv_content, mColumnFragment).commit();
}
return position;
}
}