Commit 13a9917b by 严久程

咨询声网接听页面外放

parent 1ed4124c
...@@ -42,8 +42,8 @@ ext { ...@@ -42,8 +42,8 @@ ext {
ydlPublishVersion = [ ydlPublishVersion = [
// -------------- 业务模块 -------------- // -------------- 业务模块 --------------
//第三步 若干 //第三步 若干
"m-confide" : "0.0.48.22", "m-confide" : "0.0.48.29",
"m-consultant" : "0.0.59.8", "m-consultant" : "0.0.59.15",
"m-fm" : "0.0.29.3", "m-fm" : "0.0.29.3",
"m-user" : "0.0.60.3", "m-user" : "0.0.60.3",
"m-home" : "0.0.22.2", "m-home" : "0.0.22.2",
...@@ -75,7 +75,7 @@ ext { ...@@ -75,7 +75,7 @@ ext {
"ydl-webview" : "0.0.38.29", "ydl-webview" : "0.0.38.29",
"ydl-media" : "0.0.20", "ydl-media" : "0.0.20",
"ydl-pay" : "0.0.17", "ydl-pay" : "0.0.17",
"m-audioim" : "0.0.49.0", "m-audioim" : "0.0.49.8",
"ydl-flutter-base": "0.0.14.12", "ydl-flutter-base": "0.0.14.12",
//以下 几乎不会动 //以下 几乎不会动
...@@ -121,7 +121,7 @@ ext { ...@@ -121,7 +121,7 @@ ext {
"ydl-webview" : "0.0.38.29", "ydl-webview" : "0.0.38.29",
"ydl-media" : "0.0.20", "ydl-media" : "0.0.20",
"ydl-pay" : "0.0.17", "ydl-pay" : "0.0.17",
"m-audioim" : "0.0.49.0", "m-audioim" : "0.0.49.8",
"ydl-flutter-base": "0.0.10.9", "ydl-flutter-base": "0.0.10.9",
//以下 几乎不会动 //以下 几乎不会动
......
...@@ -190,7 +190,7 @@ class AudioHomeActivity : ...@@ -190,7 +190,7 @@ class AudioHomeActivity :
LogUtil.e("[agora]发生警告回调$warn") LogUtil.e("[agora]发生警告回调$warn")
runOnUiThread { runOnUiThread {
when (warn) { when (warn) {
103, 104, 105, 106, 107 -> { 103, 105, 107 -> {
writeAgoraLog("通话挂断:网络异常(${warn})") writeAgoraLog("通话挂断:网络异常(${warn})")
showToast("当前网络较差,请更换网络!") showToast("当前网络较差,请更换网络!")
//通话结束或挂断时,上传日志文件 //通话结束或挂断时,上传日志文件
......
...@@ -19,9 +19,26 @@ class AudioPlayer { ...@@ -19,9 +19,26 @@ class AudioPlayer {
private var mContext: Context? = null private var mContext: Context? = null
private var audioManager: AudioManager? = null private var audioManager: AudioManager? = null
constructor(mContext: Context?) { constructor(mContext: Context?, isSpeakerphoneOn: Boolean = false) {
this.mContext = mContext this.mContext = mContext
mPlayer = MediaPlayer() mPlayer = MediaPlayer()
if (isSpeakerphoneOn) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
var attributes = AudioAttributes.Builder()
.setLegacyStreamType(AudioManager.STREAM_MUSIC)
.build()
mPlayer?.setAudioAttributes(attributes)
} else {
mPlayer?.setAudioStreamType(AudioManager.STREAM_MUSIC)
}
audioManager = mContext!!.getSystemService(Context.AUDIO_SERVICE) as AudioManager?
audioManager?.setStreamVolume(
AudioManager.STREAM_MUSIC,
audioManager!!.getStreamMaxVolume(AudioManager.STREAM_MUSIC),
AudioManager.STREAM_MUSIC
)
} else {
mPlayer?.setAudioStreamType(AudioManager.STREAM_VOICE_CALL) mPlayer?.setAudioStreamType(AudioManager.STREAM_VOICE_CALL)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
...@@ -34,11 +51,14 @@ class AudioPlayer { ...@@ -34,11 +51,14 @@ class AudioPlayer {
} }
audioManager = mContext!!.getSystemService(Context.AUDIO_SERVICE) as AudioManager? audioManager = mContext!!.getSystemService(Context.AUDIO_SERVICE) as AudioManager?
audioManager?.setStreamVolume(AudioManager.STREAM_VOICE_CALL, audioManager?.setStreamVolume(
AudioManager.STREAM_VOICE_CALL,
audioManager!!.getStreamMaxVolume(AudioManager.STREAM_VOICE_CALL) / 2, audioManager!!.getStreamMaxVolume(AudioManager.STREAM_VOICE_CALL) / 2,
AudioManager.STREAM_VOICE_CALL) AudioManager.STREAM_VOICE_CALL
//默认听筒模式 )
audioManager?.isSpeakerphoneOn = false }
audioManager?.isSpeakerphoneOn = isSpeakerphoneOn
} }
...@@ -48,7 +68,7 @@ class AudioPlayer { ...@@ -48,7 +68,7 @@ class AudioPlayer {
*/ */
fun setDataSource(id: Int) { fun setDataSource(id: Int) {
val file = mContext?.resources?.openRawResourceFd(id) val file = mContext?.resources?.openRawResourceFd(id)
if (null == file){ if (null == file) {
return return
} }
if (mPlayer != null) { if (mPlayer != null) {
...@@ -146,11 +166,13 @@ class AudioPlayer { ...@@ -146,11 +166,13 @@ class AudioPlayer {
*/ */
fun requestFocus() { fun requestFocus() {
try { try {
val result = audioManager?.requestAudioFocus(afChangeListener, val result = audioManager?.requestAudioFocus(
afChangeListener,
// Use the music stream. // Use the music stream.
AudioManager.STREAM_VOICE_CALL, AudioManager.STREAM_VOICE_CALL,
// Request permanent focus. // Request permanent focus.
AudioManager.AUDIOFOCUS_GAIN) AudioManager.AUDIOFOCUS_GAIN
)
} catch (e: Exception) { } catch (e: Exception) {
} }
......
...@@ -263,7 +263,7 @@ class ConsultantAudioHomeActivity : ...@@ -263,7 +263,7 @@ class ConsultantAudioHomeActivity :
//107:打开频道请求被服务器拒绝。服务器可能没有办法处理该请求或该请求是非法的 //107:打开频道请求被服务器拒绝。服务器可能没有办法处理该请求或该请求是非法的
runOnUiThread { runOnUiThread {
when (warn) { when (warn) {
103, 104, 105, 106, 107 -> { 103, 105, 107 -> {
writeAgoraLog("通话挂断:网络异常($warn)") writeAgoraLog("通话挂断:网络异常($warn)")
showToast("当前网络较差,请更换网络!") showToast("当前网络较差,请更换网络!")
//通话结束或挂断时,上传日志文件 //通话结束或挂断时,上传日志文件
...@@ -434,7 +434,7 @@ class ConsultantAudioHomeActivity : ...@@ -434,7 +434,7 @@ class ConsultantAudioHomeActivity :
wave_view.setInterpolator(AccelerateInterpolator(1.2f)) wave_view.setInterpolator(AccelerateInterpolator(1.2f))
//启动背景动画 //启动背景动画
wave_view.start() wave_view.start()
mPlayer = AudioPlayer(this) mPlayer = AudioPlayer(this, true)
mPlayer!!.setDataSource(R.raw.audioim_call_music) mPlayer!!.setDataSource(R.raw.audioim_call_music)
mPlayer!!.start(isLooping = true, isSetOnCompletionListener = false) mPlayer!!.start(isLooping = true, isSetOnCompletionListener = false)
...@@ -779,7 +779,7 @@ class ConsultantAudioHomeActivity : ...@@ -779,7 +779,7 @@ class ConsultantAudioHomeActivity :
*/ */
private fun playFinishMusic() { private fun playFinishMusic() {
if (mPlayer == null) { if (mPlayer == null) {
mPlayer = AudioPlayer(this) mPlayer = AudioPlayer(this, true)
} }
mPlayer!!.setDataSource(R.raw.audioim_hand_down_music) mPlayer!!.setDataSource(R.raw.audioim_hand_down_music)
// mPlayer!!.switchPlayType(true) // mPlayer!!.switchPlayType(true)
...@@ -802,7 +802,7 @@ class ConsultantAudioHomeActivity : ...@@ -802,7 +802,7 @@ class ConsultantAudioHomeActivity :
.subscribe({}, {}, { .subscribe({}, {}, {
if (!isConnectSuccess) { if (!isConnectSuccess) {
writeAgoraLog("通话未接通挂断:连接中的状态超过5s自动挂断") writeAgoraLog("通话未接通挂断:连接中的状态超过5s自动挂断")
showToast( "用户已挂断") showToast("用户已挂断")
close(RESULT_NOT_ANSWERED_CODE, "") close(RESULT_NOT_ANSWERED_CODE, "")
} }
}) })
......
...@@ -62,7 +62,8 @@ import org.json.JSONObject ...@@ -62,7 +62,8 @@ import org.json.JSONObject
import java.util.concurrent.Executors import java.util.concurrent.Executors
@Route(path = "/consult/list") @Route(path = "/consult/list")
class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPresenter>(), View.OnClickListener, IExpertSearchView, class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPresenter>(),
View.OnClickListener, IExpertSearchView,
OnCategoriesSelectedListener, OnSortItemSelectedListener, OnFilterConfirmListener, OnCategoriesSelectedListener, OnSortItemSelectedListener, OnFilterConfirmListener,
SwipeRefreshLayout.OnRefreshListener { SwipeRefreshLayout.OnRefreshListener {
...@@ -74,7 +75,13 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -74,7 +75,13 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
YDLImageCacheManager.showImage(ExpertSearchActivity@ this, url, imgView, ops) YDLImageCacheManager.showImage(ExpertSearchActivity@ this, url, imgView, ops)
} }
override fun showImage(url: String?, imgView: ImageView, width: Int, heigh: Int, ops: SimpleImageOpConfiger) { override fun showImage(
url: String?,
imgView: ImageView,
width: Int,
heigh: Int,
ops: SimpleImageOpConfiger
) {
YDLImageCacheManager.showImage(ExpertSearchActivity@ this, url, imgView, width, heigh, ops) YDLImageCacheManager.showImage(ExpertSearchActivity@ this, url, imgView, width, heigh, ops)
} }
...@@ -89,7 +96,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -89,7 +96,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
} }
override fun getStatusViewOptions(): StatusBarOptions { override fun getStatusViewOptions(): StatusBarOptions {
return StatusBarOptions(true,true) return StatusBarOptions(true, true)
} }
companion object { companion object {
...@@ -109,7 +116,12 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -109,7 +116,12 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
const val FROM_ONLINE_EXPERT = 2 const val FROM_ONLINE_EXPERT = 2
const val PAGE_SIZE = 15 const val PAGE_SIZE = 15
fun newIntent(activity: Activity, category: Int, showType: Int, isInitShowHot: Boolean): Intent { fun newIntent(
activity: Activity,
category: Int,
showType: Int,
isInitShowHot: Boolean
): Intent {
val intent = Intent(activity, ExpertSearchActivity::class.java) val intent = Intent(activity, ExpertSearchActivity::class.java)
intent.putExtra(EXTRA_CATEGORY, category) intent.putExtra(EXTRA_CATEGORY, category)
intent.putExtra(EXTRA_SHOW_TYPE, showType) intent.putExtra(EXTRA_SHOW_TYPE, showType)
...@@ -192,11 +204,17 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -192,11 +204,17 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
btn_call.setOnClickListener(this) btn_call.setOnClickListener(this)
tv_guide.setOnClickListener(this) tv_guide.setOnClickListener(this)
rl_search.setOnClickListener(this) rl_search.setOnClickListener(this)
srlContainer.setColorSchemeColors(ContextCompat.getColor(this, R.color.consultant_main_theme)) srlContainer.setColorSchemeColors(
ContextCompat.getColor(
this,
R.color.consultant_main_theme
)
)
srlContainer.setProgressViewOffset(false, 0, 200) srlContainer.setProgressViewOffset(false, 0, 200)
srlContainer.setOnRefreshListener(this) srlContainer.setOnRefreshListener(this)
recommendListView.addViewPagerScrollStateListener(object : RecommendListView.ViewPagerScrollStateCallback { recommendListView.addViewPagerScrollStateListener(object :
RecommendListView.ViewPagerScrollStateCallback {
override fun viewPagerScroll(isScrolling: Boolean) { override fun viewPagerScroll(isScrolling: Boolean) {
//如果viewpager正在滚动,则禁止下拉刷新 //如果viewpager正在滚动,则禁止下拉刷新
srlContainer.isEnabled = !isScrolling srlContainer.isEnabled = !isScrolling
...@@ -241,7 +259,11 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -241,7 +259,11 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
} }
} else if (newState == RecyclerView.SCROLL_STATE_IDLE) { } else if (newState == RecyclerView.SCROLL_STATE_IDLE) {
//没有滚动 //没有滚动
ConsultAssistantDialogUtils.INSTANCE.fitRequest(this@ExpertSearchActivity, "doctor_list", true) ConsultAssistantDialogUtils.INSTANCE.fitRequest(
this@ExpertSearchActivity,
"doctor_list",
true
)
if (sIsScrolling) { if (sIsScrolling) {
if (!this@ExpertSearchActivity.isFinishing) { if (!this@ExpertSearchActivity.isFinishing) {
// GlideApp.with(this@ExpertSearchActivity).resumeRequests() // GlideApp.with(this@ExpertSearchActivity).resumeRequests()
...@@ -255,7 +277,9 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -255,7 +277,9 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
var alpha = PropertyValuesHolder.ofFloat("alpha", 1f, 0f) var alpha = PropertyValuesHolder.ofFloat("alpha", 1f, 0f)
var scaleX = PropertyValuesHolder.ofFloat("scaleX", 1f, 0f) var scaleX = PropertyValuesHolder.ofFloat("scaleX", 1f, 0f)
var scaleY = PropertyValuesHolder.ofFloat("scaleY", 1f, 0f) var scaleY = PropertyValuesHolder.ofFloat("scaleY", 1f, 0f)
var animator = ObjectAnimator.ofPropertyValuesHolder(image_scroll_top, alpha, scaleX, scaleY).setDuration(200) var animator =
ObjectAnimator.ofPropertyValuesHolder(image_scroll_top, alpha, scaleX, scaleY)
.setDuration(200)
animator.addListener(object : AnimatorListenerAdapter() { animator.addListener(object : AnimatorListenerAdapter() {
override fun onAnimationEnd(animation: Animator) { override fun onAnimationEnd(animation: Animator) {
image_scroll_top.visibility = View.GONE image_scroll_top.visibility = View.GONE
...@@ -272,7 +296,9 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -272,7 +296,9 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
var alpha = PropertyValuesHolder.ofFloat("alpha", 0f, 1f) var alpha = PropertyValuesHolder.ofFloat("alpha", 0f, 1f)
var scaleX = PropertyValuesHolder.ofFloat("scaleX", 0f, 1f) var scaleX = PropertyValuesHolder.ofFloat("scaleX", 0f, 1f)
var scaleY = PropertyValuesHolder.ofFloat("scaleY", 0f, 1f) var scaleY = PropertyValuesHolder.ofFloat("scaleY", 0f, 1f)
var animator = ObjectAnimator.ofPropertyValuesHolder(image_scroll_top, alpha, scaleX, scaleY).setDuration(200) var animator =
ObjectAnimator.ofPropertyValuesHolder(image_scroll_top, alpha, scaleX, scaleY)
.setDuration(200)
animator.addListener(object : AnimatorListenerAdapter() { animator.addListener(object : AnimatorListenerAdapter() {
override fun onAnimationEnd(animation: Animator) { override fun onAnimationEnd(animation: Animator) {
image_scroll_top.visibility = View.VISIBLE image_scroll_top.visibility = View.VISIBLE
...@@ -289,7 +315,9 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -289,7 +315,9 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
var alpha = PropertyValuesHolder.ofFloat("alpha", 1f, 0f) var alpha = PropertyValuesHolder.ofFloat("alpha", 1f, 0f)
var scaleX = PropertyValuesHolder.ofFloat("scaleX", 1f, 0f) var scaleX = PropertyValuesHolder.ofFloat("scaleX", 1f, 0f)
var scaleY = PropertyValuesHolder.ofFloat("scaleY", 1f, 0f) var scaleY = PropertyValuesHolder.ofFloat("scaleY", 1f, 0f)
var animator = ObjectAnimator.ofPropertyValuesHolder(image_scroll_top, alpha, scaleX, scaleY).setDuration(200) var animator =
ObjectAnimator.ofPropertyValuesHolder(image_scroll_top, alpha, scaleX, scaleY)
.setDuration(200)
animator.addListener(object : AnimatorListenerAdapter() { animator.addListener(object : AnimatorListenerAdapter() {
override fun onAnimationEnd(animation: Animator) { override fun onAnimationEnd(animation: Animator) {
image_scroll_top.visibility = View.GONE image_scroll_top.visibility = View.GONE
...@@ -378,9 +406,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -378,9 +406,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
v_loading.visibility = View.VISIBLE v_loading.visibility = View.VISIBLE
v_loading.setViewType(LogoLoadingView.TYPE_LOADING, null) v_loading.setViewType(LogoLoadingView.TYPE_LOADING, null)
if (fromPageType != -1) { doctorAdapter.setEntrance(1)
doctorAdapter.setEntrance(fromPages[fromPageType],1)
}
} }
override fun onNewIntent(intent: Intent?) { override fun onNewIntent(intent: Intent?) {
...@@ -456,7 +482,8 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -456,7 +482,8 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
val popWidth = RxDeviceTool.getScreenWidth(mContext) val popWidth = RxDeviceTool.getScreenWidth(mContext)
val mWidth = (popWidth - RxImageTool.dp2px(10f)) / hotData.size val mWidth = (popWidth - RxImageTool.dp2px(10f)) / hotData.size
for ((index, hot) in hotData!!.withIndex()) { for ((index, hot) in hotData!!.withIndex()) {
val tv = View.inflate(mContext, R.layout.consultant_item_filter_online, null) as TextView val tv =
View.inflate(mContext, R.layout.consultant_item_filter_online, null) as TextView
val textView = tv.tvFree val textView = tv.tvFree
val params = LinearLayout.LayoutParams(0, RxImageTool.dp2px(22f)) val params = LinearLayout.LayoutParams(0, RxImageTool.dp2px(22f))
params.weight = 1f params.weight = 1f
...@@ -596,7 +623,8 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -596,7 +623,8 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
} }
when { when {
allFilter.reorder.value.equals("综合排序") -> tvSort.text = "排序" allFilter.reorder.value.equals("综合排序") -> tvSort.text = "排序"
allFilter.reorder.value?.length ?: 0 > 4 -> tvSort.text = allFilter.reorder.value?.substring(0, 3) + "..." allFilter.reorder.value?.length ?: 0 > 4 -> tvSort.text =
allFilter.reorder.value?.substring(0, 3) + "..."
else -> tvSort.text = allFilter.reorder.value else -> tvSort.text = allFilter.reorder.value
} }
} }
...@@ -700,7 +728,11 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -700,7 +728,11 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
bean.key = hotData.id bean.key = hotData.id
bean.value = hotData.value bean.value = hotData.value
for (headBean in headData!!.region) { for (headBean in headData!!.region) {
if (TextUtils.equals(headBean.key!!.substring(0, 2), bean.key!!.substring(0, 2))) { if (TextUtils.equals(
headBean.key!!.substring(0, 2),
bean.key!!.substring(0, 2)
)
) {
allFilter.region = headBean allFilter.region = headBean
break break
} }
...@@ -752,7 +784,11 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -752,7 +784,11 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
} }
//服务列表数据获取到后的回调 //服务列表数据获取到后的回调
override fun onServiceListFetched(data: MutableList<DoctorServiceItem>, page: Int, totalPage: Int) { override fun onServiceListFetched(
data: MutableList<DoctorServiceItem>,
page: Int,
totalPage: Int
) {
LogUtil.d("onServiceListFetched") LogUtil.d("onServiceListFetched")
// if (rvExperts.adapter != serviceAdapter) { // if (rvExperts.adapter != serviceAdapter) {
// rvExperts.adapter = serviceAdapter // rvExperts.adapter = serviceAdapter
...@@ -790,7 +826,11 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -790,7 +826,11 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
} }
//专家列表数据获取到后的回调 //专家列表数据获取到后的回调
override fun onDoctorListFetched(data: MutableList<DoctorServiceItem>, page: Int, totalPage: Int) { override fun onDoctorListFetched(
data: MutableList<DoctorServiceItem>,
page: Int,
totalPage: Int
) {
LogUtil.d("onDoctorListFetched") LogUtil.d("onDoctorListFetched")
if (rvExperts.adapter != doctorAdapter) { if (rvExperts.adapter != doctorAdapter) {
rvExperts.adapter = doctorAdapter rvExperts.adapter = doctorAdapter
...@@ -833,7 +873,10 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -833,7 +873,10 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
isRecommend = false isRecommend = false
if (curPage == 1) { if (curPage == 1) {
v_loading.setViewType(LogoLoadingView.TYPE_NET_LOSS, getString(R.string.consultant_reload_hint)) v_loading.setViewType(
LogoLoadingView.TYPE_NET_LOSS,
getString(R.string.consultant_reload_hint)
)
v_loading.visibility = View.VISIBLE v_loading.visibility = View.VISIBLE
ll_network_error.visibility = View.GONE ll_network_error.visibility = View.GONE
...@@ -864,7 +907,10 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -864,7 +907,10 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
if (msg != null) { if (msg != null) {
ToastUtil.toastShort(msg) ToastUtil.toastShort(msg)
} }
v_loading.setViewType(LogoLoadingView.TYPE_NET_LOSS, getString(R.string.consultant_reload_hint)) v_loading.setViewType(
LogoLoadingView.TYPE_NET_LOSS,
getString(R.string.consultant_reload_hint)
)
v_loading.visibility = View.VISIBLE v_loading.visibility = View.VISIBLE
ll_network_error.visibility = View.GONE ll_network_error.visibility = View.GONE
...@@ -923,7 +969,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -923,7 +969,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
R.id.tv_guide -> { R.id.tv_guide -> {
ActionCountUtils.count(ConsultBIConstants.ConsultEvent.APP_CONSULT_LIST_CONSULT_GUIDE_CLICK) ActionCountUtils.count(ConsultBIConstants.ConsultEvent.APP_CONSULT_LIST_CONSULT_GUIDE_CLICK)
val h5param = H5Params(HttpConfig.H5_URL+ "help/consultation/", "咨询指南") val h5param = H5Params(HttpConfig.H5_URL + "help/consultation/", "咨询指南")
h5param.isShowMenu = true h5param.isShowMenu = true
NewH5Activity.start(this, h5param) NewH5Activity.start(this, h5param)
} }
...@@ -974,7 +1020,10 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -974,7 +1020,10 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
filterPopupWindow.setOnDismissListener { filterPopupWindow.setOnDismissListener {
// viewDim.visibility = View.INVISIBLE // viewDim.visibility = View.INVISIBLE
viewDim_filter.visibility = View.GONE viewDim_filter.visibility = View.GONE
if (allFilter.others.size + allFilter.enquiries.size + allFilter.ages.size + allFilter.title.size > 0 || !TextUtils.isEmpty(allFilter.priceRanges?.minPrice) || !TextUtils.isEmpty(allFilter.priceRanges?.maxPrice)) { if (allFilter.others.size + allFilter.enquiries.size + allFilter.ages.size + allFilter.title.size > 0 || !TextUtils.isEmpty(
allFilter.priceRanges?.minPrice
) || !TextUtils.isEmpty(allFilter.priceRanges?.maxPrice)
) {
updateFilterTextViewStatus(tvFilter, FILTER_STATUS_FILTERED) updateFilterTextViewStatus(tvFilter, FILTER_STATUS_FILTERED)
} else { } else {
updateFilterTextViewStatus(tvFilter, FILTER_STATUS_NORMAL) updateFilterTextViewStatus(tvFilter, FILTER_STATUS_NORMAL)
...@@ -997,8 +1046,19 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -997,8 +1046,19 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
//筛选确认回调 //筛选确认回调
override fun onFilterConfirmed() { override fun onFilterConfirmed() {
updateFilterTextViewStatus(tvFilter, FILTER_STATUS_OPEN) updateFilterTextViewStatus(tvFilter, FILTER_STATUS_OPEN)
LogUtil.d("filter: " + tempFilter.showType.value + "," + tempFilter.enquiries.map { it.value }.joinToString(",") + "," + tempFilter.ages.map { it.value }.joinToString(",") + "," + tempFilter.others.map { it.value }.joinToString(",")) LogUtil.d(
props1.put("filtrate_second", tempFilter.showType.value + "," + tempFilter.enquiries.map { it.value }.joinToString(",") + "," + tempFilter.ages.map { it.value }.joinToString(",") + "," + tempFilter.others.map { it.value }.joinToString(",")) "filter: " + tempFilter.showType.value + "," + tempFilter.enquiries.map { it.value }.joinToString(
","
) + "," + tempFilter.ages.map { it.value }.joinToString(",") + "," + tempFilter.others.map { it.value }.joinToString(
","
)
)
props1.put(
"filtrate_second",
tempFilter.showType.value + "," + tempFilter.enquiries.map { it.value }.joinToString(",") + "," + tempFilter.ages.map { it.value }.joinToString(
","
) + "," + tempFilter.others.map { it.value }.joinToString(",")
)
BuryPointUtils.buryPoint("Filtrate", props1) BuryPointUtils.buryPoint("Filtrate", props1)
...@@ -1025,7 +1085,11 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -1025,7 +1085,11 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
textview.paint.isFakeBoldText = false textview.paint.isFakeBoldText = false
} }
for (bean in allFilter.enquiries) { for (bean in allFilter.enquiries) {
if (TextUtils.equals(bean.key.toString(), headData!!.highlighter[index].id)) { if (TextUtils.equals(
bean.key.toString(),
headData!!.highlighter[index].id
)
) {
this@ExpertSearchActivity.runOnUiThread { this@ExpertSearchActivity.runOnUiThread {
textview.isSelected = true textview.isSelected = true
textview.paint.isFakeBoldText = true textview.paint.isFakeBoldText = true
...@@ -1041,7 +1105,11 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -1041,7 +1105,11 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
textview.paint.isFakeBoldText = false textview.paint.isFakeBoldText = false
} }
for (bean in allFilter.ages) { for (bean in allFilter.ages) {
if (TextUtils.equals(bean.value.toString(), headData!!.highlighter[index].id)) { if (TextUtils.equals(
bean.value.toString(),
headData!!.highlighter[index].id
)
) {
this@ExpertSearchActivity.runOnUiThread { this@ExpertSearchActivity.runOnUiThread {
textview.isSelected = true textview.isSelected = true
textview.paint.isFakeBoldText = true textview.paint.isFakeBoldText = true
...@@ -1057,7 +1125,11 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -1057,7 +1125,11 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
textview.paint.isFakeBoldText = false textview.paint.isFakeBoldText = false
} }
for (bean in allFilter.others) { for (bean in allFilter.others) {
if (TextUtils.equals(bean.key.toString(), headData!!.highlighter[index].id)) { if (TextUtils.equals(
bean.key.toString(),
headData!!.highlighter[index].id
)
) {
this@ExpertSearchActivity.runOnUiThread { this@ExpertSearchActivity.runOnUiThread {
textview.isSelected = true textview.isSelected = true
textview.paint.isFakeBoldText = true textview.paint.isFakeBoldText = true
...@@ -1074,7 +1146,11 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -1074,7 +1146,11 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
textview.paint.isFakeBoldText = false textview.paint.isFakeBoldText = false
} }
for (bean in allFilter.title) { for (bean in allFilter.title) {
if (TextUtils.equals(bean.key.toString(), headData!!.highlighter[index].id)) { if (TextUtils.equals(
bean.key.toString(),
headData!!.highlighter[index].id
)
) {
this@ExpertSearchActivity.runOnUiThread { this@ExpertSearchActivity.runOnUiThread {
textview.isSelected = true textview.isSelected = true
textview.paint.isFakeBoldText = true textview.paint.isFakeBoldText = true
...@@ -1148,8 +1224,10 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -1148,8 +1224,10 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
//排序选择回调 //排序选择回调
override fun onSortItemSelected(sortItem: ReorderItem) { override fun onSortItemSelected(sortItem: ReorderItem) {
ActionCountUtils.count(ConsultBIConstants.ConsultEvent.APP_CONSULT_LIST_SORT_CLICK, sortItem.value ActionCountUtils.count(
?: "") ConsultBIConstants.ConsultEvent.APP_CONSULT_LIST_SORT_CLICK, sortItem.value
?: ""
)
if (sortItem.value.equals("综合排序")) { if (sortItem.value.equals("综合排序")) {
tvSort.text = "排序" tvSort.text = "排序"
...@@ -1189,8 +1267,10 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -1189,8 +1267,10 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
//显示地区弹窗 //显示地区弹窗
private fun showAreaPopupWindow() { private fun showAreaPopupWindow() {
if (headData?.region != null) { if (headData?.region != null) {
val regionPopupWindow = AreaPopupWindow(this, headData?.region val regionPopupWindow = AreaPopupWindow(
?: ArrayList(), allFilter.region, allFilter.sub) this, headData?.region
?: ArrayList(), allFilter.region, allFilter.sub
)
regionPopupWindow.showAsDropDown(viewSep2) regionPopupWindow.showAsDropDown(viewSep2)
viewDim.visibility = View.VISIBLE viewDim.visibility = View.VISIBLE
updateFilterTextViewStatus(tvArea, FILTER_STATUS_OPEN) updateFilterTextViewStatus(tvArea, FILTER_STATUS_OPEN)
...@@ -1202,7 +1282,8 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -1202,7 +1282,8 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
updateFilterTextViewStatus(tvArea, FILTER_STATUS_NORMAL) updateFilterTextViewStatus(tvArea, FILTER_STATUS_NORMAL)
} }
} }
regionPopupWindow.onRegionSelectedListener = object : AreaPopupWindow.OnRegionSelectedListener { regionPopupWindow.onRegionSelectedListener =
object : AreaPopupWindow.OnRegionSelectedListener {
override fun onRegionSelected(region: RegionItem, sub: SubItem) { override fun onRegionSelected(region: RegionItem, sub: SubItem) {
updateFilterTextViewStatus(tvArea, FILTER_STATUS_OPEN) updateFilterTextViewStatus(tvArea, FILTER_STATUS_OPEN)
allFilter.region = region allFilter.region = region
...@@ -1231,7 +1312,10 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -1231,7 +1312,10 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
tvArea.text = sub.value tvArea.text = sub.value
} }
} }
ActionCountUtils.count(ConsultBIConstants.ConsultEvent.APP_CONSULT_LIST_AREA_CLICK, region.value + "|" + sub.value) ActionCountUtils.count(
ConsultBIConstants.ConsultEvent.APP_CONSULT_LIST_AREA_CLICK,
region.value + "|" + sub.value
)
//更新热门搜索显示状态 //更新热门搜索显示状态
if (headData!!.highlighter.size > 0) { if (headData!!.highlighter.size > 0) {
...@@ -1304,7 +1388,10 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -1304,7 +1388,10 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
* 新增逻辑:当主题选择后,需要判断热门筛选中是否也有该主题,如果有,也需要同步更新选中状态 * 新增逻辑:当主题选择后,需要判断热门筛选中是否也有该主题,如果有,也需要同步更新选中状态
*/ */
override fun onCategoriesSelected(categories: ArrayList<CateItem>) { override fun onCategoriesSelected(categories: ArrayList<CateItem>) {
ActionCountUtils.count(ConsultBIConstants.ConsultEvent.APP_CONSULT_LIST_THEME_CLICK, categories.map { it.cateName }.joinToString("|")) ActionCountUtils.count(
ConsultBIConstants.ConsultEvent.APP_CONSULT_LIST_THEME_CLICK,
categories.map { it.cateName }.joinToString("|")
)
if (categories.size == 1 && "全部" != categories[0].cateName) { if (categories.size == 1 && "全部" != categories[0].cateName) {
//显示选中标题 //显示选中标题
tvSubject.text = categories[0].cateName tvSubject.text = categories[0].cateName
...@@ -1323,7 +1410,11 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -1323,7 +1410,11 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
textview.paint.isFakeBoldText = false textview.paint.isFakeBoldText = false
} }
for (bean in categories) { for (bean in categories) {
if (TextUtils.equals(bean.cateName, headData!!.highlighter[index].value)) { if (TextUtils.equals(
bean.cateName,
headData!!.highlighter[index].value
)
) {
this@ExpertSearchActivity.runOnUiThread { this@ExpertSearchActivity.runOnUiThread {
textview.isSelected = true textview.isSelected = true
textview.paint.isFakeBoldText = true textview.paint.isFakeBoldText = true
...@@ -1380,7 +1471,10 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -1380,7 +1471,10 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
// return // return
// } // }
ActionCountUtils.count(ConsultBIConstants.UserMainEvent.YDL_USER_SEARCH_CLICK, keyWord ?: "") ActionCountUtils.count(
ConsultBIConstants.UserMainEvent.YDL_USER_SEARCH_CLICK,
keyWord ?: ""
)
isDoSearch = true isDoSearch = true
resetFilter() resetFilter()
refresh() refresh()
...@@ -1416,17 +1510,32 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres ...@@ -1416,17 +1510,32 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
FILTER_STATUS_NORMAL -> { FILTER_STATUS_NORMAL -> {
tv.typeface = Typeface.defaultFromStyle(Typeface.NORMAL) tv.typeface = Typeface.defaultFromStyle(Typeface.NORMAL)
tv.setTextColor(ContextCompat.getColor(this, R.color.platform_colorTextDefault)) tv.setTextColor(ContextCompat.getColor(this, R.color.platform_colorTextDefault))
tv.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.platform_ic_arrow_drop_down_grey_500_18dp, 0) tv.setCompoundDrawablesWithIntrinsicBounds(
0,
0,
R.drawable.platform_ic_arrow_drop_down_grey_500_18dp,
0
)
} }
FILTER_STATUS_FILTERED -> { FILTER_STATUS_FILTERED -> {
tv.typeface = Typeface.DEFAULT_BOLD tv.typeface = Typeface.DEFAULT_BOLD
tv.setTextColor(ContextCompat.getColor(this, R.color.consultant_main_theme)) tv.setTextColor(ContextCompat.getColor(this, R.color.consultant_main_theme))
tv.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.platform_ic_arrow_drop_down_grey_500_18dp, 0) tv.setCompoundDrawablesWithIntrinsicBounds(
0,
0,
R.drawable.platform_ic_arrow_drop_down_grey_500_18dp,
0
)
} }
FILTER_STATUS_OPEN -> { FILTER_STATUS_OPEN -> {
tv.typeface = Typeface.DEFAULT_BOLD tv.typeface = Typeface.DEFAULT_BOLD
tv.setTextColor(ContextCompat.getColor(this, R.color.platform_colorTextDefault)) tv.setTextColor(ContextCompat.getColor(this, R.color.platform_colorTextDefault))
tv.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.consultant_ic_arrow_drop_down, 0) tv.setCompoundDrawablesWithIntrinsicBounds(
0,
0,
R.drawable.consultant_ic_arrow_drop_down,
0
)
} }
} }
} }
......
...@@ -361,9 +361,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres ...@@ -361,9 +361,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
v_loading.visibility = View.VISIBLE v_loading.visibility = View.VISIBLE
v_loading.setViewType(LogoLoadingView.TYPE_LOADING, null) v_loading.setViewType(LogoLoadingView.TYPE_LOADING, null)
if (fromPageType != -1) { doctorAdapter.setEntrance(0)
doctorAdapter.setEntrance(fromPages[fromPageType], 0)
}
} }
/** /**
......
...@@ -59,11 +59,9 @@ class ExpertSearchAdapter( ...@@ -59,11 +59,9 @@ class ExpertSearchAdapter(
var hasMore = true var hasMore = true
var entranceName: String? = null
var pageIndex: Int = 0 var pageIndex: Int = 0
fun setEntrance(entranceName: String, pageIndex: Int) { fun setEntrance(pageIndex: Int) {
this.entranceName = entranceName
this.pageIndex = pageIndex this.pageIndex = pageIndex
} }
...@@ -465,14 +463,6 @@ class ExpertSearchAdapter( ...@@ -465,14 +463,6 @@ class ExpertSearchAdapter(
} else { } else {
ToastHelper.show("请联系客服,专家参数错误!") ToastHelper.show("请联系客服,专家参数错误!")
} }
if (!TextUtils.isEmpty(entranceName)) {
LogUtil.d("entrance name: $entranceName")
BuryPointUtils.getInstance().createMap()
.put("expert_entrance", entranceName ?: "")
.put("expert_ID", doctor.doctorId ?: 0)
.put("expert_name", doctor.name ?: "")
.burryPoint("Chat_click")
}
} }
} }
} }
......
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