PaperActivity.java
4.1 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
package com.wd.module_home;
import android.os.Build;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.fastjson.JSONObject;
import com.wd.capability.layout.page.ItemElectronPapterLayoutManager;
import com.wd.capability.router.data.ActionBean;
import com.wd.common.base.BaseActivity;
import com.wd.common.constant.PageNameConstants;
import com.wd.common.constant.RegionNameConstants;
import com.wd.common.constant.RouterConstants;
import com.wd.common.utils.BarUtils;
import com.wd.foundation.bean.analytics.TrackContentBean;
import com.wd.foundation.bean.custom.MenuBean;
import com.wd.foundation.wdkit.constant.GlobalAppCacheData;
import com.wd.foundation.wdkit.constant.IntentConstants;
import com.wd.foundation.wdkit.statusbar.StatusBarStyleEnum;
import com.wd.foundation.wdkit.utils.ViewUtils;
import com.wd.foundation.wdkitcore.tools.JsonUtils;
import com.wd.foundation.wdkitcore.tools.ResUtils;
/**
* @Description: 电子报
* @Author: Li Yubing
* @Email: liyubing@wondert.com.cn
* @CreateDate: 2023/7/12 14:42
* @Version: 1.0
*/
@Route(path = RouterConstants.PATH_MODULE_PAPER)
public class PaperActivity extends BaseActivity {
private FrameLayout mRootView;
private ItemElectronPapterLayoutManager mLayoutManager;
@Override
protected int getLayoutId() {
return R.layout.activity_common_subject;
}
@Override
protected StatusBarStyleEnum getStatusBarStyle() {
return StatusBarStyleEnum.FULLSCREEN_LIGHT_ENUM;
}
@Override
public int getNavigationBarBgColor() {
return ResUtils.getColor(R.color.res_color_common_C9);
}
// @Override
// public boolean settingSwipeBack() {
// return false;
// }
@Override
protected String getTag() {
return "PaperActivity";
}
@Override
protected void initView() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
BarUtils.setNavBarColor(this.getWindow(), ResUtils.getColor(R.color.res_color_common_C9));
}
// setSwipeBackEnable(false);
mRootView = ViewUtils.findViewById(this, R.id.container);
}
@Override
protected void initData() {
mLayoutManager = new ItemElectronPapterLayoutManager();
mRootView.removeAllViews();
View pageView = LayoutInflater.from(this).inflate(mLayoutManager.getItemViewType(), mRootView, false);
mRootView.addView(pageView);
MenuBean menuBean = new MenuBean();
menuBean.setTopMargin(statusHeight);
Object actionBeanObject = getExtrasSerializableObject();
if (actionBeanObject != null && !TextUtils.isEmpty(((ActionBean) actionBeanObject).paramBean.params)) {
JSONObject jsonObject = JsonUtils.convertJsonToObject(((ActionBean) actionBeanObject).paramBean.params, JSONObject.class);
String elePageFirstPic = jsonObject.getString(IntentConstants.PAGE_BACKGROUND_URL);
//最新电子报第一版的第一张图url
menuBean.setBackgroundUrl(elePageFirstPic);
}
mLayoutManager.setFragmentActivity(this);
mLayoutManager.prepareItem(mRootView, 0);
mLayoutManager.bindItem(mRootView, 0, menuBean);
}
@Override
protected void onDestroy() {
super.onDestroy();
if (mLayoutManager != null) {
mLayoutManager.onDestory();
mLayoutManager = null;
}
GlobalAppCacheData.haveElDataMap.clear();
// 埋点
TrackContentBean bean = new TrackContentBean();
bean.setPage_name(PageNameConstants.NEWS_PAPER_PAGE);
bean.setPage_id(PageNameConstants.NEWS_PAPER_PAGE);
bean.setExposure(duration);
bean.setRegion_name(RegionNameConstants.NEWS_PAPER);
// CommonTrack.getInstance().channelExposureTrack(bean);
}
@Override
protected void initViewModel() {
}
@Override
public void finish() {
super.finish();
overridePendingTransition(R.anim.exit_page_alpha_in, R.anim.exit_page_top_bottom_out);
}
}