Commit 1fa5ffdd by 刘鹏

Merge branch 'd/v4.3.98' into 'release'

D/v4.3.98

See merge request app_android_lib/YDL-Component!177
parents dd806cb2 852a4569
/build
\ No newline at end of file
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply from: "../../maven_push_api.gradle"
version = '1.0.0'
android {
compileSdkVersion rootProject.ext.android["compileSdkVersion"]
buildToolsVersion rootProject.ext.android["buildToolsVersion"]
defaultConfig {
minSdkVersion rootProject.ext.android["minSdkVersion"]
targetSdkVersion rootProject.ext.android["targetSdkVersion"]
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
implementation "com.alibaba:arouter-api:$arouter_api"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
\ No newline at end of file
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.ydl.confide.api">
</manifest>
\ No newline at end of file
......@@ -5,11 +5,11 @@ ext {
ydlPublishVersion = [
// -------------- 业务模块 --------------
//第三步 若干
"m-confide" : "0.0.50.32",
"m-confide" : "0.0.50.37",
"m-consultant" : "0.0.60.68",
"m-fm" : "0.0.30.09",
"m-user" : "0.0.62.54",
"m-home" : "0.0.23.90",
"m-home" : "0.0.23.93",
"m-im" : "0.0.21.58",
"m-dynamic" : "0.0.7.74",
"m-article" : "0.0.0.10",
......@@ -41,7 +41,6 @@ ext {
//-------------- 业务模块 API 层 --------------
"m-audioim-api" : "0.0.6",
"m-confide-api" : "0.0.2.16",
"m-consultant-api": "0.0.5.63",
"m-course-api" : "0.0.3.6",
"m-fm-api" : "0.0.3",
......@@ -92,11 +91,11 @@ ext {
ydlCompileVersion = [
// -------------- 业务模块 --------------
//第三步 若干
"m-confide" : "0.0.50.32",
"m-confide" : "0.0.50.37",
"m-consultant" : "0.0.60.68",
"m-fm" : "0.0.30.09",
"m-user" : "0.0.62.54",
"m-home" : "0.0.23.90",
"m-home" : "0.0.23.93",
"m-im" : "0.0.21.58",
"m-dynamic" : "0.0.7.74",
"m-article" : "0.0.0.10",
......@@ -127,7 +126,7 @@ ext {
//-------------- 业务模块 API 层 --------------
"m-audioim-api" : "0.0.6",
"m-confide-api" : "0.0.2.16",
"m-confide-api" : "1.0.0",
"m-consultant-api": "0.0.5.63",
"m-course-api" : "0.0.3.6",
"m-fm-api" : "0.0.3",
......
......@@ -2,13 +2,7 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'resTools' // 资源重命名插件
// 配置资源重命名插件
resConfig {
new_prefix = 'confide_' // 资源前缀
old_prefix = '' // 老前缀,可为''空字符串
}
apply from : '../maven_push.gradle'
kapt {
arguments {
......@@ -17,16 +11,11 @@ kapt {
}
android {
// compileSdkVersion rootProject.ext.android["compileSdkVersion"]
// buildToolsVersion rootProject.ext.android["buildToolsVersion"]
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
// minSdkVersion rootProject.ext.android["minSdkVersion"]
// targetSdkVersion rootProject.ext.android["targetSdkVersion"]
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
......@@ -54,12 +43,6 @@ android {
enabled true
}
publishNonDefault true
productFlavors {
ydl {}
xlzx {}
}
//设置JDK1.8
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
......@@ -96,7 +79,7 @@ dependencies {
api project(':ydl-utils')
implementation modularPublication('com.ydl:m-im-api')
implementation modularPublication('com.ydl:m-user-api')
implementation modularPublication('com.ydl:m-confide-api')
implementation project(':api:confide')
}else {
//发布时使用
api rootProject.ext.dependencies["ydl-media"]
......
modular {
packageName "com.ydl.confide"
// 模块发布需要的参数
publish {
modules {
xlzx {
//发布信息 module/api 通用
groupId = "com.ydl"
artifactId = "m-confide-module-xlzx"
// 上报的业务模块 aar 包的版本号
version = rootProject.ext.ydlPublishVersion[childProject.getName()]
}
ydl{
//发布信息 module/api 通用
groupId = "com.ydl"
artifactId = "m-confide-module-ydl"
// 上报的业务模块 aar 包的版本号
version = rootProject.ext.ydlPublishVersion[childProject.getName()]
}
}
api {
//发布信息 module/api 通用
groupId = "com.ydl"
artifactId = "m-confide-api"
version = rootProject.ext.ydlPublishVersion["${childProject.getName()}-api"]
// API 层打包时需要引入的依赖
apiDependencies {
implementation 'androidx.fragment:fragment-ktx:1.2.4'
implementation "com.google.code.gson:gson:2.8.2"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.alibaba:arouter-api:1.4.1'
}
}
}
}
\ No newline at end of file
......@@ -9,5 +9,7 @@
<activity
android:name=".intro.ExpertIntroActivity"
android:screenOrientation="portrait" />
<activity android:name=".home.ConfideSearchActivity"
android:screenOrientation="portrait"/>
</application>
</manifest>
......@@ -8,6 +8,7 @@ import android.graphics.drawable.ColorDrawable
import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.text.TextUtils
import android.view.Gravity
import android.view.LayoutInflater
import android.view.View
......@@ -40,6 +41,7 @@ import com.ydl.ydlcommon.utils.TimeUtil
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.view.dialog.CommonDialog
import com.ydl.ydlnet.YDLHttpUtils
import com.yidianling.common.tools.LogUtil
import com.yidianling.common.tools.RxImageTool
import com.yidianling.common.tools.ToastUtil
import com.yidianling.im.api.service.IImService
......@@ -49,6 +51,8 @@ import com.yidianling.user.api.service.IUserService
import de.greenrobot.event.EventBus
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import java.io.UnsupportedEncodingException
import java.net.URLDecoder
import java.util.*
import kotlin.math.roundToInt
......@@ -57,7 +61,9 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
private const val KEY_JUMP_URL = "jumpUrl"
private const val KEY_DOCTOR_ID = "doctor_id"
private const val KEY_SHOULD_SHOW = "should_show"
private const val KEY_LISTEN_FREE = "listen_free"
private const val KEY_UID = "uid"
private const val EXPERT_URL = "expert_url"
}
private var firstVisitWXH5PayUrl = true
......@@ -73,31 +79,39 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
lateinit var ivCall: ImageView
lateinit var tvTime: TextView
lateinit var first_order: SimpleDraweeView
lateinit var free: SimpleDraweeView
lateinit var confideProgress: View
lateinit var layout_change_text: View
lateinit var layoutBottom: View
lateinit var itemView: View
var bottomSheet :FrameLayout?=null
var mJtoJHandle:IJavascriptHandler?=null
var lineStatus: Int = 0
var bottomSheet: FrameLayout? = null
var mJtoJHandle: IJavascriptHandler? = null
private var behavior: BottomSheetBehavior<*>? = null
var isLogin: Boolean = false
lateinit var jumpUrl: String
lateinit var doctorId: String
lateinit var expertUrl: String
var shouldShow: Boolean? = false
var uid: String? = null
var listen_free: Boolean = false
fun showBottomSheetDialog(
activity: FragmentActivity,
jumpUrl: String,
doctorId: String,
shouldShow: Boolean = false,
uid: String? = null
uid: String? = null,
listenFree: Boolean = false,
expertUrl: String = ""
) {
arguments = Bundle().apply {
putString(KEY_JUMP_URL, jumpUrl)
putString(KEY_DOCTOR_ID, doctorId)
putBoolean(KEY_SHOULD_SHOW, shouldShow)
putBoolean(KEY_LISTEN_FREE, listenFree)
uid?.let { putString(KEY_UID, it) }
putString(EXPERT_URL, expertUrl)
}
show(activity.supportFragmentManager, "confide_bottom_showdialog")
}
......@@ -120,11 +134,16 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
ActionCountUtils.record("ydl_experts_detail_popupwindows_page", "ydl_experts_detail_popupwindows_page_visit")
ActionCountUtils.record(
"ydl_experts_detail_popupwindows_page",
"ydl_experts_detail_popupwindows_page_visit"
)
jumpUrl = arguments?.getString(KEY_JUMP_URL) ?: ""
doctorId = arguments?.getString(KEY_DOCTOR_ID) ?: ""
expertUrl = arguments?.getString(EXPERT_URL) ?: ""
shouldShow = arguments?.getBoolean(KEY_SHOULD_SHOW) ?: false
uid = arguments?.getString(KEY_UID)
listen_free = arguments?.getBoolean(KEY_LISTEN_FREE) ?: false
onLoadDialStatus(doctorId)
// +
wv_content = view.findViewById<ProgressWebView>(com.ydl.webview.R.id.wv_content)
......@@ -175,20 +194,19 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
ivCall = itemView.findViewById<ImageView>(R.id.ivCall)
tvTime = itemView.findViewById<TextView>(R.id.tvTime)
first_order = itemView.findViewById<SimpleDraweeView>(R.id.first_order)
free = itemView.findViewById<SimpleDraweeView>(R.id.free)
val userService = findRouteService(IUserService::class.java)
val isLogin = userService.isLogin()
first_order.visibility = if (isLogin) View.GONE else View.VISIBLE
isLogin = userService.isLogin()
first_order.visibility = if (isLogin) View.GONE else View.VISIBLE
val controller: DraweeController = Fresco.newDraweeControllerBuilder()
.setUri(Uri.parse("res://drawable/"+R.drawable.first_order))
.setUri(Uri.parse("res://drawable/" + R.drawable.confide_first_order))
.setOldController(first_order.controller)
.setAutoPlayAnimations(true) // 是否自动播放Gif动画
.build()
first_order.controller = controller
layoutCall.setOnClickListener {
ActionCountUtils.record(
"ydl_experts_detail_popupwindows_page",
......@@ -211,7 +229,48 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
.show()
return@setOnClickListener
}
callJsFun(wv_content, "listenCallClick()")
when (lineStatus) {
1, 4 -> {
callJsFun(wv_content, "listenCallClick()")
}
3, 6 -> {
if (!uid.isNullOrBlank()) {
activity?.let { it1 ->
ARouter.getInstance().navigation(IImService::class.java)
?.startChatBySessionId(it1, uid!!)
}
}
}
5 -> {
if (!TextUtils.isEmpty(expertUrl)) {
val linkUri = Uri.parse(expertUrl)
if (linkUri != null) {
val host = linkUri.host
if (!TextUtils.isEmpty(host) && host == "h5") {
//如果是h5,跳转至NewH5Activity
try {
var params = URLDecoder.decode(
linkUri.getQueryParameter("params"),
"UTF-8"
)
ARouter.getInstance().build("/new_h5/h5")
.withSerializable("routerParam", params).navigation()
} catch (e: NullPointerException) {
LogUtil.e("params参数为空")
} catch (e: UnsupportedEncodingException) {
LogUtil.e("解码错误")
} catch (e: UnsupportedOperationException) {
LogUtil.e("这不是一个uri格式的地址")
}
}
}
}
}
}
}
layoutChange.setOnClickListener {
layout_change_text.visibility = View.GONE
......@@ -220,6 +279,7 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
}
}
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
val dialog = super.onCreateDialog(savedInstanceState) as BottomSheetDialog
onShowReady()
......@@ -234,17 +294,17 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
FrameLayout.LayoutParams.WRAP_CONTENT
).apply { gravity = Gravity.BOTTOM or Gravity.CENTER_HORIZONTAL }
dialog?.window?.addContentView(itemView, layoutParams)
bottomSheet =
bottomSheet =
(it as BottomSheetDialog).findViewById<View>(com.google.android.material.R.id.design_bottom_sheet) as FrameLayout?
behavior = BottomSheetBehavior.from(bottomSheet!!)
behavior?.peekHeight = (resources.displayMetrics.heightPixels * 0.7F).roundToInt()
if (jumpUrl?.contains("payPage=1")){
if (jumpUrl?.contains("payPage=1")) {
//支付高度
setMaxHeight(RxImageTool.dp2px(450f))
behavior?.isHideable = false
rl_title.visibility = View.GONE
}else{
} else {
setMaxHeight(resources.displayMetrics.heightPixels)
}
//true是跳过peekHeight,直接滑下去,false是可以滑动到顶部还可以保持peekHeight在滑下去
......@@ -255,7 +315,7 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
BottomSheetBehavior.STATE_EXPANDED -> {
bottomSheet.background = ColorDrawable(Color.WHITE)
if (!jumpUrl?.contains("payPage=1")){
if (!jumpUrl?.contains("payPage=1")) {
rl_title.visibility = View.VISIBLE
text_title.visibility = View.VISIBLE
close_webview_Icon.visibility = View.VISIBLE
......@@ -285,10 +345,12 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
}
return dialog
}
private fun setMaxHeight(height : Int){
private fun setMaxHeight(height: Int) {
bottomSheet?.layoutParams?.height = height
bottomSheet?.requestLayout()
}
private fun callJsFun(wv_content: ProgressWebView, funcName: String) {
val sb = StringBuffer("javascript:")
sb.append(funcName)
......@@ -330,6 +392,11 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
layout_change_text.visibility = View.VISIBLE
this.doctorId = doctorId
onLoadDialStatus(doctorId)
if (activity is ConfideHomeActivity) {
val confideHomeActivity = activity as ConfideHomeActivity
expertUrl = confideHomeActivity?.searchLinkUrlByUid(uid) ?: ""
}
callJsFun(wv_content, "setUnRead(${getUnReadByUid(uid = uid)})")
}
......@@ -518,7 +585,19 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
.subscribe({ resp ->
if (resp.code == "200") {
layoutCall.visibility = View.VISIBLE
val lineStatus = resp.data?.confideLine ?: 2
lineStatus = resp.data?.confideLine ?: 2
if (isLogin && listen_free) {
free.visibility = View.VISIBLE
val controller: DraweeController = Fresco.newDraweeControllerBuilder()
.setUri(Uri.parse("res://drawable/" + R.drawable.confide_free))
.setOldController(free.controller)
.setAutoPlayAnimations(true) // 是否自动播放Gif动画
.build()
free.controller = controller
} else {
free.visibility = View.GONE
}
/*
* 1在线 2离线 3通话中 4 继续倾诉
* */
......@@ -539,7 +618,12 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
context?.getDrawable(R.drawable.confide_line_bg_2)
if (showTip) {
if (!uid.isNullOrBlank()) {
findRouteService(IImService::class.java).startChat(requireActivity(), uid!!, 0, 0)
findRouteService(IImService::class.java).startChat(
requireActivity(),
uid!!,
0,
0
)
}
}
}
......@@ -553,7 +637,12 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
if (showTip) {
ToastUtil.toastShort("对方正在通话中,请稍后拨打")
if (!uid.isNullOrBlank()) {
findRouteService(IImService::class.java).startChat(requireActivity(), uid!!, 0, 0)
findRouteService(IImService::class.java).startChat(
requireActivity(),
uid!!,
0,
0
)
}
}
}
......@@ -570,6 +659,20 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
}
}
5 -> {
tvCall.text = "已离线,可预约"
tvTime.visibility = View.GONE
ivCall.visibility = View.GONE
layoutCall.background =
context?.getDrawable(R.drawable.confide_offline_book_bg)
}
6 -> {
tvCall.text = "已离线,可留言"
tvTime.visibility = View.GONE
ivCall.visibility = View.GONE
layoutCall.background =
context?.getDrawable(R.drawable.confide_offline_book_bg)
}
}
} else {
if (!resp.msg.isNullOrEmpty()) {
......@@ -584,11 +687,13 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
wv_content.destroy()
EventBus.getDefault().unregister(this)
}
//登录成功
fun onEvent(event: UserLoginEvent) {
webViewInit(wv_content)
}
//绑定成功
fun onEvent(event: UserBindPhoneEvent) {
webViewInit(wv_content)
......
......@@ -2,16 +2,24 @@ package com.ydl.confide.home
import android.annotation.SuppressLint
import android.content.Context
import android.content.Intent
import android.graphics.Color
import android.net.Uri
import android.os.Build
import android.text.TextUtils
import android.view.View
import android.view.ViewGroup
import android.view.WindowManager
import android.widget.TextView
import android.view.animation.AccelerateInterpolator
import android.view.animation.DecelerateInterpolator
import android.widget.ImageView
import android.widget.RelativeLayout
import androidx.fragment.app.FragmentActivity
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.SimpleItemAnimator
import com.alibaba.android.arouter.facade.annotation.Route
import com.bumptech.glide.Glide
import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.facebook.drawee.backends.pipeline.Fresco
import com.facebook.drawee.interfaces.DraweeController
import com.jcodecraeer.xrecyclerview.ProgressStyle
......@@ -24,11 +32,14 @@ import com.ydl.confide.home.bean.ConfideHomeBodyBean
import com.ydl.confide.home.bean.ConfideHomeDataBean
import com.ydl.confide.home.bean.ConfideHomeFiterItemBean
import com.ydl.confide.home.config.IConfideHomeConfig
import com.ydl.confide.home.constants.FinalString
import com.ydl.confide.home.constants.FinalString.SEARCH_REQUEST_CODE
import com.ydl.confide.home.contract.IConfideHomeContract
import com.ydl.confide.home.event.ConfideHomeEventImpl
import com.ydl.confide.home.event.IConfideHomeEvent
import com.ydl.confide.home.listener.ConfideHomeRecycleViewListener
import com.ydl.confide.home.listener.ConfideHomeRecyleSuspendListener
import com.ydl.confide.home.listener.HideScrollListener
import com.ydl.confide.home.modular.service.ConfideWebServiceImpl
import com.ydl.confide.home.presenter.ConfideHomePresenterImpl
import com.ydl.confide.home.util.ConfideHomeUtils
......@@ -51,6 +62,7 @@ import com.yidianling.common.tools.ToastUtil
import com.yidianling.im.api.service.IImService
import com.yidianling.user.api.service.IUserService
import kotlinx.android.synthetic.main.confide_home_activity.*
import kotlinx.android.synthetic.main.confide_recommend_view_new.view.*
import kotlinx.android.synthetic.main.confide_title_bar.*
/**
......@@ -63,7 +75,7 @@ import kotlinx.android.synthetic.main.confide_title_bar.*
@Route(path = ConfideRoute.R_CONFIDE_HOME)
class ConfideHomeActivity :
BaseLceActivity<IConfideHomeContract.View, IConfideHomeContract.Presenter>(),
IConfideHomeContract.View, XRecyclerView.LoadingListener {
IConfideHomeContract.View, XRecyclerView.LoadingListener,HideScrollListener {
private var listenFree = false
......@@ -120,6 +132,9 @@ class ConfideHomeActivity :
private var dp48 = 0
private var bottomSheetDialogFragment: ConfideBottomSheetDialogFragment? = null
private var keyword: String = "";
init {
//初始化参数
initParam()
......@@ -129,6 +144,7 @@ class ConfideHomeActivity :
private fun initParam() {
allFiltersBean = ConfideHomeAllFiltersBean(
page,
"",
ConfideHomeFiterItemBean().apply {
id = "-1"
name = ""
......@@ -177,6 +193,7 @@ class ConfideHomeActivity :
//需要将当前列表已存在的老师uid数组发送到后端去重,因为排序实时变化
this.page = page
allFiltersBean!!.page = page
allFiltersBean!!.keywords = keyword
if (1 == page) {
//显示加载中
showProgressDialog()
......@@ -218,7 +235,6 @@ class ConfideHomeActivity :
// mPresenter.loadLocalData(this)
rv_list.refresh()
initClick()
initQuickConsultDialog()
initStatusBar()
// ModularServiceManager.provide(IConsultantService::class.java).showConfideListDialog(this)
// ActionCountUtils.count("daoyi_advertisement_page|daoyi_advertisement_visit","17")
......@@ -243,9 +259,9 @@ class ConfideHomeActivity :
}
private fun showDoctorDetail(confideId: String, doctorId: String) {
val url = HttpConfig.MH5_URL + ConfideRoute.h5ConfideIntro(confideId)+"&payPage=1"
ConfideBottomSheetDialogFragment()
.showBottomSheetDialog(this@ConfideHomeActivity, url, doctorId)
val url = HttpConfig.MH5_URL + ConfideRoute.h5ConfideIntro(confideId) + "&payPage=1"
ConfideBottomSheetDialogFragment()
.showBottomSheetDialog(this@ConfideHomeActivity, url, doctorId)
}
override fun onResume() {
......@@ -259,7 +275,7 @@ class ConfideHomeActivity :
findViewById<View>(R.id.confide_Free).visibility = if (isLogin) View.GONE else View.VISIBLE
if (!isLogin) {
val controller: DraweeController = Fresco.newDraweeControllerBuilder()
.setUri(Uri.parse("res://drawable/" + R.drawable.first_order))
.setUri(Uri.parse("res://drawable/" + R.drawable.confide_first_order))
.setOldController(confide_Free.controller)
.setAutoPlayAnimations(true) // 是否自动播放Gif动画
.build()
......@@ -268,6 +284,11 @@ class ConfideHomeActivity :
if (isLogin) {
findViewById<View>(R.id.confideRed).visibility =
if (listenFree) View.VISIBLE else View.GONE
Glide.with(this)
.load(R.drawable.confide__free)
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
.into(findViewById<ImageView>(R.id.confideRed))
(quick_consult_btn.layoutParams as? ViewGroup.MarginLayoutParams)?.rightMargin =
if (listenFree) dp48 / 2 else 0
}
......@@ -287,41 +308,6 @@ class ConfideHomeActivity :
}
/**
* 监听控制一键倾诉浮层的显示与隐藏
*/
private fun initQuickConsultDialog() {
rv_list.addOnScrollListener(object : RecyclerView.OnScrollListener() {
override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
super.onScrollStateChanged(recyclerView, newState)
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
quick_consult_card.visibility = View.VISIBLE
}
// val layoutManager: RecyclerView.LayoutManager = recyclerView?.layoutManager!!
// val linearManager = layoutManager as LinearLayoutManager
// if (linearManager is LinearLayoutManager) {
// val firstItemPosition = linearManager.findFirstCompletelyVisibleItemPosition()
// if (firstItemPosition > 3) {
// quick_consult_card.visibility = View.VISIBLE
// }else {
// quick_consult_card.visibility = View.GONE
// }
// }
}
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
super.onScrolled(recyclerView, dx, dy)
if (dy <= 0) {
//向上滚动恢复显示
quick_consult_card.visibility = View.VISIBLE
} else {
//向下滚动隐藏
quick_consult_card.visibility = View.GONE
}
}
})
}
/**
* 初始化一键倾诉浮层的点击事件
*/
private fun initClick() {
......@@ -335,10 +321,18 @@ class ConfideHomeActivity :
this as FragmentActivity,
HttpConfig.MH5_URL + ConfideRoute.h5ConfideIntro("0"),
"0",
true
true,
listenFree = listenFree
)
}
rl_search_head.setOnClickListener {
var intent = Intent(this, ConfideSearchActivity::class.java)
if (!TextUtils.isEmpty(keyword)) {
intent.putExtra(FinalString.CONFIDE_SEARCH_KEY_WORD, keyword)
}
startActivityForResult(intent, SEARCH_REQUEST_CODE)
}
}
......@@ -371,7 +365,7 @@ class ConfideHomeActivity :
}
//用于滑动筛选模块置顶
if (null == listScrollListener) {
listScrollListener = ConfideHomeRecycleViewListener()
listScrollListener = ConfideHomeRecycleViewListener(this)
}
rv_list.addOnScrollListener(listScrollListener!!)
//用于显示筛选悬浮按钮
......@@ -410,6 +404,10 @@ class ConfideHomeActivity :
initParam()
hideError()
cacheList?.addAll(0, list)
cacheList?.add(
0,
ConfideHomeDataBean(IConfideHomeConfig.TYPE_SEARCH, null, null, null, -1, keyword)
)
updateAdapter()
setSuspendListener()
v_filterView.refreshView()
......@@ -419,7 +417,7 @@ class ConfideHomeActivity :
* 设置筛选模块悬浮顶部监听数据
*/
private fun setSuspendListener() {
listSuspendListener?.setFilterView(v_filterView, vFilterLine)
listSuspendListener?.setFilterView(v_filterView, rl_search_head, vFilterLine)
listSuspendListener?.setSectionAdapter(mConfideAdapter!!)
}
......@@ -428,6 +426,33 @@ class ConfideHomeActivity :
v_filterView.setHomeView(this)
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (requestCode == SEARCH_REQUEST_CODE && resultCode == RESULT_OK) {
val keyWord = data?.getStringExtra(FinalString.CONFIDE_SEARCH_KEY_WORD)
if (keyWord != null) {
this.keyword = keyWord
page = 1
allFiltersBean = ConfideHomeAllFiltersBean(
page,
"",
ConfideHomeFiterItemBean().apply {
id = "-1"
name = ""
},
ConfideHomeFiterItemBean().apply {
id = "-1"
name = ""
},
ArrayList(),
ArrayList()
)
rl_search_head.findViewById<TextView>(R.id.etSearch).setText(keyword)
onRefresh()
}
}
}
/**
* 更新适配器数据
*/
......@@ -494,6 +519,34 @@ class ConfideHomeActivity :
if (null != soundBean) {
(cacheList as ArrayList).add(soundBean)
}
if (bean?.body != null && bean?.body.size == 0) {
var hasEmptyLayout: Boolean = false
for (index in (0..(cacheList!!.size - 1)).reversed()) {
if (cacheList!![index].type == IConfideHomeConfig.TYPE_EMPTY) {
hasEmptyLayout = true
break
}
}
if (!hasEmptyLayout) {
cacheList?.add(
ConfideHomeDataBean(
IConfideHomeConfig.TYPE_EMPTY,
null,
null,
null,
-1
)
)
}
} else {
for (index in (0..(cacheList!!.size - 1)).reversed()) {
if (cacheList!![index].type == IConfideHomeConfig.TYPE_EMPTY) {
cacheList!!.removeAt(index)
}
}
}
listScrollListener?.moveToPosition(rv_list)
}
......@@ -655,4 +708,30 @@ class ConfideHomeActivity :
}
super.onBackPressed()
}
override fun onHide() {
val lp = quick_consult_card.layoutParams as RelativeLayout.LayoutParams
quick_consult_card.animate().translationY(
(quick_consult_card.height + lp.bottomMargin).toFloat()
).setDuration(1000)
.interpolator = AccelerateInterpolator(3f)
}
override fun onShow() {
quick_consult_card.animate().translationY(0F).setDuration(1000)
.interpolator = DecelerateInterpolator(3f)
}
fun searchLinkUrlByUid(uid : String):String{
cacheList?.forEach {confideHomeDataBean ->
confideHomeDataBean.body?.forEach { confideHomeBodyBean ->
if (uid == confideHomeBodyBean.uid.toString()){
return confideHomeBodyBean.linkUrl?:""
}
}
}
return ""
}
}
\ No newline at end of file
package com.ydl.confide.home
import android.content.Context
import android.content.Intent
import android.text.Editable
import android.text.TextUtils
import android.text.TextWatcher
import android.view.View
import android.view.WindowManager
import android.view.inputmethod.EditorInfo
import android.view.inputmethod.InputMethodManager
import android.widget.TextView
import com.ydl.confide.R
import com.ydl.confide.home.constants.FinalString
import com.ydl.ydlcommon.base.BaseActivity
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import kotlinx.android.synthetic.main.confide_search_activity.*
class ConfideSearchActivity : BaseActivity() {
override fun initDataAndEvent() {
val keyWord = intent.getStringExtra(FinalString.CONFIDE_SEARCH_KEY_WORD)
if (!TextUtils.isEmpty(keyWord)){
etSearch?.setText(keyWord)
iv_delete_icon.visibility = View.VISIBLE
}
etSearch.setOnEditorActionListener { _, actionId, _ ->
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
val keyword = etSearch!!.text.trim().toString()
//埋点
ActionCountUtils.record("listen_counselor_list_page","listen_counselor_list_search_click",keyword)
val intent = Intent()
intent.putExtra(FinalString.CONFIDE_SEARCH_KEY_WORD, keyword)
setResult(RESULT_OK,intent)
finish()
}
true
}
findViewById<TextView>(R.id.tv_search_cancle).setOnClickListener {
setResult(RESULT_OK)
finish()
}
if (etSearch.requestFocus()) {
val imm = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
val isShowing = imm.showSoftInput(etSearch, InputMethodManager.SHOW_IMPLICIT)
if (!isShowing) {
window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE)
}
}
etSearch.addTextChangedListener(object : TextWatcher {
override fun afterTextChanged(s: Editable?) {
if (TextUtils.isEmpty(s)) {
iv_delete_icon.visibility = View.INVISIBLE
} else {
iv_delete_icon.visibility = View.VISIBLE
}
}
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {}
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
}
})
iv_delete_icon.setOnClickListener {
etSearch.setText("")
}
}
override fun layoutResId(): Int {
return R.layout.confide_search_activity
}
}
\ No newline at end of file
package com.ydl.confide.home.adapter
import android.app.Activity
import android.content.Context
import androidx.recyclerview.widget.RecyclerView
import android.content.Intent
import android.text.Editable
import android.text.TextUtils
import android.text.TextWatcher
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.inputmethod.EditorInfo
import android.widget.EditText
import android.widget.ImageView
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.ydl.confide.R
import com.ydl.confide.home.ConfideHomeActivity
import com.ydl.confide.home.ConfideSearchActivity
import com.ydl.confide.home.bean.ConfideHomeDataBean
import com.ydl.confide.home.config.IConfideHomeConfig
import com.ydl.confide.home.constants.FinalString
import com.ydl.confide.home.constants.FinalString.SEARCH_REQUEST_CODE
import com.ydl.confide.home.contract.IConfideHomeContract
import com.ydl.confide.home.event.IConfideHomeEvent
import com.ydl.confide.home.widget.*
import com.ydl.ydlcommon.utils.DisplayUtils
import com.ydl.ydlcommon.utils.KeyboardChangeListener
import com.yidianling.common.tools.RxKeyboardTool
import kotlinx.android.synthetic.main.confide_home_activity.view.*
/**
* @author yuanwai
......@@ -20,9 +37,11 @@ import com.ydl.ydlcommon.utils.DisplayUtils
* @Company 壹点灵
* @date 2018/12/14
*/
class ConfideHomeAdapter(private val mContext: Context,
private var confideHomeEvent: IConfideHomeEvent,
private var confideHomeView: IConfideHomeContract.View) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
class ConfideHomeAdapter(
private val mContext: Context,
private var confideHomeEvent: IConfideHomeEvent,
private var confideHomeView: IConfideHomeContract.View
) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
private var mListData: List<ConfideHomeDataBean>? = null
private var mFilterViewHolder: FilterViewHolder? = null
......@@ -101,7 +120,13 @@ class ConfideHomeAdapter(private val mContext: Context,
}
//为你推荐
IConfideHomeConfig.TYPE_RECOMMEND -> {
return RecommendViewHolder(ConfideHomeRecommendView(confideHomeView, parent.context, confideHomeEvent))
return RecommendViewHolder(
ConfideHomeRecommendView(
confideHomeView,
parent.context,
confideHomeEvent
)
)
}
IConfideHomeConfig.TYPE_VIDEO_SHOW -> {
val recyclerView = RecyclerView(parent.context)
......@@ -114,6 +139,20 @@ class ConfideHomeAdapter(private val mContext: Context,
}
return VideoShowHolder(recyclerView)
}
//顶部搜索
IConfideHomeConfig.TYPE_SEARCH -> {
return SearchViewHolder(
LayoutInflater.from(mContext)
.inflate(R.layout.confide_home_search_header, parent, false)
)
}
//空白页
IConfideHomeConfig.TYPE_EMPTY -> {
return EmptyView(LayoutInflater.from(mContext).inflate(R.layout.confide_empty_layout, parent,false))
}
// //听声寻人
// IConfideHomeConfig.TYPE_SOUND -> {
//// return ConfideHomeListenAndFoundViewHolder(ConfideHomeListenAndFoundView(parent.context, confideHomeEvent))
......@@ -125,40 +164,56 @@ class ConfideHomeAdapter(private val mContext: Context,
}
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) =
/*if (holder is BannerViewHolder && null != holder.bannerView) {
//banner
holder.bannerView!!.initData(mListData!![position])
} else if (holder is CategoryViewHolder && null != holder.categoryView) {
//分类
holder.categoryView!!.initData(mListData!![position])
} else */if (holder is FilterViewHolder && null != holder.filterView) {
mFilterViewHolder = holder
//筛选模块
holder.filterView.initData(mListData!![position])
} else if (holder is ConfideHomeListenAndFoundViewHolder) {
//听声寻人
/*if (holder is BannerViewHolder && null != holder.bannerView) {
//banner
holder.bannerView!!.initData(mListData!![position])
} else if (holder is CategoryViewHolder && null != holder.categoryView) {
//分类
holder.categoryView!!.initData(mListData!![position])
} else */if (holder is FilterViewHolder && null != holder.filterView) {
mFilterViewHolder = holder
//筛选模块
holder.filterView.initData(mListData!![position])
} else if (holder is ConfideHomeListenAndFoundViewHolder) {
//听声寻人
// holder.confideHomeListenAndFoundView!!.initData(mListData!![position])
} else if (holder is RecentConfideHolder) {
} else if (holder is RecentConfideHolder) {
//最近倾诉
holder.rv.layoutManager =
LinearLayoutManager(holder.itemView.context, RecyclerView.HORIZONTAL, false)
val recentBody = mListData!![position].body
val data = recentBody?.map { ItemVideoShowViewModel().mapOf(it) } ?: emptyList()
holder.rv.adapter = RecentConfideAdapter(data, confideHomeEvent)
holder.rv.layoutManager =
LinearLayoutManager(holder.itemView.context, RecyclerView.HORIZONTAL, false)
val recentBody = mListData!![position].body
val data = recentBody?.map { ItemVideoShowViewModel().mapOf(it) } ?: emptyList()
holder.rv.adapter = RecentConfideAdapter(data, confideHomeEvent)
// holder.consultView!!.initData(mListData!![position])
} else if (holder is RecommendViewHolder && null != mListData!![position] && null != mListData!![position].body && !mListData!![position].body!!.isEmpty()) {
//为你推荐
holder.confideHomeRecommendView.initData(mListData!![position].body!![0], position, mListData!![position].recommendId)
} else if (holder is VideoShowHolder) {
holder.rv.layoutManager =
LinearLayoutManager(holder.itemView.context, RecyclerView.HORIZONTAL, false)
val recentBody = mListData!![position].body
holder.rv.adapter = VideoShowAdapter(recentBody, confideHomeEvent)
} else if (holder is EmptyViewHolder) {
} else {
} else if (holder is RecommendViewHolder && null != mListData!![position] && null != mListData!![position].body && !mListData!![position].body!!.isEmpty()) {
//为你推荐
holder.confideHomeRecommendView.initData(
mListData!![position].body!![0],
position,
mListData!![position].recommendId
)
} else if (holder is VideoShowHolder) {
holder.rv.layoutManager =
LinearLayoutManager(holder.itemView.context, RecyclerView.HORIZONTAL, false)
val recentBody = mListData!![position].body
holder.rv.adapter = VideoShowAdapter(recentBody, confideHomeEvent)
} else if (holder is SearchViewHolder) {
holder.searchView.etSearch.setText(mListData!![position].keyword)
holder.searchView.setOnClickListener {
var intent = Intent(mContext, ConfideSearchActivity::class.java)
if (!TextUtils.isEmpty(mListData!![position].keyword)){
intent.putExtra(FinalString.CONFIDE_SEARCH_KEY_WORD,mListData!![position].keyword)
}
if (mContext is ConfideHomeActivity){
val confideHomeActivity = mContext as ConfideHomeActivity
confideHomeActivity.startActivityForResult(intent,SEARCH_REQUEST_CODE)
}
}
} else if (holder is EmptyViewHolder) {
} else {
}
override fun getItemCount(): Int {
return mListData!!.size
......@@ -167,7 +222,8 @@ class ConfideHomeAdapter(private val mContext: Context,
/**
* banner viewHolder
*/
inner class BannerViewHolder(itemView: ConfideHomeBannerView) : RecyclerView.ViewHolder(itemView) {
inner class BannerViewHolder(itemView: ConfideHomeBannerView) :
RecyclerView.ViewHolder(itemView) {
var bannerView: ConfideHomeBannerView? = null
init {
......@@ -178,7 +234,8 @@ class ConfideHomeAdapter(private val mContext: Context,
/**
* 分类测评 viewHolder
*/
inner class CategoryViewHolder(itemView: ConfideHomeCategoryView) : RecyclerView.ViewHolder(itemView) {
inner class CategoryViewHolder(itemView: ConfideHomeCategoryView) :
RecyclerView.ViewHolder(itemView) {
var categoryView: ConfideHomeCategoryView? = null
init {
......@@ -189,22 +246,34 @@ class ConfideHomeAdapter(private val mContext: Context,
/**
* 筛选模块 viewHolder
*/
inner class FilterViewHolder(var filterView: ConfideHomeFilterView) : RecyclerView.ViewHolder(filterView)
inner class FilterViewHolder(var filterView: ConfideHomeFilterView) :
RecyclerView.ViewHolder(filterView)
/**
* 搜索模块 viewHolder
*/
inner class SearchViewHolder(var searchView: View) : RecyclerView.ViewHolder(searchView)
inner class EmptyView(var emptyView: View): RecyclerView.ViewHolder(emptyView)
/**
* 听声寻人 viewHolder
*/
inner class ConfideHomeListenAndFoundViewHolder(var confideHomeListenAndFoundView: ConfideHomeListenAndFoundView) : RecyclerView.ViewHolder(confideHomeListenAndFoundView)
inner class ConfideHomeListenAndFoundViewHolder(var confideHomeListenAndFoundView: ConfideHomeListenAndFoundView) :
RecyclerView.ViewHolder(confideHomeListenAndFoundView)
/**
* 最近倾诉 viewHolder
*/
inner class ConsultViewHolder(var consultView: ConfideHomeRecentView) : RecyclerView.ViewHolder(consultView)
inner class ConsultViewHolder(var consultView: ConfideHomeRecentView) :
RecyclerView.ViewHolder(consultView)
/**
* 为你推荐 viewHolder
*/
inner class RecommendViewHolder(var confideHomeRecommendView: ConfideHomeRecommendView) : RecyclerView.ViewHolder(confideHomeRecommendView)
inner class RecommendViewHolder(var confideHomeRecommendView: ConfideHomeRecommendView) :
RecyclerView.ViewHolder(confideHomeRecommendView)
/**
* 空ViewHolder
......@@ -216,6 +285,7 @@ class ConfideHomeAdapter(private val mContext: Context,
view = itemView
}
}
class VideoShowHolder(val rv: RecyclerView) : RecyclerView.ViewHolder(rv)
class RecentConfideHolder(val rv: RecyclerView) : RecyclerView.ViewHolder(rv)
}
\ No newline at end of file
......@@ -9,6 +9,8 @@ package com.ydl.confide.home.bean
*/
data class ConfideHomeAllFiltersBean(
var page : Int,
//通过倾诉师的名字搜索
var keywords : String,
//选择的综合排序Id
var selectSort : ConfideHomeFiterItemBean?,
//选择的性别id
......@@ -19,4 +21,6 @@ data class ConfideHomeAllFiltersBean(
val selectGoodData : ArrayList<ConfideHomeFiterItemBean>?,
//当前列表已存在专家uid列表
var notInUid : ArrayList<Int> = ArrayList()
)
\ No newline at end of file
......@@ -30,4 +30,6 @@ data class ConfideHomeDataBean(
/**
* 为你推荐Id 本地使用 用于区分音频播放区域
*/
var recommendId : Int)
\ No newline at end of file
var recommendId : Int,
var keyword : String = "")
\ No newline at end of file
......@@ -20,6 +20,8 @@ interface IConfideHomeConfig{
const val TYPE_RECOMMEND = 5
const val TYPE_SOUND = 6
const val TYPE_VIDEO_SHOW = 7
const val TYPE_SEARCH = 8
const val TYPE_EMPTY = 9
const val TYPE_FOOTER = 999
/**
* section id. 与上面相对应
......@@ -31,6 +33,8 @@ interface IConfideHomeConfig{
const val SECTION_RECOMMEND = 10005
const val SECTION_SOUND = 10006
const val SECTION_CONSULTANT = 10007
const val SECTION_SEARCH = 10008
const val SECTION_EMPTY = 10009
const val SECTION_FOOTER = 19999
......
......@@ -19,4 +19,9 @@ public class FinalString {
//连接倾听未绑定手机提示
public static final String TEL_BINDPHONE = "电话连接需要绑定手机哦~";
public static final String CONFIDE_SEARCH_KEY_WORD = "confide_key_word";
public static final int SEARCH_REQUEST_CODE = 1;
}
......@@ -132,13 +132,13 @@ class ConfideHomeEventImpl(context: Context, var confideHomeView: IConfideHomeCo
* 最佳倾诉榜单--点我倾诉
* @param linkUrl 跳转地址
*/
override fun consultantClick(doctorId: String?, confideId: String?, uid: String?) {
override fun consultantClick(doctorId: String?, confideId: String?, uid: String?,listenFree : Boolean?, expertUrl:String?) {
confideId?.let {
ConfideBottomSheetDialogFragment()
.showBottomSheetDialog(
mContext as FragmentActivity,
HttpConfig.MH5_URL + ConfideRoute.h5ConfideIntro(it),
doctorId!!, uid = uid
doctorId!!, uid = uid, listenFree = listenFree ?: false,expertUrl = expertUrl?:""
)
}
}
......
......@@ -73,7 +73,7 @@ interface IConfideHomeEvent {
* 咨询师推荐--点我倾诉
* @param linkUrl 跳转地址
*/
fun consultantClick(doctorId: String?, confideId: String?, uid: String?)
fun consultantClick(doctorId: String?, confideId: String?, uid: String?, listenFree: Boolean?= false, expertUrl : String?="")
fun videoShowClick(index: Int, data: List<ConfideHomeBodyBean>?)
......
......@@ -38,7 +38,7 @@ interface ConfideHomeApi {
// 1=在线 3-通话中 2-离线
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
@GET("auth/listen/dialchangestatus")
fun getDialStatus(@Query("doctorId") doctorId: String): Observable<BaseAPIResponse<DialStatus>>
fun getDialStatus(@Query("doctorId") doctorId: String, @Query("listenVersion")listenVersion : String = "2.1"): Observable<BaseAPIResponse<DialStatus>>
@GET
fun recommendDoctor(
......
......@@ -51,6 +51,7 @@ class ConfideHomeHttpImpl private constructor() : IConfideHomeHttp {
val sb = StringBuffer()
sb.append("page").append("=").append(param.page).append("&")
.append("keywords").append("=").append(param.getKeywords()).append("&")
.append("sortType").append("=").append(param.getSortType()).append("&")
.append("sexType").append("=").append(param.getSexType()).append("&")
.append("ageType").append("=").append(param.getAgeType()).append("&")
......
......@@ -30,6 +30,8 @@ class ConfideRecommendParam private constructor(builder: Builder){
*/
private var goodType : String = ""
private var keyWords : String = ""
//当前列表已存在专家uid列表
var notInUid : ArrayList<Int> = ArrayList()
......@@ -49,6 +51,10 @@ class ConfideRecommendParam private constructor(builder: Builder){
return goodType
}
fun getKeywords() : String{
return keyWords
}
init {
this.page = builder.page
this.sortType = builder.sortType
......@@ -56,6 +62,7 @@ class ConfideRecommendParam private constructor(builder: Builder){
this.ageType = builder.ageType
this.goodType = builder.goodType
this.notInUid = builder.notInUid
this.keyWords = builder.keyWords
}
class Builder {
......@@ -65,6 +72,7 @@ class ConfideRecommendParam private constructor(builder: Builder){
internal var ageType : String = ""
internal var goodType : String = ""
internal var notInUid : ArrayList<Int> = ArrayList()
internal var keyWords : String = ""
fun page(page: Int): Builder {
this.page = page
......@@ -91,9 +99,17 @@ class ConfideRecommendParam private constructor(builder: Builder){
return this
}
fun keyWords(keyWords: String): Builder {
this.keyWords = keyWords
return this
}
fun build() : ConfideRecommendParam{
return ConfideRecommendParam(this)
}
}
}
......
......@@ -13,7 +13,7 @@ import com.yidianling.common.tools.RxImageTool
* @Company 壹点灵
* @date 2018/9/25
*/
class ConfideHomeRecycleViewListener : RecyclerView.OnScrollListener() {
class ConfideHomeRecycleViewListener() : RecyclerView.OnScrollListener() {
/**
* 筛选模块位置
*/
......@@ -23,6 +23,15 @@ class ConfideHomeRecycleViewListener : RecyclerView.OnScrollListener() {
*/
private var move = false
private lateinit var listener: HideScrollListener
private var visible = true
constructor(listener: HideScrollListener):this(){
this.listener = listener
}
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
super.onScrolled(recyclerView, dx, dy)
//在这里进行第二次滚动(最后的距离)
......@@ -37,6 +46,15 @@ class ConfideHomeRecycleViewListener : RecyclerView.OnScrollListener() {
recyclerView.scrollBy(0, top)
}
}
if (dy > 0 && visible) {
visible = false
listener.onHide()
} else if (dy < 0 && !visible) {
visible = true
listener.onShow()
}
}
/**
......@@ -54,7 +72,7 @@ class ConfideHomeRecycleViewListener : RecyclerView.OnScrollListener() {
mRecyclerView.scrollBy(0, 1)
val childAt = mRecyclerView.getChildAt(mIndex)
if (childAt !is ConfideHomeFilterView) return
val top = childAt.top
val top = childAt.top - childAt.height
if(top==0 || top==1){
//已滚动到顶部
......@@ -82,4 +100,6 @@ class ConfideHomeRecycleViewListener : RecyclerView.OnScrollListener() {
// move = true
// }
}
}
\ No newline at end of file
package com.ydl.confide.home.listener
import android.text.Editable
import android.text.TextUtils
import android.text.TextWatcher
import android.util.Log
import android.view.View
import android.widget.EditText
import android.widget.ImageView
import android.widget.RelativeLayout
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import android.view.View
import com.yidianling.common.tools.LogUtil
import com.yidianling.common.tools.RxImageTool
import com.ydl.confide.R
import com.ydl.confide.home.adapter.ConfideHomeAdapter
import com.ydl.confide.home.config.IConfideHomeConfig
import com.ydl.confide.home.widget.ConfideHomeFilterView
import com.ydl.ydlcommon.base.BaseActivityMgr
import com.ydl.ydlcommon.utils.KeyboardChangeListener
import com.yidianling.common.tools.LogUtil
import com.yidianling.common.tools.RxImageTool
/**
* @author yuanwai
......@@ -22,9 +32,14 @@ class ConfideHomeRecyleSuspendListener : RecyclerView.OnScrollListener() {
private var mSuspensionHeight: Int = RxImageTool.dip2px(48f)
private var mSearchViewHeight: Int = RxImageTool.dip2px(48f)
private var filterView: ConfideHomeFilterView? = null
private var searchView: RelativeLayout? = null
private var divView: View? = null
private var searchText = ""
private var adapter: ConfideHomeAdapter? = null
fun setFilterView(filterView: ConfideHomeFilterView, divView: View) {
......@@ -32,6 +47,17 @@ class ConfideHomeRecyleSuspendListener : RecyclerView.OnScrollListener() {
this.divView = divView
}
fun setFilterView(
filterView: ConfideHomeFilterView,
searchView: RelativeLayout,
divView: View
) {
this.filterView = filterView
this.divView = divView
this.searchView = searchView
}
fun setSectionAdapter(adapter: ConfideHomeAdapter) {
this.adapter = adapter
}
......@@ -41,6 +67,11 @@ class ConfideHomeRecyleSuspendListener : RecyclerView.OnScrollListener() {
if (null != filterView) {
mSuspensionHeight = filterView!!.height
}
if (searchView != null) {
mSearchViewHeight = searchView!!.height
}
}
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
......@@ -49,24 +80,42 @@ class ConfideHomeRecyleSuspendListener : RecyclerView.OnScrollListener() {
return
}
val manager = recyclerView!!.layoutManager as LinearLayoutManager
val findFirstCompletelyVisibleItemPosition =
manager.findFirstCompletelyVisibleItemPosition();
if (findFirstCompletelyVisibleItemPosition != 0 && findFirstCompletelyVisibleItemPosition != 1) {
searchView?.visibility = View.VISIBLE
} else {
searchView?.visibility = View.INVISIBLE
}
if (mCurrentPosition != manager.findFirstVisibleItemPosition()) {
mCurrentPosition = manager.findFirstVisibleItemPosition()
}
LogUtil.e("http----------------type="+adapter!!.getItemViewType(mCurrentPosition))
if (adapter!!.getItemViewType(mCurrentPosition) == IConfideHomeConfig.TYPE_RECOMMEND) {
LogUtil.e("http----------------type=" + adapter!!.getItemViewType(mCurrentPosition))
if (adapter!!.getItemViewType(mCurrentPosition + 1) == IConfideHomeConfig.TYPE_RECOMMEND) {
var view = manager.findViewByPosition(mCurrentPosition + 1)
if (view != null) {
if (view.top <= mSuspensionHeight) {
filterView!!.visibility = View.VISIBLE
divView?.visibility = View.VISIBLE
} else {
if (view is ConfideHomeFilterView) {
if (view.top <= mSuspensionHeight) {
filterView!!.visibility = View.VISIBLE
divView?.visibility = View.VISIBLE
} else {
// filterView!!.visibility = View.INVISIBLE
filterView!!.visibility = View.INVISIBLE
divView?.visibility = View.INVISIBLE
}
}
}
}else if (adapter!!.getItemViewType(mCurrentPosition) == IConfideHomeConfig.TYPE_RECOMMEND || adapter!!.getItemViewType(mCurrentPosition) == IConfideHomeConfig.TYPE_SOUND){
} else if (adapter!!.getItemViewType(mCurrentPosition + 1) == IConfideHomeConfig.TYPE_RECOMMEND || adapter!!.getItemViewType(
mCurrentPosition + 1
) == IConfideHomeConfig.TYPE_SOUND
) {
filterView!!.visibility = View.VISIBLE
divView?.visibility = View.VISIBLE
}else {
} else {
filterView!!.visibility = View.INVISIBLE
divView?.visibility = View.INVISIBLE
}
......
package com.ydl.confide.home.listener
interface HideScrollListener {
fun onHide()
fun onShow()
}
\ No newline at end of file
......@@ -54,7 +54,7 @@ class ConfideHomeSexAgePopupWindow(context: Context, sexData: ArrayList<ConfideH
tvSexTitle.text = "性别筛选"
tvAgeTitle.text = "年龄筛选"
if (null == mAllFiltersBean){
mAllFiltersBean = ConfideHomeAllFiltersBean(allFiltersBean.page,allFiltersBean.selectSort,allFiltersBean.selectSex,allFiltersBean.selectAgeData,allFiltersBean.selectGoodData)
mAllFiltersBean = ConfideHomeAllFiltersBean(allFiltersBean.page,"",allFiltersBean.selectSort,allFiltersBean.selectSex,allFiltersBean.selectAgeData,allFiltersBean.selectGoodData)
}
initData(sexData,ageData,mAllFiltersBean!!)
initSexData(view,mAllFiltersBean!!)
......
......@@ -490,6 +490,10 @@ class ConfideHomeUtils {
if (-1 != allFiltersBean.page) {
param.page(allFiltersBean.page)
}
if (null != allFiltersBean.keywords){
param.keyWords(allFiltersBean.keywords)
}
//综合排序
if (null != allFiltersBean.selectSort && !TextUtils.isEmpty(allFiltersBean.selectSort!!.id) && "-1" != allFiltersBean.selectSort!!.id) {
param.sortType(allFiltersBean.selectSort!!.id!!)
......
......@@ -16,9 +16,15 @@ fun TextView.confideLineText(line: Int) {
3 -> {
text = "通话中"
}
4->{
4 -> {
text = "继续倾诉"
}
5 -> {
text = "已离线,可预约"
}
6 -> {
text = "已离线,可留言"
}
}
}
......
......@@ -243,7 +243,7 @@ class ConfideHomeRecommendExpertItemView(mContext: Context, private var confideH
private fun click(bodyBean: ConfideHomeBodyBean) {
when (bodyBean.confideLine) {//1在线 2离线 3通话中
1, 3, 4 -> {
confideHomeEvent.consultantClick(bodyBean.doctorId, bodyBean.confidedId, bodyBean.uid?.toString())
confideHomeEvent.consultantClick(bodyBean.doctorId, bodyBean.confidedId, bodyBean.uid?.toString(), bodyBean.listenFree)
}
2 -> {
//跳转私聊 并发送自定义消息
......
......@@ -94,7 +94,8 @@ class ConfideHomeRecommendView(var view: IConfideHomeContract.View, context: Con
"1"
)
confideHomeEvent.consultantClick(bodyBean.doctorId, bodyBean.confidedId, bodyBean.uid?.toString())
confideHomeEvent.consultantClick(bodyBean.doctorId, bodyBean.confidedId, bodyBean.uid?.toString(), bodyBean.listenFree,bodyBean.linkUrl)
}
img_head.setOnClickListener {
ActionCountUtils.record("listen_counselor_list_page", "head_portrait_click", "2")
......@@ -344,7 +345,7 @@ class ConfideHomeRecommendView(var view: IConfideHomeContract.View, context: Con
if (bodyBean.confideLine == 3) {
}
confideHomeEvent.consultantClick(bodyBean.doctorId, bodyBean.confidedId, bodyBean.uid?.toString())
confideHomeEvent.consultantClick(bodyBean.doctorId, bodyBean.confidedId, bodyBean.uid?.toString(), bodyBean.listenFree)
}
2 -> {
//跳转私聊 并发送自定义消息
......
......@@ -2,6 +2,7 @@ package com.ydl.confide.intro
import android.app.Activity
import android.net.Uri
import android.text.TextUtils
import android.util.Log
import android.view.View
import android.widget.SeekBar
......@@ -11,6 +12,7 @@ import androidx.databinding.ObservableInt
import androidx.databinding.ViewDataBinding
import androidx.fragment.app.FragmentActivity
import androidx.recyclerview.widget.RecyclerView
import com.alibaba.android.arouter.launcher.ARouter
import com.dou361.ijkplayer.widget.IjkVideoView
import com.facebook.drawee.backends.pipeline.Fresco
import com.facebook.drawee.interfaces.DraweeController
......@@ -35,6 +37,8 @@ import io.reactivex.disposables.Disposable
import io.reactivex.schedulers.Schedulers
import kotlinx.android.synthetic.main.confide_home_activity.*
import tv.danmaku.ijk.media.player.IjkMediaPlayer
import java.io.UnsupportedEncodingException
import java.net.URLDecoder
import java.net.URLEncoder
import java.util.concurrent.TimeUnit
......@@ -77,6 +81,36 @@ internal class ItemIntroHolder(binding: ItemExpertIntroBinding) :
)
val status = item.lineStatus.get()
when (status) {
5 -> {
if (!TextUtils.isEmpty(item.linkedUrl.get())){
val linkUri = Uri.parse(item.linkedUrl.get())
if (linkUri != null) {
val host = linkUri.host
if (!TextUtils.isEmpty(host) && host == "h5") {
//如果是h5,跳转至NewH5Activity
try {
var params = URLDecoder.decode(linkUri.getQueryParameter("params"),"UTF-8")
ARouter.getInstance().build("/new_h5/h5").withSerializable("routerParam", params).navigation()
}catch (e : NullPointerException){
com.yidianling.common.tools.LogUtil.e("params参数为空")
}catch (e : UnsupportedEncodingException){
com.yidianling.common.tools.LogUtil.e("解码错误")
}catch (e : UnsupportedOperationException){
com.yidianling.common.tools.LogUtil.e("这不是一个uri格式的地址")
}
}
}
}
}
6 -> {
if (!item.uid.isNullOrBlank()) {
(itemView.context as? Activity)?.let { it1 ->
ARouter.getInstance().navigation(IImService::class.java)
?.startChatBySessionId(it1, item.uid!!)
}
}
}
2, 3 -> {//离线,通话中
(itemView.context as? Activity)?.let { aty ->
findRouteService(IImService::class.java).startChat(aty, item.uid!!, 0, 0)
......@@ -226,12 +260,19 @@ internal class ItemIntroHolder(binding: ItemExpertIntroBinding) :
}
val controller: DraweeController = Fresco.newDraweeControllerBuilder()
.setUri(Uri.parse("res://drawable/" + R.drawable.first_order))
.setUri(Uri.parse("res://drawable/" + R.drawable.confide_first_order))
.setOldController(binding.confideFirstFree.controller)
.setAutoPlayAnimations(true) // 是否自动播放Gif动画
.build()
binding.confideFirstFree.controller = controller
val freeController: DraweeController = Fresco.newDraweeControllerBuilder()
.setUri(Uri.parse("res://drawable/" + R.drawable.confide_free))
.setOldController(binding.free.controller)
.setAutoPlayAnimations(true) // 是否自动播放Gif动画
.build()
binding.free.controller = freeController
binding.seekbar.progress = 0
binding.seekbar.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
......@@ -330,7 +371,8 @@ internal class ItemIntroHolder(binding: ItemExpertIntroBinding) :
itemView.context as FragmentActivity,
url,
item.doctorId!!,
uid = item.uid
uid = item.uid,
listenFree = item.listenFree.get()
)
}
}
......@@ -352,6 +394,8 @@ class VideoViewModel {
var uid: String? = null
var doctorId: String? = null
var confideId: String? = null
var listenFree = ObservableBoolean(false)
var linkedUrl = ObservableField<String>("")
}
private fun genMinProgramPath(url: String): String {
......@@ -363,6 +407,7 @@ private fun genMinProgramPath(url: String): String {
internal fun VideoViewModel.mapOf(bean: ConfideHomeBodyBean): VideoViewModel {
name.set(bean.confidedName)
avatar.set(bean.confidedIcon)
linkedUrl.set(bean.linkUrl)
val num = bean.confideNum?.replace("人", "") ?: "0"
count.set("倾诉人次 $num")
intro.set(bean.confideContent)
......@@ -385,6 +430,11 @@ internal fun VideoViewModel.mapOf(bean: ConfideHomeBodyBean): VideoViewModel {
uid = bean.uid?.toString()
doctorId = bean.doctorId
confideId = bean.confidedId
if (bean.listenFree == null) {
listenFree.set(false)
} else {
listenFree.set(bean.listenFree!!)
}
return this
}
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="40dp"/>
<solid android:color="#F7F7F7" />
<stroke android:width="1px" android:color="#E6E6E6"/>
</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:shape="rectangle">
<size android:width="1dp" />
<span style="font-family: Arial, Helvetica, sans-serif;"/>
<solid android:color="@color/platform_main_theme" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="26dp" />
<gradient
android:endColor="#FE745B"
android:startColor="#FF8772" />
<stroke
android:width="1dp"
android:color="#69FFFFFF" />
</shape>
\ No newline at end of file
......@@ -83,12 +83,24 @@
app:layout_constraintCircleRadius="70dp" />-->
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/free"
android:layout_width="@dimen/platform_dp_48"
android:layout_height="@dimen/platform_dp_24"
app:layout_constraintCircle="@+id/layoutCall"
app:layout_constraintCircleAngle="70"
app:layout_constraintCircleRadius="70dp"
android:visibility="gone"
tools:ignore="MissingConstraints" />
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/first_order"
android:layout_width="@dimen/platform_dp_64"
android:layout_height="@dimen/platform_dp_34"
android:layout_width="@dimen/platform_dp_48"
android:layout_height="@dimen/platform_dp_24"
app:layout_constraintCircle="@+id/layoutCall"
app:layout_constraintCircleAngle="70"
app:layout_constraintCircleRadius="70dp"/>
app:layout_constraintCircleRadius="70dp"
android:visibility="gone"
tools:ignore="MissingConstraints" />
<LinearLayout
......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:background="@color/white"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/empty_rl"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:gravity="center_horizontal"
android:layout_marginTop="100dp"
android:orientation="vertical"
>
<ImageView
android:id="@+id/empty_img"
android:layout_width="180dp"
android:layout_height="120dp"
android:src="@drawable/platform_ico_img_zixun_empty" />
<TextView
android:id="@+id/hint_msg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/platform_dp_35"
android:text="没有搜到相关信息,换个关键词看看吧"
android:textColor="@color/platform_color_999999"
android:textSize="14dp" />
</LinearLayout>
</RelativeLayout>
\ No newline at end of file
......@@ -16,7 +16,8 @@
<com.jcodecraeer.xrecyclerview.XRecyclerView
android:id="@+id/rv_list"
android:layout_width="match_parent"
android:layout_height="match_parent" />
android:layout_height="match_parent"
/>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/quick_consult_card"
......@@ -33,8 +34,7 @@
android:elevation="2dp"
android:paddingBottom="1dp"
android:paddingRight="@dimen/platform_dp_8"
android:visibility="gone"
tools:visibility="visible">
android:visibility="visible">
<ImageView
android:id="@+id/confide_logo"
......@@ -137,11 +137,75 @@
android:background="#80000000"
android:visibility="gone" />
<RelativeLayout
android:id="@+id/rl_search_head"
android:layout_width="match_parent"
android:layout_height="@dimen/platform_dp_48"
android:background="@color/white"
android:visibility="gone"
tools:visibility="gone">
<View
android:id="@+id/view_search_input_bg"
android:layout_width="match_parent"
android:layout_height="32dp"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/confide_dp_15"
android:layout_marginRight="@dimen/confide_dp_15"
android:background="@drawable/confide_bg_hot_search_input"
android:tag="tag_search_input_bg" />
<ImageView
android:id="@+id/iv_search_icon"
android:layout_width="14dp"
android:layout_height="14dp"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/platform_dp_25"
android:layout_marginRight="10dp"
android:scaleType="centerCrop"
android:src="@drawable/confide_icon_input_search"
android:tag="tag_search_input_img" />
<TextView
android:id="@+id/etSearch"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginRight="20dp"
android:layout_toLeftOf="@+id/iv_delete_icon"
android:layout_toRightOf="@id/iv_search_icon"
android:background="@null"
android:cursorVisible="true"
android:hint="请输入倾诉师姓名"
android:imeOptions="actionSearch"
android:maxLength="100"
android:singleLine="true"
android:tag="tag_search_input_edit"
android:textColor="#242424"
android:textColorHint="#b3b3b3"
android:textCursorDrawable="@drawable/confide_edit_cursor_drawable"
android:textSize="13sp" />
<ImageView
android:id="@+id/iv_delete_icon"
android:layout_width="14dp"
android:layout_height="14dp"
android:layout_alignRight="@+id/view_search_input_bg"
android:layout_centerVertical="true"
android:layout_marginRight="12dp"
android:scaleType="centerCrop"
android:src="@drawable/platform_delete"
android:visibility="invisible" />
</RelativeLayout>
<com.ydl.confide.home.widget.ConfideHomeFilterView
android:id="@+id/v_filterView"
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="@color/white"
android:layout_below="@+id/rl_search_head"
android:visibility="gone"
tools:visibility="gone"/>
......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rl_search"
android:layout_width="match_parent"
android:layout_height="@dimen/platform_dp_48"
android:descendantFocusability="blocksDescendants"
>
<View
android:id="@+id/view_search_input_bg"
android:layout_width="match_parent"
android:layout_height="32dp"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/confide_dp_15"
android:layout_marginRight="@dimen/confide_dp_15"
android:background="@drawable/confide_bg_hot_search_input"
android:tag="tag_search_input_bg" />
<ImageView
android:id="@+id/iv_search_icon"
android:layout_width="14dp"
android:layout_height="14dp"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/platform_dp_25"
android:layout_marginRight="10dp"
android:scaleType="centerCrop"
android:src="@drawable/confide_icon_input_search"
android:tag="tag_search_input_img" />
<TextView
android:id="@+id/etSearch"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginRight="20dp"
android:layout_toLeftOf="@+id/iv_delete_icon"
android:layout_toRightOf="@id/iv_search_icon"
android:background="@null"
android:cursorVisible="true"
android:hint="请输入倾诉师姓名"
android:imeOptions="actionSearch"
android:maxLength="100"
android:singleLine="true"
android:tag="tag_search_input_edit"
android:textColor="#242424"
android:textColorHint="#b3b3b3"
android:textCursorDrawable="@drawable/confide_edit_cursor_drawable"
android:textSize="13sp" />
<ImageView
android:id="@+id/iv_delete_icon"
android:layout_width="14dp"
android:layout_height="14dp"
android:layout_alignRight="@+id/view_search_input_bg"
android:layout_centerVertical="true"
android:layout_marginRight="12dp"
android:scaleType="centerCrop"
android:src="@drawable/platform_delete"
android:visibility="invisible" />
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/rl_search"
android:layout_width="match_parent"
android:layout_height="@dimen/platform_dp_48"
android:paddingStart="15dp"
android:tag="tag_search_input"
>
<View
android:id="@+id/view_search_input_bg"
android:layout_width="match_parent"
android:layout_height="32dp"
android:layout_centerVertical="true"
android:layout_marginRight="60dp"
android:background="@drawable/confide_bg_hot_search_input"
android:tag="tag_search_input_bg" />
<ImageView
android:id="@+id/iv_search_icon"
android:layout_width="14dp"
android:layout_height="14dp"
android:layout_centerVertical="true"
android:layout_marginLeft="15dp"
android:layout_marginRight="10dp"
android:scaleType="centerCrop"
android:src="@drawable/confide_icon_input_search"
android:tag="tag_search_input_img" />
<EditText
android:id="@+id/etSearch"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginRight="20dp"
android:layout_toLeftOf="@+id/iv_delete_icon"
android:layout_toRightOf="@id/iv_search_icon"
android:background="@null"
android:cursorVisible="true"
android:focusable="true"
android:focusableInTouchMode="true"
android:hint="请输入倾诉师姓名"
android:imeOptions="actionSearch"
android:maxLength="100"
android:singleLine="true"
android:tag="tag_search_input_edit"
android:textColor="#242424"
android:textColorHint="#b3b3b3"
android:textCursorDrawable="@drawable/confide_edit_cursor_drawable"
android:textSize="13sp" />
<ImageView
android:id="@+id/iv_delete_icon"
android:layout_width="14dp"
android:layout_height="14dp"
android:layout_alignRight="@+id/view_search_input_bg"
android:layout_centerVertical="true"
android:layout_marginRight="12dp"
android:scaleType="centerCrop"
android:src="@drawable/platform_delete"
android:visibility="invisible" />
<TextView
android:id="@+id/tv_search_cancle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="10dp"
android:padding="5dp"
android:text="取消"
android:textColor="#242424"
android:textSize="15dp" />
</RelativeLayout>
<View
android:id="@+id/v_topLine"
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_below="@+id/rl_search"
android:layout_marginTop="@dimen/platform_dp_6"
android:background="@color/platform_color_E0E0E0"
/>
</LinearLayout>
\ No newline at end of file
......@@ -100,7 +100,7 @@
android:layout_width="160dp"
android:layout_height="47dp"
android:layout_marginBottom="28dp"
android:background="@{item.lineStatus==3?@drawable/confide_line_bg_3:(item.lineStatus==2?@drawable/confide_line_bg_2:@drawable/confide_line_bg_1)}"
android:background="@{(item.lineStatus == 5 || item.lineStatus == 6) ? @drawable/confide_offline_book_bg : item.lineStatus==3?@drawable/confide_line_bg_3:(item.lineStatus==2?@drawable/confide_line_bg_2:@drawable/confide_line_bg_1)}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
......@@ -166,13 +166,24 @@
app:layout_constraintCircleRadius="70dp" />-->
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/free"
android:layout_width="@dimen/platform_dp_48"
android:layout_height="@dimen/platform_dp_24"
android:visibility="@{item.listenFree?View.VISIBLE:View.GONE}"
app:layout_constraintCircle="@+id/layoutCall"
app:layout_constraintCircleAngle="70"
app:layout_constraintCircleRadius="70dp"
tools:ignore="MissingConstraints" />
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/confide_first_free"
android:layout_width="@dimen/platform_dp_64"
android:layout_height="@dimen/platform_dp_34"
android:layout_width="@dimen/platform_dp_48"
android:layout_height="@dimen/platform_dp_24"
android:visibility="@{item.showFreeTag?View.VISIBLE:View.GONE}"
app:layout_constraintCircle="@+id/layoutCall"
app:layout_constraintCircleAngle="70"
app:layout_constraintCircleRadius="70dp" />
app:layout_constraintCircleRadius="70dp"
tools:ignore="MissingConstraints" />
<TextView
android:id="@+id/tvTag"
......
......@@ -38,6 +38,7 @@ class HomeConfideBean : HomeItemBaseBean {
var confideLine: Int = 0
var confideAddress: String? = null
var confidePraise: String? = null
var confidePraiseScore:String?=null
/**
* 实际费用
*/
......
......@@ -7,13 +7,17 @@ import android.text.TextUtils
import android.view.View
import android.view.ViewGroup
import android.widget.FrameLayout
import com.blankj.utilcode.util.SpanUtils
import com.bumptech.glide.Glide
import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.ydl.ydl_image.config.SimpleImageOpConfiger
import com.ydl.ydl_image.manager.YDLImageCacheManager
import com.ydl.ydl_image.module.GlideApp
import com.yidianling.common.tools.RxImageTool
import com.yidianling.home.R
import com.yidianling.home.event.IHomeBaseEvent
import com.yidianling.home.model.bean.HomeConfideBean
import kotlinx.android.synthetic.ydl.home_confide_expert_info_view.view.*
import kotlinx.android.synthetic.ydl.home_confide_item_layout.view.*
/**
* @author jiucheng
......@@ -34,7 +38,7 @@ class HomeConfideExpertInfoView(private var mContext: Context, private var homeE
private fun initView() {
var params = FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
layoutParams = params
View.inflate(context, R.layout.home_confide_expert_info_view, this)
View.inflate(context, R.layout.home_confide_item_layout, this)
}
fun setData(bean: HomeConfideBean.BodyBean?, position: Int, isLast: Boolean) {
......@@ -44,12 +48,19 @@ class HomeConfideExpertInfoView(private var mContext: Context, private var homeE
}
//设置头像
setHead(bean)
setListenAndScore(bean)
setConfideTag(bean)
setLineStatus(bean)
//设置名称
tv_name.text = bean.confidedName
//设置倾诉标签View的最大宽度
tag_view.setConfideWidth()
// tag_view.setConfideWidth()
//咨询师标签
tag_view.initData(bean.confidedTag as MutableList<String>)
// tag_view.initData(bean.confidedTag as MutableList<String>)
//设置向TA倾诉人数
setConfideNum(bean)
//设置接通率文案
......@@ -58,11 +69,15 @@ class HomeConfideExpertInfoView(private var mContext: Context, private var homeE
setConfideButton(bean)
//设置红包、原价
setCoupon(bean)
//设置咨询师简介
tv_content.text = bean.confideContent
//最后一项显示分割线
if (isLast) {
view_line.visibility = View.GONE
// view_line.visibility = View.GONE
} else {
view_line.visibility = View.VISIBLE
// view_line.visibility = View.VISIBLE
}
this.setOnClickListener {
homeEvent!!.confideClick(bean.linkUrl, bean.confidedId.toString(), bean.doctorId, bean.uid.toString())
......@@ -73,11 +88,22 @@ class HomeConfideExpertInfoView(private var mContext: Context, private var homeE
* 设置头像
*/
private fun setHead(bean: HomeConfideBean.BodyBean) {
val op = SimpleImageOpConfiger()
op.errorPic = R.drawable.platform_head_place_hold_pic
op.loadingPic = R.drawable.platform_head_place_hold_pic
op.transform = 0
YDLImageCacheManager.showImage(mContext, bean.confidedIcon, img_head, op)
// val op = SimpleImageOpConfiger()
// op.errorPic = R.drawable.platform_head_place_hold_pic
// op.loadingPic = R.drawable.platform_head_place_hold_pic
// op.transform = 0
// YDLImageCacheManager.showImage(mContext, bean.confidedIcon, img_head, op)
//这样处理 是防止 滑动过程中 反复去加载图片
if (!TextUtils.isEmpty(bean.confidedIcon) && img_head.getTag(R.id.img_head) != bean.confidedIcon) {
GlideApp.with(context)
.load(bean.confidedIcon)
// .override(dp96, dp96)
.into(img_head)
img_head.setTag(R.id.img_head, bean.confidedIcon)
}
}
/**
......@@ -135,41 +161,99 @@ class HomeConfideExpertInfoView(private var mContext: Context, private var homeE
}
}
private fun setListenAndScore(bodyBean: HomeConfideBean.BodyBean) {
SpanUtils.with(price_content).append(bodyBean.confideFee)
.setForegroundColor(resources.getColor(R.color.home_confide_fe6040)).setFontSize(18, true)
.append("元").setForegroundColor(resources.getColor(R.color.home_confide_fe6040))
.setFontSize(11, true)
.append("/25分钟").setForegroundColor(resources.getColor(R.color.home_confide_aaaeba))
.setFontSize(11, true)
.create()
tv_score.text = bodyBean.confidePraiseScore
if (bodyBean.confideFee == "0" && bodyBean.confideLine == 1) {
confide_free_logo.visibility = VISIBLE
Glide.with(context)
.load(R.drawable.home_confide__free)
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
.into(confide_free_logo)
} else {
confide_free_logo.visibility = GONE
}
}
/**
* 设置红包、原价
* 设置在线状态
*/
@SuppressLint("SetTextI18n")
private fun setCoupon(bodyBean: HomeConfideBean.BodyBean) {
private fun setLineStatus(bodyBean: HomeConfideBean.BodyBean) {
when (bodyBean.confideLine) {//1在线 2离线 3通话中
1, 4 -> {
tv_online.text = "在线"
tv_online.setBackgroundResource(R.drawable.home_confide_online_main)
}
2 -> {
tv_online.text = "离线"
tv_online.setBackgroundResource(R.drawable.home_confide_offline_bg)
}
3 -> {
tv_online.text = "通话中"
tv_online.setBackgroundResource(R.drawable.home_confide_online_main)
}
}
}
if(!TextUtils.isEmpty(bodyBean.couponText)){
tvCoupon.text = bodyBean.couponText
tvCoupon.visibility = View.VISIBLE
}else{
tvCoupon.visibility = View.GONE
private fun setConfideTag(bodyBean: HomeConfideBean.BodyBean) {
if (null == bodyBean.confidedTag || bodyBean.confidedTag!!.isEmpty()) {
return
}
if (TextUtils.isEmpty(bodyBean.confideFee) || TextUtils.isEmpty(bodyBean.couponMoney) || bodyBean.couponMoney!!.toFloat() <= 0){
tvOriginalPrice.visibility = View.GONE
}else{
tvOriginalPrice.visibility = View.VISIBLE
val originalBuffer = StringBuffer()
originalBuffer.append(bodyBean.confideFee).append("元/次")
tvOriginalPrice.text = originalBuffer.toString()
//添加删除线
tvOriginalPrice.paint.flags = Paint.STRIKE_THRU_TEXT_FLAG
var i = 0
val sb = StringBuilder()
for (tag in bodyBean.confidedTag!!) {
if (i > 4) break
sb.append(tag).append(" | ")
i++
}
try {
val couponMoney = bodyBean.couponMoney!!.toFloat().toInt()
val confideFee = bodyBean.confideFee!!.toFloat().toInt()
if (couponMoney >= confideFee){
tv_price.text = "¥0"
}else{
val price = confideFee - couponMoney
tv_price.text = "¥"+price.toString()
}
}catch (e:Exception){
//防止数据类型变化引起奔溃
if (sb.length > 3) {
sb.setLength(sb.length - 3)
}
flowlayout_tag.text = sb.toString()
}
/**
* 设置红包、原价
*/
@SuppressLint("SetTextI18n")
private fun setCoupon(bodyBean: HomeConfideBean.BodyBean) {
// if(!TextUtils.isEmpty(bodyBean.couponText)){
// tvCoupon.text = bodyBean.couponText
// tvCoupon.visibility = View.VISIBLE
// }else{
// tvCoupon.visibility = View.GONE
// }
// if (TextUtils.isEmpty(bodyBean.confideFee) || TextUtils.isEmpty(bodyBean.couponMoney) || bodyBean.couponMoney!!.toFloat() <= 0){
// tvOriginalPrice.visibility = View.GONE
// }else{
// tvOriginalPrice.visibility = View.VISIBLE
// val originalBuffer = StringBuffer()
// originalBuffer.append(bodyBean.confideFee).append("元/次")
// tvOriginalPrice.text = originalBuffer.toString()
// //添加删除线
// tvOriginalPrice.paint.flags = Paint.STRIKE_THRU_TEXT_FLAG
// }
// try {
// val couponMoney = bodyBean.couponMoney!!.toFloat().toInt()
// val confideFee = bodyBean.confideFee!!.toFloat().toInt()
//
// if (couponMoney >= confideFee){
// tv_price.text = "¥0"
// }else{
// val price = confideFee - couponMoney
// tv_price.text = "¥"+price.toString()
// }
// }catch (e:Exception){
// //防止数据类型变化引起奔溃
// }
}
}
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:bottomRightRadius="6dp"/>
<solid android:color="#4d000000" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:bottomRightRadius="6dp"/>
<solid android:color="#4d000000" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:topRightRadius="100dp"
android:bottomRightRadius="100dp"/>
<solid android:color="#40FFFFFF" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
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"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@color/white"
tools:ignore="MissingDefaultResource">
<androidx.cardview.widget.CardView
android:id="@+id/card_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:cardElevation="0dp"
app:cardCornerRadius="6dp"
android:layout_marginTop="20dp"
android:layout_marginStart="15dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<FrameLayout
android:layout_width="96dp"
android:layout_height="96dp">
<ImageView
android:id="@+id/img_head"
android:layout_width="96dp"
android:layout_height="96dp"
android:scaleType="fitXY"/>
<TextView
android:id="@+id/tv_online"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="9dp"
android:paddingRight="9dp"
android:paddingTop="1dp"
android:paddingBottom="1dp"
android:textSize="10sp"
android:textColor="@color/white"
android:background="@drawable/home_confide_recommend_expert_line_bg"
tools:text="在线"/>
<ImageView
android:id="@+id/iv_play"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="bottom|right"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"/>
</FrameLayout>
</androidx.cardview.widget.CardView>
<TextView
android:id="@+id/tv_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:textColor="#333333"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintStart_toEndOf="@id/card_view"
app:layout_constraintTop_toTopOf="@id/card_view"
tools:text="姚雨晴" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/ll_confide_data"
app:layout_constraintTop_toBottomOf="@id/tv_name"
app:layout_constraintStart_toEndOf="@id/card_view"
android:layout_marginStart="12dp"
android:orientation="horizontal"
>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center"
>
<TextView
android:id="@+id/tv_Connection"
android:layout_marginTop="12dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:textColor="#555555"
android:textStyle="bold"
tools:text="83%"
/>
<TextView
android:id="@+id/tv_ConnectionContent"
android:layout_marginTop="3dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="12sp"
android:textColor="#69696A"
android:text="接通率" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center"
android:layout_marginStart="25dp"
>
<TextView
android:id="@+id/tv_confideNum"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/platform_sp_14"
android:textColor="#555555"
android:textStyle="bold"
android:layout_marginTop="12dp"
tools:text="8000人"
/>
<TextView
android:id="@+id/tv_tv_confideNumContent"
android:layout_marginTop="@dimen/platform_dp_3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/platform_sp_12"
android:textColor="#69696A"
android:text="倾诉人次"
/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center"
android:layout_marginStart="25dp"
>
<TextView
android:id="@+id/tv_score"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/platform_sp_14"
android:textColor="#555555"
android:textStyle="bold"
android:layout_marginTop="12dp"
tools:text="4.9"
/>
<TextView
android:id="@+id/tv_tv_ScoreContent"
android:layout_marginTop="@dimen/platform_dp_3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/platform_sp_12"
android:textColor="#69696A"
android:text="评分"
/>
</LinearLayout>
</LinearLayout>
<TextView
android:id="@+id/price_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:layout_marginRight="16dp"
android:text="50元/25分钟"
android:textSize="@dimen/platform_sp_12"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ll_confide_data" />
<TextView
android:id="@+id/flowlayout_tag"
android:layout_width="0dp"
android:layout_height="16dp"
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
android:textColor="#9495A0"
android:maxLines="1"
android:ellipsize="end"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="@+id/card_view"
app:layout_constraintEnd_toStartOf="@+id/price_content"
app:layout_constraintStart_toEndOf="@+id/card_view" />
<TextView
android:id="@+id/tv_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="13sp"
android:textColor="#919190"
android:maxLines="2"
android:ellipsize="end"
app:layout_constraintTop_toBottomOf="@id/card_view"
app:layout_constraintStart_toStartOf="@id/card_view"
android:layout_marginTop="@dimen/platform_dp_15"
tools:text="没有人一出生就是完美的,只有不断的相信自...己…才能成就自己的梦想。"
/>
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
>
<TextView
android:id="@+id/tv_confide"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginTop="@dimen/platform_dp_15"
android:layout_marginEnd="@dimen/platform_dp_15"
android:gravity="center"/>
<ImageView
android:layout_width="42dp"
android:layout_height="21dp"
android:id="@+id/confide_free_logo"
android:layout_marginTop="@dimen/platform_dp_5"
android:layout_marginStart="@dimen/platform_dp_8"/>
</FrameLayout>
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
app:layout_constraintTop_toBottomOf="@id/tv_content"
android:layout_marginTop="@dimen/platform_dp_12"
android:layout_marginLeft="15dp"
android:background="#F0F0F0"/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......@@ -4,5 +4,9 @@
<color name="white_60">#99FFFFFF</color>
<color name="white">#FFFFFF</color>
<color name="home_confide_61CEAC">#61CEAC</color>
<color name="home_confide_48CC95">#48CC95</color>
<color name="home_confide_fe6040">#fe6040</color>
<color name="home_confide_aaaeba">#aaaeba</color>
</resources>
package com.yidianling.im.bean
data class CanViewConsult(
val canViewConsult: Boolean = false
)
......@@ -280,11 +280,7 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
//做灵犀2.0 去掉常用语逻辑
//rl_common_question_enter.setVisibility(ActionHandlerStorage.getL(sessionId) != null && ActionHandlerStorage.getL(sessionId).getUserType() == 3 ? View.VISIBLE : View.GONE);
if (null!=ActionHandlerStorage.getL(sessionId)&&ActionHandlerStorage.getL(sessionId).getUserType() != 2) {
if (null != getActivity() && null != rela_zixun) {
rela_zixun.setVisibility(View.GONE);
}
}
if (null!=ActionHandlerStorage.getL(sessionId)&&ActionHandlerStorage.getL(sessionId).isNotPrepare()) {
IMChatUtil.INSTANCE.prepareChatData((AppCompatActivity) getActivity(), sessionId, (expertInfo) -> {
String toUid = expertInfo.shareData.toUid;
......@@ -305,7 +301,6 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
//如果是群聊
if (SessionTypeEnum.Team==sessionType){
titleBar.setRightIcon(getContext().getDrawable(R.drawable.platform_common_more));
rela_zixun.setVisibility(View.GONE);
titleBar.setTitleRightDraw(null);
}
}
......@@ -328,6 +323,22 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
});
}
boolean isExpert = null!=ActionHandlerStorage.getL(sessionId)&&ActionHandlerStorage.getL(sessionId).getUserType() == 2;
ServiceImpl.Companion.getInstance().canViewConsult(ActionHandlerStorage.getL(sessionId).getInfo().doctorId)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(response -> {
if (response.code.equals("200")){
if (response.data!=null && response.data.getCanViewConsult()){
if (isExpert && sessionType != SessionTypeEnum.Team) {
rela_zixun.setVisibility(View.VISIBLE);
}
}
}
}
);
//有未完成订单或者有未评价订单时,显示订单布局
if (ActionHandlerStorage.getL(sessionId) != null && ActionHandlerStorage.getL(sessionId).getInfo() != null) {
if (ActionHandlerStorage.getL(sessionId).getInfo().hasAvailableListenOrder == 2 || ActionHandlerStorage.getL(sessionId).getInfo().listenOrderCommentStatus == 1) {
......@@ -430,13 +441,13 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
getInputPanel().setInputHintContent(res.data.getInputBoxReminder());
}
}
if ("200".equals(res.code) && res.data != null) {
if (res.data.getStatus() == 0) {
if (null != getActivity() && null != rela_zixun) {
rela_zixun.setVisibility(View.GONE);
}
}
}
// if ("200".equals(res.code) && res.data != null) {
// if (res.data.getStatus() == 0) {
// if (null != getActivity() && null != rela_zixun) {
// rela_zixun.setVisibility(View.GONE);
// }
// }
// }
}, throwable -> {
});
if (ActionHandlerStorage.getL(sessionId) != null && ActionHandlerStorage.getL(sessionId).getUserType() == 1 && ModularServiceManager.INSTANCE.provide(IUserService.class).getUserInfo().getUser_type() == 3) {
......
......@@ -4,6 +4,7 @@ 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.im.bean.BusyBean
import com.yidianling.im.bean.CanViewConsult
import com.yidianling.im.bean.FirstQuestionBean
import com.yidianling.uikit.custom.http.response.*
import com.yidianling.uikit.custom.http.response.question.QuestionsInfoBean
......@@ -125,4 +126,10 @@ interface ServiceApi {
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA,"X-App-Id: crm_cloud")
fun getFirstQuestion( @Body map: Map<String,@JvmSuppressWildcards Any>): Observable<BaseAPIResponse<FirstQuestionBean>>
//倾诉2.0迭代 是否显示立即咨询按钮
@GET("consult/expert-page/canViewConsult")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun canViewConsult(@Query("doctorId") doctorId: String): Observable<BaseAPIResponse<CanViewConsult>>
}
\ No newline at end of file
......@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON
import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.ydl.ydlnet.YDLHttpUtils
import com.yidianling.im.bean.BusyBean
import com.yidianling.im.bean.CanViewConsult
import com.yidianling.im.bean.FirstQuestionBean
import com.yidianling.im.http.ImRetrofitApi
import com.yidianling.uikit.custom.http.response.*
......@@ -200,4 +201,11 @@ class ServiceImpl private constructor() {
return YDLHttpUtils.obtainApi(ServiceApi::class.java).getFirstQuestion(map)
}
/**
* 是否显示立即咨询
*/
fun canViewConsult(doctorId: String):Observable<BaseAPIResponse<CanViewConsult>>{
return YDLHttpUtils.obtainApi(ServiceApi::class.java).canViewConsult(doctorId)
}
}
\ No newline at end of file
......@@ -3,18 +3,26 @@ package com.yidianling.uikit.custom.widget;
import android.content.Context;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.fragment.app.FragmentActivity;
import com.netease.nimlib.sdk.NIMClient;
import com.netease.nimlib.sdk.RequestCallback;
import com.netease.nimlib.sdk.msg.MessageBuilder;
import com.netease.nimlib.sdk.msg.MsgService;
import com.netease.nimlib.sdk.msg.constant.SessionTypeEnum;
import com.netease.nimlib.sdk.msg.model.IMMessage;
import com.ydl.confide.api.ConfideRoute;
import com.ydl.confide.api.IConfideService;
import com.ydl.ydlcommon.base.config.HttpConfig;
import com.ydl.ydlcommon.router.IYDLRouterConstant;
import com.ydl.ydlcommon.utils.Utils;
import com.yidianling.common.tools.RxImageTool;
import com.yidianling.common.tools.ToastUtil;
import com.yidianling.im.R;
......@@ -27,6 +35,14 @@ import com.ydl.ydlcommon.router.YdlCommonRouterManager;
import com.ydl.ydlcommon.utils.StringUtils;
import com.ydl.ydlcommon.utils.YDLCacheUtils;
import java.util.HashMap;
import kotlin.Pair;
import static com.ydl.ydlcommon.modular.ModularServiceManagerKt.findRouteService;
import static com.ydl.ydlcommon.modular.ModularServiceManagerKt.route;
/**
* Created by haorui on 2019/5/22.
* Des:
......@@ -129,9 +145,29 @@ public class ConfideOrderInfoView extends RelativeLayout {
//点击整个view,跳转订单详情页面
setOnClickListener(view -> {
if (!TextUtils.isEmpty(info.listenOrderUrl)) {//订单详情
H5Params h5Params = new H5Params(info.listenOrderUrl, "订单详情");
NewH5Activity.start(mContext, h5Params);
if (Utils.isFastClick()) {
return;
}
String remainTime = ActionHandlerStorage.getL(mSessionId).getInfo().listenOrderRemainTime;
if (TextUtils.isEmpty(remainTime)) {
Pair<String, String> confideId = new Pair<>(IYDLRouterConstant.EXTRA_CONFIDEDID,
info.listenerId);
Pair<String, String> doctorId = new Pair<>(IYDLRouterConstant.EXTRA_DOCTORID,
info.doctorId);
route(getContext(), ConfideRoute.R_CONFIDE_HOME, confideId, doctorId);
} else {
if (info != null) {
String confideId = info.listenerId;
findRouteService(IConfideService.class)
.showExpertDetailDialog(
(FragmentActivity) mContext,
HttpConfig.Companion.getMH5_URL() + ConfideRoute.INSTANCE.h5ConfideIntro(confideId),
info.doctorId,
info.toUid);
}
}
});
}
......@@ -180,4 +216,7 @@ public class ConfideOrderInfoView extends RelativeLayout {
});
MessageListPanelHelper.getInstance().notifyAddMessage(message);
}
}
......@@ -281,15 +281,16 @@
<!--用户评论banner-->
<LinearLayout
android:id="@+id/comment_banner_view_ll"
android:layout_width="match_parent"
android:layout_height="37dp"
android:background="#ffffff"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="5dp"
android:paddingRight="10dp"
android:visibility="gone">
android:id="@+id/comment_banner_view_ll"
android:layout_width="match_parent"
android:layout_height="37dp"
android:background="#ffffff"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingLeft="5dp"
android:paddingRight="10dp"
android:visibility="gone"
tools:visibility="visible">
<TextView
android:id="@+id/im_focus_btn"
......@@ -302,16 +303,16 @@
tools:text="关注" />
<View
android:layout_width="0.5dp"
android:layout_height="match_parent"
android:layout_marginLeft="5dp"
android:background="#F0F0F0" />
android:layout_width="0.5dp"
android:layout_height="match_parent"
android:layout_marginLeft="5dp"
android:background="#F0F0F0" />
<com.yidianling.uikit.business.session.view.ImCommentBannerView
android:id="@+id/comment_banner_view"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"></com.yidianling.uikit.business.session.view.ImCommentBannerView>
android:id="@+id/comment_banner_view"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<TextView
android:layout_width="wrap_content"
......@@ -487,12 +488,14 @@
android:background="@drawable/im_bg_im_consult_action"
android:gravity="center"
android:paddingLeft="17dp"
android:paddingRight="11dp">
android:paddingRight="11dp"
android:visibility="gone"
tools:visibility="visible">
<TextView
android:id="@+id/action_yuyue"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_height="36dp"
android:gravity="center"
android:paddingLeft="5dp"
android:text="立即咨询"
......
apply plugin: 'maven'
def mavenRepositoryUrl = "http://nexus.yidianling.com/repository/AndroidReleases/"
def getVersionName() {
return hasProperty('VERSION_NAME') ? VERSION_NAME : rootProject.ext.ydlPublishVersion[project.getName()]
}
task sourceJar(type:Jar){
classifier = 'source'
from android.sourceSets.main.java.srcDirs
}
artifacts {
archives sourceJar
}
afterEvaluate { project ->
uploadArchives {
repositories {
mavenDeployer {
pom.artifactId = "m-" + project.name + "-api"
pom.groupId = "com.ydl"
pom.version = project.version
repository(url: mavenRepositoryUrl) {
authentication(userName: "admin", password: "fjoi#1+#@")
}
// repository(url:mavenLocal().url)
}
}
}
uploadArchives.doFirst {
// log
println String.format(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n>>>>> [%s] 正在将[%s]版本的[%s]包上传到Maven的[%s]仓库 >>>>>\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
, project.getName()
, getVersionName()
, "aar"
, "release"
)
}
}
\ No newline at end of file
......@@ -4,4 +4,4 @@ include ':app',
':m-home',
':m-consultant', ':m-muse', ':m-fm', ':m-tests', ":m-course",
":m-im",":m-dynamic","m-article","m-audioim","m-user","m-confide"
include ':ydl-tuicore'
include ':ydl-tuicore',':api:confide'
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