Commit adf09a49 by ydl

Merge branch 'dev' into feature/image_picker

# Conflicts:
#	config.gradle
#	m-consultant/src/main/res/layout/consultant_expert_search_item_view.xml
parents 75466ca8 353ecc62
...@@ -187,7 +187,7 @@ dependencies { ...@@ -187,7 +187,7 @@ dependencies {
api project(':m-home') api project(':m-home')
// api project(':m-confide') api project(':m-confide')
// api "com.ydl:m-consultant-api:0.0.2" // api "com.ydl:m-consultant-api:0.0.2"
// api 'com.ydl:m-consultant-module-ydl:0.0.18@aar' // api 'com.ydl:m-consultant-module-ydl:0.0.18@aar'
...@@ -202,7 +202,7 @@ dependencies { ...@@ -202,7 +202,7 @@ dependencies {
// implementation project(':m-muse') implementation project(':m-muse')
implementation project(':m-im') implementation project(':m-im')
implementation project(':m-dynamic') implementation project(':m-dynamic')
implementation project(':m-audioim') implementation project(':m-audioim')
......
...@@ -18,6 +18,7 @@ import com.umeng.analytics.MobclickAgent ...@@ -18,6 +18,7 @@ import com.umeng.analytics.MobclickAgent
import com.ydl.component.music.FragmentContainerActivity import com.ydl.component.music.FragmentContainerActivity
import com.ydl.component.mvp.DemoContract import com.ydl.component.mvp.DemoContract
import com.ydl.component.mvp.DemoPresenter import com.ydl.component.mvp.DemoPresenter
import com.ydl.confide.home.ConfideHomeActivity
import com.ydl.media.audio.PlayService import com.ydl.media.audio.PlayService
import com.ydl.ydl_router.manager.YDLRouterManager import com.ydl.ydl_router.manager.YDLRouterManager
import com.ydl.ydl_router.manager.YDLRouterParams import com.ydl.ydl_router.manager.YDLRouterParams
...@@ -105,37 +106,42 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>( ...@@ -105,37 +106,42 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(
bt_to_tests.setOnClickListener { bt_to_tests.setOnClickListener {
startActivity(Intent(this, NewTestHomeActivity::class.java)) startActivity(Intent(this, NewTestHomeActivity::class.java))
} }
// bt_to_confide.setOnClickListener { bt_to_confide.setOnClickListener {
// YDLavManager.instances.login("1193016") // YDLavManager.instances.login("1193016")
// startActivity(Intent(this, ConfideHomeActivity::class.java)) startActivity(Intent(this, ConfideHomeActivity::class.java))
// } }
bt_to_muse.setOnClickListener { bt_to_muse.setOnClickListener {
YDLRouterManager.router(
IYDLRouterConstant.ROUTER_MUSE, YDLRouterManager.router(IYDLRouterConstant.ROUTER_MUSE_CENTER,
YDLRouterParams().putExtra( YDLRouterParams().putExtra
IYDLRouterConstant.MUSIC_URL, ("url", "http://video.yidianling.com/2019/05/30/746851e2f335baf5f44499f4fb49d3a9.mp3"))
"http://video.yidianling.com/2019/05/30/e6d4a71e8c895f2156a2ff37d93ca3a9.mp3"
) // YDLRouterManager.router(
.putExtra( // IYDLRouterConstant.ROUTER_MUSE,
IYDLRouterConstant.DATA_JSON, "{\n" + // YDLRouterParams().putExtra(
" \"muses\": [{\n" + // IYDLRouterConstant.MUSIC_URL,
" \"id\": 6,\n" + // "http://video.yidianling.com/2019/05/30/e6d4a71e8c895f2156a2ff37d93ca3a9.mp3"
" \"name\": \"冥想基础介绍-1-什么是冥想?\",\n" + // )
" \"audioUrl\":\n" + // .putExtra(
" \"http://video.yidianling.com/2019/05/30/e6d4a71e8c895f2156a2ff37d93ca3a9.mp3\",\n" + // IYDLRouterConstant.DATA_JSON, "{\n" +
" \"backgroundUrl\":\n" + // " \"muses\": [{\n" +
" \"https://img.yidianling.com/file/2019/06/10/i4qdax82ok2aizq3.png\",\n" + // " \"id\": 6,\n" +
" \"effectCode\": 1,\n" + // " \"name\": \"冥想基础介绍-1-什么是冥想?\",\n" +
" \"category\": 2,\n" + // " \"audioUrl\":\n" +
" \"playCount\": 929,\n" + // " \"http://video.yidianling.com/2019/05/30/e6d4a71e8c895f2156a2ff37d93ca3a9.mp3\",\n" +
" \"sort\": 255,\n" + // " \"backgroundUrl\":\n" +
" \"isDelete\": 1,\n" + // " \"https://img.yidianling.com/file/2019/06/10/i4qdax82ok2aizq3.png\",\n" +
" \"createTime\": \"May 30, 2019 4:45:17 PM\",\n" + // " \"effectCode\": 1,\n" +
" \"updateTime\": \"Jun 10, 2019 7:14:23 PM\"\n" + // " \"category\": 2,\n" +
" }]\n" + // " \"playCount\": 929,\n" +
" }" // " \"sort\": 255,\n" +
) // " \"isDelete\": 1,\n" +
) // " \"createTime\": \"May 30, 2019 4:45:17 PM\",\n" +
// " \"updateTime\": \"Jun 10, 2019 7:14:23 PM\"\n" +
// " }]\n" +
// " }"
// )
// )
} }
bt_to_fm.setOnClickListener { bt_to_fm.setOnClickListener {
......
...@@ -20,8 +20,8 @@ import java.util.List; ...@@ -20,8 +20,8 @@ import java.util.List;
public final class DemoGlobalConfig implements IConfigModule { public final class DemoGlobalConfig implements IConfigModule {
String APP_DOMAIN = "https://api.github.com/"; String APP_DOMAIN = "https://api.github.com/";
// public static String appEnv = YDLConstants.ENV_AUTO_TEST; // public static String appEnv = YDLConstants.ENV_AUTO_TEST;
// public static String appEnv = YDLConstants.ENV_TEST; public static String appEnv = YDLConstants.ENV_TEST;
public static String appEnv = YDLConstants.ENV_PROD; // public static String appEnv = YDLConstants.ENV_PROD;
@Override @Override
public void injectAppLifecycle(@NotNull Context context, @NotNull List<IAppLifecycles> lifecycles) { public void injectAppLifecycle(@NotNull Context context, @NotNull List<IAppLifecycles> lifecycles) {
......
ext { ext {
kotlin_version = "1.3.21" kotlin_version = "1.3.21"
dev_mode = false dev_mode = true
ydl_app = [ ydl_app = [
appName : "心理咨询壹点灵", appName : "心理咨询壹点灵",
...@@ -50,7 +50,7 @@ ext { ...@@ -50,7 +50,7 @@ ext {
"m-im" : "0.0.14.1", "m-im" : "0.0.14.1",
"m-dynamic" : "0.0.6.1", "m-dynamic" : "0.0.6.1",
"m-muse" : "0.0.26", "m-muse" : "0.0.27",
"m-tests" : "0.0.21", "m-tests" : "0.0.21",
"m-course" : "0.0.40.1", "m-course" : "0.0.40.1",
...@@ -253,7 +253,7 @@ ext { ...@@ -253,7 +253,7 @@ ext {
"ydl-pushagent" : "com.ydl:pushagent:0.1.1", "ydl-pushagent" : "com.ydl:pushagent:0.1.1",
"ydl-notracepoint" : "com.ydl:notracepoint-lib:0.2.3.3@aar", "ydl-notracepoint" : "com.ydl:notracepoint-lib:0.2.3.3@aar",
"ydl-js" : "com.ydl:ydl-js:1.0.7-SNAPSHOT@aar", "ydl-js" : "com.ydl:ydl-js:1.0.7-SNAPSHOT@aar",
"ydl-router" : "com.ydl:ydl-router:1.3.9-SNAPSHOT@aar", "ydl-router" : "com.ydl:ydl-router:1.4.1-SNAPSHOT@aar",
"xrecyclerview" : "com.ydl:xrecyclerview:1.0.0-SNAPSHOT@aar", "xrecyclerview" : "com.ydl:xrecyclerview:1.0.0-SNAPSHOT@aar",
"arouter-api" : "com.alibaba:arouter-api:1.4.1", "arouter-api" : "com.alibaba:arouter-api:1.4.1",
"arouter-compiler" : "com.alibaba:arouter-compiler:1.2.2", "arouter-compiler" : "com.alibaba:arouter-compiler:1.2.2",
......
...@@ -13,6 +13,11 @@ ...@@ -13,6 +13,11 @@
android:name=".HotSearchActivity" android:name=".HotSearchActivity"
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:theme="@style/consultant_NoTitleTheme"/> android:theme="@style/consultant_NoTitleTheme"/>
<activity
android:name=".ConsultAssistantCenterActivity"
android:screenOrientation="portrait"
android:theme="@style/consultant_Transparent"/>
</application> </application>
</manifest> </manifest>
\ No newline at end of file
package com.yidianling.consultant
import com.alibaba.android.arouter.facade.annotation.Route
import com.ydl.ydlcommon.base.BaseActivity
import com.yidianling.consultant.modular.singlton.ConsultAssistantDialogUtils
/**
* 导医跳转私聊的中间页面,用于统一路由
*/
@Route( path = "/chat/ChatService")
class ConsultAssistantCenterActivity : BaseActivity() {
override fun initDataAndEvent() {
supportActionBar?.hide()
ConsultAssistantDialogUtils.INSTANCE.getConsultAssistantUid(this)
}
override fun layoutResId(): Int {
return 0
}
}
\ No newline at end of file
...@@ -77,7 +77,6 @@ class ExpertSearchAdapter(private val context: Context, private val expertSearch ...@@ -77,7 +77,6 @@ class ExpertSearchAdapter(private val context: Context, private val expertSearch
// holder.tvDesc.text = itemBean.famousRemark // holder.tvDesc.text = itemBean.famousRemark
// } // }
//服务中 //服务中
if (itemBean.inConsult || itemBean.isListening) { if (itemBean.inConsult || itemBean.isListening) {
holder.imgHead_online_server.visibility = View.VISIBLE holder.imgHead_online_server.visibility = View.VISIBLE
...@@ -110,59 +109,81 @@ class ExpertSearchAdapter(private val context: Context, private val expertSearch ...@@ -110,59 +109,81 @@ class ExpertSearchAdapter(private val context: Context, private val expertSearch
}else{ }else{
holder.tvCity.text = "" holder.tvCity.text = ""
} }
//能力等级标签
if (1 == itemBean.abilityLevel){ //公益图标,不与其他图标冲突
//实习 if (1 == itemBean.hasServiceFree) {
holder.imgAbilityLevel.background = context.resources.getDrawable(R.drawable.consultant_expert_search_shixi) if (null != itemBean.tagsIcon && !TextUtils.isEmpty(itemBean.tagsIcon.serviceFreeIcon)) {
holder.imgAbilityLevel.visibility = View.VISIBLE expertSearchView.showImage(
}else if (2 == itemBean.abilityLevel){ itemBean.tagsIcon.serviceFreeIcon,
//新手 holder.imgServiceFree
holder.imgAbilityLevel.background = context.resources.getDrawable(R.drawable.consultant_expert_search_xinshou) )
holder.imgAbilityLevel.visibility = View.VISIBLE } else {
}
// else if (3 == itemBean.abilityLevel){
// //精英
// holder.imgAbilityLevel.background = context.resources.getDrawable(R.drawable.consultant_expert_search_jingying)
// holder.imgAbilityLevel.visibility = View.VISIBLE
// }
else{
holder.imgAbilityLevel.visibility = View.GONE
}
//活动图标
if (!TextUtils.isEmpty(itemBean.activityImg)){
holder.imgActivity.visibility = View.VISIBLE
GlideApp.with(context).load(itemBean.activityImg).into(holder.imgActivity)
// GlideApp.with(context).load("https://video.ydlcdn.com/2019/11/04/abdd3782c98939d0406080a6a80b8ea5.jpg").into(holder.imgActivity)
}else{
holder.imgActivity.visibility = View.GONE
}
//公益图标
if (1 == itemBean.hasServiceFree){
if (null != itemBean.tagsIcon && !TextUtils.isEmpty(itemBean.tagsIcon.serviceFreeIcon)){
expertSearchView.showImage(itemBean.tagsIcon.serviceFreeIcon,holder.imgServiceFree)
}else{
val sp = SimpleImageOpConfiger() val sp = SimpleImageOpConfiger()
sp.loadingPic = R.drawable.consultant_service_free sp.loadingPic = R.drawable.consultant_service_free
sp.errorPic = R.drawable.consultant_service_free sp.errorPic = R.drawable.consultant_service_free
expertSearchView.showImage("",holder.imgServiceFree,sp) expertSearchView.showImage("", holder.imgServiceFree, sp)
} }
holder.imgServiceFree.visibility = View.VISIBLE holder.imgServiceFree.visibility = View.VISIBLE
}else{ } else {
holder.imgServiceFree.visibility = View.GONE holder.imgServiceFree.visibility = View.GONE
} }
//新驻图标 // 展示了抗疫,就不展示其他标签
if (itemBean.isNewEnter){ if (itemBean.fightEpidemicIconShow) {
if (null != itemBean.tagsIcon && !TextUtils.isEmpty(itemBean.tagsIcon.newEnterIcon)){ itemBean.tagsIcon?.fightEpidemicIcon?.let {
expertSearchView.showImage(itemBean.tagsIcon.newEnterIcon,holder.imgNewEnter) GlideApp.with(context).load(itemBean.tagsIcon?.fightEpidemicIcon)
}else{ .into(holder.imgFightEpidemicIcon)
val sp = SimpleImageOpConfiger() holder.imgFightEpidemicIcon.visibility = View.VISIBLE
sp.loadingPic = R.drawable.consultant_new_enter
sp.errorPic = R.drawable.consultant_new_enter
expertSearchView.showImage("",holder.imgNewEnter,sp)
} }
holder.imgNewEnter.visibility = View.VISIBLE //影藏其余所有标签(除公益)
}else{ holder.imgAbilityLevel.visibility = View.GONE
holder.imgActivity.visibility = View.GONE
holder.imgNewEnter.visibility = View.GONE holder.imgNewEnter.visibility = View.GONE
} else {
//能力等级标签
if (1 == itemBean.abilityLevel) {
//实习
holder.imgAbilityLevel.background =
context.resources.getDrawable(R.drawable.consultant_expert_search_shixi)
holder.imgAbilityLevel.visibility = View.VISIBLE
} else if (2 == itemBean.abilityLevel) {
//新手
holder.imgAbilityLevel.background =
context.resources.getDrawable(R.drawable.consultant_expert_search_xinshou)
holder.imgAbilityLevel.visibility = View.VISIBLE
}
// else if (3 == itemBean.abilityLevel){
// //精英
// holder.imgAbilityLevel.background = context.resources.getDrawable(R.drawable.consultant_expert_search_jingying)
// holder.imgAbilityLevel.visibility = View.VISIBLE
// }
else {
holder.imgAbilityLevel.visibility = View.GONE
}
//活动图标
if (!TextUtils.isEmpty(itemBean.activityImg)) {
holder.imgActivity.visibility = View.VISIBLE
GlideApp.with(context).load(itemBean.activityImg).into(holder.imgActivity)
// GlideApp.with(context).load("https://video.ydlcdn.com/2019/11/04/abdd3782c98939d0406080a6a80b8ea5.jpg").into(holder.imgActivity)
} else {
holder.imgActivity.visibility = View.GONE
}
//新驻图标
if (itemBean.isNewEnter) {
if (null != itemBean.tagsIcon && !TextUtils.isEmpty(itemBean.tagsIcon.newEnterIcon)) {
expertSearchView.showImage(
itemBean.tagsIcon.newEnterIcon,
holder.imgNewEnter
)
} else {
val sp = SimpleImageOpConfiger()
sp.loadingPic = R.drawable.consultant_new_enter
sp.errorPic = R.drawable.consultant_new_enter
expertSearchView.showImage("", holder.imgNewEnter, sp)
}
holder.imgNewEnter.visibility = View.VISIBLE
} else {
holder.imgNewEnter.visibility = View.GONE
}
} }
holder.ll_feedbackRate.removeAllViews() holder.ll_feedbackRate.removeAllViews()
for (num in 1..5){ for (num in 1..5){
...@@ -330,6 +351,8 @@ class ExpertSearchAdapter(private val context: Context, private val expertSearch ...@@ -330,6 +351,8 @@ class ExpertSearchAdapter(private val context: Context, private val expertSearch
val imgHead_online_server = itemView.imgHead_online_server!! val imgHead_online_server = itemView.imgHead_online_server!!
//多少人在问询 //多少人在问询
val chat_people_in_question = itemView.people_in_question!! val chat_people_in_question = itemView.people_in_question!!
// 抗疫先锋图标
val imgFightEpidemicIcon = itemView.img_fightEpidemicIcon
init { init {
itemView.setOnClickListener { itemView.setOnClickListener {
......
...@@ -19,4 +19,8 @@ data class ExpertSearchTagsIconBean( ...@@ -19,4 +19,8 @@ data class ExpertSearchTagsIconBean(
/** /**
* 新入驻图标 * 新入驻图标
*/ */
val newEnterIcon : String?) val newEnterIcon : String?,
\ No newline at end of file /**
* 抗疫先锋图标地址
*/
var fightEpidemicIcon: String? = null)
\ No newline at end of file
...@@ -60,6 +60,10 @@ data class DoctorServiceItem( ...@@ -60,6 +60,10 @@ data class DoctorServiceItem(
*/ */
var feedbackRate: Float = 0f, var feedbackRate: Float = 0f,
/** /**
* 是否抗疫先锋图标
*/
var fightEpidemicIconShow: Boolean = false,
/**
* 评价数(咨询订单数) * 评价数(咨询订单数)
*/ */
var zixunOrderNum: Int = 0, var zixunOrderNum: Int = 0,
......
package com.yidianling.consultant.modular.singlton package com.yidianling.consultant.modular.singlton
import android.annotation.SuppressLint
import android.app.Activity import android.app.Activity
import android.content.SharedPreferences import android.content.SharedPreferences
import android.support.v7.app.AppCompatActivity import android.support.v7.app.AppCompatActivity
import android.text.TextUtils import android.text.TextUtils
import com.ydl.ydlcommon.data.http.ThrowableConsumer
import com.ydl.ydlcommon.utils.SharedPreferencesEditor import com.ydl.ydlcommon.utils.SharedPreferencesEditor
import com.ydl.ydlcommon.utils.YdlBuryPointUtil import com.ydl.ydlcommon.utils.YdlBuryPointUtil
import com.ydl.ydlcommon.utils.remind.ToastHelper
import com.yidianling.common.tools.ToastUtil import com.yidianling.common.tools.ToastUtil
import com.yidianling.consultant.ConsultAssistantCenterActivity
import com.yidianling.consultant.dialog.ConsultAssistantDialog import com.yidianling.consultant.dialog.ConsultAssistantDialog
import com.yidianling.consultant.model.SearchApi import com.yidianling.consultant.model.SearchApi
import com.yidianling.consultant.router.ConsultantIn import com.yidianling.consultant.router.ConsultantIn
import io.reactivex.Observable import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.functions.Consumer
import io.reactivex.schedulers.Schedulers import io.reactivex.schedulers.Schedulers
import java.util.* import java.util.*
...@@ -234,18 +239,25 @@ class ConsultAssistantDialogUtils private constructor() { ...@@ -234,18 +239,25 @@ class ConsultAssistantDialogUtils private constructor() {
////////////////////////////////////// 咨询师列表页面的展示隐藏逻辑 代码块end /////////////////////////////////////////////////// ////////////////////////////////////// 咨询师列表页面的展示隐藏逻辑 代码块end ///////////////////////////////////////////////////
private fun getConsultAssistantUid(activity: Activity) { @SuppressLint("CheckResult")
fun getConsultAssistantUid(activity: Activity) {
// 请求接口获取咨询助理的uid // 请求接口获取咨询助理的uid
SearchApi.getSearchApi().getConsultAssistantUidRequest() SearchApi.getSearchApi().getConsultAssistantUidRequest()
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe { .subscribe( Consumer {
if (it.code == "200" && it.data != 0.toLong()) { if (it.code == "200" && it.data != 0.toLong() && null != activity) {
ConsultantIn.startP2PSession(activity as AppCompatActivity, it.data.toString()) ConsultantIn.startP2PSession(activity as AppCompatActivity, it.data.toString())
} else { } else {
ToastUtil.toastShort("咨询助理忙碌中,请稍后再试") ToastUtil.toastShort("咨询助理忙碌中,请稍后再试")
} }
if (null != activity && activity is ConsultAssistantCenterActivity && !activity.isFinishing) activity.finish()
}, object: ThrowableConsumer() {
override fun accept(msg: String) {
if (null != activity && activity is ConsultAssistantCenterActivity && !activity.isFinishing) activity.finish()
}
} }
)
} }
// 判定是否展示左侧的描述文本 // 判定是否展示左侧的描述文本
......
...@@ -75,20 +75,25 @@ ...@@ -75,20 +75,25 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal" android:orientation="horizontal"
android:paddingLeft="10dp" android:paddingLeft="8dp"
android:gravity="center_vertical" android:gravity="center_vertical"
android:layout_alignTop="@+id/tvName" android:layout_alignTop="@+id/tvName"
android:layout_alignBottom="@+id/tvName" android:layout_alignBottom="@+id/tvName"
android:layout_toEndOf="@+id/tvName" android:layout_toEndOf="@+id/tvName"
android:layout_marginStart="@dimen/platform_dp_2"> android:layout_marginStart="@dimen/platform_dp_2">
<ImageView
android:id="@+id/img_fightEpidemicIcon"
android:layout_width="53dp"
android:layout_height="@dimen/platform_dp_17"
android:layout_marginRight="4dp"
android:scaleType="centerCrop"
android:visibility="gone"/>
<!--活动图标--> <!--活动图标-->
<ImageView <ImageView
android:id="@+id/img_activity" android:id="@+id/img_activity"
android:layout_width="42dp" android:layout_width="42dp"
android:layout_height="12dp" android:layout_height="12dp"
android:layout_marginStart="@dimen/platform_dp_4" android:layout_marginRight="4dp"
android:layout_marginEnd="4dp"
android:scaleType="centerCrop"
android:visibility="gone"/> android:visibility="gone"/>
<!--公益图标--> <!--公益图标-->
<ImageView <ImageView
......
...@@ -37,4 +37,12 @@ ...@@ -37,4 +37,12 @@
<item name="android:windowIsTranslucent">true</item> <item name="android:windowIsTranslucent">true</item>
<item name="android:backgroundDimEnabled">true</item> <item name="android:backgroundDimEnabled">true</item>
</style> </style>
<style name="consultant_Transparent" parent="@style/Base.Theme.AppCompat">
<item name="colorPrimary">@color/transparent</item>
<item name="colorPrimaryDark">@color/transparent</item>
<item name="android:windowBackground">@color/transparent</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsTranslucent">true</item>
</style>
</resources> </resources>
...@@ -5,5 +5,9 @@ ...@@ -5,5 +5,9 @@
<activity <activity
android:name=".activity.MuseActivity" android:name=".activity.MuseActivity"
android:screenOrientation="portrait"/> android:screenOrientation="portrait"/>
<activity
android:name=".activity.MuseCenterActivity"
android:screenOrientation="portrait"
android:theme="@style/muse_Transparent"/>
</application> </application>
</manifest> </manifest>
...@@ -10,6 +10,7 @@ import org.json.JSONObject ...@@ -10,6 +10,7 @@ import org.json.JSONObject
/** /**
* Created by xj on 2019/9/6. * Created by xj on 2019/9/6.
* 统一路由不要直接跳这个activity,有一个中间MuseCenterActivity
*/ */
@Route(path = "/module/muse") @Route(path = "/module/muse")
......
package com.yidianling.muse.activity
import android.annotation.SuppressLint
import android.text.TextUtils
import com.alibaba.android.arouter.facade.annotation.Route
import com.google.gson.Gson
import com.ydl.ydl_router.manager.YDLRouterManager
import com.ydl.ydl_router.manager.YDLRouterParams
import com.ydl.ydlcommon.base.BaseActivity
import com.ydl.ydlcommon.data.http.RxUtils
import com.ydl.ydlcommon.data.http.ThrowableConsumer
import com.ydl.ydlcommon.router.IYDLRouterConstant
import com.yidianling.home.http.MuseHttp
import io.reactivex.functions.Consumer
import org.json.JSONException
import org.json.JSONObject
/**
* 冥想跳转中间页面,用于统一路由跳转,在这里获取冥想助眠的列表数据,并解析统一路由的url(该url必须为接口数据中的一个)作为播放url
*/
@Route( path = "/muse/MuseService")
class MuseCenterActivity: BaseActivity() {
private var currentUrl: String? = null
override fun initDataAndEvent() {
supportActionBar?.hide()
if (intent.hasExtra("routerParam")) {
val json = intent.getStringExtra("routerParam")
if (!TextUtils.isEmpty(json)) {
try {
val jsonObject = JSONObject(json)
currentUrl = jsonObject.getString("url")
} catch (e: JSONException) {
e.printStackTrace()
}
}
}
//调用接口获取所有数据
getData()
}
@SuppressLint("CheckResult")
private fun getData() {
MuseHttp.getInstance().newMuseRequest()
.compose(RxUtils.applySchedulers())
.map { it }
.filter { true }
.subscribe(Consumer {
var dataJson = Gson().toJson(it.data)
YDLRouterManager.router(
IYDLRouterConstant.ROUTER_MUSE,
YDLRouterParams().putExtra(IYDLRouterConstant.MUSIC_URL, currentUrl?:"")
.putExtra(IYDLRouterConstant.DATA_JSON, dataJson))
finish()
}, object : ThrowableConsumer() {
override fun accept(msg: String) {
finish()
}
})
}
override fun layoutResId(): Int {
return 0
}
}
\ No newline at end of file
package com.yidianling.home.http
import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.ydl.ydlnet.YDLHttpUtils
import com.yidianling.muse.bean.MuseModuleBean
import io.reactivex.Observable
/**
* @author jiucheng
* @描述:首页接口实现类
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/8/22
*/
class MuseHttp {
companion object {
fun getInstance(): MuseHttp {
return Holder.INSTANCE
}
}
object Holder {
val INSTANCE = MuseHttp()
}
private var museApi: MusePagerApi? = null
private fun getMusePagerApi(): MusePagerApi {
if (museApi == null) {
museApi = YDLHttpUtils.obtainApi(MusePagerApi::class.java)
}
return museApi!!
}
//壹点冥想
fun newMuseRequest(): Observable<BaseAPIResponse<MuseModuleBean>> {
return getMusePagerApi().getMuseData()
}
}
\ No newline at end of file
package com.yidianling.home.http
import com.ydl.ydlcommon.base.config.YDL_DOMAIN
import com.ydl.ydlcommon.base.config.YDL_DOMAIN_JAVA
import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.yidianling.muse.bean.MuseModuleBean
import io.reactivex.Observable
import retrofit2.http.GET
import retrofit2.http.Headers
/**
* @author jiucheng
* @描述:首页接口api
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/8/22
*/
interface MusePagerApi {
//壹点 - 冥想
@GET("meditation/meditation/list")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun getMuseData(): Observable<BaseAPIResponse<MuseModuleBean>>
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="muse_Transparent" parent="@style/Base.Theme.AppCompat">
<item name="colorPrimary">@color/transparent</item>
<item name="colorPrimaryDark">@color/transparent</item>
<item name="android:windowBackground">@color/transparent</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsTranslucent">true</item>
</style>
</resources>
\ No newline at end of file
...@@ -56,6 +56,11 @@ interface IYDLRouterConstant{ ...@@ -56,6 +56,11 @@ interface IYDLRouterConstant{
const val ROUTER_MAIN_TAB = ROUTER_BASE + "main/tab" const val ROUTER_MAIN_TAB = ROUTER_BASE + "main/tab"
//咨询下单页 //咨询下单页
const val ROUTER_APPOINTMENT_ZIXUN = ROUTER_BASE + "appointment/zixun" const val ROUTER_APPOINTMENT_ZIXUN = ROUTER_BASE + "appointment/zixun"
//导医过渡页面
const val ROUTER_CHAT_CONSULT_ASSISTANT = ROUTER_BASE + "chat/ChatService"
//冥想过渡页面
const val ROUTER_MUSE_CENTER = ROUTER_BASE + "muse/MuseService"
/** /**
* 参数名称 * 参数名称
*/ */
......
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