Commit 13a9917b by 严久程

咨询声网接听页面外放

parent 1ed4124c
......@@ -42,8 +42,8 @@ ext {
ydlPublishVersion = [
// -------------- 业务模块 --------------
//第三步 若干
"m-confide" : "0.0.48.22",
"m-consultant" : "0.0.59.8",
"m-confide" : "0.0.48.29",
"m-consultant" : "0.0.59.15",
"m-fm" : "0.0.29.3",
"m-user" : "0.0.60.3",
"m-home" : "0.0.22.2",
......@@ -75,7 +75,7 @@ ext {
"ydl-webview" : "0.0.38.29",
"ydl-media" : "0.0.20",
"ydl-pay" : "0.0.17",
"m-audioim" : "0.0.49.0",
"m-audioim" : "0.0.49.8",
"ydl-flutter-base": "0.0.14.12",
//以下 几乎不会动
......@@ -121,7 +121,7 @@ ext {
"ydl-webview" : "0.0.38.29",
"ydl-media" : "0.0.20",
"ydl-pay" : "0.0.17",
"m-audioim" : "0.0.49.0",
"m-audioim" : "0.0.49.8",
"ydl-flutter-base": "0.0.10.9",
//以下 几乎不会动
......
......@@ -190,7 +190,7 @@ class AudioHomeActivity :
LogUtil.e("[agora]发生警告回调$warn")
runOnUiThread {
when (warn) {
103, 104, 105, 106, 107 -> {
103, 105, 107 -> {
writeAgoraLog("通话挂断:网络异常(${warn})")
showToast("当前网络较差,请更换网络!")
//通话结束或挂断时,上传日志文件
......
......@@ -19,26 +19,46 @@ class AudioPlayer {
private var mContext: Context? = null
private var audioManager: AudioManager? = null
constructor(mContext: Context?) {
constructor(mContext: Context?, isSpeakerphoneOn: Boolean = false) {
this.mContext = mContext
mPlayer = MediaPlayer()
mPlayer?.setAudioStreamType(AudioManager.STREAM_VOICE_CALL)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
var attributes = AudioAttributes.Builder()
.setLegacyStreamType(AudioManager.STREAM_VOICE_CALL)
if (isSpeakerphoneOn) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
var attributes = AudioAttributes.Builder()
.setLegacyStreamType(AudioManager.STREAM_MUSIC)
.build()
mPlayer?.setAudioAttributes(attributes)
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)
}
audioManager = mContext!!.getSystemService(Context.AUDIO_SERVICE) as AudioManager?
audioManager?.setStreamVolume(AudioManager.STREAM_VOICE_CALL,
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
var attributes = AudioAttributes.Builder()
.setLegacyStreamType(AudioManager.STREAM_VOICE_CALL)
.build()
mPlayer?.setAudioAttributes(attributes)
} else {
mPlayer?.setAudioStreamType(AudioManager.STREAM_VOICE_CALL)
}
audioManager = mContext!!.getSystemService(Context.AUDIO_SERVICE) as AudioManager?
audioManager?.setStreamVolume(
AudioManager.STREAM_VOICE_CALL,
audioManager!!.getStreamMaxVolume(AudioManager.STREAM_VOICE_CALL) / 2,
AudioManager.STREAM_VOICE_CALL)
//默认听筒模式
audioManager?.isSpeakerphoneOn = false
AudioManager.STREAM_VOICE_CALL
)
}
audioManager?.isSpeakerphoneOn = isSpeakerphoneOn
}
......@@ -48,7 +68,7 @@ class AudioPlayer {
*/
fun setDataSource(id: Int) {
val file = mContext?.resources?.openRawResourceFd(id)
if (null == file){
if (null == file) {
return
}
if (mPlayer != null) {
......@@ -146,11 +166,13 @@ class AudioPlayer {
*/
fun requestFocus() {
try {
val result = audioManager?.requestAudioFocus(afChangeListener,
// Use the music stream.
AudioManager.STREAM_VOICE_CALL,
// Request permanent focus.
AudioManager.AUDIOFOCUS_GAIN)
val result = audioManager?.requestAudioFocus(
afChangeListener,
// Use the music stream.
AudioManager.STREAM_VOICE_CALL,
// Request permanent focus.
AudioManager.AUDIOFOCUS_GAIN
)
} catch (e: Exception) {
}
......
......@@ -263,7 +263,7 @@ class ConsultantAudioHomeActivity :
//107:打开频道请求被服务器拒绝。服务器可能没有办法处理该请求或该请求是非法的
runOnUiThread {
when (warn) {
103, 104, 105, 106, 107 -> {
103, 105, 107 -> {
writeAgoraLog("通话挂断:网络异常($warn)")
showToast("当前网络较差,请更换网络!")
//通话结束或挂断时,上传日志文件
......@@ -434,7 +434,7 @@ class ConsultantAudioHomeActivity :
wave_view.setInterpolator(AccelerateInterpolator(1.2f))
//启动背景动画
wave_view.start()
mPlayer = AudioPlayer(this)
mPlayer = AudioPlayer(this, true)
mPlayer!!.setDataSource(R.raw.audioim_call_music)
mPlayer!!.start(isLooping = true, isSetOnCompletionListener = false)
......@@ -779,7 +779,7 @@ class ConsultantAudioHomeActivity :
*/
private fun playFinishMusic() {
if (mPlayer == null) {
mPlayer = AudioPlayer(this)
mPlayer = AudioPlayer(this, true)
}
mPlayer!!.setDataSource(R.raw.audioim_hand_down_music)
// mPlayer!!.switchPlayType(true)
......@@ -802,7 +802,7 @@ class ConsultantAudioHomeActivity :
.subscribe({}, {}, {
if (!isConnectSuccess) {
writeAgoraLog("通话未接通挂断:连接中的状态超过5s自动挂断")
showToast( "用户已挂断")
showToast("用户已挂断")
close(RESULT_NOT_ANSWERED_CODE, "")
}
})
......
......@@ -62,8 +62,9 @@ import org.json.JSONObject
import java.util.concurrent.Executors
@Route(path = "/consult/list")
class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPresenter>(), View.OnClickListener, IExpertSearchView,
OnCategoriesSelectedListener, OnSortItemSelectedListener, OnFilterConfirmListener,
class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPresenter>(),
View.OnClickListener, IExpertSearchView,
OnCategoriesSelectedListener, OnSortItemSelectedListener, OnFilterConfirmListener,
SwipeRefreshLayout.OnRefreshListener {
override fun showImage(url: String?, imgView: ImageView) {
......@@ -74,7 +75,13 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
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)
}
......@@ -89,7 +96,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
}
override fun getStatusViewOptions(): StatusBarOptions {
return StatusBarOptions(true,true)
return StatusBarOptions(true, true)
}
companion object {
......@@ -109,7 +116,12 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
const val FROM_ONLINE_EXPERT = 2
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)
intent.putExtra(EXTRA_CATEGORY, category)
intent.putExtra(EXTRA_SHOW_TYPE, showType)
......@@ -192,11 +204,17 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
btn_call.setOnClickListener(this)
tv_guide.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.setOnRefreshListener(this)
recommendListView.addViewPagerScrollStateListener(object : RecommendListView.ViewPagerScrollStateCallback {
recommendListView.addViewPagerScrollStateListener(object :
RecommendListView.ViewPagerScrollStateCallback {
override fun viewPagerScroll(isScrolling: Boolean) {
//如果viewpager正在滚动,则禁止下拉刷新
srlContainer.isEnabled = !isScrolling
......@@ -241,7 +259,11 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
}
} 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 (!this@ExpertSearchActivity.isFinishing) {
// GlideApp.with(this@ExpertSearchActivity).resumeRequests()
......@@ -255,7 +277,9 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
var alpha = PropertyValuesHolder.ofFloat("alpha", 1f, 0f)
var scaleX = PropertyValuesHolder.ofFloat("scaleX", 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() {
override fun onAnimationEnd(animation: Animator) {
image_scroll_top.visibility = View.GONE
......@@ -272,7 +296,9 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
var alpha = PropertyValuesHolder.ofFloat("alpha", 0f, 1f)
var scaleX = PropertyValuesHolder.ofFloat("scaleX", 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() {
override fun onAnimationEnd(animation: Animator) {
image_scroll_top.visibility = View.VISIBLE
......@@ -289,7 +315,9 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
var alpha = PropertyValuesHolder.ofFloat("alpha", 1f, 0f)
var scaleX = PropertyValuesHolder.ofFloat("scaleX", 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() {
override fun onAnimationEnd(animation: Animator) {
image_scroll_top.visibility = View.GONE
......@@ -378,9 +406,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
v_loading.visibility = View.VISIBLE
v_loading.setViewType(LogoLoadingView.TYPE_LOADING, null)
if (fromPageType != -1) {
doctorAdapter.setEntrance(fromPages[fromPageType],1)
}
doctorAdapter.setEntrance(1)
}
override fun onNewIntent(intent: Intent?) {
......@@ -456,7 +482,8 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
val popWidth = RxDeviceTool.getScreenWidth(mContext)
val mWidth = (popWidth - RxImageTool.dp2px(10f)) / hotData.size
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 params = LinearLayout.LayoutParams(0, RxImageTool.dp2px(22f))
params.weight = 1f
......@@ -596,7 +623,8 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
}
when {
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
}
}
......@@ -700,7 +728,11 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
bean.key = hotData.id
bean.value = hotData.value
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
break
}
......@@ -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")
// if (rvExperts.adapter != serviceAdapter) {
// rvExperts.adapter = serviceAdapter
......@@ -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")
if (rvExperts.adapter != doctorAdapter) {
rvExperts.adapter = doctorAdapter
......@@ -833,7 +873,10 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
isRecommend = false
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
ll_network_error.visibility = View.GONE
......@@ -864,7 +907,10 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
if (msg != null) {
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
ll_network_error.visibility = View.GONE
......@@ -923,7 +969,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
R.id.tv_guide -> {
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
NewH5Activity.start(this, h5param)
}
......@@ -934,9 +980,9 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
}
R.id.rl_search -> {
ARouter.getInstance()
.build("/consult/hot_search")
.withString(HOT_SEARCH_DOCTOR_NAME, tv_search_content.text.toString())
.navigation()
.build("/consult/hot_search")
.withString(HOT_SEARCH_DOCTOR_NAME, tv_search_content.text.toString())
.navigation()
}
}
}
......@@ -974,12 +1020,15 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
filterPopupWindow.setOnDismissListener {
// viewDim.visibility = View.INVISIBLE
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)
} else {
updateFilterTextViewStatus(tvFilter, FILTER_STATUS_NORMAL)
}
ConsultAssistantDialogUtils.INSTANCE.fitRequest(this, "doctor_list", true)
ConsultAssistantDialogUtils.INSTANCE.fitRequest(this, "doctor_list", true)
}
filterPopupWindow.isClippingEnabled = false
filterPopupWindow.showAtLocation(viewSep2.rootView, Gravity.TOP + Gravity.RIGHT, 0, 0)
......@@ -997,8 +1046,19 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
//筛选确认回调
override fun onFilterConfirmed() {
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(","))
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(","))
LogUtil.d(
"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)
......@@ -1025,7 +1085,11 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
textview.paint.isFakeBoldText = false
}
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 {
textview.isSelected = true
textview.paint.isFakeBoldText = true
......@@ -1041,7 +1105,11 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
textview.paint.isFakeBoldText = false
}
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 {
textview.isSelected = true
textview.paint.isFakeBoldText = true
......@@ -1057,7 +1125,11 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
textview.paint.isFakeBoldText = false
}
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 {
textview.isSelected = true
textview.paint.isFakeBoldText = true
......@@ -1074,7 +1146,11 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
textview.paint.isFakeBoldText = false
}
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 {
textview.isSelected = true
textview.paint.isFakeBoldText = true
......@@ -1148,8 +1224,10 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
//排序选择回调
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("综合排序")) {
tvSort.text = "排序"
......@@ -1189,8 +1267,10 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
//显示地区弹窗
private fun showAreaPopupWindow() {
if (headData?.region != null) {
val regionPopupWindow = AreaPopupWindow(this, headData?.region
?: ArrayList(), allFilter.region, allFilter.sub)
val regionPopupWindow = AreaPopupWindow(
this, headData?.region
?: ArrayList(), allFilter.region, allFilter.sub
)
regionPopupWindow.showAsDropDown(viewSep2)
viewDim.visibility = View.VISIBLE
updateFilterTextViewStatus(tvArea, FILTER_STATUS_OPEN)
......@@ -1202,69 +1282,73 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
updateFilterTextViewStatus(tvArea, FILTER_STATUS_NORMAL)
}
}
regionPopupWindow.onRegionSelectedListener = object : AreaPopupWindow.OnRegionSelectedListener {
override fun onRegionSelected(region: RegionItem, sub: SubItem) {
updateFilterTextViewStatus(tvArea, FILTER_STATUS_OPEN)
allFilter.region = region
allFilter.sub = sub
if (region.key == null && sub.key == null) {
regionPopupWindow.onRegionSelectedListener =
object : AreaPopupWindow.OnRegionSelectedListener {
override fun onRegionSelected(region: RegionItem, sub: SubItem) {
updateFilterTextViewStatus(tvArea, FILTER_STATUS_OPEN)
allFilter.region = region
allFilter.sub = sub
if (region.key == null && sub.key == null) {
// LogUtil.d("onRegionSelected: " + region.value)
// props1.put("filtrate_second", region.value)
// BuryPointUtils.buryPoint("Filtrate", props1)
tvArea.text = "地区"
} else if (region.key != null && sub.key == null) {
tvArea.text = "地区"
} else if (region.key != null && sub.key == null) {
// LogUtil.d("onRegionSelected: " + region.value)
// props1.put("filtrate_second", region.value)
// BuryPointUtils.buryPoint("Filtrate", props1)
if (region.value?.length ?: 0 > 4) {
tvArea.text = region.value?.substring(0, 3) + "..."
if (region.value?.length ?: 0 > 4) {
tvArea.text = region.value?.substring(0, 3) + "..."
} else {
tvArea.text = region.value
}
} else {
tvArea.text = region.value
}
} else {
// LogUtil.d("onRegionSelected: " + sub.value)
// props1.put("filtrate_second", sub.value)
// BuryPointUtils.buryPoint("Filtrate", props1)
if (sub.value?.length ?: 0 > 4) {
tvArea.text = sub.value?.substring(0, 3) + "..."
} else {
tvArea.text = sub.value
if (sub.value?.length ?: 0 > 4) {
tvArea.text = sub.value?.substring(0, 3) + "..."
} else {
tvArea.text = sub.value
}
}
}
ActionCountUtils.count(ConsultBIConstants.ConsultEvent.APP_CONSULT_LIST_AREA_CLICK, region.value + "|" + sub.value)
//更新热门搜索显示状态
if (headData!!.highlighter.size > 0) {
for ((index, hot) in headData!!.highlighter!!.withIndex()) {
if (hot.type == "2" || hot.type == "8") {
var textview = lin_filter2.getChildAt(index) as TextView
//有选择城市
if (!TextUtils.isEmpty(sub.key)) {
if (TextUtils.equals(sub.key, hot.id)) {
textview.isSelected = true
textview.paint.isFakeBoldText = true
hasSelectedArea = true
} else {
textview.isSelected = false
textview.paint.isFakeBoldText = false
}
} else {
if (TextUtils.equals(region.key, hot.id)) {
textview.isSelected = true
textview.paint.isFakeBoldText = true
hasSelectedArea = true
ActionCountUtils.count(
ConsultBIConstants.ConsultEvent.APP_CONSULT_LIST_AREA_CLICK,
region.value + "|" + sub.value
)
//更新热门搜索显示状态
if (headData!!.highlighter.size > 0) {
for ((index, hot) in headData!!.highlighter!!.withIndex()) {
if (hot.type == "2" || hot.type == "8") {
var textview = lin_filter2.getChildAt(index) as TextView
//有选择城市
if (!TextUtils.isEmpty(sub.key)) {
if (TextUtils.equals(sub.key, hot.id)) {
textview.isSelected = true
textview.paint.isFakeBoldText = true
hasSelectedArea = true
} else {
textview.isSelected = false
textview.paint.isFakeBoldText = false
}
} else {
textview.isSelected = false
textview.paint.isFakeBoldText = false
if (TextUtils.equals(region.key, hot.id)) {
textview.isSelected = true
textview.paint.isFakeBoldText = true
hasSelectedArea = true
} else {
textview.isSelected = false
textview.paint.isFakeBoldText = false
}
}
}
}
}
regionPopupWindow.dismiss()
refresh()
}
regionPopupWindow.dismiss()
refresh()
}
}
} else {
ToastUtil.toastShort("数据初始化失败,请重试")
getPresenter().fetchListHead()
......@@ -1304,7 +1388,10 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
* 新增逻辑:当主题选择后,需要判断热门筛选中是否也有该主题,如果有,也需要同步更新选中状态
*/
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) {
//显示选中标题
tvSubject.text = categories[0].cateName
......@@ -1323,7 +1410,11 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
textview.paint.isFakeBoldText = false
}
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 {
textview.isSelected = true
textview.paint.isFakeBoldText = true
......@@ -1380,7 +1471,10 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
// return
// }
ActionCountUtils.count(ConsultBIConstants.UserMainEvent.YDL_USER_SEARCH_CLICK, keyWord ?: "")
ActionCountUtils.count(
ConsultBIConstants.UserMainEvent.YDL_USER_SEARCH_CLICK,
keyWord ?: ""
)
isDoSearch = true
resetFilter()
refresh()
......@@ -1416,17 +1510,32 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
FILTER_STATUS_NORMAL -> {
tv.typeface = Typeface.defaultFromStyle(Typeface.NORMAL)
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 -> {
tv.typeface = Typeface.DEFAULT_BOLD
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 -> {
tv.typeface = Typeface.DEFAULT_BOLD
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
)
}
}
}
......@@ -1444,11 +1553,11 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
*/
fun bury(keyworks: String, isResult: Boolean, isRecommend: Boolean, location: String) {
BuryPointUtils.getInstance().createMap()
.put("keyWord", keyworks)
.put("hasResult", isResult)
.put("isRecommend", isRecommend)
.put("location", location)
.burryPoint("search")
.put("keyWord", keyworks)
.put("hasResult", isResult)
.put("isRecommend", isRecommend)
.put("location", location)
.burryPoint("search")
}
override fun onResume() {
......
......@@ -361,9 +361,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
v_loading.visibility = View.VISIBLE
v_loading.setViewType(LogoLoadingView.TYPE_LOADING, null)
if (fromPageType != -1) {
doctorAdapter.setEntrance(fromPages[fromPageType], 0)
}
doctorAdapter.setEntrance(0)
}
/**
......
......@@ -59,11 +59,9 @@ class ExpertSearchAdapter(
var hasMore = true
var entranceName: String? = null
var pageIndex: Int = 0
fun setEntrance(entranceName: String, pageIndex: Int) {
this.entranceName = entranceName
fun setEntrance(pageIndex: Int) {
this.pageIndex = pageIndex
}
......@@ -465,14 +463,6 @@ class ExpertSearchAdapter(
} else {
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