Commit 07b6d943 by 刘鹏

feat: 1. 云信ResponseService崩溃问题修复

2.首页IndexOutOfBoundsException问题修复
parent e0af8ed2
ext {
dev_mode = false//组件发布的时候需要设置为false
dev_mode = true//组件发布的时候需要设置为false
ydl2PublishVersion = "0.2.0.17"
ydlPublishVersion = [
// -------------- 业务模块 --------------
......
......@@ -5,7 +5,6 @@ import android.content.Context
import android.graphics.Color
import android.graphics.Typeface
import android.media.MediaPlayer
import android.os.Build
import android.text.TextUtils
import android.view.View
import android.widget.FrameLayout
......@@ -53,8 +52,6 @@ import kotlinx.android.synthetic.ydl.home_fragment.tab_layout
import kotlinx.android.synthetic.ydl.home_muse_view.*
import kotlinx.android.synthetic.ydl.home_muse_view.view.*
import java.util.concurrent.TimeUnit
import kotlin.properties.Delegates
/**
......@@ -136,7 +133,7 @@ open class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterIm
private fun initAdapter() {
mPresenter?.localHomeData(mContext, "home_data.json")
adapter = YdlHomeAdapter(mContext, homeEvent!!, ArrayList())
adapter = homeEvent?.let { YdlHomeAdapter(mContext, it, ArrayList()) }
val layoutManager = LinearLayoutManager(context)
home_module_fragment_recycler.layoutManager = layoutManager
home_module_fragment_recycler.adapter = adapter
......@@ -147,11 +144,13 @@ open class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterIm
open fun initRvListener() {
if (HomeViewConfig.getOrder().bannerIndex != -1) {
home_module_fragment_recycler.addOnScrollListener(
homeEvent!!.onPageScroll(
view_rl_top_bg
)!!
)
homeEvent?.onPageScroll(
view_rl_top_bg
)?.let {
home_module_fragment_recycler.addOnScrollListener(
it
)
}
}
scrollListner = HomeConfideRecyleSuspendListener()
home_module_fragment_recycler.addOnScrollListener(scrollListner)
......@@ -272,7 +271,7 @@ open class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterIm
scrollListner.setHomeView(this)
scrollListner.setConfideFilterView(ll_layout)
scrollListner.setConsultFilterView(ll_consultLayout)
scrollListner.setSectionAdapter(adapter!!)
adapter?.let { scrollListner.setSectionAdapter(it) }
scrollListner.setPhoneCallImageView(home_service_call)
}
......@@ -302,24 +301,30 @@ open class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterIm
//展示活动数据
val act = homeHeaderBean.activityResponse
if (act != null) {
act?.let { act ->
if (!TextUtils.isEmpty(act.imageUrl)) {
img_ad.visibility = View.VISIBLE
ActionCountUtils.count(HomeBIConstants.YDL_HOME_SEARCH_TAG,act.title?:"1")
ActionCountUtils.count(HomeBIConstants.YDL_HOME_SEARCH_TAG, act.title ?: "1")
GlideApp.with(this).load(act!!.imageUrl).into(img_ad)
GlideApp.with(this).load(act.imageUrl).into(img_ad)
img_ad.setOnClickListener {
if (Utils.isFastClick()) {
//防止连击
return@setOnClickListener
}
if (act.btnLinkurl != null && act.btnLinkurl!!.startsWith("http")) {
NewH5Activity.start(activity, H5Params(act.btnLinkurl!!, null))
} else {
YDLRouterManager.router(act.btnLinkurl)
act.btnLinkurl?.let { btnLinkurl ->
if (btnLinkurl.startsWith("http")) {
NewH5Activity.start(activity, H5Params(btnLinkurl, null))
} else {
YDLRouterManager.router(btnLinkurl)
}
//定制咨询点击事件埋点
ActionCountUtils.count(
HomeBIConstants.YDL_HOME_SEARCH_TAG_CLICK,
act.title ?: "1"
)
}
//定制咨询点击事件埋点
ActionCountUtils.count(HomeBIConstants.YDL_HOME_SEARCH_TAG_CLICK,act.title?:"1")
}
} else {
img_ad.visibility = View.GONE
......@@ -340,7 +345,7 @@ open class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterIm
if (!TextUtils.isEmpty(act.imageBanner)) {
//展示弹窗
if (aa == null) {
ActionCountUtils.count(HomeBIConstants.YDL_HOME_POPUPWINDOWS_PAGE_POPUP,act?.title?:"1")
ActionCountUtils.count(HomeBIConstants.YDL_HOME_POPUPWINDOWS_PAGE_POPUP,act?.title ?: "1")
aa = ActivityDialog(mActivity, act.imageBanner, act.linkUrl, act.title)
aa?.show()
aa?.setOnDismissListener {
......@@ -361,7 +366,7 @@ open class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterIm
//更新首页数据
adapter?.updateItems(list)
if (!TextUtils.isEmpty(list[0].headerBean?.doctorName)) {
doctorName = list[0].headerBean?.doctorName!!
doctorName = list[0].headerBean?.doctorName.toString()
initSearchBar()
}
......@@ -372,9 +377,9 @@ open class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterIm
for (bean in list) {
//咨询模块
if (bean.type == HomeViewConfig.getOrder().bannerIndex) {
initTabLayout(bean.headerBean!!.listenCategoryDate)
initConsultTabLayout(bean.headerBean!!.consultCategoryData)
consultLastSelectType = bean.headerBean!!.consultCategoryData!![0].id.toString()
initTabLayout(bean.headerBean?.listenCategoryDate)
initConsultTabLayout(bean.headerBean?.consultCategoryData)
consultLastSelectType = bean.headerBean?.consultCategoryData?.get(0)?.id.toString()
}
}
}
......@@ -384,19 +389,22 @@ open class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterIm
*/
private fun initTabLayout(listenCategoryDate: List<HomeHeaderBean.ListenCategoryDateBean>?) {
if (confideTabListener == null) {
confideTabListener = ConfideExpertTabSelectedListener(listenCategoryDate!!, tab_layout)
tab_layout.addOnTabSelectedListener(confideTabListener!!)
confideTabListener =
listenCategoryDate?.let { ConfideExpertTabSelectedListener(it, tab_layout) }
tab_layout.addOnTabSelectedListener(confideTabListener)
}
tab_layout.removeAllTabs()
for ((index, bean) in listenCategoryDate!!.withIndex()) {
tab_layout.addTab(
tab_layout.newTab().setText(bean.name),
index == confideLastSelectPosition
)
if (listenCategoryDate != null) {
for ((index, bean) in listenCategoryDate.withIndex()) {
tab_layout.addTab(
tab_layout.newTab().setText(bean.name),
index == confideLastSelectPosition
)
}
}
var textView =
((tab_layout!!.getChildAt(0) as LinearLayout).getChildAt(confideLastSelectPosition) as LinearLayout).getChildAt(
((tab_layout.getChildAt(0) as LinearLayout).getChildAt(confideLastSelectPosition) as LinearLayout).getChildAt(
1
)
if (textView != null && textView is TextView) {
......@@ -412,16 +420,17 @@ open class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterIm
private fun initConsultTabLayout(listenCategoryDate: List<HomeHeaderBean.ConsultCategoryDateBean>?) {
if (consultTabListener == null) {
consultTabListener =
ConsultExpertTabSelectedListener(listenCategoryDate!!, tab_consultLayout)
tab_consultLayout.addOnTabSelectedListener(consultTabListener!!)
listenCategoryDate?.let { ConsultExpertTabSelectedListener(it, tab_consultLayout) }
tab_consultLayout.addOnTabSelectedListener(consultTabListener)
}
if (null == consultCategoryDate) {
consultCategoryDate = ArrayList()
}
//如果 数据不变 则不重新构建
if (null != listenCategoryDate && consultCategoryDate!!.size == listenCategoryDate.size && consultCategoryDate!!.retainAll(
if (null != listenCategoryDate && consultCategoryDate!!.size == listenCategoryDate.size && consultCategoryDate?.retainAll(
listenCategoryDate
)
) == true
) {
return
}
......@@ -430,14 +439,16 @@ open class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterIm
consultCategoryDate?.addAll(listenCategoryDate)
}
tab_consultLayout.removeAllTabs()
for ((index, bean) in listenCategoryDate!!.withIndex()) {
tab_consultLayout.addTab(
tab_consultLayout.newTab().setText(bean.name),
index == confideLastSelectPosition
)
if (listenCategoryDate != null) {
for ((index, bean) in listenCategoryDate.withIndex()) {
tab_consultLayout.addTab(
tab_consultLayout.newTab().setText(bean.name),
index == confideLastSelectPosition
)
}
}
val textView = ((tab_consultLayout!!.getChildAt(0) as LinearLayout).getChildAt(
val textView = ((tab_consultLayout.getChildAt(0) as LinearLayout).getChildAt(
confideLastSelectPosition
) as LinearLayout).getChildAt(1)
if (textView != null && textView is TextView) {
......@@ -589,39 +600,47 @@ open class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterIm
override fun onTabUnselected(tab: TabLayout.Tab?) {
var textView =
((tabLayout!!.getChildAt(0) as LinearLayout).getChildAt(tab!!.position) as LinearLayout).getChildAt(
(tab?.position?.let { (tabLayout?.getChildAt(0) as LinearLayout).getChildAt(it) } as LinearLayout).getChildAt(
1
)
if (textView != null && textView is TextView) {
textView.textSize = 15f
textView.setTextColor(
activity?.let {
ContextCompat.getColor(
activity!!,
it,
R.color.platform_color_333333
)
)
}?.let {
textView.setTextColor(
it
)
}
}
}
override fun onTabSelected(tab: TabLayout.Tab?) {
if (tab!!.position == consultLastSelectPosition) {
if (tab?.position == consultLastSelectPosition) {
return
}
var textView =
((tabLayout!!.getChildAt(0) as LinearLayout).getChildAt(tab!!.position) as LinearLayout).getChildAt(
(tab?.position?.let { (tabLayout?.getChildAt(0) as LinearLayout).getChildAt(it) } as LinearLayout).getChildAt(
1
)
if (textView != null && textView is TextView) {
textView.textSize = 17f
textView.setTextColor(
activity?.let {
ContextCompat.getColor(
activity!!,
it,
R.color.platform_color_242424
)
)
}?.let {
textView.setTextColor(
it
)
}
textView.typeface = Typeface.defaultFromStyle(Typeface.BOLD)
}
homeEvent!!.getConsultData(list!![tab!!.position], tab!!.position)
list?.get(tab.position)?.let { homeEvent?.getConsultData(it, tab.position) }
}
}
......@@ -639,40 +658,48 @@ open class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterIm
override fun onTabUnselected(tab: TabLayout.Tab?) {
var textView =
((tabLayout!!.getChildAt(0) as LinearLayout).getChildAt(tab!!.position) as LinearLayout).getChildAt(
(tab?.let { (tabLayout?.getChildAt(0) as LinearLayout).getChildAt(it.position) } as LinearLayout).getChildAt(
1
)
if (textView != null && textView is TextView) {
textView.textSize = 15f
textView.setTextColor(
activity?.let {
ContextCompat.getColor(
activity!!,
it,
R.color.platform_color_333333
)
)
}?.let {
textView.setTextColor(
it
)
}
}
}
override fun onTabSelected(tab: TabLayout.Tab?) {
if (tab!!.position == confideLastSelectPosition) {
if (tab?.position == confideLastSelectPosition) {
return
}
var textView =
((tabLayout!!.getChildAt(0) as LinearLayout).getChildAt(tab!!.position) as LinearLayout).getChildAt(
(tab?.let { (tabLayout?.getChildAt(0) as LinearLayout).getChildAt(it.position) } as LinearLayout).getChildAt(
1
)
if (textView != null && textView is TextView) {
textView.textSize = 17f
textView.setTextColor(
activity?.let {
ContextCompat.getColor(
activity!!,
it,
R.color.platform_color_242424
)
)
}?.let {
textView.setTextColor(
it
)
}
textView.typeface = Typeface.defaultFromStyle(Typeface.BOLD)
}
homeEvent!!.getConfideData(list!![tab!!.position], tab!!.position)
list?.get(tab.position)?.let { homeEvent?.getConfideData(it, tab.position) }
}
}
......
......@@ -82,7 +82,9 @@ class NimSDKOptionConfig {
options.shouldConsiderRevokedMessageUnreadCount = true;
options.mixPushConfig = buildMixPushConfig(configBean);
//https://faq.yunxin.163.com/kb/main/#/item/KB0373
//disableAwake为true来禁止后台进程唤醒UI进程。
options.disableAwake = true;
return options;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment