Commit 3a05587f by 霍志良

feat:升级Home组件

parent e7340c1f
ext {
dev_mode = false //组件发布的时候需要设置为false
ydl2PublishVersion = "0.2.0.9-SNAPSHOT"
ydl2PublishVersion = "0.2.0.10-SNAPSHOT"
ydlPublishVersion = [
// -------------- 业务模块 --------------
//第三步 若干
......
......@@ -32,6 +32,7 @@ import com.yidianling.consultant.adapter.SearchWordsAdapter
import com.yidianling.consultant.api.IConsultantService
import com.yidianling.consultant.bean.*
import com.yidianling.consultant.constants.ConsultBIConstants
import com.yidianling.consultant.constants.ConsultBIConstants.ConsultEvent.Companion.SEARCH_BANNERWORD_CLICK
import com.yidianling.consultant.contract.IHotSearchContract
import com.yidianling.consultant.model.bean.FunctionWordBean
import com.yidianling.consultant.modular.utils.ConsultAssistantEntryUtils
......@@ -318,7 +319,7 @@ class HotSearchActivity : BaseMvpActivity<IHotSearchContract.View, IHotSearchCon
.inflate(R.layout.consultant_item_expert_hot_search, flHotSearch, false)
view.tvHotSearch.text = wordList[index].word
view.setOnClickListener {
ActionCountUtils.count(HOT_SEARCH_DOCTOR_NAME, wordList[index].word!!, "热门搜索")
ActionCountUtils.count(SEARCH_BANNERWORD_CLICK, wordList[index].word!!, "热门搜索")
getSearchWords(wordList[index].word!!, true)
}
flHotSearch.addView(view)
......@@ -361,7 +362,7 @@ class HotSearchActivity : BaseMvpActivity<IHotSearchContract.View, IHotSearchCon
}
}
view.setOnClickListener {
ActionCountUtils.count(HOT_SEARCH_DOCTOR_NAME, etSearch.text.toString(), "热门专家")
ActionCountUtils.count(SEARCH_BANNERWORD_CLICK, etSearch.text.toString(), "热门专家")
getSearchWords(etSearch.text.toString(), true)
}
flHotExpert.addView(view)
......@@ -425,7 +426,7 @@ class HotSearchActivity : BaseMvpActivity<IHotSearchContract.View, IHotSearchCon
}
view.setOnClickListener {
//历史搜索
ActionCountUtils.count(HOT_SEARCH_DOCTOR_NAME, historyStr, "历史搜索")
ActionCountUtils.count(SEARCH_BANNERWORD_CLICK, historyStr, "历史搜索")
getSearchWords(historyStr, true)
}
fl_search_history.addView(view)
......
......@@ -22,7 +22,9 @@ import com.ydl.ydlcommon.utils.StatusBarUtils
import com.ydl.ydlcommon.utils.Utils
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.utils.remind.ToastHelper
import com.yidianling.consultant.OnBottomWordListener
import com.yidianling.consultant.api.IConsultantService
import com.yidianling.consultant.bean.FunctionWordConsultBean
import com.yidianling.home.R
import com.yidianling.home.adapter.YdlHomeAdapter
import com.yidianling.home.constants.HomeBIConstants
......@@ -37,9 +39,14 @@ import com.yidianling.home.presenter.HomePresenterImpl
import com.yidianling.home.ui.view.CouponDialog
import com.yidianling.im.api.service.IImService
import com.yidianling.user.api.service.IUserService
import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
import io.reactivex.schedulers.Schedulers
import kotlinx.android.synthetic.xlzx.home_fragment_home_module.*
import kotlinx.android.synthetic.xlzx.home_layout_home_module_content.*
import kotlinx.android.synthetic.xlzx.home_layout_home_module_input.*
import java.util.concurrent.TimeUnit
import kotlin.properties.Delegates
......@@ -86,6 +93,8 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>()
private var isFromCreate: Boolean = true
var startTime = System.currentTimeMillis()
var endTime by Delegates.notNull<Long>()
private lateinit var bottomWordlist: List<FunctionWordConsultBean>
var bottomWordDisposable: Disposable? = null
override fun layoutResId(): Int {
return R.layout.home_fragment_home_module
}
......@@ -100,6 +109,7 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>()
homeEvent = HomeImpl(mActivity!!, this)
initView()
initAdapter()
getBottomWord()
}
private fun initAdapter() {
......@@ -126,7 +136,7 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>()
)
home_swipe_refresh_layout.setProgressViewOffset(false, 0, 200)
home_swipe_refresh_layout.isEnabled = true
etSearch.setOnClickListener { homeEvent?.searchTvClick("") }
etSearch.setOnClickListener { homeEvent?.searchTvClick(etSearch.hint.toString()) }
home_page_xiaoyi.setOnClickListener {
activity?.let {
......@@ -377,4 +387,33 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>()
showConsultAssistantDialog()
}
}
private fun getBottomWord() {
ModularServiceManager.provide(IConsultantService::class.java)
.getbottomWord(2, object : OnBottomWordListener {
override fun onBottomWord(wordList: List<FunctionWordConsultBean>) {
bottomWordlist = wordList!!
if (bottomWordlist.isNullOrEmpty()) return
if (bottomWordlist.size == 1) {
etSearch.hint = bottomWordlist[0].word
} else {
if (bottomWordDisposable != null) {
bottomWordDisposable?.dispose()
} else {
bottomWordDisposable = Observable.interval(0, 5, TimeUnit.SECONDS)
.subscribeOn(Schedulers.computation())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({
etSearch.hint =
bottomWordlist[(it % bottomWordlist.size).toInt()].word
}, {
}, {
})
}
}
}
})
}
}
\ No newline at end of file
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