Commit 29693366 by 刘鹏

Merge branch 'd/v_confide_2.0' into feat/lp/lp_confide_2.0

# Conflicts:
#	app/build.gradle
#	config.gradle
#	ydl-platform/src/main/java/com/ydl/ydlcommon/view/dialog/YDLShareDialog.kt
parents 5ab37efb b3e227f2
......@@ -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
......@@ -21,9 +21,9 @@ import java.util.List;
public final class DemoGlobalConfig implements IConfigModule {
String APP_DOMAIN = "https://api.github.com/";
// 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_PROD;
// public static String appEnv = YDLConstants.ENV_PROD;
@Override
public void injectAppLifecycle(@NotNull Context context, @NotNull List<IAppLifecycles> lifecycles) {
lifecycles.add(new DemoAppLifecycles());
......
......@@ -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;
......@@ -12,6 +13,8 @@ import com.ydl.ydlcommon.modular.ModularServiceManager;
import com.yidianling.common.tools.LogUtil;
import com.yidianling.im.api.service.IImService;
import de.greenrobot.event.EventBus;
/**
* webview 点击事件监听 抽象类
* Created by harvie on 2017/7/4 0004.
......@@ -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));
}
}
......@@ -381,6 +381,10 @@ class WebJavascriptHandler : IJavascriptHandler{
wvEnventPro?.setSelfPageType(it.selfPageType)
}
}
//再换一位
"get_next_doctor"->{
wvEnventPro?.getNextExpertStatus(jsData.cmd?.params?.doctorId.toString(),jsData.cmd?.params?.title,jsData.cmd?.params?.uid.toString())
}
}
}
}
......@@ -181,5 +181,5 @@ public interface WebViewClientClickListener {
//设置当前页面类型
void setSelfPageType(int selfType);
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,12 +5,12 @@ ext {
ydlPublishVersion = [
// -------------- 业务模块 --------------
//第三步 若干
"m-confide" : "0.0.49.74",
"m-confide" : "0.0.49.78",
"m-consultant" : "0.0.60.25",
"m-fm" : "0.0.30.08",
"m-user" : "0.0.62.11",
"m-home" : "0.0.23.48",
"m-im" : "0.0.21.44",
"m-im" : "0.0.21.45",
"m-dynamic" : "0.0.7.73",
"m-article" : "0.0.0.10",
......@@ -20,7 +20,7 @@ ext {
//-------------- 业务模块 API 层 --------------
"m-audioim-api" : "0.0.6",
"m-confide-api" : "0.0.2.11",
"m-confide-api" : "0.0.2.12",
"m-consultant-api": "0.0.5.63",
"m-course-api" : "0.0.3.6",
"m-fm-api" : "0.0.3",
......@@ -35,19 +35,19 @@ ext {
//mdt 组件
"ydl-tuicore" : "0.0.23",
//第一步
"ydl-platform" : "0.0.41.08",
"ydl-platform" : "0.0.41.11",
//第二步 若干
"ydl-webview" : "0.0.38.62",
"ydl-media" : "0.0.21.44",
"ydl-media" : "0.0.21.45",
"ydl-pay" : "0.0.18.19",
"m-audioim" : "0.0.49.29.90",
"m-audioim" : "0.0.49.29.92",
"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.6",
]
ydl_app = [
appName : "壹点灵心理咨询",
......@@ -90,12 +90,12 @@ ext {
// -------------- 业务模块 --------------
//第三步 若干
"m-confide" : "0.0.49.74",
"m-confide" : "0.0.49.78",
"m-consultant" : "0.0.60.25",
"m-fm" : "0.0.30.08",
"m-user" : "0.0.62.11",
"m-home" : "0.0.23.48",
"m-im" : "0.0.21.44",
"m-im" : "0.0.21.45",
"m-dynamic" : "0.0.7.73",
"m-article" : "0.0.0.8",
......@@ -104,7 +104,7 @@ ext {
"m-course" : "0.0.43.37",
//-------------- 业务模块 API 层 --------------
"m-audioim-api" : "0.0.6",
"m-confide-api" : "0.0.2.11",
"m-confide-api" : "0.0.2.12",
"m-consultant-api": "0.0.5.63",
"m-course-api" : "0.0.3.6",
"m-fm-api" : "0.0.3",
......@@ -118,19 +118,19 @@ ext {
//mdt组件
"ydl-tuicore" : "0.0.23",
//第一步
"ydl-platform" : "0.0.41.08",
"ydl-platform" : "0.0.41.11",
//第二步 若干
"ydl-webview" : "0.0.38.62",
"ydl-media" : "0.0.21.44",
"ydl-media" : "0.0.21.45",
"ydl-pay" : "0.0.18.19",
"m-audioim" : "0.0.49.29.90",
"m-audioim" : "0.0.49.29.92",
"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.6",
]
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
......
......@@ -21,6 +21,7 @@ import android.view.View
import android.view.animation.AccelerateInterpolator
import androidx.core.content.ContextCompat
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.launcher.ARouter
import com.google.gson.Gson
import com.hjq.permissions.OnPermissionCallback
import com.hjq.permissions.XXPermissions
......@@ -41,6 +42,7 @@ import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity
import com.ydl.webview.RefreshWebEvent
import com.ydl.ydl_av.chat.bean.AudioMessageBean
import com.ydl.ydl_av.voice.impl.YDLVoiceApiImpl
import com.ydl.ydl_av.voice.listener.IYDLVoiceEventHandler
import com.ydl.ydl_av.voice.manager.YDLVoiceManager
import com.ydl.ydl_image.config.SimpleImageOpConfiger
......@@ -56,6 +58,7 @@ import com.ydl.ydlcommon.utils.log.AliYunLogConfig
import com.ydl.ydlcommon.utils.log.AliYunRichLogsHelper
import com.ydl.ydlcommon.utils.log.LogHelper
import com.ydl.ydlcommon.utils.remind.ToastHelper
import com.yidianling.im.api.service.IImService
import com.yidianling.user.api.service.IUserService
import de.greenrobot.event.EventBus
import io.agora.rtc.Constants
......@@ -546,7 +549,7 @@ class AudioHomeActivity :
writeAgoraLog("用户拨打电话界面开启")
AliYunRichLogsHelper.getInstance()
.sendRichLog(AliYunLogConfig.AGORA, "用户拨打电话界面开启")
tv_change_route.isEnabled = false
ll_changeRoute.isEnabled = false
//水波纹view初始化
wave_view.setDuration(6000)
wave_view.setStyle(Paint.Style.STROKE)
......@@ -573,14 +576,33 @@ class AudioHomeActivity :
}
if (!isShowAXB) {
tv_change_route.visibility = View.GONE
ll_changeRoute.visibility = View.GONE
tv_change_time_counter.visibility = View.GONE
}
}
private fun setClickEvent() {
//跳转客服小壹
jump_kefu.setOnClickListener {
val imService = ARouter.getInstance().navigation(IImService::class.java)
imService?.startKefuChat(this, "", 0, 0)
}
//静音开启
rl_mute_on_off.setOnClickListener {
if (iv_mute_on_off.isSelected) {
iv_mute_on_off.isSelected = false
iv_mute_on_off.setImageResource(R.drawable.audiohome_muteoff)
audio_mute_text.text="麦克风已关"
voiceManage?.getVoiceApi()?.enableLocalAudio(false)
} else {
iv_mute_on_off.isSelected = true
iv_mute_on_off.setImageResource(R.drawable.audiohome_muteon)
audio_mute_text.text="麦克风已开"
voiceManage?.getVoiceApi()?.enableLocalAudio(true)
}
}
//切换线路
tv_change_route.setOnClickListener {
ll_changeRoute.setOnClickListener {
showChooseDialog(1)
}
//挂断
......@@ -597,10 +619,10 @@ class AudioHomeActivity :
leaveChannel()
uploadLog()
YDLavManager.instances.callEndStatusUpdate(channelId!!, 3, "主叫主动挂断")
callEventSave("51", "已接通:主叫主动挂断")
} else {
userCloseCalling()
}
callEventSave("51", "已接通:主叫主动挂断")
ActionCountUtils.count(
"shengwang_popup_layer_page|shengwang_popup_layer_refuse_click",
......@@ -762,7 +784,7 @@ class AudioHomeActivity :
if (!isConnectSuccess) {
//关闭音乐
stopPlaying()
callEventSave("80", "未接通挂断:50s等待倒计时结束挂断")
callEventSave("34", "未接通挂断:50s等待倒计时结束挂断")
writeAgoraLog("未接通挂断:50s等待倒计时结束挂断")
AliYunRichLogsHelper.getInstance()
......@@ -836,7 +858,7 @@ class AudioHomeActivity :
*
*/
private fun userCloseCalling() {
callEventSave("51", "未接听时:主叫(用户)主动挂断,取消呼叫")
callEventSave("32", "未接听时:主叫(用户)主动挂断,取消呼叫")
writeAgoraLog("未接听时:主叫(用户)主动挂断,取消呼叫")
AliYunRichLogsHelper.getInstance()
......@@ -997,13 +1019,10 @@ class AudioHomeActivity :
// tv_change_doctor.visibility = View.VISIBLE
// }
if (!isShowAXB) {
tv_change_route.visibility = View.GONE
ll_changeRoute.visibility = View.GONE
} else {
//切换线路按钮可见
tv_change_route.isEnabled = true
tv_change_route.text = "切换至传统电话"
tv_change_route.setTextColor(ContextCompat.getColor(this, R.color.platform_white))
ll_changeRoute.isEnabled = true
}
}
......@@ -1102,23 +1121,8 @@ class AudioHomeActivity :
playNoticeMusic(1)
}
if (localRemainTime!! <= 60) {
if (tv_change_route.isEnabled) {
tv_change_route.isEnabled = false
tv_change_route.setTextColor(
ContextCompat.getColor(
this,
R.color.audioim_color_50ffffff
)
)
tv_change_route.setCompoundDrawablesWithIntrinsicBounds(
null,
null,
ContextCompat.getDrawable(
this,
R.drawable.audioim_img_choose_arrow_unuse
),
null
)
if (ll_changeRoute.isEnabled) {
ll_changeRoute.isEnabled = false
}
}
tv_remain_time.text = DateUtils.formatTime(localRemainTime.toString())
......@@ -1406,7 +1410,7 @@ class AudioHomeActivity :
* @param res 上报的详细
* @param line 载体:1.网易 2.中国移动(双呼)3.联通 4.华为 5.糖猫-联通 7:声网 8:微信 10:新移动
* */
private fun callEventSave(
fun callEventSave(
status: String,
res: String,
session: String? = channelId,
......
......@@ -142,6 +142,7 @@ class YDLavManager {
val act = ActivityManager.getInstance().getTopTaskActivity()
if (act is AudioHomeActivity) {
act.runOnUiThread {
act.callEventSave("33", "被叫拒绝,被叫点击了拒绝按钮")
callEndStatusUpdate(response?.ChannelId!!, 2, "被叫拒绝")
ToastUtil.toastShort("对方已挂断")
act.writeAgoraLog("被叫(专家)拒绝了通话邀请")
......
<?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:color="#ffffff"
android:width="0.5dp"
>
</stroke>
</shape>
\ No newline at end of file
......@@ -4,33 +4,27 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/platform_color_80353535">
android:background="@drawable/audiohome_background">
<TextView
android:id="@+id/tv_change_route"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="25dp"
android:layout_marginRight="10dp"
android:background="?android:attr/selectableItemBackground"
android:drawablePadding="6dp"
android:padding="5dp"
android:text="后可切换至传统电话"
android:textColor="@color/platform_color_50FFFFFF"
android:textSize="13sp"
android:visibility="visible" />
<TextView
android:id="@+id/tv_change_time_counter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/tv_change_route"
android:layout_toLeftOf="@+id/tv_change_route"
android:textColor="@color/white"
android:textSize="15dp"
tools:text="60s" />
android:text="联系客服"
android:id="@+id/jump_kefu"
android:drawableLeft="@drawable/audioim_kefu"
android:layout_alignParentRight="true"
android:layout_marginTop="44dp"
android:layout_marginRight="@dimen/platform_dp_15"
android:drawablePadding="@dimen/platform_dp_3"
android:background="@drawable/audio_border_white_kefu"
android:paddingTop="@dimen/platform_dp_5"
android:paddingBottom="@dimen/platform_dp_5"
android:paddingStart="@dimen/platform_dp_8"
android:paddingEnd="@dimen/platform_dp_8"
>
</TextView>
<RelativeLayout
......@@ -58,55 +52,35 @@
android:layout_height="120dp"
android:layout_centerInParent="true"
android:scaleType="centerCrop"
android:src="@drawable/audioim_head_place_hold_pic" />
</RelativeLayout>
android:src="@drawable/audioim_head_place_hold_pic"
/>
<TextView
android:id="@+id/tv_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/rl_head"
android:layout_below="@+id/iv_head"
android:layout_centerHorizontal="true"
android:layout_marginTop="-20dp"
android:layout_marginTop="@dimen/platform_dp_12"
android:textColor="@color/white"
android:textSize="26sp"
android:textSize="22sp"
tools:text="留意" />
<TextView
android:id="@+id/tv_tips"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_name"
android:layout_centerHorizontal="true"
android:layout_marginLeft="25dp"
android:layout_marginTop="6dp"
android:layout_marginRight="25dp"
android:ellipsize="end"
android:gravity="center"
android:maxLines="2"
android:textColor="@color/white"
android:textSize="15sp"
tools:text="你存在的本身就是值得被爱的你存在的本身就是值得被爱的" />
</RelativeLayout>
<!-- 倾诉剩余时间-->
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/rl_remain_time"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/rl_hang_up"
android:layout_marginBottom="20dp"
android:layout_below="@+id/rl_head"
android:visibility="gone"
tools:visibility="visible">
<TextView
android:id="@+id/tv_notes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="剩余时长"
android:text="已通话时长"
android:textColor="@color/white"
android:textSize="15dp"
android:textSize="18sp"
app:layout_constraintEnd_toStartOf="@+id/tv_remain_time"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toStartOf="parent"
......@@ -120,7 +94,7 @@
android:layout_toRightOf="@+id/tv_notes"
android:text="23:23"
android:textColor="@color/white"
android:textSize="16dp"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/tv_notes"
app:layout_constraintTop_toTopOf="parent" />
......@@ -129,20 +103,39 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_notes"
android:layout_marginTop="2dp"
android:text="(限24小时内拨打)"
android:textColor="#80FFFFFF"
android:textSize="15dp"
android:layout_marginTop="4dp"
android:text="(满25分钟自动挂断,限24小时内拨打)"
android:textColor="#60ffffff"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_remain_time" />
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:id="@+id/tv_tips"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/rl_remain_time"
android:layout_centerHorizontal="true"
android:layout_marginLeft="25dp"
android:layout_marginTop="@dimen/platform_dp_10"
android:layout_marginRight="25dp"
android:ellipsize="end"
android:gravity="center"
android:maxLines="2"
android:textColor="@color/white"
android:textSize="15sp"
tools:text="你存在的本身就是值得被爱的你存在的本身就是值得被爱的" />
<TextView
android:id="@+id/tv_change_doctor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/rl_hang_up"
android:layout_above="@id/ll_three_icon"
android:layout_centerHorizontal="true"
android:layout_marginBottom="48dp"
android:gravity="center"
......@@ -154,7 +147,7 @@
android:id="@+id/tv_waiting"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/rl_hang_up"
android:layout_above="@+id/ll_three_icon"
android:layout_centerHorizontal="true"
android:layout_marginBottom="50dp"
android:text="正在等待聆听者接受邀请…"
......@@ -162,24 +155,82 @@
android:textSize="12sp"
android:visibility="visible"
tools:visibility="gone" />
<!--挂断按钮-->
<RelativeLayout
android:id="@+id/rl_hang_up"
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_above="@id/ll_three_icon"
android:gravity="center"
android:orientation="vertical"
android:id="@+id/ll_changeRoute"
android:layout_marginBottom="@dimen/platform_dp_88"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/iv_change_route"
android:id="@+id/iv_change_route"
>
</ImageView>
<TextView
android:id="@+id/tv_change_time_counter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/tv_change_route"
android:layout_toLeftOf="@+id/tv_change_route"
android:textColor="#60ffffff"
android:textSize="15dp"
tools:text="转传统电话(60s)" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_three_icon"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginLeft="72dp"
android:layout_marginBottom="18dp">
android:layout_marginBottom="@dimen/platform_dp_18"
android:orientation="horizontal">
<!--静音按钮-->
<LinearLayout
android:id="@+id/rl_mute_on_off"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center"
>
<ImageView
android:id="@+id/iv_mute_on_off"
android:layout_width="66dp"
android:layout_height="66dp"
android:layout_marginTop="1dp"
android:src="@drawable/audiohome_muteon"
android:visibility="visible" />
<com.ydl.ydlcommon.view.ProgressView
android:id="@+id/progress_view"
android:layout_width="70dp"
android:layout_height="70dp"
app:pa_progressBackColor="#45E6AB"
app:pa_progressWidth="4dp" />
<TextView
android:id="@+id/audio_mute_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="麦克风已开"
android:textColor="@color/white"
android:textSize="12sp" />
</LinearLayout>
<!--挂断按钮-->
<LinearLayout
android:id="@+id/rl_hang_up"
android:layout_width="0dp"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical"
android:layout_height="wrap_content">
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/iv_hang_up"
android:layout_width="66dp"
......@@ -188,46 +239,51 @@
android:layout_marginTop="1dp"
android:src="@drawable/audioim_img_hang_up_unuse"
android:visibility="visible" />
<com.ydl.ydlcommon.view.ProgressView
android:id="@+id/progress_view"
android:layout_width="70dp"
android:layout_height="70dp"
app:pa_progressBackColor="#45E6AB"
app:pa_progressWidth="4dp" />
</FrameLayout>
<TextView
android:id="@+id/audio_hangup_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/iv_hang_up"
android:layout_centerHorizontal="true"
android:layout_marginTop="8dp"
android:text="挂断"
android:id="@+id/audio_hangup_text"
android:textColor="@color/white"
android:textSize="12sp" />
</RelativeLayout>
</LinearLayout>
<!-- 免提按钮-->
<RelativeLayout
android:layout_width="wrap_content"
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginRight="72dp"
android:layout_marginBottom="18dp">
android:orientation="vertical"
android:gravity="center"
>
<ImageView
android:id="@+id/iv_hands_free"
android:layout_width="66dp"
android:layout_height="66dp"
android:layout_marginTop="1dp"
android:src="@drawable/audioim_img_hands_free_unuse" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/iv_hands_free"
android:layout_centerHorizontal="true"
android:layout_marginTop="8dp"
android:text="免提"
android:textColor="@color/white"
android:textSize="12sp" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
<!--自定义弹窗-->
<TextView
......
......@@ -50,6 +50,9 @@ android {
buildConfigField "String", "AGORA_APPID", '"3387e9b251f3491e9221a9877e8f7830"'
}
}
dataBinding {
enabled true
}
publishNonDefault true
productFlavors {
......@@ -75,9 +78,11 @@ dependencies {
implementation 'com.daimajia.androidanimations:library:2.3@aar'
api 'fr.tvbarthel.blurdialogfragment:lib:2.1.5'
api "com.alibaba:arouter-api:$arouter_api"
api 'com.tencent.tbs.tbssdk:sdk:43903'
// 注意此处的依赖方式:kotlin中使用和java中使用方式有不同
kapt "com.alibaba:arouter-compiler:$arouter_compiler"
implementation 'com.alibaba:fastjson:1.2.38'
implementation "com.ydl:jjdxm-ijkplayer:0.0.33"
api rootProject.ext.dependencies["ydl-user-router"]
implementation modularPublication('com.ydl:m-consultant-api')
......@@ -88,6 +93,7 @@ dependencies {
api project(':m-audioim')
api project(":ydl-pay")
api project(':ydl-webview')
api project(':ydl-utils')
implementation modularPublication('com.ydl:m-im-api')
implementation modularPublication('com.ydl:m-user-api')
implementation modularPublication('com.ydl:m-confide-api')
......
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ydl.confide" >
package="com.ydl.confide">
<application>
<activity android:name=".home.ConfideHomeActivity"
<activity
android:name=".home.ConfideHomeActivity"
android:screenOrientation="portrait"
android:theme="@style/confide_NoTitleTheme"
>
</activity>
android:theme="@style/confide_NoTitleTheme"/>
<activity
android:name=".intro.ExpertIntroActivity"
android:screenOrientation="portrait" />
</application>
</manifest>
package com.ydl.confide.home
import android.annotation.SuppressLint
import android.app.Dialog
import android.net.Uri
import android.os.Bundle
import android.view.Gravity
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.FrameLayout
import android.widget.TextView
import androidx.fragment.app.FragmentActivity
import com.alibaba.android.arouter.launcher.ARouter
import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import com.tencent.smtt.export.external.interfaces.JsResult
import com.tencent.smtt.sdk.ValueCallback
import com.tencent.smtt.sdk.WebChromeClient
import com.tencent.smtt.sdk.WebSettings
import com.tencent.smtt.sdk.WebView
import com.ydl.confide.R
import com.ydl.confide.home.http.ConfideHomeApi
import com.ydl.utils.WebUrlParamsUtils
import com.ydl.webview.ProgressWebView
import com.ydl.webview.TellData
import com.ydl.webview.WebModularServiceUtils
import com.ydl.ydlcommon.modular.findRouteService
import com.ydl.ydlcommon.utils.TimeUtil
import com.ydl.ydlnet.YDLHttpUtils
import com.yidianling.common.tools.RxImageTool
import com.yidianling.common.tools.ToastUtil
import com.yidianling.im.api.service.IImService
import com.yidianling.user.api.service.IUserService
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
companion object {
private const val KEY_JUMP_URL = "jumpUrl"
private const val KEY_DOCTOR_ID = "doctor_id"
private const val KEY_SHOULD_SHOW = "should_show"
}
lateinit var wv_content: ProgressWebView
lateinit var text_title: TextView
lateinit var line: View
lateinit var rl_title: View
lateinit var close_webview_Icon: View
lateinit var layoutCall: View
lateinit var layoutChange: View
lateinit var tvCall: TextView
lateinit var tvTime: TextView
lateinit var first_order: View
lateinit var confideProgress: View
lateinit var layout_change_text: View
lateinit var jumpUrl: String
lateinit var doctorId: String
var shouldShow: Boolean? = false
var uid:String?="0"
fun showBottomSheetDialog(
activity: FragmentActivity,
jumpUrl: String,
doctorId: String,
shouldShow: Boolean? = false
) {
arguments = Bundle().apply {
putString(KEY_JUMP_URL, jumpUrl)
putString(KEY_DOCTOR_ID, doctorId)
shouldShow?.let { putBoolean(KEY_SHOULD_SHOW, it) }
}
show(activity.supportFragmentManager, "confide_bottom_showdialog")
}
@SuppressLint("WrongConstant")
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setStyle(STYLE_NORMAL, R.style.AppBottomSheet)
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.confide_webview, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
jumpUrl = arguments?.getString(KEY_JUMP_URL) ?: ""
doctorId = arguments?.getString(KEY_DOCTOR_ID) ?: ""
shouldShow = arguments?.getBoolean(KEY_SHOULD_SHOW) ?: false
onLoadDialStatus(doctorId)
// +
wv_content = view.findViewById<ProgressWebView>(com.ydl.webview.R.id.wv_content)
close_webview_Icon = view.findViewById<View>(R.id.close_webview_Icon)
text_title = view.findViewById<TextView>(R.id.text_title)
line = view.findViewById<View>(R.id.line)
rl_title = view.findViewById<View>(R.id.rl_title)
close_webview_Icon?.setOnClickListener {
this.dismiss()
}
webViewInit(wv_content)
}
override fun setCancelable(cancelable: Boolean) {
val dialog = dialog
val touchOutsideView =
dialog?.window?.decorView?.findViewById<View>(com.google.android.material.R.id.touch_outside)
val bottomSheetView =
dialog?.window?.decorView?.findViewById<View>(com.google.android.material.R.id.design_bottom_sheet)
if (cancelable) {
touchOutsideView?.setOnClickListener(View.OnClickListener {
if (dialog.isShowing) {
dialog.cancel()
}
})
BottomSheetBehavior.from<View>(bottomSheetView!!).setHideable(true)
} else {
touchOutsideView?.setOnClickListener(null)
// if false 按返回键也无法取消
// dialog.setCancelable(false)
BottomSheetBehavior.from<View>(bottomSheetView!!).setHideable(false)
}
}
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
val dialog = super.onCreateDialog(savedInstanceState) as BottomSheetDialog
dialog.setOnShowListener {
val itemView =
LayoutInflater.from(context).inflate(R.layout.confide_bottom_two, null, false)
layoutCall = itemView.findViewById<View>(R.id.layoutCall)
layoutChange = itemView.findViewById<View>(R.id.layoutChange)
confideProgress = itemView.findViewById<View>(R.id.confide_progress)
layout_change_text = itemView.findViewById<View>(R.id.layout_change_text)
tvCall = itemView.findViewById<TextView>(R.id.tvCall)
tvTime = itemView.findViewById<TextView>(R.id.tvTime)
first_order = itemView.findViewById<TextView>(R.id.first_order)
val isLogin = findRouteService(IUserService::class.java)?.isLogin() ?: false
first_order.visibility = if (isLogin) View.GONE else View.VISIBLE
if (shouldShow == true) {
layoutChange.visibility = View.VISIBLE
} else {
layoutChange.visibility = View.GONE
}
layoutCall.setOnClickListener {
callJsFun(wv_content, "listenCallClick()")
}
layoutChange.setOnClickListener {
layout_change_text.visibility = View.GONE
confideProgress.visibility = View.VISIBLE
callJsFun(wv_content, "handleNext()")
}
val layoutParams = FrameLayout.LayoutParams(
FrameLayout.LayoutParams.WRAP_CONTENT,
FrameLayout.LayoutParams.WRAP_CONTENT
).apply { gravity = Gravity.BOTTOM or Gravity.CENTER_HORIZONTAL }
dialog?.window?.addContentView(itemView, layoutParams)
val bottomSheet =
(it as BottomSheetDialog).findViewById<View>(com.google.android.material.R.id.design_bottom_sheet) as FrameLayout?
val behavior = BottomSheetBehavior.from(bottomSheet!!)
behavior.peekHeight = RxImageTool.dp2px(600f)
//true是跳过peekHeight,直接滑下去,false是可以滑动到顶部还可以保持peekHeight在滑下去
// behavior?.skipCollapsed=true
behavior.addBottomSheetCallback(object : BottomSheetBehavior.BottomSheetCallback() {
override fun onStateChanged(bottomSheet: View, newState: Int) {
when (newState) {
3 -> {
rl_title.visibility = View.VISIBLE
close_webview_Icon.visibility = View.VISIBLE
text_title.visibility = View.VISIBLE
line.visibility = View.GONE
}
1 -> {
rl_title.visibility = View.VISIBLE
close_webview_Icon.visibility = View.GONE
text_title.visibility = View.GONE
line.visibility = View.VISIBLE
}
4 -> {
rl_title.visibility = View.VISIBLE
line.visibility = View.VISIBLE
}
}
}
override fun onSlide(bottomSheet: View, slideOffset: Float) {}
})
}
return dialog
}
private fun callJsFun(wv_content: ProgressWebView, funcName: String) {
val sb = StringBuffer("javascript:")
sb.append(funcName)
wv_content.post {
try {
wv_content.loadUrl(sb.toString())
} catch (e: Exception) {
e.printStackTrace()
}
}
}
fun updateChange(doctorId: String,title:String,uid: String){
this.uid=uid
text_title.text=title
confideProgress.visibility=View.GONE
layout_change_text.visibility=View.VISIBLE
onLoadDialStatus(doctorId)
callJsFun(wv_content,"setUnRead(${getUnReadByUid(uid =uid )})")
}
@SuppressLint("ClickableViewAccessibility")
private fun webViewInit(wv_content: ProgressWebView) {
val setting: WebSettings = wv_content?.settings!!
//支持js
//支持js
setting.setJavaScriptEnabled(true)
//设置字符编码
//设置字符编码
setting.setDefaultTextEncodingName("GBK")
setting.setDomStorageEnabled(true)
val appCachePath: String = context?.getCacheDir()?.getAbsolutePath().toString()
setting.setAppCachePath(appCachePath)
setting.setAllowFileAccessFromFileURLs(true)
setting.setAppCacheEnabled(true)
setting.setAllowFileAccess(true)
setting.setBlockNetworkImage(false)
wv_content!!.scrollBarStyle = View.SCROLLBARS_INSIDE_OVERLAY //滚动条风格,为0指滚动条不占用空间,直接覆盖在网页上
val jtoJHandle = WebModularServiceUtils.getWebService()
.getJavascripHandler(requireActivity(), tellData = TellData())
wv_content!!.addJavascriptInterface(jtoJHandle, "javascriptHandler")
// var jumpurl = "http://192.168.210.152/jy/listenMask?listenerId=257&isFromApp=1"
val url = WebUrlParamsUtils.getSuffix(jumpUrl, jtoJHandle.getUriAppendSuffix())
wv_content.loadUrl(url)
// wv_content.loadUrl(jumpUrl)
wv_content.setOnTouchListener { p0, p1 -> //canScrollVertically(-1)的值表示是否能向下滚动,false表示已经滚动到顶部
if (!wv_content.canScrollVertically(-1)) {
wv_content.requestDisallowInterceptTouchEvent(false);
} else {
wv_content.requestDisallowInterceptTouchEvent(true);
}
false;
}
wv_content.webChromeClient = object : WebChromeClient() {
override fun onJsAlert(
webView: WebView,
s: String,
s1: String,
jsResult: JsResult
): Boolean {
return super.onJsAlert(webView, s, s1, jsResult)
}
override fun onProgressChanged(view: WebView, newProgress: Int) {
if (newProgress == 100) {
wv_content.progressbar.visibility = View.GONE
callJsFun(wv_content,"setUnRead(${uid?.let { getUnReadByUid(uid = it) }})")
} else {
if (wv_content.progressbar.visibility == View.GONE) {
wv_content.progressbar.visibility = View.VISIBLE
}
wv_content.progressbar.progress = newProgress
}
super.onProgressChanged(view, newProgress)
}
override fun onReceivedTitle(view: WebView, title: String) {
super.onReceivedTitle(view, title)
text_title.text=title
}
// For Android < 3.0
fun openFileChooser(valueCallback: ValueCallback<Uri?>) {
}
// For Android >= 3.0
fun openFileChooser(valueCallback: ValueCallback<*>, acceptType: String?) {
}
//For Android >= 4.1
override fun openFileChooser(
valueCallback: ValueCallback<Uri>,
acceptType: String,
capture: String
) {
}
// For Android >= 5.0
override fun onShowFileChooser(
webView: WebView,
filePathCallback: ValueCallback<Array<Uri>>,
fileChooserParams: FileChooserParams
): Boolean {
return true
}
}
}
fun getUnReadByUid(uid:String):Int{
return ARouter.getInstance().navigation(IImService::class.java).getUnReadByUid(uid)
}
@SuppressLint("CheckResult")
private fun onLoadDialStatus(doctorId: String) {
val confideApi = YDLHttpUtils.obtainApi(ConfideHomeApi::class.java)
confideApi.getDialStatus(doctorId)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({ resp ->
if (resp.code == "200") {
layoutCall.visibility = View.VISIBLE
val lineStatus = resp.data?.confideLine ?: 2
/*
* 1在线 2离线 3通话中 4 继续倾诉
* */
when (lineStatus) {
1 -> {
tvCall.text = "立即拨打"
layoutCall.background =
context?.getDrawable(R.drawable.confide_line_bg_1)
}
2 -> {
tvCall.text = "已离线"
layoutCall.background =
context?.getDrawable(R.drawable.confide_line_bg_2)
}
3 -> {
tvCall.text = "通话中"
layoutCall.background =
context?.getDrawable(R.drawable.confide_line_bg_3)
}
4 -> {
tvCall.text = "继续倾诉"
layoutCall.background =
context?.getDrawable(R.drawable.confide_line_bg_1)
context?.getDrawable(R.drawable.confide_line_bg_1)
val t = resp?.data?.remainingTime?.remainingTime
if (t != null) {
tvTime.visibility = View.VISIBLE
val remain = TimeUtil.getElapseTimeForShow(t * 1000)
tvTime.text = "(剩余" + remain + ")"
}
}
}
} else {
if (!resp.msg.isNullOrEmpty()) {
ToastUtil.toastShort(resp.msg)
}
}
}, { throwable -> throwable.printStackTrace() })
}
}
\ No newline at end of file
......@@ -2,16 +2,21 @@ package com.ydl.confide.home
import android.annotation.SuppressLint
import android.content.Context
import android.graphics.Color
import android.os.Build
import android.os.Bundle
import android.view.View
import android.widget.LinearLayout
import androidx.recyclerview.widget.LinearLayoutManager
import android.view.WindowManager
import androidx.fragment.app.FragmentActivity
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.SimpleItemAnimator
import com.alibaba.android.arouter.facade.annotation.Route
import com.bumptech.glide.Glide
import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.jcodecraeer.xrecyclerview.ProgressStyle
import com.jcodecraeer.xrecyclerview.XRecyclerView
import com.ydl.confide.R
import com.ydl.confide.api.ConfideRoute
import com.ydl.confide.home.adapter.ConfideHomeAdapter
import com.ydl.confide.home.bean.ConfideHomeAllFiltersBean
import com.ydl.confide.home.bean.ConfideHomeBodyBean
......@@ -19,27 +24,32 @@ import com.ydl.confide.home.bean.ConfideHomeDataBean
import com.ydl.confide.home.bean.ConfideHomeFiterItemBean
import com.ydl.confide.home.config.IConfideHomeConfig
import com.ydl.confide.home.contract.IConfideHomeContract
import com.ydl.confide.home.event.ChangeAnotherExpertEvent
import com.ydl.confide.home.event.ConfideHomeEventImpl
import com.ydl.confide.home.event.IConfideHomeEvent
import com.ydl.confide.home.listener.ConfideHomeRecycleViewListener
import com.ydl.confide.home.listener.ConfideHomeRecyleSuspendListener
import com.ydl.confide.home.presenter.ConfideHomePresenterImpl
import com.ydl.confide.home.util.ConfideHomeUtils
import com.ydl.confide.home.widget.FilterItemDecoration
import com.ydl.confide.router.PhoneCallIn
import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity
import com.ydl.ydl_image.listener.YDLImageRecyclerOnScrollListener
import com.ydl.ydlcommon.base.config.HttpConfig
import com.ydl.ydlcommon.base.config.HttpConfig.Companion.H5_URL
import com.ydl.ydlcommon.base.config.HttpConfig.Companion.YDL_H5
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.modular.findRouteService
import com.ydl.ydlcommon.mvp.lce.BaseLceActivity
import com.ydl.ydlcommon.router.IYDLRouterConstant
import com.ydl.ydlcommon.utils.BuryPointUtils
import com.ydl.ydlcommon.utils.StatusBarUtils
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.utils.remind.ToastHelper
import com.ydl.ydlcommon.view.DrawableRightTextView
import com.ydl.ydlcommon.view.WrapContentLinearLayoutManager
import com.yidianling.common.tools.RxImageTool
import com.yidianling.consultant.api.IConsultantService
import com.yidianling.common.tools.ToastUtil
import com.yidianling.im.api.service.IImService
import de.greenrobot.event.EventBus
import kotlinx.android.synthetic.main.confide_home_activity.*
import kotlinx.android.synthetic.main.confide_title_bar.*
......@@ -88,7 +98,7 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
/**
* 页(从第二页开始)
*/
private var page: Int = 2
private var page: Int = 1
//筛选参数bean
private var allFiltersBean: ConfideHomeAllFiltersBean? = null
//用于置顶筛选模块监听
......@@ -98,7 +108,7 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
//是否有下一页(用于判断为你推荐条数,如果首页返回少于10条 那么就可以认为没有下一页了) 默认有下一页
private var hasMore = true
private var dp48 = 0
private lateinit var bottomSheetDialogFragment:ConfideBottomSheetDialogFragment
init {
//初始化参数
initParam()
......@@ -131,17 +141,24 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
*/
override fun onRefresh() {
//重置页
page = 2
page = 1
allFiltersBean!!.page = page
clearCacheData()
mPresenter.confideHomeRequest(true)
recommendList(page)
}
/**
* 上拉加载更多
*/
override fun onLoadMore() {
recommendList(page)
page++
recommendList(page + 1)
}
@SuppressLint("MissingSuperCall")
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
EventBus.getDefault().register(this)
}
override fun recommendList(page: Int) {
......@@ -172,6 +189,9 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
}
override fun initDataAndEvent() {
//来自首页倾诉红包入口
val isFromRed = intent.getBooleanExtra(IYDLRouterConstant.EXTRA_RED_PACKET,false)
isSplash = intent.getBooleanExtra("isSplash", false)
//初始化View
initView()
......@@ -181,26 +201,32 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
//显示加载中
// showProgressDialog()
//加载本地缓存
mPresenter.loadLocalData(this)
// mPresenter.loadLocalData(this)
rv_list.refresh()
initClick()
initQuickConsultDialog()
initStatus();
ModularServiceManager.provide(IConsultantService::class.java).showConfideListDialog(this)
ActionCountUtils.count("daoyi_advertisement_page|daoyi_advertisement_visit","17")
initStatusBar()
// ModularServiceManager.provide(IConsultantService::class.java).showConfideListDialog(this)
// ActionCountUtils.count("daoyi_advertisement_page|daoyi_advertisement_visit","17")
Glide.with(this)
.load(R.drawable.confide__free)
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
.into(confide_Free)
if (isFromRed){
ToastUtil.toastLong(this@ConfideHomeActivity,"红包已领取成功 可立即点击拨打")
}
}
/**
* 初始化状态栏位置
*/
private fun initStatus() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {//4.4以下不支持状态栏变色
StatusBarUtils.setTransparentForImageView(this, null)
val statusBarHeight = StatusBarUtils.getStatusBarHeight(this)
val lp1 = rl_confide_title_layout.layoutParams as LinearLayout.LayoutParams
lp1.height = (RxImageTool.dp2px(48f) + statusBarHeight)
rl_confide_title_layout.setPadding(0, statusBarHeight, 0, 0)
private fun initStatusBar() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
window?.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS)
window?.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
window?.statusBarColor = Color.WHITE
window?.decorView?.systemUiVisibility = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
}
}
......@@ -211,15 +237,29 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
rv_list.addOnScrollListener(object : RecyclerView.OnScrollListener() {
override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
super.onScrollStateChanged(recyclerView, newState)
val layoutManager: RecyclerView.LayoutManager = recyclerView?.layoutManager!!
val linearManager = layoutManager as LinearLayoutManager
if (linearManager is LinearLayoutManager) {
val firstItemPosition = linearManager.findFirstCompletelyVisibleItemPosition()
if (firstItemPosition > 3) {
if (newState==RecyclerView.SCROLL_STATE_IDLE){
quick_consult_card.visibility = View.VISIBLE
}else {
quick_consult_card.visibility = View.GONE
}
// val layoutManager: RecyclerView.LayoutManager = recyclerView?.layoutManager!!
// val linearManager = layoutManager as LinearLayoutManager
// if (linearManager is LinearLayoutManager) {
// val firstItemPosition = linearManager.findFirstCompletelyVisibleItemPosition()
// if (firstItemPosition > 3) {
// quick_consult_card.visibility = View.VISIBLE
// }else {
// quick_consult_card.visibility = View.GONE
// }
// }
}
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
super.onScrolled(recyclerView, dx, dy)
if (dy>=0){
//向上滚动恢复显示
quick_consult_card.visibility = View.VISIBLE
}else{
//向下滚动隐藏
quick_consult_card.visibility = View.GONE
}
}
})
......@@ -229,13 +269,16 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
* 初始化一键倾诉浮层的点击事件
*/
private fun initClick() {
quick_consult_btn.setOnClickListener {
quickConsultUrl?.let {
mConfideEvent?.categoryClick(quickConsultUrl)
quick_consult_card.setOnClickListener {
bottomSheetDialogFragment=ConfideBottomSheetDialogFragment()
bottomSheetDialogFragment.showBottomSheetDialog(this as FragmentActivity, HttpConfig.MH5_URL + ConfideRoute.h5ConfideIntro("0"),"0",true)
}
}
fun onEventMainThread(event: ChangeAnotherExpertEvent) {
bottomSheetDialogFragment.updateChange(event.doctorID,event.title,event.uid)
}
private fun initView() {
img_back.setOnClickListener {
finish()
......@@ -251,6 +294,15 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
val h5Paramsqing = H5Params(YDL_H5 + "confideOrderList", null)
NewH5Activity.start(this, h5Paramsqing)
}
findViewById<View>(R.id.img_customer)?.setOnClickListener {
val imService = findRouteService(IImService::class.java)
imService?.startP2PXiaoYi(this)
}
findViewById<View>(R.id.img_help)?.setOnClickListener {
val params = H5Params(H5_URL + "help/", "")
params.isShowMenu = true
NewH5Activity.start(this, params)
}
ll_bar_root.setOnClickListener {
}
......@@ -277,6 +329,7 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
if (null == mConfideAdapter) {
mConfideAdapter = ConfideHomeAdapter(ConfideHomeActivity@ this, mConfideEvent!!, this)
}
rv_list.addItemDecoration(FilterItemDecoration())
val layoutManager = WrapContentLinearLayoutManager(this, WrapContentLinearLayoutManager.VERTICAL, false)
rv_list.layoutManager = layoutManager
rv_list.setRefreshProgressStyle(ProgressStyle.BallSpinFadeLoader)
......@@ -292,9 +345,8 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
override fun confideHomeResponse(list: MutableList<ConfideHomeDataBean>) {
initParam()
hideError()
updateCacheData(list)
cacheList?.addAll(0, list)
updateAdapter()
updateQuickConsultUrl()
setSuspendListener()
v_filterView.refreshView()
}
......@@ -313,18 +365,6 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
}
/**
* 更新一键倾诉按钮url
*/
private fun updateQuickConsultUrl() {
//这边用try catch的原因是防止因为接口数据结构变化导致cacheList!![1].body!![1].linkUrl获取失败
quickConsultUrl = try {
cacheList!![1].body!![1].linkUrl
}catch (e: Exception) {
"https://h5.ydl.com/confideMatch"
}
}
/**
* 更新适配器数据
*/
private fun updateAdapter() {
......@@ -354,39 +394,11 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
}
/**
* 更新缓存数据
*/
private fun updateCacheData(list: List<ConfideHomeDataBean>) {
clearCacheData()
var soundBean: ConfideHomeDataBean? = null
for (index in 0 until list.size) {
//将听声寻人数据取出 最后加入
when {
//听声寻人
list[index].type == IConfideHomeConfig.TYPE_SOUND -> soundBean = list[index]
//为你推荐
list[index].type == IConfideHomeConfig.TYPE_RECOMMEND -> {
//如果为你推荐的数量大于等于10条 就认为有下一页
hasMore = null != list[index].body && list[index].body!!.size >= 10
list[index].recommendId = page
(cacheList as ArrayList).add(list[index])
}
//其他模块正常添加
else -> (cacheList as ArrayList).add(list[index])
}
}
//听声寻人 放在最后添加
if (null != soundBean) {
(cacheList as ArrayList).add(soundBean)
}
}
/**
* 根据筛选条件 更新为你推荐数据
*/
private fun updateCacheDataByRecommend(bean: ConfideHomeDataBean) {
//需要重置一下页码
page = 2
page = 1
if (null == cacheList) {
cacheList = ArrayList()
}
......@@ -533,6 +545,7 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
override fun onDestroy() {
super.onDestroy()
mConfideEvent!!.destoryPlayer()
EventBus.getDefault().unregister(this)
}
override fun onBackPressed() {
......
......@@ -4,12 +4,14 @@ import android.content.Context
import androidx.recyclerview.widget.RecyclerView
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.LinearLayoutManager
import com.ydl.confide.R
import com.ydl.confide.home.bean.ConfideHomeDataBean
import com.ydl.confide.home.config.IConfideHomeConfig
import com.ydl.confide.home.contract.IConfideHomeContract
import com.ydl.confide.home.event.IConfideHomeEvent
import com.ydl.confide.home.widget.*
import com.ydl.ydlcommon.utils.DisplayUtils
/**
* @author yuanwai
......@@ -73,17 +75,26 @@ class ConfideHomeAdapter(private val mContext: Context,
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
when (viewType) {
//banner
IConfideHomeConfig.TYPE_BANNER -> {
return BannerViewHolder(ConfideHomeBannerView(parent.context, confideHomeEvent))
}
// IConfideHomeConfig.TYPE_BANNER -> {
// return BannerViewHolder(ConfideHomeBannerView(parent.context, confideHomeEvent))
// }
//最近倾诉
IConfideHomeConfig.TYPE_RECENTLY_CONFIDED -> {
return ConsultViewHolder(ConfideHomeRecentView(parent.context, confideHomeEvent))
// return ConsultViewHolder(ConfideHomeRecentView(parent.context, confideHomeEvent))
val recyclerView = RecyclerView(parent.context)
recyclerView.layoutParams = ViewGroup.MarginLayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT
).apply {
leftMargin = DisplayUtils.dip2px(parent.context, 4F)
rightMargin = DisplayUtils.dip2px(parent.context, 4F)
}
//分类
IConfideHomeConfig.TYPE_CATEGORY -> {
return CategoryViewHolder(ConfideHomeCategoryView(parent.context, confideHomeEvent, confideHomeView))
return RecentConfideHolder(recyclerView)
}
//分类
// IConfideHomeConfig.TYPE_CATEGORY -> {
// return CategoryViewHolder(ConfideHomeCategoryView(parent.context, confideHomeEvent, confideHomeView))
// }
//筛选模块
IConfideHomeConfig.TYPE_RECOMMEND_FILTER -> {
return FilterViewHolder(ConfideHomeFilterView(parent.context, confideHomeView))
......@@ -92,6 +103,17 @@ class ConfideHomeAdapter(private val mContext: Context,
IConfideHomeConfig.TYPE_RECOMMEND -> {
return RecommendViewHolder(ConfideHomeRecommendView(confideHomeView, parent.context, confideHomeEvent))
}
IConfideHomeConfig.TYPE_VIDEO_SHOW -> {
val recyclerView = RecyclerView(parent.context)
recyclerView.layoutParams = ViewGroup.MarginLayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT
).apply {
leftMargin = DisplayUtils.dip2px(parent.context, 6F)
rightMargin = DisplayUtils.dip2px(parent.context, 6F)
}
return VideoShowHolder(recyclerView)
}
// //听声寻人
// IConfideHomeConfig.TYPE_SOUND -> {
//// return ConfideHomeListenAndFoundViewHolder(ConfideHomeListenAndFoundView(parent.context, confideHomeEvent))
......@@ -103,25 +125,35 @@ class ConfideHomeAdapter(private val mContext: Context,
}
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) =
if (holder is BannerViewHolder && null != holder.bannerView) {
/*if (holder is BannerViewHolder && null != holder.bannerView) {
//banner
holder.bannerView!!.initData(mListData!![position])
} else if (holder is CategoryViewHolder && null != holder.categoryView) {
//分类
holder.categoryView!!.initData(mListData!![position])
} else if (holder is FilterViewHolder && null != holder.filterView) {
} else */if (holder is FilterViewHolder && null != holder.filterView) {
mFilterViewHolder = holder
//筛选模块
holder.filterView.initData(mListData!![position])
} else if (holder is ConfideHomeListenAndFoundViewHolder) {
//听声寻人
// holder.confideHomeListenAndFoundView!!.initData(mListData!![position])
} else if (holder is ConsultViewHolder && null != holder.consultView) {
} else if (holder is RecentConfideHolder) {
//最近倾诉
holder.consultView!!.initData(mListData!![position])
holder.rv.layoutManager =
LinearLayoutManager(holder.itemView.context, RecyclerView.HORIZONTAL, false)
val recentBody = mListData!![position].body
val data = recentBody?.map { ItemVideoShowViewModel().mapOf(it) } ?: emptyList()
holder.rv.adapter = RecentConfideAdapter(data, confideHomeEvent)
// holder.consultView!!.initData(mListData!![position])
} else if (holder is RecommendViewHolder && null != mListData!![position] && null != mListData!![position].body && !mListData!![position].body!!.isEmpty()) {
//为你推荐
holder.confideHomeRecommendView.initData(mListData!![position].body!![0], position, mListData!![position].recommendId)
} else if (holder is VideoShowHolder) {
holder.rv.layoutManager =
LinearLayoutManager(holder.itemView.context, RecyclerView.HORIZONTAL, false)
val recentBody = mListData!![position].body
holder.rv.adapter = VideoShowAdapter(recentBody, confideHomeEvent)
} else if (holder is EmptyViewHolder) {
} else {
......@@ -184,4 +216,6 @@ class ConfideHomeAdapter(private val mContext: Context,
view = itemView
}
}
class VideoShowHolder(val rv: RecyclerView) : RecyclerView.ViewHolder(rv)
class RecentConfideHolder(val rv: RecyclerView) : RecyclerView.ViewHolder(rv)
}
\ No newline at end of file
package com.ydl.confide.home.adapter
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.databinding.DataBindingUtil
import androidx.databinding.ObservableField
import androidx.databinding.ObservableInt
import androidx.recyclerview.widget.RecyclerView
import com.ydl.confide.R
import com.ydl.confide.api.ConfideRoute
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.base.config.HttpConfig
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 { 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 { event.consultantClick(itemVideoShowViewModel.linkUrl,itemVideoShowViewModel.doctorId) }
}
override fun getItemCount() = data.size
}
class ItemVideoShowViewModel {
var linkUrl: String? = null
val name = ObservableField<String>("")
val coverUrl = ObservableField<String>("")
val videoCoverUrl = ObservableField<String>("")
val state = ObservableInt()
var doctorId: String? = null
}
internal fun ItemVideoShowViewModel.mapOf(bean: ConfideHomeBodyBean): ItemVideoShowViewModel {
name.set(bean.confidedName)
coverUrl.set(bean.confidedIcon)
videoCoverUrl.set(bean.coverVideoPicture)
state.set(bean.confideLine ?: 0)
doctorId = bean.doctorId
doctorId?.let {
linkUrl = HttpConfig.MH5_URL + ConfideRoute.h5ConfideIntro(it)
}
return this
}
......@@ -39,7 +39,8 @@ data class ConfideHomeBodyBean(
//副标题(底部更多文案)
val subTitle : String?,
//咨询师标题
val confidedTitle:String?,
val confidedTitle: String?,
val title: String?,
//副标题点击事件
val subLinkUrl : String?,
//咨询师背景图片
......@@ -50,6 +51,9 @@ data class ConfideHomeBodyBean(
val couponMoney : String?,
//新用户优惠文案
val couponText : String?,
val videoUrl: String?,
val coverVideoPicture: String?,
val coverPicture: String?,
/**
* banner数据
*/
......@@ -115,5 +119,7 @@ data class ConfideHomeBodyBean(
//接通率
val confideConnection : String?,
//
var bodyData : List<ConfideHomeBodyBean>?
var bodyData : List<ConfideHomeBodyBean>?,
var confidePraiseScore:String?,//新增评分字段
var listenFree:Boolean?//新增倾诉免费标识字段
)
\ 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
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
)
\ 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,16 @@ class ConfideHomeEventImpl(context: Context, var confideHomeView: IConfideHomeCo
* 最佳倾诉榜单--点我倾诉
* @param linkUrl 跳转地址
*/
override fun consultantClick(linkUrl: String?) {
link(linkUrl)
override fun consultantClick(linkUrl: String?, doctorId: String?) {
ConfideBottomSheetDialogFragment()
.showBottomSheetDialog(mContext as FragmentActivity, HttpConfig.MH5_URL + ConfideRoute.h5ConfideIntro(doctorId.toString()), doctorId!!)
}
override fun videoShowClick(index: Int, data: List<ConfideHomeBodyBean>?) {
val dataJson = if (data != null) JSON.toJSONString(data) else null
pauseVoice()
route(mContext, ConfideRoute.R_VIDEO_SHOW, "initPos" to index, "initData" to dataJson)
}
/**
......@@ -154,10 +169,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 +231,6 @@ class ConfideHomeEventImpl(context: Context, var confideHomeView: IConfideHomeCo
//听声寻人
IConfideHomeConfig.TYPE_SOUND -> {
}
//咨询师推荐
IConfideHomeConfig.TYPE_CONSULTANT -> {
}
}
}
......
......@@ -73,7 +73,9 @@ interface IConfideHomeEvent {
* 咨询师推荐--点我倾诉
* @param linkUrl 跳转地址
*/
fun consultantClick(linkUrl: String?)
fun consultantClick(linkUrl: String?,doctorId: 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){
//已滚动到顶部
......
......@@ -5,20 +5,20 @@ 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.utils.YDLCacheUtils
import com.yidianling.common.tools.RxSPTool
import com.yidianling.common.tools.ToastUtil
/**
* Created by haorui on 2019-12-11 .
......@@ -116,5 +116,8 @@ class ConfdieServiceImpl : IConfideService {
}
override fun showExpertDetailDialog(activity: FragmentActivity, jumpUrl: String, doctorId: String) {
ConfideBottomSheetDialogFragment().showBottomSheetDialog(activity, jumpUrl, doctorId, false)
}
}
\ No newline at end of file
package com.ydl.confide.home.presenter
import android.content.Context
import android.text.TextUtils
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import com.ydl.confide.home.bean.ConfideHomeDataBean
import com.ydl.confide.home.contract.IConfideHomeContract
import com.ydl.confide.home.http.ConfideRecommendParam
import com.ydl.confide.home.model.ConfideHomeModelImpl
import com.ydl.confide.home.util.ConfideHomeUtils
import com.ydl.ydlcommon.data.http.RxUtils
import com.ydl.ydlcommon.data.http.ThrowableConsumer
import com.ydl.ydlcommon.mvp.base.BasePresenter
import com.ydl.ydlcommon.mvp.base.IView
import com.ydl.ydlcommon.utils.YDLAsyncUtils
import com.ydl.ydlcommon.utils.YDLCacheUtils
import com.yidianling.common.tools.RxNetTool
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.functions.Consumer
......@@ -26,54 +18,18 @@ import io.reactivex.functions.Consumer
* @Company 壹点灵
* @date 2018/8/10
*/
class ConfideHomePresenterImpl : BasePresenter<IConfideHomeContract.View,IConfideHomeContract.Model>(), IConfideHomeContract.Presenter{
class ConfideHomePresenterImpl : BasePresenter<IConfideHomeContract.View, IConfideHomeContract.Model>(),
IConfideHomeContract.Presenter {
override fun createModel(): IConfideHomeContract.Model {
return ConfideHomeModelImpl()
}
/**
* 加载本地缓存
*/
override fun loadLocalData(context: Context) {
YDLAsyncUtils.asyncAsResult(object : YDLAsyncUtils.AsyncObjecyerResult{
override fun doAsyncAction(): Any {
//读取缓存数据
var cacheData = YDLCacheUtils.getConfideHomeData()
if (cacheData.isEmpty()) {
cacheData = String(ConfideHomeUtils.getAssertsFile(context, "confide_home.json")!!)
}
return cacheData
}
override fun asyncResult(`object`: Any?) {
//如果没有缓存数据,显示加载框
if (`object` !is String || TextUtils.isEmpty(`object`)){
mView.showLoading()
}
if (`object` is String){
val gson = Gson()
val list = gson.fromJson<MutableList<ConfideHomeDataBean>>(`object`, object : TypeToken<MutableList<ConfideHomeDataBean>>() {
}.type)
if(null != list && !list.isEmpty()){
mView.confideHomeResponse(list)
}
}
confideHomeRequest(false)
}
})
}
/**
* 请求首页数据
*/
override fun confideHomeRequest(isRefresh:Boolean) {
if (!RxNetTool.isConnected(mView.getContext())){
override fun confideHomeRequest(isRefresh: Boolean) {
if (!RxNetTool.isConnected(mView.getContext())) {
mView.confideHomeRequestFail()
return
}
......@@ -84,7 +40,6 @@ class ConfideHomePresenterImpl : BasePresenter<IConfideHomeContract.View,IConfid
.doFinally { mView.hideLoading() }
.subscribe(Consumer {
mView.confideHomeResponse(it)
updateCache(it)
}, object : ThrowableConsumer() {
override fun accept(msg: String) {
mView.confideHomeRequestFail()
......@@ -92,34 +47,11 @@ class ConfideHomePresenterImpl : BasePresenter<IConfideHomeContract.View,IConfid
})
}
private fun testHome(){
var json = "[{\"type\":1,\"body\":[{\"bannerId\":\"23434\",\"bannerImageUrl\":\"https://img.ydlcdn.com/file/2018/09/18/335fb32fd39131f9159578bcc5a62863.jpg\",\"bannerTitle\":\"banner标题\",\"bannerLinkUrl\":\"app:qingsu/home?id=123\"},{\"bannerId\":\"23434\",\"bannerImageUrl\":\"https://img.ydlcdn.com/file/2018/09/18/335fb32fd39131f9159578bcc5a62863.jpg\",\"bannerLinkUrl\":\"app:qingsu/home?id=123\"}],\"diviLine\":0},{\"type\":2,\"body\":[{\"confidedId\":\"123\",\"confidedName\":\"黄蓉\",\"confideSex\":0,\"confideContent\":\"对你留言:没有人一出生就是完美的,只有不断地相信自己才能成就自己的梦\",\"confidedIcon\":\"https://img.ydlcdn.com/file/2018/03/15/p5hmpru0n0dt5331.png\",\"confideLine\":0,\"confideHearNum\":\"已聆听2882次\",\"confideHistory\":\"7月13日 你向TA倾诉过\",\"confideVoice\":\"http://ssssssssssssssssss\"}],\"head\":{\"title\":\"最近倾诉\"},\"diviLine\":1},{\"type\":3,\"body\":[{\"categoryId\":\"123\",\"categoryType\":1,\"categoryName\":\"倾诉指南\",\"categoryContent\":\"排忧疏导,隐私安全\",\"categoryIcon\":\"https://img.ydlcdn.com/file/2018/08/15/2d04ef1c734b3bed59b33bb73fed81db.png\",\"linkUrl\":\"ydl-user://h5/h5?url=http://www.yidianling.com\"},{\"categoryId\":\"123\",\"categoryType\":2,\"categoryName\":\"专业师资\",\"categoryContent\":\"1182人倾诉心事\",\"categoryIcon\":\"https://img.ydlcdn.com/file/2018/08/15/2d04ef1c734b3bed59b33bb73fed81db.png\"}],\"diviLine\":1},{\"type\":7,\"body\":[{\"confidedId\":\"123\",\"confidedTitle\":\"情感恋爱\",\"confideNum\":\"8513人\",\"confideBgUrl\":\"https://img.ydlcdn.com/file/2018/08/11/m8ueotgn50hgxaa2.png\",\"confidedName\":\"黄蓉\",\"confideSex\":0,\"confideContent\":\"没有人出生就是完美的,只有不断地相信自己才能成就自己的梦想\",\"confidedIcon\":\"https://img.ydlcdn.com/file/2018/03/15/p5hmpru0n0dt5331.png\",\"confideLine\":1,\"confideConnection\":\"98%\",\"confideHearNum\":\"已聆听2882次\",\"confidedTag\":[\"80后\",\"婚姻家庭\",\"情感导师\",\"职场发展\"]},{\"confidedId\":\"123\",\"confidedTitle\":\"情感恋爱\",\"confideNum\":\"8513人\",\"confideBgUrl\":\"https://img.ydlcdn.com/file/2018/08/11/m8ueotgn50hgxaa2.png\",\"confidedName\":\"黄蓉\",\"confideSex\":0,\"confideContent\":\"没有人出生就是完美的,只有不断地相信自己才能成就自己的梦想\",\"confidedIcon\":\"https://img.ydlcdn.com/file/2018/03/15/p5hmpru0n0dt5331.png\",\"confideLine\":2,\"confideConnection\":\"100%\",\"confideHearNum\":\"已聆听2882次\",\"confidedTag\":[\"80后\",\"婚姻家庭\",\"情感导师\",\"职场发展\"]},{\"confidedId\":\"123\",\"confidedTitle\":\"情感恋爱\",\"confideNum\":\"8513人\",\"confideBgUrl\":\"https://img.ydlcdn.com/file/2018/08/11/m8ueotgn50hgxaa2.png\",\"confidedName\":\"黄蓉\",\"confideSex\":0,\"confideContent\":\"没有人出生就是完美的,只有不断地相信自己才能成就自己的梦想\",\"confidedIcon\":\"https://img.ydlcdn.com/file/2018/03/15/p5hmpru0n0dt5331.png\",\"confideLine\":3,\"confideConnection\":\"88%\",\"confideHearNum\":\"已聆听2882次\",\"confidedTag\":[\"80后\",\"婚姻家庭\",\"情感导师\",\"职场发展\"]}],\"head\":{\"title\":\"最佳倾诉榜单\"},\"diviLine\":1},{\"type\":4,\"body\":[{\"filterId\":\"123\",\"filterName\":\"综合排序\",\"filterType\":1,\"sortData\":[{\"id\":1,\"name\":\"综合排序\"},{\"id\":2,\"name\":\"人气从高到低\"},{\"id\":3,\"name\":\"时间从新到旧\"}]},{\"filterId\":\"456\",\"filterName\":\"性别年龄\",\"filterType\":2,\"sexTitle\":\"性别筛选\",\"sexData\":[{\"id\":1,\"name\":\"只看男生\"},{\"id\":2,\"name\":\"只看女生\"}],\"ageTitle\":\"年龄筛选\",\"ageData\":[{\"id\":1,\"name\":\"60后\"},{\"id\":2,\"name\":\"70后\"},{\"id\":3,\"name\":\"80后\"},{\"id\":4,\"name\":\"90后\"}]},{\"filterId\":\"789\",\"filterName\":\"擅长方向\",\"filterType\":3,\"goodTitle\":\"擅长方向\",\"goodData\":[{\"id\":1,\"name\":\"情感问题\"},{\"id\":2,\"name\":\"婚姻家庭\"},{\"id\":3,\"name\":\"情绪压力\"},{\"id\":4,\"name\":\"亲子教育\"}]}],\"diviLine\":1},{\"type\":5,\"body\":[{\"confidedId\":\"123\",\"confidedName\":\"黄蓉\",\"confideSex\":0,\"confideNum\":\"8513人\",\"confideContent\":\"没有人出生就是完美的,只有不断地相信自己才能成就自己的梦想\",\"confidedTag\":[\"80后\",\"婚姻家庭\",\"情感导师\",\"职场发展\"],\"confidedIcon\":\"https://img.ydlcdn.com/file/2018/03/15/p5hmpru0n0dt5331.png\",\"confideLine\":1,\"confideVoice\":\"http://ssssssssssssssssss\",\"confideConnection\":\"100%\"},{\"confidedId\":\"123\",\"confidedName\":\"黄蓉\",\"confideSex\":0,\"confideNum\":\"8513人\",\"confideContent\":\"没有人出生就是完美的,只有不断地相信自己才能成就自己的梦想\",\"confidedTag\":[\"80后\",\"婚姻家庭\",\"情感导师\",\"职场发展\"],\"confidedIcon\":\"https://img.ydlcdn.com/file/2018/03/15/p5hmpru0n0dt5331.png\",\"confideLine\":2,\"confideVoice\":\"http://ssssssssssssssssss\",\"confideConnection\":\"100%\"},{\"confidedId\":\"123\",\"confidedName\":\"黄蓉\",\"confideSex\":0,\"confideNum\":\"8513人\",\"confideContent\":\"没有人出生就是完美的,只有不断地相信自己才能成就自己的梦想\",\"confidedTag\":[\"80后\",\"婚姻家庭\",\"情感导师\",\"职场发展\"],\"confidedIcon\":\"https://img.ydlcdn.com/file/2018/03/15/p5hmpru0n0dt5331.png\",\"confideLine\":3,\"confideVoice\":\"http://ssssssssssssssssss\",\"confideConnection\":\"100%\"}],\"head\":{\"title\":\"为你推荐\"},\"diviLine\":1},{\"type\":6,\"body\":[{\"confidedId\":\"123\",\"confidedName\":\"黄蓉\",\"confideSex\":0,\"confideNum\":\"8513人\",\"confideVoice\":\"http://ssssssssssssssssss\",\"confideConnection\":\"100%\",\"confideContent\":\"没有人出生就是完美的,只有不断地相信自己才能成就自己的梦想\",\"confidedIcon\":\"https://img.ydlcdn.com/file/2018/03/15/p5hmpru0n0dt5331.png\",\"confideLine\":1,\"confideHearNum\":\"已聆听2882次\"},{\"confidedId\":\"123\",\"confidedName\":\"海伦\",\"confideSex\":0,\"confideNum\":\"8513人\",\"confideVoice\":\"http://ssssssssssssssssss\",\"confideConnection\":\"100%\",\"confideContent\":\"没有人出生就是完美的,只有不断地相信自己才能成就自己的梦想\",\"confidedIcon\":\"https://img.ydlcdn.com/file/2018/03/15/p5hmpru0n0dt5331.png\",\"confideLine\":2,\"confideHearNum\":\"已聆听2882次\"},{\"confidedId\":\"123\",\"confidedName\":\"海伦\",\"confideSex\":0,\"confideNum\":\"8513人\",\"confideVoice\":\"http://ssssssssssssssssss\",\"confideConnection\":\"100%\",\"confideContent\":\"没有人出生就是完美的,只有不断地相信自己才能成就自己的梦想\",\"confidedIcon\":\"https://img.ydlcdn.com/file/2018/03/15/p5hmpru0n0dt5331.png\",\"confideLine\":3,\"confideHearNum\":\"已聆听2882次\"}],\"head\":{\"title\":\"听声寻人\",\"subTitle\":\"更多\"},\"diviLine\":1}]"
val gson = Gson()
val list = gson.fromJson<MutableList<ConfideHomeDataBean>>(json, object : TypeToken<MutableList<ConfideHomeDataBean>>() {
}.type)
updateCache(list)
mView.confideHomeResponse(list)
}
/**
* 更新本地缓存
*/
private fun updateCache(list : MutableList<ConfideHomeDataBean>){
YDLAsyncUtils.async(object : YDLAsyncUtils.AsyncObjecyer{
override fun doAsyncAction() {
var gson = Gson()
var json = gson.toJson(list)
YDLCacheUtils.saveConfideHomeData(json)
}
})
}
/**
* 为你推荐列表(筛选调用)
*/
override fun recommendList(param : ConfideRecommendParam) {
if (!RxNetTool.isConnected(mView.getContext())){
override fun recommendList(param: ConfideRecommendParam) {
if (!RxNetTool.isConnected(mView.getContext())) {
mView.showError1("网络不给力")
return
}
......@@ -141,7 +73,7 @@ class ConfideHomePresenterImpl : BasePresenter<IConfideHomeContract.View,IConfid
* 为你推荐列表(翻页时调用)
*/
override fun recommendListMore(param: ConfideRecommendParam) {
if (!RxNetTool.isConnected(mView.getContext())){
if (!RxNetTool.isConnected(mView.getContext())) {
mView.showError1("网络不给力")
return
}
......
package com.ydl.confide.home.util
import android.content.Context
import androidx.core.content.ContextCompat
import androidx.appcompat.widget.AppCompatTextView
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import android.text.TextUtils
import android.view.View
import android.view.animation.AnimationUtils
import android.view.animation.LinearInterpolator
import android.widget.ImageView
import androidx.appcompat.widget.AppCompatTextView
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.ydl.confide.R
import com.ydl.confide.home.adapter.ConfideHomeAdapter
import com.ydl.confide.home.bean.ConfideHomeAllFiltersBean
......@@ -84,32 +84,12 @@ class ConfideHomeUtils {
* 数据重组
*/
fun resetData(list: MutableList<ConfideHomeDataBean>, filterView: ConfideHomeFilterView, listScrollListener: ConfideHomeRecycleViewListener) {
val recommendList: MutableList<ConfideHomeDataBean> = ArrayList()
var soundDataBean: ConfideHomeDataBean? = null
for ((index, dataBean) in list.withIndex().reversed()) {
for ((index, dataBean) in list.withIndex()) {
//给隐藏的为你推荐筛选view赋值
if (dataBean.type == IConfideHomeConfig.TYPE_RECOMMEND_FILTER) {
listScrollListener.setFilterIndex(index)
filterView.initData(dataBean)
}
//拆分为你推荐数据
if (dataBean.type == IConfideHomeConfig.TYPE_RECOMMEND) {
//如果是为你推荐数据 则进行筛分
recommendList.addAll(getRecommendList(dataBean))
//移除当前 为你推荐数据
list.removeAt(index)
}
//移除听声寻人数据 放在最后
if (dataBean.type == IConfideHomeConfig.TYPE_SOUND) {
soundDataBean = ConfideHomeDataBean(dataBean.type, dataBean.body, dataBean.head, dataBean.footer, dataBean.recommendId, dataBean.diviLine)
list.removeAt(index)
}
}
//添加 拆分后的 为你推荐数据
list.addAll(recommendList)
//添加 听声寻人 数据
if (null != soundDataBean) {
list.add(soundDataBean)
}
}
......@@ -124,7 +104,7 @@ class ConfideHomeUtils {
for (bodyBean in dataBean.body) {
val bodyList: MutableList<ConfideHomeBodyBean> = ArrayList()
bodyList.add(bodyBean)
val recommendDataBean = ConfideHomeDataBean(dataBean.type, bodyList, dataBean.head, dataBean.footer, dataBean.recommendId, dataBean.diviLine)
val recommendDataBean = ConfideHomeDataBean(dataBean.type, bodyList, dataBean.head, dataBean.footer, dataBean.recommendId)
list.add(recommendDataBean)
}
return list
......@@ -174,12 +154,6 @@ class ConfideHomeUtils {
section.setData(resultBean)
mConfideAdapter?.addSection(section)
}
//最佳倾诉榜单 todo 产品说先隐藏掉
IConfideHomeConfig.TYPE_CONSULTANT -> {
// var section = ConfideHomeRecommendExpertSection(context,mConfideEvent)
// section.setData(resultBean)
// mConfideAdapter?.addSection(section)
}
//为你推荐筛选模块
IConfideHomeConfig.TYPE_RECOMMEND_FILTER -> {
var section = ConfideHomeFilterSection(context, view)
......@@ -254,10 +228,6 @@ class ConfideHomeUtils {
IConfideHomeConfig.TYPE_SOUND -> {
listenAndFoundData = resultBean
}
//最佳倾听榜单
IConfideHomeConfig.TYPE_CONSULTANT -> {
recommendExpertData = resultBean
}
}
}
......
package com.ydl.confide.home.util
import android.widget.TextView
import androidx.databinding.BindingAdapter
import com.ydl.confide.R
@BindingAdapter("confideLineText")
fun TextView.confideLineText(line: Int) {
when (line) {
1 -> {
text = "立即拨打"
}
2 -> {
text = "已离线"
}
3 -> {
text = "通话中"
}
4->{
text = "继续倾诉"
}
}
}
@BindingAdapter("confideLineRecentText")
fun TextView.confideLineRecentText(line: Int) {
when (line) {
1 -> {
text = "空闲"
setBackgroundResource(R.drawable.confide_bg_main_color)
}
2 -> {
text = "离线"
setBackgroundResource(R.drawable.confide_bg_color_666666)
}
3 -> {
text = "通话中"
setBackgroundResource(R.drawable.confide_bg_color_ff8f38)
}
else ->{
text = ""
background = null
}
}
}
\ No newline at end of file
......@@ -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)
}
}
}
......@@ -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.linkUrl,bodyBean.doctorId)
}
2 -> {
//跳转私聊 并发送自定义消息
......
......@@ -2,7 +2,6 @@ package com.ydl.confide.home.widget
import android.content.Context
import android.graphics.Color
import android.graphics.Paint
import android.text.TextUtils
import android.util.TypedValue
import android.view.Gravity
......@@ -11,14 +10,17 @@ import android.view.ViewGroup
import android.widget.FrameLayout
import android.widget.LinearLayout
import android.widget.TextView
import com.ydl.ydl_image.module.GlideApp
import com.yidianling.common.tools.RxImageTool
import com.blankj.utilcode.util.SpanUtils
import com.bumptech.glide.Glide
import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.ydl.confide.R
import com.ydl.confide.home.bean.ConfideHomeBodyBean
import com.ydl.confide.home.config.IConfideHomeConfig
import com.ydl.confide.home.contract.IConfideHomeContract
import com.ydl.confide.home.event.IConfideHomeEvent
import kotlinx.android.synthetic.main.confide_recommend_view.view.*
import com.ydl.ydl_image.module.GlideApp
import com.yidianling.common.tools.RxImageTool
import kotlinx.android.synthetic.main.confide_recommend_view_new.view.*
/**
* @author yuanwai
......@@ -41,7 +43,7 @@ class ConfideHomeRecommendView(var view: IConfideHomeContract.View, context: Con
private fun initView() {
var params = FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
layoutParams = params
View.inflate(context, R.layout.confide_recommend_view, this)
View.inflate(context, R.layout.confide_recommend_view_new, this)
dp96 = RxImageTool.dip2px(96f)
dp16 = RxImageTool.dip2px(16f)
dp4 = RxImageTool.dip2px(4f)
......@@ -63,25 +65,47 @@ class ConfideHomeRecommendView(var view: IConfideHomeContract.View, context: Con
//设置名称
tv_name.text = bodyBean.confidedName
//设置性别
setSex(bodyBean)
// setSex(bodyBean)
//设置向TA倾诉文案
setConfideNum(bodyBean)
//设置接通率文案
setConnection(bodyBean)
//设置价格
setPrice(bodyBean)
// setPrice(bodyBean)
//设置红包、原价
setCoupon(bodyBean)
// setCoupon(bodyBean)
//设置标签
setConfideTag(bodyBean)
//设置咨询师简介
tv_content.text = bodyBean.confideContent
//设置向TA倾诉按钮状态
setConfideButton(bodyBean)
setListenAndScore(bodyBean)
//设置页面点击事件
this.setOnClickListener {
confideHomeEvent.consultantClick(bodyBean.linkUrl)
confideHomeEvent.consultantClick(bodyBean.linkUrl,bodyBean.doctorId)
}
}
private fun setListenAndScore(bodyBean: ConfideHomeBodyBean) {
SpanUtils.with(price_content).append(bodyBean.confideFee.toString())
.setForegroundColor(resources.getColor(R.color.confide_fe6040)).setFontSize(18, true)
.append("元").setForegroundColor(resources.getColor(R.color.confide_fe6040))
.setFontSize(11, true)
.append("/25分钟").setForegroundColor(resources.getColor(R.color.confide_aaaeba))
.setFontSize(11, true)
.create()
tv_score.text = bodyBean.confidePraiseScore
if (bodyBean.listenFree == true) {
confide_free_logo.visibility = VISIBLE
Glide.with(context)
.load(R.drawable.confide__free)
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
.into(confide_free_logo)
} else {
confide_free_logo.visibility = GONE
}
}
......@@ -141,7 +165,7 @@ class ConfideHomeRecommendView(var view: IConfideHomeContract.View, context: Con
if (bodyBean.confideIsPlay!!) {
confideHomeEvent.pauseVoice()
} else {
confideHomeEvent.playVoice(IConfideHomeConfig.TYPE_RECOMMEND, position, recommendId, bodyBean.confideVoice, bodyBean.confidedName)
confideHomeEvent.playVoice(IConfideHomeConfig.TYPE_RECOMMEND, position, recommendId, bodyBean.confideVoice, bodyBean.confidedName,bodyBean.confidedIcon)
}
}
}
......@@ -149,13 +173,13 @@ class ConfideHomeRecommendView(var view: IConfideHomeContract.View, context: Con
/**
* 设置性别
*/
private fun setSex(bodyBean: ConfideHomeBodyBean) {
/*private fun setSex(bodyBean: ConfideHomeBodyBean) {
if (bodyBean.confideSex == 1) {
img_sex.setImageResource(R.drawable.confide_new_male)
} else {
img_sex.setImageResource(R.drawable.confide_new_female)
}
}
}*/
/**
* 设置向TA倾诉文案
......@@ -188,15 +212,15 @@ class ConfideHomeRecommendView(var view: IConfideHomeContract.View, context: Con
/**
* 设置价格
*/
private fun setPrice(bodyBean: ConfideHomeBodyBean) {
val sb = StringBuffer()
if (TextUtils.isEmpty(bodyBean.confideFee)) {
sb.append("0")
} else {
sb.append(bodyBean.confideFee)
}
tv_price.text = sb.toString()
}
// private fun setPrice(bodyBean: ConfideHomeBodyBean) {
// val sb = StringBuffer()
// if (TextUtils.isEmpty(bodyBean.confideFee)) {
// sb.append("0")
// } else {
// sb.append(bodyBean.confideFee)
// }
// tv_price.text = sb.toString()
// }
/**
* 设置标签 todo 待优化
......@@ -255,7 +279,7 @@ class ConfideHomeRecommendView(var view: IConfideHomeContract.View, context: Con
/**
* 设置红包、原价
*/
private fun setCoupon(bodyBean: ConfideHomeBodyBean) {
/*private fun setCoupon(bodyBean: ConfideHomeBodyBean) {
if (!TextUtils.isEmpty(bodyBean.couponText)) {
tvCoupon.text = bodyBean.couponText
tvCoupon.visibility = View.VISIBLE
......@@ -286,7 +310,7 @@ class ConfideHomeRecommendView(var view: IConfideHomeContract.View, context: Con
}
}
}
}*/
/**
* 点击事件
......@@ -299,7 +323,7 @@ class ConfideHomeRecommendView(var view: IConfideHomeContract.View, context: Con
if (bodyBean.confideLine == 3) {
}
confideHomeEvent.consultantClick(bodyBean.linkUrl)
confideHomeEvent.consultantClick(bodyBean.linkUrl,bodyBean.doctorId)
}
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
class FilterItemDecoration : RecyclerView.ItemDecoration() {
private val bounds = Rect()
private val paint = Paint().apply {
color = Color.parseColor("#EFEFF1")
strokeWidth = 1F
}
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() ?: false
val vms = beans.map {
VideoViewModel().mapOf(it).apply { showFreeTag.set(!isLogin) }
}
data.addAll(vms)
}
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.currentItem = initPos
}
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.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.utils.TimeUtil
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
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 var hasAgreePlayWithoutWiFi = false
private var curPos = 0
private var dispose: Disposable? = null
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
}
}
videoViews.put(adapterPosition, videoView)
holder.onAttach(videoView)
}
internal fun checkNetwork() {
if (!ConfideNetworkUtil.isWifi(context)) {
val dialog = CommonDialog.create(context)
.setTitle(context.getString(R.string.confide_tip))
.setMessage(context.getString(R.string.confide_video_wifi_tip))
.setLeftOnclick("继续播放") {
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("取消") {
if (context is Activity) {
context.onBackPressed()
}
}
.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()
}
@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 curUid = data[position].uid
if (curUid != null) {
dispose?.dispose()
dispose = confideApi.getDialStatus(curUid)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({ resp ->
if (resp.code == "200") {
val lineStatus = resp.data?.confideLine ?: 2
if (lineStatus == 4) {//继续倾诉
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
)
)
}
}
data[position].lineStatus.set(lineStatus)
} else {
if (!resp.msg.isNullOrEmpty()) {
ToastUtil.toastShort(resp.msg)
}
}
}, { throwable -> throwable.printStackTrace() })
}
}
}
\ No newline at end of file
package com.ydl.confide.intro
import android.app.Activity
import android.util.Log
import android.view.View
import android.widget.SeekBar
import androidx.databinding.ObservableBoolean
import androidx.databinding.ObservableField
import androidx.databinding.ObservableInt
import androidx.databinding.ViewDataBinding
import androidx.fragment.app.FragmentActivity
import androidx.recyclerview.widget.RecyclerView
import com.dou361.ijkplayer.widget.IjkVideoView
import com.ydl.confide.api.ConfideRoute
import com.ydl.confide.databinding.ItemExpertIntroBinding
import com.ydl.confide.home.ConfideBottomSheetDialogFragment
import com.ydl.confide.home.bean.ConfideHomeBodyBean
import com.ydl.ydlcommon.base.config.HttpConfig
import com.ydl.ydlcommon.modular.findRouteService
import com.ydl.ydlcommon.utils.LogUtil
import com.ydl.ydlcommon.view.dialog.YDLShareDialog
import com.yidianling.im.api.service.IImService
import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
import io.reactivex.schedulers.Schedulers
import tv.danmaku.ijk.media.player.IjkMediaPlayer
import java.net.URLEncoder
import java.util.concurrent.TimeUnit
internal class ItemIntroHolder(binding: ItemExpertIntroBinding) :
BindingViewHolder<ItemExpertIntroBinding>(binding) {
companion object {
private const val TAG = "ItemIntroHolder"
}
private var disposable: Disposable? = null
private var video: IjkVideoView? = null
private var vm: VideoViewModel? = null
@Volatile
private var isTouch = false
fun onDetach() {
stopTiming()
video?.release(true)
}
fun onBind(item: VideoViewModel) {
vm = item
binding.layoutCall.setOnClickListener {
showDoctorDetail(item)
}
binding.btnChat.setOnClickListener {
val aty = it.context as? Activity
if (aty != null && !item.uid.isNullOrEmpty()) {
findRouteService(IImService::class.java)?.startChat(aty, item.uid!!, 0, 0)
}
}
binding.btnEvaluate.setOnClickListener {
item.doctorId?.let {
ConfideBottomSheetDialogFragment()
.showBottomSheetDialog(
itemView.context as FragmentActivity,
HttpConfig.MH5_URL + ConfideRoute.h5ExpertEval(it),
it
)
}
}
binding.tvName.setOnClickListener {
showDoctorDetail(item)
}
binding.ivAvatar.setOnClickListener {
showDoctorDetail(item)
}
binding.vDisableClick.setOnClickListener { }
binding.btnShare.setOnClickListener {
val aty = it.context as? Activity
if (aty != null) {
var shareUrl = "${HttpConfig.MH5_URL}experts/${item.doctorId}"
if (!item.confideId.isNullOrBlank()) {
shareUrl += "?id=${item.confideId}"
}
val dialog = YDLShareDialog.style8(
aty, "${item.name.get()}_${item.title.get()}", shareUrl, "壹点灵心理服务平台让天下人更快乐", item.avatar.get(),
genMinProgramPath(shareUrl), "gh_25b90294ddcc"
)
dialog.show(aty.fragmentManager, "share")
}
}
binding.videoView.setOnClickListener {
if (video?.canPause() == true) {
video?.pause()
if (item.isVideo) {
binding.ivPlay.visibility = View.VISIBLE
} else {
binding.voicePlay.stop()
}
}
}
binding.ivPlay.setOnClickListener {
video?.start()
if (item.isVideo) {
binding.ivPlay.visibility = View.GONE
} else {
binding.voicePlay.start()
}
}
binding.voicePlay.setOnClickListener {
if (video?.isPlaying == true) {
video?.pause()
binding.voicePlay.stop()
} else if (video?.isPlaying == false) {
video?.start()
binding.voicePlay.start()
}
}
binding.seekbar.progress = 0
binding.seekbar.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
}
override fun onStartTrackingTouch(seekBar: SeekBar?) {
isTouch = true
}
override fun onStopTrackingTouch(seekBar: SeekBar?) {
isTouch = false
if (seekBar != null) {
video?.seekTo(seekBar.progress)
video?.start()
binding.ivPlay.visibility = View.GONE
}
}
})
binding.voicePlay.visibility =
if (item.isVideo) View.GONE else if (item.playUrl.isNullOrBlank()) View.GONE else View.VISIBLE
}
fun onAttach(videoView: IjkVideoView) {
this.video = videoView
binding.videoView.addView(videoView)
video?.setOnPreparedListener { player ->
Log.d(TAG, "${player.videoHeight},${player.videoWidth},${player.duration}")
val duration = player.duration.toInt()
if (duration > 0) {
binding.seekbar.max = duration
} else {
binding.seekbar.visibility = View.GONE
}
}
video?.setOnInfoListener { mp, what, extra ->
Log.d(TAG, "OnInfo:${what},${extra}")
return@setOnInfoListener true
}
video?.setOnCompletionListener {
video?.seekTo(0)
video?.start()
}
video?.setOnErrorListener { player, what, extra ->
LogUtil.e(TAG, "onError:$what,$extra")
return@setOnErrorListener true
}
startTiming()
if (vm?.isVideo == false && !vm?.playUrl.isNullOrBlank()) {
binding.voicePlay.start()
}
}
private fun startTiming() {
disposable = Observable.interval(3, TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(Schedulers.computation())
.subscribe {
val pos = (video?.mMediaPlayer as IjkMediaPlayer?)?.currentPosition ?: 0
if (pos > 0) {
if (vm?.isVideo == true) {
binding.ivCover.visibility = View.GONE
}
if (!isTouch) {
binding.seekbar.progress = pos.toInt()// video.bufferPercentage
}
if (video?.isPlaying == true) {
when (vm?.isVideo) {
true -> {
binding.ivPlay.visibility = View.GONE
}
false -> {
binding.voicePlay.start()
}
}
}
}
}
}
private fun stopTiming() {
disposable?.dispose()
}
private fun showDoctorDetail(item: VideoViewModel) {
if (!item.linkUrl.isNullOrBlank()) {
ConfideBottomSheetDialogFragment()
.showBottomSheetDialog(itemView.context as FragmentActivity, item.linkUrl!!, item.doctorId!!)
}
}
}
class VideoViewModel {
val name = ObservableField<String>("")
val title = ObservableField<String>("")
val avatar = ObservableField<String>("")
val count = ObservableField<String>("")
val lineStatus = ObservableInt()
var remainingTime = ObservableField<String>("")
val intro = ObservableField<String>("")
val tag = ObservableField<String>("")
var playUrl: String? = null
val coverUrl = ObservableField<String>("")
val showFreeTag = ObservableBoolean(false)
var isVideo = false
var uid: String? = null
var doctorId: String? = null
var confideId: String? = null
var linkUrl: String? = null
}
private fun genMinProgramPath(url: String): String {
val pathPrefix = "/pages/web/web?load_url="
val encode = URLEncoder.encode(url, "UTF-8")
return pathPrefix + encode
}
internal fun VideoViewModel.mapOf(bean: ConfideHomeBodyBean): VideoViewModel {
name.set(bean.confidedName)
avatar.set(bean.confidedIcon)
count.set("倾听人次 " + bean.confideNum)
intro.set(bean.confideContent)
title.set(bean.title)
val sb = StringBuilder()
bean.confidedTag?.forEach { sb.append(it).append(" | ") }
if (sb.isNotEmpty()) {
sb.setLength(sb.length - 3)
}
tag.set(sb.toString())
if (!bean.videoUrl.isNullOrEmpty()) {
playUrl = bean.videoUrl
isVideo = true
coverUrl.set(bean.coverVideoPicture)
} else {
playUrl = bean.confideVoice
isVideo = false
coverUrl.set(bean.coverPicture)
}
uid = bean.uid?.toString()
doctorId = bean.doctorId
confideId = bean.confidedId
doctorId?.let {
linkUrl = HttpConfig.MH5_URL + ConfideRoute.h5ExpertEval(it)
}
return this
}
open class BindingViewHolder<T : ViewDataBinding>(val binding: T) :
RecyclerView.ViewHolder(binding.root)
\ No newline at end of file
......@@ -5,6 +5,7 @@ import android.app.Application
import android.content.Context
import android.content.Intent
import androidx.fragment.app.DialogFragment
import androidx.fragment.app.FragmentActivity
import com.alibaba.android.arouter.facade.template.IProvider
interface IConfideService : IProvider {
......@@ -26,4 +27,10 @@ interface IConfideService : IProvider {
fun initYdlavManager(app: Application)
fun showAxbConfirmDialog(activity: Activity?, type: Int, phoneNumber: String?)
fun showExpertDetailDialog(
activity: FragmentActivity,
jumpUrl: String,
doctorId: String
)
}
\ No newline at end of file
package com.ydl.confide.api
object ConfideRoute {
const val R_VIDEO_SHOW = "confide/expert_video"
fun h5ConfideIntro(id: String) = "jy/listenMask?listenerId=${id}"
fun h5ExpertEval(id: String) = "comment/evaList/${id}?listenerId=${id}"
}
\ 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">
<corners android:bottomRightRadius="6dp"/>
<solid android:color="#90666666" />
<solid android:color="#BBC1CD" />
</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="#FF994B"/>
</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="#701da1f2" />
</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,7 +3,7 @@
android:shape="rectangle">
<corners
android:radius="4dp"/>
android:radius="8dp"/>
<solid android:color="#eaffffff"/>
......
......@@ -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" />
</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" />
</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" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="26dp" />
<gradient
android:endColor="#4BAFEC"
android:startColor="#65C4FF" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:pivotX="50%" android:pivotY="50%"
android:fromDegrees="0"
android:toDegrees="360">
<shape
android:shape="ring"
android:innerRadiusRatio="3"
android:thicknessRatio="8"
android:useLevel="false">
<gradient
android:type="sweep"
android:useLevel="false"
android:startColor="#ffffff"
android:centerColor="#ffffff"
android:centerY="0.50"
android:endColor="@color/transparent" />
</shape>
</animated-rotate>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:bottomRightRadius="3dp"/>
<solid android:color="@color/platform_main_theme" />
<solid android:color="#701da1f2" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<selector>
<item android:state_pressed="true">
<shape>
<corners android:radius="4dp" />
<solid android:color="#59FFFFFF" />
<stroke android:width="1dp" android:color="@color/transparent"/>
</shape>
</item>
<item>
<shape>
<corners android:radius="4dp" />
<solid android:color="#59FFFFFF" />
<stroke android:width="3dp" android:color="@color/transparent"/>
</shape>
</item>
</selector>
</item>
<item android:id="@android:id/secondaryProgress">
<clip>
<shape>
<corners android:radius="4dp" />
<solid android:color="@color/white" />
</shape>
</clip>
</item>
<item android:id="@android:id/progress">
<selector>
<item android:state_pressed="true">
<clip>
<shape>
<corners android:radius="4dp" />
<solid android:color="@color/white" />
<stroke android:width="1dp" android:color="@color/transparent"/>
</shape>
</clip>
</item>
<item>
<clip>
<shape>
<corners android:radius="4dp" />
<solid android:color="@color/white" />
<stroke android:width="3dp" android:color="@color/transparent"/>
</shape>
</clip>
</item>
</selector>
</item>
</layer-list>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape android:shape="rectangle">
<solid android:color="@color/white" />
<size android:width="6dp" android:height="8dp" />
<corners android:radius="2dp" />
</shape>
</item>
<item android:state_pressed="false">
<shape android:shape="oval">
<solid android:color="@color/white" />
<size android:width="8dp" android:height="8dp" />
<stroke android:width="2dp" android:color="@color/transparent" />
</shape>
</item>
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black">
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/viewPager"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/ivBack"
android:layout_width="44dp"
android:layout_height="44dp"
android:layout_marginLeft="12dp"
android:layout_marginTop="24dp"
android:padding="12dp"
android:src="@drawable/confide_back"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:shape="@{1}"
app:shapeBg="@{0x33000000}"
tools:ignore="ContentDescription" />
<TextView
android:id="@+id/tvConfideRecord"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="16dp"
android:drawableLeft="@drawable/ic_confide_record"
android:drawablePadding="4dp"
android:gravity="center"
android:padding="8dp"
android:paddingHorizontal="8dp"
android:paddingVertical="5dp"
android:text="倾诉记录"
android:textColor="@color/white"
android:textSize="13sp"
app:layout_constraintBottom_toBottomOf="@+id/ivBack"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@+id/ivBack"
app:shapeBg="@{0x26000000}"
app:shapeRadius="@{15}"
app:shapeStrokeWidth="@{1}"
app:shapeStrokeColor="@{0xFFFFFFFF}" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:tools="http://schemas.android.com/tools"
android:layout_marginStart="@dimen/platform_dp_15"
android:layout_marginEnd="@dimen/platform_dp_15"
android:background="@color/transparent"
android:gravity="center_horizontal"
android:orientation="horizontal">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/layoutCall"
android:layout_width="150dp"
android:layout_height="42dp"
android:layout_marginBottom="32dp"
android:background="@drawable/confide_line_bg_1"
android:visibility="gone"
tools:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/layoutChange"
>
<ImageView
android:id="@+id/ivCall"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginRight="4dp"
android:src="@drawable/ic_confide_call"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@+id/tvCall"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tvCall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="继续倾诉"
android:textColor="@color/white"
android:textSize="17sp"
app:layout_constraintBottom_toTopOf="@+id/tvTime"
app:layout_constraintLeft_toRightOf="@+id/ivCall"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<TextView
android:id="@+id/tvTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textColor="@color/white"
android:textSize="10sp"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="@+id/tvCall"
app:layout_constraintRight_toRightOf="@+id/tvCall"
app:layout_constraintTop_toBottomOf="@+id/tvCall"
tools:text="剩余1分40秒" />
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/bg_confide_free"
android:paddingLeft="5dp"
android:paddingTop="2dp"
android:paddingRight="5dp"
android:paddingBottom="2dp"
android:text="首单免费"
android:textColor="@color/white"
android:textSize="11sp"
android:id="@+id/first_order"
android:visibility="gone"
app:layout_constraintCircle="@+id/layoutCall"
app:layout_constraintCircleAngle="70"
app:layout_constraintCircleRadius="70dp" />
<LinearLayout
android:id="@+id/layoutChange"
android:layout_width="150dp"
android:layout_height="42dp"
android:layout_marginStart="@dimen/platform_dp_23"
android:layout_marginBottom="32dp"
android:visibility="gone"
tools:visibility="visible"
android:background="@drawable/confide_line_bg_change"
app:layout_constraintTop_toTopOf="@id/layoutCall"
app:layout_constraintLeft_toRightOf="@id/layoutCall"
app:layout_constraintRight_toRightOf="parent"
android:gravity="center"
android:paddingLeft="28dp"
android:paddingRight="28dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="再换一位"
android:id="@+id/layout_change_text"
android:textColor="@color/white"
android:textSize="17sp"
/>
<ProgressBar
android:layout_width="@dimen/platform_dp_20"
android:layout_height="@dimen/platform_dp_20"
android:id="@+id/confide_progress"
android:visibility="gone"
android:indeterminateDrawable="@drawable/confide_progress"
>
</ProgressBar>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
......@@ -15,47 +16,89 @@
<com.jcodecraeer.xrecyclerview.XRecyclerView
android:id="@+id/rv_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
android:layout_height="match_parent" />
<LinearLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/quick_consult_card"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginBottom="30dp"
android:background="@drawable/confide_card_consult_bg"
android:orientation="horizontal"
android:paddingLeft="@dimen/confide_dp_25"
android:paddingRight="@dimen/confide_dp_25"
android:visibility="gone">
android:paddingLeft="@dimen/platform_dp_8"
android:paddingRight="@dimen/platform_dp_8"
android:visibility="gone"
tools:visibility="visible">
<ImageView
android:id="@+id/confide_logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/confide_call_logo"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="@dimen/platform_dp_12"
android:layout_marginBottom="@dimen/platform_dp_12"
>
</ImageView>
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:gravity="center_vertical"
android:maxLines="1"
android:text="不知道选择哪位咨询师?试试"
android:textColor="@color/platform_color_242424"
android:textSize="14dp" />
android:text="智能推荐,一键倾诉"
android:textColor="@color/platform_color_333333"
android:textSize="14dp"
android:layout_marginStart="@dimen/platform_dp_8"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/confide_logo"
app:layout_constraintTop_toTopOf="parent" />
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginBottom="@dimen/platform_dp_12"
app:layout_constraintTop_toTopOf="@id/confide_logo"
app:layout_constraintBottom_toBottomOf="@id/confide_logo"
>
<TextView
android:id="@+id/quick_consult_btn"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:background="@drawable/confide_consult_btn_bg"
android:gravity="center"
android:paddingLeft="@dimen/confide_dp_20"
android:paddingRight="@dimen/confide_dp_20"
android:text="一键倾诉"
android:textColor="@color/platform_but_text_color"
android:textSize="14dp"
android:textStyle="bold" />
</LinearLayout>
android:paddingTop="@dimen/platform_dp_5"
android:paddingBottom="@dimen/platform_dp_5"
android:paddingLeft="@dimen/platform_dp_7"
android:paddingRight="@dimen/platform_dp_7"
android:text="我要倾诉"
android:layout_marginTop="@dimen/platform_dp_15"
android:textColor="@color/white"
android:textSize="13sp"
android:drawableRight="@drawable/confide_right_arrow"
/>
<ImageView
android:layout_width="@dimen/platform_dp_40"
android:layout_height="@dimen/confide_dp_25"
android:src="@drawable/confide__free"
android:layout_marginStart="@dimen/platform_dp_40"
android:id="@+id/confide_Free"
>
</ImageView>
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<View
android:id="@+id/v_zhezhao"
......@@ -63,26 +106,24 @@
android:layout_height="match_parent"
android:layout_marginTop="48dp"
android:background="#80000000"
android:visibility="gone"
/>
android:visibility="gone" />
<com.ydl.confide.home.widget.ConfideHomeFilterView
android:id="@+id/v_filterView"
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="@color/white"
android:visibility="gone"
/>
android:visibility="gone" />
<com.ydl.ydlcommon.mvp.lce.view.YDLStateView
android:visibility="gone"
android:id="@+id/lce_state_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/rv_list"
android:layout_alignTop="@+id/rv_list"
android:layout_alignRight="@+id/rv_list"
android:layout_alignBottom="@+id/rv_list" />
android:layout_alignBottom="@+id/rv_list"
android:visibility="gone" />
</RelativeLayout>
......
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:background="@color/white"
>
<androidx.cardview.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:cardElevation="0dp"
app:cardCornerRadius="6dp"
android:layout_marginTop="@dimen/platform_dp_15"
android:layout_marginStart="@dimen/platform_dp_15"
android:id="@+id/img_bg"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
>
<FrameLayout
android:layout_width="96dp"
android:layout_height="96dp">
<ImageView
android:id="@+id/img_head"
android:layout_width="96dp"
android:layout_height="96dp"
android:scaleType="fitXY"/>
<TextView
android:id="@+id/tv_isLine"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="9dp"
android:paddingRight="9dp"
android:paddingTop="1dp"
android:paddingBottom="1dp"
android:textSize="@dimen/confide_dp_10"
android:textColor="@color/white"
android:background="@drawable/confide_recommend_expert_line_bg"
tools:text="在线"/>
<ImageView
android:id="@+id/iv_play"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="bottom|right"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
tools:background="@drawable/confide_paused"/>
</FrameLayout>
</androidx.cardview.widget.CardView>
<TextView
android:id="@+id/tv_name"
app:layout_constraintStart_toEndOf="@id/img_bg"
app:layout_constraintTop_toTopOf="@id/img_bg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="14dp"
android:textSize="@dimen/platform_sp_16"
android:textColor="@color/platform_color_333333"
tools:text="姚雨晴"
/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/ll_confide_data"
app:layout_constraintTop_toBottomOf="@id/tv_name"
app:layout_constraintStart_toEndOf="@id/img_bg"
android:layout_marginStart="14dp"
android:orientation="horizontal"
>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center"
>
<TextView
android:id="@+id/tv_Connection"
android:layout_marginTop="@dimen/confide_dp_12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/platform_sp_14"
android:textColor="#ACADB1"
android:textStyle="bold"
tools:text="83%"
/>
<TextView
android:id="@+id/tv_ConnectionContent"
android:layout_marginTop="@dimen/platform_dp_3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/platform_sp_12"
android:textColor="#BCBCBC"
android:text="接通率" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center"
android:layout_marginStart="@dimen/confide_dp_25"
>
<TextView
android:id="@+id/tv_confideNum"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/platform_sp_14"
android:textColor="#ACADB1"
android:textStyle="bold"
android:layout_marginTop="12dp"
tools:text="8000人"
/>
<TextView
android:id="@+id/tv_tv_confideNumContent"
android:layout_marginTop="@dimen/platform_dp_3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/platform_sp_12"
android:textColor="#BCBCBC"
android:text="向TA倾诉"
/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center"
android:layout_marginStart="@dimen/confide_dp_25"
>
<TextView
android:id="@+id/tv_score"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/platform_sp_14"
android:textColor="#ACADB1"
android:textStyle="bold"
android:layout_marginTop="12dp"
tools:text="4.9"
/>
<TextView
android:id="@+id/tv_tv_ScoreContent"
android:layout_marginTop="@dimen/platform_dp_3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/platform_sp_12"
android:textColor="#BCBCBC"
android:text="评分"
/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/flowlayout_tag"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="16dp"
app:layout_constraintStart_toEndOf="@id/img_bg"
android:layout_marginStart="14dp"
app:layout_constraintBottom_toBottomOf="@id/img_bg"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="50元/25分钟"
android:id="@+id/price_content"
android:textSize="@dimen/platform_sp_12"
app:layout_constraintStart_toEndOf="@id/flowlayout_tag"
app:layout_constraintBottom_toBottomOf="@id/flowlayout_tag"
>
</TextView>
<TextView
android:id="@+id/tv_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="13sp"
android:textColor="#919190"
android:maxLines="2"
android:ellipsize="end"
app:layout_constraintTop_toBottomOf="@id/img_bg"
app:layout_constraintStart_toStartOf="@id/img_bg"
android:layout_marginTop="@dimen/platform_dp_15"
tools:text="没有人一出生就是完美的,只有不断的相信自...己…才能成就自己的梦想。"
/>
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
>
<TextView
android:id="@+id/tv_confide"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginTop="@dimen/platform_dp_15"
android:layout_marginEnd="@dimen/platform_dp_15"
android:gravity="center"
tools:background="@drawable/confide_line_1"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/confide_free_logo"
android:layout_marginTop="@dimen/platform_dp_5"
android:layout_marginStart="@dimen/platform_dp_8"
>
</ImageView>
</FrameLayout>
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
app:layout_constraintTop_toBottomOf="@id/tv_content"
android:layout_marginTop="@dimen/platform_dp_12"
android:layout_marginLeft="@dimen/confide_dp_15"
android:background="@color/confide_line"/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="horizontal"
android:id="@+id/rl_confide_title_layout"
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="@drawable/confide_common_bg"
android:id="@+id/rl_confide_title_layout"
>
android:background="@color/white"
android:orientation="horizontal">
<LinearLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/ll_bar_root"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="48dp">
android:layout_height="48dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/img_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="40dp"
android:layout_height="0dp"
android:layout_gravity="center_vertical"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:background="@drawable/confide_back"/>
android:scaleType="center"
android:src="@drawable/platform_common_back"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_title"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:text="@string/confide_title"
android:textColor="@color/black"
android:textSize="17dp"
android:textColor="#FFFFFF"
android:text="@string/confide_title"/>
<ImageView
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" />
<TextView
android:id="@+id/img_mine"
android:layout_width="wrap_content"
android:layout_width="40dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:drawableTop="@drawable/ic_action_confide_order"
android:drawablePadding="4dp"
android:gravity="center"
android:text="订单"
android:textColor="@color/_9"
android:textSize="7sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toLeftOf="@+id/img_customer"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/img_customer"
android:layout_width="40dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:drawableTop="@drawable/ic_action_confide_customer"
android:drawablePadding="4dp"
android:gravity="center"
android:text="客服"
android:textColor="@color/_9"
android:textSize="7sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toLeftOf="@+id/img_help"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/img_help"
android:layout_width="40dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:background="@drawable/confide_mine"/>
</LinearLayout>
android:drawableTop="@drawable/ic_action_confide_help"
android:drawablePadding="4dp"
android:gravity="center"
android:text="帮助"
android:textColor="@color/_9"
android:textSize="7sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="@+id/rl_title"
android:layout_marginLeft="@dimen/platform_dp_20"
android:layout_marginRight="@dimen/platform_dp_20"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/confide_close_icon"
android:id="@+id/close_webview_Icon"
android:visibility="gone"
android:layout_marginTop="@dimen/platform_dp_28"
android:layout_centerVertical="true"
>
</ImageView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:layout_centerInParent="true"
android:id="@+id/text_title"
android:visibility="gone"
>
</TextView>
<View
android:layout_width="@dimen/platform_dp_36"
android:layout_height="@dimen/platform_dp_6"
android:background="@drawable/confide_bottom_line"
android:id="@+id/line"
android:layout_marginTop="@dimen/platform_dp_12"
android:layout_centerInParent="true"
>
</View>
</RelativeLayout>
<com.ydl.webview.ProgressWebView
android:id="@+id/wv_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/rl_title"
/>
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<variable
name="item"
type="com.ydl.confide.home.adapter.ItemVideoShowViewModel" />
</data>
<androidx.cardview.widget.CardView
android:layout_width="52dp"
android:layout_height="52dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="10dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="10dp"
app:cardCornerRadius="6dp"
app:cardElevation="0dp">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:imageUrl="@{item.coverUrl}" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center"
android:layout_marginBottom="2dp"
android:maxLines="1"
android:text="@{item.name}"
android:textColor="@color/white"
android:textSize="10sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|left"
android:layout_marginBottom="2dp"
android:maxLines="1"
android:paddingLeft="4dp"
android:paddingTop="2dp"
android:paddingRight="4dp"
android:paddingBottom="2dp"
android:textColor="@color/white"
android:textSize="7sp"
app:confideLineRecentText="@{item.state}" />
</androidx.cardview.widget.CardView>
</layout>
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<data>
<import type="android.view.View" />
<import type="android.text.TextUtils" />
<variable
name="item"
type="com.ydl.confide.intro.VideoViewModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black">
<FrameLayout
android:id="@+id/videoView"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/ivCover"
android:layout_width="0dp"
android:layout_height="0dp"
app:imageUrl="@{item.coverUrl}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/ivPlay"
android:layout_width="76dp"
android:layout_height="76dp"
android:src="@drawable/ic_video_play"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.yidianling.common.view.ui.VoicePlayingIcon
android:id="@+id/voicePlay"
android:layout_width="76dp"
android:layout_height="76dp"
android:padding="24dp"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:shape="@{1}"
app:shapeBg="@{0x99000000}" />
<View
android:id="@+id/vDisableClick"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@+id/tvName"
tools:visibility="gone" />
<SeekBar
android:id="@+id/seekbar"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="23dp"
android:maxHeight="8dp"
android:paddingStart="0dp"
android:paddingEnd="0dp"
android:progressDrawable="@drawable/confide_seekbar_style"
android:splitTrack="false"
android:thumb="@drawable/confide_seekbar_thumb"
app:layout_constraintBottom_toTopOf="@+id/layoutCall"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/layoutCall"
android:layout_width="160dp"
android:layout_height="42dp"
android:layout_marginBottom="32dp"
android:background="@{item.lineStatus==3?@drawable/confide_line_bg_3:(item.lineStatus==2?@drawable/confide_line_bg_2:@drawable/confide_line_bg_1)}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
tools:background="@drawable/confide_line_bg_1">
<ImageView
android:id="@+id/ivCall"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginRight="4dp"
android:src="@drawable/ic_confide_call"
android:visibility="@{item.lineStatus==2?View.GONE:View.VISIBLE}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@+id/tvCall"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tvCall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/white"
android:textSize="16sp"
app:confideLineText="@{item.lineStatus}"
app:layout_constraintBottom_toTopOf="@+id/tvTime"
app:layout_constraintLeft_toRightOf="@+id/ivCall"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="通话中" />
<TextView
android:id="@+id/tvTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{item.remainingTime}"
android:textColor="@color/white"
android:textSize="10sp"
android:visibility="@{TextUtils.isEmpty(item.remainingTime)?View.GONE:View.VISIBLE}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="@+id/tvCall"
app:layout_constraintRight_toRightOf="@+id/tvCall"
app:layout_constraintTop_toBottomOf="@+id/tvCall"
tools:text="剩余1分40秒" />
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/bg_confide_free"
android:paddingLeft="5dp"
android:paddingTop="2dp"
android:paddingRight="5dp"
android:paddingBottom="2dp"
android:text="首单免费"
android:textColor="@color/white"
android:textSize="11sp"
android:visibility="@{item.showFreeTag?View.VISIBLE:View.GONE}"
app:layout_constraintCircle="@+id/layoutCall"
app:layout_constraintCircleAngle="70"
app:layout_constraintCircleRadius="70dp" />
<TextView
android:id="@+id/tvTag"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:layout_marginBottom="60dp"
android:text="@{item.tag}"
android:textColor="#99FFFFFF"
android:textSize="13sp"
app:layout_constraintBottom_toTopOf="@+id/layoutCall"
app:layout_constraintLeft_toLeftOf="parent"
tools:text="tag|tag|tag" />
<TextView
android:id="@+id/tvIntro"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="40dp"
android:layout_marginBottom="8dp"
android:text="@{item.intro}"
android:textColor="@color/white"
android:textSize="15sp"
app:layout_constraintBottom_toTopOf="@+id/tvTag"
app:layout_constraintLeft_toLeftOf="@+id/tvTag"
app:layout_constraintRight_toLeftOf="@+id/btnShare"
tools:text="tag|tag|tag" />
<TextView
android:id="@+id/tvName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:text="@{item.name}"
android:textColor="@color/white"
android:textSize="19sp"
app:layout_constraintBottom_toTopOf="@+id/tvIntro"
app:layout_constraintLeft_toLeftOf="@+id/tvTag"
tools:text="tag|tag|tag" />
<TextView
android:id="@+id/tvConfideCount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:text="@{item.count}"
android:textColor="@color/white"
android:textSize="13sp"
app:layout_constraintBottom_toBottomOf="@+id/tvName"
app:layout_constraintLeft_toRightOf="@+id/tvName"
tools:text="tag|tag|tag" />
<TextView
android:id="@+id/btnShare"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="18dp"
android:layout_marginBottom="56dp"
android:drawableTop="@drawable/ic_video_share"
android:drawablePadding="6dp"
android:gravity="center_horizontal"
android:text="分享"
android:textColor="@color/white"
android:textSize="11sp"
app:layout_constraintBottom_toTopOf="@+id/layoutCall"
app:layout_constraintRight_toRightOf="parent" />
<TextView
android:id="@+id/btnEvaluate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="18dp"
android:layout_marginBottom="20dp"
android:drawableTop="@drawable/ic_video_eval"
android:drawablePadding="6dp"
android:gravity="center_horizontal"
android:text="评价"
android:textColor="@color/white"
android:textSize="11sp"
app:layout_constraintBottom_toTopOf="@+id/btnShare"
app:layout_constraintRight_toRightOf="parent" />
<TextView
android:id="@+id/btnChat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="18dp"
android:layout_marginBottom="20dp"
android:drawableTop="@drawable/ic_video_chat"
android:drawablePadding="6dp"
android:gravity="center_horizontal"
android:text="私聊"
android:textColor="@color/white"
android:textSize="11sp"
app:layout_constraintBottom_toTopOf="@+id/btnEvaluate"
app:layout_constraintRight_toRightOf="parent" />
<ImageView
android:id="@+id/ivAvatar"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="20dp"
android:padding="1dp"
app:circle="@{true}"
app:imageUrl="@{item.avatar}"
app:layout_constraintBottom_toTopOf="@+id/btnChat"
app:layout_constraintRight_toRightOf="parent"
app:shape="@{1}"
app:shapeBg="@{0x00FFFFFF}"
app:shapeStrokeColor="@{0xFFFFFFFF}"
app:shapeStrokeWidth="@{1}" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<variable
name="item"
type="com.ydl.confide.home.adapter.ItemVideoShowViewModel" />
</data>
<androidx.cardview.widget.CardView
android:layout_width="180dp"
android:layout_height="140dp"
android:layout_marginLeft="6dp"
android:layout_marginTop="20dp"
android:layout_marginRight="6dp"
android:layout_marginBottom="10dp"
app:cardCornerRadius="8dp"
app:cardElevation="0dp">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
app:imageUrl="@{item.videoCoverUrl}" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|left"
android:layout_marginLeft="10dp"
android:layout_marginBottom="10dp"
android:text="@{item.name}"
android:textColor="@color/white"
android:textSize="15sp" />
<ImageView
android:layout_width="33dp"
android:layout_height="33dp"
android:layout_gravity="center"
android:src="@drawable/ic_video_play" />
</androidx.cardview.widget.CardView>
</layout>
......@@ -4,4 +4,8 @@
<color name="confide_line">#F0F0F0</color>
<color name="confide_filters_line">#E0E0E0</color>
<color name="confide_category_bg">#FAFAFA</color>
<color name="confide_61CEAC">#61CEAC</color>
<color name="confide_48CC95">#48CC95</color>
<color name="confide_fe6040">#fe6040</color>
<color name="confide_aaaeba">#aaaeba</color>
</resources>
<resources>
<string name="confide_title">即时倾诉</string>
<string name="confide_video_wifi_tip">当前处于非wifi环境下,播放会消耗流量,确定继续播放?</string>
<string name="confide_tip">提示</string>
<string name="confide_tip_remain_time">(剩余%s)</string>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="confide_NoTitleTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="android:windowActionBar">false</item>
......@@ -9,5 +10,22 @@
<item name="colorPrimaryDark">@color/platform_main_theme</item>
<item name="colorAccent">@color/platform_main_theme</item>
</style>
<style name="confide_dialog" parent="Theme.MaterialComponents.Light.BottomSheetDialog">
<!-- Customize your theme here. -->
</style>
<style name="CustomShapeAppearanceBottomSheetDialog" parent="Theme.MaterialComponents.Light.BottomSheetDialog">
<item name="cornerFamily">rounded</item>
<item name="cornerSizeTopRight">16dp</item>
<item name="cornerSizeTopLeft">16dp</item>
<item name="cornerSizeBottomRight">0dp</item>
<item name="cornerSizeBottomLeft">0dp</item>
<item name="background">@color/transparent</item>
</style>
<style name="AppBottomSheet" parent="Theme.Design.Light.BottomSheetDialog">
<item name="bottomSheetStyle">@style/AppBottomSheetStyle</item>
</style>
<style name="AppBottomSheetStyle" parent="Widget.Design.BottomSheet.Modal">
<item name="android:background">@drawable/confide_bottom_webview</item>
</style>
</resources>
\ No newline at end of file
......@@ -68,14 +68,9 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.fragment:fragment-ktx:1.2.4'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
api "com.airbnb.android:lottie:3.4.0"
implementation "com.alibaba:arouter-api:$arouter_api"
// 注意此处的依赖方式:kotlin中使用和java中使用方式有不同
kapt "com.alibaba:arouter-compiler:$arouter_compiler"
implementation rootProject.ext.dependencies["ydl-user-router"]
......@@ -87,6 +82,7 @@ dependencies {
implementation modularPublication('com.ydl:m-tests-api')
implementation modularPublication('com.ydl:m-home-api')
implementation modularPublication('com.ydl:m-im-api')
implementation modularPublication('com.ydl:m-confide-api')
implementation project(':ydl-webview')
implementation project(':ydl-media')
implementation project(":ydl-platform")
......@@ -98,6 +94,7 @@ dependencies {
compileOnly rootProject.ext.dependencies["ydl-m-home-api"]
compileOnly rootProject.ext.dependencies['ydl-m-tests-api']
compileOnly rootProject.ext.dependencies["ydl-m-im-api"]
compileOnly rootProject.ext.dependencies["ydl-m-confide-api"]
api (rootProject.ext.dependencies["ydl-platform"]) {
transitive = true
}
......
......@@ -7,8 +7,11 @@ import android.os.Bundle
import android.text.TextUtils
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.FragmentActivity
import androidx.recyclerview.widget.RecyclerView
import com.alibaba.android.arouter.launcher.ARouter
import com.ydl.confide.api.ConfideRoute
import com.ydl.confide.api.IConfideService
import com.ydl.media.audio.AudioPlayer
import com.ydl.media.audio.model.Music
import com.ydl.media.view.PlayTypeEnum
......@@ -23,7 +26,7 @@ import com.ydl.ydlcommon.base.config.HttpConfig
import com.ydl.ydlcommon.bean.ShareData
import com.ydl.ydlcommon.data.PlatformRamImpl
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.modular.ModularServiceManager.provide
import com.ydl.ydlcommon.modular.findRouteService
import com.ydl.ydlcommon.router.IYDLRouterConstant
import com.ydl.ydlcommon.utils.LogUtil
import com.ydl.ydlcommon.utils.Utils
......@@ -357,14 +360,12 @@ open class HomeBaseImpl : IHomeBaseEvent {
doctorId.toString()
)
if (linkUrl.startsWith("http")) {
YDLRouterManager.router(
IYDLRouterConstant.ROUTER_H5_H5,
YDLRouterParams().putExtra(IYDLRouterConstant.EXTRA_URL, linkUrl), ""
findRouteService(IConfideService::class.java)
?.showExpertDetailDialog(
mContext as FragmentActivity,
HttpConfig.MH5_URL + ConfideRoute.h5ConfideIntro(doctorId.toString()),
doctorId.toString()
)
} else {
YDLRouterManager.router(linkUrl)
}
}
/**
......
......@@ -467,7 +467,7 @@ public class SessionHelper {
NimUIKit.registerMsgItemViewHolder(CustomAttachPleaseSubscribeConsultDate.class, MsgViewHolderPleaseSubscribeConsultDate.class);//请预约咨询时间
NimUIKit.registerMsgItemViewHolder(CustomCustomerServiceCardAttachment.class, MsgViewHolderCustomerServiceCard.class);//客服小壹名片
NimUIKit.registerMsgItemViewHolder(CustomAttachmentShareMsg.class, MsgViewHolderShareMsg.class);//分享推送
NimUIKit.registerMsgItemViewHolder(CustomAttachConsultCallStatus.class, MsgViewHolderConsultCallStatus.class);//咨询声网的拨打状态
NimUIKit.registerMsgItemViewHolder(CustomAttachConsultCallStatus.class, MsgViewHolderConsultCallStatus.class);//咨询声网的拨打状态 32
NimUIKit.registerMsgItemViewHolder(CustomAttachAssistantReceivedMoney.class, MsgViewHolderAssistantReceivedMoney.class);
NimUIKit.registerMsgItemViewHolder(CustomAttachmentBusinessCard.class, MsgViewHolderBusinessCard.class);//专家自定义名片 ,TYPE=34
NimUIKit.registerMsgItemViewHolder(CustomAttachmentJumpToDaoYi.class, MsgViewHolderJumpToDaoYi.class);//跳转导医聊天窗口触发导医分配逻辑,TYPE=35
......
......@@ -15,7 +15,8 @@ import com.yidianling.uikit.business.session.viewholder.MsgViewHolderBase;
*/
public class MsgViewHolderConsultCallStatus extends MsgViewHolderBase {
private ImageView typeImage;
private ImageView typeImageLeft;
private ImageView typeImageRight;
private TextView statusLabel;
public MsgViewHolderConsultCallStatus(BaseMultiItemFetchLoadAdapter adapter) {
......@@ -29,7 +30,8 @@ public class MsgViewHolderConsultCallStatus extends MsgViewHolderBase {
@Override
protected void inflateContentView() {
typeImage = findViewById(R.id.type_img);
typeImageLeft = findViewById(R.id.type_img_left);
typeImageRight = findViewById(R.id.type_img_right);
statusLabel = findViewById(R.id.tv_state);
}
......@@ -43,20 +45,16 @@ public class MsgViewHolderConsultCallStatus extends MsgViewHolderBase {
private void layoutByDirection(CustomAttachConsultCallStatus customAttachTipMsg) {
if (isReceivedMessage()) {
typeImage.setImageResource(R.drawable.im_avchat_left_type_audio);
typeImageLeft.setVisibility(View.VISIBLE);
typeImageRight.setVisibility(View.GONE);
} else {
typeImage.setImageResource(R.drawable.im_avchat_right_type_audio);
typeImageLeft.setVisibility(View.GONE);
typeImageRight.setVisibility(View.VISIBLE);
}
if (TextUtils.equals("1", customAttachTipMsg.getStatus())) {
typeImage.setVisibility(View.VISIBLE);
if ("true".equals(customAttachTipMsg.getIsConsultOrder())) {
statusLabel.setText("通话接听时长 " + customAttachTipMsg.getDuration());
statusLabel.setText(customAttachTipMsg.getDuration());
} else {
statusLabel.setText("通话拨打时长 " + customAttachTipMsg.getDuration());
}
} else {
typeImage.setVisibility(View.GONE);
if (isReceivedMessage()) {
statusLabel.setText(customAttachTipMsg.getCallee());
} else {
......
......@@ -9,14 +9,15 @@
android:orientation="horizontal">
<ImageView
android:id="@+id/type_img"
android:id="@+id/type_img_left"
android:layout_width="14dp"
android:layout_height="14dp"
android:layout_gravity="center_vertical"
android:layout_marginLeft="3dp"
android:layout_marginRight="3dp"
android:contentDescription="@string/im_empty"
android:src="@drawable/im_avchat_left_type_audio"/>
android:visibility="gone"
android:src="@drawable/im_avchat_type_audio"/>
<TextView
android:id="@+id/tv_state"
......@@ -28,4 +29,15 @@
android:text="无人接听"
android:textColor="@color/platform_color_242424"
android:textSize="14sp"/>
<ImageView
android:visibility="gone"
android:id="@+id/type_img_right"
android:layout_width="14dp"
android:layout_height="14dp"
android:layout_gravity="center_vertical"
android:layout_marginLeft="3dp"
android:layout_marginRight="3dp"
android:contentDescription="@string/im_empty"
android:src="@drawable/im_avchat_type_audio"/>
</LinearLayout>
......@@ -3,6 +3,6 @@
<corners android:radius="10dp" />
<solid android:color="#99000000" />
<solid android:color="#60000000" />
</shape>
\ No newline at end of file
......@@ -20,13 +20,14 @@
android:layout_height="20dp"
android:layout_gravity="center"
android:layout_marginLeft="12.5dp"
android:layout_marginRight="@dimen/platform_dp_25"
android:padding="2.5dp"
android:src="@drawable/ico_play_float_pause"
android:visibility="visible" />
<ImageView
android:id="@+id/play_head"
android:layout_width="66dp"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginLeft="12.5dp"
android:src="@drawable/ico_play_float_pic" />
......@@ -35,7 +36,8 @@
android:id="@+id/rl_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="6dp"
android:layout_marginLeft="@dimen/platform_dp_18"
android:layout_marginRight="@dimen/platform_dp_18"
android:layout_weight="1">
<TextView
......
/*___Generated_by_IDEA___*/
package com.ydl.ydlcommon;
/* This stub is only used by the IDE. It is NOT the BuildConfig class actually packed into the APK */
public final class BuildConfig {
public final static boolean DEBUG = Boolean.parseBoolean(null);
}
\ No newline at end of file
/*___Generated_by_IDEA___*/
package com.ydl.ydlcommon;
/* This stub is only used by the IDE. It is NOT the Manifest class actually packed into the APK */
public final class Manifest {
}
\ No newline at end of file
/*___Generated_by_IDEA___*/
package com.ydl.ydlcommon;
/* This stub is only used by the IDE. It is NOT the R class actually packed into the APK */
public final class R {
}
\ No newline at end of file
package com.ydl.ydlcommon.modular
import android.content.Context
import android.os.Bundle
import android.os.Parcelable
import com.alibaba.android.arouter.facade.template.IProvider
import com.alibaba.android.arouter.launcher.ARouter
import com.ydl.ydlcommon.utils.LogUtil
......@@ -9,6 +12,59 @@ import com.ydl.ydlcommon.utils.LogUtil
* Created by haorui on 2019-09-21 .
* Des:查找 Arouter 服务封装类
*/
fun <T> findRouteService(clz: Class<T>): T? =
ARouter.getInstance().navigation(clz)
fun route(context: Context?, route: String, vararg params: Pair<String, Any?>) {
val build = ARouter.getInstance().build(route)
params.forEach {
when (val value = it.second) {
is Boolean -> {
build.withBoolean(it.first, value)
}
is Char -> {
build.withChar(it.first, value)
}
is Int -> {
build.withInt(it.first, value)
}
is Long -> {
build.withLong(it.first, value)
}
is Float -> {
build.withFloat(it.first, value)
}
is Double -> {
build.withDouble(it.first, value)
}
is Short -> {
build.withShort(it.first, value)
}
is Byte -> {
build.withByte(it.first, value)
}
is String -> {
build.withString(it.first, value)
}
is Bundle -> {
build.withBundle(it.first, value)
}
is CharSequence -> {
build.withCharSequence(it.first, value)
}
is Parcelable -> {
build.withParcelable(it.first, value)
}
}
}
if (context == null) {
build.navigation()
} else {
build.navigation(context)
}
}
object ModularServiceManager {
private val routerMap: HashMap<String, IProvider> = HashMap()
......
......@@ -77,6 +77,7 @@ interface IYDLRouterConstant{
const val EXTRA_CATETITLE = "cateTitle"
const val EXTRA_SHOWTYPE = "showType"
const val EXTRA_KEYWORD = "keyword"
const val EXTRA_RED_PACKET = "by_red_packet"
/**
* 冥想模块额外参数
......
......@@ -293,21 +293,21 @@ public class TimeUtil {
return retStr;
}
public static String getElapseTimeForShow(int milliseconds) {
public static String getElapseTimeForShow(long milliseconds) {
StringBuilder sb = new StringBuilder();
int seconds = milliseconds / 1000;
long seconds = milliseconds / 1000;
if (seconds < 1) {
seconds = 1;
}
int hour = seconds / (60 * 60);
long hour = seconds / (60 * 60);
if (hour != 0) {
sb.append(hour).append("小时");
}
int minute = (seconds - 60 * 60 * hour) / 60;
long minute = (seconds - 60 * 60 * hour) / 60;
if (minute != 0) {
sb.append(minute).append("分");
}
int second = (seconds - 60 * 60 * hour - 60 * minute);
long second = (seconds - 60 * 60 * hour - 60 * minute);
if (second != 0) {
sb.append(second).append("秒");
}
......
......@@ -42,7 +42,6 @@ class YDLShareDialog : DialogFragment {
//小程序页面地址
private var path: String? = null
//小程序id
private var minProgramId: String? = null
......@@ -51,13 +50,7 @@ class YDLShareDialog : DialogFragment {
private var llmargin = 0
@SuppressLint("ValidFragment")
constructor(
activity: Activity,
shareTitle: String?,
shareUrl: String?,
shareContent: String?,
shareHead: String?
) : super() {
constructor(activity: Activity, shareTitle: String?, shareUrl: String?, shareContent: String?, shareHead: String?) : super() {
this.mActivity = activity
this.shareTitle = shareTitle
this.shareUrl = shareUrl
......@@ -67,15 +60,7 @@ class YDLShareDialog : DialogFragment {
//传递小程序参数
@SuppressLint("ValidFragment")
constructor(
activity: Activity,
shareTitle: String?,
shareUrl: String?,
shareContent: String?,
shareHead: String?,
path: String?,
minProgramId: String?
) : super() {
constructor(activity: Activity, shareTitle: String?, shareUrl: String?, shareContent: String?, shareHead: String?, path: String?, minProgramId: String?) : super() {
this.mActivity = activity
this.shareTitle = shareTitle
this.shareUrl = shareUrl
......@@ -95,7 +80,6 @@ class YDLShareDialog : DialogFragment {
companion object {
var typeStyle: Int = 0
/**
* 1.为显示1排(5个) 2.为显示2排(隐藏动态和举报)3.为显示2排(隐藏动态和删除) 4.为显示1排(4个)隐藏动态按钮 5:生成海报按钮、隐藏动态 6:保存海报按钮、隐藏动态 7.为显示1排(4个)隐藏动态按钮
*/
......@@ -106,7 +90,7 @@ class YDLShareDialog : DialogFragment {
const val TYPE5 = 5
const val TYPE6 = 6
const val TYPE7 = 7
const val TYPE8 = 8
/**
* 点击事件类型 1.动态 2.删除 3.举报 4.返回首页 5:生成海报 6:保存本地 7:分享纯图片
*/
......@@ -118,122 +102,63 @@ class YDLShareDialog : DialogFragment {
const val CLICK_SAVE = 6
const val CLICK_SHARE_IMAGE = 7
fun style1(
activity: Activity,
shareTitle: String?,
shareUrl: String?,
shareContent: String?,
shareHead: String?
): YDLShareDialog {
fun style1(activity: Activity, shareTitle: String?, shareUrl: String?, shareContent: String?, shareHead: String?): YDLShareDialog {
typeStyle = TYPE1
return YDLShareDialog(activity, shareTitle, shareUrl, shareContent, shareHead)
}
//支持分享小程序
fun style1(
activity: Activity,
shareTitle: String?,
shareUrl: String?,
shareContent: String?,
shareHead: String?,
minProgramPath: String? = "",
minProgramId: String? = ""
): YDLShareDialog {
fun style1(activity: Activity, shareTitle: String?, shareUrl: String?, shareContent: String?, shareHead: String?, minProgramPath: String? = "", minProgramId: String? = ""): YDLShareDialog {
typeStyle = TYPE1
return YDLShareDialog(
activity,
shareTitle,
shareUrl,
shareContent,
shareHead,
minProgramPath,
minProgramId
)
return YDLShareDialog(activity, shareTitle, shareUrl, shareContent, shareHead, minProgramPath, minProgramId)
}
fun style2(
activity: Activity,
shareTitle: String?,
shareUrl: String?,
shareContent: String?,
shareHead: String?
): YDLShareDialog {
fun style2(activity: Activity, shareTitle: String?, shareUrl: String?, shareContent: String?, shareHead: String?): YDLShareDialog {
typeStyle = TYPE2
return YDLShareDialog(activity, shareTitle, shareUrl, shareContent, shareHead)
}
fun style3(
activity: Activity,
shareTitle: String?,
shareUrl: String?,
shareContent: String?,
shareHead: String?
): YDLShareDialog {
fun style3(activity: Activity, shareTitle: String?, shareUrl: String?, shareContent: String?, shareHead: String?): YDLShareDialog {
typeStyle = TYPE3
return YDLShareDialog(activity, shareTitle, shareUrl, shareContent, shareHead)
}
fun style4(
activity: Activity,
shareTitle: String?,
shareUrl: String?,
shareContent: String?,
shareHead: String?
): YDLShareDialog {
fun style4(activity: Activity, shareTitle: String?, shareUrl: String?, shareContent: String?, shareHead: String?): YDLShareDialog {
typeStyle = TYPE4
return YDLShareDialog(activity, shareTitle, shareUrl, shareContent, shareHead)
}
fun style5(
activity: Activity,
shareTitle: String?,
shareUrl: String?,
shareContent: String?,
shareHead: String?
): YDLShareDialog {
fun style5(activity: Activity, shareTitle: String?, shareUrl: String?, shareContent: String?, shareHead: String?): YDLShareDialog {
typeStyle = TYPE5
return YDLShareDialog(activity, shareTitle, shareUrl, shareContent, shareHead)
}
fun style6(
activity: Activity,
shareTitle: String?,
shareUrl: String?,
shareContent: String?,
shareHead: String?
): YDLShareDialog {
fun style6(activity: Activity, shareTitle: String?, shareUrl: String?, shareContent: String?, shareHead: String?): YDLShareDialog {
typeStyle = TYPE6
return YDLShareDialog(activity, shareTitle, shareUrl, shareContent, shareHead)
}
//支持分享小程序
fun style7(
fun style7(activity: Activity, shareTitle: String?, shareUrl: String?, shareContent: String?, shareHead: String?, minProgramPath: String? = "", minProgramId: String? = ""): YDLShareDialog {
typeStyle = TYPE7
return YDLShareDialog(activity, shareTitle, shareUrl, shareContent, shareHead, minProgramPath, minProgramId)
}
//只有微信和朋友圈
fun style8(
activity: Activity,
shareTitle: String?,
shareUrl: String?,
shareContent: String?,
shareHead: String?,
minProgramPath: String? = "",
minProgramId: String? = ""
minProgramPath: String?,
minProgramId: String?
): YDLShareDialog {
typeStyle = TYPE7
return YDLShareDialog(
activity,
shareTitle,
shareUrl,
shareContent,
shareHead,
minProgramPath,
minProgramId
)
typeStyle = TYPE8
return YDLShareDialog(activity, shareTitle, shareUrl, shareContent, shareHead, minProgramPath, minProgramId)
}
}
override fun onCreateView(
inflater: LayoutInflater?,
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?, savedInstanceState: Bundle?): View {
//去掉dialog的标题,需要在setContentView()之前
this.dialog.requestWindowFeature(Window.FEATURE_NO_TITLE)
val window = this.dialog.window
......@@ -288,8 +213,7 @@ class YDLShareDialog : DialogFragment {
//举报
ll_report.visibility = View.GONE
setStyle()
val deleteParams =
LinearLayout.LayoutParams(dp55, ViewGroup.LayoutParams.WRAP_CONTENT)
val deleteParams = LinearLayout.LayoutParams(dp55, ViewGroup.LayoutParams.WRAP_CONTENT)
deleteParams.setMargins(dp7, 0, llmargin, 0)
deleteParams.weight = 0f
ll_delete.layoutParams = deleteParams
......@@ -303,8 +227,7 @@ class YDLShareDialog : DialogFragment {
ll_dynamic.visibility = View.GONE
ll_delete.visibility = View.GONE
setStyle()
val reportParams =
LinearLayout.LayoutParams(dp55, ViewGroup.LayoutParams.WRAP_CONTENT)
val reportParams = LinearLayout.LayoutParams(dp55, ViewGroup.LayoutParams.WRAP_CONTENT)
reportParams.setMargins(dp7, 0, llmargin, 0)
reportParams.weight = 0f
ll_report.layoutParams = reportParams
......@@ -340,6 +263,12 @@ class YDLShareDialog : DialogFragment {
//动态
ll_dynamic.visibility = View.GONE
}
TYPE8 -> {
ll_layout2.visibility = View.GONE
ll_dynamic.visibility = View.GONE
ll_qq.visibility = View.GONE
ll_qqzone.visibility = View.GONE
}
}
showPictureView()
......@@ -523,7 +452,6 @@ class YDLShareDialog : DialogFragment {
*/
private fun shareMinWeixin() {
//分享小程序到微信
mActivity?.let { activity ->
shareTitle?.let { shareTitle ->
shareUrl?.let { shareUrl ->
......
......@@ -29,6 +29,10 @@ android {
abortOnError false
}
dataBinding {
enabled true
}
buildTypes {
release {
minifyEnabled false
......@@ -62,7 +66,9 @@ dependencies {
api(rootProject.ext.dependencies["support-v4"])
api(rootProject.ext.dependencies["appcompat-v7"])
api(rootProject.ext.dependencies["design"])
implementation(rootProject.ext.dependencies["annotations"])
implementation(rootProject.ext.dependencies["arouter"])
kapt(rootProject.ext.dependencies["arouter-compiler"])
compileOnly(rootProject.ext.dependencies["systembartint"])
implementation "com.ydl:ydl-image:1.0.10-SNAPSHOT"
}
package com.yidianling.common.binding
import android.graphics.Color
import android.graphics.drawable.GradientDrawable
import android.view.View
import android.widget.ImageView
import androidx.databinding.BindingAdapter
import com.ydl.ydl_image.module.GlideApp
@BindingAdapter("imageUrl", "circle", requireAll = false)
fun setImageUrl(imageView: ImageView, url: String?, circle: Boolean = false) {
if (url.isNullOrEmpty()) return
if (circle) {
GlideApp.with(imageView).load(url).circleCrop().into(imageView)
} else {
GlideApp.with(imageView).load(url).into(imageView)
}
}
@BindingAdapter(
value = [
"shapeBg",
"shapeStrokeColor",
"shapeStrokeWidth",
"shapeRadius",
"shape"
],
requireAll = false
)
fun View.setCustomStyle(
shapeBg: Int = Color.TRANSPARENT, // 背景颜色
shapeStrokeColor: Int = Color.TRANSPARENT, // 边框颜色
shapeStrokeWidth: Float = 0f, // 边框宽度
shapeRadius: Float = 0f, // 圆角宽度
shape: Int = GradientDrawable.RECTANGLE // Shape样式 默认矩形
) {
val gradientDrawable: GradientDrawable = if (background as? GradientDrawable == null) {
GradientDrawable()
} else {
background as GradientDrawable
}
val density = resources.displayMetrics.density
gradientDrawable.setColor(shapeBg)
gradientDrawable.setStroke(
(shapeStrokeWidth * density).toInt(),
shapeStrokeColor
)
val radius = density * shapeRadius
gradientDrawable.cornerRadius = radius
when (shape) {
GradientDrawable.RECTANGLE -> gradientDrawable.shape = GradientDrawable.RECTANGLE
GradientDrawable.OVAL -> gradientDrawable.shape = GradientDrawable.OVAL
GradientDrawable.LINE -> gradientDrawable.shape = GradientDrawable.LINE
GradientDrawable.RING -> gradientDrawable.shape = GradientDrawable.RING
else -> gradientDrawable.shape = GradientDrawable.RECTANGLE
}
background = gradientDrawable
}
\ No newline at end of file
package com.yidianling.common.view.ui;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.view.View;
import androidx.annotation.Nullable;
import com.yidianling.common.R;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
public class VoicePlayingIcon extends View implements Runnable {
//画笔
private Paint paint;
//跳动指针的集合
private List<Pointer> pointers;
//跳动指针的数量
private int pointerNum;
//逻辑坐标 原点
private float basePointX;
private float basePointY;
//指针间的间隙 默认5dp
private float pointerPadding;
//每个指针的宽度 默认3dp
private float pointerWidth;
//指针的颜色
private int pointerColor = Color.RED;
//控制开始/停止
private boolean isPlaying = false;
//子线程
private Thread myThread;
//指针波动速率
private int pointerSpeed;
private Random random;
private RectF rectF;
private float radius;
public VoicePlayingIcon(Context context) {
super(context);
init();
}
public VoicePlayingIcon(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
//取出自定义属性
TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.VoicePlayingIcon);
pointerColor = ta.getColor(R.styleable.VoicePlayingIcon_pointer_color, Color.WHITE);
pointerNum = ta.getInt(R.styleable.VoicePlayingIcon_pointer_num, 3);//指针的数量,默认为4
pointerWidth = dp2px(getContext(),
ta.getFloat(R.styleable.VoicePlayingIcon_pointer_width, 6f));//指针的宽度,默认5dp
pointerSpeed = ta.getInt(R.styleable.VoicePlayingIcon_pointer_speed, 40);
ta.recycle();
init();
}
public VoicePlayingIcon(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.VoicePlayingIcon);
pointerColor = ta.getColor(R.styleable.VoicePlayingIcon_pointer_color, Color.RED);
pointerNum = ta.getInt(R.styleable.VoicePlayingIcon_pointer_num, 3);
pointerWidth = dp2px(getContext(), ta.getFloat(R.styleable.VoicePlayingIcon_pointer_width, 6f));
pointerSpeed = ta.getInt(R.styleable.VoicePlayingIcon_pointer_speed, 40);
ta.recycle();
init();
}
/**
* 初始化画笔与指针的集合
*/
private void init() {
paint = new Paint();
paint.setAntiAlias(true);
paint.setColor(pointerColor);
radius = pointerWidth / 2;
pointers = new ArrayList<>();
for (int i = 0; i < pointerNum; i++) {
pointers.add(new Pointer());
}
random = new Random();
rectF = new RectF();
}
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
//获取逻辑原点的,也就是画布左下角的坐标。这里减去了paddingBottom的距离
basePointY = getHeight() - getPaddingBottom();
for (int i = 0; i < pointerNum; i++) {
//创建指针对象,利用0~1的随机数 乘以 可绘制区域的高度。作为每个指针的初始高度。
Pointer pointer = pointers.get(i);
if (pointer != null) {
pointer.height = (float) (0.1 * (random.nextInt(10) + 1) * (getHeight() - getPaddingBottom() - getPaddingTop()));
}
}
//计算每个指针之间的间隔 总宽度 - 左右两边的padding - 所有指针占去的宽度 然后再除以间隔的数量
pointerPadding = (getWidth() - getPaddingLeft() - getPaddingRight() - pointerWidth * pointerNum) / (pointerNum - 1);
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
//将x坐标移动到逻辑原点,也就是左下角
basePointX = 0f + getPaddingLeft();
//循环绘制每一个指针。
for (int i = 0; i < pointers.size(); i++) {
//绘制指针,也就是绘制矩形
rectF.set(basePointX,
basePointY - pointers.get(i).height,
basePointX + pointerWidth,
basePointY);
canvas.drawRoundRect(rectF, radius, radius, paint);
basePointX += (pointerPadding + pointerWidth);
}
}
/**
* 开始播放
*/
public void start() {
if (!isPlaying) {
removeCallbacks(this);
postOnAnimation(this);
isPlaying = true;//控制子线程中的循环
}
}
/**
* 停止子线程,并刷新画布
*/
public void stop() {
isPlaying = false;
removeCallbacks(this);
invalidate();
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
removeCallbacks(this);
isPlaying = false;
}
private float i = 0F;
@Override
public void run() {
for (int j = 0; j < pointers.size(); j++) { //循环改变每个指针高度
float rate = (float) Math.abs(Math.sin(i + j));//利用正弦有规律的获取0~1的数。
pointers.get(j).height = (basePointY - getPaddingTop()) * rate; //rate 乘以 可绘制高度,来改变每个指针的高度
}
invalidate();
i += 0.1;
postOnAnimationDelayed(this, pointerSpeed);
}
/**
* 指针对象
*/
private static class Pointer {
private float height;
}
static int dp2px(Context context, float dipValue) {
final float scale = context.getResources().getDisplayMetrics().density;
return (int) (dipValue * scale + 0.5f);
}
}
......@@ -318,4 +318,11 @@
<attr name="ratingTitleVisible" format="boolean"/>
<attr name="ratingCenterColor" format="color"/>
</declare-styleable>
<declare-styleable name="VoicePlayingIcon">
<attr name="pointer_color" format="color" />
<attr name="pointer_num" format="integer" />
<attr name="pointer_width" format="float" />
<attr name="pointer_speed" format="integer" />
</declare-styleable>
</resources>
\ No newline at end of file
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