Commit 054be915 by 严久程

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

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