wangkai

1、添加NavigationBarActivity;

2、拆分模块wdbean与lib_room之间不再有依赖
Showing 43 changed files with 3563 additions and 264 deletions
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EclipseCodeFormatterProjectSettings">
<option name="projectSpecificProfile">
<ProjectSpecificProfile>
<option name="formatter" value="ECLIPSE" />
<option name="importOrder" value="java;javax;org;android;androidx;com;" />
<option name="pathToConfigFileJava" value="$PROJECT_DIR$/config/CodeQuality/WonderTek_CodeFormatter_Convention_v1.0.xml" />
<option name="selectedJavaProfile" value="WonderTek_CodeFormatter_Convention_v1.0" />
</ProjectSpecificProfile>
</option>
</component>
</project>
\ No newline at end of file
... ... @@ -8,12 +8,15 @@ package com.wd.layoutdataimpl.model;
import android.text.TextUtils;
import com.people.room.ChannelDbHelper;
import com.wd.base.log.Logger;
import com.wd.capability.layout.ui.channel.vm.IChannelDataListener;
import com.wd.capability.network.BaseObserver;
import com.wd.capability.network.bean.MetaBean;
import com.wd.capability.network.cachedata.CacheData;
import com.wd.common.api.RequestApi;
import com.wd.capability.network.response.BaseResponse;
import com.wd.foundation.bean.response.ChannelBean;
import com.wd.foundation.wdkitcore.constant.BaseConstants;
import com.wd.foundation.bean.custom.SimpleTabBean;
import com.wd.foundation.bean.custom.comp.PageBean;
... ... @@ -22,10 +25,13 @@ import com.wd.capability.network.fetcher.BaseDataFetcher;
import com.wd.foundation.wdkit.json.GsonUtils;
import com.wd.foundation.wdkit.utils.SpUtils;
import com.wd.foundation.wdkit.utils.ToastNightUtil;
import com.wd.foundation.wdkitcore.tools.AppContext;
import com.wd.foundation.wdkitcore.tools.ArrayUtils;
import com.wd.foundation.wdkitcore.tools.JsonUtils;
import com.wd.foundation.wdkitcore.tools.StringUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import io.reactivex.Observable;
... ... @@ -82,20 +88,20 @@ public class ChannelDataFetcherNews extends BaseDataFetcher<RequestApi> {
if (2 == dataType){
//新闻tab
if (isNewsChannel){
String newsTabGroupMd5 = SpUtils.getBottomNavGroupDetailMd5();
//有数据,保存的md5不为空,并且和接口给的md5一致,不用再调接口
if (StringUtils.isBlank(BaseConstants.newsTabMd5)){
// Logger.e("newsTabMd5空的==不会调用");
return;
}
// Logger.e("newsTabMd5 调用== firstLocation="+firstLocation);
// Logger.e("newsTabMd5 ==newsTabGroupMd5=="+newsTabGroupMd5);
if (1 != firstLocation && StringUtils.isNotBlank(newsTabGroupMd5)
&& newsTabGroupMd5.equals(BaseConstants.newsTabMd5)) {
// Logger.e("newsTabMd5不变==不会调用");
return;
}
SpUtils.saveBottomNavGroupDetailMd5(BaseConstants.newsTabMd5);
// String newsTabGroupMd5 = SpUtils.getBottomNavGroupDetailMd5();
// //有数据,保存的md5不为空,并且和接口给的md5一致,不用再调接口
// if (StringUtils.isBlank(BaseConstants.newsTabMd5)){
//// Logger.e("newsTabMd5空的==不会调用");
// return;
// }
//// Logger.e("newsTabMd5 调用== firstLocation="+firstLocation);
//// Logger.e("newsTabMd5 ==newsTabGroupMd5=="+newsTabGroupMd5);
// if (1 != firstLocation && StringUtils.isNotBlank(newsTabGroupMd5)
// && newsTabGroupMd5.equals(BaseConstants.newsTabMd5)) {
//// Logger.e("newsTabMd5不变==不会调用");
// return;
// }
// SpUtils.saveBottomNavGroupDetailMd5(BaseConstants.newsTabMd5);
}else {
//如果不是新闻tab并且有缓存数据,不再进行接口请求
return;
... ... @@ -122,23 +128,24 @@ public class ChannelDataFetcherNews extends BaseDataFetcher<RequestApi> {
map.put("districtCode", SpUtils.getDistrictCode());
}
// if (isNewsChannel && dataType != 1) {
// List<ChannelBean> myChannelBeans = ChannelDbHelper.getInstance(AppContext.getContext()).searchAllSelectChannel();
// StringBuilder builder = new StringBuilder();
// int index = -1;
// if (myChannelBeans != null && myChannelBeans.size() > 0) {
// int size = myChannelBeans.size();
// for (ChannelBean myChannelBean : myChannelBeans) {
// index = index + 1;
// builder.append(myChannelBean.getChannelId());
// if (index != size - 1) {
// builder.append(",");
// }
// }
// //获取我的频道
// map.put("channelIds", builder.toString());
// }
// }
if (isNewsChannel && dataType != 1) {
List<com.people.room.entity.ChannelBean> channelBeans = ChannelDbHelper.getInstance(AppContext.getContext()).searchAllSelectChannel();
List<ChannelBean> myChannelBeans = convertBeanList(channelBeans);
StringBuilder builder = new StringBuilder();
int index = -1;
if (myChannelBeans != null && myChannelBeans.size() > 0) {
int size = myChannelBeans.size();
for (ChannelBean myChannelBean : myChannelBeans) {
index = index + 1;
builder.append(myChannelBean.getChannelId());
if (index != size - 1) {
builder.append(",");
}
}
//获取我的频道
map.put("channelIds", builder.toString());
}
}
Observable<BaseResponse<PageTopNavBean>> groupDataObservable = getRetrofit().getTopNavDetail(map);
... ... @@ -264,12 +271,13 @@ public class ChannelDataFetcherNews extends BaseDataFetcher<RequestApi> {
SimpleTabBean simpleTabBean = new SimpleTabBean();
if (isUseCache) {
// List<ChannelBean> myChannelList = ChannelDbHelper.getInstance(AppContext.getContext()).searchAllSelectChannel();
// if (myChannelList.size() > 0) {
// simpleTabBean.setTopNavChannelList(myChannelList);
// } else {
List<com.people.room.entity.ChannelBean> channelList = ChannelDbHelper.getInstance(AppContext.getContext()).searchAllSelectChannel();
List<ChannelBean> myChannelList = convertBeanList(channelList);
if (!myChannelList.isEmpty()) {
simpleTabBean.setTopNavChannelList(myChannelList);
} else {
simpleTabBean.setTopNavChannelList(bean.getTopNavChannelList());
// }
}
} else {
simpleTabBean.setTopNavChannelList(bean.getTopNavChannelList());
}
... ... @@ -388,25 +396,51 @@ public class ChannelDataFetcherNews extends BaseDataFetcher<RequestApi> {
onTopNavDataSuccess(bean, false);
return;
}
// //获取本地数据库
// ChannelDbHelper helper = ChannelDbHelper.getInstance(AppContext.getContext());
// //预置数据 如果数据库已经有数据,则无需更新,数据库的数据和预置的一样
// if ("1".equals(type) && helper.hasData()) {
// onTopNavDataSuccess(bean, true);
// return;
// }
// //本地数据直接获取
// if ("2".equals(type)) {
// if (!helper.hasData()) {
// helper.save(bean.getTopNavChannelList());
// }
// } else {
// //清除本地数据
// helper.deleteAll();
// //4.保存数据到数据库
// helper.save(bean.getTopNavChannelList());
//
// onTopNavDataSuccess(bean, true);
// }
//获取本地数据库
ChannelDbHelper helper = ChannelDbHelper.getInstance(AppContext.getContext());
//预置数据 如果数据库已经有数据,则无需更新,数据库的数据和预置的一样
if ("1".equals(type) && helper.hasData()) {
onTopNavDataSuccess(bean, true);
return;
}
List<ChannelBean> topNavChannelList = bean.getTopNavChannelList();
List<com.people.room.entity.ChannelBean> copyList = convertRoomList(topNavChannelList);
//本地数据直接获取
if ("2".equals(type)) {
if (!helper.hasData()) {
helper.save(copyList);
}
} else {
//清除本地数据
helper.deleteAll();
//4.保存数据到数据库
helper.save(copyList);
onTopNavDataSuccess(bean, true);
}
}
private List<com.people.room.entity.ChannelBean> convertRoomList(List<ChannelBean> topNavChannelList) {
List<com.people.room.entity.ChannelBean> retList;
try {
String objectToJson = JsonUtils.convertObjectToJson(topNavChannelList);
retList = JsonUtils.convertJsonArrayToObjList(objectToJson,com.people.room.entity.ChannelBean.class);
} catch (Exception e) {
throw new RuntimeException(e);
}
return retList;
}
private List<ChannelBean> convertBeanList(List<com.people.room.entity.ChannelBean> channelList) {
List<ChannelBean> retList;
try {
String objectToJson = JsonUtils.convertObjectToJson(channelList);
retList = JsonUtils.convertJsonArrayToObjList(objectToJson,ChannelBean.class);
} catch (Exception e) {
throw new RuntimeException(e);
}
return retList;
}
}
... ...
{
"bottomNavList":[
{
"backgroundUrl": "",
"channelChooseActionUrl": "",
"channelChooseCColor": "",
"channelChooseColor": "",
"channelMoreColor": "",
"dropDownAnimationColor": null,
"extraData": "{\"haveSearch\":\"1\",\"haveTopNav\":\"1\",\"leftIconurl\":\"\",\"rightIconUrl\":\"\"}",
"homePageColor": "",
"icon": "https://cdnjdphoto.aikan.pdnews.cn/sjbj-20240516/image/display/921fd11c21b0441b91753710d9799947.png",
"iconC": "https://cdnjdphoto.aikan.pdnews.cn/sjbj-20240516/image/display/7e81da19ad394ded8fd18920b7a1276f.pag",
"id": 201,
"immersiveIconCUrl": "",
"immersiveIconUrl": "",
"immersiveNameCColor": "",
"immersiveNameColor": "",
"logoUrl": "",
"morningAndEveningUrl": "",
"name": "新闻",
"nameCColor": "#ED2800",
"nameColor": "#999999",
"nightIconCUrl": "https://cdnjdphoto.aikan.pdnews.cn/sjbj-20240724/vod/display/b2609f02ce8048cdb8643f6620092a6c.pag",
"nightIconUrl": "https://cdnjdphoto.aikan.pdnews.cn/sjbj-20240724/image/display/aa5fc4db41f6400c930e6af02fb52abb.png",
"nightNameCColor": "#ED2800",
"nightNameColor": "#999999",
"noticeColor": "",
"pageId": null,
"pageType": null,
"searchBothColor": "",
"searchUrl": "",
"sortValue": 1,
"statusBarColor": null,
"topStyle": "11",
"type": "1"
},
{
"backgroundUrl": "",
"channelChooseActionUrl": "",
"channelChooseCColor": "",
"channelChooseColor": "",
"channelMoreColor": "",
"dropDownAnimationColor": null,
"extraData": "{\"haveSearch\":\"0\",\"haveTopNav\":\"1\",\"leftIconurl\":\"\",\"rightIconUrl\":\"\"}",
"homePageColor": "",
"icon": "https://cdnjdphoto.aikan.pdnews.cn/sjbj-20240516/image/display/8a27e684b1204b209bf70b41e593ace3.png",
"iconC": "https://cdnjdphoto.aikan.pdnews.cn/sjbj-20240516/image/display/9075c365c1ee44a38d914728bf1ba49d.pag",
"id": 202,
"immersiveIconCUrl": "",
"immersiveIconUrl": "",
"immersiveNameCColor": "",
"immersiveNameColor": "",
"logoUrl": "",
"morningAndEveningUrl": "",
"name": "人民号",
"nameCColor": "#ED2800",
"nameColor": "#999999",
"nightIconCUrl": "https://cdnjdphoto.aikan.pdnews.cn/sjbj-20240724/vod/display/c8fded2b47db4912b596bde55b66ba19.pag",
"nightIconUrl": "https://cdnjdphoto.aikan.pdnews.cn/sjbj-20240724/image/display/344767225aa5417e9a4fd6dcfdca62d9.png",
"nightNameCColor": "#ED2800",
"nightNameColor": "#999999",
"noticeColor": "",
"pageId": null,
"pageType": null,
"searchBothColor": "",
"searchUrl": "",
"sortValue": 2,
"statusBarColor": null,
"topStyle": "12",
"type": "1"
},
{
"backgroundUrl": "",
"channelChooseActionUrl": "",
"channelChooseCColor": "",
"channelChooseColor": "",
"channelMoreColor": "",
"dropDownAnimationColor": null,
"extraData": "{\"haveSearch\":\"1\",\"haveTopNav\":\"1\",\"leftIconurl\":\"\",\"rightIconUrl\":\"\"}",
"homePageColor": "",
"icon": "https://cdnjdphoto.aikan.pdnews.cn/sjbj-20240516/image/display/85080ae1fc2243209e957408dae18cb6.png",
"iconC": "https://cdnjdphoto.aikan.pdnews.cn/sjbj-20240516/image/display/30f80c6e894f452da7f37b55c9f015e5.pag",
"id": 203,
"immersiveIconCUrl": "",
"immersiveIconUrl": "",
"immersiveNameCColor": "",
"immersiveNameColor": "",
"logoUrl": "",
"morningAndEveningUrl": "",
"name": "视频",
"nameCColor": "#ED2800",
"nameColor": "#999999",
"nightIconCUrl": "https://cdnjdphoto.aikan.pdnews.cn/sjbj-20240724/vod/display/22c71b8d9be44c1d96fca177286698f8.pag",
"nightIconUrl": "https://cdnjdphoto.aikan.pdnews.cn/sjbj-20240724/image/display/0a7a51b4875a4b7fb0fed0cca7414738.png",
"nightNameCColor": "#ED2800",
"nightNameColor": "#999999",
"noticeColor": "",
"pageId": null,
"pageType": null,
"searchBothColor": "",
"searchUrl": "",
"sortValue": 3,
"statusBarColor": null,
"topNavChannelList": [
{
"channelId": 2060,
"channelStrategy": 1,
"channelStyle": 1,
"channelType": 1,
"defaultPermitted": 0,
"delPermitted": 1,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "0",
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "0",
"name": "视频",
"num": 1,
"pageId": 20070,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2061,
"channelStrategy": 2,
"channelStyle": 3,
"channelType": 1,
"defaultPermitted": 0,
"delPermitted": 1,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "0",
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "0",
"name": "直播",
"num": 2,
"pageId": 20071,
"pageType": "",
"underlineCColor": ""
}
],
"topStyle": "13",
"type": "1"
},
{
"backgroundUrl": "",
"channelChooseActionUrl": "",
"channelChooseCColor": "",
"channelChooseColor": "",
"channelMoreColor": "",
"dropDownAnimationColor": null,
"extraData": "{\"haveSearch\":\"1\",\"haveTopNav\":\"1\",\"leftIconurl\":\"\",\"rightIconUrl\":\"\"}",
"homePageColor": "",
"icon": "https://cdnjdphoto.aikan.pdnews.cn/sjbj-20240516/image/display/d9ca281088e547739d5cb866ce4b9dd8.png",
"iconC": "https://cdnjdphoto.aikan.pdnews.cn/sjbj-20240516/image/display/eba2ce70b4cf411bbd402dc8c3d079e1.pag",
"id": 204,
"immersiveIconCUrl": "",
"immersiveIconUrl": "",
"immersiveNameCColor": "",
"immersiveNameColor": "",
"logoUrl": "",
"morningAndEveningUrl": "",
"name": "服务",
"nameCColor": "#ED2800",
"nameColor": "#999999",
"nightIconCUrl": "https://cdnjdphoto.aikan.pdnews.cn/sjbj-20240724/vod/display/1ebdfbc313154574bd824b5d13550ade.pag",
"nightIconUrl": "https://cdnjdphoto.aikan.pdnews.cn/sjbj-20240724/image/display/fab17ba083c141a7ad3788e4bfe35e84.png",
"nightNameCColor": "#ED2800",
"nightNameColor": "#999999",
"noticeColor": "",
"pageId": null,
"pageType": null,
"searchBothColor": "",
"searchUrl": "",
"sortValue": 4,
"statusBarColor": null,
"topStyle": "14",
"type": "1"
},
{
"backgroundUrl": "",
"channelChooseActionUrl": "",
"channelChooseCColor": "",
"channelChooseColor": "",
"channelMoreColor": "",
"dropDownAnimationColor": null,
"extraData": "{\"haveSearch\":\"0\",\"haveTopNav\":\"0\"}",
"homePageColor": "",
"icon": "https://cdnjdphoto.aikan.pdnews.cn/sjbj-20240516/image/display/8601cf94eecb418a8d467a50acc67416.png",
"iconC": "https://cdnjdphoto.aikan.pdnews.cn/sjbj-20240516/image/display/801f044aec0f4dc2ae9e85d382d85a34.pag",
"id": 205,
"immersiveIconCUrl": "https://cdnjdphoto.aikan.pdnews.cn/inen-20230403/image/display/9f22b579db15497797e8204b1ec12d14.png",
"immersiveIconUrl": "https://cdnjdphoto.aikan.pdnews.cn/inen-20230403/image/display/5be23055a4dc4d869be2139e9deb7a55.png",
"immersiveNameCColor": "#FFFFFF",
"immersiveNameColor": "#6A6B75",
"logoUrl": "",
"morningAndEveningUrl": "",
"name": "我的",
"nameCColor": "#ED2800",
"nameColor": "#999999",
"nightIconCUrl": "https://cdnjdphoto.aikan.pdnews.cn/sjbj-20240724/vod/display/2d865d8ac6b741448321651dd79a5969.pag",
"nightIconUrl": "https://cdnjdphoto.aikan.pdnews.cn/sjbj-20240724/image/display/6a430e75b8314644a4d8ec61bc881e97.png",
"nightNameCColor": "#ED2800",
"nightNameColor": "#999999",
"noticeColor": "",
"pageId": null,
"pageType": null,
"searchBothColor": "",
"searchUrl": "",
"sortValue": 5,
"statusBarColor": null,
"topStyle": "",
"type": "2"
}
],
"isGongjiri":0
}
\ No newline at end of file
... ...
{
"presetsData":[
{
"id":201,
"topNavChannelList":[
{
"channelId": 2001,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 1,
"defaultPermitted": 1,
"delPermitted": 0,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "1",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "0",
"moreChannel": "0",
"movePermitted": 0,
"myChannel": "1",
"name": "推荐",
"num": 1,
"pageId": 20011,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2002,
"channelStrategy": 2,
"channelStyle": 2,
"channelType": 1,
"defaultPermitted": 1,
"delPermitted": 0,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "1",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "0",
"moreChannel": "0",
"movePermitted": 0,
"myChannel": "1",
"name": "热点",
"num": 2,
"pageId": 20012,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2003,
"channelStrategy": 2,
"channelStyle": 2,
"channelType": 1,
"defaultPermitted": 0,
"delPermitted": 0,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "0",
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "1",
"name": "锐评",
"num": 3,
"pageId": 20013,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2006,
"channelStrategy": 2,
"channelStyle": 3,
"channelType": 1,
"defaultPermitted": 0,
"delPermitted": 0,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "0",
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "1",
"name": "版面",
"num": 5,
"pageId": 20016,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2007,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 1,
"defaultPermitted": 0,
"delPermitted": 0,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "0",
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "1",
"name": "镜头",
"num": 13,
"pageId": 20017,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2066,
"channelStrategy": 2,
"channelStyle": 3,
"channelType": 1,
"defaultPermitted": 0,
"delPermitted": 1,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "0",
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "1",
"name": "播报",
"num": 4,
"pageId": 21003,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2011,
"channelStrategy": 2,
"channelStyle": 2,
"channelType": 1,
"defaultPermitted": 0,
"delPermitted": 1,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "0",
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "1",
"name": "体育",
"num": 6,
"pageId": 20021,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2020,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 1,
"defaultPermitted": 0,
"delPermitted": 1,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "0",
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "1",
"name": "国际",
"num": 7,
"pageId": 20030,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2015,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 1,
"defaultPermitted": 0,
"delPermitted": 1,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "0",
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "1",
"name": "科技",
"num": 10,
"pageId": 20025,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2005,
"channelStrategy": 2,
"channelStyle": 2,
"channelType": 1,
"defaultPermitted": 0,
"delPermitted": 1,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "0",
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "1",
"name": "文件",
"num": 12,
"pageId": 20015,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2009,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 1,
"defaultPermitted": 0,
"delPermitted": 1,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "0",
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "1",
"name": "社会",
"num": 15,
"pageId": 20019,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2010,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 1,
"defaultPermitted": 0,
"delPermitted": 1,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "0",
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "1",
"name": "财经",
"num": 16,
"pageId": 20020,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2012,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 1,
"defaultPermitted": 0,
"delPermitted": 1,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "0",
"moreChannel": "1",
"movePermitted": 1,
"myChannel": "1",
"name": "文化",
"num": 17,
"pageId": 20022,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2013,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 1,
"defaultPermitted": 0,
"delPermitted": 1,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "0",
"moreChannel": "1",
"movePermitted": 1,
"myChannel": "0",
"name": "教育",
"num": 18,
"pageId": 20023,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2014,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 1,
"defaultPermitted": 0,
"delPermitted": 1,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "0",
"moreChannel": "1",
"movePermitted": 1,
"myChannel": "0",
"name": "军事",
"num": 19,
"pageId": 20024,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2017,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 1,
"defaultPermitted": 0,
"delPermitted": 1,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "0",
"moreChannel": "1",
"movePermitted": 1,
"myChannel": "0",
"name": "健康",
"num": 20,
"pageId": 20027,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2018,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 1,
"defaultPermitted": 0,
"delPermitted": 1,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "0",
"moreChannel": "1",
"movePermitted": 1,
"myChannel": "0",
"name": "汽车",
"num": 22,
"pageId": 20028,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2021,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 1,
"defaultPermitted": 0,
"delPermitted": 1,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "0",
"moreChannel": "1",
"movePermitted": 1,
"myChannel": "0",
"name": "法治",
"num": 27,
"pageId": 20031,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2027,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
"delPermitted": 1,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "1",
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "0",
"name": "北京",
"num": 32,
"pageId": 20037,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2029,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
"delPermitted": 1,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "1",
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "0",
"name": "天津",
"num": 33,
"pageId": 20039,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2030,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
"delPermitted": 1,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "1",
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "0",
"name": "河北",
"num": 34,
"pageId": 20040,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2042,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
"delPermitted": 1,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "1",
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "0",
"name": "河南",
"num": 35,
"pageId": 20052,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2041,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
"delPermitted": 1,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "1",
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "0",
"name": "山东",
"num": 36,
"pageId": 20051,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2031,
"channelStrategy": 2,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
"delPermitted": 1,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "1",
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "0",
"name": "山西",
"num": 37,
"pageId": 20041,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2032,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
"delPermitted": 1,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "1",
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "0",
"name": "内蒙古",
"num": 38,
"pageId": 20042,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2033,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
"delPermitted": 1,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "1",
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "0",
"name": "辽宁",
"num": 39,
"pageId": 20043,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2034,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
"delPermitted": 1,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "1",
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "0",
"name": "吉林",
"num": 40,
"pageId": 20044,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2035,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
"delPermitted": 1,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "1",
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "0",
"name": "黑龙江",
"num": 41,
"pageId": 20045,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2028,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
"delPermitted": 1,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "1",
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "0",
"name": "上海",
"num": 42,
"pageId": 20038,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2036,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
"delPermitted": 1,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "1",
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "0",
"name": "江苏",
"num": 43,
"pageId": 20046,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2037,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
"delPermitted": 1,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "1",
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "0",
"name": "浙江",
"num": 44,
"pageId": 20047,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2038,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
"delPermitted": 1,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "1",
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "0",
"name": "安徽",
"num": 45,
"pageId": 20048,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2039,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
"delPermitted": 1,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "1",
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "0",
"name": "福建",
"num": 46,
"pageId": 20049,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2040,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
"delPermitted": 1,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "1",
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "0",
"name": "江西",
"num": 47,
"pageId": 20050,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2045,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
"delPermitted": 1,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "1",
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "0",
"name": "广东",
"num": 48,
"pageId": 20055,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2046,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
"delPermitted": 1,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "1",
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "0",
"name": "广西",
"num": 49,
"pageId": 20056,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2048,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
"delPermitted": 1,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "1",
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "0",
"name": "重庆",
"num": 50,
"pageId": 20058,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2049,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
"delPermitted": 1,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "1",
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "0",
"name": "四川",
"num": 51,
"pageId": 20059,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2051,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
"delPermitted": 1,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "1",
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "0",
"name": "云南",
"num": 52,
"pageId": 20061,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2050,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
"delPermitted": 1,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "1",
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "0",
"name": "贵州",
"num": 53,
"pageId": 20060,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2044,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
"delPermitted": 1,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "1",
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "0",
"name": "湖南",
"num": 54,
"pageId": 20054,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2043,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
"delPermitted": 1,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "1",
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "0",
"name": "湖北",
"num": 55,
"pageId": 20053,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2052,
"channelStrategy": 2,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
"delPermitted": 1,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "1",
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "0",
"name": "西藏",
"num": 56,
"pageId": 20062,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2057,
"channelStrategy": 2,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
"delPermitted": 1,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "1",
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "0",
"name": "新疆",
"num": 57,
"pageId": 20067,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2053,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
"delPermitted": 1,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "1",
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "0",
"name": "陕西",
"num": 58,
"pageId": 20063,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2054,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
"delPermitted": 1,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "1",
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "0",
"name": "甘肃",
"num": 59,
"pageId": 20064,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2055,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
"delPermitted": 1,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "1",
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "0",
"name": "青海",
"num": 60,
"pageId": 20065,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2056,
"channelStrategy": 2,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
"delPermitted": 1,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "1",
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "0",
"name": "宁夏",
"num": 61,
"pageId": 20066,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2047,
"channelStrategy": 1,
"channelStyle": 2,
"channelType": 2,
"defaultPermitted": 0,
"delPermitted": 1,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "1",
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "0",
"name": "海南",
"num": 62,
"pageId": 20057,
"pageType": "",
"underlineCColor": ""
}
]
},
{
"id":202,
"topNavChannelList":[
{
"channelId": 2058,
"channelStrategy": 1,
"channelStyle": 3,
"channelType": 1,
"defaultPermitted": 0,
"delPermitted": 1,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "0",
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "0",
"name": "推荐",
"num": 1,
"pageId": 20068,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2059,
"channelStrategy": 2,
"channelStyle": 3,
"channelType": 3,
"defaultPermitted": 0,
"delPermitted": 1,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "0",
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "0",
"name": "关注",
"num": 2,
"pageId": 20069,
"pageType": "",
"underlineCColor": ""
}
]
},
{
"id":203,
"topNavChannelList":[
{
"channelId": 2060,
"channelStrategy": 1,
"channelStyle": 1,
"channelType": 1,
"defaultPermitted": 0,
"delPermitted": 1,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "0",
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "0",
"name": "视频",
"num": 1,
"pageId": 20070,
"pageType": "",
"underlineCColor": ""
},
{
"channelId": 2061,
"channelStrategy": 2,
"channelStyle": 3,
"channelType": 1,
"defaultPermitted": 0,
"delPermitted": 1,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "0",
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "0",
"name": "直播",
"num": 2,
"pageId": 20071,
"pageType": "",
"underlineCColor": ""
}
]
},
{
"id":204,
"topNavChannelList":[
{
"channelId": 2062,
"channelStrategy": 2,
"channelStyle": 3,
"channelType": 1,
"defaultPermitted": 0,
"delPermitted": 1,
"fontCColor": "#FFFFFF",
"fontColor": "#F9AB99",
"headlinesOn": 0,
"homeChannel": "0",
"iconCUrl": "",
"iconCUrlSize": "",
"iconUrl": "",
"iconUrlSize": "",
"localChannel": "0",
"moreChannel": "0",
"movePermitted": 1,
"myChannel": "0",
"name": "服务",
"num": 1,
"pageId": 20072,
"pageType": "",
"underlineCColor": ""
}
]
}
]
}
\ No newline at end of file
... ...
{
"data":[
{
"code":"110000",
"children":[
{
"cityCode":"110000",
"id":10000035,
"label":"东城区"
}
],
"id":10000001,
"label":"北京市"
},
{
"code":"130000",
"children":[
{
"cityCode":null,
"id":130100,
"label":"石家庄市"
}
],
"id":10000003,
"label":"河北省"
}
]
}
\ No newline at end of file
... ...
package com.wd.common.utils;
/**
* @author LiuKun
* @date 2023/4/26 20:19
* @Description:objectUti
*/
public class ObjectUtil {
public static boolean isNull(Object obj) {
return obj == null;
}
public static boolean isNotNull(Object obj) {
return obj != null;
}
public static int hashCode(Object obj) {
return obj.hashCode();
}
public static boolean equals(Object source, Object target) {
if (isNull(source)) {
return false;
}
if (isNull(target)) {
return false;
}
if (target == source) {
return true;
}
if (hashCode(target) == hashCode(source)) {
return true;
}
return false;
}
}
... ...
... ... @@ -11,10 +11,10 @@ import com.google.gson.JsonObject;
import com.wd.base.log.Logger;
import com.wd.capability.router.WdRouterRule;
import com.wd.capability.router.data.ActionBean;
import com.wd.fastcoding.base.R;
import com.wd.foundation.wdkit.constant.PageNameConstants;
import com.wd.common.constant.RouterConstants;
import com.wd.common.manager.AudioThemManager;
import com.wd.fastcoding.base.R;
import com.wd.foundation.bean.custom.MenuBean;
import com.wd.foundation.bean.custom.SimpleAudioThemeBean;
import com.wd.foundation.bean.custom.SimpleAudioThemeBeans;
... ... @@ -73,6 +73,11 @@ public class ProcessUtils implements IntentConstants {
public static String VideoChannelPageId = null;
/**
* 首页顶部导航栏de 辅助频道数据
*/
public static List<ChannelBean> tempAddList = null;
/**
* 版面频道(电子报)
*/
public static String CHANNEL_ID_EL_NEWS = "2006";
... ... @@ -1130,6 +1135,7 @@ public class ProcessUtils implements IntentConstants {
}
/**
* 进入启动页
*/
... ... @@ -1216,6 +1222,40 @@ public class ProcessUtils implements IntentConstants {
/**
* 搜索
*
* @param position -1不处理
*/
public static void toSearchActivity(int position,String fromPage) {
// 拦截画中画
interceptorPictureInPicture();
ActionBean actionBean = new ActionBean();
actionBean.paramBean.pageID = RouterConstants.PATH_MODULE_SEARCH;
JsonObject jsonObject = new JsonObject();
jsonObject.addProperty(IntentConstants.JUMP_FROM_PAGE,fromPage);
jsonObject.addProperty(IntentConstants.INDEX, position + "");
actionBean.paramBean.params = jsonObject.toString();
WdRouterRule.getInstance().processAction(AppContext.getContext(), actionBean);
}
/**
* 进入导航栏
*/
@SuppressLint("ResourceType")
public static void goToNavBarActivity(String tabId) {
JsonObject jsonObject = new JsonObject();
jsonObject.addProperty(IntentConstants.PARAM_CHANNEL_ID, tabId);
ActionBean actionBean = new ActionBean();
// 加进场动效
actionBean.enterAnim = R.anim.enter_page_bottom_top_in;
actionBean.exitAnim = R.anim.enter_page_alpha_top_out;
actionBean.paramBean.pageID = RouterConstants.PATH_NAV_BAR;
actionBean.paramBean.params = jsonObject.toString();
WdRouterRule.getInstance().processAction(ActivityController.getCurrentActivity(), actionBean);
}
/**
* 检测当前频道是否是特殊频道
*
* @param tabBean
... ...
package com.wd.common.widget;
import android.graphics.Rect;
import android.view.View;
import androidx.recyclerview.widget.RecyclerView;
/**
* Created by Administrator on 2016/11/12.
*/
public class GridSpaceItemDecoration extends RecyclerView.ItemDecoration {
private int spanCount;
private int spacing;
private boolean includeEdge;
public GridSpaceItemDecoration(int spanCount, int spacing, boolean includeEdge) {
this.spanCount = spanCount;
this.spacing = spacing;
this.includeEdge = includeEdge;
}
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
int position = parent.getChildAdapterPosition(view); // item position
int column = position % spanCount; // item column
if (includeEdge) {
outRect.left = spacing - column * spacing / spanCount; // spacing - column * ((1f / spanCount) * spacing)
outRect.right = (column + 1) * spacing / spanCount; // (column + 1) * ((1f / spanCount) * spacing)
if (position < spanCount) { // top edge
outRect.top = spacing;
}
outRect.bottom = spacing; // item bottom
} else {
outRect.left = column * spacing / spanCount; // column * ((1f / spanCount) * spacing)
outRect.right = spacing - (column + 1) * spacing / spanCount; // spacing - (column + 1) * ((1f / spanCount) * spacing)
if (position >= spanCount) {
outRect.top = spacing; // item top
}
}
}
}
... ...
package com.wd.common.widget;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.GridView;
/**
* @author prim
* @version 1.0.0
* @desc
* @time 2018/11/12 - 6:59 PM
*/
public class OtherGridView extends GridView {
public OtherGridView(Context paramContext, AttributeSet paramAttributeSet) {
super(paramContext, paramAttributeSet);
}
@Override
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2,
MeasureSpec.AT_MOST);
super.onMeasure(widthMeasureSpec, expandSpec);
}
}
... ...
... ... @@ -348,32 +348,6 @@
<!--跳转异常-->
<string name="jump_not_find">请升级到最新版本以体验全部功能</string>
<!--缺省页-->
<!--页面接口报错,用于列表类及其他页面(带重试按钮)-->
<string name="default_get_content_error">加载失败,请重试!</string>
<!--内容获取失败,用于内容详情页(带重试按钮)-->
<string name="default_get_content_failed">发生错误,请稍后重试。</string>
<!--暂无网络(带重试按钮)-->
<string name="default_no_network">请检查您的网络连接,然后重试!</string>
<!--暂无内容-->
<string name="default_no_content">暂无内容</string>
<!--暂无收藏内容-->
<string name="default_no_collected">你好没有收藏. 去主页.</string>
<string name="no_collection">暂无收藏内容</string>
<!--暂无消息或暂无浏览历史-->
<string name="default_no_records">暂无消息</string>
<string name="no_browsing_history">暂无浏览历史</string>
<!--暂无搜索结果-->
<string name="default_no_content_found">未找到内容</string>
<string name="no_net_tips">无网络</string>
<string name="weak_net_tips">网络有问题。请检查网络</string>
<string name="click_retry">重试</string>
<string name="clickretry">点击重试</string>
<string name="no_more_data">没有了</string>
<string name="seal_login_user_logout">用户已注销</string>
<string name="seal_login_user_blocked">这个账号被封了!</string>
<!-- 加入聊天室失败-->
<string name="discovery_chat_room_join_failure">加入聊天室失败 </string>
<!-- 你被禁止加入聊天室-->
... ...
... ... @@ -37,7 +37,6 @@ dependencies {
annotationProcessor rootProject.ext.dependencies["room-compiler"]
//json解析
implementation rootProject.ext.dependencies["gson"]
implementation project(path: ':wdbean')
implementation project(path: ':wdkitcore')
// implementation project(':aar_repo:localaar_ability')
}
\ No newline at end of file
... ...
... ... @@ -18,7 +18,12 @@
android:screenOrientation="portrait"/>
<activity
android:name="com.wd.module_home.PaperActivity"
android:name=".NavigationBarActivity"
android:exported="false"
android:screenOrientation="portrait" />
<activity
android:name=".PaperActivity"
android:exported="false"
android:screenOrientation="portrait"
android:theme="@style/BgTransparentTheme"/>
... ...
package com.wd.module_home;
import android.graphics.drawable.Drawable;
import android.view.View;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.people.room.ChannelDbHelper;
import com.people.room.entity.ChannelBean;
import com.wd.common.base.BaseActivity;
import com.wd.common.constant.RouterConstants;
import com.wd.common.utils.ObjectUtil;
import com.wd.common.utils.ProcessUtils;
import com.wd.common.widget.GridSpaceItemDecoration;
import com.wd.common.widget.WrapHeightGridLayoutManager;
import com.wd.foundation.wdkit.constant.EventConstants;
import com.wd.foundation.wdkit.statusbar.StatusBarStyleEnum;
import com.wd.foundation.wdkit.utils.SpUtils;
import com.wd.foundation.wdkitcore.livedata.LiveDataBus;
import com.wd.foundation.wdkitcore.thread.ThreadPoolUtils;
import com.wd.foundation.wdkitcore.tools.AppContext;
import com.wd.module_home.adapter.ActNewChannelAdapter;
import com.wd.module_home.adapter.ActNewChannelNormalAdapter;
import com.wd.module_home.util.CallbackItemTouch;
import com.wd.module_home.util.MyItemTouchHelperCallback;
import java.util.ArrayList;
import java.util.List;
/**
* @Description: 导航栏页面、频道选择页、频道切换页面、频道排序页、更多频道页、频道栏目页(首页设置、我的频道、更多频道、地方频道)
* @Author: Li Yubing
* @Email: liyubing@wondert.com.cn
* @CreateDate: 2023/8/3 15:14
* @Version: 1.0
*/
@Route(path = RouterConstants.PATH_NAV_BAR)
public class NavigationBarActivity extends BaseActivity implements View.OnClickListener {
private ItemTouchHelper touchHelper;
/**
* 我的频道
*/
private RecyclerView recyclerView;
/**
* 我的频道适配器
*/
private ActNewChannelAdapter myChannelAdapter;
/**
* 地方频道
*/
private ActNewChannelNormalAdapter cityChannelAdapter;
/**
* 更多频道
*/
private ActNewChannelNormalAdapter moreAdapter;
private GridView gvLocalChannel;
private GridView gvMoreChannel;
private TextView act_channel_local, act_channel_cat, tv_edit_channel;
private List<ChannelBean> myChannelList;
private List<ChannelBean> cityChannelList;
private List<ChannelBean> moreChannelList;
private ImageView recommendImg;
private TextView recommendBtn;
private ImageView hotImg;
private TextView hotBtn;
private TextView tvhomeset;
private TextView tvhomesettip;
//我的频道
private TextView mychannel;
private ConstraintLayout clHomeSet;
private boolean isEditChannel = false;
/**
* 页面数据有变化
*/
private boolean isChange = false;
/**
* 首页设置第一项
*/
private ChannelBean firstChannelEntity;
/**
* 首页设置第二项
*/
private ChannelBean secondChannelEntity;
@Override
protected int getLayoutId() {
return R.layout.act_new_channel;
}
@Override
protected String getTag() {
return getClass().getSimpleName();
}
@Override
protected StatusBarStyleEnum getStatusBarStyle() {
boolean isNightMode = SpUtils.isNightMode();
if(isNightMode){
return StatusBarStyleEnum.FULLSCREEN_LIGHT_ENUM;
}else {
return StatusBarStyleEnum.FULLSCREEN_DARK_ENUM;
}
}
@Override
protected void initView() {
initArgs();
findView();
}
@Override
protected void initData() {
}
@Override
protected void initViewModel() {
ThreadPoolUtils.backgroundSubmit(new Runnable() {
@Override
public void run() {
getNavbarChannelDataToDrawPage(ProcessUtils.tempAddList);
}
});
}
public void initArgs() {
ItemTouchHelper.Callback callback = new MyItemTouchHelperCallback(new CallbackItemTouch() {
private int oldPosition = -1;
private int newPosition = -1;
@Override
public boolean itemTouchOnMove(int oldPosition, int newPosition) {
if (myChannelAdapter.getChannelEntities().get(newPosition).getHeadlinesOn() == 1
|| myChannelAdapter.getChannelEntities().get(newPosition).getMovePermitted() == 0
|| myChannelAdapter.getChannelEntities().get(oldPosition).getHeadlinesOn() == 1
|| myChannelAdapter.getChannelEntities().get(oldPosition).getMovePermitted() == 0
) {
return false;
} else {
isChange = true;
this.oldPosition = oldPosition;
this.newPosition = newPosition;
ChannelBean item = myChannelAdapter.getChannelEntities().get(oldPosition);
myChannelAdapter.getChannelEntities().remove(oldPosition);
myChannelAdapter.getChannelEntities().add(newPosition, item);
myChannelAdapter.notifyItemMoved(oldPosition, newPosition);
return true;
}
}
@Override
public void stopDrag() {
if (isChange && oldPosition > -1) {
myChannelAdapter.notifyDataSetChanged();
oldPosition = -1;
newPosition = -1;
}
}
});// create MyItemTouchHelperCallback
touchHelper = new ItemTouchHelper(callback); // Create ItemTouchHelper and pass with parameter the MyItemTouchHelperCallback
myChannelAdapter = new ActNewChannelAdapter(this,touchHelper, (v, object) -> {
ChannelBean entity = (ChannelBean) object;
int id = v.getId();
if (id == R.id.del_imageView) {
removeChannel(entity);
} else {
if (isEditChannel) {
if (entity.getHeadlinesOn() != 1 && entity.getMovePermitted() != 0 && entity.getDelPermitted() != 0) {//允许删除才可以删除
removeChannel(entity);
}
} else {
toChannel(entity);
}
}
});
myChannelAdapter.setOnChannelEditListener(new ActNewChannelAdapter.OnChannelEditListener() {
@Override
public void show() {
isEditChannel = true;
tv_edit_channel.setText(R.string.navigation_bar_finish);
}
@Override
public void diss() {
isEditChannel = false;
tv_edit_channel.setText(R.string.navigation_bar_edit);
}
});
cityChannelAdapter = new ActNewChannelNormalAdapter(this, (v, object) -> {
ChannelBean channelEntity = (ChannelBean) object;
myChannelAdapter.addOne(channelEntity);
judeMyChannelVisible();
cityChannelAdapter.removeItem(channelEntity);
isChange = true;
judegeLocalChannelVisible();
});
moreAdapter = new ActNewChannelNormalAdapter(this, (v, object) -> {
ChannelBean channelEntity = (ChannelBean) object;
myChannelAdapter.addOne(channelEntity);
moreAdapter.removeItem(channelEntity);
isChange = true;
judgeMoreChannelVisible();
});
}
/**
* 异步保存频道
*/
private void saveChannel(ChannelBean bean) {
if (isChange) {
ThreadPoolUtils.submit(new Runnable() {
@Override
public void run() {
List<ChannelBean> channelEntities = new ArrayList<>();
ChannelDbHelper.getInstance(NavigationBarActivity.this).deleteAll();
channelEntities.addAll(myChannelAdapter.getChannelEntities());
channelEntities.addAll(moreAdapter.getChannelList());
channelEntities.addAll(cityChannelAdapter.getChannelList());
ChannelDbHelper.getInstance(NavigationBarActivity.this).save(channelEntities);
LiveDataBus.getInstance().with(EventConstants.COLUMN_NAVIGATION_DATACHANGE).postValue(bean);
}
});
} else {
if (bean != null) {
LiveDataBus.getInstance().with(EventConstants.COLUMN_NAVIGATION_SELECT).postValue(bean);
}
}
}
public void findView() {
gvMoreChannel = findViewById(R.id.act_channel_local_grid2);
gvLocalChannel = findViewById(R.id.act_channel_local_grid);
act_channel_local = findViewById(R.id.act_channel_local);
act_channel_cat = findViewById(R.id.act_channel_cat);
recyclerView = findViewById(R.id.act_new_channel_recyclerView);
recommendBtn = findViewById(R.id.tv_channel_recommend_btn);
hotBtn = findViewById(R.id.tv_channel_hot_btn);
recommendImg = findViewById(R.id.iv_channel_recommend_btn);
hotImg = findViewById(R.id.iv_channel_hot_btn);
//首页设置
tvhomeset = findViewById(R.id.tvhomeset);
tvhomesettip = findViewById(R.id.tvhomesettip);
//我的频道
mychannel = findViewById(R.id.tv_my_channel);
tv_edit_channel = findViewById(R.id.tv_edit_channel);
clHomeSet = findViewById(R.id.clHomeSet);
recyclerView.setLayoutManager(new WrapHeightGridLayoutManager(this, 4));
recyclerView.addItemDecoration(new GridSpaceItemDecoration(4, (int) getResources().getDimension(R.dimen.rmrb_dp8), false));
recyclerView.setAdapter(myChannelAdapter);
gvMoreChannel.setAdapter(moreAdapter);
gvLocalChannel.setAdapter(cityChannelAdapter);
act_channel_local.setOnClickListener(this);
act_channel_cat.setOnClickListener(this);
act_channel_local.setSelected(true);
findViewById(R.id.flClose).setOnClickListener(this);
touchHelper.attachToRecyclerView(recyclerView); // Attach ItemTouchHelper to RecyclerView
tv_edit_channel.setOnClickListener(this);
recommendImg.setOnClickListener(this);
hotImg.setOnClickListener(this);
ImageView iv_rmrb_1 = findViewById(R.id.iv_rmrb_1);
RelativeLayout.LayoutParams rlChannelParams = (RelativeLayout.LayoutParams) iv_rmrb_1.getLayoutParams();
rlChannelParams.setMargins(0, (int) (getResources().getDimension(R.dimen.rmrb_dp44) + getResources().getDimension(R.dimen.rmrb_dp4)), 0, 0);
}
private void removeChannel(ChannelBean entity) {
isChange = true;
entity.myChannel = "0";
myChannelAdapter.removeOne(entity);
judeMyChannelVisible();
//地区频道
if (entity.getChannelType() == 2) {
entity.localChannel = "1";
cityChannelAdapter.addItem(entity);
judegeLocalChannelVisible();
} else {
entity.moreChannel = "1";
moreAdapter.addItem(entity);
judgeMoreChannelVisible();
}
}
private void judeMyChannelVisible() {
if (ObjectUtil.isNull(myChannelAdapter)) {
mychannel.setVisibility(View.GONE);
tv_edit_channel.setVisibility(View.GONE);
return;
}
if (myChannelAdapter.isDataEmpty()) {
mychannel.setVisibility(View.GONE);
tv_edit_channel.setVisibility(View.GONE);
} else {
mychannel.setVisibility(View.VISIBLE);
tv_edit_channel.setVisibility(View.VISIBLE);
}
}
private void judgeMoreChannelVisible() {
if (ObjectUtil.isNull(moreAdapter)) {
act_channel_cat.setVisibility(View.GONE);
gvMoreChannel.setVisibility(View.GONE);
return;
}
if (moreAdapter.isDataEmpty()) {
act_channel_cat.setVisibility(View.GONE);
gvMoreChannel.setVisibility(View.GONE);
} else {
act_channel_cat.setVisibility(View.VISIBLE);
gvMoreChannel.setVisibility(View.VISIBLE);
}
}
private void judegeLocalChannelVisible() {
if (ObjectUtil.isNull(cityChannelAdapter)) {
act_channel_local.setVisibility(View.GONE);
gvLocalChannel.setVisibility(View.GONE);
return;
}
if (cityChannelAdapter.isDataEmpty()) {
act_channel_local.setVisibility(View.GONE);
gvLocalChannel.setVisibility(View.GONE);
} else {
act_channel_local.setVisibility(View.VISIBLE);
gvLocalChannel.setVisibility(View.VISIBLE);
}
}
private ChannelBean entity;
private void toChannel(ChannelBean entity) {
this.entity = entity;
finish();
}
@Override
public void onClick(View v) {
int id = v.getId();
if (id == R.id.tv_edit_channel) {
myChannelAdapter.togDelete();
myChannelAdapter.notifyDataSetChanged();
} else if (id == R.id.iv_channel_recommend_btn) {
changeHomeSetUi(firstChannelEntity.getChannelId());
entity = firstChannelEntity;
} else if (id == R.id.iv_channel_hot_btn) {
changeHomeSetUi(secondChannelEntity.getChannelId());
entity = secondChannelEntity;
} else if (id == R.id.flClose) {
// entity = null;
finish();
}
}
private void changeHomeSetUi(String channelId) {
if (secondChannelEntity != null && secondChannelEntity.getChannelId().equals(channelId)) {
recommendImg.setVisibility(View.VISIBLE);
hotImg.setVisibility(View.VISIBLE);
recommendBtn.setVisibility(View.VISIBLE);
hotBtn.setVisibility(View.VISIBLE);
SpUtils.setKeyDefaultChannelId(secondChannelEntity.getChannelId());
recommendImg.setImageResource(R.drawable.shape_channel_recommend_unselect);
hotImg.setImageResource(R.drawable.shape_channel_hot_select);
recommendBtn.setTextColor(ContextCompat.getColor(this, R.color.res_color_common_C11));
Drawable drawable = ContextCompat.getDrawable(this, R.drawable.channeldrawer_unselect);
int wh = (int) getResources().getDimension(R.dimen.rmrb_dp20);
drawable.setBounds(0, 0, wh,wh);
recommendBtn.setCompoundDrawables(drawable, null, null, null);
hotBtn.setTextColor(ContextCompat.getColor(this, R.color.res_color_common_C8_keep));
} else {
if (secondChannelEntity == null) {
recommendImg.setVisibility(View.VISIBLE);
recommendBtn.setVisibility(View.VISIBLE);
SpUtils.setKeyDefaultChannelId(firstChannelEntity.getChannelId());
hotImg.setImageResource(R.drawable.shape_channel_hot_unselect);
recommendBtn.setTextColor(ContextCompat.getColor(this, R.color.res_color_common_C8_keep));
Drawable drawable = ContextCompat.getDrawable(this, R.drawable.channeldrawer_select);
int wh = (int) getResources().getDimension(R.dimen.rmrb_dp20);
drawable.setBounds(0, 0, wh, wh);
recommendBtn.setCompoundDrawables(drawable, null, null, null);
hotBtn.setTextColor(ContextCompat.getColor(this, R.color.res_color_common_C11));
hotImg.setVisibility(View.GONE);
hotBtn.setVisibility(View.GONE);
recommendImg.setImageResource(R.drawable.shape_bag_red_radious3);
} else {
recommendImg.setVisibility(View.VISIBLE);
hotImg.setVisibility(View.VISIBLE);
recommendBtn.setVisibility(View.VISIBLE);
hotBtn.setVisibility(View.VISIBLE);
SpUtils.setKeyDefaultChannelId(firstChannelEntity.getChannelId());
recommendImg.setImageResource(R.drawable.shape_channel_recommend_select);
hotImg.setImageResource(R.drawable.shape_channel_hot_unselect);
recommendBtn.setTextColor(ContextCompat.getColor(this, R.color.res_color_common_C8_keep));
Drawable drawable = ContextCompat.getDrawable(this, R.drawable.channeldrawer_select);
int wh = (int) getResources().getDimension(R.dimen.rmrb_dp20);
drawable.setBounds(0, 0, wh,wh);
recommendBtn.setCompoundDrawables(drawable, null, null, null);
hotBtn.setTextColor(ContextCompat.getColor(this, R.color.res_color_common_C11));
}
}
recommendBtn.setText(firstChannelEntity.getName());
if (secondChannelEntity != null) {
hotBtn.setText(secondChannelEntity.getName());
}
}
/**
* 获取频道导航栏频道数据,并调用页面绘制
*
* @param tempAddList 辅助频道数据
*/
private void getNavbarChannelDataToDrawPage(List<com.wd.foundation.bean.response.ChannelBean> tempAddList) {
boolean saveFlag = false;
// 频道编辑栏目中所有频道数据
List<ChannelBean> allChannelList = ChannelDbHelper.getInstance(AppContext.getContext()).getData();
if (tempAddList != null) {
for (com.wd.foundation.bean.response.ChannelBean tempBean : tempAddList) {
String channlId = tempBean.getChannelId();
for (ChannelBean bean : allChannelList) {
if (channlId.equals(bean.getChannelId())) {
// 设置成我的频道数据
bean.myChannel = "1";
saveFlag = true;
break;
}
}
}
}
if (saveFlag) {
ChannelDbHelper.getInstance(AppContext.getContext()).save(allChannelList);
}
// 更新编辑编辑ui页面
update(allChannelList);
}
/**
* 设置/更新数据
*/
private void update(@NonNull List<ChannelBean> list) {
firstChannelEntity = null;
secondChannelEntity = null;
myChannelList = new ArrayList<>();
cityChannelList = new ArrayList<>();
moreChannelList = new ArrayList<>();
ChannelBean channelEntity = null;
for (int i = 0; i < list.size(); i++) {
channelEntity = list.get(i);
if (secondChannelEntity == null && "1".equals(channelEntity.homeChannel)) {
if (firstChannelEntity == null) {
firstChannelEntity = channelEntity;
} else {
secondChannelEntity = channelEntity;
}
}
//我的频道
if ("1".equals(channelEntity.myChannel)) {
myChannelList.add(channelEntity);
} else {
if ("1".equals(channelEntity.localChannel)) {
//地方频道
cityChannelList.add(channelEntity);
} else {
channelEntity.moreChannel = "1";
//更多频道
moreChannelList.add(channelEntity);
}
}
}
if (firstChannelEntity == null && secondChannelEntity == null) {
SpUtils.setKeyDefaultChannelId("2002");
//隐藏首选项
recommendImg.setVisibility(View.GONE);
hotImg.setVisibility(View.GONE);
recommendBtn.setVisibility(View.GONE);
hotBtn.setVisibility(View.GONE);
tvhomeset.setVisibility(View.GONE);
tvhomesettip.setVisibility(View.GONE);
clHomeSet.setVisibility(View.GONE);
} else {
clHomeSet.setVisibility(View.VISIBLE);
ChannelBean sortChannelEntity = null;
//排序
if (secondChannelEntity != null && firstChannelEntity.num > secondChannelEntity.num) {
sortChannelEntity = secondChannelEntity;
secondChannelEntity = firstChannelEntity;
firstChannelEntity = sortChannelEntity;
}
tvhomeset.setVisibility(View.VISIBLE);
tvhomesettip.setVisibility(View.VISIBLE);
changeHomeSetUi(SpUtils.getKeyDefaultChannelId());
}
myChannelAdapter.setChannelEntities(myChannelList);
cityChannelAdapter.setData(cityChannelList);
moreAdapter.setData(moreChannelList);
judeMyChannelVisible();
judgeMoreChannelVisible();
judegeLocalChannelVisible();
}
@Override
public void finish() {
super.finish();
overridePendingTransition(R.anim.exit_page_alpha_in, R.anim.exit_page_top_bottom_out);
saveChannel(entity);
}
}
... ...
package com.wd.module_home.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import androidx.core.view.MotionEventCompat;
import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.RecyclerView;
import com.people.room.entity.ChannelBean;
import com.wd.foundation.wdkit.utils.FilletUtil;
import com.wd.foundation.wdkit.utils.SpUtils;
import com.wd.foundation.wdkitcore.tools.ArrayUtils;
import com.wd.module_home.R;
import com.wd.module_home.util.MyGeneraItemClickListener;
import java.util.ArrayList;
import java.util.List;
/**
* 作者 zhangbinglei.
* 日期 2016/11/19.
* 描述
*/
public class ActNewChannelAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
boolean delView;
private MyGeneraItemClickListener onItemClickListener;
private Context context;
private List<ChannelBean> channelEntities = new ArrayList<>();
private ItemTouchHelper mItemTouchHelper;
private LayoutInflater mInflater;
/**
* touch 间隔时间 用于分辨是否是 "点击"
*/
private static final long SPACE_TIME = 100;
/**
* touch 点击开始时间
*/
private long startTime;
public void setChannelEntities(List<ChannelBean> channelEntities) {
this.channelEntities = channelEntities;
notifyDataSetChanged();
}
public List<ChannelBean> getChannelEntities() {
return channelEntities;
}
public ActNewChannelAdapter(Context context, ItemTouchHelper helper, MyGeneraItemClickListener onItemClickListener) {
this.onItemClickListener = onItemClickListener;
this.context = context;
this.mItemTouchHelper = helper;
this.mInflater = LayoutInflater.from(context);
}
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
return getViewHolderByTypeMyChannel(parent);
}
/**
* 获取我的频道的ViewHolder
*/
@NonNull
private RecyclerView.ViewHolder getViewHolderByTypeMyChannel(final ViewGroup parent) {
View myChannelView = mInflater.inflate(R.layout.act_new_channel_item, parent, false);
final ChannelViewHolder myHolder = new ChannelViewHolder(myChannelView);
//点击事件
myHolder.convertView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(final View v) {
int p = (int) v.getTag(R.id.status_view);
if (ArrayUtils.listHasItem(p, channelEntities)) {
onItemClickListener.onItemClick(v, channelEntities.get(p));
}
}
});
//长按事件
myHolder.convertView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(final View v) {
if (!delView) {
togDelete();
RecyclerView recyclerView = ((RecyclerView) parent);
startEditMode(recyclerView);
}
//手动调用ItemTouchHelper的startDrag方法启动拖拽。
mItemTouchHelper.startDrag(myHolder);
return true;
}
});
//触摸事件
myHolder.convertView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (delView) {
switch (MotionEventCompat.getActionMasked(event)) {
case MotionEvent.ACTION_DOWN:
startTime = System.currentTimeMillis();
break;
case MotionEvent.ACTION_MOVE:
/*
* 当MOVE事件与DOWN事件的触发的间隔时间大于100ms时,则认为是拖拽starDrag,
* 小于100ms不做任何处理,return false。
* 这样item的点击事件、RecyclerView的滚动事件都可以正常执行。
*/
if (System.currentTimeMillis() - startTime > SPACE_TIME) {
//手动调用ItemTouchHelper的startDrag方法启动拖拽。
mItemTouchHelper.startDrag(myHolder);
}
break;
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
startTime = 0;
break;
}
}
return false;
}
});
return myHolder;
}
/**
* 开启编辑模式
*/
private void startEditMode(RecyclerView parent) {
startOrCancelEditMode(parent);
}
/**
* 开启或者完成编辑模式
*/
private void startOrCancelEditMode(RecyclerView parent) {
int visibleChildCount = parent.getChildCount();
for (int i = 0; i < visibleChildCount; i++) {
View view = parent.getChildAt(i);
ImageView imgEdit = (ImageView) view.findViewById(R.id.del_imageView);
if (imgEdit != null) {
dealX(channelEntities.get(i),imgEdit);
}
}
}
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
((ChannelViewHolder) holder).update(position);
}
public boolean togDelete() {
if (delView) {
delView = false;
if (listener != null) {
listener.diss();
}
} else {
delView = true;
if (listener != null) {
listener.show();
}
}
return delView;
}
@Override
public int getItemCount() {
return channelEntities.size();
}
public void addOne(ChannelBean entity) {
entity.myChannel = "1";
channelEntities.add(entity);
notifyDataSetChanged();
}
public void removeOne(ChannelBean entity) {
entity.myChannel = "0";
channelEntities.remove(entity);
notifyDataSetChanged();
}
public boolean isDataEmpty(){
return ArrayUtils.isEmpty(channelEntities);
}
public class ChannelViewHolder extends RecyclerView.ViewHolder {
View convertView;
public ChannelBean channel;
private TextView item_text;
private ImageView del_imageView;
public ChannelViewHolder(View itemView) {
super(itemView);
this.convertView = itemView;
}
public void update(int position) {
item_text = convertView.findViewById(R.id.navigate_content_right);
convertView.setTag(R.id.status_view,position);
del_imageView = convertView.findViewById(R.id.del_imageView);
del_imageView.setTag(R.id.status_view,position);
channel = channelEntities.get(position);
item_text.setText(channel.getName());
int strokeWidth = (int) context.getResources().getDimension(R.dimen.rmrb_dp0_5);
if(strokeWidth < 1){
strokeWidth = 1;
}
int strokeColor = 0xFFEDEDED;
if (SpUtils.isNightMode()){
strokeColor = 0xFF333333;
}
if (channel.getHeadlinesOn() == 1 || channel.getMovePermitted() == 0) {//不可删除不可排序
// 填充色
int fillColor = 0xFFF5F5F5;
if (SpUtils.isNightMode()){
fillColor = 0xFF262626;
}
convertView.setBackground(FilletUtil.createRectangleDrawable(fillColor, strokeColor, strokeWidth, context.getResources().getDimension(R.dimen.rmrb_dp3)));
item_text.setTextColor(ContextCompat.getColor(context, R.color.res_color_common_C3));
convertView.setEnabled(true);
convertView.setLongClickable(false);
} else if (channel.getDelPermitted() == 0) {//不可删除,可排序
int fillColor = 0xFFFFFFFF;
if (SpUtils.isNightMode()){
fillColor = 0xFF1D1D1D;
}
convertView.setBackground(FilletUtil.createRectangleDrawable(fillColor, strokeColor, strokeWidth, context.getResources().getDimension(R.dimen.rmrb_dp3)));
convertView.setEnabled(true);
item_text.setTextColor(ContextCompat.getColor(context, R.color.res_color_common_C1));
convertView.setLongClickable(true);
} else {//可删除,可排序
int fillColor = 0xFFFFFFFF;
if (SpUtils.isNightMode()){
fillColor = 0xFF1D1D1D;
}
convertView.setBackground(FilletUtil.createRectangleDrawable(fillColor, strokeColor, strokeWidth, context.getResources().getDimension(R.dimen.rmrb_dp3)));
convertView.setEnabled(true);
item_text.setTextColor(ContextCompat.getColor(context, R.color.res_color_common_C1));
convertView.setLongClickable(true);
}
dealX(channel,del_imageView);
}
}
private void dealX(ChannelBean channel,ImageView del_imageView) {
//非头条、允许移动移动、可删除才展示X
if (delView && channel.getHeadlinesOn() != 1 && channel.getMovePermitted() != 0 && channel.getDelPermitted() != 0) {
del_imageView.setVisibility(View.VISIBLE);
del_imageView.setOnClickListener(v -> {
int p = (int) v.getTag(R.id.status_view);
if (ArrayUtils.listHasItem(p, channelEntities)) {
onItemClickListener.onItemClick(v, channelEntities.get(p));
}
});
} else {
del_imageView.setVisibility(View.GONE);
}
}
private OnChannelEditListener listener;
public void setOnChannelEditListener(OnChannelEditListener listener) {
this.listener = listener;
}
public interface OnChannelEditListener {
void show();
void diss();
}
}
... ...
package com.wd.module_home.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import com.people.room.entity.ChannelBean;
import com.wd.foundation.wdkit.utils.FilletUtil;
import com.wd.foundation.wdkit.utils.SpUtils;
import com.wd.foundation.wdkitcore.tools.ArrayUtils;
import com.wd.module_home.R;
import com.wd.module_home.util.MyGeneraItemClickListener;
import java.util.ArrayList;
import java.util.List;
public class ActNewChannelNormalAdapter extends BaseAdapter {
private Context context;
public List<ChannelBean> channelList = new ArrayList<>();
private TextView item_text;
private MyGeneraItemClickListener onItemClickListener;
public ActNewChannelNormalAdapter(Context context, MyGeneraItemClickListener onItemClickListener) {
this.onItemClickListener = onItemClickListener;
this.context = context;
}
@Override
public int getCount() {
return channelList.size();
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
View view = LayoutInflater.from(context).inflate(R.layout.subscribe_category_item, parent, false);
int strokeWidth = (int) context.getResources().getDimension(R.dimen.rmrb_dp0_5);
if (strokeWidth < 1) {
strokeWidth = 1;
}
int fillColor = 0xFFFFFFFF;
int strokeColor = 0xFFEDEDED;
if (SpUtils.isNightMode()) {
fillColor = 0xFF1D1D1D;
strokeColor = 0xFF333333;
}
view.setBackground(FilletUtil.createRectangleDrawable(fillColor, strokeColor, strokeWidth, context.getResources().getDimension(R.dimen.rmrb_dp3)));
item_text = view.findViewById(R.id.text_item);
ChannelBean channel = channelList.get(position);
item_text.setText(channel.getName());
view.setOnClickListener(v -> {
try {
if (onItemClickListener != null) {
if (position < channelList.size()) {
onItemClickListener.onItemClick(v, channelList.get(position));
}
}
} catch (Exception e) {
// ThrowableHelper.printStackTrace(null, e);
}
});
return view;
}
@Override
public Object getItem(int position) {
return null;
}
/**
* 获取频道列表
*/
public List<ChannelBean> getChannelList() {
return channelList;
}
/**
* 添加频道列表
*/
public void addItem(ChannelBean channel) {
channelList.add(0, channel);
notifyDataSetChanged();
}
/**
* 删除一项
*/
public void removeItem(ChannelBean channel) {
channelList.remove(channel);
notifyDataSetChanged();
}
/**
* 设置频道列表
*/
public void setData(List<ChannelBean> list) {
channelList = list;
notifyDataSetChanged();
}
public boolean isDataEmpty() {
return ArrayUtils.isEmpty(channelList);
}
}
\ No newline at end of file
... ...
package com.wd.module_home.util;
/**
* Interface to listen move in ItemTouchHelper.Callback
* Created by Alessandro on 15/01/2016.
*/
public interface CallbackItemTouch {
/**
* Called when an item has been dragged
*
* @param oldPosition start position
* @param newPosition end position
*/
boolean itemTouchOnMove(int oldPosition, int newPosition);
/**
* 停止拖动
*/
void stopDrag();
}
... ...
package com.wd.module_home.util;
import android.view.View;
/**
* Created by zhangbinglei on 15/4/16.
*/
public interface MyGeneraItemClickListener {
void onItemClick(View v, Object object);
}
... ...
package com.wd.module_home.util;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.StaggeredGridLayoutManager;
import com.wd.module_home.adapter.ActNewChannelAdapter;
import org.jetbrains.annotations.NotNull;
/**
* Created by Alessandro on 12/01/2016.
*/
public class MyItemTouchHelperCallback extends ItemTouchHelper.Callback {
private CallbackItemTouch callbackItemTouch; // interface
@Override
public boolean isLongPressDragEnabled() {
return false;
}
@Override
public boolean isItemViewSwipeEnabled() {
return false; // swiped disabled
}
@Override
public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
int dragFlags;
RecyclerView.LayoutManager manager = recyclerView.getLayoutManager();
if (manager instanceof GridLayoutManager || manager instanceof StaggeredGridLayoutManager) {
dragFlags = ItemTouchHelper.UP | ItemTouchHelper.DOWN | ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT;
} else {
dragFlags = ItemTouchHelper.UP | ItemTouchHelper.DOWN;
}
// 如果想支持滑动(删除)操作, swipeFlags = ItemTouchHelper.START | ItemTouchHelper.END
int swipeFlags = 0;
if (viewHolder instanceof ActNewChannelAdapter.ChannelViewHolder) {
ActNewChannelAdapter.ChannelViewHolder channelViewHolder = (ActNewChannelAdapter.ChannelViewHolder) viewHolder;
if (channelViewHolder.channel.getHeadlinesOn() == 1 || channelViewHolder.channel.getMovePermitted() == 0) {
//设置不可拖动 https://github.com/CymChad/BaseRecyclerViewAdapterHelper/issues/370
return makeMovementFlags(0, 0);
}
}
return makeMovementFlags(dragFlags, swipeFlags);
}
@Override
public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, RecyclerView.ViewHolder target) {
return callbackItemTouch.itemTouchOnMove(viewHolder.getAdapterPosition(), target.getAdapterPosition()); // information to the interface
}
public MyItemTouchHelperCallback(CallbackItemTouch callbackItemTouch) {
this.callbackItemTouch = callbackItemTouch;
}
@Override
public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) {
// swiped disabled
}
@Override
public void clearView(@NonNull @NotNull RecyclerView recyclerView, @NonNull @NotNull RecyclerView.ViewHolder viewHolder) {
super.clearView(recyclerView, viewHolder);
callbackItemTouch.stopDrag();
}
}
... ...
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/res_color_common_C8"
android:paddingLeft="@dimen/rmrb_dp16"
android:paddingRight="@dimen/rmrb_dp16">
<ImageView
android:id="@+id/iv_rmrb_1"
android:layout_width="@dimen/rmrb_dp72"
android:layout_height="@dimen/rmrb_dp29"
android:scaleType="fitXY"
android:src="@drawable/channeldrawer_logo" />
<FrameLayout
android:id="@+id/flClose"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/iv_rmrb_1"
android:layout_alignBottom="@+id/iv_rmrb_1"
android:layout_alignParentRight="true">
<ImageView
android:layout_width="@dimen/rmrb_dp24"
android:layout_height="@dimen/rmrb_dp24"
android:layout_gravity="center_vertical"
android:scaleType="fitXY"
android:src="@mipmap/icon_channel_close" />
</FrameLayout>
<com.scwang.smart.refresh.layout.SmartRefreshLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/iv_rmrb_1"
android:layout_marginTop="@dimen/rmrb_dp11"
app:srlEnablePureScrollMode="true">
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/rmrb_dp21"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/clHomeSet"
android:layout_width="match_parent"
android:layout_marginBottom="@dimen/rmrb_dp36"
android:layout_height="wrap_content">
<TextView
android:id="@+id/tvhomeset"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/navigation_bar_home_set"
android:textColor="@color/res_color_common_C1"
android:textSize="@dimen/rmrb_dp16"
android:textStyle="bold"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tvhomesettip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/rmrb_dp4"
android:ellipsize="end"
android:maxLines="1"
android:text="@string/navigation_bar_home_set_msg"
android:textColor="@color/res_color_common_C1_80"
android:textSize="@dimen/rmrb_dp12"
app:layout_constraintBottom_toBottomOf="@id/tvhomeset"
app:layout_constraintLeft_toRightOf="@id/tvhomeset"
app:layout_constraintTop_toTopOf="@id/tvhomeset" />
<ImageView
android:id="@+id/iv_channel_recommend_btn"
android:layout_width="0dp"
android:layout_height="@dimen/rmrb_dp36"
android:layout_marginTop="@dimen/rmrb_dp16"
android:scaleType="fitXY"
app:layout_constraintHorizontal_weight="1"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@+id/iv_channel_hot_btn"
app:layout_constraintTop_toBottomOf="@id/tvhomeset" />
<TextView
android:id="@+id/tv_channel_recommend_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawablePadding="@dimen/rmrb_dp4"
android:ellipsize="end"
android:gravity="center"
android:maxLines="1"
android:textColor="@color/res_color_common_C8_keep"
android:textSize="@dimen/rmrb_dp16"
app:autoSizeMaxTextSize="@dimen/rmrb_dp16"
app:autoSizeMinTextSize="@dimen/rmrb_dp10"
app:autoSizeTextType="uniform"
app:layout_constraintBottom_toBottomOf="@+id/iv_channel_recommend_btn"
app:layout_constraintLeft_toLeftOf="@+id/iv_channel_recommend_btn"
app:layout_constraintRight_toRightOf="@+id/iv_channel_recommend_btn"
app:layout_constraintTop_toTopOf="@+id/iv_channel_recommend_btn" />
<ImageView
android:id="@+id/iv_channel_hot_btn"
android:layout_width="0dp"
android:layout_height="@dimen/rmrb_dp36"
android:layout_marginTop="@dimen/rmrb_dp16"
android:scaleType="fitXY"
app:layout_constraintHorizontal_weight="1"
app:layout_constraintLeft_toRightOf="@+id/iv_channel_recommend_btn"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvhomeset" />
<TextView
android:id="@+id/tv_channel_hot_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:textColor="@color/res_color_general_DB0000"
android:textSize="@dimen/rmrb_dp16"
app:autoSizeMaxTextSize="@dimen/rmrb_dp16"
app:autoSizeMinTextSize="@dimen/rmrb_dp10"
app:autoSizeTextType="uniform"
app:layout_constraintBottom_toBottomOf="@+id/iv_channel_hot_btn"
app:layout_constraintLeft_toLeftOf="@+id/iv_channel_hot_btn"
app:layout_constraintRight_toRightOf="@+id/iv_channel_hot_btn"
app:layout_constraintTop_toTopOf="@+id/iv_channel_hot_btn" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_my_channel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/navigation_bar_my_channel"
android:textColor="@color/res_color_common_C1"
android:textSize="@dimen/rmrb_dp16"
android:textStyle="bold" />
<TextView
android:id="@+id/tv_edit_channel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:paddingLeft="@dimen/rmrb_dp4"
android:paddingRight="@dimen/rmrb_dp4"
android:text="@string/navigation_bar_edit"
android:textColor="@color/res_color_common_C11"
android:textSize="@dimen/rmrb_dp14" />
</androidx.appcompat.widget.LinearLayoutCompat>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/act_new_channel_recyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/rmrb_dp12"
android:clipChildren="false"
android:clipToPadding="false"
app:layout_constraintTop_toBottomOf="@id/tv_my_channel" />
<TextView
android:id="@+id/act_channel_cat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/rmrb_dp28"
android:text="@string/navigation_bar_more_channel"
android:textColor="@color/res_color_common_C1"
android:textSize="@dimen/rmrb_dp16"
android:textStyle="bold"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@id/act_new_channel_recyclerView" />
<com.wd.common.widget.OtherGridView
android:id="@+id/act_channel_local_grid2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/rmrb_dp12"
android:horizontalSpacing="@dimen/rmrb_dp8"
android:listSelector="@android:color/transparent"
android:numColumns="4"
android:verticalSpacing="@dimen/rmrb_dp8"
android:visibility="visible"
app:layout_constraintTop_toBottomOf="@id/act_channel_cat" />
<TextView
android:id="@+id/act_channel_local"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/rmrb_dp28"
android:text="@string/navigation_bar_city_channel"
android:textColor="@color/res_color_common_C1"
android:textSize="@dimen/rmrb_dp16"
android:textStyle="bold"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@id/act_channel_local_grid2" />
<com.wd.common.widget.OtherGridView
android:id="@+id/act_channel_local_grid"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/rmrb_dp12"
android:horizontalSpacing="@dimen/rmrb_dp8"
android:listSelector="@android:color/transparent"
android:numColumns="4"
android:verticalSpacing="@dimen/rmrb_dp8"
app:layout_constraintTop_toBottomOf="@id/act_channel_local" />
<View
android:layout_width="match_parent"
android:layout_height="@dimen/rmrb_dp28"
app:layout_constraintTop_toBottomOf="@id/act_channel_local_grid" />
</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.core.widget.NestedScrollView>
</com.scwang.smart.refresh.layout.SmartRefreshLayout>
</RelativeLayout>
\ No newline at end of file
... ...
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="@dimen/rmrb_dp40"
android:clipChildren="false"
android:clipToPadding="false"
android:gravity="center">
<TextView
android:id="@+id/navigate_content_right"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:ellipsize="end"
android:gravity="center"
android:maxLines="1"
android:textColor="@color/res_color_common_C1"
android:textSize="@dimen/rmrb_dp14"
app:autoSizeMaxTextSize="@dimen/rmrb_dp14"
app:autoSizeMinTextSize="@dimen/rmrb_dp10"
app:autoSizeTextType="uniform"
app:layout_constraintLeft_toLeftOf="parent" />
<ImageView
android:id="@+id/del_imageView"
android:layout_width="@dimen/rmrb_dp12"
android:layout_height="@dimen/rmrb_dp12"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/rmrb_dp1"
android:layout_toRightOf="@id/navigate_content_right"
android:background="@drawable/channeldrawer_x"
android:clipChildren="false"
android:clipToPadding="false"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@id/navigate_content_right"
app:layout_constraintTop_toTopOf="parent" />
</RelativeLayout>
\ No newline at end of file
... ...
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/rl_subscribe"
android:layout_width="match_parent"
android:layout_height="@dimen/rmrb_dp40"
android:gravity="center">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/text_item"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:ellipsize="end"
android:gravity="center"
android:maxLines="1"
android:textColor="@color/res_color_common_C1"
android:textSize="@dimen/rmrb_dp14"
app:autoSizeMaxTextSize="@dimen/rmrb_dp14"
app:autoSizeMinTextSize="@dimen/rmrb_dp10"
app:autoSizeTextType="uniform" />
<ImageView
android:layout_width="@dimen/rmrb_dp12"
android:layout_height="@dimen/rmrb_dp12"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/rmrb_dp1"
android:layout_toRightOf="@id/text_item"
android:background="@drawable/channeldrawer_add"
android:clipChildren="false"
android:clipToPadding="false" />
</RelativeLayout>
\ No newline at end of file
... ...
... ... @@ -74,4 +74,13 @@
<string name="termsofuse">《用户协议》</string>
<string name="privacypolicy">《隐私政策》</string>
<!--导航编辑页面-->
<string name="navigation_bar_home_set">首页设置</string>
<string name="navigation_bar_home_set_msg">将指定频道设置为首页</string>
<string name="navigation_bar_my_channel">我的频道</string>
<string name="navigation_bar_more_channel">更多频道</string>
<string name="navigation_bar_city_channel">地方频道</string>
<string name="navigation_bar_edit">编辑</string>
<string name="navigation_bar_finish">完成</string>
</resources>
... ...
... ... @@ -50,8 +50,6 @@ android {
dependencies {
implementation 'com.alibaba:fastjson:1.2.62'
implementation 'androidx.annotation:annotation:1.1.0'
// //依赖数据库module 里面的数据bean
// api project(path: ':lib_room')
implementation project(':wdkitcore')
}
... ...
package com.people.room.entity.publish;
package com.wd.foundation.bean.publish;
import android.text.TextUtils;
import java.io.Serializable;
... ...
package com.wd.foundation.wdinterface.comp
import android.view.View
import androidx.fragment.app.Fragment
import com.alibaba.android.arouter.facade.template.IProvider
import com.wd.foundation.bean.custom.comp.CompBean
import com.wd.foundation.bean.custom.content.ContentBean
... ... @@ -29,4 +31,12 @@ interface IProcess : IProvider {
fun getShortVideoPath() : String
fun getHomeFullPlayPath() : String
fun goToPaperActivity()
fun goToCommonSubjectPage(llRight: View)
fun toSearchActivity(marqueePosition: Int, Title: String)
fun goToNavBarActivity(fragment: Fragment, tabId: String)
}
\ No newline at end of file
... ...
package com.wd.foundation.wdinterfaceimpl.comp;
import android.content.Context;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.wd.capability.layout.fragment.NewsHomeFragment;
import com.wd.common.constant.RouterConstants;
import com.wd.common.listener.ResultCallback;
import com.wd.common.utils.CommonNetUtils;
import com.wd.common.utils.ProcessUtils;
import com.wd.foundation.bean.custom.comp.CompBean;
import com.wd.foundation.bean.custom.comp.PageBean;
import com.wd.foundation.bean.custom.content.ContentBean;
import com.wd.foundation.bean.custom.content.ContentTypeConstant;
import com.wd.foundation.bean.response.ChannelBean;
import com.wd.foundation.wdinterface.comp.IProcess;
import com.wd.foundation.wdinterface.constant.InterfaceConstant;
import com.wd.foundation.wdkit.utils.ToastNightUtil;
import java.util.List;
/**
* @author wangkai
... ... @@ -72,4 +82,62 @@ public class ProcessImpl implements IProcess {
public String getHomeFullPlayPath() {
return RouterConstants.PATH_HOME_FULL_PLAY;
}
@Override
public void goToPaperActivity() {
ProcessUtils.goToPaperActivity();
}
@Override
public void goToCommonSubjectPage(View llRight) {
CommonNetUtils.getInstance().getDailyPaperId(new ResultCallback<PageBean>() {
@Override
public void onSuccess(PageBean pageBean) {
if (pageBean != null) {
ContentBean bean = new ContentBean();
bean.setObjectLevel(String.valueOf(ContentTypeConstant.SUBJECT_TOPICTYPE_25));
bean.setPageId(pageBean.getId());
bean.setNewsTitle(pageBean.getName());
ProcessUtils.goToCommonSubjectPage(bean);
} else {
ToastNightUtil.showShort("暂无数据");
}
llRight.setClickable(true);
}
@Override
public void onError(String errorCode) {
llRight.setClickable(true);
}
});
}
@Override
public void toSearchActivity(int marqueePosition, @NonNull String Title) {
ProcessUtils.toSearchActivity(marqueePosition, Title);
}
@Override
public void goToNavBarActivity(Fragment fragment, @NonNull String tabId) {
/*
处理辅助频道
*/
if (fragment != null && fragment instanceof NewsHomeFragment) {
NewsHomeFragment newsHomeFragment = (NewsHomeFragment) fragment;
// 辅助频道数据
List<ChannelBean> tempAddList = newsHomeFragment.getTempAddList();
if (tempAddList != null && tempAddList.size() > 0) {
ProcessUtils.tempAddList = tempAddList;
// 完成编辑后清理辅助频道数据
newsHomeFragment.setTempAddList(null);
} else {
ProcessUtils.tempAddList = null;
}
} else {
ProcessUtils.tempAddList = null;
}
ProcessUtils.goToNavBarActivity(tabId);
}
}
... ...
... ... @@ -13,4 +13,30 @@
<string name="brvah_load_end">没有更多数据</string>
<string name="brvah_load_failed">加载失败,请点我重试</string>
<string name="brvah_loading">正在加载中...</string>
<!--缺省页-->
<!--页面接口报错,用于列表类及其他页面(带重试按钮)-->
<string name="default_get_content_error">加载失败,请重试!</string>
<!--内容获取失败,用于内容详情页(带重试按钮)-->
<string name="default_get_content_failed">发生错误,请稍后重试。</string>
<!--暂无网络(带重试按钮)-->
<string name="default_no_network">请检查您的网络连接,然后重试!</string>
<!--暂无内容-->
<string name="default_no_content">暂无内容</string>
<!--暂无收藏内容-->
<string name="default_no_collected">你好没有收藏. 去主页.</string>
<string name="no_collection">暂无收藏内容</string>
<!--暂无消息或暂无浏览历史-->
<string name="default_no_records">暂无消息</string>
<string name="no_browsing_history">暂无浏览历史</string>
<!--暂无搜索结果-->
<string name="default_no_content_found">未找到内容</string>
<string name="no_net_tips">无网络</string>
<string name="weak_net_tips">网络有问题。请检查网络</string>
<string name="click_retry">重试</string>
<string name="clickretry">点击重试</string>
<string name="no_more_data">没有了</string>
<string name="seal_login_user_logout">用户已注销</string>
<string name="seal_login_user_blocked">这个账号被封了!</string>
</resources>
\ No newline at end of file
... ...
... ... @@ -297,6 +297,14 @@ public class ArrayUtils {
}
}
public static boolean listHasItem(int position, List<?> list) {
if (list == null) {
return false;
}
return position < list.size();
}
public static boolean isOutOffIndex(int position, List<?> list) {
if (isEmpty(list)) {
return true;
... ...
... ... @@ -57,6 +57,7 @@ dependencies {
api project(path: ':wdkit')
api project(path: ':wdinterface')
api project(path: ':wdplayer')
api project(path: ':lib_room')
implementation rootProject.ext.support["appcompat-v7"]
implementation 'androidx.recyclerview:recyclerview:1.2.1'
... ...
package com.wd.capability.layout.constant;
public class ProcessConstant {
/**
* 版面频道(电子报)
*/
public static String CHANNEL_ID_EL_NEWS = "2006";
// 播报频道(音频频道)
public static String CHANNEL_ID_VOICE = "2066";
/**
* 播报的pageID
*/
public static String PAGE_ID_VOICE = "21003";
// 直播
public static String CHANNEL_ID_LIVE = "2061";
// 活动频道
public static String CHANNEL_ID_ACTIVITY = "2073";
}
\ No newline at end of file
... ...
... ... @@ -18,12 +18,15 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.people.room.ChannelDbHelper;
import com.wd.base.log.Logger;
import com.wd.capability.layout.comp.layoutmanager.ItemLayoutManager;
import com.wd.capability.layout.page.ItemErrorSubjectLayoutManager;
import com.wd.capability.layout.page.ItemNewsHomeMenuTopLayoutManager;
import com.wd.capability.layout.ui.channel.vm.ChannelViewModel;
import com.wd.capability.layout.ui.channel.vm.INavChannelDataListener;
import com.wd.foundation.wdinterface.comp.IProcess;
import com.wd.foundation.wdinterface.constant.InterfaceConstant;
import com.wd.foundation.wdkit.base.fragment.BaseFragment;
import com.wd.foundation.wdkit.base.fragment.BaseLazyFragment;
import com.wd.foundation.wdkit.constant.DefaultViewConstant;
... ... @@ -35,8 +38,12 @@ import com.wd.foundation.bean.response.ChannelBean;
import com.wd.foundation.wdkit.utils.SafeBundleUtil;
import com.wd.foundation.wdkit.utils.SpUtils;
import com.wd.foundation.wdkitcore.livedata.LiveDataBus;
import com.wd.foundation.wdkitcore.router.ArouterServiceManager;
import com.wd.foundation.wdkitcore.tools.AppContext;
import com.wd.foundation.wdkitcore.tools.CastUtils;
import com.wd.foundation.wdkitcore.tools.JsonUtils;
import java.util.ArrayList;
import java.util.List;
/**
... ... @@ -269,62 +276,69 @@ public class NewsHomeFragment extends BaseLazyFragment {
//频道编辑完成事件
LiveDataBus.getInstance().with(EventConstants.COLUMN_NAVIGATION_DATACHANGE, ChannelBean.class).observe(getViewLifecycleOwner(), result -> {
// if (mTabManager != null && mTabBean != null && menuData != null) {
// // 获取我的频道数据
// List<ChannelBean> myChannelList = ChannelDbHelper.getInstance(AppContext.getContext()).searchAllSelectChannel();
// mTabBean.setTopNavChannelList(myChannelList);
// if (result != null) {
// menuData.jumpChannelId = result.getChannelId();
// } else {
// menuData.jumpChannelId = null;
// }
//
// mTabManager.bindItem(mNavBarView, 0, mTabBean);
//
// }
if (mTabManager != null && mTabBean != null && menuData != null) {
// 获取我的频道数据
List<com.people.room.entity.ChannelBean> channelList = ChannelDbHelper.getInstance(AppContext.getContext()).searchAllSelectChannel();
List<ChannelBean> myChannelList = convertBeanList(channelList);
mTabBean.setTopNavChannelList(myChannelList);
if (result != null) {
menuData.jumpChannelId = result.getChannelId();
} else {
menuData.jumpChannelId = null;
}
mTabManager.bindItem(mNavBarView, 0, mTabBean);
}
});
// 接收临时频道数据
LiveDataBus.getInstance().with(EventConstants.COLUMN_NAVIGATION_DATACHANGE_ADD, ChannelBean.class).observe(getViewLifecycleOwner(), result -> {
// if (mTabManager != null && mTabBean != null) {
// if (tempAddList == null) {
// tempAddList = new ArrayList<>();
// }
// //检测是否有重复的
// int size = tempAddList.size();
// if (size > 0) {
// boolean isAdd = true;
// for (ChannelBean bean : tempAddList) {
// if (result.getChannelId().equals(bean.getChannelId())) {
// isAdd = false;
// break;
// }
// }
// if (isAdd) {
// tempAddList.add(result);
// }
//
// } else {
// tempAddList.add(result);
// }
//
// // 获取我的频道数据
// List<ChannelBean> myChannelList = ChannelDbHelper.getInstance(AppContext.getContext()).searchAllSelectChannel();
// // 增加个临时频道
// myChannelList.addAll(tempAddList);
//
// if (result.isSpecialChannel()) {
// // 特殊频道跳转方法
// ProcessUtils.specialChannelJumpPage(result);
// } else {
// // 设置跳转频道id
// menuData.jumpChannelId = result.getChannelId();
// }
// mTabBean.setTopNavChannelList(myChannelList);
// mTabManager.bindItem(mNavBarView, 0, mTabBean);
//
// }
if (mTabManager != null && mTabBean != null) {
if (tempAddList == null) {
tempAddList = new ArrayList<>();
}
//检测是否有重复的
int size = tempAddList.size();
if (size > 0) {
boolean isAdd = true;
for (ChannelBean bean : tempAddList) {
if (result.getChannelId().equals(bean.getChannelId())) {
isAdd = false;
break;
}
}
if (isAdd) {
tempAddList.add(result);
}
} else {
tempAddList.add(result);
}
// 获取我的频道数据
List<com.people.room.entity.ChannelBean> channelList = ChannelDbHelper.getInstance(AppContext.getContext()).searchAllSelectChannel();
List<ChannelBean> myChannelList = convertBeanList(channelList);
// 增加个临时频道
myChannelList.addAll(tempAddList);
if (result.isSpecialChannel()) {
// 特殊频道跳转方法
IProcess process = ArouterServiceManager.provide(InterfaceConstant.PATH_COMP_PROCESS);
if (process == null) {
Logger.t(TAG).e("COLUMN_NAVIGATION_DATACHANGE_ADD, IProcess has not impl");
} else {
process.specialChannelJumpPage(result);
}
} else {
// 设置跳转频道id
menuData.jumpChannelId = result.getChannelId();
}
mTabBean.setTopNavChannelList(myChannelList);
mTabManager.bindItem(mNavBarView, 0, mTabBean);
}
});
}
... ... @@ -467,4 +481,16 @@ public class NewsHomeFragment extends BaseLazyFragment {
public void setTempAddList(List<ChannelBean> tempAddList) {
this.tempAddList = tempAddList;
}
private List<ChannelBean> convertBeanList(List<com.people.room.entity.ChannelBean> channelList) {
List<ChannelBean> retList;
try {
String objectToJson = JsonUtils.convertObjectToJson(channelList);
retList = JsonUtils.convertJsonArrayToObjList(objectToJson,ChannelBean.class);
} catch (Exception e) {
throw new RuntimeException(e);
}
return retList;
}
}
... ...
... ... @@ -31,6 +31,7 @@ import com.wd.capability.layout.R;
import com.wd.capability.layout.comp.ICompService;
import com.wd.capability.layout.comp.layoutmanager.ItemContainerManager;
import com.wd.capability.layout.constant.LaunchPageConstant;
import com.wd.capability.layout.constant.ProcessConstant;
import com.wd.capability.layout.fragment.ColumnFragment;
import com.wd.capability.layout.fragment.NewsHomeFragment;
import com.wd.capability.layout.listener.ColumnFragmentCallback;
... ... @@ -41,6 +42,9 @@ import com.wd.capability.layout.ui.widget.commonnavigator.titles.TopNavEffectTit
import com.wd.capability.layout.uitls.CompentLogicUtil;
import com.wd.capability.network.utils.NetworkUtil;
import com.wd.capability.network.cachedata.CacheData;
import com.wd.foundation.bean.custom.comp.PageBean;
import com.wd.foundation.bean.custom.content.ContentBean;
import com.wd.foundation.bean.custom.content.ContentTypeConstant;
import com.wd.foundation.wdinterface.comp.IProcess;
import com.wd.foundation.wdinterface.constant.InterfaceConstant;
import com.wd.foundation.wdkit.constant.DefaultViewConstant;
... ... @@ -48,6 +52,7 @@ import com.wd.foundation.wdkit.constant.EventConstants;
import com.wd.foundation.wdkit.imageglide.ImageUtils;
import com.wd.foundation.wdkit.utils.GrayManager;
import com.wd.foundation.wdkit.utils.ToastNightUtil;
import com.wd.foundation.wdkit.viewclick.BaseClickListener;
import com.wd.foundation.wdkit.view.DefaultView;
import com.wd.foundation.bean.custom.MenuBean;
... ... @@ -324,76 +329,60 @@ public class ItemNewsHomeMenuTopLayoutManager extends ItemContainerManager<Simpl
* 点击事件监听
*/
private void setClickListen(View itemView) {
// ViewUtils.findViewById(itemView, R.id.ivCenter).setOnClickListener(new BaseClickListener() {
// @Override
// protected void onNoDoubleClick(View v) {
// ProcessUtils.goToPaperActivity();
// }
// });
// //跳转到播报频道 pageId:21003, channelId:2066, 名称:播报
// ViewUtils.findViewById(itemView, R.id.llToMusicChannel).setOnClickListener(new BaseClickListener() {
// @Override
// protected void onNoDoubleClick(View v) {
// ChannelBean channelBean = new ChannelBean();
// channelBean.setChannelId(ProcessUtils.CHANNEL_ID_VOICE);
// channelBean.setPageId(ProcessUtils.PAGE_ID_VOICE);
// channelBean.setName("播报");
// ProcessUtils.specialChannelJumpPage(channelBean);
// }
// });
// ViewUtils.findViewById(itemView, R.id.llDialyNews).setOnClickListener(new BaseClickListener() {
// @Override
// protected void onNoDoubleClick(View v) {
IProcess process = ArouterServiceManager.provide(InterfaceConstant.PATH_COMP_PROCESS);
if (process == null) {
Logger.t(TAG).e("setClickListen, IProcess has not impl");
}
ViewUtils.findViewById(itemView, R.id.ivCenter).setOnClickListener(new BaseClickListener() {
@Override
protected void onNoDoubleClick(View v) {
process.goToPaperActivity();
}
});
//跳转到播报频道 pageId:21003, channelId:2066, 名称:播报
ViewUtils.findViewById(itemView, R.id.llToMusicChannel).setOnClickListener(new BaseClickListener() {
@Override
protected void onNoDoubleClick(View v) {
ChannelBean channelBean = new ChannelBean();
channelBean.setChannelId(ProcessConstant.CHANNEL_ID_VOICE);
channelBean.setPageId(ProcessConstant.PAGE_ID_VOICE);
channelBean.setName("播报");
process.specialChannelJumpPage(channelBean);
}
});
ViewUtils.findViewById(itemView, R.id.llDialyNews).setOnClickListener(new BaseClickListener() {
@Override
protected void onNoDoubleClick(View v) {
// GeneralTrack.getInstance().E_MEN_CLICK(bottomMenuBean.getTitle(), bottomMenuBean.getNavId());
// llRight.setClickable(false);
// CommonNetUtils.getInstance().getDailyPaperId(new ResultCallback<PageBean>() {
// @Override
// public void onSuccess(PageBean pageBean) {
// if (pageBean != null) {
// ContentBean bean = new ContentBean();
// bean.setObjectLevel(String.valueOf(ContentTypeConstant.SUBJECT_TOPICTYPE_25));
// bean.setPageId(pageBean.getId());
// bean.setNewsTitle(pageBean.getName());
// ProcessUtils.goToCommonSubjectPage(bean);
//
// } else {
// ToastNightUtil.showShort("暂无数据");
// }
// llRight.setClickable(true);
// }
//
// @Override
// public void onError(String errorCode) {
// llRight.setClickable(true);
// }
// });
// }
// });
//
// llLeft.setOnClickListener(new BaseClickListener() {
// @Override
// protected void onNoDoubleClick(View v) {
// int marqueePosition = -1;
// if (searchHotWordList != null && searchHotWordList.size() > 0 && mMarqueeView != null) {
// marqueePosition = mMarqueeView.getPosition();
// }
// ProcessUtils.toSearchActivity(marqueePosition, bottomMenuBean.getTitle());
//
llRight.setClickable(false);
process.goToCommonSubjectPage(llRight);
}
});
llLeft.setOnClickListener(new BaseClickListener() {
@Override
protected void onNoDoubleClick(View v) {
int marqueePosition = -1;
if (searchHotWordList != null && searchHotWordList.size() > 0 && mMarqueeView != null) {
marqueePosition = mMarqueeView.getPosition();
}
process.toSearchActivity(marqueePosition, bottomMenuBean.getTitle());
// CommonTrack.getInstance().clickSearchButton(bottomMenuBean.getTitle(), bottomMenuBean.getNavId());
// }
// });
// mMarqueeView.setOnItemClickListener(new MarqueeView.OnItemClickListener() {
// @Override
// public void onItemClick(int position, TextView textView) {
// if (searchHotWordList != null) {
// ProcessUtils.toSearchActivity(position, bottomMenuBean.getTitle());
// } else {
// ProcessUtils.toSearchActivity(-1, bottomMenuBean.getTitle());
// }
//
}
});
mMarqueeView.setOnItemClickListener(new MarqueeView.OnItemClickListener() {
@Override
public void onItemClick(int position, TextView textView) {
if (searchHotWordList != null) {
process.toSearchActivity(position, bottomMenuBean.getTitle());
} else {
process.toSearchActivity(-1, bottomMenuBean.getTitle());
}
// CommonTrack.getInstance().clickSearchButton(bottomMenuBean.getTitle(), bottomMenuBean.getNavId());
// }
// });
}
});
}
/**
... ... @@ -428,27 +417,13 @@ public class ItemNewsHomeMenuTopLayoutManager extends ItemContainerManager<Simpl
imgSearchManage.setOnClickListener(new BaseClickListener() {
@Override
protected void onNoDoubleClick(View v) {
/*
处理辅助频道
*/
// Fragment fragment = getFragment();
// if (fragment != null && fragment instanceof NewsHomeFragment) {
// NewsHomeFragment newsHomeFragment = (NewsHomeFragment) fragment;
// // 辅助频道数据
// List<ChannelBean> tempAddList = newsHomeFragment.getTempAddList();
// if (tempAddList != null && tempAddList.size() > 0) {
// ProcessUtils.tempAddList = tempAddList;
// // 完成编辑后清理辅助频道数据
// newsHomeFragment.setTempAddList(null);
// } else {
// ProcessUtils.tempAddList = null;
// }
// } else {
// ProcessUtils.tempAddList = null;
// }
//
// String tabId = mTabBean.getTabChannleId();
// ProcessUtils.goToNavBarActivity(tabId);
IProcess process = ArouterServiceManager.provide(InterfaceConstant.PATH_COMP_PROCESS);
if (process == null) {
Logger.t(TAG).e("imgSearchManage OnClickListener, IProcess has not impl");
}
String tabId = mTabBean.getTabChannleId();
Fragment fragment = getFragment();
process.goToNavBarActivity(fragment, tabId);
}
});
... ... @@ -560,13 +535,13 @@ public class ItemNewsHomeMenuTopLayoutManager extends ItemContainerManager<Simpl
private void loadMorningAndNightData() {
//不用请求
String paperTodayMd5 = SpUtils.getPaperTodayMd5();
if (StringUtils.isNotBlank(paperTodayMd5)){
if (StringUtils.isNotBlank(paperTodayMd5)) {
String[] split = paperTodayMd5.split("_");
if (split != null){
if (split != null) {
String date = split[0];
String currentDate = TimeUtil.getCurrentDate();
String pagePic = split[2];
if (date.equals(currentDate)){
if (date.equals(currentDate)) {
//预加载缓存下第一页图片
ImageUtils.getInstance().preloadImage(getFragment().getContext(), pagePic);
return;
... ... @@ -586,7 +561,7 @@ public class ItemNewsHomeMenuTopLayoutManager extends ItemContainerManager<Simpl
double paperCanvasWidth = maxWidth - UiUtils.dp2px(26);
double paperCanvasHeight = paperCanvasWidth * unproprotion;
String xy = paperCanvasWidth + "x" + paperCanvasHeight;
if(getFragment() == null || getFragment().isDetached()){
if (getFragment() == null || getFragment().isDetached()) {
//Fragment如果Detached就不往下执行了,否则一样异常
return;
}
... ... @@ -614,7 +589,7 @@ public class ItemNewsHomeMenuTopLayoutManager extends ItemContainerManager<Simpl
}
});
}
paperPageModel.requestPaperList(null, true,true);
paperPageModel.requestPaperList(null, true, true);
}
... ... @@ -1004,18 +979,18 @@ public class ItemNewsHomeMenuTopLayoutManager extends ItemContainerManager<Simpl
}
// 顶部左右文字和icon颜色
String color = bottomMenuBean.getSearchBothColor();
if(StringUtils.isEmpty(color)){
if (StringUtils.isEmpty(color)) {
color = THEME_IMAGE_TXT_COLOR;
}
ivIconLeft.setColorFilter(Color.parseColor(addAlphaColorForPercent(color,128)),PorterDuff.Mode.SRC_IN);
ivIconLeft.setColorFilter(Color.parseColor(addAlphaColorForPercent(color, 128)), PorterDuff.Mode.SRC_IN);
// ivIconLeft.setImageAlpha(128);
ivRightIcon.setColorFilter(Color.parseColor(addAlphaColorForPercent(color,128)),PorterDuff.Mode.SRC_IN);
ivRightIcon.setColorFilter(Color.parseColor(addAlphaColorForPercent(color, 128)), PorterDuff.Mode.SRC_IN);
// ivRightIcon.setImageAlpha(128);
ivToMusicChannel.setColorFilter(Color.parseColor(addAlphaColorForPercent(color,128)),PorterDuff.Mode.SRC_IN);
ivToMusicChannel.setColorFilter(Color.parseColor(addAlphaColorForPercent(color, 128)), PorterDuff.Mode.SRC_IN);
// ivToMusicChannel.setImageAlpha(128);
vLineMusicChannel.setBackgroundColor(Color.parseColor(addAlphaColorForPercent(color,51)));
mMarqueeView.setTextColor(Color.parseColor(addAlphaColorForPercent(color,128)));
tvRight.setTextColor(Color.parseColor(addAlphaColorForPercent(color,128)));
vLineMusicChannel.setBackgroundColor(Color.parseColor(addAlphaColorForPercent(color, 51)));
mMarqueeView.setTextColor(Color.parseColor(addAlphaColorForPercent(color, 128)));
tvRight.setTextColor(Color.parseColor(addAlphaColorForPercent(color, 128)));
// 搜索背景框url
String searchUrl = bottomMenuBean.getSearchUrl();
... ... @@ -1034,7 +1009,7 @@ public class ItemNewsHomeMenuTopLayoutManager extends ItemContainerManager<Simpl
channelMoreColor = THEME_MENU_MORE_COLOR;
}
// imgSearchManage.setImageAlpha(128);
imgSearchManage.setColorFilter(Color.parseColor(addAlphaColorForPercent(channelMoreColor,128)),PorterDuff.Mode.SRC_IN);
imgSearchManage.setColorFilter(Color.parseColor(addAlphaColorForPercent(channelMoreColor, 128)), PorterDuff.Mode.SRC_IN);
//顶部频道导航栏颜色
... ... @@ -1042,7 +1017,7 @@ public class ItemNewsHomeMenuTopLayoutManager extends ItemContainerManager<Simpl
TITLE_TEXT_SELECTED_COLOR = bottomMenuBean.getChannelChooseColor();
}
if (!TextUtils.isEmpty(bottomMenuBean.getChannelChooseCColor())) {
TITLE_TEXT_UNSELECTED_COLOR = addAlphaColorForPercent(bottomMenuBean.getChannelChooseCColor(),128);
TITLE_TEXT_UNSELECTED_COLOR = addAlphaColorForPercent(bottomMenuBean.getChannelChooseCColor(), 128);
}
// 下划线
if (!TextUtils.isEmpty(bottomMenuBean.getChannelChooseActionUrl())) {
... ... @@ -1400,12 +1375,12 @@ public class ItemNewsHomeMenuTopLayoutManager extends ItemContainerManager<Simpl
/**
* 更新频道策略
*/
private void updateChannelStrategy(){
if(mTabBean == null){
private void updateChannelStrategy() {
if (mTabBean == null) {
return;
}
List<ChannelBean> topNavChannelList = mTabBean.getTopNavChannelList();
if(ArrayUtils.isEmpty(topNavChannelList)){
if (ArrayUtils.isEmpty(topNavChannelList)) {
return;
}
int size = topNavChannelList.size();
... ... @@ -1423,24 +1398,25 @@ public class ItemNewsHomeMenuTopLayoutManager extends ItemContainerManager<Simpl
/**
* 为色值添加透明度
*
* @param color
* @param percent
* @return
*/
private String addAlphaColorForPercent(String color,int percent){
if (!color.startsWith("#") || color.length() != 7){
private String addAlphaColorForPercent(String color, int percent) {
if (!color.startsWith("#") || color.length() != 7) {
return color;
}
String str = "#"+Integer.toHexString(percent);
return color.replace("#",str);
String str = "#" + Integer.toHexString(percent);
return color.replace("#", str);
}
/**
* 设置夜间模式颜色
*/
private void setNightModeColor(Context context){
private void setNightModeColor(Context context) {
//文字选中颜色 "#222222"
if (SpUtils.isNightMode()){
if (SpUtils.isNightMode()) {
TITLE_TEXT_SELECTED_COLOR = "#DDDDDD";
//文字未选中颜色 "#999999"
TITLE_TEXT_UNSELECTED_COLOR = "#80DDDDDD";
... ...