Commit 2c856e50 by 范玉宾

Merge branch 'release' of…

Merge branch 'release' of http://gitlab.yidianling.com/app_android_lib/YDL-Component into dev/lancet/4.3.93_muse

* 'release' of http://gitlab.yidianling.com/app_android_lib/YDL-Component: (98 commits)
  feat: data class 修改
  feat: 去掉倾字
  feat: video点击处理
  feat: 文案
  feat: 支付按钮隐藏
  feat: 优化了喊他xxx文案,产品优化的好啊
  feat: 权限弹窗文案修改、视频播放按钮位置更改
  feat: 语音权限弹窗
  feat: 音频动画修改
  feat: 拨打点击修改
  fix:修复BUG
  feat: 版本打包
  fix bug 通话界面弹框提醒
  feat: 首页营销埋点事件
  feat: 评价跳转url修改
  feat: 播放卡顿处理
  feat: 支付弹窗展示逻辑优化
  feat: 1.UI还原 2.拨打加入绑定手机号逻辑 3. 支付弹窗样式修改
  feat: 一键登录、拨打页优化
  fix bug mr改动
  ...

# Conflicts:
#	app/src/main/java/com/ydl/component/service/web/WVClickAbstractListener.java
#	app/src/main/java/com/ydl/component/service/web/WebJavascriptHandler.kt
#	app/src/main/java/com/ydl/component/service/web/WebViewClientClickListener.java
#	config.gradle
#	m-home/src/main/java/com/yidianling/home/constants/HomeBIConstants.kt
#	m-home/src/ydl/java/com/yidianling/home/ui/fragment/YdlHomeFragment.kt
parents 084a60cb 16bfe177
......@@ -170,6 +170,9 @@ android {
packagingOptions {
exclude 'META-INF/proguard/coroutines.pro'
}
dataBinding {
enabled true
}
}
......@@ -248,5 +251,6 @@ dependencies {
implementation rootProject.ext.dependencies["retrofit-url-manager"]
kapt 'com.alibaba:arouter-compiler:1.2.2'
implementation 'androidx.fragment:fragment:1.2.4@aar'
implementation "androidx.fragment:fragment:1.2.4"
implementation 'tv.danmaku.ijk.media:ijkplayer-java:0.8.8'
}
/*___Generated_by_IDEA___*/
package com.ydl.component;
/* This stub is only used by the IDE. It is NOT the BuildConfig class actually packed into the APK */
public final class BuildConfig {
public final static boolean DEBUG = Boolean.parseBoolean(null);
}
\ No newline at end of file
/*___Generated_by_IDEA___*/
package com.ydl.component;
/* This stub is only used by the IDE. It is NOT the Manifest class actually packed into the APK */
public final class Manifest {
}
\ No newline at end of file
/*___Generated_by_IDEA___*/
package com.ydl.component;
/* This stub is only used by the IDE. It is NOT the R class actually packed into the APK */
public final class R {
}
\ No newline at end of file
package com.ydl.component.service.web
import com.google.gson.JsonObject
import com.google.gson.JsonParser
import com.ydl.confide.home.event.ConfideDialogEvent
import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity
import com.ydl.ydlcommon.base.BaseActivityMgr
import com.ydl.ydlcommon.ui.Loading
import com.yidianling.common.tools.ToastUtil
import de.greenrobot.event.EventBus
class JsMethod {
fun handle(param: String): Boolean {
try {
val obj = JsonParser().parse(param).asJsonObject
val cmd = obj.getAsJsonObject("cmd")
val actionName = cmd?.getAsJsonPrimitive("action_name")?.asString
if (actionName.isNullOrBlank()) return false
return innerHandle(actionName, cmd)
} catch (throwable: Throwable) {
throwable.printStackTrace()
return false
}
}
private fun innerHandle(actionName: String, obj: JsonObject): Boolean {
val param = obj.getAsJsonObject("params")
when (actionName) {
"handle_confide_btn" -> {
val show = param.getAsJsonPrimitive("show").asInt
EventBus.getDefault().post(ConfideDialogEvent(show))
return true
}
"show_loading" -> {
val topActivity = BaseActivityMgr.INST.getTopActivity()
Loading.show(topActivity)
return true
}
"close_loading" -> {
Loading.close()
return true
}
"open_app_eval_list"->{
val url = param.getAsJsonPrimitive("url").asString
val topActivity = BaseActivityMgr.INST.getTopActivity()
NewH5Activity.start(topActivity, H5Params(url, ""))
return true
}
"toast" -> {
val msg = param.getAsJsonPrimitive("msg").asString
if (!msg.isNullOrBlank()) {
ToastUtil.toastShort(msg)
}
return true
}
else -> {
return false
}
}
}
}
\ No newline at end of file
......@@ -5,6 +5,7 @@ import android.app.Activity;
import com.alibaba.android.arouter.launcher.ARouter;
import com.ydl.confide.api.IConfideService;
import com.ydl.confide.home.event.ChangeAnotherExpertEvent;
import com.ydl.webview.H5JsBean;
import com.ydl.webview.H5Params;
import com.ydl.webview.NewH5Activity;
......@@ -17,6 +18,8 @@ import com.yidianling.muse.activity.ChooseMusicActivity;
//import static com.ydl.ydlcommon.router.IYDLRouterConstant.ROUTER_MUSE_PLAY;
import de.greenrobot.event.EventBus;
/**
* webview 点击事件监听 抽象类
* Created by harvie on 2017/7/4 0004.
......@@ -458,6 +461,12 @@ public class WVClickAbstractListener implements WebViewClientClickListener {
@Override
public void playMeditation(int mediaId, long meditationId, int meditationType, String mediaCoverUrl) {
public void getNextExpertStatus(String doctorID, String title,String uid) {
EventBus.getDefault().post(new ChangeAnotherExpertEvent(doctorID,title,uid));
}
if (mContext instanceof NewH5Activity) {
// YDLRouterManager.Companion.router(ROUTER_MUSE_PLAY,
// new YDLRouterParams().putExtra("MEDITATION_ID", String.valueOf(meditationId))
......
package com.ydl.component.service.web
import android.webkit.JavascriptInterface
import androidx.fragment.app.FragmentActivity
import com.google.gson.Gson
import com.ydl.confide.api.ConfideRoute
import com.ydl.confide.api.IConfideService
import com.ydl.js_module.manager.WebViewRouterManager
import com.ydl.webview.H5JsBean
import com.ydl.webview.IJavascriptHandler
import com.ydl.ydl_router.manager.YDLRouterManager
import com.ydl.ydlcommon.base.BaseActivityMgr
import com.ydl.ydlcommon.base.config.HttpConfig
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.modular.findRouteService
import com.ydl.ydlcommon.utils.log.LogHelper
import com.yidianling.common.tools.LogUtil
import com.yidianling.user.UserHelper
......@@ -16,6 +22,9 @@ import com.yidianling.user.UserHelper
*/
class WebJavascriptHandler : IJavascriptHandler{
private val js = JsMethod()
override fun getUriAppendSuffix(): String {
return "platform_main_theme=00C9E2&platform_main_theme_light=00D4DF&platform_main_theme_bright=EAFAFC"
}
......@@ -41,6 +50,7 @@ class WebJavascriptHandler : IJavascriptHandler{
if (YDLRouterManager.router(params)) {
return
}
if (js.handle(params)) return
val jsData = Gson().fromJson(params, H5JsBean::class.java)
//是否登录
if (jsData.cmd?.action_name != null && jsData.cmd!!.action_name.equals("login")) {
......@@ -382,6 +392,7 @@ class WebJavascriptHandler : IJavascriptHandler{
}
}
"meditation_play" -> {
jsData.cmd!!.params?.let{
val mediaId = it.mediaId
......@@ -428,6 +439,22 @@ class WebJavascriptHandler : IJavascriptHandler{
}
}
//再换一位
"get_next_doctor"->{
wvEnventPro?.getNextExpertStatus(jsData.cmd?.params?.doctorId.toString(),jsData.cmd?.params?.title,jsData.cmd?.params?.uid.toString())
}
"show_popup_window" -> {
val doctorId = jsData.cmd?.params?.doctorId?.toString()
val confideId = jsData.cmd?.params?.confidedId
val uid = jsData.cmd?.params?.uid?.toString()
val topActivity = BaseActivityMgr.INST.getTopActivity()
if (topActivity is FragmentActivity && doctorId != null && confideId != null) {
val url = HttpConfig.MH5_URL + ConfideRoute.h5ConfideIntro(confideId)
findRouteService(IConfideService::class.java).showExpertDetailDialog(topActivity, url, doctorId, uid ?: "")
}
}
}
}
}
......@@ -182,6 +182,7 @@ public interface WebViewClientClickListener {
//设置当前页面类型
void setSelfPageType(int selfType);
default void playMeditation(int mediaId,long meditationId,int meditationType,String mediaCoverUrl){}
default void switchSound(int mediaId,long meditationId,int meditationType,int businessType,
......@@ -194,4 +195,7 @@ public interface WebViewClientClickListener {
default void setWebViewBG(String rgb,String alpha){}
void getNextExpertStatus(String doctorID,String title,String uid);
}
......@@ -31,8 +31,6 @@ buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
//bugly 符号表
classpath 'com.tencent.bugly:symtabfileuploader:2.2.1'
classpath 'com.ydl.plugins:modular:1.0.3'
classpath 'com.ydl:notracepoint-gradle-plugin:0.0.3'
classpath 'com.ydl.plugins:restools:1.0.1'
......
......@@ -5,24 +5,27 @@ ext {
ydlPublishVersion = [
// -------------- 业务模块 --------------
//第三步 若干
"m-confide" : "0.0.49.74",
"m-consultant" : "0.0.60.25",
"m-fm" : "0.0.30.08",
"m-user" : "0.0.62.32",
"m-home" : "0.0.23.83",
"m-im" : "0.0.21.50",
"m-dynamic" : "0.0.7.73",
"m-confide" : "0.0.50.08",
"m-consultant" : "0.0.60.27",
"m-fm" : "0.0.30.09",
"m-im" : "0.0.21.51",
"m-dynamic" : "0.0.7.74",
"m-article" : "0.0.0.10",
"m-muse" : "0.0.28.70",
"m-tests" : "0.0.24.18",
"m-course" : "0.0.43.37",
"m-course" : "0.0.43.39",
//-------------- 业务模块 API 层 --------------
"m-audioim-api" : "0.0.6",
"m-confide-api" : "0.0.2.11",
"m-confide-api" : "0.0.2.16",
"m-consultant-api": "0.0.5.63",
"m-course-api" : "0.0.3.6",
"m-fm-api" : "0.0.3",
......@@ -37,6 +40,7 @@ ext {
//mdt 组件
"ydl-tuicore" : "0.0.23",
//第一步
"ydl-platform" : "0.0.41.26",
//第二步 若干
......@@ -44,12 +48,15 @@ ext {
"ydl-media" : "0.0.21.47",
"ydl-pay" : "0.0.18.19",
"m-audioim" : "0.0.49.30.07",
"ydl-flutter-base": "0.0.14.38",
//以下 几乎不会动
"router" : "0.0.1",
"ydl-net" : "0.0.3.93",
"ydl-utils" : "0.0.3.3",
"ydl-utils" : "0.0.3.8",
]
ydl_app = [
appName : "壹点灵心理咨询",
......@@ -92,23 +99,30 @@ ext {
// -------------- 业务模块 --------------
//第三步 若干
"m-confide" : "0.0.49.74",
"m-consultant" : "0.0.60.25",
"m-fm" : "0.0.30.08",
"m-user" : "0.0.62.32",
"m-home" : "0.0.23.83",
"m-im" : "0.0.21.50",
"m-dynamic" : "0.0.7.73",
"m-confide" : "0.0.50.08",
"m-consultant" : "0.0.60.27",
"m-fm" : "0.0.30.09",
"m-im" : "0.0.21.51",
"m-dynamic" : "0.0.7.74",
"m-article" : "0.0.0.8",
"m-muse" : "0.0.28.70",
"m-tests" : "0.0.24.18",
"m-course" : "0.0.43.37",
"m-course" : "0.0.43.39",
//-------------- 业务模块 API 层 --------------
"m-audioim-api" : "0.0.6",
"m-confide-api" : "0.0.2.11",
"m-confide-api" : "0.0.2.16",
"m-consultant-api": "0.0.5.63",
"m-course-api" : "0.0.3.6",
"m-fm-api" : "0.0.3",
......@@ -122,6 +136,7 @@ ext {
//mdt组件
"ydl-tuicore" : "0.0.23",
//第一步
"ydl-platform" : "0.0.41.26",
//第二步 若干
......@@ -129,12 +144,17 @@ ext {
"ydl-media" : "0.0.21.47",
"ydl-pay" : "0.0.18.19",
"m-audioim" : "0.0.49.30.07",
"ydl-flutter-base": "0.0.14.38",
//以下 几乎不会动
"router" : "0.0.1",
"ydl-net" : "0.0.3.93",
"ydl-utils" : "0.0.3.3",
"ydl-utils" : "0.0.3.8",
]
dependencies = [
......
......@@ -9,7 +9,7 @@
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m
org.gradle.jvmargs=-Xmx4096m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
......
......@@ -75,7 +75,7 @@ dependencies {
kapt "com.alibaba:arouter-compiler:$arouter_compiler"
api "com.alibaba:arouter-api:$arouter_api"
implementation "com.ydl:ydl-av:1.3.9"
implementation "com.ydl:ydl-av:1.4.2"
implementation 'com.volcengine:apm_insight:1.4.6.cn'
if (rootProject.ext.dev_mode){
......
......@@ -12,15 +12,16 @@ 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.os.*
import android.provider.Settings
import android.text.TextUtils
import android.view.View
import android.view.WindowManager
import android.view.animation.AccelerateInterpolator
import android.widget.TextView
import androidx.core.content.ContextCompat
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.launcher.ARouter
import com.google.gson.Gson
import com.hjq.permissions.OnPermissionCallback
import com.hjq.permissions.XXPermissions
......@@ -49,6 +50,7 @@ import com.ydl.ydlcommon.base.BaseMvpActivity
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.router.YdlCommonRouterManager
import com.ydl.ydlcommon.utils.LogUtil
import com.ydl.ydlcommon.utils.ScreenUtil
import com.ydl.ydlcommon.utils.StatusBarUtils
import com.ydl.ydlcommon.utils.Utils
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
......@@ -56,6 +58,7 @@ import com.ydl.ydlcommon.utils.log.AliYunLogConfig
import com.ydl.ydlcommon.utils.log.AliYunRichLogsHelper
import com.ydl.ydlcommon.utils.log.LogHelper
import com.ydl.ydlcommon.utils.remind.ToastHelper
import com.yidianling.im.api.service.IImService
import com.yidianling.user.api.service.IUserService
import de.greenrobot.event.EventBus
import io.agora.rtc.Constants
......@@ -151,6 +154,16 @@ class AudioHomeActivity :
private var localRemainTime: Int? = 0
/**
* 挂断电话需要等待时间
*/
private var onlineCallTime: Long? = 0
/**
* 跳转传统电话需要等待时间
*/
private var traditionCallTime: Long? = 0
/**
* 50s自动挂断倒计时
*/
private var waitDisposable: Disposable? = null
......@@ -185,10 +198,12 @@ class AudioHomeActivity :
private var mPlayer: AudioPlayer? = null
private var vibrator: Vibrator? = null
private var handler: Handler? = null
private var phoneHandler: Handler? = Handler(Looper.getMainLooper())
//声网
private var voiceManage: YDLVoiceManager? = null
//频道管理器
// private var channelManager: ChannelManager? = null
......@@ -204,6 +219,14 @@ class AudioHomeActivity :
private var mStorageDialog: ZDialog? = null
private var mHangUpTimeTraditionalDialog: ZDialog? = null
private var mHangUpTimeOnlineDialog: ZDialog? = null
private var canHangUp: Boolean = false
private var canChangeRoute: Boolean = false
/**
* 声网事件回调 (SDK 通过指定的事件通知应用程序 SDK 的运行事件,如: 加入或离开频道,新用户加入频道等)
*/
......@@ -227,6 +250,7 @@ class AudioHomeActivity :
// 声网发出警告错误码,不应该直接离开房间
}
/**
* https://docs.agora.io/cn/Voice/API%20Reference/java/classio_1_1agora_1_1rtc_1_1_i_rtc_engine_event_handler_1_1_error_code.html
* */
......@@ -312,6 +336,7 @@ class AudioHomeActivity :
// leaveChannel()
// }
}
/**
* https://docs.agora.io/cn/Voice/API%20Reference/java/classio_1_1agora_1_1rtc_1_1_i_rtc_engine_event_handler.html#a31b2974a574ec45e62bb768e17d1f49e
* */
......@@ -377,8 +402,11 @@ class AudioHomeActivity :
//另一方离开频道
updateExpertStatus(false, 1)
}, 500)
}
//本地音频状态变化
override fun onLocalAudioStateChanged(localVideoState: Int, error: Int) {
super.onLocalAudioStateChanged(localVideoState, error)
......@@ -457,12 +485,25 @@ class AudioHomeActivity :
//权限申请
requestPermission()
ActionCountUtils.record("call_phone_page", "call_phone_page_visit", "0", "1")
}
private fun setWindowStatusBarColor() {
if (Build.VERSION.SDK_INT >= 21) {
val decorView = window.decorView
val option = (View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
or View.SYSTEM_UI_FLAG_LAYOUT_STABLE)
decorView.systemUiVisibility = option
window.statusBarColor = Color.TRANSPARENT
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
window.attributes?.layoutInDisplayCutoutMode =
WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
}
} else {
StatusBarUtils.setWindowStatusBarColor(this, R.color.audioim_color_40353535)
}
}
@SuppressLint("InvalidWakeLockTag")
private fun initSensorManager() {
......@@ -521,9 +562,24 @@ class AudioHomeActivity :
writeAgoraLog("主叫方发送的邀请通话消息内容:$content", true)
AliYunRichLogsHelper.getInstance()
.sendRichLog(AliYunLogConfig.AGORA, "主叫方发送的邀请通话消息内容:$content")
localRemainTime = remainTime?.toInt()
localRemainTime = (totalDuration ?: 1500).minus(remainTime?.toInt() ?: 1500)
handler = Handler()
vibrator = getSystemService(Service.VIBRATOR_SERVICE) as Vibrator?
var count = 0
phoneHandler?.postDelayed(object : Runnable {
override fun run() {
if (count % 2 == 0) {
tv_tips.text = "正在发送倾诉请求…"
} else {
tv_tips.text = "正在等待聆听者接受邀请…"
}
count++
phoneHandler?.postDelayed({ this.run() }, 3000)
}
}, 3000)
}
private fun reLoginRTM() {
......@@ -546,7 +602,6 @@ class AudioHomeActivity :
writeAgoraLog("用户拨打电话界面开启")
AliYunRichLogsHelper.getInstance()
.sendRichLog(AliYunLogConfig.AGORA, "用户拨打电话界面开启")
tv_change_route.isEnabled = false
//水波纹view初始化
wave_view.setDuration(6000)
wave_view.setStyle(Paint.Style.STROKE)
......@@ -555,14 +610,14 @@ class AudioHomeActivity :
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)
// tv_tips.text = expertTips
var time = totalDuration?.minus(remainTime!!.toInt())
tv_remain_time.text = DateUtils.formatTime((time).toString())
if (!TextUtils.isEmpty(expertHeadUrl)) {
var option = SimpleImageOpConfiger()
......@@ -573,22 +628,54 @@ class AudioHomeActivity :
}
if (!isShowAXB) {
tv_change_route.visibility = View.GONE
ll_changeRoute.visibility = View.GONE
tv_change_time_counter.visibility = View.GONE
}
}
private fun setClickEvent() {
//跳转客服小壹
jump_kefu.setOnClickListener {
val imService = ARouter.getInstance().navigation(IImService::class.java)
imService?.startKefuChat(this, "", 0, 0)
}
//静音开启
rl_mute_on_off.setOnClickListener {
ActionCountUtils.record("call_phone_page", "call_phone_icon_click", "0", "2")
if (iv_mute_on_off.isSelected) {
iv_mute_on_off.isSelected = false
iv_mute_on_off.setImageResource(R.drawable.audiohome_muteoff)
audio_mute_text.text = "麦克风已关"
voiceManage?.getVoiceApi()?.enableLocalAudio(false)
} else {
iv_mute_on_off.isSelected = true
iv_mute_on_off.setImageResource(R.drawable.audiohome_muteon)
audio_mute_text.text = "麦克风已开"
voiceManage?.getVoiceApi()?.enableLocalAudio(true)
}
}
//切换线路
tv_change_route.setOnClickListener {
ll_changeRoute.setOnClickListener {
if (!canChangeRoute) {
showHangUpTimeTraditionalDialog()
return@setOnClickListener
}
ActionCountUtils.record("call_phone_page", "call_phone_icon_click", "0", "4")
showChooseDialog(1)
}
//挂断
iv_hang_up.setOnClickListener {
if (!canHangUp) {
showHangUpTimeOnlineDialog()
return@setOnClickListener
}
if (Utils.isFastClick()) {
//防止连击
return@setOnClickListener
}
ActionCountUtils.record("call_phone_page", "call_phone_icon_click", "0", "1")
if (isConnectSuccess) {
writeAgoraLog("已接通:主叫主动挂断")
AliYunRichLogsHelper.getInstance()
......@@ -597,10 +684,10 @@ class AudioHomeActivity :
leaveChannel()
uploadLog()
YDLavManager.instances.callEndStatusUpdate(channelId!!, 3, "主叫主动挂断")
callEventSave("51", "已接通:主叫主动挂断")
} else {
userCloseCalling()
}
callEventSave("51", "已接通:主叫主动挂断")
ActionCountUtils.count(
"shengwang_popup_layer_page|shengwang_popup_layer_refuse_click",
......@@ -611,6 +698,7 @@ class AudioHomeActivity :
}
//免提
iv_hands_free.setOnClickListener {
ActionCountUtils.record("call_phone_page", "call_phone_icon_click", "0", "3")
if (iv_hands_free.isSelected) {
iv_hands_free.isSelected = false
iv_hands_free.setImageResource(R.drawable.audioim_img_hands_free_unuse)
......@@ -679,19 +767,20 @@ class AudioHomeActivity :
}
}
private fun showStorageDialog() {
if (mStorageDialog == null) {
mStorageDialog = ZDialog.Builder(this)
.setContentView(R.layout.audioim_activity_permission_dialog)
.setOnClickListener(R.id.cancel_dialog) {
mStorageDialog?.dismiss()
mStorageDialog=null
mStorageDialog = null
finish()
}
.setAnimation(0)//取消动画
.setOnClickListener(R.id.dial_right_now) {
mStorageDialog?.dismiss()
mStorageDialog=null
mStorageDialog = null
finish()
val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS)
val uri = Uri.fromParts("package", packageName, null)
......@@ -701,6 +790,66 @@ class AudioHomeActivity :
.show()
}
}
private fun showHangUpTimeTraditionalDialog() {
if (mHangUpTimeTraditionalDialog == null) {
mHangUpTimeTraditionalDialog = ZDialog.Builder(this)
.setContentView(R.layout.audioim_activity_time_alarm_dialog)
.setOnClickListener(R.id.dial_right_now) {
mHangUpTimeTraditionalDialog?.dismiss()
mHangUpTimeTraditionalDialog = null
}
.setCancelAble(false)
.setAnimation(0)//取消动画
.width((resources.displayMetrics.widthPixels * 0.8f).toInt())
.show()
val text = String.format(
getString(R.string.audioim_audio_time_alarm_msg_tradition_dialog),
traditionCallTime
)
(mHangUpTimeTraditionalDialog?.findDialogView(R.id.third_title) as TextView).text = text
}
}
private fun dismissHangUpTimeTraditionalDialog() {
if (mHangUpTimeTraditionalDialog != null && mHangUpTimeTraditionalDialog!!.isShowing) {
mHangUpTimeTraditionalDialog!!.dismiss()
mHangUpTimeTraditionalDialog = null
}
}
private fun dismissHangUpTimeOnlineDialog() {
if (mHangUpTimeOnlineDialog != null && mHangUpTimeOnlineDialog!!.isShowing) {
mHangUpTimeOnlineDialog!!.dismiss()
mHangUpTimeOnlineDialog = null
}
}
private fun showHangUpTimeOnlineDialog() {
if (mHangUpTimeOnlineDialog == null) {
mHangUpTimeOnlineDialog = ZDialog.Builder(this)
.setContentView(R.layout.audioim_activity_time_alarm_dialog)
.setOnClickListener(R.id.dial_right_now) {
mHangUpTimeOnlineDialog?.dismiss()
mHangUpTimeOnlineDialog = null
}
.setCancelAble(false)
.setAnimation(0)//取消动画
.width((resources.displayMetrics.widthPixels * 0.8f).toInt())
.show()
val text = String.format(
getString(R.string.audioim_audio_time_alarm_msg_online_dialog),
onlineCallTime
)
(mHangUpTimeOnlineDialog?.findDialogView(R.id.third_title) as TextView).text = text
}
}
@SuppressLint("CheckResult", "SetTextI18n")
private fun init() {
wave_view.start()
......@@ -714,6 +863,7 @@ class AudioHomeActivity :
YdlCommonRouterManager.getYdlCommonRoute().getUserInfo()!!.headUrl,
YdlCommonRouterManager.getYdlCommonRoute().getUserInfo()!!.userName,
remainTime!!.toInt(),
totalDuration ?: 1500,
relationId,
callId,
null,
......@@ -731,23 +881,43 @@ class AudioHomeActivity :
Observable.interval(0, 100, TimeUnit.MILLISECONDS).subscribeOn(Schedulers.computation())
.take(600).observeOn(AndroidSchedulers.mainThread()).subscribe({
val remainTime = 50 - it / 10
traditionCallTime = remainTime
if (remainTime <= 0) {
dismissHangUpTimeTraditionalDialog()
waittingStatus()
} else {
tv_change_time_counter.text = "${remainTime}s"
tv_change_time_counter.text = "转传统电话(${remainTime}s)"
if (mHangUpTimeTraditionalDialog != null && mHangUpTimeTraditionalDialog!!.isShowing) {
val callTime = String.format(
getString(R.string.audioim_audio_time_alarm_msg_tradition_dialog),
traditionCallTime
)
(mHangUpTimeTraditionalDialog!!.findDialogView(R.id.third_title) as TextView).text =
callTime
}
}
onlineCallTime = remainTime - 20
if (remainTime <= 20) {
audio_hangup_text.text = "挂断"
dismissHangUpTimeOnlineDialog()
} else {
audio_hangup_text.text = "挂断(${remainTime - 20}s)"
if (mHangUpTimeOnlineDialog != null && mHangUpTimeOnlineDialog!!.isShowing) {
val callTime = String.format(
getString(R.string.audioim_audio_time_alarm_msg_online_dialog),
onlineCallTime
)
(mHangUpTimeOnlineDialog!!.findDialogView(R.id.third_title) as TextView).text =
callTime
}
if (remainTime<=20){
audio_hangup_text.text="挂断"
}else{
audio_hangup_text.text="挂断(${remainTime-20}s)"
}
var result = it.toFloat()/3f
var result = it.toFloat() / 3f
progress_view.setProgress(result)
if (result >= 100f && !iv_hang_up.isEnabled) {
audio_hangup_text.text="挂断"
if (result >= 100f && !canHangUp) {
audio_hangup_text.text = "挂断"
//挂断按钮可点击
iv_hang_up.isEnabled = true
canHangUp = true
iv_hang_up.setImageResource(R.drawable.audioim_img_hang_up)
}
......@@ -757,12 +927,22 @@ class AudioHomeActivity :
LogUtil.d(it.message)
AliYunRichLogsHelper.getInstance()
.sendRichLog(AliYunLogConfig.AGORA, "倒计时异常${it.message}")
dismissHangUpTimeOnlineDialog()
dismissHangUpTimeTraditionalDialog()
}) {
// waittingStatus()
if (!isConnectSuccess) {
//关闭音乐
dismissHangUpTimeOnlineDialog()
dismissHangUpTimeTraditionalDialog()
stopPlaying()
callEventSave("80", "未接通挂断:50s等待倒计时结束挂断")
callEventSave("34", "未接通挂断:50s等待倒计时结束挂断")
writeAgoraLog("未接通挂断:50s等待倒计时结束挂断")
AliYunRichLogsHelper.getInstance()
......@@ -836,7 +1016,7 @@ class AudioHomeActivity :
*
*/
private fun userCloseCalling() {
callEventSave("51", "未接听时:主叫(用户)主动挂断,取消呼叫")
callEventSave("32", "未接听时:主叫(用户)主动挂断,取消呼叫")
writeAgoraLog("未接听时:主叫(用户)主动挂断,取消呼叫")
AliYunRichLogsHelper.getInstance()
......@@ -875,20 +1055,6 @@ class AudioHomeActivity :
if (finishStatus == 0) {
callStartTime = System.currentTimeMillis()
}
// 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)
// }
}
/**
......@@ -988,7 +1154,7 @@ class AudioHomeActivity :
private fun waittingStatus() {
tv_change_time_counter.visibility = View.GONE
//挂断按钮可点击
iv_hang_up.isEnabled = true
canHangUp = true
iv_hang_up.setImageResource(R.drawable.audioim_img_hang_up)
// if (!isConnectSuccess) {
// //页面等待文案调整
......@@ -997,13 +1163,10 @@ class AudioHomeActivity :
// tv_change_doctor.visibility = View.VISIBLE
// }
if (!isShowAXB) {
tv_change_route.visibility = View.GONE
ll_changeRoute.visibility = View.GONE
} else {
//切换线路按钮可见
tv_change_route.isEnabled = true
tv_change_route.text = "切换至传统电话"
tv_change_route.setTextColor(ContextCompat.getColor(this, R.color.platform_white))
canChangeRoute = true
}
}
......@@ -1034,7 +1197,10 @@ class AudioHomeActivity :
mPlayer!!.setCompletionListener(MediaPlayer.OnCompletionListener {
LogUtil.e("播放结束")
//通话剩余时间不足60s时,默认
if (localRemainTime!! < 60 && !TextUtils.isEmpty(commentUrl)) {
if (localRemainTime!! > (totalDuration ?: 1500).minus(60) && !TextUtils.isEmpty(
commentUrl
)
) {
val h5Params = H5Params(commentUrl!!, "评价")
NewH5Activity.start(this@AudioHomeActivity, h5Params)
}
......@@ -1061,7 +1227,7 @@ class AudioHomeActivity :
*/
private fun connectSuccess() {
isConnectSuccess = true
phoneHandler?.removeCallbacksAndMessages(null)
//通知服务端,此次通话已经接通,服务端开始订单
updateExpertStatus(false, 0)
......@@ -1081,7 +1247,7 @@ class AudioHomeActivity :
//等待状态的相关ui隐藏(挂断按钮的倒计时不清除,挂断按钮必须在30s后才能点击)
tv_change_doctor.visibility = View.GONE
tv_waiting.visibility = View.GONE
tv_tips.visibility = View.GONE
//显示通话相关ui
rl_remain_time.visibility = View.VISIBLE
......@@ -1091,34 +1257,17 @@ class AudioHomeActivity :
//剩余倾诉时长倒计时
totalDisposable =
Observable.interval(0, 1, TimeUnit.SECONDS).subscribeOn(Schedulers.computation())
.take(remainTime!!.toLong() + 1).observeOn(AndroidSchedulers.mainThread())
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.audioim_color_50ffffff
)
)
tv_change_route.setCompoundDrawablesWithIntrinsicBounds(
null,
null,
ContextCompat.getDrawable(
this,
R.drawable.audioim_img_choose_arrow_unuse
),
null
)
localRemainTime =
(totalDuration ?: 1500).minus(remainTime!!.toInt()).plus(it.toInt())
if (localRemainTime!! >= (totalDuration ?: 1500).minus(60)) {
if (canChangeRoute) {
canChangeRoute = false
}
}
tv_remain_time.text = DateUtils.formatTime(localRemainTime.toString())
......@@ -1170,6 +1319,7 @@ class AudioHomeActivity :
YdlCommonRouterManager.getYdlCommonRoute().getUserInfo()!!.headUrl,
YdlCommonRouterManager.getYdlCommonRoute().getUserInfo()!!.userName,
remainTime!!.toInt(),
totalDuration ?: 1500,
relationId,
callId,
null,
......@@ -1354,6 +1504,7 @@ class AudioHomeActivity :
override fun onDestroy() {
super.onDestroy()
uploadLog()
phoneHandler?.removeCallbacksAndMessages(null)
if (isConnectSuccess) {
uploadException("", "zhu", "108", callback = null)
}
......@@ -1361,6 +1512,10 @@ class AudioHomeActivity :
handler = null
}
if (phoneHandler != null) {
phoneHandler = null
}
hasUpLoadLog = false
if (waitDisposable != null) {
......@@ -1406,13 +1561,13 @@ class AudioHomeActivity :
* @param res 上报的详细
* @param line 载体:1.网易 2.中国移动(双呼)3.联通 4.华为 5.糖猫-联通 7:声网 8:微信 10:新移动
* */
private fun callEventSave(
fun callEventSave(
status: String,
res: String,
session: String? = channelId,
line: String = "7"
) {
YDLavManager.instances.callEventSave(status,res , session, line)
YDLavManager.instances.callEventSave(status, res, session, line)
}
private fun onStartCall() {
......
......@@ -2,6 +2,7 @@ package com.ydl.audioim.widget;
import android.app.Dialog;
import android.content.Context;
import android.os.Build;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
......@@ -123,6 +124,11 @@ public class ZDialog extends Dialog {
return this;
}
public Builder width(int width){
mDialogParams.defaultWidth = width;
return this;
}
public Builder setGravity(@ZDialogDirection.ZGravity int direction) {
switch (direction) {
case ZDialogDirection.FROM_TOP:
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="@dimen/platform_dp_14" />
<solid android:color="@color/transparent" />
<stroke
android:width="0.5dp"
android:color="#ffffff">
</stroke>
</shape>
\ No newline at end of file
......@@ -4,39 +4,44 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/platform_color_80353535">
android:background="@drawable/audiohome_background">
<TextView
android:id="@+id/tv_change_route"
<LinearLayout
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:drawablePadding="6dp"
android:padding="5dp"
android:text="后可切换至传统电话"
android:textColor="@color/platform_color_50FFFFFF"
android:textSize="13sp"
android:visibility="visible" />
android:layout_marginTop="44dp"
android:layout_marginRight="@dimen/platform_dp_15"
android:background="@drawable/audioim_border_white_kefu"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:src="@drawable/audioim_kefu" />
<TextView
android:id="@+id/tv_change_time_counter"
android:id="@+id/jump_kefu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/tv_change_route"
android:layout_toLeftOf="@+id/tv_change_route"
android:layout_marginLeft="3dp"
android:layout_marginTop="5dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="5dp"
android:text="联系客服"
android:textColor="@color/white"
android:textSize="15dp"
tools:text="60s" />
android:textSize="13sp" />
</LinearLayout>
<RelativeLayout
android:id="@+id/rl_head"
android:layout_width="250dp"
android:layout_height="250dp"
android:layout_height="270dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="60dp">
......@@ -60,17 +65,15 @@
android:scaleType="centerCrop"
android:src="@drawable/audioim_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_below="@+id/iv_head"
android:layout_centerHorizontal="true"
android:layout_marginTop="-20dp"
android:layout_marginTop="@dimen/platform_dp_12"
android:textColor="@color/white"
android:textSize="26sp"
android:textSize="22sp"
tools:text="留意" />
<TextView
......@@ -80,33 +83,32 @@
android:layout_below="@+id/tv_name"
android:layout_centerHorizontal="true"
android:layout_marginLeft="25dp"
android:layout_marginTop="6dp"
android:layout_marginTop="@dimen/platform_dp_10"
android:layout_marginRight="25dp"
android:ellipsize="end"
android:gravity="center"
android:maxLines="2"
android:textColor="@color/white"
android:textSize="15sp"
tools:text="你存在的本身就是值得被爱的你存在的本身就是值得被爱的" />
android:text="正在等待聆听者接受邀请…"
android:textColor="@color/platform_color_70FFFFFF"
android:textSize="12sp" />
</RelativeLayout>
<!-- 倾诉剩余时间-->
<androidx.constraintlayout.widget.ConstraintLayout
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:layout_below="@+id/rl_head"
android:visibility="gone"
tools:visibility="visible">
<TextView
android:id="@+id/tv_notes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="剩余时长"
android:text="已通话时长"
android:textColor="@color/white"
android:textSize="15dp"
android:textSize="18sp"
app:layout_constraintEnd_toStartOf="@+id/tv_remain_time"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toStartOf="parent"
......@@ -120,7 +122,7 @@
android:layout_toRightOf="@+id/tv_notes"
android:text="23:23"
android:textColor="@color/white"
android:textSize="16dp"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/tv_notes"
app:layout_constraintTop_toTopOf="parent" />
......@@ -129,20 +131,37 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_notes"
android:layout_marginTop="2dp"
android:text="(限24小时内拨打)"
android:textColor="#80FFFFFF"
android:textSize="15dp"
android:layout_marginTop="4dp"
android:text="(满25分钟自动挂断,限24小时内拨打)"
android:textColor="#60ffffff"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_remain_time" />
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:id="@+id/tv_tips1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/rl_remain_time"
android:layout_centerHorizontal="true"
android:layout_marginLeft="25dp"
android:layout_marginTop="@dimen/platform_dp_10"
android:layout_marginRight="25dp"
android:ellipsize="end"
android:gravity="center"
android:maxLines="2"
android:textColor="@color/white"
android:textSize="15sp" />
<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_above="@id/ll_three_icon"
android:layout_centerHorizontal="true"
android:layout_marginBottom="48dp"
android:gravity="center"
......@@ -154,31 +173,89 @@
android:id="@+id/tv_waiting"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/rl_hang_up"
android:layout_above="@+id/ll_three_icon"
android:layout_centerHorizontal="true"
android:layout_marginBottom="50dp"
android:text="正在等待聆听者接受邀请…"
android:textColor="@color/platform_color_70FFFFFF"
android:textSize="12sp"
android:visibility="visible"
android:visibility="gone"
tools:visibility="gone" />
<!--挂断按钮-->
<RelativeLayout
android:id="@+id/rl_hang_up"
<LinearLayout
android:id="@+id/ll_changeRoute"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@id/ll_three_icon"
android:layout_centerHorizontal="true"
android:layout_marginBottom="@dimen/platform_dp_88"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="@+id/iv_change_route"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/iv_change_route"></ImageView>
<TextView
android:id="@+id/tv_change_time_counter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/tv_change_route"
android:layout_toLeftOf="@+id/tv_change_route"
android:textColor="#60ffffff"
android:textSize="15dp"
tools:text="转传统电话(60s)" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_three_icon"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginLeft="72dp"
android:layout_marginBottom="18dp">
android:layout_marginBottom="@dimen/platform_dp_18"
android:orientation="horizontal">
<!--静音按钮-->
<LinearLayout
android:id="@+id/rl_mute_on_off"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="@+id/iv_mute_on_off"
android:layout_width="66dp"
android:layout_height="66dp"
android:layout_marginTop="1dp"
android:src="@drawable/audiohome_muteon"
android:visibility="visible" />
<TextView
android:id="@+id/audio_mute_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="麦克风已开"
android:textColor="@color/white"
android:textSize="12sp" />
<com.ydl.ydlcommon.view.ProgressView
android:id="@+id/progress_view"
android:layout_width="70dp"
android:layout_height="70dp"
app:pa_progressBackColor="#45E6AB"
app:pa_progressWidth="4dp" />
</LinearLayout>
<!--挂断按钮-->
<LinearLayout
android:id="@+id/rl_hang_up"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/iv_hang_up"
......@@ -189,52 +266,58 @@
android:src="@drawable/audioim_img_hang_up_unuse"
android:visibility="visible" />
<com.ydl.ydlcommon.view.ProgressView
android:id="@+id/progress_view"
android:layout_width="70dp"
android:layout_height="70dp"
app:pa_progressBackColor="#45E6AB"
app:pa_progressWidth="4dp" />
</FrameLayout>
<TextView
android:id="@+id/audio_hangup_text"
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:id="@+id/audio_hangup_text"
android:textColor="@color/white"
android:textSize="12sp" />
</RelativeLayout>
</LinearLayout>
<!-- 免提按钮-->
<RelativeLayout
android:layout_width="wrap_content"
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginRight="72dp"
android:layout_marginBottom="18dp">
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="@+id/iv_hands_free"
android:layout_width="66dp"
android:layout_height="66dp"
android:layout_marginTop="1dp"
android:src="@drawable/audioim_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>
</LinearLayout>
</LinearLayout>
<!--自定义弹窗-->
<TextView
android:id="@+id/tv_toast"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_tips"
android:layout_below="@+id/tv_tips1"
android:layout_centerHorizontal="true"
android:layout_marginTop="34dp"
android:background="@drawable/audioim_toast_view_background"
......@@ -253,7 +336,7 @@
android:id="@+id/tv_nte_status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_tips"
android:layout_below="@+id/tv_tips1"
android:layout_centerHorizontal="true"
android:layout_marginTop="70dp"
android:background="@drawable/audioim_toast_view_background"
......
......@@ -14,9 +14,11 @@
android:id="@+id/third_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="App正常工作需要录音权限,请开启"
android:text="请启用权限:麦克风或录音,以保障语音通话正常使用。"
android:textColor="@color/platform_color_242424"
android:textSize="15sp"
android:paddingLeft="12dp"
android:paddingRight="12dp"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
......
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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_marginStart="@dimen/platform_dp_38"
android:layout_marginLeft="@dimen/platform_dp_38"
android:layout_marginEnd="@dimen/platform_dp_38"
android:background="@drawable/shape_bg_white_fillet8"
app:layout_goneMarginEnd="@dimen/platform_dp_38">
<TextView
android:id="@+id/third_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/platform_dp_20"
android:textColor="@color/platform_color_242424"
android:textSize="15sp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:layout_editor_absoluteY="85dp" />
<View
android:id="@+id/line"
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_marginTop="@dimen/platform_dp_28"
android:background="@color/platform_color_D8D8D8"
app:layout_constraintTop_toBottomOf="@id/third_title" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/line"
>
<TextView
android:id="@+id/dial_right_now"
android:layout_width="match_parent"
android:layout_height="@dimen/platform_dp_48"
android:gravity="center"
android:text="@string/audioim_got_it"
android:textColor="@color/platform_color_1DA1F2"
android:textSize="17sp" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<resources>
<string name="audioim_need_storage_permission_hint">App正常工作需要内部存储使用权限,请开启</string>
<string name="audioim_got_it">知道了</string>
<string name="audioim_audio_time_alarm_msg_tradition_dialog">请等待 %s 秒后,点击跳转传统电话</string>
<string name="audioim_audio_time_alarm_msg_online_dialog">请等待 %s 秒后,点击挂断</string>
</resources>
......@@ -50,6 +50,9 @@ android {
buildConfigField "String", "AGORA_APPID", '"3387e9b251f3491e9221a9877e8f7830"'
}
}
dataBinding {
enabled true
}
publishNonDefault true
productFlavors {
......@@ -75,9 +78,11 @@ dependencies {
implementation 'com.daimajia.androidanimations:library:2.3@aar'
api 'fr.tvbarthel.blurdialogfragment:lib:2.1.5'
api "com.alibaba:arouter-api:$arouter_api"
api 'com.tencent.tbs.tbssdk:sdk:43903'
// 注意此处的依赖方式:kotlin中使用和java中使用方式有不同
kapt "com.alibaba:arouter-compiler:$arouter_compiler"
implementation 'com.alibaba:fastjson:1.2.38'
implementation "com.ydl:jjdxm-ijkplayer:0.0.33"
api rootProject.ext.dependencies["ydl-user-router"]
implementation modularPublication('com.ydl:m-consultant-api')
......@@ -88,6 +93,7 @@ dependencies {
api project(':m-audioim')
api project(":ydl-pay")
api project(':ydl-webview')
api project(':ydl-utils')
implementation modularPublication('com.ydl:m-im-api')
implementation modularPublication('com.ydl:m-user-api')
implementation modularPublication('com.ydl:m-confide-api')
......
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ydl.confide" >
package="com.ydl.confide">
<application>
<activity android:name=".home.ConfideHomeActivity"
<activity
android:name=".home.ConfideHomeActivity"
android:screenOrientation="portrait"
android:theme="@style/confide_NoTitleTheme"
>
</activity>
android:theme="@style/confide_NoTitleTheme"/>
<activity
android:name=".intro.ExpertIntroActivity"
android:screenOrientation="portrait" />
</application>
</manifest>
package com.ydl.confide.home
import android.annotation.SuppressLint
import android.app.Dialog
import android.content.Intent
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.view.Gravity
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.FrameLayout
import android.widget.ImageView
import android.widget.TextView
import androidx.fragment.app.FragmentActivity
import com.alibaba.android.arouter.launcher.ARouter
import com.facebook.drawee.backends.pipeline.Fresco
import com.facebook.drawee.interfaces.DraweeController
import com.facebook.drawee.view.SimpleDraweeView
import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import com.tencent.smtt.export.external.interfaces.JsResult
import com.tencent.smtt.sdk.*
import com.ydl.confide.R
import com.ydl.confide.home.event.ChangeAnotherExpertEvent
import com.ydl.confide.home.event.ConfideDialogEvent
import com.ydl.confide.home.http.ConfideHomeApi
import com.ydl.confide.router.PhoneCallIn
import com.ydl.utils.WebUrlParamsUtils
import com.ydl.webview.ProgressWebView
import com.ydl.webview.TellData
import com.ydl.webview.WebModularServiceUtils
import com.ydl.ydlcommon.modular.findRouteService
import com.ydl.ydlcommon.utils.TimeUtil
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.view.dialog.CommonDialog
import com.ydl.ydlnet.YDLHttpUtils
import com.yidianling.common.tools.RxImageTool
import com.yidianling.common.tools.ToastUtil
import com.yidianling.im.api.service.IImService
import com.yidianling.user.api.service.IUserService
import de.greenrobot.event.EventBus
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import java.util.*
import kotlin.math.roundToInt
class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
companion object {
private const val KEY_JUMP_URL = "jumpUrl"
private const val KEY_DOCTOR_ID = "doctor_id"
private const val KEY_SHOULD_SHOW = "should_show"
private const val KEY_UID = "uid"
}
private var firstVisitWXH5PayUrl = true
lateinit var wv_content: ProgressWebView
lateinit var text_title: TextView
lateinit var line: View
lateinit var rl_title: View
lateinit var close_webview_Icon: View
lateinit var layoutCall: View
lateinit var layoutChange: View
lateinit var tvCall: TextView
lateinit var ivCall: ImageView
lateinit var tvTime: TextView
lateinit var first_order: SimpleDraweeView
lateinit var confideProgress: View
lateinit var layout_change_text: View
lateinit var layoutBottom: View
lateinit var itemView: View
var bottomSheet :FrameLayout?=null
private var behavior: BottomSheetBehavior<*>? = null
lateinit var jumpUrl: String
lateinit var doctorId: String
var shouldShow: Boolean? = false
var uid: String? = null
fun showBottomSheetDialog(
activity: FragmentActivity,
jumpUrl: String,
doctorId: String,
shouldShow: Boolean = false,
uid: String? = null
) {
arguments = Bundle().apply {
putString(KEY_JUMP_URL, jumpUrl)
putString(KEY_DOCTOR_ID, doctorId)
putBoolean(KEY_SHOULD_SHOW, shouldShow)
uid?.let { putString(KEY_UID, it) }
}
show(activity.supportFragmentManager, "confide_bottom_showdialog")
}
@SuppressLint("WrongConstant")
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setStyle(STYLE_NORMAL, R.style.AppBottomSheet)
EventBus.getDefault().register(this)
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.confide_webview, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
ActionCountUtils.record("ydl_experts_detail_popupwindows_page", "ydl_experts_detail_popupwindows_page_visit")
jumpUrl = arguments?.getString(KEY_JUMP_URL) ?: ""
doctorId = arguments?.getString(KEY_DOCTOR_ID) ?: ""
shouldShow = arguments?.getBoolean(KEY_SHOULD_SHOW) ?: false
uid = arguments?.getString(KEY_UID)
onLoadDialStatus(doctorId)
// +
wv_content = view.findViewById<ProgressWebView>(com.ydl.webview.R.id.wv_content)
wv_content.progressbar.visibility = View.GONE
close_webview_Icon = view.findViewById<View>(R.id.close_webview_Icon)
text_title = view.findViewById<TextView>(R.id.text_title)
line = view.findViewById<View>(R.id.line)
rl_title = view.findViewById<View>(R.id.rl_title)
close_webview_Icon?.setOnClickListener {
this.dismiss()
}
webViewInit(wv_content)
}
override fun setCancelable(cancelable: Boolean) {
val dialog = dialog
val touchOutsideView =
dialog?.window?.decorView?.findViewById<View>(com.google.android.material.R.id.touch_outside)
val bottomSheetView =
dialog?.window?.decorView?.findViewById<View>(com.google.android.material.R.id.design_bottom_sheet)
if (cancelable) {
touchOutsideView?.setOnClickListener(View.OnClickListener {
if (dialog.isShowing) {
dialog.cancel()
}
})
BottomSheetBehavior.from<View>(bottomSheetView!!).setHideable(true)
} else {
touchOutsideView?.setOnClickListener(null)
// if false 按返回键也无法取消
// dialog.setCancelable(false)
BottomSheetBehavior.from<View>(bottomSheetView!!).setHideable(false)
}
}
private fun onShowReady() {
itemView = LayoutInflater.from(context).inflate(R.layout.confide_bottom_two, null, false)
layoutCall = itemView.findViewById<View>(R.id.layoutCall)
layoutChange = itemView.findViewById<View>(R.id.layoutChange)
confideProgress = itemView.findViewById<View>(R.id.confide_progress)
layout_change_text = itemView.findViewById<View>(R.id.layout_change_text)
layoutBottom = itemView.findViewById<View>(R.id.layoutBottom)
tvCall = itemView.findViewById<TextView>(R.id.tvCall)
ivCall = itemView.findViewById<ImageView>(R.id.ivCall)
tvTime = itemView.findViewById<TextView>(R.id.tvTime)
first_order = itemView.findViewById<SimpleDraweeView>(R.id.first_order)
val userService = findRouteService(IUserService::class.java)
val isLogin = userService.isLogin()
first_order.visibility = if (isLogin) View.GONE else View.VISIBLE
val controller: DraweeController = Fresco.newDraweeControllerBuilder()
.setUri(Uri.parse("res://drawable/"+R.drawable.first_order))
.setOldController(first_order.controller)
.setAutoPlayAnimations(true) // 是否自动播放Gif动画
.build()
first_order.controller = controller
layoutCall.setOnClickListener {
ActionCountUtils.record(
"ydl_experts_detail_popupwindows_page",
"ydl_experts_detail_popupwindows_page_visit"
)
if (!PhoneCallIn.loginByOneKeyLogin(requireContext(), true)) {
return@setOnClickListener
}
//判断是否绑定手机号
if (!userService.isBindPhone()) {
CommonDialog(requireContext())
.setMessage("为了您的账号安全,请绑定手机号")
.setLeftOnclick("取消") {
}
.setRightClick("确定") {
//跳转绑定手机号页面
userService.wxBindToInputhonePage(requireActivity())
}
.setCancelAble(false)
.show()
return@setOnClickListener
}
callJsFun(wv_content, "listenCallClick()")
}
layoutChange.setOnClickListener {
layout_change_text.visibility = View.GONE
confideProgress.visibility = View.VISIBLE
callJsFun(wv_content, "handleNext()")
}
}
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
val dialog = super.onCreateDialog(savedInstanceState) as BottomSheetDialog
onShowReady()
dialog.setOnShowListener {
if (shouldShow == true) {
layoutChange.visibility = View.VISIBLE
} else {
layoutChange.visibility = View.GONE
}
val layoutParams = FrameLayout.LayoutParams(
FrameLayout.LayoutParams.WRAP_CONTENT,
FrameLayout.LayoutParams.WRAP_CONTENT
).apply { gravity = Gravity.BOTTOM or Gravity.CENTER_HORIZONTAL }
dialog?.window?.addContentView(itemView, layoutParams)
bottomSheet =
(it as BottomSheetDialog).findViewById<View>(com.google.android.material.R.id.design_bottom_sheet) as FrameLayout?
behavior = BottomSheetBehavior.from(bottomSheet!!)
behavior?.peekHeight = (resources.displayMetrics.heightPixels * 0.7F).roundToInt()
if (jumpUrl?.contains("payPage=1")){
//支付高度
setMaxHeight(RxImageTool.dp2px(450f))
behavior?.isHideable = false
rl_title.visibility = View.GONE
}else{
setMaxHeight(resources.displayMetrics.heightPixels)
}
//true是跳过peekHeight,直接滑下去,false是可以滑动到顶部还可以保持peekHeight在滑下去
// behavior?.skipCollapsed=true
behavior?.addBottomSheetCallback(object : BottomSheetBehavior.BottomSheetCallback() {
override fun onStateChanged(bottomSheet: View, newState: Int) {
when (newState) {
BottomSheetBehavior.STATE_EXPANDED -> {
bottomSheet.background = ColorDrawable(Color.WHITE)
if (!jumpUrl?.contains("payPage=1")){
rl_title.visibility = View.VISIBLE
text_title.visibility = View.VISIBLE
close_webview_Icon.visibility = View.VISIBLE
line.visibility = View.GONE
}
}
BottomSheetBehavior.STATE_DRAGGING -> {
bottomSheet.setBackgroundResource(R.drawable.confide_bottom_webview)
if (!jumpUrl?.contains("payPage=1")) {
rl_title.visibility = View.VISIBLE
}
close_webview_Icon.visibility = View.GONE
text_title.visibility = View.GONE
line.visibility = View.VISIBLE
}
BottomSheetBehavior.STATE_COLLAPSED -> {
if (!jumpUrl?.contains("payPage=1")) {
rl_title.visibility = View.VISIBLE
}
line.visibility = View.VISIBLE
}
}
}
override fun onSlide(bottomSheet: View, slideOffset: Float) {}
})
}
return dialog
}
private fun setMaxHeight(height : Int){
bottomSheet?.layoutParams?.height = height
bottomSheet?.requestLayout()
}
private fun callJsFun(wv_content: ProgressWebView, funcName: String) {
val sb = StringBuffer("javascript:")
sb.append(funcName)
wv_content.post {
try {
wv_content.loadUrl(sb.toString())
} catch (e: Exception) {
e.printStackTrace()
}
}
}
fun onEventMainThread(event: ConfideDialogEvent) {
// 第一位表示拨打按钮,第二位代表再换一位按钮
val show = event.show
// if (show == 0) {
// behavior?.state = BottomSheetBehavior.STATE_EXPANDED
// }
setMaxHeight(RxImageTool.dp2px(450f))
rl_title.visibility = View.GONE
behavior?.isHideable = false
layoutCall.visibility = if (show and 0x01 == 0x01) View.VISIBLE else View.GONE
layoutChange.visibility = if (show and 0x02 == 0x01) View.VISIBLE else View.GONE
}
fun onEventMainThread(event: ChangeAnotherExpertEvent) {
updateChange(event.doctorID, event.title, event.uid)
}
private fun updateChange(doctorId: String, title: String, uid: String) {
if (doctorId == "0") {//没有下一位了
layoutChange.visibility = View.GONE
return
}
this.uid = uid
text_title.text = title
confideProgress.visibility = View.GONE
layout_change_text.visibility = View.VISIBLE
this.doctorId = doctorId
onLoadDialStatus(doctorId)
callJsFun(wv_content, "setUnRead(${getUnReadByUid(uid = uid)})")
}
@SuppressLint("ClickableViewAccessibility")
private fun webViewInit(wv_content: ProgressWebView) {
val setting: WebSettings = wv_content?.settings!!
//支持js
setting.setJavaScriptEnabled(true)
//设置字符编码
setting.setDefaultTextEncodingName("GBK")
setting.setDomStorageEnabled(true)
val appCachePath: String = context?.getCacheDir()?.getAbsolutePath().toString()
setting.setAppCachePath(appCachePath)
setting.setAllowFileAccessFromFileURLs(true)
setting.setAppCacheEnabled(true)
setting.setAllowFileAccess(true)
setting.setBlockNetworkImage(false)
wv_content!!.scrollBarStyle = View.SCROLLBARS_INSIDE_OVERLAY //滚动条风格,为0指滚动条不占用空间,直接覆盖在网页上
val jtoJHandle = WebModularServiceUtils.getWebService()
.getJavascripHandler(requireActivity(), tellData = TellData())
wv_content!!.addJavascriptInterface(jtoJHandle, "javascriptHandler")
// var jumpurl = "http://192.168.210.152/jy/listenMask?listenerId=257&isFromApp=1"
val url = WebUrlParamsUtils.getSuffix(jumpUrl, jtoJHandle.getUriAppendSuffix())
wv_content.loadUrl(url)
// wv_content.loadUrl(jumpUrl)
wv_content.setOnTouchListener { p0, p1 -> //canScrollVertically(-1)的值表示是否能向下滚动,false表示已经滚动到顶部
if (!wv_content.canScrollVertically(-1)) {
wv_content.requestDisallowInterceptTouchEvent(false);
} else {
wv_content.requestDisallowInterceptTouchEvent(true);
}
false
}
wv_content.webViewClient = object : WebViewClient() {
override fun shouldOverrideUrlLoading(webview: WebView, url: String?): Boolean {
if (url.isNullOrBlank()) return false
return shouldOverridePayUrl(webview, url)
}
}
wv_content.webChromeClient = object : WebChromeClient() {
override fun onJsAlert(
webView: WebView,
s: String,
s1: String,
jsResult: JsResult
): Boolean {
return super.onJsAlert(webView, s, s1, jsResult)
}
override fun onProgressChanged(view: WebView, newProgress: Int) {
if (newProgress == 100) {
callJsFun(wv_content, "setUnRead(${uid?.let { getUnReadByUid(uid = it) }})")
}
super.onProgressChanged(view, newProgress)
}
override fun onReceivedTitle(view: WebView, title: String) {
super.onReceivedTitle(view, title)
text_title.text = title
}
// For Android < 3.0
fun openFileChooser(valueCallback: ValueCallback<Uri?>) {
}
// For Android >= 3.0
fun openFileChooser(valueCallback: ValueCallback<*>, acceptType: String?) {
}
//For Android >= 4.1
override fun openFileChooser(
valueCallback: ValueCallback<Uri>,
acceptType: String,
capture: String
) {
}
// For Android >= 5.0
override fun onShowFileChooser(
webView: WebView,
filePathCallback: ValueCallback<Array<Uri>>,
fileChooserParams: FileChooserParams
): Boolean {
return true
}
}
}
private fun shouldOverridePayUrl(view: WebView, url: String): Boolean {
if (url.startsWith("weixin://")) {
return try {
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(url)))
true
} catch (e: java.lang.Exception) {
// 防止手机没有安装处理某个 scheme 开头的 url 的 APP 导致 crash
ToastUtil.toastShort("该手机没有安装微信")
true
}
} else if (url.startsWith("alipays://") || url.startsWith("alipay")) {
return try {
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(url)))
true
} catch (e: java.lang.Exception) {
// 防止手机没有安装处理某个 scheme 开头的 url 的 APP 导致 crash
// 启动支付宝 App 失败,会自行跳转支付宝网页支付
true
}
}
// 处理普通 http 请求跳转
// if (!(url.startsWith("http") || url.startsWith("https"))) {
// return true;
// }
// 处理微信 H5 支付跳转时验证请求头 referer 失效
// 验证不通过会出现“商家参数格式有误,请联系商家解决”
if (url.contains("wx.tenpay.com")) {
// 申请微信 H5 支付时填写的域名
// 比如经常用来测试网络连通性的 http://www.baidu.com
val parse = Uri.parse(url)
//从url 中获取 域名信息
val redirectUrlStr = parse.getQueryParameter("redirect_url")
val redirectUrl = Uri.parse(redirectUrlStr)
// 申请微信 H5 支付时填写的域名
val referer = redirectUrl.scheme + "://" + redirectUrl.host
// 兼容 Android 4.4.3 和 4.4.4 两个系统版本设置 referer 无效的问题
return if ("4.4.3" == Build.VERSION.RELEASE
|| "4.4.4" == Build.VERSION.RELEASE
) {
if (firstVisitWXH5PayUrl) {
view.loadDataWithBaseURL(
referer, "<script>window.location.href=\"$url\";</script>",
"text/html", "utf-8", null
)
// 修改标记位状态,避免循环调用
// 再次进入微信H5支付流程时记得重置状态 firstVisitWXH5PayUrl = true
firstVisitWXH5PayUrl = false
}
// 返回 false 由系统 WebView 自己处理该 url
false
} else {
// HashMap 指定容量初始化,避免不必要的内存消耗
val map = HashMap<String, String>(1)
map["Referer"] = referer
view.loadUrl(url, map)
true
}
} else if (url.contains("alipay")) {
return false
}
return false
}
override fun onResume() {
super.onResume()
if (doctorId.isNotBlank() && layoutCall.visibility == View.VISIBLE) {
onLoadDialStatus(doctorId)
}
}
fun getUnReadByUid(uid: String): Int {
if (uid.isBlank()) return 0
return ARouter.getInstance().navigation(IImService::class.java).getUnReadByUid(uid)
}
@SuppressLint("CheckResult")
private fun onLoadDialStatus(doctorId: String, showTip: Boolean = false) {
if (doctorId.isBlank()) return
if (doctorId == "0") return
val confideApi = YDLHttpUtils.obtainApi(ConfideHomeApi::class.java)
confideApi.getDialStatus(doctorId)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({ resp ->
if (resp.code == "200") {
layoutCall.visibility = View.VISIBLE
val lineStatus = resp.data?.confideLine ?: 2
/*
* 1在线 2离线 3通话中 4 继续倾诉
* */
when (lineStatus) {
1 -> {
tvCall.text = "立即拨打"
tvTime.visibility = View.GONE
ivCall.visibility = View.VISIBLE
layoutCall.background =
context?.getDrawable(R.drawable.confide_line_bg_1)
}
2 -> {
tvCall.text = "已离线"
tvTime.visibility = View.VISIBLE
ivCall.visibility = View.GONE
tvTime.text = "(点击邀请上线)"
layoutCall.background =
context?.getDrawable(R.drawable.confide_line_bg_2)
if (showTip) {
if (!uid.isNullOrBlank()) {
findRouteService(IImService::class.java).startChat(requireActivity(), uid!!, 0, 0)
}
}
}
3 -> {
tvCall.text = "通话中"
tvTime.visibility = View.VISIBLE
ivCall.visibility = View.GONE
tvTime.text = "(点击留言)"
layoutCall.background =
context?.getDrawable(R.drawable.confide_line_bg_3)
if (showTip) {
ToastUtil.toastShort("对方正在通话中,请稍后拨打")
if (!uid.isNullOrBlank()) {
findRouteService(IImService::class.java).startChat(requireActivity(), uid!!, 0, 0)
}
}
}
4 -> {
tvCall.text = "继续倾诉"
ivCall.visibility = View.VISIBLE
layoutCall.background =
context?.getDrawable(R.drawable.confide_line_bg_1)
val t = resp?.data?.remainingTime?.remainingTime
if (t != null) {
tvTime.visibility = View.VISIBLE
val remain = TimeUtil.getElapseTimeForShow(t * 1000)
tvTime.text = "(剩余" + remain + ")"
}
}
}
} else {
if (!resp.msg.isNullOrEmpty()) {
ToastUtil.toastShort(resp.msg)
}
}
}, { throwable -> throwable.printStackTrace() })
}
override fun onDestroy() {
super.onDestroy()
wv_content.destroy()
EventBus.getDefault().unregister(this)
}
}
\ No newline at end of file
......@@ -2,16 +2,22 @@ package com.ydl.confide.home
import android.annotation.SuppressLint
import android.content.Context
import android.graphics.Color
import android.net.Uri
import android.os.Build
import android.view.View
import android.widget.LinearLayout
import androidx.recyclerview.widget.LinearLayoutManager
import android.view.ViewGroup
import android.view.WindowManager
import androidx.fragment.app.FragmentActivity
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.SimpleItemAnimator
import com.alibaba.android.arouter.facade.annotation.Route
import com.facebook.drawee.backends.pipeline.Fresco
import com.facebook.drawee.interfaces.DraweeController
import com.jcodecraeer.xrecyclerview.ProgressStyle
import com.jcodecraeer.xrecyclerview.XRecyclerView
import com.ydl.confide.R
import com.ydl.confide.api.ConfideRoute
import com.ydl.confide.home.adapter.ConfideHomeAdapter
import com.ydl.confide.home.bean.ConfideHomeAllFiltersBean
import com.ydl.confide.home.bean.ConfideHomeBodyBean
......@@ -23,23 +29,27 @@ 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.modular.service.ConfideWebServiceImpl
import com.ydl.confide.home.presenter.ConfideHomePresenterImpl
import com.ydl.confide.home.util.ConfideHomeUtils
import com.ydl.confide.home.widget.FilterItemDecoration
import com.ydl.confide.router.PhoneCallIn
import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity
import com.ydl.ydl_image.listener.YDLImageRecyclerOnScrollListener
import com.ydl.ydlcommon.base.config.HttpConfig
import com.ydl.ydlcommon.base.config.HttpConfig.Companion.YDL_H5
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.modular.findRouteService
import com.ydl.ydlcommon.mvp.lce.BaseLceActivity
import com.ydl.ydlcommon.utils.BuryPointUtils
import com.ydl.ydlcommon.utils.StatusBarUtils
import com.ydl.ydlcommon.router.IYDLRouterConstant
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.utils.remind.ToastHelper
import com.ydl.ydlcommon.view.DrawableRightTextView
import com.ydl.ydlcommon.view.WrapContentLinearLayoutManager
import com.yidianling.common.tools.RxImageTool
import com.yidianling.consultant.api.IConsultantService
import com.yidianling.common.tools.ToastUtil
import com.yidianling.im.api.service.IImService
import com.yidianling.user.api.service.IUserService
import kotlinx.android.synthetic.main.confide_home_activity.*
import kotlinx.android.synthetic.main.confide_title_bar.*
......@@ -50,8 +60,12 @@ import kotlinx.android.synthetic.main.confide_title_bar.*
* @Company 壹点灵
* @date 2018/8/10
*/
@Route(path = "/confide/home")
class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHomeContract.Presenter>(),IConfideHomeContract.View,XRecyclerView.LoadingListener {
@Route(path = ConfideRoute.R_CONFIDE_HOME)
class ConfideHomeActivity :
BaseLceActivity<IConfideHomeContract.View, IConfideHomeContract.Presenter>(),
IConfideHomeContract.View, XRecyclerView.LoadingListener {
private var listenFree = false
override fun getContentViewId(): Int {
return R.id.rv_list
......@@ -68,10 +82,12 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
//是否从启动页直接进入
var isSplash: Boolean = false
/**
* 倾诉首页适配器
*/
private var mConfideAdapter: ConfideHomeAdapter? = null
/**
* 倾诉首页事件处理类
*/
......@@ -88,16 +104,21 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
/**
* 页(从第二页开始)
*/
private var page: Int = 2
private var page: Int = 1
//筛选参数bean
private var allFiltersBean: ConfideHomeAllFiltersBean? = null
//用于置顶筛选模块监听
private var listScrollListener: ConfideHomeRecycleViewListener? = null
//用于显示筛选悬浮View
private var listSuspendListener: ConfideHomeRecyleSuspendListener? = null
//是否有下一页(用于判断为你推荐条数,如果首页返回少于10条 那么就可以认为没有下一页了) 默认有下一页
private var hasMore = true
private var dp48 = 0
private var bottomSheetDialogFragment: ConfideBottomSheetDialogFragment? = null
init {
//初始化参数
......@@ -108,10 +129,17 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
private fun initParam() {
allFiltersBean = ConfideHomeAllFiltersBean(
page,
ConfideHomeFiterItemBean("1", ""),
ConfideHomeFiterItemBean("-1", ""),
ConfideHomeFiterItemBean().apply {
id = "-1"
name = ""
},
ConfideHomeFiterItemBean().apply {
id = "-1"
name = ""
},
ArrayList(),
ArrayList())
ArrayList()
)
}
override fun getContext(): Context {
......@@ -131,17 +159,18 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
*/
override fun onRefresh() {
//重置页
page = 2
page = 1
allFiltersBean!!.page = page
clearCacheData()
mPresenter.confideHomeRequest(true)
recommendList(page)
}
/**
* 上拉加载更多
*/
override fun onLoadMore() {
recommendList(page)
page++
recommendList(page + 1)
}
override fun recommendList(page: Int) {
......@@ -156,12 +185,12 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
} else if (page > 1) {
var listData = mConfideAdapter?.getList()
var notUidList = ArrayList<Int>()
if (listData!=null){
for (bean in listData){
if (listData != null) {
for (bean in listData) {
//列表类型数组
if (bean.type==5 && bean.body!=null){
for (bean in bean.body){
notUidList.add(bean.uid?:0)
if (bean.type == 5 && bean.body != null) {
for (bean in bean.body) {
notUidList.add(bean.uid ?: 0)
}
}
}
......@@ -172,6 +201,11 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
}
override fun initDataAndEvent() {
//来自首页倾诉红包入口
val isFromRed = intent.getBooleanExtra(IYDLRouterConstant.EXTRA_RED_PACKET, false)
val confidedId = intent.getStringExtra(IYDLRouterConstant.EXTRA_CONFIDEDID)
val doctorId = intent.getStringExtra(IYDLRouterConstant.EXTRA_DOCTORID)
isSplash = intent.getBooleanExtra("isSplash", false)
//初始化View
initView()
......@@ -181,26 +215,74 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
//显示加载中
// showProgressDialog()
//加载本地缓存
mPresenter.loadLocalData(this)
// mPresenter.loadLocalData(this)
rv_list.refresh()
initClick()
initQuickConsultDialog()
initStatus();
ModularServiceManager.provide(IConsultantService::class.java).showConfideListDialog(this)
ActionCountUtils.count("daoyi_advertisement_page|daoyi_advertisement_visit","17")
initStatusBar()
// ModularServiceManager.provide(IConsultantService::class.java).showConfideListDialog(this)
// ActionCountUtils.count("daoyi_advertisement_page|daoyi_advertisement_visit","17")
// Glide.with(this)
// .load(R.drawable.confide__free)
// .diskCacheStrategy(DiskCacheStrategy.RESOURCE)
// .into(confide_Free)
if (isFromRed) {
ToastUtil.toastLong(this@ConfideHomeActivity, "红包已领取成功 可立即点击拨打")
}
if (!confidedId.isNullOrBlank() && !doctorId.isNullOrBlank()) {
ConfideWebServiceImpl().connectionJava(
confidedId.toInt(),
3,
this@ConfideHomeActivity,
null
) {
showDoctorDetail(confidedId, doctorId)
}
}
}
private fun showDoctorDetail(confideId: String, doctorId: String) {
val url = HttpConfig.MH5_URL + ConfideRoute.h5ConfideIntro(confideId)+"&payPage=1"
ConfideBottomSheetDialogFragment()
.showBottomSheetDialog(this@ConfideHomeActivity, url, doctorId)
}
override fun onResume() {
super.onResume()
handleFree()
}
private fun handleFree() {
//登录了回来之后就不显示了
val isLogin = (findRouteService(IUserService::class.java).isLogin())
findViewById<View>(R.id.confide_Free).visibility = if (isLogin) View.GONE else View.VISIBLE
if (!isLogin) {
val controller: DraweeController = Fresco.newDraweeControllerBuilder()
.setUri(Uri.parse("res://drawable/" + R.drawable.first_order))
.setOldController(confide_Free.controller)
.setAutoPlayAnimations(true) // 是否自动播放Gif动画
.build()
confide_Free.controller = controller
}
if (isLogin) {
findViewById<View>(R.id.confideRed).visibility =
if (listenFree) View.VISIBLE else View.GONE
(quick_consult_btn.layoutParams as? ViewGroup.MarginLayoutParams)?.rightMargin =
if (listenFree) dp48 / 2 else 0
}
}
/**
* 初始化状态栏位置
*/
private fun initStatus() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {//4.4以下不支持状态栏变色
StatusBarUtils.setTransparentForImageView(this, null)
val statusBarHeight = StatusBarUtils.getStatusBarHeight(this)
val lp1 = rl_confide_title_layout.layoutParams as LinearLayout.LayoutParams
lp1.height = (RxImageTool.dp2px(48f) + statusBarHeight)
rl_confide_title_layout.setPadding(0, statusBarHeight, 0, 0)
private fun initStatusBar() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
window?.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS)
window?.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
window?.statusBarColor = Color.WHITE
window?.decorView?.systemUiVisibility = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
}
}
......@@ -211,15 +293,29 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
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) {
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
quick_consult_card.visibility = View.VISIBLE
}else {
quick_consult_card.visibility = View.GONE
}
// val layoutManager: RecyclerView.LayoutManager = recyclerView?.layoutManager!!
// val linearManager = layoutManager as LinearLayoutManager
// if (linearManager is LinearLayoutManager) {
// val firstItemPosition = linearManager.findFirstCompletelyVisibleItemPosition()
// if (firstItemPosition > 3) {
// quick_consult_card.visibility = View.VISIBLE
// }else {
// quick_consult_card.visibility = View.GONE
// }
// }
}
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
super.onScrolled(recyclerView, dx, dy)
if (dy <= 0) {
//向上滚动恢复显示
quick_consult_card.visibility = View.VISIBLE
} else {
//向下滚动隐藏
quick_consult_card.visibility = View.GONE
}
}
})
......@@ -229,10 +325,20 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
* 初始化一键倾诉浮层的点击事件
*/
private fun initClick() {
quick_consult_btn.setOnClickListener {
quickConsultUrl?.let {
mConfideEvent?.categoryClick(quickConsultUrl)
quick_consult_card.setOnClickListener {
ActionCountUtils.record("listen_counselor_list_page", "akey_consult_icon_click")
if (!PhoneCallIn.loginByOneKeyLogin(this, true)) {
return@setOnClickListener
}
bottomSheetDialogFragment = ConfideBottomSheetDialogFragment()
bottomSheetDialogFragment?.showBottomSheetDialog(
this as FragmentActivity,
HttpConfig.MH5_URL + ConfideRoute.h5ConfideIntro("0"),
"0",
true
)
}
}
......@@ -242,15 +348,24 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
}
img_mine.setOnClickListener {
//跳转倾诉列表
if (!PhoneCallIn.loginByOneKeyLogin(this,true)) {
ActionCountUtils.record("listen_counselor_list_page", "topright_corner_icon_click", "1")
if (!PhoneCallIn.loginByOneKeyLogin(this, true)) {
return@setOnClickListener
}
BuryPointUtils.getInstance().createMap()
.put("mine_name", "倾诉记录")
.burryPoint("mine")
val h5Paramsqing = H5Params(YDL_H5 + "confideOrderList", null)
NewH5Activity.start(this, h5Paramsqing)
}
findViewById<View>(R.id.img_customer)?.setOnClickListener {
ActionCountUtils.record("listen_counselor_list_page", "topright_corner_icon_click", "2")
val imService = findRouteService(IImService::class.java)
imService.startP2PXiaoYi(this)
}
findViewById<View>(R.id.img_help)?.setOnClickListener {
ActionCountUtils.record("listen_counselor_list_page", "topright_corner_icon_click", "3")
val params = H5Params("https://activity.yidianling.com/activity/qs", "")//倾诉指南
params.isShowMenu = true
NewH5Activity.start(this, params)
}
ll_bar_root.setOnClickListener {
}
......@@ -277,7 +392,9 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
if (null == mConfideAdapter) {
mConfideAdapter = ConfideHomeAdapter(ConfideHomeActivity@ this, mConfideEvent!!, this)
}
val layoutManager = WrapContentLinearLayoutManager(this, WrapContentLinearLayoutManager.VERTICAL, false)
rv_list.addItemDecoration(FilterItemDecoration())
val layoutManager =
WrapContentLinearLayoutManager(this, WrapContentLinearLayoutManager.VERTICAL, false)
rv_list.layoutManager = layoutManager
rv_list.setRefreshProgressStyle(ProgressStyle.BallSpinFadeLoader)
rv_list.setRefreshProgressStyle(ProgressStyle.BallSpinFadeLoader)
......@@ -292,9 +409,8 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
override fun confideHomeResponse(list: MutableList<ConfideHomeDataBean>) {
initParam()
hideError()
updateCacheData(list)
cacheList?.addAll(0, list)
updateAdapter()
updateQuickConsultUrl()
setSuspendListener()
v_filterView.refreshView()
}
......@@ -303,7 +419,7 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
* 设置筛选模块悬浮顶部监听数据
*/
private fun setSuspendListener() {
listSuspendListener?.setFilterView(v_filterView)
listSuspendListener?.setFilterView(v_filterView, vFilterLine)
listSuspendListener?.setSectionAdapter(mConfideAdapter!!)
}
......@@ -313,18 +429,6 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
}
/**
* 更新一键倾诉按钮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() {
......@@ -354,39 +458,11 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
}
/**
* 更新缓存数据
*/
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
page = 1
if (null == cacheList) {
cacheList = ArrayList()
}
......@@ -428,7 +504,7 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
dismissProgressDialog()
rv_list.loadMoreComplete()
bean.recommendId = page
if(bean.body?.size?:0==0) {
if (bean.body?.size ?: 0 == 0) {
rv_list.loadMoreComplete()
mConfideAdapter!!.notifyDataSetChanged()
return
......@@ -453,6 +529,10 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
// rv_list.loadMoreComplete()
// }
mConfideAdapter!!.notifyDataSetChanged()
if (!bean.body.isNullOrEmpty()) {
listenFree = bean.body[0].listenFree ?: false
handleFree()
}
}
/**
......@@ -482,34 +562,67 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
listScrollListener?.moveToPosition(rv_list)
}
override fun showSortPopupWindow(v_line_top: View, tvSort: DrawableRightTextView, bodyBean: ConfideHomeBodyBean?) {
override fun showSortPopupWindow(
v_line_top: View,
tvSort: DrawableRightTextView,
bodyBean: ConfideHomeBodyBean?
) {
ActionCountUtils.record("listen_counselor_list_page", "choice_filter_click")
if (null == allFiltersBean) {
return
}
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?) {
mConfideEvent?.showSortPopupWindow(
v_line_top,
v_filterView,
bodyBean,
allFiltersBean!!,
mConfideAdapter!!
)
}
override fun showSexAgePopupWindow(
v_line_top: View,
tvSexAge: DrawableRightTextView,
bodyBean: ConfideHomeBodyBean?
) {
ActionCountUtils.record("listen_counselor_list_page", "choice_filter_click")
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?) {
mConfideEvent?.showSexAgePopupWindow(
v_line_top,
v_filterView,
bodyBean,
allFiltersBean!!,
mConfideAdapter!!
)
}
override fun showGoodPopupWindow(
v_line_top: View,
tvGood: DrawableRightTextView,
bodyBean: ConfideHomeBodyBean?
) {
ActionCountUtils.record("listen_counselor_list_page", "choice_filter_click")
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!!)
mConfideEvent?.showGoodPopupWindow(
v_line_top,
v_filterView,
bodyBean,
allFiltersBean!!,
mConfideAdapter!!
)
}
private fun showError() {
......@@ -521,7 +634,7 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
rv_list.visibility = View.VISIBLE
}
override fun showError1(msg: String?){
override fun showError1(msg: String?) {
rv_list.loadMoreComplete()
msg?.let {
......
......@@ -4,12 +4,14 @@ import android.content.Context
import androidx.recyclerview.widget.RecyclerView
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.LinearLayoutManager
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.*
import com.ydl.ydlcommon.utils.DisplayUtils
/**
* @author yuanwai
......@@ -73,17 +75,26 @@ class ConfideHomeAdapter(private val mContext: Context,
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
when (viewType) {
//banner
IConfideHomeConfig.TYPE_BANNER -> {
return BannerViewHolder(ConfideHomeBannerView(parent.context, confideHomeEvent))
}
// IConfideHomeConfig.TYPE_BANNER -> {
// return BannerViewHolder(ConfideHomeBannerView(parent.context, confideHomeEvent))
// }
//最近倾诉
IConfideHomeConfig.TYPE_RECENTLY_CONFIDED -> {
return ConsultViewHolder(ConfideHomeRecentView(parent.context, confideHomeEvent))
// return ConsultViewHolder(ConfideHomeRecentView(parent.context, confideHomeEvent))
val recyclerView = RecyclerView(parent.context)
recyclerView.layoutParams = ViewGroup.MarginLayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT
).apply {
leftMargin = DisplayUtils.dip2px(parent.context, 4F)
rightMargin = DisplayUtils.dip2px(parent.context, 4F)
}
//分类
IConfideHomeConfig.TYPE_CATEGORY -> {
return CategoryViewHolder(ConfideHomeCategoryView(parent.context, confideHomeEvent, confideHomeView))
return RecentConfideHolder(recyclerView)
}
//分类
// IConfideHomeConfig.TYPE_CATEGORY -> {
// return CategoryViewHolder(ConfideHomeCategoryView(parent.context, confideHomeEvent, confideHomeView))
// }
//筛选模块
IConfideHomeConfig.TYPE_RECOMMEND_FILTER -> {
return FilterViewHolder(ConfideHomeFilterView(parent.context, confideHomeView))
......@@ -92,6 +103,17 @@ class ConfideHomeAdapter(private val mContext: Context,
IConfideHomeConfig.TYPE_RECOMMEND -> {
return RecommendViewHolder(ConfideHomeRecommendView(confideHomeView, parent.context, confideHomeEvent))
}
IConfideHomeConfig.TYPE_VIDEO_SHOW -> {
val recyclerView = RecyclerView(parent.context)
recyclerView.layoutParams = ViewGroup.MarginLayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT
).apply {
leftMargin = DisplayUtils.dip2px(parent.context, 6F)
rightMargin = DisplayUtils.dip2px(parent.context, 6F)
}
return VideoShowHolder(recyclerView)
}
// //听声寻人
// IConfideHomeConfig.TYPE_SOUND -> {
//// return ConfideHomeListenAndFoundViewHolder(ConfideHomeListenAndFoundView(parent.context, confideHomeEvent))
......@@ -103,25 +125,35 @@ class ConfideHomeAdapter(private val mContext: Context,
}
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) =
if (holder is BannerViewHolder && null != holder.bannerView) {
/*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) {
} 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) {
} else if (holder is RecentConfideHolder) {
//最近倾诉
holder.consultView!!.initData(mListData!![position])
holder.rv.layoutManager =
LinearLayoutManager(holder.itemView.context, RecyclerView.HORIZONTAL, false)
val recentBody = mListData!![position].body
val data = recentBody?.map { ItemVideoShowViewModel().mapOf(it) } ?: emptyList()
holder.rv.adapter = RecentConfideAdapter(data, confideHomeEvent)
// holder.consultView!!.initData(mListData!![position])
} else if (holder is RecommendViewHolder && null != mListData!![position] && null != mListData!![position].body && !mListData!![position].body!!.isEmpty()) {
//为你推荐
holder.confideHomeRecommendView.initData(mListData!![position].body!![0], position, mListData!![position].recommendId)
} else if (holder is VideoShowHolder) {
holder.rv.layoutManager =
LinearLayoutManager(holder.itemView.context, RecyclerView.HORIZONTAL, false)
val recentBody = mListData!![position].body
holder.rv.adapter = VideoShowAdapter(recentBody, confideHomeEvent)
} else if (holder is EmptyViewHolder) {
} else {
......@@ -184,4 +216,6 @@ class ConfideHomeAdapter(private val mContext: Context,
view = itemView
}
}
class VideoShowHolder(val rv: RecyclerView) : RecyclerView.ViewHolder(rv)
class RecentConfideHolder(val rv: RecyclerView) : RecyclerView.ViewHolder(rv)
}
\ No newline at end of file
package com.ydl.confide.home.adapter
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.databinding.DataBindingUtil
import androidx.databinding.ObservableField
import androidx.databinding.ObservableInt
import androidx.recyclerview.widget.RecyclerView
import com.ydl.confide.R
import com.ydl.confide.databinding.ItemConfideHomeRecentBinding
import com.ydl.confide.databinding.ItemVideoShowBinding
import com.ydl.confide.home.bean.ConfideHomeBodyBean
import com.ydl.confide.home.event.IConfideHomeEvent
import com.ydl.confide.intro.BindingViewHolder
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
class VideoShowAdapter(private val data: List<ConfideHomeBodyBean>?, private val event: IConfideHomeEvent) :
RecyclerView.Adapter<BindingViewHolder<ItemVideoShowBinding>>() {
private val dataList: List<ItemVideoShowViewModel> = data?.map { ItemVideoShowViewModel().mapOf(it) } ?: emptyList()
override fun onCreateViewHolder(
parent: ViewGroup,
viewType: Int
): BindingViewHolder<ItemVideoShowBinding> {
val layoutInflater = LayoutInflater.from(parent.context)
val binding =
DataBindingUtil.inflate<ItemVideoShowBinding>(layoutInflater, R.layout.item_video_show, parent, false)
return BindingViewHolder(binding)
}
override fun onBindViewHolder(holder: BindingViewHolder<ItemVideoShowBinding>, position: Int) {
val itemVideoShowViewModel = dataList[position]
holder.binding.item = itemVideoShowViewModel
holder.itemView.setOnClickListener {
ActionCountUtils.record("listen_counselor_list_page", "video_card_click")
event.videoShowClick(position, data)
}
}
override fun getItemCount() = dataList.size
}
class RecentConfideAdapter(val data: List<ItemVideoShowViewModel>, private val event: IConfideHomeEvent) :
RecyclerView.Adapter<BindingViewHolder<ItemConfideHomeRecentBinding>>() {
override fun onCreateViewHolder(
parent: ViewGroup,
viewType: Int
): BindingViewHolder<ItemConfideHomeRecentBinding> {
val layoutInflater = LayoutInflater.from(parent.context)
val binding =
DataBindingUtil.inflate<ItemConfideHomeRecentBinding>(
layoutInflater,
R.layout.item_confide_home_recent,
parent,
false
)
return BindingViewHolder(binding)
}
override fun onBindViewHolder(holder: BindingViewHolder<ItemConfideHomeRecentBinding>, position: Int) {
val itemVideoShowViewModel = data[position]
holder.binding.item = itemVideoShowViewModel
holder.itemView.setOnClickListener {
ActionCountUtils.record("listen_counselor_list_page", "head_portrait_click", "1")
ActionCountUtils.record(
"listen_counselor_popupwindows_page",
"popupwindows_page_visit",
itemVideoShowViewModel.confideId ?: "", "2"
)
event.consultantClick(
itemVideoShowViewModel.doctorId,
itemVideoShowViewModel.confideId,
itemVideoShowViewModel.uid
)
}
}
override fun getItemCount() = data.size
}
class ItemVideoShowViewModel {
val name = ObservableField<String>("")
val coverUrl = ObservableField<String>("")
val videoCoverUrl = ObservableField<String>("")
val state = ObservableInt()
var doctorId: String? = null
var confideId: String? = null
var uid: String? = null
}
internal fun ItemVideoShowViewModel.mapOf(bean: ConfideHomeBodyBean): ItemVideoShowViewModel {
name.set(bean.videoTitle ?: "")
coverUrl.set(bean.confidedIcon)
if (bean.coverVideoPicture.isNullOrBlank()) {
videoCoverUrl.set(bean.coverPicture)
} else {
videoCoverUrl.set(bean.coverVideoPicture)
}
state.set(bean.confideLine ?: 0)
doctorId = bean.doctorId
confideId = bean.confidedId
uid = bean.uid?.toString()
return this
}
......@@ -7,60 +7,89 @@ package com.ydl.confide.home.bean
* @Company 壹点灵
* @date 2018/8/10
*/
data class ConfideHomeBodyBean(
class ConfideHomeBodyBean {
/**
* 公共参数
*/
val linkUrl : String?,
var linkUrl: String? = null
//倾诉Id
val confidedId : String?,
var confidedId: String? = null
//专家Id(专家编号)
val doctorId : String?,
var doctorId: String? = null
//专家的uid
val uid : Int?,
var uid: Int? = null
//咨询师姓名
val confidedName : String?,
var confidedName: String? = null
var videoTitle: String? = null
//咨询师性别 1.男 2.女
val confideSex : Int = 1,
var confideSex: Int = 1
//对你留言
val confideContent : String?,
var confideContent: String? = null
//咨询师头像地址
val confidedIcon : String?,
var confidedIcon: String? = null
//是否在线 //1在线 2离线 3通话中 4继续倾诉
val confideLine : Int?,
var confideLine: Int? = null
//已聆听文案
val confideHearNum : String?,
var confideHearNum: String? = null
//历史倾听记录
val confideHistory : String?,
var confideHistory: String? = null
//是否为播放状态
var confideIsPlay : Boolean=false,
var confideIsPlay: Boolean = false
//音频播放地址
val confideVoice:String?,
var confideVoice: String? = null
//副标题(底部更多文案)
val subTitle : String?,
var subTitle: String? = null
//咨询师标题
val confidedTitle:String?,
var confidedTitle: String? = null
var title: String? = null
//副标题点击事件
val subLinkUrl : String?,
var subLinkUrl: String? = null
//咨询师背景图片
val confideBgUrl : String?,
var confideBgUrl: String? = null
//价格
val confideFee : String?,
var confideFee: String? = null
//红包金额
val couponMoney : String?,
var couponMoney: String? = null
//新用户优惠文案
val couponText : String?,
var couponText: String? = null
var videoUrl: String? = null
var coverVideoPicture: String? = null
var coverPicture: String? = null
/**
* banner数据
*/
//banner id
val bannerId : String?,
var bannerId: String? = null
//banner 图片地址
val bannerImageUrl : String?,
var bannerImageUrl: String? = null
//banner标题(用于数据埋点)
val bannerTitle : String?,
var bannerTitle: String? = null
//跳转地址
val bannerLinkUrl : String?,
var bannerLinkUrl: String? = null
/**
* 最近倾诉数据说明(查看公共参数说明)
*/
......@@ -69,40 +98,47 @@ data class ConfideHomeBodyBean(
* 分类参数
*/
//分类Id
val categoryId : String?,
var categoryId: String? = null
//分类名称
val categoryName : String?,
var categoryName: String? = null
//分类类型(1.倾诉指南,2.专业师资)
val categoryType : Int?,
var categoryType: Int? = null
//分类图片地址
val categoryIcon : String?,
var categoryIcon: String? = null
//分类内容
val categoryContent : String?,
var categoryContent: String? = null
/**
* 为你推荐筛选模块数据
*/
//筛选标题
val filterName : String?,
var filterName: String? = null
//筛选类型(1.综合排序 2.性别年龄 3.擅长方向)
val filterType : Int?,
var filterType: Int? = null
//筛选数据集
val group : ArrayList<ConfideHomeBodyGroupItemBean>?,
var group: List<ConfideHomeBodyGroupItemBean>? = emptyList()
// //性别筛选标题
// val sexTitle : String?,
// var sexTitle : String?,
// //性别筛选数据集
// val sexData : ArrayList<ConfideHomeFiterItemBean>?,
// var sexData : ArrayList<ConfideHomeFiterItemBean>?,
// //年龄筛选标题
// val ageTitle : String?,
// var ageTitle : String?,
// //年龄筛选数据集
// val ageData : ArrayList<ConfideHomeFiterItemBean>?,
// var ageData : ArrayList<ConfideHomeFiterItemBean>?,
// //擅长方向标题
// val goodTitle : String?,
// var goodTitle : String?,
// //擅长方向筛选数据集
// val goodData : ArrayList<ConfideHomeFiterItemBean>?,
// var goodData : ArrayList<ConfideHomeFiterItemBean>?,
/**
* 为你推荐数据说明
*/
val confidedTag : List<String>?,
var confidedTag: List<String>? = null
/**
* 听声寻人数据说明(请查看公共参数说明)
*/
......@@ -111,9 +147,13 @@ data class ConfideHomeBodyBean(
* 最佳倾诉榜单数据说明
*/
//倾诉统计文案(8513人)
val confideNum : String?,
var confideNum: String? = null
//接通率
val confideConnection : String?,
var confideConnection: String? = null
//
var bodyData : List<ConfideHomeBodyBean>?
)
\ No newline at end of file
var bodyData: List<ConfideHomeBodyBean>? = null
var confidePraiseScore: String? = null//新增评分字段
var listenFree: Boolean? = null//新增倾诉免费标识字段
}
\ No newline at end of file
......@@ -7,5 +7,7 @@ package com.ydl.confide.home.bean
* @Company 壹点灵
* @date 2018/10/15
*/
data class ConfideHomeBodyGroupItemBean(val title : String?,
val data : ArrayList<ConfideHomeFiterItemBean>?)
\ No newline at end of file
class ConfideHomeBodyGroupItemBean {
var title: String? = null
var data: ArrayList<ConfideHomeFiterItemBean>? = null
}
\ No newline at end of file
......@@ -30,8 +30,4 @@ data class ConfideHomeDataBean(
/**
* 为你推荐Id 本地使用 用于区分音频播放区域
*/
var recommendId : Int,
/**
* 是否显示分割线 0.不显示 1.显示
*/
val diviLine : Int?)
\ No newline at end of file
var recommendId : Int)
\ No newline at end of file
......@@ -7,12 +7,14 @@ package com.ydl.confide.home.bean
* @Company 壹点灵
* @date 2018/9/22
*/
data class ConfideHomeFiterItemBean(
class ConfideHomeFiterItemBean {
/**
* 筛选id
*/
var id : String?,
var id: String? = null
/**
* 筛选名称
*/
var name : String?)
\ No newline at end of file
var name: String? = null
}
\ No newline at end of file
package com.ydl.confide.home.bean
class DialStatus {
var confideLine: Int? = null
var remainingTime: RemainingTime? = null
}
class RemainingTime {
var remainingTime: Long? = null//秒
var listenerUid: String? = null
var listenOrderId: String? = null
}
\ No newline at end of file
......@@ -19,7 +19,7 @@ interface IConfideHomeConfig{
const val TYPE_RECOMMEND_FILTER = 4
const val TYPE_RECOMMEND = 5
const val TYPE_SOUND = 6
const val TYPE_CONSULTANT = 7
const val TYPE_VIDEO_SHOW = 7
const val TYPE_FOOTER = 999
/**
* section id. 与上面相对应
......
......@@ -87,10 +87,6 @@ interface IConfideHomeContract{
interface Presenter : IPresenter<View> {
/**
* 加载本地缓存
*/
fun loadLocalData(context: Context)
/**
* 倾诉首页数据请求
*/
fun confideHomeRequest(isRefresh:Boolean = true)
......
package com.ydl.confide.home.event
data class ChangeAnotherExpertEvent(
var doctorID: String,
var title: String,
var uid: String
)
class ConfideDialogEvent(val show: Int)
\ No newline at end of file
......@@ -4,9 +4,13 @@ import android.app.Activity
import android.content.Context
import android.content.Intent
import android.net.Uri
import androidx.appcompat.app.AppCompatActivity
import android.text.TextUtils
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.FragmentActivity
import com.alibaba.fastjson.JSON
import com.ydl.confide.api.ConfideRoute
import com.ydl.confide.home.ConfideBottomSheetDialogFragment
import com.ydl.confide.home.ConfideHomeActivity
import com.ydl.confide.home.adapter.ConfideHomeAdapter
import com.ydl.confide.home.bean.ConfideHomeAllFiltersBean
......@@ -27,11 +31,14 @@ import com.ydl.media.view.PlayerFloatView
import com.ydl.ydl_router.manager.YDLRouterManager
import com.ydl.ydl_router.manager.YDLRouterParams
import com.ydl.ydlcommon.base.BaseActivity
import com.ydl.ydlcommon.base.config.HttpConfig
import com.ydl.ydlcommon.modular.route
import com.ydl.ydlcommon.router.IYDLRouterConstant
import com.ydl.ydlcommon.utils.remind.ToastHelper
import com.yidianling.common.tools.ToastUtil
import com.yidianling.im.api.bean.IMRequestCallback
/**
* @author yuanwai
* @描述:倾诉首页事件处理类
......@@ -125,8 +132,23 @@ class ConfideHomeEventImpl(context: Context, var confideHomeView: IConfideHomeCo
* 最佳倾诉榜单--点我倾诉
* @param linkUrl 跳转地址
*/
override fun consultantClick(linkUrl: String?) {
link(linkUrl)
override fun consultantClick(doctorId: String?, confideId: String?, uid: String?) {
confideId?.let {
ConfideBottomSheetDialogFragment()
.showBottomSheetDialog(
mContext as FragmentActivity,
HttpConfig.MH5_URL + ConfideRoute.h5ConfideIntro(it),
doctorId!!, uid = uid
)
}
}
override fun videoShowClick(index: Int, data: List<ConfideHomeBodyBean>?) {
val dataJson = if (data != null) JSON.toJSONString(data) else null
AudioPlayer.get().playPause()
PlayerFloatHelper.updatePlayState()
route(mContext, ConfideRoute.R_VIDEO_SHOW, "initPos" to index, "initData" to dataJson)
}
/**
......@@ -154,10 +176,11 @@ class ConfideHomeEventImpl(context: Context, var confideHomeView: IConfideHomeCo
initConfidePlayerListener()
}
override fun playVoice(type: Int?, index: Int?, recommendId: Int, playUrl: String?, name: String?) {
override fun playVoice(type: Int?, index: Int?, recommendId: Int, playUrl: String?, name: String?,confideIcon:String?) {
val mu = Music()
mu.title = name
mu.path = playUrl
mu.coverPath=confideIcon
AudioPlayer.get().singlePlay(mu)
if (PlayerFloatHelper.isShow(mContext!!)) {
if (AudioPlayer.get().playMode.value() == 1) {
......@@ -215,9 +238,6 @@ class ConfideHomeEventImpl(context: Context, var confideHomeView: IConfideHomeCo
//听声寻人
IConfideHomeConfig.TYPE_SOUND -> {
}
//咨询师推荐
IConfideHomeConfig.TYPE_CONSULTANT -> {
}
}
}
......@@ -258,10 +278,11 @@ class ConfideHomeEventImpl(context: Context, var confideHomeView: IConfideHomeCo
* 私聊
*/
override fun toChatForMsg(doctorId: String?) {
if (null != mContext && mContext is Activity){
PhoneCallIn.loginByOneKeyLogin(mContext as Activity,true)
if (null != mContext && mContext is Activity) {
if (!PhoneCallIn.loginByOneKeyLogin(mContext as Activity, true)) {
return
}
}
if (mContext is AppCompatActivity && !TextUtils.isEmpty(doctorId)) {
PhoneCallIn.startChat(mContext as AppCompatActivity, doctorId!!, 0x001, 0)
}
......@@ -328,9 +349,9 @@ class ConfideHomeEventImpl(context: Context, var confideHomeView: IConfideHomeCo
return
}
var sortPopup: ConfideHomeSortPopupWindow? = null
if (bodyBean.group != null && !bodyBean.group.isEmpty() && null != bodyBean.group[0].data && !bodyBean.group[0].data!!.isEmpty()) {
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 {
sortPopup = ConfideHomeSortPopupWindow(mContext!!, bodyBean.group!![0].data!!, allFiltersBean!!.selectSort!!, object : ConfideHomeSortPopupWindow.OnSortItemSelectedListener {
override fun onSortItemSelected(sortItem: ConfideHomeFiterItemBean) {
//更改小图标
......@@ -363,17 +384,17 @@ class ConfideHomeEventImpl(context: Context, var confideHomeView: IConfideHomeCo
* @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()))) {
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!!)
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!!)
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)
......@@ -414,8 +435,8 @@ class ConfideHomeEventImpl(context: Context, var confideHomeView: IConfideHomeCo
* @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!!)
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])) {
......
......@@ -73,7 +73,9 @@ interface IConfideHomeEvent {
* 咨询师推荐--点我倾诉
* @param linkUrl 跳转地址
*/
fun consultantClick(linkUrl: String?)
fun consultantClick(doctorId: String?, confideId: String?, uid: String?)
fun videoShowClick(index: Int, data: List<ConfideHomeBodyBean>?)
/**
* 咨询师推荐--更多情感恋爱专家
......@@ -97,7 +99,7 @@ interface IConfideHomeEvent {
* @param playUrl 播放地址
* @param name 咨询师姓名
*/
fun playVoice(type: Int?, index: Int?, recommendId: Int, playUrl: String?, name: String?)
fun playVoice(type: Int?, index: Int?, recommendId: Int, playUrl: String?, name: String?,confideIcon:String?)
/**
* 重播
......
......@@ -2,6 +2,7 @@ package com.ydl.confide.home.http
import com.ydl.confide.home.bean.ConfideConnectResponse
import com.ydl.confide.home.bean.ConfideHomeDataBean
import com.ydl.confide.home.bean.DialStatus
import com.ydl.ydlcommon.base.config.YDL_DOMAIN
import com.ydl.ydlcommon.base.config.YDL_DOMAIN_JAVA
import com.ydl.ydlcommon.data.http.BaseAPIResponse
......@@ -33,4 +34,16 @@ interface ConfideHomeApi {
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA, "Content-Type:application/json")
@GET("auth/listen/dial")
fun connectJava(@QueryMap params: Map<String, String>): Observable<BaseAPIResponse<ConfideConnectResponse>>
// 1=在线 3-通话中 2-离线
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
@GET("auth/listen/dialchangestatus")
fun getDialStatus(@Query("doctorId") doctorId: String): Observable<BaseAPIResponse<DialStatus>>
@GET
fun recommendDoctor(
@Url url: String,
@Query("page") page: Int,
@Query("businessSource") source: Int
): Observable<BaseAPIResponse<ConfideHomeDataBean>>
}
\ No newline at end of file
......@@ -35,7 +35,7 @@ class ConfideHomeHttpImpl private constructor() : IConfideHomeHttp {
override fun confideHomeRequest(): Observable<BaseAPIResponse<MutableList<ConfideHomeDataBean>>> {
return RxUtils.mapObservable(ConfideHomeParam(0))
.flatMap {
confideHomeApi.confideHome(HttpConfig.JAVA_BASE_URL + "auth/listen/home", 2)
confideHomeApi.confideHome(HttpConfig.JAVA_BASE_URL + "auth/listen/nhome?listenVersion=2.0", 2)
}
}
......
......@@ -2,6 +2,7 @@ package com.ydl.confide.home.listener
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.ydl.confide.home.widget.ConfideHomeFilterView
import com.yidianling.common.tools.LogUtil
import com.yidianling.common.tools.RxImageTool
......@@ -51,7 +52,9 @@ class ConfideHomeRecycleViewListener : RecyclerView.OnScrollListener() {
fun moveToPosition(mRecyclerView: RecyclerView){
mRecyclerView.scrollBy(0, 1)
var top = mRecyclerView.getChildAt(mIndex).top
val childAt = mRecyclerView.getChildAt(mIndex)
if (childAt !is ConfideHomeFilterView) return
val top = childAt.top
if(top==0 || top==1){
//已滚动到顶部
......
......@@ -23,11 +23,13 @@ class ConfideHomeRecyleSuspendListener : RecyclerView.OnScrollListener() {
private var mSuspensionHeight: Int = RxImageTool.dip2px(48f)
private var filterView: ConfideHomeFilterView? = null
private var divView: View? = null
private var adapter: ConfideHomeAdapter? = null
fun setFilterView(filterView: ConfideHomeFilterView) {
fun setFilterView(filterView: ConfideHomeFilterView, divView: View) {
this.filterView = filterView
this.divView = divView
}
fun setSectionAdapter(adapter: ConfideHomeAdapter) {
......@@ -56,14 +58,17 @@ class ConfideHomeRecyleSuspendListener : RecyclerView.OnScrollListener() {
if (view != null) {
if (view.top <= mSuspensionHeight) {
filterView!!.visibility = View.VISIBLE
divView?.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
divView?.visibility = View.VISIBLE
}else {
filterView!!.visibility = View.INVISIBLE
divView?.visibility = View.INVISIBLE
}
}
}
\ No newline at end of file
......@@ -5,20 +5,21 @@ import android.app.Application
import android.content.Context
import android.content.Intent
import android.net.Uri
import androidx.fragment.app.DialogFragment
import android.text.TextUtils
import androidx.fragment.app.DialogFragment
import androidx.fragment.app.FragmentActivity
import com.alibaba.android.arouter.facade.annotation.Route
import com.google.gson.Gson
import com.ydl.audioim.YDLavManager
import com.ydl.audioim.widget.AxbConfirmDialog
import com.ydl.confide.api.IConfideService
import com.ydl.confide.home.ConfideBottomSheetDialogFragment
import com.ydl.confide.home.ConfideHomeActivity
import com.ydl.webview.TellData
import com.ydl.ydlcommon.base.BaseApp
import com.ydl.ydlcommon.base.config.YDLConstants
import com.ydl.ydlcommon.ui.Loading
import com.ydl.ydlcommon.utils.YDLCacheUtils
import com.yidianling.common.tools.RxSPTool
import com.yidianling.common.tools.ToastUtil
/**
* Created by haorui on 2019-12-11 .
......@@ -52,6 +53,7 @@ class ConfdieServiceImpl : IConfideService {
}
override fun connectionJava(id: Int, type: Int, activity: Activity, tellData: String?, callType: String?) {
Loading.show(activity)
val myTellData: TellData? = if (tellData == null ) null else Gson().fromJson(tellData, TellData::class.java)
ConfideWebServiceImpl().connectionJava(id, type, activity, myTellData, callType)
}
......@@ -116,5 +118,8 @@ class ConfdieServiceImpl : IConfideService {
}
override fun showExpertDetailDialog(activity: FragmentActivity, jumpUrl: String, doctorId: String, uid: String) {
ConfideBottomSheetDialogFragment().showBottomSheetDialog(activity, jumpUrl, doctorId, false, uid)
}
}
\ No newline at end of file
......@@ -2,6 +2,7 @@ package com.ydl.confide.home.modular.service
import android.annotation.SuppressLint
import android.app.Activity
import android.content.Context
import android.content.Intent
import android.net.Uri
import android.text.TextUtils
......@@ -17,6 +18,7 @@ import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity
import com.ydl.webview.TellData
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.ui.Loading
import com.ydl.ydlcommon.utils.remind.ToastHelper
import com.ydl.ydlcommon.view.dialog.CommonDialog
import com.yidianling.common.tools.ToastUtil
......@@ -25,6 +27,7 @@ import com.yidianling.ydl_pay.pay.payDialog.CallBack
import com.yidianling.ydl_pay.pay.payDialog.ConfidePayParams
import com.yidianling.ydl_pay.pay.payDialog.PayDialog
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
import io.reactivex.schedulers.Schedulers
/**
......@@ -156,9 +159,72 @@ class ConfideWebServiceImpl {
})
}
fun connectionJava(
id: Int,
type: Int,
activity: Context,
callType: String?,
otherwise: (() -> Unit)? = null
): Disposable {
Loading.show(activity)
return ConfideHomeDataManager.getHttp()
.connectionJava(ConnectParamJava("" + id, "" + type, callType))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({
Loading.close()
if ("200" == it.code) {
if (it.data?.dialDetail?.dialStatus != null) {
if (100007 == it.data?.dialDetail?.dialStatus) {
//支付弹窗
otherwise?.invoke()
} else if (100008 == it.data?.dialDetail?.dialStatus) {
CommonDialog(activity)
.setCancelAble(false)
.setMessage(FinalString.TEL_BINDPHONE)
.setLeftOnclick("忍痛放弃", null)
.setRightClick("果断绑定") { view ->
try {
ModularServiceManager.provide(IUserService::class.java)
.wxBindToInputhonePage(activity as Activity)
} catch (e: Exception) {
}
}
.show()
} else if (0 == it.data?.dialDetail?.dialStatus && it.data?.dialDetail?.callConnectType == 3) {
it.data?.dialDetail?.agoraExpertInfo ?: return@subscribe
if (!YDLavManager.isOnlineRtm) { // 判断如果账号在其它设备登录rtm是否在线
ToastUtil.toastShort("网络通话错误代码001")
return@subscribe
}
callAgora(
activity,
id,
it.data!!.dialDetail!!.agoraExpertInfo!!,
it.data.callId ?: "0",
it.data.listenOrderId ?: 0L,
null,
it.data.isShowAxb,
it.data?.dialDetail?.dialStatus.toString()
)
} else {
ToastHelper.show(it.data?.dialDetail?.dialReason ?: "连接失败")
}
} else {
ToastHelper.show(it.data?.dialDetail?.dialReason ?: "连接失败")
}
} else {
ToastHelper.show(it.msg)
}
}, {
ToastHelper.show(it.message ?: "连接失败")
})
}
//启动声网电话
private fun callAgora(
activity: Activity,
activity: Context,
confideId: Int,
expertInfo: ExpertInfoBean,
call_id: String,
......@@ -181,7 +247,8 @@ class ConfideWebServiceImpl {
expertInfo.remainingTime =
ExpertInfoBean.ListenRemainingTime(expertInfo.totalDuration);
}
YDLavManager.instances.callEventSave("10","用户点击拨打",expertInfo.channelId,"7")
YDLavManager.instances.callEventSave("10", "用户点击拨打", expertInfo.channelId, "7")
Loading.close()
ARouter.getInstance().build("/av/AudioHomeActivity")
.withString(IntentConstants.INTENT_EXPERT_HEAD_URL, expertInfo.expertHeadUrl)
.withString(IntentConstants.INTENT_EXPERT_NAME, expertInfo.expertName)
......
......@@ -2,14 +2,14 @@ package com.ydl.confide.home.popwindow
import android.content.Context
import android.graphics.drawable.BitmapDrawable
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.PopupWindow
import android.widget.TextView
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.ydl.confide.R
import com.ydl.confide.home.bean.ConfideHomeAllFiltersBean
import com.ydl.confide.home.bean.ConfideHomeFiterItemBean
......@@ -65,7 +65,10 @@ class ConfideHomeSexAgePopupWindow(context: Context, sexData: ArrayList<ConfideH
dismiss()
}
view.btnReset.setOnClickListener {
selectSex = ConfideHomeFiterItemBean("-1","")
selectSex = ConfideHomeFiterItemBean().apply {
id = "-1"
name = ""
}
mAllFiltersBean!!.selectSex = selectSex
initSexData(view,mAllFiltersBean!!)
sexAgeAdapter?.cleanSelectedGoods()
......@@ -81,7 +84,8 @@ class ConfideHomeSexAgePopupWindow(context: Context, sexData: ArrayList<ConfideH
private fun initData(sexData: ArrayList<ConfideHomeFiterItemBean>,ageData : ArrayList<ConfideHomeFiterItemBean>,allFiltersBean: ConfideHomeAllFiltersBean){
//初始化已选择性别数据
if (null == selectSex){
selectSex = ConfideHomeFiterItemBean("-1","")
selectSex = ConfideHomeFiterItemBean().apply { id="-1"
name=""}
}
if (null != allFiltersBean.selectSex){
selectSex!!.id = allFiltersBean.selectSex!!.id
......
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.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.RxUtils
import com.ydl.ydlcommon.data.http.ThrowableConsumer
import com.ydl.ydlcommon.mvp.base.BasePresenter
import com.ydl.ydlcommon.mvp.base.IView
import com.ydl.ydlcommon.utils.YDLAsyncUtils
import com.ydl.ydlcommon.utils.YDLCacheUtils
import com.yidianling.common.tools.RxNetTool
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.functions.Consumer
......@@ -26,54 +18,18 @@ import io.reactivex.functions.Consumer
* @Company 壹点灵
* @date 2018/8/10
*/
class ConfideHomePresenterImpl : BasePresenter<IConfideHomeContract.View,IConfideHomeContract.Model>(), IConfideHomeContract.Presenter{
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.showLoading()
}
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(false)
}
})
}
/**
* 请求首页数据
*/
override fun confideHomeRequest(isRefresh:Boolean) {
if (!RxNetTool.isConnected(mView.getContext())){
override fun confideHomeRequest(isRefresh: Boolean) {
if (!RxNetTool.isConnected(mView.getContext())) {
mView.confideHomeRequestFail()
return
}
......@@ -84,7 +40,6 @@ class ConfideHomePresenterImpl : BasePresenter<IConfideHomeContract.View,IConfid
.doFinally { mView.hideLoading() }
.subscribe(Consumer {
mView.confideHomeResponse(it)
updateCache(it)
}, object : ThrowableConsumer() {
override fun accept(msg: String) {
mView.confideHomeRequestFail()
......@@ -92,34 +47,11 @@ class ConfideHomePresenterImpl : BasePresenter<IConfideHomeContract.View,IConfid
})
}
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())){
override fun recommendList(param: ConfideRecommendParam) {
if (!RxNetTool.isConnected(mView.getContext())) {
mView.showError1("网络不给力")
return
}
......@@ -141,7 +73,7 @@ class ConfideHomePresenterImpl : BasePresenter<IConfideHomeContract.View,IConfid
* 为你推荐列表(翻页时调用)
*/
override fun recommendListMore(param: ConfideRecommendParam) {
if (!RxNetTool.isConnected(mView.getContext())){
if (!RxNetTool.isConnected(mView.getContext())) {
mView.showError1("网络不给力")
return
}
......
package com.ydl.confide.home.util
import android.content.Context
import androidx.core.content.ContextCompat
import androidx.appcompat.widget.AppCompatTextView
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.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 androidx.appcompat.widget.AppCompatTextView
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.ydl.confide.R
import com.ydl.confide.home.adapter.ConfideHomeAdapter
import com.ydl.confide.home.bean.ConfideHomeAllFiltersBean
......@@ -84,32 +84,12 @@ class ConfideHomeUtils {
* 数据重组
*/
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()) {
for ((index, dataBean) in list.withIndex()) {
//给隐藏的为你推荐筛选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)
}
}
......@@ -124,7 +104,7 @@ class ConfideHomeUtils {
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)
val recommendDataBean = ConfideHomeDataBean(dataBean.type, bodyList, dataBean.head, dataBean.footer, dataBean.recommendId)
list.add(recommendDataBean)
}
return list
......@@ -174,12 +154,6 @@ class ConfideHomeUtils {
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)
......@@ -254,10 +228,6 @@ class ConfideHomeUtils {
IConfideHomeConfig.TYPE_SOUND -> {
listenAndFoundData = resultBean
}
//最佳倾听榜单
IConfideHomeConfig.TYPE_CONSULTANT -> {
recommendExpertData = resultBean
}
}
}
......
package com.ydl.confide.home.util
import android.widget.TextView
import androidx.databinding.BindingAdapter
import com.ydl.confide.R
@BindingAdapter("confideLineText")
fun TextView.confideLineText(line: Int) {
when (line) {
1 -> {
text = "立即拨打"
}
2 -> {
text = "已离线"
}
3 -> {
text = "通话中"
}
4->{
text = "继续倾诉"
}
}
}
@BindingAdapter("confideLineRecentText")
fun TextView.confideLineRecentText(line: Int) {
when (line) {
1 -> {
text = "空闲"
setBackgroundResource(R.drawable.confide_bg_main_color)
}
2 -> {
text = "离线"
setBackgroundResource(R.drawable.confide_bg_color_666666)
}
3 -> {
text = "通话中"
setBackgroundResource(R.drawable.confide_bg_color_ff8f38)
}
else ->{
text = ""
background = null
}
}
}
\ No newline at end of file
......@@ -10,13 +10,13 @@ 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.ydl_image.module.GlideApp
import com.ydl.ydlcommon.utils.ScreenUtil
import com.yidianling.common.tools.RxImageTool
import kotlinx.android.synthetic.main.confide_recommend_expert_item_view.view.*
/**
......@@ -153,7 +153,7 @@ class ConfideHomeRecommendExpertItemView(mContext: Context, private var confideH
if (confideIsPlay) {
confideHomeEvent.pauseVoice()
} else {
confideHomeEvent.playVoice(IConfideHomeConfig.TYPE_CONSULTANT, position, bodyBean.confideVoice)
confideHomeEvent.playVoice(IConfideHomeConfig.TYPE_VIDEO_SHOW, position, bodyBean.confideVoice)
}
}
}
......@@ -202,11 +202,11 @@ class ConfideHomeRecommendExpertItemView(mContext: Context, private var confideH
*/
private fun setConfideTag(bodyBean: ConfideHomeBodyBean) {
flowlayout_tag.removeAllViews()
if (null == bodyBean.confidedTag || bodyBean.confidedTag.isEmpty()) {
if (null == bodyBean.confidedTag || bodyBean.confidedTag!!.isEmpty()) {
return
}
var i = 0
for (tag in bodyBean.confidedTag) {
for (tag in bodyBean.confidedTag!!) {
if (i > 4) break
var params = LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, dp16)
params.setMargins(0, 0, dp4, 0)
......@@ -243,7 +243,7 @@ class ConfideHomeRecommendExpertItemView(mContext: Context, private var confideH
private fun click(bodyBean: ConfideHomeBodyBean) {
when (bodyBean.confideLine) {//1在线 2离线 3通话中
1, 3, 4 -> {
confideHomeEvent.consultantClick(bodyBean.linkUrl)
confideHomeEvent.consultantClick(bodyBean.doctorId, bodyBean.confidedId, bodyBean.uid?.toString())
}
2 -> {
//跳转私聊 并发送自定义消息
......
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.blankj.utilcode.util.SpanUtils
import com.bumptech.glide.Glide
import com.bumptech.glide.load.engine.DiskCacheStrategy
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 kotlinx.android.synthetic.main.confide_recommend_view.view.*
import com.ydl.ydl_image.module.GlideApp
import com.ydl.ydlcommon.utils.Utils
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.yidianling.common.tools.RxImageTool
import kotlinx.android.synthetic.main.confide_recommend_view_new.view.*
/**
* @author yuanwai
......@@ -41,7 +40,7 @@ class ConfideHomeRecommendView(var view: IConfideHomeContract.View, context: Con
private fun initView() {
var params = FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
layoutParams = params
View.inflate(context, R.layout.confide_recommend_view, this)
View.inflate(context, R.layout.confide_recommend_view_new, this)
dp96 = RxImageTool.dip2px(96f)
dp16 = RxImageTool.dip2px(16f)
dp4 = RxImageTool.dip2px(4f)
......@@ -63,25 +62,63 @@ class ConfideHomeRecommendView(var view: IConfideHomeContract.View, context: Con
//设置名称
tv_name.text = bodyBean.confidedName
//设置性别
setSex(bodyBean)
// setSex(bodyBean)
//设置向TA倾诉文案
setConfideNum(bodyBean)
//设置接通率文案
setConnection(bodyBean)
//设置价格
setPrice(bodyBean)
// setPrice(bodyBean)
//设置红包、原价
setCoupon(bodyBean)
// setCoupon(bodyBean)
//设置标签
setConfideTag(bodyBean)
//设置咨询师简介
tv_content.text = bodyBean.confideContent
//设置向TA倾诉按钮状态
setConfideButton(bodyBean)
setListenAndScore(bodyBean)
//设置页面点击事件
this.setOnClickListener {
ActionCountUtils.record(
"listen_counselor_list_page",
"listen_counselor_card_click",
bodyBean.confidedId ?: ""
)
ActionCountUtils.record(
"listen_counselor_popupwindows_page",
"popupwindows_page_visit",
bodyBean.confidedId ?: "",
"1"
)
confideHomeEvent.consultantClick(bodyBean.linkUrl)
confideHomeEvent.consultantClick(bodyBean.doctorId, bodyBean.confidedId, bodyBean.uid?.toString())
}
img_head.setOnClickListener {
ActionCountUtils.record("listen_counselor_list_page", "head_portrait_click", "2")
this.performClick()
}
}
private fun setListenAndScore(bodyBean: ConfideHomeBodyBean) {
SpanUtils.with(price_content).append(bodyBean.confideFee.toString())
.setForegroundColor(resources.getColor(R.color.confide_fe6040)).setFontSize(18, true)
.append("元").setForegroundColor(resources.getColor(R.color.confide_fe6040))
.setFontSize(11, true)
.append("/25分钟").setForegroundColor(resources.getColor(R.color.confide_aaaeba))
.setFontSize(11, true)
.create()
tv_score.text = bodyBean.confidePraiseScore
if (bodyBean.listenFree == true && bodyBean.confideLine == 1) {
confide_free_logo.visibility = VISIBLE
Glide.with(context)
.load(R.drawable.confide__free)
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
.into(confide_free_logo)
} else {
confide_free_logo.visibility = GONE
}
}
......@@ -138,10 +175,16 @@ class ConfideHomeRecommendView(var view: IConfideHomeContract.View, context: Con
iv_play.setImageResource(R.drawable.confide_sond_play)
}
iv_play.setOnClickListener {
ActionCountUtils.record(
"listen_counselor_list_page",
"listen_counselor_icon_click",
bodyBean.confidedId ?: "",
"4"
)
if (bodyBean.confideIsPlay!!) {
confideHomeEvent.pauseVoice()
} else {
confideHomeEvent.playVoice(IConfideHomeConfig.TYPE_RECOMMEND, position, recommendId, bodyBean.confideVoice, bodyBean.confidedName)
confideHomeEvent.playVoice(IConfideHomeConfig.TYPE_RECOMMEND, position, recommendId, bodyBean.confideVoice, bodyBean.confidedName,bodyBean.confidedIcon)
}
}
}
......@@ -149,13 +192,13 @@ class ConfideHomeRecommendView(var view: IConfideHomeContract.View, context: Con
/**
* 设置性别
*/
private fun setSex(bodyBean: ConfideHomeBodyBean) {
/*private fun setSex(bodyBean: ConfideHomeBodyBean) {
if (bodyBean.confideSex == 1) {
img_sex.setImageResource(R.drawable.confide_new_male)
} else {
img_sex.setImageResource(R.drawable.confide_new_female)
}
}
}*/
/**
* 设置向TA倾诉文案
......@@ -188,52 +231,45 @@ class ConfideHomeRecommendView(var view: IConfideHomeContract.View, context: Con
/**
* 设置价格
*/
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()
}
// 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()) {
if (null == bodyBean.confidedTag || bodyBean.confidedTag!!.isEmpty()) {
return
}
var i = 0
val sb = StringBuilder()
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.confide_bg_tag)
textView.layoutParams = params
textView.text = tag
flowlayout_tag.addView(textView)
sb.append(tag).append(" | ")
i++
}
if (sb.length > 3) {
sb.setLength(sb.length - 3)
}
flowlayout_tag.text = sb.toString()
}
/**
* 设置向TA倾诉按钮状态
*/
private fun setConfideButton(bodyBean: ConfideHomeBodyBean) {
var sign2 = 1
when (bodyBean.confideLine) {//1在线 2离线 3通话中 4继续倾诉
1 -> {
tv_confide.setBackgroundResource(R.drawable.confide_line_1)
}
2 -> {
//男他女她
sign2 = 3
if (bodyBean.confideSex == 1) {
tv_confide.setBackgroundResource(R.drawable.confide_line_sex_boy)
} else {
......@@ -241,6 +277,7 @@ class ConfideHomeRecommendView(var view: IConfideHomeContract.View, context: Con
}
}
3 -> {
sign2 = 2
tv_confide.setBackgroundResource(R.drawable.confide_line_3)
}
4 -> {
......@@ -248,14 +285,22 @@ class ConfideHomeRecommendView(var view: IConfideHomeContract.View, context: Con
}
}
tv_confide.setOnClickListener {
if (!Utils.isFastClick()) {
ActionCountUtils.record(
"listen_counselor_list_page",
"listen_counselor_icon_click",
bodyBean.confidedId ?: "",
sign2.toString()
)
click(bodyBean)
}
}
}
/**
* 设置红包、原价
*/
private fun setCoupon(bodyBean: ConfideHomeBodyBean) {
/*private fun setCoupon(bodyBean: ConfideHomeBodyBean) {
if (!TextUtils.isEmpty(bodyBean.couponText)) {
tvCoupon.text = bodyBean.couponText
tvCoupon.visibility = View.VISIBLE
......@@ -286,7 +331,7 @@ class ConfideHomeRecommendView(var view: IConfideHomeContract.View, context: Con
}
}
}
}*/
/**
* 点击事件
......@@ -299,7 +344,7 @@ class ConfideHomeRecommendView(var view: IConfideHomeContract.View, context: Con
if (bodyBean.confideLine == 3) {
}
confideHomeEvent.consultantClick(bodyBean.linkUrl)
confideHomeEvent.consultantClick(bodyBean.doctorId, bodyBean.confidedId, bodyBean.uid?.toString())
}
2 -> {
//跳转私聊 并发送自定义消息
......
package com.ydl.confide.home.widget
import android.graphics.Canvas
import android.graphics.Color
import android.graphics.Paint
import android.graphics.Rect
import android.view.View
import androidx.recyclerview.widget.RecyclerView
import com.yidianling.common.tools.RxImageTool
class FilterItemDecoration : RecyclerView.ItemDecoration() {
private val bounds = Rect()
private val paint = Paint().apply {
color = Color.parseColor("#EFEFF1")
strokeWidth = 2F
}
override fun getItemOffsets(outRect: Rect, view: View, parent: RecyclerView, state: RecyclerView.State) {
if (view is ConfideHomeFilterView) {
outRect.set(0, 0, 0, 1)
}
}
override fun onDraw(c: Canvas, parent: RecyclerView, state: RecyclerView.State) {
val count = parent.childCount
for (i in 0 until count) {
val child = parent.getChildAt(i)
if (child is ConfideHomeFilterView) {
parent.getDecoratedBoundsWithMargins(child, bounds)
c.drawLine(
bounds.left.toFloat(),
bounds.top.toFloat(),
bounds.right.toFloat(),
bounds.top.toFloat(),
paint
)
c.drawLine(
bounds.left.toFloat(),
bounds.bottom.toFloat(),
bounds.right.toFloat(),
bounds.bottom.toFloat(),
paint
)
}
}
}
}
\ No newline at end of file
package com.ydl.confide.intro
import android.graphics.Color
import android.os.Build
import android.os.Bundle
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import androidx.viewpager2.widget.ViewPager2
import com.alibaba.android.arouter.facade.annotation.Autowired
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.launcher.ARouter
import com.alibaba.fastjson.JSON
import com.ydl.confide.R
import com.ydl.confide.api.ConfideRoute
import com.ydl.confide.databinding.ActivityExpertIntroBinding
import com.ydl.confide.home.bean.ConfideHomeBodyBean
import com.ydl.confide.home.http.ConfideHomeApi
import com.ydl.confide.router.PhoneCallIn
import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity
import com.ydl.ydlcommon.base.config.HttpConfig
import com.ydl.ydlcommon.base.config.HttpConfig.Companion.YDL_H5
import com.ydl.ydlcommon.modular.findRouteService
import com.ydl.ydlcommon.utils.BuryPointUtils
import com.ydl.ydlcommon.utils.LogUtil
import com.ydl.ydlnet.YDLHttpUtils
import com.yidianling.common.tools.ToastUtil
import com.yidianling.user.api.service.IUserService
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
import io.reactivex.schedulers.Schedulers
@Route(path = ConfideRoute.R_VIDEO_SHOW)
class ExpertIntroActivity : AppCompatActivity() {
companion object {
private const val SOURCE_VIDEO = 10
}
private val tag = javaClass.simpleName
@Autowired
@JvmField
var initPos: Int = 0
@Autowired
@JvmField
var initData: String? = null
private var lastSelectPos = 0
private lateinit var binding: ActivityExpertIntroBinding
private lateinit var adapter: IntroAdapter
private var page = 1
private var disposable: Disposable? = null
private val confideApi = YDLHttpUtils.obtainApi(ConfideHomeApi::class.java)
private val data = mutableListOf<VideoViewModel>()
private var noMoreData = false
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
ARouter.getInstance().inject(this)
binding = DataBindingUtil.setContentView(this, R.layout.activity_expert_intro)
if (Build.VERSION.SDK_INT >= 21) {
val decorView = window.decorView
val option = (View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
or View.SYSTEM_UI_FLAG_LAYOUT_STABLE)
decorView.systemUiVisibility = option
window.statusBarColor = Color.TRANSPARENT
}
if (initData != null) {
val beans = JSON.parseArray(initData, ConfideHomeBodyBean::class.java)
val isLogin = findRouteService(IUserService::class.java).isLogin()
val vms = beans.map {
VideoViewModel().mapOf(it).apply { showFreeTag.set(!isLogin) }
}
data.addAll(vms)
}
if (data.isEmpty()) {
loadMore()
}
binding.ivBack.setOnClickListener { onBackPressed() }
binding.tvConfideRecord.setOnClickListener {
if (!PhoneCallIn.loginByOneKeyLogin(this, true)) {
return@setOnClickListener
}
BuryPointUtils.getInstance().createMap()
.put("mine_name", "倾诉记录")
.burryPoint("mine")
val h5Paramsqing = H5Params(YDL_H5 + "confideOrderList", null)
NewH5Activity.start(this, h5Paramsqing)
}
binding.viewPager.orientation = ViewPager2.ORIENTATION_VERTICAL
binding.viewPager.offscreenPageLimit = 1
adapter = IntroAdapter(this, data, this)
binding.viewPager.adapter = adapter
binding.viewPager.registerOnPageChangeCallback(object : ViewPager2.OnPageChangeCallback() {
override fun onPageSelected(position: Int) {
adapter.onSelect(position)
if (position == data.size - 1 && lastSelectPos < position) {
loadMore()
}
lastSelectPos = position
}
})
adapter.checkNetwork()
binding.viewPager.setCurrentItem(initPos, false)
}
private fun loadMore() {
if (disposable != null && !disposable!!.isDisposed) {
return
}
if (noMoreData) return
disposable = confideApi.recommendDoctor(HttpConfig.JAVA_BASE_URL + "auth/listen/nsearch?", page, SOURCE_VIDEO)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({ resp ->
if (resp.code == "200") {
page++
val body = resp.data.body
val isLogin = findRouteService(IUserService::class.java).isLogin() ?: false
val map = body?.map { VideoViewModel().mapOf(it).apply { showFreeTag.set(!isLogin) } }
map?.let {
data.addAll(it)
adapter.notifyItemRangeInserted(data.size - it.size, it.size)
}
if (body == null || body.size == 0) {
noMoreData = true
}
} else {
ToastUtil.toastShort(resp.msg)
}
}, { throwable ->
LogUtil.e(tag, throwable.message)
})
}
override fun onDestroy() {
super.onDestroy()
disposable?.dispose()
}
}
\ No newline at end of file
package com.ydl.confide.intro
import android.app.Activity
import android.content.Context
import android.net.Uri
import android.util.Log
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.databinding.DataBindingUtil
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleObserver
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.OnLifecycleEvent
import androidx.recyclerview.widget.RecyclerView
import com.dou361.ijkplayer.widget.IjkVideoView
import com.ydl.confide.R
import com.ydl.confide.databinding.ItemExpertIntroBinding
import com.ydl.confide.home.http.ConfideHomeApi
import com.ydl.confide.home.util.ConfideNetworkUtil
import com.ydl.ydlcommon.ui.Loading
import com.ydl.ydlcommon.utils.TimeUtil
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.view.dialog.CommonDialog
import com.ydl.ydlnet.YDLHttpUtils
import com.yidianling.common.tools.ToastUtil
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
import io.reactivex.schedulers.Schedulers
import tv.danmaku.ijk.media.player.IMediaPlayer
internal class IntroAdapter(
private val context: Context,
private val data: List<VideoViewModel>,
private val lifecycleOwner: LifecycleOwner
) : RecyclerView.Adapter<ItemIntroHolder>(), LifecycleObserver {
private val videoViews = hashMapOf<Int, IjkVideoView>()
private val onInfoListener = OnVideoInfo()
private var hasAgreePlayWithoutWiFi = false
private var curPos = 0
private var dispose: Disposable? = null
private val keySp = "check_network_continue"
init {
lifecycleOwner.lifecycle.addObserver(this)
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemIntroHolder {
val binding = DataBindingUtil.inflate<ItemExpertIntroBinding>(
LayoutInflater.from(parent.context),
R.layout.item_expert_intro,
parent,
false
)
return ItemIntroHolder(binding)
}
override fun onBindViewHolder(holder: ItemIntroHolder, position: Int) {
val item = data[position]
holder.onBind(item)
holder.binding.item = item
}
override fun onViewAttachedToWindow(holder: ItemIntroHolder) {
val adapterPosition = holder.adapterPosition
val videoView = IjkVideoView(context)
val playUrl = data[adapterPosition].playUrl
if (!playUrl.isNullOrBlank()) {
if (hasAgreePlayWithoutWiFi || ConfideNetworkUtil.isWifi(context)) {
videoView.setVideoURI(Uri.parse(playUrl))
if (curPos == adapterPosition) {
videoView.start()
}
} else {
videoView.tag = playUrl
}
}
videoView.setOnInfoListener(onInfoListener)
videoViews.put(adapterPosition, videoView)
holder.onAttach(videoView)
}
internal fun checkNetwork() {
if (!ConfideNetworkUtil.isWifi(context)) {
val lastCheck = context.getSharedPreferences("temp_test", Context.MODE_PRIVATE).getLong(keySp, 0)
val duration = System.currentTimeMillis() - lastCheck
if (duration < 24 * 60 * 60 * 1000) {
return
}
val dialog = CommonDialog.create(context)
.setTitle(context.getString(R.string.confide_tip))
.setMessage(context.getString(R.string.confide_video_wifi_tip))
.setLeftOnclick("继续播放") {
context.getSharedPreferences("temp_test", Context.MODE_PRIVATE).edit()
.putLong(keySp, System.currentTimeMillis()).apply()
hasAgreePlayWithoutWiFi = true
for (entry in videoViews.entries) {
val value = entry.value
val playUrl = value.tag as? String
if (!playUrl.isNullOrBlank()) {
value.setVideoURI(Uri.parse(playUrl))
if (curPos == entry.key) {
value.start()
}
}
}
}
.setLeftButton_color(R.color.platform_but_text_color_selected)
.setRightButton_color(R.color.platform_text_bright_color)
.setRightClick("取消") {
for (entry in videoViews.entries) {
val value = entry.value
if (value.canPause()) {
value.pause()
}
}
}
.setCancelAble(true)
dialog.setOnCancelListener {
if (context is Activity) {
context.onBackPressed()
}
}
dialog.show()
}
}
override fun onViewDetachedFromWindow(holder: ItemIntroHolder) {
super.onViewDetachedFromWindow(holder)
val adapterPosition = holder.adapterPosition
val video = videoViews.get(adapterPosition)
video?.release(true)
videoViews.remove(adapterPosition)
holder.onDetach()
}
override fun getItemCount(): Int {
return data.size
}
@OnLifecycleEvent(Lifecycle.Event.ON_DESTROY)
private fun onDestroy() {
for (entry in videoViews.entries) {
entry.value.release(true)
}
}
@OnLifecycleEvent(Lifecycle.Event.ON_RESUME)
private fun onResume() {
val ijkVideoView = videoViews[curPos]
ijkVideoView?.start()
onLoadDialStatus(curPos)
}
@OnLifecycleEvent(Lifecycle.Event.ON_PAUSE)
private fun onPause() {
val ijkVideoView = videoViews[curPos]
ijkVideoView?.pause()
}
fun onSelect(position: Int) {
curPos = position
onLoadDialStatus(position)
if (!ConfideNetworkUtil.isWifi(context) && !hasAgreePlayWithoutWiFi) {
return
}
for (entry in videoViews.entries) {
if (entry.key == position) {
// entry.value.seekTo(0)
entry.value.start()
} else {
entry.value.seekTo(0)
entry.value.pause()
}
}
}
private fun onLoadDialStatus(position: Int) {
val confideApi = YDLHttpUtils.obtainApi(ConfideHomeApi::class.java)
val doctorId = data[position].doctorId
val confideId = data[position].confideId
val video = data[position].isVideo
ActionCountUtils.record(
"listen_counselor_content_play_page",
"listen_counselor_content_play_visit",
confideId ?: "",
if (video) "1" else "2",
"1"
)
if (doctorId != null) {
dispose?.dispose()
dispose = confideApi.getDialStatus(doctorId)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({ resp ->
if (resp.code == "200") {
val lineStatus = resp.data?.confideLine ?: 2
if (lineStatus == 4) {//继续倾诉4,1在线 2离线 3通话中
val t = resp?.data?.remainingTime?.remainingTime
if (t != null) {
val remain = TimeUtil.getElapseTimeForShow(t * 1000)
data[position].remainingTime.set(
context.getString(
R.string.confide_tip_remain_time,
remain
)
)
}
} else if (lineStatus == 3) {
data[position].remainingTime.set("(点击留言)")
} else if (lineStatus == 2) {
data[position].remainingTime.set("(点击邀请上线)")
}
data[position].lineStatus.set(lineStatus)
} else {
if (!resp.msg.isNullOrEmpty()) {
ToastUtil.toastShort(resp.msg)
}
}
}, { throwable -> throwable.printStackTrace() })
}
}
private inner class OnVideoInfo : IMediaPlayer.OnInfoListener {
override fun onInfo(mp: IMediaPlayer?, what: Int, extra: Int): Boolean {
Log.d("OnVideoInfo", "OnInfo:${what},${extra},${curPos}")
if (videoViews[curPos]?.mMediaPlayer == mp && data[curPos].isVideo) {
if (what == IMediaPlayer.MEDIA_INFO_BUFFERING_START) {
Loading.show(context)
} else if (what == IMediaPlayer.MEDIA_INFO_BUFFERING_END) {
Loading.close()
}
}
return true
}
}
}
\ No newline at end of file
package com.ydl.confide.intro
import android.app.Activity
import android.net.Uri
import android.util.Log
import android.view.View
import android.widget.SeekBar
import androidx.databinding.ObservableBoolean
import androidx.databinding.ObservableField
import androidx.databinding.ObservableInt
import androidx.databinding.ViewDataBinding
import androidx.fragment.app.FragmentActivity
import androidx.recyclerview.widget.RecyclerView
import com.dou361.ijkplayer.widget.IjkVideoView
import com.facebook.drawee.backends.pipeline.Fresco
import com.facebook.drawee.interfaces.DraweeController
import com.ydl.confide.R
import com.ydl.confide.api.ConfideRoute
import com.ydl.confide.databinding.ItemExpertIntroBinding
import com.ydl.confide.home.ConfideBottomSheetDialogFragment
import com.ydl.confide.home.bean.ConfideHomeBodyBean
import com.ydl.confide.home.modular.service.ConfideWebServiceImpl
import com.ydl.confide.router.PhoneCallIn
import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity
import com.ydl.ydlcommon.base.config.HttpConfig
import com.ydl.ydlcommon.modular.findRouteService
import com.ydl.ydlcommon.utils.LogUtil
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.view.dialog.YDLShareDialog
import com.yidianling.im.api.service.IImService
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.confide_home_activity.*
import tv.danmaku.ijk.media.player.IjkMediaPlayer
import java.net.URLEncoder
import java.util.concurrent.TimeUnit
internal class ItemIntroHolder(binding: ItemExpertIntroBinding) :
BindingViewHolder<ItemExpertIntroBinding>(binding) {
companion object {
private const val TAG = "ItemIntroHolder"
}
private var disposable: Disposable? = null
private var video: IjkVideoView? = null
private var vm: VideoViewModel? = null
@Volatile
private var isTouch = false
fun onDetach() {
stopTiming()
video?.release(true)
binding.videoView.removeAllViews()
}
fun onBind(item: VideoViewModel) {
vm = item
binding.layoutCall.setOnClickListener {
if (!PhoneCallIn.loginByOneKeyLogin(itemView.context, true)) {
return@setOnClickListener
}
ActionCountUtils.record(
"listen_counselor_content_play_page",
"listen_counselor_content_play_icon_click",
item.confideId.toString(),
if (item.isVideo) "1" else "2",
"6"
)
val status = item.lineStatus.get()
when (status) {
2, 3 -> {//离线,通话中
(itemView.context as? Activity)?.let { aty ->
findRouteService(IImService::class.java).startChat(aty, item.uid!!, 0, 0)
}
}
else -> {
if (!item.confideId.isNullOrBlank()) {
ConfideWebServiceImpl().connectionJava(item.confideId!!.toInt(), 3, it.context as Activity, null) {
showDoctorDetail(item, true)
}
}
}
}
// showDoctorDetail(item)
}
binding.btnChat.setOnClickListener {
val aty = it.context as? Activity
if (aty != null && !item.uid.isNullOrEmpty()) {
ActionCountUtils.record(
"listen_counselor_content_play_page",
"listen_counselor_content_play_icon_click",
item.confideId.toString(),
if (item.isVideo) "1" else "2",
"7"
)
findRouteService(IImService::class.java).startChat(aty, item.uid!!, 0, 0)
}
}
binding.btnEvaluate.setOnClickListener {
item.doctorId?.let {
ActionCountUtils.record(
"listen_counselor_content_play_page",
"listen_counselor_content_play_icon_click",
item.confideId ?: "",
if (item.isVideo) "1" else "2",
"8"
)
val url = HttpConfig.MH5_URL + ConfideRoute.h5ExpertEval(it, item.confideId ?: "")
NewH5Activity.start(itemView.context, H5Params(url, ""))
// ConfideBottomSheetDialogFragment()
// .showBottomSheetDialog(
// itemView.context as FragmentActivity,
// HttpConfig.MH5_URL + ConfideRoute.h5ExpertEval(it, item.confideId ?: ""),
// it, uid = item.uid
// )
}
}
binding.tvName.setOnClickListener {
ActionCountUtils.record(
"listen_counselor_popupwindows_page",
"popupwindows_page_visit",
item.confideId ?: "",
"4"
)
showDoctorDetail(item,false)
}
binding.ivAvatar.setOnClickListener {
ActionCountUtils.record(
"listen_counselor_content_play_page",
"listen_counselor_content_play_icon_click",
item.confideId ?: "",
if (item.isVideo) "1" else "2",
"10"
)
ActionCountUtils.record(
"listen_counselor_popupwindows_page",
"popupwindows_page_visit",
item.confideId ?: "",
"3"
)
showDoctorDetail(item,false)
}
binding.vDisableClick.setOnClickListener { }
binding.btnShare.setOnClickListener {
val aty = it.context as? Activity
if (aty != null) {
ActionCountUtils.record(
"listen_counselor_content_play_page",
"listen_counselor_content_play_icon_click",
item.confideId ?: "",
if (item.isVideo) "1" else "2",
"9"
)
var shareUrl = "${HttpConfig.MH5_URL}experts/${item.doctorId}"
if (!item.confideId.isNullOrBlank()) {
shareUrl += "?id=${item.confideId}"
}
val dialog = YDLShareDialog.style8(
aty,
"${item.name.get()}_${item.title.get()}",
shareUrl,
"壹点灵心理服务平台让天下人更快乐",
item.avatar.get(),
genMinProgramPath(shareUrl),
"gh_25b90294ddcc"
)
dialog.show(aty.fragmentManager, "share")
}
}
binding.videoView.setOnClickListener {
ActionCountUtils.record(
"listen_counselor_content_play_page",
"listen_counselor_content_play_icon_click",
item.confideId ?: "",
if (item.isVideo) "1" else "2",
if (item.isVideo) "4" else "2"
)
if (video?.canPause() == true) {
video?.pause()
if (item.isVideo) {
binding.ivPlay.visibility = View.VISIBLE
} else {
binding.voicePlay.stop()
}
}
}
binding.ivPlay.setOnClickListener {
ActionCountUtils.record(
"listen_counselor_content_play_page",
"listen_counselor_content_play_icon_click",
item.confideId.toString(),
if (item.isVideo) "1" else "2",
if (item.isVideo) "3" else "1"
)
video?.start()
if (item.isVideo) {
binding.ivPlay.visibility = View.GONE
} else {
binding.voicePlay.start()
}
}
binding.voicePlay.setOnClickListener {
ActionCountUtils.record(
"listen_counselor_content_play_page",
"listen_counselor_content_play_icon_click",
item.confideId.toString(),
if (item.isVideo) "1" else "2",
if (item.isVideo) "3" else "1"
)
if (video?.isPlaying == true) {
video?.pause()
binding.voicePlay.stop()
} else if (video?.isPlaying == false) {
video?.start()
binding.voicePlay.start()
}
}
val controller: DraweeController = Fresco.newDraweeControllerBuilder()
.setUri(Uri.parse("res://drawable/" + R.drawable.first_order))
.setOldController(binding.confideFirstFree.controller)
.setAutoPlayAnimations(true) // 是否自动播放Gif动画
.build()
binding.confideFirstFree.controller = controller
binding.seekbar.progress = 0
binding.seekbar.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
}
override fun onStartTrackingTouch(seekBar: SeekBar?) {
isTouch = true
}
override fun onStopTrackingTouch(seekBar: SeekBar?) {
isTouch = false
if (seekBar != null) {
video?.seekTo(seekBar.progress)
video?.start()
binding.ivPlay.visibility = View.GONE
}
ActionCountUtils.record(
"listen_counselor_content_play_page",
"listen_counselor_content_play_icon_click",
item.confideId.toString(),
if (item.isVideo) "1" else "2",
"5"
)
}
})
binding.voicePlay.visibility =
if (item.isVideo) View.GONE else if (item.playUrl.isNullOrBlank()) View.GONE else View.VISIBLE
}
fun onAttach(videoView: IjkVideoView) {
this.video = videoView
binding.videoView.addView(videoView)
video?.setOnPreparedListener { player ->
Log.d(TAG, "${player.videoHeight},${player.videoWidth},${player.duration}")
val duration = player.duration.toInt()
if (duration > 0) {
binding.seekbar.max = duration
} else {
binding.seekbar.visibility = View.GONE
}
}
video?.setOnCompletionListener {
video?.seekTo(0)
video?.start()
}
video?.setOnErrorListener { player, what, extra ->
LogUtil.e(TAG, "onError:$what,$extra")
return@setOnErrorListener true
}
startTiming()
if (vm?.isVideo == false && !vm?.playUrl.isNullOrBlank()) {
binding.voicePlay.start()
}
}
private fun startTiming() {
disposable = Observable.interval(3, TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(Schedulers.computation())
.subscribe {
val pos = (video?.mMediaPlayer as IjkMediaPlayer?)?.currentPosition ?: 0
if (pos > 0) {
if (vm?.isVideo == true) {
binding.ivCover.visibility = View.GONE
}
if (!isTouch) {
binding.seekbar.progress = pos.toInt()// video.bufferPercentage
}
if (video?.isPlaying == true) {
when (vm?.isVideo) {
true -> {
binding.ivPlay.visibility = View.GONE
}
false -> {
binding.voicePlay.start()
}
}
}
}
}
}
private fun stopTiming() {
disposable?.dispose()
}
private fun showDoctorDetail(item: VideoViewModel,toPay:Boolean) {
item.confideId?.let {
val url = HttpConfig.MH5_URL + ConfideRoute.h5ConfideIntro(it)+ if(toPay) "&payPage=1" else ""
ConfideBottomSheetDialogFragment()
.showBottomSheetDialog(
itemView.context as FragmentActivity,
url,
item.doctorId!!,
uid = item.uid
)
}
}
}
class VideoViewModel {
val name = ObservableField<String>("")
val title = ObservableField<String>("")
val avatar = ObservableField<String>("")
val count = ObservableField<String>("")
val lineStatus = ObservableInt()
var remainingTime = ObservableField<String>("")
val intro = ObservableField<String>("")
val tag = ObservableField<String>("")
var playUrl: String? = null
val coverUrl = ObservableField<String>("")
val showFreeTag = ObservableBoolean(false)
var isVideo = false
var uid: String? = null
var doctorId: String? = null
var confideId: String? = null
}
private fun genMinProgramPath(url: String): String {
val pathPrefix = "/pages/web/web?load_url="
val encode = URLEncoder.encode(url, "UTF-8")
return pathPrefix + encode
}
internal fun VideoViewModel.mapOf(bean: ConfideHomeBodyBean): VideoViewModel {
name.set(bean.confidedName)
avatar.set(bean.confidedIcon)
val num = bean.confideNum?.replace("人", "") ?: "0"
count.set("倾诉人次 $num")
intro.set(bean.confideContent)
title.set(bean.title)
val sb = StringBuilder()
bean.confidedTag?.forEach { sb.append(it).append(" | ") }
if (sb.length > 3) {
sb.setLength(sb.length - 3)
}
tag.set(sb.toString())
if (!bean.videoUrl.isNullOrEmpty()) {
playUrl = bean.videoUrl
isVideo = true
coverUrl.set(bean.coverVideoPicture)
} else {
playUrl = bean.confideVoice
isVideo = false
coverUrl.set(bean.coverPicture)
}
uid = bean.uid?.toString()
doctorId = bean.doctorId
confideId = bean.confidedId
return this
}
open class BindingViewHolder<T : ViewDataBinding>(val binding: T) :
RecyclerView.ViewHolder(binding.root)
\ No newline at end of file
......@@ -5,6 +5,7 @@ import android.app.Application
import android.content.Context
import android.content.Intent
import androidx.fragment.app.DialogFragment
import androidx.fragment.app.FragmentActivity
import com.alibaba.android.arouter.facade.template.IProvider
interface IConfideService : IProvider {
......@@ -26,4 +27,11 @@ interface IConfideService : IProvider {
fun initYdlavManager(app: Application)
fun showAxbConfirmDialog(activity: Activity?, type: Int, phoneNumber: String?)
fun showExpertDetailDialog(
activity: FragmentActivity,
jumpUrl: String,
doctorId: String,
uid: String
)
}
\ No newline at end of file
package com.ydl.confide.api
object ConfideRoute {
const val R_VIDEO_SHOW = "/confide/expert_video"
const val R_CONFIDE_HOME = "/confide/home"
fun h5ConfideIntro(id: String) = "jy/listenMask?listenerId=${id}"
fun h5ExpertEval(doctorId: String, confideId: String) =
"comment/evaList/${doctorId}?listenerId=${confideId}&fromVideo=1"
}
\ 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:bottomRightRadius="10dp"
android:topLeftRadius="10dp"
android:topRightRadius="10dp" />
<solid android:color="#FF4A4A" />
<stroke
android:width="1dp"
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"
android:shape="rectangle">
<gradient
android:angle="90"
android:centerColor="#33000000"
android:endColor="#00000000"
android:startColor="#80000000" />
</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:angle="90"
android:endColor="#00000000"
android:startColor="#66000000" />
</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" />
<solid android:color="#4d000000" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:bottomRightRadius="6dp"/>
<solid android:color="#90FF8F38"/>
<solid android:color="#4d000000"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:bottomRightRadius="6dp"/>
<solid android:color="#901da1f2" />
<solid android:color="#4d000000" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners
android:radius="@dimen/confide_dp_4"
/>
<solid android:color="#d1d1d1"/>
</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>
<shape android:shape="rectangle">
<solid android:color="@android:color/white" />
<corners android:topLeftRadius="15dp" android:topRightRadius="15dp" />
</shape>
</item>
</selector>
\ No newline at end of file
......@@ -3,11 +3,8 @@
android:shape="rectangle">
<corners
android:radius="4dp"/>
android:radius="8dp"/>
<solid android:color="#eaffffff"/>
<stroke android:width="0.5dp"
android:color="#cccccc"/>
<solid android:color="#ffffff"/>
</shape>
\ No newline at end of file
......@@ -3,9 +3,9 @@
android:shape="rectangle">
<gradient
android:startColor="@color/platform_main_gradient_end_color"
android:endColor="@color/platform_main_gradient_start_color"/>
android:startColor="@color/confide_61CEAC"
android:endColor="@color/confide_48CC95"/>
<corners android:radius="15dp" />
<corners android:radius="8dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="26dp" />
<gradient
android:endColor="#48CC95"
android:startColor="#61CEAC" />
<stroke
android:width="1dp"
android:color="#69FFFFFF" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="26dp" />
<gradient
android:endColor="#BBC1CD"
android:startColor="#D5D6D7" />
<stroke
android:width="1dp"
android:color="#69FFFFFF" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="26dp" />
<gradient
android:endColor="#FF994B"
android:startColor="#F6B37F" />
<stroke
android:width="1dp"
android:color="#69FFFFFF" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="26dp" />
<gradient
android:endColor="#4BAFEC"
android:startColor="#65C4FF" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:pivotX="50%" android:pivotY="50%"
android:fromDegrees="0"
android:toDegrees="360">
<shape
android:shape="ring"
android:innerRadiusRatio="3"
android:thicknessRatio="8"
android:useLevel="false">
<gradient
android:type="sweep"
android:useLevel="false"
android:startColor="#ffffff"
android:centerColor="#ffffff"
android:centerY="0.50"
android:endColor="@color/transparent" />
</shape>
</animated-rotate>
\ 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="@color/platform_main_theme" />
<solid android:color="#701da1f2" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<selector>
<item android:state_pressed="true">
<shape>
<corners android:radius="4dp" />
<solid android:color="#59FFFFFF" />
<stroke android:width="1dp" android:color="@color/transparent"/>
</shape>
</item>
<item>
<shape>
<corners android:radius="4dp" />
<solid android:color="#59FFFFFF" />
<stroke android:width="5dp" android:color="@color/transparent"/>
</shape>
</item>
</selector>
</item>
<item android:id="@android:id/secondaryProgress">
<clip>
<shape>
<corners android:radius="4dp" />
<solid android:color="@color/white" />
</shape>
</clip>
</item>
<item android:id="@android:id/progress">
<selector>
<item android:state_pressed="true">
<clip>
<shape>
<corners android:radius="4dp" />
<solid android:color="@color/white" />
<stroke android:width="1dp" android:color="@color/transparent"/>
</shape>
</clip>
</item>
<item>
<clip>
<shape>
<corners android:radius="4dp" />
<solid android:color="@color/white" />
<stroke android:width="5dp" android:color="@color/transparent"/>
</shape>
</clip>
</item>
</selector>
</item>
</layer-list>
\ 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_pressed="true">
<shape android:shape="rectangle">
<solid android:color="@color/white" />
<size android:width="6dp" android:height="8dp" />
<corners android:radius="2dp" />
</shape>
</item>
<item android:state_pressed="false">
<shape android:shape="oval">
<solid android:color="@color/white" />
<size android:width="8dp" android:height="8dp" />
<stroke android:width="2dp" android:color="@color/transparent" />
</shape>
</item>
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layout 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">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black">
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/viewPager"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/ivBack"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginLeft="12dp"
android:layout_marginTop="24dp"
android:padding="4dp"
android:scaleType="fitXY"
android:src="@drawable/confide_back"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:shape="@{1}"
app:shapeBg="@{0x33000000}"
tools:ignore="ContentDescription" />
<TextView
android:id="@+id/tvConfideRecord"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="16dp"
android:drawableLeft="@drawable/ic_confide_record"
android:drawablePadding="4dp"
android:gravity="center"
android:padding="8dp"
android:paddingHorizontal="8dp"
android:paddingVertical="5dp"
android:text="倾诉记录"
android:textColor="@color/white"
android:textSize="13sp"
app:layout_constraintBottom_toBottomOf="@+id/ivBack"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@+id/ivBack"
app:shapeBg="@{0x26000000}"
app:shapeRadius="@{15}"
app:shapeStrokeColor="@{0x69FFFFFF}"
app:shapeStrokeWidth="@{1}" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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:id="@+id/layoutBottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/platform_dp_15"
android:layout_marginEnd="@dimen/platform_dp_15"
android:background="@color/transparent"
android:gravity="center_horizontal"
android:orientation="horizontal">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/layoutCall"
android:layout_width="150dp"
android:layout_height="47dp"
android:layout_marginBottom="28dp"
android:background="@drawable/confide_line_bg_1"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/layoutChange"
tools:visibility="visible">
<ImageView
android:id="@+id/ivCall"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginRight="4dp"
android:src="@drawable/ic_confide_call"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@+id/tvCall"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tvCall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="继续倾诉"
android:textColor="@color/white"
android:textSize="17sp"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@+id/tvTime"
app:layout_constraintLeft_toRightOf="@+id/ivCall"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed" />
<TextView
android:id="@+id/tvTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textColor="@color/white"
android:textSize="10sp"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="@+id/tvCall"
app:layout_constraintRight_toRightOf="@+id/tvCall"
app:layout_constraintTop_toBottomOf="@+id/tvCall"
tools:text="剩余1分40秒" />
</androidx.constraintlayout.widget.ConstraintLayout>
<!--<TextView
android:id="@+id/first_order"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/bg_confide_free"
android:paddingLeft="5dp"
android:paddingTop="2dp"
android:paddingRight="5dp"
android:paddingBottom="2dp"
android:text="首单免费1111111"
android:textColor="@color/white"
android:textSize="11sp"
android:visibility="gone"
app:layout_constraintCircle="@+id/layoutCall"
app:layout_constraintCircleAngle="70"
app:layout_constraintCircleRadius="70dp" />-->
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/first_order"
android:layout_width="@dimen/platform_dp_64"
android:layout_height="@dimen/platform_dp_34"
app:layout_constraintCircle="@+id/layoutCall"
app:layout_constraintCircleAngle="70"
app:layout_constraintCircleRadius="70dp"/>
<LinearLayout
android:id="@+id/layoutChange"
android:layout_width="150dp"
android:layout_height="47dp"
android:layout_marginStart="@dimen/platform_dp_23"
android:layout_marginBottom="32dp"
android:background="@drawable/confide_line_bg_change"
android:gravity="center"
android:paddingLeft="28dp"
android:paddingRight="28dp"
android:visibility="gone"
app:layout_constraintLeft_toRightOf="@id/layoutCall"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/layoutCall"
tools:visibility="visible">
<TextView
android:id="@+id/layout_change_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="再换一位"
android:textColor="@color/white"
android:textSize="17sp"
android:textStyle="bold" />
<ProgressBar
android:id="@+id/confide_progress"
android:layout_width="@dimen/platform_dp_20"
android:layout_height="@dimen/platform_dp_20"
android:indeterminateDrawable="@drawable/confide_progress"
android:visibility="gone"></ProgressBar>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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/white"
......@@ -15,47 +16,118 @@
<com.jcodecraeer.xrecyclerview.XRecyclerView
android:id="@+id/rv_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
android:layout_height="match_parent" />
<LinearLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/quick_consult_card"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginBottom="30dp"
android:layout_marginBottom="20dp"
android:background="@drawable/confide_card_consult_bg"
android:orientation="horizontal"
android:paddingLeft="@dimen/confide_dp_25"
android:paddingRight="@dimen/confide_dp_25"
android:visibility="gone">
android:paddingLeft="@dimen/platform_dp_8"
android:paddingTop="1dp"
android:elevation="2dp"
android:paddingBottom="1dp"
android:paddingRight="@dimen/platform_dp_8"
android:visibility="gone"
tools:visibility="visible">
<ImageView
android:id="@+id/confide_logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/confide_call_logo"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="@dimen/platform_dp_12"
android:layout_marginBottom="@dimen/platform_dp_12"
>
</ImageView>
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:gravity="center_vertical"
android:maxLines="1"
android:text="不知道选择哪位咨询师?试试"
android:textColor="@color/platform_color_242424"
android:textSize="14dp" />
android:text="智能推荐,一键倾诉"
android:textColor="@color/platform_color_333333"
android:textSize="14dp"
android:layout_marginStart="@dimen/platform_dp_8"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/confide_logo"
app:layout_constraintTop_toTopOf="parent" />
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginBottom="@dimen/platform_dp_12"
app:layout_constraintTop_toTopOf="@id/confide_logo"
app:layout_constraintBottom_toBottomOf="@id/confide_logo"
>
<TextView
android:id="@+id/quick_consult_btn"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:background="@drawable/confide_consult_btn_bg"
android:layout_marginRight="24dp"
android:gravity="center"
android:paddingLeft="@dimen/confide_dp_20"
android:paddingRight="@dimen/confide_dp_20"
android:text="一键倾诉"
android:textColor="@color/platform_but_text_color"
android:textSize="14dp"
android:textStyle="bold" />
</LinearLayout>
android:paddingTop="@dimen/platform_dp_5"
android:paddingBottom="@dimen/platform_dp_5"
android:paddingLeft="@dimen/platform_dp_7"
android:paddingRight="@dimen/platform_dp_7"
android:text="我要倾诉"
android:layout_marginTop="@dimen/platform_dp_12"
android:textColor="@color/white"
android:textSize="13sp"
android:drawableRight="@drawable/confide_right_arrow" />
<ImageView
android:id="@+id/confideRed"
android:layout_width="@dimen/platform_dp_40"
android:layout_height="@dimen/confide_dp_25"
android:layout_gravity="right|top"
android:visibility="gone"
android:layout_marginEnd="10dp"
android:src="@drawable/confide__free" />
<!--<TextView
android:id="@+id/confide_Free"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/bg_confide_free"
android:layout_gravity="right|top"
android:paddingLeft="5dp"
android:paddingTop="2dp"
android:paddingRight="5dp"
android:paddingBottom="2dp"
android:text="首单免费"
android:visibility="gone"
android:textColor="@color/white"
android:textSize="11sp" />-->
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/confide_Free"
android:layout_width="@dimen/platform_dp_64"
android:layout_height="@dimen/platform_dp_34"
app:layout_constraintCircle="@+id/layoutCall"
android:paddingLeft="5dp"
android:layout_marginTop="-7dp"
android:paddingRight="5dp"
android:paddingBottom="2dp"
android:layout_gravity="right|top"
android:visibility="gone"
/>
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<View
android:id="@+id/v_zhezhao"
......@@ -63,8 +135,7 @@
android:layout_height="match_parent"
android:layout_marginTop="48dp"
android:background="#80000000"
android:visibility="gone"
/>
android:visibility="gone" />
<com.ydl.confide.home.widget.ConfideHomeFilterView
android:id="@+id/v_filterView"
......@@ -72,17 +143,25 @@
android:layout_height="48dp"
android:background="@color/white"
android:visibility="gone"
/>
tools:visibility="gone"/>
<com.ydl.ydlcommon.mvp.lce.view.YDLStateView
<View
android:id="@+id/vFilterLine"
android:layout_width="match_parent"
android:layout_below="@+id/v_filterView"
android:visibility="gone"
android:layout_height="1px"
android:background="#E1E1E4" />
<com.ydl.ydlcommon.mvp.lce.view.YDLStateView
android:id="@+id/lce_state_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/rv_list"
android:layout_alignTop="@+id/rv_list"
android:layout_alignRight="@+id/rv_list"
android:layout_alignBottom="@+id/rv_list" />
android:layout_alignBottom="@+id/rv_list"
android:visibility="gone" />
</RelativeLayout>
......
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:background="@color/white"
>
<androidx.cardview.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:cardElevation="0dp"
app:cardCornerRadius="6dp"
android:layout_marginTop="20dp"
android:layout_marginStart="@dimen/platform_dp_15"
android:id="@+id/img_bg"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
>
<FrameLayout
android:layout_width="96dp"
android:layout_height="96dp">
<ImageView
android:id="@+id/img_head"
android:layout_width="96dp"
android:layout_height="96dp"
android:scaleType="fitXY"/>
<TextView
android:id="@+id/tv_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/confide_dp_10"
android:textColor="@color/white"
android:background="@drawable/confide_recommend_expert_line_bg"
tools:text="在线"/>
<ImageView
android:id="@+id/iv_play"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="bottom|right"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
tools:background="@drawable/confide_paused"/>
</FrameLayout>
</androidx.cardview.widget.CardView>
<TextView
android:id="@+id/tv_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:textColor="@color/platform_color_333333"
android:textSize="@dimen/platform_sp_16"
android:textStyle="bold"
app:layout_constraintStart_toEndOf="@id/img_bg"
app:layout_constraintTop_toTopOf="@id/img_bg"
tools:text="姚雨晴" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/ll_confide_data"
app:layout_constraintTop_toBottomOf="@id/tv_name"
app:layout_constraintStart_toEndOf="@id/img_bg"
android:layout_marginStart="12dp"
android:orientation="horizontal"
>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center"
>
<TextView
android:id="@+id/tv_Connection"
android:layout_marginTop="@dimen/confide_dp_12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/platform_sp_14"
android:textColor="#555555"
android:textStyle="bold"
tools:text="83%"
/>
<TextView
android:id="@+id/tv_ConnectionContent"
android:layout_marginTop="@dimen/platform_dp_3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/platform_sp_12"
android:textColor="#69696A"
android:text="接通率" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center"
android:layout_marginStart="@dimen/confide_dp_25"
>
<TextView
android:id="@+id/tv_confideNum"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/platform_sp_14"
android:textColor="#555555"
android:textStyle="bold"
android:layout_marginTop="12dp"
tools:text="8000人"
/>
<TextView
android:id="@+id/tv_tv_confideNumContent"
android:layout_marginTop="@dimen/platform_dp_3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/platform_sp_12"
android:textColor="#69696A"
android:text="倾诉人次"
/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center"
android:layout_marginStart="@dimen/confide_dp_25"
>
<TextView
android:id="@+id/tv_score"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/platform_sp_14"
android:textColor="#555555"
android:textStyle="bold"
android:layout_marginTop="12dp"
tools:text="4.9"
/>
<TextView
android:id="@+id/tv_tv_ScoreContent"
android:layout_marginTop="@dimen/platform_dp_3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/platform_sp_12"
android:textColor="#69696A"
android:text="评分"
/>
</LinearLayout>
</LinearLayout>
<TextView
android:id="@+id/flowlayout_tag"
android:layout_width="0dp"
android:layout_height="16dp"
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
android:textColor="#9495A0"
android:maxLines="1"
android:ellipsize="end"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="@+id/img_bg"
app:layout_constraintEnd_toStartOf="@+id/price_content"
app:layout_constraintStart_toEndOf="@+id/img_bg" />
<TextView
android:id="@+id/price_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:layout_marginRight="16dp"
android:text="50元/25分钟"
android:textSize="@dimen/platform_sp_12"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ll_confide_data" />
<TextView
android:id="@+id/tv_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="13sp"
android:textColor="#919190"
android:maxLines="2"
android:ellipsize="end"
app:layout_constraintTop_toBottomOf="@id/img_bg"
app:layout_constraintStart_toStartOf="@id/img_bg"
android:layout_marginTop="@dimen/platform_dp_15"
tools:text="没有人一出生就是完美的,只有不断的相信自...己…才能成就自己的梦想。"
/>
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
>
<TextView
android:id="@+id/tv_confide"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginTop="@dimen/platform_dp_15"
android:layout_marginEnd="@dimen/platform_dp_15"
android:gravity="center"
tools:background="@drawable/confide_line_1"/>
<ImageView
android:layout_width="42dp"
android:layout_height="21dp"
android:id="@+id/confide_free_logo"
android:layout_marginTop="@dimen/platform_dp_5"
android:layout_marginStart="@dimen/platform_dp_8"
>
</ImageView>
</FrameLayout>
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
app:layout_constraintTop_toBottomOf="@id/tv_content"
android:layout_marginTop="@dimen/platform_dp_12"
android:layout_marginLeft="@dimen/confide_dp_15"
android:background="@color/confide_line"/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="horizontal"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/rl_confide_title_layout"
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="@drawable/confide_common_bg"
android:id="@+id/rl_confide_title_layout"
>
android:background="@color/white"
android:orientation="horizontal">
<LinearLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/ll_bar_root"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="48dp">
android:layout_height="48dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/img_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="40dp"
android:layout_height="0dp"
android:layout_gravity="center_vertical"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:background="@drawable/confide_back"/>
android:scaleType="center"
android:src="@drawable/platform_common_back"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_title"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:text="@string/confide_title"
android:textColor="@color/black"
android:textSize="17dp"
android:textColor="#FFFFFF"
android:text="@string/confide_title"/>
<ImageView
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" />
<TextView
android:id="@+id/img_mine"
android:layout_width="wrap_content"
android:layout_width="40dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginBottom="2dp"
android:drawableTop="@drawable/ic_action_confide_order"
android:drawablePadding="2dp"
android:gravity="center"
android:text="订单"
android:textColor="@color/_9"
android:textSize="8sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toLeftOf="@+id/img_customer"/>
<TextView
android:id="@+id/img_customer"
android:layout_width="40dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginBottom="2dp"
android:drawableTop="@drawable/ic_action_confide_customer"
android:drawablePadding="2dp"
android:gravity="center"
android:text="客服"
android:textColor="@color/_9"
android:textSize="8sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toLeftOf="@+id/img_help" />
<TextView
android:id="@+id/img_help"
android:layout_width="40dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:background="@drawable/confide_mine"/>
</LinearLayout>
android:layout_marginBottom="2dp"
android:drawableTop="@drawable/ic_action_confide_help"
android:drawablePadding="2dp"
android:gravity="center"
android:text="帮助"
android:textColor="@color/_9"
android:textSize="8sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:background="@color/white"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="@+id/rl_title"
android:layout_marginLeft="@dimen/platform_dp_20"
android:layout_marginRight="@dimen/platform_dp_20"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/confide_close_icon"
android:id="@+id/close_webview_Icon"
android:visibility="gone"
android:layout_marginTop="@dimen/platform_dp_28"
android:layout_centerVertical="true"
>
</ImageView>
<TextView
android:id="@+id/text_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text=""
android:textColor="@color/black"
android:textSize="18dp"
android:visibility="gone">
</TextView>
<View
android:layout_width="@dimen/platform_dp_36"
android:layout_height="@dimen/platform_dp_6"
android:background="@drawable/confide_bottom_line"
android:id="@+id/line"
android:layout_marginTop="@dimen/platform_dp_12"
android:layout_centerInParent="true"
>
</View>
</RelativeLayout>
<com.ydl.webview.ProgressWebView
android:id="@+id/wv_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:layout_below="@id/rl_title"
/>
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<variable
name="item"
type="com.ydl.confide.home.adapter.ItemVideoShowViewModel" />
</data>
<androidx.cardview.widget.CardView
android:layout_width="52dp"
android:layout_height="52dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="10dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="10dp"
app:cardCornerRadius="6dp"
app:cardElevation="0dp">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:imageUrl="@{item.coverUrl}" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center"
android:layout_marginBottom="2dp"
android:maxLines="1"
android:text="@{item.name}"
android:textColor="@color/white"
android:textSize="10sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|left"
android:layout_marginBottom="2dp"
android:maxLines="1"
android:paddingLeft="4dp"
android:paddingTop="2dp"
android:paddingRight="4dp"
android:paddingBottom="2dp"
android:textColor="@color/white"
android:textSize="7sp"
app:confideLineRecentText="@{item.state}" />
</androidx.cardview.widget.CardView>
</layout>
<?xml version="1.0" encoding="utf-8"?>
<layout 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">
<data>
<import type="android.view.View" />
<import type="android.text.TextUtils" />
<variable
name="item"
type="com.ydl.confide.intro.VideoViewModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black">
<FrameLayout
android:id="@+id/videoView"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="@+id/layoutCall"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/ivCover"
android:layout_width="0dp"
android:layout_height="0dp"
app:imageUrl="@{item.coverUrl}"
app:layout_constraintBottom_toBottomOf="@+id/videoView"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/ivPlay"
android:layout_width="76dp"
android:layout_height="76dp"
android:src="@drawable/ic_video_play"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="@+id/videoView"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.yidianling.common.view.ui.VoicePlayingIcon
android:id="@+id/voicePlay"
android:layout_width="60dp"
android:layout_height="28dp"
android:layout_marginBottom="37dp"
android:paddingLeft="22dp"
android:paddingTop="6dp"
android:paddingRight="22dp"
android:paddingBottom="6dp"
android:visibility="gone"
app:layout_constraintBottom_toTopOf="@+id/tvName"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:shapeBg="@{0x26000000}"
app:shapeRadius="@{14}"
app:shapeStrokeColor="@{0xE6FFFFFF}"
app:shapeStrokeWidth="@{1}" />
<View
android:id="@+id/vDisableClick"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="@drawable/bg_expert_video_bottom_cover"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@+id/tvName"
tools:visibility="visible" />
<SeekBar
android:id="@+id/seekbar"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:maxHeight="10dp"
android:paddingStart="0dp"
android:paddingTop="8dp"
android:paddingEnd="0dp"
android:paddingBottom="8dp"
android:progressDrawable="@drawable/confide_seekbar_style"
android:splitTrack="false"
android:thumb="@drawable/confide_seekbar_thumb"
app:layout_constraintBottom_toTopOf="@+id/layoutCall"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/layoutCall"
android:layout_width="160dp"
android:layout_height="47dp"
android:layout_marginBottom="28dp"
android:background="@{item.lineStatus==3?@drawable/confide_line_bg_3:(item.lineStatus==2?@drawable/confide_line_bg_2:@drawable/confide_line_bg_1)}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
tools:background="@drawable/confide_line_bg_1">
<ImageView
android:id="@+id/ivCall"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginRight="4dp"
android:src="@drawable/ic_confide_call"
android:visibility="@{item.lineStatus==1?View.VISIBLE:View.GONE}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@+id/tvCall"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tvCall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="立即拨打"
android:textColor="@color/white"
android:textSize="16sp"
android:textStyle="bold"
app:confideLineText="@{item.lineStatus}"
app:layout_constraintBottom_toTopOf="@+id/tvTime"
app:layout_constraintLeft_toRightOf="@+id/ivCall"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed" />
<TextView
android:id="@+id/tvTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{item.remainingTime}"
android:textColor="@color/white"
android:textSize="10sp"
android:visibility="@{TextUtils.isEmpty(item.remainingTime)?View.GONE:View.VISIBLE}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="@+id/tvCall"
app:layout_constraintRight_toRightOf="@+id/tvCall"
app:layout_constraintTop_toBottomOf="@+id/tvCall"
tools:text="剩余1分40秒" />
</androidx.constraintlayout.widget.ConstraintLayout>
<!--<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/bg_confide_free"
android:paddingLeft="5dp"
android:paddingTop="2dp"
android:paddingRight="5dp"
android:paddingBottom="2dp"
android:text="首单免费"
android:textColor="@color/white"
android:textSize="11sp"
android:visibility="@{item.showFreeTag?View.VISIBLE:View.GONE}"
app:layout_constraintCircle="@+id/layoutCall"
app:layout_constraintCircleAngle="70"
app:layout_constraintCircleRadius="70dp" />-->
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/confide_first_free"
android:layout_width="@dimen/platform_dp_64"
android:layout_height="@dimen/platform_dp_34"
android:visibility="@{item.showFreeTag?View.VISIBLE:View.GONE}"
app:layout_constraintCircle="@+id/layoutCall"
app:layout_constraintCircleAngle="70"
app:layout_constraintCircleRadius="70dp" />
<TextView
android:id="@+id/tvTag"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:layout_marginRight="40dp"
android:layout_marginBottom="60dp"
android:maxLines="1"
android:text="@{item.tag}"
android:textColor="#99FFFFFF"
android:textSize="13sp"
app:layout_constraintBottom_toTopOf="@+id/layoutCall"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@+id/btnShare"
tools:text="tag|tag|tag" />
<TextView
android:id="@+id/tvIntro"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="40dp"
android:layout_marginBottom="8dp"
android:maxLines="3"
android:text="@{item.intro}"
android:textColor="@color/white"
android:textSize="15sp"
app:layout_constraintBottom_toTopOf="@+id/tvTag"
app:layout_constraintLeft_toLeftOf="@+id/tvTag"
app:layout_constraintRight_toLeftOf="@+id/btnShare"
tools:text="tag|tag|tag" />
<TextView
android:id="@+id/tvName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:text="@{item.name}"
android:textColor="@color/white"
android:textSize="19sp"
app:layout_constraintBottom_toTopOf="@+id/tvIntro"
app:layout_constraintLeft_toLeftOf="@+id/tvTag"
tools:text="tag|tag|tag" />
<TextView
android:id="@+id/tvConfideCount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginBottom="1dp"
android:text="@{item.count}"
android:textColor="@color/white"
android:textSize="13sp"
app:layout_constraintBottom_toBottomOf="@+id/tvName"
app:layout_constraintLeft_toRightOf="@+id/tvName"
tools:text="tag|tag|tag" />
<LinearLayout
android:id="@+id/btnShare"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="18dp"
android:layout_marginBottom="55dp"
android:orientation="vertical"
app:layout_constraintBottom_toTopOf="@+id/layoutCall"
app:layout_constraintRight_toRightOf="parent">
<ImageView
android:layout_width="29dp"
android:layout_height="29dp"
android:src="@drawable/ic_video_share" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/text_share" />
<!--<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="4dp"
android:text="分享"
android:textColor="@color/white"
android:textSize="11sp" />-->
</LinearLayout>
<LinearLayout
android:id="@+id/btnEvaluate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="18dp"
android:layout_marginBottom="20dp"
android:orientation="vertical"
app:layout_constraintBottom_toTopOf="@+id/btnShare"
app:layout_constraintRight_toRightOf="parent">
<ImageView
android:layout_width="29dp"
android:layout_height="29dp"
android:src="@drawable/ic_video_eval" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/text_eval" />
<!--<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="4dp"
android:text="评价"
android:textColor="@color/white"
android:textSize="11sp" />-->
</LinearLayout>
<LinearLayout
android:id="@+id/btnChat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="18dp"
android:layout_marginBottom="20dp"
android:gravity="center"
android:orientation="vertical"
app:layout_constraintBottom_toTopOf="@+id/btnEvaluate"
app:layout_constraintRight_toRightOf="parent">
<ImageView
android:layout_width="29dp"
android:layout_height="29dp"
android:src="@drawable/ic_video_chat" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/text_chat" />
<!--<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="4dp"
android:text="私聊"
android:textColor="@color/white"
android:textSize="11sp" />-->
</LinearLayout>
<ImageView
android:id="@+id/ivAvatar"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="20dp"
android:padding="1dp"
app:circle="@{true}"
app:imageUrl="@{item.avatar}"
app:layout_constraintBottom_toTopOf="@+id/btnChat"
app:layout_constraintRight_toRightOf="parent"
app:shape="@{1}"
app:shapeBg="@{0x00FFFFFF}"
app:shapeStrokeColor="@{0xFFFFFFFF}"
app:shapeStrokeWidth="@{1}" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<variable
name="item"
type="com.ydl.confide.home.adapter.ItemVideoShowViewModel" />
</data>
<androidx.cardview.widget.CardView
android:layout_width="180dp"
android:layout_height="140dp"
android:layout_marginLeft="6dp"
android:layout_marginTop="20dp"
android:layout_marginRight="6dp"
android:layout_marginBottom="10dp"
app:cardCornerRadius="8dp"
app:cardElevation="0dp">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
app:imageUrl="@{item.videoCoverUrl}" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom|left"
android:background="@drawable/bg_expert_video_item"
android:maxLines="1"
android:paddingLeft="10dp"
android:paddingBottom="10dp"
android:text="@{item.name}"
android:textColor="@color/white"
android:textSize="15sp" />
<ImageView
android:layout_width="33dp"
android:layout_height="33dp"
android:layout_gravity="center"
android:src="@drawable/ic_video_play" />
</androidx.cardview.widget.CardView>
</layout>
......@@ -4,4 +4,8 @@
<color name="confide_line">#F0F0F0</color>
<color name="confide_filters_line">#E0E0E0</color>
<color name="confide_category_bg">#FAFAFA</color>
<color name="confide_61CEAC">#61CEAC</color>
<color name="confide_48CC95">#48CC95</color>
<color name="confide_fe6040">#fe6040</color>
<color name="confide_aaaeba">#aaaeba</color>
</resources>
<resources>
<string name="confide_title">即时倾诉</string>
<string name="confide_title">倾诉热线</string>
<string name="confide_video_wifi_tip">当前处于非wifi环境下,播放会消耗流量,确定继续播放?</string>
<string name="confide_tip">提示</string>
<string name="confide_tip_remain_time">(剩余%s)</string>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="confide_NoTitleTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="android:windowActionBar">false</item>
......@@ -9,5 +10,22 @@
<item name="colorPrimaryDark">@color/platform_main_theme</item>
<item name="colorAccent">@color/platform_main_theme</item>
</style>
<style name="confide_dialog" parent="Theme.MaterialComponents.Light.BottomSheetDialog">
<!-- Customize your theme here. -->
</style>
<style name="CustomShapeAppearanceBottomSheetDialog" parent="Theme.MaterialComponents.Light.BottomSheetDialog">
<item name="cornerFamily">rounded</item>
<item name="cornerSizeTopRight">16dp</item>
<item name="cornerSizeTopLeft">16dp</item>
<item name="cornerSizeBottomRight">0dp</item>
<item name="cornerSizeBottomLeft">0dp</item>
<item name="background">@color/transparent</item>
</style>
<style name="AppBottomSheet" parent="Theme.Design.Light.BottomSheetDialog">
<item name="bottomSheetStyle">@style/AppBottomSheetStyle</item>
</style>
<style name="AppBottomSheetStyle" parent="Widget.Design.BottomSheet.Modal">
<item name="android:background">@drawable/confide_bottom_webview</item>
</style>
</resources>
\ No newline at end of file
......@@ -10,6 +10,7 @@ import com.ydl.ydl_router.manager.YDLRouterManager
import com.ydl.ydlcommon.data.http.RxUtils
import com.ydl.ydlcommon.data.http.ThrowableConsumer
import com.ydl.ydlcommon.router.IYDLRouterConstant
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.yidianling.course.R
import com.yidianling.course.bean.RedListParam
import com.yidianling.course.net.CourseRetrofitUtils
......@@ -62,6 +63,7 @@ class CourseRedPacketView : RelativeLayout {
}
JUMP_CONFIDE_HOME -> {//跳转倾诉频道页
// ARouter.getInstance().build("/confide/home").navigation()
ActionCountUtils.record("listen_counselor_list_page", "listen_counselor_list_page_visit", "3")
YDLRouterManager.router(IYDLRouterConstant.ROUTER_CONFIDE_HOME)
}
JUMP_EXPERT_INFO -> {//跳转专家详情页
......
......@@ -68,14 +68,9 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.fragment:fragment-ktx:1.2.4'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
api "com.airbnb.android:lottie:3.4.0"
implementation "com.alibaba:arouter-api:$arouter_api"
// 注意此处的依赖方式:kotlin中使用和java中使用方式有不同
kapt "com.alibaba:arouter-compiler:$arouter_compiler"
implementation rootProject.ext.dependencies["ydl-user-router"]
......@@ -87,6 +82,7 @@ dependencies {
implementation modularPublication('com.ydl:m-tests-api')
implementation modularPublication('com.ydl:m-home-api')
implementation modularPublication('com.ydl:m-im-api')
implementation modularPublication('com.ydl:m-confide-api')
implementation project(':ydl-webview')
implementation project(':ydl-media')
implementation project(":ydl-platform")
......@@ -98,6 +94,7 @@ dependencies {
compileOnly rootProject.ext.dependencies["ydl-m-home-api"]
compileOnly rootProject.ext.dependencies['ydl-m-tests-api']
compileOnly rootProject.ext.dependencies["ydl-m-im-api"]
compileOnly rootProject.ext.dependencies["ydl-m-confide-api"]
api (rootProject.ext.dependencies["ydl-platform"]) {
transitive = true
}
......
......@@ -40,7 +40,12 @@ class HomeBIConstants {
const val YDL_HOME_ZHUMIANMINGXIANG: String = YDL_USER_MAIN_PAGE + "ydl_user_sleep_aid_more_click" // 首页助眠冥想
const val YDL_HOME_ZHUMIANICON: String = YDL_USER_MAIN_PAGE + "ydl_user_sleep_aid_type_click" // 首页_助眠_icon
const val YDL_HOME_SEARCH_TAG: String = YDL_USER_MAIN_PAGE + "ydl_user_search_tag" // 首页_定制咨询点击tag
const val YDL_HOME_SEARCH_TAG_CLICK: String = YDL_USER_MAIN_PAGE + "ydl_user_search_tag_click" // 首页_定制咨询点击tag
const val YDL_HOME_POPUPWINDOWS_PAGE_POPUP: String = YDL_USER_MAIN_PAGE + "popupwindows_page_popup" // 首页弹窗页面弹出事件(99元3小时弹出事件)
const val YDL_HOME_POPUPWINDOWS_PAGE_POPUP_CLICK: String = YDL_USER_MAIN_PAGE + "popupwindows_page_popup_click"
// 首页弹窗页面弹出事件(99元3小时弹出事件)
//首页_冥想(ydl_user_main_page)
const val YDL_USER_MAIN_PAGE_MUSE: String = "ydl_user_main_page"//壹点灵用户版首页 partId
......
......@@ -7,8 +7,11 @@ import android.os.Bundle
import android.text.TextUtils
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.FragmentActivity
import androidx.recyclerview.widget.RecyclerView
import com.alibaba.android.arouter.launcher.ARouter
import com.ydl.confide.api.ConfideRoute
import com.ydl.confide.api.IConfideService
import com.ydl.media.audio.AudioPlayer
import com.ydl.media.audio.model.Music
import com.ydl.media.view.PlayTypeEnum
......@@ -23,7 +26,8 @@ import com.ydl.ydlcommon.base.config.HttpConfig
import com.ydl.ydlcommon.bean.ShareData
import com.ydl.ydlcommon.data.PlatformRamImpl
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.modular.ModularServiceManager.provide
import com.ydl.ydlcommon.modular.findRouteService
import com.ydl.ydlcommon.modular.route
import com.ydl.ydlcommon.router.IYDLRouterConstant
import com.ydl.ydlcommon.utils.LogUtil
import com.ydl.ydlcommon.utils.Utils
......@@ -293,7 +297,7 @@ open class HomeBaseImpl : IHomeBaseEvent {
ActionCountUtils.count(HomeBIConstants.YDL_USER_CONSULT_CLICK)
}
override fun nowConfideClick() {
override fun nowConfideClick(listenFree: Boolean) {
if (Utils.isFastClick()) {
//防止连击
return
......@@ -301,7 +305,8 @@ open class HomeBaseImpl : IHomeBaseEvent {
ActionCountUtils.count(HomeBIConstants.YDL_USER_TALK_IN_TIME_CLICK)
//倾诉首页 ydl-user://confide/home
YDLRouterManager.router(IYDLRouterConstant.ROUTER_CONFIDE_HOME)
ActionCountUtils.record("listen_counselor_list_page", "listen_counselor_list_page_visit", "1")
route(mContext, ConfideRoute.R_CONFIDE_HOME)
}
override fun psychologyClassClick() {
......@@ -343,7 +348,7 @@ open class HomeBaseImpl : IHomeBaseEvent {
* 倾述咨询师点击
* @param linkUrl 跳转地址
*/
override fun confideClick(linkUrl: String?, doctorId: Int) {
override fun confideClick(linkUrl: String?, confideId:String, doctorId: Int, uid:String?) {
if (Utils.isFastClick()) {
//防止连击
return
......@@ -357,14 +362,13 @@ open class HomeBaseImpl : IHomeBaseEvent {
doctorId.toString()
)
if (linkUrl.startsWith("http")) {
YDLRouterManager.router(
IYDLRouterConstant.ROUTER_H5_H5,
YDLRouterParams().putExtra(IYDLRouterConstant.EXTRA_URL, linkUrl), ""
findRouteService(IConfideService::class.java)
.showExpertDetailDialog(
mContext as FragmentActivity,
HttpConfig.MH5_URL + ConfideRoute.h5ConfideIntro(confideId),
doctorId.toString(),
uid ?: ""
)
} else {
YDLRouterManager.router(linkUrl)
}
}
/**
......
package com.yidianling.home.event
import androidx.recyclerview.widget.RecyclerView
import android.view.View
import androidx.recyclerview.widget.RecyclerView
import com.yidianling.home.model.bean.*
/**
......@@ -82,7 +82,7 @@ interface IHomeBaseEvent {
/**
* 即可倾诉点击事件
*/
fun nowConfideClick()
fun nowConfideClick(listenFree: Boolean)
/**
* 心理课堂点击事件
......@@ -103,7 +103,7 @@ interface IHomeBaseEvent {
* 倾述咨询师点击
* @param linkUrl 跳转地址
*/
fun confideClick(linkUrl: String?, doctorId: Int)
fun confideClick(linkUrl: String?, confideId:String, doctorId: Int, uid: String?)
/**
* 私聊
*/
......
......@@ -199,6 +199,7 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>()
if (!TextUtils.isEmpty(act.imageUrl)) {
img_ad.visibility = View.VISIBLE
img_ad_card.visibility = View.VISIBLE
ActionCountUtils.count(HomeBIConstants.YDL_HOME_SEARCH_TAG,"1")
GlideApp.with(this).load(act.imageUrl).into(img_ad)
img_ad.setOnClickListener {
if (Utils.isFastClick()) {
......@@ -211,7 +212,8 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>()
YDLRouterManager.router(act.btnLinkurl)
}
//定制咨询点击事件埋点
ActionCountUtils.count(HomeBIConstants.YDL_HOME_SEARCH_TAG,"1")
ActionCountUtils.count(HomeBIConstants.YDL_HOME_SEARCH_TAG_CLICK,"1")
}
} else {
......@@ -233,6 +235,8 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>()
if (!TextUtils.isEmpty(act.imageBanner)) {
//展示弹窗
if (aa == null) {
//99元3小时弹出事件
ActionCountUtils.count(HomeBIConstants.YDL_HOME_POPUPWINDOWS_PAGE_POPUP,act.title)
aa = ActivityDialog(mActivity!!, act.imageBanner, act.linkUrl, act.title)
aa?.show()
aa?.setOnDismissListener {
......@@ -248,8 +252,6 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>()
location[1] - heig,
location[0]
).show()
//99元3小时弹出事件
ActionCountUtils.count(HomeBIConstants.YDL_HOME_POPUPWINDOWS_PAGE_POPUP,"1")
}
}
}
......
......@@ -7,7 +7,9 @@ import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity
import com.ydl.ydl_image.module.GlideApp
import com.ydl.ydl_router.manager.YDLRouterManager
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.yidianling.home.R
import com.yidianling.home.constants.HomeBIConstants
import kotlinx.android.synthetic.ydl.home_dialog_activity.*
import java.lang.ref.WeakReference
......@@ -48,6 +50,9 @@ class ActivityDialog : Dialog {
}
img_activity.setOnClickListener {
//跳转
//99元3小时点击事件
ActionCountUtils.count(HomeBIConstants.YDL_HOME_POPUPWINDOWS_PAGE_POPUP_CLICK,title?:"1")
if (this.linkUrl != null && this.linkUrl!!.startsWith("http")) {
NewH5Activity.start(context, H5Params(this.linkUrl!!, null))
} else {
......
......@@ -49,6 +49,7 @@ import kotlinx.android.synthetic.ydl.home_muse_view.view.*
import kotlin.properties.Delegates
/**
* @author <a href="https://www.jianshu.com/u/c1e5310dd724">xujian</a>
* @描述: 壹点灵首页fragment
......@@ -209,7 +210,7 @@ open class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterIm
homeEvent?.reservationExpertsClick()
}
tv_confide.setOnClickListener {
homeEvent?.nowConfideClick()
homeEvent?.nowConfideClick(adapter?.listenFree ?: false)
}
tv_course.setOnClickListener {
homeEvent?.psychologyClassClick()
......@@ -304,6 +305,8 @@ open class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterIm
if (act != null) {
if (!TextUtils.isEmpty(act!!.imageUrl)) {
img_ad.visibility = View.VISIBLE
ActionCountUtils.count(HomeBIConstants.YDL_HOME_SEARCH_TAG,act.title?:"1")
GlideApp.with(this).load(act!!.imageUrl).into(img_ad)
img_ad.setOnClickListener {
if (Utils.isFastClick()) {
......@@ -316,7 +319,7 @@ open class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterIm
YDLRouterManager.router(act.btnLinkurl)
}
//定制咨询点击事件埋点
ActionCountUtils.count(HomeBIConstants.YDL_HOME_SEARCH_TAG,"1")
ActionCountUtils.count(HomeBIConstants.YDL_HOME_SEARCH_TAG_CLICK,act.title?:"1")
}
} else {
img_ad.visibility = View.GONE
......@@ -337,14 +340,13 @@ open class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterIm
if (!TextUtils.isEmpty(act.imageBanner)) {
//展示弹窗
if (aa == null) {
ActionCountUtils.count(HomeBIConstants.YDL_HOME_POPUPWINDOWS_PAGE_POPUP,act?.title?:"1")
aa = ActivityDialog(mActivity, act.imageBanner, act.linkUrl, act.title)
aa?.show()
aa?.setOnDismissListener {
//文案不为空才显示引导--李思开
if (!TextUtils.isEmpty(act.title)) {
ActivityGuideDialog(mActivity, act.imageUrl, act.title).show()
//99元3小时弹出事件
ActionCountUtils.count(HomeBIConstants.YDL_HOME_POPUPWINDOWS_PAGE_POPUP,"1")
}
}
}
......
......@@ -8,10 +8,9 @@ import android.widget.LinearLayout
import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide
import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.yidianling.common.tools.LogUtil
import com.yidianling.common.tools.RxDeviceTool
import com.yidianling.home.R
import com.yidianling.home.event.IHomeBaseEvent
import com.yidianling.common.tools.RxDeviceTool
import kotlinx.android.synthetic.ydl.home_button_banner_view.view.*
/**
......@@ -54,7 +53,7 @@ class HomeButtonBannerView(private val mContext: Context, private var homeEvent:
homeEvent?.reservationExpertsClick()
}
homeModuleButtonBannerSecond.setOnClickListener {
homeEvent?.nowConfideClick()
homeEvent?.nowConfideClick(listenFree)
}
homeModuleButtonBannerThird.setOnClickListener {
homeEvent?.psychologyClassClick()
......
......@@ -7,12 +7,12 @@ import android.text.TextUtils
import android.view.View
import android.view.ViewGroup
import android.widget.FrameLayout
import com.yidianling.home.R
import com.yidianling.home.event.IHomeBaseEvent
import com.yidianling.home.model.bean.HomeConfideBean
import com.ydl.ydl_image.config.SimpleImageOpConfiger
import com.ydl.ydl_image.manager.YDLImageCacheManager
import com.yidianling.common.tools.RxImageTool
import com.yidianling.home.R
import com.yidianling.home.event.IHomeBaseEvent
import com.yidianling.home.model.bean.HomeConfideBean
import kotlinx.android.synthetic.ydl.home_confide_expert_info_view.view.*
/**
......@@ -65,7 +65,7 @@ class HomeConfideExpertInfoView(private var mContext: Context, private var homeE
view_line.visibility = View.VISIBLE
}
this.setOnClickListener {
homeEvent!!.confideClick(bean.linkUrl,bean.doctorId)
homeEvent!!.confideClick(bean.linkUrl, bean.confidedId.toString(), bean.doctorId, bean.uid.toString())
}
}
......@@ -130,7 +130,7 @@ class HomeConfideExpertInfoView(private var mContext: Context, private var homeE
if (bodyBean.confideLine == 2) {//喊他上线 私聊
homeEvent!!.toChatForMsg(bodyBean.uid.toString())
} else {
homeEvent!!.confideClick(bodyBean.linkUrl, bodyBean.doctorId)
homeEvent!!.confideClick(bodyBean.linkUrl, bodyBean.confidedId.toString(), bodyBean.doctorId, bodyBean.uid.toString())
}
}
}
......
......@@ -10,6 +10,7 @@ import android.widget.TextView
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.tabs.TabLayout
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.yidianling.common.tools.LogUtil
import com.yidianling.home.R
import com.yidianling.home.constract.HomeViewConfig
......@@ -47,6 +48,7 @@ class HomeConfideView(private val mContext: Context, private var homeEvent: IHom
View.inflate(mContext, R.layout.home_confide_view, this)
homeModuleConfideViewHomeCommonTitleView.setTitle(HomeViewConfig.getOrder().confideTitle)
homeModuleConfideViewHomeCommonTitleView.setOnClickListener {
ActionCountUtils.record("listen_counselor_list_page", "listen_counselor_list_page_visit", "2")
homeEvent?.confideMoreClick()
}
}
......
......@@ -466,8 +466,8 @@ public class SessionHelper {
NimUIKit.registerMsgItemViewHolder(CustomAttachConsultPerfectData.class, MsgViewHolderPerfectConsultData.class);//完善咨询资料提醒消息
NimUIKit.registerMsgItemViewHolder(CustomAttachPleaseSubscribeConsultDate.class, MsgViewHolderPleaseSubscribeConsultDate.class);//请预约咨询时间
NimUIKit.registerMsgItemViewHolder(CustomCustomerServiceCardAttachment.class, MsgViewHolderCustomerServiceCard.class);//客服小壹名片
NimUIKit.registerMsgItemViewHolder(CustomAttachmentShareMsg.class, MsgViewHolderShareMsg.class);//分享推送
NimUIKit.registerMsgItemViewHolder(CustomAttachConsultCallStatus.class, MsgViewHolderConsultCallStatus.class);//咨询声网的拨打状态
NimUIKit.registerMsgItemViewHolder(CustomAttachmentShareMsg.class, MsgViewHolderShareMsg.class);//分享推送30
NimUIKit.registerMsgItemViewHolder(CustomAttachConsultCallStatus.class, MsgViewHolderConsultCallStatus.class);//咨询声网的拨打状态 32
NimUIKit.registerMsgItemViewHolder(CustomAttachAssistantReceivedMoney.class, MsgViewHolderAssistantReceivedMoney.class);
NimUIKit.registerMsgItemViewHolder(CustomAttachmentBusinessCard.class, MsgViewHolderBusinessCard.class);//专家自定义名片 ,TYPE=34
NimUIKit.registerMsgItemViewHolder(CustomAttachmentJumpToDaoYi.class, MsgViewHolderJumpToDaoYi.class);//跳转导医聊天窗口触发导医分配逻辑,TYPE=35
......
......@@ -21,27 +21,29 @@ public class CustomAttachmentShareMsg extends CustomAttachment {
private final String KEY_SHAREPOPULAR="sharePopular";// 分享的人气
private final String KEY_SHARE_JUMP_URL="url";// 分享的跳转链接
private final String KEY_CONFIDEDID="confidedId";//倾诉id
private final String KEY_DOCTORID="doctorId";
private String shareUrl;
private String sharePrice;
//分享类型,0:测试;1,课程;2,文章;3:倾诉
private int shareType;
private String confidedId;
private String doctorId;
public CustomAttachmentShareMsg() {
super(CustomAttachmentType.TYPE_PUSH_SHARE);
}
public CustomAttachmentShareMsg(String url, String money, ShareMsgTypeEnum typeEnum) {
super(CustomAttachmentType.TYPE_PUSH_SHARE);
this.shareUrl = url;
this.sharePrice = money;
this.shareType = typeEnum.value();
}
@Override
protected void parseData(JSONObject data) {
this.shareUrl=data.getString(KEY_SHARE_JUMP_URL);
this.sharePrice =data.getString(KEY_PRICE);
this.shareType = data.getInteger(KEY_SHARETYPE);
this.confidedId = data.getString(KEY_CONFIDEDID);
this.doctorId = data.getString(KEY_DOCTORID);
}
@Override
......@@ -50,6 +52,8 @@ public class CustomAttachmentShareMsg extends CustomAttachment {
data.put(KEY_SHARE_JUMP_URL, shareUrl);
data.put(KEY_PRICE, sharePrice);
data.put(KEY_SHARETYPE, shareType);
data.put(KEY_CONFIDEDID, confidedId);
data.put(KEY_DOCTORID, doctorId);
return data;
}
......@@ -64,4 +68,11 @@ public class CustomAttachmentShareMsg extends CustomAttachment {
public int getShareType() {
return shareType;
}
public String getConfidedId() {
return confidedId;
}
public String getDoctorId() {
return doctorId;
}
}
package com.yidianling.im.session.viewholder;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
......@@ -15,7 +14,8 @@ import com.yidianling.uikit.business.session.viewholder.MsgViewHolderBase;
*/
public class MsgViewHolderConsultCallStatus extends MsgViewHolderBase {
private ImageView typeImage;
private ImageView typeImageLeft;
private ImageView typeImageRight;
private TextView statusLabel;
public MsgViewHolderConsultCallStatus(BaseMultiItemFetchLoadAdapter adapter) {
......@@ -29,7 +29,8 @@ public class MsgViewHolderConsultCallStatus extends MsgViewHolderBase {
@Override
protected void inflateContentView() {
typeImage = findViewById(R.id.type_img);
typeImageLeft = findViewById(R.id.type_img_left);
typeImageRight = findViewById(R.id.type_img_right);
statusLabel = findViewById(R.id.tv_state);
}
......@@ -43,33 +44,20 @@ public class MsgViewHolderConsultCallStatus extends MsgViewHolderBase {
private void layoutByDirection(CustomAttachConsultCallStatus customAttachTipMsg) {
if (isReceivedMessage()) {
typeImage.setImageResource(R.drawable.im_avchat_left_type_audio);
typeImageLeft.setVisibility(View.VISIBLE);
typeImageRight.setVisibility(View.GONE);
} else {
typeImage.setImageResource(R.drawable.im_avchat_right_type_audio);
typeImageLeft.setVisibility(View.GONE);
typeImageRight.setVisibility(View.VISIBLE);
}
if (TextUtils.equals("1", customAttachTipMsg.getStatus())) {
typeImage.setVisibility(View.VISIBLE);
if ("true".equals(customAttachTipMsg.getIsConsultOrder())) {
statusLabel.setText("通话接听时长 " + customAttachTipMsg.getDuration());
} else {
statusLabel.setText("通话拨打时长 " + customAttachTipMsg.getDuration());
}
} else {
typeImage.setVisibility(View.GONE);
if (isReceivedMessage()) {
statusLabel.setText(customAttachTipMsg.getCallee());
} else {
statusLabel.setText(customAttachTipMsg.getCaller());
}
}
//只有倾诉加角标,咨询不加
if (!"true".equals(customAttachTipMsg.getIsConsultOrder())) {
showAudioSmallTip();
} else {
hideAudioSmallTip();
}
}
@Override
protected int leftBackground() {
......
......@@ -59,7 +59,9 @@ public class MsgViewHolderReceivedMoney extends MsgViewHolderBase {
num = customAttachReceivedMoney.getNum();
isNewOrder = customAttachReceivedMoney.getNewOrder();
if (title != null) tit.setText(title);
if (title != null) {
tit.setText(title);
}
if (orPay == 1) {
//支付成功
if (num != null) {
......
package com.yidianling.im.session.viewholder;
import android.annotation.SuppressLint;
import android.widget.TextView;
import com.netease.nimlib.sdk.msg.attachment.MsgAttachment;
import com.ydl.webview.H5Params;
import com.ydl.webview.NewH5Activity;
import com.ydl.ydlcommon.utils.Utils;
import com.ydl.ydlcommon.utils.remind.HttpErrorUtils;
import com.yidianling.common.tools.ToastUtil;
import com.yidianling.im.R;
import com.yidianling.im.bean.PushConfideStatusBean;
import com.yidianling.im.http.ImRetrofitApi;
import com.yidianling.im.router.ImIn;
import com.yidianling.im.session.extension.CustomAttachmentShareMsg;
import com.yidianling.nimbase.common.ui.recyclerview.adapter.BaseMultiItemFetchLoadAdapter;
import com.yidianling.user.api.bean.UserResponseBean;
import com.yidianling.uikit.business.session.viewholder.MsgViewHolderBase;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
/**
* Created by haorui on 2019-11-06 .
* Des: 分享 消息
* 分享的类型,0:测试;1,课程;2,文章;3:倾诉
*/
public class MsgViewHolderShareMsg extends MsgViewHolderBase {
private TextView tv_confide_money;
private TextView tv_confide;
public String mShareUrl;
public String mPrice;
private int mShareType;
private Disposable mSubscribe;
public MsgViewHolderShareMsg(BaseMultiItemFetchLoadAdapter adapter) {
super(adapter);
}
@Override
protected int getContentResId() {
MsgAttachment attachment = message.getAttachment();
if (attachment instanceof CustomAttachmentShareMsg) {
CustomAttachmentShareMsg customMsg = (CustomAttachmentShareMsg) attachment;
switch (customMsg.getShareType()) {
//0:测试;
case 0:
return R.layout.im_ui_message_custom_confide;
//1,课程;
case 1:
return R.layout.im_ui_message_custom_confide;
//2,文章;
case 2:
return R.layout.im_ui_message_custom_confide;
//3:倾诉
case 3:
return R.layout.im_ui_message_custom_confide;
}
}
return R.layout.im_ui_message_custom_confide;
}
@Override
protected void inflateContentView() {
tv_confide_money = view.findViewById(R.id.tv_confide_money);
tv_confide = view.findViewById(R.id.tv_confide);
}
@Override
protected void bindContentView() {
MsgAttachment attachment = message.getAttachment();
if (attachment instanceof CustomAttachmentShareMsg) {
mShareUrl = ((CustomAttachmentShareMsg) attachment).getShareUrl();
mPrice = ((CustomAttachmentShareMsg) attachment).getSharePrice();
mShareType = ((CustomAttachmentShareMsg) attachment).getShareType();
}
if (isReceivedMessage()) {
setAvatarRightInVisibity();
} else {
setAvatarLeftInVisibity();
}
switch (mShareType) {
//0:测试;
case 0:
break;
//1,课程;
case 1:
break;
//2,文章;
case 2:
break;
//3:倾诉
case 3:
tv_confide_money.setText(mPrice);
break;
}
}
@Override
protected void onItemClick() {
super.onItemClick();
if (Utils.isFastClick()) {
//防止连击
return;
}
requestConfideStatus();
}
@SuppressLint("CheckResult")
private void requestConfideStatus() {
if(mSubscribe != null && !mSubscribe.isDisposed()){
mSubscribe.dispose();
}
UserResponseBean userInfo = ImIn.INSTANCE.getUserResponse();
mSubscribe = ImRetrofitApi.Companion.getImJavaApi().getPushConfideStatus(userInfo.getUid(), message.getFromAccount()).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(it -> {
if ("200".equals(it.code)) {
PushConfideStatusBean data = it.data;
if (data.getIsOpen() != 1) {
ToastUtil.toastShort(view.getContext().getString(R.string.im_push_confide_msg_unopened));
return;
}
if (data.getIsOnline() != 1) {
ToastUtil.toastShort(view.getContext().getString(R.string.im_push_confide_msg_offline));
return;
}
if (data.getIsReducible() != 1) {
ToastUtil.toastShort(view.getContext().getString(R.string.im_push_confide_msg_busy));
return;
}
if (data.getIsStatus() != 1) {
ToastUtil.toastShort(view.getContext().getString(R.string.im_push_confide_msg_calling));
return;
}
NewH5Activity.start(view.getContext(), new H5Params(mShareUrl, null));
}
}, t -> {
HttpErrorUtils.Companion.handleError(context, t);
});
}
}
package com.yidianling.im.session.viewholder
import android.annotation.SuppressLint
import android.widget.TextView
import com.ydl.confide.api.ConfideRoute.R_CONFIDE_HOME
import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity
import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.ydl.ydlcommon.modular.route
import com.ydl.ydlcommon.router.IYDLRouterConstant
import com.ydl.ydlcommon.utils.Utils
import com.ydl.ydlcommon.utils.remind.HttpErrorUtils.Companion.handleError
import com.yidianling.common.tools.ToastUtil
import com.yidianling.im.R
import com.yidianling.im.bean.PushConfideStatusBean
import com.yidianling.im.http.ImRetrofitApi.Companion.getImJavaApi
import com.yidianling.im.router.ImIn.getUserResponse
import com.yidianling.im.session.extension.CustomAttachmentShareMsg
import com.yidianling.nimbase.common.ui.recyclerview.adapter.BaseMultiItemFetchLoadAdapter
import com.yidianling.uikit.business.session.viewholder.MsgViewHolderBase
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
import io.reactivex.schedulers.Schedulers
/**
* Created by haorui on 2019-11-06 .
* Des: 分享 消息
* 分享的类型,0:测试;1,课程;2,文章;3:倾诉
* 消息由咨询师端触发
*/
class MsgViewHolderShareMsg(adapter: BaseMultiItemFetchLoadAdapter<*, *>?) :
MsgViewHolderBase(adapter) {
private var tv_confide_money: TextView? = null
private var tv_confide: TextView? = null
var mShareUrl: String? = null
var mPrice: String? = null
private var mShareType = 0
private var mSubscribe: Disposable? = null
private var mConfidedId: String? = null
private var mDoctorId: String? = null
//测试
val Type0 = 0
//课程
private val Type1 = 1
//文章
private val Type2 = 2
//倾诉
private val Type3 = 3
private val SUCCESS_CODE = "200"
override fun getContentResId(): Int {
val attachment = message.attachment
if (attachment is CustomAttachmentShareMsg) {
return when (attachment.shareType) {
Type0 -> R.layout.im_ui_message_custom_confide
Type1 -> R.layout.im_ui_message_custom_confide
Type2 -> R.layout.im_ui_message_custom_confide
Type3 -> R.layout.im_ui_message_custom_confide
else -> R.layout.im_ui_message_custom_confide
}
}
return R.layout.im_ui_message_custom_confide
}
override fun inflateContentView() {
tv_confide_money = view.findViewById(R.id.tv_confide_money)
tv_confide = view.findViewById(R.id.tv_confide)
}
override fun bindContentView() {
val attachment = message.attachment
if (attachment is CustomAttachmentShareMsg) {
mShareUrl = attachment.shareUrl
mPrice = attachment.sharePrice
mShareType = attachment.shareType
mConfidedId = attachment.confidedId
mDoctorId = attachment.doctorId
}
if (isReceivedMessage) {
setAvatarRightInVisibity()
} else {
setAvatarLeftInVisibity()
}
when (mShareType) {
Type0 -> {
}
Type1 -> {
}
Type2 -> {
}
Type3 -> tv_confide_money!!.text = mPrice
else -> {
}
}
}
override fun onItemClick() {
super.onItemClick()
if (Utils.isFastClick()) {
//防止连击
return
}
requestConfideStatus()
}
@SuppressLint("CheckResult")
private fun requestConfideStatus() {
if (mSubscribe != null && !mSubscribe!!.isDisposed) {
mSubscribe!!.dispose()
}
val userInfo = getUserResponse()
mSubscribe = getImJavaApi().getPushConfideStatus(userInfo!!.uid!!, message.fromAccount)
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(
{ it: BaseAPIResponse<PushConfideStatusBean> ->
if (SUCCESS_CODE == it.code) {
val data = it.data
if (data.isOpen != 1) {
ToastUtil.toastShort(view.context.getString(R.string.im_push_confide_msg_unopened))
return@subscribe
}
if (data.isOnline != 1) {
ToastUtil.toastShort(view.context.getString(R.string.im_push_confide_msg_offline))
return@subscribe
}
if (data.isReducible != 1) {
ToastUtil.toastShort(view.context.getString(R.string.im_push_confide_msg_busy))
return@subscribe
}
if (data.isStatus != 1) {
ToastUtil.toastShort(view.context.getString(R.string.im_push_confide_msg_calling))
return@subscribe
}
if (mShareType == Type3 && mConfidedId != null && mDoctorId != null) {
//新版本走倾诉列表逻辑
route(view.context, R_CONFIDE_HOME,
IYDLRouterConstant.EXTRA_CONFIDEDID to mConfidedId,
IYDLRouterConstant.EXTRA_DOCTORID to mDoctorId)
} else {
//老版本去专家主页
NewH5Activity.start(view.context, H5Params(mShareUrl!!, null))
}
}
}) { t: Throwable? -> handleError(context, t!!) }
}
}
\ No newline at end of file
......@@ -8,6 +8,7 @@
<TextView
android:padding="12dp"
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
......@@ -20,9 +21,9 @@
android:id="@+id/message_layout"
android:layout_width="match_parent"
android:layout_height="88dp"
android:layout_marginLeft="12dp"
android:layout_marginRight="12dp"
android:layout_below="@+id/tv_title"
android:layout_marginTop="10dp"
android:layout_marginBottom="11dp"
android:background="@drawable/im_bg_push_confide_content"
android:orientation="vertical"
android:padding="10dp">
......@@ -103,15 +104,15 @@
android:layout_below="@+id/message_layout"
android:layout_alignLeft="@+id/message_layout"
android:layout_weight="1"
android:padding="12dp"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="18dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:includeFontPadding="false"
android:text="¥"
android:textSize="8sp"
android:textStyle="bold" />
......
......@@ -9,14 +9,15 @@
android:orientation="horizontal">
<ImageView
android:id="@+id/type_img"
android:id="@+id/type_img_left"
android:layout_width="14dp"
android:layout_height="14dp"
android:layout_gravity="center_vertical"
android:layout_marginLeft="3dp"
android:layout_marginRight="3dp"
android:contentDescription="@string/im_empty"
android:src="@drawable/im_avchat_left_type_audio"/>
android:visibility="gone"
android:src="@drawable/im_avchat_type_audio"/>
<TextView
android:id="@+id/tv_state"
......@@ -28,4 +29,15 @@
android:text="无人接听"
android:textColor="@color/platform_color_242424"
android:textSize="14sp"/>
<ImageView
android:visibility="gone"
android:id="@+id/type_img_right"
android:layout_width="14dp"
android:layout_height="14dp"
android:layout_gravity="center_vertical"
android:layout_marginLeft="3dp"
android:layout_marginRight="3dp"
android:contentDescription="@string/im_empty"
android:src="@drawable/im_avchat_type_audio"/>
</LinearLayout>
......@@ -342,12 +342,13 @@ object OneKeyLoginHelp {
.setAppPrivacyTwo("隐私协议", appPrivacyTwo)
.setAppPrivacyColor(Color.parseColor("#bfbfbf"), Color.parseColor("#991da1f2"))
.setCheckboxHidden(checkBoxHidden) // 设置是否同意协议的checkbox隐藏
.setCheckBoxHeight(16)
.setCheckBoxWidth(16)
.setCheckBoxHeight(24)
.setCheckBoxWidth(24)
.setCheckedImgPath("user_login_protocol_selected_new")
.setUncheckedImgPath("user_login_protocol_unselected_new")
.setPrivacyBefore(mPrivacyBeforeText)
.setPrivacyMargin(35)
.setProtocolGravity(Gravity.CENTER_VERTICAL)
.setScreenOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT) // 设置竖屏
// .setAuthPageActIn("in_activity", "out_activity")
// .setAuthPageActOut("in_activity", "out_activity")
......@@ -394,12 +395,13 @@ object OneKeyLoginHelp {
.setAppPrivacyTwo("隐私协议", "https://m.ydl.com/Protol/yinsi")
.setAppPrivacyColor(Color.parseColor("#bfbfbf"), Color.parseColor("#991da1f2"))
.setCheckboxHidden(checkBoxHidden) // 设置是否同意协议的checkbox隐藏
.setCheckBoxHeight(16)
.setCheckBoxWidth(16)
.setCheckedImgPath("user_login_protocol_selected_new")
.setUncheckedImgPath("user_login_protocol_unselected_new")
.setCheckBoxHeight(22)
.setCheckBoxWidth(24)
.setCheckedImgPath("user_login_protocol_selected_dialog")
.setUncheckedImgPath("user_login_protocol_unselected_dialog")
.setPrivacyBefore(mPrivacyBeforeText)
.setPrivacyMargin(35)
.setProtocolGravity(Gravity.FILL_VERTICAL)
.setDialogHeight(dialogHeight)
.setDialogBottom(true)
.setScreenOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT) // 设置竖屏
......
......@@ -185,8 +185,8 @@
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:id="@+id/iv_select_protocol"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="36dp"
android:layout_height="36dp"
android:src="@drawable/user_login_protocol_unselected_new" />
<TextView
......
......@@ -3,6 +3,6 @@
<corners android:radius="10dp" />
<solid android:color="#99000000" />
<solid android:color="#60000000" />
</shape>
\ No newline at end of file
......@@ -20,13 +20,14 @@
android:layout_height="20dp"
android:layout_gravity="center"
android:layout_marginLeft="12.5dp"
android:layout_marginRight="@dimen/platform_dp_25"
android:padding="2.5dp"
android:src="@drawable/ico_play_float_pause"
android:visibility="visible" />
<ImageView
android:id="@+id/play_head"
android:layout_width="66dp"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginLeft="12.5dp"
android:src="@drawable/ico_play_float_pic" />
......@@ -35,7 +36,8 @@
android:id="@+id/rl_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="6dp"
android:layout_marginLeft="@dimen/platform_dp_18"
android:layout_marginRight="@dimen/platform_dp_18"
android:layout_weight="1">
<TextView
......
/*___Generated_by_IDEA___*/
package com.ydl.ydlcommon;
/* This stub is only used by the IDE. It is NOT the BuildConfig class actually packed into the APK */
public final class BuildConfig {
public final static boolean DEBUG = Boolean.parseBoolean(null);
}
\ No newline at end of file
/*___Generated_by_IDEA___*/
package com.ydl.ydlcommon;
/* This stub is only used by the IDE. It is NOT the Manifest class actually packed into the APK */
public final class Manifest {
}
\ No newline at end of file
/*___Generated_by_IDEA___*/
package com.ydl.ydlcommon;
/* This stub is only used by the IDE. It is NOT the R class actually packed into the APK */
public final class R {
}
\ No newline at end of file
package com.ydl.ydlcommon.modular
import android.content.Context
import android.os.Bundle
import android.os.Parcelable
import com.alibaba.android.arouter.facade.template.IProvider
import com.alibaba.android.arouter.launcher.ARouter
import com.ydl.ydlcommon.BuildConfig
import com.ydl.ydlcommon.utils.LogUtil
......@@ -9,6 +13,65 @@ import com.ydl.ydlcommon.utils.LogUtil
* Created by haorui on 2019-09-21 .
* Des:查找 Arouter 服务封装类
*/
fun <T> findRouteService(clz: Class<T>): T {
val service = ARouter.getInstance().navigation(clz)
if (service != null) return service
if (BuildConfig.DEBUG) {
throw IllegalStateException("check module dependency by [${clz.simpleName}]")
}
return service
}
fun route(context: Context?, route: String, vararg params: Pair<String, Any?>) {
val build = ARouter.getInstance().build(route)
params.forEach {
when (val value = it.second) {
is Boolean -> {
build.withBoolean(it.first, value)
}
is Char -> {
build.withChar(it.first, value)
}
is Int -> {
build.withInt(it.first, value)
}
is Long -> {
build.withLong(it.first, value)
}
is Float -> {
build.withFloat(it.first, value)
}
is Double -> {
build.withDouble(it.first, value)
}
is Short -> {
build.withShort(it.first, value)
}
is Byte -> {
build.withByte(it.first, value)
}
is String -> {
build.withString(it.first, value)
}
is Bundle -> {
build.withBundle(it.first, value)
}
is CharSequence -> {
build.withCharSequence(it.first, value)
}
is Parcelable -> {
build.withParcelable(it.first, value)
}
}
}
if (context == null) {
build.navigation()
} else {
build.navigation(context)
}
}
object ModularServiceManager {
private val routerMap: HashMap<String, IProvider> = HashMap()
......
......@@ -79,6 +79,9 @@ interface IYDLRouterConstant{
const val EXTRA_CATETITLE = "cateTitle"
const val EXTRA_SHOWTYPE = "showType"
const val EXTRA_KEYWORD = "keyword"
const val EXTRA_RED_PACKET = "by_red_packet"
const val EXTRA_CONFIDEDID = "confidedId"
const val EXTRA_DOCTORID = "doctorId"
/**
* 冥想模块额外参数
......
package com.ydl.ydlcommon.ui
import android.content.Context
import androidx.fragment.app.DialogFragment
import androidx.fragment.app.FragmentActivity
object Loading {
private var loadingDialogFragment: DialogFragment? = null
fun show(context: Context?, msg: String? = null) {
if (context !is FragmentActivity) return
if (loadingDialogFragment == null) {
loadingDialogFragment = LoadingDialogFragment2.newInstance(msg)
}
if (loadingDialogFragment?.isAdded!!) {
return
}
// if (Looper.myLooper() == Looper.getMainLooper()) {
loadingDialogFragment?.show(context.supportFragmentManager, Loading::class.java.simpleName)
// } else
// context.runOnUiThread {
// loadingDialogFragment?.show(context.supportFragmentManager, Loading::class.java.simpleName)
// }
}
fun close() {
loadingDialogFragment?.dismissAllowingStateLoss()
}
}
package com.ydl.ydlcommon.ui
import android.animation.ObjectAnimator
import android.animation.ValueAnimator
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.os.Bundle
import android.text.TextUtils
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.Window
import androidx.fragment.app.DialogFragment
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import com.ydl.ydlcommon.R
import kotlinx.android.synthetic.main.platform_fragment_loading_dialog.view.*
/**
* A simple [Fragment] subclass.
* Use the [LoadingDialogFragment2.newInstance] factory method to
* create an instance of this fragment.
*/
class LoadingDialogFragment2 : DialogFragment() {
private var msg: String? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
msg = arguments?.getString(ARG_MSG)
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
// Inflate the layout for this fragment
dialog?.requestWindowFeature(Window.FEATURE_NO_TITLE)
return inflater.inflate(R.layout.platform_fragment_loading_dialog2, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
startAnim(view)
if (!TextUtils.isEmpty(msg)) {
view.tvMsg.text = msg
} else {
view.tvMsg.visibility = View.GONE
}
}
override fun onStart() {
super.onStart()
dialog?.window?.setBackgroundDrawable(null)
val dp100 = (resources.displayMetrics.density * 100).toInt()
dialog?.window?.setLayout(dp100, dp100)
dialog?.window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
}
private fun startAnim(view: View) {
val ivLoading = view.findViewById<View>(R.id.ivLoading)
val anim = ObjectAnimator.ofFloat(ivLoading, "rotation", 0F, 360F)
anim.duration = 1000
anim.repeatMode = ValueAnimator.RESTART
anim.repeatCount = ValueAnimator.INFINITE
anim.start()
}
companion object {
private val ARG_MSG = "arg_msg"
/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param msg 要显示的信息.
* @return LoadingDialogFragment 实例
*/
fun newInstance(msg: String?): LoadingDialogFragment2 {
val fragment = LoadingDialogFragment2()
val args = Bundle()
args.putString(ARG_MSG, msg)
fragment.arguments = args
return fragment
}
}
override fun show(manager: FragmentManager, tag: String?) {
try {
//在每个add事务前增加一个remove事务,防止连续的add
manager.beginTransaction().remove(this).commitAllowingStateLoss()
super.show(manager, tag)
} catch (e: Exception) {
//同一实例使用不同的tag会异常,这里捕获一下
e.printStackTrace()
}
}
fun hide() {
dismissAllowingStateLoss()
}
}
......@@ -293,21 +293,21 @@ public class TimeUtil {
return retStr;
}
public static String getElapseTimeForShow(int milliseconds) {
public static String getElapseTimeForShow(long milliseconds) {
StringBuilder sb = new StringBuilder();
int seconds = milliseconds / 1000;
long seconds = milliseconds / 1000;
if (seconds < 1) {
seconds = 1;
}
int hour = seconds / (60 * 60);
long hour = seconds / (60 * 60);
if (hour != 0) {
sb.append(hour).append("小时");
}
int minute = (seconds - 60 * 60 * hour) / 60;
long minute = (seconds - 60 * 60 * hour) / 60;
if (minute != 0) {
sb.append(minute).append("分");
}
int second = (seconds - 60 * 60 * hour - 60 * minute);
long second = (seconds - 60 * 60 * hour - 60 * minute);
if (second != 0) {
sb.append(second).append("秒");
}
......
......@@ -106,6 +106,11 @@ class ActionCountUtils {
count(uid, partId, position, url, api, signs = *arrayOf(sign1))
}
fun record(partId: String, position: String, vararg signs: String) {
val userId = ModularServiceManager.getPlatformUserService()?.getUser()?.userId ?: ""
count(userId, partId, position, url = "", api = "", signs = *signs)
}
/*
*
* 测试用埋点,现在服务端统一用百度埋点
......@@ -155,7 +160,7 @@ class ActionCountUtils {
DeviceIDHelper.getInstance().deviceId
}
actionDataParams.deviceId(deviceId)
signs == null ?: signs.forEachIndexed { index, s ->
signs.forEachIndexed { index, s ->
//拓展参数个数确定,暂不使用反射调用
//actionDataParams.javaClass.getMethod("sign$index").invoke(s)
when (index) {
......
......@@ -42,7 +42,6 @@ class YDLShareDialog : DialogFragment {
//小程序页面地址
private var path: String? = null
//小程序id
private var minProgramId: String? = null
......@@ -51,13 +50,7 @@ class YDLShareDialog : DialogFragment {
private var llmargin = 0
@SuppressLint("ValidFragment")
constructor(
activity: Activity,
shareTitle: String?,
shareUrl: String?,
shareContent: String?,
shareHead: String?
) : super() {
constructor(activity: Activity, shareTitle: String?, shareUrl: String?, shareContent: String?, shareHead: String?) : super() {
this.mActivity = activity
this.shareTitle = shareTitle
this.shareUrl = shareUrl
......@@ -67,15 +60,7 @@ class YDLShareDialog : DialogFragment {
//传递小程序参数
@SuppressLint("ValidFragment")
constructor(
activity: Activity,
shareTitle: String?,
shareUrl: String?,
shareContent: String?,
shareHead: String?,
path: String?,
minProgramId: String?
) : super() {
constructor(activity: Activity, shareTitle: String?, shareUrl: String?, shareContent: String?, shareHead: String?, path: String?, minProgramId: String?) : super() {
this.mActivity = activity
this.shareTitle = shareTitle
this.shareUrl = shareUrl
......@@ -95,7 +80,6 @@ class YDLShareDialog : DialogFragment {
companion object {
var typeStyle: Int = 0
/**
* 1.为显示1排(5个) 2.为显示2排(隐藏动态和举报)3.为显示2排(隐藏动态和删除) 4.为显示1排(4个)隐藏动态按钮 5:生成海报按钮、隐藏动态 6:保存海报按钮、隐藏动态 7.为显示1排(4个)隐藏动态按钮
*/
......@@ -106,7 +90,7 @@ class YDLShareDialog : DialogFragment {
const val TYPE5 = 5
const val TYPE6 = 6
const val TYPE7 = 7
const val TYPE8 = 8
/**
* 点击事件类型 1.动态 2.删除 3.举报 4.返回首页 5:生成海报 6:保存本地 7:分享纯图片
*/
......@@ -118,122 +102,63 @@ class YDLShareDialog : DialogFragment {
const val CLICK_SAVE = 6
const val CLICK_SHARE_IMAGE = 7
fun style1(
activity: Activity,
shareTitle: String?,
shareUrl: String?,
shareContent: String?,
shareHead: String?
): YDLShareDialog {
fun style1(activity: Activity, shareTitle: String?, shareUrl: String?, shareContent: String?, shareHead: String?): YDLShareDialog {
typeStyle = TYPE1
return YDLShareDialog(activity, shareTitle, shareUrl, shareContent, shareHead)
}
//支持分享小程序
fun style1(
activity: Activity,
shareTitle: String?,
shareUrl: String?,
shareContent: String?,
shareHead: String?,
minProgramPath: String? = "",
minProgramId: String? = ""
): YDLShareDialog {
fun style1(activity: Activity, shareTitle: String?, shareUrl: String?, shareContent: String?, shareHead: String?, minProgramPath: String? = "", minProgramId: String? = ""): YDLShareDialog {
typeStyle = TYPE1
return YDLShareDialog(
activity,
shareTitle,
shareUrl,
shareContent,
shareHead,
minProgramPath,
minProgramId
)
return YDLShareDialog(activity, shareTitle, shareUrl, shareContent, shareHead, minProgramPath, minProgramId)
}
fun style2(
activity: Activity,
shareTitle: String?,
shareUrl: String?,
shareContent: String?,
shareHead: String?
): YDLShareDialog {
fun style2(activity: Activity, shareTitle: String?, shareUrl: String?, shareContent: String?, shareHead: String?): YDLShareDialog {
typeStyle = TYPE2
return YDLShareDialog(activity, shareTitle, shareUrl, shareContent, shareHead)
}
fun style3(
activity: Activity,
shareTitle: String?,
shareUrl: String?,
shareContent: String?,
shareHead: String?
): YDLShareDialog {
fun style3(activity: Activity, shareTitle: String?, shareUrl: String?, shareContent: String?, shareHead: String?): YDLShareDialog {
typeStyle = TYPE3
return YDLShareDialog(activity, shareTitle, shareUrl, shareContent, shareHead)
}
fun style4(
activity: Activity,
shareTitle: String?,
shareUrl: String?,
shareContent: String?,
shareHead: String?
): YDLShareDialog {
fun style4(activity: Activity, shareTitle: String?, shareUrl: String?, shareContent: String?, shareHead: String?): YDLShareDialog {
typeStyle = TYPE4
return YDLShareDialog(activity, shareTitle, shareUrl, shareContent, shareHead)
}
fun style5(
activity: Activity,
shareTitle: String?,
shareUrl: String?,
shareContent: String?,
shareHead: String?
): YDLShareDialog {
fun style5(activity: Activity, shareTitle: String?, shareUrl: String?, shareContent: String?, shareHead: String?): YDLShareDialog {
typeStyle = TYPE5
return YDLShareDialog(activity, shareTitle, shareUrl, shareContent, shareHead)
}
fun style6(
activity: Activity,
shareTitle: String?,
shareUrl: String?,
shareContent: String?,
shareHead: String?
): YDLShareDialog {
fun style6(activity: Activity, shareTitle: String?, shareUrl: String?, shareContent: String?, shareHead: String?): YDLShareDialog {
typeStyle = TYPE6
return YDLShareDialog(activity, shareTitle, shareUrl, shareContent, shareHead)
}
//支持分享小程序
fun style7(
fun style7(activity: Activity, shareTitle: String?, shareUrl: String?, shareContent: String?, shareHead: String?, minProgramPath: String? = "", minProgramId: String? = ""): YDLShareDialog {
typeStyle = TYPE7
return YDLShareDialog(activity, shareTitle, shareUrl, shareContent, shareHead, minProgramPath, minProgramId)
}
//只有微信和朋友圈
fun style8(
activity: Activity,
shareTitle: String?,
shareUrl: String?,
shareContent: String?,
shareHead: String?,
minProgramPath: String? = "",
minProgramId: String? = ""
minProgramPath: String?,
minProgramId: String?
): YDLShareDialog {
typeStyle = TYPE7
return YDLShareDialog(
activity,
shareTitle,
shareUrl,
shareContent,
shareHead,
minProgramPath,
minProgramId
)
typeStyle = TYPE8
return YDLShareDialog(activity, shareTitle, shareUrl, shareContent, shareHead, minProgramPath, minProgramId)
}
}
override fun onCreateView(
inflater: LayoutInflater?,
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?, savedInstanceState: Bundle?): View {
//去掉dialog的标题,需要在setContentView()之前
this.dialog.requestWindowFeature(Window.FEATURE_NO_TITLE)
val window = this.dialog.window
......@@ -288,8 +213,7 @@ class YDLShareDialog : DialogFragment {
//举报
ll_report.visibility = View.GONE
setStyle()
val deleteParams =
LinearLayout.LayoutParams(dp55, ViewGroup.LayoutParams.WRAP_CONTENT)
val deleteParams = LinearLayout.LayoutParams(dp55, ViewGroup.LayoutParams.WRAP_CONTENT)
deleteParams.setMargins(dp7, 0, llmargin, 0)
deleteParams.weight = 0f
ll_delete.layoutParams = deleteParams
......@@ -303,8 +227,7 @@ class YDLShareDialog : DialogFragment {
ll_dynamic.visibility = View.GONE
ll_delete.visibility = View.GONE
setStyle()
val reportParams =
LinearLayout.LayoutParams(dp55, ViewGroup.LayoutParams.WRAP_CONTENT)
val reportParams = LinearLayout.LayoutParams(dp55, ViewGroup.LayoutParams.WRAP_CONTENT)
reportParams.setMargins(dp7, 0, llmargin, 0)
reportParams.weight = 0f
ll_report.layoutParams = reportParams
......@@ -340,6 +263,12 @@ class YDLShareDialog : DialogFragment {
//动态
ll_dynamic.visibility = View.GONE
}
TYPE8 -> {
ll_layout2.visibility = View.GONE
ll_dynamic.visibility = View.GONE
ll_qq.visibility = View.GONE
ll_qqzone.visibility = View.GONE
}
}
showPictureView()
......@@ -523,7 +452,6 @@ class YDLShareDialog : DialogFragment {
*/
private fun shareMinWeixin() {
//分享小程序到微信
mActivity?.let { activity ->
shareTitle?.let { shareTitle ->
shareUrl?.let { shareUrl ->
......
<?xml version="1.0" encoding="utf-8" ?>
<androidx.cardview.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="100dp"
android:layout_height="100dp"
app:cardBackgroundColor="#66000000"
app:cardElevation="0dp"
app:contentPadding="0dp"
app:cardCornerRadius="8dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="@+id/ivLoading"
android:layout_width="32dp"
android:layout_height="32dp"
android:src="@drawable/ic_loading" />
<TextView
android:id="@+id/tvMsg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="18dp"
android:textColor="@color/white"
android:textSize="17sp"
tools:text="@string/platform_dialog_loading" />
</LinearLayout>
</androidx.cardview.widget.CardView>
\ No newline at end of file
......@@ -29,6 +29,10 @@ android {
abortOnError false
}
dataBinding {
enabled true
}
buildTypes {
release {
minifyEnabled false
......@@ -62,7 +66,9 @@ dependencies {
api(rootProject.ext.dependencies["support-v4"])
api(rootProject.ext.dependencies["appcompat-v7"])
api(rootProject.ext.dependencies["design"])
implementation(rootProject.ext.dependencies["annotations"])
implementation(rootProject.ext.dependencies["arouter"])
kapt(rootProject.ext.dependencies["arouter-compiler"])
compileOnly(rootProject.ext.dependencies["systembartint"])
implementation "com.ydl:ydl-image:1.0.10-SNAPSHOT"
}
package com.yidianling.common.binding
import android.graphics.Color
import android.graphics.drawable.GradientDrawable
import android.view.View
import android.widget.ImageView
import androidx.databinding.BindingAdapter
import com.ydl.ydl_image.module.GlideApp
@BindingAdapter("imageUrl", "circle", requireAll = false)
fun setImageUrl(imageView: ImageView, url: String?, circle: Boolean = false) {
if (url.isNullOrEmpty()) return
if (circle) {
GlideApp.with(imageView).load(url).circleCrop().into(imageView)
} else {
GlideApp.with(imageView).load(url).into(imageView)
}
}
@BindingAdapter(
value = [
"shapeBg",
"shapeStrokeColor",
"shapeStrokeWidth",
"shapeRadius",
"shape"
],
requireAll = false
)
fun View.setCustomStyle(
shapeBg: Int = Color.TRANSPARENT, // 背景颜色
shapeStrokeColor: Int = Color.TRANSPARENT, // 边框颜色
shapeStrokeWidth: Float = 0f, // 边框宽度
shapeRadius: Float = 0f, // 圆角宽度
shape: Int = GradientDrawable.RECTANGLE // Shape样式 默认矩形
) {
val gradientDrawable: GradientDrawable = if (background as? GradientDrawable == null) {
GradientDrawable()
} else {
background as GradientDrawable
}
val density = resources.displayMetrics.density
gradientDrawable.setColor(shapeBg)
gradientDrawable.setStroke(
(shapeStrokeWidth * density).toInt(),
shapeStrokeColor
)
val radius = density * shapeRadius
gradientDrawable.cornerRadius = radius
when (shape) {
GradientDrawable.RECTANGLE -> gradientDrawable.shape = GradientDrawable.RECTANGLE
GradientDrawable.OVAL -> gradientDrawable.shape = GradientDrawable.OVAL
GradientDrawable.LINE -> gradientDrawable.shape = GradientDrawable.LINE
GradientDrawable.RING -> gradientDrawable.shape = GradientDrawable.RING
else -> gradientDrawable.shape = GradientDrawable.RECTANGLE
}
background = gradientDrawable
}
\ No newline at end of file
package com.yidianling.common.view.ui;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.view.View;
import androidx.annotation.Nullable;
import com.yidianling.common.R;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
public class VoicePlayingIcon extends View implements Runnable {
//画笔
private Paint paint;
//跳动指针的集合
private List<Pointer> pointers;
//跳动指针的数量
private int pointerNum;
//逻辑坐标 原点
private float basePointX;
private float basePointY;
//指针间的间隙 默认5dp
private float pointerPadding;
//每个指针的宽度 默认3dp
private float pointerWidth;
//指针的颜色
private int pointerColor = Color.RED;
//控制开始/停止
private boolean isPlaying = false;
//指针波动速率
private int pointerSpeed;
private Random random;
private RectF rectF;
private float radius;
public VoicePlayingIcon(Context context) {
super(context);
init();
}
public VoicePlayingIcon(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
//取出自定义属性
TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.VoicePlayingIcon);
pointerColor = ta.getColor(R.styleable.VoicePlayingIcon_pointer_color, Color.WHITE);
pointerNum = ta.getInt(R.styleable.VoicePlayingIcon_pointer_num, 3);//指针的数量,默认为4
pointerWidth = dp2px(getContext(),
ta.getFloat(R.styleable.VoicePlayingIcon_pointer_width, 1.5f));//指针的宽度,默认5dp
pointerSpeed = ta.getInt(R.styleable.VoicePlayingIcon_pointer_speed, 40);
ta.recycle();
init();
}
public VoicePlayingIcon(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.VoicePlayingIcon);
pointerColor = ta.getColor(R.styleable.VoicePlayingIcon_pointer_color, Color.RED);
pointerNum = ta.getInt(R.styleable.VoicePlayingIcon_pointer_num, 3);
pointerWidth = dp2px(getContext(), ta.getFloat(R.styleable.VoicePlayingIcon_pointer_width, 1.5f));
pointerSpeed = ta.getInt(R.styleable.VoicePlayingIcon_pointer_speed, 40);
ta.recycle();
init();
}
/**
* 初始化画笔与指针的集合
*/
private void init() {
paint = new Paint();
paint.setAntiAlias(true);
paint.setColor(pointerColor);
radius = pointerWidth / 2;
pointers = new ArrayList<>();
for (int i = 0; i < pointerNum; i++) {
pointers.add(new Pointer());
}
random = new Random();
rectF = new RectF();
}
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
//获取逻辑原点的,也就是画布左下角的坐标。这里减去了paddingBottom的距离
basePointY = getHeight() - getPaddingBottom();
for (int i = 0; i < pointerNum; i++) {
//创建指针对象,利用0~1的随机数 乘以 可绘制区域的高度。作为每个指针的初始高度。
Pointer pointer = pointers.get(i);
if (pointer != null) {
pointer.height = (float) (0.1 * (random.nextInt(10) + 1) * (getHeight() - getPaddingBottom() - getPaddingTop()));
}
}
//计算每个指针之间的间隔 总宽度 - 左右两边的padding - 所有指针占去的宽度 然后再除以间隔的数量
pointerPadding = (getWidth() - getPaddingLeft() - getPaddingRight() - pointerWidth * pointerNum) / (pointerNum - 1);
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
//将x坐标移动到逻辑原点,也就是左下角
basePointX = 0f + getPaddingLeft();
//循环绘制每一个指针。
for (int i = 0; i < pointers.size(); i++) {
//绘制指针,也就是绘制矩形
rectF.set(basePointX,
basePointY - pointers.get(i).height,
basePointX + pointerWidth,
basePointY);
canvas.drawRoundRect(rectF, radius, radius, paint);
basePointX += (pointerPadding + pointerWidth);
}
}
/**
* 开始播放
*/
public void start() {
if (!isPlaying) {
removeCallbacks(this);
postOnAnimation(this);
isPlaying = true;//控制子线程中的循环
}
}
/**
* 停止子线程,并刷新画布
*/
public void stop() {
isPlaying = false;
removeCallbacks(this);
invalidate();
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
removeCallbacks(this);
isPlaying = false;
}
private float i = 0F;
@Override
public void run() {
for (int j = 0; j < pointers.size(); j++) { //循环改变每个指针高度
float rate = (float) Math.abs(Math.sin(i + j));//利用正弦有规律的获取0~1的数。
pointers.get(j).height = (basePointY - getPaddingTop()) * rate; //rate 乘以 可绘制高度,来改变每个指针的高度
}
invalidate();
i += 0.1;
postOnAnimationDelayed(this, pointerSpeed);
}
/**
* 指针对象
*/
private static class Pointer {
private float height;
}
static int dp2px(Context context, float dipValue) {
final float scale = context.getResources().getDisplayMetrics().density;
return (int) (dipValue * scale + 0.5f);
}
}
......@@ -318,4 +318,11 @@
<attr name="ratingTitleVisible" format="boolean"/>
<attr name="ratingCenterColor" format="color"/>
</declare-styleable>
<declare-styleable name="VoicePlayingIcon">
<attr name="pointer_color" format="color" />
<attr name="pointer_num" format="integer" />
<attr name="pointer_width" format="float" />
<attr name="pointer_speed" format="integer" />
</declare-styleable>
</resources>
\ No newline at end of file
......@@ -127,6 +127,8 @@ public class WebUrlParamsUtils {
if (userInfo != null) {
mTree.put("uid", userInfo.getUserId());
mTree.put("accessToken", userInfo.getToken());
} else {
mTree.put("uid", "0");
}
mTree.put("v", RxAppTool.getAppVersionName(BaseApp.Companion.getApp()));
mTree.put("isFromApp", "1");//1表示用户版调用接口
......
......@@ -40,6 +40,7 @@ class H5JsBean {
var isFromQingShu = 0//是否是从专家倾述主页跳转私聊界面 0: 不是 1:是
var docHead: String? = null//聊天头像
var doctorId: Int = 0//医生id
var confidedId: String?=null//医生id
var listenerId: Int = 0
var orderStatus: Int = 0
var orderStatusDesc: String? = null
......
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