Commit d2e3abca by ydl

merge

parents 249f2afc 2beef95f
......@@ -42,12 +42,12 @@ ext {
ydlPublishVersion = [
// -------------- 业务模块 --------------
//第三步 若干
"m-confide" : "0.0.48.11",
"m-consultant" : "0.0.58.6",
"m-confide" : "0.0.48.12",
"m-consultant" : "0.0.59.0",
"m-fm" : "0.0.29.3",
"m-user" : "0.0.60.4",
"m-home" : "0.0.19.1",
"m-im" : "0.0.17.9",
"m-home" : "0.0.21.4",
"m-im" : "0.0.18.0",
"m-dynamic" : "0.0.7.5",
"m-muse" : "0.0.28.9",
......@@ -69,14 +69,14 @@ ext {
//-------------- 功能组件 --------------
//第一步
"ydl-platform" : "0.0.39.22",
"ydl-platform" : "0.0.39.24",
//第二步 若干
"ydl-webview" : "0.0.38.24",
"ydl-webview" : "0.0.38.29",
"ydl-media" : "0.0.20",
"ydl-pay" : "0.0.17",
"m-audioim" : "0.0.48.3.14",
"ydl-flutter-base": "0.0.10.9",
"m-audioim" : "0.0.48.3.16",
"ydl-flutter-base": "0.0.14.12",
//以下 几乎不会动
"router" : "0.0.1",
......@@ -115,13 +115,13 @@ ext {
//-------------- 功能组件 --------------
//第一步
"ydl-platform" : "0.0.39.21",
"ydl-platform" : "0.0.39.24",
//第二步 若干
"ydl-webview" : "0.0.38.24",
"ydl-webview" : "0.0.38.29",
"ydl-media" : "0.0.20",
"ydl-pay" : "0.0.17",
"m-audioim" : "0.0.48.3.14",
"m-audioim" : "0.0.48.3.16",
"ydl-flutter-base": "0.0.10.9",
//以下 几乎不会动
......@@ -270,7 +270,7 @@ ext {
//flutter功能组件升级===>发布ydl-flutter组件===>引用flutter相关的业务模块
"ydl-flutter-base" : "com.ydl:ydl-flutter-base:${ydlCompileVersion["ydl-flutter-base"]}", //组件化项目中的flutter base模块
"ydl-flutter" : "com.ydl:ydl-flutter:0.0.18.0@aar", //flutter aar
"ydl-flutter" : "com.ydl:ydl-flutter:0.0.18.9@aar", //flutter aar
"ydl-flutter-sp" : "com.ydl:ydl-flutter-sp:0.0.2@aar", //flutter 缓存 aar
//基础组件 <<--- 先发这个,发完改这里的版本号
......
......@@ -56,6 +56,7 @@ import com.ydl.ydlcommon.utils.log.LogHelper
import com.ydl.ydlcommon.utils.remind.ToastHelper
import com.yidianling.user.api.service.IUserService
import de.greenrobot.event.EventBus
import io.agora.rtc.Constants
import io.agora.rtc.IRtcEngineEventHandler
import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers
......@@ -190,6 +191,7 @@ class AudioHomeActivity :
runOnUiThread {
when (warn) {
103, 104, 105, 106, 107 -> {
writeAgoraLog("通话挂断:网络异常(${warn})")
showToast("当前网络较差,请更换网络!")
//通话结束或挂断时,上传日志文件
uploadLog()
......@@ -259,6 +261,7 @@ class AudioHomeActivity :
//更新:现在专家先加入频道,所以不会有等待的过程,
runOnUiThread {
writeAgoraLog("主叫加入频道成功")
//自己加入频道成功
connectSuccess()
}
......@@ -271,6 +274,7 @@ class AudioHomeActivity :
runOnUiThread {
//自己加入频道成功
if (!isConnectSuccess) {
writeAgoraLog("主叫重新加入频道成功")
connectSuccess()
}
}
......@@ -281,6 +285,7 @@ class AudioHomeActivity :
super.onRtcStats(stats)
//因为用户端直接加入了频道,防止该回调执行时,专家还未加入频道,因此在连接成功之后,才进行频道人数判断
if (isConnectSuccess && null != stats?.users && stats.users == 1) {
writeAgoraLog("通话结束:用户加入了频道,但频道内只有一个人")
com.yidianling.common.tools.ToastUtil.toastShort("专家已挂断")
//通话结束或挂断时,上传日志文件
uploadLog()
......@@ -292,6 +297,7 @@ class AudioHomeActivity :
super.onConnectionStateChanged(state, reason)
// 3 网络连接被服务器中止 该情况现在是因为后端踢人逻辑
if (reason == 3) {
writeAgoraLog("通话结束:原因(${reason})")
com.yidianling.common.tools.ToastUtil.toastShort("专家已挂断")
//通话结束或挂断时,上传日志文件
uploadLog()
......@@ -306,15 +312,6 @@ class AudioHomeActivity :
uploadLog()
}
override fun onLastmileQuality(quality: Int) {
super.onLastmileQuality(quality)
// LogUtil.e("[agora]网络质量报告回调${quality}")
}
override fun onConnectionInterrupted() {
super.onConnectionInterrupted()
LogUtil.e("[agora]连接中断回调")
}
override fun onUserJoined(uid: Int, elapsed: Int) {
super.onUserJoined(uid, elapsed)
......@@ -324,6 +321,7 @@ class AudioHomeActivity :
override fun onUserOffline(uid: Int, elapsed: Int) {
super.onUserOffline(uid, elapsed)
LogUtil.e("[agora]远端用户$uid 离开频道回调")
writeAgoraLog("接通后通话结束:对方已挂断")
//通话结束或挂断时,上传日志文件
uploadLog()
showToast("专家已挂断")
......@@ -354,16 +352,19 @@ class AudioHomeActivity :
initSensorManager()
//页面传递数据初始化
initIntentData()
if (YDLavManager.sdkStatus != Constants.CONNECTION_STATE_CONNECTED) {
//再次登录声网,确保声网登录状态
reLoginRTM()
}
//view初始化
initView()
//设置信令的回调
setCallBack()
//点击事件
setClickEvent()
//权限申请
requestPermission()
}
private fun setWindowStatusBarColor() {
StatusBarUtils.setWindowStatusBarColor(this, R.color.audioim_color_40353535)
}
......@@ -393,14 +394,6 @@ class AudioHomeActivity :
listenId = intent.getStringExtra(IntentConstants.INTENT_LISTEN_ID)
commentUrl = intent.getStringExtra(IntentConstants.INTENT_COMMENT_URL)
writeAgoraLog()
localRemainTime = remainTime?.toInt()
handler = Handler()
vibrator = getSystemService(Service.VIBRATOR_SERVICE) as Vibrator?
}
private fun writeAgoraLog() {
val logBean = AgoraLogInfoBean(
expertHeadUrl,
expertName,
......@@ -411,18 +404,25 @@ class AudioHomeActivity :
callId,
listenId
)
val content = Gson().toJson(logBean)
writeAgoraLog("主叫方发送的邀请通话消息内容:$content", isAppend = false)
Observable.create<Any> {
try {
val content = Gson().toJson(logBean)
AudioLogUtils.writeAgoraLog(content,"confide")
} catch (e: Exception) {
}
}.subscribeOn(Schedulers.io())
.subscribe()
localRemainTime = remainTime?.toInt()
handler = Handler()
vibrator = getSystemService(Service.VIBRATOR_SERVICE) as Vibrator?
}
private fun reLoginRTM() {
writeAgoraLog("RMT状态:${YDLavManager.sdkStatus},重新登录RMT")
val uid=YdlCommonRouterManager.getYdlCommonRoute().getUid().toString()
YDLavManager.instances.login(uid) { _isSuccess, _msg ->
writeAgoraLog("登录RTM的uid=${uid}")
val result = if (_isSuccess) "RMT登录成功" else "RMT登录失败:$_msg"
writeAgoraLog(result)
}
}
private fun initView() {
tv_change_route.isEnabled = false
//水波纹view初始化
......@@ -461,8 +461,8 @@ class AudioHomeActivity :
return@setOnClickListener
}
if (isConnectSuccess) {
writeAgoraLog("已接通:主叫主动挂断")
updateExpertStatus(false, 1)
// userCloseCalling()
leaveChannel()
uploadLog()
} else {
......@@ -499,71 +499,6 @@ class AudioHomeActivity :
}
}
private fun setCallBack() {
/**
* RTC 回调 在[YDLavManager.setCallback]中注册使用
*/
// //RTC 回调
// YDLRTMClient.instances.setCallListener(object : CallListener {
// override fun onCallRecivedByPeer(response: CallLocalResponse?) {
// playWaitingMusic()
// //返回给主叫:被叫已收到呼叫邀请
// LogUtil.i("[agora]${response?.calleeId}已收到呼叫邀请,频道号${response?.ChannelId}")
// }
//
// override fun onCallAccepted(response: CallLocalResponse?, msg: String?) {
// //返回给主叫
// LogUtil.i("[agora]${response?.calleeId}已接受呼叫邀请")
// //加入声网频道时机修改:用户收到专家接受邀请的回调后再加入声网频道
// joinChannel()
// }
//
// override fun onCallRefused(response: CallLocalResponse?, msg: String?) {
// //返回给主叫
// LogUtil.i("[agora]${response?.calleeId}已拒绝呼叫邀请")
// ToastUtil.showToast(applicationContext, "对方已挂断")
// //通话结束或挂断时,上传日志文件
// uploadLog()
// leaveChannel()
// }
//
// override fun onCallCanceled(response: CallLocalResponse?) {
// //返回给主叫
// LogUtil.i("[agora]主叫已取消呼叫邀请")
// }
//
// override fun onCallFailure(response: CallLocalResponse?, errorCode: Int) {
// //返回给主叫
// LogUtil.i("[agora]呼叫${response?.calleeId}用户失败:${response?.response}")
// //专家离线或者30 秒后仍未收到专家响应,重新再邀请一次
// when (errorCode) {
// //被叫不在线 呼叫邀请发出 30 秒后被叫仍未 ACK 响应呼叫邀请
// RtmStatusCode.LocalInvitationError.LOCAL_INVITATION_ERR_PEER_OFFLINE,
// RtmStatusCode.LocalInvitationError.LOCAL_INVITATION_ERR_PEER_NO_RESPONSE -> {
// rtcCall()
// }
// RtmStatusCode.LocalInvitationError.LOCAL_INVITATION_ERR_INVITATION_EXPIRE -> {//呼叫邀请过期。被叫 ACK 响应呼叫邀请后 60 秒呼叫邀请未被取消、接受、拒绝,则呼叫邀请过期。
//
// }
// }
// }
//
// override fun onMessageReceived(message: RTMMesssage?, member: ChannelMember?) {
// //接到频道消息
// LogUtil.i("[agora]接到${member?.channelId}频道${member?.userId}的消息:" + message?.text)
// }
//
// override fun onMemberJoined(member: ChannelMember?) {
// //新用户加入频道
// LogUtil.i("[agora]新用户加入${member?.channelId}频道:${member?.userId}")
// }
//
// override fun onMemberLeft(member: ChannelMember?) {
// LogUtil.i("[agora]有用户离开${member?.channelId}频道:${member?.userId}")
// }
// })
}
/**
* 请求权限
*/
......@@ -609,22 +544,9 @@ class AudioHomeActivity :
)
sendDoctocrMsg = Gson().toJson(msgBean)
writeAgoraLog("主叫发送通话邀请")
rtcCall()
// Observable.interval(0, 100, TimeUnit.MILLISECONDS)
// .subscribeOn(Schedulers.computation())
// .take(303)
// .observeOn(AndroidSchedulers.mainThread())
// .subscribe({
// var result = it.toFloat() / 2.5f
// progress_view.setProgress(result)
// if (result >= 100f && !iv_hang_up.isEnabled) {
// //挂断按钮可点击
// iv_hang_up.isEnabled = true
// iv_hang_up.setImageResource(R.drawable.audioim_img_hang_up)
// }
// }, {}, {})
//开始60s等待倒计时
waitDisposable = Observable.interval(0, 100, TimeUnit.MILLISECONDS)
......@@ -646,6 +568,7 @@ class AudioHomeActivity :
if (!isConnectSuccess) {
//关闭音乐
stopPlaying()
writeAgoraLog("未接通挂断:60s等待倒计时结束挂断")
//提示切换传统线路
//发送消息通知专家用户已挂断
YDLRTMClient.instances.cancelCall(listenerUid, channelId,object :CancelCallStatusListener{
......@@ -689,6 +612,7 @@ class AudioHomeActivity :
* 声网加入频道
*/
fun joinChannel() {
writeAgoraLog("对方接受了通话邀请,主叫开始加入频道:$channelId")
voiceManage!!.getVoiceApi().joinChannel(
token!!,
channelId!!,
......@@ -703,10 +627,11 @@ class AudioHomeActivity :
*
*/
private fun userCloseCalling() {
//发送消息通知专家用户已挂断
writeAgoraLog("未接听时:主叫主动挂断,取消呼叫")
//发送消息通知专家用户已挂断
YDLRTMClient.instances.cancelCall(listenerUid, channelId,object :CancelCallStatusListener{
override fun onFailure(errorMsg: String?, errorCode: Int) {
writeAgoraLog("未接听时:主叫主动挂断失败,msg=$errorMsg($errorCode),再次挂断")
YDLRTMClient.instances.cancelCall(listenerUid, channelId,null)
}
......@@ -1166,6 +1091,14 @@ class AudioHomeActivity :
}
fun writeAgoraLog(content: String, isAppend: Boolean = true) {
try {
AudioLogUtils.writeAgoraLog(content, "confide", isAppend)
} catch (e: Exception) {
}
}
override fun finishActivity() {
leaveChannel()
}
......
......@@ -2,11 +2,13 @@ package com.ydl.audioim
import android.annotation.SuppressLint
import android.content.Context
import android.os.Handler
import android.text.TextUtils
import com.alibaba.android.arouter.launcher.ARouter
import com.google.gson.Gson
import com.ydl.audioim.http.AudioApiRequestUtil
import com.ydl.audioim.http.command.ConnectExceptionCommand
import com.ydl.audioim.utils.AudioLogUtils
import com.ydl.consultantim.ConsultantAudioHomeActivity
import com.ydl.ydl_av.chat.bean.AudioMessageBean
import com.ydl.ydl_av.messge_service.YDLRTMClient
......@@ -38,6 +40,10 @@ class YDLavManager {
companion object {
val FILE_NAME="consult"
//当前sdk的登录状态
var sdkStatus = -1
val instances: YDLavManager by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
YDLavManager()
}
......@@ -49,6 +55,14 @@ class YDLavManager {
YDLRTMClient.instances.init(context, appId, listener)
//设置回调
setCallback()
val uid= ModularServiceManager.provide(IUserService::class.java).getUserInfo()?.uid
if (!TextUtils.isEmpty(uid) && !TextUtils.equals("0", uid)) {
//不延时,可能会导致请求api报 network not unablibale
Handler().postDelayed({
login(uid)
}, 300)
}
}
......@@ -88,6 +102,7 @@ class YDLavManager {
if (act is AudioHomeActivity) {
act.runOnUiThread {
ToastUtil.toastShort("对方已挂断")
act. writeAgoraLog("被叫拒绝了通话邀请")
//通话结束或挂断时,上传日志文件
act.uploadLog()
act.leaveChannel()
......@@ -100,17 +115,23 @@ class YDLavManager {
override fun onCallCanceled(response: CallLocalResponse?) {
//返回给主叫
LogUtil.e("[agora]主叫已取消呼叫邀请")
val act = ActivityManager.getInstance().getTopTaskActivity()
if (act is AudioHomeActivity) {
act.runOnUiThread {
act.writeAgoraLog("主叫呼叫取消:超时或主动取消")
}
}
}
override fun onCallFailure(response: CallLocalResponse?, errorCode: Int) {
//返回给主叫
LogUtil.e("[agora]呼叫${response?.calleeId}用户失败:${response?.response}")
val act = ActivityManager.getInstance().getTopTaskActivity()
//专家离线或者30 秒后仍未收到专家响应,重新再邀请一次
when (errorCode) {
//被叫不在线 呼叫邀请发出 30 秒后被叫仍未 ACK 响应呼叫邀请
RtmStatusCode.LocalInvitationError.LOCAL_INVITATION_ERR_PEER_OFFLINE,
RtmStatusCode.LocalInvitationError.LOCAL_INVITATION_ERR_PEER_NO_RESPONSE -> {
val act = ActivityManager.getInstance().getTopTaskActivity()
if (act is AudioHomeActivity) {
act.runOnUiThread {
act.rtcCall()
......@@ -118,7 +139,14 @@ class YDLavManager {
}
}
RtmStatusCode.LocalInvitationError.LOCAL_INVITATION_ERR_INVITATION_EXPIRE -> {//呼叫邀请过期。被叫 ACK 响应呼叫邀请后 60 秒呼叫邀请未被取消、接受、拒绝,则呼叫邀请过期。
if (act is AudioHomeActivity) {
act.runOnUiThread {
act. writeAgoraLog("呼叫失败:${errorCode}")
//通话结束或挂断时,上传日志文件
act.uploadLog()
act.leaveChannel()
}
}
}
}
}
......@@ -126,7 +154,7 @@ class YDLavManager {
override fun onRemoteInvitationReceived(response: CallRemoteResponse?) {
//返回给被叫
LogUtil.e("[agora]收到来自${response?.callerId}的呼叫邀请")
receivedCall(response?.content)
receivedCall(response?.content, "来自RTM")
}
override fun onRemoteInvitationAccepted(response: CallRemoteResponse?) {
......@@ -142,12 +170,18 @@ class YDLavManager {
override fun onRemoteInvitationCanceled(response: CallRemoteResponse?) {
//返回给被叫
LogUtil.e("[agora]主叫${response?.callerId}已取消呼叫邀请")
AudioLogUtils.writeAgoraLog("呼叫邀请被取消:主叫主动取消",FILE_NAME)
closePage()
}
override fun onRemoteInvitationFailure(response: CallRemoteResponse?, errorCode: Int) {
//返回给被叫
LogUtil.e("[agora]来自主叫${response?.callerId}的呼叫邀请进程失败:${response?.response}")
if (errorCode == RtmStatusCode.RemoteInvitationError.REMOTE_INVITATION_ERR_INVITATION_EXPIRE) {//呼叫邀请过期
AudioLogUtils.writeAgoraLog("呼叫邀请被取消:呼叫邀请过期",FILE_NAME)
} else {
AudioLogUtils.writeAgoraLog("呼叫邀请被取消:错误原因(${errorCode})",FILE_NAME)
}
//关闭页面
closePage()
}
......@@ -158,8 +192,16 @@ class YDLavManager {
})
}
@SuppressLint("CheckResult")
fun login(userId: String?) {
login(userId) { _, _ ->
}
}
@SuppressLint("CheckResult")
fun login(userId: String?, event: (isSuccess: Boolean, msg: String?) -> Unit) {
if (TextUtils.isEmpty(userId) || userId ?: "0" <= "0") {
//如果uid为空或小于等于0 ,则不进行登录,因为uid为0也会登录成功,会导致后面uid正确时无法登录
LogUtil.e("[agora]login-uid:$userId")
......@@ -177,10 +219,12 @@ class YDLavManager {
override fun onSuccess() {
//登陆成功,发起呼叫
LogUtil.e("[agora]实时消息登录成功")
event(true, "")
}
override fun onFailure(msg: String?) {
LogUtil.e("[agora]实时消息登录失败:$msg")
event(false, msg)
}
})
......@@ -199,7 +243,7 @@ class YDLavManager {
* 收到邀请
*/
@SuppressLint("CheckResult")
fun receivedCall(content: String?) {
fun receivedCall(content: String?, from: String = "") {
if (!TextUtils.isEmpty(content)) {
//如果已经接听了用户电话 再有电话进来 是不能接听的
if (!activityIsExists(ConsultantAudioHomeActivity::class.java) && !activityIsExists(
......@@ -215,14 +259,10 @@ class YDLavManager {
ARouter.getInstance().build("/av/ConsultantAudioHomeActivity")
.withString("param", content)
.navigation()
AudioLogUtils.writeAgoraLog("收到主叫方通话邀请($from)", FILE_NAME, false)
}
} else {
try {
val mAudioMessageBean = Gson().fromJson(content, AudioMessageBean::class.java)
YDLRTMClient.instances.refuseCall(mAudioMessageBean.channelId)
} catch (e: Exception) {
}
LogUtil.d("[agora]收到声网邀请,但界面实例已存在")
}
} else {
......@@ -303,6 +343,7 @@ class YDLavManager {
}
override fun onConnectionStateChanged(state: Int, reason: Int) {
sdkStatus = state
LogUtil.i("[agora]onConnectionStateChanged:state:${state} -->reason:$reason")
}
......
......@@ -29,10 +29,10 @@ class AudioLogUtils {
@SuppressLint("SimpleDateFormat")
private val format = SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
fun writeAgoraLog(content: String, fileName: String) {
fun writeAgoraLog(content: String, fileName: String, isAppend: Boolean = true) {
Observable.create<Any> {
try {
writeLog(content, fileName)
writeLog(content, fileName, isAppend)
if (BuildConfig.DEBUG) {
LogUtil.d("writeLog_complete")
}
......@@ -42,7 +42,7 @@ class AudioLogUtils {
.subscribe()
}
private fun writeLog(content: String, fileName: String) {
private fun writeLog(content: String, fileName: String, isAppend: Boolean) {
try {
val folder = getLogFolder()
val file = File(folder, fileName)
......@@ -51,19 +51,21 @@ class AudioLogUtils {
}
val fileWriter = FileWriter(file, true)
val writer = BufferedWriter(fileWriter)
writer.write("""Time:${format.format(Calendar.getInstance().time)}""")
writer.newLine()
writer.write("UserUid = ${ModularServiceManager.getPlatformUserService()?.getUser()?.userId}")
writer.newLine()
writer.write("""Network:${RxNetTool.getNetWorkTypeName(BaseApp.getApp())}""")
writer.newLine()
writer.write("""DevicesInfo:${RxDeviceTool.getBuildBrandModel()},${RxDeviceTool.getSDKVersionName()}""")
writer.newLine()
writer.write("""VersionInfo:${RxAppTool.getAppVersionName(BaseApp.getApp())}""")
writer.newLine()
writer.write("AgoraLog:$content")
writer.newLine()
writer.write("--------")
if (!isAppend) {
writer.write("----------------")
writer.newLine()
writer.write("""Time:${format.format(Calendar.getInstance().time)}""")
writer.newLine()
writer.write("ExpertUid = ${ModularServiceManager.getPlatformUserService()?.getUser()?.userId}")
writer.newLine()
writer.write("""Network:${RxNetTool.getNetWorkTypeName(BaseApp.getApp())}""")
writer.newLine()
writer.write("""DevicesInfo:${RxDeviceTool.getBuildBrandModel()},${RxDeviceTool.getSDKVersionName()}""")
writer.newLine()
writer.write("""VersionInfo:${RxAppTool.getAppVersionName(BaseApp.getApp())}""")
writer.newLine()
}
writer.write(content)
writer.newLine()
writer.flush()
writer.close()
......
......@@ -52,6 +52,7 @@ import com.ydl.ydlcommon.utils.remind.ToastHelper
import com.yidianling.common.tools.ToastUtil
import com.yidianling.user.api.service.IUserService
import de.greenrobot.event.EventBus
import io.agora.rtc.Constants
import io.agora.rtc.IRtcEngineEventHandler
import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers
......@@ -128,9 +129,12 @@ class ConsultantAudioHomeActivity :
override fun onJoinChannelSuccess(channel: String?, uid: Int, elapsed: Int) {
super.onJoinChannelSuccess(channel, uid, elapsed)
LogUtil.e("[agora]$uid 加入频道回调")
// 加入频道后再通知用户已接受
YDLRTMClient.instances.acceptCall(mAudioMessageBean?.channelId)
writeAgoraLog("被叫加入声网($channel)频道成功")
runOnUiThread {
// 加入频道后再通知用户已接受
YDLRTMClient.instances.acceptCall(mAudioMessageBean?.channelId)
tv_toast.visibility = View.VISIBLE
tv_toast.text = "连接中..."
......@@ -143,9 +147,32 @@ class ConsultantAudioHomeActivity :
}
}
/**
* 重新加入频道回调
*/
override fun onRejoinChannelSuccess(channel: String?, uid: Int, elapsed: Int) {
super.onRejoinChannelSuccess(channel, uid, elapsed)
LogUtil.e("[agora]$uid 重新加入频道回调")
writeAgoraLog("被叫重新加入声网频道($channel)成功")
runOnUiThread {
if (!isConnectSuccess) {
tv_toast.visibility = View.VISIBLE
tv_toast.text = "连接中..."
voiceManage!!.getVoiceApi().setEnableSpeakerphone(false)
//5s倒计时,5s后还是连接中,则直接关闭页面
connectingStatusWaitingTimeCount()
}
}
}
override fun onUserJoined(uid: Int, elapsed: Int) {
super.onUserJoined(uid, elapsed)
LogUtil.e("[agora]远端用户加入频道回调")
writeAgoraLog("主叫加入声网频道成功")
//另一方加入频道成功
runOnUiThread {
isConnectSuccess = true
......@@ -166,6 +193,7 @@ class ConsultantAudioHomeActivity :
// 3 网络连接被服务器中止 该情况现在是因为后端踢人逻辑
if (reason == 3) {
ToastUtil.toastShort("对方已挂断")
writeAgoraLog("通话挂断:网络连接被服务器中止")
//通话结束或挂断时,上传日志文件
uploadLog()
leaveChannel()
......@@ -203,6 +231,7 @@ class ConsultantAudioHomeActivity :
LogUtil.e("[agora]$uid 主播离开频道回调")
runOnUiThread {
showLongToast("对方已挂断")
writeAgoraLog("通话接通后挂断:主叫离开频道")
//通话结束或挂断时,上传日志文件
uploadLog()
if (null != totalDisposable) {
......@@ -214,27 +243,6 @@ class ConsultantAudioHomeActivity :
}
/**
* 重新加入频道回调
*/
override fun onRejoinChannelSuccess(channel: String?, uid: Int, elapsed: Int) {
super.onRejoinChannelSuccess(channel, uid, elapsed)
LogUtil.e("[agora]$uid 重新加入频道回调")
runOnUiThread {
if (!isConnectSuccess) {
tv_toast.visibility = View.VISIBLE
tv_toast.text = "连接中..."
voiceManage!!.getVoiceApi().setEnableSpeakerphone(false)
//5s倒计时,5s后还是连接中,则直接关闭页面
connectingStatusWaitingTimeCount()
}
}
}
/**
* 网络质量报告回调
* 报告本地用户的网络质量。当你调用 enableLastmileTest 之后,该回调函数每 2 秒触发一次
*/
......@@ -257,6 +265,7 @@ class ConsultantAudioHomeActivity :
runOnUiThread {
when (warn) {
103, 104, 105, 106, 107 -> {
writeAgoraLog("通话挂断:网络异常($warn)")
showLongToast("当前网络较差,请更换网络!")
//通话结束或挂断时,上传日志文件
uploadLog()
......@@ -339,8 +348,6 @@ class ConsultantAudioHomeActivity :
ConsultantAudioUtils.wakeUpAndUnlock(this)
//页面传递数据初始化
getParam()
//设置信令的回调
setCallback()
//初始化传感器
initSensorManager()
initUser()
......@@ -362,10 +369,20 @@ class ConsultantAudioHomeActivity :
if (null != intent.getStringExtra(PARAM)) {
val json = intent.getStringExtra(PARAM)
if (!TextUtils.isEmpty(json)) {
writeAgoraLog(json)
writeAgoraLog("收到邀请通话消息内容:$json")
mAudioMessageBean = Gson().fromJson(json, AudioMessageBean::class.java)
YDLavManager.instances.login(ModularServiceManager.provide(IUserService::class.java).getUserInfo()?.uid)
if (YDLavManager.sdkStatus != Constants.CONNECTION_STATE_CONNECTED) {
writeAgoraLog("RMT状态:${YDLavManager.sdkStatus},重新登录RMT")
val uid =
ModularServiceManager.provide(IUserService::class.java).getUserInfo()?.uid
YDLavManager.instances.login(uid) { _isSuccess, _msg ->
writeAgoraLog("登录RTM的uid=${uid}")
val result = if (_isSuccess) "RMT登录成功" else "RMT登录失败:$_msg"
writeAgoraLog(result)
}
}
}
} else {
close(RESULT_NOT_ANSWERED_CODE, "通话异常")
......@@ -373,69 +390,6 @@ class ConsultantAudioHomeActivity :
}
}
private fun setCallback() {
/**
* RTC 回调 在[YDLavManager.setCallback]中注册使用
*/
// YDLRTMClient.instances.setCallListener(object : CallListener {
// override fun onCallRecivedByPeer(response: CallLocalResponse?) {
// //返回给主叫:被叫已收到呼叫邀请
// LogUtil.I("[agora]${response?.calleeId}已收到呼叫邀请,频道号${response?.ChannelId}")
// }
//
// override fun onCallAccepted(response: CallLocalResponse?, msg: String?) {
// //返回给主叫
// LogUtil.I("[agora]${response?.calleeId}已接受呼叫邀请")
// }
//
// override fun onCallRefused(response: CallLocalResponse?, msg: String?) {
// //返回给主叫
// LogUtil.I("[agora]${response?.calleeId}已拒绝呼叫邀请")
// }
//
// override fun onCallCanceled(response: CallLocalResponse?) {
// //返回给主叫
// LogUtil.I("[agora]主叫已取消呼叫邀请")
// }
//
// override fun onCallFailure(response: CallLocalResponse?, errorCode: Int) {
// //返回给主叫
// LogUtil.I("[agora]呼叫${response?.calleeId}用户失败:${response?.response}")
//
// }
//
// override fun onRemoteInvitationReceived(response: CallRemoteResponse?) {
// //返回给被叫
// LogUtil.I("[agora]收到来自${response?.callerId}的呼叫邀请")
// }
//
// override fun onRemoteInvitationAccepted(response: CallRemoteResponse?) {
// //返回给被叫
// LogUtil.I("[agora]接受来自${response?.callerId}的呼叫成功")
// }
//
// override fun onRemoteInvitationRefused(response: CallRemoteResponse?) {
// //返回给被叫
// LogUtil.I("[agora]已拒绝来自${response?.callerId}的呼叫")
// }
//
// override fun onRemoteInvitationCanceled(response: CallRemoteResponse?) {
// //返回给被叫
// LogUtil.I("[agora]主叫${response?.callerId}已取消呼叫邀请")
// }
//
// override fun onRemoteInvitationFailure(response: CallRemoteResponse?, errorCode: Int) {
// //返回给被叫
// LogUtil.I("[agora]来自主叫${response?.callerId}的呼叫邀请进程失败:${response?.response}")
// }
//
// override fun onOtherMsg(error: String?) {
// LogUtil.I("[agora]其它消息:${error}")
// }
// })
}
@SuppressLint("InvalidWakeLockTag")
private fun initSensorManager() {
sensorManager = getSystemService(Context.SENSOR_SERVICE) as SensorManager?
......@@ -493,6 +447,7 @@ class ConsultantAudioHomeActivity :
* //获取声网频道号
*/
private fun getChannelToken() {
writeAgoraLog("获取声网token")
//获取频道token
mPresenter.getChannelToken(mAudioMessageBean, false)
}
......@@ -506,6 +461,7 @@ class ConsultantAudioHomeActivity :
return
}
this.channelToken = token
writeAgoraLog("返回的声网token=$channelToken")
if (needJoinChannel) {
//权限申请
requestPermission()
......@@ -622,11 +578,13 @@ class ConsultantAudioHomeActivity :
private fun showStopService() {
if (status == STATUS_NOT_ANSWERED) {
writeAgoraLog("通话未接通挂断:主动挂断")
//通话结束或挂断时,上传日志文件
uploadLog()
//当未接听 直接挂断 要发送给老师一条消息
close(RESULT_NOT_ANSWERED_CODE, "用户已挂断")
} else if (status == STATUS_ANSWERED) {
writeAgoraLog("通话接通后挂断:专家主动挂断")
//正常接听 挂断电话 需要重置信令管理类状态
close(RESULT_ANSWERED_CODE, "")
}
......@@ -842,6 +800,7 @@ class ConsultantAudioHomeActivity :
.observeOn(AndroidSchedulers.mainThread())
.subscribe({}, {}, {
if (!isConnectSuccess) {
writeAgoraLog("通话未接通挂断:连接中的状态超过5s自动挂断")
ToastUtil.toastShort(this, "用户已挂断")
close(RESULT_NOT_ANSWERED_CODE, "")
}
......
......@@ -86,9 +86,6 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE or WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN)
initViews()
initData(intent)
ActionCountUtils.count("main_page|app_consult_list_page_visit|app_consult_list_page_visit")
}
override fun getStatusViewOptions(): StatusBarOptions {
......@@ -174,8 +171,8 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
private var headData: HeadData? = null //筛选数据
private var isFromSplash = false
private val props1 = JSONObject() //筛选标题埋点参数
private var fromPageType: Int = 0 //从哪个页面跳转过来的
private val fromPages = arrayOf("首页搜索", "找专家", "在线专家")
private var fromPageType: Int = 1 //从哪个页面跳转过来的
private val fromPages = arrayOf("首页", "搜索页面", "在线专家")
private var isRecommend = false //埋点数据
private var keyWord: String? = null //埋点数据
private var isDoSearch: Boolean = false //埋点判断是否通过搜索进入埋点的
......@@ -382,7 +379,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
v_loading.setViewType(LogoLoadingView.TYPE_LOADING, null)
if (fromPageType != -1) {
doctorAdapter.setEntrance(fromPages[fromPageType])
doctorAdapter.setEntrance(fromPages[fromPageType],1)
}
}
......@@ -1456,7 +1453,7 @@ class ExpertSearchActivity : BaseMvpActivity<IExpertSearchView, ExpertSearchPres
override fun onResume() {
super.onResume()
ActionCountUtils.count(ConsultBIConstants.ConsultEvent.APP_CONSULT_LIST_PAGE_VISIT)
ActionCountUtils.count(ConsultBIConstants.ConsultSearchListEvent.APP_CONSULT_SEARCH_LIST_PAGE_VISIT)
}
......
......@@ -26,6 +26,7 @@ import com.ydl.ydl_image.listener.YDLImageRecyclerOnScrollListener
import com.ydl.ydl_image.manager.YDLImageCacheManager
import com.ydl.ydlcommon.base.BaseMvpFragment
import com.ydl.ydlcommon.base.config.HttpConfig
import com.ydl.ydlcommon.data.PlatformDataManager
import com.ydl.ydlcommon.ui.LogoLoadingView
import com.ydl.ydlcommon.utils.BuryPointUtils
import com.ydl.ydlcommon.utils.DisplayUtils
......@@ -57,8 +58,9 @@ import kotlinx.android.synthetic.main.consultant_layout_search_toolbar.*
import org.json.JSONObject
import java.util.concurrent.Executors
class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPresenter>(), View.OnClickListener, IExpertSearchView,
OnCategoriesSelectedListener, OnSortItemSelectedListener, OnFilterConfirmListener,
class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPresenter>(),
View.OnClickListener, IExpertSearchView,
OnCategoriesSelectedListener, OnSortItemSelectedListener, OnFilterConfirmListener,
SwipeRefreshLayout.OnRefreshListener {
......@@ -68,13 +70,18 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
override fun initDataAndEvent() {
var statusBarHeight = StatusBarUtils.getStatusBarHeight(context);
rootView.setPadding(0,statusBarHeight,0,0)
rootView.setPadding(0, statusBarHeight, 0, 0)
btn_back.visibility = View.GONE
title_layout.setPadding(DisplayUtils.dp2px(context,15),0,0,0)
title_layout.setPadding(DisplayUtils.dp2px(context, 15), 0, 0, 0)
initViews()
initData()
ActionCountUtils.count("main_page|app_consult_list_page_visit|app_consult_list_page_visit")
val ffrom = PlatformDataManager.getRam().getChannelName()
if (!TextUtils.isEmpty(ffrom) && ffrom.endsWith("huawei")) {
rl_hot_fix_for_huawei.visibility = View.GONE
} else {
rl_hot_fix_for_huawei.visibility = View.VISIBLE
}
}
override fun initDataAndEventLazy() {
......@@ -93,7 +100,13 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
}
}
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
) {
if (isAdded) {
YDLImageCacheManager.showImage(activity, url, imgView, width, heigh, ops)
}
......@@ -134,7 +147,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
private var headData: HeadData? = null //筛选数据
private val props1 = JSONObject() //筛选标题埋点参数
private var fromPageType: Int = 0 //从哪个页面跳转过来的
private val fromPages = arrayOf("首页搜索", "找专家", "在线专家")
private val fromPages = arrayOf("首页", "搜索页面", "在线专家")
private var isRecommend = false //埋点数据
private var keyWord: String? = null //埋点数据
private var isDoSearch: Boolean = false //埋点判断是否通过搜索进入埋点的
......@@ -154,12 +167,18 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
btn_call.setOnClickListener(this)
tv_guide.setOnClickListener(this)
rl_search.setOnClickListener(this)
srlContainer.setColorSchemeColors(ContextCompat.getColor(activity, R.color.consultant_main_theme))
srlContainer.setColorSchemeColors(
ContextCompat.getColor(
activity,
R.color.consultant_main_theme
)
)
srlContainer.setProgressViewOffset(false, 0, 200)
srlContainer.setOnRefreshListener(this)
initNetLossView()
recommendListView.addViewPagerScrollStateListener(object : RecommendListView.ViewPagerScrollStateCallback {
recommendListView.addViewPagerScrollStateListener(object :
RecommendListView.ViewPagerScrollStateCallback {
override fun viewPagerScroll(isScrolling: Boolean) {
//如果viewpager正在滚动,则禁止下拉刷新
srlContainer.isEnabled = !isScrolling
......@@ -212,7 +231,9 @@ class ExpertSearchFragment : BaseMvpFragment<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
......@@ -229,7 +250,9 @@ class ExpertSearchFragment : BaseMvpFragment<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
......@@ -246,7 +269,9 @@ class ExpertSearchFragment : BaseMvpFragment<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
......@@ -284,7 +309,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
super.setUserVisibleHint(isVisibleToUser)
if (isVisibleToUser && isResumed && userVisibleHint) {
showConsultAssistantDialog()
}else {
} else {
hideConsultAssistantDialog()
}
if (isVisibleToUser && isResumed) {
......@@ -302,12 +327,12 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
}
private fun initNetLossView() {
v_loading.setListener(object : LogoLoadingView.LogoLoadingListener {
v_loading.setListener(object : LogoLoadingView.LogoLoadingListener {
override fun onDataResetClick() {
rvExperts.visibility = View.GONE
v_loading.visibility = View.VISIBLE
ll_network_error.visibility = View.GONE
v_loading.setViewType(LogoLoadingView.TYPE_LOADING, null)
rvExperts.visibility = View.GONE
v_loading.visibility = View.VISIBLE
ll_network_error.visibility = View.GONE
v_loading.setViewType(LogoLoadingView.TYPE_LOADING, null)
refresh(false)
}
......@@ -334,11 +359,11 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
getPresenter().localData(initShowType)
//refresh(false)
v_loading.visibility = View.VISIBLE
v_loading.setViewType(LogoLoadingView.TYPE_LOADING, null)
v_loading.visibility = View.VISIBLE
v_loading.setViewType(LogoLoadingView.TYPE_LOADING, null)
if (fromPageType != -1) {
doctorAdapter.setEntrance(fromPages[fromPageType])
doctorAdapter.setEntrance(fromPages[fromPageType], 0)
}
}
......@@ -350,9 +375,9 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
StatusBarUtils.setTransparentForImageView(activity, null)
val statusBarHeight = StatusBarUtils.getStatusBarHeight(context)
val lp1 =title_layout.layoutParams as LinearLayout.LayoutParams
val lp1 = title_layout.layoutParams as LinearLayout.LayoutParams
lp1.height = (RxImageTool.dp2px(48f) + statusBarHeight)
title_layout.setPadding(0, statusBarHeight, 0, 0)
title_layout.setPadding(0, statusBarHeight, 0, 0)
}
}
......@@ -368,10 +393,10 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
allFilter.categories.add(cate)
if (allFilter.categories.size == 1 && !"全部".equals(allFilter.categories[0].cateName)) {
//显示选中标题
tvSubject.text = allFilter.categories[0].cateName
tvSubject.text = allFilter.categories[0].cateName
} else {
//显示主标题
tvSubject.text = "主题"
tvSubject.text = "主题"
}
updateFilterTextViewStatus(tvSubject, FILTER_STATUS_FILTERED)
break
......@@ -464,10 +489,10 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
}
if (allFilter.categories.size == 1 && "全部" != allFilter.categories[0].cateName) {
//显示选中标题
tvSubject.text = allFilter.categories[0].cateName
tvSubject.text = allFilter.categories[0].cateName
} else {
//显示主标题
tvSubject.text = "主题"
tvSubject.text = "主题"
}
}
}
......@@ -479,7 +504,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
if (hasSelectedArea) {
for ((index, bean) in headData!!.highlighter.withIndex()) {
if (bean.type == "2" || bean.type == "8") {
var textview =lin_filter2.getChildAt(index) as TextView
var textview = lin_filter2.getChildAt(index) as TextView
textview.isSelected = false
textview.paint.isFakeBoldText = false
}
......@@ -495,16 +520,16 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
}
allFilter.region = bean
if (allFilter.region.value?.length ?: 0 > 4) {
tvArea.text = allFilter.region.value?.substring(0, 3) + "..."
tvArea.text = allFilter.region.value?.substring(0, 3) + "..."
} else {
tvArea.text = allFilter.region.value
tvArea.text = allFilter.region.value
}
updateFilterTextViewStatus(tvArea, FILTER_STATUS_FILTERED)
hasSelectedArea = true
} else {
allFilter.region = RegionItem()
tvArea.text = "地区"
tvArea.text = "地区"
updateFilterTextViewStatus(tvArea, FILTER_STATUS_NORMAL)
hasSelectedArea = false
......@@ -521,7 +546,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
if (hasSelectedSort) {
for ((index, bean) in headData!!.highlighter.withIndex()) {
if (bean.type == "3") {
var textview =lin_filter2.getChildAt(index) as TextView
var textview = lin_filter2.getChildAt(index) as TextView
textview.isSelected = false
textview.paint.isFakeBoldText = false
}
......@@ -540,9 +565,10 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
}
}
when {
allFilter.reorder.value.equals("综合排序") ->tvSort.text = "排序"
allFilter.reorder.value?.length ?: 0 > 4 ->tvSort.text = allFilter.reorder.value?.substring(0, 3) + "..."
else ->tvSort.text = allFilter.reorder.value
allFilter.reorder.value.equals("综合排序") -> tvSort.text = "排序"
allFilter.reorder.value?.length ?: 0 > 4 -> tvSort.text =
allFilter.reorder.value?.substring(0, 3) + "..."
else -> tvSort.text = allFilter.reorder.value
}
}
}
......@@ -635,7 +661,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
if (hasSelectedArea) {
for ((index, bean) in headData!!.highlighter.withIndex()) {
if (bean.type == "2" || bean.type == "8") {
var textview =lin_filter2.getChildAt(index) as TextView
var textview = lin_filter2.getChildAt(index) as TextView
textview.isSelected = false
textview.paint.isFakeBoldText = false
}
......@@ -645,16 +671,20 @@ class ExpertSearchFragment : BaseMvpFragment<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
}
}
allFilter.sub = bean
if (allFilter.sub.value?.length ?: 0 > 4) {
tvArea.text = allFilter.sub.value?.substring(0, 3) + "..."
tvArea.text = allFilter.sub.value?.substring(0, 3) + "..."
} else {
tvArea.text = allFilter.sub.value
tvArea.text = allFilter.sub.value
}
updateFilterTextViewStatus(tvArea, FILTER_STATUS_FILTERED)
......@@ -663,7 +693,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
allFilter.region = RegionItem()
allFilter.sub = SubItem("不限", null)
tvArea.text = "地区"
tvArea.text = "地区"
updateFilterTextViewStatus(tvArea, FILTER_STATUS_NORMAL)
hasSelectedArea = false
......@@ -679,14 +709,14 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
if (lin_filter2.childCount > 0) {
//清空选中
for (i in 0.until(lin_filter2.childCount)) {
val textView =lin_filter2.getChildAt(i) as TextView
val textView = lin_filter2.getChildAt(i) as TextView
textView.isSelected = false
textView.paint.isFakeBoldText = false
}
//重置选中状态
for ((index, other) in otherdata.withIndex()) {
for (i in 0 until lin_filter2.childCount) {
val textView =lin_filter2.getChildAt(i) as TextView
val textView = lin_filter2.getChildAt(i) as TextView
if (textView.text == other.value) {
textView.isSelected = true
textView.paint.isFakeBoldText = true
......@@ -697,7 +727,11 @@ class ExpertSearchFragment : BaseMvpFragment<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
......@@ -726,18 +760,22 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
isRecommend = false
isDoSearch = false
v_loading.visibility = View.GONE
ll_network_error.visibility = View.GONE
v_loading.visibility = View.GONE
ll_network_error.visibility = View.GONE
rvExperts.visibility = View.VISIBLE
srlContainer.isRefreshing = false
rvExperts.visibility = View.VISIBLE
srlContainer.isRefreshing = false
}
//专家列表数据获取到后的回调
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
rvExperts.adapter = doctorAdapter
}
LogUtil.d("data size " + data.size)
......@@ -764,10 +802,10 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
isDoSearch = false
isRecommend = false
v_loading.visibility = View.GONE
ll_network_error.visibility = View.GONE
v_loading.visibility = View.GONE
ll_network_error.visibility = View.GONE
rvExperts.visibility = View.VISIBLE
rvExperts.visibility = View.VISIBLE
srlContainer.isRefreshing = false
}
......@@ -776,27 +814,30 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
isRecommend = false
if (curPage == 1) {
v_loading.setViewType(LogoLoadingView.TYPE_NET_LOSS, getString(R.string.consultant_reload_hint))
v_loading.visibility = View.VISIBLE
v_loading.setViewType(
LogoLoadingView.TYPE_NET_LOSS,
getString(R.string.consultant_reload_hint)
)
v_loading.visibility = View.VISIBLE
ll_network_error.visibility = View.GONE
ll_network_error.visibility = View.GONE
} else {
ToastHelper.show("网络不给力")
}
srlContainer.isRefreshing = false
srlContainer.isRefreshing = false
}
override fun fetchListEmpty(msg: String?) {
isDoSearch = false
isRecommend = false
tv_reload.visibility = View.GONE
tv_reload_hint.text = msg
ll_network_error.visibility = View.VISIBLE
iv_exception.setImageResource(R.drawable.platform_ico_img_zixun_empty)
tv_reload.visibility = View.GONE
tv_reload_hint.text = msg
ll_network_error.visibility = View.VISIBLE
iv_exception.setImageResource(R.drawable.platform_ico_img_zixun_empty)
rvExperts.visibility = View.GONE
srlContainer.isRefreshing = false
rvExperts.visibility = View.GONE
srlContainer.isRefreshing = false
}
override fun fetchFailed(msg: String?) {
......@@ -805,17 +846,20 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
if (msg != null) {
ToastUtil.toastShort(msg)
}
v_loading.setViewType(LogoLoadingView.TYPE_NET_LOSS, getString(R.string.consultant_reload_hint))
v_loading.visibility = View.VISIBLE
v_loading.setViewType(
LogoLoadingView.TYPE_NET_LOSS,
getString(R.string.consultant_reload_hint)
)
v_loading.visibility = View.VISIBLE
ll_network_error.visibility = View.GONE
ll_network_error.visibility = View.GONE
rvExperts.visibility = View.GONE
appbar_layout.setExpanded(false)
rvExperts.visibility = View.GONE
appbar_layout.setExpanded(false)
}
override fun showRefreshLayout() {
srlContainer.isRefreshing = true
srlContainer.isRefreshing = true
}
......@@ -827,8 +871,8 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
R.id.tvSubject -> {
props1.put("filtrate_first", "主题")
hideSoftInput()
appbar_layout.setExpanded(false)
appbar_layout.postDelayed({
appbar_layout.setExpanded(false)
appbar_layout.postDelayed({
showSubjectPopupWindow()
}, 300);
......@@ -836,8 +880,8 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
R.id.tvArea -> {
props1.put("filtrate_first", "地区")
hideSoftInput()
appbar_layout.setExpanded(false)
appbar_layout.postDelayed({
appbar_layout.setExpanded(false)
appbar_layout.postDelayed({
showAreaPopupWindow()
}, 300);
......@@ -845,8 +889,8 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
R.id.tvSort -> {
props1.put("filtrate_first", "排序")
hideSoftInput()
appbar_layout.setExpanded(false)
appbar_layout.postDelayed({
appbar_layout.setExpanded(false)
appbar_layout.postDelayed({
showSortPopupWindow()
}, 300);
......@@ -854,8 +898,8 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
R.id.tvFilter -> {
props1.put("filtrate_first", "筛选")
hideSoftInput()
appbar_layout.setExpanded(false)
appbar_layout.postDelayed({
appbar_layout.setExpanded(false)
appbar_layout.postDelayed({
showFilterPopupWindow()
}, 300);
......@@ -863,7 +907,7 @@ class ExpertSearchFragment : BaseMvpFragment<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(context, h5param)
}
......@@ -874,19 +918,19 @@ class ExpertSearchFragment : BaseMvpFragment<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()
}
}
}
private fun scrollToTop() {
if ((rvExperts.layoutManager as LinearLayoutManager).findFirstVisibleItemPosition() > 10) {
rvExperts.scrollToPosition(10)
rvExperts.smoothScrollToPosition(0)
rvExperts.scrollToPosition(10)
rvExperts.smoothScrollToPosition(0)
} else {
rvExperts.smoothScrollToPosition(0)
rvExperts.smoothScrollToPosition(0)
}
}
......@@ -913,8 +957,11 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
val filterPopupWindow = FilterPopupWindow(context, headData?.filters!!, tempFilter)
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)) {
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)
) {
updateFilterTextViewStatus(tvFilter, FILTER_STATUS_FILTERED)
} else {
updateFilterTextViewStatus(tvFilter, FILTER_STATUS_NORMAL)
......@@ -927,7 +974,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
filterPopupWindow.onFilterConfirmListener = this
updateFilterTextViewStatus(tvFilter, FILTER_STATUS_OPEN)
// viewDim.visibility = View.VISIBLE
viewDim_filter.visibility = View.VISIBLE
viewDim_filter.visibility = View.VISIBLE
} else {
ToastUtil.toastShort("数据初始化失败,请重试")
getPresenter().fetchListHead()
......@@ -937,8 +984,19 @@ class ExpertSearchFragment : BaseMvpFragment<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)
......@@ -959,13 +1017,17 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
if (headData!!.highlighter.size > 0) {
for (index in 0.until(headData!!.highlighter.size)) {
if (headData!!.highlighter[index].type == "4") {
var textview =lin_filter2.getChildAt(index) as TextView
var textview = lin_filter2.getChildAt(index) as TextView
activity.runOnUiThread {
textview.isSelected = false
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
)
) {
activity.runOnUiThread {
textview.isSelected = true
textview.paint.isFakeBoldText = true
......@@ -975,13 +1037,17 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
}
}
if (headData!!.highlighter[index].type == "5") {
var textview =lin_filter2.getChildAt(index) as TextView
var textview = lin_filter2.getChildAt(index) as TextView
activity.runOnUiThread {
textview.isSelected = false
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
)
) {
activity.runOnUiThread {
textview.isSelected = true
textview.paint.isFakeBoldText = true
......@@ -991,13 +1057,17 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
}
}
if (headData!!.highlighter[index].type == "6") {
var textview =lin_filter2.getChildAt(index) as TextView
var textview = lin_filter2.getChildAt(index) as TextView
activity.runOnUiThread {
textview.isSelected = false
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
)
) {
activity.runOnUiThread {
textview.isSelected = true
textview.paint.isFakeBoldText = true
......@@ -1008,13 +1078,17 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
}
if (headData!!.highlighter[index].type == "7") {
var textview =lin_filter2.getChildAt(index) as TextView
var textview = lin_filter2.getChildAt(index) as TextView
activity.runOnUiThread {
textview.isSelected = false
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
)
) {
activity.runOnUiThread {
textview.isSelected = true
textview.paint.isFakeBoldText = true
......@@ -1049,12 +1123,12 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
text = "筛选"
}
if (text?.length ?: 0 > 4) {
tvFilter.text = text?.substring(0, 3) + "..."
tvFilter.text = text?.substring(0, 3) + "..."
} else {
tvFilter.text = text
tvFilter.text = text
}
} else {
tvFilter.text = "筛选"
tvFilter.text = "筛选"
}
}
......@@ -1066,7 +1140,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
if (headData?.reorder != null) {
sortPopup = SortPopupWindow(activity, headData?.reorder!!, allFilter.reorder, this)
sortPopup!!.setOnDismissListener {
viewDim.visibility = View.INVISIBLE
viewDim.visibility = View.INVISIBLE
if (allFilter.reorder != headData!!.reorder[0]) {
updateFilterTextViewStatus(tvSort, FILTER_STATUS_FILTERED)
} else {
......@@ -1079,7 +1153,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
}
sortPopup!!.showAsDropDown(viewSep2)
updateFilterTextViewStatus(tvSort, FILTER_STATUS_OPEN)
viewDim.visibility = View.VISIBLE
viewDim.visibility = View.VISIBLE
} else {
ToastUtil.toastShort("数据初始化失败,请重试")
getPresenter().fetchListHead()
......@@ -1088,22 +1162,24 @@ class ExpertSearchFragment : BaseMvpFragment<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 = "排序"
tvSort.text = "排序"
} else if (sortItem.value?.length ?: 0 > 4) {
tvSort.text = sortItem.value?.substring(0, 3) + "..."
tvSort.text = sortItem.value?.substring(0, 3) + "..."
} else {
tvSort.text = sortItem.value
tvSort.text = sortItem.value
}
//判断排序选中,判断热门筛选中是否也有该排序
if (headData!!.highlighter.size > 0) {
for (index in 0.until(headData!!.highlighter.size)) {
if (headData!!.highlighter[index].type == "3") {
var textview =lin_filter2.getChildAt(index) as TextView
var textview = lin_filter2.getChildAt(index) as TextView
if (TextUtils.equals(sortItem.value, headData!!.highlighter[index].value)) {
textview.isSelected = true
textview.paint.isFakeBoldText = true
......@@ -1129,82 +1205,88 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
//显示地区弹窗
private fun showAreaPopupWindow() {
if (headData?.region != null) {
val regionPopupWindow = AreaPopupWindow(activity, headData?.region
?: ArrayList(), allFilter.region, allFilter.sub)
val regionPopupWindow = AreaPopupWindow(
activity, headData?.region
?: ArrayList(), allFilter.region, allFilter.sub
)
regionPopupWindow.showAsDropDown(viewSep2)
viewDim.visibility = View.VISIBLE
viewDim.visibility = View.VISIBLE
updateFilterTextViewStatus(tvArea, FILTER_STATUS_OPEN)
regionPopupWindow.setOnDismissListener {
viewDim.visibility = View.INVISIBLE
viewDim.visibility = View.INVISIBLE
if (tvArea.text != "地区") {
updateFilterTextViewStatus(tvArea, FILTER_STATUS_FILTERED)
} else {
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()
......@@ -1221,7 +1303,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
if (categories != null) {
categoryPopup = CategoryPopupWindow(activity, categories, tempFilter.categories)
categoryPopup!!.setOnDismissListener {
viewDim.visibility = View.INVISIBLE
viewDim.visibility = View.INVISIBLE
if (allFilter.categories.size > 1 || (allFilter.categories.size == 1 && allFilter.categories[0] != headData!!.cates[0])) {
updateFilterTextViewStatus(tvSubject, FILTER_STATUS_FILTERED)
} else {
......@@ -1231,7 +1313,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
categoryPopup!!.onSubjectsSelectedListener = this
categoryPopup!!.showAsDropDown(viewSep2)
updateFilterTextViewStatus(tvSubject, FILTER_STATUS_OPEN)
viewDim.visibility = View.VISIBLE
viewDim.visibility = View.VISIBLE
} else {
ToastUtil.toastShort("数据初始化失败,请重试")
getPresenter().fetchListHead()
......@@ -1244,26 +1326,33 @@ class ExpertSearchFragment : BaseMvpFragment<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
tvSubject.text = categories[0].cateName
} else {
//显示主标题
tvSubject.text = "主题"
tvSubject.text = "主题"
}
//判断主题选中,判断热门筛选中是否也有该主题
Executors.newCachedThreadPool().execute {
if (headData!!.highlighter.size > 0) {
for (index in 0.until(headData!!.highlighter.size)) {
if (headData!!.highlighter[index].type == "1") {
var textview =lin_filter2.getChildAt(index) as TextView
var textview = lin_filter2.getChildAt(index) as TextView
activity.runOnUiThread {
textview.isSelected = false
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
)
) {
activity.runOnUiThread {
textview.isSelected = true
textview.paint.isFakeBoldText = true
......@@ -1298,8 +1387,8 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
//刷新列表
private fun refresh(isShowRefresh: Boolean? = true) {
srlContainer.isRefreshing = isShowRefresh!!
val key =tv_search_content.text.toString()
srlContainer.isRefreshing = isShowRefresh!!
val key = tv_search_content.text.toString()
if (!TextUtils.isEmpty(key.trim())) {
allFilter.searchWord = key.trim()
} else {
......@@ -1313,7 +1402,7 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
//执行搜索
private fun doSearch() {
image_scroll_top.visibility = View.GONE
image_scroll_top.visibility = View.GONE
hideSoftInput();
// keyWord = etSearch.text.toString()
// if (TextUtils.isEmpty(keyWord?.trim())) {
......@@ -1321,7 +1410,10 @@ class ExpertSearchFragment : BaseMvpFragment<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()
......@@ -1357,17 +1449,32 @@ class ExpertSearchFragment : BaseMvpFragment<IExpertSearchView, ExpertSearchPres
FILTER_STATUS_NORMAL -> {
tv.typeface = Typeface.defaultFromStyle(Typeface.NORMAL)
tv.setTextColor(ContextCompat.getColor(context, 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(context, 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(context, 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
)
}
}
}
......@@ -1385,11 +1492,11 @@ class ExpertSearchFragment : BaseMvpFragment<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() {
......
......@@ -38,8 +38,11 @@ import kotlinx.android.synthetic.main.consultant_item_tag.view.*
/**
* 专家服务列表适配器
*/
class ExpertSearchAdapter(private val context: Context, private val expertSearchView : IExpertSearchView, private val listData: ArrayList<DoctorServiceItem>)
: RecyclerView.Adapter<RecyclerView.ViewHolder>() {
class ExpertSearchAdapter(
private val context: Context,
private val expertSearchView: IExpertSearchView,
private val listData: ArrayList<DoctorServiceItem>
) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
companion object {
const val NORMAL_VIEW = 0
......@@ -48,14 +51,16 @@ class ExpertSearchAdapter(private val context: Context, private val expertSearch
}
//记录当前选择主题的id
var cateId : String? = null
var cateId: String? = null
var hasMore = true
var entranceName: String? = null
var pageIndex: Int = 0
fun setEntrance(entranceName: String) {
fun setEntrance(entranceName: String, pageIndex: Int) {
this.entranceName = entranceName
this.pageIndex = pageIndex
}
@SuppressLint("SetTextI18n")
......@@ -66,47 +71,46 @@ class ExpertSearchAdapter(private val context: Context, private val expertSearch
val headConfig = SimpleImageOpConfiger()
headConfig.loadingPic = R.drawable.consultant_avatar_def_circle
headConfig.errorPic = R.drawable.consultant_avatar_def_circle
expertSearchView.showImage(itemBean.head,holder.imgHead,holder.imgHead.width,holder.imgHead.height,headConfig)
expertSearchView.showImage(
itemBean.head,
holder.imgHead,
holder.imgHead.width,
holder.imgHead.height,
headConfig
)
//姓名
holder.tvName.text = itemBean.name
// if (TextUtils.isEmpty(itemBean.famousRemark)){
// holder.group_desc.visibility = View.GONE
// }else{
// holder.group_desc.visibility = View.VISIBLE
// //描述
// holder.tvDesc.text = itemBean.famousRemark
// }
//服务中
if (itemBean.inConsult || itemBean.isListening) {
holder.imgHead_online_server.visibility = View.VISIBLE
holder.chat_people_in_question.visibility = View.GONE
holder.imgHead_online.visibility = View.GONE
}else {
} else {
//不是服务中且问询人数大于0
if (itemBean.chatNum > 5) {
holder.chat_people_in_question.visibility = View.VISIBLE
holder.chat_people_in_question.text = "多人在问询"
}else if (itemBean.chatNum > 0){
} else if (itemBean.chatNum > 0) {
holder.chat_people_in_question.visibility = View.VISIBLE
holder.chat_people_in_question.text = "${itemBean.chatNum}人在问询"
}else {
} else {
holder.chat_people_in_question.visibility = View.GONE
}
//可预约
holder.imgHead_online_server.visibility = View.GONE
if (itemBean.isTodayFree == true){
if (itemBean.isTodayFree == true) {
holder.imgHead_online.visibility = View.VISIBLE
}else{
} else {
holder.imgHead_online.visibility = View.GONE
}
}
//省市
if (!TextUtils.isEmpty(itemBean.province)){
holder.tvCity.text = itemBean.province+"·"+itemBean.city
}else{
if (!TextUtils.isEmpty(itemBean.province)) {
holder.tvCity.text = itemBean.province + "·" + itemBean.city
} else {
holder.tvCity.text = ""
}
......@@ -151,20 +155,13 @@ class ExpertSearchAdapter(private val context: Context, private val expertSearch
holder.imgAbilityLevel.background =
context.resources.getDrawable(R.drawable.consultant_expert_search_xinshou)
holder.imgAbilityLevel.visibility = View.VISIBLE
}
// else if (3 == itemBean.abilityLevel){
// //精英
// holder.imgAbilityLevel.background = context.resources.getDrawable(R.drawable.consultant_expert_search_jingying)
// holder.imgAbilityLevel.visibility = View.VISIBLE
// }
else {
} else {
holder.imgAbilityLevel.visibility = View.GONE
}
//活动图标
if (!TextUtils.isEmpty(itemBean.activityImg)) {
holder.imgActivity.visibility = View.VISIBLE
GlideApp.with(context).load(itemBean.activityImg).into(holder.imgActivity)
// GlideApp.with(context).load("https://video.ydlcdn.com/2019/11/04/abdd3782c98939d0406080a6a80b8ea5.jpg").into(holder.imgActivity)
} else {
holder.imgActivity.visibility = View.GONE
}
......@@ -187,29 +184,38 @@ class ExpertSearchAdapter(private val context: Context, private val expertSearch
}
}
holder.ll_feedbackRate.removeAllViews()
for (num in 1..5){
val view = LayoutInflater.from(context).inflate(R.layout.consultant_expert_search_feedbackrate, holder.ll_feedbackRate, false)
if (itemBean.feedbackRate >= num){
(view.imgRate as ImageView).background = context.resources.getDrawable(R.drawable.consultant_expert_search_full_star)
}else if (itemBean.feedbackRate < num && itemBean.feedbackRate > num - 1){
(view.imgRate as ImageView).background = context.resources.getDrawable(R.drawable.consultant_expert_search_half_star)
}else{
(view.imgRate as ImageView).background = context.resources.getDrawable(R.drawable.consultant_expert_search_nothing_star)
for (num in 1..5) {
val view = LayoutInflater.from(context).inflate(
R.layout.consultant_expert_search_feedbackrate,
holder.ll_feedbackRate,
false
)
if (itemBean.feedbackRate >= num) {
(view.imgRate as ImageView).background =
context.resources.getDrawable(R.drawable.consultant_expert_search_full_star)
} else if (itemBean.feedbackRate < num && itemBean.feedbackRate > num - 1) {
(view.imgRate as ImageView).background =
context.resources.getDrawable(R.drawable.consultant_expert_search_half_star)
} else {
(view.imgRate as ImageView).background =
context.resources.getDrawable(R.drawable.consultant_expert_search_nothing_star)
}
holder.ll_feedbackRate.addView(view)
}
//XXX人点评
val numSb = StringBuffer()
holder.tv_zixunOrderNum.text = numSb.append(itemBean.zixunOrderNum).append("").toString()
holder.tv_zixunOrderNum.text =
numSb.append(itemBean.zixunOrderNum).append("").toString()
//咨询师简介
holder.tvTeamCertifications.text = itemBean.teamCertifications
//咨询师标签
holder.ll_tags.removeAllViews()
if (!TextUtils.isEmpty(itemBean.tags)){
if (!TextUtils.isEmpty(itemBean.tags)) {
val tagList = itemBean.tags!!.split("|")
for (tag in tagList) {
if (!TextUtils.isEmpty(tag)){
val view = LayoutInflater.from(context).inflate(R.layout.consultant_item_tag, holder.ll_tags, false)
if (!TextUtils.isEmpty(tag)) {
val view = LayoutInflater.from(context)
.inflate(R.layout.consultant_item_tag, holder.ll_tags, false)
view.tvTag.text = tag
holder.ll_tags.addView(view)
}
......@@ -218,49 +224,61 @@ class ExpertSearchAdapter(private val context: Context, private val expertSearch
//帮助人数
val orderUser = StringBuffer()
holder.tvOrderNum.text = orderUser.append(itemBean.zixunOrderUser).append("").toString()
// if ( 50 <= itemBean.zixunOrderNum){
// holder.tvOrderNumContent.text = "帮助"
// holder.tvSaleDurationForMonth.visibility = View.VISIBLE
// holder.tvSaleDurationForMonthContent.visibility = View.VISIBLE
// }else{
// holder.tvOrderNumContent.text = "公益解答"
// holder.tvSaleDurationForMonth.visibility = View.GONE
// holder.tvSaleDurationForMonthContent.visibility = View.GONE
// }
//私聊文案
if (TextUtils.isEmpty(itemBean.chatBtnText)){
if (TextUtils.isEmpty(itemBean.chatBtnText)) {
holder.tvChat.text = "私聊"
holder.tvChat.setTextColor(ContextCompat.getColor(context,R.color.consultant_confirm_text_color))
holder.tvChat.background = ContextCompat.getDrawable(context,R.drawable.consultant_expert_search_chat)
}else{
holder.tvChat.setTextColor(
ContextCompat.getColor(
context,
R.color.consultant_confirm_text_color
)
)
holder.tvChat.background =
ContextCompat.getDrawable(context, R.drawable.consultant_expert_search_chat)
} else {
holder.tvChat.text = itemBean.chatBtnText
holder.tvChat.setTextColor(ContextCompat.getColor(context,R.color.platform_color_999999))
holder.tvChat.background = ContextCompat.getDrawable(context,R.drawable.consultant_expert_search_chat_rest)
holder.tvChat.setTextColor(
ContextCompat.getColor(
context,
R.color.platform_color_999999
)
)
holder.tvChat.background = ContextCompat.getDrawable(
context,
R.drawable.consultant_expert_search_chat_rest
)
}
//服务时长
val durationStringBuffer = StringBuffer()
holder.tvSaleDurationForMonth.text = durationStringBuffer.append(itemBean.allSaleDuration.toInt()).append("").toString()
holder.tvSaleDurationForMonth.text =
durationStringBuffer.append(itemBean.allSaleDuration.toInt()).append("").toString()
//价格
val sb = StringBuffer()
holder.tvPrice.text = sb.append("").append(itemBean.minBookingPrice).toString()
//套餐
holder.ll_products.removeAllViews()
if (null != itemBean.products && !itemBean.products.isEmpty()){
if (null != itemBean.products && !itemBean.products.isEmpty()) {
for (item in itemBean.products) {
val view = LayoutInflater.from(context).inflate(R.layout.consultant_expert_search_products_item, holder.ll_tags, false)
if (1 == item.isPackage){
val view = LayoutInflater.from(context).inflate(
R.layout.consultant_expert_search_products_item,
holder.ll_tags,
false
)
if (1 == item.isPackage) {
view.tvTitle.text = "单次"
view.tvTitle.setTextColor(context.resources.getColor(R.color.platform_color_1DA1F2))
view.tvTitle.background = context.resources.getDrawable(R.drawable.consultant_expert_search_single)
view.tvTitle.background =
context.resources.getDrawable(R.drawable.consultant_expert_search_single)
view.tvContent.text = item.name
holder.ll_products.addView(view)
} else if (2 == item.isPackage){
} else if (2 == item.isPackage) {
view.tvTitle.text = "套餐"
view.tvTitle.setTextColor(context.resources.getColor(R.color.consultant_color_FF9500))
view.tvTitle.background = context.resources.getDrawable(R.drawable.consultant_expert_search_menu)
view.tvTitle.background =
context.resources.getDrawable(R.drawable.consultant_expert_search_menu)
view.tvContent.text = item.name
holder.ll_products.addView(view)
}else{
} else {
}
}
......@@ -277,27 +295,31 @@ class ExpertSearchAdapter(private val context: Context, private val expertSearch
}
}
override fun getItemCount(): Int = if (listData.size < ExpertSearchActivity.PAGE_SIZE && hasMore) {
listData.size
} else {
listData.size + 1
}
override fun getItemCount(): Int =
if (listData.size < ExpertSearchActivity.PAGE_SIZE && hasMore) {
listData.size
} else {
listData.size + 1
}
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): RecyclerView.ViewHolder =
when (viewType) {
NORMAL_VIEW -> {
val view = LayoutInflater.from(context).inflate(R.layout.consultant_expert_search_item_view, parent, false)
NormalViewHolder(view)
}
FOOT_VIEW -> {
val view = LayoutInflater.from(context).inflate(R.layout.consultant_item_footer, parent, false)
FooterViewHolder(view)
}
else -> {
val view = LayoutInflater.from(context).inflate(R.layout.consultant_item_empty, parent, false)
EmptyViewHolder(view)
}
when (viewType) {
NORMAL_VIEW -> {
val view = LayoutInflater.from(context)
.inflate(R.layout.consultant_expert_search_item_view, parent, false)
NormalViewHolder(view)
}
FOOT_VIEW -> {
val view = LayoutInflater.from(context)
.inflate(R.layout.consultant_item_footer, parent, false)
FooterViewHolder(view)
}
else -> {
val view = LayoutInflater.from(context)
.inflate(R.layout.consultant_item_empty, parent, false)
EmptyViewHolder(view)
}
}
override fun getItemViewType(position: Int): Int = when {
position < listData.size -> NORMAL_VIEW
......@@ -362,27 +384,46 @@ class ExpertSearchAdapter(private val context: Context, private val expertSearch
val itemBean = listData[adapterPosition]
var linkUrl = itemBean.linkUrl
if (!TextUtils.isEmpty(cateId)){
linkUrl = URLUtils.appendParmas(linkUrl,"cateId",cateId)
if (!TextUtils.isEmpty(cateId)) {
linkUrl = URLUtils.appendParmas(linkUrl, "cateId", cateId)
}
ActionCountUtils.count(ConsultBIConstants.ConsultEvent.APP_CONSULT_LIST_DOCTOR_CLICK,itemBean.doctorId?:"")
TempH5RouteUtils.tempH5Route(linkUrl)
// var params = URLDecoder.decode( Uri.parse(linkUrl)!!.getQueryParameter("params"),"UTF-8")
// ARouter.getInstance().build("/h5/h5").withSerializable("routerParam",params).navigation()
if (pageIndex == 0) {
ActionCountUtils.count(
ConsultBIConstants.ConsultEvent.APP_CONSULT_LIST_DOCTOR_CLICK,
itemBean.doctorId ?: ""
)
} else {
ActionCountUtils.count(
ConsultBIConstants.ConsultSearchListEvent.APP_CONSULT_SEARCH_LIST_CONSULT_ITEM_CLICK,
itemBean.doctorId ?: ""
)
}
TempH5RouteUtils.tempH5Route(linkUrl)
}
}
itemView.tvChat.setOnClickListener {
if (adapterPosition != RecyclerView.NO_POSITION) {
val doctor = listData[adapterPosition]
if (pageIndex == 0) {
ActionCountUtils.count(
ConsultBIConstants.ConsultEvent.APP_CONSULT_LIST_CHAT_CLICK,
doctor.doctorId ?: ""
)
} else {
ActionCountUtils.count(
ConsultBIConstants.ConsultSearchListEvent.APP_CONSULT_SEARCH_LIST_CHAT_CLICK,
doctor.doctorId ?: ""
)
}
//判断是否已登录
if(!ConsultantIn.getUserImpl().isLogin()){
if (!ConsultantIn.getUserImpl().isLogin()) {
TempH5RouteUtils.tempH5Route(IYDLRouterConstant.ROUTER_MINE_LOGIN)
return@setOnClickListener
}
val doctor = listData[adapterPosition]
ActionCountUtils.count(ConsultBIConstants.ConsultEvent.APP_CONSULT_LIST_CHAT_CLICK,doctor.doctorId?:"")
if (!TextUtils.isEmpty(doctor.uid)) {
//跳转私聊
......@@ -393,10 +434,10 @@ class ExpertSearchAdapter(private val context: Context, private val expertSearch
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")
.put("expert_entrance", entranceName ?: "")
.put("expert_ID", doctor.doctorId ?: 0)
.put("expert_name", doctor.name ?: "")
.burryPoint("Chat_click")
}
}
}
......
......@@ -32,6 +32,19 @@ class ConsultBIConstants {
const val APP_CONSULT_LIST_CHAT_CLICK: String = APP_CONSULT_LIST_PAGE + "app_consult_list_chat_click"//每个咨询师私聊
}
}
class ConsultSearchListEvent {
companion object {
private const val CONSULT_SEARCH_LIST_PAGE: String = "consul_search_list_page|"//APP咨询搜索列表页 partId
const val APP_CONSULT_SEARCH_LIST_PAGE_VISIT: String = CONSULT_SEARCH_LIST_PAGE + "consul_search_list_page_visit"//列表页浏览事件
const val APP_CONSULT_SEARCH_LIST_CONSULT_ITEM_CLICK: String = CONSULT_SEARCH_LIST_PAGE + "consult_search_list_doctor_click "//每个咨询师页面点击
const val APP_CONSULT_SEARCH_LIST_CHAT_CLICK: String = CONSULT_SEARCH_LIST_PAGE + "consult__search_list_chat_click"//每个咨询师私聊
}
}
class UserMainEvent {
companion object {
......
......@@ -11,57 +11,67 @@
layout="@layout/consultant_layout_search_toolbar"
android:layout_width="match_parent"
android:layout_height="48dp" />
<com.yidianling.consultant.ui.view.ExpertSearchSwipeRefreshLayout
android:id="@+id/srlContainer"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.CoordinatorLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/consultant_colorBg"
tools:ignore="InefficientWeight">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar_layout"
<android.support.design.widget.CoordinatorLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:background="@color/consultant_colorBg"
android:clipChildren="false"
android:clipToPadding="false"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:elevation="0dp">
tools:ignore="InefficientWeight">
<android.support.design.widget.CollapsingToolbarLayout
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:background="@color/consultant_colorBg"
android:clipChildren="false"
android:clipToPadding="false"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:elevation="0dp">
<com.yidianling.consultant.ui.view.topView.RecommendListView
android:id="@+id/recommendListView"
<android.support.design.widget.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
</com.yidianling.consultant.ui.view.topView.RecommendListView>
android:layout_height="match_parent"
android:clipChildren="false"
android:clipToPadding="false"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<include layout="@layout/consultant_layout_search_content" />
<!-- 心理咨询app华为渠道紧急处理,咨询师列表页先简单粗暴的隐藏顶部推荐模块-->
<RelativeLayout
android:id="@+id/rl_hot_fix_for_huawei"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone">
<!--<include layout="@layout/layout_search_head_input"/>-->
<com.yidianling.consultant.ui.view.topView.RecommendListView
android:id="@+id/recommendListView"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</RelativeLayout>
<!--筛选弹窗半透明背景-->
<View
android:id="@+id/viewDim_filter"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#40000000"
android:visibility="gone" />
</android.support.design.widget.CoordinatorLayout>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<include layout="@layout/consultant_layout_search_content" />
<!--<include layout="@layout/layout_search_head_input"/>-->
<!--筛选弹窗半透明背景-->
<View
android:id="@+id/viewDim_filter"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#40000000"
android:visibility="gone" />
</android.support.design.widget.CoordinatorLayout>
</com.yidianling.consultant.ui.view.ExpertSearchSwipeRefreshLayout>
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:topLeftRadius="8dp"
android:bottomLeftRadius="8dp"/>
<gradient
android:angle="0"
android:startColor="#CC1DA1F2"
android:endColor="#CC1DA1F2"/>
</shape>
\ No newline at end of file
......@@ -2,13 +2,14 @@ package com.yidianling.home.adapter
import android.content.Context
import android.support.v7.widget.RecyclerView
import android.text.TextUtils
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.ydl.ydlcommon.data.PlatformDataManager.getRam
import com.yidianling.home.R
import com.yidianling.home.constract.YdlHomeViewHolderConstract
import com.yidianling.home.event.HomeImpl
import com.yidianling.home.event.IHomeEvent
import com.yidianling.home.model.bean.HomeAskBean
import com.yidianling.home.model.bean.HomeConfideBean
import com.yidianling.home.model.bean.HomeConsultBean
......@@ -22,9 +23,11 @@ import com.yidianling.home.ui.view.*
* @Company 壹点灵
* @date 2019/02/13
*/
class YdlHomeAdapter(private val mContext: Context,
private var homeEvent: HomeImpl,
private var list: ArrayList<HomePagerDataBean>) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
class YdlHomeAdapter(
private val mContext: Context,
private var homeEvent: HomeImpl,
private var list: ArrayList<HomePagerDataBean>
) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
private val mInflater: LayoutInflater = LayoutInflater.from(mContext)
/**
......@@ -141,11 +144,17 @@ class YdlHomeAdapter(private val mContext: Context,
when (holder) {
//顶部预约专家,即时倾诉,心理课堂,心理测试按钮模块
is HomeButtonBannerViewHolder -> {
holder.buttonBannerView.initData(list[position].headerBean?.homeSaleData,list[position].headerBean?.askCategoryData)
holder.buttonBannerView.initData(
list[position].headerBean?.homeSaleData,
list[position].headerBean?.askCategoryData
)
}
//倾诉*排解模块
is HomeConfideViewHolder -> {
holder.confideViewView.setTitle(list[position].headerBean?.listenCategoryDate, confideSelectPosition)
holder.confideViewView.setTitle(
list[position].headerBean?.listenCategoryDate,
confideSelectPosition
)
holder.confideViewView.setConfideExpertInfoView(list[position].confideBean?.body)
confidePosition = position
}
......@@ -155,7 +164,15 @@ class YdlHomeAdapter(private val mContext: Context,
}
//解忧*问答模块
is HomeAssuageGriefViewHolder -> {
holder.assuageGriefViewView.initData(position, list[position].askBean?.data)
val ffrom =
getRam().getChannelName()
if (!TextUtils.isEmpty(ffrom) && ffrom.endsWith("huawei")) {
val parm = holder.itemView.layoutParams
parm.height = 0
holder.itemView.layoutParams = parm
} else {
holder.assuageGriefViewView.initData(position, list[position].askBean?.data)
}
}
//文章*阅读模块
is HomeArticleViewHolder -> {
......@@ -163,8 +180,14 @@ class YdlHomeAdapter(private val mContext: Context,
}
//咨询模块
is HomeConsultViewHolder -> {
holder.consultView.setTitle(list[position].headerBean?.consultCategoryData, consultSelectPosition)
holder.consultView.setConsultInfoView(list[position].consultBean?.list,list[position].headerBean?.consultCategoryData?.get(consultSelectPosition))
holder.consultView.setTitle(
list[position].headerBean?.consultCategoryData,
consultSelectPosition
)
holder.consultView.setConsultInfoView(
list[position].consultBean?.list,
list[position].headerBean?.consultCategoryData?.get(consultSelectPosition)
)
consultPosition = position
}
//测试模块
......@@ -177,25 +200,30 @@ class YdlHomeAdapter(private val mContext: Context,
override fun getItemCount(): Int {
return list.size
}
/**
* 顶部预约专家,即时倾诉,心理测试按钮模块 ViewHolder
*/
inner class HomeButtonBannerViewHolder(val buttonBannerView: HomeButtonBannerView) : RecyclerView.ViewHolder(buttonBannerView)
inner class HomeButtonBannerViewHolder(val buttonBannerView: HomeButtonBannerView) :
RecyclerView.ViewHolder(buttonBannerView)
/**
* 咨询模块 ViewHolder
*/
inner class HomeConsultViewHolder(val consultView: HomeConsultView) : RecyclerView.ViewHolder(consultView)
inner class HomeConsultViewHolder(val consultView: HomeConsultView) :
RecyclerView.ViewHolder(consultView)
/**
* 倾诉*排解模块 ViewHolder
*/
inner class HomeConfideViewHolder(val confideViewView: HomeConfideView) : RecyclerView.ViewHolder(confideViewView)
inner class HomeConfideViewHolder(val confideViewView: HomeConfideView) :
RecyclerView.ViewHolder(confideViewView)
/**
* 课程*成长模块 ViewHolder
*/
inner class HomeCourseViewHolder(val courseViewView: HomeCourseView) : RecyclerView.ViewHolder(courseViewView)
inner class HomeCourseViewHolder(val courseViewView: HomeCourseView) :
RecyclerView.ViewHolder(courseViewView)
/**
* 测试模块 ViewHolder
......@@ -205,11 +233,14 @@ class YdlHomeAdapter(private val mContext: Context,
/**
* 解忧*问答模块 ViewHolder
*/
inner class HomeAssuageGriefViewHolder(val assuageGriefViewView: HomeAssuageGriefView) : RecyclerView.ViewHolder(assuageGriefViewView)
inner class HomeAssuageGriefViewHolder(val assuageGriefViewView: HomeAssuageGriefView) :
RecyclerView.ViewHolder(assuageGriefViewView)
/**
* 文章*阅读模块 ViewHolder
*/
inner class HomeArticleViewHolder(val articleViewView: HomeArticleView) : RecyclerView.ViewHolder(articleViewView)
inner class HomeArticleViewHolder(val articleViewView: HomeArticleView) :
RecyclerView.ViewHolder(articleViewView)
/**
* 底部提示语模块 ViewHolder
......
package com.yidianling.home.ui.view
import android.content.Context
import android.graphics.Color
import android.view.View
import android.view.ViewGroup
import android.widget.LinearLayout
......@@ -33,6 +34,7 @@ class HomeAssuageGriefView(private val mContext: Context, private var homeEvent:
)
layoutParams = params
View.inflate(mContext, R.layout.home_assuage_grief_view, this)
setBackgroundColor(Color.GREEN)
homeModuleAssuageGriefViewHomeCommonTitleView.setTitle("解忧·问答")
homeModuleAssuageGriefViewHomeCommonTitleView.setOnClickListener {
homeEvent?.askMoreClick()
......@@ -42,6 +44,7 @@ class HomeAssuageGriefView(private val mContext: Context, private var homeEvent:
fun initData(position: Int, list: List<HomeAskBean.DataBean>?) {
//添加View
if (list == null) {
visibility = View.GONE
return
}
if (cacheList.size != list?.size) {
......
package com.yidianling.home.ui.view
import android.content.Context
import android.graphics.Color
import android.support.v7.widget.RecyclerView
import android.text.TextUtils
import android.view.View
import android.view.ViewGroup
import android.widget.FrameLayout
import android.widget.LinearLayout
import com.ydl.ydlcommon.data.PlatformDataManager
import com.yidianling.common.tools.RxImageTool
import com.yidianling.home.R
import com.yidianling.home.event.IHomeBaseEvent
......@@ -56,6 +59,28 @@ class HomeButtonBannerView(private val mContext: Context, private var homeEvent:
// initButtonView()
val ffrom = PlatformDataManager.getRam().getChannelName()
if (!TextUtils.isEmpty(ffrom) && ffrom.endsWith("huawei")) {
homeModuleButtonBannerFirst.background =
resources.getDrawable(R.drawable.home_dcotor_bt_bg_huawei)
homeModuleButtonBannerSecond.background =
resources.getDrawable(R.drawable.home_test_bt_bg_hauwei)
homeModuleButtonBannerThird.background =
resources.getDrawable(R.drawable.home_course_bt_bg_huawei)
homeModuleButtonBannerFourth.background =
resources.getDrawable(R.drawable.home_listen_bt_bg_huawei)
homeModuleButtonBannerFirstTitle.setTextColor(Color.WHITE)
tv_first_text.setTextColor(Color.WHITE)
homeModuleButtonBannerFourthTitle.setTextColor(Color.WHITE)
tv_second_text.setTextColor(Color.WHITE)
homeModuleButtonBannerThirdTitle.setTextColor(Color.WHITE)
tv_third_text.setTextColor(Color.WHITE)
homeModuleButtonBannerSecondTitle.setTextColor(Color.WHITE)
tv_fourth_text.setTextColor(Color.WHITE)
}
homeModuleButtonBannerFirst.setOnClickListener {
homeEvent?.reservationExpertsClick()
}
......
......@@ -5,11 +5,6 @@
android:layout_height="wrap_content"
android:orientation="vertical">
<com.yidianling.home.ui.widget.HomeModuleCategoryView
android:id="@+id/home_category_view"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
......@@ -17,8 +12,8 @@
android:layout_marginTop="8dp"
android:layout_marginRight="15dp"
android:gravity="center_horizontal"
android:orientation="horizontal"
android:paddingBottom="20dp">
android:paddingBottom="12dp"
android:orientation="horizontal">
<RelativeLayout
......@@ -29,22 +24,23 @@
android:layout_marginRight="8dp"
android:layout_weight="1"
android:background="@drawable/home_dcotor_bt_bg"
android:gravity="center">
android:gravity="center_horizontal">
<TextView
android:id="@+id/homeModuleButtonBannerFirstTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="7dp"
android:text="预约咨询"
android:textColor="@color/platform_black"
android:textSize="@dimen/platform_dp_16"
android:textStyle="bold" />
<TextView
android:id="@+id/tv_first_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/homeModuleButtonBannerFirstTitle"
android:layout_marginTop="2dp"
android:text="1W+师资"
android:textColor="@color/platform_color_444444"
android:textSize="@dimen/platform_dp_11" />
......@@ -58,22 +54,23 @@
android:layout_marginRight="8dp"
android:layout_weight="1"
android:background="@drawable/home_listen_bt_bg"
android:gravity="center">
android:gravity="center_horizontal">
<TextView
android:id="@+id/homeModuleButtonBannerFourthTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="7dp"
android:text="心理测试"
android:textColor="@color/platform_black"
android:textSize="@dimen/platform_dp_16"
android:textStyle="bold" />
<TextView
android:id="@+id/tv_second_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/homeModuleButtonBannerFourthTitle"
android:layout_marginTop="2dp"
android:text="专业权威"
android:textColor="@color/platform_color_444444"
android:textSize="@dimen/platform_dp_11" />
......@@ -87,23 +84,24 @@
android:layout_marginRight="8dp"
android:layout_weight="1"
android:background="@drawable/home_course_bt_bg"
android:gravity="center"
android:gravity="center_horizontal"
android:orientation="vertical">
<TextView
android:id="@+id/homeModuleButtonBannerThirdTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="7dp"
android:text="心理课堂"
android:textColor="@color/platform_black"
android:textSize="@dimen/platform_dp_16"
android:textStyle="bold" />
<TextView
android:id="@+id/tv_third_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/homeModuleButtonBannerThirdTitle"
android:layout_marginTop="2dp"
android:text="学习与成长"
android:textColor="@color/platform_color_444444"
android:textSize="@dimen/platform_dp_11" />
......@@ -114,59 +112,38 @@
android:layout_width="0dp"
android:layout_height="78dp"
android:layout_weight="1"
android:background="@drawable/home_test_bt_bg">
android:background="@drawable/home_test_bt_bg"
android:gravity="center_horizontal">
<RelativeLayout
<TextView
android:id="@+id/homeModuleButtonBannerSecondTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:background="@drawable/home_button_first_free_bg"
android:paddingLeft="5dp"
android:paddingTop="1dp"
android:paddingRight="5dp"
android:paddingBottom="1dp"
android:visibility="gone" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_marginTop="7dp"
android:text="即时倾诉"
android:textColor="@color/platform_black"
android:textSize="@dimen/platform_dp_16"
android:textStyle="bold" />
<TextView
android:id="@+id/tv_fourth_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/homeModuleButtonBannerSecondTitle"
android:layout_centerVertical="true"
android:layout_gravity="center_horizontal"
android:gravity="center_vertical"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical">
<TextView
android:id="@+id/homeModuleButtonBannerSecondTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="即时倾诉"
android:textColor="@color/platform_black"
android:textSize="@dimen/platform_dp_16"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/homeModuleButtonBannerSecondTitle"
android:layout_centerVertical="true"
android:layout_marginTop="2dp"
android:text="专业解忧"
android:textColor="@color/platform_color_444444"
android:textSize="@dimen/platform_dp_11" />
</LinearLayout>
</LinearLayout>
android:text="专业解忧"
android:textColor="@color/platform_color_444444"
android:textSize="@dimen/platform_dp_11" />
</RelativeLayout>
</LinearLayout>
<com.yidianling.home.ui.widget.HomeModuleCategoryView
android:id="@+id/home_category_view"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
......@@ -36,7 +36,6 @@ public class ConfideOrderInfoView extends RelativeLayout {
private String mSessionId;
private IP2PCustomActionHandler.DocInfo info = null;
private TextView tv_status = null;
private TextView tv_tips = null;
private TextView tv_action = null;
private TextView tv_order_info = null;
private ImageView iv_call = null;
......@@ -61,7 +60,6 @@ public class ConfideOrderInfoView extends RelativeLayout {
View.inflate(mContext, R.layout.im_nim_chat_confide_order_info_view, this);
setBackground(getResources().getDrawable(R.drawable.im_bg_im_confide_action));
tv_status = findViewById(R.id.tv_status);
tv_tips = findViewById(R.id.tv_tips);
tv_action = findViewById(R.id.tv_action);
iv_call = findViewById(R.id.iv_call);
tv_order_info = findViewById(R.id.tv_order_info);
......@@ -78,7 +76,6 @@ public class ConfideOrderInfoView extends RelativeLayout {
//有未完成订单
if (info.hasAvailableListenOrder == 2) {
tv_status.setText("剩余时间:" + coverTime(Integer.valueOf(info.listenOrderRemainTime)));
tv_tips.setVisibility(View.GONE);
if (info.is_online == 3) { //通话中
......@@ -98,7 +95,6 @@ public class ConfideOrderInfoView extends RelativeLayout {
tv_action.setBackground(getResources().getDrawable(R.drawable.im_background_chat_confide_order_action));
tv_action.setTextColor(getResources().getColor(R.color.im_white));
tv_action.setText("去评价");
tv_tips.setVisibility(View.VISIBLE);
}
tv_order_info.setText(info.listenOrderDesc);
}
......
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:parentTag="android.widget.RelativeLayout">
<TextView
android:id="@+id/tv_order_style"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginTop="18dp"
android:background="@drawable/im_background_chat_confide_order_stytle"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:text="倾诉"
android:textColor="@color/platform_color_1DA1F2"
android:textSize="11sp" />
<TextView
android:id="@+id/tv_status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="6dp"
android:layout_marginTop="16dp"
android:layout_toRightOf="@+id/tv_order_style"
android:textColor="@color/im_color_242424"
android:textSize="15sp"
android:textStyle="bold"
tools:text="已结束" />
<TextView
android:id="@+id/tv_order_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_order_style"
android:layout_marginLeft="15dp"
android:layout_marginTop="7dp"
android:layout_marginBottom="13dp"
android:textColor="@color/platform_color_999999"
android:textSize="11sp"
android:textStyle="bold"
tools:text="电话倾诉 倾诉时长:25分钟 2018.11.24 " />
<ImageView
android:id="@+id/iv_call"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="15dp"
android:src="@drawable/im_icon_qingsu_call"
android:visibility="gone" />
<TextView
android:id="@+id/tv_action"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="15dp"
android:paddingLeft="14dp"
android:paddingTop="4dp"
android:paddingRight="14dp"
android:paddingBottom="4dp"
android:textColor="@color/im_white"
tools:background="@drawable/im_background_chat_confide_order_action"
tools:text="去评价" />
<TextView
android:id="@+id/tv_tips"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:background="@drawable/im_background_chat_confide_order_tpis"
android:paddingLeft="5dp"
android:paddingTop="1dp"
android:paddingRight="5dp"
android:paddingBottom="1dp"
android:text="最高返30元红包"
android:textColor="@color/im_white"
android:textSize="9sp"
android:visibility="gone" />
</merge>
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:parentTag="android.widget.RelativeLayout">
<TextView
android:id="@+id/tv_order_style"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginTop="18dp"
android:background="@drawable/im_background_chat_confide_order_stytle"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:text="倾诉"
android:textColor="@color/platform_color_1DA1F2"
android:textSize="11sp" />
<TextView
android:id="@+id/tv_status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="6dp"
android:layout_marginTop="16dp"
android:layout_toRightOf="@+id/tv_order_style"
android:textColor="@color/im_color_242424"
android:textSize="15sp"
android:textStyle="bold"
tools:text="已结束" />
<TextView
android:id="@+id/tv_order_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_order_style"
android:layout_marginLeft="15dp"
android:layout_marginTop="7dp"
android:layout_marginBottom="13dp"
android:textColor="@color/platform_color_999999"
android:textSize="11sp"
android:textStyle="bold"
tools:text="电话倾诉 倾诉时长:25分钟 2018.11.24 " />
<ImageView
android:id="@+id/iv_call"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="15dp"
android:src="@drawable/im_icon_qingsu_call"
android:visibility="gone" />
<TextView
android:id="@+id/tv_action"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="15dp"
android:paddingLeft="14dp"
android:paddingTop="4dp"
android:paddingRight="14dp"
android:paddingBottom="4dp"
android:textColor="@color/im_white"
tools:background="@drawable/im_background_chat_confide_order_action"
tools:text="去评价" />
</merge>
......@@ -191,7 +191,8 @@ interface UserApi {
fun getFocusData(@Query("parentId") parentId: String = "0"): Observable<BaseAPIResponse<List<CollectFocusItemBean>>>
//获取新用户引导页面url
@FormUrlEncoded
@POST("user/getNewUserJumpUrl")
@Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA)
fun getNewUserJumpUrl(): Observable<BaseAPIResponse<String>>
fun getNewUserJumpUrl(@FieldMap params: Map<String, String>): Observable<BaseAPIResponse<String>>
}
\ No newline at end of file
......@@ -6,6 +6,7 @@ import com.google.gson.internal.LinkedTreeMap
import com.umeng.socialize.bean.SHARE_MEDIA
import com.ydl.ydlcommon.base.BaseApp
import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.ydl.ydlcommon.data.http.BaseCommand
import com.ydl.ydlcommon.data.http.BaseResponse
import com.ydl.ydlcommon.data.http.RxUtils
import com.ydl.ydlcommon.router.YdlCommonOut
......@@ -204,7 +205,8 @@ class UserHttpImpl private constructor() : UserHttp {
}
override fun getNewUserJumpUrl(): Observable<BaseAPIResponse<String>> {
return getUserApi().getNewUserJumpUrl()
return RxUtils.mapObservable(BaseCommand())
.flatMap { getUserApi().getNewUserJumpUrl(it) }
}
private object Holder {
......
......@@ -9,6 +9,7 @@ import com.ydl.ydlcommon.base.BaseApp
import com.ydl.ydlcommon.base.config.YDLConstants
import com.ydl.ydlcommon.data.PlatformDataManager
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.router.YdlCommonOut
import com.ydl.ydlcommon.utils.SharedPreferencesEditor
import com.ydl.ydlcommon.utils.YDLCacheUtils
import com.ydl.ydlcommon.utils.YdlBuryPointUtil
......@@ -40,6 +41,7 @@ class YDLCommonPlugin : MethodChannel.MethodCallHandler {
companion object {
const val CHANNEL: String = "lib/common/channel"
const val GETPUBLICPARAMAS: String = "getPublicParamas"
const val GET_PACKAGE_AND_FFROM: String = "get_package_and_ffrom" // 获取包名和渠道名,中间用,分割
const val ACTION_PUSH_EVENT_TRACKING_TAP: String = "action_push_event_tracking_tap"// 点击事件埋点
const val ACTION_PUSH_EVENT_TRACKING_PV: String = "action_push_event_tracking_pv"//pv埋点
......@@ -127,6 +129,11 @@ class YDLCommonPlugin : MethodChannel.MethodCallHandler {
YdlBuryPointUtil.sendPv(pvPath)
}
}
GET_PACKAGE_AND_FFROM -> {
val packageName = YdlCommonOut.getApp().packageName
val ffrom = PlatformDataManager.getRam().getChannelName()
result.success("$packageName,$ffrom")
}
}
}
}
\ No newline at end of file
......@@ -102,6 +102,32 @@ abstract class BaseActivity : AppCompatActivity(), IActivityLifecycleable {
}
}
/**
* 设置底部抬高的布局的颜色
*/
open fun setBottomColor(color: String) {
try {
if (getStatusViewOptions()?.isAddStatusView) {
if (StatusBarUtils.hasBottomNavigatorLine(this)) {
findViewById<View>(R.id.ll_bottom_v).setBackgroundColor(
Color.parseColor(
color
)
)
}
} else {
if (StatusBarUtils.hasBottomNavigatorLine(this)) {
findViewById<View>(R.id.ll_bottom_fit_v).setBackgroundColor(
Color.parseColor(
color
)
)
}
}
} catch (e: Exception) {
}
}
open fun getDefaultBottomColor(): Int {
return Color.parseColor("#00000000")
}
......
......@@ -154,6 +154,8 @@ class LogHelper private constructor() {
val yunxinLog = getYunXinLog(BaseApp.getApp())
//声网日志
val agoraLog = getAgoraLog(BaseApp.getApp())
val agoraRtmLog = getAgoraRTMLog(BaseApp.getApp())
val agoraRtmBackLog = getAgoraRtmBackLog(BaseApp.getApp())
if (zipFile.exists()) zipFile.delete()
zipFile.createNewFile()
......@@ -167,6 +169,12 @@ class LogHelper private constructor() {
if (agoraLog.exists()) {
files.add(agoraLog)
}
if (agoraRtmLog.exists()) {
files.add(agoraRtmLog)
}
if (agoraRtmBackLog.exists()) {
files.add(agoraRtmBackLog)
}
// ZipUtils.toZip(getLogFolder().absolutePath, FileOutputStream(zipFile), true)
ZipUtils.toZip(files, FileOutputStream(zipFile))
......@@ -233,6 +241,20 @@ class LogHelper private constructor() {
return File(filePath)
}
//获取RTM日志
private fun getAgoraRTMLog(context: Context): File {
val agoraRTMLog = FileUtils.getSDDirectory() + "/" + context.packageName + "/agorartm.log"
return File(agoraRTMLog)
}
//获取RTM备份日志
private fun getAgoraRtmBackLog(context: Context): File {
val agoraRTMLog = FileUtils.getSDDirectory() + "/" + context.packageName + "/agorartm_1.log"
return File(agoraRTMLog)
}
private object Holder {
val INSTANCE = LogHelper()
}
......
......@@ -44,6 +44,8 @@ class H5JsBean {
var orderStatus: Int = 0
var orderStatusDesc: String? = null
var bottomfitViewColor: String? = null //底部适配布局的颜色
var orderContent: String? = null//默认发送的第一天聊天
var action_name: String? = null
......
......@@ -17,7 +17,6 @@ import android.text.TextUtils;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.webkit.ValueCallback;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
......@@ -28,6 +27,7 @@ import com.tencent.smtt.export.external.interfaces.JsResult;
import com.tencent.smtt.export.external.interfaces.SslError;
import com.tencent.smtt.export.external.interfaces.SslErrorHandler;
import com.tencent.smtt.sdk.CookieSyncManager;
import com.tencent.smtt.sdk.ValueCallback;
import com.tencent.smtt.sdk.WebChromeClient;
import com.tencent.smtt.sdk.WebSettings;
import com.tencent.smtt.sdk.WebView;
......@@ -544,6 +544,12 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
});
}
public void setBottomViewColor(String color) {
runOnUiThread(() -> {
setBottomColor(color);
});
}
public void showTitleBar() {
runOnUiThread(() -> {
tb_title.setVisibility(VISIBLE);
......@@ -1267,6 +1273,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
* 新用户侧滑按钮限制
*/
if (h5Params.getBackLimit() != null && h5Params.getBackLimit() == H5Params.BackLimit.NEW_USER_PAGE) {
ModularServiceManager.INSTANCE.provide(IAppService.class).mainIntent(this);
return true;
}
......
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