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-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-dynamic" : "0.0.7.73",
"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){
......
......@@ -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
......@@ -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>
......@@ -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)
}
return RecentConfideHolder(recyclerView)
}
//分类
IConfideHomeConfig.TYPE_CATEGORY -> {
return CategoryViewHolder(ConfideHomeCategoryView(parent.context, confideHomeEvent, confideHomeView))
}
// 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) {
//最近倾诉
holder.consultView!!.initData(mListData!![position])
} else if (holder is RecentConfideHolder) {
//最近倾诉
holder.rv.layoutManager =
LinearLayoutManager(holder.itemView.context, RecyclerView.HORIZONTAL, false)
val recentBody = mListData!![position].body
val data = recentBody?.map { ItemVideoShowViewModel().mapOf(it) } ?: emptyList()
holder.rv.adapter = RecentConfideAdapter(data, confideHomeEvent)
// holder.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,113 +7,153 @@ package com.ydl.confide.home.bean
* @Company 壹点灵
* @date 2018/8/10
*/
data class ConfideHomeBodyBean(
/**
* 公共参数
*/
val linkUrl : String?,
//倾诉Id
val confidedId : String?,
//专家Id(专家编号)
val doctorId : String?,
//专家的uid
val uid : Int?,
//咨询师姓名
val confidedName : String?,
//咨询师性别 1.男 2.女
val confideSex : Int = 1,
//对你留言
val confideContent : String?,
//咨询师头像地址
val confidedIcon : String?,
//是否在线 //1在线 2离线 3通话中 4继续倾诉
val confideLine : Int?,
//已聆听文案
val confideHearNum : String?,
//历史倾听记录
val confideHistory : String?,
//是否为播放状态
var confideIsPlay : Boolean=false,
//音频播放地址
val confideVoice:String?,
//副标题(底部更多文案)
val subTitle : String?,
//咨询师标题
val confidedTitle:String?,
//副标题点击事件
val subLinkUrl : String?,
//咨询师背景图片
val confideBgUrl : String?,
//价格
val confideFee : String?,
//红包金额
val couponMoney : String?,
//新用户优惠文案
val couponText : String?,
/**
* banner数据
*/
//banner id
val bannerId : String?,
//banner 图片地址
val bannerImageUrl : String?,
//banner标题(用于数据埋点)
val bannerTitle : String?,
//跳转地址
val bannerLinkUrl : String?,
/**
* 最近倾诉数据说明(查看公共参数说明)
*/
//...
/**
* 分类参数
*/
//分类Id
val categoryId : String?,
//分类名称
val categoryName : String?,
//分类类型(1.倾诉指南,2.专业师资)
val categoryType : Int?,
//分类图片地址
val categoryIcon : String?,
//分类内容
val categoryContent : String?,
/**
* 为你推荐筛选模块数据
*/
//筛选标题
val filterName : String?,
//筛选类型(1.综合排序 2.性别年龄 3.擅长方向)
val filterType : Int?,
//筛选数据集
val group : ArrayList<ConfideHomeBodyGroupItemBean>?,
class ConfideHomeBodyBean {
/**
* 公共参数
*/
var linkUrl: String? = null
//倾诉Id
var confidedId: String? = null
//专家Id(专家编号)
var doctorId: String? = null
//专家的uid
var uid: Int? = null
//咨询师姓名
var confidedName: String? = null
var videoTitle: String? = null
//咨询师性别 1.男 2.女
var confideSex: Int = 1
//对你留言
var confideContent: String? = null
//咨询师头像地址
var confidedIcon: String? = null
//是否在线 //1在线 2离线 3通话中 4继续倾诉
var confideLine: Int? = null
//已聆听文案
var confideHearNum: String? = null
//历史倾听记录
var confideHistory: String? = null
//是否为播放状态
var confideIsPlay: Boolean = false
//音频播放地址
var confideVoice: String? = null
//副标题(底部更多文案)
var subTitle: String? = null
//咨询师标题
var confidedTitle: String? = null
var title: String? = null
//副标题点击事件
var subLinkUrl: String? = null
//咨询师背景图片
var confideBgUrl: String? = null
//价格
var confideFee: String? = null
//红包金额
var couponMoney: String? = null
//新用户优惠文案
var couponText: String? = null
var videoUrl: String? = null
var coverVideoPicture: String? = null
var coverPicture: String? = null
/**
* banner数据
*/
//banner id
var bannerId: String? = null
//banner 图片地址
var bannerImageUrl: String? = null
//banner标题(用于数据埋点)
var bannerTitle: String? = null
//跳转地址
var bannerLinkUrl: String? = null
/**
* 最近倾诉数据说明(查看公共参数说明)
*/
//...
/**
* 分类参数
*/
//分类Id
var categoryId: String? = null
//分类名称
var categoryName: String? = null
//分类类型(1.倾诉指南,2.专业师资)
var categoryType: Int? = null
//分类图片地址
var categoryIcon: String? = null
//分类内容
var categoryContent: String? = null
/**
* 为你推荐筛选模块数据
*/
//筛选标题
var filterName: String? = null
//筛选类型(1.综合排序 2.性别年龄 3.擅长方向)
var filterType: Int? = null
//筛选数据集
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>?,
/**
* 为你推荐数据说明
*/
val confidedTag : List<String>?,
/**
* 听声寻人数据说明(请查看公共参数说明)
*/
//...
/**
* 最佳倾诉榜单数据说明
*/
//倾诉统计文案(8513人)
val confideNum : String?,
//接通率
val confideConnection : String?,
//
var bodyData : List<ConfideHomeBodyBean>?
)
\ No newline at end of file
// var goodData : ArrayList<ConfideHomeFiterItemBean>?,
/**
* 为你推荐数据说明
*/
var confidedTag: List<String>? = null
/**
* 听声寻人数据说明(请查看公共参数说明)
*/
//...
/**
* 最佳倾诉榜单数据说明
*/
//倾诉统计文案(8513人)
var confideNum: String? = null
//接通率
var confideConnection: String? = null
//
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(
/**
* 筛选id
*/
var id : String?,
/**
* 筛选名称
*/
var name : String?)
\ No newline at end of file
class ConfideHomeFiterItemBean {
/**
* 筛选id
*/
var id: String? = null
/**
* 筛选名称
*/
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,9 +278,10 @@ class ConfideHomeEventImpl(context: Context, var confideHomeView: IConfideHomeCo
* 私聊
*/
override fun toChatForMsg(doctorId: String?) {
if (null != mContext && mContext is Activity){
PhoneCallIn.loginByOneKeyLogin(mContext as Activity,true)
return
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.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.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
......@@ -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
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