Commit ca3a5007 by 严久程

动态bug修复

im模块4.0.20内容增加
basecommand字段修改
parent e9d92d27
......@@ -8,6 +8,7 @@ import android.os.Build;
import android.os.Process;
import android.support.annotation.RequiresApi;
import com.facebook.stetho.Stetho;
import com.meituan.android.walle.WalleChannelReader;
import com.netease.nimlib.sdk.util.NIMUtil;
import com.tencent.bugly.crashreport.CrashReport;
......@@ -15,7 +16,6 @@ import com.umeng.analytics.MobclickAgent;
import com.umeng.commonsdk.UMConfigure;
import com.umeng.socialize.PlatformConfig;
import com.umeng.socialize.UMShareAPI;
import com.ydl.audioim.YDLavManager;
import com.ydl.component.BuildConfig;
import com.ydl.component.MainActivity;
import com.ydl.media.audio.PlayService;
......@@ -61,6 +61,8 @@ public class DemoAppLifecycles implements IAppLifecycles {
Intent intent = new Intent(application, PlayService.class);
application.startService(intent);
application.registerActivityLifecycleCallbacks(new CoursePlayLifecycle());
Stetho.initializeWithDefaults(application);
}
}
......
ext {
kotlin_version = "1.3.21"
dev_mode = false
dev_mode = true
ydl_app = [
appName : "心理咨询壹点灵",
applicationId: "com.cxzapp.yidianling",
versionName : "4.0.00",
versionName : "4.0.20",
versionCode : 4000,
]
......
......@@ -72,8 +72,7 @@ public class TrendsDetailInfoBean {
public ArrayList<IMage> bigAttach;//大图
public int topicId;//话题id
public String topicTitle;//话题标题
@SerializedName(value = "isFocused",alternate = "is_focused")
public int is_focused;//1已关注,2未关注
public int isFocused;//1已关注,2未关注
public String uid;
public String multitextType;//动态类型
public ExtAd ext;
......
......@@ -300,7 +300,7 @@ public class TrendsDetailActivity extends BaseMvpActivity<ITrendsDetailView, ITr
@NotNull
@Override
public StatusBarOptions getStatusViewOptions() {
return new StatusBarOptions(true,true);
return new StatusBarOptions(true, true);
}
public static Intent newIntent(Activity activity, int trendId, boolean isScrollToZan) {
......@@ -407,8 +407,8 @@ public class TrendsDetailActivity extends BaseMvpActivity<ITrendsDetailView, ITr
/**
* 获取路由传递的参数
*/
private void getParam(){
if (null == getIntent() || !getIntent().hasExtra(ROUTER_PARAMS)){
private void getParam() {
if (null == getIntent() || !getIntent().hasExtra(ROUTER_PARAMS)) {
return;
}
//路由传递的入参
......@@ -421,6 +421,7 @@ public class TrendsDetailActivity extends BaseMvpActivity<ITrendsDetailView, ITr
e.printStackTrace();
}
}
@Override
protected void onResume() {
super.onResume();
......@@ -432,7 +433,7 @@ public class TrendsDetailActivity extends BaseMvpActivity<ITrendsDetailView, ITr
dismissProgressDialog();
if (isFirstLoad) {
vLoading.setViewType(LogoLoadingView.TYPE_LOADING, null);
}else {
} else {
showProgressDialog(message);
}
}
......@@ -492,7 +493,7 @@ public class TrendsDetailActivity extends BaseMvpActivity<ITrendsDetailView, ITr
.setLeftOnclick(TrendsDetailActivity.this.getString(R.string.dynamic_details), new View.OnClickListener() {
@Override
public void onClick(View v) {
String realUrl = TextUtils.isEmpty(url) ? DynamicConstants.HELP_URL : url;
String realUrl = TextUtils.isEmpty(url) ? DynamicConstants.HELP_URL : url;
H5Params params = new H5Params(realUrl, "");
NewH5Activity.start(TrendsDetailActivity.this, params);
}
......@@ -875,7 +876,7 @@ public class TrendsDetailActivity extends BaseMvpActivity<ITrendsDetailView, ITr
comments = new ArrayList<>();
Bundle bundle = getIntent().getBundleExtra(YDLConstants.BUNDLE);
if (null != bundle){
if (null != bundle) {
lastId = bundle.getInt(KEY_LAST_ID, 0);
isFromSplash = bundle.getBoolean(KEY_IS_SPLASH, false);
trendId = bundle.getInt(KEY_TREND_ID, 0);
......@@ -1179,7 +1180,7 @@ public class TrendsDetailActivity extends BaseMvpActivity<ITrendsDetailView, ITr
.setRightClick("果断绑定", v -> {
startActivity(DynamicIn.INSTANCE.inputPhoneIntent(this, DynamicConstants.BIND_PHONE_ACTION));
})
.setMessage("\n" + DynamicConstants.Companion.getBIND_PHONE()+ "\n")
.setMessage("\n" + DynamicConstants.Companion.getBIND_PHONE() + "\n")
.show();
return;
}
......@@ -1388,7 +1389,7 @@ public class TrendsDetailActivity extends BaseMvpActivity<ITrendsDetailView, ITr
linContent.setVisibility(View.VISIBLE);
relNotExist.setVisibility(View.GONE);
linNullTip.setVisibility(mTrendBody.replyCounter > 0 ? GONE : VISIBLE);
tvGuanzhu.setVisibility(mTrendBody.is_focused == 1 || mTrendBody.uid.equals("0") || TextUtils.equals(mTrendBody.uid, DynamicIn.INSTANCE.getUserInfo().getUid()) ? View.GONE : View.VISIBLE);
tvGuanzhu.setVisibility(mTrendBody.isFocused == 1 || mTrendBody.uid.equals("0") || TextUtils.equals(mTrendBody.uid, DynamicIn.INSTANCE.getUserInfo().getUid()) ? View.GONE : View.VISIBLE);
ivLike.setImageResource(mTrendBody.isZan == 1 ? R.drawable.dynamic_newsfeed_like_sel : R.drawable.dynamic_newsfeed_like);
if (!TextUtils.isEmpty(mTrendBody.content)) {
MoonUtil.identifyFaceExpression(this, tvContent, mTrendBody.content, ImageSpan.ALIGN_BOTTOM);
......@@ -1614,7 +1615,7 @@ public class TrendsDetailActivity extends BaseMvpActivity<ITrendsDetailView, ITr
// //删除
// deleteDialog(2, mTrendBody.id, 0);//
// }));
YDLShareDialog dialog = YDLShareDialog.Companion.style2(this, mTrendBody.title, DynamicConstants.Companion.getTRENF_INFO_SHARE_H5()+ trendId, mTrendBody.content, "http://static.ydlcdn.com/v1/images/logo320.png");
YDLShareDialog dialog = YDLShareDialog.Companion.style2(this, mTrendBody.title, DynamicConstants.Companion.getTRENF_INFO_SHARE_H5() + trendId, mTrendBody.content, "http://static.ydlcdn.com/v1/images/logo320.png");
dialog.setCallBack(type -> {
if (2 == type) {
//删除
......@@ -1626,7 +1627,7 @@ public class TrendsDetailActivity extends BaseMvpActivity<ITrendsDetailView, ITr
dialog.show(getFragmentManager(), "lose");
} else {
//别人帖子
YDLShareDialog dialog = YDLShareDialog.Companion.style3(this, mTrendBody.title, DynamicConstants.Companion.getTRENF_INFO_SHARE_H5()+ trendId, mTrendBody.content, "http://static.ydlcdn.com/v1/images/logo320.png");
YDLShareDialog dialog = YDLShareDialog.Companion.style3(this, mTrendBody.title, DynamicConstants.Companion.getTRENF_INFO_SHARE_H5() + trendId, mTrendBody.content, "http://static.ydlcdn.com/v1/images/logo320.png");
dialog.setCallBack(type -> {
if (3 == type) {
if (!DynamicIn.INSTANCE.isLogin()) {
......@@ -1672,7 +1673,7 @@ public class TrendsDetailActivity extends BaseMvpActivity<ITrendsDetailView, ITr
}
private void backHome() {
DynamicIn.INSTANCE.mainIntent(this,0);
DynamicIn.INSTANCE.mainIntent(this, 0);
}
/**
......
......@@ -253,7 +253,6 @@ public class TrendsHomeFragment extends BaseFragment implements ITrendHomeView,
.burryPoint("topTabClick");
if (!DynamicIn.INSTANCE.isLogin()) {
startActivity(DynamicIn.INSTANCE.loginWayIntent(getActivity()));
// startActivity(new Intent(getActivity(), ChooseLoginWayActivity.class));
return;
}
BuryPointUtils.getInstance().trackViewScreen(getActivity(), "动态-关注", "com.cxzapp.yidianling.trends.trendList.TrendsListFragment");
......
......@@ -20,7 +20,7 @@ import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.functions.Action
import io.reactivex.functions.Consumer
import io.reactivex.schedulers.Schedulers
import java.util.concurrent.TimeUnit
/**
* @author <a href="https://www.jianshu.com/u/c1e5310dd724">xujian</a>
......
package com.yidianling.im.bean
/**
* @author jiucheng
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2019/12/10
*/
class UserTypeBean(var userType: String,//用户类型 1 用户 2 专家 3 助理
var chatEvent: Boolean,//私聊常用语弹窗
var collectEvent: Boolean)//收集信息
\ No newline at end of file
package com.yidianling.im.event;
/**
* @author jiucheng
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2019/12/13
*/
public class MsgPushEvent {
public String toUid;
public String headUrl;
public String content;
public String name;
@Override
public String toString() {
return "MsgPushEvent{" +
"toUid='" + toUid + '\'' +
", headUrl='" + headUrl + '\'' +
", content='" + content + '\'' +
", name='" + name + '\'' +
'}';
}
}
......@@ -5,11 +5,8 @@ import com.ydl.ydlcommon.base.config.YDL_DOMAIN_JAVA
import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.ydl.ydlcommon.data.http.BaseResponse
import com.ydl.ydlnet.YDLHttpUtils
import com.yidianling.im.bean.CourseStatusBean
import com.yidianling.im.bean.DoctorAssistantRespDtoBean
import com.yidianling.im.bean.PushConfideStatusBean
import com.yidianling.im.bean.RedPacketDetailBean
import com.yidianling.im.api.bean.IMExpertBuild
import com.yidianling.im.bean.*
import io.reactivex.Observable
import retrofit2.http.*
......@@ -43,7 +40,7 @@ interface ImRetrofitApi {
//获取用户的状态(用户、专家、助理)
@GET("user/userType")
@Headers(YDL_DOMAIN+ YDL_DOMAIN_JAVA)
fun getUserType(@Query("targetUid") uid: String): Observable<BaseResponse<String>>
fun getUserType(@Query("targetUid") uid: String): Observable<BaseResponse<UserTypeBean>>
//根据专家uid获取私聊的目标uid(有可能是专家uid,有可能是助理uid)
@GET("doctor/chat-user")
......
......@@ -47,7 +47,7 @@ public class OrderAction extends BaseAction {
.subscribe(res -> {
if (res.code == 200) {
Observable<BaseResponse<IMExpertBuild>> observable;
if (TextUtils.equals(res.data, "2")) {//专家
if (TextUtils.equals(res.data.getUserType(), "2")) {//专家
observable = ImRetrofitApi.Companion.getImJavaApi().getPersonalChat(getAccount());
} else {
observable = ImHttpImpl.Companion.getInstance().getExpert(new ExpertParam(Integer.valueOf(getAccount()), 0));
......
package com.yidianling.uikit.business.session.helper;
import java.util.HashMap;
/**
* @author jiucheng
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2019/12/11
*/
public class ChatStatusCacheHelper {
private static final HashMap<String, Boolean> statusCache = new HashMap<>();
public static void setStatusCache(String key, boolean value) {
statusCache.put(key, value);
}
public static boolean getStatusCache(String key) {
if (statusCache.containsKey(key)) {
return statusCache.get(key);
}
return false;
}
public static void clearDataByKey(String key) {
if (statusCache.containsKey(key)) {
statusCache.remove(key);
}
}
}
......@@ -213,7 +213,7 @@ public class MessageListPanelEx {
private OnItemClickListener listener = new OnItemClickListener() {
@Override
public void onItemClick(IRecyclerView adapter, View view, int position) {
container.proxy.shouldCollapseInputPanel();
}
@Override
......
package com.yidianling.uikit.business.session.view
import android.content.Context
import android.graphics.drawable.BitmapDrawable
import android.view.Gravity
import android.view.KeyEvent
import android.view.View
import android.view.ViewGroup
import android.widget.PopupWindow
import com.yidianling.common.tools.ToastUtil
import com.yidianling.uikit.custom.http.response.UserQuestInfoBean
/**
* @author jiucheng
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2019/12/10
*/
class CollectInfoPopupWindow(var mContext: Context, var listener: OnSendMsgListener) : PopupWindow(mContext) {
private var collectUserInformationView: CollectUserInformationView
private var isFromBack = true
init {
height = ViewGroup.LayoutParams.MATCH_PARENT
width = ViewGroup.LayoutParams.MATCH_PARENT
setBackgroundDrawable(BitmapDrawable())
collectUserInformationView = CollectUserInformationView(mContext, {
listener.sendMsg("", ArrayList())
isFromBack = false
dismiss()
}, { _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(list: List<UserQuestInfoBean>) {
if (list.isEmpty()) {
ToastUtil.toastShort("数据异常,请稍后重试")
return
}
collectUserInformationView.setData(list)
}
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<UserQuestInfoBean>)
}
}
\ No newline at end of file
package com.yidianling.uikit.business.session.view
import android.support.v7.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import com.yidianling.im.R
/**
* @author jiucheng
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2019/12/11
*/
class CollectInfoStyleAdapter(var list: List<String>, var event: (title: String) -> Unit) : RecyclerView.Adapter<CollectInfoStyleAdapter.InfoStyleHolder>() {
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): InfoStyleHolder {
return InfoStyleHolder(LayoutInflater.from(parent!!.context).inflate(R.layout.im_item_collect_info_question_style, parent, false))
}
override fun getItemCount(): Int {
return if (list.size > 9) 9 else list.size
}
override fun onBindViewHolder(holder: InfoStyleHolder?, position: Int) {
holder!!.bindData(list[position])
holder.itemView.setOnClickListener {
event(list[position])
}
}
inner class InfoStyleHolder(var view: View) : RecyclerView.ViewHolder(view) {
private var textView: TextView = view.findViewById(R.id.tv_title)
fun bindData(title: String) {
textView!!.text = title
}
}
}
\ No newline at end of file
package com.yidianling.uikit.business.session.view
import android.annotation.SuppressLint
import android.content.Context
import android.graphics.Color
import android.support.v7.widget.GridLayoutManager
import android.text.Spannable
import android.text.SpannableString
import android.text.TextUtils
import android.text.style.AbsoluteSizeSpan
import android.text.style.ForegroundColorSpan
import android.util.TypedValue
import android.view.Gravity
import android.view.View
import android.view.ViewGroup
import android.view.inputmethod.InputMethodManager
import android.widget.EditText
import android.widget.LinearLayout
import android.widget.ScrollView
import android.widget.TextView
import com.ydl.ydlcommon.view.dialog.CommonDialog
import com.yidianling.common.tools.RxImageTool
import com.yidianling.common.tools.ToastUtil
import com.yidianling.im.R
import com.yidianling.uikit.custom.http.response.UserQuestInfoBean
import kotlinx.android.synthetic.main.im_view_collect_user_infomation.view.*
import java.util.*
import kotlin.collections.ArrayList
/**
* @author jiucheng
* @描述:用户信息采集view
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2019/12/10
*/
@SuppressLint("ViewConstructor")
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 currentIndex = 0
private var year =1994
//todo CommonDialog的样式要改
private var dialog: CommonDialog? = null
private var ageStr = ""
private var genderStr = ""
private var questionStr = ""
private var questionStyleStr = ""
init {
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
tv_skip.setOnClickListener {
showSkipDialog()
}
}
fun setData(list: List<UserQuestInfoBean>) {
resultInfoList.clear()
resultInfoList.addAll(list)
addContentView(resultInfoList[0].question!!, true)
proceedNext(list)
}
private fun proceedNext(list: List<UserQuestInfoBean>) {
tv_start.setOnClickListener {
addContentView(resultInfoList[1].question!!, true)
tv_start.visibility = View.GONE
ll_gender.visibility = View.VISIBLE
}
tv_gender_male.setOnClickListener {
addContentView(tv_gender_male.text.toString(), false)
tv_gender_male.postDelayed({
genderStr = "性别:男"
addContentView(resultInfoList[currentIndex].question!!, true)
ll_gender.visibility = View.GONE
rl_age.visibility = View.VISIBLE
}, 300)
}
tv_gender_fomale.setOnClickListener {
addContentView(tv_gender_fomale.text.toString(), false)
tv_gender_fomale.postDelayed({
genderStr = "性别:女"
addContentView(resultInfoList[currentIndex].question!!, true)
ll_gender.visibility = View.GONE
rl_age.visibility = View.VISIBLE
}, 300)
}
((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, _, _ ->
this.year = year
}
date_pick.maxDate = Calendar.getInstance().timeInMillis
tv_age_ensure.setOnClickListener {
ageStr = "年龄:${(Calendar.getInstance().get(Calendar.YEAR) - year)}岁"
addContentView("${year}年", false)
tv_age_ensure.postDelayed({
addContentView(resultInfoList[currentIndex].question!!, true)
rl_age.visibility = View.GONE
rl_question_style.visibility = View.VISIBLE
}, 300)
}
val adapter = CollectInfoStyleAdapter(list[3].answerList!!) {
addContentView(it, false)
rl_question_style.postDelayed({
questionStyleStr = "咨询类型:${it}"
addContentView(resultInfoList[currentIndex].question!!, true, resultInfoList[currentIndex].answerList!![0])
rl_question_style.visibility = View.GONE
ll_input.visibility = View.VISIBLE
rl_question_style.postDelayed({ showInputMethod(et_input) }, 100)
scrollView.postDelayed({
scrollView.fullScroll(ScrollView.FOCUS_DOWN)
}, 300)
}, 300)
}
val layoutManager = GridLayoutManager(mContext, 3)
rl_question_style.layoutManager = layoutManager
rl_question_style.adapter = adapter
tv_send.setOnClickListener {
val content = et_input.text.trim().toString()
if (TextUtils.isEmpty(content)) {
ToastUtil.toastShort("请输入内容")
} else {
questionStr = "问题描述:${content}"
addContentView(content, false)
tv_send.postDelayed({
addContentView(resultInfoList[currentIndex].question!!, true)
ll_input.visibility = View.GONE
tv_finish.visibility = View.VISIBLE
hideInputMethod(et_input)
}, 300)
}
}
tv_finish.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 resultList = ArrayList<UserQuestInfoBean>()
resultList.add(genderBean)
resultList.add(ageBean)
resultList.add(questionStyleBean)
resultList.add(questionBean)
sendMsgEvent(resultContent, resultList)
}
}
@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)
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))
if (send) {
textView.setBackgroundResource(R.drawable.im_background_collect_info_left)
params.gravity = Gravity.LEFT
} else {
textView.setBackgroundResource(R.drawable.im_background_collect_info_right)
params.gravity = Gravity.RIGHT
}
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)
textView.text = sbString
textView.setLineSpacing(4f, 1f)
} else {
textView.text = title
}
textView.maxWidth = RxImageTool.dp2px(255f)
textView.layoutParams = params
ll_content.addView(textView)
if (send) {
currentIndex++
}
}
// 隐藏键盘布局
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)
}
fun showSkipDialog() {
if (dialog == null) {
dialog = CommonDialog.create(mContext)
.setLeftOnclick("下次吧") {
skipEvent()
}
.setRightClick("继续填写") {
dialog!!.dismiss()
}
.setMessage("这个过程可以帮助您更快地改变当前的现状,确定要跳过吗?")
.setTitle_color(R.color.im_color_242424)
.setCancelAble(true)
}
if (!dialog!!.isShowing) {
dialog!!.show()
}
}
}
\ No newline at end of file
package com.yidianling.uikit.business.session.view
import android.content.Context
import android.support.v7.widget.RecyclerView
import android.view.ViewGroup
import com.yidianling.uikit.custom.http.response.CommonQuestionBean
/**
* @author jiucheng
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2019/12/9
*/
class CommonQuestionAdapter(var mContext: Context, var list: List<CommonQuestionBean>, var event: (title: String, id: String) -> Unit) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): RecyclerView.ViewHolder {
return CommonQuestionViewHolder(CommonQuestionItemView(mContext))
}
override fun getItemCount(): Int {
return list.size
}
override fun onBindViewHolder(holder: RecyclerView.ViewHolder?, position: Int) {
((holder as CommonQuestionViewHolder).itemView as CommonQuestionItemView).setData(list[position].title, list[position].keyword, position == list.size - 1)
holder.itemView.setOnClickListener {
event(list[position].title, list[position].id)
}
}
inner class CommonQuestionViewHolder(view: CommonQuestionItemView) : RecyclerView.ViewHolder(view)
}
\ No newline at end of file
package com.yidianling.uikit.business.session.view
import android.content.Context
import android.graphics.Color
import android.text.Spannable
import android.text.SpannableString
import android.text.TextUtils
import android.text.style.ForegroundColorSpan
import android.view.View
import android.view.ViewGroup
import android.widget.LinearLayout
import com.yidianling.im.R
import kotlinx.android.synthetic.main.im_item_view_common_question.view.*
/**
* @author jiucheng
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2019/12/9
*/
class CommonQuestionItemView(var mContext: Context) : LinearLayout(mContext) {
init {
var parmas = LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.WRAP_CONTENT)
layoutParams = parmas
View.inflate(mContext, R.layout.im_item_view_common_question, this)
orientation = VERTICAL
}
fun setData(title: String, keyWords: String?, isLast: Boolean) {
if (TextUtils.isEmpty(keyWords)) {
tv_title.text = title
} else {
if (title.contains(keyWords!!)) {
val temp = title.split(keyWords)
val spanString = SpannableString(temp[0] + keyWords + temp[1])
spanString.setSpan(ForegroundColorSpan(Color.parseColor("#1da1f2")), temp[0].length, (temp[0] + keyWords).length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
tv_title.text = spanString
} else {
tv_title.text = title
}
}
if (isLast) {
view_line.visibility = View.GONE
} else {
view_line.visibility = View.VISIBLE
}
}
}
package com.yidianling.uikit.business.session.view
import android.content.Context
import android.support.v7.widget.RecyclerView
import android.view.View
import android.view.ViewGroup
import android.widget.LinearLayout
import com.ydl.ydlcommon.view.WrapContentLinearLayoutManager
import com.yidianling.common.tools.RxImageTool
import com.yidianling.im.R
import com.yidianling.uikit.custom.http.response.CommonQuestionBean
import kotlinx.android.synthetic.main.im_view_common_question.view.*
/**
* @author jiucheng
* @描述:私聊常见问题view
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2019/12/9
*/
class CommonQuestionView(var mContext: Context) : LinearLayout(mContext) {
var listener: OnSelectItemListener? = null
init {
var parmas = LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
layoutParams = parmas
View.inflate(mContext, R.layout.im_view_common_question, this)
orientation = VERTICAL
}
fun setData(list: List<CommonQuestionBean>) {
if (list.isEmpty()) {
visibility = View.GONE
return
}
if (list.size > 4) {
var parmas = LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, RxImageTool.dp2px(214f))
content_view.layoutParams = parmas
}
val adapter = CommonQuestionAdapter(mContext, list) { title, id ->
listener!!.onSelect(title, id)
listener!!.close()
}
var layoutManager = WrapContentLinearLayoutManager(mContext)
content_view.layoutManager = layoutManager as RecyclerView.LayoutManager?
content_view.adapter = adapter
rl_close.setOnClickListener {
listener!!.close()
}
}
fun show() {
visibility = View.VISIBLE
}
fun hide() {
visibility = View.GONE
}
interface OnSelectItemListener {
fun onSelect(title: String, id: String)
fun close()
}
}
\ No newline at end of file
......@@ -4,11 +4,12 @@ import com.ydl.ydlcommon.base.config.YDL_DOMAIN
import com.ydl.ydlcommon.base.config.YDL_DOMAIN_JAVA
import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.yidianling.uikit.custom.http.response.ChatStatusBean
import com.yidianling.uikit.custom.http.response.CommonQuestionBean
import com.yidianling.uikit.custom.http.response.RecommendExpertBean
import com.yidianling.uikit.custom.http.response.UserQuestInfoBean
import io.reactivex.Observable
import retrofit2.http.GET
import retrofit2.http.Headers
import retrofit2.http.Query
import okhttp3.RequestBody
import retrofit2.http.*
/**
* Created by xj on 2019/6/26.
......@@ -29,4 +30,25 @@ interface ServiceApi{
@GET("doctor/recommendSimilarListeners")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun getRecommendExpertList(@Query("doctorUid") doctorUid: Long, @Query("catName") catName: String, @Query("limit") limit: Int): Observable<BaseAPIResponse<ArrayList<RecommendExpertBean>>>
//获取常用语
@POST("phrase/list")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun getCommonQuestionList(): Observable<BaseAPIResponse<List<CommonQuestionBean>>>
//常用语的点击
@GET("phrase/count")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun sendCommonQuestionCount(@Query("id") id: String): Observable<BaseAPIResponse<Any>>
//信息采集的问题
@GET("user/collect/list")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun userCollectList(): Observable<BaseAPIResponse<List<UserQuestInfoBean>>>
//信息采集的问题
@POST("user/collect/submit")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun submitUserCollect(@Body body: RequestBody): Observable<BaseAPIResponse<Any>>
}
\ No newline at end of file
......@@ -3,8 +3,12 @@ package com.yidianling.uikit.custom.http
import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.ydl.ydlnet.YDLHttpUtils
import com.yidianling.uikit.custom.http.response.ChatStatusBean
import com.yidianling.uikit.custom.http.response.CommonQuestionBean
import com.yidianling.uikit.custom.http.response.RecommendExpertBean
import com.yidianling.uikit.custom.http.response.UserQuestInfoBean
import io.reactivex.Observable
import okhttp3.MediaType
import okhttp3.RequestBody
/**
* Created by xj on 2019/6/26.
......@@ -35,4 +39,33 @@ class ServiceImpl private constructor(){
fun getRecommendExpertList(doctorUid: Long, catName: String, limit: Int): Observable<BaseAPIResponse<ArrayList<RecommendExpertBean>>> {
return YDLHttpUtils.obtainApi(ServiceApi::class.java).getRecommendExpertList(doctorUid, catName, limit)
}
/**
* 获取常用语
*/
fun getCommonQuestionList(): Observable<BaseAPIResponse<List<CommonQuestionBean>>> {
return YDLHttpUtils.obtainApi(ServiceApi::class.java).getCommonQuestionList()
}
/**
* 常用语的点击
*/
fun sendCommonQuestionCount(id: String): Observable<BaseAPIResponse<Any>> {
return YDLHttpUtils.obtainApi(ServiceApi::class.java).sendCommonQuestionCount(id)
}
/**
* 信息采集的问题
*/
fun userCollectList(): Observable<BaseAPIResponse<List<UserQuestInfoBean>>> {
return YDLHttpUtils.obtainApi(ServiceApi::class.java).userCollectList()
}
/**
* 上传采集的问题
*/
fun submitUserCollect(params: String): Observable<BaseAPIResponse<Any>> {
val body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), params) as RequestBody
return YDLHttpUtils.obtainApi(ServiceApi::class.java).submitUserCollect(body)
}
}
\ No newline at end of file
package com.yidianling.uikit.custom.http.response
/**
* @author jiucheng
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2019/12/9
*/
class CommonQuestionBean(var title: String,var id: String, var keyword: String)
\ No newline at end of file
package com.yidianling.uikit.custom.http.response;
import java.util.List;
/**
* @author jiucheng
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2019/12/13
*/
public class SubmitUserInfoBean {
public List<UserQuestInfoBean> userInfoList;
}
package com.yidianling.uikit.custom.http.response
/**
* @author jiucheng
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2019/12/12
*/
class UserQuestInfoBean(var userInfoType: String, var question: String?, var answerList: List<String>?, var content: String?)
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:exitFadeDuration="@android:integer/config_shortAnimTime">
<corners android:radius="17dp" />
<solid android:color="#1A1DA1F2"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:exitFadeDuration="@android:integer/config_shortAnimTime">
<corners android:radius="6dp" />
<solid android:color="@color/platform_color_1DA1F2"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:exitFadeDuration="@android:integer/config_shortAnimTime">
<corners android:topRightRadius="6dp" />
<solid android:color="#EBffffff" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:exitFadeDuration="@android:integer/config_shortAnimTime">
<corners android:radius="20dp" />
<solid android:color="#1F1DA1F2" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:exitFadeDuration="@android:integer/config_shortAnimTime">
<corners
android:radius="20dp" />
<gradient
android:endColor="@color/platform_color_1DA1F2"
android:startColor="#23B2FA" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:exitFadeDuration="@android:integer/config_shortAnimTime">
<corners
android:bottomLeftRadius="6dp"
android:bottomRightRadius="6dp"
android:topRightRadius="6dp" />
<solid android:color="#ffffff" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:exitFadeDuration="@android:integer/config_shortAnimTime">
<corners
android:bottomLeftRadius="6dp"
android:bottomRightRadius="6dp"
android:topLeftRadius="6dp" />
<solid android:color="#CCEBFF" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/tv_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:background="@drawable/im_background_chat_collect_info_question_style"
android:gravity="center"
android:paddingTop="7dp"
android:layout_marginTop="14dp"
android:paddingBottom="7dp"
android:textColor="@color/platform_color_1DA1F2"
android:textSize="15sp"
tools:text="恋爱情感" />
<?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:orientation="vertical"
tools:parentTag="android.widget.LinearLayout">
<TextView
android:id="@+id/tv_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="11dp"
android:layout_marginEnd="17dp"
android:ellipsize="end"
android:gravity="center_vertical"
android:maxLines="2"
android:minHeight="44dp"
android:paddingTop="11dp"
android:paddingBottom="11dp"
android:textColor="#242424"
android:textSize="16sp"
tools:text="咨询顾问的服咨询顾问的服咨询顾问的服务收费吗务收费吗咨询顾问的服务收费吗务收费吗?" />
<View
android:id="@+id/view_line"
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_marginStart="11dp"
android:layout_marginEnd="17dp"
android:background="#EBEBEB" />
</merge>
\ No newline at end of file
<?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"
android:orientation="vertical"
tools:parentTag="android.widget.LinearLayout">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="44dp"
android:background="@color/white">
<ImageView
android:id="@+id/iv_close"
android:layout_width="26dp"
android:layout_height="30dp"
android:layout_marginRight="6dp"
android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/tv_title"
android:src="@drawable/im_ico_default_avatar" />
<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:gravity="center_vertical"
android:text="咨询前评估"
android:textColor="@color/im_color_242424"
android:textSize="17sp" />
<TextView
android:id="@+id/tv_skip"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:gravity="center_vertical"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:text="跳过"
android:textColor="@color/im_color_grey_999999"
android:textSize="14sp" />
</RelativeLayout>
<ScrollView
android:id="@+id/scrollView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="@color/platform_color_F0F0F0">
<LinearLayout
android:id="@+id/ll_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingLeft="18dp"
android:paddingRight="18dp"
android:paddingBottom="28dp">
</LinearLayout>
</ScrollView>
<RelativeLayout
android:id="@+id/rl_choose_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:minHeight="56dp">
<!-- 开始-->
<TextView
android:id="@+id/tv_start"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginLeft="30dp"
android:layout_marginTop="14dp"
android:layout_marginRight="30dp"
android:layout_marginBottom="14dp"
android:background="@drawable/im_background_collect_info_bottom_start"
android:gravity="center"
android:text="好的"
android:textColor="@color/white"
android:textSize="16sp"
android:visibility="visible"
tools:visibility="gone" />
<!-- 性别-->
<LinearLayout
android:id="@+id/ll_gender"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginTop="14dp"
android:layout_marginRight="30dp"
android:layout_marginBottom="14dp"
android:orientation="horizontal"
android:visibility="gone">
<TextView
android:id="@+id/tv_gender_male"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_weight="1"
android:background="@drawable/im_background_collect_info_bottom_gender"
android:gravity="center"
android:text="男"
android:textColor="@color/platform_color_1DA1F2"
android:textSize="16sp" />
<TextView
android:id="@+id/tv_gender_fomale"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginLeft="15dp"
android:layout_weight="1"
android:background="@drawable/im_background_collect_info_bottom_gender"
android:gravity="center"
android:text="女"
android:textColor="@color/platform_color_1DA1F2"
android:textSize="16sp" />
</LinearLayout>
<!-- 年龄-->
<RelativeLayout
android:id="@+id/rl_age"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone">
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="44dp"
android:layout_centerHorizontal="true"
android:gravity="center"
android:text="请选择出生年份"
android:textColor="@color/im_color_242424"
android:textSize="17sp" />
<TextView
android:id="@+id/tv_age_ensure"
android:layout_width="wrap_content"
android:layout_height="44dp"
android:layout_alignParentRight="true"
android:gravity="center"
android:paddingRight="20dp"
android:text="确定"
android:textColor="@color/platform_color_1DA1F2"
android:textSize="17sp" />
<DatePicker
android:id="@+id/date_pick"
android:layout_width="match_parent"
android:layout_height="205dp"
android:layout_below="@+id/title"
android:calendarViewShown="false"
android:datePickerMode="spinner" />
</RelativeLayout>
<!-- 问题类型?-->
<android.support.v7.widget.RecyclerView
android:id="@+id/rl_question_style"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:paddingTop="6dp"
android:paddingRight="20dp"
android:paddingBottom="20dp"
android:visibility="gone"
tools:layout_height="160dp" />
<!-- 问题输入-->
<LinearLayout
android:id="@+id/ll_input"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/platform_color_F7F7F7"
android:orientation="horizontal"
android:paddingRight="20dp"
android:visibility="gone"
tools:visibility="visible">
<EditText
android:id="@+id/et_input"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:layout_weight="1"
android:background="@drawable/im_nim_chat_input_edit_background"
android:hint="放心咨询,信息保密"
android:minHeight="37dp"
android:paddingStart="10dp"
android:paddingTop="5dp"
android:paddingRight="10dp"
android:paddingBottom="5dp"
android:textColor="@color/im_color_242424"
android:textColorHint="@color/platform_color_BFBFBF"
android:textSize="14sp"
tools:text="放心咨询,信放心咨询,信息保密放心咨询,信息保密放心咨询,信息保密放心咨询,信息保密放心咨询,信息保密息保密" />
<TextView
android:id="@+id/tv_send"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="12dp"
android:background="@drawable/im_background_chat_collect_info_send"
android:gravity="center"
android:padding="5dp"
android:text="@string/send"
android:textColor="@color/white"
android:textSize="14sp" />
</LinearLayout>
<!-- 开始-->
<TextView
android:id="@+id/tv_finish"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginLeft="30dp"
android:layout_marginTop="14dp"
android:layout_marginRight="30dp"
android:layout_marginBottom="14dp"
android:background="@drawable/im_background_collect_info_bottom_start"
android:gravity="center"
android:text="去沟通"
android:textColor="@color/white"
android:textSize="16sp"
android:visibility="gone" />
</RelativeLayout>
</merge>
\ No newline at end of file
<?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:orientation="vertical"
tools:parentTag="android.widget.LinearLayout">
<android.support.v7.widget.RecyclerView
android:id="@+id/content_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:layout_height="200dp" />
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:background="#EBEBEB" />
<RelativeLayout
android:id="@+id/rl_close"
android:layout_width="match_parent"
android:layout_height="42dp">
<TextView
android:id="@+id/tv_common"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginStart="11dp"
android:layout_marginRight="13dp"
android:gravity="center_vertical"
android:text="常见问题"
android:textColor="#242424"
android:textStyle="bold" />
</RelativeLayout>
</merge>
\ No newline at end of file
......@@ -10,21 +10,22 @@ import com.ydl.ydlcommon.modular.ModularServiceManager
* Created by Dog on 2015/5/8.
*/
open class BaseCommand {
@JvmField
var uid = "0"
@JvmField
var accessToken = ""
@JvmField
var ts: String
@JvmField
var version: String
@JvmField
var osBuild =
RxDeviceTool.getBuildMANUFACTURER() + "," + RxDeviceTool.getBuildBrandModel() + "," + RxDeviceTool.getOsBuileVersion() + "," + RxDeviceTool.getAppVersionName(
BaseApp.getApp()
)
@JvmField
var isFromApp = "1"//2表示专家版1表示用户版
@JvmField
var ffrom = PlatformDataManager.getRam().getChannelName()//渠Y道来源
init {
......
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