Commit 07b6d943 by 刘鹏

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

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