Commit af53ee64 by 刘鹏

feat: 改变信息收集入口

parent f451ce8d
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.yidianling.im"
android:installLocation="auto">
package="com.yidianling.im"
android:installLocation="auto">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.FLASHLIGHT" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
<uses-permission android:name="android.permission.BROADCAST_STICKY"/>
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.BROADCAST_STICKY" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<permission
android:name="${APPLICATIONID}.permission.RECEIVE_MSG"
android:protectionLevel="signature" />
android:name="${APPLICATIONID}.permission.RECEIVE_MSG"
android:protectionLevel="signature" />
<uses-permission android:name="${APPLICATIONID}.permission.RECEIVE_MSG" />
<application>
......@@ -45,49 +49,53 @@
<!-- ==================== IM ==================== -->
<meta-data
android:name="com.netease.nim.appKey"
android:value="4e258ba5cdf489fa188274ebf0fb5669" />
android:name="com.netease.nim.appKey"
android:value="4e258ba5cdf489fa188274ebf0fb5669" />
<!-- 全面屏配置 -->
<meta-data
android:name="android.max_aspect"
android:value="2.1" />
android:name="android.max_aspect"
android:value="2.1" />
<activity
android:name=".ui.activity.SystemMsgDetailActivity"
android:screenOrientation="portrait"
android:theme="@style/platform_NoTitleTheme"
/>
android:name=".ui.activity.SystemMsgDetailActivity"
android:screenOrientation="portrait"
android:theme="@style/platform_NoTitleTheme" />
<activity
android:name=".ui.activity.OtherMsgDetailActivity"
android:screenOrientation="portrait"
android:theme="@style/platform_NoTitleTheme" />
<!--前置信息手机页面-->
<activity
android:name=".ui.activity.OtherMsgDetailActivity"
android:screenOrientation="portrait"
android:theme="@style/platform_NoTitleTheme"
/>
android:name=".ui.activity.CmsExamQuestionPaperActivity"
android:screenOrientation="portrait"
android:theme="@style/platform_NoTitleTheme" />
<!-- 云信 集成配置 -->
<!-- 声明云信后台服务 -->
<service
android:name="com.netease.nimlib.service.NimService"
android:process=":core" />
android:name="com.netease.nimlib.service.NimService"
android:process=":core" />
<!-- 运行后台辅助服务 -->
<service
android:name="com.netease.nimlib.service.NimService$Aux"
android:process=":core" />
android:name="com.netease.nimlib.service.NimService$Aux"
android:process=":core" />
<!-- 声明云信后台辅助服务 -->
<service
android:name="com.netease.nimlib.job.NIMJobService"
android:exported="true"
android:permission="android.permission.BIND_JOB_SERVICE"
android:process=":core" />
android:name="com.netease.nimlib.job.NIMJobService"
android:exported="true"
android:permission="android.permission.BIND_JOB_SERVICE"
android:process=":core" />
<!-- 云信SDK的监视系统启动和网络变化的广播接收器,用户开机自启动以及网络变化时候重新登录 -->
<receiver
android:name="com.netease.nimlib.service.NimReceiver"
android:exported="false"
android:process=":core">
android:name="com.netease.nimlib.service.NimReceiver"
android:exported="false"
android:process=":core">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
......@@ -103,29 +111,29 @@
<!-- 云信进程间通信provider -->
<!-- android:authorities="{包名}.ipc.provider", 请将com.yidianling.im替换为自己的包名 -->
<provider
android:name="com.netease.nimlib.ipc.NIMContentProvider"
android:authorities="${APPLICATIONID}.ipc.provider"
android:exported="false"
android:process=":core" />
android:name="com.netease.nimlib.ipc.NIMContentProvider"
android:authorities="${APPLICATIONID}.ipc.provider"
android:exported="false"
android:process=":core" />
<!-- ====================IM - AvChat==================== -->
<!-- ====================IM - AvChat==================== -->
<!-- ====================IM - AvChat==================== -->
<activity
android:name="com.yidianling.avchatkit.activity.AVChatActivity"
android:launchMode="singleInstance"
android:screenOrientation="portrait"
android:theme="@style/FullScreenTheme"
android:windowSoftInputMode="stateAlwaysHidden" />
android:name="com.yidianling.avchatkit.activity.AVChatActivity"
android:launchMode="singleInstance"
android:screenOrientation="portrait"
android:theme="@style/FullScreenTheme"
android:windowSoftInputMode="stateAlwaysHidden" />
<!-- 音视频 -->
<activity
android:name="com.yidianling.avchatkit.teamavchat.activity.TeamAVChatActivity"
android:launchMode="singleInstance"
android:screenOrientation="portrait"
android:theme="@style/FullScreenTheme"
android:windowSoftInputMode="stateAlwaysHidden" />
android:name="com.yidianling.avchatkit.teamavchat.activity.TeamAVChatActivity"
android:launchMode="singleInstance"
android:screenOrientation="portrait"
android:theme="@style/FullScreenTheme"
android:windowSoftInputMode="stateAlwaysHidden" />
<!-- 申明本地电话状态(通话状态)的广播接收器,第三方APP集成时音视频模块时,如果需要在App中处理网络通话与本地电话的交互请加上此接收器 -->
......@@ -140,106 +148,106 @@
<!-- ====================IM - UIKit==================== -->
<activity
android:name="com.yidianling.uikit.business.session.activity.YDLP2PMessageActivity"
android:configChanges="keyboardHidden|orientation"
android:screenOrientation="portrait"
android:theme="@style/platform_NoTitleTheme"
android:windowSoftInputMode="stateHidden|adjustResize" />
android:name="com.yidianling.uikit.business.session.activity.YDLP2PMessageActivity"
android:configChanges="keyboardHidden|orientation"
android:screenOrientation="portrait"
android:theme="@style/platform_NoTitleTheme"
android:windowSoftInputMode="stateHidden|adjustResize" />
<activity
android:name="com.yidianling.uikit.business.session.activity.YDLTeamMessageActivity"
android:configChanges="keyboardHidden|orientation"
android:screenOrientation="portrait"
android:theme="@style/platform_NoTitleTheme"
android:windowSoftInputMode="stateHidden|adjustResize" />
android:name="com.yidianling.uikit.business.session.activity.YDLTeamMessageActivity"
android:configChanges="keyboardHidden|orientation"
android:screenOrientation="portrait"
android:theme="@style/platform_NoTitleTheme"
android:windowSoftInputMode="stateHidden|adjustResize" />
<!-- 群聊 -->
<activity
android:name="com.yidianling.uikit.business.team.activity.NormalTeamInfoActivity"
android:configChanges="keyboardHidden|orientation"
android:screenOrientation="portrait"
android:theme="@style/platform_NoTitleTheme"
android:windowSoftInputMode="stateHidden|adjustResize" />
<activity
android:name="com.yidianling.uikit.business.team.activity.AdvancedTeamInfoActivity"
android:configChanges="keyboardHidden|orientation"
android:screenOrientation="portrait"
android:theme="@style/platform_NoTitleTheme"
android:windowSoftInputMode="stateHidden|adjustResize" />
<activity
android:name="com.yidianling.uikit.business.team.activity.AdvancedTeamMemberActivity"
android:configChanges="keyboardHidden|orientation"
android:screenOrientation="portrait"
android:theme="@style/platform_NoTitleTheme"
android:windowSoftInputMode="stateHidden|adjustResize" />
<activity
android:name="com.yidianling.uikit.business.team.activity.AdvancedTeamAnnounceActivity"
android:configChanges="keyboardHidden|orientation"
android:screenOrientation="portrait"
android:theme="@style/platform_NoTitleTheme"
android:windowSoftInputMode="stateHidden|adjustResize" />
<activity
android:name="com.yidianling.uikit.business.team.activity.AdvancedTeamMemberInfoActivity"
android:configChanges="keyboardHidden|orientation"
android:screenOrientation="portrait"
android:theme="@style/platform_NoTitleTheme"
android:windowSoftInputMode="stateHidden|adjustResize" />
<activity
android:name="com.yidianling.uikit.business.team.activity.AdvancedTeamNicknameActivity"
android:configChanges="keyboardHidden|orientation"
android:screenOrientation="portrait"
android:theme="@style/platform_NoTitleTheme"
android:windowSoftInputMode="stateHidden|adjustResize" />
<activity
android:name="com.yidianling.uikit.business.team.activity.AdvancedTeamCreateAnnounceActivity"
android:configChanges="keyboardHidden|orientation"
android:screenOrientation="portrait"
android:theme="@style/platform_NoTitleTheme"
android:windowSoftInputMode="stateHidden|adjustResize" />
<activity
android:name="com.yidianling.uikit.business.team.activity.TeamPropertySettingActivity"
android:configChanges="keyboardHidden|orientation"
android:screenOrientation="portrait"
android:theme="@style/platform_NoTitleTheme"
android:windowSoftInputMode="stateHidden|adjustResize" />
android:name="com.yidianling.uikit.business.team.activity.NormalTeamInfoActivity"
android:configChanges="keyboardHidden|orientation"
android:screenOrientation="portrait"
android:theme="@style/platform_NoTitleTheme"
android:windowSoftInputMode="stateHidden|adjustResize" />
<activity
android:name="com.yidianling.uikit.business.team.activity.AdvancedTeamInfoActivity"
android:configChanges="keyboardHidden|orientation"
android:screenOrientation="portrait"
android:theme="@style/platform_NoTitleTheme"
android:windowSoftInputMode="stateHidden|adjustResize" />
<activity
android:name="com.yidianling.uikit.business.team.activity.AdvancedTeamMemberActivity"
android:configChanges="keyboardHidden|orientation"
android:screenOrientation="portrait"
android:theme="@style/platform_NoTitleTheme"
android:windowSoftInputMode="stateHidden|adjustResize" />
<activity
android:name="com.yidianling.uikit.business.team.activity.AdvancedTeamAnnounceActivity"
android:configChanges="keyboardHidden|orientation"
android:screenOrientation="portrait"
android:theme="@style/platform_NoTitleTheme"
android:windowSoftInputMode="stateHidden|adjustResize" />
<activity
android:name="com.yidianling.uikit.business.team.activity.AdvancedTeamMemberInfoActivity"
android:configChanges="keyboardHidden|orientation"
android:screenOrientation="portrait"
android:theme="@style/platform_NoTitleTheme"
android:windowSoftInputMode="stateHidden|adjustResize" />
<activity
android:name="com.yidianling.uikit.business.team.activity.AdvancedTeamNicknameActivity"
android:configChanges="keyboardHidden|orientation"
android:screenOrientation="portrait"
android:theme="@style/platform_NoTitleTheme"
android:windowSoftInputMode="stateHidden|adjustResize" />
<activity
android:name="com.yidianling.uikit.business.team.activity.AdvancedTeamCreateAnnounceActivity"
android:configChanges="keyboardHidden|orientation"
android:screenOrientation="portrait"
android:theme="@style/platform_NoTitleTheme"
android:windowSoftInputMode="stateHidden|adjustResize" />
<activity
android:name="com.yidianling.uikit.business.team.activity.TeamPropertySettingActivity"
android:configChanges="keyboardHidden|orientation"
android:screenOrientation="portrait"
android:theme="@style/platform_NoTitleTheme"
android:windowSoftInputMode="stateHidden|adjustResize" />
<!-- 联系人选择器 -->
<activity
android:name="com.yidianling.uikit.business.contact.selector.activity.ContactSelectActivity"
android:configChanges="keyboardHidden|orientation"
android:label="@string/im_contact_selector"
android:screenOrientation="portrait"
android:theme="@style/platform_NoTitleTheme"
android:windowSoftInputMode="stateHidden|adjustPan" />
android:name="com.yidianling.uikit.business.contact.selector.activity.ContactSelectActivity"
android:configChanges="keyboardHidden|orientation"
android:label="@string/im_contact_selector"
android:screenOrientation="portrait"
android:theme="@style/platform_NoTitleTheme"
android:windowSoftInputMode="stateHidden|adjustPan" />
<!-- @ 选择器 -->
<activity
android:name="com.yidianling.uikit.business.ait.selector.AitContactSelectorActivity"
android:screenOrientation="portrait"
android:theme="@style/platform_NoTitleTheme" />
android:name="com.yidianling.uikit.business.ait.selector.AitContactSelectorActivity"
android:screenOrientation="portrait"
android:theme="@style/platform_NoTitleTheme" />
<!-- 视频 -->
<activity
android:name="com.yidianling.uikit.business.session.activity.CaptureVideoActivity"
android:configChanges="keyboardHidden|orientation"
android:screenOrientation="portrait"
android:theme="@style/platform_NoTitleTheme"
android:windowSoftInputMode="stateHidden|adjustResize" />
android:name="com.yidianling.uikit.business.session.activity.CaptureVideoActivity"
android:configChanges="keyboardHidden|orientation"
android:screenOrientation="portrait"
android:theme="@style/platform_NoTitleTheme"
android:windowSoftInputMode="stateHidden|adjustResize" />
<activity
android:name="com.yidianling.uikit.business.session.activity.WatchVideoActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="@string/im_video_play"
android:theme="@style/platform_NoTitleTheme" />
android:name="com.yidianling.uikit.business.session.activity.WatchVideoActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="@string/im_video_play"
android:theme="@style/platform_NoTitleTheme" />
<!-- 查看大图 -->
<activity
android:name="com.yidianling.uikit.business.session.activity.WatchMessagePictureActivity"
android:configChanges="keyboardHidden"
android:theme="@style/platform_NoTitleTheme" />
android:name="com.yidianling.uikit.business.session.activity.WatchMessagePictureActivity"
android:configChanges="keyboardHidden"
android:theme="@style/platform_NoTitleTheme" />
<activity
android:name="com.yidianling.uikit.business.session.activity.WatchPicAndVideoMenuActivity"
android:configChanges="keyboardHidden"
android:theme="@style/platform_NoTitleTheme" />
android:name="com.yidianling.uikit.business.session.activity.WatchPicAndVideoMenuActivity"
android:configChanges="keyboardHidden"
android:theme="@style/platform_NoTitleTheme" />
</application>
</manifest>
......@@ -2,10 +2,10 @@ package com.yidianling.im.helper
import android.annotation.SuppressLint
import android.content.Context
import androidx.core.content.ContextCompat
import androidx.appcompat.app.AppCompatActivity
import android.text.TextUtils
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity
import com.ydl.ydlcommon.data.http.BaseAPIResponse
......@@ -35,6 +35,7 @@ import com.yidianling.im.http.ImRetrofitApi.Companion.getImRetrofitApi
import com.yidianling.im.router.ImIn
import com.yidianling.im.router.ImIn.isLogin
import com.yidianling.im.session.SessionHelper
import com.yidianling.im.ui.activity.CmsExamQuestionPaperActivity
import com.yidianling.im.ui.page.fragment.bean.ChatItemBean
import com.yidianling.uikit.business.session.fragment.YDLMessageFragment
import com.yidianling.uikit.business.session.helper.ChatStatusCacheHelper
......@@ -55,10 +56,11 @@ import java.net.URLEncoder
*/
object IMChatUtil {
private var loadingDialog: LoadingDialogFragment? = null
private const val USER_TYPE_EXPERT=2//专家
private const val USER_TYPE_ASSISTANT=3//助理
private const val USER_TYPE_USER=1//用户
lateinit var doctorId:String
private const val USER_TYPE_EXPERT = 2//专家
private const val USER_TYPE_ASSISTANT = 3//助理
private const val USER_TYPE_USER = 1//用户
lateinit var doctorId: String
/**
* 接口数据请求完成回调
*/
......@@ -85,14 +87,74 @@ object IMChatUtil {
* @param context
* @param chatItemBean
*/
@SuppressLint("CheckResult")
fun startChat(context: AppCompatActivity?, chatItemBean: ChatItemBean) {
SessionHelper.startP2PSession(
context,
chatItemBean.utype,
chatItemBean.toUid.toString(),
null,
P2PCustomActionHandlerImpl(chatItemBean)
)
if (context == null || (!isLogin(context, true))) {
return
}
if (loadingDialog == null) {
loadingDialog = newInstance(null)
}
if (context.supportFragmentManager != null && !context.isDestroyed) {
loadingDialog?.show(context.supportFragmentManager, null)
}
getImJavaApi().getUserType(chatItemBean.toUid.toString())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({ res: BaseResponse<UserTypeBean> ->
if (res.code == 200 && res.data != null) {
if (res.data!!.collectEvent &&TextUtils.equals(res.data!!.userType, USER_TYPE_ASSISTANT.toString()) && res.data!!.collectEvent) {
//和助理私聊需要打开信息采集弹窗
prepareAssistantChatData(
context,
chatItemBean.toUid.toString(),
object : ChatDataRequestListener {
override fun onSuccess(expertInfo: IMExpertBuild) { //新前置信息收集入口
CmsExamQuestionPaperActivity.start(
context, chatItemBean.toUid.toString(), expertInfo,
0
)
}
})
} else {
SessionHelper.startP2PSession(
context,
chatItemBean.utype,
chatItemBean.toUid.toString(),
null,
P2PCustomActionHandlerImpl(chatItemBean)
)
}
} else {
if (loadingDialog != null && loadingDialog!!.isVisible) {
loadingDialog?.dismissAllowingStateLoss()
}
SessionHelper.startP2PSession(
context,
chatItemBean.utype,
chatItemBean.toUid.toString(),
null,
P2PCustomActionHandlerImpl(chatItemBean)
)
}
}, { throwable: Throwable? ->
if (loadingDialog != null && loadingDialog!!.isVisible) {
loadingDialog?.dismissAllowingStateLoss()
}
SessionHelper.startP2PSession(
context,
chatItemBean.utype,
chatItemBean.toUid.toString(),
null,
P2PCustomActionHandlerImpl(chatItemBean)
)
})
}
/**
......@@ -147,12 +209,24 @@ object IMChatUtil {
}) { t: Throwable? ->
handleError(context, t!!)
}
} else if (TextUtils.equals(res.data!!.userType, USER_TYPE_ASSISTANT.toString()) && res.data!!.collectEvent) {//助理
prepareAssistantChatData(context, toUid, object : ChatDataRequestListener {
override fun onSuccess(expertInfo: IMExpertBuild) { //新前置信息收集入口
CmsExamQuestionPaperActivity.start(
context,
toUid,
expertInfo,
isFromQingShu
)
}
})
} else {
prepareAssistantChatData(context, toUid, object : ChatDataRequestListener {
override fun onSuccess(expertInfo: IMExpertBuild) {
startChatSession(toUid, expertInfo, isFromQingShu, context)
}
})
}
} else {
if (loadingDialog != null && loadingDialog!!.isVisible) {
......@@ -165,8 +239,7 @@ object IMChatUtil {
loadingDialog?.dismissAllowingStateLoss()
}
handleError(context, throwable!!)
}
)
})
}
......@@ -197,7 +270,8 @@ object IMChatUtil {
isFromQingShu: Int,
context: AppCompatActivity
) {
AliYunRichLogsHelper.getInstance().sendRichLog(AliYunLogConfig.YUNXIN, "startChatSession 开启聊天会话")
AliYunRichLogsHelper.getInstance()
.sendRichLog(AliYunLogConfig.YUNXIN, "startChatSession 开启聊天会话")
val p2PCustomActionHandlerImpl = P2PCustomActionHandlerImpl(toUid, expertInfo)
p2PCustomActionHandlerImpl.isFromQingShu = isFromQingShu
SessionHelper.startP2PSession(
......@@ -209,6 +283,18 @@ object IMChatUtil {
)
}
/**
* 信息收集前置页调用方法
* */
open fun startChatSessionByCms(
toUid: String,
expertInfo: IMExpertBuild,
isFromQingShu: Int,
context: AppCompatActivity
) {
startChatSession(toUid, expertInfo, isFromQingShu, context)
}
//====================准备私聊数据====================
/**
* 初始化聊天数据
......@@ -489,7 +575,7 @@ object IMChatUtil {
val showExpertList = !(promptRule == 1 || promptRule == 3)
if (actionHandler.userType == USER_TYPE_EXPERT && status == 2) { //当该专家离线时
sendRecommendExpertListMessage(1, showExpertList, toUid, actionHandler)
} else if (actionHandler.userType == USER_TYPE_EXPERT&& status >= 3) { //当该专家忙碌时
} else if (actionHandler.userType == USER_TYPE_EXPERT && status >= 3) { //当该专家忙碌时
sendRecommendExpertListMessage(2, showExpertList, toUid, actionHandler)
}
}
......
package com.yidianling.uikit.business.session.view
package com.yidianling.im.ui.activity
import android.annotation.SuppressLint
import android.app.Activity
import android.content.Context
import android.content.Intent
import android.os.Handler
import android.text.Editable
import android.text.TextUtils
import android.text.TextWatcher
import android.view.MotionEvent
import android.view.View
import android.view.ViewGroup
import android.view.inputmethod.InputMethodManager
import android.widget.EditText
import android.widget.LinearLayout
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.alibaba.fastjson.JSON
import com.ydl.ydlcommon.base.BaseActivity
import com.ydl.ydlcommon.utils.SharedPreferencesEditor
import com.ydl.ydlcommon.utils.Utils
import com.ydl.ydlcommon.view.dialog.CommonDialog
import com.yidianling.im.R
import com.yidianling.im.api.bean.IMExpertBuild
import com.yidianling.im.helper.IMChatUtil
import com.yidianling.im.router.ImIn
import com.yidianling.listener.SoftKeyBoardListener
import com.yidianling.uikit.business.session.view.question.QuestionAdapter
......@@ -28,196 +31,92 @@ import com.yidianling.uikit.custom.http.ServiceImpl.Companion.instance
import com.yidianling.uikit.custom.http.response.question.*
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import kotlinx.android.synthetic.main.im_view_question_infomation.*
import kotlinx.android.synthetic.main.im_view_question_infomation.view.*
import java.util.*
import kotlin.collections.ArrayList
/**
* @author jiucheng
* @描述:用户信息采集view
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2019/12/10
*/
@SuppressLint("ViewConstructor", "NewApi")
class QuestionInformationView(
var mContext: Activity,
var skipEvent: () -> Unit,
var backEvent: () -> Unit,
var sendMsgEvent: (content: String, list: List<QuestionsInfoBean>) -> Unit
) : LinearLayout(mContext) {
* 新前置信息收集
* */
class CmsExamQuestionPaperActivity : BaseActivity() {
private var dialog: CommonDialog? = null
private var mQuestionAdapter: QuestionAdapter
/**界面数据流adapter*/
private lateinit var mQuestionAdapter: QuestionAdapter
/** 界面消息数据*/
private var mData = ArrayList<QuestionMultiItem>();
/**用于云信聊天界面添加数据使用*/
private var mType70RequestList = ArrayList<AnswerQuestionType70RequestBean>();
/**题库*/
private var mQuestionBean: QuestionsInfoBean? = null
/***/
private var problemContent = ""
private var answerQuestionId = ""
init {
val params = LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT
)
layoutParams = params
View.inflate(mContext, R.layout.im_view_question_infomation, this)
orientation = VERTICAL
/**答题id*/
private var answerQuestionId = ""
tv_skip.setOnClickListener {
if (Utils.isFastClick()) {
//防止连击
return@setOnClickListener
}
showSkipDialog()
companion object {
private lateinit var expertInfo: IMExpertBuild
private lateinit var toUid: String
private var isFromQingShu: Int = 0
@JvmStatic
fun start(context: Context, toUid: String, expertInfo: IMExpertBuild, isFromQingShu: Int) {
val starter = Intent(context, CmsExamQuestionPaperActivity::class.java)
this.expertInfo = expertInfo
this.toUid = toUid
this.isFromQingShu = isFromQingShu
context.startActivity(starter)
}
}
override fun layoutResId(): Int {
return R.layout.im_view_question_infomation
}
override fun initDataAndEvent() {
// if (isJumpToIm()) {
// //如果今天打过题,跳转到聊天界面
// skipToIm()
// return
// }
//初始化
initRecycle()
//设置view事件
addVIewListener()
//-------------请求数据----------------
preExamQuestionPaper()
createExams()
}
private fun initRecycle() {
val linearLayoutManager = LinearLayoutManager(mContext, RecyclerView.VERTICAL, false)
recycle.layoutManager = linearLayoutManager
mQuestionAdapter = QuestionAdapter(mData)
recycle.adapter = mQuestionAdapter
mQuestionAdapter.setOneCheckListener(object : QuestionOneCheckListener {
override fun itemClick(list: List<OptionsBean>?, question: QuestionsBean) {
var anwserStr = ""
list?.forEach {
if (anwserStr.isNotEmpty()) {
anwserStr = anwserStr + "、" + it?.name
} else {
anwserStr += it?.name
}
}
//发送回答问题信息
val questionMultiItem = QuestionMultiItem()
questionMultiItem.type2Text = anwserStr
questionMultiItem.viewType = 2
mData.add(questionMultiItem)
mQuestionAdapter.notifyDataSetChanged()
//回答问题
list?.let { anserOneChek(question, it, "") }
recycle.scrollToPosition(mData.size - 1)
val questionMultiItem2 = QuestionMultiItem()
// 使用问题questionId 去questionChains取到选项配置
val options = mQuestionBean!!.questionPaper.questionChains[question.id]?.options
//从配置里找到下一题id
val nextQuestionId = options?.get(list?.get(0)?.id)
//使用下一题nextQuestionId 取到题
val questionsBean = mQuestionBean!!.questionPaper.questions[nextQuestionId]
if (questionsBean != null) {
//还有下一题
questionMultiItem2.questionsBean = questionsBean
if ("radio" == questionsBean?.type) {
questionMultiItem2.viewType = 3
} else {
questionMultiItem2.viewType = 4
questionMultiItem2.type4CanClick = true
}
mData.add(questionMultiItem2)
} else {
//没有下一题了,展示描述=题
for ((index, item) in mData.withIndex()) {
mData[index].type4CanClick = false
}
val questionMultiItem5 = QuestionMultiItem()
questionMultiItem5.type5Bean = mQuestionBean!!.questions[1]
questionMultiItem5.viewType = 5
mData.add(questionMultiItem5)
//显示输入框
cl_input.visibility = VISIBLE
tv_problem.visibility = GONE
hsv_problem_tips.visibility = VISIBLE
et_input_problem.hint = "请简单描述遇到的问题……\n\n\n"
// 打开软件盘
showInputMethod(et_input_problem)
// 滚动到底部
Handler().postDelayed({
recycle.scrollToPosition(mData.size - 1)
}, 500L)
}
mQuestionAdapter.notifyDataSetChanged()
recycle.scrollToPosition(mData.size - 1)
mQuestionAdapter.setOneCheckListener(object : QuestionOneCheckListener {
override fun itemClick(list: List<OptionsBean>?, question: QuestionsBean) {
itemClick(list, question)
}
override fun moreDefineItemClick(list: List<OptionsBean>?, question: QuestionsBean) {
//多选确定
var anwserStr = ""
list?.forEach {
if (anwserStr.isNotEmpty()) {
anwserStr = anwserStr + "、" + it?.name
} else {
anwserStr += it?.name
}
}
//创建回答消息
val bean = list?.get(0)
val questionMultiItem = QuestionMultiItem()
questionMultiItem.type2Text = anwserStr
questionMultiItem.viewType = 2
mData.add(questionMultiItem)
mQuestionAdapter.notifyDataSetChanged()
//回答问题
list?.let { anserOneChek(question, it, "") }
//寻找下一题
recycle.scrollToPosition(mData.size - 1)
val questionMultiItem2 = QuestionMultiItem()
// 使用问题questionId 去questionChains取到选项配置
val options = mQuestionBean!!.questionPaper.questionChains[question.id]?.options
//从配置里找到下一题id
val nextQuestionId = options?.get(bean?.id)
//使用下一题nextQuestionId 取到题
val questionsBean = mQuestionBean!!.questionPaper.questions[nextQuestionId]
if (questionsBean != null) {
//还有下一题
questionMultiItem2.questionsBean = questionsBean
if ("radio" == questionsBean.type) {
questionMultiItem2.viewType = 3
} else {
questionMultiItem2.viewType = 4
questionMultiItem2.type4CanClick = true
}
mData.add(questionMultiItem2)
} else {
//没有下一题了,展示描述=题
for ((index, item) in mData.withIndex()) {
mData[index].type4CanClick = false
}
val questionMultiItem5 = QuestionMultiItem()
questionMultiItem5.type5Bean = mQuestionBean!!.questions[1]
questionMultiItem5.viewType = 5
mData.add(questionMultiItem5)
//显示输入框
cl_input.visibility = VISIBLE
tv_problem.visibility = GONE
hsv_problem_tips.visibility = VISIBLE
et_input_problem.hint = "请简单描述遇到的问题……\n\n\n"
// 打开软件盘
showInputMethod(et_input_problem)
// 滚动到底部
Handler().postDelayed({
recycle.scrollToPosition(mData.size - 1)
}, 500L)
}
mQuestionAdapter.notifyDataSetChanged()
recycle.scrollToPosition(mData.size - 1)
moreDefineItemClick(list, question)
}
override fun showOtherEdit(list: List<OptionsBean?>?, question: QuestionsBean) {
//显示输入框
cl_input.visibility = VISIBLE
tv_problem.visibility = VISIBLE
hsv_problem_tips.visibility = GONE
cl_input.visibility = LinearLayout.VISIBLE
tv_problem.visibility = LinearLayout.VISIBLE
hsv_problem_tips.visibility = LinearLayout.GONE
var problem = "已选:"
list?.forEach {
problem += "# " + it?.name
......@@ -233,7 +132,9 @@ class QuestionInformationView(
}
override fun hideOtherEdit() {
// TODO: 6/28/21 隐藏 其他键盘
//隐藏其他软键盘
et_input_problem.setText("")
hideInputMethod(et_input_problem)
}
})
......@@ -247,7 +148,6 @@ class QuestionInformationView(
}
}
recycle.addOnScrollListener(object : RecyclerView.OnScrollListener() {
override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
super.onScrollStateChanged(recyclerView, newState)
......@@ -261,9 +161,147 @@ class QuestionInformationView(
}
}
}
})
}
private fun moreDefineItemClick(
list: List<OptionsBean>?,
question: QuestionsBean
) {
//多选确定
var anwserStr = ""
list?.forEach {
if (anwserStr.isNotEmpty()) {
anwserStr = anwserStr + "、" + it?.name
} else {
anwserStr += it?.name
}
}
//创建回答消息
val bean = list?.get(0)
val questionMultiItem = QuestionMultiItem()
questionMultiItem.type2Text = anwserStr
questionMultiItem.viewType = 2
mData.add(questionMultiItem)
mQuestionAdapter.notifyDataSetChanged()
//回答问题
list?.let { anserOneChek(question, it, "") }
//寻找下一题
recycle.scrollToPosition(mData.size - 1)
val questionMultiItem2 = QuestionMultiItem()
// 使用问题questionId 去questionChains取到选项配置
val options = mQuestionBean!!.questionPaper.questionChains[question.id]?.options
//从配置里找到下一题id
val nextQuestionId = options?.get(bean?.id)
//使用下一题nextQuestionId 取到题
val questionsBean = mQuestionBean!!.questionPaper.questions[nextQuestionId]
if (questionsBean != null) {
//还有下一题
questionMultiItem2.questionsBean = questionsBean
if ("radio" == questionsBean.type) {
questionMultiItem2.viewType = 3
} else {
questionMultiItem2.viewType = 4
questionMultiItem2.type4CanClick = true
}
mData.add(questionMultiItem2)
} else {
//没有下一题了,展示描述=题
for ((index, item) in mData.withIndex()) {
mData[index].type4CanClick = false
}
val questionMultiItem5 = QuestionMultiItem()
questionMultiItem5.type5Bean = mQuestionBean!!.questions[1]
questionMultiItem5.viewType = 5
mData.add(questionMultiItem5)
//显示输入框
cl_input.visibility = LinearLayout.VISIBLE
tv_problem.visibility = LinearLayout.GONE
hsv_problem_tips.visibility = LinearLayout.VISIBLE
et_input_problem.hint = "请简单描述遇到的问题……\n\n\n"
// 打开软件盘
showInputMethod(et_input_problem)
// 滚动到底部
Handler().postDelayed({
recycle.scrollToPosition(mData.size - 1)
}, 500L)
}
mQuestionAdapter.notifyDataSetChanged()
recycle.scrollToPosition(mData.size - 1)
}
private fun itemClick(
list: List<OptionsBean>?,
question: QuestionsBean
) {
var anwserStr = ""
list?.forEach {
if (anwserStr.isNotEmpty()) {
anwserStr = anwserStr + "、" + it?.name
} else {
anwserStr += it?.name
}
}
//发送回答问题信息
val questionMultiItem = QuestionMultiItem()
questionMultiItem.type2Text = anwserStr
questionMultiItem.viewType = 2
mData.add(questionMultiItem)
mQuestionAdapter.notifyDataSetChanged()
//回答问题
list?.let { anserOneChek(question, it, "") }
recycle.scrollToPosition(mData.size - 1)
val questionMultiItem2 = QuestionMultiItem()
// 使用问题questionId 去questionChains取到选项配置
val options = mQuestionBean!!.questionPaper.questionChains[question.id]?.options
//从配置里找到下一题id
val nextQuestionId = options?.get(list?.get(0)?.id)
//使用下一题nextQuestionId 取到题
val questionsBean = mQuestionBean!!.questionPaper.questions[nextQuestionId]
if (questionsBean != null) {
//还有下一题
questionMultiItem2.questionsBean = questionsBean
if ("radio" == questionsBean?.type) {
questionMultiItem2.viewType = 3
} else {
questionMultiItem2.viewType = 4
questionMultiItem2.type4CanClick = true
}
mData.add(questionMultiItem2)
} else {
//没有下一题了,展示描述=题
for ((index, item) in mData.withIndex()) {
mData[index].type4CanClick = false
}
val questionMultiItem5 = QuestionMultiItem()
questionMultiItem5.type5Bean = mQuestionBean!!.questions[1]
questionMultiItem5.viewType = 5
mData.add(questionMultiItem5)
//显示输入框
cl_input.visibility = LinearLayout.VISIBLE
tv_problem.visibility = LinearLayout.GONE
hsv_problem_tips.visibility = LinearLayout.VISIBLE
et_input_problem.hint = "请简单描述遇到的问题……\n\n\n"
// 打开软件盘
showInputMethod(et_input_problem)
// 滚动到底部
Handler().postDelayed({
recycle.scrollToPosition(mData.size - 1)
}, 500L)
}
mQuestionAdapter.notifyDataSetChanged()
recycle.scrollToPosition(mData.size - 1)
}
/**
......@@ -278,8 +316,6 @@ class QuestionInformationView(
list: List<OptionsBean>,
otherInput: String
) {
val answerQuestionRequestBean = AnswerQuestionRequestBean()
answerQuestionRequestBean.examId = answerQuestionId
answerQuestionRequestBean.questionId = question.id
......@@ -300,6 +336,10 @@ class QuestionInformationView(
}
answerQuestionRequestBean.answers = answersBeanList
val type70RequestBean = AnswerQuestionType70RequestBean()
type70RequestBean.data = answerQuestionRequestBean
//添加回答数据到
mType70RequestList.add(type70RequestBean)
instance.answerQuestion(answerQuestionId, JSON.toJSONString(answerQuestionRequestBean))
.subscribeOn(Schedulers.io())
......@@ -307,20 +347,35 @@ class QuestionInformationView(
.subscribe()
}
@SuppressLint("ClickableViewAccessibility")
fun setData(questionInfo: QuestionsInfoBean) {
mQuestionBean = questionInfo
//设置数据,清空list数据
mData.clear()
//取到问候语
getFirstQuestion(questionInfo)
//取出第二条消息
setSecondQuestion()
//设置view事件
addVIewListener()
createExams()
/**
* 获取试题
* */
@SuppressLint("CheckResult")
fun preExamQuestionPaper() {
instance.preExamQuestionPaper()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({ resp ->
if (resp.data != null) {
mQuestionBean = resp.data
//设置数据,清空list数据
mData.clear()
//取到问候语
getFirstQuestion(resp.data)
//取出第二条消息
setSecondQuestion()
} else {
//无答题数据,跳转到聊天界面
IMChatUtil.startChatSessionByCms(
toUid, expertInfo, isFromQingShu, this@CmsExamQuestionPaperActivity
)
}
}, {
//接口请求报错,跳转到聊天页面
IMChatUtil.startChatSessionByCms(
toUid, expertInfo, isFromQingShu, this@CmsExamQuestionPaperActivity
)
})
}
@SuppressLint("CheckResult")
......@@ -336,8 +391,15 @@ class QuestionInformationView(
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({ resp ->
answerQuestionId = resp.data
}, { throwable ->
if (resp.data != null) {
answerQuestionId = resp.data
} else {
//未获取到答题id跳转到聊天页面
skipToIm()
}
}, {
//获取到答题id错误,跳转到聊天页面
skipToIm()
})
}
......@@ -374,11 +436,19 @@ class QuestionInformationView(
/**添加view事件*/
private fun addVIewListener() {
tv_skip.setOnClickListener {
if (Utils.isFastClick()) {
//防止连击
return@setOnClickListener
}
showSkipDialog()
}
tv_send.setOnClickListener {
et_input_problem.setText("")
hideInputMethod(et_input_problem)
//隐藏输入框
cl_input.visibility = GONE
cl_input.visibility = LinearLayout.GONE
}
tv_cur_problem.setOnClickListener {
problemContent = et_input_problem.text.toString()
......@@ -415,16 +485,16 @@ class QuestionInformationView(
if (char.contains("\n")) {
val s = char.toString().replace("\n", "")
if (TextUtils.isEmpty(s)) {
tv_send.visibility = GONE
tv_send.visibility = LinearLayout.GONE
et_input_problem.setText("")
} else {
tv_send.visibility = VISIBLE
tv_send.visibility = LinearLayout.VISIBLE
}
} else {
tv_send.visibility = VISIBLE
tv_send.visibility = LinearLayout.VISIBLE
}
} else {
tv_send.visibility = GONE
tv_send.visibility = LinearLayout.GONE
}
}
......@@ -459,27 +529,26 @@ class QuestionInformationView(
}
}
// 隐藏键盘布局
private fun hideInputMethod(et: EditText) {
val imm = mContext.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
imm.hideSoftInputFromWindow(et.windowToken, 0)
et.clearFocus()
}
// 显示键盘布局
private fun showInputMethod(editTextMessage: EditText) {
editTextMessage.requestFocus()
val imm = mContext.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
imm.showSoftInput(editTextMessage, 0)
/***
* 判断今天是否展示过
* */
private fun isJumpToIm(): Boolean {
val time =
Calendar.getInstance()[Calendar.YEAR].toString() + "-" + Calendar.getInstance()[Calendar.MONTH] + Calendar.getInstance()[Calendar.DAY_OF_MONTH]
return TextUtils.equals(
time,
SharedPreferencesEditor.getString("skip_time_" + ImIn.getUserInfo()?.uid)
)
}
fun showSkipDialog() {
/**
* 跳过填写dialog
* */
private fun showSkipDialog() {
if (dialog == null) {
dialog = CommonDialog.create(mContext)
.setLeftOnclick("下次吧") {
skipEvent()
skipToIm()
}
.setRightClick("继续填写") {
dialog!!.dismiss()
......@@ -493,6 +562,31 @@ class QuestionInformationView(
}
}
/**
* 跳过,直接取IM界面
* */
private fun skipToIm() {
IMChatUtil.startChatSessionByCms(
toUid, expertInfo, isFromQingShu, this@CmsExamQuestionPaperActivity
)
finish()
}
// 隐藏键盘布局
private fun hideInputMethod(et: EditText) {
val imm = mContext.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
imm.hideSoftInputFromWindow(et.windowToken, 0)
et.clearFocus()
}
// 显示键盘布局
private fun showInputMethod(editTextMessage: EditText) {
editTextMessage.requestFocus()
val imm = mContext.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
imm.showSoftInput(editTextMessage, 0)
}
/**
* 判断软键盘是否需要隐藏
......@@ -513,4 +607,5 @@ class QuestionInformationView(
}
return false
}
}
\ No newline at end of file
......@@ -10,8 +10,6 @@ import androidx.fragment.app.Fragment
import androidx.viewpager.widget.ViewPager
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.launcher.ARouter
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import com.netease.nimlib.sdk.NIMClient
import com.netease.nimlib.sdk.msg.MsgService
import com.netease.nimlib.sdk.msg.constant.SessionTypeEnum
......@@ -22,12 +20,15 @@ import com.yidianling.common.tools.ToastUtil
import com.yidianling.im.R
import com.yidianling.im.api.event.ImLogoutEvent
import com.yidianling.im.api.event.UpdateBottomBarUnreadNumEvent
import com.yidianling.im.bridge.P2PCustomActionHandlerImpl
import com.yidianling.im.config.constants.ImConstants
import com.yidianling.im.event.MessageListRefreshEvent
import com.yidianling.im.event.ReQureyUnreadNum
import com.yidianling.im.event.UpdateTabUnreadNumEvent
import com.yidianling.im.helper.MsgReceiveHelper
import com.yidianling.im.http.ImHttpImpl
import com.yidianling.im.router.ImIn
import com.yidianling.im.session.SessionHelper
import com.yidianling.im.ui.page.dialog.MessageChatSettingDialog
import com.yidianling.im.ui.page.fragment.ChatFragment
import com.yidianling.im.ui.page.fragment.InteractFragment
......@@ -37,18 +38,11 @@ import com.yidianling.im.ui.page.fragment.bean.UnreadMessageBean
import com.yidianling.im.ui.page.popupWindow.ChatSettingPopupWindow
import com.yidianling.im.ui.param.ClearMessageParam
import com.yidianling.im.ui.param.UnreadParam
import com.yidianling.uikit.business.session.view.CollectInfoPopupWindow
import com.yidianling.uikit.business.session.view.CollectInfoPopupWindow.OnSendMsgListener
import com.yidianling.uikit.custom.http.response.UserQuestInfoBean
import com.yidianling.uikit.custom.http.response.question.QuestionsInfoBean
import de.greenrobot.event.EventBus
import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import kotlinx.android.synthetic.main.im_new_multi_message_fragment.*
import java.io.BufferedInputStream
import java.io.IOException
import java.io.InputStream
import java.util.concurrent.TimeUnit
/**
......@@ -329,76 +323,15 @@ class NewMultiMessageFragment : BaseFragment() {
*/
private fun initKefu() {
ll_kefu.setOnClickListener {
// if (ImIn.isLogin()) {
// SessionHelper.startP2PSession(context, -1, ImConstants.KEFUXIAOYI, null,
// P2PCustomActionHandlerImpl(ImConstants.KEFUXIAOYI, "客服小壹", ImConstants.KEFUXIAOYI))
// } else {
// ToastUtil.toastShort("请登录后再试")
// }
// TODO: 6/23/21 测试入口
var collectInfoPopupWindow = activity?.let { it1 ->
CollectInfoPopupWindow(it1, object : OnSendMsgListener {
override fun sendMsg(content: String, result: List<QuestionsInfoBean>) {
}
override fun finishPage() {
activity!!.finish()
}
})
}
var cacheQuestion = String(activity?.let { it1 -> getAssertsFile(it1, "question.json") }!!)
if (cacheQuestion != null) {
var question = Gson().fromJson(cacheQuestion, QuestionsInfoBean::class.java)
collectInfoPopupWindow!!.show(ll_kefu)
collectInfoPopupWindow!!.setData(question)
}
}
}
fun getAssertsFile(context: Context, fileName: String): ByteArray? {
var inputStream: InputStream? = null
val assetManager = context.assets
try {
inputStream = assetManager.open(fileName)
if (inputStream == null) {
return null
}
var bis: BufferedInputStream? = null
val length: Int
try {
bis = BufferedInputStream(inputStream)
length = bis.available()
val data = ByteArray(length)
bis.read(data)
return data
} catch (e: IOException) {
} finally {
if (bis != null) {
try {
bis.close()
} catch (e: Exception) {
}
}
if (ImIn.isLogin()) {
SessionHelper.startP2PSession(context, -1, ImConstants.KEFUXIAOYI, null,
P2PCustomActionHandlerImpl(ImConstants.KEFUXIAOYI, "客服小壹", ImConstants.KEFUXIAOYI)
)
} else {
ToastUtil.toastShort("请登录后再试")
}
return null
} catch (e: IOException) {
e.printStackTrace()
}
return null
}
/**
* 设置页面背景色
*/
......
......@@ -26,7 +26,6 @@ import androidx.appcompat.app.AppCompatActivity;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.fastjson.JSON;
import com.netease.nimlib.sdk.NIMClient;
import com.netease.nimlib.sdk.Observer;
import com.netease.nimlib.sdk.RequestCallback;
......@@ -77,7 +76,6 @@ import com.yidianling.uikit.business.session.helper.ChatStatusCacheHelper;
import com.yidianling.uikit.business.session.module.input.InputPanel;
import com.yidianling.uikit.business.session.module.list.MessageListPanelEx;
import com.yidianling.uikit.business.session.view.ChatPrivateTips;
import com.yidianling.uikit.business.session.view.CollectInfoPopupWindow;
import com.yidianling.uikit.business.session.view.CommonQuestionView;
import com.yidianling.uikit.business.session.view.ImCommentBannerView;
import com.yidianling.uikit.business.session.view.ImRedStarGradeView;
......@@ -86,9 +84,7 @@ import com.yidianling.uikit.custom.bridge.IP2PCustomActionHandler;
import com.yidianling.uikit.custom.http.ServiceImpl;
import com.yidianling.uikit.custom.http.response.CommonQuestionBean;
import com.yidianling.uikit.custom.http.response.NewUserMesBean;
import com.yidianling.uikit.custom.http.response.SubmitUserInfoBean;
import com.yidianling.uikit.custom.http.response.UserQuestInfoBean;
import com.yidianling.uikit.custom.http.response.question.QuestionsInfoBean;
import com.yidianling.uikit.custom.widget.ConfideOrderInfoView;
import com.yidianling.uikit.custom.widget.ExpertInfoDialog;
import com.yidianling.uikit.custom.widget.TitleBarBottom;
......@@ -154,7 +150,6 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
private int timeCount = 0;
protected AitManager aitManager;
private CollectInfoPopupWindow collectInfoPopupWindow;
private CircleImageView small_head_img; //小头像
private TextView help_num_tv; //帮助人数
......@@ -290,6 +285,7 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
private void initView() {
if (ActionHandlerStorage.getL(sessionId) != null && ActionHandlerStorage.getL(sessionId).getUserType() == 3) {
//助理
rl_common_question_enter.setOnClickListener(v -> {
if (commonQuestionBeanList != null && commonQuestionBeanList.size() > 0) {
openOrCloseCommonQuestionLayout(true);
......@@ -304,54 +300,18 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
try {
YdlBuryPointUtil.sendPv("common_question_pager");
} catch (Exception e) {
e.printStackTrace();
}
getCommonQuestionListData();
}
ChatStatusCacheHelper.clearDataByKey("chatEvent");
}
if (ChatStatusCacheHelper.getStatusCache("collectEvent")) {
String time = Calendar.getInstance().get(Calendar.YEAR) + "-" + Calendar.getInstance().get(Calendar.MONTH) + Calendar.getInstance().get(Calendar.DAY_OF_MONTH);
// if (!TextUtils.equals(time, SharedPreferencesEditor.getString("skip_time_" + ImIn.INSTANCE.getUserInfo().getUid()))) {
collectInfoPopupWindow = new CollectInfoPopupWindow(getActivity(), new CollectInfoPopupWindow.OnSendMsgListener() {
@Override
public void sendMsg(@NotNull String content, @NotNull List<? extends QuestionsInfoBean> result) {
if (TextUtils.isEmpty(content)) {//点击跳过后当天不再显示此弹窗
SharedPreferencesEditor.putString("skip_time_" + ImIn.INSTANCE.getUserInfo().getUid()
, time);
} else {
IMMessage textMessage = MessageBuilder.createTextMessage(sessionId, sessionType, content);
if (sendMessage(textMessage)) {
openOrCloseCommonQuestionLayout(false);
}
// submitUserCollect(result);
}
}
@Override
public void finishPage() {
getActivity().finish();
}
});
getUserInfoCollect();
if (!getActivity().isFinishing()) {
try {
YdlBuryPointUtil.sendPv("user_collect_pager");
} catch (Exception e) {
}
collectInfoPopupWindow.show(top_expert_info_cl);
}
// }
ChatStatusCacheHelper.clearDataByKey("collectEvent");
}
}
//有未完成订单或者有未评价订单时,显示订单布局
if (ActionHandlerStorage.getL(sessionId) != null && ActionHandlerStorage.getL(sessionId).getInfo() != null) {
if (ActionHandlerStorage.getL(sessionId).getInfo().hasAvailableListenOrder == 2 || ActionHandlerStorage.getL(sessionId).getInfo().listenOrderCommentStatus == 1) {
//2专家 1用户
ConfideOrderInfoView confideOrderInfoView = new ConfideOrderInfoView(getContext(), sessionId);
confideOrderInfoView.setData(ActionHandlerStorage.getL(sessionId).getInfo());
rl_contain.addView(confideOrderInfoView);
......@@ -1405,46 +1365,6 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
});
}
@SuppressLint("CheckResult")
private void getUserInfoCollect() {
ServiceImpl.Companion.getInstance().preExamQuestionPaper()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(resp -> {
if (resp.data != null ) {
ServiceImpl.Companion.getInstance().getNewUserMes(new NewUserMesBean(""))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(hasCollectedInResp -> {
if (hasCollectedInResp.data != null && hasCollectedInResp.data.size() > 0) {
collectInfoPopupWindow.setData(resp.data);
} else {
collectInfoPopupWindow.setData(resp.data);
}
}, throwable -> {
collectInfoPopupWindow.setData(resp.data);
});
} else {
collectInfoPopupWindow.dismiss();
}
}, throwable -> {
collectInfoPopupWindow.dismiss();
});
}
@SuppressLint("CheckResult")
private void submitUserCollect(List<UserQuestInfoBean> result) {
SubmitUserInfoBean submitUserInfoBean = new SubmitUserInfoBean();
submitUserInfoBean.userInfoList = result;
ServiceImpl.Companion.getInstance().submitUserCollect(JSON.toJSONString(submitUserInfoBean))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(resp -> {
}, throwable -> {
});
}
private void showCheckAgeDialog() {
CommonDialog.create(getActivity())
.setLeftOnclick("返回", v -> {
......
package com.yidianling.uikit.business.session.view
import android.app.Activity
import android.content.Context
import android.graphics.drawable.BitmapDrawable
import android.os.Build
import android.view.Gravity
import android.view.KeyEvent
import android.view.View
import android.view.ViewGroup
import android.widget.PopupWindow
import androidx.annotation.RequiresApi
import com.yidianling.common.tools.ToastUtil
import com.yidianling.uikit.custom.http.response.question.QuestionsInfoBean
/**
* @author jiucheng
* @描述: 前置信息收集
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2019/12/10
*/
class CollectInfoPopupWindow(var mContext: Activity, var listener: OnSendMsgListener) :
PopupWindow(mContext) {
private var collectUserInformationView: QuestionInformationView
private var isFromBack = true
init {
height = ViewGroup.LayoutParams.MATCH_PARENT
width = ViewGroup.LayoutParams.MATCH_PARENT
setBackgroundDrawable(BitmapDrawable())
collectUserInformationView = QuestionInformationView(mContext, {
listener.sendMsg("", ArrayList())
isFromBack = false
dismiss()
}, {
dismiss()
listener.finishPage()
}, { _content, _list ->
listener.sendMsg(_content, _list)
isFromBack = false
dismiss()
})
collectUserInformationView.isFocusableInTouchMode = true
collectUserInformationView.setOnKeyListener { v, keyCode, event ->
if (keyCode == KeyEvent.KEYCODE_BACK) {
showSkipDialog()
true
}
false
}
contentView = collectUserInformationView
isFocusable = true
isTouchable = true
isOutsideTouchable = false
}
fun setData(questionInfo: QuestionsInfoBean) {
collectUserInformationView.setData(questionInfo)
}
override fun dismiss() {
if (isFromBack) {
showSkipDialog()
isFromBack = false
} else {
super.dismiss()
}
}
private fun showSkipDialog() {
collectUserInformationView.showSkipDialog()
}
fun show(v: View) {
v.post { showAtLocation(v, Gravity.BOTTOM, 0, 0) }
}
interface OnSendMsgListener {
fun sendMsg(content: String, result: List<QuestionsInfoBean>)
fun finishPage()
}
}
\ No newline at end of file
......@@ -147,7 +147,7 @@ class ServiceImpl private constructor() {
}
/**
* 创建答题信息
* 回答问题
*/
fun answerQuestion(id: String, params: String): Observable<BaseAPIResponse<String>> {
val body = RequestBody.create(
......
package com.yidianling.uikit.custom.http.response.question;
import com.yidianling.uikit.custom.http.response.question.RelatesBean;
import java.util.List;
......
package com.yidianling.uikit.custom.http.response.question;
/**
* @author liupeng
* <p>
* 测试前置-回答消息(区分其他类型与主诉类型)
* 用户APP -》灵犀
* type 70
* <p>
* 地址 https://note.youdao.com/ynoteshare1/index.html?id=ac018cb5b65b7d5fc5e961410b14621a&type=note
*/
public class AnswerQuestionType70RequestBean {
public String type = "70";
public AnswerQuestionRequestBean data;
}
......@@ -2,6 +2,11 @@ package com.yidianling.uikit.custom.http.response.question;
import java.util.List;
/**
* 题库信息
*
* @author liupeng
*/
public class QuestionsInfoBean {
......
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:parentTag="android.widget.LinearLayout">
android:orientation="vertical">
<RelativeLayout
......@@ -44,10 +43,9 @@
android:text="跳过"
android:textColor="@color/im_color_grey_999999"
android:textSize="14sp" />
</RelativeLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
......@@ -58,9 +56,9 @@
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="@color/color_f8f8f8"
android:paddingBottom="12dp"
app:layout_constraintBottom_toTopOf="@id/cl_input"
app:layout_constraintTop_toTopOf="parent"
android:paddingBottom="12dp"
app:layout_constraintVertical_weight="1" />
<androidx.constraintlayout.widget.ConstraintLayout
......@@ -69,31 +67,31 @@
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="gone"
tools:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent">
app:layout_constraintBottom_toBottomOf="parent"
tools:visibility="visible">
<TextView
android:id="@+id/tv_problem"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/color_f8f8f8"
android:paddingStart="12dp"
android:paddingBottom="13dp"
android:textColor="@color/color_242424"
android:textSize="14sp"
android:visibility="gone"
android:background="@color/color_f8f8f8"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:visibility="visible"
tools:text="已选:" />
tools:text="已选:"
tools:visibility="visible" />
<EditText
android:id="@+id/et_input_problem"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:gravity="top"
android:hint="请简单描述遇到的问题......"
android:background="@color/white"
android:maxHeight="200dp"
android:padding="12dp"
android:textColor="@color/color_242424"
......@@ -199,12 +197,11 @@
android:text="去沟通"
android:textColor="@color/white"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="parent"
android:visibility="gone"
tools:visibility="gone"
/>
app:layout_constraintBottom_toBottomOf="parent"
tools:visibility="gone" />
</androidx.constraintlayout.widget.ConstraintLayout>
</merge>
\ No newline at end of file
</LinearLayout>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment