Commit f961eb92 by 洪国微

stash

parent f6209eb8
......@@ -4,7 +4,7 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'trace-point'
//apply plugin: 'trace-point'
kapt {
arguments {
......@@ -175,20 +175,20 @@ dependencies {
kapt 'com.alibaba:arouter-compiler:1.2.2'
}
noTracePoint{
outputModifyFile = false
targetPackages = ['com.cxzapp.yidianling',
'com.yidianling.consultant',
'com.yidianling.course',
'com.yidianling.dynamic',
'com.ydl.home_module',
'com.yidianling.fm',
'com.yidianling.im',
'com.yidianling.avchatkit',
'com.yidianling.uikit',
'com.yidianling.phonecall',
'com.yidianling.tests',
'com.yidianling.user',
'com.yidianling.ydlcommon',
]
}
\ No newline at end of file
//noTracePoint{
// outputModifyFile = false
// targetPackages = ['com.cxzapp.yidianling',
// 'com.yidianling.consultant',
// 'com.yidianling.course',
// 'com.yidianling.dynamic',
// 'com.ydl.home_module',
// 'com.yidianling.fm',
// 'com.yidianling.im',
// 'com.yidianling.avchatkit',
// 'com.yidianling.uikit',
// 'com.yidianling.phonecall',
// 'com.yidianling.tests',
// 'com.yidianling.user',
// 'com.yidianling.ydlcommon',
// ]
//}
\ No newline at end of file
apply from: "config.gradle"
buildscript {
ext.kotlin_version = '1.3.21'
ext {
kotlin_version = '1.3.21'
support_version = '26.1.0'
......@@ -16,7 +15,7 @@ buildscript {
}
repositories {
google()
maven{
maven {
url 'http://nexus.yidianling.com/repository/AndroidReleases/'
}
jcenter()
......@@ -103,7 +102,7 @@ modular {
}
repositories {
maven{
maven {
url 'http://nexus.yidianling.com/repository/AndroidReleases/'
credentials {
username "admin"
......
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
kapt {
arguments {
arg("AROUTER_MODULE_NAME", project.getName())
}
}
android {
compileSdkVersion rootProject.ext.android["compileSdkVersion"]
buildToolsVersion rootProject.ext.android["buildToolsVersion"]
defaultConfig {
minSdkVersion rootProject.ext.android["minSdkVersion"]
targetSdkVersion rootProject.ext.android["targetSdkVersion"]
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
flavorDimensions "versionCode"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
buildConfigField "String", "AGORA_APPID", "3387e9b251f3491e9221a9877e8f7830"
}
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
buildConfigField "String", "AGORA_APPID", "13b1536698f64905a1e7e5bb978ba821"
}
}
publishNonDefault true
productFlavors {
ydl {}
xlzx {}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
// 注意此处的依赖方式:kotlin中使用和java中使用方式有不同
kapt "com.alibaba:arouter-compiler:$arouter_compiler"
implementation project(":ydl-platform")
api "com.alibaba:arouter-api:$arouter_api"
implementation ('com.ydl:ydl-av:1.1.8@aar'){
transitive = true
}
implementation project(":ydl-webview")
}
modular {
packageName "com.ydl.audioim"
// 模块发布需要的参数
publish {
modules {
xlzx {
//发布信息 module/api 通用
groupId = "com.ydl"
artifactId = "m-audioim-module-xlzx"
// 上报的业务模块 aar 包的版本号
version = "0.0.1"
}
ydl{
//发布信息 module/api 通用
groupId = "com.ydl"
artifactId = "m-audioim-module-ydl"
// 上报的业务模块 aar 包的版本号
version = "0.0.1"
}
}
api {
//发布信息 module/api 通用
groupId = "com.ydl"
artifactId = "m-audioim-api"
// version = "0.0.1"
// API 层打包时需要引入的依赖
apiDependencies {
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
# 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
package com.ydl.audioim
import android.support.test.InstrumentationRegistry
import android.support.test.runner.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.example.m_audioim.test", appContext.packageName)
}
}
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ydl.audioim" >
<uses-permission android:name="android.permission.VIBRATE" />
<application>
<activity
android:name=".AudioHomeActivity"
android:screenOrientation="portrait" />
</application>
</manifest>
package com.ydl.audioim
import com.ydl.audioim.api.IAVRouter
class AVRouterImpl: IAVRouter {
override fun loginAgora(userId: String?) {
YDLavManager.instances.login(userId)
}
}
\ No newline at end of file
package com.ydl.audioim
import android.Manifest
import android.annotation.SuppressLint
import android.app.Service
import android.content.Context
import android.content.Intent
import android.graphics.Color
import android.graphics.Paint
import android.hardware.Sensor
import android.hardware.SensorEvent
import android.hardware.SensorEventListener
import android.hardware.SensorManager
import android.media.MediaPlayer
import android.net.Uri
import android.os.Handler
import android.os.PowerManager
import android.os.Vibrator
import android.provider.Settings
import android.support.v4.content.ContextCompat
import android.text.TextUtils
import android.view.View
import android.view.animation.AccelerateInterpolator
import com.alibaba.android.arouter.facade.annotation.Route
import com.google.gson.Gson
import com.tbruyelle.rxpermissions2.RxPermissions
import com.ydl.ydl_av.messge_service.ChannelManager
import com.ydl.ydl_av.messge_service.YDLRTMClient
import com.ydl.ydl_av.messge_service.bean.RTMMesssage
import com.ydl.ydl_av.messge_service.callback.CallListener
import com.ydl.ydl_av.messge_service.callback.ChannelListener
import com.ydl.ydl_av.messge_service.response.CallLocalResponse
import com.ydl.ydl_av.messge_service.response.CallRemoteResponse
import com.ydl.ydl_av.messge_service.response.ChannelMember
import com.ydl.ydl_av.voice.listener.IYDLVoiceEventHandler
import com.ydl.ydl_av.voice.manager.YDLVoiceManager
import com.ydl.ydl_image.config.SimpleImageOpConfiger
import com.ydl.ydl_image.manager.YDLImageCacheManager
import com.ydl.ydl_av.chat.bean.AudioMessageBean
import com.ydl.audioim.contract.IAudioHomeActivityContract
import com.ydl.audioim.http.command.ConnectCommand
import com.ydl.audioim.http.command.ConnectFinishCommand
import com.ydl.audioim.http.command.ConnectStartCommand
import com.ydl.audioim.http.command.NoticePushCommand
import com.ydl.audioim.player.AudioPlayer
import com.ydl.audioim.presenter.AudioHomePresenterImpl
import com.ydl.audioim.utils.DateUtils
import com.ydl.audioim.widget.AxbConfirmDialog
import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity
import com.ydl.webview.RefreshWebEvent
import com.ydl.ydlcommon.base.BaseActivity
import com.ydl.ydlcommon.base.BaseMvpActivity
import com.ydl.ydlcommon.mvp.lce.BaseLceActivity
import com.ydl.ydlcommon.router.YdlCommonRouterManager
import com.ydl.ydlcommon.utils.StatusBarUtils
import com.ydl.ydlcommon.utils.UMEventUtils
import com.yidianling.common.tools.LogUtil
import com.yidianling.common.tools.ToastUtil
import de.greenrobot.event.EventBus
import io.agora.rtc.IRtcEngineEventHandler
import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
import io.reactivex.schedulers.Schedulers
import kotlinx.android.synthetic.main.activity_audio_home.*
import java.util.concurrent.TimeUnit
/**
* @author jiucheng
* @描述: 声网通话页面
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/10/30
*/
@Route(path = "/av/AudioHomeActivity")
class AudioHomeActivity : BaseMvpActivity<IAudioHomeActivityContract.View, IAudioHomeActivityContract.Presenter>(),IAudioHomeActivityContract.View, SensorEventListener {
/**
* 专家头像地址
*/
private var expertHeadUrl: String? = null
/**
* 专家姓名
*/
private var expertName: String? = null
/**
* 专家文案
*/
private var expertTips: String? = null
/**
* 声网点对点聊天房间id
*/
private var channelId: String? = null
/**
* 通话开始时间(接通)
*/
private var callStartTime:Long? = null
/**
* 倾诉剩余时长(时长单位s,eg:剩余2min15s,返回135)
*/
private var remainTime: String? = null
/**
*聆听者id(不是聆听者的uid)
*/
private var listenId: String? = null
/**
* token
*/
private var token: String? = null
/**
* commentUrl 评价页URL
*/
private var commentUrl: String? = null
/**
* callId
*/
private var callId: String? = null
/**
* relation_id
*/
private var relationId: String? = null
/**
* listenerUid专家uid
*/
private var listenerUid: String? = null
/**
* 倾述总时长
*/
private var totalDuration: Int? = 0
/**
* 本地记录的当前剩余时间
*/
private var localRemainTime: Int? = 0
/**
* 60s自动挂断倒计时
*/
private var waitDisposable: Disposable? = null
/**
* 45s倒计时
*/
private var disposable: Disposable? = null
/**
* 本次倾述倒计时
*/
private var totalDisposable: Disposable? = null
/**
* 是否连接成功
*/
private var isConnectSuccess: Boolean = false
//电源管理对象
private var localPowerManager: PowerManager? = null
//电源锁
private var localWakeLock: PowerManager.WakeLock? = null
private var sensorManager: SensorManager? = null
private var axbPhone: String? = null
//是否跳转到拨号页面
private var isJumpDail: Boolean = false
private var mPlayer: AudioPlayer? = null
private var vibrator: Vibrator? = null
private var handler: Handler? = null
//声网
private var voiceManage: YDLVoiceManager? = null
//频道管理器
private var channelManager : ChannelManager? = null
/**
* 声网事件回调 (SDK 通过指定的事件通知应用程序 SDK 的运行事件,如: 加入或离开频道,新用户加入频道等)
*/
private val mRtcEventHandler = object : IYDLVoiceEventHandler() {
override fun onUserMuteAudio(uid: Int, muted: Boolean) {
}
override fun onWarning(warn: Int) {
super.onWarning(warn)
//103:没有可用的频道资源。可能是因为服务端没法分配频道资源
//104:查找频道超时。在加入频道时 SDK 先要查找指定的频道,出现该警告一般是因为网络太差,连接不到服务器
//105:查找频道请求被服务器拒绝。服务器可能没有办法处理这个请求或请求是非法的
//106:打开频道超时。查找到指定频道后,SDK 接着打开该频道,超时一般是因为网络太差,连接不到服务器
//107:打开频道请求被服务器拒绝。服务器可能没有办法处理该请求或该请求是非法的
LogUtil.e("[agora]发生警告回调$warn")
runOnUiThread {
when (warn) {
103, 104, 105, 106, 107 -> {
showToast("当前网络较差,请更换网络!")
leaveChannel()
}
}
}
}
override fun onError(err: Int) {
super.onError(err)
//3:SDK 初始化失败。Agora 建议尝试以下处理方法
//7:SDK 尚未初始化,就调用其 API。请确认在调用 API 之前已创建 RtcEngine 对象并完成初始化
//10:API 调用超时。有些 API 调用需要 SDK 返回结果,如果 SDK 处理时间过长,超过 10 秒没有返回,会出现此错误
//17:加入频道被拒绝。一般有以下原因:
//用户已进入频道,再次调用加入频道的 API,例如 joinChannel,会返回此错误。停止调用该方法即可。
//用户在做 Echo 测试时尝试加入频道。等待 Echo test 结束后再加入频道即可。
//101:不是有效的 APP ID。请更换有效的 APP ID 重新加入频道
//102:不是有效的 频道名。请更换有效的频道名重新加入频道
//109:当前使用的 Token 过期,不再有效
//110:生成的 Token 无效
//123:此用户被服务器禁止
LogUtil.e("[agora]发生错误回调$err")
runOnUiThread {
when (err) {
3, 7, 109, 110 -> {
showToast("请退出应用,重新打开")
leaveChannel()
}
10, 17 -> {
showToast("当前网络较差,请更换网络")
leaveChannel()
}
101 -> {
showToast("安装包有问题,请联系技术")
leaveChannel()
}
102 -> {
showToast("频道错误,请联系技术")
leaveChannel()
}
123 -> {
showToast("当前用户不允许接听电话,请联系客服")
leaveChannel()
}
else -> {
//异常关闭
leaveChannel()
}
}
}
}
override fun onApiCallExecuted(error: Int, api: String?, result: String?) {
super.onApiCallExecuted(error, api, result)
LogUtil.e("[agora]$api 已执行回调 $result")
}
override fun onJoinChannelSuccess(channel: String?, uid: Int, elapsed: Int) {
super.onJoinChannelSuccess(channel, uid, elapsed)
LogUtil.e("[agora]$uid 用户声网加入频道成功:channel=$channel")
//更新ui
onJoinChannelSuccess()
}
override fun onLeaveChannel(stats: IRtcEngineEventHandler.RtcStats?) {
super.onLeaveChannel(stats)
LogUtil.e("[agora]离开频道回调")
}
override fun onLastmileQuality(quality: Int) {
super.onLastmileQuality(quality)
LogUtil.e("[agora]网络质量报告回调${quality}")
}
override fun onConnectionInterrupted() {
super.onConnectionInterrupted()
LogUtil.e("[agora]连接中断回调")
}
override fun onUserJoined(uid: Int, elapsed: Int) {
super.onUserJoined(uid, elapsed)
LogUtil.e("[agora]远端用户/主播加入频道回调")
runOnUiThread {
//另一方加入频道成功
connectSuccess()
}
}
override fun onUserOffline(uid: Int, elapsed: Int) {
super.onUserOffline(uid, elapsed)
LogUtil.e("[agora]远端用户$uid 离开频道回调")
showToast("专家已挂断")
if (totalDisposable != null) {
totalDisposable!!.dispose()
}
handler!!.postDelayed({
//另一方离开频道
updateExpertStatus(false, 1)
}, 500)
}
}
//
override fun createPresenter(): IAudioHomeActivityContract.Presenter {
return AudioHomePresenterImpl()
}
override fun layoutResId(): Int {
return R.layout.activity_audio_home
}
override fun initDataAndEvent() {
//状态栏颜色
setWindowStatusBarColor()
//初始化传感器
initSensorManager()
//页面传递数据初始化
initIntentData()
//view初始化
initView()
//设置信令的回调
setCallBack()
//点击事件
setClickEvent()
//权限申请
requestPermission()
}
private fun setWindowStatusBarColor() {
StatusBarUtils.setWindowStatusBarColor(this, R.color.color_40353535)
}
@SuppressLint("InvalidWakeLockTag")
private fun initSensorManager() {
sensorManager = getSystemService(Context.SENSOR_SERVICE) as SensorManager?
localPowerManager = getSystemService(POWER_SERVICE) as PowerManager?
localWakeLock = localPowerManager!!.newWakeLock(PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK, "yidianling")
}
private fun initIntentData() {
expertHeadUrl = intent.getStringExtra(IntentConstants.INTENT_EXPERT_HEAD_URL)
expertName = intent.getStringExtra(IntentConstants.INTENT_EXPERT_NAME)
expertTips = intent.getStringExtra(IntentConstants.INTENT_EXPERT_TIPS)
totalDuration = intent.getStringExtra(IntentConstants.INTENT_TOTAL_DURATION).toInt()
channelId = intent.getStringExtra(IntentConstants.INTENT_ROOM_ID)
remainTime = intent.getStringExtra(IntentConstants.INTENT_REMAIN_TIME)
callId = intent.getStringExtra(IntentConstants.INTENT_CALL_ID)
relationId = intent.getStringExtra(IntentConstants.INTENT_RELATION_ID)
token = intent.getStringExtra(IntentConstants.INTENT_TOKEN)
listenerUid = intent.getStringExtra(IntentConstants.INTENT_LISTENER_UID)
listenId = intent.getStringExtra(IntentConstants.INTENT_LISTEN_ID)
commentUrl = intent.getStringExtra(IntentConstants.INTENT_COMMENT_URL)
localRemainTime = remainTime?.toInt()
handler = Handler()
vibrator = getSystemService(Service.VIBRATOR_SERVICE) as Vibrator?
}
private fun initView() {
tv_change_route.isEnabled = false
//水波纹view初始化
wave_view.setDuration(6000)
wave_view.setStyle(Paint.Style.STROKE)
wave_view.setSpeed(1000)
wave_view.setColor(Color.WHITE)
wave_view.setInitialRadius(140f)
wave_view.setInterpolator(AccelerateInterpolator(1.2f))
//挂断按钮默认不可点击
iv_hang_up.isEnabled = false
//设置默认关闭扬声器
iv_hands_free.isSelected = false
tv_name.text = expertName
tv_tips.text = expertTips
tv_remain_time.text = DateUtils.formatTime(remainTime)
if (!TextUtils.isEmpty(expertHeadUrl)) {
var option = SimpleImageOpConfiger()
option.errorPic = R.drawable.head_place_hold_pic
option.loadingPic = R.drawable.head_place_hold_pic
option.transform = 0
YDLImageCacheManager.showImage(this, expertHeadUrl, iv_head, option)
}
}
private fun setClickEvent() {
//切换线路
tv_change_route.setOnClickListener { showChooseDialog() }
//挂断
iv_hang_up.setOnClickListener {
if (isConnectSuccess) {
updateExpertStatus(false, 1)
} else {
userCloseCalling()
}
}
//免提
iv_hands_free.setOnClickListener {
if (iv_hands_free.isSelected) {
iv_hands_free.isSelected = false
iv_hands_free.setImageResource(R.drawable.audio_home_img_hands_free_unuse)
} else {
iv_hands_free.isSelected = true
iv_hands_free.setImageResource(R.drawable.audio_home_img_hands_free)
}
//已经接通
if (isConnectSuccess) {
//是否开启外放
voiceManage!!.getVoiceApi().setEnableSpeakerphone(iv_hands_free.isSelected)
} else {
//未接通
if (mPlayer != null) {
mPlayer!!.switchPlayType(iv_hands_free.isSelected)
}
}
}
}
private fun setCallBack() {
YDLRTMClient.instances.setCallListener(object :CallListener{
override fun onCallRecivedByPeer(response: CallLocalResponse?) {
//返回给主叫:被叫已收到呼叫邀请
LogUtil.i("[agora]${response?.calleeId}已收到呼叫邀请,频道号${response?.ChannelId}")
}
override fun onCallAccepted(response: CallLocalResponse?) {
//返回给主叫
LogUtil.i("[agora]${response?.calleeId}已接收呼叫邀请")
}
override fun onCallRefused(response: CallLocalResponse?) {
//返回给主叫
LogUtil.i("[agora]${response?.calleeId}已拒绝呼叫邀请")
ToastUtil.toastShort("对方已拒绝")
leaveChannel()
}
override fun onCallCanceled(response: CallLocalResponse?) {
//返回给主叫
LogUtil.i("[agora]主叫已取消呼叫邀请")
}
override fun onCallFailure(response: CallLocalResponse?) {
//返回给主叫
LogUtil.i("[agora]呼叫${response?.calleeId}用户失败:${response?.response}")
}
override fun onRemoteInvitationReceived(response: CallRemoteResponse?) {
//返回给被叫
LogUtil.i("[agora]收到来自${response?.callerId}的呼叫邀请")
}
override fun onRemoteInvitationAccepted(response: CallRemoteResponse?) {
//返回给被叫
LogUtil.i("[agora]接受来自${response?.callerId}的呼叫成功")
}
override fun onRemoteInvitationRefused(response: CallRemoteResponse?) {
//返回给被叫
LogUtil.i("[agora]已拒绝来自${response?.callerId}的呼叫")
}
override fun onRemoteInvitationCanceled(response: CallRemoteResponse?) {
//返回给被叫
LogUtil.i("[agora]主叫${response?.callerId}已取消呼叫邀请")
}
override fun onRemoteInvitationFailure(response: CallRemoteResponse?) {
//返回给被叫
LogUtil.i("[agora]来自主叫${response?.callerId}的呼叫邀请进程失败:${response?.response}")
}
override fun onOtherMsg(error: String?) {
LogUtil.i("[agora]其它消息:${error}")
}
})
channelManager = YDLRTMClient.instances.createChannelManager(channelId,object :ChannelListener{
override fun onMemberCountUpdated(memberCount: Int) {
//频道人数更新
LogUtil.i("[agora]当前频道人数:$memberCount")
}
override fun onMessageReceived(message: RTMMesssage?, member: ChannelMember?) {
//接到频道消息
LogUtil.i("[agora]接到${member?.channelId}频道${member?.userId}的消息:"+message?.text)
}
override fun onMemberJoined(member: ChannelMember?) {
//新用户加入频道
LogUtil.i("[agora]新用户加入${member?.channelId}频道:${member?.userId}")
}
override fun onMemberLeft(member: ChannelMember?) {
LogUtil.i("[agora]有用户离开${member?.channelId}频道:${member?.userId}")
}
})
}
/**
* 请求权限
*/
private fun requestPermission() {
val rxPermissions = RxPermissions(this)
rxPermissions.requestEach(Manifest.permission.RECORD_AUDIO)
.subscribe { permission ->
if (permission.granted) {
init()
} else if (permission.shouldShowRequestPermissionRationale) {
requestPermission()
} else {
ToastUtil.toastLong(this, getString(R.string.need_storage_permission_hint))
val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS)
val uri = Uri.fromParts("package", packageName, null)
intent.data = uri
startActivity(intent)
finish()
}
}
}
private fun init() {
wave_view.start()
//初始化声网
initializeAgoraEngine()
//发起呼叫
var msgBean = AudioMessageBean(
1,
channelId!!,
YdlCommonRouterManager.getYdlCommonRoute().getUid().toString(),
YdlCommonRouterManager.getYdlCommonRoute().getUserInfo()!!.headUrl,
YdlCommonRouterManager.getYdlCommonRoute().getUserInfo()!!.userName,
remainTime!!.toInt(),
relationId,
callId,
null,
channelId
)
YDLRTMClient.instances.call(listenerUid!!,channelId,Gson().toJson(msgBean))
//开始25s等待倒计时
Observable.interval(0, 100, TimeUnit.MILLISECONDS)
.subscribeOn(Schedulers.computation())
.take(253)
.observeOn(AndroidSchedulers.mainThread())
.subscribe({
progress_view.setProgress(it.toFloat() / 2.5f)
}, {
LogUtil.d(it.message)
}, {
waittingStatus()
if (!isConnectSuccess){
iv_hang_up.setImageResource(R.mipmap.ico_close)
//关闭音乐
stopPlaying()
//提示切换传统线路
//发送消息通知专家用户已挂断
YDLRTMClient.instances.cancelCall(listenerUid,channelId)
showChooseDialog()
}
})
//加入频道
joinChannel()
//双重保险:加入频道成功,通过服务端发推送给专家
noticeServerPush(true)
}
/**
* 声网初始化
*/
private fun initializeAgoraEngine() {
//数据埋点
UMEventUtils.umEvent("ydl_android_login", "", "")
/**
* 创建一个实例
* param appId 应用id
* param mRtcEventHandler 事件回调(SDK 通过指定的事件通知应用程序 SDK 的运行事件,如: 加入或离开频道,新用户加入频道等)
*/
voiceManage = YDLVoiceManager(this, BuildConfig.AGORA_APPID, mRtcEventHandler)
voiceManage!!.init()
voiceManage!!.getVoiceApi().enableLastmileTest()
//默认听筒模式
voiceManage!!.getVoiceApi().setEnableSpeakerphone(false)
}
/**
* 声网加入频道
*/
private fun joinChannel() {
voiceManage!!.getVoiceApi().joinChannel(token!!, channelId!!, "Extra Optional Data", YdlCommonRouterManager.getYdlCommonRoute().getUid())
}
/**
* 用户主动挂断(包括:60s专家未接听自动挂断)
* 注意:这个方法只在专家还未接听的状态才能调用
*
*/
private fun userCloseCalling() {
//发送消息通知专家用户已挂断
YDLRTMClient.instances.cancelCall(listenerUid,channelId)
handler!!.postDelayed({
leaveChannel()
}, 100)
}
/**
* 更新专家状态
*@param isSwitchAxb 是否切换axb
* @param finishStatus 状态值: 0:开始 1:结束
*/
private fun updateExpertStatus(isSwitchAxb: Boolean, finishStatus: Int) {
if (isSwitchAxb){
dialPhone()
}
if(finishStatus==1){
var param = ConnectFinishCommand(listenerUid!!, relationId!!, "0",
remainTime!!.toInt() - localRemainTime!!, callId!!,
"0","0","$callStartTime",
"${System.currentTimeMillis()}",3)
mPresenter.connectFinish(param)
}else{
//接通开始回调
callStartTime = System.currentTimeMillis()
var param = ConnectStartCommand(listenerUid!!, relationId!!, callId!!,
"${System.currentTimeMillis()}","3","0","0","0","0")
mPresenter.connectStart(param)
}
}
/**
* 线路选择弹窗
*/
private fun showChooseDialog() {
val dialog = AxbConfirmDialog(mContext, object : AxbConfirmDialog.OnClickEnsureListener {
override fun onClickEnsure() {
switchAXB()
}
})
dialog.show()
}
/**
* 切换成axb路线请求
*/
private fun switchAXB() {
mPresenter.getAXBPhone(ConnectCommand(listenId!!,"1"))
}
/**
* 切换axb网络请求结果:axb电话
*w
*/
override fun switchAXBResponse(axbPhone: String) {
this.axbPhone = axbPhone
isJumpDail = true
if (isConnectSuccess) {
//已经连接成功,切换axb时需要更新专家状态
updateExpertStatus(true, 1)
} else {
//未连接成功,切换axb时:需发送消息通知专家端用户已挂断
//发送消息通知专家用户已挂断
YDLRTMClient.instances.cancelCall(listenerUid,channelId)
leaveChannel()
}
}
/**
* 跳转拨号界面
*/
override fun dialPhone() {
var phoneIntent = Intent(Intent.ACTION_DIAL, Uri.parse("tel:$axbPhone"))
startActivity(phoneIntent)
}
/**
* 30s等待完成,专家未接听
*/
private fun waittingStatus() {
//挂断按钮可点击
iv_hang_up.isEnabled = true
iv_hang_up.setImageResource(R.drawable.audio_home_img_hang_up)
if (!isConnectSuccess) {
//页面等待文案调整
tv_waiting.visibility = View.GONE
tv_change_doctor.text = "对方暂无应答,正在为您切换线路重播"
tv_change_doctor.visibility = View.VISIBLE
}
//切换线路按钮可见
tv_change_route.isEnabled = true
tv_change_route.setTextColor(ContextCompat.getColor(this, R.color.white))
tv_change_route.setCompoundDrawablesWithIntrinsicBounds(null, null, ContextCompat.getDrawable(this, R.drawable.audio_home_img_choose_arrow), null)
}
/**
* 加入语音聊天频道成功
*/
private fun onJoinChannelSuccess() {
dismissProgressView()
playWaitingMusic()
//45s倒计时逻辑
// disposable = Observable.interval(0, 1, TimeUnit.SECONDS)
// .subscribeOn(Schedulers.computation())
// .take(45)
// .observeOn(AndroidSchedulers.mainThread())
// .subscribe({
// }, {
// LogUtil.d(it.message)
// }, {
// if (!isConnectSuccess) {
// tv_change_doctor.visibility = View.VISIBLE
// }
// })
//60超时倒计时逻辑
// waitDisposable = Observable.interval(0, 1, TimeUnit.SECONDS)
// .subscribeOn(Schedulers.computation())
// .take(60)
// .observeOn(AndroidSchedulers.mainThread())
// .subscribe({
// }, {
// LogUtil.d(it.message)
// }, {
// if (!isConnectSuccess) {
// ActivityManager.getInstance().finishActivity(NewH5Activity::class.java!!)
// showToast("专家未接听")
// userCloseCalling()
// }
// })
}
/**
* 播放等待音频
*/
private fun playWaitingMusic() {
if (mPlayer == null) {
mPlayer = AudioPlayer(this)
}
if ((Math.random() * 10 + 1).toInt() >= 5) {
mPlayer!!.setTwoDataAndStart(R.raw.audio_music_1, R.raw.loop_music)
} else {
mPlayer!!.setTwoDataAndStart(R.raw.audio_music_2, R.raw.loop_music)
}
}
/**
* 播放结束音频,音频播放结束后,自动关闭页面
*/
private fun playFinishMusic() {
if (mPlayer == null) {
mPlayer = AudioPlayer(this)
}
mPlayer!!.setDataSource(R.raw.hand_down_music)
mPlayer!!.switchPlayType(iv_hands_free.isSelected)
mPlayer!!.setCompletionListener(MediaPlayer.OnCompletionListener {
//通话剩余时间不足60s时,默认
if (localRemainTime!! < 60 && !TextUtils.isEmpty(commentUrl)) {
val h5Params = H5Params(commentUrl!!, "评价")
NewH5Activity.start(this@AudioHomeActivity, h5Params)
}
if (isJumpDail) {
//跳转拨号界面
dialPhone()
}
finish()
})
mPlayer!!.start(false, true)
}
/**
* 停止播放
*/
private fun stopPlaying() {
if (mPlayer != null) {
mPlayer!!.pause()
}
}
/**
* sdk通话链接成功
*/
private fun connectSuccess() {
isConnectSuccess = true
//通知服务端,此次通话已经接通,服务端开始订单
updateExpertStatus(false, 0)
if (waitDisposable != null) {
waitDisposable!!.dispose()
}
if (disposable != null) {
disposable!!.dispose()
}
stopPlaying()
vibrator!!.vibrate(1000)
//等待状态的相关ui隐藏(挂断按钮的倒计时不清除,挂断按钮必须在30s后才能点击)
tv_change_doctor.visibility = View.GONE
tv_waiting.visibility = View.GONE
//显示通话相关ui
rl_remain_time.visibility = View.VISIBLE
showToast("已接通")
tv_tips.visibility = View.GONE
//剩余倾诉时长倒计时
totalDisposable = Observable.interval(0, 1, TimeUnit.SECONDS)
.subscribeOn(Schedulers.computation())
.take(remainTime!!.toLong() + 1)
.observeOn(AndroidSchedulers.mainThread())
.subscribe({
localRemainTime = remainTime!!.toInt() - it.toInt()
if (localRemainTime == 180) {
playNoticeMusic(3)
}
if (localRemainTime == 60) {
playNoticeMusic(1)
}
if (localRemainTime!! <= 60) {
if (tv_change_route.isEnabled) {
tv_change_route.isEnabled = false
tv_change_route.setTextColor(ContextCompat.getColor(this, R.color.color_50ffffff))
tv_change_route.setCompoundDrawablesWithIntrinsicBounds(null, null, ContextCompat.getDrawable(this, R.drawable.audio_home_img_choose_arrow_unuse), null)
}
}
tv_remain_time.text = DateUtils.formatTime(localRemainTime.toString())
}, {
LogUtil.d(it.message)
}, {
//注意:自动挂断时,如果对方离开频道的回调已经触发,就不要再重复调用接口
showToast("通话已结束")
updateExpertStatus(false, 1)
})
}
/**
* 剩余3min和1min时提示音
* @param min 1 :还剩1min 3:还剩3min
*
*/
private fun playNoticeMusic(min: Int) {
if (mPlayer == null) {
mPlayer = AudioPlayer(this)
}
if (3 == min) {
mPlayer!!.setDataSource(R.raw.last_3_min)
} else {
mPlayer!!.setDataSource(R.raw.last_1_min)
}
mPlayer!!.switchPlayType(iv_hands_free.isSelected)
mPlayer!!.start(false, false)
}
/**
* 用户加入频道后
*通知服务端发送推送
* 通知专家加入频道
* 这个功能已经有用信令通知,为了解决专家信令掉线的问题,增加推送逻辑
*
* @param isCall true 拨打 false 取消拨打
*/
private fun noticeServerPush(isCall: Boolean) {
var msgBean = AudioMessageBean(
1,
channelId!!,
YdlCommonRouterManager.getYdlCommonRoute().getUid().toString(),
YdlCommonRouterManager.getYdlCommonRoute().getUserInfo()!!.headUrl,
YdlCommonRouterManager.getYdlCommonRoute().getUserInfo()!!.userName,
remainTime!!.toInt(),
relationId,
callId,
null,
channelId
)
var cmd = NoticePushCommand()
cmd.data = Gson().toJson(msgBean)
cmd.pushId = listenerUid
if (isCall) {
cmd.status = "CALL"
} else {
cmd.status = "CALL_OFF"
}
mPresenter.noticeServerPush(cmd)
}
/**
* 声网离开频道
*/
private fun leaveChannel() {
//刷新h5页面
EventBus.getDefault().post(RefreshWebEvent(false))
stopPlaying()
//播放结束音频
playFinishMusic()
}
override fun onResume() {
super.onResume()
sensorManager!!.registerListener(this, sensorManager!!.getDefaultSensor(Sensor.TYPE_PROXIMITY), SensorManager.SENSOR_DELAY_NORMAL)
}
override fun onAccuracyChanged(sensor: Sensor?, accuracy: Int) {
}
override fun onSensorChanged(event: SensorEvent?) {
val values = event!!.values
when (event.sensor.type) {
Sensor.TYPE_PROXIMITY -> {
if (values[0] == 0.0f) {
//贴近手机
if (!localWakeLock!!.isHeld) {
localWakeLock!!.acquire()
}
} else {
//离开手机
//唤醒设备
if (localWakeLock!!.isHeld) {
localWakeLock!!.release()
}
}
}
}
}
/**
* 显示自定义弹窗
*/
private fun showToast(msg: String?) {
runOnUiThread {
// tv_toast.visibility = View.VISIBLE
//// tv_toast.text = msg
//// tv_toast.postDelayed({
//// tv_toast.visibility = View.GONE
//// }, 1000)
ToastUtil.toastShort(msg)
}
}
override fun showProgressView() {
try {
showProgressDialog()
}catch (e : Exception){
e.printStackTrace()
}
}
override fun dismissProgressView() {
try {
dismissProgressDialog()
}catch (e:Exception){
e.printStackTrace()
}
}
override fun finishActivity() {
leaveChannel()
}
override fun onDestroy() {
super.onDestroy()
if (handler != null) {
handler = null
}
if (waitDisposable != null) {
waitDisposable!!.dispose()
}
if (disposable != null) {
disposable!!.dispose()
}
if (totalDisposable != null) {
totalDisposable!!.dispose()
}
if (sensorManager != null) {
sensorManager!!.unregisterListener(this)
}
//唤醒设备
if (localWakeLock != null && localWakeLock!!.isHeld) {
localWakeLock!!.release()
}
sensorManager = null
localWakeLock = null
localPowerManager = null
if (null != voiceManage && null != voiceManage!!.getVoiceApi()) {
voiceManage!!.getVoiceApi().leaveChannel()
voiceManage!!.getVoiceApi().destroy()
voiceManage = null
}
if (mPlayer != null) {
mPlayer!!.clear()
}
}
//重写物理返回按钮
override fun onBackPressed() {
}
}
package com.ydl.audioim;
/**
* @author jiucheng
* @描述:页面参数传递常量
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/11/7
*/
public interface IntentConstants {
String INTENT_EXPERT_HEAD_URL = "intent_expert_head_url";
String INTENT_EXPERT_NAME = "intent_expert_name";
String INTENT_EXPERT_TIPS = "intent_expert_tips";
String INTENT_ROOM_ID = "intent_room_id";
String INTENT_REMAIN_TIME = "intent_remain_time";
String INTENT_RELATION_ID = "intent_relation_id";
String INTENT_CALL_ID = "INTENT_CALL_ID";
String INTENT_TOKEN = "intent_token";
String INTENT_SIGNAL_TOKEN= "intent_signal_token";
String INTENT_LISTENER_UID= "intent_listener_uid";
String INTENT_TOTAL_DURATION= "intent_total_duration";
String INTENT_LISTEN_ID= "intent_listen_id";
String INTENT_COMMENT_URL= "intent_comment_url";
}
package com.ydl.audioim
import android.content.Context
import com.ydl.ydl_av.messge_service.YDLRTMClient
import com.ydl.ydl_av.messge_service.bean.RTMMesssage
import com.ydl.ydl_av.messge_service.callback.InitListener
import com.ydl.ydl_av.messge_service.callback.LoginCallback
import com.ydl.ydl_av.messge_service.request.LoginParam
import com.ydl.audioim.http.AudioApiRequestUtil
import com.ydl.ydlcommon.utils.log.LogHelper
import com.yidianling.common.tools.LogUtil
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
/**
* @author harvie
* @date 2019/9/27
* 语音通话入口类
*/
class YDLavManager {
companion object{
val instances : YDLavManager by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED){
YDLavManager()
}
}
private constructor()
fun init(context: Context,appId:String){
YDLRTMClient.instances.init(context,appId,listener)
}
fun login(userId:String?){
//登录实时消息
//获取token
AudioApiRequestUtil.getAgoraToken(userId)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({
if ("200".equals(it.code)){
YDLRTMClient.instances.login(LoginParam(userId,it.data.token),object : LoginCallback {
override fun onSuccess() {
//登陆成功,发起呼叫
LogUtil.d("[agora]实时消息登录成功")
}
override fun onFailure(msg: String?) {
LogUtil.d("[agora]实时消息登录失败:$msg")
}
})
}else{
LogUtil.e("声网token获取失败uid:"+userId+" error:"+it.msg)
LogHelper.getInstance().writeLogSync("声网token获取失败uid:"+userId+" error:"+it.msg)
}
},{
LogUtil.e("声网token获取异常uid:"+userId+" error:"+it.message)
})
}
/**
* 退出登录
*/
fun logout(){
YDLRTMClient.instances.logout(object : LoginCallback {
override fun onSuccess() {
//退出登陆成功
LogUtil.d("[agora]实时消息退出成功")
}
override fun onFailure(msg: String?) {
LogUtil.d("[agora]实时消息退出失败:$msg")
}
})
}
/**
* 实时消息全局监听
*/
private val listener = object :InitListener{
override fun onTokenExpired() {
LogUtil.e("[agora]onTokenExpired")
}
override fun onMessageReceived(message: RTMMesssage, userId: Int) {
LogUtil.i("[agora]onMessageReceived:${message.text} -->uid:$userId")
}
override fun onConnectionStateChanged(state: Int, reason: Int) {
LogUtil.i("[agora]onConnectionStateChanged:state:${state} -->reason:$reason")
}
}
}
\ No newline at end of file
package com.ydl.audioim.bean;
/**
* 声网token获取结果
*/
public class AgoraTokenResponse {
private String token;
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
}
package com.ydl.audioim.bean
class ConnectBean{
var dialDetail : DialDetail? = null
var listenOrderId : Long? = 0 //订单ID
var callId : String? = null //
var payId : String?=null //支付ID
var payTitle : String? = null //支付标题
var listenOrderPrice : Double? = null //订单金额
var userBaseInfoRespDto : UserBaseInfoRespDto?=null
var coupon :CouponData? = null //优惠信息
}
class DialDetail{
var agoraExpertInfo: ExpertInfoBean? = null
var callConnectType :Int ? = null
var dialReason : String? = null //连接失败原因
var dialStatus : Int? = null //连接状态
var phoneNu : String ?= null //axb号码
}
class UserBaseInfoRespDto{
var availableMoney : Double ? = null
var companyMoney : Double ? = null
var doctorId : Long ? = null
var phone : Long ? = null
var userType : String?=null
}
class CouponData{
var couponMoney:Double? = 0.00
}
package com.ydl.audioim.bean;
/**
* @author jiucheng
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/11/10
*/
public class ExpertInfoBean {
public String expertHeadUrl;//专家头像地址
public String expertName;//专家姓名
public String expertTips;//专家文案
public String token;//token
public String signalToken;//信令
public String listenerUid;//聆听者UID
public int listenerStatus;//1 空闲 2 倾听中(只用这个字段判断老师状态,下面两个字段都不用)
public String listenerIsOpen;//1 开启 2 关闭
public String listenOrderStatus;//1未链接2连接中3连接失败4连接成功
public String channelId;//声网点对点聊天房间id
public String remainingTime;//倾诉剩余时长(时长单位s,eg:剩余2min15s,返回135)
public String totalDuration;//总时长
public String commentUrl;//评价页URL
}
package com.ydl.audioim.contract
import com.ydl.audioim.bean.ConnectBean
import com.ydl.audioim.http.command.ConnectCommand
import com.ydl.audioim.http.command.ConnectFinishCommand
import com.ydl.audioim.http.command.ConnectStartCommand
import com.ydl.audioim.http.command.NoticePushCommand
import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.ydl.ydlcommon.data.http.BaseResponse
import com.ydl.ydlcommon.mvp.base.BasePresenter
import com.ydl.ydlcommon.mvp.base.IModel
import com.ydl.ydlcommon.mvp.base.IPresenter
import com.ydl.ydlcommon.mvp.base.IView
import io.reactivex.Observable
/**
* @author jiucheng
* @描述:声网倾诉首页约束类
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/10/30
*/
interface IAudioHomeActivityContract {
interface View : IView {
/**
* 显示进度条
*/
fun showProgressView()
/**
* 关闭进度条
*/
fun dismissProgressView()
/**
* 关闭窗口
*/
fun finishActivity()
/**
*切换axb回调
*/
fun switchAXBResponse(axbPhone: String)
/**
* 跳转拨号页面
*/
fun dialPhone()
}
interface Presenter : IPresenter<View> {
/**
* 登录信令
*/
fun loginChatNet(signalingToken: String)
/**
* 获取axb电话
*/
fun getAXBPhone(cmd: ConnectCommand)
/**
* 通话开始(更新专家状态)
* @param param 请求参数
*/
fun connectStart(param: ConnectStartCommand)
/**
* 通话结束(更新专家状态)
* @param param 请求参数
*/
fun connectFinish(param: ConnectFinishCommand)
/**
* 通知服务端发送推送
*/
fun noticeServerPush(cmd: NoticePushCommand)
}
interface Model : IModel {
/**
* 获取axb电话
*/
fun getAXBPhone(cmd: ConnectCommand): Observable<BaseAPIResponse<ConnectBean>>
/**
* 通话开始回调(更新专家状态)
*/
fun connectStart(param: ConnectStartCommand): Observable<BaseAPIResponse<Any>>
/**
* 通话结束(更新专家状态)
*/
fun connectFinish(param: ConnectFinishCommand): Observable<BaseAPIResponse<Any>>
/**
* 通知服务端发送推送
*/
fun noticeServerPush(param: NoticePushCommand): Observable<BaseResponse<Any>>
}
}
\ No newline at end of file
package com.ydl.audioim.http
import com.google.gson.Gson
import com.ydl.audioim.bean.AgoraTokenResponse
import com.ydl.audioim.bean.ConnectBean
import com.ydl.audioim.http.command.ConnectCommand
import com.ydl.audioim.http.command.NoticePushCommand
import com.ydl.audioim.http.command.ConnectFinishCommand
import com.ydl.audioim.http.command.ConnectStartCommand
import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.ydl.ydlcommon.data.http.BaseResponse
import com.ydl.ydlcommon.data.http.RxUtils
import com.ydl.ydlnet.YDLHttpUtils
import io.reactivex.Observable
import okhttp3.MediaType
import okhttp3.RequestBody
/**
* @author jiucheng
* @描述:声网业务接口请求
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/11/9
*/
class AudioApiRequestUtil {
companion object {
/**
* 倾诉
*/
fun connectListen(cmd: ConnectCommand): Observable<BaseAPIResponse<ConnectBean>> {
return RxUtils.mapObservable(cmd)
.flatMap {
it->
YDLHttpUtils.obtainApi(AudioNetAPi::class.java).connectListen(it)
}
}
/**
* 通话开始回调
*
* @param param
* @return
*/
fun connectStart(param: ConnectStartCommand): Observable<BaseAPIResponse<Any>> {
// val list = YdlRetrofitUtils.getPostList(param)
var str = Gson().toJson(param)
val body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), str) as RequestBody
return YDLHttpUtils.obtainApi(AudioNetAPi::class.java).connectStart(body)
}
/**
* 通话结束回调
*
* @param param
* @return
*/
fun connectFinish(param: ConnectFinishCommand): Observable<BaseAPIResponse<Any>> {
// val list = YdlRetrofitUtils.getPostList(param)
var str = Gson().toJson(param)
val body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), str) as RequestBody
return YDLHttpUtils.obtainApi(AudioNetAPi::class.java).connectFinish(body)
}
/**
* 通知服务端发送推送
*/
fun noticeServerPush(param: NoticePushCommand): Observable<BaseResponse<Any>> {
var str = Gson().toJson(param)
val body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), str) as RequestBody
return YDLHttpUtils.obtainApi(AudioNetAPi::class.java).noticeServerPush(body)
}
/**
* 获取声网登录token
*/
fun getAgoraToken(uid:String?): Observable<BaseAPIResponse<AgoraTokenResponse>>{
return YDLHttpUtils.obtainApi(AudioNetAPi::class.java).getAgoraToken(uid)
}
}
}
\ No newline at end of file
package com.ydl.audioim.http
import com.ydl.audioim.bean.AgoraTokenResponse
import com.ydl.audioim.bean.ConnectBean
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.ydl.ydlcommon.data.http.BaseResponse
import io.reactivex.Observable
import okhttp3.RequestBody
import retrofit2.http.*
/**
* @author jiucheng
* @描述:声网业务接口api
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/11/9
*/
interface AudioNetAPi {
/**
* 通话开始回调
*/
@Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA,"Content-Type:application/json")
@POST("auth/listen-order/callback/agora/start")
fun connectStart(@Body body:RequestBody): Observable<BaseAPIResponse<Any>>
/**
* 通话结束回调
*/
@Headers( YDL_DOMAIN + YDL_DOMAIN_JAVA,"Content-Type:application/json")
@POST("auth/listen-order/callback/agora/finish")
fun connectFinish(@Body body:RequestBody): Observable<BaseAPIResponse<Any>>
/**
* 链接 :获取axb手机号
*/
@Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA,"Content-Type:application/json")
@GET("auth/listen/dial")
fun connectListen(@QueryMap params: Map<String, String>): Observable<BaseAPIResponse<ConnectBean>>
/**
*通知服务端发送推送
*/
@POST("api/push/notify/doctor")
fun noticeServerPush(@Body body: RequestBody): Observable<BaseResponse<Any>>
/**
* 获取声网登录token
*/
@Headers( YDL_DOMAIN + YDL_DOMAIN_JAVA,"Content-Type:application/json")
@GET("im/getAgoraToken")
fun getAgoraToken(@Query("uid") uid: String?): Observable<BaseAPIResponse<AgoraTokenResponse>>
}
\ No newline at end of file
package com.ydl.audioim.http.command
import com.ydl.ydlcommon.data.http.BaseCommand
/**
* author : Zhangwenchao
* e-mail : zhangwch@yidianling.com
* time : 2018/03/08
*/
class ConnectCommand : BaseCommand {
var id: String = "0" //倾诉id
var type: String = "1" //1 走AxB 2双呼 3声网
var isCheckStatus = "2"//1 检测专家状态 2 跳过检测专家状态
constructor() : super()
constructor(id: String, type: String) : super() {
this.id = id
this.type = type
}
}
package com.ydl.audioim.http.command
import com.ydl.ydlcommon.data.http.BaseCommand
/**
* @author jiucheng
* @描述:更新专家状态请求参数
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/11/9
*/
data class ConnectFinishCommand(
var listenerUid:String,//专家uid
// @JvmField
var relationId: String,//订单ID
var connectStatus:String,// 0开始 1 结束
// @JvmField
var callLongTime: Int,//本次通话时长
// @JvmField
var session: String,//调用connect接口时候,会返回这个值,直接给我好了
var calleePhone:String = "${0}",
var callerPhone:String = "${0}",
var callStartTime:String,//通话开始时间
var callEndTime:String,//通话结束时间
var status:Int //连接成功传递3
) : BaseCommand()
\ No newline at end of file
package com.ydl.audioim.http.command
import com.ydl.ydlcommon.data.http.BaseCommand
/**
* @author jiucheng
* @描述:通话开始请求参数
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/11/9
*/
data class ConnectStartCommand(
var listenerUid:String,//专家uid
// @JvmField
var relationId: String,//订单ID
var callId:String,//会话session 调用connect接口时候,会返回这个值,直接给我好了
var callTime:String,//通话开始时间
var callType:String,//声网默认3
var subId:String,
var telA:String,
var telB:String,
var telX:String
) : BaseCommand()
\ No newline at end of file
package com.ydl.audioim.http.command;
import com.ydl.ydlcommon.data.http.BaseCommand;
/**
* @author jiucheng
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/11/17
*/
public class NoticePushCommand extends BaseCommand {
public String data;//AudioMessageBean的字符串
public String pushId;//专家uid
public String status;//CALL 呼叫 CALL_OFF 取消呼叫
public String title = "您有一条倾诉消息";
public String sound = "专家响铃3.mp3";//用于ios设备接到通知响铃
}
package com.ydl.audioim.model
import com.ydl.audioim.bean.ConnectBean
import com.ydl.audioim.contract.IAudioHomeActivityContract
import com.ydl.audioim.http.AudioApiRequestUtil
import com.ydl.audioim.http.command.ConnectCommand
import com.ydl.audioim.http.command.NoticePushCommand
import com.ydl.audioim.http.command.ConnectFinishCommand
import com.ydl.audioim.http.command.ConnectStartCommand
import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.ydl.ydlcommon.data.http.BaseResponse
import io.reactivex.Observable
/**
* @author jiucheng
* @描述:model实现类
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/10/30
*/
class AudioHomeModelImpl : IAudioHomeActivityContract.Model {
override fun connectStart(param: ConnectStartCommand): Observable<BaseAPIResponse<Any>> {
return AudioApiRequestUtil.connectStart(param)
}
override fun connectFinish(param: ConnectFinishCommand): Observable<BaseAPIResponse<Any>> {
return AudioApiRequestUtil.connectFinish(param)
}
override fun noticeServerPush(param: NoticePushCommand): Observable<BaseResponse<Any>> {
return AudioApiRequestUtil.noticeServerPush(param)
}
override fun getAXBPhone(cmd: ConnectCommand): Observable<BaseAPIResponse<ConnectBean>> {
return AudioApiRequestUtil.connectListen(cmd)
}
}
\ No newline at end of file
package com.ydl.audioim.player
import android.content.Context
import android.media.AudioAttributes
import android.media.AudioManager
import android.media.MediaPlayer
import android.os.Build
/**
* @author jiucheng
* @描述:音频播放
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/11/9
*/
class AudioPlayer {
private var mPlayer: MediaPlayer? = null
private var mContext: Context? = null
private var audioManager: AudioManager? = null
constructor(mContext: Context?) {
this.mContext = mContext
mPlayer = MediaPlayer()
mPlayer?.setAudioStreamType(AudioManager.STREAM_VOICE_CALL)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
var attributes = AudioAttributes.Builder()
.setLegacyStreamType(AudioManager.STREAM_VOICE_CALL)
.build()
mPlayer?.setAudioAttributes(attributes)
} else {
mPlayer?.setAudioStreamType(AudioManager.STREAM_VOICE_CALL)
}
audioManager = mContext!!.getSystemService(Context.AUDIO_SERVICE) as AudioManager?
audioManager?.setStreamVolume(AudioManager.STREAM_VOICE_CALL,
audioManager!!.getStreamMaxVolume(AudioManager.STREAM_VOICE_CALL) / 2,
AudioManager.STREAM_VOICE_CALL)
//默认听筒模式
audioManager?.isSpeakerphoneOn = false
}
/**
* 设置音频文件
* @param id 文件id
*/
fun setDataSource(id: Int) {
val file = mContext?.resources?.openRawResourceFd(id)
if (null == file){
return
}
if (mPlayer != null) {
mPlayer?.reset()
mPlayer?.setDataSource(file.fileDescriptor, file.startOffset, file.length)
}
file.close()
}
/**
* 设置两个音乐文件,第一个播放一次,第二个循环播放
*/
fun setTwoDataAndStart(startMusicId: Int, loopMusicId: Int) {
requestFocus()
setDataSource(startMusicId)
mPlayer?.setOnPreparedListener {
it.start()
}
mPlayer?.setOnCompletionListener {
it.pause()
startNext(loopMusicId)
}
mPlayer?.prepare()
}
/**
* 播放下一首
*/
private fun startNext(loopMusicId: Int) {
setDataSource(loopMusicId)
start(true, false)
}
/**
* 播放
* @param isLooping 是否重复播放
* @param isSetOnCompletionListener 是否设置过播放完成监听
*/
fun start(isLooping: Boolean, isSetOnCompletionListener: Boolean) {
requestFocus()
mPlayer?.isLooping = isLooping
mPlayer?.setOnPreparedListener {
it.start()
}
if (!isLooping && !isSetOnCompletionListener) {
mPlayer?.setOnCompletionListener {
it.pause()
}
}
mPlayer?.prepare()
}
/**
* 设置播放完成回调
*/
fun setCompletionListener(listener: MediaPlayer.OnCompletionListener) {
if (listener == null) {
return
}
mPlayer?.setOnCompletionListener(listener)
}
/**
* 切换扬声器、听筒播放方式
* @param isSpeakerphoneOn true 扬声器 false 听筒模式
*/
fun switchPlayType(isSpeakerphoneOn: Boolean) {
audioManager?.isSpeakerphoneOn = isSpeakerphoneOn
audioManager?.mode = AudioManager.MODE_IN_CALL
}
/**
* 暂停
*/
fun pause() {
if (mPlayer != null) {
mPlayer?.pause()
}
}
/**
* 停止
*/
fun stop() {
if (mPlayer != null) {
mPlayer?.stop()
}
}
/**
* 获取焦点
*
*/
fun requestFocus() {
try {
val result = audioManager?.requestAudioFocus(afChangeListener,
// Use the music stream.
AudioManager.STREAM_VOICE_CALL,
// Request permanent focus.
AudioManager.AUDIOFOCUS_GAIN)
} catch (e: Exception) {
}
}
fun clear() {
if (audioManager != null) {
audioManager?.abandonAudioFocus(afChangeListener)
}
if (mPlayer != null) {
mPlayer?.stop()
mPlayer?.release()
mPlayer = null
}
}
var afChangeListener = AudioManager.OnAudioFocusChangeListener {
if (it == AudioManager.AUDIOFOCUS_LOSS_TRANSIENT) {
// Pause playback
// pause()
} else if (it == AudioManager.AUDIOFOCUS_GAIN) {
// Resume playback
} else if (it == AudioManager.AUDIOFOCUS_LOSS) {
// mAm.unregisterMediaButtonEventReceiver(RemoteControlReceiver);
// audioManager!!.abandonAudioFocus(afChangeListener)
// // Stop playback
// stop()
}
}
}
package com.ydl.audioim.presenter
import android.app.Activity
import com.ydl.audioim.BuildConfig
import com.ydl.ydl_av.chat.config.YDLChatParam
import com.ydl.audioim.R
import com.ydl.audioim.contract.IAudioHomeActivityContract
import com.ydl.audioim.http.command.ConnectCommand
import com.ydl.audioim.http.command.ConnectFinishCommand
import com.ydl.audioim.http.command.ConnectStartCommand
import com.ydl.audioim.http.command.NoticePushCommand
import com.ydl.audioim.model.AudioHomeModelImpl
import com.ydl.ydlcommon.mvp.base.BasePresenter
import com.ydl.ydlcommon.router.YdlCommonRouterManager
import com.ydl.ydlcommon.utils.remind.ToastHelper
import com.yidianling.common.tools.LogUtil
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
/**
* @author jiucheng
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/10/30
*/
class AudioHomePresenterImpl : BasePresenter<IAudioHomeActivityContract.View, IAudioHomeActivityContract.Model>(), IAudioHomeActivityContract.Presenter {
override fun connectStart(param: ConnectStartCommand) {
mModel.connectStart(param)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.doOnSubscribe {
}
.doAfterTerminate {
// view.dismissProgressView()
}
.subscribe({
// if (isSwitchAxb) {
// //切换axb:跳到拨号界面
// view.dialPhone()
// }
}, { e ->
LogUtil.e(e.message)
})
}
override fun connectFinish(param: ConnectFinishCommand) {
mModel.connectFinish(param)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.doOnSubscribe {
//通知服务端专家已经接通时,此时用户已在界面通话中,不需要弹进度条
mView.showProgressView()
}
.doAfterTerminate {
mView.dismissProgressView()
}
.subscribe({
// if (isSwitchAxb) {
// //切换axb:跳到拨号界面
// view.dialPhone()
// }
//挂断逻辑:不管接口调用成功与否,都关闭界面
mView.finishActivity()
}, { e ->
LogUtil.e(e.message)
//挂断逻辑:不管接口调用成功与否,都关闭界面
mView.finishActivity()
})
}
/**
* 登录声网
*/
override fun loginChatNet(signalingToken: String) {
mView.showProgressView()
// appId:应用id
// account:uid
// token :由 App ID 和 App Certificate 生成的 SignalingToken (如果不使用token可以设为字符串 _no_need_token)
// uid:固定填 0
// deviceID:暂时无用,设置为空
// retry_time_in_s:登录重试时间,默认为 30 秒
// retry_count:登录重试次数,默认为 3 次
val ydlChtat = YDLChatParam()
ydlChtat.appId = BuildConfig.AGORA_APPID
ydlChtat.account = YdlCommonRouterManager.getYdlCommonRoute().getUid().toString()
ydlChtat.token = signalingToken
ydlChtat.uid = 0
ydlChtat.deviceID = ""
ydlChtat.retry_time_in_s = 30
ydlChtat.retry_count = 3
// YDLChartManager.instance!!.getChatApi().login(ydlChtat)
}
/**
* 获取axb电话
*/
override fun getAXBPhone(cmd: ConnectCommand) {
mModel.getAXBPhone(cmd)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.doOnSubscribe { mView.showProgressView() }
.doAfterTerminate { mView.dismissProgressView() }
.subscribe({
if ("200".equals(it.code)){
if(0==it.data?.dialDetail?.dialStatus?:-1){
//连接成功
if(it.data?.dialDetail?.callConnectType?:-1==1){
//axb
mView.switchAXBResponse(it.data?.dialDetail?.phoneNu?:"")
}else{
ToastHelper.show(it.data?.dialDetail?.dialReason?:"连接失败")
}
}else{
ToastHelper.show(it.data?.dialDetail?.dialReason?:"连接失败")
}
}else{
ToastHelper.show(it.data?.dialDetail?.dialReason?:"连接失败")
}
}, { e ->
LogUtil.d(e.message)
})
}
/**
* 通知服务端发送推送
*/
override fun noticeServerPush(param: NoticePushCommand) {
mModel.noticeServerPush(param)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({
if (it.code == 200) {
//TODO
} else {
LogUtil.e(it.msg)
}
}, { e ->
LogUtil.e(e.message)
})
}
override fun createModel(): IAudioHomeActivityContract.Model {
return AudioHomeModelImpl()
}
}
\ No newline at end of file
# 声网module
\ No newline at end of file
package com.ydl.audioim.utils;
/**
* @author jiucheng
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/11/7
*/
public class DateUtils {
/**
* 将时间(单位:s )转化成00:00格式
*
* @param timeTemp
* @return
*/
public static String formatTime(Object timeTemp) {
int timeParam = 0;
if (timeTemp instanceof Integer) {
timeParam = (Integer) timeTemp;
}
if (timeTemp instanceof String) {
timeParam = Integer.valueOf((String) timeTemp);
}
int second = timeParam % 60;
int minuteTemp = timeParam / 60;
if (minuteTemp > 0) {
int minute = minuteTemp % 60;
int hour = minuteTemp / 60;
if (hour > 0) {
return (hour >= 10 ? (hour + "") : ("0" + hour)) + ":" + (minute >= 10 ? (minute + "") : ("0" + minute))
+ ":" + (second >= 10 ? (second + "") : ("0" + second));
} else {
return (minute >= 10 ? (minute + "") : ("0" + minute)) + ":"
+ (second >= 10 ? (second + "") : ("0" + second));
}
} else {
return "00:" + (second >= 10 ? (second + "") : ("0" + second));
}
}
}
package com.ydl.audioim.widget
import android.app.Activity
import android.app.Dialog
import android.graphics.drawable.ColorDrawable
import android.os.Bundle
import com.ydl.audioim.R
import kotlinx.android.synthetic.main.dialog_axb_confirm.*
/**
* @author jiucheng
* @描述:Axb呼叫确认弹窗
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/12/27
*/
class AxbConfirmDialog : Dialog {
private var activity: Activity? = null
private var listener: OnClickEnsureListener? = null
constructor(activity: Activity?, listener: OnClickEnsureListener?) : super(activity) {
this.activity = activity
this.listener = listener
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.dialog_axb_confirm)
setCanceledOnTouchOutside(false)
window.setBackgroundDrawable(ColorDrawable())
ic_close.setOnClickListener {
dismiss()
}
rl_ensure.setOnClickListener {
if (listener != null) {
listener!!.onClickEnsure()
}
dismiss()
}
}
interface OnClickEnsureListener {
fun onClickEnsure()
}
override fun show() {
if (null == activity || activity!!.isFinishing) {
return
}
super.show()
}
}
\ No newline at end of file
package com.ydl.audioim.api
/**
* Created by hgw on 2018/5/3.
*/
interface IAVRouter {
/**
* 登录agora
*/
fun loginAgora(userId:String?)
}
\ 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="63dp" />
<solid android:color="@color/color_30FFFFFF" />
</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="20dp" />
<solid android:color="@color/color_32D296" />
</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="4dp" />
<solid android:color="@color/color_20FFFFFF" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/color_80353535">
<TextView
android:id="@+id/tv_change_route"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="25dp"
android:layout_marginRight="10dp"
android:background="?android:attr/selectableItemBackground"
android:drawableRight="@drawable/audio_home_img_choose_arrow_unuse"
android:drawablePadding="6dp"
android:padding="5dp"
android:text="切换至传统电话"
android:textColor="@color/color_50FFFFFF"
android:textSize="13sp"
android:visibility="visible" />
<RelativeLayout
android:id="@+id/rl_head"
android:layout_width="250dp"
android:layout_height="250dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="74dp">
<com.ydl.ydlcommon.view.WaveView
android:id="@+id/wave_view"
android:layout_width="250dp"
android:layout_height="250dp"
android:layout_centerInParent="true" />
<ImageView
android:layout_width="126dp"
android:layout_height="126dp"
android:layout_centerInParent="true"
android:background="@drawable/audio_home_head_background" />
<ImageView
android:id="@+id/iv_head"
android:layout_width="120dp"
android:layout_height="120dp"
android:layout_centerInParent="true"
android:scaleType="centerCrop"
android:src="@drawable/head_place_hold_pic" />
</RelativeLayout>
<TextView
android:id="@+id/tv_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/rl_head"
android:layout_centerHorizontal="true"
android:layout_marginTop="-20dp"
android:textColor="@color/white"
android:textSize="26sp"
tools:text="留意" />
<TextView
android:id="@+id/tv_tips"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_name"
android:layout_centerHorizontal="true"
android:layout_marginLeft="25dp"
android:layout_marginTop="6dp"
android:layout_marginRight="25dp"
android:ellipsize="end"
android:gravity="center"
android:maxLines="2"
android:textColor="@color/white"
android:textSize="15sp"
tools:text="你存在的本身就是值得被爱的你存在的本身就是值得被爱的" />
<!-- 倾诉剩余时间-->
<RelativeLayout
android:id="@+id/rl_remain_time"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/rl_hang_up"
android:layout_marginBottom="20dp"
android:visibility="gone">
<TextView
android:id="@+id/tv_notes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="您的倾诉时间还有"
android:textColor="@color/color_30FFFFFF"
android:textSize="12sp" />
<TextView
android:id="@+id/tv_remain_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_notes"
android:layout_centerHorizontal="true"
android:text="23:23"
android:textColor="@color/white"
android:textSize="20sp" />
</RelativeLayout>
<TextView
android:id="@+id/tv_change_doctor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/rl_hang_up"
android:layout_centerHorizontal="true"
android:layout_marginBottom="48dp"
android:gravity="center"
android:text="聆听者长时间未接听,\n您可以点击右上角切换线路,或者挂断换一位"
android:textColor="@color/white"
android:visibility="gone" />
<TextView
android:id="@+id/tv_waiting"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/rl_hang_up"
android:layout_centerHorizontal="true"
android:layout_marginBottom="50dp"
android:text="正在等待聆听者接受邀请…"
android:textColor="@color/color_70FFFFFF"
android:textSize="12sp"
android:visibility="visible" />
<!--挂断按钮-->
<RelativeLayout
android:id="@+id/rl_hang_up"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginLeft="72dp"
android:layout_marginBottom="18dp">
<com.ydl.ydlcommon.view.ProgressView
android:id="@+id/progress_view"
android:layout_width="70dp"
android:layout_height="70dp"
app:progressWidth="2dp" />
<ImageView
android:id="@+id/iv_hang_up"
android:layout_width="66dp"
android:layout_height="66dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="1dp"
android:src="@drawable/audio_home_img_hang_up_unuse"
android:visibility="visible" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/iv_hang_up"
android:layout_centerHorizontal="true"
android:layout_marginTop="8dp"
android:text="挂断"
android:textColor="@color/white"
android:textSize="12sp" />
</RelativeLayout>
<!-- 免提按钮-->
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginRight="72dp"
android:layout_marginBottom="18dp">
<ImageView
android:id="@+id/iv_hands_free"
android:layout_width="66dp"
android:layout_height="66dp"
android:layout_marginTop="1dp"
android:src="@drawable/audio_home_img_hands_free_unuse" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/iv_hands_free"
android:layout_centerHorizontal="true"
android:layout_marginTop="8dp"
android:text="免提"
android:textColor="@color/white"
android:textSize="12sp" />
</RelativeLayout>
<!--自定义弹窗-->
<TextView
android:id="@+id/tv_toast"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_tips"
android:layout_centerHorizontal="true"
android:layout_marginTop="34dp"
android:background="@drawable/audio_home_toast_view_background"
android:elevation="6dp"
android:paddingLeft="11dp"
android:paddingTop="4dp"
android:paddingRight="11dp"
android:paddingBottom="4dp"
android:textColor="@color/white"
android:visibility="gone"
tools:text="已接通" />
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="280dp"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
app:cardCornerRadius="15dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:id="@+id/ic_close"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_marginTop="7dp"
android:layout_marginRight="10dp"
android:padding="5dp"
android:src="@drawable/ic_close_24dp" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:src="@drawable/audio_home_privacy_ico" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
android:text="号码隐私保护"
android:textColor="@color/color_333333"
android:textSize="17sp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="15dp"
android:text="您的真实号码全程保密,请安心呼叫"
android:textColor="@color/color_333333"
android:visibility="visible"
android:textSize="13sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_gravity="center_horizontal"
android:gravity="center"
android:layout_marginTop="15dp"
android:text="呼出号码与注册号码需为同一手机号"
android:textColor="@color/color_999999"
android:textSize="13sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_gravity="center_horizontal"
android:gravity="center"
android:text="否则无法接通"
android:textColor="@color/color_999999"
android:textSize="13sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:gravity="bottom"
android:text="壹点灵全程保护您的隐私"
android:textColor="@color/color_999999"
android:textSize="10sp" />
<RelativeLayout
android:id="@+id/rl_ensure"
android:layout_width="210dp"
android:layout_height="40dp"
android:layout_marginTop="11dp"
android:layout_marginBottom="20dp"
android:background="@drawable/audio_home_privacy_background">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_gravity="center_horizontal"
android:drawableLeft="@drawable/audio_home_ic_phone"
android:gravity="center_horizontal"
android:text="呼叫"
android:textColor="@color/white"
android:textSize="17sp"
android:textStyle="bold" />
</RelativeLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="color_40353535">#66353535</color>
<color name="color_80353535">#CC353535</color>
<color name="color_50ffffff">#B3ffffff</color>
<color name="color_30FFFFFF">#4DFFFFFF</color>
<color name="color_70FFFFFF">#B3FFFFFF</color>
</resources>
\ No newline at end of file
<resources>
<string name="app_name">av</string>
<string name="need_storage_permission_hint">App正常工作需要内部存储使用权限,请开启</string>
</resources>
package com.ydl.audioim
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
kapt {
arguments {
arg("AROUTER_MODULE_NAME", project.getName())
}
}
android {
compileSdkVersion rootProject.ext.android["compileSdkVersion"]
buildToolsVersion rootProject.ext.android["buildToolsVersion"]
defaultConfig {
minSdkVersion rootProject.ext.android["minSdkVersion"]
targetSdkVersion rootProject.ext.android["targetSdkVersion"]
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
flavorDimensions "versionCode"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
publishNonDefault true
productFlavors {
ydl {}
xlzx {}
}
sourceSets {
main {
res.srcDirs = [
'src/main/res/layouts/confidehome',
'src/main/res/layouts',
'src/main/res'
]
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.daimajia.androidanimations:library:2.3@aar'
api 'fr.tvbarthel.blurdialogfragment:lib:2.1.5'
api "com.alibaba:arouter-api:$arouter_api"
// 注意此处的依赖方式:kotlin中使用和java中使用方式有不同
kapt "com.alibaba:arouter-compiler:$arouter_compiler"
implementation project(":ydl-platform")
implementation 'com.alibaba:fastjson:1.2.38'
}
modular {
packageName "com.ydl.confide"
// 模块发布需要的参数
publish {
modules {
xlzx {
//发布信息 module/api 通用
groupId = "com.ydl"
artifactId = "m-confide-module-xlzx"
// 上报的业务模块 aar 包的版本号
version = "0.0.1"
}
ydl{
//发布信息 module/api 通用
groupId = "com.ydl"
artifactId = "m-confide-module-ydl"
// 上报的业务模块 aar 包的版本号
version = "0.0.1"
}
}
api {
//发布信息 module/api 通用
groupId = "com.ydl"
artifactId = "m-confide-api"
//version = "0.0.1"
// API 层打包时需要引入的依赖
apiDependencies {
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
# 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
package com.ydl.confide
import android.support.test.InstrumentationRegistry
import android.support.test.runner.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.example.m_confide.test", appContext.packageName)
}
}
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ydl.confide" >
<application>
<activity android:name=".PhoneCallActivity"
android:screenOrientation="portrait"/>
<activity android:name=".home.ConfideHomeActivity"
android:screenOrientation="portrait">
</activity>
<activity android:name="com.yidianling.phonecall.order.DownOrderActivity"
android:screenOrientation="portrait"/>
</application>
</manifest>
[{"type":1,"body":[{"bannerId":192,"bannerTitle":"banner图三","bannerImageUrl":"https://img.ydlcdn.com/file/2019/04/22/6dd7829a24b0911dbacf7360058551dd.png","bannerLinkUrl":"a"}],"diviLine":0,"head":null},{"type":3,"body":[{"categoryType":1,"categoryName":"倾诉指南","categoryContent":"排忧疏导,隐私安全","categoryIcon":"https://img.ydlcdn.com/file/2018/09/28/tcru5giepubsjbub.png","linkUrl":"https://activity.yidianling.com/activity/qs"},{"categoryType":1,"categoryName":"一键倾诉","categoryContent":"智能匹配咨询师","categoryIcon":"https://img.ydlcdn.com/file/2019/03/18/fr12kf8plb69hxdq.png","linkUrl":"https://h5.ydl.com/confideMatch"}],"diviLine":1,"head":null},{"type":4,"body":[{"filterName":"排序","filterType":1,"group":[{"title":"排序","data":[{"id":1,"name":"综合排序"},{"id":2,"name":"人气从高到低"},{"id":3,"name":"时间从新到旧"}]}]},{"filterName":"性别年龄","filterType":2,"group":[{"title":"性别筛选","data":[{"id":1,"name":"只看男生"},{"id":2,"name":"只看女生"}]},{"title":"年龄筛选","data":[{"id":1,"name":"60后"},{"id":2,"name":"70后"},{"id":3,"name":"80后"},{"id":4,"name":"90后"}]}]},{"filterName":"擅长方向","filterType":3,"group":[{"title":"擅长方向","data":[{"id":1,"name":"恋爱"},{"id":2,"name":"婚姻家庭"},{"id":3,"name":"陪聊治愈"},{"id":4,"name":"情绪压力"},{"id":5,"name":"亲子教育"},{"id":7,"name":"职业"},{"id":8,"name":"人际"},{"id":9,"name":"个人成长"}]}]}],"diviLine":1,"head":null},{"type":5,"body":[{"confidedId":754,"confidedName":"刘和平","confidedIcon":"https://img.ydlcdn.com/file/2019/05/08/tmwz7d58nx3lecwl.jpg!s200x200","confideHearNum":"已聆听2462次","doctorId":9033,"uid":2237915,"confideVoice":"https://img.ydlcdn.com/file/2019/05/27/topquczw1ek0iojq.mp3","tags":"恋爱,婚姻家庭,人际,情绪压力,职场心理","confideContent":"能够帮助到你是我最大的快乐,我会做好每一次咨询。","confideSex":2,"status":1,"confideLine":1,"confideAddress":"","confidePraise":"100.0%","confideFee":50,"confideConnection":"100%","confidedTag":["恋爱","婚姻家庭","人际","情绪压力","职场心理"],"confideNum":"2462人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F9033%3Fid%3D754%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":true},{"confidedId":577,"confidedName":"霍慧鹏","confidedIcon":"https://img.ydlcdn.com/file/2017/12/13/bvug749vkvtpaff0.png!s200x200","confideHearNum":"已聆听363次","doctorId":5224,"uid":1490380,"confideVoice":"https://img.ydlcdn.com/file/2019/07/01/mnl6e7vgmzfhklo1.mp3","tags":"恋爱婚姻,情绪压力,职业规划","confideContent":"用生命陪伴生命,用生命感动生命,用生命影响生命。","confideSex":1,"status":2,"confideLine":3,"confideAddress":"","confidePraise":"100.0%","confideFee":50,"confideConnection":"100%","confidedTag":["恋爱婚姻","情绪压力","职业规划"],"confideNum":"363人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F5224%3Fid%3D577%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":null},{"confidedId":830,"confidedName":"刘艳华","confidedIcon":"https://img.ydlcdn.com/file/2019/05/08/szr3b87jldrrd0ac.jpg!s200x200","confideHearNum":"已聆听2339次","doctorId":10539,"uid":2640524,"confideVoice":"https://img.ydlcdn.com/file/2019/06/11/xp2uybpfxv33qbeh.mp3","tags":"恋爱婚姻,情绪压力,个人成长","confideContent":"用心倾听您的故事,用爱陪伴您的成长。","confideSex":2,"status":1,"confideLine":1,"confideAddress":"","confidePraise":"100.0%","confideFee":50,"confideConnection":"99.0%","confidedTag":["恋爱婚姻","情绪压力","个人成长"],"confideNum":"2339人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F10539%3Fid%3D830%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":true},{"confidedId":865,"confidedName":"金哲君","confidedIcon":"https://img.ydlcdn.com/file/2019/03/22/kl04mglvr3xjtpsf.jpg!s200x200","confideHearNum":"已聆听481次","doctorId":7233,"uid":1894118,"confideVoice":"https://img.ydlcdn.com/file/2019/06/14/wwdyls5m4dnwvhor.mp3","tags":"情感挽回,婚恋技巧,减压解惑","confideContent":"用爱用心,助您缓解压力,解决问题。","confideSex":1,"status":1,"confideLine":3,"confideAddress":"","confidePraise":"100.0%","confideFee":50,"confideConnection":"100%","confidedTag":["情感挽回","婚恋技巧","减压解惑"],"confideNum":"481人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F7233%3Fid%3D865%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":null},{"confidedId":264,"confidedName":"姜建萍","confidedIcon":"https://img.ydlcdn.com/file/2019/06/6ebe18133ff74f43b7e7c9a5a630352d.jpg!s200x200","confideHearNum":"已聆听2539次","doctorId":1614,"uid":97078,"confideVoice":"https://video.ydlcdn.com/2016/08/05/c888edade212746b1445ede3d1d00791.mp3","tags":"65后,恋爱婚姻,青少年心理","confideContent":"亲爱的,外面没有别人,来这里感受自己真实的内心吧。","confideSex":2,"status":1,"confideLine":1,"confideAddress":"嘉兴","confidePraise":"100.0%","confideFee":50,"confideConnection":"99.0%","confidedTag":["65后","恋爱婚姻","青少年心理"],"confideNum":"2539人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F1614%3Fid%3D264%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":true},{"confidedId":683,"confidedName":"杨秋玲","confidedIcon":"https://img.ydlcdn.com/file/2018/05/03/y6ngclx3qi0lxlon.jpg!s200x200","confideHearNum":"已聆听597次","doctorId":7428,"uid":1925392,"confideVoice":"https://img.ydlcdn.com/file/2019/06/14/lt1y3xmgoqq82vzr.mp3","tags":"婚恋家庭,心理健康,个人成长,职场管理,家庭教育","confideContent":"用心聆听您的故事,用爱读懂您的心声,用阳光拨动您的...","confideSex":2,"status":2,"confideLine":3,"confideAddress":"湖北","confidePraise":"100.0%","confideFee":50,"confideConnection":"100%","confidedTag":["婚恋家庭","心理健康","个人成长","职场管理","家庭教育"],"confideNum":"597人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F7428%3Fid%3D683%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":null},{"confidedId":852,"confidedName":"赵佳文","confidedIcon":"https://img.ydlcdn.com/file/2019/05/13/ercwphfmxexex0rs.jpg!s200x200","confideHearNum":"已聆听968次","doctorId":10556,"uid":2455784,"confideVoice":"https://img.ydlcdn.com/file/2019/06/14/mj4o6yi3y3txwahu.mp3","tags":"恋爱婚姻,孩子教育,个人成长","confideContent":"用心陪伴,用爱倾听,让我们一起共同成长!","confideSex":2,"status":1,"confideLine":1,"confideAddress":"","confidePraise":"100.0%","confideFee":50,"confideConnection":"99.0%","confidedTag":["恋爱婚姻","孩子教育","个人成长"],"confideNum":"968人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F10556%3Fid%3D852%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":null},{"confidedId":917,"confidedName":"张学静","confidedIcon":"https://img.ydlcdn.com/file/2019/06/05/z5uydjprae13ro9m.jpg!s200x200","confideHearNum":"已聆听186次","doctorId":11146,"uid":1962330,"confideVoice":"https://img.ydlcdn.com/file/2019/06/05/hzn62l12tgps95na.mp3","tags":"恋爱婚姻,情绪压力,个人成长","confideContent":"每个生命都值得被温柔对待","confideSex":2,"status":1,"confideLine":1,"confideAddress":"鞍山","confidePraise":"98.0%","confideFee":50,"confideConnection":"100%","confidedTag":["恋爱婚姻","情绪压力","个人成长"],"confideNum":"186人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F11146%3Fid%3D917%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":null},{"confidedId":799,"confidedName":"松华","confidedIcon":"https://img.ydlcdn.com/file/2019/05/23/nttqymv0fzthu2qk.png!s200x200","confideHearNum":"已聆听1787次","doctorId":9899,"uid":2426437,"confideVoice":"https://img.ydlcdn.com/file/2019/05/27/xrzc1vh3cbss8hiq.mp3","tags":"恋爱婚姻,情绪压力,家庭关系","confideContent":"陪伴您走过人生的一段风景。","confideSex":2,"status":1,"confideLine":1,"confideAddress":"","confidePraise":"100.0%","confideFee":50,"confideConnection":"99.0%","confidedTag":["恋爱婚姻","情绪压力","家庭关系"],"confideNum":"1787人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F9899%3Fid%3D799%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":null},{"confidedId":207,"confidedName":"辛红芳","confidedIcon":"https://img.ydlcdn.com/file/2019/06/10/7d9d270a880f68411a8a690900279f4e..jpg!s200x200","confideHearNum":"已聆听1696次","doctorId":1658,"uid":88532,"confideVoice":"https://img.ydlcdn.com/file/2019/06/14/6h4kqp097d1ljgw1.mp3","tags":"恋爱婚姻,情绪压力,个人成长","confideContent":"人生是一场无人可代的修行,心灵是一朵自性圆满的莲花...","confideSex":2,"status":1,"confideLine":1,"confideAddress":"阜阳","confidePraise":"98.0%","confideFee":50,"confideConnection":"100%","confidedTag":["恋爱婚姻","情绪压力","个人成长"],"confideNum":"1696人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F1658%3Fid%3D207%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":null},{"confidedId":743,"confidedName":"于新萍","confidedIcon":"https://img.ydlcdn.com/file/2019/07/31/lgc8f086kvjx161q.png!s200x200","confideHearNum":"已聆听362次","doctorId":4765,"uid":1388976,"confideVoice":"https://img.ydlcdn.com/file/2019/05/27/zp8n59b5x81tz8n3.mp3","tags":"70后,恋爱,婚姻家庭,情绪压力,职场,亲子,人际,个人成长","confideContent":"用心陪伴,用爱倾听,我在壹点灵陪伴您!","confideSex":2,"status":1,"confideLine":3,"confideAddress":"Shenyang","confidePraise":"100.0%","confideFee":50,"confideConnection":"100%","confidedTag":["70后","恋爱","婚姻家庭","情绪压力","职场","亲子","人际","个人成长"],"confideNum":"362人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F4765%3Fid%3D743%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":null},{"confidedId":633,"confidedName":"刘金双","confidedIcon":"https://img.ydlcdn.com/file/2019/05/08/a8af3svzt14awooa.jpg!s200x200","confideHearNum":"已聆听1047次","doctorId":3277,"uid":1193634,"confideVoice":"https://img.ydlcdn.com/file/2019/06/14/7jlq9gzvsj6ezt8a.mp3","tags":"恋爱婚姻,情绪压力,亲子教育,人际关系","confideContent":"成长路上,有我与你同行","confideSex":2,"status":1,"confideLine":1,"confideAddress":"江苏苏州","confidePraise":"100.0%","confideFee":50,"confideConnection":"100%","confidedTag":["恋爱婚姻","情绪压力","亲子教育","人际关系"],"confideNum":"1047人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F3277%3Fid%3D633%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":null},{"confidedId":171,"confidedName":"吴立秀","confidedIcon":"https://img.ydlcdn.com/file/2019/07/05/hxmmzsv0ylsz83ne.png!s200x200","confideHearNum":"已聆听5245次","doctorId":1261,"uid":49874,"confideVoice":"https://img.ydlcdn.com/file/2019/05/27/usgf8492ujvrdnud.mp3","tags":"75后,恋爱婚姻,个人成长,孩子教育","confideContent":"当你的世界飘雨的时候,不要忧伤,我就陪在你身旁,待...","confideSex":2,"status":2,"confideLine":3,"confideAddress":"唐山","confidePraise":"100.0%","confideFee":50,"confideConnection":"100%","confidedTag":["75后","恋爱婚姻","个人成长","孩子教育"],"confideNum":"5245人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F1261%3Fid%3D171%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":null},{"confidedId":703,"confidedName":"高丰娟","confidedIcon":"https://img.ydlcdn.com/file/2019/05/2e935a1f0ad94ec1b001c5919dbbf41e.jpg!s200x200","confideHearNum":"已聆听194次","doctorId":8879,"uid":2208415,"confideVoice":"https://video.ydlcdn.com/2018/08/16/d61282f651b1714a20f4fe7c6686f60c.mp3","tags":"70后,个人成长,青春叛逆,情绪压力","confideContent":"您倾诉 我倾听 您成长 我陪伴","confideSex":2,"status":1,"confideLine":1,"confideAddress":"郑州","confidePraise":"100.0%","confideFee":50,"confideConnection":"100%","confidedTag":["70后","个人成长","青春叛逆","情绪压力"],"confideNum":"194人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F8879%3Fid%3D703%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":null},{"confidedId":270,"confidedName":"苏建游","confidedIcon":"https://img.ydlcdn.com/file/2019/05/09/txau5ftn55qle9vd.jpg!s200x200","confideHearNum":"已聆听407次","doctorId":1972,"uid":1018763,"confideVoice":"https://video.ydlcdn.com/2016/08/10/b5c04a3d2d3fc3e0d6bd1cc541ed5377.mp3","tags":"75后,情绪宣泄,婚姻家庭,个人成长","confideContent":"与其说是别人让你痛苦,不如说是自己的修养不够,归去...","confideSex":1,"status":2,"confideLine":3,"confideAddress":"银川","confidePraise":"100.0%","confideFee":50,"confideConnection":"100%","confidedTag":["75后","情绪宣泄","婚姻家庭","个人成长"],"confideNum":"407人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F1972%3Fid%3D270%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":null},{"confidedId":358,"confidedName":"卜彬","confidedIcon":"https://img.ydlcdn.com/file/2019/07/04/4bmumglwx2l2mwaq.png!s200x200","confideHearNum":"已聆听1079次","doctorId":2287,"uid":1011925,"confideVoice":"https://img.ydlcdn.com/file/2019/05/27/651t1fsu8gh79bpz.mp3","tags":"60后,情绪压力,个人成长,亲子关系","confideContent":"施者有意,受者能识,是亿万劫中的偶然,可遇不可求","confideSex":2,"status":1,"confideLine":3,"confideAddress":"","confidePraise":"100.0%","confideFee":50,"confideConnection":"100%","confidedTag":["60后","情绪压力","个人成长","亲子关系"],"confideNum":"1079人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F2287%3Fid%3D358%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":null},{"confidedId":968,"confidedName":"张齐","confidedIcon":"https://img.ydlcdn.com/file/2019/04/26/m71cffk8mmmuvaog.png!s200x200","confideHearNum":"已聆听10次","doctorId":12073,"uid":3136130,"confideVoice":"https://img.ydlcdn.com/file/2019/07/19/pz9cnnwu4tqwx5qe.mp3","tags":"恋爱婚姻,职业发展,亲子教育","confideContent":"陪伴您每一个孤独的时刻,走出迷茫与困惑!","confideSex":2,"status":1,"confideLine":1,"confideAddress":"","confidePraise":"100.0%","confideFee":50,"confideConnection":"100%","confidedTag":["恋爱婚姻","职业发展","亲子教育"],"confideNum":"10人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F12073%3Fid%3D968%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":null},{"confidedId":158,"confidedName":"饶小思","confidedIcon":"https://img.ydlcdn.com/file/2019/04/04/sdzoq10ffvkw0yae.png!s200x200","confideHearNum":"已聆听783次","doctorId":1023,"uid":27255,"confideVoice":"https://img.ydlcdn.com/file/2019/06/17/nkffud0rjpgbq2l4.mp3","tags":"80后,情绪疏导,婚恋情感,人际关系","confideContent":"从您拨通电话那一刻开始,我将用爱和温暖,倾听和疗愈...","confideSex":1,"status":1,"confideLine":3,"confideAddress":"咸宁","confidePraise":"100.0%","confideFee":50,"confideConnection":"100%","confidedTag":["80后","情绪疏导","婚恋情感","人际关系"],"confideNum":"783人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F1023%3Fid%3D158%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":null},{"confidedId":843,"confidedName":"时卫玲","confidedIcon":"https://img.ydlcdn.com/file/2019/05/13/21z4scikrbqk1fij.png!s200x200","confideHearNum":"已聆听659次","doctorId":2984,"uid":1157749,"confideVoice":"https://img.ydlcdn.com/file/2019/05/27/2v8lp0843b2yu05d.mp3","tags":"婚姻家庭,亲子教育,人际关系,职业发展","confideContent":"专业耐心的她,帮你快速解除困惑,走出阴霾,收获轻松...","confideSex":2,"status":1,"confideLine":3,"confideAddress":"海淀","confidePraise":"100.0%","confideFee":50,"confideConnection":"100%","confidedTag":["婚姻家庭","亲子教育","人际关系","职业发展"],"confideNum":"659人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F2984%3Fid%3D843%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":null},{"confidedId":972,"confidedName":"张宁娟","confidedIcon":"https://img.ydlcdn.com/file/2019/04/08/55aesbp00ze057xb.png!s200x200","confideHearNum":"已聆听11次","doctorId":6246,"uid":1215191,"confideVoice":"https://img.ydlcdn.com/file/2019/07/23/0v2upo2ua5eh5kfo.mp3","tags":"恋爱婚姻,孩子教育,上岗认证 ","confideContent":"我愿尽我所能,陪您一起成长!","confideSex":2,"status":1,"confideLine":3,"confideAddress":"","confidePraise":"100.0%","confideFee":50,"confideConnection":"100%","confidedTag":["恋爱婚姻","孩子教育","上岗认证 "],"confideNum":"11人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F6246%3Fid%3D972%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":null},{"confidedId":476,"confidedName":"董永波","confidedIcon":"https://img.ydlcdn.com/file/2017/03/30/w864sqf5vot0ntrf.jpg!s200x200","confideHearNum":"已聆听2291次","doctorId":1599,"uid":94247,"confideVoice":"https://img.ydlcdn.com/file/2019/06/18/1rq61e6n0fzze3b6.mp3","tags":"70后,恋爱婚姻,个人成长","confideContent":"无条件的聆听你的故事,伴随你一起成长!","confideSex":1,"status":1,"confideLine":1,"confideAddress":"三门峡","confidePraise":"100.0%","confideFee":50,"confideConnection":"98.0%","confidedTag":["70后","恋爱婚姻","个人成长"],"confideNum":"2291人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F1599%3Fid%3D476%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":null},{"confidedId":963,"confidedName":"刘月","confidedIcon":"https://img.ydlcdn.com/file/2019/07/30/wxckamcz08profpf.png!s200x200","confideHearNum":"已聆听40次","doctorId":10722,"uid":2666484,"confideVoice":"https://img.ydlcdn.com/file/2019/07/18/gj6useyjt3edyjta.mp3","tags":"恋爱婚姻,情绪压力,孩子教育","confideContent":"以心灵温暖心灵,让我陪伴您遇见更好的自己!","confideSex":2,"status":1,"confideLine":1,"confideAddress":"","confidePraise":"100.0%","confideFee":50,"confideConnection":"100%","confidedTag":["恋爱婚姻","情绪压力","孩子教育"],"confideNum":"40人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F10722%3Fid%3D963%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":null},{"confidedId":970,"confidedName":"蒋安慧","confidedIcon":"https://img.ydlcdn.com/file/2019/04/03/lggqofy9xidj20mu.png!s200x200","confideHearNum":"已聆听13次","doctorId":7548,"uid":1253941,"confideVoice":"30","tags":"恋婚情感,人际关系,自我认知","confideContent":"我想做一个小太阳,带给你丝丝温暖;\r\n亦想做一个月...","confideSex":2,"status":1,"confideLine":3,"confideAddress":"","confidePraise":"100.0%","confideFee":50,"confideConnection":"100%","confidedTag":["恋婚情感","人际关系","自我认知"],"confideNum":"13人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F7548%3Fid%3D970%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":null},{"confidedId":356,"confidedName":"阳仁辉","confidedIcon":"https://img.ydlcdn.com/file/2019/05/0c53618cafc9471d9d5abdba18297b46.jpg!s200x200","confideHearNum":"已聆听1283次","doctorId":2250,"uid":1061863,"confideVoice":"https://img.ydlcdn.com/file/2019/06/14/iwzbohi3yk8qmrav.mp3","tags":"85后,个人成长,学生心理,职场心理","confideContent":"你不是孤军奋战","confideSex":1,"status":1,"confideLine":3,"confideAddress":"郴州","confidePraise":"100.0%","confideFee":50,"confideConnection":"100%","confidedTag":["85后","个人成长","学生心理","职场心理"],"confideNum":"1283人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F2250%3Fid%3D356%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":null},{"confidedId":965,"confidedName":"杨萍","confidedIcon":"https://img.ydlcdn.com/file/2019/07/19/wi8k4bi2e53kpfqk.jpg!s200x200","confideHearNum":"已聆听10次","doctorId":10362,"uid":2587326,"confideVoice":"https://img.ydlcdn.com/file/2019/07/19/29svsu9jdit4pda8.mp3","tags":"恋爱情感,亲子教育,个人成长","confideContent":"让我用专业.温暖来陪伴您,聆听您的故事","confideSex":2,"status":1,"confideLine":3,"confideAddress":"杭州","confidePraise":"100.0%","confideFee":50,"confideConnection":"100%","confidedTag":["恋爱情感","亲子教育","个人成长"],"confideNum":"10人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F10362%3Fid%3D965%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":null},{"confidedId":554,"confidedName":"翟曙霞","confidedIcon":"https://img.ydlcdn.com/file/2019/05/a3646cb80aea494682c488e4c22be8fe.jpg!s200x200","confideHearNum":"已聆听1760次","doctorId":2353,"uid":1085815,"confideVoice":"https://video.ydlcdn.com/2017/09/11/718dbba7c20d0b4ea1dcf35b024aab51.mp3","tags":"80后,恋爱婚姻,情绪压力,人际关系","confideContent":"用心陪伴,用爱倾听,留下烦恼,带走轻松。","confideSex":2,"status":1,"confideLine":1,"confideAddress":"淮安","confidePraise":"100.0%","confideFee":50,"confideConnection":"100%","confidedTag":["80后","恋爱婚姻","情绪压力","人际关系"],"confideNum":"1760人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F2353%3Fid%3D554%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":null},{"confidedId":787,"confidedName":"邵奎高","confidedIcon":"https://img.ydlcdn.com/file/2019/05/83fdbf5d280c4f0ebc01518122abe571.jpg!s200x200","confideHearNum":"已聆听1018次","doctorId":9548,"uid":2348253,"confideVoice":"https://img.ydlcdn.com/file/2019/05/27/iqo2ql3t6dklodtq.mp3","tags":"70后,恋爱,婚姻家庭,情绪压力,亲子教育","confideContent":"陪你安抚心灵,助你轻松自在,我在这里等你!","confideSex":1,"status":1,"confideLine":3,"confideAddress":"大连","confidePraise":"100.0%","confideFee":50,"confideConnection":"100%","confidedTag":["70后","恋爱","婚姻家庭","情绪压力","亲子教育"],"confideNum":"1018人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F9548%3Fid%3D787%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":null},{"confidedId":360,"confidedName":"许文慧","confidedIcon":"https://img.ydlcdn.com/file/2016/11/09/y9xyr9yzjnj566u2.jpg!s200x200","confideHearNum":"已聆听524次","doctorId":2457,"uid":1097704,"confideVoice":"https://img.ydlcdn.com/file/2019/06/18/tg6s9n1js1vsw60o.mp3","tags":"70后,两性情感,亲子教育,婚姻家庭","confideContent":"万相皆由有心生,用心倾听,用爱陪伴,相信每位来访者...","confideSex":2,"status":1,"confideLine":1,"confideAddress":"徐汇","confidePraise":"100.0%","confideFee":50,"confideConnection":"100%","confidedTag":["70后","两性情感","亲子教育","婚姻家庭"],"confideNum":"524人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F2457%3Fid%3D360%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":null},{"confidedId":780,"confidedName":"王丽","confidedIcon":"https://img.ydlcdn.com/file/2019/05/28/jczkj3zl80snwjcy.png!s200x200","confideHearNum":"已聆听155次","doctorId":9048,"uid":1446626,"confideVoice":"https://video.ydlcdn.com/2018/10/18/cdfe49cf1825295b26fa2843a96af789.mp3","tags":"恋爱婚姻,情绪压力,上岗认证,80后","confideContent":"用专注的耳朵,聆听每一朵姹紫嫣红的心声!","confideSex":2,"status":1,"confideLine":1,"confideAddress":"","confidePraise":"100.0%","confideFee":50,"confideConnection":"100%","confidedTag":["恋爱婚姻","情绪压力","上岗认证","80后"],"confideNum":"155人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F9048%3Fid%3D780%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":null},{"confidedId":774,"confidedName":"林秋祯","confidedIcon":"https://img.ydlcdn.com/file/2019/05/2324206d00ab4585ae2e22333e48fbc3.jpg!s200x200","confideHearNum":"已聆听77次","doctorId":8974,"uid":2228959,"confideVoice":"https://img.ydlcdn.com/file/2019/06/18/f2uf6yf70wcccuvk.mp3","tags":"情绪压力,家庭关系,个人成长","confideContent":"用温暖、真诚为您点亮生命的道路,用专业、耐心陪您找...","confideSex":2,"status":1,"confideLine":1,"confideAddress":"","confidePraise":"100.0%","confideFee":50,"confideConnection":"97.0%","confidedTag":["情绪压力","家庭关系","个人成长"],"confideNum":"77人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F8974%3Fid%3D774%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":null}],"diviLine":1,"head":null},{"type":6,"body":[{"confidedId":754,"confidedName":"刘和平","confidedIcon":"https://img.ydlcdn.com/file/2019/05/08/tmwz7d58nx3lecwl.jpg!s200x200","confideHearNum":"已聆听2462次","doctorId":9033,"uid":2237915,"confideVoice":"https://img.ydlcdn.com/file/2019/05/27/topquczw1ek0iojq.mp3","tags":"恋爱,婚姻家庭,人际,情绪压力,职场心理","confideContent":"能够帮助到你是我最大的快乐,我会做好每一次咨询。","confideSex":2,"status":1,"confideLine":1,"confideAddress":"","confidePraise":"100.0%","confideFee":50,"confideConnection":"100%","confidedTag":["恋爱","婚姻家庭","人际","情绪压力","职场心理"],"confideNum":"2462人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F9033%3Fid%3D754%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":true},{"confidedId":577,"confidedName":"霍慧鹏","confidedIcon":"https://img.ydlcdn.com/file/2017/12/13/bvug749vkvtpaff0.png!s200x200","confideHearNum":"已聆听363次","doctorId":5224,"uid":1490380,"confideVoice":"https://img.ydlcdn.com/file/2019/07/01/mnl6e7vgmzfhklo1.mp3","tags":"恋爱婚姻,情绪压力,职业规划","confideContent":"用生命陪伴生命,用生命感动生命,用生命影响生命。","confideSex":1,"status":2,"confideLine":3,"confideAddress":"","confidePraise":"100.0%","confideFee":50,"confideConnection":"100%","confidedTag":["恋爱婚姻","情绪压力","职业规划"],"confideNum":"363人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F5224%3Fid%3D577%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":null},{"confidedId":830,"confidedName":"刘艳华","confidedIcon":"https://img.ydlcdn.com/file/2019/05/08/szr3b87jldrrd0ac.jpg!s200x200","confideHearNum":"已聆听2339次","doctorId":10539,"uid":2640524,"confideVoice":"https://img.ydlcdn.com/file/2019/06/11/xp2uybpfxv33qbeh.mp3","tags":"恋爱婚姻,情绪压力,个人成长","confideContent":"用心倾听您的故事,用爱陪伴您的成长。","confideSex":2,"status":1,"confideLine":1,"confideAddress":"","confidePraise":"100.0%","confideFee":50,"confideConnection":"99.0%","confidedTag":["恋爱婚姻","情绪压力","个人成长"],"confideNum":"2339人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F10539%3Fid%3D830%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":true},{"confidedId":865,"confidedName":"金哲君","confidedIcon":"https://img.ydlcdn.com/file/2019/03/22/kl04mglvr3xjtpsf.jpg!s200x200","confideHearNum":"已聆听481次","doctorId":7233,"uid":1894118,"confideVoice":"https://img.ydlcdn.com/file/2019/06/14/wwdyls5m4dnwvhor.mp3","tags":"情感挽回,婚恋技巧,减压解惑","confideContent":"用爱用心,助您缓解压力,解决问题。","confideSex":1,"status":1,"confideLine":3,"confideAddress":"","confidePraise":"100.0%","confideFee":50,"confideConnection":"100%","confidedTag":["情感挽回","婚恋技巧","减压解惑"],"confideNum":"481人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F7233%3Fid%3D865%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":null},{"confidedId":264,"confidedName":"姜建萍","confidedIcon":"https://img.ydlcdn.com/file/2019/06/6ebe18133ff74f43b7e7c9a5a630352d.jpg!s200x200","confideHearNum":"已聆听2539次","doctorId":1614,"uid":97078,"confideVoice":"https://video.ydlcdn.com/2016/08/05/c888edade212746b1445ede3d1d00791.mp3","tags":"65后,恋爱婚姻,青少年心理","confideContent":"亲爱的,外面没有别人,来这里感受自己真实的内心吧。","confideSex":2,"status":1,"confideLine":1,"confideAddress":"嘉兴","confidePraise":"100.0%","confideFee":50,"confideConnection":"99.0%","confidedTag":["65后","恋爱婚姻","青少年心理"],"confideNum":"2539人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F1614%3Fid%3D264%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":true},{"confidedId":683,"confidedName":"杨秋玲","confidedIcon":"https://img.ydlcdn.com/file/2018/05/03/y6ngclx3qi0lxlon.jpg!s200x200","confideHearNum":"已聆听597次","doctorId":7428,"uid":1925392,"confideVoice":"https://img.ydlcdn.com/file/2019/06/14/lt1y3xmgoqq82vzr.mp3","tags":"婚恋家庭,心理健康,个人成长,职场管理,家庭教育","confideContent":"用心聆听您的故事,用爱读懂您的心声,用阳光拨动您的...","confideSex":2,"status":2,"confideLine":3,"confideAddress":"湖北","confidePraise":"100.0%","confideFee":50,"confideConnection":"100%","confidedTag":["婚恋家庭","心理健康","个人成长","职场管理","家庭教育"],"confideNum":"597人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F7428%3Fid%3D683%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":null},{"confidedId":852,"confidedName":"赵佳文","confidedIcon":"https://img.ydlcdn.com/file/2019/05/13/ercwphfmxexex0rs.jpg!s200x200","confideHearNum":"已聆听968次","doctorId":10556,"uid":2455784,"confideVoice":"https://img.ydlcdn.com/file/2019/06/14/mj4o6yi3y3txwahu.mp3","tags":"恋爱婚姻,孩子教育,个人成长","confideContent":"用心陪伴,用爱倾听,让我们一起共同成长!","confideSex":2,"status":1,"confideLine":1,"confideAddress":"","confidePraise":"100.0%","confideFee":50,"confideConnection":"99.0%","confidedTag":["恋爱婚姻","孩子教育","个人成长"],"confideNum":"968人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F10556%3Fid%3D852%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":null},{"confidedId":917,"confidedName":"张学静","confidedIcon":"https://img.ydlcdn.com/file/2019/06/05/z5uydjprae13ro9m.jpg!s200x200","confideHearNum":"已聆听186次","doctorId":11146,"uid":1962330,"confideVoice":"https://img.ydlcdn.com/file/2019/06/05/hzn62l12tgps95na.mp3","tags":"恋爱婚姻,情绪压力,个人成长","confideContent":"每个生命都值得被温柔对待","confideSex":2,"status":1,"confideLine":1,"confideAddress":"鞍山","confidePraise":"98.0%","confideFee":50,"confideConnection":"100%","confidedTag":["恋爱婚姻","情绪压力","个人成长"],"confideNum":"186人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F11146%3Fid%3D917%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":null},{"confidedId":799,"confidedName":"松华","confidedIcon":"https://img.ydlcdn.com/file/2019/05/23/nttqymv0fzthu2qk.png!s200x200","confideHearNum":"已聆听1787次","doctorId":9899,"uid":2426437,"confideVoice":"https://img.ydlcdn.com/file/2019/05/27/xrzc1vh3cbss8hiq.mp3","tags":"恋爱婚姻,情绪压力,家庭关系","confideContent":"陪伴您走过人生的一段风景。","confideSex":2,"status":1,"confideLine":1,"confideAddress":"","confidePraise":"100.0%","confideFee":50,"confideConnection":"99.0%","confidedTag":["恋爱婚姻","情绪压力","家庭关系"],"confideNum":"1787人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F9899%3Fid%3D799%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":null},{"confidedId":207,"confidedName":"辛红芳","confidedIcon":"https://img.ydlcdn.com/file/2019/06/10/7d9d270a880f68411a8a690900279f4e..jpg!s200x200","confideHearNum":"已聆听1696次","doctorId":1658,"uid":88532,"confideVoice":"https://img.ydlcdn.com/file/2019/06/14/6h4kqp097d1ljgw1.mp3","tags":"恋爱婚姻,情绪压力,个人成长","confideContent":"人生是一场无人可代的修行,心灵是一朵自性圆满的莲花...","confideSex":2,"status":1,"confideLine":1,"confideAddress":"阜阳","confidePraise":"98.0%","confideFee":50,"confideConnection":"100%","confidedTag":["恋爱婚姻","情绪压力","个人成长"],"confideNum":"1696人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F1658%3Fid%3D207%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":null},{"confidedId":743,"confidedName":"于新萍","confidedIcon":"https://img.ydlcdn.com/file/2019/07/31/lgc8f086kvjx161q.png!s200x200","confideHearNum":"已聆听362次","doctorId":4765,"uid":1388976,"confideVoice":"https://img.ydlcdn.com/file/2019/05/27/zp8n59b5x81tz8n3.mp3","tags":"70后,恋爱,婚姻家庭,情绪压力,职场,亲子,人际,个人成长","confideContent":"用心陪伴,用爱倾听,我在壹点灵陪伴您!","confideSex":2,"status":1,"confideLine":3,"confideAddress":"Shenyang","confidePraise":"100.0%","confideFee":50,"confideConnection":"100%","confidedTag":["70后","恋爱","婚姻家庭","情绪压力","职场","亲子","人际","个人成长"],"confideNum":"362人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F4765%3Fid%3D743%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":null},{"confidedId":633,"confidedName":"刘金双","confidedIcon":"https://img.ydlcdn.com/file/2019/05/08/a8af3svzt14awooa.jpg!s200x200","confideHearNum":"已聆听1047次","doctorId":3277,"uid":1193634,"confideVoice":"https://img.ydlcdn.com/file/2019/06/14/7jlq9gzvsj6ezt8a.mp3","tags":"恋爱婚姻,情绪压力,亲子教育,人际关系","confideContent":"成长路上,有我与你同行","confideSex":2,"status":1,"confideLine":1,"confideAddress":"江苏苏州","confidePraise":"100.0%","confideFee":50,"confideConnection":"100%","confidedTag":["恋爱婚姻","情绪压力","亲子教育","人际关系"],"confideNum":"1047人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F3277%3Fid%3D633%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":null},{"confidedId":171,"confidedName":"吴立秀","confidedIcon":"https://img.ydlcdn.com/file/2019/07/05/hxmmzsv0ylsz83ne.png!s200x200","confideHearNum":"已聆听5245次","doctorId":1261,"uid":49874,"confideVoice":"https://img.ydlcdn.com/file/2019/05/27/usgf8492ujvrdnud.mp3","tags":"75后,恋爱婚姻,个人成长,孩子教育","confideContent":"当你的世界飘雨的时候,不要忧伤,我就陪在你身旁,待...","confideSex":2,"status":2,"confideLine":3,"confideAddress":"唐山","confidePraise":"100.0%","confideFee":50,"confideConnection":"100%","confidedTag":["75后","恋爱婚姻","个人成长","孩子教育"],"confideNum":"5245人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F1261%3Fid%3D171%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":null},{"confidedId":703,"confidedName":"高丰娟","confidedIcon":"https://img.ydlcdn.com/file/2019/05/2e935a1f0ad94ec1b001c5919dbbf41e.jpg!s200x200","confideHearNum":"已聆听194次","doctorId":8879,"uid":2208415,"confideVoice":"https://video.ydlcdn.com/2018/08/16/d61282f651b1714a20f4fe7c6686f60c.mp3","tags":"70后,个人成长,青春叛逆,情绪压力","confideContent":"您倾诉 我倾听 您成长 我陪伴","confideSex":2,"status":1,"confideLine":1,"confideAddress":"郑州","confidePraise":"100.0%","confideFee":50,"confideConnection":"100%","confidedTag":["70后","个人成长","青春叛逆","情绪压力"],"confideNum":"194人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F8879%3Fid%3D703%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":null},{"confidedId":270,"confidedName":"苏建游","confidedIcon":"https://img.ydlcdn.com/file/2019/05/09/txau5ftn55qle9vd.jpg!s200x200","confideHearNum":"已聆听407次","doctorId":1972,"uid":1018763,"confideVoice":"https://video.ydlcdn.com/2016/08/10/b5c04a3d2d3fc3e0d6bd1cc541ed5377.mp3","tags":"75后,情绪宣泄,婚姻家庭,个人成长","confideContent":"与其说是别人让你痛苦,不如说是自己的修养不够,归去...","confideSex":1,"status":2,"confideLine":3,"confideAddress":"银川","confidePraise":"100.0%","confideFee":50,"confideConnection":"100%","confidedTag":["75后","情绪宣泄","婚姻家庭","个人成长"],"confideNum":"407人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F1972%3Fid%3D270%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":null},{"confidedId":358,"confidedName":"卜彬","confidedIcon":"https://img.ydlcdn.com/file/2019/07/04/4bmumglwx2l2mwaq.png!s200x200","confideHearNum":"已聆听1079次","doctorId":2287,"uid":1011925,"confideVoice":"https://img.ydlcdn.com/file/2019/05/27/651t1fsu8gh79bpz.mp3","tags":"60后,情绪压力,个人成长,亲子关系","confideContent":"施者有意,受者能识,是亿万劫中的偶然,可遇不可求","confideSex":2,"status":1,"confideLine":3,"confideAddress":"","confidePraise":"100.0%","confideFee":50,"confideConnection":"100%","confidedTag":["60后","情绪压力","个人成长","亲子关系"],"confideNum":"1079人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F2287%3Fid%3D358%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":null},{"confidedId":968,"confidedName":"张齐","confidedIcon":"https://img.ydlcdn.com/file/2019/04/26/m71cffk8mmmuvaog.png!s200x200","confideHearNum":"已聆听10次","doctorId":12073,"uid":3136130,"confideVoice":"https://img.ydlcdn.com/file/2019/07/19/pz9cnnwu4tqwx5qe.mp3","tags":"恋爱婚姻,职业发展,亲子教育","confideContent":"陪伴您每一个孤独的时刻,走出迷茫与困惑!","confideSex":2,"status":1,"confideLine":1,"confideAddress":"","confidePraise":"100.0%","confideFee":50,"confideConnection":"100%","confidedTag":["恋爱婚姻","职业发展","亲子教育"],"confideNum":"10人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F12073%3Fid%3D968%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":null},{"confidedId":158,"confidedName":"饶小思","confidedIcon":"https://img.ydlcdn.com/file/2019/04/04/sdzoq10ffvkw0yae.png!s200x200","confideHearNum":"已聆听783次","doctorId":1023,"uid":27255,"confideVoice":"https://img.ydlcdn.com/file/2019/06/17/nkffud0rjpgbq2l4.mp3","tags":"80后,情绪疏导,婚恋情感,人际关系","confideContent":"从您拨通电话那一刻开始,我将用爱和温暖,倾听和疗愈...","confideSex":1,"status":1,"confideLine":3,"confideAddress":"咸宁","confidePraise":"100.0%","confideFee":50,"confideConnection":"100%","confidedTag":["80后","情绪疏导","婚恋情感","人际关系"],"confideNum":"783人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F1023%3Fid%3D158%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":null},{"confidedId":843,"confidedName":"时卫玲","confidedIcon":"https://img.ydlcdn.com/file/2019/05/13/21z4scikrbqk1fij.png!s200x200","confideHearNum":"已聆听659次","doctorId":2984,"uid":1157749,"confideVoice":"https://img.ydlcdn.com/file/2019/05/27/2v8lp0843b2yu05d.mp3","tags":"婚姻家庭,亲子教育,人际关系,职业发展","confideContent":"专业耐心的她,帮你快速解除困惑,走出阴霾,收获轻松...","confideSex":2,"status":1,"confideLine":3,"confideAddress":"海淀","confidePraise":"100.0%","confideFee":50,"confideConnection":"100%","confidedTag":["婚姻家庭","亲子教育","人际关系","职业发展"],"confideNum":"659人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F2984%3Fid%3D843%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":null},{"confidedId":972,"confidedName":"张宁娟","confidedIcon":"https://img.ydlcdn.com/file/2019/04/08/55aesbp00ze057xb.png!s200x200","confideHearNum":"已聆听11次","doctorId":6246,"uid":1215191,"confideVoice":"https://img.ydlcdn.com/file/2019/07/23/0v2upo2ua5eh5kfo.mp3","tags":"恋爱婚姻,孩子教育,上岗认证 ","confideContent":"我愿尽我所能,陪您一起成长!","confideSex":2,"status":1,"confideLine":3,"confideAddress":"","confidePraise":"100.0%","confideFee":50,"confideConnection":"100%","confidedTag":["恋爱婚姻","孩子教育","上岗认证 "],"confideNum":"11人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F6246%3Fid%3D972%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":null},{"confidedId":476,"confidedName":"董永波","confidedIcon":"https://img.ydlcdn.com/file/2017/03/30/w864sqf5vot0ntrf.jpg!s200x200","confideHearNum":"已聆听2291次","doctorId":1599,"uid":94247,"confideVoice":"https://img.ydlcdn.com/file/2019/06/18/1rq61e6n0fzze3b6.mp3","tags":"70后,恋爱婚姻,个人成长","confideContent":"无条件的聆听你的故事,伴随你一起成长!","confideSex":1,"status":1,"confideLine":1,"confideAddress":"三门峡","confidePraise":"100.0%","confideFee":50,"confideConnection":"98.0%","confidedTag":["70后","恋爱婚姻","个人成长"],"confideNum":"2291人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F1599%3Fid%3D476%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":null},{"confidedId":963,"confidedName":"刘月","confidedIcon":"https://img.ydlcdn.com/file/2019/07/30/wxckamcz08profpf.png!s200x200","confideHearNum":"已聆听40次","doctorId":10722,"uid":2666484,"confideVoice":"https://img.ydlcdn.com/file/2019/07/18/gj6useyjt3edyjta.mp3","tags":"恋爱婚姻,情绪压力,孩子教育","confideContent":"以心灵温暖心灵,让我陪伴您遇见更好的自己!","confideSex":2,"status":1,"confideLine":1,"confideAddress":"","confidePraise":"100.0%","confideFee":50,"confideConnection":"100%","confidedTag":["恋爱婚姻","情绪压力","孩子教育"],"confideNum":"40人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F10722%3Fid%3D963%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":null},{"confidedId":970,"confidedName":"蒋安慧","confidedIcon":"https://img.ydlcdn.com/file/2019/04/03/lggqofy9xidj20mu.png!s200x200","confideHearNum":"已聆听13次","doctorId":7548,"uid":1253941,"confideVoice":"30","tags":"恋婚情感,人际关系,自我认知","confideContent":"我想做一个小太阳,带给你丝丝温暖;\r\n亦想做一个月...","confideSex":2,"status":1,"confideLine":3,"confideAddress":"","confidePraise":"100.0%","confideFee":50,"confideConnection":"100%","confidedTag":["恋婚情感","人际关系","自我认知"],"confideNum":"13人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F7548%3Fid%3D970%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":null},{"confidedId":356,"confidedName":"阳仁辉","confidedIcon":"https://img.ydlcdn.com/file/2019/05/0c53618cafc9471d9d5abdba18297b46.jpg!s200x200","confideHearNum":"已聆听1283次","doctorId":2250,"uid":1061863,"confideVoice":"https://img.ydlcdn.com/file/2019/06/14/iwzbohi3yk8qmrav.mp3","tags":"85后,个人成长,学生心理,职场心理","confideContent":"你不是孤军奋战","confideSex":1,"status":1,"confideLine":3,"confideAddress":"郴州","confidePraise":"100.0%","confideFee":50,"confideConnection":"100%","confidedTag":["85后","个人成长","学生心理","职场心理"],"confideNum":"1283人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F2250%3Fid%3D356%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":null},{"confidedId":965,"confidedName":"杨萍","confidedIcon":"https://img.ydlcdn.com/file/2019/07/19/wi8k4bi2e53kpfqk.jpg!s200x200","confideHearNum":"已聆听10次","doctorId":10362,"uid":2587326,"confideVoice":"https://img.ydlcdn.com/file/2019/07/19/29svsu9jdit4pda8.mp3","tags":"恋爱情感,亲子教育,个人成长","confideContent":"让我用专业.温暖来陪伴您,聆听您的故事","confideSex":2,"status":1,"confideLine":3,"confideAddress":"杭州","confidePraise":"100.0%","confideFee":50,"confideConnection":"100%","confidedTag":["恋爱情感","亲子教育","个人成长"],"confideNum":"10人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F10362%3Fid%3D965%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":null},{"confidedId":554,"confidedName":"翟曙霞","confidedIcon":"https://img.ydlcdn.com/file/2019/05/a3646cb80aea494682c488e4c22be8fe.jpg!s200x200","confideHearNum":"已聆听1760次","doctorId":2353,"uid":1085815,"confideVoice":"https://video.ydlcdn.com/2017/09/11/718dbba7c20d0b4ea1dcf35b024aab51.mp3","tags":"80后,恋爱婚姻,情绪压力,人际关系","confideContent":"用心陪伴,用爱倾听,留下烦恼,带走轻松。","confideSex":2,"status":1,"confideLine":1,"confideAddress":"淮安","confidePraise":"100.0%","confideFee":50,"confideConnection":"100%","confidedTag":["80后","恋爱婚姻","情绪压力","人际关系"],"confideNum":"1760人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F2353%3Fid%3D554%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":null},{"confidedId":787,"confidedName":"邵奎高","confidedIcon":"https://img.ydlcdn.com/file/2019/05/83fdbf5d280c4f0ebc01518122abe571.jpg!s200x200","confideHearNum":"已聆听1018次","doctorId":9548,"uid":2348253,"confideVoice":"https://img.ydlcdn.com/file/2019/05/27/iqo2ql3t6dklodtq.mp3","tags":"70后,恋爱,婚姻家庭,情绪压力,亲子教育","confideContent":"陪你安抚心灵,助你轻松自在,我在这里等你!","confideSex":1,"status":1,"confideLine":3,"confideAddress":"大连","confidePraise":"100.0%","confideFee":50,"confideConnection":"100%","confidedTag":["70后","恋爱","婚姻家庭","情绪压力","亲子教育"],"confideNum":"1018人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F9548%3Fid%3D787%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":null},{"confidedId":360,"confidedName":"许文慧","confidedIcon":"https://img.ydlcdn.com/file/2016/11/09/y9xyr9yzjnj566u2.jpg!s200x200","confideHearNum":"已聆听524次","doctorId":2457,"uid":1097704,"confideVoice":"https://img.ydlcdn.com/file/2019/06/18/tg6s9n1js1vsw60o.mp3","tags":"70后,两性情感,亲子教育,婚姻家庭","confideContent":"万相皆由有心生,用心倾听,用爱陪伴,相信每位来访者...","confideSex":2,"status":1,"confideLine":1,"confideAddress":"徐汇","confidePraise":"100.0%","confideFee":50,"confideConnection":"100%","confidedTag":["70后","两性情感","亲子教育","婚姻家庭"],"confideNum":"524人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F2457%3Fid%3D360%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":null},{"confidedId":780,"confidedName":"王丽","confidedIcon":"https://img.ydlcdn.com/file/2019/05/28/jczkj3zl80snwjcy.png!s200x200","confideHearNum":"已聆听155次","doctorId":9048,"uid":1446626,"confideVoice":"https://video.ydlcdn.com/2018/10/18/cdfe49cf1825295b26fa2843a96af789.mp3","tags":"恋爱婚姻,情绪压力,上岗认证,80后","confideContent":"用专注的耳朵,聆听每一朵姹紫嫣红的心声!","confideSex":2,"status":1,"confideLine":1,"confideAddress":"","confidePraise":"100.0%","confideFee":50,"confideConnection":"100%","confidedTag":["恋爱婚姻","情绪压力","上岗认证","80后"],"confideNum":"155人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F9048%3Fid%3D780%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":null},{"confidedId":774,"confidedName":"林秋祯","confidedIcon":"https://img.ydlcdn.com/file/2019/05/2324206d00ab4585ae2e22333e48fbc3.jpg!s200x200","confideHearNum":"已聆听77次","doctorId":8974,"uid":2228959,"confideVoice":"https://img.ydlcdn.com/file/2019/06/18/f2uf6yf70wcccuvk.mp3","tags":"情绪压力,家庭关系,个人成长","confideContent":"用温暖、真诚为您点亮生命的道路,用专业、耐心陪您找...","confideSex":2,"status":1,"confideLine":1,"confideAddress":"","confidePraise":"100.0%","confideFee":50,"confideConnection":"97.0%","confidedTag":["情绪压力","家庭关系","个人成长"],"confideNum":"77人","linkUrl":"ydl-user://h5/consult?params\u003d%7B%22url%22%3A%22https%3A%2F%2Fh2.yidianling.com%2Fexperts%2F8974%3Fid%3D774%26toConfide%3D1%22%7D","couponMoney":0,"couponText":"新用户送50元红包","stub":null}],"diviLine":1,"head":{"title":"听声寻人","subTitle":"更多","subLinkUrl":"app://listen/list"}}]
\ No newline at end of file
package com.ydl.confide.home
import android.content.Context
import android.support.v7.widget.LinearLayoutManager
import android.support.v7.widget.RecyclerView
import android.support.v7.widget.SimpleItemAnimator
import android.view.View
import com.alibaba.android.arouter.facade.annotation.Route
import com.jcodecraeer.xrecyclerview.ProgressStyle
import com.jcodecraeer.xrecyclerview.XRecyclerView
import com.ydl.ydl_image.listener.YDLImageRecyclerOnScrollListener
import com.yidianling.common.tools.RxImageTool
import com.ydl.confide.R
import com.ydl.confide.home.adapter.ConfideHomeAdapter
import com.ydl.confide.home.bean.ConfideHomeAllFiltersBean
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.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.presenter.ConfideHomePresenterImpl
import com.ydl.confide.home.util.ConfideHomeUtils
import com.ydl.ydlcommon.mvp.lce.BaseLceActivity
import com.ydl.ydlcommon.utils.UMEventUtils
import com.ydl.ydlcommon.view.DrawableRightTextView
import com.ydl.ydlcommon.view.WrapContentLinearLayoutManager
/**
* @author yuanwai
* @描述:倾诉首页Activity
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/8/10
*/
@Route(path = "/confide/home")
class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHomeContract.Presenter>(),XRecyclerView.LoadingListener {
override fun loadData() {
}
//是否从启动页直接进入
var isSplash: Boolean = false
/**
* 倾诉首页适配器
*/
private var mConfideAdapter: ConfideHomeAdapter? = null
/**
* 倾诉首页事件处理类
*/
private var mConfideEvent: IConfideHomeEvent? = null
/**
* 数据缓存
*/
private var cacheList: MutableList<ConfideHomeDataBean>? = null
// 一键倾诉Url
private var quickConsultUrl: String? = null
/**
* 页(从第二页开始)
*/
private var page: Int = 2
//筛选参数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
init {
//初始化参数
initParam()
dp48 = RxImageTool.dip2px(48f)
}
private fun initParam() {
allFiltersBean = ConfideHomeAllFiltersBean(
page,
ConfideHomeFiterItemBean("1", ""),
ConfideHomeFiterItemBean("-1", ""),
ArrayList(),
ArrayList())
}
override fun getContext(): Context {
return ConfideHomeActivity@ this
}
override fun createPresenter(): IConfideHomeContract.Presenter {
return ConfideHomePresenterImpl(this)
}
override fun layoutResId(): Int {
return R.layout.confidehome_home_activity
}
/**
* 下拉刷新回调
*/
override fun onRefresh() {
//重置页
page = 2
allFiltersBean!!.page = page
presenter.confideHomeRequest()
}
/**
* 上拉加载更多
*/
override fun onLoadMore() {
recommendList(page)
page++
}
override fun recommendList(page: Int) {
//需要将当前列表已存在的老师uid数组发送到后端去重,因为排序实时变化
this.page = page
allFiltersBean!!.page = page
if (1 == page) {
//显示加载中
showProgressDialog()
allFiltersBean!!.notInUid = ArrayList()
presenter.recommendList(ConfideHomeUtils.createParam(allFiltersBean!!))
} else if (page > 1) {
var listData = mConfideAdapter?.getList()
var notUidList = ArrayList<Int>()
if (listData!=null){
for (bean in listData){
//列表类型数组
if (bean.type==5 && bean.body!=null){
for (bean in bean.body){
notUidList.add(bean.uid?:0)
}
}
}
}
allFiltersBean!!.notInUid = notUidList
presenter.recommendListMore(ConfideHomeUtils.createParam(allFiltersBean!!))
}
}
override fun initDataAndEvent() {
isSplash = intent.getBooleanExtra("isSplash", false)
//统计埋点
UMEventUtils.listen_list(ConfideHomeActivity@ this)
//初始化View
initView()
mConfideEvent = ConfideHomeEventImpl(this, this)
//初始化适配器
initAdapter()
//显示加载中
// showProgressDialog()
//加载本地缓存
presenter.loadLocalData(this)
initClick()
initQuickConsultDialog()
}
/**
* 监听控制一键倾诉浮层的显示与隐藏
*/
private fun initQuickConsultDialog() {
rv_list.addOnScrollListener(object : RecyclerView.OnScrollListener() {
override fun onScrollStateChanged(recyclerView: RecyclerView?, newState: Int) {
super.onScrollStateChanged(recyclerView, newState)
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
}
}
}
})
}
/**
* 初始化一键倾诉浮层的点击事件
*/
private fun initClick() {
quick_consult_btn.setOnClickListener {
quickConsultUrl?.let {
mConfideEvent?.categoryClick(quickConsultUrl)
}
}
}
private fun initView() {
img_back.setOnClickListener {
finish()
}
img_mine.setOnClickListener {
mConfideEvent!!.jumpMine()
}
ll_bar_root.setOnClickListener {
}
//用于滑动筛选模块置顶
if (null == listScrollListener) {
listScrollListener = ConfideHomeRecycleViewListener()
}
rv_list.addOnScrollListener(listScrollListener)
//用于显示筛选悬浮按钮
if (null == listSuspendListener) {
listSuspendListener = ConfideHomeRecyleSuspendListener()
}
rv_list.addOnScrollListener(listSuspendListener)
rv_list.addOnScrollListener(YDLImageRecyclerOnScrollListener(ConfideHomeActivity@ this))
if (rv_list.itemAnimator is SimpleItemAnimator) {
(rv_list.itemAnimator as SimpleItemAnimator).supportsChangeAnimations = false
}
}
/**
* 初始化适配器
*/
private fun initAdapter() {
if (null == mConfideAdapter) {
mConfideAdapter = ConfideHomeAdapter(ConfideHomeActivity@ this, mConfideEvent!!, this)
}
val layoutManager = WrapContentLinearLayoutManager(this, WrapContentLinearLayoutManager.VERTICAL, false)
rv_list.layoutManager = layoutManager
rv_list.setRefreshProgressStyle(ProgressStyle.BallSpinFadeLoader)
rv_list.setRefreshProgressStyle(ProgressStyle.BallSpinFadeLoader)
rv_list.setArrowImageView(R.drawable.confidehome_downgrey)
rv_list.setLoadingListener(this)
rv_list.adapter = mConfideAdapter
}
/**
* 倾诉首页数据请求结果
*/
override fun confideHomeResponse(list: MutableList<ConfideHomeDataBean>) {
initParam()
hideError()
updateCacheData(list)
updateAdapter()
updateQuickConsultUrl()
setSuspendListener()
v_filterView.refreshView()
}
/**
* 设置筛选模块悬浮顶部监听数据
*/
private fun setSuspendListener() {
listSuspendListener?.setFilterView(v_filterView)
listSuspendListener?.setSectionAdapter(mConfideAdapter!!)
}
private fun setHideFilterView() {
v_filterView.visibility = View.INVISIBLE
v_filterView.setHomeView(this)
}
/**
* 更新一键倾诉按钮url
*/
private fun updateQuickConsultUrl() {
//这边用try catch的原因是防止因为接口数据结构变化导致cacheList!![1].body!![1].linkUrl获取失败
quickConsultUrl = try {
cacheList!![1].body!![1].linkUrl
}catch (e: Exception) {
"https://h5.ydl.com/confideMatch"
}
}
/**
* 更新适配器数据
*/
private fun updateAdapter() {
rv_list.removeAllViews()
//数据重组
ConfideHomeUtils.resetData(cacheList!!, v_filterView, listScrollListener!!)
setHideFilterView()
mConfideAdapter?.updataItems(cacheList!!)
mConfideAdapter?.notifyDataSetChanged()
rv_list.refreshComplete()
}
/**
* 更新适配器数据(用于播放 暂停 状态切换 更新整体数据)
*/
private fun updateAdapterForPlayStatus() {
mConfideAdapter!!.updataItems(cacheList!!)
mConfideAdapter!!.notifyDataSetChanged()
}
private fun clearCacheData() {
if (null == cacheList) {
cacheList = ArrayList()
} else {
(cacheList as ArrayList).clear()
}
}
/**
* 更新缓存数据
*/
private fun updateCacheData(list: List<ConfideHomeDataBean>) {
clearCacheData()
var soundBean: ConfideHomeDataBean? = null
for (index in 0 until list.size) {
//将听声寻人数据取出 最后加入
when {
//听声寻人
list[index].type == IConfideHomeConfig.TYPE_SOUND -> soundBean = list[index]
//为你推荐
list[index].type == IConfideHomeConfig.TYPE_RECOMMEND -> {
//如果为你推荐的数量大于等于10条 就认为有下一页
hasMore = null != list[index].body && list[index].body!!.size >= 10
list[index].recommendId = page
(cacheList as ArrayList).add(list[index])
}
//其他模块正常添加
else -> (cacheList as ArrayList).add(list[index])
}
}
//听声寻人 放在最后添加
if (null != soundBean) {
(cacheList as ArrayList).add(soundBean)
}
}
/**
* 根据筛选条件 更新为你推荐数据
*/
private fun updateCacheDataByRecommend(bean: ConfideHomeDataBean) {
//需要重置一下页码
page = 2
if (null == cacheList) {
cacheList = ArrayList()
}
if (bean?.body == null) {
v_filterView.visibility = View.GONE
} else if (null != bean.body && bean.body.size < 2) {
v_filterView.visibility = View.GONE
} else {
v_filterView.visibility = View.VISIBLE
}
var soundBean: ConfideHomeDataBean? = null
//从后往前循环 这样remove的时候不会有问题
for (index in (0..(cacheList!!.size - 1)).reversed()) {
if (cacheList!![index].type == IConfideHomeConfig.TYPE_RECOMMEND) {
//移除原有的为你推荐数据
(cacheList as ArrayList).removeAt(index)
} else if (cacheList!![index].type == IConfideHomeConfig.TYPE_SOUND) {
//移除听声寻人数据 重新添加
soundBean = cacheList!![index]
(cacheList as ArrayList).removeAt(index)
}
}
if (bean?.body != null) {
bean.recommendId = page
//添加为你推荐数据
(cacheList as ArrayList).addAll(ConfideHomeUtils.getRecommendList(bean))
}
//添加听声寻人数据
if (null != soundBean) {
(cacheList as ArrayList).add(soundBean)
}
listScrollListener?.moveToPosition(rv_list)
}
/**
* 为你推荐 翻页 请求结果
*/
override fun recommendListMoreResponse(bean: ConfideHomeDataBean) {
dismissProgressDialog()
bean.recommendId = page
if(bean.body?.size?:0==0) {
rv_list.loadMoreComplete()
mConfideAdapter!!.notifyDataSetChanged()
return
}
(cacheList as ArrayList).add(bean)
var size = mConfideAdapter!!.itemCount
mConfideAdapter!!.addItems(ConfideHomeUtils.getRecommendList(bean))
// if (bean?.body == null || bean.body!!.size < 10) {
// rv_list.setNoMore(true)
// } else {
rv_list.loadMoreComplete()
// }
mConfideAdapter!!.notifyItemInserted(if (size > 0) size + 1 else 0)
}
/**
* 为你推荐 筛选 请求结果
*/
override fun recommendListResponse(bean: ConfideHomeDataBean) {
dismissProgressDialog()
updateCacheDataByRecommend(bean)
mConfideAdapter!!.updataItems(cacheList!!)
if (bean?.body == null || bean.body!!.size < 10) {
rv_list.setNoMore(true)
} else {
rv_list.loadMoreComplete()
}
mConfideAdapter!!.notifyDataSetChanged()
}
/**
* 倾诉首页数据请求失败
*/
override fun confideHomeRequestFail() {
showError()
}
override fun showProgress() {
}
/**
* 更新section的播放状态
* 点击列表中的一个播放按钮 其他播放按钮要显示暂停状态
* @param sectionId
* @param index 模块中点击播放的索引位置
*/
override fun updataPlayStatu(type: Int?, index: Int, recommendId: Int, isPlaying: Boolean) {
ConfideHomeUtils.changeCacheDataPlay(cacheList, type, index, recommendId)
updateAdapterForPlayStatus()
}
override fun moveToFilter() {
rv_list.scrollBy(0, 400)
listScrollListener?.moveToPosition(rv_list)
}
override fun showSortPopupWindow(v_line_top: View, tvSort: DrawableRightTextView, bodyBean: ConfideHomeBodyBean?) {
if (null == allFiltersBean) {
return
}
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!!)
}
override fun showSexAgePopupWindow(v_line_top: View, tvSexAge: DrawableRightTextView, bodyBean: ConfideHomeBodyBean?) {
if (null == allFiltersBean) {
return
}
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!!)
}
override fun showGoodPopupWindow(v_line_top: View, tvGood: DrawableRightTextView, bodyBean: ConfideHomeBodyBean?) {
if (null == allFiltersBean) {
return
}
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!!)
}
private fun showError() {
rv_list.refreshComplete()
}
private fun hideError() {
rv_list.refreshComplete()
rv_list.visibility = View.VISIBLE
}
override fun showError(msg: String?) {
rv_list.loadMoreComplete()
msg?.let {
ToastHelper.show(msg)
}
}
override fun onDestroy() {
super.onDestroy()
mConfideEvent!!.destoryPlayer()
}
override fun onBackPressed() {
if (isSplash) {
//跳转主页
var int = RouterManager.getAppRouter()?.mainIntent(this)
startActivity(int)
}
super.onBackPressed()
}
}
\ No newline at end of file
package com.ydl.confide.home.adapter
import android.content.Context
import android.support.v7.widget.RecyclerView
import android.view.View
import android.view.ViewGroup
import com.ydl.confide.R
import com.ydl.confide.home.bean.ConfideHomeDataBean
import com.ydl.confide.home.config.IConfideHomeConfig
import com.ydl.confide.home.contract.IConfideHomeContract
import com.ydl.confide.home.event.IConfideHomeEvent
import com.ydl.confide.home.widget.*
/**
* @author yuanwai
* @描述:倾诉首页列表适配器(因为section框架有问题,故先改为传统方式编写)
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/12/14
*/
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
fun getFilterViewHolder(): FilterViewHolder? {
return mFilterViewHolder
}
init {
if (null == mListData) {
mListData = ArrayList()
}
}
override fun getItemViewType(position: Int): Int {
if (null == mListData || mListData!!.isEmpty() || position >= mListData!!.size) {
//当没数据 返回一个不存在的类型
return 0
}
return mListData!![position].type!!
}
fun updataItems(list: List<ConfideHomeDataBean>) {
if (null == mListData || mListData!!.isEmpty()) {
mListData = ArrayList()
} else {
(mListData as ArrayList).clear()
}
(mListData as ArrayList).addAll(list)
}
fun addItems(list: List<ConfideHomeDataBean>) {
if (null == mListData || mListData!!.isEmpty()) {
mListData = ArrayList()
}
(mListData as ArrayList).addAll(list)
}
fun getList(): List<ConfideHomeDataBean>? {
return mListData
}
fun getCount(): Int {
if (null == mListData || mListData!!.isEmpty()) {
return 0
}
return mListData!!.size
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
when (viewType) {
//banner
IConfideHomeConfig.TYPE_BANNER -> {
return BannerViewHolder(ConfideHomeBannerView(parent.context, confideHomeEvent))
}
//最近倾诉
IConfideHomeConfig.TYPE_RECENTLY_CONFIDED -> {
return ConsultViewHolder(ConfideHomeRecentView(parent.context, confideHomeEvent))
}
//分类
IConfideHomeConfig.TYPE_CATEGORY -> {
return CategoryViewHolder(ConfideHomeCategoryView(parent.context, confideHomeEvent, confideHomeView))
}
//筛选模块
IConfideHomeConfig.TYPE_RECOMMEND_FILTER -> {
return FilterViewHolder(ConfideHomeFilterView(parent.context, confideHomeView))
}
//为你推荐
IConfideHomeConfig.TYPE_RECOMMEND -> {
return RecommendViewHolder(ConfideHomeRecommendView(confideHomeView, parent.context, confideHomeEvent))
}
//听声寻人
IConfideHomeConfig.TYPE_SOUND -> {
return ConfideHomeListenAndFoundViewHolder(ConfideHomeListenAndFoundView(parent.context, confideHomeEvent))
}
else -> {
return EmptyViewHolder(View.inflate(parent.context, R.layout.confidehome_empty, null))
}
}
}
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) {
//听声寻人
holder.confideHomeListenAndFoundView!!.initData(mListData!![position])
} else if (holder is ConsultViewHolder && null != holder.consultView) {
//最近倾诉
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 EmptyViewHolder) {
} else {
}
override fun getItemCount(): Int {
return mListData!!.size
}
/**
* banner viewHolder
*/
inner class BannerViewHolder(itemView: ConfideHomeBannerView) : RecyclerView.ViewHolder(itemView) {
var bannerView: ConfideHomeBannerView? = null
init {
bannerView = itemView
}
}
/**
* 分类测评 viewHolder
*/
inner class CategoryViewHolder(itemView: ConfideHomeCategoryView) : RecyclerView.ViewHolder(itemView) {
var categoryView: ConfideHomeCategoryView? = null
init {
categoryView = itemView
}
}
/**
* 筛选模块 viewHolder
*/
inner class FilterViewHolder(var filterView: ConfideHomeFilterView) : RecyclerView.ViewHolder(filterView)
/**
* 听声寻人 viewHolder
*/
inner class ConfideHomeListenAndFoundViewHolder(var confideHomeListenAndFoundView: ConfideHomeListenAndFoundView) : RecyclerView.ViewHolder(confideHomeListenAndFoundView)
/**
* 最近倾诉 viewHolder
*/
inner class ConsultViewHolder(var consultView: ConfideHomeRecentView) : RecyclerView.ViewHolder(consultView)
/**
* 为你推荐 viewHolder
*/
inner class RecommendViewHolder(var confideHomeRecommendView: ConfideHomeRecommendView) : RecyclerView.ViewHolder(confideHomeRecommendView)
/**
* 空ViewHolder
*/
inner class EmptyViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
var view: View? = null
init {
view = itemView
}
}
}
\ No newline at end of file
package com.ydl.confide.home.bean
/**
* @author yuanwai
* @描述:倾诉首页--已选择的筛选参数bean(用于拼装为你推荐筛选请求参数)
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/9/22
*/
data class ConfideHomeAllFiltersBean(
var page : Int,
//选择的综合排序Id
var selectSort : ConfideHomeFiterItemBean?,
//选择的性别id
var selectSex : ConfideHomeFiterItemBean?,
//年龄筛选数据集
val selectAgeData : ArrayList<ConfideHomeFiterItemBean>?,
//擅长方向筛选数据集
val selectGoodData : ArrayList<ConfideHomeFiterItemBean>?,
//当前列表已存在专家uid列表
var notInUid : ArrayList<Int> = ArrayList()
)
\ No newline at end of file
package com.ydl.confide.home.bean
/**
* @author yuanwai
* @描述:倾诉首页数据--body bean
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/8/10
*/
data class ConfideHomeBodyBean(
/**
* 公共参数
*/
val linkUrl : String?,
//倾诉Id
val confidedId : String?,
//专家Id(专家编号)
val doctorId : String?,
//专家的uid
val uid : Int?,
//咨询师姓名
val confidedName : String?,
//咨询师性别 1.男 2.女
val confideSex : Int = 1,
//对你留言
val confideContent : String?,
//咨询师头像地址
val confidedIcon : String?,
//是否在线 //1在线 2离线 3通话中 4继续倾诉
val confideLine : Int?,
//已聆听文案
val confideHearNum : String?,
//历史倾听记录
val confideHistory : String?,
//是否为播放状态
var confideIsPlay : Boolean=false,
//音频播放地址
val confideVoice:String?,
//副标题(底部更多文案)
val subTitle : String?,
//咨询师标题
val confidedTitle:String?,
//副标题点击事件
val subLinkUrl : String?,
//咨询师背景图片
val confideBgUrl : String?,
//价格
val confideFee : String?,
//红包金额
val couponMoney : String?,
//新用户优惠文案
val couponText : String?,
/**
* banner数据
*/
//banner id
val bannerId : String?,
//banner 图片地址
val bannerImageUrl : String?,
//banner标题(用于数据埋点)
val bannerTitle : String?,
//跳转地址
val bannerLinkUrl : String?,
/**
* 最近倾诉数据说明(查看公共参数说明)
*/
//...
/**
* 分类参数
*/
//分类Id
val categoryId : String?,
//分类名称
val categoryName : String?,
//分类类型(1.倾诉指南,2.专业师资)
val categoryType : Int?,
//分类图片地址
val categoryIcon : String?,
//分类内容
val categoryContent : String?,
/**
* 为你推荐筛选模块数据
*/
//筛选标题
val filterName : String?,
//筛选类型(1.综合排序 2.性别年龄 3.擅长方向)
val filterType : Int?,
//筛选数据集
val group : ArrayList<ConfideHomeBodyGroupItemBean>?,
// //性别筛选标题
// val sexTitle : String?,
// //性别筛选数据集
// val sexData : ArrayList<ConfideHomeFiterItemBean>?,
// //年龄筛选标题
// val ageTitle : String?,
// //年龄筛选数据集
// val ageData : ArrayList<ConfideHomeFiterItemBean>?,
// //擅长方向标题
// val goodTitle : String?,
// //擅长方向筛选数据集
// val goodData : ArrayList<ConfideHomeFiterItemBean>?,
/**
* 为你推荐数据说明
*/
val confidedTag : List<String>?,
/**
* 听声寻人数据说明(请查看公共参数说明)
*/
//...
/**
* 最佳倾诉榜单数据说明
*/
//倾诉统计文案(8513人)
val confideNum : String?,
//接通率
val confideConnection : String?,
//
var bodyData : List<ConfideHomeBodyBean>?
)
\ No newline at end of file
package com.ydl.confide.home.bean
/**
* @author yuanwai
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/10/15
*/
data class ConfideHomeBodyGroupItemBean(val title : String?,
val data : ArrayList<ConfideHomeFiterItemBean>?)
\ No newline at end of file
package com.ydl.confide.home.bean
import com.ydl.ydlcommon.bean.YDLFooterBean
import com.ydl.ydlcommon.bean.YDLHeadBean
/**
* @author yuanwai
* @描述:倾诉首页数据bean
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/7/26
*/
data class ConfideHomeDataBean(
/**
* 数据分类 1.banner 2.最近倾诉 3.分类测评 4.实时倾诉数据 5.为你推荐 6.听声寻人 7.咨询师推荐
*/
val type: Int?,
/**
* 数据集合节点
*/
val body : MutableList<ConfideHomeBodyBean>?,
/**
* 头部数据节点
*/
val head : YDLHeadBean?,
/**
* 底部数据节点
*/
val footer : YDLFooterBean?,
/**
* 为你推荐Id 本地使用 用于区分音频播放区域
*/
var recommendId : Int,
/**
* 是否显示分割线 0.不显示 1.显示
*/
val diviLine : Int?)
\ No newline at end of file
package com.ydl.confide.home.bean
/**
* @author yuanwai
* @描述:倾诉首页筛选Item bean
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/9/22
*/
data class ConfideHomeFiterItemBean(
/**
* 筛选id
*/
var id : String?,
/**
* 筛选名称
*/
var name : String?)
\ No newline at end of file
package com.ydl.confide.home.config
/**
* @author yuanwai
* @描述:倾诉首页配置信息
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/8/10
*/
interface IConfideHomeConfig{
companion object {
/**
* 数据类型 1.banner 2.最近倾诉 3.分类 4.为你推荐筛选模块
* 5.为你推荐 6.听声寻人 7.最佳倾诉榜单 999.底部 更多情感恋爱专家view
*/
const val TYPE_BANNER = 1
const val TYPE_RECENTLY_CONFIDED = 2
const val TYPE_CATEGORY = 3
const val TYPE_RECOMMEND_FILTER = 4
const val TYPE_RECOMMEND = 5
const val TYPE_SOUND = 6
const val TYPE_CONSULTANT = 7
const val TYPE_FOOTER = 999
/**
* section id. 与上面相对应
*/
const val SECTION_BANNER = 10001
const val SECTION_RECENTLY_CONFIDED = 10002
const val SECTION_CATEGORY = 10003
const val SECTION_RECOMMEND_FILTER = 10004
const val SECTION_RECOMMEND = 10005
const val SECTION_SOUND = 10006
const val SECTION_CONSULTANT = 10007
const val SECTION_FOOTER = 19999
/**
* 筛选窗状态
* 0.默认筛选状态 1.非默认筛选状态 2.筛选窗打开状态
*/
const val FILTER_STATUS_NORMAL = 0
const val FILTER_STATUS_FILTERED = 1
const val FILTER_STATUS_OPEN = 2
}
}
\ No newline at end of file
package com.ydl.confide.home.contract
import android.content.Context
import com.ydl.confide.home.bean.ConfideHomeBodyBean
import com.ydl.confide.home.bean.ConfideHomeDataBean
import com.ydl.confide.home.http.ConfideRecommendParam
import com.ydl.ydlcommon.mvp.base.IModel
import com.ydl.ydlcommon.mvp.base.IPresenter
import com.ydl.ydlcommon.mvp.base.IView
import com.ydl.ydlcommon.view.DrawableRightTextView
import io.reactivex.Observable
/**
* @author yuanwai
* @描述:倾诉首页约束类
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/8/10
*/
interface IConfideHomeContract{
//View接口
interface View : IView {
/**
* 倾诉首页数据请求结果
* @param list 数据集合
*/
fun confideHomeResponse(list : MutableList<ConfideHomeDataBean>)
/**
* 倾诉首页数据请求失败
*/
fun confideHomeRequestFail()
/**
* 为你推荐--筛选 请求结果
*/
fun recommendListResponse(bean : ConfideHomeDataBean)
/**
* 为你推荐--翻页 请求结果
*/
fun recommendListMoreResponse(bean : ConfideHomeDataBean)
/**
* 更新section的播放状态
* 点击列表中的一个播放按钮 其他播放按钮要显示暂停状态
* @param type
* @param index 模块中点击播放的索引位置
* @param recommendId
*/
fun updataPlayStatu(type : Int?,index : Int,recommendId : Int,isPlaying : Boolean)
/**
* 为你推荐列表
*/
fun recommendList(page : Int)
/**
* 排序弹窗
*/
fun showSortPopupWindow(v_line_top: android.view.View, tvSort: DrawableRightTextView, bodyBean: ConfideHomeBodyBean?)
/**
* 性别年龄弹窗
*/
fun showSexAgePopupWindow(v_line_top: android.view.View, tvSexAge: DrawableRightTextView, bodyBean: ConfideHomeBodyBean?)
/**
* 擅长方向弹窗
*/
fun showGoodPopupWindow(v_line_top: android.view.View, tvGood: DrawableRightTextView, bodyBean: ConfideHomeBodyBean?)
/**
* 移动到为你推荐筛选模块 并置顶
*/
fun moveToFilter()
/**
* 显示错误信息
*/
fun showError(msg : String?)
fun getContext() : Context
fun showProgress()
}
interface Presenter : IPresenter<View> {
/**
* 加载本地缓存
*/
fun loadLocalData(context: Context)
/**
* 倾诉首页数据请求
*/
fun confideHomeRequest()
/**
* 为你推荐列表(筛选调用)
*/
fun recommendList(param : ConfideRecommendParam)
/**
* 为你推荐列表(翻页调用)
*/
fun recommendListMore(param : ConfideRecommendParam)
}
interface Model: IModel {
/**
* 倾诉首页数据请求
*/
fun confideHomeRequest() : Observable<MutableList<ConfideHomeDataBean>>
/**
* 为你推荐列表
*/
fun recommendList(param : ConfideRecommendParam) : Observable<ConfideHomeDataBean>
}
}
\ No newline at end of file
package com.ydl.confide.home.event
import android.app.Activity
import android.content.Context
import android.net.Uri
import android.support.v7.app.AppCompatActivity
import android.text.TextUtils
import android.view.View
import com.ydl.ydl_router.manager.YDLRouterManager
import com.ydl.ydl_router.manager.YDLRouterParams
import com.yidianling.common.tools.ToastUtil
import com.ydl.confide.home.adapter.ConfideHomeAdapter
import com.ydl.confide.home.bean.ConfideHomeAllFiltersBean
import com.ydl.confide.home.bean.ConfideHomeBodyBean
import com.ydl.confide.home.bean.ConfideHomeFiterItemBean
import com.ydl.confide.home.config.IConfideHomeConfig
import com.ydl.confide.home.contract.IConfideHomeContract
import com.ydl.confide.home.popwindow.ConfideHomeGoodPopupWindow
import com.ydl.confide.home.popwindow.ConfideHomeSexAgePopupWindow
import com.ydl.confide.home.popwindow.ConfideHomeSortPopupWindow
import com.ydl.confide.home.util.ConfideHomeUtils
import com.ydl.confide.home.widget.ConfideHomeFilterView
import com.ydl.confide.router.PhoneCallIn
import com.ydl.ydlcommon.base.BaseActivity
import com.ydl.ydlcommon.router.IYDLRouterConstant
import com.ydl.ydlcommon.utils.UMEventUtils
/**
* @author yuanwai
* @描述:倾诉首页事件处理类
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/8/10
*/
class ConfideHomeEventImpl(context: Context, var confideHomeView: IConfideHomeContract.View) : IConfideHomeEvent {
private var mContext: Context? = null
private var floatViewClickListener: PlayerFloatView.FloatViewPlayListener? = null
init {
mContext = context
}
/**
* 跳转我的
*/
override fun jumpMine() {
ConfideHomeUtils.buildJumpMine(mContext!!)
}
/**
* banner点击事件
* @param linkUrl 跳转地址
* @param position 点击索引
* @param title banner 标题
*/
override fun bannerClick(linkUrl: String?, position: Int?, title: String?) {
UMEventUtils.listen_banner(mContext)
link(linkUrl)
}
/**
* 最近倾诉--继续倾诉
*/
override fun latelyConfideClick(linkUrl: String?) {
//埋点
UMEventUtils.umEvent("最近倾诉点击", "最近倾诉模块", linkUrl)
link(linkUrl)
}
/**
* 最近倾诉--更多
*/
override fun latelyConfideMore(linkUrl: String?) {
link(linkUrl)
}
/**
* 分类点击事件
* @param linkUrl
*/
override fun categoryClick(linkUrl: String?) {
//埋点
UMEventUtils.umEvent("倾诉指南点击", "倾诉指南", linkUrl)
UMEventUtils.listen_classification(mContext)
link(linkUrl)
}
/**
* 为你推荐--向TA倾诉
* @param linkUrl 跳转地址
*/
override fun recommendClick(linkUrl: String?) {
UMEventUtils.listen_recommend_say(mContext)
link(linkUrl)
}
/**
* 为你推荐--更多
* @param linkUrl 跳转地址
*/
override fun recommendMoreClick(linkUrl: String?) {
UMEventUtils.listen_recommend_more(mContext)
link(linkUrl)
}
/**
* 听声寻人--向TA倾诉
* @param linkUrl 跳转地址
*/
override fun soundClick(linkUrl: String?) {
UMEventUtils.listen_find_say(mContext)
link(linkUrl)
}
/**
* 听声寻人--更多
* @param linkUrl 跳转地址
*/
override fun soundMoreClick(linkUrl: String?) {
UMEventUtils.listen_find_more(mContext)
link(linkUrl)
}
/**
* 最佳倾诉榜单--点我倾诉
* @param linkUrl 跳转地址
*/
override fun consultantClick(linkUrl: String?) {
UMEventUtils.listen_recommend(mContext)
link(linkUrl)
}
/**
* 最佳倾诉榜单--更多情感恋爱专家
* @param linkUrl 跳转地址
*/
override fun consultantMoreClick(linkUrl: String?) {
link(linkUrl)
}
/**
* 播放音频文件
* @param type 当前模块数据类型
* @param index 当前的模块里的数据索引位置
* @param playUrl 播放地址
*/
override fun playVoice(type: Int?, index: Int?, playUrl: String?) {
//埋点
UMEventUtils.umEvent("听声寻人点击", "图片点击", "图片点击")
YDLMusicHelper.confidePlay(playUrl)
umengPlayVoice(type)
confideHomeView.updataPlayStatu(type, index!!, 0, true)
initCache(type, index!!, 0, playUrl)
initConfidePlayerListener()
}
override fun playVoice(type: Int?, index: Int?, recommendId: Int, playUrl: String?, name: String?) {
YDLMusicHelper.name = name
YDLMusicHelper.confidePlay(playUrl)
if (PlayerFloatHelper.isShow(mContext!!)) {
if (YDLMusicHelper.playType == 1) {
PlayerFloatHelper.removeView(mContext!!)
PlayerFloatHelper.show(mContext!!)
} else {
PlayerFloatHelper.setPlayingState(mContext!!)
}
} else {
mContext?.let { PlayerFloatHelper.show(it) }
}
//埋点
UMEventUtils.umEvent("列表展示点击", "语音点击", "语音点击")
umengPlayVoice(type)
confideHomeView.updataPlayStatu(type, index!!, recommendId, true)
initCache(type, index!!, recommendId, playUrl)
initConfidePlayerListener()
}
private fun initConfidePlayerListener() {
if (floatViewClickListener == null) {
floatViewClickListener = object : PlayerFloatView.FloatViewPlayListener {
override fun onStartClick() {
confideHomeView.updataPlayStatu(cacheType, cacheIndex!!, cacheSubIndex, true)
}
override fun onPlayFinish() {
confideHomeView.updataPlayStatu(9999, 0, 0, false)
}
override fun onPauseClick() {
confideHomeView.updataPlayStatu(9999, 0, 0, false)
}
}
PlayerFloatHelper.addClickListener(floatViewClickListener as PlayerFloatView.FloatViewPlayListener);
}
}
private fun initCache(type: Int?, index: Int?, sub_index: Int, playUrl: String?) {
cachePlayUrl = playUrl
cacheType = type
cacheIndex = index
cacheSubIndex = sub_index
}
//友盟统计埋点
private fun umengPlayVoice(type: Int?) {
when (type) {
//为你推荐
IConfideHomeConfig.TYPE_RECOMMEND -> {
UMEventUtils.listen_recommend_play(mContext)
}
//听声寻人
IConfideHomeConfig.TYPE_SOUND -> {
UMEventUtils.listen_find_play(mContext)
}
//咨询师推荐
IConfideHomeConfig.TYPE_CONSULTANT -> {
UMEventUtils.listen_audio_list(mContext)
}
}
}
/**
* 播放缓存变量 用于重播使用
*/
private var cachePlayUrl: String? = null
private var cacheType: Int? = -1
private var cacheIndex: Int? = -1
private var cacheSubIndex: Int = -1
override fun rePlayVoice() {
if (TextUtils.isEmpty(cachePlayUrl)) {
return
}
YDLMusicHelper.start()
confideHomeView.updataPlayStatu(cacheType, cacheIndex!!, cacheSubIndex, true)
}
/**
* 暂停播放音频文件
*/
override fun pauseVoice() {
YDLMusicHelper.pause()
PlayerFloatHelper.updatePlayState()
//因为9999 类型不存在 所以就能把状态全部置为暂停状态了 偷个懒
confideHomeView.updataPlayStatu(9999, 0, 0, false)
}
override fun destoryPlayer() {
PlayerFloatHelper.hide()
YDLMusicHelper.clearTempData()
YDLMusicHelper.stop()
floatViewClickListener?.let { PlayerFloatHelper.removeClickListener(it) };
}
/**
* 私聊
*/
override fun toChatForMsg(doctorId: String?) {
UMEventUtils.umEvent("列表展示点击", "喊他上线点击", "喊他上线点击")
if (!PhoneCallIn.isLogin() && null != mContext && mContext is Activity) {
mContext!!.startActivity(PhoneCallIn.loginWayIntent(mContext as Activity))
return
}
if (mContext is AppCompatActivity && !TextUtils.isEmpty(doctorId)) {
PhoneCallIn.startChat(mContext as AppCompatActivity, doctorId!!, 0x001, 0)
}
RouterManager.getImRouter().createTextMessage(doctorId, "你好,我想找你倾诉,请尽快上线私聊我,我在等你。", object : IMRequestCallback<Void> {
override fun onSuccess(aVoid: Void?) {
(mContext as BaseActivity).dismissProgressDialog()
ToastHelper.show("发送成功")
}
override fun onFailed(i: Int) {
(mContext as BaseActivity).dismissProgressDialog()
var message = "发送失败"
if (i == 7101) {
message = "您已被对方拉黑!"
}
ToastHelper.show(message)
}
override fun onException(throwable: Throwable?) {
(mContext as BaseActivity).dismissProgressDialog()
ToastHelper.show("发送异常")
}
})
}
private fun link(linkUrl: String?) {
if (null == linkUrl || linkUrl.isEmpty()) {
return
}
if (linkUrl!!.startsWith("app")) {
var uri = Uri.parse(linkUrl)
//app://listen/list 列表
//app://listen/lately 最近倾诉列表
//因为android本地 没有最近倾诉列表 故都跳转 倾诉列表
if ("listen" == uri.host) {
var tabIndex = uri.getQueryParameter("type")
if (TextUtils.isEmpty(tabIndex)) {
PhoneCallActivity.start(mContext!!)
} else {
PhoneCallActivity.start(mContext!!, tabIndex.toInt())
}
}
} else if (linkUrl.startsWith("http")) {
YDLRouterManager.router(IYDLRouterConstant.ROUTER_H5_H5,
YDLRouterParams().putExtra(IYDLRouterConstant.EXTRA_URL, linkUrl), "")
} else {
YDLRouterManager.router(linkUrl)
}
}
/**
* 显示综合排序弹窗
* @param v_line_top 显示弹窗的位置
* @param filterView 隐藏的筛选栏View
* @param bodyBean 数据bean
* @param allFiltersBean 已选择的筛选bean
* @param mConfideAdapter section适配器
*/
override fun showSortPopupWindow(v_line_top: View, filterView: ConfideHomeFilterView, bodyBean: ConfideHomeBodyBean?, allFiltersBean: ConfideHomeAllFiltersBean, mConfideAdapter: ConfideHomeAdapter) {
if (null == bodyBean) {
return
}
var sortPopup: ConfideHomeSortPopupWindow? = null
if (bodyBean.group != null && !bodyBean.group.isEmpty() && null != bodyBean.group[0].data && !bodyBean.group[0].data!!.isEmpty()) {
ConfideHomeUtils.synchroTextDrawable(mContext!!, 1, IConfideHomeConfig.FILTER_STATUS_OPEN, filterView, mConfideAdapter)
sortPopup = ConfideHomeSortPopupWindow(mContext!!, bodyBean.group[0].data!!, allFiltersBean!!.selectSort!!, object : ConfideHomeSortPopupWindow.OnSortItemSelectedListener {
override fun onSortItemSelected(sortItem: ConfideHomeFiterItemBean) {
//埋点
UMEventUtils.umEvent("筛选点击", "筛选名称", "排序-${sortItem.name}")
//更改小图标
ConfideHomeUtils.synchroTextDrawable(mContext!!, 1, IConfideHomeConfig.FILTER_STATUS_NORMAL, filterView, mConfideAdapter)
allFiltersBean.selectSort = sortItem
confideHomeView.recommendList(1)
sortPopup!!.dismiss()
}
})
sortPopup.setOnDismissListener {
ConfideHomeUtils.synchroTextDrawable(mContext!!, 1, IConfideHomeConfig.FILTER_STATUS_NORMAL, filterView, mConfideAdapter)
}
if (sortPopup!!.selectedSort != allFiltersBean.selectSort) {
sortPopup!!.selectedSort = allFiltersBean.selectSort!!
sortPopup!!.notifyDataSetChanged()
}
sortPopup!!.showAsDropDown(v_line_top)
} else {
ToastUtil.toastShort("数据初始化失败,请重新下拉刷新")
}
}
/**
* 显示性别年龄弹窗
* @param v_line_top 显示弹窗的位置
* @param filterView 隐藏的筛选栏View
* @param bodyBean 数据bean
* @param allFiltersBean 已选择的筛选bean
* @param mConfideAdapter section适配器
*/
override fun showSexAgePopupWindow(v_line_top: View, filterView: ConfideHomeFilterView, bodyBean: ConfideHomeBodyBean?, allFiltersBean: ConfideHomeAllFiltersBean, mConfideAdapter: ConfideHomeAdapter) {
if (null == bodyBean || ((null == bodyBean.group || bodyBean.group.isEmpty()) && (null == bodyBean.group!![0].data || bodyBean.group[0].data!!.isEmpty()))) {
ToastUtil.toastShort( "数据初始化失败,请重新下拉刷新")
return
}
val sexData = ArrayList<ConfideHomeFiterItemBean>()
if (null != bodyBean.group[0].data) {
sexData.addAll(bodyBean.group[0].data!!)
}
val ageData = ArrayList<ConfideHomeFiterItemBean>()
if (1 < bodyBean.group.size && null != bodyBean.group[1].data) {
ageData.addAll(bodyBean.group[1].data!!)
}
val categoryPopup = ConfideHomeSexAgePopupWindow(mContext!!, sexData, ageData, allFiltersBean)
ConfideHomeUtils.synchroStyle(mContext!!, 2, IConfideHomeConfig.FILTER_STATUS_OPEN, filterView, mConfideAdapter)
categoryPopup!!.setOnDismissListener {
if (allFiltersBean.selectSex!!.id != "-1" || allFiltersBean.selectAgeData!!.size > 0) {
ConfideHomeUtils.synchroTextColor(mContext!!, 2, IConfideHomeConfig.FILTER_STATUS_FILTERED, filterView, mConfideAdapter)
} else {
ConfideHomeUtils.synchroTextColor(mContext!!, 2, IConfideHomeConfig.FILTER_STATUS_NORMAL, filterView, mConfideAdapter)
}
}
categoryPopup!!.onGoodSelectedListener = object : ConfideHomeSexAgePopupWindow.OnSexAgeSelectedListener {
override fun onSexAgeSelected(sexData: ConfideHomeFiterItemBean, ageData: ArrayList<ConfideHomeFiterItemBean>) {
var ageBuild = StringBuilder()
if (ageData != null) {
for (data in ageData) {
ageBuild.append("${data.name};")
}
}
//埋点
UMEventUtils.umEvent("筛选点击", "筛选名称", "性别-${sexData.name}-年龄-${ageBuild.toString()}")
ConfideHomeUtils.synchroTextColor(mContext!!, 2, IConfideHomeConfig.FILTER_STATUS_OPEN, filterView, mConfideAdapter)
allFiltersBean.selectSex!!.name = sexData.name
allFiltersBean.selectSex!!.id = sexData.id
allFiltersBean.selectAgeData!!.clear()
allFiltersBean.selectAgeData!!.addAll(ageData)
confideHomeView.recommendList(1)
categoryPopup.dismiss()
}
}
categoryPopup!!.showAsDropDown(v_line_top)
}
/**
* 显示擅长方向弹窗
* @param v_line_top 显示弹窗的位置
* @param filterView 隐藏的筛选栏View
* @param bodyBean 数据bean
* @param allFiltersBean 已选择的筛选bean
* @param mConfideAdapter section适配器
*/
override fun showGoodPopupWindow(v_line_top: View, filterView: ConfideHomeFilterView, bodyBean: ConfideHomeBodyBean?, allFiltersBean: ConfideHomeAllFiltersBean, mConfideAdapter: ConfideHomeAdapter) {
if (bodyBean != null && null != bodyBean.group && !bodyBean.group.isEmpty() && null != bodyBean.group[0].data && !bodyBean.group[0].data!!.isEmpty()) {
val categoryPopup = ConfideHomeGoodPopupWindow(mContext!!, bodyBean.group[0].data!!, allFiltersBean.selectGoodData!!)
ConfideHomeUtils.synchroStyle(mContext!!, 3, IConfideHomeConfig.FILTER_STATUS_OPEN, filterView, mConfideAdapter)
categoryPopup!!.setOnDismissListener {
if (allFiltersBean.selectGoodData!!.size > 1 || (allFiltersBean.selectGoodData!!.size == 1 && allFiltersBean!!.selectGoodData!![0] != bodyBean.group!![0].data!![0])) {
ConfideHomeUtils.synchroTextColor(mContext!!, 3, IConfideHomeConfig.FILTER_STATUS_FILTERED, filterView, mConfideAdapter)
} else {
ConfideHomeUtils.synchroTextColor(mContext!!, 3, IConfideHomeConfig.FILTER_STATUS_NORMAL, filterView, mConfideAdapter)
}
}
categoryPopup!!.onGoodSelectedListener = object : ConfideHomeGoodPopupWindow.OnGoodSelectedListener {
override fun onGoodSelected(selectedGoodsList: ArrayList<ConfideHomeFiterItemBean>) {
var ageBuild = StringBuilder()
if (selectedGoodsList != null) {
for (data in selectedGoodsList) {
ageBuild.append("${data.name};")
}
}
//埋点
UMEventUtils.umEvent("筛选点击", "筛选名称", "擅长方向-${ageBuild.toString()}")
ConfideHomeUtils.synchroTextColor(mContext!!, 3, IConfideHomeConfig.FILTER_STATUS_OPEN, filterView, mConfideAdapter)
allFiltersBean.selectGoodData.clear()
allFiltersBean.selectGoodData.addAll(selectedGoodsList)
confideHomeView.recommendList(1)
categoryPopup.dismiss()
}
}
categoryPopup!!.showAsDropDown(v_line_top)
} else {
ToastUtil.toastShort("数据初始化失败,请重新下拉刷新")
}
}
}
\ No newline at end of file
package com.ydl.confide.home.event
import android.view.View
import com.ydl.confide.home.adapter.ConfideHomeAdapter
import com.ydl.confide.home.bean.ConfideHomeAllFiltersBean
import com.ydl.confide.home.bean.ConfideHomeBodyBean
import com.ydl.confide.home.widget.ConfideHomeFilterView
/**
* @author yuanwai
* @描述:倾诉首页事件处理类接口
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/8/10
*/
interface IConfideHomeEvent {
/**
* 跳转我的
*/
fun jumpMine()
/**
* banner点击事件
* @param linkUrl 跳转地址
* @param position 点击索引
* @param title banner 标题
*/
fun bannerClick(linkUrl: String?, position: Int?, title: String?)
/**
* 最近倾诉--继续倾诉
* @param linkUrl 跳转地址
*/
fun latelyConfideClick(linkUrl: String?)
/**
* 最近倾诉--更多
* @param linkUrl 跳转地址
*/
fun latelyConfideMore(linkUrl: String?)
/**
* 分类测评点击事件
* @param linkUrl
*/
fun categoryClick(linkUrl: String?)
/**
* 为你推荐--向TA倾诉
* @param linkUrl 跳转地址
*/
fun recommendClick(linkUrl: String?)
/**
* 为你推荐--更多
* @param linkUrl 跳转地址
*/
fun recommendMoreClick(linkUrl: String?)
/**
* 听声寻人--向TA倾诉
* @param linkUrl 跳转地址
*/
fun soundClick(linkUrl: String?)
/**
* 听声寻人--更多
* @param linkUrl 跳转地址
*/
fun soundMoreClick(linkUrl: String?)
/**
* 咨询师推荐--点我倾诉
* @param linkUrl 跳转地址
*/
fun consultantClick(linkUrl: String?)
/**
* 咨询师推荐--更多情感恋爱专家
* @param linkUrl 跳转地址
*/
fun consultantMoreClick(linkUrl: String?)
/**
* 播放音频
* @param type 当前模块数据类型
* @param index 当前的模块里的数据索引位置
* @param playUrl 播放地址
*/
fun playVoice(type: Int?, index: Int?, playUrl: String?)
/**
* 播放音频
* @param type 当前模块数据类型
* @param index 当前的模块里的数据索引位置
* @param recommendId 为你推荐Id(用于区分播放区域)
* @param playUrl 播放地址
* @param name 咨询师姓名
*/
fun playVoice(type: Int?, index: Int?, recommendId: Int, playUrl: String?, name: String?)
/**
* 重播
*/
fun rePlayVoice()
/**
* 暂停播放
*/
fun pauseVoice()
/**
* 结束播放 释放资源
*/
fun destoryPlayer()
/**
* 私聊
*/
fun toChatForMsg(doctorId: String?)
/**
* 排序弹窗
*/
fun showSortPopupWindow(v_line_top: View, filterView: ConfideHomeFilterView, bodyBean: ConfideHomeBodyBean?, allFiltersBean: ConfideHomeAllFiltersBean, mConfideAdapter: ConfideHomeAdapter)
/**
* 性别年龄弹窗
*/
fun showSexAgePopupWindow(v_line_top: View, filterView: ConfideHomeFilterView, bodyBean: ConfideHomeBodyBean?, allFiltersBean: ConfideHomeAllFiltersBean, mConfideAdapter: ConfideHomeAdapter)
/**
* 擅长方向弹窗
*/
fun showGoodPopupWindow(v_line_top: View, filterView: ConfideHomeFilterView, bodyBean: ConfideHomeBodyBean?, allFiltersBean: ConfideHomeAllFiltersBean, mConfideAdapter: ConfideHomeAdapter)
}
\ No newline at end of file
package com.ydl.confide.home.http
import com.ydl.confide.home.bean.ConfideHomeDataBean
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 io.reactivex.Observable
import retrofit2.http.GET
import retrofit2.http.Headers
import retrofit2.http.Url
/**
* @author yuanwai
* @描述:倾诉首页Api
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/8/10
*/
interface ConfideHomeApi{
//倾诉首页
@Headers( YDL_DOMAIN + YDL_DOMAIN_JAVA,"Content-Type:application/json")
@GET
fun confideHome(@Url url: String): Observable<BaseAPIResponse<MutableList<ConfideHomeDataBean>>>
//每日精选 换一批
@Headers( YDL_DOMAIN+ YDL_DOMAIN_JAVA,"Content-Type:application/json")
@GET
fun recommedChange(@Url url: String): Observable<BaseAPIResponse<ConfideHomeDataBean>>
}
\ No newline at end of file
package com.ydl.confide.home.http
/**
* @author yuanwai
* @描述:倾诉首页接口实现模型
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/7/26
*/
object ConfideHomeDataManager{
fun getHttp(): IConfideHomeHttp = ConfideHomeHttpImpl.getInstance()
}
\ No newline at end of file
package com.ydl.confide.home.http
import com.ydl.confide.home.bean.ConfideHomeDataBean
import com.ydl.ydlcommon.base.config.HttpConfig
import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.ydl.ydlcommon.data.http.RxUtils
import com.ydl.ydlnet.YDLHttpUtils
import io.reactivex.Observable
/**
* @author yuanwai
* @描述:倾诉首页接口实现类
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/7/26
*/
class ConfideHomeHttpImpl private constructor(): IConfideHomeHttp{
companion object {
fun getInstance(): ConfideHomeHttpImpl {
return Holder.INSTANCE
}
}
object Holder {
val INSTANCE = ConfideHomeHttpImpl()
}
private val confideHomeApi: ConfideHomeApi by lazy {
YDLHttpUtils.obtainApi(ConfideHomeApi::class.java)
}
override fun confideHomeRequest(): Observable<BaseAPIResponse<MutableList<ConfideHomeDataBean>>> {
return RxUtils.mapObservable(ConfideHomeParam(0))
.flatMap {
confideHomeApi.confideHome(HttpConfig.SERVER_API_JAVA_URL+"auth/listen/home")
}
}
override fun recommendList(param : ConfideRecommendParam): Observable<BaseAPIResponse<ConfideHomeDataBean>> {
var inuid = StringBuffer()
if (param != null && param.notInUid != null){
for (i in param.notInUid.indices) {
inuid.append(param.notInUid[i])
if(i<param.notInUid.size-1){
inuid.append(",")
}
}
}
val sb = StringBuffer()
sb.append("page").append("=").append(param.page).append("&")
.append("sortType").append("=").append(param.getSortType()).append("&")
.append("sexType").append("=").append(param.getSexType()).append("&")
.append("ageType").append("=").append(param.getAgeType()).append("&")
.append("goodType").append("=").append(param.getGoodType()).append("&")
.append("notInUid").append("=").append(inuid.toString()).append("&")
val confideParam = sb.toString()
return RxUtils.mapObservable(param)
.flatMap {
confideHomeApi.recommedChange(HttpConfig.SERVER_API_JAVA_URL + "auth/listen/search?"+confideParam)
}
}
}
\ No newline at end of file
package com.ydl.confide.home.http
/**
* @author yuanwai
* @描述:倾诉首页请求参数bean
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/8/10
*/
data class ConfideHomeParam(val type : Int)
\ No newline at end of file
package com.ydl.confide.home.http
/**
* @author yuanwai
* @描述:倾诉首页为你推荐请求参数bean
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/9/11
*/
class ConfideRecommendParam private constructor(builder: Builder){
/**
* 页码
*/
internal var page : Int = 1
/**
* 综合排序(传对应排序的ID)
*/
private var sortType : String = ""
/**
* 性别(传对应性别的ID)
*/
private var sexType : String = ""
/**
* 年龄(传对应年龄ID拼接成的字符串) 例如:选中60后、70后、80后,传参为:“6-7-8”
*/
private var ageType : String = ""
/**
* 年龄(传对应年龄ID拼接成的字符串) 例如:选中60后、70后、80后,传参为:“6-7-8”
*/
private var goodType : String = ""
//当前列表已存在专家uid列表
var notInUid : ArrayList<Int> = ArrayList()
fun getSortType() : String{
return sortType
}
fun getSexType() : String{
return sexType
}
fun getAgeType() : String{
return ageType
}
fun getGoodType() : String{
return goodType
}
init {
this.page = builder.page
this.sortType = builder.sortType
this.sexType = builder.sexType
this.ageType = builder.ageType
this.goodType = builder.goodType
this.notInUid = builder.notInUid
}
class Builder {
internal var page : Int = 1
internal var sortType : String = ""
internal var sexType : String = ""
internal var ageType : String = ""
internal var goodType : String = ""
internal var notInUid : ArrayList<Int> = ArrayList()
fun page(page: Int): Builder {
this.page = page
return this
}
fun sortType(sortType: String): Builder {
this.sortType = sortType
return this
}
fun sexType(sexType: String): Builder {
this.sexType = sexType
return this
}
fun ageType(ageType: String): Builder {
this.ageType = ageType
return this
}
fun goodType(goodType: String): Builder {
this.goodType = goodType
return this
}
fun build() : ConfideRecommendParam{
return ConfideRecommendParam(this)
}
}
}
package com.ydl.confide.home.http
import com.ydl.confide.home.bean.ConfideHomeDataBean
import com.ydl.ydlcommon.data.http.BaseAPIResponse
import io.reactivex.Observable
/**
* @author yuanwai
* @描述:倾诉首页请求接口
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/7/26
*/
interface IConfideHomeHttp{
/**
* 倾诉首页请求
*/
fun confideHomeRequest(): Observable<BaseAPIResponse<MutableList<ConfideHomeDataBean>>>
/**
* 为你推荐列表
*/
fun recommendList(param : ConfideRecommendParam): Observable<BaseAPIResponse<ConfideHomeDataBean>>
}
\ No newline at end of file
package com.ydl.confide.home.listener
import android.support.v7.widget.LinearLayoutManager
import android.support.v7.widget.RecyclerView
import com.yidianling.common.tools.LogUtil
import com.yidianling.common.tools.RxImageTool
/**
* @author yuanwai
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/9/25
*/
class ConfideHomeRecycleViewListener : RecyclerView.OnScrollListener() {
/**
* 筛选模块位置
*/
private var mIndex: Int = 0
/**
* rv是否需要第二次滚动
*/
private var move = false
override fun onScrolled(recyclerView: RecyclerView?, dx: Int, dy: Int) {
super.onScrolled(recyclerView, dx, dy)
//在这里进行第二次滚动(最后的距离)
if (move && recyclerView != null) {
move = false
//获取要置顶的项在当前屏幕的位置,mIndex是记录的要置顶项在RecyclerView中的位置
var n = mIndex - (recyclerView!!.layoutManager as LinearLayoutManager).findFirstVisibleItemPosition()
if (0 <= n && n < recyclerView.childCount) {
//获取要置顶的项顶部离RecyclerView顶部的距离
var top = recyclerView.getChildAt(n).top
//最后的移动
recyclerView.scrollBy(0, top)
}
}
}
/**
* 设置筛选模块的位置
*/
fun setFilterIndex(index : Int){
this.mIndex = index
}
/**
* 移动筛选模块置顶
*/
fun moveToPosition(mRecyclerView: RecyclerView){
mRecyclerView.scrollBy(0, 1)
var top = mRecyclerView.getChildAt(mIndex).top
if(top==0 || top==1){
//已滚动到顶部
}else{
// top-=mRecyclerView.getChildAt(mIndex).height
mRecyclerView.scrollBy(0, top)
}
//获取当前recycleView屏幕可见的第一项和最后一项的Position
// var firstItem = (recyclerview.layoutManager as LinearLayoutManager).findFirstVisibleItemPosition()
// var lastItem = (recyclerview.layoutManager as LinearLayoutManager).findLastVisibleItemPosition()
// //然后区分情况
// if (mIndex <= firstItem) {
// //当要置顶的项在当前显示的第一个项的前面时
// recyclerview.scrollToPosition(mIndex)
// } else if (mIndex <= lastItem) {
// //当要置顶的项已经在屏幕上显示时,计算它离屏幕原点的距离
// var top = recyclerview.getChildAt(mIndex - firstItem).top - RxImageTool.dip2px(48f)
// recyclerview.scrollBy(0, top)
// } else {
// //当要置顶的项在当前显示的最后一项的后面时
// recyclerview.scrollToPosition(mIndex)
// //记录当前需要在RecyclerView滚动监听里面继续第二次滚动
// move = true
// }
}
}
\ No newline at end of file
package com.ydl.confide.home.listener
import android.support.v7.widget.LinearLayoutManager
import android.support.v7.widget.RecyclerView
import android.view.View
import com.yidianling.common.tools.LogUtil
import com.yidianling.common.tools.RxImageTool
import com.ydl.confide.home.adapter.ConfideHomeAdapter
import com.ydl.confide.home.config.IConfideHomeConfig
import com.ydl.confide.home.widget.ConfideHomeFilterView
/**
* @author yuanwai
* @描述:悬浮按钮监听事件
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/9/25
*/
class ConfideHomeRecyleSuspendListener : RecyclerView.OnScrollListener() {
private var mCurrentPosition = 0
private var mSuspensionHeight: Int = RxImageTool.dip2px(48f)
private var filterView: ConfideHomeFilterView? = null
private var adapter: ConfideHomeAdapter? = null
fun setFilterView(filterView: ConfideHomeFilterView) {
this.filterView = filterView
}
fun setSectionAdapter(adapter: ConfideHomeAdapter) {
this.adapter = adapter
}
override fun onScrollStateChanged(recyclerView: RecyclerView?, newState: Int) {
super.onScrollStateChanged(recyclerView, newState)
if (null != filterView) {
mSuspensionHeight = filterView!!.height
}
}
override fun onScrolled(recyclerView: RecyclerView?, dx: Int, dy: Int) {
super.onScrolled(recyclerView, dx, dy)
if (null == adapter) {
return
}
val manager = recyclerView!!.layoutManager as LinearLayoutManager
if (mCurrentPosition != manager.findFirstVisibleItemPosition()) {
mCurrentPosition = manager.findFirstVisibleItemPosition()
}
LogUtil.e("http----------------type="+adapter!!.getItemViewType(mCurrentPosition))
if (adapter!!.getItemViewType(mCurrentPosition) == IConfideHomeConfig.TYPE_RECOMMEND) {
var view = manager.findViewByPosition(mCurrentPosition + 1)
if (view != null) {
if (view.top <= mSuspensionHeight) {
filterView!!.visibility = View.VISIBLE
} else {
// filterView!!.visibility = View.INVISIBLE
}
}
}else if (adapter!!.getItemViewType(mCurrentPosition) == IConfideHomeConfig.TYPE_RECOMMEND || adapter!!.getItemViewType(mCurrentPosition) == IConfideHomeConfig.TYPE_SOUND){
filterView!!.visibility = View.VISIBLE
}else {
filterView!!.visibility = View.INVISIBLE
}
}
}
\ No newline at end of file
package com.ydl.confide.home.model
import com.ydl.confide.home.bean.ConfideHomeDataBean
import com.ydl.confide.home.contract.IConfideHomeContract
import com.ydl.confide.home.http.ConfideHomeDataManager
import com.ydl.confide.home.http.ConfideRecommendParam
import com.ydl.ydlcommon.data.http.RxUtils
import io.reactivex.Observable
/**
* @author yuanwai
* @描述:倾诉首页数据模型实现类
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/8/10
*/
class ConfideHomeModelImpl : IConfideHomeContract.Model{
override fun confideHomeRequest(): Observable<MutableList<ConfideHomeDataBean>> {
return ConfideHomeDataManager.getHttp().confideHomeRequest()
.compose(RxUtils.resultJavaData())
}
override fun recommendList(param : ConfideRecommendParam): Observable<ConfideHomeDataBean> {
return ConfideHomeDataManager.getHttp().recommendList(param)
.compose(RxUtils.resultJavaData())
}
}
\ No newline at end of file
package com.ydl.confide.home.popwindow
import android.content.Context
import android.graphics.Typeface
import android.graphics.drawable.BitmapDrawable
import android.support.v7.widget.GridLayoutManager
import android.support.v7.widget.LinearLayoutManager
import android.view.LayoutInflater
import android.view.ViewGroup
import android.widget.PopupWindow
import com.yidianling.common.tools.RxImageTool
import com.ydl.confide.R
import com.ydl.confide.home.bean.ConfideHomeFiterItemBean
import com.ydl.confide.home.popwindow.adapter.ConfideHomeGoodAdapter
import com.ydl.ydlcommon.view.SpaceItemDecorator
import kotlinx.android.synthetic.main.confidehome_good_popup_window.view.*
/**
* @author yuanwai
* @描述:倾诉首页--擅长方向popWindow
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/9/22
*/
class ConfideHomeGoodPopupWindow(context: Context, goodsList: ArrayList<ConfideHomeFiterItemBean>, selectedGoodsList: ArrayList<ConfideHomeFiterItemBean>)
: PopupWindow(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) {
var onGoodSelectedListener: OnGoodSelectedListener? = null
//擅长方向列表数据
private var goodsList: ArrayList<ConfideHomeFiterItemBean>? = null
//已选择的擅长方向数据
private var selectedGoodsList: ArrayList<ConfideHomeFiterItemBean>? = null
init {
val view = LayoutInflater.from(context).inflate(R.layout.confidehome_good_popup_window, null)
this.contentView = view
this.isFocusable = true
@Suppress("DEPRECATION")
this.setBackgroundDrawable(BitmapDrawable())
this.isOutsideTouchable = true
val rvGood = view.rvGood
val tvTitle = view.tv_title
tvTitle.text = "擅长方向"
if (null == this.goodsList){
this.goodsList = ArrayList()
}else{
(this.goodsList as ArrayList).clear()
}
this.goodsList!!.addAll(goodsList)
if (null == this.selectedGoodsList){
this.selectedGoodsList = ArrayList()
}else{
(this.selectedGoodsList as ArrayList).clear()
}
this.selectedGoodsList!!.addAll(selectedGoodsList)
var goodAdapter: ConfideHomeGoodAdapter? = null
if (null == rvGood.adapter){
goodAdapter = ConfideHomeGoodAdapter(context, this.goodsList!!, this.selectedGoodsList!!)
rvGood.adapter = goodAdapter
rvGood.layoutManager = GridLayoutManager(context, 3, LinearLayoutManager.VERTICAL, false)
rvGood.addItemDecoration(SpaceItemDecorator(RxImageTool.dp2px(8f), 3))
}
inputMethodMode = PopupWindow.INPUT_METHOD_NEEDED
view.btnConfirm.setOnClickListener {
onGoodSelectedListener?.onGoodSelected(this.selectedGoodsList!!)
dismiss()
}
view.btnReset.setOnClickListener {
goodAdapter?.cleanSelectedGoods()
}
view.v_zhezhao.setOnClickListener {
dismiss()
}
}
interface OnGoodSelectedListener {
fun onGoodSelected(selectedGoodsList: ArrayList<ConfideHomeFiterItemBean>)
}
}
\ No newline at end of file
package com.ydl.confide.home.popwindow
import android.content.Context
import android.graphics.Typeface
import android.graphics.drawable.BitmapDrawable
import android.support.v7.widget.GridLayoutManager
import android.support.v7.widget.LinearLayoutManager
import android.support.v7.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.PopupWindow
import android.widget.TextView
import com.yidianling.common.tools.RxImageTool
import com.ydl.confide.R
import com.ydl.confide.home.bean.ConfideHomeAllFiltersBean
import com.ydl.confide.home.bean.ConfideHomeFiterItemBean
import com.ydl.confide.home.popwindow.adapter.ConfideHomeGoodAdapter
import com.ydl.ydlcommon.view.SpaceItemDecorator
import kotlinx.android.synthetic.main.confidehome_sexage_popup_window.view.*
/**
* @author yuanwai
* @描述:倾诉首页--性别年龄popWindow
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/9/22
*/
class ConfideHomeSexAgePopupWindow(context: Context, sexData: ArrayList<ConfideHomeFiterItemBean>,ageData : ArrayList<ConfideHomeFiterItemBean>, allFiltersBean: ConfideHomeAllFiltersBean)
: PopupWindow(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) {
var onGoodSelectedListener: OnSexAgeSelectedListener? = null
//性别数据集
private var sexData: ArrayList<ConfideHomeFiterItemBean>? = null
//年龄数据集
private var ageData: ArrayList<ConfideHomeFiterItemBean>? = null
//已选择的性别数据
private var selectSex : ConfideHomeFiterItemBean? = null
//已选择的年龄数据集
private var selectedAge: ArrayList<ConfideHomeFiterItemBean>? = null
private var sexAgeAdapter : ConfideHomeGoodAdapter? = null
private var mAllFiltersBean : ConfideHomeAllFiltersBean? = null
init {
val view = LayoutInflater.from(context).inflate(R.layout.confidehome_sexage_popup_window, null)
this.contentView = view
this.isFocusable = true
@Suppress("DEPRECATION")
this.setBackgroundDrawable(BitmapDrawable())
this.isOutsideTouchable = true
val rvAge = view.rvAge
val tvSexTitle = view.tv_sexTitle
val tvAgeTitle = view.tv_ageTitle
tvSexTitle.text = "性别筛选"
tvAgeTitle.text = "年龄筛选"
if (null == mAllFiltersBean){
mAllFiltersBean = ConfideHomeAllFiltersBean(allFiltersBean.page,allFiltersBean.selectSort,allFiltersBean.selectSex,allFiltersBean.selectAgeData,allFiltersBean.selectGoodData)
}
initData(sexData,ageData,mAllFiltersBean!!)
initSexData(view,mAllFiltersBean!!)
initAdapter(context,rvAge)
inputMethodMode = PopupWindow.INPUT_METHOD_NEEDED
view.btnConfirm.setOnClickListener {
onGoodSelectedListener?.onSexAgeSelected(this.selectSex!!,this.selectedAge!!)
dismiss()
}
view.btnReset.setOnClickListener {
selectSex = ConfideHomeFiterItemBean("-1","")
mAllFiltersBean!!.selectSex = selectSex
initSexData(view,mAllFiltersBean!!)
sexAgeAdapter?.cleanSelectedGoods()
}
view.v_zhezhao.setOnClickListener {
dismiss()
}
}
/**
* 初始化数据
*/
private fun initData(sexData: ArrayList<ConfideHomeFiterItemBean>,ageData : ArrayList<ConfideHomeFiterItemBean>,allFiltersBean: ConfideHomeAllFiltersBean){
//初始化已选择性别数据
if (null == selectSex){
selectSex = ConfideHomeFiterItemBean("-1","")
}
if (null != allFiltersBean.selectSex){
selectSex!!.id = allFiltersBean.selectSex!!.id
selectSex!!.name = allFiltersBean.selectSex!!.name
}
//初始化性别数据集
if (null == this.sexData){
this.sexData = ArrayList()
}else{
(this.sexData as ArrayList).clear()
}
this.sexData!!.addAll(sexData)
//初始化年龄数据集
if (null == this.ageData){
this.ageData = ArrayList()
}else{
(this.ageData as ArrayList).clear()
}
this.ageData!!.addAll(ageData)
//初始化已选择年龄数据集
if (null == this.selectedAge){
this.selectedAge = ArrayList()
}else{
(this.selectedAge as ArrayList).clear()
}
this.selectedAge!!.addAll(allFiltersBean.selectAgeData!!)
}
/**
* 初始化性别数据
*/
private fun initSexData(view : View,allFiltersBean: ConfideHomeAllFiltersBean){
var tvSex1 = view.findViewById<TextView>(R.id.tvSex1)
var tvSex2 = view.findViewById<TextView>(R.id.tvSex2)
if (null != sexData && sexData!!.size > 0){
tvSex1.text = sexData!![0].name
tvSex1.setOnClickListener {
if (selectSex!!.id == sexData!![0].id){
selectSex!!.id = "-1"
selectSex!!.name = ""
setSelect(tvSex1,false)
}else{
selectSex!!.id = sexData!![0].id
selectSex!!.name = sexData!![0].name
setSelect(tvSex1,true)
setSelect(tvSex2,false)
}
}
}
if (null != sexData && sexData!!.size > 1) {
tvSex2.text = sexData!![1].name
tvSex2.setOnClickListener {
if (selectSex!!.id == sexData!![1].id){
selectSex!!.id = "-1"
selectSex!!.name = ""
setSelect(tvSex2,false)
}else{
selectSex!!.id = sexData!![1].id
selectSex!!.name = sexData!![1].name
setSelect(tvSex1,false)
setSelect(tvSex2,true)
}
}
}
if (null == sexData || null == allFiltersBean.selectSex){
return
}
if (sexData!!.size > 0 && allFiltersBean.selectSex!!.id == sexData!![0].id){
setSelect(tvSex1,true)
}else if (sexData!!.size > 1 && allFiltersBean.selectSex!!.id == sexData!![1].id){
setSelect(tvSex2,true)
}else{
setSelect(tvSex1,false)
setSelect(tvSex2,false)
}
}
/**
* 设置性别选中样式
*/
private fun setSelect(tvSex1: TextView,boolean: Boolean){
if (boolean){
tvSex1.setBackgroundResource(R.drawable.confidehome_filter_select_sel)
tvSex1.setTextColor(tvSex1.context.resources.getColor(R.color.baby_blue))
}else{
tvSex1.setBackgroundResource(R.drawable.confidehome_filter_select_nor)
tvSex1.setTextColor(tvSex1.context.resources.getColor(R.color._6))
}
}
private fun initAdapter(context: Context,rvAge : RecyclerView){
//初始化年龄适配器
if (null == rvAge.adapter){
sexAgeAdapter = ConfideHomeGoodAdapter(context, this.ageData!!, this.selectedAge!!)
rvAge.adapter = sexAgeAdapter
rvAge.layoutManager = GridLayoutManager(context, 3, LinearLayoutManager.VERTICAL, false)
rvAge.addItemDecoration(SpaceItemDecorator(RxImageTool.dp2px(8f), 3))
}
}
interface OnSexAgeSelectedListener {
fun onSexAgeSelected(sexData : ConfideHomeFiterItemBean,ageData: ArrayList<ConfideHomeFiterItemBean>)
}
}
\ No newline at end of file
package com.ydl.confide.home.popwindow
import android.content.Context
import android.graphics.drawable.BitmapDrawable
import android.support.v7.widget.LinearLayoutManager
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.PopupWindow
import com.ydl.confide.R
import com.ydl.confide.home.bean.ConfideHomeFiterItemBean
import com.ydl.confide.home.popwindow.adapter.ConfideHomeSortAdapter
import kotlinx.android.synthetic.main.confidehome_sort_popup_window.view.*
/**
* @author yuanwai
* @描述:综合排序popupWindow
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/9/22
*/
class ConfideHomeSortPopupWindow(val context: Context, private val sortItems: ArrayList<ConfideHomeFiterItemBean>, var selectedSort: ConfideHomeFiterItemBean, private val onSortItemSelectedListener: OnSortItemSelectedListener)
: PopupWindow(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) {
private var adapter: ConfideHomeSortAdapter? = null
init {
val view = LayoutInflater.from(context).inflate(R.layout.confidehome_sort_popup_window, null)
this.contentView = view
this.isFocusable = true
@Suppress("DEPRECATION")
this.setBackgroundDrawable(BitmapDrawable())
this.isOutsideTouchable = true
val rvSortItem = view.rvSortItem
if (null == adapter){
adapter = ConfideHomeSortAdapter(context, sortItems, selectedSort, onSortItemSelectedListener)
rvSortItem.adapter = adapter
rvSortItem.layoutManager = LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)
}
view.v_zhezhao.setOnClickListener {
dismiss()
}
}
fun notifyDataSetChanged() {
adapter?.notifyDataSetChanged()
}
interface OnSortItemSelectedListener {
fun onSortItemSelected(sortItem: ConfideHomeFiterItemBean)
}
}
\ No newline at end of file
package com.ydl.confide.home.popwindow.adapter
import android.content.Context
import android.support.v7.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import com.ydl.confide.R
import com.ydl.confide.home.bean.ConfideHomeFiterItemBean
import kotlinx.android.synthetic.main.confidehome_good_item.view.*
/**
* @author yuanwai
* @描述:倾诉首页--筛选模块--擅长方式popwindow适配器
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/9/22
*/
class ConfideHomeGoodAdapter(private val context: Context, private val goods: ArrayList<ConfideHomeFiterItemBean>, private val selectedGood: ArrayList<ConfideHomeFiterItemBean>) : RecyclerView.Adapter<ConfideHomeGoodAdapter.ViewHolder>() {
override fun onBindViewHolder(holder: ViewHolder?, position: Int) {
if (holder != null) {
val category = goods[position]
holder.tvGoodName.text = goods[position].name
holder.tvGoodName.isSelected = selectedGood.contains(category)
if (holder.tvGoodName.isSelected) {
holder.tvGoodName.setBackgroundResource(R.drawable.confidehome_filter_select_sel)
} else {
holder.tvGoodName.setBackgroundResource(R.drawable.confidehome_filter_select_nor)
}
}
}
fun cleanSelectedGoods(){
selectedGood?.clear()
notifyDataSetChanged()
}
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): ViewHolder {
val itemView = LayoutInflater.from(context).inflate(R.layout.confidehome_good_item, parent, false)
return ViewHolder(itemView)
}
override fun getItemCount(): Int = goods.size
inner class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
val tvGoodName: TextView = itemView.tvGoodName
init {
itemView.setOnClickListener {
if (adapterPosition != RecyclerView.NO_POSITION) {
val subject = goods[adapterPosition]
when {
//如果 点击已选中的 那就移除 然后更新
selectedGood.contains(subject) -> {
selectedGood.remove(subject)
notifyItemChanged(adapterPosition)
}
else -> {
//如果点击没选中的 则添加
selectedGood.add(subject)
notifyDataSetChanged()
}
}
}
}
}
}
}
\ No newline at end of file
package com.ydl.confide.home.popwindow.adapter
import android.content.Context
import android.graphics.Color
import android.support.v4.content.ContextCompat
import android.support.v7.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.ydl.confide.R
import com.ydl.confide.home.bean.ConfideHomeFiterItemBean
import com.ydl.confide.home.popwindow.ConfideHomeSortPopupWindow
import kotlinx.android.synthetic.main.confidehome_sort_item.view.*
/**
* @author yuanwai
* @描述:倾诉首页--综合排序适配器
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/9/22
*/
class ConfideHomeSortAdapter(private val context: Context,
private val sortItems: ArrayList<ConfideHomeFiterItemBean>,
private val selectedSort: ConfideHomeFiterItemBean,
private val onItemSelectedListener: ConfideHomeSortPopupWindow.OnSortItemSelectedListener) : RecyclerView.Adapter<ConfideHomeSortAdapter.ViewHolder>() {
override fun getItemCount(): Int = sortItems.size
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): ViewHolder {
val itemView = LayoutInflater.from(context).inflate(R.layout.confidehome_sort_item, parent, false)
return ViewHolder(itemView)
}
override fun onBindViewHolder(holder: ViewHolder?, position: Int) {
val item = sortItems[position]
if (holder != null) {
holder.tvSort.text = item.name
if (item.id == selectedSort.id) {
holder.tvSort.setTextColor(Color.parseColor("#1DA1F2"))
}else{
holder.tvSort.setTextColor(ContextCompat.getColor(context, R.color._6))
}
}
}
inner class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
val tvSort = itemView.tvSort!!
init {
itemView.setOnClickListener {
if (adapterPosition != RecyclerView.NO_POSITION){
onItemSelectedListener.onSortItemSelected(sortItems[adapterPosition])
}
}
}
}
}
\ No newline at end of file
package com.ydl.confide.home.presenter
import android.content.Context
import android.text.TextUtils
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import com.yidianling.common.tools.RxNetTool
import com.ydl.confide.home.bean.ConfideHomeDataBean
import com.ydl.confide.home.contract.IConfideHomeContract
import com.ydl.confide.home.http.ConfideRecommendParam
import com.ydl.confide.home.model.ConfideHomeModelImpl
import com.ydl.confide.home.util.ConfideHomeUtils
import com.ydl.ydlcommon.data.http.ThrowableConsumer
import com.ydl.ydlcommon.mvp.base.BasePresenter
import com.ydl.ydlcommon.utils.RxLifecycleUtils
import com.ydl.ydlcommon.utils.YDLAsyncUtils
import com.ydl.ydlcommon.utils.YDLCacheUtils
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.functions.Consumer
/**
* @author yuanwai
* @描述:倾诉首页逻辑实现类
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/8/10
*/
class ConfideHomePresenterImpl : BasePresenter<IConfideHomeContract.View,IConfideHomeContract.Model>(), IConfideHomeContract.Presenter{
override fun createModel(): IConfideHomeContract.Model {
return ConfideHomeModelImpl()
}
/**
* 加载本地缓存
*/
override fun loadLocalData(context: Context) {
YDLAsyncUtils.asyncAsResult(object : YDLAsyncUtils.AsyncObjecyerResult{
override fun doAsyncAction(): Any {
//读取缓存数据
var cacheData = YDLCacheUtils.getConfideHomeData()
if (cacheData.isEmpty()) {
cacheData = String(ConfideHomeUtils.getAssertsFile(context, "confide_home.json")!!)
}
return cacheData
}
override fun asyncResult(`object`: Any?) {
//如果没有缓存数据,显示加载框
if (`object` !is String || TextUtils.isEmpty(`object`)){
mView.showProgress()
}
if (`object` is String){
val gson = Gson()
val list = gson.fromJson<MutableList<ConfideHomeDataBean>>(`object`, object : TypeToken<MutableList<ConfideHomeDataBean>>() {
}.type)
if(null != list && !list.isEmpty()){
mView.confideHomeResponse(list)
}
}
confideHomeRequest()
}
})
}
/**
* 请求首页数据
*/
override fun confideHomeRequest() {
if (!RxNetTool.isConnected(mView.getContext())){
mView.confideHomeRequestFail()
return
}
val disposable = mModel.confideHomeRequest()
.map { it }
.filter { it != null }
.compose(RxLifecycleUtils.bindToLifecycle(mView!!))//使用 Rxlifecycle,使 Disposable 和 Activity 一起销毁
.observeOn(AndroidSchedulers.mainThread())
.subscribe(Consumer {
mView.confideHomeResponse(it)
updateCache(it)
}, object : ThrowableConsumer() {
override fun accept(msg: String) {
mView.confideHomeRequestFail()
}
})
}
private fun testHome(){
var json = "[{\"type\":1,\"body\":[{\"bannerId\":\"23434\",\"bannerImageUrl\":\"https://img.ydlcdn.com/file/2018/09/18/335fb32fd39131f9159578bcc5a62863.jpg\",\"bannerTitle\":\"banner标题\",\"bannerLinkUrl\":\"app:qingsu/home?id=123\"},{\"bannerId\":\"23434\",\"bannerImageUrl\":\"https://img.ydlcdn.com/file/2018/09/18/335fb32fd39131f9159578bcc5a62863.jpg\",\"bannerLinkUrl\":\"app:qingsu/home?id=123\"}],\"diviLine\":0},{\"type\":2,\"body\":[{\"confidedId\":\"123\",\"confidedName\":\"黄蓉\",\"confideSex\":0,\"confideContent\":\"对你留言:没有人一出生就是完美的,只有不断地相信自己才能成就自己的梦\",\"confidedIcon\":\"https://img.ydlcdn.com/file/2018/03/15/p5hmpru0n0dt5331.png\",\"confideLine\":0,\"confideHearNum\":\"已聆听2882次\",\"confideHistory\":\"7月13日 你向TA倾诉过\",\"confideVoice\":\"http://ssssssssssssssssss\"}],\"head\":{\"title\":\"最近倾诉\"},\"diviLine\":1},{\"type\":3,\"body\":[{\"categoryId\":\"123\",\"categoryType\":1,\"categoryName\":\"倾诉指南\",\"categoryContent\":\"排忧疏导,隐私安全\",\"categoryIcon\":\"https://img.ydlcdn.com/file/2018/08/15/2d04ef1c734b3bed59b33bb73fed81db.png\",\"linkUrl\":\"ydl-user://h5/h5?url=http://www.yidianling.com\"},{\"categoryId\":\"123\",\"categoryType\":2,\"categoryName\":\"专业师资\",\"categoryContent\":\"1182人倾诉心事\",\"categoryIcon\":\"https://img.ydlcdn.com/file/2018/08/15/2d04ef1c734b3bed59b33bb73fed81db.png\"}],\"diviLine\":1},{\"type\":7,\"body\":[{\"confidedId\":\"123\",\"confidedTitle\":\"情感恋爱\",\"confideNum\":\"8513人\",\"confideBgUrl\":\"https://img.ydlcdn.com/file/2018/08/11/m8ueotgn50hgxaa2.png\",\"confidedName\":\"黄蓉\",\"confideSex\":0,\"confideContent\":\"没有人出生就是完美的,只有不断地相信自己才能成就自己的梦想\",\"confidedIcon\":\"https://img.ydlcdn.com/file/2018/03/15/p5hmpru0n0dt5331.png\",\"confideLine\":1,\"confideConnection\":\"98%\",\"confideHearNum\":\"已聆听2882次\",\"confidedTag\":[\"80后\",\"婚姻家庭\",\"情感导师\",\"职场发展\"]},{\"confidedId\":\"123\",\"confidedTitle\":\"情感恋爱\",\"confideNum\":\"8513人\",\"confideBgUrl\":\"https://img.ydlcdn.com/file/2018/08/11/m8ueotgn50hgxaa2.png\",\"confidedName\":\"黄蓉\",\"confideSex\":0,\"confideContent\":\"没有人出生就是完美的,只有不断地相信自己才能成就自己的梦想\",\"confidedIcon\":\"https://img.ydlcdn.com/file/2018/03/15/p5hmpru0n0dt5331.png\",\"confideLine\":2,\"confideConnection\":\"100%\",\"confideHearNum\":\"已聆听2882次\",\"confidedTag\":[\"80后\",\"婚姻家庭\",\"情感导师\",\"职场发展\"]},{\"confidedId\":\"123\",\"confidedTitle\":\"情感恋爱\",\"confideNum\":\"8513人\",\"confideBgUrl\":\"https://img.ydlcdn.com/file/2018/08/11/m8ueotgn50hgxaa2.png\",\"confidedName\":\"黄蓉\",\"confideSex\":0,\"confideContent\":\"没有人出生就是完美的,只有不断地相信自己才能成就自己的梦想\",\"confidedIcon\":\"https://img.ydlcdn.com/file/2018/03/15/p5hmpru0n0dt5331.png\",\"confideLine\":3,\"confideConnection\":\"88%\",\"confideHearNum\":\"已聆听2882次\",\"confidedTag\":[\"80后\",\"婚姻家庭\",\"情感导师\",\"职场发展\"]}],\"head\":{\"title\":\"最佳倾诉榜单\"},\"diviLine\":1},{\"type\":4,\"body\":[{\"filterId\":\"123\",\"filterName\":\"综合排序\",\"filterType\":1,\"sortData\":[{\"id\":1,\"name\":\"综合排序\"},{\"id\":2,\"name\":\"人气从高到低\"},{\"id\":3,\"name\":\"时间从新到旧\"}]},{\"filterId\":\"456\",\"filterName\":\"性别年龄\",\"filterType\":2,\"sexTitle\":\"性别筛选\",\"sexData\":[{\"id\":1,\"name\":\"只看男生\"},{\"id\":2,\"name\":\"只看女生\"}],\"ageTitle\":\"年龄筛选\",\"ageData\":[{\"id\":1,\"name\":\"60后\"},{\"id\":2,\"name\":\"70后\"},{\"id\":3,\"name\":\"80后\"},{\"id\":4,\"name\":\"90后\"}]},{\"filterId\":\"789\",\"filterName\":\"擅长方向\",\"filterType\":3,\"goodTitle\":\"擅长方向\",\"goodData\":[{\"id\":1,\"name\":\"情感问题\"},{\"id\":2,\"name\":\"婚姻家庭\"},{\"id\":3,\"name\":\"情绪压力\"},{\"id\":4,\"name\":\"亲子教育\"}]}],\"diviLine\":1},{\"type\":5,\"body\":[{\"confidedId\":\"123\",\"confidedName\":\"黄蓉\",\"confideSex\":0,\"confideNum\":\"8513人\",\"confideContent\":\"没有人出生就是完美的,只有不断地相信自己才能成就自己的梦想\",\"confidedTag\":[\"80后\",\"婚姻家庭\",\"情感导师\",\"职场发展\"],\"confidedIcon\":\"https://img.ydlcdn.com/file/2018/03/15/p5hmpru0n0dt5331.png\",\"confideLine\":1,\"confideVoice\":\"http://ssssssssssssssssss\",\"confideConnection\":\"100%\"},{\"confidedId\":\"123\",\"confidedName\":\"黄蓉\",\"confideSex\":0,\"confideNum\":\"8513人\",\"confideContent\":\"没有人出生就是完美的,只有不断地相信自己才能成就自己的梦想\",\"confidedTag\":[\"80后\",\"婚姻家庭\",\"情感导师\",\"职场发展\"],\"confidedIcon\":\"https://img.ydlcdn.com/file/2018/03/15/p5hmpru0n0dt5331.png\",\"confideLine\":2,\"confideVoice\":\"http://ssssssssssssssssss\",\"confideConnection\":\"100%\"},{\"confidedId\":\"123\",\"confidedName\":\"黄蓉\",\"confideSex\":0,\"confideNum\":\"8513人\",\"confideContent\":\"没有人出生就是完美的,只有不断地相信自己才能成就自己的梦想\",\"confidedTag\":[\"80后\",\"婚姻家庭\",\"情感导师\",\"职场发展\"],\"confidedIcon\":\"https://img.ydlcdn.com/file/2018/03/15/p5hmpru0n0dt5331.png\",\"confideLine\":3,\"confideVoice\":\"http://ssssssssssssssssss\",\"confideConnection\":\"100%\"}],\"head\":{\"title\":\"为你推荐\"},\"diviLine\":1},{\"type\":6,\"body\":[{\"confidedId\":\"123\",\"confidedName\":\"黄蓉\",\"confideSex\":0,\"confideNum\":\"8513人\",\"confideVoice\":\"http://ssssssssssssssssss\",\"confideConnection\":\"100%\",\"confideContent\":\"没有人出生就是完美的,只有不断地相信自己才能成就自己的梦想\",\"confidedIcon\":\"https://img.ydlcdn.com/file/2018/03/15/p5hmpru0n0dt5331.png\",\"confideLine\":1,\"confideHearNum\":\"已聆听2882次\"},{\"confidedId\":\"123\",\"confidedName\":\"海伦\",\"confideSex\":0,\"confideNum\":\"8513人\",\"confideVoice\":\"http://ssssssssssssssssss\",\"confideConnection\":\"100%\",\"confideContent\":\"没有人出生就是完美的,只有不断地相信自己才能成就自己的梦想\",\"confidedIcon\":\"https://img.ydlcdn.com/file/2018/03/15/p5hmpru0n0dt5331.png\",\"confideLine\":2,\"confideHearNum\":\"已聆听2882次\"},{\"confidedId\":\"123\",\"confidedName\":\"海伦\",\"confideSex\":0,\"confideNum\":\"8513人\",\"confideVoice\":\"http://ssssssssssssssssss\",\"confideConnection\":\"100%\",\"confideContent\":\"没有人出生就是完美的,只有不断地相信自己才能成就自己的梦想\",\"confidedIcon\":\"https://img.ydlcdn.com/file/2018/03/15/p5hmpru0n0dt5331.png\",\"confideLine\":3,\"confideHearNum\":\"已聆听2882次\"}],\"head\":{\"title\":\"听声寻人\",\"subTitle\":\"更多\"},\"diviLine\":1}]"
val gson = Gson()
val list = gson.fromJson<MutableList<ConfideHomeDataBean>>(json, object : TypeToken<MutableList<ConfideHomeDataBean>>() {
}.type)
updateCache(list)
mView.confideHomeResponse(list)
}
/**
* 更新本地缓存
*/
private fun updateCache(list : MutableList<ConfideHomeDataBean>){
YDLAsyncUtils.async(object : YDLAsyncUtils.AsyncObjecyer{
override fun doAsyncAction() {
var gson = Gson()
var json = gson.toJson(list)
YDLCacheUtils.saveConfideHomeData(json)
}
})
}
/**
* 为你推荐列表(筛选调用)
*/
override fun recommendList(param : ConfideRecommendParam) {
if (!RxNetTool.isConnected(mView.getContext())){
mView.showError("网络不给力")
return
}
val disposable = mModel.recommendList(param)
.map { it }
.filter { it != null }
.observeOn(AndroidSchedulers.mainThread())
.subscribe(Consumer {
mView.recommendListResponse(it)
}, object : ThrowableConsumer() {
override fun accept(msg: String) {
mView.showError(msg)
}
})
}
/**
* 为你推荐列表(翻页时调用)
*/
override fun recommendListMore(param: ConfideRecommendParam) {
if (!RxNetTool.isConnected(mView.getContext())){
mView.showError("网络不给力")
return
}
val disposable = mModel.recommendList(param)
.map { it }
.filter { it != null }
.observeOn(AndroidSchedulers.mainThread())
.subscribe(Consumer {
mView.recommendListMoreResponse(it)
}, object : ThrowableConsumer() {
override fun accept(msg: String) {
mView.showError(msg)
}
})
}
}
\ No newline at end of file
倾诉首页界面
\ No newline at end of file
package com.ydl.confide.home.section
import android.content.Context
import android.support.v7.widget.RecyclerView
import android.view.View
import android.view.ViewGroup
import com.ydl.confide.R
import com.ydl.confide.home.bean.ConfideHomeDataBean
import com.ydl.confide.home.config.IConfideHomeConfig
import com.ydl.confide.home.event.IConfideHomeEvent
import com.ydl.confide.home.widget.ConfideHomeBannerView
import com.ydl.ydlcommon.adapter.section.Section
/**
* @author yuanwai
* @描述:banner 适配器
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/8/10 0010
*/
class ConfideHomeBannerSection(var context: Context, private var confideHomeEvent : IConfideHomeEvent) : Section<RecyclerView.ViewHolder>(0) {
override fun getSectionId(): Int {
return IConfideHomeConfig.SECTION_BANNER
}
private var data : ConfideHomeDataBean? = null
override fun getTotalDataNum(): Int {
return 1
}
override fun getItemViewType(position: Int): Int {
return IConfideHomeConfig.SECTION_BANNER
}
fun setData(data : ConfideHomeDataBean){
this.data = data
}
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): RecyclerView.ViewHolder {
return when(viewType){
//banner
IConfideHomeConfig.SECTION_BANNER -> {
BannerViewHolder(ConfideHomeBannerView(context,confideHomeEvent))
}
else -> {
EmptyViewHolder(View.inflate(context,R.layout.view_empty,null))
}
}
}
override fun bindViewHolder(holder: RecyclerView.ViewHolder?, position: Int) {
if (holder is BannerViewHolder){
holder.bannerView!!.initData(this.data!!)
}
}
override fun isBelongTo(viewType: Int): Boolean {
return viewType.toString().startsWith(IConfideHomeConfig.SECTION_BANNER.toString())
}
override fun isHeadType(position: Int): Boolean {
return false
}
override fun isFooterType(position: Int): Boolean {
return false
}
/**
* banner viewHolder
*/
inner class BannerViewHolder(itemView: ConfideHomeBannerView) : RecyclerView.ViewHolder(itemView) {
var bannerView: ConfideHomeBannerView? = null
init {
bannerView = itemView
}
}
/**
* 空View
*/
inner class EmptyViewHolder(itemViews: View) : RecyclerView.ViewHolder(itemViews) {
private var itemViews: View? = null
init {
this.itemViews = itemViews
}
}
}
\ No newline at end of file
package com.ydl.confide.home.section
import android.content.Context
import android.support.v7.widget.RecyclerView
import android.view.View
import android.view.ViewGroup
import com.ydl.confide.R
import com.ydl.confide.home.bean.ConfideHomeDataBean
import com.ydl.confide.home.config.IConfideHomeConfig
import com.ydl.confide.home.contract.IConfideHomeContract
import com.ydl.confide.home.event.IConfideHomeEvent
import com.ydl.confide.home.widget.ConfideHomeCategoryView
import com.ydl.ydlcommon.adapter.section.Section
/**
* @author yuanwai
* @描述:倾诉首页 分类 适配器
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/8/10 0010
*/
class ConfideHomeCategorySection(var context: Context, var confideHomeEvent : IConfideHomeEvent,var homeView : IConfideHomeContract.View) : Section<RecyclerView.ViewHolder>(0) {
override fun getSectionId(): Int {
return IConfideHomeConfig.SECTION_CATEGORY
}
private var data : ConfideHomeDataBean? = null
override fun getTotalDataNum(): Int {
return 1
}
override fun getItemViewType(position: Int): Int {
return IConfideHomeConfig.SECTION_CATEGORY
}
fun setData(data : ConfideHomeDataBean){
this.data = data
}
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): RecyclerView.ViewHolder {
return when(viewType){
//banner
IConfideHomeConfig.SECTION_CATEGORY -> {
CategoryViewHolder(ConfideHomeCategoryView(context,confideHomeEvent,homeView))
}
else -> {
EmptyViewHolder(View.inflate(context,R.layout.view_empty,null))
}
}
}
override fun bindViewHolder(holder: RecyclerView.ViewHolder?, position: Int) {
if (holder is CategoryViewHolder){
holder.categoryView!!.initData(this.data!!)
}
}
override fun isBelongTo(viewType: Int): Boolean {
return viewType.toString().startsWith(IConfideHomeConfig.SECTION_CATEGORY.toString())
}
override fun isHeadType(position: Int): Boolean {
return false
}
override fun isFooterType(position: Int): Boolean {
return false
}
/**
* 分类测评 viewHolder
*/
inner class CategoryViewHolder(itemView: ConfideHomeCategoryView) : RecyclerView.ViewHolder(itemView) {
var categoryView: ConfideHomeCategoryView? = null
init {
categoryView = itemView
}
}
/**
* 空View
*/
inner class EmptyViewHolder(itemViews: View) : RecyclerView.ViewHolder(itemViews) {
private var itemViews: View? = null
init {
this.itemViews = itemViews
}
}
}
\ No newline at end of file
package com.ydl.confide.home.section
import android.content.Context
import android.support.v7.widget.RecyclerView
import android.view.View
import android.view.ViewGroup
import com.yidianling.common.tools.RxImageTool
import com.ydl.confide.R
import com.ydl.confide.home.bean.ConfideHomeDataBean
import com.ydl.confide.home.config.IConfideHomeConfig
import com.ydl.confide.home.contract.IConfideHomeContract
import com.ydl.confide.home.event.IConfideHomeEvent
import com.ydl.confide.home.widget.ConfideHomeFilterView
import com.ydl.ydlcommon.adapter.section.Section
/**
* @author yuanwai
* @描述:为你推荐筛选模块section
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/9/21 0010
*/
class ConfideHomeFilterSection(var context: Context,var view : IConfideHomeContract.View) : Section<RecyclerView.ViewHolder>(0) {
private val FOOTER = 200
private var mFilterViewHolder : FilterViewHolder? = null
override fun getSectionId(): Int {
return IConfideHomeConfig.SECTION_RECOMMEND_FILTER
}
private var data: ConfideHomeDataBean? = null
override fun getItemViewType(position: Int): Int {
if (isFooterType(position)) {
return combineType(IConfideHomeConfig.SECTION_RECOMMEND_FILTER, this.FOOTER)
} else {
return IConfideHomeConfig.SECTION_RECOMMEND_FILTER
}
}
fun setData(data: ConfideHomeDataBean) {
this.data = data
}
override fun bindViewHolder(holder: RecyclerView.ViewHolder?, position: Int) {
if (holder is FilterViewHolder) {
holder.filterView.initData(data!!)
}else if (holder is FooterViewHolder){
}
}
override fun getTotalDataNum(): Int {
return 2
}
fun getFilterViewHolder() : FilterViewHolder? {
return mFilterViewHolder
}
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): RecyclerView.ViewHolder {
if (viewType == combineType(IConfideHomeConfig.SECTION_RECOMMEND_FILTER, FOOTER)) {
var param = RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,RxImageTool.dip2px(0.5f))
var dp15 = RxImageTool.dip2px(15f)
param.setMargins(dp15,0,dp15,0)
var footerView = View(context)
footerView.setBackgroundColor(context.resources.getColor(R.color.confidehome_filters_line))
footerView.layoutParams = param
return FooterViewHolder(footerView)
}else{
mFilterViewHolder = FilterViewHolder(ConfideHomeFilterView(context,view))
return mFilterViewHolder as FilterViewHolder
}
}
override fun isBelongTo(viewType: Int): Boolean {
return viewType.toString().startsWith(IConfideHomeConfig.SECTION_RECOMMEND_FILTER.toString())
}
override fun isHeadType(position: Int): Boolean {
return false
}
override fun isFooterType(position: Int): Boolean {
if (position == 1){
return true
}
return false
}
inner class FilterViewHolder(var filterView: ConfideHomeFilterView) : RecyclerView.ViewHolder(filterView)
inner class FooterViewHolder(var footerView : View) : RecyclerView.ViewHolder(footerView)
}
\ No newline at end of file
package com.ydl.confide.home.section
import android.content.Context
import android.support.v7.widget.RecyclerView
import android.view.View
import android.view.ViewGroup
import com.ydl.confide.R
import com.ydl.confide.home.config.IConfideHomeConfig
import com.ydl.confide.home.event.IConfideHomeEvent
import com.ydl.confide.home.widget.ConfideHomeFooterView
import com.ydl.ydlcommon.adapter.section.Section
/**
* @author yuanwai
* @描述:倾诉首页 底部 更多情感恋爱专家View 适配器
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/8/10 0010
*/
class ConfideHomeFooterSection(var context: Context, private var confideHomeEvent : IConfideHomeEvent) : Section<RecyclerView.ViewHolder>(0) {
override fun getSectionId(): Int {
return IConfideHomeConfig.SECTION_FOOTER
}
override fun getTotalDataNum(): Int {
return 1
}
override fun getItemViewType(position: Int): Int {
return IConfideHomeConfig.SECTION_FOOTER
}
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): RecyclerView.ViewHolder {
return when(viewType){
//banner
IConfideHomeConfig.SECTION_FOOTER -> {
FooterViewHolder(ConfideHomeFooterView(context,confideHomeEvent))
}
else -> {
EmptyViewHolder(View.inflate(context,R.layout.view_empty,null))
}
}
}
override fun bindViewHolder(holder: RecyclerView.ViewHolder?, position: Int) {
}
override fun isBelongTo(viewType: Int): Boolean {
return viewType.toString().startsWith(IConfideHomeConfig.SECTION_FOOTER.toString())
}
override fun isHeadType(position: Int): Boolean {
return false
}
override fun isFooterType(position: Int): Boolean {
return false
}
/**
* 底部 更多情感恋爱专家 viewHolder
*/
inner class FooterViewHolder(itemView: ConfideHomeFooterView) : RecyclerView.ViewHolder(itemView) {
var footerView: ConfideHomeFooterView? = null
init {
footerView = itemView
}
}
/**
* 空View
*/
inner class EmptyViewHolder(itemViews: View) : RecyclerView.ViewHolder(itemViews) {
private var itemViews: View? = null
init {
this.itemViews = itemViews
}
}
}
\ No newline at end of file
package com.ydl.confide.home.section
import android.content.Context
import android.support.v7.widget.RecyclerView
import android.view.ViewGroup
import com.ydl.confide.home.bean.ConfideHomeDataBean
import com.ydl.confide.home.config.IConfideHomeConfig
import com.ydl.confide.home.contract.IConfideHomeContract
import com.ydl.confide.home.event.IConfideHomeEvent
import com.ydl.confide.home.widget.ConfideHomeHeadView
import com.ydl.confide.home.widget.ConfideHomeListenAndFoundView
import com.ydl.ydlcommon.adapter.section.Section
/**
* @author Jim
* @描述:听声寻人section
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/8/11 0011
*/
class ConfideHomeListenAndFoundSection(var context: Context, var view: IConfideHomeContract.View, var confideHomeEvent: IConfideHomeEvent) : Section<RecyclerView.ViewHolder>(0) {
override fun getSectionId(): Int {
return IConfideHomeConfig.SECTION_RECENTLY_CONFIDED
}
private var data: ConfideHomeDataBean? = null
private val HEADER = 200
private var confideHomeListenAndFoundView: ConfideHomeListenAndFoundView? = null
fun setData(data: ConfideHomeDataBean) {
this.data = data
}
override fun bindViewHolder(holder: RecyclerView.ViewHolder?, position: Int) {
if (holder is HeadViewHolder) {
holder.confideHeadView.initData(this.data!!)
} else if (holder is ConfideHomeListenAndFoundViewHolder) {
holder.confideHomeListenAndFoundView.initData(this.data!!)
}
}
override fun getTotalDataNum(): Int {
var count = 1
if (data?.head != null) {
count++
} else if (data?.footer != null) {
count++
}
return count
}
override fun getItemViewType(position: Int): Int {
if (isHeadType(position)) {
return combineType(IConfideHomeConfig.SECTION_SOUND, this.HEADER)
} else {
return IConfideHomeConfig.SECTION_SOUND
}
}
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): RecyclerView.ViewHolder {
if (viewType == combineType(IConfideHomeConfig.SECTION_SOUND, HEADER)) {
return HeadViewHolder(ConfideHomeHeadView(context, confideHomeEvent))
} else {
confideHomeListenAndFoundView = ConfideHomeListenAndFoundView(context, confideHomeEvent)
return ConfideHomeListenAndFoundViewHolder(confideHomeListenAndFoundView!!)
}
}
override fun isBelongTo(viewType: Int): Boolean {
return viewType.toString().startsWith(IConfideHomeConfig.SECTION_SOUND.toString())
}
override fun isHeadType(position: Int): Boolean {
if (data?.head == null) {
return false
} else if (position == 0) {
return true
}
return false
}
override fun isFooterType(position: Int): Boolean {
return false
}
inner class HeadViewHolder(var confideHeadView: ConfideHomeHeadView) : RecyclerView.ViewHolder(confideHeadView)
inner class ConfideHomeListenAndFoundViewHolder(var confideHomeListenAndFoundView: ConfideHomeListenAndFoundView) : RecyclerView.ViewHolder(confideHomeListenAndFoundView)
}
\ No newline at end of file
package com.ydl.confide.home.section
import android.content.Context
import android.support.v7.widget.RecyclerView
import android.view.ViewGroup
import com.ydl.confide.home.bean.ConfideHomeDataBean
import com.ydl.confide.home.config.IConfideHomeConfig
import com.ydl.confide.home.event.IConfideHomeEvent
import com.ydl.confide.home.widget.ConfideHomeRecentView
import com.ydl.ydlcommon.adapter.section.Section
/**
* @author Jim
* @描述:最近倾诉
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/8/10 0010
*/
class ConfideHomeRecentConfideSection(var context: Context, var confideHomeEvent: IConfideHomeEvent) : Section<RecyclerView.ViewHolder>(0) {
override fun getSectionId(): Int {
return IConfideHomeConfig.SECTION_RECENTLY_CONFIDED
}
private var data: ConfideHomeDataBean? = null
fun setData(data: ConfideHomeDataBean) {
this.data = data
}
override fun bindViewHolder(holder: RecyclerView.ViewHolder?, position: Int) {
if (holder is ConsultViewHolder) {
holder.consultView.initData(data!!)
}
}
override fun getTotalDataNum(): Int {
return 1
}
override fun getItemViewType(position: Int): Int {
return IConfideHomeConfig.SECTION_RECENTLY_CONFIDED
}
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): RecyclerView.ViewHolder {
return ConsultViewHolder(ConfideHomeRecentView(context, confideHomeEvent))
}
override fun isBelongTo(viewType: Int): Boolean {
return viewType.toString().startsWith(IConfideHomeConfig.SECTION_RECENTLY_CONFIDED.toString())
}
override fun isHeadType(position: Int): Boolean {
return false
}
override fun isFooterType(position: Int): Boolean {
return false
}
inner class ConsultViewHolder(var consultView: ConfideHomeRecentView) : RecyclerView.ViewHolder(consultView)
}
\ No newline at end of file
package com.ydl.confide.home.section
import android.content.Context
import android.support.v7.widget.RecyclerView
import android.text.TextUtils
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import com.ydl.confide.R
import com.ydl.confide.home.bean.ConfideHomeDataBean
import com.ydl.confide.home.config.IConfideHomeConfig
import com.ydl.confide.home.event.IConfideHomeEvent
import com.ydl.confide.home.widget.ConfideHomeRecommendExpertView
import com.ydl.ydlcommon.adapter.section.Section
/**
* @author Jim
* @描述:最佳倾诉榜单section
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/8/11 0011
*/
class ConfideHomeRecommendExpertSection(var context: Context, var confideHomeEvent: IConfideHomeEvent) : Section<RecyclerView.ViewHolder>(0){
private var data: ConfideHomeDataBean? = null
private val HEADER = 200
fun setData(data: ConfideHomeDataBean) {
this.data = data
}
override fun bindViewHolder(holder: RecyclerView.ViewHolder?, position: Int) {
if (holder is HeadViewHolder && null != data && null != data!!.head && !TextUtils.isEmpty(this.data?.head!!.title)) {
holder.confideHeadView.findViewById<TextView>(R.id.tv_title).text = this.data?.head!!.title
} else if (holder is ConfideHomeRecommendExpertViewHolder) {
holder.confideHomeRecommendExpertView.initData(this.data!!)
}
}
override fun getTotalDataNum(): Int {
var count = 0
if (data?.head != null && !TextUtils.isEmpty(data?.head!!.title)) {
count++
} else if (data?.footer != null) {
count++
}
return count+1
}
override fun getItemViewType(position: Int): Int {
if (isHeadType(position)) {
return combineType(IConfideHomeConfig.SECTION_CONSULTANT, this.HEADER)
} else {
return IConfideHomeConfig.SECTION_CONSULTANT
}
}
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): RecyclerView.ViewHolder {
if (viewType == combineType(IConfideHomeConfig.SECTION_CONSULTANT, HEADER)) {
return HeadViewHolder(LayoutInflater.from(context).inflate(R.layout.confidehome_recommend_expert_head, parent, false))
} else {
return ConfideHomeRecommendExpertViewHolder(ConfideHomeRecommendExpertView(context, confideHomeEvent))
}
}
override fun isBelongTo(viewType: Int): Boolean {
return viewType.toString().startsWith(IConfideHomeConfig.SECTION_CONSULTANT.toString())
}
override fun isHeadType(position: Int): Boolean {
if (data?.head==null || TextUtils.isEmpty(data?.head!!.title)) {
return false
} else if (position == 0) {
return true
}
return false
}
override fun isFooterType(position: Int): Boolean {
if (data?.footer == null) {
return false
} else if (position == totalDataNum - 1) {
return true
}
return false
}
inner class HeadViewHolder(var confideHeadView: View) : RecyclerView.ViewHolder(confideHeadView)
inner class ConfideHomeRecommendExpertViewHolder(var confideHomeRecommendExpertView: ConfideHomeRecommendExpertView) : RecyclerView.ViewHolder(confideHomeRecommendExpertView)
}
\ No newline at end of file
package com.ydl.confide.home.section
import android.content.Context
import android.support.v7.widget.RecyclerView
import android.view.ViewGroup
import com.ydl.confide.home.bean.ConfideHomeDataBean
import com.ydl.confide.home.config.IConfideHomeConfig
import com.ydl.confide.home.contract.IConfideHomeContract
import com.ydl.confide.home.event.IConfideHomeEvent
import com.ydl.confide.home.widget.ConfideHomeRecommendView
import com.ydl.ydlcommon.adapter.section.Section
/**
* @author Jim
* @描述:为你推荐section
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/8/11 0011
*/
class ConfideRecommendSection(var context: Context,var view: IConfideHomeContract.View, var confideHomeEvent: IConfideHomeEvent) : Section<RecyclerView.ViewHolder>(0) {
override fun getSectionId(): Int {
return IConfideHomeConfig.SECTION_RECOMMEND
}
private var data: ConfideHomeDataBean? = null
fun setData(data: ConfideHomeDataBean) {
this.data = data
}
fun addData(data: ConfideHomeDataBean){
if (null == data || null == data.body){
return
}
(this.data!!.body as ArrayList).addAll(data.body)
}
override fun bindViewHolder(holder: RecyclerView.ViewHolder?, position: Int) {
if (holder is RecommendViewHolder) {
holder.confideHomeRecommendView.initData(this.data!!.body!![position],position,data!!.recommendId)
}
}
override fun getTotalDataNum(): Int {
return data!!.body!!.size
}
override fun getItemViewType(position: Int): Int {
return IConfideHomeConfig.SECTION_RECOMMEND
}
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): RecyclerView.ViewHolder {
return RecommendViewHolder(ConfideHomeRecommendView(view,context, confideHomeEvent))
}
override fun isBelongTo(viewType: Int): Boolean {
return viewType.toString().startsWith(IConfideHomeConfig.SECTION_RECOMMEND.toString())
}
override fun isHeadType(position: Int): Boolean {
return false
}
override fun isFooterType(position: Int): Boolean {
return false
}
inner class RecommendViewHolder(var confideHomeRecommendView: ConfideHomeRecommendView) : RecyclerView.ViewHolder(confideHomeRecommendView)
}
\ No newline at end of file
package com.ydl.confide.home.util
import android.content.Context
import android.content.Intent
import android.support.v4.content.ContextCompat
import android.support.v7.widget.AppCompatTextView
import android.support.v7.widget.LinearLayoutManager
import android.support.v7.widget.RecyclerView
import android.text.TextUtils
import android.view.View
import android.view.animation.AnimationUtils
import android.view.animation.LinearInterpolator
import android.widget.ImageView
import com.yidianling.common.tools.LogUtil
import com.ydl.confide.R
import com.ydl.confide.home.adapter.ConfideHomeAdapter
import com.ydl.confide.home.bean.ConfideHomeAllFiltersBean
import com.ydl.confide.home.bean.ConfideHomeBodyBean
import com.ydl.confide.home.bean.ConfideHomeDataBean
import com.ydl.confide.home.config.IConfideHomeConfig
import com.ydl.confide.home.contract.IConfideHomeContract
import com.ydl.confide.home.event.IConfideHomeEvent
import com.ydl.confide.home.http.ConfideRecommendParam
import com.ydl.confide.home.listener.ConfideHomeRecycleViewListener
import com.ydl.confide.home.section.*
import com.ydl.confide.home.widget.ConfideHomeFilterView
import com.ydl.confide.home.widget.ConfidePlayerFloatView
import com.ydl.ydlcommon.adapter.section.SectionAdapter
import com.ydl.ydlcommon.utils.MainUtils
import java.io.BufferedInputStream
import java.io.IOException
import java.io.InputStream
/**
* @author yuanwai
* @描述:倾诉首页工具类
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/8/10
*/
class ConfideHomeUtils {
companion object {
/**
* 读取Assets下文本文件
*/
fun getAssertsFile(context: Context, fileName: String): ByteArray? {
var inputStream: InputStream? = null
val assetManager = context.assets
try {
inputStream = assetManager.open(fileName)
if (inputStream == null) {
return null
}
var bis: BufferedInputStream? = null
val length: Int
try {
bis = BufferedInputStream(inputStream)
length = bis.available()
val data = ByteArray(length)
bis.read(data)
return data
} catch (e: IOException) {
} finally {
if (bis != null) {
try {
bis.close()
} catch (e: Exception) {
}
}
}
return null
} catch (e: IOException) {
e.printStackTrace()
}
return null
}
/**
* 数据重组
*/
fun resetData(list: MutableList<ConfideHomeDataBean>, filterView: ConfideHomeFilterView, listScrollListener: ConfideHomeRecycleViewListener) {
val recommendList: MutableList<ConfideHomeDataBean> = ArrayList()
var soundDataBean: ConfideHomeDataBean? = null
for ((index, dataBean) in list.withIndex().reversed()) {
//给隐藏的为你推荐筛选view赋值
if (dataBean.type == IConfideHomeConfig.TYPE_RECOMMEND_FILTER) {
listScrollListener.setFilterIndex(index)
filterView.initData(dataBean)
}
//拆分为你推荐数据
if (dataBean.type == IConfideHomeConfig.TYPE_RECOMMEND) {
//如果是为你推荐数据 则进行筛分
recommendList.addAll(getRecommendList(dataBean))
//移除当前 为你推荐数据
list.removeAt(index)
}
//移除听声寻人数据 放在最后
if (dataBean.type == IConfideHomeConfig.TYPE_SOUND) {
soundDataBean = ConfideHomeDataBean(dataBean.type, dataBean.body, dataBean.head, dataBean.footer, dataBean.recommendId, dataBean.diviLine)
list.removeAt(index)
}
}
//添加 拆分后的 为你推荐数据
list.addAll(recommendList)
//添加 听声寻人 数据
if (null != soundDataBean) {
list.add(soundDataBean)
}
}
/**
* 筛分 为你推荐数据 并返回集合
*/
fun getRecommendList(dataBean: ConfideHomeDataBean): MutableList<ConfideHomeDataBean> {
var list: MutableList<ConfideHomeDataBean> = ArrayList()
if (null == dataBean || null == dataBean.body || dataBean.body.isEmpty()) {
return list
}
for (bodyBean in dataBean.body) {
val bodyList: MutableList<ConfideHomeBodyBean> = ArrayList()
bodyList.add(bodyBean)
val recommendDataBean = ConfideHomeDataBean(dataBean.type, bodyList, dataBean.head, dataBean.footer, dataBean.recommendId, dataBean.diviLine)
list.add(recommendDataBean)
}
return list
}
/**
* 构建section适配器数据
* @param context 上下文
* @param view confideHomeActivity view层接口
* @param list 数据集合
* @param mConfideAdapter section适配器
* @param mConfideEvent 首页点击事件处理类
*/
fun createScetion(context: Context, view: IConfideHomeContract.View, list: List<ConfideHomeDataBean>, mConfideAdapter: SectionAdapter, mConfideEvent: IConfideHomeEvent, filterView: ConfideHomeFilterView, listScrollListener: ConfideHomeRecycleViewListener) {
for ((index, resultBean) in list.withIndex()) {
//给隐藏的为你推荐筛选view赋值
if (resultBean.type == IConfideHomeConfig.TYPE_RECOMMEND_FILTER) {
listScrollListener.setFilterIndex(index)
filterView.initData(resultBean)
}
createScetion(context, view, resultBean, mConfideAdapter, mConfideEvent)
}
}
/**
* 构建section适配器数据
* @param context 上下文
* @param view confideHomeActivity view层接口
* @param resultBean 数据
* @param mConfideAdapter section适配器
* @param mConfideEvent 首页点击事件处理类
*/
fun createScetion(context: Context, view: IConfideHomeContract.View, resultBean: ConfideHomeDataBean?, mConfideAdapter: SectionAdapter, mConfideEvent: IConfideHomeEvent) {
if (null == resultBean) {
return
}
when (resultBean!!.type) {
//banner
IConfideHomeConfig.TYPE_BANNER -> {
var section = ConfideHomeBannerSection(context, mConfideEvent)
section.setData(resultBean)
mConfideAdapter?.addSection(section)
}
//分类
IConfideHomeConfig.TYPE_CATEGORY -> {
var section = ConfideHomeCategorySection(context, mConfideEvent, view)
section.setData(resultBean)
mConfideAdapter?.addSection(section)
}
//最佳倾诉榜单 todo 产品说先隐藏掉
IConfideHomeConfig.TYPE_CONSULTANT -> {
// var section = ConfideHomeRecommendExpertSection(context,mConfideEvent)
// section.setData(resultBean)
// mConfideAdapter?.addSection(section)
}
//为你推荐筛选模块
IConfideHomeConfig.TYPE_RECOMMEND_FILTER -> {
var section = ConfideHomeFilterSection(context, view)
section.setData(resultBean)
mConfideAdapter?.addSection(section)
}
//最近倾诉
IConfideHomeConfig.TYPE_RECENTLY_CONFIDED -> {
var section = ConfideHomeRecentConfideSection(context, mConfideEvent)
section.setData(resultBean)
mConfideAdapter?.addSection(section)
}
//为你推荐
IConfideHomeConfig.TYPE_RECOMMEND -> {
var section = ConfideRecommendSection(context, view, mConfideEvent)
section.setData(resultBean)
mConfideAdapter?.addSection(section)
}
//听声寻人
IConfideHomeConfig.TYPE_SOUND -> {
var section = ConfideHomeListenAndFoundSection(context, view, mConfideEvent)
section.setData(resultBean)
mConfideAdapter?.addSection(section)
}
}
}
/**
* 更新section适配器数据(用于点击某个模块的播放或暂停按钮,重置了各模块的播放状态字段)
* @param list 数据集合
* @param mConfideAdapter section适配器
*/
fun updateSection(list: List<ConfideHomeDataBean>, mConfideAdapter: SectionAdapter) {
//banner 数据bean
var bannerData: ConfideHomeDataBean? = null
//分类 数据bean
var categoryData: ConfideHomeDataBean? = null
//最近倾诉 数据bean
var recentData: ConfideHomeDataBean? = null
//为你推荐筛选模块 数据bean
var recommendFilterData: ConfideHomeDataBean? = null
//为你推荐 数据bean
var recommendData: ConfideHomeDataBean? = null
//听声寻人 数据bean
var listenAndFoundData: ConfideHomeDataBean? = null
//最佳倾听榜单 数据bean
var recommendExpertData: ConfideHomeDataBean? = null
for (resultBean in list) {
when (resultBean.type) {
//banner
IConfideHomeConfig.TYPE_BANNER -> {
bannerData = resultBean
}
//最近倾诉
IConfideHomeConfig.TYPE_RECENTLY_CONFIDED -> {
recentData = resultBean
}
//分类测评
IConfideHomeConfig.TYPE_CATEGORY -> {
categoryData = resultBean
}
//为你推荐筛选模块数据
IConfideHomeConfig.TYPE_RECOMMEND_FILTER -> {
recommendFilterData = resultBean
}
//为你推荐
IConfideHomeConfig.TYPE_RECOMMEND -> {
recommendData = resultBean
}
//听声寻人
IConfideHomeConfig.TYPE_SOUND -> {
listenAndFoundData = resultBean
}
//最佳倾听榜单
IConfideHomeConfig.TYPE_CONSULTANT -> {
recommendExpertData = resultBean
}
}
}
for (section in mConfideAdapter.getmSections()) {
when (section) {
is ConfideHomeBannerSection -> {
//banner
section.setData(bannerData!!)
}
is ConfideHomeRecentConfideSection -> {
//最近倾诉
section.setData(recentData!!)
}
is ConfideHomeCategorySection -> {
//分类倾诉
section.setData(categoryData!!)
}
is ConfideHomeFilterSection -> {
//为你推荐筛选模块
section.setData(recommendFilterData!!)
}
is ConfideRecommendSection -> {
//为你推荐
section.setData(recommendData!!)
}
is ConfideHomeListenAndFoundSection -> {
//听声寻人
section.setData(listenAndFoundData!!)
}
is ConfideHomeRecommendExpertSection -> {
//最佳倾听榜单
section.setData(recommendExpertData!!)
}
}
}
}
/**
* 移除为你推荐和听声寻人section
*/
fun removeRecommendAndSoundSection(mConfideAdapter: SectionAdapter) {
for (index in (0..(mConfideAdapter.getmSections().size - 1)).reversed()) {
if (mConfideAdapter.getmSections()[index] is ConfideRecommendSection) {
//移除为你推荐section
mConfideAdapter.getmSections().removeAt(index)
} else if (mConfideAdapter.getmSections()[index] is ConfideHomeListenAndFoundSection) {
//移除听声寻人section
mConfideAdapter.getmSections().removeAt(index)
}
}
}
/**
* 同步筛选栏样式状态(因为筛选栏有两个 一个是列表中的,一个是顶部隐藏的)
*/
fun synchroStyle(context: Context, type: Int, status: Int, filterView: ConfideHomeFilterView, mConfideAdapter: ConfideHomeAdapter) {
//设置悬浮隐藏的筛选栏样式
var view = filterView.getTextViewByType(type)
if (null != view) {
updateOthersTextStyle(context, view, status)
}
//设置列表中的筛选栏样式
if (null != mConfideAdapter.getFilterViewHolder() && null != mConfideAdapter.getFilterViewHolder()!!.filterView) {
var list_filterView = mConfideAdapter.getFilterViewHolder()!!.filterView.getTextViewByType(type)
if (null != list_filterView) {
updateOthersTextStyle(context, list_filterView, status)
}
}
}
/**
* 同步筛选栏样式状态(因为筛选栏有两个 一个是列表中的,一个是顶部隐藏的)
*/
fun synchroTextColor(context: Context, type: Int, status: Int, filterView: ConfideHomeFilterView, mConfideAdapter: ConfideHomeAdapter) {
//设置悬浮隐藏的筛选栏样式
var view = filterView.getTextViewByType(type)
if (null != view) {
updateOthersTextColor(context, view, status)
}
//设置列表中的筛选栏样式
//为你推荐筛选模块
if (null != mConfideAdapter.getFilterViewHolder() && null != mConfideAdapter.getFilterViewHolder()!!.filterView) {
var list_filterView = mConfideAdapter.getFilterViewHolder()!!.filterView.getTextViewByType(type)
if (null != list_filterView) {
updateOthersTextColor(context, list_filterView, status)
}
}
}
/**
* 同步筛选栏样式状态(因为筛选栏有两个 一个是列表中的,一个是顶部隐藏的)
*/
fun synchroTextDrawable(mContext: Context, type: Int, status: Int, filterView: ConfideHomeFilterView, mConfideAdapter: ConfideHomeAdapter) {
//设置悬浮隐藏的筛选栏样式
var view = filterView.getTextViewByType(type)
if (null != view) {
updateOthersTextDrawable(mContext, view, status)
}
//设置列表中的筛选栏样式
//为你推荐筛选模块
if (null != mConfideAdapter.getFilterViewHolder() && null != mConfideAdapter.getFilterViewHolder()!!.filterView) {
var list_filterView = mConfideAdapter.getFilterViewHolder()!!.filterView.getTextViewByType(type)
if (null != list_filterView) {
updateOthersTextDrawable(mContext, list_filterView, status)
}
}
}
/**
* 获取滑动的距离
*/
fun getScollYDistance(recyclerview: RecyclerView): Int {
if (null == recyclerview) {
return 0
}
val layoutManager = recyclerview.layoutManager as LinearLayoutManager
val position = layoutManager.findFirstVisibleItemPosition()
val firstVisiableChildView = layoutManager.findViewByPosition(position)
val itemHeight = firstVisiableChildView.height
var yDistance = position * itemHeight - firstVisiableChildView.top
if (yDistance <= 50 && position > 1) {
//position滑动到2和3之间的时候 滑动距离 会变成 小于10的距离
//先这样解决吧
return 200
}
return yDistance
}
/**
* 跳转个人中心
*/
fun buildJumpMine(context: Context) {
val intent = Intent()
intent.putExtra(MainUtils.ACTION_TAG, MainUtils.JUMP_MAIN_TAB_CHANGE)
intent.putExtra(MainUtils.MAIN_TAB_INDEX, 4)
intent.setClassName(context, "com.cxzapp.yidianling.MainActivity")
intent.flags = Intent.FLAG_ACTIVITY_CLEAR_TOP
context.startActivity(intent)
}
/**
* 根据点击播放的位置,重置所有数据播放状态
* @param cacheList 缓存数据
* @param type 点击的数据类型
* @param index 一级数据索引
* @param recommendId 为你推荐区域Id 用于区分播放的区域 因为为你推荐是多个section
*/
fun changeCacheDataPlay(cacheList: MutableList<ConfideHomeDataBean>?, type: Int?, index: Int?, recommendId: Int?) {
if (null == cacheList) {
return
}
for ((itemIndex, item) in cacheList!!.withIndex()) {
if (null == item) {
break
}
//循环查找点击的类型
if (item.type == type) {
if (type == IConfideHomeConfig.TYPE_RECOMMEND && null != item.body && !item.body.isEmpty()) {
// 为你推荐
// 当ID匹配的时候 在去查找对应的索引位置
if (item.recommendId == recommendId) {
item.body[0].confideIsPlay = itemIndex == index
} else {
item.body[0].confideIsPlay = false
}
} else {
for ((i, bodyItem) in item.body!!.withIndex()) {
bodyItem.confideIsPlay = index == i
}
}
} else {
for (bodyItem in item.body!!) {
bodyItem.confideIsPlay = false
}
}
}
}
/**
* 更新播放状态
*/
fun updateFMStatu(mPlayerFloatView: ConfidePlayerFloatView, isPlaying: Boolean) {
if (null == mPlayerFloatView) {
return
}
if (isPlaying) {
mPlayerFloatView.visibility = View.VISIBLE
} else {
mPlayerFloatView.visibility = View.GONE
}
mPlayerFloatView.updatePlayState(isPlaying)
}
//更改筛选选项的按钮 文字颜色和图标
private fun updateOthersTextStyle(mContext: Context, tv: AppCompatTextView, status: Int) {
LogUtil.e("http-----------------updateOthersTextStyle")
when (status) {
IConfideHomeConfig.FILTER_STATUS_NORMAL -> {
tv.setTextColor(ContextCompat.getColor(mContext, R.color._6))
tv.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.platform_ic_arrow_drop_down_grey_500_18dp, 0)
}
IConfideHomeConfig.FILTER_STATUS_FILTERED, IConfideHomeConfig.FILTER_STATUS_OPEN -> {
tv.setTextColor(ContextCompat.getColor(mContext, R.color.baby_blue))
tv.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.platform_ic_arrow_drop_down_green_18dp, 0)
}
}
}
//设置筛选选项的按钮文字颜色
private fun updateOthersTextColor(mContext: Context, tv: AppCompatTextView, status: Int) {
LogUtil.e("http-----------------updateOthersTextColor")
when (status) {
IConfideHomeConfig.FILTER_STATUS_NORMAL -> {
tv.setTextColor(ContextCompat.getColor(mContext, R.color._6))
}
IConfideHomeConfig.FILTER_STATUS_FILTERED, IConfideHomeConfig.FILTER_STATUS_OPEN -> {
tv.setTextColor(ContextCompat.getColor(mContext, R.color.baby_blue))
}
}
tv.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.platform_ic_arrow_drop_down_grey_500_18dp, 0)
}
//更改筛选选项的按钮 图标
private fun updateOthersTextDrawable(mContext: Context, tv: AppCompatTextView, status: Int) {
when (status) {
IConfideHomeConfig.FILTER_STATUS_NORMAL -> {
tv.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.platform_ic_arrow_drop_down_grey_500_18dp, 0)
}
IConfideHomeConfig.FILTER_STATUS_FILTERED, IConfideHomeConfig.FILTER_STATUS_OPEN -> {
tv.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.platform_ic_arrow_drop_down_green_18dp, 0)
}
}
}
/**
* 启动 播放动画
*/
fun startPlayAnim(context: Context, imageView: ImageView) {
var animation = AnimationUtils.loadAnimation(context, R.anim.confidehome_play_anim)
var lin = LinearInterpolator()//设置动画匀速运动
animation.interpolator = lin
imageView.startAnimation(animation)
}
/**
* 停止 播放动画
*/
fun stopPlayAnim(imageView: ImageView) {
imageView.clearAnimation()
}
/**
* 构建为你推荐接口入参
* @param allFiltersBean 筛选参数缓存
* @return ConfideRecommendParam 为你推荐参数bean
*/
fun createParam(allFiltersBean: ConfideHomeAllFiltersBean): ConfideRecommendParam {
var param = ConfideRecommendParam.Builder()
param.notInUid = allFiltersBean.notInUid
//页码
if (-1 != allFiltersBean.page) {
param.page(allFiltersBean.page)
}
//综合排序
if (null != allFiltersBean.selectSort && !TextUtils.isEmpty(allFiltersBean.selectSort!!.id) && "-1" != allFiltersBean.selectSort!!.id) {
param.sortType(allFiltersBean.selectSort!!.id!!)
}
//性别
if (null != allFiltersBean.selectSex && !TextUtils.isEmpty(allFiltersBean.selectSex!!.id) && "-1" != allFiltersBean.selectSex!!.id) {
param.sexType(allFiltersBean.selectSex!!.id!!)
}
//年龄
if (null != allFiltersBean.selectAgeData && !allFiltersBean.selectAgeData.isEmpty()) {
param.ageType(allFiltersBean.selectAgeData.map { it.id }.joinToString("-"))
}
//擅长方向
if (null != allFiltersBean.selectGoodData && !allFiltersBean.selectGoodData.isEmpty()) {
param.goodType(allFiltersBean.selectGoodData.map { it.id }.joinToString("-"))
}
return param.build()
}
}
}
\ No newline at end of file
package com.ydl.confide.home.widget
import android.content.Context
import android.view.View
import android.view.ViewGroup
import android.widget.FrameLayout
import com.yidianling.common.tools.RxImageTool
import com.ydl.confide.R
import com.ydl.confide.home.bean.ConfideHomeBodyBean
import com.ydl.confide.home.bean.ConfideHomeDataBean
import com.ydl.confide.home.event.IConfideHomeEvent
import com.ydl.ydlcommon.view.banner.GlideImageLoader
import kotlinx.android.synthetic.main.confidehome_banner_view.view.*
/**
* @author yuanwai
* @描述:倾诉首页banner
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/8/10
*/
class ConfideHomeBannerView(context: Context,
//
private var confideHomeEvent: IConfideHomeEvent) : FrameLayout(context) {
/**
* banner数据缓存
*/
private var mDataList: List<ConfideHomeBodyBean>? = null
/**
* 数据缓存
*/
private var mDataBean: ConfideHomeDataBean? = null
private var margin = 0
init {
initView()
}
private fun initView() {
val params = FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
View.inflate(context, R.layout.confidehome_banner_view, this)
layoutParams = params
margin = RxImageTool.dip2px(2.5f)
}
fun initData(dataBean: ConfideHomeDataBean?) {
if (null == dataBean ||
dataBean.body == null ||
dataBean.body!!.isEmpty()) {
visibility = View.GONE
return
}
mDataBean = dataBean
visibility = View.VISIBLE
if (null == mDataList) {
mDataList = ArrayList()
} else {
(mDataList as ArrayList).clear()
}
(mDataList as ArrayList<ConfideHomeBodyBean>).addAll(mDataBean!!.body!!)
var urlLists = ArrayList<String>()
var count = (mDataList as ArrayList<ConfideHomeBodyBean>).size - 1
for (index in 0..count) {
urlLists.add((mDataList as ArrayList<ConfideHomeBodyBean>)[index].bannerImageUrl!!)
}
banner.setImageLoader(GlideImageLoader(R.color.new_divide_color,6)).setImages(urlLists).start()
banner.setOnBannerListener {
confideHomeEvent!!.bannerClick((mDataList as ArrayList<ConfideHomeBodyBean>)[it].bannerLinkUrl, it, (mDataList as ArrayList<ConfideHomeBodyBean>)[it].bannerTitle)
}
}
}
\ No newline at end of file
package com.ydl.confide.home.widget
import android.content.Context
import android.support.annotation.Nullable
import android.support.v7.widget.CardView
import android.text.TextUtils
import android.util.AttributeSet
import android.view.View
import com.ydl.ydl_image.module.GlideApp
import com.yidianling.common.tools.RxImageTool
import com.ydl.confide.R
import com.ydl.confide.home.bean.ConfideHomeBodyBean
import com.ydl.confide.home.contract.IConfideHomeContract
import com.ydl.confide.home.event.IConfideHomeEvent
import com.ydl.ydlcommon.utils.UMEventUtils
import kotlinx.android.synthetic.main.confidehome_item_category.view.*
/**
* @author yuanwai
* @描述:倾诉首页--分类子View
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/9/21
*/
class ConfideHomeCategoryItemView(mContext: Context, @Nullable attrs: AttributeSet) : CardView(mContext, attrs) {
private var confideHomeEvent: IConfideHomeEvent? = null
private var dp35: Int = 0
init {
initView()
}
private fun initView() {
View.inflate(context, R.layout.confidehome_item_category, this)
dp35 = RxImageTool.dip2px(35f)
}
fun initData(bodyBean: ConfideHomeBodyBean?, confideHomeEvent: IConfideHomeEvent, homeView: IConfideHomeContract.View) {
this.confideHomeEvent = confideHomeEvent
if (null == bodyBean) {
return
}
//这样处理 是防止 滑动过程中 反复去加载图片
if (!TextUtils.isEmpty(bodyBean.categoryIcon) && img_icon.getTag(R.id.img_icon) != bodyBean.categoryIcon) {
GlideApp.with(context)
.load(bodyBean.categoryIcon)
.override(dp35, dp35)
.into(img_icon)
img_icon.setTag(R.id.img_icon, bodyBean.categoryIcon)
}
tv_title.text = bodyBean.categoryName
tv_content.text = bodyBean.categoryContent
setOnClickListener {
//加载H5页面
if (bodyBean.categoryType == 1) {
//加载H5页面,跳转统一路由
confideHomeEvent.categoryClick(bodyBean.linkUrl)
} else if (bodyBean.categoryType == 2) {
//锚点到筛选位置
homeView.moveToFilter()
//埋点
UMEventUtils.umEvent("专业师资点击", "专业师资", "专业师资")
}
}
}
}
\ No newline at end of file
package com.ydl.confide.home.widget
import android.content.Context
import android.view.View
import android.view.ViewGroup
import android.widget.LinearLayout
import com.yidianling.common.tools.RxImageTool
import com.ydl.confide.R
import com.ydl.confide.home.bean.ConfideHomeBodyBean
import com.ydl.confide.home.bean.ConfideHomeDataBean
import com.ydl.confide.home.contract.IConfideHomeContract
import com.ydl.confide.home.event.IConfideHomeEvent
import kotlinx.android.synthetic.main.confidehome_category_view.view.*
/**
* @author yuanwai
* @描述:倾诉首页--分类View
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/9/21
*/
class ConfideHomeCategoryView(mContext: Context,
//倾诉首页事件类
private var confideHomeEvent: IConfideHomeEvent,
//倾诉首页View接口
private var homeView : IConfideHomeContract.View) : LinearLayout(mContext) {
init {
initView()
}
private fun initView(){
var params = ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,RxImageTool.dip2px(106f))
View.inflate(context, R.layout.confidehome_category_view,this)
layoutParams = params
orientation = HORIZONTAL
setBackgroundResource(R.color.confidehome_category_bg)
}
fun initData(bean: ConfideHomeDataBean?){
if (null == bean || null == bean.body || bean.body.isEmpty()){
visibility = View.GONE
return
}
visibility = View.VISIBLE
initItem1Data(bean.body[0])
if (bean.body.size > 1){
initItem2Data(bean.body[1])
}
}
private fun initItem1Data(bodyBean: ConfideHomeBodyBean?){
v_item1.initData(bodyBean,confideHomeEvent,homeView)
}
private fun initItem2Data(bodyBean: ConfideHomeBodyBean?){
v_item2.initData(bodyBean,confideHomeEvent,homeView)
}
}
\ No newline at end of file
package com.ydl.confide.home.widget
import android.content.Context
import android.support.annotation.Nullable
import android.support.v4.content.ContextCompat
import android.util.AttributeSet
import android.util.TypedValue
import android.view.Gravity
import android.view.View
import android.view.ViewGroup
import android.widget.LinearLayout
import com.yidianling.common.tools.RxImageTool
import com.ydl.confide.R
import com.ydl.confide.home.bean.ConfideHomeBodyBean
import com.ydl.confide.home.bean.ConfideHomeDataBean
import com.ydl.confide.home.contract.IConfideHomeContract
import com.ydl.ydlcommon.utils.ScreenUtil
import com.ydl.ydlcommon.view.DrawableRightTextView
/**
* @author yuanwai
* @描述:倾诉首页--为你推荐筛选View
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/9/21
*/
class ConfideHomeFilterView(mContext: Context, @Nullable attrs: AttributeSet?, defStyleAttr: Int) : LinearLayout(mContext,attrs,defStyleAttr){
constructor(mContext : Context,attrs : AttributeSet):this(mContext,attrs,0)
constructor(mContext : Context,confideHomeView : IConfideHomeContract.View): this(mContext,null,0){
this.confideHomeView = confideHomeView
}
private var first = false
private var confideHomeView : IConfideHomeContract.View? = null
init {
initView()
}
private fun initView() {
var params = ViewGroup.LayoutParams(ScreenUtil.screenWidth,RxImageTool.dip2px(48f))
layoutParams = params
orientation = HORIZONTAL
}
fun setHomeView(confideHomeView : IConfideHomeContract.View){
this.confideHomeView = confideHomeView
}
fun initData(dataBean: ConfideHomeDataBean?){
if (null == dataBean || null == dataBean.body || dataBean.body.isEmpty()){
visibility = View.GONE
return
}
visibility = View.VISIBLE
for (index in dataBean.body.indices){
if (childCount == 0){
createView()
}else if (index > childCount - 1){
createView()
}
if (index < childCount){
bindData(getChildAt(index),dataBean.body[index])
}
}
first = true
}
private fun createView(){
var params = LinearLayout.LayoutParams(0,RxImageTool.dip2px(48f))
params.weight = 1f
var textView = DrawableRightTextView(context)
textView.id = R.id.tv_title
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 13f)
textView.gravity = Gravity.CENTER
textView.setTextColor(ContextCompat.getColor(context, R.color._6))
setDrawableRight(textView)
textView.layoutParams = params
addView(textView)
}
private fun setDrawableRight(textView: DrawableRightTextView){
var drawable = context.resources.getDrawable(R.drawable.ic_arrow_drop_down_grey_500_18dp)
// 这一步必须要做,否则不会显示.
drawable.setBounds(0, 0, drawable.minimumWidth, drawable.minimumHeight)
textView.setCompoundDrawablesWithIntrinsicBounds(null, null, drawable, null)
}
private fun bindData(view : View,bodyBean: ConfideHomeBodyBean){
var textView = view.findViewById<DrawableRightTextView>(R.id.tv_title)
textView.text = bodyBean.filterName
textView.setTag(R.id.tv_title,bodyBean)
if ("排序" == bodyBean.filterName){
textView.setTextColor(ContextCompat.getColor(context, R.color.baby_blue))
// textView.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_arrow_drop_down_green_18dp, 0)
}
textView.setOnClickListener {
showPopWindow(textView,textView.getTag(R.id.tv_title) as ConfideHomeBodyBean)
}
}
private fun showPopWindow(textView : DrawableRightTextView,bodyBean: ConfideHomeBodyBean){
if (null == confideHomeView){
return
}
when(bodyBean.filterType){
1 -> {
//综合排序
confideHomeView!!.showSortPopupWindow(textView,textView,bodyBean)
}
2 -> {
//性别年龄
confideHomeView!!.showSexAgePopupWindow(textView,textView,bodyBean)
}
3 -> {
//擅长方向
confideHomeView!!.showGoodPopupWindow(textView,textView,bodyBean)
}
}
}
fun refreshView(){
var count = childCount
for (index in 0..count){
var view = getChildAt(index)
if (view is DrawableRightTextView){
if ("排序" == view.text){
view.setTextColor(ContextCompat.getColor(context, R.color.baby_blue))
}else{
view.setTextColor(ContextCompat.getColor(context, R.color._6))
}
}
}
}
/**
* 根据类型获取View
*/
fun getTextViewByType(type : Int) : DrawableRightTextView? {
var count = childCount
for (index in 0..count){
var view = getChildAt(index) as DrawableRightTextView
var bodyBean = view.getTag(R.id.tv_title) as ConfideHomeBodyBean
if (bodyBean.filterType == type){
return view
}
}
return null
}
}
\ No newline at end of file
package com.ydl.confide.home.widget
import android.content.Context
import android.view.View
import android.view.ViewGroup
import android.widget.LinearLayout
import android.widget.RelativeLayout
import com.ydl.confide.R
import com.ydl.confide.home.event.IConfideHomeEvent
import kotlinx.android.synthetic.main.confidehome_footer.view.*
/**
* @author yuanwai
* @描述:倾诉首页底部 更多情感恋爱专家View
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/8/11
*/
class ConfideHomeFooterView(var mContext: Context,var confideHomeEvent : IConfideHomeEvent) : RelativeLayout(mContext){
init {
initView()
}
/**
* 界面初始化
*/
private fun initView() {
var params = ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.WRAP_CONTENT)
View.inflate(context, R.layout.confidehome_footer,this)
tv_footer.setOnClickListener {
confideHomeEvent.consultantMoreClick("app://listen/list")
}
layoutParams = params
}
}
\ No newline at end of file
package com.ydl.confide.home.widget
import android.content.Context
import android.view.View
import android.view.ViewGroup
import android.widget.LinearLayout
import com.yidianling.common.tools.RxImageTool
import com.ydl.confide.R
import com.ydl.confide.home.bean.ConfideHomeDataBean
import com.ydl.confide.home.config.IConfideHomeConfig
import com.ydl.confide.home.event.IConfideHomeEvent
import kotlinx.android.synthetic.main.confidehome_item_header.view.*
@Suppress("DEPRECATION")
/**
* @author Jim
* @描述:倾诉首页headview
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/8/11 0011
*/
class ConfideHomeHeadView(context: Context, private var confideHomeEvent: IConfideHomeEvent) : LinearLayout(context) {
init {
initView()
}
private fun initView() {
orientation = HORIZONTAL
View.inflate(context, R.layout.confidehome_item_header, this)
var params = LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, RxImageTool.dip2px(25f))
params.setMargins(0, RxImageTool.dip2px(30f), 0, RxImageTool.dip2px(18f))
layoutParams = params
}
fun initData(bean: ConfideHomeDataBean) {
if (bean.head == null) {
visibility = View.GONE
return
}
visibility = View.VISIBLE
iv_recently_more.text = bean.head.subTitle
iv_recently_more.setOnClickListener {
confideHomeEvent.recommendMoreClick(bean.head.subLinkUrl)
}
when (bean.type) {
IConfideHomeConfig.TYPE_RECOMMEND -> {
setPadding(0, RxImageTool.dip2px(30f), 0, 0)
iv_recently_talk.setImageResource(R.drawable.confidehome_recommend)
iv_recently_title.text = bean.head.title
iv_recently_more.visibility = View.GONE
}
IConfideHomeConfig.TYPE_RECENTLY_CONFIDED -> {
setPadding(0, RxImageTool.dip2px(30f), 0, RxImageTool.dip2px(18f))
iv_recently_talk.setImageResource(R.drawable.confidehome_zuijin)
iv_recently_title.text = bean.head.title
iv_recently_more.visibility = View.GONE
}
IConfideHomeConfig.TYPE_SOUND -> {
iv_recently_talk.setImageResource(R.drawable.confidehome_listen)
iv_recently_title.text = bean.head.title
iv_recently_more.visibility = View.GONE
}
}
}
}
\ No newline at end of file
package com.ydl.confide.home.widget
import android.content.Context
import android.text.TextUtils
import android.view.View
import android.widget.FrameLayout
import com.ydl.confide.R
import com.ydl.confide.home.bean.ConfideHomeBodyBean
import com.ydl.confide.home.config.IConfideHomeConfig
import com.ydl.confide.home.event.IConfideHomeEvent
import com.ydl.confide.home.util.ConfideHomeUtils
import com.ydl.ydlcommon.utils.UMEventUtils
import kotlinx.android.synthetic.main.confidehome_listen_and_found_item_view.view.*
/**
* @author yuanwai
* @描述:倾诉首页--听声寻人Item View
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/9/22
*/
class ConfideHomeListenAndFoundItemView(mContext: Context, private var confideHomeEvent: IConfideHomeEvent) : FrameLayout(mContext) {
init {
initView()
}
private fun initView() {
View.inflate(context, R.layout.confidehome_listen_and_found_item_view, this)
}
/**
* 数据初始化
*/
fun initData(bodyBean: ConfideHomeBodyBean?, position: Int) {
if (null == bodyBean) {
visibility = View.GONE
return
}
visibility = View.VISIBLE
//设置在线状态
setLineStatu(bodyBean)
//设置是否播放动画
setPlay(bodyBean, position)
//设置名称
tv_name.text = bodyBean.confidedName
//设置性别
setSex(bodyBean)
//设置向TA倾诉文案
setConfideNum(bodyBean)
//设置接通率文案
setConnection(bodyBean)
//设置咨询师简介
tv_content.text = bodyBean.confideContent
//设置向TA倾诉按钮状态
setConfideButton(bodyBean)
//界面跳转事件
this.setOnClickListener {
click(bodyBean)
}
}
/**
* 设置在线状态
*/
private fun setLineStatu(bodyBean: ConfideHomeBodyBean) {
tv_isLine.visibility = View.VISIBLE
when (bodyBean.confideLine) {//1在线 2离线 3通话中
1 -> {
tv_isLine.text = "在线"
tv_isLine.setBackgroundResource(R.drawable.confidehome_bg_main_color)
}
2 -> {
tv_isLine.text = "离线"
tv_isLine.setBackgroundResource(R.drawable.confidehome_bg_color_666666)
}
3 -> {
tv_isLine.text = "通话中"
tv_isLine.setBackgroundResource(R.drawable.confidehome_bg_color_ff8f38)
}
else -> {
tv_isLine.visibility = View.GONE
}
}
}
/**
* 设置是否播放动画
*/
private fun setPlay(bodyBean: ConfideHomeBodyBean, position: Int) {
if (bodyBean.confideIsPlay) {
//启动动画
ConfideHomeUtils.startPlayAnim(context, img_disc)
} else {
//暂停动画
ConfideHomeUtils.stopPlayAnim(img_disc)
}
if (TextUtils.isEmpty(bodyBean.confideVoice)) {
return
}
img_mask.setOnClickListener {
if (bodyBean.confideIsPlay!!) {
confideHomeEvent.pauseVoice()
} else {
confideHomeEvent.playVoice(IConfideHomeConfig.TYPE_SOUND, position, bodyBean.confideVoice)
}
}
}
/**
* 设置性别
*/
private fun setSex(bodyBean: ConfideHomeBodyBean) {
if (bodyBean.confideSex == 1) {
img_sex.setImageResource(R.drawable.confidehome_new_male)
} else {
img_sex.setImageResource(R.drawable.confidehome_new_female)
}
}
/**
* 设置向TA倾诉文案
*/
private fun setConfideNum(bodyBean: ConfideHomeBodyBean) {
if (TextUtils.isEmpty(bodyBean.confideNum)) {
tv_confideNum.visibility = View.GONE
tv_tv_confideNumContent.visibility = View.GONE
} else {
tv_confideNum.visibility = View.VISIBLE
tv_tv_confideNumContent.visibility = View.VISIBLE
tv_confideNum.text = bodyBean.confideNum
}
}
/**
* 设置接通率文案
*/
private fun setConnection(bodyBean: ConfideHomeBodyBean) {
if (TextUtils.isEmpty(bodyBean.confideConnection)) {
tv_Connection.visibility = View.INVISIBLE
tv_ConnectionContent.visibility = View.INVISIBLE
} else {
tv_Connection.visibility = View.VISIBLE
tv_ConnectionContent.visibility = View.VISIBLE
tv_Connection.text = bodyBean.confideConnection
}
}
/**
* 设置向TA倾诉按钮状态
*/
private fun setConfideButton(bodyBean: ConfideHomeBodyBean) {
when (bodyBean.confideLine) {//1.在线 2.离线 3.通话中 4.继续倾诉
1 -> {
tv_confide.setBackgroundResource(R.drawable.confidehome_line_1)
}
2 -> {
tv_confide.setBackgroundResource(R.drawable.confidehome_line_2)
}
3 -> {
tv_confide.setBackgroundResource(R.drawable.confidehome_line_3)
}
4 ->{
tv_confide.setBackgroundResource(R.drawable.confidehome_line_4)
}
}
}
/**
* 点击事件
*/
private fun click(bodyBean: ConfideHomeBodyBean) {
when (bodyBean.confideLine) {//1在线 2离线 3通话中
1, 3,4 -> {
//埋点
UMEventUtils.umEvent("听声寻人点击", "向他倾诉点击", "向他倾诉")
confideHomeEvent.soundClick(bodyBean.linkUrl)
}
2 -> {
//跳转私聊 并发送自定义消息
confideHomeEvent.toChatForMsg(""+bodyBean.uid)
}
}
}
}
\ No newline at end of file
package com.ydl.confide.home.widget
import android.content.Context
import android.view.View
import android.widget.FrameLayout
import com.ydl.confide.R
import com.ydl.confide.home.bean.ConfideHomeDataBean
import com.ydl.confide.home.event.IConfideHomeEvent
import kotlinx.android.synthetic.main.confidehome_banner.view.*
/**
* @author Jim
* @描述:倾诉首页--听声寻人View
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/8/11 0011
*/
class ConfideHomeListenAndFoundView(context: Context, private var confideHomeEvent: IConfideHomeEvent) : FrameLayout(context) {
private var selectIndex: Int = 0
private var firstView: View? = null
private var lastView: View? = null
private var cacheList: ArrayList<View>? = null
init {
initView()
cacheList = ArrayList()
}
private fun initView() {
View.inflate(context, R.layout.confidehome_banner, this)
}
fun initData(bean: ConfideHomeDataBean) {
if (bean == null || bean.body == null || bean.body.isEmpty()) {
visibility = View.GONE
return
}
visibility = View.VISIBLE
for (index in 0 until bean.body.size) {
if (bean.body[index].confideIsPlay) {
if (index < bean.body.size) {
selectIndex = index + 1
} else {
selectIndex = index
}
}
if (index == 0) {
if (null == firstView) {
//第一个View(用于左右滑动过度的View)
firstView = ConfideHomeListenAndFoundItemView(context, confideHomeEvent)
}
(firstView as ConfideHomeListenAndFoundItemView).initData(bean.body[index], index)
}
if (index == bean.body.size - 1) {
if (null == lastView) {
//最后一个View(用于左右滑动过度的View)
lastView = ConfideHomeListenAndFoundItemView(context, confideHomeEvent)
}
(lastView as ConfideHomeListenAndFoundItemView).initData(bean.body[index], index)
}
//如果缓存为0 则新建View
if (cacheList!!.size == 0) {
//根据数据集合添加item view
var view = ConfideHomeListenAndFoundItemView(context, confideHomeEvent)
cacheList!!.add(view)
} else if (index > cacheList!!.size - 1) {//如果索引大于缓存的大小 则新建View
//根据数据集合添加item view
var view = ConfideHomeListenAndFoundItemView(context, confideHomeEvent)
cacheList!!.add(view)
}
//获取缓存相应索引位置的Item view 并初始化数据
((cacheList as ArrayList)[index] as ConfideHomeListenAndFoundItemView).initData(bean.body[index], index)
}
//给bannner设置数据
confide_home_banner?.setView(cacheList, firstView, lastView)?.start()
//设置上一次 点击播放的位置
if (selectIndex == 0) {
confide_home_banner.setCurrentItem(1)
} else {
confide_home_banner.setCurrentItem(selectIndex)
}
}
}
\ No newline at end of file
package com.ydl.confide.home.widget
import android.content.Context
import android.os.Build
import android.support.v7.widget.CardView
import android.support.v7.widget.RecyclerView
import android.text.TextUtils
import android.view.View
import android.view.ViewGroup
import com.ydl.ydl_image.module.GlideApp
import com.ydl.ydl_image.transform.GlideRoundTransform
import com.yidianling.common.tools.RxImageTool
import com.ydl.confide.R
import com.ydl.confide.home.bean.ConfideHomeDataBean
import com.ydl.confide.home.event.IConfideHomeEvent
import kotlinx.android.synthetic.main.confidehome_recent_view.view.*
/**
* @author yuanwai
* @描述:最近倾诉View
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/9/20
*/
class ConfideHomeRecentView(mContext: Context, private var confideHomeEvent: IConfideHomeEvent) : CardView(mContext) {
private var dp42: Int = 0
init {
initView()
}
/**
* 界面初始化
*/
private fun initView() {
initLayoutParam()
View.inflate(context, R.layout.confidehome_recent_view, this)
}
private fun initLayoutParam() {
dp42 = RxImageTool.dip2px(42f)
var dp15 = RxImageTool.dip2px(15f)
var params = RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, RxImageTool.dip2px(50f))
params.setMargins(dp15, RxImageTool.dip2px(28f), dp15, RxImageTool.dip2px(24f))
radius = RxImageTool.dip2px(23f).toFloat()
layoutParams = params
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
elevation = RxImageTool.dip2px(1f).toFloat()
}
}
/**
* 数据赋值
*/
fun initData(bean: ConfideHomeDataBean?) {
if (null == bean || null == bean.body || bean.body.isEmpty()) {
visibility = View.GONE
return
}
var bodyBean = bean.body[0]
visibility = View.VISIBLE
//这样处理 是防止 滑动过程中 反复去加载图片
if (!TextUtils.isEmpty(bodyBean.confidedIcon) && img_icon.getTag(R.id.img_icon) != bodyBean.confidedIcon) {
GlideApp.with(context)
.load(bodyBean.confidedIcon)
.override(dp42, dp42)
.transform(GlideRoundTransform(context, 21))
.into(img_icon)
img_icon.setTag(R.id.img_icon, bodyBean.confidedIcon)
}
if (bodyBean.confideSex == 1) {
img_sex.setImageResource(R.drawable.confidehome_new_male)
} else {
img_sex.setImageResource(R.drawable.confidehome_new_female)
}
tv_name.text = bodyBean.confidedName
tv_history.text = bodyBean.confideHistory
setOnClickListener {
when (bodyBean.confideLine) {//1在线 2离线 3通话中
1, 3,4 -> {
confideHomeEvent.latelyConfideClick(bodyBean.linkUrl)
}
2 -> {
//跳转私聊 并发送自定义消息
confideHomeEvent.toChatForMsg(""+bodyBean.uid)
}
}
}
}
}
\ No newline at end of file
package com.ydl.confide.home.widget
import android.content.Context
import android.graphics.Color
import android.text.TextUtils
import android.util.TypedValue
import android.view.Gravity
import android.view.View
import android.view.ViewGroup
import android.widget.FrameLayout
import android.widget.LinearLayout
import android.widget.TextView
import com.ydl.ydl_image.module.GlideApp
import com.yidianling.common.tools.RxImageTool
import com.ydl.confide.R
import com.ydl.confide.home.bean.ConfideHomeBodyBean
import com.ydl.confide.home.config.IConfideHomeConfig
import com.ydl.confide.home.event.IConfideHomeEvent
import com.ydl.ydlcommon.utils.ScreenUtil
import kotlinx.android.synthetic.main.confidehome_recommend_expert_item_view.view.*
/**
* @author yuanwai
* @描述:倾诉首页--最佳倾诉榜单item view
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/9/21
*/
class ConfideHomeRecommendExpertItemView(mContext: Context, private var confideHomeEvent: IConfideHomeEvent) : FrameLayout(mContext) {
private var bgWidth: Int = 0
private var dp100: Int = 0
private var dp16 = 0
private var dp4 = 0
private var dp3 = 0
init {
initView()
}
private fun initView() {
View.inflate(context, R.layout.confidehome_recommend_expert_item_view, this)
bgWidth = ScreenUtil.screenWidth - RxImageTool.dip2px(30f)
dp100 = RxImageTool.dip2px(100f)
dp16 = RxImageTool.dip2px(16f)
dp4 = RxImageTool.dip2px(4f)
dp3 = RxImageTool.dip2px(3f)
}
fun initData(bodyBean: ConfideHomeBodyBean?, position: Int) {
if (null == bodyBean || null == bodyBean.bodyData || bodyBean.bodyData!!.isEmpty()) {
visibility = View.GONE
return
}
var dataBean = bodyBean.bodyData!![0]
visibility = View.VISIBLE
//设置标题
if (!TextUtils.isEmpty(bodyBean.confidedTitle)) {
tv_title.text = bodyBean.confidedTitle
}
//设置背景图
setBGUrl(bodyBean)
//设置在线状态
setLineStatu(dataBean)
//设置头像
setHead(dataBean)
//设置播放状态
setPlay(dataBean, bodyBean.confideIsPlay, position)
//设置名称
if (!TextUtils.isEmpty(dataBean.confidedName)) {
tv_name.text = dataBean.confidedName
}
//设置性别
setSex(dataBean)
//设置向TA倾诉文案
setConfideNum(dataBean)
//设置接通率文案
setConnection(dataBean)
//设置标签
setConfideTag(dataBean)
//设置咨询师简介
tv_content.text = dataBean.confideContent
//设置按钮文案
setConfideButton(dataBean)
//点击事件
setOnClickListener {
click(dataBean)
}
}
/**
* 设置背景图片
*/
private fun setBGUrl(bodyBean: ConfideHomeBodyBean) {
//这样处理 是防止 滑动过程中 反复去加载图片
if (!TextUtils.isEmpty(bodyBean.confideBgUrl) && img_bg.getTag(R.id.img_bg) != bodyBean.confideBgUrl) {
GlideApp.with(context)
.load(bodyBean.confideBgUrl)
.override(bgWidth, RxImageTool.dip2px(250f))
.into(img_bg)
img_bg.setTag(R.id.img_bg, bodyBean.confideBgUrl)
}
}
/**
* 设置在线状态
*/
private fun setLineStatu(bodyBean: ConfideHomeBodyBean) {
when (bodyBean.confideLine) {//1在线 2离线 3通话中 4继续通话
1, 4 -> {
tv_isLine.text = "在线"
tv_isLine.setBackgroundResource(R.drawable.confidehome_bg_main_color)
}
2 -> {
tv_isLine.text = "离线"
tv_isLine.setBackgroundResource(R.drawable.confidehome_bg_color_666666)
}
3 -> {
tv_isLine.text = "通话中"
tv_isLine.setBackgroundResource(R.drawable.confidehome_bg_color_ff8f38)
}
}
}
/**
* 设置头像
*/
private fun setHead(bodyBean: ConfideHomeBodyBean) {
//这样处理 是防止 滑动过程中 反复去加载图片
if (!TextUtils.isEmpty(bodyBean.confidedIcon) && img_head.getTag(R.id.img_head) != bodyBean.confidedIcon) {
GlideApp.with(context)
.load(bodyBean.confidedIcon)
.override(dp100, dp100)
.into(img_head)
img_head.setTag(R.id.img_head, bodyBean.confidedIcon)
}
}
/**
* 设置播放按钮
*/
private fun setPlay(bodyBean: ConfideHomeBodyBean, confideIsPlay: Boolean, position: Int) {
if (TextUtils.isEmpty(bodyBean.confideVoice)) {
img_play.visibility = View.GONE
} else {
img_play.visibility = View.VISIBLE
}
if (confideIsPlay) {
img_play.setImageResource(R.drawable.confidehome_playing)
} else {
img_play.setImageResource(R.drawable.confidehome_sond_play)
}
img_play.setOnClickListener {
if (confideIsPlay) {
confideHomeEvent.pauseVoice()
} else {
confideHomeEvent.playVoice(IConfideHomeConfig.TYPE_CONSULTANT, position, bodyBean.confideVoice)
}
}
}
/**
* 设置性别
*/
private fun setSex(bodyBean: ConfideHomeBodyBean) {
if (bodyBean.confideSex == 1) {
img_sex.setImageResource(R.drawable.confidehome_new_male)
} else {
img_sex.setImageResource(R.drawable.confidehome_new_female)
}
}
/**
* 设置向TA倾诉文案
*/
private fun setConfideNum(bodyBean: ConfideHomeBodyBean) {
if (TextUtils.isEmpty(bodyBean.confideNum)) {
tv_confideNum.visibility = View.GONE
tv_tv_confideNumContent.visibility = View.GONE
} else {
tv_confideNum.visibility = View.VISIBLE
tv_tv_confideNumContent.visibility = View.VISIBLE
tv_confideNum.text = bodyBean.confideNum
}
}
/**
* 设置接通率文案
*/
private fun setConnection(bodyBean: ConfideHomeBodyBean) {
if (TextUtils.isEmpty(bodyBean.confideConnection)) {
tv_Connection.visibility = View.GONE
tv_ConnectionContent.visibility = View.GONE
} else {
tv_Connection.visibility = View.VISIBLE
tv_ConnectionContent.visibility = View.VISIBLE
tv_Connection.text = bodyBean.confideConnection
}
}
/**
* 设置标签 todo 待优化
*/
private fun setConfideTag(bodyBean: ConfideHomeBodyBean) {
flowlayout_tag.removeAllViews()
if (null == bodyBean.confidedTag || bodyBean.confidedTag.isEmpty()) {
return
}
var i = 0
for (tag in bodyBean.confidedTag) {
if (i > 4) break
var params = LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, dp16)
params.setMargins(0, 0, dp4, 0)
var textView = TextView(context)
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 10f)
textView.setTextColor(Color.parseColor("#808080"))
textView.gravity = Gravity.CENTER
textView.setPadding(dp3, 0, dp3, 0)
textView.setBackgroundResource(R.drawable.confidehome_bg_tag)
textView.layoutParams = params
textView.text = tag
flowlayout_tag.addView(textView)
i++
}
}
/**
* 设置向TA倾诉按钮状态
*/
private fun setConfideButton(bodyBean: ConfideHomeBodyBean) {
when (bodyBean.confideLine) {//1在线 2离线 3通话中
1, 3, 4 -> {
tv_confide.text = "向TA倾诉"
}
2 -> {
tv_confide.text = "喊TA上线"
}
}
}
/**
* 点击事件
*/
private fun click(bodyBean: ConfideHomeBodyBean) {
when (bodyBean.confideLine) {//1在线 2离线 3通话中
1, 3, 4 -> {
confideHomeEvent.consultantClick(bodyBean.linkUrl)
}
2 -> {
//跳转私聊 并发送自定义消息
confideHomeEvent.toChatForMsg(""+bodyBean.uid)
}
}
}
}
\ No newline at end of file
package com.ydl.confide.home.widget
import android.content.Context
import android.view.View
import android.widget.FrameLayout
import com.ydl.confide.R
import com.ydl.confide.home.bean.ConfideHomeDataBean
import com.ydl.confide.home.event.IConfideHomeEvent
import com.ydl.confide.home.widget.adapter.RecommendExpertAdapter
import kotlinx.android.synthetic.main.confidehome_recommend_expert_view.view.*
/**
* @author yuanwai
* @描述:倾诉首页--最佳倾诉榜单View
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/9/21
*/
class ConfideHomeRecommendExpertView(context : Context, private var confideHomeEvent: IConfideHomeEvent) : FrameLayout(context){
//适配器
private var mRecommendExpertAdapter : RecommendExpertAdapter? = null
//view缓存集合
private var cacheViewList: List<View>? = null
init {
cacheViewList = ArrayList()
initView()
}
companion object {
//播放索引位置
var playIndex = 0
}
private fun initView(){
View.inflate(context, R.layout.confidehome_recommend_expert_view,this)
}
fun initData(bean: ConfideHomeDataBean?){
if (null == bean){
visibility = View.GONE
return
}
visibility = View.VISIBLE
bindView(bean)
initAdapter()
}
/**
* 创建View
*/
private fun bindView(bean: ConfideHomeDataBean){
var count = cacheViewList!!.size
for (index in 0 until bean.body!!.size) {
if (bean.body[index].confideIsPlay){
playIndex = index
}
if (0 == count){
(cacheViewList as ArrayList).add(ConfideHomeRecommendExpertItemView(context,confideHomeEvent))
}else if (index > count - 1){
(cacheViewList as ArrayList).add(ConfideHomeRecommendExpertItemView(context,confideHomeEvent))
}
if ((cacheViewList as ArrayList)[index] is ConfideHomeRecommendExpertItemView){
((cacheViewList as ArrayList)[index] as ConfideHomeRecommendExpertItemView).initData(bean.body[index],index)
}
}
}
/**
* 初始化适配器
*/
private fun initAdapter(){
if (null == mRecommendExpertAdapter){
mRecommendExpertAdapter = RecommendExpertAdapter(context,cacheViewList!!)
viewPager.adapter = mRecommendExpertAdapter
viewPager.offscreenPageLimit = cacheViewList!!.size
}
viewPager.currentItem = playIndex
}
}
\ No newline at end of file
package com.ydl.confide.home.widget
import android.content.Context
import android.graphics.Color
import android.graphics.Paint
import android.text.TextUtils
import android.util.TypedValue
import android.view.Gravity
import android.view.View
import android.view.ViewGroup
import android.widget.FrameLayout
import android.widget.LinearLayout
import android.widget.TextView
import com.ydl.ydl_image.module.GlideApp
import com.yidianling.common.tools.RxImageTool
import com.ydl.confide.R
import com.ydl.confide.home.bean.ConfideHomeBodyBean
import com.ydl.confide.home.config.IConfideHomeConfig
import com.ydl.confide.home.contract.IConfideHomeContract
import com.ydl.confide.home.event.IConfideHomeEvent
import com.ydl.ydlcommon.utils.UMEventUtils
import kotlinx.android.synthetic.main.confidehome_recommend_view.view.*
/**
* @author yuanwai
* @描述:为你推荐
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/9/21 0011
*/
class ConfideHomeRecommendView(var view: IConfideHomeContract.View, context: Context, private var confideHomeEvent: IConfideHomeEvent) : FrameLayout(context) {
private var dp96 = 0
private var dp16 = 0
private var dp4 = 0
private var dp3 = 0
init {
initView()
}
private fun initView() {
var params = FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
layoutParams = params
View.inflate(context, R.layout.confidehome_recommend_view, this)
dp96 = RxImageTool.dip2px(96f)
dp16 = RxImageTool.dip2px(16f)
dp4 = RxImageTool.dip2px(4f)
dp3 = RxImageTool.dip2px(3f)
}
fun initData(bodyBean: ConfideHomeBodyBean?, position: Int, recommendId: Int) {
if (bodyBean == null) {
visibility = View.GONE
return
}
var data = bodyBean
//设置在线状态
setLineStatu(bodyBean)
//设置头像
setHead(bodyBean)
//设置播放按钮
setPlay(bodyBean, position, recommendId)
//设置名称
tv_name.text = bodyBean.confidedName
//设置性别
setSex(bodyBean)
//设置向TA倾诉文案
setConfideNum(bodyBean)
//设置接通率文案
setConnection(bodyBean)
//设置价格
setPrice(bodyBean)
//设置红包、原价
setCoupon(bodyBean)
//设置标签
setConfideTag(bodyBean)
//设置咨询师简介
tv_content.text = bodyBean.confideContent
//设置向TA倾诉按钮状态
setConfideButton(bodyBean)
//设置页面点击事件
this.setOnClickListener {
//埋点(这里的点击事件是执行的同一个方法,但是点击区域不同,所以分开统计)
UMEventUtils.umEvent("列表展示点击", "图片点击", "图片点击")
confideHomeEvent.consultantClick(bodyBean.linkUrl)
}
}
/**
* 设置在线状态
*/
private fun setLineStatu(bodyBean: ConfideHomeBodyBean) {
when (bodyBean.confideLine) {//1在线 2离线 3通话中
1, 4 -> {
tv_isLine.text = "在线"
tv_isLine.setBackgroundResource(R.drawable.confidehome_bg_main_color)
}
2 -> {
tv_isLine.text = "离线"
tv_isLine.setBackgroundResource(R.drawable.confidehome_bg_color_666666)
}
3 -> {
tv_isLine.text = "通话中"
tv_isLine.setBackgroundResource(R.drawable.confidehome_bg_color_ff8f38)
}
// 4 -> {
// tv_confide.text = "继续倾诉"
// tv_confide.setBackgroundResource(R.drawable.confidehome_recent_btn_continue_bg)
// }
}
}
/**
* 设置头像
*/
private fun setHead(bodyBean: ConfideHomeBodyBean) {
//这样处理 是防止 滑动过程中 反复去加载图片
if (!TextUtils.isEmpty(bodyBean.confidedIcon) && img_head.getTag(R.id.img_head) != bodyBean.confidedIcon) {
GlideApp.with(context)
.load(bodyBean.confidedIcon)
.override(dp96, dp96)
.into(img_head)
img_head.setTag(R.id.img_head, bodyBean.confidedIcon)
}
}
/**
* 设置播放按钮
*/
private fun setPlay(bodyBean: ConfideHomeBodyBean, position: Int, recommendId: Int) {
if (TextUtils.isEmpty(bodyBean.confideVoice)) {
iv_play.visibility = View.GONE
} else {
iv_play.visibility = View.VISIBLE
}
if (bodyBean.confideIsPlay) {
iv_play.setImageResource(R.drawable.confidehome_playing)
} else {
iv_play.setImageResource(R.drawable.confidehome_sond_play)
}
iv_play.setOnClickListener {
if (bodyBean.confideIsPlay!!) {
confideHomeEvent.pauseVoice()
} else {
confideHomeEvent.playVoice(IConfideHomeConfig.TYPE_RECOMMEND, position, recommendId, bodyBean.confideVoice, bodyBean.confidedName)
}
}
}
/**
* 设置性别
*/
private fun setSex(bodyBean: ConfideHomeBodyBean) {
if (bodyBean.confideSex == 1) {
img_sex.setImageResource(R.drawable.confidehome_new_male)
} else {
img_sex.setImageResource(R.drawable.confidehome_new_female)
}
}
/**
* 设置向TA倾诉文案
*/
private fun setConfideNum(bodyBean: ConfideHomeBodyBean) {
if (TextUtils.isEmpty(bodyBean.confideNum)) {
tv_confideNum.visibility = View.GONE
tv_tv_confideNumContent.visibility = View.GONE
} else {
tv_confideNum.visibility = View.VISIBLE
tv_tv_confideNumContent.visibility = View.VISIBLE
tv_confideNum.text = bodyBean.confideNum
}
}
/**
* 设置接通率文案
*/
private fun setConnection(bodyBean: ConfideHomeBodyBean) {
if (TextUtils.isEmpty(bodyBean.confideConnection)) {
tv_Connection.visibility = View.INVISIBLE
tv_ConnectionContent.visibility = View.INVISIBLE
} else {
tv_Connection.visibility = View.VISIBLE
tv_ConnectionContent.visibility = View.VISIBLE
tv_Connection.text = bodyBean.confideConnection
}
}
/**
* 设置价格
*/
private fun setPrice(bodyBean: ConfideHomeBodyBean) {
val sb = StringBuffer()
if (TextUtils.isEmpty(bodyBean.confideFee)) {
sb.append("0")
} else {
sb.append(bodyBean.confideFee)
}
tv_price.text = sb.toString()
}
/**
* 设置标签 todo 待优化
*/
private fun setConfideTag(bodyBean: ConfideHomeBodyBean) {
flowlayout_tag.removeAllViews()
if (null == bodyBean.confidedTag || bodyBean.confidedTag.isEmpty()) {
return
}
var i = 0
for (tag in bodyBean.confidedTag!!) {
if (i > 4) break
var params = LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, dp16)
params.setMargins(0, 0, dp4, 0)
var textView = TextView(context)
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 10f)
textView.setTextColor(Color.parseColor("#808080"))
textView.gravity = Gravity.CENTER
textView.setPadding(dp3, 0, dp3, 0)
textView.setBackgroundResource(R.drawable.confidehome_bg_tag)
textView.layoutParams = params
textView.text = tag
flowlayout_tag.addView(textView)
i++
}
}
/**
* 设置向TA倾诉按钮状态
*/
private fun setConfideButton(bodyBean: ConfideHomeBodyBean) {
when (bodyBean.confideLine) {//1在线 2离线 3通话中 4继续倾诉
1 -> {
tv_confide.setBackgroundResource(R.drawable.confidehome_line_1)
}
2 -> {
tv_confide.setBackgroundResource(R.drawable.confidehome_line_2)
}
3 -> {
tv_confide.setBackgroundResource(R.drawable.confidehome_line_3)
}
4 -> {
tv_confide.setBackgroundResource(R.drawable.confidehome_line_4)
}
}
tv_confide.setOnClickListener {
click(bodyBean)
}
}
/**
* 设置红包、原价
*/
private fun setCoupon(bodyBean: ConfideHomeBodyBean) {
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 {
try {
val couponMoney = bodyBean.couponMoney.toFloat().toInt()
val confideFee = bodyBean.confideFee!!.toFloat().toInt()
tvOriginalPrice.visibility = View.VISIBLE
val originalBuffer = StringBuffer()
originalBuffer.append(bodyBean.confideFee).append("元/次")
tvOriginalPrice.text = originalBuffer.toString()
//添加删除线
tvOriginalPrice.paint.flags = Paint.STRIKE_THRU_TEXT_FLAG
if (couponMoney >= confideFee) {
tv_price.text = "0"
} else {
val price = confideFee - couponMoney
tv_price.text = price.toString()
}
} catch (e: Exception) {
//防止数据类型变化引起奔溃
}
}
}
/**
* 点击事件
*/
private fun click(bodyBean: ConfideHomeBodyBean) {
when (bodyBean.confideLine) {//1在线 2离线 3通话中
1, 3, 4 -> {
if (bodyBean.confideLine == 1) {
//埋点(这里的点击事件是执行的同一个方法,但是点击区域不同,所以分开统计)
UMEventUtils.umEvent("列表展示点击", "向他倾诉点击", "向他倾诉点击")
}
if (bodyBean.confideLine == 3) {
//埋点(这里的点击事件是执行的同一个方法,但是点击区域不同,所以分开统计)
UMEventUtils.umEvent("列表展示点击", "正在通话中点击", "正在通话中点击")
}
confideHomeEvent.consultantClick(bodyBean.linkUrl)
}
2 -> {
//跳转私聊 并发送自定义消息
confideHomeEvent.toChatForMsg("" + bodyBean.uid)
}
}
}
}
\ No newline at end of file
package com.ydl.confide.home.widget;
import android.annotation.SuppressLint;
import android.content.Context;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.WindowManager;
import android.widget.FrameLayout;
import android.widget.ImageView;
import com.yidianling.common.tools.RxImageTool;
import com.ydl.confide.R;
public class ConfidePlayerFloatView extends FrameLayout {
private float mTouchStartX;
private float mTouchStartY;
private float x;
private float y;
private ImageView playState;
private ImageView playClose;
private ImageView playHead;
private View dividerLine;
boolean mBoolean;
private int mTouchSlop;
private boolean isFmPlay;
private boolean isClick;
private boolean isMove;
private WindowManager wm;
private int dp3 = 0;
//此wmParams为获取的全局变量,用以保存悬浮窗口的属性
public WindowManager.LayoutParams wmParams = new WindowManager.LayoutParams();
public ConfidePlayerFloatView(Context context) {
super(context);
init(context);
}
@SuppressLint("ClickableViewAccessibility")
private void init(Context context) {
wm = (WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE);
dp3= RxImageTool.dip2px(3f);
mTouchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop() + 5;
View view = inflate(context, R.layout.confidehome_playing_float_btn, this);
playHead = view.findViewById(R.id.play_head);
playState = view.findViewById(R.id.play_state);
playClose = findViewById(R.id.play_close);
dividerLine = findViewById(R.id.hz_divider_line);
// GlideApp.with(context)
// .load(R.drawable.)
// .circleCrop()
// .into(playHead);
playHead.setOnTouchListener((v, event) -> {
x = event.getRawX();
y = event.getRawY() - 25;
Log.i("currP", "currX" + x + "====currY" + y);
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
//获取相对View的坐标,即以此View左上角为原点
mTouchStartX = event.getX();
mTouchStartY = event.getY();
break;
case MotionEvent.ACTION_MOVE:
Log.i("TAG", "currX" + event.getX() + "====currY" + event.getY());
if (Math.abs(event.getX() - mTouchStartX) > mTouchSlop ||
Math.abs((event.getY() - mTouchStartY)) > mTouchSlop) {
Log.i("TAG", "is move");
updateViewPosition();
isMove = true;
}
break;
case MotionEvent.ACTION_UP:
if (Math.abs(event.getX() - mTouchStartX) > mTouchSlop ||
Math.abs((event.getY() - mTouchStartY)) > mTouchSlop || isMove) {
Log.i("TAG", "is move");
updateViewPosition();
} else {
if (!isMove) {
// if (PhoneCallIn.INSTANCE.isFmPlaying()) {
// //FM播放页
// context.startActivity(PhoneCallIn.INSTANCE.fmDetailIntent((Activity) context, PhoneCallIn.INSTANCE.getFmId()));
// } else if (PhoneCallIn.INSTANCE.isCoursePlaying()) {
// //课程播放页
// PhoneCallIn.INSTANCE.startCoursePlayPage((Activity) context);
//
// }
}
Log.i("TAG", "is click");
}
isClick = false;
isMove = false;
mTouchStartX = mTouchStartY = 0;
break;
}
return true;
});
playClose.setOnTouchListener((v, event) -> {
x = event.getRawX();
y = event.getRawY() - 25;
Log.i("currP", "currX" + x + "====currY" + y);
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
//获取相对View的坐标,即以此View左上角为原点
mTouchStartX = event.getX();
mTouchStartY = event.getY();
break;
case MotionEvent.ACTION_MOVE:
Log.i("TAG", "currX" + event.getX() + "====currY" + event.getY());
if (Math.abs(event.getX() - mTouchStartX) > mTouchSlop ||
Math.abs((event.getY() - mTouchStartY)) > mTouchSlop) {
Log.i("TAG", "is move");
updateViewPosition();
isMove = true;
}
break;
case MotionEvent.ACTION_UP:
if (Math.abs(event.getX() - mTouchStartX) > mTouchSlop ||
Math.abs((event.getY() - mTouchStartY)) > mTouchSlop || isMove) {
Log.i("TAG", "is move");
updateViewPosition();
} else {
if (!isMove) {
ConfidePlayerFloatView.this.setVisibility(GONE);
}
Log.i("TAG", "is click");
}
isClick = false;
isMove = false;
mTouchStartX = mTouchStartY = 0;
break;
}
return true;
});
playState.setOnTouchListener((v, event) -> {
x = event.getRawX();
y = event.getRawY() - 25;
Log.i("currP", "currX" + x + "====currY" + y);
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
//获取相对View的坐标,即以此View左上角为原点
mTouchStartX = event.getX();
mTouchStartY = event.getY();
break;
case MotionEvent.ACTION_MOVE:
Log.i("TAG", "currX" + event.getX() + "====currY" + event.getY());
if (Math.abs(event.getX() - mTouchStartX) > mTouchSlop ||
Math.abs((event.getY() - mTouchStartY)) > mTouchSlop) {
Log.i("TAG", "is move");
updateViewPosition();
isMove = true;
}
break;
case MotionEvent.ACTION_UP:
if (Math.abs(event.getX() - mTouchStartX) > mTouchSlop ||
Math.abs((event.getY() - mTouchStartY)) > mTouchSlop || isMove) {
Log.i("TAG", "is move");
updateViewPosition();
} else {
if (!isMove) {
if (isFmPlay) {
playState.setImageResource(R.drawable.confidehome_play_stop);
playState.setPadding(dp3,dp3,dp3,dp3);
playClose.setVisibility(VISIBLE);
dividerLine.setVisibility(VISIBLE);
if (null != mPlayCallBack){
mPlayCallBack.click(false);
}
} else {
playState.setImageResource(R.drawable.confidehome_play_pause);
playState.setPadding(dp3,dp3,dp3,dp3);
playClose.setVisibility(GONE);
dividerLine.setVisibility(GONE);
if (null != mPlayCallBack){
mPlayCallBack.click(true);
}
}
}
Log.i("TAG", "is click");
}
isClick = false;
isMove = false;
mTouchStartX = mTouchStartY = 0;
break;
}
return true;
});
}
@Override
public boolean onTouchEvent(MotionEvent event) {
//获取相对屏幕的坐标,即以屏幕左上角为原点
x = event.getRawX();
y = event.getRawY() - 25;
Log.i("currP", "currX" + x + "====currY" + y);
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
//获取相对View的坐标,即以此View左上角为原点
mTouchStartX = event.getX();
mTouchStartY = event.getY();
break;
case MotionEvent.ACTION_MOVE:
updateViewPosition();
break;
case MotionEvent.ACTION_UP:
updateViewPosition();
mTouchStartX = mTouchStartY = 0;
break;
}
return true;
}
private void updateViewPosition() {
//更新浮动窗口位置参数
wmParams.x = (int) (x - mTouchStartX);
wmParams.y = (int) (y - mTouchStartY);
wm.updateViewLayout(this, wmParams);
}
public void updatePlayState(Boolean isPlaying) {
this.isFmPlay = isPlaying;
if (isPlaying) {
playState.setImageResource(R.drawable.confidehome_play_pause);
playState.setPadding(dp3,dp3,dp3,dp3);
playClose.setVisibility(GONE);
dividerLine.setVisibility(VISIBLE);
} else {
playState.setImageResource(R.drawable.confidehome_play_stop);
playState.setPadding(dp3,dp3,dp3,dp3);
playClose.setVisibility(VISIBLE);
}
}
private PlayCallBack mPlayCallBack;
public void setPlayCallBack(PlayCallBack mPlayCallBack){
this.mPlayCallBack = mPlayCallBack;
}
public interface PlayCallBack{
//通知界面是暂停 还是播放 以此来刷新 updatePlayState方法的播放状态
//MyPlayer类中的 isPlaying状态不好用 所以用这种方式更新
void click(boolean isPlay);
}
}
\ No newline at end of file
package com.ydl.confide.home.widget.adapter
import android.content.Context
import android.support.v4.view.PagerAdapter
import android.view.View
import android.view.ViewGroup
/**
* @author yuanwai
* @描述:倾诉首页--最佳倾听榜单适配器
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/9/21
*/
class RecommendExpertAdapter(var mContext : Context,var dataList : List<View>) : PagerAdapter(){
private var datas : List<View>? = null
init {
init()
(datas as ArrayList).addAll(dataList)
}
private fun init(){
if (null == datas){
datas = ArrayList()
}else{
(datas as ArrayList).clear()
}
}
fun updataItems(dataList: List<View>){
init()
(this.datas as ArrayList).addAll(dataList)
notifyDataSetChanged()
}
override fun isViewFromObject(view: View?, `object`: Any?): Boolean {
return view == `object`
}
override fun getCount(): Int {
return datas!!.size
}
override fun instantiateItem(container: ViewGroup?, position: Int): Any {
var view =datas!![position]
container!!.addView(view)
return view
}
override fun destroyItem(container: ViewGroup?, position: Int, `object`: Any?) {
container!!.removeView(datas!![position])
}
}
\ No newline at end of file
package com.ydl.confide.router
import android.app.Activity
import android.content.Context
import android.content.Intent
import com.ydl.confide.api.IPhoneCallRouter
import com.ydl.confide.home.ConfideHomeActivity
class PhoneCallImp : IPhoneCallRouter {
override fun openConfideHome(context: Context) {
val intent = Intent(context, ConfideHomeActivity::class.java)
if (context !is Activity){
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
}
context.startActivity(intent)
}
override fun closePlayer() {
// if (MyPlayer.isStart()) {
// MyPlayer.getInstance().releaseMedia()
// }
}
}
\ No newline at end of file
package com.ydl.confide.router
import android.app.Activity
import android.content.Intent
import android.support.v7.app.AppCompatActivity
/**
* author : Zhangwenchao
* e-mail : zhangwch@yidianling.com
* time : 2018/04/25
*/
object PhoneCallIn {
fun isLogin(): Boolean {
return RouterManager.getUserRouter()?.isLogin()?:false
}
fun getUserInfo(): UserResponse.UserInfo? = RouterManager.getUserRouter()?.getUserInfo()
fun rechargeIntent(activity: Activity): Intent? {
return RouterManager.getAppRouter()?.rechargeIntent(activity)
}
fun inputPhoneIntent(activity: Activity, smsAction: String): Intent? {
return RouterManager.getUserRouter()?.inputPhoneIntent(activity, smsAction)
}
fun loginWayIntent(activity: Activity): Intent? {
return RouterManager.getUserRouter()?.loginWayIntent(activity)
}
fun publishTrendIntent(activity: Activity, url: String, cover: String, title: String): Intent? {
return RouterManager.getDynamicRouter()?.publishTrendIntent(activity, url, cover, title)
}
fun myRedPacketIntent(activity: Activity): Intent? {
return RouterManager.getAppRouter()?.myRedPockIntent(activity)
}
fun fmDetailIntent(activity: Activity, fmId: Int): Intent? {
return RouterManager.getFMRouter()?.fmDetailIntent(activity, fmId)
}
fun isFmPlaying(): Boolean {
return RouterManager.getFMRouter()?.isPlaying() ?: false
}
fun isCoursePlaying(): Boolean {
return RouterManager.getCourseRouter()?.isPlaying() ?: false
}
fun getFmId(): Int {
return RouterManager.getFMRouter()?.getFmId() ?: 0
}
/**
* 课程播放页
*/
fun startCoursePlayPage(activity: Activity){
RouterManager.getCourseRouter()?.startCoursePlayPage(activity,1)
}
fun playCourse(){
if (!isCoursePlaying()){
RouterManager.getCourseRouter()?.play()
}
}
fun pauseCourse(){
if (isCoursePlaying()){
RouterManager.getCourseRouter()?.pause()
}
}
fun rePlayFM(){
RouterManager.getFMRouter()?.replay()
}
fun pauseFm(){
RouterManager.getFMRouter()?.pause()
}
/**
* 私聊
*/
fun startChat(context: AppCompatActivity, toUid: String, flag: Int, canTalk: Int) {
RouterManager.getImRouter().startChat(context,toUid,flag,canTalk)
}
}
\ No newline at end of file
package com.ydl.confide.api
import android.content.Context
interface IPhoneCallRouter{
fun closePlayer()
//倾诉首页
fun openConfideHome(context: Context)
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:fromYDelta="0"
android:toYDelta="100%p"
android:duration="300"
/>
</set>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:endColor="#00ffffff"
android:startColor="@color/white" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="180"
android:endColor="#00ffffff"
android:startColor="@color/white" />
</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="oval"
android:useLevel="false">
<solid android:color="@color/white" />
<stroke
android:width="1dp"
android:color="@color/white" />
<size
android:width="20dp"
android:height="20dp" />
</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="@dimen/default_dis_size_big" />
<stroke
android:width="1dp"
android:color="#D6D6D6" />
<solid android:color="@color/transparent" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<!-- 背景色 -->
<solid android:color="@color/white"/>
<!-- 边框色 -->
<stroke android:width="1dip" android:color="@color/default_button_bg" />
//圆角
<corners android:radius="4dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<!-- 背景色 -->
<solid android:color="#D9D9D9"/>
<!-- 边框色 -->
<stroke android:width="1dip" android:color="#D9D9D9" />
//圆角
<corners android:radius="4dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true" android:color="@color/google_green"/>
<item android:state_checked="false" android:color="@color/text_gray"/>
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools">
<RelativeLayout
android:id="@+id/rl_head"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="30dp">
<com.yidianling.phonecall.WaveView
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_centerInParent="true"
android:background="@color/transparent" />
<ImageView
android:id="@+id/sdv_head"
android:layout_width="@dimen/head_size_big"
android:layout_height="@dimen/head_size_big"
android:layout_centerHorizontal="true"
android:layout_centerInParent="true"
android:contentDescription="@null" />
</RelativeLayout>
<LinearLayout
android:id="@+id/lin_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:gravity="center_horizontal"
android:layout_below="@+id/rl_head"
android:layout_marginTop="50dp"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:layout_height="@dimen/divide_line_stroke_width"
android:layout_marginBottom="@dimen/default_dis_size_huge"
android:background="#22222B24" />
<TextView
android:id="@+id/tv_phone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/default_dis_size_huge"
android:text="请注意接听,通常为0571开头号码"
android:textColor="@color/white" />
<TextView
android:id="@+id/tv_hint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/default_dis_size_huge"
android:text="如倒计时结束后仍然未接到来电,请挂断后重新连接"
android:textColor="@color/white" />
<ImageView
android:layout_width="match_parent"
android:layout_height="@dimen/divide_line_stroke_width"
android:layout_marginBottom="@dimen/default_dis_size_huge"
android:background="#22222B24" />
</LinearLayout>
<LinearLayout
android:id="@+id/lin_djs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_below="@+id/lin_text"
android:layout_above="@+id/iv_stop"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/white"
android:text="倒计时:"/>
<TextView
android:id="@+id/text_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="1"
android:gravity="center"
android:layout_above="@+id/lin_text"
android:textColor="@color/red"
tools:text="30"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/white"
android:text=" 秒"/>
</LinearLayout>
<ImageView
android:id="@+id/iv_stop"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="30dp"
android:src="@drawable/state_stop"
android:visibility="invisible"/>
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<rotate
android:duration="5000"
android:fromDegrees="0"
android:pivotX="50%"
android:pivotY="50%"
android:repeatCount="-1"
android:repeatMode="restart"
android:toDegrees="360" />
</set>
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/baby_blue" android:state_selected="true" android:state_enabled="true"/>
<item android:color="@color/_6" android:state_enabled="true"/>
</selector>
\ 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">
<corners
android:radius="4dp"/>
<solid android:color="#eaffffff"/>
<stroke android:width="0.5dp"
android:color="#cccccc"/>
</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="#90666666" />
</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="@dimen/dp_3"/>
<stroke android:color="#ff5b05" android:width="1px"/>
</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="#90FF8F38"/>
</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="#901da1f2" />
</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="20dp"></corners>
<solid android:color="@color/white" />
<stroke android:width="0.5dp" android:color="#BEBEBE"/>
</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"
android:useLevel="false">
<solid android:color="#1DA1F2"/>
<corners android:radius="10dp"/>
</shape>
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval"
android:useLevel="false">
<solid android:color="#FFF6F6F6"/>
<size
android:width="20dp"
android:height="20dp"/>
</shape>
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="5dp"/>
<solid android:color="#f6f6f6" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:startColor="#56CCF2"
android:endColor="#2F80ED"
android:angle="0" />
</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="20dp" />
<!--<stroke-->
<!--android:width="1dp"-->
<!--android:color="@color/main_theme_blue" />-->
<gradient
android:startColor="#1DA1F2"
android:endColor="#42C1FF"
android:angle="0"/>
</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="20dp" />
<stroke
android:width="1px"
android:color="@color/main_theme_blue" />
<!--<solid android:color="@color/white"/>-->
</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="4dp" />
<stroke android:width="1px" android:color="#E0E0E0"/>
</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="4dp" />
<solid android:color="#1A1DA1F2" />
<stroke android:width="1px" android:color="#1DA1F2"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="100dp"/>
<solid android:color="#1da1f2" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="270"
android:startColor="#FFFFFF" android:endColor="#F5F5F5"/>
</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="100dp"/>
<stroke android:color="@color/white"
android:width="0.5dp"/>
</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="3dp"/>
<solid android:color="#1DA1F2" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<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"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:startColor="#FFDB26"
android:endColor="#FFD814"/>
<corners android:radius="15dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/rl_root"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white">
<com.yidianling.ydlcommon.view.banner.Banner
android:id="@+id/confide_home_banner"
android:layout_width="match_parent"
android:layout_height="145dp"
android:layout_marginBottom="30dp"
app:indicator_different_width="14dp"
app:indicator_drawable_selected="@drawable/confidehome_bg_sound_selected"
app:indicator_drawable_unselected="@drawable/confidehome_bg_sound_unselect"
app:indicator_height="5dp"
app:indicator_margin="3dp"
app:is_auto_play="false"
app:is_selected_same_unselected="false"
app:is_show_inside="false" />
<View
android:layout_width="match_parent"
android:layout_height="10dp"
android:layout_below="@+id/confide_home_banner"
android:background="@color/f0" />
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="118dp"
android:background="@drawable/confidehome_confidehome_bg" />
<FrameLayout
android:layout_width="match_parent"
android:layout_marginTop="@dimen/dp_10"
android:layout_height="160dp"
android:layout_marginBottom="20dp">
<com.yidianling.ydlcommon.view.banner.Banner
android:id="@+id/banner"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
app:indicator_different_width="14dp"
app:indicator_drawable_selected="@drawable/confidehome_bg_sound_selected"
app:indicator_drawable_unselected="@drawable/confidehome_bg_sound_unselect"
app:indicator_height="4dp"
app:is_selected_same_unselected="false"
app:is_show_inside="false" />
</FrameLayout>
</merge>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<merge android:layout_width="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<com.yidianling.phonecall.home.widget.ConfideHomeCategoryItemView
android:id="@+id/v_item1"
android:layout_width="0px"
android:layout_marginLeft="@dimen/dp_15"
android:layout_marginTop="@dimen/dp_19"
android:layout_marginBottom="@dimen/dp_18"
android:layout_height="match_parent"
android:layout_weight="1"
app:cardCornerRadius="6dp"
app:cardElevation="1dp" />
<com.yidianling.phonecall.home.widget.ConfideHomeCategoryItemView
android:id="@+id/v_item2"
android:layout_marginLeft="10dp"
android:layout_marginTop="@dimen/dp_19"
android:layout_marginBottom="@dimen/dp_18"
android:layout_marginRight="@dimen/dp_15"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="1"
app:cardCornerRadius="6dp"
app:cardElevation="1dp" />
</merge>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.Space
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="0px"/>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<TextView
android:id="@+id/tv_footer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginBottom="20dp"
android:drawablePadding="5dp"
android:layout_centerInParent="true"
android:text="更多情感恋爱专家"
android:drawableRight="@drawable/common_more"
android:textColor="#666666"
android:textSize="15dp"/>
</merge>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/tvGoodName"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_marginTop="8dp"
android:gravity="center"
android:textColor="@color/confidehome_color_filter_selector"
android:orientation="vertical"
android:background="@drawable/confidehome_filter_select_nor"
android:textSize="@dimen/dp_13"
tools:text="恋爱婚姻" />
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical">
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:background="@color/confidehome_filters_line"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:orientation="vertical">
<TextView
android:id="@+id/tv_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="@dimen/dp_13"
android:textColor="@color/_6"
android:layout_marginLeft="24dp"
android:layout_marginTop="25dp"
android:layout_marginBottom="8dp"
tools:text="擅长方向"/>
<android.support.v7.widget.RecyclerView
android:id="@+id/rvGood"
android:layout_width="match_parent"
android:layout_marginLeft="@dimen/dp_16"
android:layout_marginRight="@dimen/dp_16"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:orientation="horizontal">
<Button
android:id="@+id/btnReset"
android:layout_width="0px"
android:layout_height="37dp"
android:layout_weight="1"
android:layout_marginBottom="24dp"
android:layout_marginTop="8dp"
android:layout_marginLeft="15dp"
android:background="@drawable/confidehome_filter_reset_btn_bg"
android:text="@string/reset"
android:textColor="@color/main_theme_blue"
android:textSize="@dimen/dp_18" />
<Button
android:id="@+id/btnConfirm"
android:layout_width="0px"
android:layout_height="37dp"
android:layout_weight="1"
android:layout_marginLeft="13dp"
android:layout_marginRight="15dp"
android:layout_marginBottom="24dp"
android:layout_marginTop="8dp"
android:background="@drawable/confidehome_filter_btn_bg"
android:gravity="center"
android:text="@string/confirm"
android:textColor="@color/white"
android:textSize="@dimen/dp_18" />
</LinearLayout>
<View
android:id="@+id/v_zhezhao"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#80000000"/>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white">
<com.jcodecraeer.xrecyclerview.XRecyclerView
android:id="@+id/rv_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="48dp" />
<include layout="@layout/confidehome_title_bar" />
<LinearLayout
android:id="@+id/quick_consult_card"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:layout_marginBottom="30dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:background="@drawable/card_consult_bg"
android:orientation="horizontal"
android:paddingLeft="@dimen/dp_25"
android:paddingRight="@dimen/dp_25"
android:visibility="gone">
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:ellipsize="end"
android:gravity="center_vertical"
android:maxLines="1"
android:text="不知道选择哪位咨询师?试试"
android:textColor="@color/color_242424"
android:textSize="14dp" />
<TextView
android:id="@+id/quick_consult_btn"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:background="@drawable/consult_btn_bg"
android:gravity="center"
android:paddingLeft="@dimen/dp_20"
android:paddingRight="@dimen/dp_20"
android:text="一键倾诉"
android:textColor="@color/color_242424"
android:textSize="14dp"
android:textStyle="bold" />
</LinearLayout>
<View
android:id="@+id/v_zhezhao"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="96dp"
android:background="#80000000"
android:visibility="gone" />
<com.yidianling.phonecall.home.widget.ConfideHomeFilterView
android:id="@+id/v_filterView"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginTop="48dp"
android:background="@color/white"
android:visibility="gone" />
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
xmlns:tools="http://schemas.android.com/tools">
<ImageView
android:id="@+id/img_icon"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginTop="17dp"
android:layout_marginLeft="16dp"
tools:background="@drawable/confidehome_recent_btn_on_bg"/>
<TextView
android:id="@id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_17"
android:layout_marginLeft="59dp"
android:textSize="@dimen/dp_13"
android:textColor="@color/_6"
tools:text="倾诉指南"/>
<TextView
android:id="@+id/tv_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="59.5dp"
android:layout_marginTop="38dp"
android:textSize="@dimen/dp_10"
android:textColor="@color/_9"
tools:text="排忧疏导,隐私安全"/>
</FrameLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<merge
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<ImageView
android:id="@+id/iv_recently_talk"
android:layout_width="18dp"
android:layout_height="18dp"
android:layout_gravity="center_vertical"
tools:src="@drawable/confidehome_zuijin"
android:layout_marginLeft="15dp"/>
<TextView
android:id="@+id/iv_recently_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="5dp"
android:textSize="18sp"
android:layout_weight="1"
android:textColor="@color/color_666666"
tools:text="最近倾诉"/>
<TextView
android:id="@+id/iv_recently_more"
android:layout_width="41dp"
android:layout_height="19dp"
android:gravity="center"
android:layout_gravity="center"
android:textColor="#b3b3b3"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="3dp"
android:paddingBottom="3dp"
android:layout_marginRight="15dp"
android:textSize="10sp"
android:background="@drawable/confidehome_bg_radius_line_gray_20"
tools:text="更多"/>
</merge>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_15"
android:layout_marginRight="@dimen/dp_15"
android:layout_marginBottom="1dp"
android:layout_marginTop="1dp"
app:cardElevation="1dp"
app:cardCornerRadius="6dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!--背景图片-->
<ImageView
android:id="@+id/img_bg"
android:layout_width="116dp"
android:layout_height="116dp"
android:background="@drawable/confidehome_listen_bg" />
<!--播放图片-->
<ImageView
android:id="@+id/img_disc"
android:layout_width="94dp"
android:layout_height="94dp"
android:layout_marginLeft="@dimen/dp_11"
android:layout_marginTop="@dimen/dp_11"
android:background="@drawable/confidehome_listen_disc" />
<ImageView
android:id="@+id/img_play"
android:layout_width="38dp"
android:layout_height="38dp"
android:layout_marginLeft="39dp"
android:layout_marginTop="39dp"
android:background="@drawable/confidehome_listen_play"/>
<!--遮罩图片-->
<ImageView
android:id="@+id/img_mask"
android:layout_width="116dp"
android:layout_height="116dp"
android:background="@drawable/confidehome_listen_mask" />
<TextView
android:id="@+id/tv_isLine"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/confidehome_recommend_expert_line_bg"
android:paddingBottom="1dp"
android:paddingLeft="9dp"
android:paddingRight="9dp"
android:paddingTop="1dp"
android:textColor="@color/white"
android:textSize="@dimen/dp_10"
tools:text="在线" />
<TextView
android:id="@+id/tv_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="136dp"
android:layout_marginTop="16dp"
android:textColor="#555555"
android:textSize="@dimen/dp_15"
tools:text="姚雨晴" />
<ImageView
android:id="@+id/img_sex"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="6dp"
android:layout_marginTop="19dp"
android:layout_toRightOf="@+id/tv_name"
tools:background="@drawable/confidehome_new_male" />
<TextView
android:id="@+id/tv_confide"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentRight="true"
android:layout_marginRight="@dimen/dp_15"
android:layout_marginTop="16dp"
android:gravity="center"
tools:background="@drawable/confidehome_line_1" />
<TextView
android:id="@+id/tv_confideNum"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_name"
android:layout_marginLeft="136dp"
android:layout_marginTop="12dp"
android:textColor="@color/_6"
android:textSize="@dimen/dp_11"
tools:text="8000人" />
<TextView
android:id="@+id/tv_tv_confideNumContent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_name"
android:layout_marginRight="@dimen/dp_16"
android:layout_marginTop="12dp"
android:layout_toRightOf="@+id/tv_confideNum"
android:text="向TA倾诉"
android:textColor="@color/_9"
android:textSize="@dimen/dp_11" />
<TextView
android:id="@+id/tv_Connection"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_name"
android:layout_marginTop="@dimen/dp_12"
android:layout_toRightOf="@+id/tv_tv_confideNumContent"
android:textColor="@color/_6"
android:textSize="@dimen/dp_11"
tools:text="83%" />
<TextView
android:id="@+id/tv_ConnectionContent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_name"
android:layout_marginTop="@dimen/dp_12"
android:layout_toRightOf="@+id/tv_Connection"
android:text="接通率"
android:textColor="@color/_9"
android:textSize="@dimen/dp_11" />
<View
android:id="@+id/v_line"
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_below="@+id/tv_Connection"
android:layout_marginBottom="4dp"
android:layout_marginLeft="136dp"
android:layout_marginRight="@dimen/dp_10"
android:layout_marginTop="4dp"
android:background="@color/confidehome_line" />
<TextView
android:id="@+id/tv_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/v_line"
android:layout_marginLeft="136dp"
android:layout_marginRight="@dimen/dp_15"
android:ellipsize="end"
android:maxLines="2"
android:textColor="@color/_9"
android:textSize="@dimen/dp_11"
tools:text="没有人一出生就是完美的,只有不断的相信自...己…才能成就自己的梦想。" />
</RelativeLayout>
</android.support.v7.widget.CardView>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:cardElevation="0dp"
app:cardCornerRadius="18dp">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/play_head"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_marginBottom="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="8dp"
android:src="@drawable/confidehome_float_head"/>
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:background="@color/divide_color"/>
<ImageView
android:id="@+id/play_state"
android:layout_width="20dp"
android:layout_height="20dp"
android:padding="3dp"
android:layout_gravity="center"
android:layout_marginBottom="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="8dp"
android:src="@drawable/confidehome_play_pause"/>
<View
android:id="@+id/hz_divider_line"
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:background="@color/divide_color"
android:visibility="gone"/>
<ImageView
android:id="@+id/play_close"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_gravity="center"
android:layout_marginBottom="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="8dp"
android:src="@drawable/confidehome_play_close"
android:visibility="gone"/>
</LinearLayout>
</android.support.v7.widget.CardView>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:paddingTop="4dp"
android:paddingBottom="4dp"
android:paddingLeft="4dp"
android:paddingRight="13dp"
xmlns:tools="http://schemas.android.com/tools">
<android.support.v7.widget.CardView
android:id="@+id/cv_icon"
android:layout_width="42dp"
android:layout_height="42dp"
app:cardCornerRadius="21dp"
app:cardElevation="0px">
<ImageView
android:id="@+id/img_icon"
android:layout_width="42dp"
android:layout_height="42dp"
android:scaleType="centerCrop"/>
</android.support.v7.widget.CardView>
<TextView
android:id="@+id/tv_name"
android:layout_toRightOf="@id/cv_icon"
android:layout_marginTop="3dp"
android:layout_marginLeft="12dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15dp"
android:textColor="@color/color_black_333333"
tools:text="黄蓉"/>
<ImageView
android:id="@+id/img_sex"
android:layout_toRightOf="@+id/tv_name"
android:layout_marginTop="5dp"
android:layout_marginLeft="5dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:background="@drawable/confidehome_new_male"/>
<TextView
android:id="@+id/tv_history"
android:layout_toRightOf="@id/cv_icon"
android:layout_below="@+id/tv_name"
android:layout_marginLeft="12dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/dp_10"
android:textColor="@color/color_grey_999999"
tools:text="7月13日 你向TA倾诉过"/>
<TextView
android:id="@+id/tv_again"
android:layout_width="80dp"
android:layout_height="24dp"
android:textSize="12dp"
android:textColor="@color/white"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:gravity="center"
android:background="@drawable/confidehome_recent_btn_on_bg"
android:text="再倾诉一次"/>
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<View
android:layout_width="0px"
android:layout_height="1px"
android:layout_weight="1"/>
<View
android:layout_width="13dp"
android:layout_height="2dp"
android:layout_marginTop="46dp"
android:background="#E0E0E0"/>
<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="34dp"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp"
android:textSize="@dimen/dp_18"
android:textColor="#444444"
tools:text="最佳倾诉榜单"/>
<View
android:layout_width="13dp"
android:layout_height="2dp"
android:layout_marginTop="46dp"
android:background="#E0E0E0"/>
<View
android:layout_width="0px"
android:layout_height="1px"
android:layout_weight="1"/>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cardElevation="1dp"
app:cardCornerRadius="6dp"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginBottom="2dp">
<FrameLayout
android:id="@+id/ll_layout"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/img_bg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"/>
<TextView
android:id="@id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/dp_14"
android:textColor="@color/white"
android:layout_marginTop="@dimen/dp_12"
android:paddingTop="2dp"
android:paddingBottom="1dp"
android:paddingLeft="@dimen/dp_10"
android:paddingRight="@dimen/dp_10"
android:background="@drawable/confidehome_recommend_expert_title_bg"
tools:text="情感恋爱"/>
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_12"
android:layout_marginRight="@dimen/dp_12"
android:layout_marginTop="48dp"
android:layout_marginBottom="@dimen/dp_16"
app:cardBackgroundColor="@color/white"
app:cardCornerRadius="6dp"
app:cardElevation="1dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/tv_isLine"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="9dp"
android:paddingRight="9dp"
android:paddingTop="1dp"
android:paddingBottom="1dp"
android:textSize="@dimen/dp_10"
android:textColor="@color/white"
android:background="@drawable/confidehome_recommend_expert_line_bg"
tools:text="在线"/>
<android.support.v7.widget.CardView
android:id="@+id/cv_head"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginLeft="@dimen/dp_12"
android:layout_marginTop="@dimen/dp_20"
android:layout_marginBottom="@dimen/dp_20"
app:cardCornerRadius="50dp"
app:cardElevation="0px">
<ImageView
android:id="@+id/img_head"
android:layout_width="100dp"
android:layout_height="100dp"
android:scaleType="fitXY" />
</android.support.v7.widget.CardView>
<ImageView
android:id="@+id/img_play"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginTop="91dp"
android:layout_marginLeft="84dp"
tools:background="@drawable/confidehome_paused"/>
<TextView
android:id="@+id/tv_name"
android:layout_toRightOf="@+id/cv_head"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_22"
android:layout_marginLeft="14dp"
android:textSize="@dimen/dp_15"
android:textColor="#555555"
tools:text="姚雨晴"/>
<ImageView
android:id="@+id/img_sex"
android:layout_toRightOf="@+id/tv_name"
android:layout_marginTop="25dp"
android:layout_marginLeft="6dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:background="@drawable/confidehome_new_male"/>
<TextView
android:id="@+id/tv_confideNum"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/dp_11"
android:textColor="@color/_6"
android:layout_toRightOf="@+id/cv_head"
android:layout_below="@+id/tv_name"
android:layout_marginLeft="14dp"
android:layout_marginTop="10dp"
tools:text="8000人"/>
<TextView
android:id="@+id/tv_tv_confideNumContent"
android:layout_below="@+id/tv_name"
android:layout_toRightOf="@+id/tv_confideNum"
android:layout_marginTop="10dp"
android:layout_marginRight="@dimen/dp_16"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/dp_11"
android:textColor="@color/_9"
android:text="向TA倾诉"/>
<TextView
android:id="@+id/tv_Connection"
android:layout_below="@+id/tv_name"
android:layout_toRightOf="@+id/tv_tv_confideNumContent"
android:layout_marginTop="@dimen/dp_10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/dp_11"
android:textColor="@color/_6"
tools:text="83%"/>
<TextView
android:id="@+id/tv_ConnectionContent"
android:layout_below="@+id/tv_name"
android:layout_toRightOf="@+id/tv_Connection"
android:layout_marginTop="@dimen/dp_10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/dp_11"
android:textColor="@color/_9"
android:text="接通率"/>
<LinearLayout
android:id="@+id/flowlayout_tag"
android:orientation="horizontal"
android:layout_below="@+id/tv_confideNum"
android:layout_toRightOf="@+id/cv_head"
android:layout_width="wrap_content"
android:layout_height="16dp"
android:layout_marginBottom="8dp"
android:layout_marginLeft="@dimen/dp_12"
android:layout_marginRight="@dimen/dp_10"
android:layout_marginTop="4dp" />
<View
android:id="@+id/v_line"
android:layout_below="@+id/flowlayout_tag"
android:layout_toRightOf="@+id/cv_head"
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_marginLeft="@dimen/dp_14"
android:layout_marginRight="@dimen/dp_10"
android:layout_marginBottom="4dp"
android:background="@color/confidehome_line"/>
<TextView
android:id="@+id/tv_content"
android:layout_below="@+id/v_line"
android:layout_toRightOf="@+id/cv_head"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_14"
android:layout_marginRight="@dimen/dp_10"
android:textSize="@dimen/dp_11"
android:textColor="@color/_9"
android:lines="1"
android:ellipsize="end"
tools:text="没有人一出生就是完美的,只有不断的相信自...己…才能成就自己的梦想。"/>
</RelativeLayout>
</android.support.v7.widget.CardView>
<TextView
android:id="@+id/tv_confide"
android:layout_width="128dp"
android:layout_height="28dp"
android:layout_marginTop="204dp"
android:layout_marginBottom="@dimen/dp_18"
android:layout_gravity="center_horizontal"
android:textSize="@dimen/dp_12"
android:textColor="@color/white"
android:gravity="center"
android:background="@drawable/confidehome_recommend_expert_btn_bg"
android:text="向TA倾诉"/>
</FrameLayout>
</android.support.v7.widget.CardView>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipChildren="false"
android:paddingTop="14dp"
android:paddingBottom="35dp"
android:paddingLeft="5dp"
android:background="@drawable/confidehome_recommend_expert_bg">
<android.support.v4.view.ViewPager
android:id="@+id/viewPager"
android:layout_width="match_parent"
android:layout_height="250dp"
android:clipChildren="false"
android:layout_marginRight="15dp"/>
</FrameLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto">
<!--头像+在线状态-->
<android.support.v7.widget.CardView
android:id="@+id/cv_head"
android:layout_width="96dp"
android:layout_height="96dp"
android:layout_marginStart="@dimen/dp_15"
android:layout_marginTop="24.5dp"
android:layout_marginBottom="24dp"
app:cardElevation="1dp"
app:cardCornerRadius="6dp">
<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_isLine"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="9dp"
android:paddingRight="9dp"
android:paddingTop="1dp"
android:paddingBottom="1dp"
android:textSize="@dimen/dp_10"
android:textColor="@color/white"
android:background="@drawable/confidehome_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"
tools:background="@drawable/confidehome_paused"/>
</FrameLayout>
</android.support.v7.widget.CardView>
<TextView
android:id="@+id/tv_name"
android:layout_toEndOf="@+id/cv_head"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="24.5dp"
android:layout_marginStart="14dp"
android:textSize="@dimen/dp_15"
android:textColor="#555555"
tools:text="姚雨晴"
tools:ignore="SpUsage" />
<ImageView
android:id="@+id/img_sex"
android:layout_toEndOf="@+id/tv_name"
android:layout_marginTop="29dp"
android:layout_marginStart="6dp"
android:layout_width="13dp"
android:layout_height="13dp"
tools:background="@drawable/confidehome_new_male"/>
<TextView
android:id="@+id/tv_confide"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignParentEnd="true"
android:layout_marginTop="24.5dp"
android:layout_marginEnd="@dimen/dp_15"
android:gravity="center"
tools:background="@drawable/confidehome_line_1"/>
<TextView
android:id="@+id/tv_confideNum"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/dp_11"
android:textColor="@color/_6"
android:layout_toEndOf="@+id/cv_head"
android:layout_below="@+id/tv_name"
android:layout_marginStart="@dimen/dp_12"
android:layout_marginTop="12dp"
tools:text="8000人"
tools:ignore="SpUsage" />
<TextView
android:id="@+id/tv_tv_confideNumContent"
android:layout_below="@+id/tv_name"
android:layout_toEndOf="@+id/tv_confideNum"
android:layout_marginTop="12dp"
android:layout_marginEnd="@dimen/dp_16"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/dp_11"
android:textColor="@color/_9"
android:text="向TA倾诉"
tools:ignore="SpUsage" />
<TextView
android:id="@+id/tv_Connection"
android:layout_below="@+id/tv_name"
android:layout_toEndOf="@+id/tv_tv_confideNumContent"
android:layout_marginTop="@dimen/dp_12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/dp_11"
android:textColor="@color/_6"
tools:text="83%"
tools:ignore="SpUsage" />
<TextView
android:id="@+id/tv_ConnectionContent"
android:layout_below="@+id/tv_name"
android:layout_toEndOf="@+id/tv_Connection"
android:layout_marginTop="@dimen/dp_12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/dp_12"
android:textSize="@dimen/dp_11"
android:textColor="@color/_9"
android:text="接通率"
tools:ignore="SpUsage" />
<LinearLayout
android:id="@+id/flowlayout_tag"
android:orientation="horizontal"
android:layout_below="@+id/tv_Connection"
android:layout_toEndOf="@+id/cv_head"
android:layout_width="wrap_content"
android:layout_height="16dp"
android:layout_marginBottom="8dp"
android:layout_marginStart="@dimen/dp_12"
android:layout_marginEnd="@dimen/dp_10"
android:layout_marginTop="4dp" />
<View
android:id="@+id/v_line"
android:layout_below="@+id/flowlayout_tag"
android:layout_toEndOf="@+id/cv_head"
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_marginStart="@dimen/dp_12"
android:layout_marginEnd="@dimen/dp_15"
android:layout_marginBottom="4dp"
android:background="@color/confidehome_line"/>
<TextView
android:id="@+id/tv_content"
android:layout_below="@+id/v_line"
android:layout_toEndOf="@+id/cv_head"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_12"
android:layout_marginEnd="@dimen/dp_15"
android:textSize="@dimen/dp_11"
android:textColor="@color/_9"
android:lines="1"
android:ellipsize="end"
tools:text="没有人一出生就是完美的,只有不断的相信自...己…才能成就自己的梦想。"
tools:ignore="SpUsage" />
<TextView
android:id="@+id/tv_price"
android:layout_below="@+id/tv_content"
android:layout_toEndOf="@+id/cv_head"
android:layout_marginStart="@dimen/dp_12"
android:layout_marginTop="6dp"
android:layout_marginBottom="20dp"
android:textSize="@dimen/dp_18"
android:textColor="#FF5B05"
android:gravity="bottom"
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="199"
tools:ignore="SpUsage" />
<TextView
android:id="@+id/tv_priceContent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_13"
android:layout_below="@+id/tv_content"
android:layout_toEndOf="@+id/tv_price"
android:textSize="@dimen/dp_11"
android:textColor="#FF5B05"
android:text="元/次"
tools:ignore="SpUsage" />
<TextView
android:id="@+id/tvOriginalPrice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_content"
android:layout_toEndOf="@+id/tv_priceContent"
android:layout_marginTop="@dimen/dp_14"
android:layout_marginStart="@dimen/dp_5"
android:textColor="#a2a2a2"
android:textSize="@dimen/dp_10"
tools:ignore="SpUsage"
tools:text="50元/次"/>
<TextView
android:id="@+id/tvCoupon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_content"
android:layout_alignParentEnd="true"
android:layout_marginEnd="@dimen/dp_15"
android:layout_marginTop="@dimen/dp_12"
android:background="@drawable/confidehome_bg_color_ff5b05"
android:textSize="@dimen/dp_10"
android:textColor="#ff5b05"
android:paddingStart="@dimen/dp_4"
android:paddingEnd="@dimen/dp_4"
android:paddingTop="@dimen/dp_2"
android:paddingBottom="@dimen/dp_2"
tools:text="立减¥30"
tools:ignore="SpUsage" />
<View
android:layout_below="@+id/tv_price"
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_marginLeft="@dimen/dp_15"
android:layout_marginRight="@dimen/dp_15"
android:background="@color/confidehome_line"/>
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:background="@color/confidehome_filters_line" />
<!--之所以要加一层 是因为 要设置白色 背景 但是 TextView改为padding 不好用 比较急 先这样吧-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:orientation="vertical">
<TextView
android:id="@+id/tv_sexTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginLeft="24dp"
android:layout_marginTop="25dp"
android:textColor="@color/_6"
android:textSize="@dimen/dp_13"
tools:text="性别筛选" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:orientation="horizontal">
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/tvSex1"
android:layout_width="0px"
android:layout_height="30dp"
android:layout_marginLeft="24dp"
android:layout_marginTop="8dp"
android:layout_weight="1"
android:background="@drawable/confidehome_filter_select_nor"
android:gravity="center"
android:orientation="vertical"
android:textColor="@color/confidehome_color_filter_selector"
android:textSize="@dimen/dp_13"
tools:text="只选男生" />
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/tvSex2"
android:layout_width="0px"
android:layout_height="30dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="8dp"
android:layout_weight="1"
android:background="@drawable/confidehome_filter_select_nor"
android:gravity="center"
android:orientation="vertical"
android:textColor="@color/confidehome_color_filter_selector"
android:textSize="@dimen/dp_13"
tools:text="只选女生" />
<TextView
android:layout_width="0px"
android:layout_height="30dp"
android:layout_marginRight="24dp"
android:layout_weight="1"
tools:text="站位用 只为了效果 啦啦啦" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:orientation="vertical">
<TextView
android:id="@+id/tv_ageTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginLeft="24dp"
android:layout_marginTop="25dp"
android:textColor="@color/_6"
android:textSize="@dimen/dp_13"
tools:text="年龄筛选" />
<android.support.v7.widget.RecyclerView
android:id="@+id/rvAge"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:orientation="horizontal">
<Button
android:id="@+id/btnReset"
android:layout_width="0px"
android:layout_height="37dp"
android:layout_marginBottom="24dp"
android:layout_marginLeft="15dp"
android:layout_marginTop="8dp"
android:layout_weight="1"
android:background="@drawable/confidehome_filter_reset_btn_bg"
android:text="@string/reset"
android:textColor="@color/main_theme_blue"
android:textSize="@dimen/dp_18" />
<Button
android:id="@+id/btnConfirm"
android:layout_width="0px"
android:layout_height="37dp"
android:layout_marginBottom="24dp"
android:layout_marginLeft="13dp"
android:layout_marginRight="15dp"
android:layout_marginTop="8dp"
android:layout_weight="1"
android:background="@drawable/confidehome_filter_btn_bg"
android:text="@string/confirm"
android:textColor="@color/white"
android:textSize="@dimen/dp_18" />
</LinearLayout>
<View
android:id="@+id/v_zhezhao"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#80000000" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground"
android:orientation="vertical">
<TextView
android:id="@+id/tvSort"
android:layout_width="match_parent"
android:layout_height="50dp"
android:gravity="center_vertical"
android:layout_marginLeft="24dp"
android:layout_marginRight="24dp"
tools:text="智能排序" />
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_marginLeft="24dp"
android:layout_marginRight="24dp"
android:background="@color/confidehome_line"/>
</LinearLayout>
<?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">
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:background="@color/confidehome_filters_line"/>
<android.support.v7.widget.RecyclerView
android:id="@+id/rvSortItem"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white" />
<View
android:id="@+id/v_zhezhao"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#80000000"/>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="48dp">
<View
android:id="@+id/v_bg"
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="@drawable/common_bg"/>
<LinearLayout
android:id="@+id/ll_bar_root"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="48dp">
<ImageView
android:id="@+id/img_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:background="@drawable/common_back"/>
<TextView
android:id="@+id/tv_title"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:textSize="17dp"
android:textColor="#FFFFFF"
android:text="@string/confidehome_title"/>
<ImageView
android:id="@+id/img_mine"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:background="@drawable/common_mine"/>
</LinearLayout>
</FrameLayout>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="confidehome_line">#F0F0F0</color>
<color name="confidehome_filters_line">#E0E0E0</color>
<color name="confidehome_category_bg">#FAFAFA</color>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!--为你推荐 图片tag-->
<item name="confidehome_recommendTag" type="id"/>
<!--最近倾诉 图片tag-->
<item name="confidehome_consultTag" type="id"/>
<!--咨询师模块 图片tag1-->
<item name="confidehome_recommendexpertTag1" type="id"/>
<!--咨询师模块 图片tag2-->
<item name="confidehome_recommendexpertTag2" type="id"/>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="confidehome_title">即时倾诉</string>
</resources>
\ No newline at end of file
<resources>
<string name="app_name">PhoneCall</string>
</resources>
package com.ydl.confide
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}
//package com.yidianling.consultant.model.bean
//
//import com.google.gson.annotations.SerializedName
//import com.yidianling.ydlcommon.data.ShareData
//import com.ydl.ydlcommon.data.ShareData
//
//data class DoctorItem(
// /**
......
include ':app', ':ydl-net', ':ydl-utils', ':ydl-platform', ':ydl-webview',":m-user", ':m-consultant',":router"
include ':app', ':ydl-net', ':ydl-utils', ':ydl-platform', ':ydl-webview', ':m-confide', ':m-audioim',":m-user", ':m-consultant',":router"
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.Space
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="0px"/>
\ No newline at end of file
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