Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fastcoding
/
wdlayout
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
zhangbo
2024-10-23 10:39:10 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
33f6fe4811a3ba7c5c2f97887de29761cd1e23ec
33f6fe48
1 parent
fded162a
提交部分修改;编译报错,待调试
Hide whitespace changes
Inline
Side-by-side
Showing
33 changed files
with
735 additions
and
647 deletions
wdlayout/build.gradle
wdlayout/src/main/java/com/wd/capability/layout/comp/CompServiceImpl.java
wdlayout/src/main/java/com/wd/capability/layout/comp/ICompService.java
wdlayout/src/main/java/com/wd/capability/layout/comp/layoutmanager/BaseAdapter.java
wdlayout/src/main/java/com/wd/capability/layout/comp/layoutmanager/ILayoutManagerScrollListener.java
wdlayout/src/main/java/com/wd/capability/layout/comp/layoutmanager/ILayoutRender.java
wdlayout/src/main/java/com/wd/capability/layout/comp/layoutmanager/Indexer.java
wdlayout/src/main/java/com/wd/capability/layout/comp/layoutmanager/ItemContainerManager.java
wdlayout/src/main/java/com/wd/capability/layout/comp/layoutmanager/ItemLayoutManager.java
wdlayout/src/main/java/com/wd/capability/layout/comp/layoutmanager/ItemSpecialManager.java
wdlayout/src/main/java/com/wd/capability/layout/comp/layoutmanager/LayoutAdapter.java
wdlayout/src/main/java/com/wd/capability/layout/comp/layoutmanager/channel/BaseLineLayoutManager.java
wdlayout/src/main/java/com/wd/capability/layout/comp/layoutmanager/channel/CompActivity01.java
wdlayout/src/main/java/com/wd/capability/layout/comp/layoutmanager/channel/CompAdvGuanMI.java
wdlayout/src/main/java/com/wd/capability/layout/comp/layoutmanager/channel/CompAdvLongImageLan.java
wdlayout/src/main/java/com/wd/capability/layout/comp/layoutmanager/channel/CompAdvVideoEx.java
wdlayout/src/main/java/com/wd/capability/layout/comp/layoutmanager/channel/CompAllResultPeoplesAccount.java
wdlayout/src/main/java/com/wd/capability/layout/comp/layoutmanager/control/CompPlayController.java
wdlayout/src/main/java/com/wd/capability/layout/comp/page/ItemMenuTopLayoutManager.java
wdlayout/src/main/java/com/wd/capability/layout/ui/channel/listener/PageInforToLayoutManagerCallback.java
wdlayout/src/main/java/com/wd/capability/layout/ui/channel/model/ChannelDataFetcherNews.java
wdlayout/src/main/java/com/wd/capability/layout/ui/channel/vm/ChannelViewModel.java
wdlayout/src/main/java/com/wd/capability/layout/ui/channel/vm/IChannelDataListener.java
wdlayout/src/main/java/com/wd/capability/layout/ui/channel/vm/INavChannelDataListener.java
wdlayout/src/main/java/com/wd/capability/layout/ui/channel/vm/IPageInforDataListener.java
wdlayout/src/main/java/com/wd/capability/layout/ui/fragment/CommonFragment.java
wdlayout/src/main/java/com/wd/capability/layout/ui/fragment/MainFragment.java
wdlayout/src/main/java/com/wd/capability/layout/ui/fragment/NewsHomeFragment.java
wdlayout/src/main/java/com/wd/capability/layout/ui/fragment/TemplateMainFragment.java
wdlayout/src/main/java/com/wd/foundation/wdkit/datafetcher/BaseDataFetcher.java
wdlayout/src/main/java/com/wd/foundation/wdkit/datafetcher/IDataFetcher.java
wdlayout/src/main/java/com/wd/foundation/wdkit/datafetcher/IRequestApi.java
wdlayout/src/main/res/layout/wdlayout_item_layout_placeholder.xml
wdlayout/build.gradle
View file @
33f6fe4
...
...
@@ -44,6 +44,23 @@ android {
dependencies
{
implementation
'com.wd:wdkit:1.0.2'
implementation
'com.wd:wdbean:1.0.0'
implementation
'com.wd:router:1.0.0'
implementation
'com.wd:wdnetwork:1.0.0'
implementation
'androidx.recyclerview:recyclerview:1.2.1'
implementation
'androidx.viewpager2:viewpager2:1.0.0'
implementation
'com.github.hackware1993:MagicIndicator:1.7.0'
// 基础依赖库
api
'com.alibaba:arouter-api:1.5.2'
api
'com.squareup.okhttp3:okhttp:4.8.0'
api
'com.squareup.retrofit2:retrofit:2.9.0'
api
'com.squareup.retrofit2:converter-gson:2.9.0'
api
'com.squareup.retrofit2:adapter-rxjava2:2.9.0'
//rxjava
api
'io.reactivex.rxjava2:rxjava:2.2.8'
api
'io.reactivex.rxjava2:rxandroid:2.1.0'
//解析bean
api
'com.alibaba:fastjson:1.2.62'
api
'com.airbnb.android:lottie:5.2.0'
}
uploadArchives
{
...
...
wdlayout/src/main/java/com/wd/capability/layout/comp/CompServiceImpl.java
View file @
33f6fe4
...
...
@@ -4,23 +4,12 @@
package
com
.
wd
.
capability
.
layout
.
comp
;
import
static
com
.
people
.
common
.
constant
.
IntentConstants
.
PAGE_BACKGROUND_URL
;
import
static
com
.
people
.
common
.
constant
.
IntentConstants
.
PAGE_HOME_COLOR
;
import
static
com
.
people
.
common
.
constant
.
IntentConstants
.
PAGE_NOTICE_COLOR
;
import
static
com
.
people
.
common
.
constant
.
IntentConstants
.
PAGE_STATUS_COLOR
;
import
static
com
.
people
.
common
.
constant
.
IntentConstants
.
PARAM_PAGE_ID
;
import
static
com
.
people
.
common
.
constant
.
IntentConstants
.
TAB_NEWS_TITLE
;
import
android.os.Bundle
;
import
androidx.fragment.app.Fragment
;
import
com.people.common.constant.IntentConstants
;
import
com.people.entity.custom.video.VodDetailIntentBean
;
import
com.people.router.WdRouterRule
;
import
com.people.router.constants.RouterConstants
;
import
com.wondertek.wheat.ability.tools.JsonUtils
;
import
com.wd.foundation.bean.custom.video.VodDetailIntentBean
;
import
com.wd.foundation.wdkitcore.tools.JsonUtils
;
/**
* comp组件的相关Service实现<BR>
...
...
@@ -31,7 +20,6 @@ import com.wondertek.wheat.ability.tools.JsonUtils;
*/
public
class
CompServiceImpl
implements
ICompService
{
@Override
public
Fragment
createMainFragment
(
String
id
)
{
return
null
;
...
...
@@ -66,7 +54,6 @@ public class CompServiceImpl implements ICompService {
return
new
Fragment
();
}
@Override
public
Fragment
createDefaultFragment
()
{
// 这里默认直接创建Fragment
...
...
@@ -80,14 +67,15 @@ public class CompServiceImpl implements ICompService {
@Override
public
Fragment
createCommonFragment
(
String
pageId
)
{
//return CommonFragment.newInstance(pageId);
//
return CommonFragment.newInstance(pageId);
return
null
;
}
@Override
public
Fragment
createMiFragment
(
String
pageId
,
String
pageName
,
int
statuesBar
,
String
backgroundUrl
,
String
homeColor
,
String
noticeColor
)
{
public
Fragment
createMiFragment
(
String
pageId
,
String
pageName
,
int
statuesBar
,
String
backgroundUrl
,
String
homeColor
,
String
noticeColor
)
{
Fragment
myFragment
=
(
Fragment
)
WdRouterRule
.
getInstance
().
getFragment
(
RouterConstants
.
PATH_MODULE_MY_FRAGMENT
);
(
Fragment
)
WdRouterRule
.
getInstance
().
getFragment
(
RouterConstants
.
PATH_MODULE_MY_FRAGMENT
);
Bundle
bundle
=
new
Bundle
();
if
(
myFragment
!=
null
)
{
bundle
.
putString
(
PARAM_PAGE_ID
,
pageId
);
...
...
wdlayout/src/main/java/com/wd/capability/layout/comp/ICompService.java
View file @
33f6fe4
...
...
@@ -6,7 +6,7 @@ package com.wd.capability.layout.comp;
import
androidx.fragment.app.Fragment
;
import
com.w
ondertek.wheat.ability
.scheduler.IService
;
import
com.w
d.foundation.wdkitcore
.scheduler.IService
;
/**
* comp服务的相关接口<BR>
...
...
@@ -52,7 +52,6 @@ public interface ICompService extends IService {
*/
Fragment
createLiveChannelFragment
(
boolean
isGray
,
String
level1ChannelId
,
String
pageId
,
String
channelId
);
/**
* 创建默认Fragment
*
...
...
@@ -62,28 +61,33 @@ public interface ICompService extends IService {
/**
* 创建关注Fragment
* @param pageId 页面id
*
* @param pageId 页面id
* @return
*/
Fragment
createFollowFragment
(
String
pageId
);
/**
* 创建通用Fragment
*
* @param pageId
* @return
*/
Fragment
createCommonFragment
(
String
pageId
);
/**
* 创建 我的 Fragment
* 创建 我的 Fragment
*
* @param pageId
* @return
*/
Fragment
createMiFragment
(
String
pageId
,
String
pageName
,
int
statuesBar
,
String
backgroundUrl
,
String
homeColor
,
String
noticeColor
);
Fragment
createMiFragment
(
String
pageId
,
String
pageName
,
int
statuesBar
,
String
backgroundUrl
,
String
homeColor
,
String
noticeColor
);
/**
* 创建短视频Fragment
* @param pageId 页面id
* 创建短视频Fragment
*
* @param pageId 页面id
*/
Fragment
createShortVideoFragment
(
String
pageId
,
int
color
);
Fragment
createShortVideoFragment
(
String
pageId
,
int
color
);
}
...
...
wdlayout/src/main/java/com/wd/capability/layout/comp/layoutmanager/BaseAdapter.java
View file @
33f6fe4
...
...
@@ -15,8 +15,9 @@ import android.view.ViewGroup;
import
androidx.annotation.NonNull
;
import
androidx.recyclerview.widget.RecyclerView
;
import
com.people.component.R
;
import
com.people.entity.custom.item.ItemBean
;
import
com.wd.capability.layout.R
;
import
com.wd.foundation.bean.custom.item.ItemBean
;
public
abstract
class
BaseAdapter
extends
RecyclerView
.
Adapter
<
RecyclerView
.
ViewHolder
>
{
...
...
@@ -35,7 +36,7 @@ public abstract class BaseAdapter extends RecyclerView.Adapter<RecyclerView.View
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
R
.
layout
.
rmrb
_item_layout_placeholder
;
return
R
.
layout
.
wdlayout
_item_layout_placeholder
;
}
/**
...
...
wdlayout/src/main/java/com/wd/capability/layout/comp/layoutmanager/ILayoutManagerScrollListener.java
View file @
33f6fe4
package
com
.
wd
.
capability
.
layout
.
comp
.
layoutmanager
;
import
android.view.View
;
/**
* 楼层内组件滑动监听 如内部嵌套的推荐位滑动
*/
...
...
wdlayout/src/main/java/com/wd/capability/layout/comp/layoutmanager/ILayoutRender.java
View file @
33f6fe4
...
...
@@ -9,9 +9,9 @@ import java.util.List;
import
androidx.annotation.NonNull
;
import
com.people.component.comp.layoutdata.AbsPage
;
import
com.people.component.comp.layoutdata.AbsSection
;
import
com.people.component.comp.layoutdata.Page
;
import
com.wd.capability.layout.comp.layoutdata.AbsPage
;
import
com.wd.capability.layout.comp.layoutdata.AbsSection
;
import
com.wd.capability.layout.comp.layoutdata.Page
;
/**
* Page 布局渲染器, 将comp渲染到页面上
...
...
@@ -28,13 +28,15 @@ public interface ILayoutRender {
void
itemRangeRemoved
(
int
startIndex
,
int
count
);
/**
* 移除置指定的item
* 移除置指定的item
*
* @param positon
*/
void
itemRemoved
(
int
positon
);
/**
* 依据LayoutManager的 HashCode值删除对应的LayoutManager
*
* @param hashCode
*/
void
itemRemovedByLayoutManagerHashCode
(
int
hashCode
);
...
...
@@ -67,7 +69,7 @@ public interface ILayoutRender {
*
* @param page Page实例
*/
void
renderPage
(
AbsPage
page
,
boolean
isRefresh
);
void
renderPage
(
AbsPage
page
,
boolean
isRefresh
);
// /**
// * 渲染overlay浮层
...
...
wdlayout/src/main/java/com/wd/capability/layout/comp/layoutmanager/Indexer.java
View file @
33f6fe4
...
...
@@ -10,15 +10,16 @@ import java.util.List;
import
androidx.annotation.NonNull
;
import
com.orhanobut.logger.Logger
;
import
com.people.component.comp.layoutdata.AbsGroup
;
import
com.people.component.comp.layoutdata.AbsPage
;
import
com.people.component.comp.layoutdata.AbsSection
;
import
com.people.component.comp.layoutdata.channel.BaseLineSection
;
import
com.people.component.comp.layoutmanager.channel.BaseLineLayoutManager
;
import
com.people.entity.custom.BaseLineBean
;
import
com.people.entity.custom.item.ItemBean
;
import
com.wondertek.wheat.ability.tools.ArrayUtils
;
import
com.wd.base.log.Logger
;
import
com.wd.capability.layout.comp.layoutdata.AbsGroup
;
import
com.wd.capability.layout.comp.layoutdata.AbsPage
;
import
com.wd.capability.layout.comp.layoutdata.AbsSection
;
import
com.wd.capability.layout.comp.layoutdata.channel.BaseLineSection
;
import
com.wd.capability.layout.comp.layoutmanager.channel.BaseLineLayoutManager
;
import
com.wd.foundation.bean.custom.BaseLineBean
;
import
com.wd.foundation.bean.custom.item.ItemBean
;
import
com.wd.foundation.wdkitcore.tools.ArrayUtils
;
/**
*
...
...
wdlayout/src/main/java/com/wd/capability/layout/comp/layoutmanager/ItemContainerManager.java
View file @
33f6fe4
...
...
@@ -5,8 +5,7 @@
package
com
.
wd
.
capability
.
layout
.
comp
.
layoutmanager
;
import
com.people.entity.custom.item.ItemBean
;
import
com.wd.foundation.bean.custom.item.ItemBean
;
public
abstract
class
ItemContainerManager
<
T
extends
ItemBean
>
extends
ItemLayoutManager
<
T
>
{
...
...
wdlayout/src/main/java/com/wd/capability/layout/comp/layoutmanager/ItemLayoutManager.java
View file @
33f6fe4
...
...
@@ -20,37 +20,19 @@ import androidx.core.content.ContextCompat;
import
androidx.fragment.app.Fragment
;
import
androidx.fragment.app.FragmentActivity
;
import
com.people.common.CommonNetUtils
;
import
com.people.common.ProcessUtils
;
import
com.people.common.analytics.CommonTrack
;
import
com.people.common.analytics.constants.PageNameConstants
;
import
com.people.common.constant.Constants
;
import
com.people.common.interact.like.model.UserLikeFetcher
;
import
com.people.common.listener.OnCollectCheckedChangeListener
;
import
com.people.common.util.GrayManager
;
import
com.people.common.util.PDUtils
;
import
com.people.common.viewclick.OnMoreClickListener
;
import
com.people.common.widget.AnimationView
;
import
com.people.component.R
;
import
com.people.component.comp.layoutdata.AbsSection
;
import
com.people.component.comp.layoutmanager.adapter.CompCommonListAdapter
;
import
com.people.component.utils.CompentLogicUtil
;
import
com.people.daily.lib_library.CommonUtil
;
import
com.people.entity.analytics.TrackContentBean
;
import
com.people.entity.custom.comp.CompBean
;
import
com.people.entity.custom.comp.ContainerItemBean
;
import
com.people.entity.custom.content.ContentBean
;
import
com.people.entity.custom.content.PeopleMasterBean
;
import
com.people.entity.custom.item.ItemBean
;
import
com.people.room.MailBookingLiveHelper
;
import
com.people.room.MailMessageHelper
;
import
com.people.toolset.SpUtils
;
import
com.people.toolset.string.StrUtils
;
import
com.view.text.view.TagTextView
;
import
com.wondertek.wheat.ability.thread.ThreadPoolUtils
;
import
com.wondertek.wheat.ability.tools.AppContext
;
import
com.wondertek.wheat.ability.tools.StringUtils
;
import
com.wd.capability.layout.R
;
import
com.wd.capability.layout.comp.layoutdata.AbsSection
;
import
com.wd.capability.layout.comp.layoutmanager.adapter.CompCommonListAdapter
;
import
com.wd.foundation.bean.analytics.TrackContentBean
;
import
com.wd.foundation.bean.custom.comp.CompBean
;
import
com.wd.foundation.bean.custom.comp.ContainerItemBean
;
import
com.wd.foundation.bean.custom.content.ContentBean
;
import
com.wd.foundation.bean.custom.content.PeopleMasterBean
;
import
com.wd.foundation.bean.custom.item.ItemBean
;
import
com.wd.foundation.wdkitcore.thread.ThreadPoolUtils
;
import
com.wd.foundation.wdkitcore.tools.AppContext
;
import
com.wd.foundation.wdkitcore.tools.SpUtils
;
import
com.wd.foundation.wdkitcore.tools.StringUtils
;
public
abstract
class
ItemLayoutManager
<
T
extends
ItemBean
>
{
...
...
@@ -79,7 +61,6 @@ public abstract class ItemLayoutManager<T extends ItemBean> {
*/
private
String
likeStatus
=
"0"
;
// 组件内每页最大数量
protected
final
int
maxCount
=
20
;
...
...
@@ -100,7 +81,6 @@ public abstract class ItemLayoutManager<T extends ItemBean> {
*/
public
abstract
int
getItemSpan
();
public
void
setSection
(
AbsSection
section
)
{
this
.
section
=
section
;
}
...
...
@@ -109,7 +89,6 @@ public abstract class ItemLayoutManager<T extends ItemBean> {
return
section
;
}
public
void
setItemIndex
(
ItemIndex
itemIndex
)
{
this
.
index
=
itemIndex
;
}
...
...
@@ -137,7 +116,7 @@ public abstract class ItemLayoutManager<T extends ItemBean> {
/**
* 设置标题
*
* @param title
标题内容
* @param title 标题内容
* @param tv_title 标题View
*/
protected
void
setTittleValue
(
String
title
,
TextView
tv_title
,
String
keyWords
)
{
...
...
@@ -151,14 +130,14 @@ public abstract class ItemLayoutManager<T extends ItemBean> {
int
keyWordsLength
=
keyWords
.
length
();
for
(
int
i
=
0
;
i
<
title
.
length
();
i
++)
{
if
(
title
.
regionMatches
(
true
,
i
,
keyWords
,
0
,
keyWordsLength
))
{
result
.
setSpan
(
new
ForegroundColorSpan
(
ContextCompat
.
getColor
(
tv_title
.
getContext
(),
R
.
color
.
color_B71D26
)),
i
,
i
+
keyWordsLength
,
SpannableStringBuilder
.
SPAN_INCLUSIVE_INCLUSIVE
);
result
.
setSpan
(
new
ForegroundColorSpan
(
ContextCompat
.
getColor
(
tv_title
.
getContext
(),
R
.
color
.
color_B71D26
)),
i
,
i
+
keyWordsLength
,
SpannableStringBuilder
.
SPAN_INCLUSIVE_INCLUSIVE
);
}
}
tv_title
.
setText
(
result
);
}
/**
* 装载数据
*
...
...
@@ -196,7 +175,6 @@ public abstract class ItemLayoutManager<T extends ItemBean> {
public
void
onInvisible
()
{
}
public
void
onCreateViewHolder
(
BaseAdapter
adapter
,
View
itemView
)
{
}
...
...
@@ -243,26 +221,25 @@ public abstract class ItemLayoutManager<T extends ItemBean> {
}
if
(
isPersonalHomePage
(
bean
,
position
,
ivMore
))
{
//号主页 统一隐藏关注按钮
//
号主页 统一隐藏关注按钮
attentionLay
.
setVisibility
(
View
.
GONE
);
}
else
{
//非号主页 统一隐藏更多按钮
//
非号主页 统一隐藏更多按钮
ivMore
.
setVisibility
(
View
.
GONE
);
}
}
/**
* 是否是号主页
*/
private
boolean
isPersonalHomePage
(
ContentBean
bean
,
int
position
,
ImageView
ivMore
)
{
String
fromPage
=
StrUtils
.
getStringValue
(
bean
.
getFromPage
());
if
(
PageNameConstants
.
MAIN_PERSONAL_HOME_PAGE
.
equals
(
fromPage
))
{
//主态号主页
//
主态号主页
if
(
bean
.
isShowMoreButton
())
{
bean
.
position
=
position
;
ivMore
.
setVisibility
(
View
.
VISIBLE
);
//扩大View的触摸和点击响应范围
//
扩大View的触摸和点击响应范围
CommonUtil
.
expandViewTouchDelegate
(
ivMore
,
50
);
ivMore
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
...
...
@@ -275,7 +252,7 @@ public abstract class ItemLayoutManager<T extends ItemBean> {
}
return
true
;
}
else
if
(
PageNameConstants
.
CUSTOMER_PERSONAL_HOME_PAGE
.
equals
(
fromPage
))
{
//客态号主页
//
客态号主页
ivMore
.
setVisibility
(
View
.
GONE
);
return
true
;
}
...
...
@@ -291,7 +268,8 @@ public abstract class ItemLayoutManager<T extends ItemBean> {
public
boolean
isCollectPage
(
ContentBean
contentBean
)
{
if
(
contentBean
!=
null
)
{
String
fromPage
=
StrUtils
.
getStringValue
(
contentBean
.
getFromPage
());
if
(
PageNameConstants
.
MY_COLLECT_PAGE
.
equals
(
fromPage
)
||
PageNameConstants
.
MY_HISTORY_PAGE
.
equals
(
fromPage
))
{
if
(
PageNameConstants
.
MY_COLLECT_PAGE
.
equals
(
fromPage
)
||
PageNameConstants
.
MY_HISTORY_PAGE
.
equals
(
fromPage
))
{
return
true
;
}
}
...
...
@@ -302,11 +280,11 @@ public abstract class ItemLayoutManager<T extends ItemBean> {
* 更新已读状态
*/
public
void
updateReadState
(
TextView
tvTitle
,
ContainerItemBean
data
)
{
//未读
//
未读
if
(
"2"
.
equals
(
data
.
getLocalFiledReadState
()))
{
data
.
setLocalFiledReadState
(
"1"
);
if
(
tvTitle
!=
null
)
{
//设置已读、更新已读状态
//
设置已读、更新已读状态
tvTitle
.
setTextColor
(
ContextCompat
.
getColor
(
tvTitle
.
getContext
(),
R
.
color
.
res_color_common_C3
));
}
ThreadPoolUtils
.
submit
(
new
Runnable
()
{
...
...
@@ -320,14 +298,15 @@ public abstract class ItemLayoutManager<T extends ItemBean> {
public
void
updateReadState
(
ContainerItemBean
data
)
{
if
(
"0"
.
equals
(
data
.
getLocalFiledType
()))
{
//0站内信-预约直播类型
//
0站内信-预约直播类型
String
userId
=
SpUtils
.
getUserId
();
if
(
TextUtils
.
isEmpty
(
userId
))
{
return
;
}
MailBookingLiveHelper
.
getInstance
(
AppContext
.
getContext
()).
updateReadStateByKey
(
data
.
getLocalFiledIdType
(),
userId
);
MailBookingLiveHelper
.
getInstance
(
AppContext
.
getContext
())
.
updateReadStateByKey
(
data
.
getLocalFiledIdType
(),
userId
);
}
else
if
(
"1"
.
equals
(
data
.
getLocalFiledType
()))
{
//1站内信-推送消息记录类型
//
1站内信-推送消息记录类型
MailMessageHelper
.
getInstance
(
AppContext
.
getContext
()).
updateReadStateByKey
(
data
.
getLocalFiledIdType
());
}
}
...
...
@@ -373,10 +352,10 @@ public abstract class ItemLayoutManager<T extends ItemBean> {
trackContentBean
.
exporeOrClick
(
isClick
);
if
(
isClick
)
{
if
(
"0"
.
equals
(
type
))
{
//站内信-预约直播列表子项点击
//
站内信-预约直播列表子项点击
CommonTrack
.
getInstance
().
liveSubscribeNoticeClickTrack
(
trackContentBean
);
}
else
if
(
"1"
.
equals
(
type
))
{
//站内信-推送消息列表子项点击
//
站内信-推送消息列表子项点击
CommonTrack
.
getInstance
().
followAuthorNoticeClickTrack
(
trackContentBean
);
}
else
{
CommonTrack
.
getInstance
().
contentClickTrack
(
trackContentBean
);
...
...
@@ -427,15 +406,14 @@ public abstract class ItemLayoutManager<T extends ItemBean> {
*/
private
void
trackCommentClickContent
(
ContentBean
contentBean
,
int
position
)
{
// 点击埋点
// TrackContentBean trackContentBean = new TrackContentBean();
// trackContentBean.contentBeantoBean(contentBean, section == null ? null : section.getCompBean());
// trackContentBean.commentAction();
// CommonTrack.getInstance().contentCommentTrack(trackContentBean);
// TrackContentBean trackContentBean = new TrackContentBean();
// trackContentBean.contentBeantoBean(contentBean, section == null ? null : section.getCompBean());
// trackContentBean.commentAction();
// CommonTrack.getInstance().contentCommentTrack(trackContentBean);
}
/**
* 检测是否要开启国殇View
&& section.getCompBean().isPageGrayFlag()
* 检测是否要开启国殇View && section.getCompBean().isPageGrayFlag()
*/
public
void
checkOpenGrayModel
(
View
view
,
int
index
)
{
...
...
@@ -446,7 +424,7 @@ public abstract class ItemLayoutManager<T extends ItemBean> {
itemView
=
view
;
}
if
(
itemView
!=
null
)
{
if
(
itemView
!=
null
)
{
if
(
GrayManager
.
getInstance
().
switchOpen
&&
index
<
8
&&
section
.
getCompBean
().
isPageGrayFlag
())
{
GrayManager
.
getInstance
().
setLayerGrayType
(
itemView
);
}
else
{
...
...
@@ -470,7 +448,6 @@ public abstract class ItemLayoutManager<T extends ItemBean> {
view
.
getLayoutParams
().
height
=
h
;
}
/**
* 初始化历史记录复选框
*/
...
...
@@ -542,7 +519,6 @@ public abstract class ItemLayoutManager<T extends ItemBean> {
boolean
followStatus
=
true
;
/**
* 查看是否关注
*/
...
...
@@ -557,7 +533,7 @@ public abstract class ItemLayoutManager<T extends ItemBean> {
// 默认显示关注入口
if
(
contentBean
.
isOpenFollowBt
())
{
//当用登录用户是人民号,且是自己发布的直播,不需要显示关注
//
当用登录用户是人民号,且是自己发布的直播,不需要显示关注
boolean
isMasterSelf
=
false
;
if
(
bean
!=
null
)
{
String
masUserId
=
bean
.
getUserId
();
...
...
@@ -581,8 +557,9 @@ public abstract class ItemLayoutManager<T extends ItemBean> {
if
(
section
!=
null
)
{
pageId
=
section
.
getCompBean
().
getCompInforPageId
();
}
CommonNetUtils
.
getInstance
().
operation
(
pageId
,
bean
.
getUserId
(),
bean
.
getUserType
(),
bean
.
getRmhId
(),
followStatus
?
0
:
1
);
CommonNetUtils
.
getInstance
()
.
operation
(
pageId
,
bean
.
getUserId
(),
bean
.
getUserType
(),
bean
.
getRmhId
(),
followStatus
?
0
:
1
);
trackFollowClickContent
(!
followStatus
,
contentBean
,
0
);
}
...
...
@@ -596,10 +573,8 @@ public abstract class ItemLayoutManager<T extends ItemBean> {
attentionLay
.
setVisibility
(
View
.
GONE
);
}
}
/**
* 处理用户关注状态
*
...
...
@@ -636,7 +611,6 @@ public abstract class ItemLayoutManager<T extends ItemBean> {
}
}
/**
* 人民号底部的评论点赞详情和点击事件
*
...
...
@@ -647,16 +621,16 @@ public abstract class ItemLayoutManager<T extends ItemBean> {
TextView
shareBtn
=
bottomView
.
findViewById
(
R
.
id
.
share_btn
);
TagTextView
commentLay
=
bottomView
.
findViewById
(
R
.
id
.
ttcomment_btn
);
LinearLayout
praiseLay
=
bottomView
.
findViewById
(
R
.
id
.
praise_lay
);
//
TextView
praiseBtnTv = bottomView.findViewById(R.id.praise_btn);
//
TextView
praiseBtnTv = bottomView.findViewById(R.id.praise_btn);
praiseBtn
=
bottomView
.
findViewById
(
R
.
id
.
praise_img
);
// 评论处理
// if (!TextUtils.isEmpty(contentBean.commentNum) && !"0".equals(contentBean.commentNum)) {
// commentBtn.setText(NumberStrUtils.Companion.getINSTANCE().handlerNumber(contentBean.commentNum));
// } else {
// commentBtn.setText(R.string.comp_bottom_comment_txt);
// }
//点赞数量
// if (!TextUtils.isEmpty(contentBean.commentNum) && !"0".equals(contentBean.commentNum)) {
// commentBtn.setText(NumberStrUtils.Companion.getINSTANCE().handlerNumber(contentBean.commentNum));
// } else {
// commentBtn.setText(R.string.comp_bottom_comment_txt);
// }
// 点赞数量
handlerLikeNum
();
// 点赞处理
if
(!
StringUtils
.
isEmpty
(
contentBean
.
getLikeStatus
()))
{
...
...
@@ -671,14 +645,14 @@ public abstract class ItemLayoutManager<T extends ItemBean> {
if
(
contentBean
.
getRmhInfo
()
==
null
)
{
return
;
}
//分享按钮控制
//
分享按钮控制
if
(
contentBean
.
getShareInfo
()
!=
null
&&
"1"
.
equals
(
contentBean
.
getShareInfo
().
getShareOpen
()))
{
shareBtn
.
setVisibility
(
View
.
VISIBLE
);
shareBtn
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
CompentLogicUtil
.
shareContent
(
contentBean
,
shareBtn
.
getContext
(),
section
==
null
?
null
:
section
.
getCompBean
(),
false
);
section
==
null
?
null
:
section
.
getCompBean
(),
false
);
}
});
}
else
{
...
...
@@ -718,7 +692,8 @@ public abstract class ItemLayoutManager<T extends ItemBean> {
}
if
(
shareBtn
.
getVisibility
()
==
View
.
GONE
&&
commentLay
.
getVisibility
()
==
View
.
GONE
&&
praiseLay
.
getVisibility
()
==
View
.
GONE
)
{
if
(
shareBtn
.
getVisibility
()
==
View
.
GONE
&&
commentLay
.
getVisibility
()
==
View
.
GONE
&&
praiseLay
.
getVisibility
()
==
View
.
GONE
)
{
RelativeLayout
.
LayoutParams
layoutParams1
=
(
RelativeLayout
.
LayoutParams
)
bottomView
.
getLayoutParams
();
layoutParams1
.
bottomMargin
=
0
;
bottomView
.
setLayoutParams
(
layoutParams1
);
...
...
@@ -728,10 +703,8 @@ public abstract class ItemLayoutManager<T extends ItemBean> {
bottomView
.
setLayoutParams
(
layoutParams1
);
}
}
/**
* 点赞、取消点赞
*
...
...
@@ -761,13 +734,14 @@ public abstract class ItemLayoutManager<T extends ItemBean> {
trackLikeClickContent
(
true
,
contentBean
,
position
);
}
dyHandlerLikeStatusView
();
//
ToastNightUtil.showShort(showTip);
//
ToastNightUtil.showShort(showTip);
// 发送点赞、取消点赞事件
UserLikeFetcher
fetcher
=
new
UserLikeFetcher
();
String
channelId
=
contentBean
.
getChannelInfoBean
()
!=
null
?
contentBean
.
getChannelInfoBean
().
getChannelId
()
:
""
;
String
channelId
=
contentBean
.
getChannelInfoBean
()
!=
null
?
contentBean
.
getChannelInfoBean
().
getChannelId
()
:
""
;
fetcher
.
contentExecuteLike
(
contentBean
.
getObjectId
(),
contentBean
.
getObjectType
(),
contentBean
.
getContentRelId
(),
String
.
valueOf
(
contentBean
.
getRelType
()),
likeStatus
,
contentBean
.
getNewsTitle
(),
channelId
);
contentBean
.
getContentRelId
(),
String
.
valueOf
(
contentBean
.
getRelType
()),
likeStatus
,
contentBean
.
getNewsTitle
(),
channelId
);
}
...
...
@@ -778,7 +752,7 @@ public abstract class ItemLayoutManager<T extends ItemBean> {
* @param imageView
*/
private
void
likeIcon
(
boolean
isCollect
,
AnimationView
imageView
)
{
if
(
imageView
!=
null
){
if
(
imageView
!=
null
)
{
imageView
.
setSelected
(
isCollect
);
}
}
...
...
@@ -855,7 +829,6 @@ public abstract class ItemLayoutManager<T extends ItemBean> {
*/
public
void
updateUserFollow
(
String
createId
,
boolean
followStatusFlag
)
{
if
(
contentBean
!=
null
&&
contentBean
.
getRmhInfo
()
!=
null
&&
!
TextUtils
.
isEmpty
(
createId
))
{
PeopleMasterBean
rmhInfo
=
contentBean
.
getRmhInfo
();
if
(
createId
.
equals
(
rmhInfo
.
getRmhId
()))
{
...
...
@@ -875,7 +848,7 @@ public abstract class ItemLayoutManager<T extends ItemBean> {
*
* @param contentId
* @param relId
* @param isZan
异步获取的点赞状态
* @param isZan 异步获取的点赞状态
*/
public
boolean
updateContentZan
(
String
contentId
,
String
relId
,
boolean
isZan
)
{
...
...
@@ -884,7 +857,7 @@ public abstract class ItemLayoutManager<T extends ItemBean> {
if
(
contentBean
!=
null
&&
contentBean
.
getRmhInfo
()
!=
null
)
{
if
(
contentBean
.
getObjectId
().
equals
(
contentId
))
{
//&& contentBean.getContentRelId().equals(relId)
//
&& contentBean.getContentRelId().equals(relId)
if
(
isZan
)
{
contentBean
.
setLikeStatus
(
"1"
);
}
else
{
...
...
@@ -919,13 +892,13 @@ public abstract class ItemLayoutManager<T extends ItemBean> {
* 依据点赞数量展示
*/
private
void
handlerLikeNum
()
{
//点赞数量
// if (contentBean.likeNum > 0) {
// praiseBtnTv.setText(NumberStrUtils.Companion.getINSTANCE().handlerNumber(contentBean.likeNum + ""));
// } else {
// praiseBtnTv.setText(R.string.comp_bottom_praise_txt);
// contentBean.likeNum = 0;
// }
// 点赞数量
// if (contentBean.likeNum > 0) {
// praiseBtnTv.setText(NumberStrUtils.Companion.getINSTANCE().handlerNumber(contentBean.likeNum + ""));
// } else {
// praiseBtnTv.setText(R.string.comp_bottom_praise_txt);
// contentBean.likeNum = 0;
// }
}
/**
...
...
@@ -934,15 +907,15 @@ public abstract class ItemLayoutManager<T extends ItemBean> {
public
void
updateData
(
int
position
)
{
if
(
llFromm
!=
null
&&
contentBean
!=
null
)
{
//if (contentBean.isExposure()) {
if
(
llFromm
.
getVisibility
()
!=
View
.
GONE
)
{
// 处理频道和发布日期
CompentLogicUtil
.
handlerFromDataInfor
(
llFromm
,
contentBean
);
}
else
{
checkFollowState
(
contentBean
,
topLayout
);
checkPeopleStatus
(
contentBean
,
bottomLayout
,
position
);
}
// }
// if (contentBean.isExposure()) {
if
(
llFromm
.
getVisibility
()
!=
View
.
GONE
)
{
// 处理频道和发布日期
CompentLogicUtil
.
handlerFromDataInfor
(
llFromm
,
contentBean
);
}
else
{
checkFollowState
(
contentBean
,
topLayout
);
checkPeopleStatus
(
contentBean
,
bottomLayout
,
position
);
}
// }
}
}
...
...
wdlayout/src/main/java/com/wd/capability/layout/comp/layoutmanager/ItemSpecialManager.java
View file @
33f6fe4
...
...
@@ -6,7 +6,7 @@ package com.wd.capability.layout.comp.layoutmanager;
import
androidx.recyclerview.widget.RecyclerView
;
import
com.
people.entity
.custom.item.ItemBean
;
import
com.
wd.foundation.bean
.custom.item.ItemBean
;
/**
* 节目tab样式(专题页面tab样式)<BR>
...
...
wdlayout/src/main/java/com/wd/capability/layout/comp/layoutmanager/LayoutAdapter.java
View file @
33f6fe4
...
...
@@ -12,11 +12,11 @@ import android.view.View;
import
androidx.annotation.NonNull
;
import
com.people.component.comp.layoutdata.AbsPage
;
import
com.people.component.comp.layoutdata.AbsSection
;
import
com.people.component.comp.layoutdata.Page
;
import
com.people.entity.custom.BaseLineBean
;
import
com.people.entity.custom.comp.PageBean
;
import
com.wd.capability.layout.comp.layoutdata.AbsPage
;
import
com.wd.capability.layout.comp.layoutdata.AbsSection
;
import
com.wd.capability.layout.comp.layoutdata.Page
;
import
com.wd.foundation.bean.custom.BaseLineBean
;
import
com.wd.foundation.bean.custom.comp.PageBean
;
public
class
LayoutAdapter
extends
BaseAdapter
implements
ILayoutRender
,
ILayoutManagerScrollListener
{
...
...
@@ -40,12 +40,12 @@ public class LayoutAdapter extends BaseAdapter implements ILayoutRender, ILayout
public
void
itemRangeRemoved
(
int
startIndex
,
int
count
)
{
List
<
ItemLayoutManager
>
itemLayoutManagers
=
indexer
.
getItemLayoutManagers
();
List
<
ItemLayoutManager
>
list
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
int
position
=
startIndex
+
i
;
list
.
add
(
itemLayoutManagers
.
get
(
position
));
}
itemLayoutManagers
.
removeAll
(
list
);
notifyItemRangeRemoved
(
startIndex
,
count
);
notifyItemRangeRemoved
(
startIndex
,
count
);
}
@Override
...
...
@@ -85,10 +85,10 @@ public class LayoutAdapter extends BaseAdapter implements ILayoutRender, ILayout
@Override
public
void
renderPage
(
AbsPage
page
,
boolean
isRefresh
)
{
if
(
isRefresh
)
{
if
(
isRefresh
)
{
indexer
.
updateItemLayoutManagers
(
page
);
}
else
{
indexer
.
updateItemLayoutManagersByGroup
(
page
,
isRefresh
);
}
else
{
indexer
.
updateItemLayoutManagersByGroup
(
page
,
isRefresh
);
}
}
...
...
@@ -213,8 +213,6 @@ public class LayoutAdapter extends BaseAdapter implements ILayoutRender, ILayout
}
}
/**
* item滑出屏幕
*
...
...
@@ -234,7 +232,6 @@ public class LayoutAdapter extends BaseAdapter implements ILayoutRender, ILayout
this
.
layoutManagerScrollListener
=
layoutManagerScrollListener
;
}
@Override
public
void
onScrolled
(
View
view
,
int
dx
,
int
dy
)
{
if
(
null
!=
layoutManagerScrollListener
)
{
...
...
wdlayout/src/main/java/com/wd/capability/layout/comp/layoutmanager/channel/BaseLineLayoutManager.java
View file @
33f6fe4
...
...
@@ -7,11 +7,10 @@ package com.wd.capability.layout.comp.layoutmanager.channel;
import
android.view.View
;
import
android.widget.TextView
;
import
com.people.common.TextViewUtils
;
import
com.people.component.R
;
import
com.people.component.comp.layoutmanager.ItemLayoutManager
;
import
com.people.entity.custom.BaseLineBean
;
import
com.wondertek.wheat.ability.tools.ResUtils
;
import
com.wd.capability.layout.R
;
import
com.wd.capability.layout.comp.layoutmanager.ItemLayoutManager
;
import
com.wd.foundation.bean.custom.BaseLineBean
;
import
com.wd.foundation.wdkitcore.tools.ResUtils
;
/**
* 底线样式(page接口返回的数据,不同于其他样式)
...
...
wdlayout/src/main/java/com/wd/capability/layout/comp/layoutmanager/channel/CompActivity01.java
View file @
33f6fe4
package
com
.
wd
.
capability
.
layout
.
comp
.
layoutmanager
.
channel
;
import
android.annotation.SuppressLint
;
...
...
@@ -6,15 +7,11 @@ import android.view.ViewGroup;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
com.people.common.ProcessUtils
;
import
com.people.common.viewclick.BaseClickListener
;
import
com.people.component.R
;
import
com.people.component.comp.layoutmanager.ItemLayoutManager
;
import
com.people.component.utils.CompentLogicUtil
;
import
com.people.daily.lib_library.TimeUtil
;
import
com.people.entity.custom.NavigationBeanNews
;
import
com.people.entity.custom.act.BaseActivityBean
;
import
com.people.toolset.imageglide.ImageUtils
;
import
com.wd.capability.layout.R
;
import
com.wd.capability.layout.comp.layoutmanager.ItemLayoutManager
;
import
com.wd.foundation.bean.custom.NavigationBeanNews
;
import
com.wd.foundation.bean.custom.act.BaseActivityBean
;
import
com.wd.foundation.wdkit.viewclick.BaseClickListener
;
/**
* @Description: 活动卡
...
...
@@ -26,14 +23,12 @@ import com.people.toolset.imageglide.ImageUtils;
*/
public
class
CompActivity01
extends
ItemLayoutManager
<
NavigationBeanNews
>
{
private
ImageView
imageView
;
private
TextView
tvTitle
,
tvData
,
tvLookDetail
;
private
View
viewTag
;
@Override
public
int
getItemViewType
()
{
return
R
.
layout
.
comp_activity_01
;
...
...
@@ -55,15 +50,15 @@ public class CompActivity01 extends ItemLayoutManager<NavigationBeanNews> {
tvLookDetail
=
itemView
.
findViewById
(
R
.
id
.
tvLookDetail
);
viewTag
=
itemView
.
findViewById
(
R
.
id
.
viewTag
);
// // 绘制图片
// int screenWith = DeviceUtil.getDeviceWidth();
// float imageW = (screenWith - AppContext.getContext().getResources().getDimension(R.dimen.rmrb_dp32)) / 3;
// float imageH = imageW * 2 / 3;
//
// RelativeLayout.LayoutParams imageViewLp = (RelativeLayout.LayoutParams) imageView.getLayoutParams();
// imageViewLp.width = (int) imageW;
// imageViewLp.height = (int) imageH;
// imageView.setLayoutParams(imageViewLp);
// // 绘制图片
// int screenWith = DeviceUtil.getDeviceWidth();
// float imageW = (screenWith - AppContext.getContext().getResources().getDimension(R.dimen.rmrb_dp32)) / 3;
// float imageH = imageW * 2 / 3;
//
// RelativeLayout.LayoutParams imageViewLp = (RelativeLayout.LayoutParams) imageView.getLayoutParams();
// imageViewLp.width = (int) imageW;
// imageViewLp.height = (int) imageH;
// imageView.setLayoutParams(imageViewLp);
// 国殇
checkOpenGrayModel
(
itemView
,
position
);
...
...
@@ -93,7 +88,8 @@ public class CompActivity01 extends ItemLayoutManager<NavigationBeanNews> {
CompentLogicUtil
.
contentObjectTextMsg
(
tvLookDetail
,
contentBean
);
// 活动开始和结束日期
String
commentTxt
=
tvData
.
getContext
().
getString
(
R
.
string
.
comp_activity_data
);
tvData
.
setText
(
String
.
format
(
commentTxt
,
TimeUtil
.
transFormTime9
(
activityBean
.
getStartTime
()),
TimeUtil
.
transFormTime9
(
activityBean
.
getEndTime
())));
tvData
.
setText
(
String
.
format
(
commentTxt
,
TimeUtil
.
transFormTime9
(
activityBean
.
getStartTime
()),
TimeUtil
.
transFormTime9
(
activityBean
.
getEndTime
())));
itemView
.
setOnClickListener
(
new
BaseClickListener
()
{
@Override
...
...
@@ -105,7 +101,6 @@ public class CompActivity01 extends ItemLayoutManager<NavigationBeanNews> {
}
});
// 曝光埋点
itemView
.
post
(()
->
...
...
@@ -114,12 +109,10 @@ public class CompActivity01 extends ItemLayoutManager<NavigationBeanNews> {
});
}
else
{
setLayoutManagerItemViewHeight
(
itemView
,
0
);
}
return
position
;
}
}
...
...
wdlayout/src/main/java/com/wd/capability/layout/comp/layoutmanager/channel/CompAdvGuanMI.java
View file @
33f6fe4
package
com
.
wd
.
capability
.
layout
.
comp
.
layoutmanager
.
channel
;
import
java.util.List
;
...
...
@@ -15,22 +16,14 @@ import androidx.appcompat.widget.LinearLayoutCompat;
import
androidx.recyclerview.widget.LinearLayoutManager
;
import
androidx.recyclerview.widget.RecyclerView
;
import
com.chad.library.adapter.base.BaseQuickAdapter
;
import
com.chad.library.adapter.base.viewholder.BaseViewHolder
;
import
com.people.common.ProcessUtils
;
import
com.people.common.viewclick.BaseClickListener
;
import
com.people.common.widget.RoundCornerImageView
;
import
com.people.component.R
;
import
com.people.component.comp.layoutmanager.ItemLayoutManager
;
import
com.people.component.ui.widget.assist.SpeaceLineHDecoration
;
import
com.people.entity.custom.comp.CompBean
;
import
com.people.entity.custom.content.ContentBean
;
import
com.people.entity.custom.label.CompAdv01Bean
;
import
com.people.livedate.EventConstants
;
import
com.people.livedate.base.LiveDataBus
;
import
com.people.toolset.imageglide.ImageUtils
;
import
com.people.toolset.system.DeviceUtil
;
import
com.wondertek.wheat.ability.tools.AppContext
;
import
com.wd.capability.layout.R
;
import
com.wd.capability.layout.comp.layoutmanager.ItemLayoutManager
;
import
com.wd.foundation.bean.custom.comp.CompBean
;
import
com.wd.foundation.bean.custom.content.ContentBean
;
import
com.wd.foundation.bean.custom.label.CompAdv01Bean
;
import
com.wd.foundation.wdkit.viewclick.BaseClickListener
;
import
com.wd.foundation.wdkitcore.livedata.LiveDataBus
;
import
com.wd.foundation.wdkitcore.tools.AppContext
;
/**
* 冠名广告
...
...
@@ -54,7 +47,6 @@ public class CompAdvGuanMI extends ItemLayoutManager<CompAdv01Bean> {
private
TextView
tvMore
;
@Override
public
int
getItemViewType
()
{
return
R
.
layout
.
comp_adv_guan_mi
;
...
...
@@ -78,21 +70,21 @@ public class CompAdvGuanMI extends ItemLayoutManager<CompAdv01Bean> {
LinearLayout
llContent
=
itemView
.
findViewById
(
R
.
id
.
llContent
);
setHorizontalSlideMargin
(
position
,
llContent
,
bottomLine
);
// 国殇
checkOpenGrayModel
(
itemView
,
position
);
checkOpenGrayModel
(
itemView
,
position
);
itemView
.
findViewById
(
R
.
id
.
flClose
).
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
CompBean
compBean
=
section
.
getCompBean
();
int
hashCode
=
CompAdvGuanMI
.
this
.
hashCode
();
LiveDataBus
.
getInstance
().
with
(
EventConstants
.
USER_COMP_MANUSCRIPT_DEL
+
compBean
.
getCompInforPageId
()).
postValue
(
hashCode
);
LiveDataBus
.
getInstance
()
.
with
(
EventConstants
.
USER_COMP_MANUSCRIPT_DEL
+
compBean
.
getCompInforPageId
())
.
postValue
(
hashCode
);
}
});
}
@Override
public
int
bindItem
(
View
itemView
,
int
position
,
CompAdv01Bean
data
)
{
if
(
data
==
null
)
{
...
...
@@ -113,7 +105,7 @@ public class CompAdvGuanMI extends ItemLayoutManager<CompAdv01Bean> {
String
topImageUrl
=
data
.
topImageUrl
;
itemView
.
findViewById
(
R
.
id
.
more_LLC
).
setOnClickListener
(
moreClick
);
//imageView.setOnClickListener(moreClick);
//
imageView.setOnClickListener(moreClick);
// 头部广告图
int
screenWith
=
DeviceUtil
.
getDeviceWidth
();
...
...
@@ -127,7 +119,6 @@ public class CompAdvGuanMI extends ItemLayoutManager<CompAdv01Bean> {
ImageUtils
.
getInstance
().
loadImageSourceByNetStatus
(
imageView
,
topImageUrl
,
R
.
drawable
.
shape_comp_default
);
// 计算出最长标题
String
maxTitleStr
=
data
.
maxTitleName
;
...
...
@@ -136,7 +127,7 @@ public class CompAdvGuanMI extends ItemLayoutManager<CompAdv01Bean> {
contentRv
.
removeItemDecorationAt
(
0
);
}
/*
数量=2,间距=12dp
*
数量=2,间距=12dp
*/
int
interval
=
(
int
)
AppContext
.
getContext
().
getResources
().
getDimension
(
R
.
dimen
.
rmrb_dp8
);
if
(
size
==
2
)
{
...
...
@@ -151,13 +142,11 @@ public class CompAdvGuanMI extends ItemLayoutManager<CompAdv01Bean> {
if
(
position
==
0
)
{
rvR
=
(
int
)
AppContext
.
getContext
().
getResources
().
getDimension
(
R
.
dimen
.
rmrb_dp10
);
}
speaceLineHDecoration
=
new
SpeaceLineHDecoration
(
contentRv
.
getContext
(),
interval
,
rvLr
,
rvR
);
speaceLineHDecoration
=
new
SpeaceLineHDecoration
(
contentRv
.
getContext
(),
interval
,
rvLr
,
rvR
);
contentRv
.
addItemDecoration
(
speaceLineHDecoration
);
LinearLayoutManager
layoutManager
=
new
LinearLayoutManager
(
contentRv
.
getContext
(),
LinearLayoutManager
.
HORIZONTAL
,
false
);
LinearLayoutManager
layoutManager
=
new
LinearLayoutManager
(
contentRv
.
getContext
(),
LinearLayoutManager
.
HORIZONTAL
,
false
);
contentRv
.
setLayoutManager
(
layoutManager
);
contentAdapter
=
new
ContentAdapter
(
size
,
maxTitleStr
);
...
...
@@ -170,11 +159,9 @@ public class CompAdvGuanMI extends ItemLayoutManager<CompAdv01Bean> {
tvMore
.
setText
(
R
.
string
.
component_more
);
}
return
position
;
}
private
View
.
OnClickListener
moreClick
=
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
...
...
@@ -216,12 +203,11 @@ public class CompAdvGuanMI extends ItemLayoutManager<CompAdv01Bean> {
}
else
{
imageWith
=
(
int
)
(
screenWith
*
150
f
/
375
f
);
}
//按要求不做等比放大,按照设计图大小开发
//
按要求不做等比放大,按照设计图大小开发
imageHeight
=
imageWith
*
84
f
/
150
f
;
}
@Override
protected
void
convert
(
@NonNull
BaseViewHolder
baseViewHolder
,
ContentBean
bean
)
{
...
...
@@ -233,7 +219,8 @@ public class CompAdvGuanMI extends ItemLayoutManager<CompAdv01Bean> {
TextView
tvTitleTemp
=
baseViewHolder
.
itemView
.
findViewById
(
R
.
id
.
tvTitleTemp
);
tvTitleTemp
.
setText
(
maxTitleStr
);
RecyclerView
.
LayoutParams
itemViewLp
=
(
RecyclerView
.
LayoutParams
)
baseViewHolder
.
itemView
.
getLayoutParams
();
RecyclerView
.
LayoutParams
itemViewLp
=
(
RecyclerView
.
LayoutParams
)
baseViewHolder
.
itemView
.
getLayoutParams
();
itemViewLp
.
width
=
(
int
)
imageWith
;
baseViewHolder
.
itemView
.
setLayoutParams
(
itemViewLp
);
...
...
@@ -251,7 +238,6 @@ public class CompAdvGuanMI extends ItemLayoutManager<CompAdv01Bean> {
}
});
// 曝光埋点
baseViewHolder
.
itemView
.
post
(()
->
{
trackItemContent
(
false
,
bean
,
0
,
null
);
...
...
@@ -259,6 +245,5 @@ public class CompAdvGuanMI extends ItemLayoutManager<CompAdv01Bean> {
});
}
}
}
...
...
wdlayout/src/main/java/com/wd/capability/layout/comp/layoutmanager/channel/CompAdvLongImageLan.java
View file @
33f6fe4
package
com
.
wd
.
capability
.
layout
.
comp
.
layoutmanager
.
channel
;
import
android.text.TextUtils
;
...
...
@@ -6,18 +7,13 @@ import android.view.ViewGroup;
import
android.widget.LinearLayout
;
import
android.widget.TextView
;
import
com.people.common.ProcessUtils
;
import
com.people.common.viewclick.BaseClickListener
;
import
com.people.common.widget.RoundCornerImageView
;
import
com.people.component.R
;
import
com.people.component.comp.layoutmanager.ItemLayoutManager
;
import
com.people.entity.custom.NavigationBeanNews
;
import
com.people.entity.custom.comp.CompBean
;
import
com.people.livedate.EventConstants
;
import
com.people.livedate.base.LiveDataBus
;
import
com.people.toolset.imageglide.ImageUtils
;
import
com.people.toolset.system.DeviceUtil
;
import
com.wondertek.wheat.ability.tools.AppContext
;
import
com.wd.capability.layout.R
;
import
com.wd.capability.layout.comp.layoutmanager.ItemLayoutManager
;
import
com.wd.foundation.bean.custom.NavigationBeanNews
;
import
com.wd.foundation.bean.custom.comp.CompBean
;
import
com.wd.foundation.wdkit.viewclick.BaseClickListener
;
import
com.wd.foundation.wdkitcore.livedata.LiveDataBus
;
import
com.wd.foundation.wdkitcore.tools.AppContext
;
/**
* 长通栏广告(可带标题)
...
...
@@ -29,12 +25,10 @@ import com.wondertek.wheat.ability.tools.AppContext;
*/
public
class
CompAdvLongImageLan
extends
ItemLayoutManager
<
NavigationBeanNews
>
{
private
RoundCornerImageView
imageView
;
private
TextView
tvTitle
;
@Override
public
int
getItemViewType
()
{
return
R
.
layout
.
comp_adv_long_image_lan
;
...
...
@@ -56,11 +50,13 @@ public class CompAdvLongImageLan extends ItemLayoutManager<NavigationBeanNews> {
public
void
onClick
(
View
v
)
{
CompBean
compBean
=
section
.
getCompBean
();
int
hashCode
=
CompAdvLongImageLan
.
this
.
hashCode
();
LiveDataBus
.
getInstance
().
with
(
EventConstants
.
USER_COMP_MANUSCRIPT_DEL
+
compBean
.
getCompInforPageId
()).
postValue
(
hashCode
);
LiveDataBus
.
getInstance
()
.
with
(
EventConstants
.
USER_COMP_MANUSCRIPT_DEL
+
compBean
.
getCompInforPageId
())
.
postValue
(
hashCode
);
}
});
// 国殇
checkOpenGrayModel
(
itemView
,
position
);
checkOpenGrayModel
(
itemView
,
position
);
}
@Override
...
...
@@ -87,15 +83,15 @@ public class CompAdvLongImageLan extends ItemLayoutManager<NavigationBeanNews> {
imageViewLp
.
width
=
(
int
)
imageW
;
imageViewLp
.
height
=
(
int
)
imageH
;
imageView
.
setLayoutParams
(
imageViewLp
);
ImageUtils
.
getInstance
().
loadImageSourceByNetStatus
(
imageView
,
url
,
R
.
drawable
.
shape_comp_default
);
ImageUtils
.
getInstance
().
loadImageSourceByNetStatus
(
imageView
,
url
,
R
.
drawable
.
shape_comp_default
);
itemView
.
setOnClickListener
(
new
BaseClickListener
()
{
@Override
protected
void
onNoDoubleClick
(
View
v
)
{
ProcessUtils
.
processPage
(
contentBean
);
//更新已读状态
// updateReadState(tvTitle, data);
// 更新已读状态
// updateReadState(tvTitle, data);
// 点击埋点
trackItemContent
(
true
,
contentBean
,
position
,
data
.
getLocalFiledType
());
...
...
@@ -107,7 +103,6 @@ public class CompAdvLongImageLan extends ItemLayoutManager<NavigationBeanNews> {
trackItemContent
(
false
,
contentBean
,
position
,
data
.
getLocalFiledType
());
});
}
else
{
setLayoutManagerItemViewHeight
(
itemView
,
0
);
}
...
...
@@ -115,5 +110,4 @@ public class CompAdvLongImageLan extends ItemLayoutManager<NavigationBeanNews> {
return
position
;
}
}
...
...
wdlayout/src/main/java/com/wd/capability/layout/comp/layoutmanager/channel/CompAdvVideoEx.java
View file @
33f6fe4
...
...
@@ -10,22 +10,14 @@ import androidx.annotation.NonNull;
import
androidx.appcompat.widget.LinearLayoutCompat
;
import
androidx.recyclerview.widget.LinearLayoutManager
;
import
com.chad.library.adapter.base.BaseQuickAdapter
;
import
com.chad.library.adapter.base.viewholder.BaseViewHolder
;
import
com.people.common.ProcessUtils
;
import
com.people.common.viewclick.BaseClickListener
;
import
com.people.common.widget.RoundCornerImageView
;
import
com.people.component.R
;
import
com.people.component.comp.layoutmanager.ItemLayoutManager
;
import
com.people.component.ui.widget.ItemRecyclerView
;
import
com.people.entity.custom.comp.CompBean
;
import
com.people.entity.custom.content.ContentBean
;
import
com.people.entity.custom.label.CompAdv01Bean
;
import
com.people.livedate.EventConstants
;
import
com.people.livedate.base.LiveDataBus
;
import
com.people.toolset.imageglide.ImageUtils
;
import
com.people.toolset.system.DeviceUtil
;
import
com.wondertek.wheat.ability.tools.AppContext
;
import
com.wd.capability.layout.comp.layoutmanager.BaseAdapter
;
import
com.wd.capability.layout.comp.layoutmanager.ItemLayoutManager
;
import
com.wd.foundation.bean.custom.comp.CompBean
;
import
com.wd.foundation.bean.custom.label.CompAdv01Bean
;
import
com.wd.foundation.wdkit.viewclick.BaseClickListener
;
import
com.wd.foundation.wdkitcore.livedata.LiveDataBus
;
import
com.wd.foundation.wdkitcore.tools.AppContext
;
/**
* @Description: 视频展会广告
...
...
@@ -163,7 +155,7 @@ public class CompAdvVideoEx extends ItemLayoutManager<CompAdv01Bean> {
@Override
protected
void
convert
(
@NonNull
BaseViewHolder
baseViewHolder
,
ContentBean
bean
)
{
protected
void
convert
(
@NonNull
Base
Adapter
.
Base
ViewHolder
baseViewHolder
,
ContentBean
bean
)
{
TextView
tvTitle
=
baseViewHolder
.
itemView
.
findViewById
(
R
.
id
.
tvTitle
);
tvTitle
.
setText
(
bean
.
getNewsTitle
());
...
...
wdlayout/src/main/java/com/wd/capability/layout/comp/layoutmanager/channel/CompAllResultPeoplesAccount.java
View file @
33f6fe4
package
com
.
wd
.
capability
.
layout
.
comp
.
layoutmanager
.
channel
;
import
java.util.List
;
...
...
@@ -8,19 +9,13 @@ import android.widget.ImageView;
import
android.widget.RelativeLayout
;
import
android.widget.TextView
;
import
com.people.common.CommonNetUtils
;
import
com.people.common.ProcessUtils
;
import
com.people.common.util.PDUtils
;
import
com.people.common.viewclick.BaseClickListener
;
import
com.people.component.R
;
import
com.people.component.comp.layoutmanager.ItemLayoutManager
;
import
com.people.entity.custom.NavigationBeanNews
;
import
com.people.entity.custom.content.ContentBean
;
import
com.people.network.BaseObserver
;
import
com.people.toolset.imageglide.FilletUtil
;
import
com.people.toolset.imageglide.ImageUtils
;
import
com.people.toolset.string.NumberStrUtils
;
import
com.wondertek.wheat.ability.tools.ResUtils
;
import
com.wd.capability.layout.R
;
import
com.wd.capability.layout.comp.layoutmanager.ItemLayoutManager
;
import
com.wd.capability.network.BaseObserver
;
import
com.wd.foundation.bean.custom.NavigationBeanNews
;
import
com.wd.foundation.bean.custom.content.ContentBean
;
import
com.wd.foundation.wdkit.viewclick.BaseClickListener
;
import
com.wd.foundation.wdkitcore.tools.ResUtils
;
/**
* 搜索结果-更多人民号模块
...
...
@@ -29,105 +24,110 @@ import com.wondertek.wheat.ability.tools.ResUtils;
* @description:
* @author: wd
* @date :2023/2/6 16:21
* 参照:{@link com.people.personalcenter.adapter.FocusListAdapter CompSingleRowRecommendFollow
* com.people.component.comp.layoutmanager.channel.CompSingleRowRecommendFollow}
* 参照:{@link com.people.personalcenter.adapter.FocusListAdapter CompSingleRowRecommendFollow
* com.people.component.comp.layoutmanager.channel.CompSingleRowRecommendFollow}
*/
public
class
CompAllResultPeoplesAccount
extends
ItemLayoutManager
<
NavigationBeanNews
>
{
private
ImageView
riv_author
,
ivtagsplitpoint
,
ivadd
,
ivvip
,
imgavatarframe
;
private
TextView
tvTitle
,
tv_fans
,
tv_desc
,
btn_focus
;
private
ImageView
riv_author
,
ivtagsplitpoint
,
ivadd
,
ivvip
,
imgavatarframe
;
private
TextView
tvTitle
,
tv_fans
,
tv_desc
,
btn_focus
;
private
RelativeLayout
rlcare
;
private
View
vline
,
vauthorheadframe
,
vvipbg
;
private
View
vline
,
vauthorheadframe
,
vvipbg
;
@Override
public
void
prepareItem
(
View
itemView
,
int
position
)
{
//荣誉头像框
//
荣誉头像框
imgavatarframe
=
itemView
.
findViewById
(
R
.
id
.
imgavatarframe
);
//用户头像边框 #000000 0.5 dp 5%
//
用户头像边框 #000000 0.5 dp 5%
vauthorheadframe
=
itemView
.
findViewById
(
R
.
id
.
vauthorheadframe
);
//用户头像
//
用户头像
riv_author
=
itemView
.
findViewById
(
R
.
id
.
riv_author
);
//用户V图标边框
//
用户V图标边框
vvipbg
=
itemView
.
findViewById
(
R
.
id
.
vvipbg
);
//用户户V图标
//
用户户V图标
ivvip
=
itemView
.
findViewById
(
R
.
id
.
ivvip
);
//用户名称
//
用户名称
tvTitle
=
itemView
.
findViewById
(
R
.
id
.
tv_author
);
//粉丝数
//
粉丝数
tv_fans
=
itemView
.
findViewById
(
R
.
id
.
tv_fans
);
//粉丝数目和简介之间的分割线
//
粉丝数目和简介之间的分割线
ivtagsplitpoint
=
itemView
.
findViewById
(
R
.
id
.
ivtagsplitpoint
);
//用户简介
//
用户简介
tv_desc
=
itemView
.
findViewById
(
R
.
id
.
tv_desc
);
//用户关注布局
//
用户关注布局
rlcare
=
itemView
.
findViewById
(
R
.
id
.
rlcare
);
//用户关注+号
//
用户关注+号
ivadd
=
itemView
.
findViewById
(
R
.
id
.
ivadd
);
//用户关注状态标签 已关注/关注
//
用户关注状态标签 已关注/关注
btn_focus
=
itemView
.
findViewById
(
R
.
id
.
btn_focus
);
//底线
//
底线
vline
=
itemView
.
findViewById
(
R
.
id
.
vline
);
// 国殇
checkOpenGrayModel
(
itemView
,
position
);
checkOpenGrayModel
(
itemView
,
position
);
}
@Override
public
int
bindItem
(
View
itemView
,
int
position
,
NavigationBeanNews
data
)
{
List
<
ContentBean
>
subList
=
data
.
getSubList
();
if
(
subList
!=
null
)
{
if
(
subList
!=
null
)
{
contentBean
=
subList
.
get
(
0
);
}
//设置荣誉头像框
ImageUtils
.
getInstance
().
loadImage
(
imgavatarframe
,
contentBean
.
getRmhInfo
().
getHonoraryIcon
(),-
1
);
//设置头像
ImageUtils
.
getInstance
().
loadImageCircle
(
riv_author
,
contentBean
.
getRmhInfo
().
getRmhHeadUrl
(),
R
.
mipmap
.
icon_default_head
);
//设置v标识
if
(
TextUtils
.
isEmpty
(
contentBean
.
getRmhInfo
().
getAuthIcon
())){
// 设置荣誉头像框
ImageUtils
.
getInstance
().
loadImage
(
imgavatarframe
,
contentBean
.
getRmhInfo
().
getHonoraryIcon
(),
-
1
);
// 设置头像
ImageUtils
.
getInstance
()
.
loadImageCircle
(
riv_author
,
contentBean
.
getRmhInfo
().
getRmhHeadUrl
(),
R
.
mipmap
.
icon_default_head
);
// 设置v标识
if
(
TextUtils
.
isEmpty
(
contentBean
.
getRmhInfo
().
getAuthIcon
()))
{
vvipbg
.
setVisibility
(
View
.
GONE
);
ivvip
.
setVisibility
(
View
.
GONE
);
}
else
{
ImageUtils
.
getInstance
().
loadImageCircle
(
ivvip
,
contentBean
.
getRmhInfo
().
getAuthIcon
(),
-
1
);
}
else
{
ImageUtils
.
getInstance
().
loadImageCircle
(
ivvip
,
contentBean
.
getRmhInfo
().
getAuthIcon
(),
-
1
);
vvipbg
.
setVisibility
(
View
.
VISIBLE
);
ivvip
.
setVisibility
(
View
.
VISIBLE
);
}
//设置用户昵称
setTittleValue
(
TextUtils
.
isEmpty
(
contentBean
.
getRmhInfo
().
getRmhName
())?
""
:
contentBean
.
getRmhInfo
().
getRmhName
(),
tvTitle
,
null
);
// 设置用户昵称
setTittleValue
(
TextUtils
.
isEmpty
(
contentBean
.
getRmhInfo
().
getRmhName
())
?
""
:
contentBean
.
getRmhInfo
().
getRmhName
(),
tvTitle
,
null
);
boolean
hasFansAndIntroduction
=
true
;
//设置粉丝
if
(
TextUtils
.
isEmpty
(
contentBean
.
getRmhInfo
().
fansNum
)
||
"0"
.
equals
(
contentBean
.
getRmhInfo
().
fansNum
)){
// 设置粉丝
if
(
TextUtils
.
isEmpty
(
contentBean
.
getRmhInfo
().
fansNum
)
||
"0"
.
equals
(
contentBean
.
getRmhInfo
().
fansNum
))
{
hasFansAndIntroduction
=
false
;
tv_fans
.
setText
(
""
);
}
else
{
tv_fans
.
setText
(
"粉丝"
+
NumberStrUtils
.
Companion
.
getINSTANCE
().
handlerNumber
(
contentBean
.
getRmhInfo
().
fansNum
));
}
else
{
tv_fans
.
setText
(
"粉丝"
+
NumberStrUtils
.
Companion
.
getINSTANCE
().
handlerNumber
(
contentBean
.
getRmhInfo
().
fansNum
));
}
//设置简介
if
(
TextUtils
.
isEmpty
(
contentBean
.
getRmhInfo
().
getRmhDesc
())){
// 设置简介
if
(
TextUtils
.
isEmpty
(
contentBean
.
getRmhInfo
().
getRmhDesc
()))
{
hasFansAndIntroduction
=
false
;
tv_desc
.
setText
(
""
);
}
else
{
}
else
{
tv_desc
.
setText
(
contentBean
.
getRmhInfo
().
getRmhDesc
());
}
//设置分割点
if
(
hasFansAndIntroduction
){
// 设置分割点
if
(
hasFansAndIntroduction
)
{
ivtagsplitpoint
.
setVisibility
(
View
.
VISIBLE
);
}
else
{
}
else
{
ivtagsplitpoint
.
setVisibility
(
View
.
GONE
);
}
//设置关注状态
//
设置关注状态
refreshCareState
(
contentBean
.
getRmhInfo
().
followStatus
);
//点击关注/取消关注
//
点击关注/取消关注
rlcare
.
setOnClickListener
(
new
BaseClickListener
()
{
@Override
protected
void
onNoDoubleClick
(
View
v
)
{
if
(!
PDUtils
.
isLogin
())
{
if
(!
PDUtils
.
isLogin
())
{
ProcessUtils
.
toOneKeyLoginActivity
();
}
int
status
=
TextUtils
.
isEmpty
(
contentBean
.
getRmhInfo
().
followStatus
)?
0
:
Integer
.
parseInt
(
contentBean
.
getRmhInfo
().
followStatus
);
CommonNetUtils
.
getInstance
().
operation
(
contentBean
.
getRmhInfo
().
getUserId
(),
contentBean
.
getRmhInfo
().
getUserType
(),
contentBean
.
getRmhInfo
().
getRmhId
(),
status
==
1
?
0
:
1
,
new
BaseObserver
<
String
>()
{
int
status
=
TextUtils
.
isEmpty
(
contentBean
.
getRmhInfo
().
followStatus
)
?
0
:
Integer
.
parseInt
(
contentBean
.
getRmhInfo
().
followStatus
);
CommonNetUtils
.
getInstance
()
.
operation
(
contentBean
.
getRmhInfo
().
getUserId
(),
contentBean
.
getRmhInfo
().
getUserType
(),
contentBean
.
getRmhInfo
().
getRmhId
(),
status
==
1
?
0
:
1
,
new
BaseObserver
<
String
>()
{
@Override
protected
void
dealSpecialCode
(
int
code
,
String
message
)
{
...
...
@@ -137,7 +137,7 @@ public class CompAllResultPeoplesAccount extends ItemLayoutManager<NavigationBea
protected
void
onSuccess
(
String
s
)
{
if
(
status
==
1
)
{
contentBean
.
getRmhInfo
().
followStatus
=
"0"
;
}
else
{
}
else
{
contentBean
.
getRmhInfo
().
followStatus
=
"1"
;
}
refreshCareState
(
contentBean
.
getRmhInfo
().
followStatus
);
...
...
@@ -145,16 +145,14 @@ public class CompAllResultPeoplesAccount extends ItemLayoutManager<NavigationBea
});
}
});
//跳转到号主页
//
跳转到号主页
itemView
.
setOnClickListener
(
new
BaseClickListener
()
{
@Override
protected
void
onNoDoubleClick
(
View
v
)
{
//跳转个人中心页
ProcessUtils
.
jumpToPersonalCenterActivity
(
contentBean
.
getRmhInfo
().
getCnMainControl
(),
contentBean
.
getRmhInfo
().
getUserId
(),
contentBean
.
getRmhInfo
().
getUserType
(),
contentBean
.
getRmhInfo
().
getRmhId
()
);
// 跳转个人中心页
ProcessUtils
.
jumpToPersonalCenterActivity
(
contentBean
.
getRmhInfo
().
getCnMainControl
(),
contentBean
.
getRmhInfo
().
getUserId
(),
contentBean
.
getRmhInfo
().
getUserType
(),
contentBean
.
getRmhInfo
().
getRmhId
());
}
});
...
...
@@ -164,16 +162,17 @@ public class CompAllResultPeoplesAccount extends ItemLayoutManager<NavigationBea
private
void
refreshCareState
(
String
status
)
{
int
linesize
=
(
int
)
rlcare
.
getContext
().
getResources
().
getDimension
(
R
.
dimen
.
rmrb_dp0_5
);
if
(
"1"
.
equals
(
status
))
{
//已关注
rlcare
.
setBackground
(
FilletUtil
.
createRectangleDrawable
(
0x00000000
,
rlcare
.
getContext
().
getResources
().
getColor
(
R
.
color
.
res_color_common_C5
),
Math
.
max
(
1
,
linesize
),
rlcare
.
getContext
().
getResources
().
getDimension
(
R
.
dimen
.
rmrb_dp3
)));
rlcare
.
setPadding
(
0
,
0
,
0
,
0
);
// 已关注
rlcare
.
setBackground
(
FilletUtil
.
createRectangleDrawable
(
0x00000000
,
rlcare
.
getContext
().
getResources
().
getColor
(
R
.
color
.
res_color_common_C5
),
Math
.
max
(
1
,
linesize
),
rlcare
.
getContext
().
getResources
().
getDimension
(
R
.
dimen
.
rmrb_dp3
)));
rlcare
.
setPadding
(
0
,
0
,
0
,
0
);
ivadd
.
setVisibility
(
View
.
GONE
);
btn_focus
.
setTextColor
(
btn_focus
.
getContext
().
getResources
().
getColor
(
R
.
color
.
res_color_common_C5
));
btn_focus
.
setText
(
btn_focus
.
getContext
().
getResources
().
getString
(
R
.
string
.
res_followed
));
}
else
{
rlcare
.
setPadding
(
0
,
0
,
(
int
)
ResUtils
.
getDimension
(
R
.
dimen
.
rmrb_dp2
),
0
);
//未关注
}
else
{
rlcare
.
setPadding
(
0
,
0
,
(
int
)
ResUtils
.
getDimension
(
R
.
dimen
.
rmrb_dp2
),
0
);
// 未关注
rlcare
.
setBackground
(
null
);
ivadd
.
setVisibility
(
View
.
VISIBLE
);
btn_focus
.
setTextColor
(
btn_focus
.
getContext
().
getResources
().
getColor
(
R
.
color
.
res_color_common_C11
));
...
...
wdlayout/src/main/java/com/wd/capability/layout/comp/layoutmanager/control/CompPlayController.java
View file @
33f6fe4
...
...
@@ -9,15 +9,10 @@ import android.widget.FrameLayout;
import
android.widget.ImageView
;
import
android.widget.RelativeLayout
;
import
com.aliyun.player.IPlayer
;
import
com.people.component.R
;
import
com.people.entity.custom.content.ContentBean
;
import
com.people.player.widget.AliyunRenderView
;
import
com.people.toolset.SpUtils
;
import
com.people.toolset.imageglide.RenderViewOutlineProvider
;
import
com.wondertek.wheat.ability.tools.AppContext
;
import
com.wondertek.wheat.ability.tools.NetworkUtil
;
import
com.wondertek.wheat.ability.tools.ViewUtils
;
import
com.wd.capability.layout.R
;
import
com.wd.foundation.bean.custom.content.ContentBean
;
import
com.wd.foundation.wdkitcore.tools.AppContext
;
import
com.wd.foundation.wdkitcore.tools.SpUtils
;
/**
* 组件播放器控制器
...
...
@@ -30,7 +25,6 @@ public class CompPlayController {
private
static
final
String
TAG
=
"CompPlayController"
;
private
static
CompPlayController
instance
=
null
;
private
PlayerItemHolder
mPlayerItemHolder
;
...
...
@@ -55,12 +49,11 @@ public class CompPlayController {
return
instance
;
}
// // 埋点对象
// private ConvertQtBean qtBean;
// // 埋点对象
// private ConvertQtBean qtBean;
private
CompPlayController
()
{
//
qtBean = new ConvertQtBean();
// qtBean = new ConvertQtBean();
}
public
CompPlayController
setRadius
(
float
radius
)
{
...
...
@@ -99,7 +92,7 @@ public class CompPlayController {
mPlayerItemHolder
.
playContainer
=
playContainer
;
if
(
mPlayerItemHolder
.
playParentLayout
==
null
)
{
mPlayerItemHolder
.
playParentLayout
=
LayoutInflater
.
from
(
mPlayerItemHolder
.
playContainer
.
getContext
())
.
inflate
(
R
.
layout
.
comp_item_player
,
mPlayerItemHolder
.
playContainer
,
false
);
.
inflate
(
R
.
layout
.
comp_item_player
,
mPlayerItemHolder
.
playContainer
,
false
);
mPlayerItemHolder
.
player
=
ViewUtils
.
findViewById
(
mPlayerItemHolder
.
playParentLayout
,
R
.
id
.
player_view
);
mPlayerItemHolder
.
player
.
setSurfaceType
(
AliyunRenderView
.
SurfaceType
.
TEXTURE_VIEW
);
mPlayerItemHolder
.
player
.
setScaleModel
(
IPlayer
.
ScaleMode
.
SCALE_ASPECT_FILL
);
...
...
@@ -114,7 +107,8 @@ public class CompPlayController {
});
mPlayerItemHolder
.
player_layout
=
ViewUtils
.
findViewById
(
mPlayerItemHolder
.
playParentLayout
,
R
.
id
.
player_layout
);
mPlayerItemHolder
.
player_layout
=
ViewUtils
.
findViewById
(
mPlayerItemHolder
.
playParentLayout
,
R
.
id
.
player_layout
);
}
mPlayerItemHolder
.
player
.
setOnStateChangedListener
(
state
->
{
...
...
wdlayout/src/main/java/com/wd/capability/layout/comp/page/ItemMenuTopLayoutManager.java
View file @
33f6fe4
...
...
@@ -28,43 +28,29 @@ import androidx.recyclerview.widget.RecyclerView;
import
androidx.viewpager2.adapter.FragmentStateAdapter
;
import
androidx.viewpager2.widget.ViewPager2
;
import
com.orhanobut.logger.Logger
;
import
com.people.common.ProcessUtils
;
import
com.people.common.analytics.CommonTrack
;
import
com.people.common.analytics.GeneralTrack
;
import
com.people.common.analytics.constants.PageNameConstants
;
import
com.people.common.base.BaseAutoLazyFragment
;
import
com.people.common.base.BaseLazyFragment
;
import
com.people.common.constant.DefaultViewConstant
;
import
com.people.common.statusbar.StatusBarStyleEnum
;
import
com.people.common.util.GrayManager
;
import
com.people.common.util.ToolsUtil
;
import
com.people.common.viewclick.BaseClickListener
;
import
com.people.common.widget.DefaultView
;
import
com.people.component.R
;
import
com.people.component.comp.CompServiceImpl
;
import
com.people.component.comp.layoutmanager.ItemContainerManager
;
import
com.people.component.ui.assist.LivingMarkDataFetcher
;
import
com.people.component.ui.channel.listener.PageInforToLayoutManagerCallback
;
import
com.people.component.ui.fragment.ColumnFragment
;
import
com.people.component.ui.fragment.HomeFollowFragment
;
import
com.people.component.ui.fragment.MainFragment
;
import
com.people.component.ui.fragment.TemplateFragment
;
import
com.people.component.ui.widget.commonnavigator.titles.TopNavEffectTitleView
;
import
com.people.entity.custom.MenuBean
;
import
com.people.entity.custom.SimpleTabBean
;
import
com.people.entity.custom.comp.ChannelInfoBean
;
import
com.people.entity.custom.comp.CompDataSourceBean
;
import
com.people.entity.custom.comp.TopicInfoBean
;
import
com.people.entity.theme.ThemeMessage
;
import
com.people.livedate.EventConstants
;
import
com.people.livedate.base.LiveDataBus
;
import
com.people.network.NetworkUtils
;
import
com.people.room.entity.ChannelBean
;
import
com.people.toolset.ScreenUtils
;
import
com.people.toolset.imageglide.ImageUtils
;
import
com.wondertek.wheat.ability.tools.ArrayUtils
;
import
com.wondertek.wheat.ability.tools.ViewUtils
;
import
com.wd.base.log.Logger
;
import
com.wd.capability.layout.comp.CompServiceImpl
;
import
com.wd.capability.layout.ui.channel.listener.PageInforToLayoutManagerCallback
;
import
com.wd.capability.layout.ui.fragment.ColumnFragment
;
import
com.wd.capability.layout.ui.fragment.HomeFollowFragment
;
import
com.wd.capability.layout.ui.fragment.MainFragment
;
import
com.wd.capability.layout.ui.fragment.TemplateFragment
;
import
com.wd.capability.network.NetworkUtils
;
import
com.wd.foundation.bean.custom.MenuBean
;
import
com.wd.foundation.bean.custom.SimpleTabBean
;
import
com.wd.foundation.bean.custom.comp.ChannelInfoBean
;
import
com.wd.foundation.bean.custom.comp.CompDataSourceBean
;
import
com.wd.foundation.bean.custom.comp.TopicInfoBean
;
import
com.wd.foundation.bean.response.ChannelBean
;
import
com.wd.foundation.bean.theme.ThemeMessage
;
import
com.wd.foundation.wdkit.base.BaseLazyFragment
;
import
com.wd.foundation.wdkit.constant.DefaultViewConstant
;
import
com.wd.foundation.wdkit.statusbar.StatusBarStyleEnum
;
import
com.wd.foundation.wdkit.utils.ToolsUtil
;
import
com.wd.foundation.wdkit.widget.DefaultView
;
import
com.wd.foundation.wdkitcore.livedata.LiveDataBus
;
import
com.wd.foundation.wdkitcore.tools.ArrayUtils
;
import
net.lucode.hackware.magicindicator.MagicIndicator
;
import
net.lucode.hackware.magicindicator.buildins.UIUtil
;
...
...
wdlayout/src/main/java/com/wd/capability/layout/ui/channel/listener/PageInforToLayoutManagerCallback.java
View file @
33f6fe4
package
com
.
wd
.
capability
.
layout
.
ui
.
channel
.
listener
;
import
com.people.entity.custom.comp.ChannelInfoBean
;
import
com.people.entity.custom.comp.TopicInfoBean
;
import
com.people.entity.theme.ThemeMessage
;
import
com.wd.foundation.bean.custom.comp.ChannelInfoBean
;
import
com.wd.foundation.bean.custom.comp.TopicInfoBean
;
import
com.wd.foundation.bean.theme.ThemeMessage
;
/**
* 构建页面LayoutManager 与 ColumnFragment 回调接口类
...
...
@@ -18,9 +19,7 @@ public interface PageInforToLayoutManagerCallback {
*
* @param themeMessage
*/
void
onPageThemeChange
(
ThemeMessage
themeMessage
);
void
onPageThemeChange
(
ThemeMessage
themeMessage
);
/**
* 获取pangeinfor 专题对象
...
...
@@ -39,8 +38,8 @@ public interface PageInforToLayoutManagerCallback {
/**
* ColumnFragment 页面接口访问 数据回调动作
*
* @param isRefresh true: 下拉刷新;false:加载更多
* @param isOpenLoadMore 是否开启加载更多事件 true :开启; false:关闭
* @param isRefresh true: 下拉刷新;false:加载更多
* @param isOpenLoadMore 是否开启加载更多事件 true :开启; false:关闭
*/
void
fragmentRequestCallback
(
boolean
isRefresh
,
boolean
isOpenLoadMore
);
...
...
@@ -50,11 +49,10 @@ public interface PageInforToLayoutManagerCallback {
void
isTop
();
/**
* 错误信息
参见类:DefaultViewConstant.class
* 错误信息 参见类:DefaultViewConstant.class
*
* @param errorCode
*/
void
failedPage
(
int
errorCode
);
}
...
...
wdlayout/src/main/java/com/wd/capability/layout/ui/channel/model/ChannelDataFetcherNews.java
View file @
33f6fe4
...
...
@@ -4,31 +4,30 @@
package
com
.
wd
.
capability
.
layout
.
ui
.
channel
.
model
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
android.text.TextUtils
;
import
com.orhanobut.logger.Logger
;
import
com.people.common.fetcher.BaseDataFetcher
;
import
com.people.component.ui.channel.vm.IChannelDataListener
;
import
com.people.daily.lib_library.ToastNightUtil
;
import
com.people.entity.custom.SimpleTabBean
;
import
com.people.entity.custom.comp.PageBean
;
import
com.people.entity.response.PageTopNavBean
;
import
com.people.network.BaseObserver
;
import
com.people.network.bean.MetaBean
;
import
com.people.network.cachedata.CacheData
;
import
com.people.network.response.BaseResponse
;
import
com.people.room.ChannelDbHelper
;
import
com.people.room.entity.ChannelBean
;
import
com.people.toolset.SpUtils
;
import
com.people.toolset.json.GsonUtils
;
import
com.wondertek.wheat.ability.tools.AppContext
;
import
com.wondertek.wheat.ability.tools.ArrayUtils
;
import
com.wondertek.wheat.ability.tools.StringUtils
;
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.capability.network.response.BaseResponse
;
import
com.wd.foundation.bean.custom.SimpleTabBean
;
import
com.wd.foundation.bean.custom.comp.PageBean
;
import
com.wd.foundation.bean.response.ChannelBean
;
import
com.wd.foundation.bean.response.PageTopNavBean
;
import
com.wd.foundation.wdinterface.toast.IToast
;
import
com.wd.foundation.wdkit.datafetcher.BaseDataFetcher
;
import
com.wd.foundation.wdkitcore.router.ArouterServiceManager
;
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.SpUtils
;
import
com.wd.foundation.wdkitcore.tools.StringUtils
;
import
io.reactivex.Observable
;
...
...
@@ -45,10 +44,8 @@ public class ChannelDataFetcherNews extends BaseDataFetcher {
private
static
final
String
TAG
=
"ChannelDataFetcherNews"
;
private
final
IChannelDataListener
mListener
;
/**
* 构造器
*
...
...
@@ -58,13 +55,16 @@ public class ChannelDataFetcherNews extends BaseDataFetcher {
this
.
mListener
=
listener
;
}
/**
* 取消任务
*/
public
void
cancel
()
{
}
@Override
public
String
getLogTag
()
{
return
""
;
}
/**
* 获取顶部菜单导航栏数据(底部导航栏接口里返回的)
...
...
@@ -76,7 +76,7 @@ public class ChannelDataFetcherNews extends BaseDataFetcher {
// 读取缓存数据
int
dataType
=
loadLocalCacheData
(
id
,
isNewsChannl
);
//Log.e("DDDDSSS","--dataType--->"+dataType);
//
Log.e("DDDDSSS","--dataType--->"+dataType);
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"id"
,
id
);
if
(!
TextUtils
.
isEmpty
(
SpUtils
.
getProvinceCode
()))
{
...
...
@@ -90,7 +90,8 @@ public class ChannelDataFetcherNews extends BaseDataFetcher {
map
.
put
(
"districtCode"
,
SpUtils
.
getDistrictCode
());
}
if
(
isNewsChannl
)
{
List
<
ChannelBean
>
myChannelBeans
=
ChannelDbHelper
.
getInstance
(
AppContext
.
getContext
()).
searchAllSelectChannel
();
List
<
ChannelBean
>
myChannelBeans
=
ChannelDbHelper
.
getInstance
(
AppContext
.
getContext
()).
searchAllSelectChannel
();
StringBuilder
builder
=
new
StringBuilder
();
int
index
=
-
1
;
if
(
myChannelBeans
!=
null
&&
myChannelBeans
.
size
()
>
0
)
{
...
...
@@ -102,7 +103,7 @@ public class ChannelDataFetcherNews extends BaseDataFetcher {
builder
.
append
(
","
);
}
}
//获取我的频道
//
获取我的频道
map
.
put
(
"channelIds"
,
builder
.
toString
());
}
}
...
...
@@ -128,7 +129,7 @@ public class ChannelDataFetcherNews extends BaseDataFetcher {
return
;
}
CacheData
localCacheData
=
CacheData
.
getLocalCacheData
(
CacheData
.
channelCacheDataKey
+
id
);
//没缓存数据进行刷新
//
没缓存数据进行刷新
boolean
needRefresh
=
false
;
if
(
localCacheData
==
null
)
{
...
...
@@ -139,21 +140,21 @@ public class ChannelDataFetcherNews extends BaseDataFetcher {
if
(
metaBean
!=
null
)
{
dataMd5
=
metaBean
.
getMd5
();
}
//代码规范提示if里不要有复杂计算
//
代码规范提示if里不要有复杂计算
if
(
localCacheData
!=
null
&&
localCacheData
.
needRefreshByMd5
(
dataMd5
))
{
needRefresh
=
true
;
}
if
(
needRefresh
)
{
if
(
isNewsChannl
)
{
//
2023/5/18 更新本地栏目数据
// 2023/5/18 更新本地栏目数据
updateLocalColumnSubscriptionDb
(
pageTopNavBean
,
"3"
);
}
else
{
onTopNavDataSuccess
(
pageTopNavBean
,
isNewsChannl
);
}
}
if
(
pageTopNavBean
!=
null
&&
pageTopNavBean
.
getTopNavChannelList
()
!=
null
&&
pageTopNavBean
.
getTopNavChannelList
().
size
()
>
0
)
{
if
(
pageTopNavBean
!=
null
&&
pageTopNavBean
.
getTopNavChannelList
()
!=
null
&&
pageTopNavBean
.
getTopNavChannelList
().
size
()
>
0
)
{
// 缓存到本地
CacheData
.
saveDataToPreference
(
CacheData
.
channelCacheDataKey
+
id
,
pageTopNavBean
,
dataMd5
);
}
...
...
@@ -163,7 +164,10 @@ public class ChannelDataFetcherNews extends BaseDataFetcher {
@Override
protected
void
_onError
(
String
message
)
{
super
.
_onError
(
message
);
ToastNightUtil
.
showShort
(
message
);
IToast
toaster
=
ArouterServiceManager
.
provide
(
IToast
.
class
);
if
(
toaster
!=
null
)
{
toaster
.
showShort
(
message
);
}
if
(
mListener
!=
null
)
{
mListener
.
onPageDataFailed
(
message
);
}
...
...
@@ -185,7 +189,7 @@ public class ChannelDataFetcherNews extends BaseDataFetcher {
if
(
pageTopNavData
!=
null
&&
!
StringUtils
.
isBlank
(
pageTopNavData
.
getNetWorkData
()))
{
// 缓存数据
String
netWorkData
=
pageTopNavData
.
getNetWorkData
();
PageTopNavBean
pageTopNavBean
=
GsonUtils
.
fromJson
(
netWorkData
,
PageTopNavBean
.
class
);
PageTopNavBean
pageTopNavBean
=
JsonUtils
.
convertJsonToObject
(
netWorkData
,
PageTopNavBean
.
class
);
// 更新频道选择页面数据
if
(
isNewsChannl
)
{
updateLocalColumnSubscriptionDb
(
pageTopNavBean
,
"2"
);
...
...
@@ -197,10 +201,11 @@ public class ChannelDataFetcherNews extends BaseDataFetcher {
// 预置的数据
String
pageTopNavPresetsData
=
CacheData
.
getChannelPresetsData
(
id
);
if
(!
StringUtils
.
isBlank
(
pageTopNavPresetsData
))
{
PageTopNavBean
pageTopNavBean
=
GsonUtils
.
fromJson
(
pageTopNavPresetsData
,
PageTopNavBean
.
class
);
PageTopNavBean
pageTopNavBean
=
JsonUtils
.
convertJsonToObject
(
pageTopNavPresetsData
,
PageTopNavBean
.
class
);
if
(
isNewsChannl
)
{
//
2023/5/18 本地无栏目数据则更新本地栏目数据
// 2023/5/18 本地无栏目数据则更新本地栏目数据
updateLocalColumnSubscriptionDb
(
pageTopNavBean
,
"1"
);
}
else
{
onTopNavDataSuccess
(
pageTopNavBean
,
isNewsChannl
);
...
...
@@ -224,7 +229,8 @@ public class ChannelDataFetcherNews extends BaseDataFetcher {
SimpleTabBean
simpleTabBean
=
new
SimpleTabBean
();
if
(
isNews
)
{
List
<
ChannelBean
>
myChannelList
=
ChannelDbHelper
.
getInstance
(
AppContext
.
getContext
()).
searchAllSelectChannel
();
List
<
ChannelBean
>
myChannelList
=
ChannelDbHelper
.
getInstance
(
AppContext
.
getContext
()).
searchAllSelectChannel
();
if
(
myChannelList
.
size
()
>
0
)
{
simpleTabBean
.
setTopNavChannelList
(
myChannelList
);
}
else
{
...
...
@@ -244,7 +250,6 @@ public class ChannelDataFetcherNews extends BaseDataFetcher {
*/
public
void
getPageInfor
(
String
pageId
)
{
CacheData
localCacheData
=
loadLocalPageInforCacheData
(
pageId
);
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
...
...
@@ -271,7 +276,7 @@ public class ChannelDataFetcherNews extends BaseDataFetcher {
return
;
}
//没缓存数据进行刷新
//
没缓存数据进行刷新
boolean
needRefresh
=
false
;
if
(
localCacheData
==
null
)
{
needRefresh
=
true
;
...
...
@@ -281,7 +286,7 @@ public class ChannelDataFetcherNews extends BaseDataFetcher {
if
(
metaBean
!=
null
)
{
dataMd5
=
metaBean
.
getMd5
();
}
//代码规范提示if里不要有复杂计算
//
代码规范提示if里不要有复杂计算
if
(
localCacheData
!=
null
&&
localCacheData
.
needRefreshByMd5
(
dataMd5
))
{
needRefresh
=
true
;
}
...
...
@@ -300,7 +305,10 @@ public class ChannelDataFetcherNews extends BaseDataFetcher {
@Override
protected
void
_onError
(
String
e
)
{
ToastNightUtil
.
showShort
(
e
);
IToast
toaster
=
ArouterServiceManager
.
provide
(
IToast
.
class
);
if
(
toaster
!=
null
)
{
toaster
.
showShort
(
e
);
}
if
(
mListener
!=
null
)
{
mListener
.
onPageDataFailed
(
"page is not exist"
);
}
...
...
@@ -308,7 +316,6 @@ public class ChannelDataFetcherNews extends BaseDataFetcher {
});
}
/**
* 获取早晚报业务数据
*/
...
...
@@ -343,7 +350,10 @@ public class ChannelDataFetcherNews extends BaseDataFetcher {
@Override
protected
void
_onError
(
String
e
)
{
ToastNightUtil
.
showShort
(
e
);
IToast
toaster
=
ArouterServiceManager
.
provide
(
IToast
.
class
);
if
(
toaster
!=
null
)
{
toaster
.
showShort
(
e
);
}
if
(
mListener
!=
null
)
{
mListener
.
onPageDataFailed
(
"page is not exist"
);
}
...
...
@@ -360,7 +370,7 @@ public class ChannelDataFetcherNews extends BaseDataFetcher {
CacheData
pageCacheData
=
CacheData
.
getLocalCacheData
(
CacheData
.
comPageInfoCacheKey
+
pageId
);
if
(
pageCacheData
!=
null
&&
!
StringUtils
.
isBlank
(
pageCacheData
.
getNetWorkData
()))
{
String
netWorkData
=
pageCacheData
.
getNetWorkData
();
PageBean
pageBean
=
GsonUtils
.
fromJson
(
netWorkData
,
PageBean
.
class
);
PageBean
pageBean
=
JsonUtils
.
convertJsonToObject
(
netWorkData
,
PageBean
.
class
);
if
(
pageBean
==
null
||
ArrayUtils
.
isEmpty
(
pageBean
.
getGroups
()))
{
return
null
;
}
...
...
@@ -379,29 +389,29 @@ public class ChannelDataFetcherNews extends BaseDataFetcher {
* 1预置数据、2本地数据、3接口数据
*/
private
synchronized
void
updateLocalColumnSubscriptionDb
(
PageTopNavBean
bean
,
String
type
)
{
// if(BuildConfig.DEBUG){
// type = "3";
// }
//使用本地数据
// if(BuildConfig.DEBUG){
// type = "3";
// }
// 使用本地数据
if
(
"2"
.
equals
(
type
))
{
//无需变化,优先首页逻辑
//
无需变化,优先首页逻辑
onTopNavDataSuccess
(
bean
,
true
);
}
//无数据
//
无数据
if
(
bean
==
null
||
bean
.
getTopNavChannelList
()
==
null
||
bean
.
getTopNavChannelList
().
size
()
==
0
)
{
Logger
.
t
(
TAG
).
d
(
"updateLocalColumnSubscriptionDb return"
);
onTopNavDataSuccess
(
bean
,
false
);
return
;
}
//获取本地数据库
//
获取本地数据库
ChannelDbHelper
helper
=
ChannelDbHelper
.
getInstance
(
AppContext
.
getContext
());
//预置数据 如果数据库已经有数据,则无需更新,数据库的数据和预置的一样
//
预置数据 如果数据库已经有数据,则无需更新,数据库的数据和预置的一样
if
(
"1"
.
equals
(
type
)
&&
helper
.
hasData
())
{
Logger
.
t
(
TAG
).
d
(
"预置数据 如果数据库已经有数据,则无需更新,数据库的数据和预置的一样"
);
onTopNavDataSuccess
(
bean
,
true
);
return
;
}
//本地数据直接获取
//
本地数据直接获取
if
(
"2"
.
equals
(
type
))
{
Logger
.
t
(
TAG
).
d
(
"本地数据"
);
List
<
ChannelBean
>
local
=
helper
.
getData
();
...
...
@@ -411,9 +421,9 @@ public class ChannelDataFetcherNews extends BaseDataFetcher {
}
Logger
.
t
(
TAG
).
d
(
local
.
size
()
+
" 本地数据大小"
);
}
else
{
//清除本地数据
//
清除本地数据
helper
.
deleteAll
();
//4.保存数据到数据库
//
4.保存数据到数据库
helper
.
save
(
bean
.
getTopNavChannelList
());
Logger
.
t
(
TAG
).
d
(
"首次数据 save:"
+
bean
.
getTopNavChannelList
().
size
());
onTopNavDataSuccess
(
bean
,
true
);
...
...
wdlayout/src/main/java/com/wd/capability/layout/ui/channel/vm/ChannelViewModel.java
View file @
33f6fe4
...
...
@@ -6,13 +6,13 @@ package com.wd.capability.layout.ui.channel.vm;
import
androidx.lifecycle.LifecycleOwner
;
import
com.orhanobut.logger.Logger
;
import
com.people.common.UIViewModel
;
import
com.people.component.comp.layoutdata.Page
;
import
com.people.component.ui.channel.model.ChannelDataFetcherNews
;
import
com.people.entity.custom.SimpleTabBean
;
import
com.people.entity.custom.comp.PageBean
;
import
com.wondertek.wheat.ability.tools.StringUtils
;
import
com.wd.base.log.Logger
;
import
com.wd.capability.layout.comp.layoutdata.Page
;
import
com.wd.capability.layout.ui.channel.model.ChannelDataFetcherNews
;
import
com.wd.foundation.bean.custom.SimpleTabBean
;
import
com.wd.foundation.bean.custom.comp.PageBean
;
import
com.wd.foundation.wdkit.mvvm.vm.BaseViewModel
;
import
com.wd.foundation.wdkitcore.tools.StringUtils
;
/**
...
...
@@ -22,7 +22,7 @@ import com.wondertek.wheat.ability.tools.StringUtils;
* @version [V1.0.0, 2021/12/8]
* @since V1.0.0
*/
public
class
ChannelViewModel
extends
UI
ViewModel
{
public
class
ChannelViewModel
extends
Base
ViewModel
{
/**
* 频道列表保存名
*/
...
...
wdlayout/src/main/java/com/wd/capability/layout/ui/channel/vm/IChannelDataListener.java
View file @
33f6fe4
...
...
@@ -4,10 +4,10 @@
package
com
.
wd
.
capability
.
layout
.
ui
.
channel
.
vm
;
import
com.people.component.comp.layoutdata.Page
;
import
com.people.entity.custom.SimpleTabBean
;
import
com.people.entity.custom.comp.PageBean
;
import
com.wondertek.wheat.component.framework.mvvm.vm.IVMCallback
;
import
com.wd.capability.layout.comp.layoutdata.Page
;
import
com.wd.foundation.bean.custom.SimpleTabBean
;
import
com.wd.foundation.bean.custom.comp.PageBean
;
import
com.wd.foundation.wdkit.mvvm.vm.IVMCallback
;
/**
* 频道页VM监听回调接口<BR>
...
...
@@ -19,10 +19,10 @@ import com.wondertek.wheat.component.framework.mvvm.vm.IVMCallback;
public
interface
IChannelDataListener
extends
IVMCallback
{
/**
*
* @param data
*/
void
onPageInforSuccess
(
PageBean
data
);
/**
* 获取页面数据返回
*
...
...
@@ -45,5 +45,4 @@ public interface IChannelDataListener extends IVMCallback {
*/
void
onPageDataFailed
(
String
error
);
}
...
...
wdlayout/src/main/java/com/wd/capability/layout/ui/channel/vm/INavChannelDataListener.java
View file @
33f6fe4
...
...
@@ -4,8 +4,8 @@
package
com
.
wd
.
capability
.
layout
.
ui
.
channel
.
vm
;
import
com.people.entity.custom.SimpleTabBean
;
import
com.wondertek.wheat.component.framework.mvvm.vm.IVMCallback
;
import
com.wd.foundation.bean.custom.SimpleTabBean
;
import
com.wd.foundation.wdkit.mvvm.vm.IVMCallback
;
/**
* 首页VM监听回调接口<BR>
...
...
wdlayout/src/main/java/com/wd/capability/layout/ui/channel/vm/IPageInforDataListener.java
View file @
33f6fe4
...
...
@@ -4,8 +4,8 @@
package
com
.
wd
.
capability
.
layout
.
ui
.
channel
.
vm
;
import
com.people.entity.custom.comp.PageBean
;
import
com.wondertek.wheat.component.framework.mvvm.vm.IVMCallback
;
import
com.wd.foundation.bean.custom.comp.PageBean
;
import
com.wd.foundation.wdkit.mvvm.vm.IVMCallback
;
/**
* 首页VM监听回调接口<BR>
...
...
wdlayout/src/main/java/com/wd/capability/layout/ui/fragment/CommonFragment.java
View file @
33f6fe4
...
...
@@ -10,13 +10,11 @@ import android.widget.FrameLayout;
import
androidx.annotation.NonNull
;
import
androidx.annotation.Nullable
;
import
com.people.common.constant.IntentConstants
;
import
com.people.component.R
;
import
com.people.component.comp.page.ItemNoTitleLayoutManager
;
import
com.people.entity.custom.MenuBean
;
import
com.wd.base.log.Logger
;
import
com.wd.capability.layout.comp.page.ItemNoTitleLayoutManager
;
import
com.wd.foundation.bean.custom.MenuBean
;
import
com.wd.foundation.wdkit.base.BaseLazyFragment
;
import
com.w
ondertek.wheat.ability.tools.SafeBundleUtil
;
import
com.w
d.foundation.wdkit.statusbar.StatusBarCompat
;
/**
* 常见碎片
...
...
wdlayout/src/main/java/com/wd/capability/layout/ui/fragment/MainFragment.java
View file @
33f6fe4
...
...
@@ -4,7 +4,6 @@
package
com
.
wd
.
capability
.
layout
.
ui
.
fragment
;
import
android.os.Bundle
;
import
android.text.TextUtils
;
import
android.view.KeyEvent
;
...
...
@@ -17,23 +16,13 @@ import androidx.annotation.NonNull;
import
androidx.annotation.Nullable
;
import
androidx.lifecycle.Observer
;
import
com.orhanobut.logger.Logger
;
import
com.people.common.analytics.GeneralTrack
;
import
com.people.common.analytics.constants.PageNameConstants
;
import
com.people.common.base.BaseFragment
;
import
com.people.common.base.BaseLazyFragment
;
import
com.people.common.constant.DefaultViewConstant
;
import
com.people.common.constant.IntentConstants
;
import
com.people.component.comp.page.ItemMenuTopLayoutManager
;
import
com.people.component.ui.channel.vm.ChannelViewModel
;
import
com.people.component.ui.channel.vm.INavChannelDataListener
;
import
com.people.entity.custom.MenuBean
;
import
com.people.entity.custom.SimpleTabBean
;
import
com.people.entity.livedate.EventMessage
;
import
com.people.livedate.EventConstants
;
import
com.people.livedate.base.LiveDataBus
;
import
com.wondertek.wheat.ability.tools.CastUtils
;
import
com.wondertek.wheat.ability.tools.SafeBundleUtil
;
import
com.wd.base.log.Logger
;
import
com.wd.capability.layout.comp.page.ItemMenuTopLayoutManager
;
import
com.wd.capability.layout.ui.channel.vm.ChannelViewModel
;
import
com.wd.foundation.bean.custom.MenuBean
;
import
com.wd.foundation.bean.custom.SimpleTabBean
;
import
com.wd.foundation.wdkit.base.BaseLazyFragment
;
import
com.wd.foundation.wdkit.constant.DefaultViewConstant
;
/**
* 页面fragment<BR>
...
...
@@ -92,7 +81,8 @@ public class MainFragment extends BaseLazyFragment {
@Override
protected
View
getJavaLayout
()
{
FrameLayout
.
LayoutParams
params
=
new
FrameLayout
.
LayoutParams
(
ViewGroup
.
LayoutParams
.
MATCH_PARENT
,
ViewGroup
.
LayoutParams
.
MATCH_PARENT
);
FrameLayout
.
LayoutParams
params
=
new
FrameLayout
.
LayoutParams
(
ViewGroup
.
LayoutParams
.
MATCH_PARENT
,
ViewGroup
.
LayoutParams
.
MATCH_PARENT
);
mRootView
=
new
FrameLayout
(
activity
);
mRootView
.
setLayoutParams
(
params
);
return
mRootView
;
...
...
@@ -101,7 +91,7 @@ public class MainFragment extends BaseLazyFragment {
@Override
protected
void
perCreate
()
{
super
.
perCreate
();
//首页启动速度用户,使用java布局
//
首页启动速度用户,使用java布局
setIsjava
(
true
);
}
...
...
@@ -117,7 +107,7 @@ public class MainFragment extends BaseLazyFragment {
mId
=
menuData
.
getNavId
();
initNavBar
(
mRootView
);
initViewModel
();
if
(
menuData
.
isSearchTab
())
{
if
(
menuData
.
isSearchTab
())
{
receiveLiveDataMsg
();
}
...
...
@@ -135,12 +125,12 @@ public class MainFragment extends BaseLazyFragment {
* 请求顶部导航栏接口
*/
public
void
request
()
{
if
(
menuData
.
isTemplate
())
{
if
(
menuData
.
isTemplate
())
{
haveDataLoadInPage
=
true
;
SimpleTabBean
tabBean
=
new
SimpleTabBean
();
tabBean
.
setTopNavChannelList
(
menuData
.
getTopNavChannelList
());
initData
(
tabBean
);
}
else
{
}
else
{
mViewModel
.
getNavData
(
mId
,
false
);
}
}
...
...
@@ -200,20 +190,21 @@ public class MainFragment extends BaseLazyFragment {
tabBean
.
parentImmerseColor
=
menuData
.
parentImmerseColor
;
mTabManager
.
setFragment
(
this
);
tabBean
.
setTabChannleId
(
mId
);
//
section.initData(tabBean);
// section.initData(tabBean);
mTabManager
.
prepareItem
(
mNavBarView
,
0
);
mTabManager
.
bindItem
(
mNavBarView
,
0
,
tabBean
);
mTabBean
=
tabBean
;
}
@Override
public
void
onDestroy
()
{
super
.
onDestroy
();
Logger
.
t
(
TAG
).
i
(
"onDestroy."
);
if
(
menuData
!=
null
&&
menuData
.
isSearchTab
()){
LiveDataBus
.
getInstance
().
with
(
EventConstants
.
SEARCH_POST_KEYWORD_TAB
,
EventMessage
.
class
).
removeObservers
(
this
);
if
(
menuData
!=
null
&&
menuData
.
isSearchTab
())
{
LiveDataBus
.
getInstance
()
.
with
(
EventConstants
.
SEARCH_POST_KEYWORD_TAB
,
EventMessage
.
class
)
.
removeObservers
(
this
);
}
}
...
...
@@ -221,24 +212,28 @@ public class MainFragment extends BaseLazyFragment {
* 初始化LiveData监听
*/
private
void
initLiveData
()
{
LiveDataBus
.
getInstance
().
with
(
EventConstants
.
SHORT_VIDEO_SWITCH_FULL
,
String
.
class
).
observe
(
getViewLifecycleOwner
(),
result
->
{
if
(
"1"
.
equals
(
result
))
{
// 横屏
mTabManager
.
changeOrientation
(
true
);
}
else
{
mTabManager
.
changeOrientation
(
false
);
}
});
LiveDataBus
.
getInstance
()
.
with
(
EventConstants
.
SHORT_VIDEO_SWITCH_FULL
,
String
.
class
)
.
observe
(
getViewLifecycleOwner
(),
result
->
{
if
(
"1"
.
equals
(
result
))
{
// 横屏
mTabManager
.
changeOrientation
(
true
);
}
else
{
mTabManager
.
changeOrientation
(
false
);
}
});
// 接收画中画,处理首页view事件
LiveDataBus
.
getInstance
().
with
(
EventConstants
.
HOME_PICTURE_IN_PICTURE
,
Boolean
.
class
).
observe
(
getViewLifecycleOwner
(),
result
->
{
if
(
result
)
{
// 横屏
mTabManager
.
changeOrientation
(
true
);
}
else
{
// 竖屏
mTabManager
.
changeOrientation
(
false
);
}
});
LiveDataBus
.
getInstance
()
.
with
(
EventConstants
.
HOME_PICTURE_IN_PICTURE
,
Boolean
.
class
)
.
observe
(
getViewLifecycleOwner
(),
result
->
{
if
(
result
)
{
// 横屏
mTabManager
.
changeOrientation
(
true
);
}
else
{
// 竖屏
mTabManager
.
changeOrientation
(
false
);
}
});
}
@Override
...
...
@@ -270,7 +265,7 @@ public class MainFragment extends BaseLazyFragment {
if
(
mTabManager
!=
null
)
{
LiveDataBus
.
getInstance
().
with
(
EventConstants
.
HOME_TAB_BACKGROUND_THEME
).
postValue
(
false
);
if
(
menuData
!=
null
)
{
if
(
menuData
!=
null
)
{
if
(
menuData
.
isTabVideo
())
{
mTabManager
.
checkLiveRedMark
();
...
...
@@ -283,15 +278,15 @@ public class MainFragment extends BaseLazyFragment {
int
statusBarColor
=
menuData
.
getStatusBarColor
();
changePhoneStatusBarWhiteOrBlack
(
statusBarColor
==
0
);
// 埋点
String
pageName
=
""
;
String
pageName
=
""
;
if
(
menuData
.
isTabRMH
())
{
pageName
=
PageNameConstants
.
TAB_TWO
;
}
else
if
(
menuData
.
isTabVideo
()
)
{
}
else
if
(
menuData
.
isTabVideo
())
{
pageName
=
PageNameConstants
.
TAB_THREE
;
}
else
if
(
menuData
.
isTabService
()
)
{
}
else
if
(
menuData
.
isTabService
())
{
pageName
=
PageNameConstants
.
TAB_FOUR
;
}
if
(!
TextUtils
.
isEmpty
(
pageName
))
{
if
(!
TextUtils
.
isEmpty
(
pageName
))
{
GeneralTrack
.
getInstance
().
barClick
(
menuData
.
getTitle
(),
menuData
.
getNavId
());
}
...
...
@@ -300,7 +295,6 @@ public class MainFragment extends BaseLazyFragment {
}
/**
* 切换频道
*/
...
...
@@ -312,7 +306,6 @@ public class MainFragment extends BaseLazyFragment {
}
}
public
void
grayUiPage
()
{
if
(
mTabManager
!=
null
)
{
...
...
@@ -334,13 +327,13 @@ public class MainFragment extends BaseLazyFragment {
*/
private
void
receiveLiveDataMsg
()
{
LiveDataBus
.
getInstance
()
.
with
(
EventConstants
.
SEARCH_POST_KEYWORD_TAB
,
EventMessage
.
class
)
.
observe
(
getViewLifecycleOwner
(),
new
Observer
<
EventMessage
>()
{
@Override
public
void
onChanged
(
EventMessage
mEventMessage
)
{
menuData
=
(
MenuBean
)
mEventMessage
.
getSerializableExtra
(
IntentConstants
.
PAGE_INFOR_DATA
);
request
();
}
});
.
with
(
EventConstants
.
SEARCH_POST_KEYWORD_TAB
,
EventMessage
.
class
)
.
observe
(
getViewLifecycleOwner
(),
new
Observer
<
EventMessage
>()
{
@Override
public
void
onChanged
(
EventMessage
mEventMessage
)
{
menuData
=
(
MenuBean
)
mEventMessage
.
getSerializableExtra
(
IntentConstants
.
PAGE_INFOR_DATA
);
request
();
}
});
}
}
...
...
wdlayout/src/main/java/com/wd/capability/layout/ui/fragment/NewsHomeFragment.java
View file @
33f6fe4
...
...
@@ -4,7 +4,6 @@
package
com
.
wd
.
capability
.
layout
.
ui
.
fragment
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -18,28 +17,20 @@ import android.widget.FrameLayout;
import
androidx.annotation.NonNull
;
import
androidx.annotation.Nullable
;
import
com.orhanobut.logger.Logger
;
import
com.people.common.ProcessUtils
;
import
com.people.common.analytics.GeneralTrack
;
import
com.people.common.analytics.constants.PageNameConstants
;
import
com.people.common.base.BaseFragment
;
import
com.people.common.base.BaseLazyFragment
;
import
com.people.common.constant.DefaultViewConstant
;
import
com.people.common.constant.IntentConstants
;
import
com.people.component.comp.layoutmanager.ItemLayoutManager
;
import
com.people.component.comp.page.ItemErrorSubjectLayoutManager
;
import
com.people.component.comp.page.ItemNewsHomeMenuTopLayoutManager
;
import
com.people.component.ui.channel.vm.ChannelViewModel
;
import
com.people.component.ui.channel.vm.INavChannelDataListener
;
import
com.people.entity.custom.MenuBean
;
import
com.people.entity.custom.SimpleTabBean
;
import
com.people.livedate.EventConstants
;
import
com.people.livedate.base.LiveDataBus
;
import
com.people.room.ChannelDbHelper
;
import
com.people.room.entity.ChannelBean
;
import
com.wondertek.wheat.ability.tools.AppContext
;
import
com.wondertek.wheat.ability.tools.CastUtils
;
import
com.wondertek.wheat.ability.tools.SafeBundleUtil
;
import
com.wd.base.log.Logger
;
import
com.wd.capability.layout.comp.layoutmanager.ItemLayoutManager
;
import
com.wd.capability.layout.comp.page.ItemErrorSubjectLayoutManager
;
import
com.wd.capability.layout.comp.page.ItemNewsHomeMenuTopLayoutManager
;
import
com.wd.capability.layout.ui.channel.vm.ChannelViewModel
;
import
com.wd.capability.layout.ui.channel.vm.INavChannelDataListener
;
import
com.wd.foundation.bean.custom.MenuBean
;
import
com.wd.foundation.bean.custom.SimpleTabBean
;
import
com.wd.foundation.bean.response.ChannelBean
;
import
com.wd.foundation.wdkit.base.BaseFragment
;
import
com.wd.foundation.wdkit.base.BaseLazyFragment
;
import
com.wd.foundation.wdkit.constant.DefaultViewConstant
;
import
com.wd.foundation.wdkitcore.livedata.LiveDataBus
;
import
com.wd.foundation.wdkitcore.tools.AppContext
;
/**
* 页面fragment
...
...
@@ -101,7 +92,8 @@ public class NewsHomeFragment extends BaseLazyFragment {
@Override
protected
View
getJavaLayout
()
{
FrameLayout
.
LayoutParams
params
=
new
FrameLayout
.
LayoutParams
(
ViewGroup
.
LayoutParams
.
MATCH_PARENT
,
ViewGroup
.
LayoutParams
.
MATCH_PARENT
);
FrameLayout
.
LayoutParams
params
=
new
FrameLayout
.
LayoutParams
(
ViewGroup
.
LayoutParams
.
MATCH_PARENT
,
ViewGroup
.
LayoutParams
.
MATCH_PARENT
);
mRootView
=
new
FrameLayout
(
activity
);
mRootView
.
setLayoutParams
(
params
);
return
mRootView
;
...
...
@@ -110,7 +102,7 @@ public class NewsHomeFragment extends BaseLazyFragment {
@Override
protected
void
perCreate
()
{
super
.
perCreate
();
//首页启动速度用户,使用java布局
//
首页启动速度用户,使用java布局
setIsjava
(
true
);
}
...
...
@@ -127,25 +119,24 @@ public class NewsHomeFragment extends BaseLazyFragment {
initNavBar
(
mRootView
);
initViewModel
();
LiveDataBus
.
getInstance
().
with
(
EventConstants
.
TWO_PAGE_REFRESH
+
mId
,
Boolean
.
class
).
observe
(
getViewLifecycleOwner
(),
aBoolean
->
{
if
(
aBoolean
)
{
request
();
}
});
LiveDataBus
.
getInstance
()
.
with
(
EventConstants
.
TWO_PAGE_REFRESH
+
mId
,
Boolean
.
class
)
.
observe
(
getViewLifecycleOwner
(),
aBoolean
->
{
if
(
aBoolean
)
{
request
();
}
});
}
}
@Override
protected
void
lazyLoadData
()
{
request
();
}
/**
* 请求顶部导航栏接口
*/
...
...
@@ -228,10 +219,8 @@ public class NewsHomeFragment extends BaseLazyFragment {
mTabManager
.
bindItem
(
mRootView
,
0
,
menuBean
);
}
}
@Override
public
void
onDestroy
()
{
super
.
onDestroy
();
...
...
@@ -263,66 +252,72 @@ public class NewsHomeFragment extends BaseLazyFragment {
*/
private
void
initLiveData
()
{
//频道编辑完成事件
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
;
}
// 频道编辑完成事件
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
);
mTabManager
.
bindItem
(
mNavBarView
,
0
,
mTabBean
);
}
});
}
});
// 接收临时频道数据
LiveDataBus
.
getInstance
().
with
(
EventConstants
.
COLUMN_NAVIGATION_DATACHANGE_ADD
,
ChannelBean
.
class
).
observe
(
getViewLifecycleOwner
(),
result
->
{
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
(
mTabManager
!=
null
&&
mTabBean
!=
null
)
{
if
(
tempAddList
==
null
)
{
tempAddList
=
new
ArrayList
<>();
}
if
(
isAdd
)
{
// 检测是否有重复的
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
);
}
}
else
{
tempAddList
.
add
(
result
);
}
// 获取我的频道数据
List
<
ChannelBean
>
myChannelList
=
ChannelDbHelper
.
getInstance
(
AppContext
.
getContext
()).
searchAllSelectChannel
();
// 增加个临时频道
myChannelList
.
addAll
(
tempAddList
);
// 获取我的频道数据
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
(
result
.
isSpecialChannel
())
{
// 特殊频道跳转方法
ProcessUtils
.
specialChannelJumpPage
(
result
);
}
else
{
// 设置跳转频道id
menuData
.
jumpChannelId
=
result
.
getChannelId
();
}
mTabBean
.
setTopNavChannelList
(
myChannelList
);
mTabManager
.
bindItem
(
mNavBarView
,
0
,
mTabBean
);
}
});
});
}
@Override
...
...
@@ -377,10 +372,8 @@ public class NewsHomeFragment extends BaseLazyFragment {
mTabManager
.
onResume
();
}
}
/**
* 切换频道
*/
...
...
@@ -392,7 +385,6 @@ public class NewsHomeFragment extends BaseLazyFragment {
}
}
/**
* 切换到默认tab
*/
...
...
wdlayout/src/main/java/com/wd/capability/layout/ui/fragment/TemplateMainFragment.java
View file @
33f6fe4
...
...
@@ -17,23 +17,12 @@ import androidx.annotation.NonNull;
import
androidx.annotation.Nullable
;
import
androidx.lifecycle.Observer
;
import
com.orhanobut.logger.Logger
;
import
com.people.common.analytics.GeneralTrack
;
import
com.people.common.analytics.constants.PageNameConstants
;
import
com.people.common.base.BaseFragment
;
import
com.people.common.base.BaseLazyFragment
;
import
com.people.common.constant.DefaultViewConstant
;
import
com.people.common.constant.IntentConstants
;
import
com.people.component.comp.page.TemplateMenuTopLayoutManager
;
import
com.people.component.ui.channel.vm.ChannelViewModel
;
import
com.people.component.ui.channel.vm.INavChannelDataListener
;
import
com.people.entity.custom.MenuBean
;
import
com.people.entity.custom.SimpleTabBean
;
import
com.people.entity.livedate.EventMessage
;
import
com.people.livedate.EventConstants
;
import
com.people.livedate.base.LiveDataBus
;
import
com.wondertek.wheat.ability.tools.CastUtils
;
import
com.wondertek.wheat.ability.tools.SafeBundleUtil
;
import
com.wd.capability.layout.comp.page.TemplateMenuTopLayoutManager
;
import
com.wd.capability.layout.ui.channel.vm.ChannelViewModel
;
import
com.wd.foundation.bean.custom.MenuBean
;
import
com.wd.foundation.bean.custom.SimpleTabBean
;
import
com.wd.foundation.wdkit.base.BaseLazyFragment
;
/**
* 页面fragment<BR> 我的留言tab、搜索结果页tab
...
...
wdlayout/src/main/java/com/wd/foundation/wdkit/datafetcher/BaseDataFetcher.java
0 → 100644
View file @
33f6fe4
/*
* Copyright (c) Wondertek Technologies Co., Ltd. 2019-2022. All rights reserved.
*/
package
com
.
wd
.
foundation
.
wdkit
.
datafetcher
;
import
java.util.HashMap
;
import
com.wd.base.log.Logger
;
import
com.wd.capability.network.BaseObserver
;
import
com.wd.capability.network.RetrofitClient
;
import
com.wd.capability.network.constant.ParameterConstant
;
import
com.wd.foundation.wdkitcore.tools.JsonUtils
;
import
io.reactivex.Observable
;
import
okhttp3.MediaType
;
import
okhttp3.RequestBody
;
/**
* 描述:获取数据
*
* @author : lvjinhui
* @since: 2022/6/21
*/
public
abstract
class
BaseDataFetcher
implements
IDataFetcher
<
IRequestApi
>
{
@Override
public
RequestBody
getBody
(
String
paramsJson
)
{
Logger
.
t
(
getLogTag
()).
d
(
"---请求data---"
+
paramsJson
);
MediaType
mediaType
=
MediaType
.
Companion
.
parse
(
ParameterConstant
.
HEADER_JSON_TYPE
);
RequestBody
body
=
RequestBody
.
Companion
.
create
(
paramsJson
,
mediaType
);
return
body
;
}
@Override
public
RequestBody
getBody
(
Object
object
)
{
String
requestJson
=
JsonUtils
.
convertObjectToJson
(
object
);
Logger
.
t
(
getLogTag
()).
d
(
"---请求data---"
+
requestJson
);
MediaType
mediaType
=
MediaType
.
Companion
.
parse
(
ParameterConstant
.
HEADER_JSON_TYPE
);
RequestBody
body
=
RequestBody
.
Companion
.
create
(
requestJson
,
mediaType
);
return
body
;
}
@Override
public
RequestBody
getBody
(
HashMap
<
String
,
Object
>
map
)
{
String
requestJson
=
JsonUtils
.
convertObjectToJson
(
map
);
Logger
.
t
(
getLogTag
()).
d
(
"---请求data---"
+
requestJson
);
MediaType
mediaType
=
MediaType
.
Companion
.
parse
(
ParameterConstant
.
HEADER_JSON_TYPE
);
RequestBody
requestBody
=
RequestBody
.
Companion
.
create
(
requestJson
,
mediaType
);
return
requestBody
;
}
@Override
public
IRequestApi
getRetrofit
()
{
return
RetrofitClient
.
getInstance
().
create
(
IRequestApi
.
class
);
}
/**
* 请求封装
*
* @param observable
* @param baseObserver
* @param <T>
*/
@Override
public
<
T
>
void
request
(
Observable
observable
,
BaseObserver
<
T
>
baseObserver
)
{
RetrofitClient
.
execute
(
observable
,
baseObserver
);
}
public
abstract
String
getLogTag
();
}
...
...
wdlayout/src/main/java/com/wd/foundation/wdkit/datafetcher/IDataFetcher.java
0 → 100644
View file @
33f6fe4
/*
* Copyright (c) Wondertek Technologies Co., Ltd. 2019-2022. All rights reserved.
*/
package
com
.
wd
.
foundation
.
wdkit
.
datafetcher
;
import
java.util.HashMap
;
import
com.wd.capability.network.BaseObserver
;
import
io.reactivex.Observable
;
import
okhttp3.RequestBody
;
/**
* 描述:
*
* @author : lvjinhui
* @since: 2022/6/21
* @param <T>
*/
public
interface
IDataFetcher
<
T
>
{
/**
* 获取body
*
* @param map
* @return RequestBody
*/
RequestBody
getBody
(
HashMap
<
String
,
Object
>
map
);
/**
* 获取body
*
* @param object
* @return RequestBody
*/
RequestBody
getBody
(
Object
object
);
/**
* 获取body
*
* @param params
* @return RequestBody
*/
RequestBody
getBody
(
String
params
);
/**
* 接口定义
*
* @return T
*/
T
getRetrofit
();
/**
* 发送请求
*
* @param observable
* @param baseObserver
* @param <D>
*/
<
D
>
void
request
(
Observable
observable
,
BaseObserver
<
D
>
baseObserver
);
}
...
...
wdlayout/src/main/java/com/wd/foundation/wdkit/datafetcher/IRequestApi.java
0 → 100644
View file @
33f6fe4
/*
* Copyright (c) Wondertek Technologies Co., Ltd. 2019-2022. All rights reserved.
*/
package
com
.
wd
.
foundation
.
wdkit
.
datafetcher
;
import
java.util.List
;
import
com.wd.capability.network.response.BaseResponse
;
import
io.reactivex.Observable
;
import
retrofit2.http.GET
;
/**
* 请求的接口
*
* @author shishuagnxi
*/
public
interface
IRequestApi
{
/**
* 获取隐私政策和协议
* http://180.167.180.242:7866/project/3466/interface/api/182973
* /display/zh/c/agreement
*/
@GET
(
"api/rmrb-bff-display-zh/display/zh/c/agreement"
)
Observable
<
BaseResponse
<
List
<?>>>
getAppAgreement
();
}
...
...
wdlayout/src/main/res/layout/wdlayout_item_layout_placeholder.xml
0 → 100644
View file @
33f6fe4
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/wdkit_dp30"
>
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:gravity=
"center"
android:text=
"敬请期待 >"
/>
<View
android:layout_width=
"match_parent"
android:layout_marginLeft=
"@dimen/wdkit_dp16"
android:layout_marginRight=
"@dimen/wdkit_dp16"
android:layout_height=
"@dimen/wdkit_dp1"
android:layout_gravity=
"bottom"
android:background=
"@color/res_color_common_C7"
/>
</FrameLayout>
\ No newline at end of file
...
...
Please
register
or
login
to post a comment