ItemElectronPapterLayoutManager.java
5.63 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
package com.wd.display.comp.page;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
import com.people.common.statusbar.StatusBarCompat;
import com.people.component.R;
import com.people.component.comp.layoutmanager.ItemContainerManager;
import com.people.component.ui.paper.PaperContract;
import com.people.component.ui.paper.PaperHelpFactory;
import com.people.component.ui.paper.PaperHelper;
import com.people.component.utils.CompentLogicUtil;
import com.people.daily.lib_library.TimeUtil;
import com.people.daily.lib_library.ToastNightUtil;
import com.people.entity.custom.MenuBean;
import com.people.entity.paper.PaperPageBean;
import com.wondertek.wheat.ability.tools.ViewUtils;
/**
* @Description: 电子报
* @Author: Li Yubing
* @Email: liyubing@wondert.com.cn
* @CreateDate: 2023/7/13 14:51
* @Version: 1.0
*/
public class ItemElectronPapterLayoutManager extends ItemContainerManager<MenuBean> implements PaperContract.onSizeMeasureCallback {
// -------------- title bar --------------
public RelativeLayout rlTitle;
public ImageView imgBack;
public ImageView imgShare;
public TextView tvDate;
// -------------- content --------------
public TextView tvPageIndicator;
public ImageView imgPageIndicatorArrow,ivLoadingView,ivImageLayer;
public RecyclerView rvContentImage, rvContentList;
public LinearLayout llPageIndicatorContainer;
public FrameLayout flContent;
// -------------- bottom-------------
public RelativeLayout rlBottomLeft, llPaperTitleDate;
public TextView tvNewsNo;
public RelativeLayout rlBarBottom;
public LinearLayout llReadList;
public RelativeLayout rlTopLeft;
public ImageView ivBottom;
// -------------- help container --------------
public PaperHelpFactory helpFactory;
@Override
public int getItemViewType() {
return R.layout.page_item_layout_electro_paper;
}
@Override
public void prepareItem(View itemView, int position) {
}
@Override
public int bindItem(View itemView, int position, MenuBean data) {
rlTitle = ViewUtils.findViewById(itemView, R.id.rl_act_paper_bar_title);
imgBack = ViewUtils.findViewById(itemView, R.id.img_act_paper_bar_title_back);
imgBack.setOnClickListener(v -> getFragmentActivity().finish());
imgShare = ViewUtils.findViewById(itemView, R.id.img_act_paper_bar_title_share);
imgShare.setOnClickListener(v -> {
if(helpFactory != null){
PaperPageBean currentPageBean = helpFactory.pagePositionSyncHelp.getCurrentPageBean();
if(currentPageBean != null){
CompentLogicUtil.shareElInfo(currentPageBean,imgShare.getContext());
}else {
ToastNightUtil.showShort("暂无数据");
}
}
});
llPaperTitleDate = ViewUtils.findViewById(itemView, R.id.ll_paper_title_date);
tvDate = ViewUtils.findViewById(itemView, R.id.tv_act_paper_bar_title_date);
tvPageIndicator = ViewUtils.findViewById(itemView, R.id.tv_act_paper_content_image_indicator);
llPageIndicatorContainer = ViewUtils.findViewById(itemView, R.id.ll_act_paper_content_image_indicator_container);
rvContentImage = ViewUtils.findViewById(itemView, R.id.rv_act_paper_content_image);
imgPageIndicatorArrow = ViewUtils.findViewById(itemView, R.id.img_act_paper_content_image_indicator_arrow);
flContent = ViewUtils.findViewById(itemView,R.id.flImageContent);
rlBottomLeft = ViewUtils.findViewById(itemView, R.id.rlBottomLeft);
tvNewsNo = ViewUtils.findViewById(itemView, R.id.tvNewsNo);
rlBarBottom = ViewUtils.findViewById(itemView, R.id.rl_act_paper_bar_bottom);
llReadList = ViewUtils.findViewById(itemView, R.id.llReadList);
rlTopLeft = ViewUtils.findViewById(itemView, R.id.rlTopLeft);
rvContentList = ViewUtils.findViewById(itemView, R.id.rvContentList);
ivBottom = ViewUtils.findViewById(itemView,R.id.ivBottom);
ivLoadingView = ViewUtils.findViewById(itemView,R.id.ivLoadingView);
ivImageLayer = ViewUtils.findViewById(itemView,R.id.ivImageLayer);
RelativeLayout.LayoutParams rlTitleLp = (RelativeLayout.LayoutParams) rlTitle.getLayoutParams();
rlTitleLp.topMargin = StatusBarCompat.getStatusBarHeight(getFragmentActivity());
rlTitle.setLayoutParams(rlTitleLp);
initHelp();
return position;
}
@Override
public void sizeMeasure(double w, double h) {
String data = TimeUtil.getCurrentDate();
setChoosePaperDate(data);
helpFactory.paperPageModel.setElWh(w + "x" + h);
helpFactory.paperPageModel.requestPaperTime(null);
}
/**
* 设置选择电子报日期
*
* @param date
*/
public void setChoosePaperDate(String date) {
// tvDate.setText(date);
tvDate.setText(PaperHelper.format2TitleStyle(date));
}
private void initHelp() {
helpFactory = PaperHelpFactory.create(this, getFragmentActivity());
helpFactory.injectView();
helpFactory.paperImageHelp.measurePaperImageCanvasSize(this);
}
public void setShareShow(PaperPageBean currentPageBean){
if(currentPageBean != null && currentPageBean.getSharePagePic() != null
&& 1 == currentPageBean.getSharePagePic().getSharePosterOpen()){
//判断分享显示或隐藏
imgShare.setVisibility(View.VISIBLE);
}
}
}