ChannelBean.java
8.17 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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
package com.people.room.entity;
import android.text.TextUtils;
import androidx.annotation.NonNull;
import androidx.room.Entity;
import androidx.room.Ignore;
import androidx.room.PrimaryKey;
import com.people.room.constant.RoomConstant;
import java.io.Serializable;
/**
* 首页底部导航栏单个数据<BR>
*
* @author liyubing
* @version [V1.0.0, 2022/7/13]
* @since V1.0.0
*/
@Entity(tableName = RoomConstant.TB_CHANNELENTITY)
public class ChannelBean implements Serializable {
/**
* 频道关联页面id
*/
private String pageId;
/**
* 频道名称
*/
private String name;
/**
* 频道id
*/
@PrimaryKey
@NonNull
private String channelId;
/**
* 频道样式;1-沉浸式;2-信息流
*/
private String channelStyle;
/**
* 频道类型:1:主频道 2:地方频道,3:关注频道
*/
private int channelType;
/**
* 频道按钮图片样式--未选中
*/
private String iconUrl;
/**
* 频道按钮图片样式--选中
*/
private String iconCUrl;
private String iconUrlSize;
/**
* 首页设置根据这个排序20230828
* */
public int num;
/**
* 下划线颜色-选中
*/
private String underlineCColor;
/**
* 头条标识 0:否, 1:是;【是否头条=是的频道,固定排序在第一位,且不可移出/移动】
*/
private int headlinesOn;
/**
* 允许移动 0:否, 1:是;【位置属性】
*/
private int movePermitted;
/**
* 允许删除 0:否, 1:是;【撤销属性】
*/
private int delPermitted;
/**
* 允许设置为默认首页 0:否, 1:是;【首页设置频道】
*/
private int defaultPermitted;
// 国殇 true:开启;false:关闭
private boolean grayFlag;
/**
* // string 必须 是否首页设置;0否,1是
* */
public String homeChannel;
/**
* // string 必须 是否我的频道;0否,1是
* */
public String myChannel;
/**
* // string 必须 是否更多频道;0否,1是
* */
public String moreChannel;
/**
* // string 必须 是否地方频道;0否,1是
* */
public String localChannel;
//本地字段 频道字体颜色-未选中
private String fontColor;
// 本地字段 频道字体颜色-选中
private String fontCColor;
@Ignore
private String fontMiddleColor;
// 本地字段 是否要显示下划线
@Ignore
private boolean showLine = true;
@Ignore
public String[] sameIds;
/**
* 是否时间线 1 推荐, 2时间线
*/
public int channelStrategy;
public String getPageId() {
return pageId;
}
public void setPageId(String pageId) {
this.pageId = pageId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getFontColor() {
return fontColor;
}
public void setFontColor(String fontColor) {
this.fontColor = fontColor;
}
public String getFontCColor() {
return fontCColor;
}
public void setFontCColor(String fontCColor) {
this.fontCColor = fontCColor;
}
public int getChannelType() {
return channelType;
}
public void setChannelType(int channelType) {
this.channelType = channelType;
}
public String getChannelId() {
return channelId;
}
public void setChannelId(String channelId) {
this.channelId = channelId;
}
public String getChannelStyle() {
return channelStyle;
}
public void setChannelStyle(String channelStyle) {
this.channelStyle = channelStyle;
}
public String getIconUrl() {
return iconUrl;
}
public void setIconUrl(String iconUrl) {
this.iconUrl = iconUrl;
}
public String getIconCUrl() {
return iconCUrl;
}
public void setIconCUrl(String iconCUrl) {
this.iconCUrl = iconCUrl;
}
public String getUnderlineCColor() {
return underlineCColor;
}
public String getFontMiddleColor() {
return fontMiddleColor;
}
public void setFontMiddleColor(String fontMiddleColor) {
this.fontMiddleColor = fontMiddleColor;
}
public void setUnderlineCColor(String underlineCColor) {
this.underlineCColor = underlineCColor;
}
public int getHeadlinesOn() {
return headlinesOn;
}
public void setHeadlinesOn(int headlinesOn) {
this.headlinesOn = headlinesOn;
}
public int getMovePermitted() {
return movePermitted;
}
public void setMovePermitted(int movePermitted) {
this.movePermitted = movePermitted;
}
public int getDelPermitted() {
return delPermitted;
}
public void setDelPermitted(int delPermitted) {
this.delPermitted = delPermitted;
}
public int getDefaultPermitted() {
return defaultPermitted;
}
public void setDefaultPermitted(int defaultPermitted) {
this.defaultPermitted = defaultPermitted;
}
public String getIconUrlSize() {
return iconUrlSize;
}
public void setIconUrlSize(String iconUrlSize) {
this.iconUrlSize = iconUrlSize;
}
public boolean isGrayFlag() {
return grayFlag;
}
public void setGrayFlag(boolean grayFlag) {
this.grayFlag = grayFlag;
}
public boolean isImmersePage() {
return "1".equals(channelStyle);
}
public boolean isShowLine() {
return showLine;
}
public void setShowLine(boolean showLine) {
this.showLine = showLine;
}
public int getChannelStrategy() {
return channelStrategy;
}
public void setChannelStrategy(int channelStrategy) {
this.channelStrategy = channelStrategy;
}
/**
* 关注频道页面
* @return
*/
public boolean isFollowChannelPage(){
return 3 == channelType;
}
/**
* 同步新数据
* */
public void updateData(ChannelBean channelBean){
//设置接口字段数据
pageId = channelBean.pageId;
name = channelBean.name;
channelStyle = channelBean.channelStyle;
channelType = channelBean.channelType;
channelStrategy = channelBean.channelStrategy;
fontColor = channelBean.fontColor;
fontCColor = channelBean.fontCColor;
iconUrl = channelBean.iconUrl;
iconCUrl = channelBean.iconCUrl;
underlineCColor = channelBean.underlineCColor;
headlinesOn = channelBean.headlinesOn;
movePermitted = channelBean.movePermitted;
delPermitted = channelBean.delPermitted;
defaultPermitted = channelBean.defaultPermitted;
grayFlag = channelBean.grayFlag;
}
/**
* 是特殊频道
* @return true:特殊频道,跳转到指定页面
*/
public boolean isSpecialChannel(){
return "3".equals(channelStyle);
}
/**
* 获取图片宽高数组
*
* @return
*/
public int[] getImageWHArray() {
String coverSize = getIconUrlSize();
if ( !TextUtils.isEmpty(coverSize)) {
String[] widthHeigh = coverSize.split("\\*");
if (2 == widthHeigh.length) {
try {
int width = Integer.parseInt(widthHeigh[0]);
int heigth = Integer.parseInt(widthHeigh[1]);
int[] imageArray = new int[2];
imageArray[0] = width;
imageArray[1] = heigth;
return imageArray;
} catch (NumberFormatException e) {
e.printStackTrace();
}
}
}
return null;
}
/**
* 依据宽度比,计算新的高度
*
* @param height
* @return
*/
public int getCalWithByH(float height) {
int[] whArray = getImageWHArray();
if (whArray != null) {
int w = whArray[0];
int h = whArray[1];
float calH = height * w / h;
return (int) calH;
} else {
return 0;
}
}
}