Commit 16bfe177 by 万齐军

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

倾诉2.0

See merge request app_android_lib/YDL-Component!125
parents 5ab37efb 17b50d23
...@@ -170,6 +170,9 @@ android { ...@@ -170,6 +170,9 @@ android {
packagingOptions { packagingOptions {
exclude 'META-INF/proguard/coroutines.pro' exclude 'META-INF/proguard/coroutines.pro'
} }
dataBinding {
enabled true
}
} }
...@@ -248,5 +251,6 @@ dependencies { ...@@ -248,5 +251,6 @@ dependencies {
implementation rootProject.ext.dependencies["retrofit-url-manager"] implementation rootProject.ext.dependencies["retrofit-url-manager"]
kapt 'com.alibaba:arouter-compiler:1.2.2' 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
...@@ -21,9 +21,9 @@ import java.util.List; ...@@ -21,9 +21,9 @@ import java.util.List;
public final class DemoGlobalConfig implements IConfigModule { public final class DemoGlobalConfig implements IConfigModule {
String APP_DOMAIN = "https://api.github.com/"; String APP_DOMAIN = "https://api.github.com/";
// public static String appEnv = YDLConstants.ENV_AUTO_TEST; // public static String appEnv = YDLConstants.ENV_AUTO_TEST;
// public static String appEnv = YDLConstants.ENV_TEST; public static String appEnv = YDLConstants.ENV_TEST;
// public static String appEnv = YDLConstants.ENV_NEW_TEST;//配置未上传到maven库 // public static String appEnv = YDLConstants.ENV_NEW_TEST;//配置未上传到maven库
public static String appEnv = YDLConstants.ENV_PROD; // public static String appEnv = YDLConstants.ENV_PROD;
@Override @Override
public void injectAppLifecycle(@NotNull Context context, @NotNull List<IAppLifecycles> lifecycles) { public void injectAppLifecycle(@NotNull Context context, @NotNull List<IAppLifecycles> lifecycles) {
lifecycles.add(new DemoAppLifecycles()); lifecycles.add(new DemoAppLifecycles());
......
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; ...@@ -5,6 +5,7 @@ import android.app.Activity;
import com.alibaba.android.arouter.launcher.ARouter; import com.alibaba.android.arouter.launcher.ARouter;
import com.ydl.confide.api.IConfideService; import com.ydl.confide.api.IConfideService;
import com.ydl.confide.home.event.ChangeAnotherExpertEvent;
import com.ydl.webview.H5JsBean; import com.ydl.webview.H5JsBean;
import com.ydl.webview.H5Params; import com.ydl.webview.H5Params;
import com.ydl.webview.NewH5Activity; import com.ydl.webview.NewH5Activity;
...@@ -12,6 +13,8 @@ import com.ydl.ydlcommon.modular.ModularServiceManager; ...@@ -12,6 +13,8 @@ import com.ydl.ydlcommon.modular.ModularServiceManager;
import com.yidianling.common.tools.LogUtil; import com.yidianling.common.tools.LogUtil;
import com.yidianling.im.api.service.IImService; import com.yidianling.im.api.service.IImService;
import de.greenrobot.event.EventBus;
/** /**
* webview 点击事件监听 抽象类 * webview 点击事件监听 抽象类
* Created by harvie on 2017/7/4 0004. * Created by harvie on 2017/7/4 0004.
...@@ -446,5 +449,10 @@ public class WVClickAbstractListener implements WebViewClientClickListener { ...@@ -446,5 +449,10 @@ public class WVClickAbstractListener implements WebViewClientClickListener {
} }
} }
@Override
public void getNextExpertStatus(String doctorID, String title,String uid) {
EventBus.getDefault().post(new ChangeAnotherExpertEvent(doctorID,title,uid));
}
} }
package com.ydl.component.service.web package com.ydl.component.service.web
import android.webkit.JavascriptInterface import android.webkit.JavascriptInterface
import androidx.fragment.app.FragmentActivity
import com.google.gson.Gson 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.js_module.manager.WebViewRouterManager
import com.ydl.webview.H5JsBean import com.ydl.webview.H5JsBean
import com.ydl.webview.IJavascriptHandler import com.ydl.webview.IJavascriptHandler
import com.ydl.ydl_router.manager.YDLRouterManager 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.ModularServiceManager
import com.ydl.ydlcommon.modular.findRouteService
import com.ydl.ydlcommon.utils.log.LogHelper import com.ydl.ydlcommon.utils.log.LogHelper
import com.yidianling.common.tools.LogUtil import com.yidianling.common.tools.LogUtil
import com.yidianling.user.UserHelper import com.yidianling.user.UserHelper
...@@ -16,6 +22,9 @@ import com.yidianling.user.UserHelper ...@@ -16,6 +22,9 @@ import com.yidianling.user.UserHelper
*/ */
class WebJavascriptHandler : IJavascriptHandler{ class WebJavascriptHandler : IJavascriptHandler{
private val js = JsMethod()
override fun getUriAppendSuffix(): String { override fun getUriAppendSuffix(): String {
return "platform_main_theme=00C9E2&platform_main_theme_light=00D4DF&platform_main_theme_bright=EAFAFC" return "platform_main_theme=00C9E2&platform_main_theme_light=00D4DF&platform_main_theme_bright=EAFAFC"
} }
...@@ -41,6 +50,7 @@ class WebJavascriptHandler : IJavascriptHandler{ ...@@ -41,6 +50,7 @@ class WebJavascriptHandler : IJavascriptHandler{
if (YDLRouterManager.router(params)) { if (YDLRouterManager.router(params)) {
return return
} }
if (js.handle(params)) return
val jsData = Gson().fromJson(params, H5JsBean::class.java) val jsData = Gson().fromJson(params, H5JsBean::class.java)
//是否登录 //是否登录
if (jsData.cmd?.action_name != null && jsData.cmd!!.action_name.equals("login")) { if (jsData.cmd?.action_name != null && jsData.cmd!!.action_name.equals("login")) {
...@@ -381,6 +391,20 @@ class WebJavascriptHandler : IJavascriptHandler{ ...@@ -381,6 +391,20 @@ class WebJavascriptHandler : IJavascriptHandler{
wvEnventPro?.setSelfPageType(it.selfPageType) wvEnventPro?.setSelfPageType(it.selfPageType)
} }
} }
//再换一位
"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 ?: "")
}
}
} }
} }
} }
...@@ -181,5 +181,5 @@ public interface WebViewClientClickListener { ...@@ -181,5 +181,5 @@ public interface WebViewClientClickListener {
//设置当前页面类型 //设置当前页面类型
void setSelfPageType(int selfType); void setSelfPageType(int selfType);
void getNextExpertStatus(String doctorID,String title,String uid);
} }
...@@ -31,8 +31,6 @@ buildscript { ...@@ -31,8 +31,6 @@ buildscript {
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.2.0' classpath 'com.android.tools.build:gradle:3.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 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.plugins:modular:1.0.3'
classpath 'com.ydl:notracepoint-gradle-plugin:0.0.3' classpath 'com.ydl:notracepoint-gradle-plugin:0.0.3'
classpath 'com.ydl.plugins:restools:1.0.1' classpath 'com.ydl.plugins:restools:1.0.1'
......
...@@ -5,22 +5,22 @@ ext { ...@@ -5,22 +5,22 @@ ext {
ydlPublishVersion = [ ydlPublishVersion = [
// -------------- 业务模块 -------------- // -------------- 业务模块 --------------
//第三步 若干 //第三步 若干
"m-confide" : "0.0.49.74", "m-confide" : "0.0.50.08",
"m-consultant" : "0.0.60.25", "m-consultant" : "0.0.60.27",
"m-fm" : "0.0.30.08", "m-fm" : "0.0.30.09",
"m-user" : "0.0.62.11", "m-user" : "0.0.62.26",
"m-home" : "0.0.23.48", "m-home" : "0.0.23.79",
"m-im" : "0.0.21.44", "m-im" : "0.0.21.51",
"m-dynamic" : "0.0.7.73", "m-dynamic" : "0.0.7.74",
"m-article" : "0.0.0.10", "m-article" : "0.0.0.10",
"m-muse" : "0.0.28.28", "m-muse" : "0.0.28.28",
"m-tests" : "0.0.24.18", "m-tests" : "0.0.24.18",
"m-course" : "0.0.43.37", "m-course" : "0.0.43.39",
//-------------- 业务模块 API 层 -------------- //-------------- 业务模块 API 层 --------------
"m-audioim-api" : "0.0.6", "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-consultant-api": "0.0.5.63",
"m-course-api" : "0.0.3.6", "m-course-api" : "0.0.3.6",
"m-fm-api" : "0.0.3", "m-fm-api" : "0.0.3",
...@@ -35,19 +35,19 @@ ext { ...@@ -35,19 +35,19 @@ ext {
//mdt 组件 //mdt 组件
"ydl-tuicore" : "0.0.23", "ydl-tuicore" : "0.0.23",
//第一步 //第一步
"ydl-platform" : "0.0.41.08", "ydl-platform" : "0.0.41.22",
//第二步 若干 //第二步 若干
"ydl-webview" : "0.0.38.62", "ydl-webview" : "0.0.38.80",
"ydl-media" : "0.0.21.44", "ydl-media" : "0.0.21.45",
"ydl-pay" : "0.0.18.19", "ydl-pay" : "0.0.18.19",
"m-audioim" : "0.0.49.29.90", "m-audioim" : "0.0.49.30.06",
"ydl-flutter-base": "0.0.14.38", "ydl-flutter-base": "0.0.14.38",
//以下 几乎不会动 //以下 几乎不会动
"router" : "0.0.1", "router" : "0.0.1",
"ydl-net" : "0.0.3.93", "ydl-net" : "0.0.3.93",
"ydl-utils" : "0.0.3.3", "ydl-utils" : "0.0.3.8",
] ]
ydl_app = [ ydl_app = [
appName : "壹点灵心理咨询", appName : "壹点灵心理咨询",
...@@ -90,21 +90,21 @@ ext { ...@@ -90,21 +90,21 @@ ext {
// -------------- 业务模块 -------------- // -------------- 业务模块 --------------
//第三步 若干 //第三步 若干
"m-confide" : "0.0.49.74", "m-confide" : "0.0.50.08",
"m-consultant" : "0.0.60.25", "m-consultant" : "0.0.60.27",
"m-fm" : "0.0.30.08", "m-fm" : "0.0.30.09",
"m-user" : "0.0.62.11", "m-user" : "0.0.62.26",
"m-home" : "0.0.23.48", "m-home" : "0.0.23.79",
"m-im" : "0.0.21.44", "m-im" : "0.0.21.51",
"m-dynamic" : "0.0.7.73", "m-dynamic" : "0.0.7.74",
"m-article" : "0.0.0.8", "m-article" : "0.0.0.8",
"m-muse" : "0.0.28.28", "m-muse" : "0.0.28.28",
"m-tests" : "0.0.24.18", "m-tests" : "0.0.24.18",
"m-course" : "0.0.43.37", "m-course" : "0.0.43.39",
//-------------- 业务模块 API 层 -------------- //-------------- 业务模块 API 层 --------------
"m-audioim-api" : "0.0.6", "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-consultant-api": "0.0.5.63",
"m-course-api" : "0.0.3.6", "m-course-api" : "0.0.3.6",
"m-fm-api" : "0.0.3", "m-fm-api" : "0.0.3",
...@@ -118,19 +118,19 @@ ext { ...@@ -118,19 +118,19 @@ ext {
//mdt组件 //mdt组件
"ydl-tuicore" : "0.0.23", "ydl-tuicore" : "0.0.23",
//第一步 //第一步
"ydl-platform" : "0.0.41.08", "ydl-platform" : "0.0.41.22",
//第二步 若干 //第二步 若干
"ydl-webview" : "0.0.38.62", "ydl-webview" : "0.0.38.80",
"ydl-media" : "0.0.21.44", "ydl-media" : "0.0.21.45",
"ydl-pay" : "0.0.18.19", "ydl-pay" : "0.0.18.19",
"m-audioim" : "0.0.49.29.90", "m-audioim" : "0.0.49.30.06",
"ydl-flutter-base": "0.0.14.38", "ydl-flutter-base": "0.0.14.38",
//以下 几乎不会动 //以下 几乎不会动
"router" : "0.0.1", "router" : "0.0.1",
"ydl-net" : "0.0.3.93", "ydl-net" : "0.0.3.93",
"ydl-utils" : "0.0.3.3", "ydl-utils" : "0.0.3.8",
] ]
dependencies = [ dependencies = [
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
# Specifies the JVM arguments used for the daemon process. # Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings. # 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. # When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit # This option should only be used with decoupled projects. More details, visit
......
...@@ -75,7 +75,7 @@ dependencies { ...@@ -75,7 +75,7 @@ dependencies {
kapt "com.alibaba:arouter-compiler:$arouter_compiler" kapt "com.alibaba:arouter-compiler:$arouter_compiler"
api "com.alibaba:arouter-api:$arouter_api" 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' implementation 'com.volcengine:apm_insight:1.4.6.cn'
if (rootProject.ext.dev_mode){ if (rootProject.ext.dev_mode){
......
...@@ -2,6 +2,7 @@ package com.ydl.audioim.widget; ...@@ -2,6 +2,7 @@ package com.ydl.audioim.widget;
import android.app.Dialog; import android.app.Dialog;
import android.content.Context; import android.content.Context;
import android.os.Build;
import android.view.Gravity; import android.view.Gravity;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
...@@ -123,6 +124,11 @@ public class ZDialog extends Dialog { ...@@ -123,6 +124,11 @@ public class ZDialog extends Dialog {
return this; return this;
} }
public Builder width(int width){
mDialogParams.defaultWidth = width;
return this;
}
public Builder setGravity(@ZDialogDirection.ZGravity int direction) { public Builder setGravity(@ZDialogDirection.ZGravity int direction) {
switch (direction) { switch (direction) {
case ZDialogDirection.FROM_TOP: 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 @@ ...@@ -14,9 +14,11 @@
android:id="@+id/third_title" android:id="@+id/third_title"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="App正常工作需要录音权限,请开启" android:text="请启用权限:麦克风或录音,以保障语音通话正常使用。"
android:textColor="@color/platform_color_242424" android:textColor="@color/platform_color_242424"
android:textSize="15sp" android:textSize="15sp"
android:paddingLeft="12dp"
android:paddingRight="12dp"
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="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> <resources>
<string name="audioim_need_storage_permission_hint">App正常工作需要内部存储使用权限,请开启</string> <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> </resources>
...@@ -50,6 +50,9 @@ android { ...@@ -50,6 +50,9 @@ android {
buildConfigField "String", "AGORA_APPID", '"3387e9b251f3491e9221a9877e8f7830"' buildConfigField "String", "AGORA_APPID", '"3387e9b251f3491e9221a9877e8f7830"'
} }
} }
dataBinding {
enabled true
}
publishNonDefault true publishNonDefault true
productFlavors { productFlavors {
...@@ -75,9 +78,11 @@ dependencies { ...@@ -75,9 +78,11 @@ dependencies {
implementation 'com.daimajia.androidanimations:library:2.3@aar' implementation 'com.daimajia.androidanimations:library:2.3@aar'
api 'fr.tvbarthel.blurdialogfragment:lib:2.1.5' api 'fr.tvbarthel.blurdialogfragment:lib:2.1.5'
api "com.alibaba:arouter-api:$arouter_api" api "com.alibaba:arouter-api:$arouter_api"
api 'com.tencent.tbs.tbssdk:sdk:43903'
// 注意此处的依赖方式:kotlin中使用和java中使用方式有不同 // 注意此处的依赖方式:kotlin中使用和java中使用方式有不同
kapt "com.alibaba:arouter-compiler:$arouter_compiler" kapt "com.alibaba:arouter-compiler:$arouter_compiler"
implementation 'com.alibaba:fastjson:1.2.38' implementation 'com.alibaba:fastjson:1.2.38'
implementation "com.ydl:jjdxm-ijkplayer:0.0.33"
api rootProject.ext.dependencies["ydl-user-router"] api rootProject.ext.dependencies["ydl-user-router"]
implementation modularPublication('com.ydl:m-consultant-api') implementation modularPublication('com.ydl:m-consultant-api')
...@@ -88,6 +93,7 @@ dependencies { ...@@ -88,6 +93,7 @@ dependencies {
api project(':m-audioim') api project(':m-audioim')
api project(":ydl-pay") api project(":ydl-pay")
api project(':ydl-webview') api project(':ydl-webview')
api project(':ydl-utils')
implementation modularPublication('com.ydl:m-im-api') implementation modularPublication('com.ydl:m-im-api')
implementation modularPublication('com.ydl:m-user-api') implementation modularPublication('com.ydl:m-user-api')
implementation modularPublication('com.ydl:m-confide-api') implementation modularPublication('com.ydl:m-confide-api')
......
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ydl.confide" > package="com.ydl.confide">
<application> <application>
<activity android:name=".home.ConfideHomeActivity" <activity
android:name=".home.ConfideHomeActivity"
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:theme="@style/confide_NoTitleTheme" android:theme="@style/confide_NoTitleTheme"/>
> <activity
</activity> android:name=".intro.ExpertIntroActivity"
android:screenOrientation="portrait" />
</application> </application>
</manifest> </manifest>
...@@ -4,12 +4,14 @@ import android.content.Context ...@@ -4,12 +4,14 @@ import android.content.Context
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.recyclerview.widget.LinearLayoutManager
import com.ydl.confide.R import com.ydl.confide.R
import com.ydl.confide.home.bean.ConfideHomeDataBean import com.ydl.confide.home.bean.ConfideHomeDataBean
import com.ydl.confide.home.config.IConfideHomeConfig import com.ydl.confide.home.config.IConfideHomeConfig
import com.ydl.confide.home.contract.IConfideHomeContract import com.ydl.confide.home.contract.IConfideHomeContract
import com.ydl.confide.home.event.IConfideHomeEvent import com.ydl.confide.home.event.IConfideHomeEvent
import com.ydl.confide.home.widget.* import com.ydl.confide.home.widget.*
import com.ydl.ydlcommon.utils.DisplayUtils
/** /**
* @author yuanwai * @author yuanwai
...@@ -73,17 +75,26 @@ class ConfideHomeAdapter(private val mContext: Context, ...@@ -73,17 +75,26 @@ class ConfideHomeAdapter(private val mContext: Context,
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
when (viewType) { when (viewType) {
//banner //banner
IConfideHomeConfig.TYPE_BANNER -> { // IConfideHomeConfig.TYPE_BANNER -> {
return BannerViewHolder(ConfideHomeBannerView(parent.context, confideHomeEvent)) // return BannerViewHolder(ConfideHomeBannerView(parent.context, confideHomeEvent))
} // }
//最近倾诉 //最近倾诉
IConfideHomeConfig.TYPE_RECENTLY_CONFIDED -> { 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 -> { // IConfideHomeConfig.TYPE_CATEGORY -> {
return CategoryViewHolder(ConfideHomeCategoryView(parent.context, confideHomeEvent, confideHomeView)) // return CategoryViewHolder(ConfideHomeCategoryView(parent.context, confideHomeEvent, confideHomeView))
} // }
//筛选模块 //筛选模块
IConfideHomeConfig.TYPE_RECOMMEND_FILTER -> { IConfideHomeConfig.TYPE_RECOMMEND_FILTER -> {
return FilterViewHolder(ConfideHomeFilterView(parent.context, confideHomeView)) return FilterViewHolder(ConfideHomeFilterView(parent.context, confideHomeView))
...@@ -92,6 +103,17 @@ class ConfideHomeAdapter(private val mContext: Context, ...@@ -92,6 +103,17 @@ class ConfideHomeAdapter(private val mContext: Context,
IConfideHomeConfig.TYPE_RECOMMEND -> { IConfideHomeConfig.TYPE_RECOMMEND -> {
return RecommendViewHolder(ConfideHomeRecommendView(confideHomeView, parent.context, confideHomeEvent)) return RecommendViewHolder(ConfideHomeRecommendView(confideHomeView, parent.context, confideHomeEvent))
} }
IConfideHomeConfig.TYPE_VIDEO_SHOW -> {
val recyclerView = RecyclerView(parent.context)
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 -> { // IConfideHomeConfig.TYPE_SOUND -> {
//// return ConfideHomeListenAndFoundViewHolder(ConfideHomeListenAndFoundView(parent.context, confideHomeEvent)) //// return ConfideHomeListenAndFoundViewHolder(ConfideHomeListenAndFoundView(parent.context, confideHomeEvent))
...@@ -103,25 +125,35 @@ class ConfideHomeAdapter(private val mContext: Context, ...@@ -103,25 +125,35 @@ class ConfideHomeAdapter(private val mContext: Context,
} }
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) = override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) =
if (holder is BannerViewHolder && null != holder.bannerView) { /*if (holder is BannerViewHolder && null != holder.bannerView) {
//banner //banner
holder.bannerView!!.initData(mListData!![position]) holder.bannerView!!.initData(mListData!![position])
} else if (holder is CategoryViewHolder && null != holder.categoryView) { } else if (holder is CategoryViewHolder && null != holder.categoryView) {
//分类 //分类
holder.categoryView!!.initData(mListData!![position]) holder.categoryView!!.initData(mListData!![position])
} else if (holder is FilterViewHolder && null != holder.filterView) { } else */if (holder is FilterViewHolder && null != holder.filterView) {
mFilterViewHolder = holder mFilterViewHolder = holder
//筛选模块 //筛选模块
holder.filterView.initData(mListData!![position]) holder.filterView.initData(mListData!![position])
} else if (holder is ConfideHomeListenAndFoundViewHolder) { } else if (holder is ConfideHomeListenAndFoundViewHolder) {
//听声寻人 //听声寻人
// holder.confideHomeListenAndFoundView!!.initData(mListData!![position]) // 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()) { } 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) 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 if (holder is EmptyViewHolder) {
} else { } else {
...@@ -184,4 +216,6 @@ class ConfideHomeAdapter(private val mContext: Context, ...@@ -184,4 +216,6 @@ class ConfideHomeAdapter(private val mContext: Context,
view = itemView 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 ...@@ -7,113 +7,153 @@ package com.ydl.confide.home.bean
* @Company 壹点灵 * @Company 壹点灵
* @date 2018/8/10 * @date 2018/8/10
*/ */
data class ConfideHomeBodyBean(
/** class ConfideHomeBodyBean {
* 公共参数 /**
*/ * 公共参数
val linkUrl : String?, */
//倾诉Id var linkUrl: String? = null
val confidedId : String?,
//专家Id(专家编号) //倾诉Id
val doctorId : String?, var confidedId: String? = null
//专家的uid
val uid : Int?, //专家Id(专家编号)
//咨询师姓名 var doctorId: String? = null
val confidedName : String?,
//咨询师性别 1.男 2.女 //专家的uid
val confideSex : Int = 1, var uid: Int? = null
//对你留言
val confideContent : String?, //咨询师姓名
//咨询师头像地址 var confidedName: String? = null
val confidedIcon : String?, var videoTitle: String? = null
//是否在线 //1在线 2离线 3通话中 4继续倾诉
val confideLine : Int?, //咨询师性别 1.男 2.女
//已聆听文案 var confideSex: Int = 1
val confideHearNum : String?,
//历史倾听记录 //对你留言
val confideHistory : String?, var confideContent: String? = null
//是否为播放状态
var confideIsPlay : Boolean=false, //咨询师头像地址
//音频播放地址 var confidedIcon: String? = null
val confideVoice:String?,
//副标题(底部更多文案) //是否在线 //1在线 2离线 3通话中 4继续倾诉
val subTitle : String?, var confideLine: Int? = null
//咨询师标题
val confidedTitle:String?, //已聆听文案
//副标题点击事件 var confideHearNum: String? = null
val subLinkUrl : String?,
//咨询师背景图片 //历史倾听记录
val confideBgUrl : String?, var confideHistory: String? = null
//价格
val confideFee : String?, //是否为播放状态
//红包金额 var confideIsPlay: Boolean = false
val couponMoney : String?,
//新用户优惠文案 //音频播放地址
val couponText : String?, var confideVoice: String? = null
/**
* banner数据 //副标题(底部更多文案)
*/ var subTitle: String? = null
//banner id
val bannerId : String?, //咨询师标题
//banner 图片地址 var confidedTitle: String? = null
val bannerImageUrl : String?, var title: String? = null
//banner标题(用于数据埋点)
val bannerTitle : String?, //副标题点击事件
//跳转地址 var subLinkUrl: String? = null
val bannerLinkUrl : String?,
/** //咨询师背景图片
* 最近倾诉数据说明(查看公共参数说明) var confideBgUrl: String? = null
*/
//... //价格
/** var confideFee: String? = null
* 分类参数
*/ //红包金额
//分类Id var couponMoney: String? = null
val categoryId : String?,
//分类名称 //新用户优惠文案
val categoryName : String?, var couponText: String? = null
//分类类型(1.倾诉指南,2.专业师资) var videoUrl: String? = null
val categoryType : Int?, var coverVideoPicture: String? = null
//分类图片地址 var coverPicture: String? = null
val categoryIcon : String?,
//分类内容 /**
val categoryContent : String?, * banner数据
/** */
* 为你推荐筛选模块数据 //banner id
*/ var bannerId: String? = null
//筛选标题
val filterName : String?, //banner 图片地址
//筛选类型(1.综合排序 2.性别年龄 3.擅长方向) var bannerImageUrl: String? = null
val filterType : Int?,
//筛选数据集 //banner标题(用于数据埋点)
val group : ArrayList<ConfideHomeBodyGroupItemBean>?, 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>?, // var goodData : ArrayList<ConfideHomeFiterItemBean>?,
/** /**
* 为你推荐数据说明 * 为你推荐数据说明
*/ */
val confidedTag : List<String>?, var confidedTag: List<String>? = null
/** /**
* 听声寻人数据说明(请查看公共参数说明) * 听声寻人数据说明(请查看公共参数说明)
*/ */
//... //...
/** /**
* 最佳倾诉榜单数据说明 * 最佳倾诉榜单数据说明
*/ */
//倾诉统计文案(8513人) //倾诉统计文案(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 ...@@ -7,5 +7,7 @@ package com.ydl.confide.home.bean
* @Company 壹点灵 * @Company 壹点灵
* @date 2018/10/15 * @date 2018/10/15
*/ */
data class ConfideHomeBodyGroupItemBean(val title : String?, class ConfideHomeBodyGroupItemBean {
val data : ArrayList<ConfideHomeFiterItemBean>?) var title: String? = null
\ No newline at end of file var data: ArrayList<ConfideHomeFiterItemBean>? = null
}
\ No newline at end of file
...@@ -30,8 +30,4 @@ data class ConfideHomeDataBean( ...@@ -30,8 +30,4 @@ data class ConfideHomeDataBean(
/** /**
* 为你推荐Id 本地使用 用于区分音频播放区域 * 为你推荐Id 本地使用 用于区分音频播放区域
*/ */
var recommendId : Int, var recommendId : Int)
/** \ No newline at end of file
* 是否显示分割线 0.不显示 1.显示
*/
val diviLine : Int?)
\ No newline at end of file
...@@ -7,12 +7,14 @@ package com.ydl.confide.home.bean ...@@ -7,12 +7,14 @@ package com.ydl.confide.home.bean
* @Company 壹点灵 * @Company 壹点灵
* @date 2018/9/22 * @date 2018/9/22
*/ */
data class ConfideHomeFiterItemBean( class ConfideHomeFiterItemBean {
/** /**
* 筛选id * 筛选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{ ...@@ -19,7 +19,7 @@ interface IConfideHomeConfig{
const val TYPE_RECOMMEND_FILTER = 4 const val TYPE_RECOMMEND_FILTER = 4
const val TYPE_RECOMMEND = 5 const val TYPE_RECOMMEND = 5
const val TYPE_SOUND = 6 const val TYPE_SOUND = 6
const val TYPE_CONSULTANT = 7 const val TYPE_VIDEO_SHOW = 7
const val TYPE_FOOTER = 999 const val TYPE_FOOTER = 999
/** /**
* section id. 与上面相对应 * section id. 与上面相对应
......
...@@ -87,10 +87,6 @@ interface IConfideHomeContract{ ...@@ -87,10 +87,6 @@ interface IConfideHomeContract{
interface Presenter : IPresenter<View> { interface Presenter : IPresenter<View> {
/** /**
* 加载本地缓存
*/
fun loadLocalData(context: Context)
/**
* 倾诉首页数据请求 * 倾诉首页数据请求
*/ */
fun confideHomeRequest(isRefresh:Boolean = true) 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 ...@@ -4,9 +4,13 @@ import android.app.Activity
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.net.Uri import android.net.Uri
import androidx.appcompat.app.AppCompatActivity
import android.text.TextUtils import android.text.TextUtils
import android.view.View 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.ConfideHomeActivity
import com.ydl.confide.home.adapter.ConfideHomeAdapter import com.ydl.confide.home.adapter.ConfideHomeAdapter
import com.ydl.confide.home.bean.ConfideHomeAllFiltersBean import com.ydl.confide.home.bean.ConfideHomeAllFiltersBean
...@@ -27,11 +31,14 @@ import com.ydl.media.view.PlayerFloatView ...@@ -27,11 +31,14 @@ import com.ydl.media.view.PlayerFloatView
import com.ydl.ydl_router.manager.YDLRouterManager import com.ydl.ydl_router.manager.YDLRouterManager
import com.ydl.ydl_router.manager.YDLRouterParams import com.ydl.ydl_router.manager.YDLRouterParams
import com.ydl.ydlcommon.base.BaseActivity 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.router.IYDLRouterConstant
import com.ydl.ydlcommon.utils.remind.ToastHelper import com.ydl.ydlcommon.utils.remind.ToastHelper
import com.yidianling.common.tools.ToastUtil import com.yidianling.common.tools.ToastUtil
import com.yidianling.im.api.bean.IMRequestCallback import com.yidianling.im.api.bean.IMRequestCallback
/** /**
* @author yuanwai * @author yuanwai
* @描述:倾诉首页事件处理类 * @描述:倾诉首页事件处理类
...@@ -125,8 +132,23 @@ class ConfideHomeEventImpl(context: Context, var confideHomeView: IConfideHomeCo ...@@ -125,8 +132,23 @@ class ConfideHomeEventImpl(context: Context, var confideHomeView: IConfideHomeCo
* 最佳倾诉榜单--点我倾诉 * 最佳倾诉榜单--点我倾诉
* @param linkUrl 跳转地址 * @param linkUrl 跳转地址
*/ */
override fun consultantClick(linkUrl: String?) { override fun consultantClick(doctorId: String?, confideId: String?, uid: String?) {
link(linkUrl) 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 ...@@ -154,10 +176,11 @@ class ConfideHomeEventImpl(context: Context, var confideHomeView: IConfideHomeCo
initConfidePlayerListener() 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() val mu = Music()
mu.title = name mu.title = name
mu.path = playUrl mu.path = playUrl
mu.coverPath=confideIcon
AudioPlayer.get().singlePlay(mu) AudioPlayer.get().singlePlay(mu)
if (PlayerFloatHelper.isShow(mContext!!)) { if (PlayerFloatHelper.isShow(mContext!!)) {
if (AudioPlayer.get().playMode.value() == 1) { if (AudioPlayer.get().playMode.value() == 1) {
...@@ -215,9 +238,6 @@ class ConfideHomeEventImpl(context: Context, var confideHomeView: IConfideHomeCo ...@@ -215,9 +238,6 @@ class ConfideHomeEventImpl(context: Context, var confideHomeView: IConfideHomeCo
//听声寻人 //听声寻人
IConfideHomeConfig.TYPE_SOUND -> { IConfideHomeConfig.TYPE_SOUND -> {
} }
//咨询师推荐
IConfideHomeConfig.TYPE_CONSULTANT -> {
}
} }
} }
...@@ -258,9 +278,10 @@ class ConfideHomeEventImpl(context: Context, var confideHomeView: IConfideHomeCo ...@@ -258,9 +278,10 @@ class ConfideHomeEventImpl(context: Context, var confideHomeView: IConfideHomeCo
* 私聊 * 私聊
*/ */
override fun toChatForMsg(doctorId: String?) { override fun toChatForMsg(doctorId: String?) {
if (null != mContext && mContext is Activity){ if (null != mContext && mContext is Activity) {
PhoneCallIn.loginByOneKeyLogin(mContext as Activity,true) if (!PhoneCallIn.loginByOneKeyLogin(mContext as Activity, true)) {
return return
}
} }
if (mContext is AppCompatActivity && !TextUtils.isEmpty(doctorId)) { if (mContext is AppCompatActivity && !TextUtils.isEmpty(doctorId)) {
PhoneCallIn.startChat(mContext as AppCompatActivity, doctorId!!, 0x001, 0) PhoneCallIn.startChat(mContext as AppCompatActivity, doctorId!!, 0x001, 0)
...@@ -328,9 +349,9 @@ class ConfideHomeEventImpl(context: Context, var confideHomeView: IConfideHomeCo ...@@ -328,9 +349,9 @@ class ConfideHomeEventImpl(context: Context, var confideHomeView: IConfideHomeCo
return return
} }
var sortPopup: ConfideHomeSortPopupWindow? = null 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) 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) { override fun onSortItemSelected(sortItem: ConfideHomeFiterItemBean) {
//更改小图标 //更改小图标
...@@ -363,17 +384,17 @@ class ConfideHomeEventImpl(context: Context, var confideHomeView: IConfideHomeCo ...@@ -363,17 +384,17 @@ class ConfideHomeEventImpl(context: Context, var confideHomeView: IConfideHomeCo
* @param mConfideAdapter section适配器 * @param mConfideAdapter section适配器
*/ */
override fun showSexAgePopupWindow(v_line_top: View, filterView: ConfideHomeFilterView, bodyBean: ConfideHomeBodyBean?, allFiltersBean: ConfideHomeAllFiltersBean, mConfideAdapter: ConfideHomeAdapter) { 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( "数据初始化失败,请重新下拉刷新") ToastUtil.toastShort( "数据初始化失败,请重新下拉刷新")
return return
} }
val sexData = ArrayList<ConfideHomeFiterItemBean>() val sexData = ArrayList<ConfideHomeFiterItemBean>()
if (null != bodyBean.group[0].data) { if (null != bodyBean.group!![0].data) {
sexData.addAll(bodyBean.group[0].data!!) sexData.addAll(bodyBean.group!![0].data!!)
} }
val ageData = ArrayList<ConfideHomeFiterItemBean>() val ageData = ArrayList<ConfideHomeFiterItemBean>()
if (1 < bodyBean.group.size && null != bodyBean.group[1].data) { if (1 < bodyBean.group!!.size && null != bodyBean.group!![1].data) {
ageData.addAll(bodyBean.group[1].data!!) ageData.addAll(bodyBean.group!![1].data!!)
} }
val categoryPopup = ConfideHomeSexAgePopupWindow(mContext!!, sexData, ageData, allFiltersBean) val categoryPopup = ConfideHomeSexAgePopupWindow(mContext!!, sexData, ageData, allFiltersBean)
ConfideHomeUtils.synchroStyle(mContext!!, 2, IConfideHomeConfig.FILTER_STATUS_OPEN, filterView, mConfideAdapter) ConfideHomeUtils.synchroStyle(mContext!!, 2, IConfideHomeConfig.FILTER_STATUS_OPEN, filterView, mConfideAdapter)
...@@ -414,8 +435,8 @@ class ConfideHomeEventImpl(context: Context, var confideHomeView: IConfideHomeCo ...@@ -414,8 +435,8 @@ class ConfideHomeEventImpl(context: Context, var confideHomeView: IConfideHomeCo
* @param mConfideAdapter section适配器 * @param mConfideAdapter section适配器
*/ */
override fun showGoodPopupWindow(v_line_top: View, filterView: ConfideHomeFilterView, bodyBean: ConfideHomeBodyBean?, allFiltersBean: ConfideHomeAllFiltersBean, mConfideAdapter: ConfideHomeAdapter) { 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()) { 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!!) val categoryPopup = ConfideHomeGoodPopupWindow(mContext!!, bodyBean.group!![0].data!!, allFiltersBean.selectGoodData!!)
ConfideHomeUtils.synchroStyle(mContext!!, 3, IConfideHomeConfig.FILTER_STATUS_OPEN, filterView, mConfideAdapter) ConfideHomeUtils.synchroStyle(mContext!!, 3, IConfideHomeConfig.FILTER_STATUS_OPEN, filterView, mConfideAdapter)
categoryPopup!!.setOnDismissListener { categoryPopup!!.setOnDismissListener {
if (allFiltersBean.selectGoodData!!.size > 1 || (allFiltersBean.selectGoodData!!.size == 1 && allFiltersBean!!.selectGoodData!![0] != bodyBean.group!![0].data!![0])) { if (allFiltersBean.selectGoodData!!.size > 1 || (allFiltersBean.selectGoodData!!.size == 1 && allFiltersBean!!.selectGoodData!![0] != bodyBean.group!![0].data!![0])) {
......
...@@ -73,7 +73,9 @@ interface IConfideHomeEvent { ...@@ -73,7 +73,9 @@ interface IConfideHomeEvent {
* 咨询师推荐--点我倾诉 * 咨询师推荐--点我倾诉
* @param linkUrl 跳转地址 * @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 { ...@@ -97,7 +99,7 @@ interface IConfideHomeEvent {
* @param playUrl 播放地址 * @param playUrl 播放地址
* @param name 咨询师姓名 * @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 ...@@ -2,6 +2,7 @@ package com.ydl.confide.home.http
import com.ydl.confide.home.bean.ConfideConnectResponse import com.ydl.confide.home.bean.ConfideConnectResponse
import com.ydl.confide.home.bean.ConfideHomeDataBean 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
import com.ydl.ydlcommon.base.config.YDL_DOMAIN_JAVA import com.ydl.ydlcommon.base.config.YDL_DOMAIN_JAVA
import com.ydl.ydlcommon.data.http.BaseAPIResponse import com.ydl.ydlcommon.data.http.BaseAPIResponse
...@@ -33,4 +34,16 @@ interface ConfideHomeApi { ...@@ -33,4 +34,16 @@ interface ConfideHomeApi {
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA, "Content-Type:application/json") @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA, "Content-Type:application/json")
@GET("auth/listen/dial") @GET("auth/listen/dial")
fun connectJava(@QueryMap params: Map<String, String>): Observable<BaseAPIResponse<ConfideConnectResponse>> 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 { ...@@ -35,7 +35,7 @@ class ConfideHomeHttpImpl private constructor() : IConfideHomeHttp {
override fun confideHomeRequest(): Observable<BaseAPIResponse<MutableList<ConfideHomeDataBean>>> { override fun confideHomeRequest(): Observable<BaseAPIResponse<MutableList<ConfideHomeDataBean>>> {
return RxUtils.mapObservable(ConfideHomeParam(0)) return RxUtils.mapObservable(ConfideHomeParam(0))
.flatMap { .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 ...@@ -2,6 +2,7 @@ package com.ydl.confide.home.listener
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.ydl.confide.home.widget.ConfideHomeFilterView
import com.yidianling.common.tools.LogUtil import com.yidianling.common.tools.LogUtil
import com.yidianling.common.tools.RxImageTool import com.yidianling.common.tools.RxImageTool
...@@ -51,7 +52,9 @@ class ConfideHomeRecycleViewListener : RecyclerView.OnScrollListener() { ...@@ -51,7 +52,9 @@ class ConfideHomeRecycleViewListener : RecyclerView.OnScrollListener() {
fun moveToPosition(mRecyclerView: RecyclerView){ fun moveToPosition(mRecyclerView: RecyclerView){
mRecyclerView.scrollBy(0, 1) 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){ if(top==0 || top==1){
//已滚动到顶部 //已滚动到顶部
......
...@@ -23,11 +23,13 @@ class ConfideHomeRecyleSuspendListener : RecyclerView.OnScrollListener() { ...@@ -23,11 +23,13 @@ class ConfideHomeRecyleSuspendListener : RecyclerView.OnScrollListener() {
private var mSuspensionHeight: Int = RxImageTool.dip2px(48f) private var mSuspensionHeight: Int = RxImageTool.dip2px(48f)
private var filterView: ConfideHomeFilterView? = null private var filterView: ConfideHomeFilterView? = null
private var divView: View? = null
private var adapter: ConfideHomeAdapter? = null private var adapter: ConfideHomeAdapter? = null
fun setFilterView(filterView: ConfideHomeFilterView) { fun setFilterView(filterView: ConfideHomeFilterView, divView: View) {
this.filterView = filterView this.filterView = filterView
this.divView = divView
} }
fun setSectionAdapter(adapter: ConfideHomeAdapter) { fun setSectionAdapter(adapter: ConfideHomeAdapter) {
...@@ -56,14 +58,17 @@ class ConfideHomeRecyleSuspendListener : RecyclerView.OnScrollListener() { ...@@ -56,14 +58,17 @@ class ConfideHomeRecyleSuspendListener : RecyclerView.OnScrollListener() {
if (view != null) { if (view != null) {
if (view.top <= mSuspensionHeight) { if (view.top <= mSuspensionHeight) {
filterView!!.visibility = View.VISIBLE filterView!!.visibility = View.VISIBLE
divView?.visibility = View.VISIBLE
} else { } else {
// filterView!!.visibility = View.INVISIBLE // filterView!!.visibility = View.INVISIBLE
} }
} }
}else if (adapter!!.getItemViewType(mCurrentPosition) == IConfideHomeConfig.TYPE_RECOMMEND || adapter!!.getItemViewType(mCurrentPosition) == IConfideHomeConfig.TYPE_SOUND){ }else if (adapter!!.getItemViewType(mCurrentPosition) == IConfideHomeConfig.TYPE_RECOMMEND || adapter!!.getItemViewType(mCurrentPosition) == IConfideHomeConfig.TYPE_SOUND){
filterView!!.visibility = View.VISIBLE filterView!!.visibility = View.VISIBLE
divView?.visibility = View.VISIBLE
}else { }else {
filterView!!.visibility = View.INVISIBLE filterView!!.visibility = View.INVISIBLE
divView?.visibility = View.INVISIBLE
} }
} }
} }
\ No newline at end of file
...@@ -5,20 +5,21 @@ import android.app.Application ...@@ -5,20 +5,21 @@ import android.app.Application
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.net.Uri import android.net.Uri
import androidx.fragment.app.DialogFragment
import android.text.TextUtils import android.text.TextUtils
import androidx.fragment.app.DialogFragment
import androidx.fragment.app.FragmentActivity
import com.alibaba.android.arouter.facade.annotation.Route import com.alibaba.android.arouter.facade.annotation.Route
import com.google.gson.Gson import com.google.gson.Gson
import com.ydl.audioim.YDLavManager import com.ydl.audioim.YDLavManager
import com.ydl.audioim.widget.AxbConfirmDialog import com.ydl.audioim.widget.AxbConfirmDialog
import com.ydl.confide.api.IConfideService import com.ydl.confide.api.IConfideService
import com.ydl.confide.home.ConfideBottomSheetDialogFragment
import com.ydl.confide.home.ConfideHomeActivity import com.ydl.confide.home.ConfideHomeActivity
import com.ydl.webview.TellData import com.ydl.webview.TellData
import com.ydl.ydlcommon.base.BaseApp import com.ydl.ydlcommon.base.BaseApp
import com.ydl.ydlcommon.base.config.YDLConstants import com.ydl.ydlcommon.base.config.YDLConstants
import com.ydl.ydlcommon.ui.Loading
import com.ydl.ydlcommon.utils.YDLCacheUtils 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 . * Created by haorui on 2019-12-11 .
...@@ -52,6 +53,7 @@ class ConfdieServiceImpl : IConfideService { ...@@ -52,6 +53,7 @@ class ConfdieServiceImpl : IConfideService {
} }
override fun connectionJava(id: Int, type: Int, activity: Activity, tellData: String?, callType: String?) { 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) val myTellData: TellData? = if (tellData == null ) null else Gson().fromJson(tellData, TellData::class.java)
ConfideWebServiceImpl().connectionJava(id, type, activity, myTellData, callType) ConfideWebServiceImpl().connectionJava(id, type, activity, myTellData, callType)
} }
...@@ -116,5 +118,8 @@ class ConfdieServiceImpl : IConfideService { ...@@ -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 ...@@ -2,6 +2,7 @@ package com.ydl.confide.home.modular.service
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.app.Activity import android.app.Activity
import android.content.Context
import android.content.Intent import android.content.Intent
import android.net.Uri import android.net.Uri
import android.text.TextUtils import android.text.TextUtils
...@@ -17,6 +18,7 @@ import com.ydl.webview.H5Params ...@@ -17,6 +18,7 @@ import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity import com.ydl.webview.NewH5Activity
import com.ydl.webview.TellData import com.ydl.webview.TellData
import com.ydl.ydlcommon.modular.ModularServiceManager import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.ui.Loading
import com.ydl.ydlcommon.utils.remind.ToastHelper import com.ydl.ydlcommon.utils.remind.ToastHelper
import com.ydl.ydlcommon.view.dialog.CommonDialog import com.ydl.ydlcommon.view.dialog.CommonDialog
import com.yidianling.common.tools.ToastUtil import com.yidianling.common.tools.ToastUtil
...@@ -25,6 +27,7 @@ import com.yidianling.ydl_pay.pay.payDialog.CallBack ...@@ -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.ConfidePayParams
import com.yidianling.ydl_pay.pay.payDialog.PayDialog import com.yidianling.ydl_pay.pay.payDialog.PayDialog
import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
import io.reactivex.schedulers.Schedulers import io.reactivex.schedulers.Schedulers
/** /**
...@@ -156,9 +159,72 @@ class ConfideWebServiceImpl { ...@@ -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( private fun callAgora(
activity: Activity, activity: Context,
confideId: Int, confideId: Int,
expertInfo: ExpertInfoBean, expertInfo: ExpertInfoBean,
call_id: String, call_id: String,
...@@ -181,7 +247,8 @@ class ConfideWebServiceImpl { ...@@ -181,7 +247,8 @@ class ConfideWebServiceImpl {
expertInfo.remainingTime = expertInfo.remainingTime =
ExpertInfoBean.ListenRemainingTime(expertInfo.totalDuration); 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") ARouter.getInstance().build("/av/AudioHomeActivity")
.withString(IntentConstants.INTENT_EXPERT_HEAD_URL, expertInfo.expertHeadUrl) .withString(IntentConstants.INTENT_EXPERT_HEAD_URL, expertInfo.expertHeadUrl)
.withString(IntentConstants.INTENT_EXPERT_NAME, expertInfo.expertName) .withString(IntentConstants.INTENT_EXPERT_NAME, expertInfo.expertName)
......
...@@ -2,14 +2,14 @@ package com.ydl.confide.home.popwindow ...@@ -2,14 +2,14 @@ package com.ydl.confide.home.popwindow
import android.content.Context import android.content.Context
import android.graphics.drawable.BitmapDrawable 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.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.PopupWindow import android.widget.PopupWindow
import android.widget.TextView 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.R
import com.ydl.confide.home.bean.ConfideHomeAllFiltersBean import com.ydl.confide.home.bean.ConfideHomeAllFiltersBean
import com.ydl.confide.home.bean.ConfideHomeFiterItemBean import com.ydl.confide.home.bean.ConfideHomeFiterItemBean
...@@ -65,7 +65,10 @@ class ConfideHomeSexAgePopupWindow(context: Context, sexData: ArrayList<ConfideH ...@@ -65,7 +65,10 @@ class ConfideHomeSexAgePopupWindow(context: Context, sexData: ArrayList<ConfideH
dismiss() dismiss()
} }
view.btnReset.setOnClickListener { view.btnReset.setOnClickListener {
selectSex = ConfideHomeFiterItemBean("-1","") selectSex = ConfideHomeFiterItemBean().apply {
id = "-1"
name = ""
}
mAllFiltersBean!!.selectSex = selectSex mAllFiltersBean!!.selectSex = selectSex
initSexData(view,mAllFiltersBean!!) initSexData(view,mAllFiltersBean!!)
sexAgeAdapter?.cleanSelectedGoods() sexAgeAdapter?.cleanSelectedGoods()
...@@ -81,7 +84,8 @@ class ConfideHomeSexAgePopupWindow(context: Context, sexData: ArrayList<ConfideH ...@@ -81,7 +84,8 @@ class ConfideHomeSexAgePopupWindow(context: Context, sexData: ArrayList<ConfideH
private fun initData(sexData: ArrayList<ConfideHomeFiterItemBean>,ageData : ArrayList<ConfideHomeFiterItemBean>,allFiltersBean: ConfideHomeAllFiltersBean){ private fun initData(sexData: ArrayList<ConfideHomeFiterItemBean>,ageData : ArrayList<ConfideHomeFiterItemBean>,allFiltersBean: ConfideHomeAllFiltersBean){
//初始化已选择性别数据 //初始化已选择性别数据
if (null == selectSex){ if (null == selectSex){
selectSex = ConfideHomeFiterItemBean("-1","") selectSex = ConfideHomeFiterItemBean().apply { id="-1"
name=""}
} }
if (null != allFiltersBean.selectSex){ if (null != allFiltersBean.selectSex){
selectSex!!.id = allFiltersBean.selectSex!!.id selectSex!!.id = allFiltersBean.selectSex!!.id
......
package com.ydl.confide.home.util package com.ydl.confide.home.util
import android.content.Context 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.text.TextUtils
import android.view.View import android.view.View
import android.view.animation.AnimationUtils import android.view.animation.AnimationUtils
import android.view.animation.LinearInterpolator import android.view.animation.LinearInterpolator
import android.widget.ImageView 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.R
import com.ydl.confide.home.adapter.ConfideHomeAdapter import com.ydl.confide.home.adapter.ConfideHomeAdapter
import com.ydl.confide.home.bean.ConfideHomeAllFiltersBean import com.ydl.confide.home.bean.ConfideHomeAllFiltersBean
...@@ -84,32 +84,12 @@ class ConfideHomeUtils { ...@@ -84,32 +84,12 @@ class ConfideHomeUtils {
* 数据重组 * 数据重组
*/ */
fun resetData(list: MutableList<ConfideHomeDataBean>, filterView: ConfideHomeFilterView, listScrollListener: ConfideHomeRecycleViewListener) { fun resetData(list: MutableList<ConfideHomeDataBean>, filterView: ConfideHomeFilterView, listScrollListener: ConfideHomeRecycleViewListener) {
val recommendList: MutableList<ConfideHomeDataBean> = ArrayList() for ((index, dataBean) in list.withIndex()) {
var soundDataBean: ConfideHomeDataBean? = null
for ((index, dataBean) in list.withIndex().reversed()) {
//给隐藏的为你推荐筛选view赋值 //给隐藏的为你推荐筛选view赋值
if (dataBean.type == IConfideHomeConfig.TYPE_RECOMMEND_FILTER) { if (dataBean.type == IConfideHomeConfig.TYPE_RECOMMEND_FILTER) {
listScrollListener.setFilterIndex(index) listScrollListener.setFilterIndex(index)
filterView.initData(dataBean) 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 { ...@@ -124,7 +104,7 @@ class ConfideHomeUtils {
for (bodyBean in dataBean.body) { for (bodyBean in dataBean.body) {
val bodyList: MutableList<ConfideHomeBodyBean> = ArrayList() val bodyList: MutableList<ConfideHomeBodyBean> = ArrayList()
bodyList.add(bodyBean) 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) list.add(recommendDataBean)
} }
return list return list
...@@ -174,12 +154,6 @@ class ConfideHomeUtils { ...@@ -174,12 +154,6 @@ class ConfideHomeUtils {
section.setData(resultBean) section.setData(resultBean)
mConfideAdapter?.addSection(section) mConfideAdapter?.addSection(section)
} }
//最佳倾诉榜单 todo 产品说先隐藏掉
IConfideHomeConfig.TYPE_CONSULTANT -> {
// var section = ConfideHomeRecommendExpertSection(context,mConfideEvent)
// section.setData(resultBean)
// mConfideAdapter?.addSection(section)
}
//为你推荐筛选模块 //为你推荐筛选模块
IConfideHomeConfig.TYPE_RECOMMEND_FILTER -> { IConfideHomeConfig.TYPE_RECOMMEND_FILTER -> {
var section = ConfideHomeFilterSection(context, view) var section = ConfideHomeFilterSection(context, view)
...@@ -254,10 +228,6 @@ class ConfideHomeUtils { ...@@ -254,10 +228,6 @@ class ConfideHomeUtils {
IConfideHomeConfig.TYPE_SOUND -> { IConfideHomeConfig.TYPE_SOUND -> {
listenAndFoundData = resultBean 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 ...@@ -10,13 +10,13 @@ import android.view.ViewGroup
import android.widget.FrameLayout import android.widget.FrameLayout
import android.widget.LinearLayout import android.widget.LinearLayout
import android.widget.TextView 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.R
import com.ydl.confide.home.bean.ConfideHomeBodyBean import com.ydl.confide.home.bean.ConfideHomeBodyBean
import com.ydl.confide.home.config.IConfideHomeConfig import com.ydl.confide.home.config.IConfideHomeConfig
import com.ydl.confide.home.event.IConfideHomeEvent import com.ydl.confide.home.event.IConfideHomeEvent
import com.ydl.ydl_image.module.GlideApp
import com.ydl.ydlcommon.utils.ScreenUtil import com.ydl.ydlcommon.utils.ScreenUtil
import com.yidianling.common.tools.RxImageTool
import kotlinx.android.synthetic.main.confide_recommend_expert_item_view.view.* import kotlinx.android.synthetic.main.confide_recommend_expert_item_view.view.*
/** /**
...@@ -153,7 +153,7 @@ class ConfideHomeRecommendExpertItemView(mContext: Context, private var confideH ...@@ -153,7 +153,7 @@ class ConfideHomeRecommendExpertItemView(mContext: Context, private var confideH
if (confideIsPlay) { if (confideIsPlay) {
confideHomeEvent.pauseVoice() confideHomeEvent.pauseVoice()
} else { } 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 ...@@ -202,11 +202,11 @@ class ConfideHomeRecommendExpertItemView(mContext: Context, private var confideH
*/ */
private fun setConfideTag(bodyBean: ConfideHomeBodyBean) { private fun setConfideTag(bodyBean: ConfideHomeBodyBean) {
flowlayout_tag.removeAllViews() flowlayout_tag.removeAllViews()
if (null == bodyBean.confidedTag || bodyBean.confidedTag.isEmpty()) { if (null == bodyBean.confidedTag || bodyBean.confidedTag!!.isEmpty()) {
return return
} }
var i = 0 var i = 0
for (tag in bodyBean.confidedTag) { for (tag in bodyBean.confidedTag!!) {
if (i > 4) break if (i > 4) break
var params = LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, dp16) var params = LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, dp16)
params.setMargins(0, 0, dp4, 0) params.setMargins(0, 0, dp4, 0)
...@@ -243,7 +243,7 @@ class ConfideHomeRecommendExpertItemView(mContext: Context, private var confideH ...@@ -243,7 +243,7 @@ class ConfideHomeRecommendExpertItemView(mContext: Context, private var confideH
private fun click(bodyBean: ConfideHomeBodyBean) { private fun click(bodyBean: ConfideHomeBodyBean) {
when (bodyBean.confideLine) {//1在线 2离线 3通话中 when (bodyBean.confideLine) {//1在线 2离线 3通话中
1, 3, 4 -> { 1, 3, 4 -> {
confideHomeEvent.consultantClick(bodyBean.linkUrl) confideHomeEvent.consultantClick(bodyBean.doctorId, bodyBean.confidedId, bodyBean.uid?.toString())
} }
2 -> { 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 ...@@ -5,6 +5,7 @@ import android.app.Application
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import androidx.fragment.app.DialogFragment import androidx.fragment.app.DialogFragment
import androidx.fragment.app.FragmentActivity
import com.alibaba.android.arouter.facade.template.IProvider import com.alibaba.android.arouter.facade.template.IProvider
interface IConfideService : IProvider { interface IConfideService : IProvider {
...@@ -26,4 +27,11 @@ interface IConfideService : IProvider { ...@@ -26,4 +27,11 @@ interface IConfideService : IProvider {
fun initYdlavManager(app: Application) fun initYdlavManager(app: Application)
fun showAxbConfirmDialog(activity: Activity?, type: Int, phoneNumber: String?) 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"?> <?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"> <shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:bottomRightRadius="6dp"/> <corners android:bottomRightRadius="6dp"/>
<solid android:color="#90666666" /> <solid android:color="#4d000000" />
</shape> </shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"> <shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:bottomRightRadius="6dp"/> <corners android:bottomRightRadius="6dp"/>
<solid android:color="#90FF8F38"/> <solid android:color="#4d000000"/>
</shape> </shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"> <shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:bottomRightRadius="6dp"/> <corners android:bottomRightRadius="6dp"/>
<solid android:color="#901da1f2" /> <solid android:color="#4d000000" />
</shape> </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 @@ ...@@ -3,11 +3,8 @@
android:shape="rectangle"> android:shape="rectangle">
<corners <corners
android:radius="4dp"/> android:radius="8dp"/>
<solid android:color="#eaffffff"/> <solid android:color="#ffffff"/>
<stroke android:width="0.5dp"
android:color="#cccccc"/>
</shape> </shape>
\ No newline at end of file
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
android:shape="rectangle"> android:shape="rectangle">
<gradient <gradient
android:startColor="@color/platform_main_gradient_end_color" android:startColor="@color/confide_61CEAC"
android:endColor="@color/platform_main_gradient_start_color"/> android:endColor="@color/confide_48CC95"/>
<corners android:radius="15dp" /> <corners android:radius="8dp" />
</shape> </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
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