Commit b537cadc by 万齐军

Merge branch 'darren_confide_2.0' into 'd/v_confide_2.0'

fix bug mr改动

See merge request app_android_lib/YDL-Component!93
parents d4370995 d7f9853a
......@@ -12,10 +12,7 @@ import android.hardware.SensorEventListener
import android.hardware.SensorManager
import android.media.MediaPlayer
import android.net.Uri
import android.os.Build
import android.os.Handler
import android.os.PowerManager
import android.os.Vibrator
import android.os.*
import android.provider.Settings
import android.text.TextUtils
import android.view.View
......@@ -189,7 +186,7 @@ class AudioHomeActivity :
private var mPlayer: AudioPlayer? = null
private var vibrator: Vibrator? = null
private var handler: Handler? = null
private var phone_handler: Handler? = null
private var phoneHandler: Handler? = Handler(Looper.getMainLooper())
//声网
private var voiceManage: YDLVoiceManager? = null
......@@ -547,21 +544,19 @@ class AudioHomeActivity :
.sendRichLog(AliYunLogConfig.AGORA, "主叫方发送的邀请通话消息内容:$content")
localRemainTime = (totalDuration?:1500).minus(remainTime?.toInt()?:1500)
handler = Handler()
phone_handler = Handler()
vibrator = getSystemService(Service.VIBRATOR_SERVICE) as Vibrator?
vibrator = getSystemService(Service.VIBRATOR_SERVICE) as Vibrator?
var count = 0
phone_handler!!.postDelayed(object : Runnable {
phoneHandler?.postDelayed(object : Runnable {
override fun run() {
if(count % 2 == 0){
tv_tips.text = "正在发送倾诉请求…"
}else{
tv_tips.text = "正在等待聆听者接受邀请…"
}
count++
phone_handler!!.postDelayed({ this.run() }, 3000)
phoneHandler?.postDelayed({ this.run() }, 3000)
}
}, 3000)
......@@ -1109,7 +1104,7 @@ class AudioHomeActivity :
*/
private fun connectSuccess() {
isConnectSuccess = true
handler!!.removeCallbacksAndMessages(null)
phoneHandler?.removeCallbacksAndMessages(null)
//通知服务端,此次通话已经接通,服务端开始订单
updateExpertStatus(false, 0)
......@@ -1385,7 +1380,7 @@ class AudioHomeActivity :
override fun onDestroy() {
super.onDestroy()
uploadLog()
phone_handler?.removeCallbacksAndMessages(null)
phoneHandler?.removeCallbacksAndMessages(null)
if (isConnectSuccess) {
uploadException("", "zhu", "108", callback = null)
}
......@@ -1393,8 +1388,8 @@ class AudioHomeActivity :
handler = null
}
if (phone_handler != null){
phone_handler = null
if (phoneHandler != null){
phoneHandler = null
}
hasUpLoadLog = false
......
......@@ -63,7 +63,9 @@ import kotlinx.android.synthetic.main.confide_title_bar.*
* @date 2018/8/10
*/
@Route(path = ConfideRoute.R_CONFIDE_HOME)
class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHomeContract.Presenter>(),IConfideHomeContract.View,XRecyclerView.LoadingListener {
class ConfideHomeActivity :
BaseLceActivity<IConfideHomeContract.View, IConfideHomeContract.Presenter>(),
IConfideHomeContract.View, XRecyclerView.LoadingListener {
private var listenFree = false
......@@ -82,10 +84,12 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
//是否从启动页直接进入
var isSplash: Boolean = false
/**
* 倾诉首页适配器
*/
private var mConfideAdapter: ConfideHomeAdapter? = null
/**
* 倾诉首页事件处理类
*/
......@@ -103,16 +107,21 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
* 页(从第二页开始)
*/
private var page: Int = 1
//筛选参数bean
private var allFiltersBean: ConfideHomeAllFiltersBean? = null
//用于置顶筛选模块监听
private var listScrollListener: ConfideHomeRecycleViewListener? = null
//用于显示筛选悬浮View
private var listSuspendListener: ConfideHomeRecyleSuspendListener? = null
//是否有下一页(用于判断为你推荐条数,如果首页返回少于10条 那么就可以认为没有下一页了) 默认有下一页
private var hasMore = true
private var dp48 = 0
private var bottomSheetDialogFragment: ConfideBottomSheetDialogFragment? = null
init {
//初始化参数
initParam()
......@@ -121,11 +130,12 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
private fun initParam() {
allFiltersBean = ConfideHomeAllFiltersBean(
page,
ConfideHomeFiterItemBean("1", ""),
ConfideHomeFiterItemBean("-1", ""),
ArrayList(),
ArrayList())
page,
ConfideHomeFiterItemBean("1", ""),
ConfideHomeFiterItemBean("-1", ""),
ArrayList(),
ArrayList()
)
}
override fun getContext(): Context {
......@@ -171,12 +181,12 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
} else if (page > 1) {
var listData = mConfideAdapter?.getList()
var notUidList = ArrayList<Int>()
if (listData!=null){
for (bean in listData){
if (listData != null) {
for (bean in listData) {
//列表类型数组
if (bean.type==5 && bean.body!=null){
for (bean in bean.body){
notUidList.add(bean.uid?:0)
if (bean.type == 5 && bean.body != null) {
for (bean in bean.body) {
notUidList.add(bean.uid ?: 0)
}
}
}
......@@ -188,7 +198,7 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
override fun initDataAndEvent() {
//来自首页倾诉红包入口
val isFromRed = intent.getBooleanExtra(IYDLRouterConstant.EXTRA_RED_PACKET,false)
val isFromRed = intent.getBooleanExtra(IYDLRouterConstant.EXTRA_RED_PACKET, false)
val confidedId = intent.getStringExtra(IYDLRouterConstant.EXTRA_CONFIDEDID)
val doctorId = intent.getStringExtra(IYDLRouterConstant.EXTRA_DOCTORID)
......@@ -212,18 +222,23 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
// .load(R.drawable.confide__free)
// .diskCacheStrategy(DiskCacheStrategy.RESOURCE)
// .into(confide_Free)
if (isFromRed){
ToastUtil.toastLong(this@ConfideHomeActivity,"红包已领取成功 可立即点击拨打")
}
if (!confidedId.isNullOrBlank() && !doctorId.isNullOrBlank()){
ConfideWebServiceImpl().connectionJava(confidedId.toInt(), 3, this@ConfideHomeActivity, null) {
showDoctorDetail(confidedId,doctorId)
if (isFromRed) {
ToastUtil.toastLong(this@ConfideHomeActivity, "红包已领取成功 可立即点击拨打")
}
if (!confidedId.isNullOrBlank() && !doctorId.isNullOrBlank()) {
ConfideWebServiceImpl().connectionJava(
confidedId.toInt(),
3,
this@ConfideHomeActivity,
null
) {
showDoctorDetail(confidedId, doctorId)
}
}
}
private fun showDoctorDetail(confideId: String,doctorId:String) {
private fun showDoctorDetail(confideId: String, doctorId: String) {
val url = HttpConfig.MH5_URL + ConfideRoute.h5ConfideIntro(confideId)+"&payPage=1"
ConfideBottomSheetDialogFragment()
.showBottomSheetDialog(this@ConfideHomeActivity, url, doctorId)
......@@ -237,19 +252,18 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
private fun handleFree() {
//登录了回来之后就不显示了
val isLogin = (findRouteService(IUserService::class.java).isLogin())
findViewById<View>(R.id.confide_Free).visibility = if (isLogin) View.GONE else View.VISIBLE
if (!isLogin){
if (!isLogin) {
val controller: DraweeController = Fresco.newDraweeControllerBuilder()
.setUri(Uri.parse("res://drawable/"+R.drawable.first_order))
.setUri(Uri.parse("res://drawable/" + R.drawable.first_order))
.setOldController(confide_Free.controller)
.setAutoPlayAnimations(true) // 是否自动播放Gif动画
.build()
confide_Free.controller = controller
}
if (isLogin) {
findViewById<View>(R.id.confideRed).visibility = if (listenFree) View.VISIBLE else View.GONE
findViewById<View>(R.id.confideRed).visibility =
if (listenFree) View.VISIBLE else View.GONE
(quick_consult_btn.layoutParams as? ViewGroup.MarginLayoutParams)?.rightMargin =
if (listenFree) dp48 / 2 else 0
}
......@@ -275,7 +289,7 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
rv_list.addOnScrollListener(object : RecyclerView.OnScrollListener() {
override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
super.onScrollStateChanged(recyclerView, newState)
if (newState==RecyclerView.SCROLL_STATE_IDLE){
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
quick_consult_card.visibility = View.VISIBLE
}
// val layoutManager: RecyclerView.LayoutManager = recyclerView?.layoutManager!!
......@@ -292,10 +306,10 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
super.onScrolled(recyclerView, dx, dy)
if (dy<=0){
if (dy <= 0) {
//向上滚动恢复显示
quick_consult_card.visibility = View.VISIBLE
}else{
} else {
//向下滚动隐藏
quick_consult_card.visibility = View.GONE
}
......@@ -309,11 +323,16 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
private fun initClick() {
quick_consult_card.setOnClickListener {
ActionCountUtils.record("listen_counselor_list_page", "akey_consult_icon_click")
if (!PhoneCallIn.loginByOneKeyLogin(this,true)) {
if (!PhoneCallIn.loginByOneKeyLogin(this, true)) {
return@setOnClickListener
}
bottomSheetDialogFragment=ConfideBottomSheetDialogFragment()
bottomSheetDialogFragment?.showBottomSheetDialog(this as FragmentActivity, HttpConfig.MH5_URL + ConfideRoute.h5ConfideIntro("0"),"0",true)
bottomSheetDialogFragment = ConfideBottomSheetDialogFragment()
bottomSheetDialogFragment?.showBottomSheetDialog(
this as FragmentActivity,
HttpConfig.MH5_URL + ConfideRoute.h5ConfideIntro("0"),
"0",
true
)
}
......@@ -324,21 +343,21 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
finish()
}
img_mine.setOnClickListener {
//跳转倾诉列表
ActionCountUtils.record("listen_counselor_list_page", "topright_corner_icon_click","1")
if (!PhoneCallIn.loginByOneKeyLogin(this,true)) {
//跳转倾诉列表
ActionCountUtils.record("listen_counselor_list_page", "topright_corner_icon_click", "1")
if (!PhoneCallIn.loginByOneKeyLogin(this, true)) {
return@setOnClickListener
}
val h5Paramsqing = H5Params(YDL_H5 + "confideOrderList", null)
NewH5Activity.start(this, h5Paramsqing)
}
findViewById<View>(R.id.img_customer)?.setOnClickListener {
ActionCountUtils.record("listen_counselor_list_page", "topright_corner_icon_click","2")
ActionCountUtils.record("listen_counselor_list_page", "topright_corner_icon_click", "2")
val imService = findRouteService(IImService::class.java)
imService.startP2PXiaoYi(this)
}
findViewById<View>(R.id.img_help)?.setOnClickListener {
ActionCountUtils.record("listen_counselor_list_page", "topright_corner_icon_click","3")
ActionCountUtils.record("listen_counselor_list_page", "topright_corner_icon_click", "3")
val params = H5Params("https://activity.yidianling.com/activity/qs", "")//倾诉指南
params.isShowMenu = true
NewH5Activity.start(this, params)
......@@ -370,7 +389,8 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
mConfideAdapter = ConfideHomeAdapter(ConfideHomeActivity@ this, mConfideEvent!!, this)
}
rv_list.addItemDecoration(FilterItemDecoration())
val layoutManager = WrapContentLinearLayoutManager(this, WrapContentLinearLayoutManager.VERTICAL, false)
val layoutManager =
WrapContentLinearLayoutManager(this, WrapContentLinearLayoutManager.VERTICAL, false)
rv_list.layoutManager = layoutManager
rv_list.setRefreshProgressStyle(ProgressStyle.BallSpinFadeLoader)
rv_list.setRefreshProgressStyle(ProgressStyle.BallSpinFadeLoader)
......@@ -480,7 +500,7 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
dismissProgressDialog()
rv_list.loadMoreComplete()
bean.recommendId = page
if(bean.body?.size?:0==0) {
if (bean.body?.size ?: 0 == 0) {
rv_list.loadMoreComplete()
mConfideAdapter!!.notifyDataSetChanged()
return
......@@ -538,7 +558,11 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
listScrollListener?.moveToPosition(rv_list)
}
override fun showSortPopupWindow(v_line_top: View, tvSort: DrawableRightTextView, bodyBean: ConfideHomeBodyBean?) {
override fun showSortPopupWindow(
v_line_top: View,
tvSort: DrawableRightTextView,
bodyBean: ConfideHomeBodyBean?
) {
ActionCountUtils.record("listen_counselor_list_page", "choice_filter_click")
if (null == allFiltersBean) {
return
......@@ -546,10 +570,20 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
if (v_filterView.visibility == View.GONE || v_filterView.visibility == View.INVISIBLE) {
listScrollListener?.moveToPosition(rv_list)
}
mConfideEvent?.showSortPopupWindow(v_line_top, v_filterView, bodyBean, allFiltersBean!!, mConfideAdapter!!)
mConfideEvent?.showSortPopupWindow(
v_line_top,
v_filterView,
bodyBean,
allFiltersBean!!,
mConfideAdapter!!
)
}
override fun showSexAgePopupWindow(v_line_top: View, tvSexAge: DrawableRightTextView, bodyBean: ConfideHomeBodyBean?) {
override fun showSexAgePopupWindow(
v_line_top: View,
tvSexAge: DrawableRightTextView,
bodyBean: ConfideHomeBodyBean?
) {
ActionCountUtils.record("listen_counselor_list_page", "choice_filter_click")
if (null == allFiltersBean) {
return
......@@ -557,10 +591,20 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
if (v_filterView.visibility == View.GONE || v_filterView.visibility == View.INVISIBLE) {
listScrollListener?.moveToPosition(rv_list)
}
mConfideEvent?.showSexAgePopupWindow(v_line_top, v_filterView, bodyBean, allFiltersBean!!, mConfideAdapter!!)
mConfideEvent?.showSexAgePopupWindow(
v_line_top,
v_filterView,
bodyBean,
allFiltersBean!!,
mConfideAdapter!!
)
}
override fun showGoodPopupWindow(v_line_top: View, tvGood: DrawableRightTextView, bodyBean: ConfideHomeBodyBean?) {
override fun showGoodPopupWindow(
v_line_top: View,
tvGood: DrawableRightTextView,
bodyBean: ConfideHomeBodyBean?
) {
ActionCountUtils.record("listen_counselor_list_page", "choice_filter_click")
if (null == allFiltersBean) {
return
......@@ -568,7 +612,13 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
if (v_filterView.visibility == View.GONE || v_filterView.visibility == View.INVISIBLE) {
listScrollListener?.moveToPosition(rv_list)
}
mConfideEvent?.showGoodPopupWindow(v_line_top, v_filterView, bodyBean, allFiltersBean!!, mConfideAdapter!!)
mConfideEvent?.showGoodPopupWindow(
v_line_top,
v_filterView,
bodyBean,
allFiltersBean!!,
mConfideAdapter!!
)
}
private fun showError() {
......@@ -580,7 +630,7 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
rv_list.visibility = View.VISIBLE
}
override fun showError1(msg: String?){
override fun showError1(msg: String?) {
rv_list.loadMoreComplete()
msg?.let {
......
......@@ -145,8 +145,13 @@ internal class ItemIntroHolder(binding: ItemExpertIntroBinding) :
shareUrl += "?id=${item.confideId}"
}
val dialog = YDLShareDialog.style8(
aty, "${item.name.get()}_${item.title.get()}", shareUrl, "壹点灵心理服务平台让天下人更快乐", item.avatar.get(),
genMinProgramPath(shareUrl), "gh_25b90294ddcc"
aty,
"${item.name.get()}_${item.title.get()}",
shareUrl,
"壹点灵心理服务平台让天下人更快乐",
item.avatar.get(),
genMinProgramPath(shareUrl),
"gh_25b90294ddcc"
)
dialog.show(aty.fragmentManager, "share")
}
......@@ -201,13 +206,12 @@ 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.first_order))
.setOldController(binding.confideFirstFree.controller)
.setAutoPlayAnimations(true) // 是否自动播放Gif动画
.build()
binding.confideFirstFree.controller = controller
binding.seekbar.progress = 0
binding.seekbar.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
......@@ -302,7 +306,12 @@ internal class ItemIntroHolder(binding: ItemExpertIntroBinding) :
item.confideId?.let {
val url = HttpConfig.MH5_URL + ConfideRoute.h5ConfideIntro(it)+ if(toPay) "&payPage=1" else ""
ConfideBottomSheetDialogFragment()
.showBottomSheetDialog(itemView.context as FragmentActivity, url, item.doctorId!!, uid = item.uid)
.showBottomSheetDialog(
itemView.context as FragmentActivity,
url,
item.doctorId!!,
uid = item.uid
)
}
}
}
......
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