Commit 054be915 by 严久程

信息采集过滤已经采集到的

parent 2ecece76
......@@ -181,7 +181,7 @@ dependencies {
implementation project(':m-user')
implementation modularPublication('com.ydl:m-user-api')
api project(':m-tests')
// api project(':m-consultant')
api project(':m-consultant')
implementation modularPublication('com.ydl:m-consultant-api')
// implementation project(':m-confide')
......
......@@ -118,9 +118,9 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(
}
bt_to_muse.setOnClickListener {
YDLRouterManager.router(IYDLRouterConstant.ROUTER_MUSE_CENTER,
YDLRouterParams().putExtra
("url", "http://video.yidianling.com/2019/05/30/746851e2f335baf5f44499f4fb49d3a9.mp3"))
// YDLRouterManager.router(IYDLRouterConstant.ROUTER_MUSE_CENTER,
// YDLRouterParams().putExtra
// ("url", "http://video.yidianling.com/2019/05/30/746851e2f335baf5f44499f4fb49d3a9.mp3"))
// YDLRouterManager.router(
// IYDLRouterConstant.ROUTER_MUSE,
......
......@@ -7,6 +7,7 @@ import com.ydl.component.mvp.DemoContract
import com.ydl.component.mvp.DemoPresenter
import com.ydl.ydlcommon.bean.StatusBarOptions
import com.ydl.ydlcommon.mvp.lce.BaseLceActivity
import com.yidianling.consultant.ExpertSearchFragment
//import com.yidianling.consultant.ExpertSearchFragment
import com.yidianling.dynamic.trendsHome.TrendsHomeFragment
import com.yidianling.home.ui.fragment.YdlHomeFragment
......@@ -70,9 +71,9 @@ class FragmentContainerActivity : BaseLceActivity<DemoContract.View, DemoContra
if ("YdlHomeFragment" == fragmentName) {
return YdlHomeFragment()
}
// if ("ExpertSearchFragment" == fragmentName) {
// return ExpertSearchFragment()
// }
if ("ExpertSearchFragment" == fragmentName) {
return ExpertSearchFragment()
}
return PlayFragment()
}
}
......@@ -281,8 +281,6 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
}
collectInfoPopupWindow.show(top_expert_info_cl);
}
}
ChatStatusCacheHelper.clearDataByKey("collectEvent");
}
......@@ -1190,7 +1188,18 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
.observeOn(AndroidSchedulers.mainThread())
.subscribe(resp -> {
if (resp.data != null && resp.data.size() > 0) {
collectInfoPopupWindow.setData(resp.data);
ServiceImpl.Companion.getInstance().userCollectList()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(hasCollectedInResp -> {
if (hasCollectedInResp.data != null && hasCollectedInResp.data.size() > 0) {
collectInfoPopupWindow.setData(resp.data, hasCollectedInResp.data);
} else {
collectInfoPopupWindow.setData(resp.data, null);
}
}, throwable -> {
collectInfoPopupWindow.setData(resp.data, null);
});
} else {
collectInfoPopupWindow.dismiss();
}
......
......@@ -18,7 +18,8 @@ import com.yidianling.uikit.custom.http.response.UserQuestInfoBean
* @Company 壹点灵
* @date 2019/12/10
*/
class CollectInfoPopupWindow(var mContext: Context, var listener: OnSendMsgListener) : PopupWindow(mContext) {
class CollectInfoPopupWindow(var mContext: Context, var listener: OnSendMsgListener) :
PopupWindow(mContext) {
private var collectUserInformationView: CollectUserInformationView
private var isFromBack = true
......@@ -49,12 +50,12 @@ class CollectInfoPopupWindow(var mContext: Context, var listener: OnSendMsgListe
isOutsideTouchable = false
}
fun setData(list: List<UserQuestInfoBean>) {
fun setData(list: List<UserQuestInfoBean>, hasCompleteInfoList: List<UserQuestInfoBean>?) {
if (list.isEmpty()) {
ToastUtil.toastShort("数据异常,请稍后重试")
return
}
collectUserInformationView.setData(list)
collectUserInformationView.setData(list, hasCompleteInfoList)
}
......
......@@ -37,11 +37,16 @@ import kotlin.collections.ArrayList
* @date 2019/12/10
*/
@SuppressLint("ViewConstructor")
class CollectUserInformationView(var mContext: Context, var skipEvent: () -> Unit, var sendMsgEvent: (content: String, list: List<UserQuestInfoBean>) -> Unit) : LinearLayout(mContext) {
class CollectUserInformationView(
var mContext: Context,
var skipEvent: () -> Unit,
var sendMsgEvent: (content: String, list: List<UserQuestInfoBean>) -> Unit
) : LinearLayout(mContext) {
private var resultInfoList = ArrayList<UserQuestInfoBean>()
private var hasAge = false
private var hasGender = false
private var currentIndex = 0
private var year =1994
//todo CommonDialog的样式要改
private var year = 1994
private var dialog: CommonDialog? = null
private var ageStr = ""
private var genderStr = ""
......@@ -49,7 +54,8 @@ class CollectUserInformationView(var mContext: Context, var skipEvent: () -> Uni
private var questionStyleStr = ""
init {
val params = LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)
val params =
LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)
layoutParams = params
View.inflate(mContext, R.layout.im_view_collect_user_infomation, this)
orientation = VERTICAL
......@@ -64,9 +70,30 @@ class CollectUserInformationView(var mContext: Context, var skipEvent: () -> Uni
}
fun setData(list: List<UserQuestInfoBean>) {
fun setData(list: List<UserQuestInfoBean>, hasCompleteInfoList: List<UserQuestInfoBean>?) {
resultInfoList.clear()
resultInfoList.addAll(list)
if (hasCompleteInfoList != null && hasCompleteInfoList.isNotEmpty()) {
repeat(hasCompleteInfoList.size) {
if (TextUtils.equals("age", hasCompleteInfoList[it].userInfoType)) {
if (!TextUtils.isEmpty(hasCompleteInfoList[it].content)) {
hasAge = true
year = try {
hasCompleteInfoList[it].content!!.toInt()
} catch (e: Exception) {
1994
}
}
}
if (TextUtils.equals("gener", hasCompleteInfoList[it].userInfoType)) {
if (!TextUtils.isEmpty(hasCompleteInfoList[it].content)) {
hasGender = true
genderStr = "性别:${hasCompleteInfoList[it].content}"
}
}
}
}
addContentView(resultInfoList[0].question!!, true)
proceedNext(list)
}
......@@ -79,14 +106,18 @@ class CollectUserInformationView(var mContext: Context, var skipEvent: () -> Uni
//防止连击
return@setOnClickListener
}
addContentView(resultInfoList[1].question!!, true)
if (hasGender || hasAge) {
addContentView(resultInfoList[3].question!!, true)
currentIndex += 2
rl_question_style.visibility = View.VISIBLE
} else {
addContentView(resultInfoList[1].question!!, true)
ll_gender.visibility = View.VISIBLE
}
tv_start.visibility = View.GONE
ll_gender.visibility = View.VISIBLE
}
//性别
tv_gender_male.setOnClickListener {
if (Utils.isFastClick()) {
//防止连击
......@@ -116,12 +147,15 @@ class CollectUserInformationView(var mContext: Context, var skipEvent: () -> Uni
}
((date_pick.getChildAt(0) as ViewGroup).getChildAt(0) as ViewGroup).getChildAt(2).visibility = View.GONE
((date_pick.getChildAt(0) as ViewGroup).getChildAt(0) as ViewGroup).getChildAt(1).visibility = View.GONE
//年龄
((date_pick.getChildAt(0) as ViewGroup).getChildAt(0) as ViewGroup).getChildAt(2)
.visibility = View.GONE
((date_pick.getChildAt(0) as ViewGroup).getChildAt(0) as ViewGroup).getChildAt(1)
.visibility = View.GONE
date_pick.init(
year,
Calendar.getInstance().get(Calendar.MONTH),
Calendar.getInstance().get(Calendar.DAY_OF_MONTH)
year,
Calendar.getInstance().get(Calendar.MONTH),
Calendar.getInstance().get(Calendar.DAY_OF_MONTH)
) { _, year, _, _ ->
this.year = year
}
......@@ -141,13 +175,17 @@ class CollectUserInformationView(var mContext: Context, var skipEvent: () -> Uni
}, 300)
}
if (list.size >= 3){
if (list.size >= 3) {
val adapter = CollectInfoStyleAdapter(list[3].answerList!!) {
addContentView(it, false)
rl_question_style.postDelayed({
questionStyleStr = "咨询类型:${it}"
addContentView(resultInfoList[currentIndex].question!!, true, resultInfoList[currentIndex].answerList!![0])
addContentView(
resultInfoList[currentIndex].question!!,
true,
resultInfoList[currentIndex].answerList!![0]
)
rl_question_style.visibility = View.GONE
ll_input.visibility = View.VISIBLE
......@@ -162,8 +200,8 @@ class CollectUserInformationView(var mContext: Context, var skipEvent: () -> Uni
val layoutManager = GridLayoutManager(mContext, 3)
rl_question_style.layoutManager = layoutManager
rl_question_style.adapter = adapter
}else{
rl_question_style.visibility = View.GONE
} else {
rl_question_style.visibility = View.GONE
}
tv_send.setOnClickListener {
......@@ -191,12 +229,20 @@ class CollectUserInformationView(var mContext: Context, var skipEvent: () -> Uni
//防止连击
return@setOnClickListener
}
val resultContent = ageStr + "\n" + genderStr + "\n" + questionStyleStr + "\n" + questionStr
val genderBean = UserQuestInfoBean(list[1].userInfoType, "", ArrayList(), genderStr.split(":")[1])
val ageBean = UserQuestInfoBean(list[2].userInfoType, "", ArrayList(),"${year}")
val questionStyleBean = UserQuestInfoBean(list[3].userInfoType, "", ArrayList(), questionStyleStr.split(":")[1])
val questionBean = UserQuestInfoBean(list[4].userInfoType, "", ArrayList(), questionStr.split(":")[1])
val resultContent =
ageStr + "\n" + genderStr + "\n" + questionStyleStr + "\n" + questionStr
val genderBean =
UserQuestInfoBean(list[1].userInfoType, "", ArrayList(), genderStr.split(":")[1])
val ageBean = UserQuestInfoBean(list[2].userInfoType, "", ArrayList(), "$year")
val questionStyleBean = UserQuestInfoBean(
list[3].userInfoType,
"",
ArrayList(),
questionStyleStr.split(":")[1]
)
val questionBean =
UserQuestInfoBean(list[4].userInfoType, "", ArrayList(), questionStr.split(":")[1])
val resultList = ArrayList<UserQuestInfoBean>()
resultList.add(genderBean)
......@@ -212,11 +258,17 @@ class CollectUserInformationView(var mContext: Context, var skipEvent: () -> Uni
@SuppressLint("RtlHardcoded")
private fun addContentView(title: String, send: Boolean, subtitle: String = "") {
val textView = TextView(mContext)
val params = LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)
val params =
LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)
params.topMargin = RxImageTool.dp2px(18f)
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 17f)
textView.setTextColor(Color.parseColor("#242424"))
textView.setPadding(RxImageTool.dp2px(13f), RxImageTool.dp2px(9f), RxImageTool.dp2px(13f), RxImageTool.dp2px(9f))
textView.setPadding(
RxImageTool.dp2px(13f),
RxImageTool.dp2px(9f),
RxImageTool.dp2px(13f),
RxImageTool.dp2px(9f)
)
if (send) {
textView.setBackgroundResource(R.drawable.im_background_collect_info_left)
params.gravity = Gravity.LEFT
......@@ -227,8 +279,18 @@ class CollectUserInformationView(var mContext: Context, var skipEvent: () -> Uni
if (!TextUtils.isEmpty(subtitle)) {
val resultText = "$title\n参考:\n$subtitle"
val sbString = SpannableString(resultText)
sbString.setSpan(ForegroundColorSpan(Color.parseColor("#999999")), title.length + 3, resultText.length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
sbString.setSpan(AbsoluteSizeSpan(12, true), title.length, resultText.length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
sbString.setSpan(
ForegroundColorSpan(Color.parseColor("#999999")),
title.length + 3,
resultText.length,
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
)
sbString.setSpan(
AbsoluteSizeSpan(12, true),
title.length,
resultText.length,
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
)
textView.text = sbString
textView.setLineSpacing(4f, 1f)
} else {
......@@ -261,15 +323,15 @@ class CollectUserInformationView(var mContext: Context, var skipEvent: () -> Uni
fun showSkipDialog() {
if (dialog == null) {
dialog = CommonDialog.create(mContext)
.setLeftOnclick("下次吧") {
skipEvent()
}
.setRightClick("继续填写") {
dialog!!.dismiss()
}
.setMessage("这个过程可以帮助您更快地改变当前的现状,确定要跳过吗?")
.setTitle_color(R.color.im_color_242424)
.setCancelAble(true)
.setLeftOnclick("下次吧") {
skipEvent()
}
.setRightClick("继续填写") {
dialog!!.dismiss()
}
.setMessage("这个过程可以帮助您更快地改变当前的现状,确定要跳过吗?")
.setTitle_color(R.color.im_color_242424)
.setCancelAble(true)
}
if (!dialog!!.isShowing) {
dialog!!.show()
......
......@@ -48,6 +48,12 @@ interface ServiceApi {
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun userCollectList(): Observable<BaseAPIResponse<List<UserQuestInfoBean>>>
//获取新用户收集的信息
@GET("user/getNewUserMes")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun getNewUserMes(): Observable<BaseAPIResponse<List<UserQuestInfoBean>>>
//信息采集的问题
@POST("user/collect/submit")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
......
......@@ -64,6 +64,13 @@ class ServiceImpl private constructor() {
}
/**
* 获取新用户收集的信息
*/
fun getNewUserMes(): Observable<BaseAPIResponse<List<UserQuestInfoBean>>> {
return YDLHttpUtils.obtainApi(ServiceApi::class.java).getNewUserMes()
}
/**
* 上传采集的问题
*/
fun submitUserCollect(params: String): Observable<BaseAPIResponse<Any>> {
......
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