Commit c011cc87 by ydl

增加导医和冥想的统一路由跳转(增加中间的透明过渡页)

parent cd835900
......@@ -187,7 +187,7 @@ dependencies {
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-module-ydl:0.0.18@aar'
......@@ -202,7 +202,7 @@ dependencies {
// implementation project(':m-muse')
implementation project(':m-muse')
implementation project(':m-im')
implementation project(':m-dynamic')
......
......@@ -18,6 +18,7 @@ import com.umeng.analytics.MobclickAgent
import com.ydl.component.music.FragmentContainerActivity
import com.ydl.component.mvp.DemoContract
import com.ydl.component.mvp.DemoPresenter
import com.ydl.confide.home.ConfideHomeActivity
import com.ydl.media.audio.PlayService
import com.ydl.ydl_router.manager.YDLRouterManager
import com.ydl.ydl_router.manager.YDLRouterParams
......@@ -105,37 +106,42 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(
bt_to_tests.setOnClickListener {
startActivity(Intent(this, NewTestHomeActivity::class.java))
}
// bt_to_confide.setOnClickListener {
bt_to_confide.setOnClickListener {
// YDLavManager.instances.login("1193016")
// startActivity(Intent(this, ConfideHomeActivity::class.java))
// }
startActivity(Intent(this, ConfideHomeActivity::class.java))
}
bt_to_muse.setOnClickListener {
YDLRouterManager.router(
IYDLRouterConstant.ROUTER_MUSE,
YDLRouterParams().putExtra(
IYDLRouterConstant.MUSIC_URL,
"http://video.yidianling.com/2019/05/30/e6d4a71e8c895f2156a2ff37d93ca3a9.mp3"
)
.putExtra(
IYDLRouterConstant.DATA_JSON, "{\n" +
" \"muses\": [{\n" +
" \"id\": 6,\n" +
" \"name\": \"冥想基础介绍-1-什么是冥想?\",\n" +
" \"audioUrl\":\n" +
" \"http://video.yidianling.com/2019/05/30/e6d4a71e8c895f2156a2ff37d93ca3a9.mp3\",\n" +
" \"backgroundUrl\":\n" +
" \"https://img.yidianling.com/file/2019/06/10/i4qdax82ok2aizq3.png\",\n" +
" \"effectCode\": 1,\n" +
" \"category\": 2,\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" +
" }"
)
)
YDLRouterManager.router(IYDLRouterConstant.ROUTER_MUSE_CENTER,
YDLRouterParams().putExtra
("url", "http://video.yidianling.com/2019/05/30/746851e2f335baf5f44499f4fb49d3a9.mp3"))
// YDLRouterManager.router(
// IYDLRouterConstant.ROUTER_MUSE,
// YDLRouterParams().putExtra(
// IYDLRouterConstant.MUSIC_URL,
// "http://video.yidianling.com/2019/05/30/e6d4a71e8c895f2156a2ff37d93ca3a9.mp3"
// )
// .putExtra(
// IYDLRouterConstant.DATA_JSON, "{\n" +
// " \"muses\": [{\n" +
// " \"id\": 6,\n" +
// " \"name\": \"冥想基础介绍-1-什么是冥想?\",\n" +
// " \"audioUrl\":\n" +
// " \"http://video.yidianling.com/2019/05/30/e6d4a71e8c895f2156a2ff37d93ca3a9.mp3\",\n" +
// " \"backgroundUrl\":\n" +
// " \"https://img.yidianling.com/file/2019/06/10/i4qdax82ok2aizq3.png\",\n" +
// " \"effectCode\": 1,\n" +
// " \"category\": 2,\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 {
......
......@@ -20,8 +20,8 @@ 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_PROD;
public static String appEnv = YDLConstants.ENV_TEST;
// public static String appEnv = YDLConstants.ENV_PROD;
@Override
public void injectAppLifecycle(@NotNull Context context, @NotNull List<IAppLifecycles> lifecycles) {
......
ext {
kotlin_version = "1.3.21"
dev_mode = false
dev_mode = true
ydl_app = [
appName : "心理咨询壹点灵",
......@@ -43,14 +43,14 @@ ext {
// -------------- 业务模块 --------------
//第三步 若干
"m-confide" : "0.0.47.1",
"m-consultant" : "0.0.56.1",
"m-consultant" : "0.0.57",
"m-fm" : "0.0.28",
"m-user" : "0.0.56",
"m-home" : "0.0.19.1",
"m-im" : "0.0.11",
"m-dynamic" : "0.0.5.1",
"m-muse" : "0.0.26",
"m-muse" : "0.0.27",
"m-tests" : "0.0.21",
"m-course" : "0.0.40.1",
......@@ -253,7 +253,7 @@ ext {
"ydl-pushagent" : "com.ydl:pushagent:0.1.1",
"ydl-notracepoint" : "com.ydl:notracepoint-lib:0.2.3.3@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",
"arouter-api" : "com.alibaba:arouter-api:1.4.1",
"arouter-compiler" : "com.alibaba:arouter-compiler:1.2.2",
......
......@@ -13,6 +13,11 @@
android:name=".HotSearchActivity"
android:screenOrientation="portrait"
android:theme="@style/consultant_NoTitleTheme"/>
<activity
android:name=".ConsultAssistantCenterActivity"
android:screenOrientation="portrait"
android:theme="@style/consultant_Transparent"/>
</application>
</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
package com.yidianling.consultant.modular.singlton
import android.annotation.SuppressLint
import android.app.Activity
import android.content.SharedPreferences
import android.support.v7.app.AppCompatActivity
import android.text.TextUtils
import com.ydl.ydlcommon.data.http.ThrowableConsumer
import com.ydl.ydlcommon.utils.SharedPreferencesEditor
import com.ydl.ydlcommon.utils.YdlBuryPointUtil
import com.ydl.ydlcommon.utils.remind.ToastHelper
import com.yidianling.common.tools.ToastUtil
import com.yidianling.consultant.ConsultAssistantCenterActivity
import com.yidianling.consultant.dialog.ConsultAssistantDialog
import com.yidianling.consultant.model.SearchApi
import com.yidianling.consultant.router.ConsultantIn
import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.functions.Consumer
import io.reactivex.schedulers.Schedulers
import java.util.*
......@@ -234,18 +239,25 @@ class ConsultAssistantDialogUtils private constructor() {
////////////////////////////////////// 咨询师列表页面的展示隐藏逻辑 代码块end ///////////////////////////////////////////////////
private fun getConsultAssistantUid(activity: Activity) {
@SuppressLint("CheckResult")
fun getConsultAssistantUid(activity: Activity) {
// 请求接口获取咨询助理的uid
SearchApi.getSearchApi().getConsultAssistantUidRequest()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe {
if (it.code == "200" && it.data != 0.toLong()) {
.subscribe( Consumer {
if (it.code == "200" && it.data != 0.toLong() && null != activity) {
ConsultantIn.startP2PSession(activity as AppCompatActivity, it.data.toString())
} else {
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()
}
}
)
}
// 判定是否展示左侧的描述文本
......
......@@ -37,4 +37,12 @@
<item name="android:windowIsTranslucent">true</item>
<item name="android:backgroundDimEnabled">true</item>
</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>
......@@ -5,5 +5,9 @@
<activity
android:name=".activity.MuseActivity"
android:screenOrientation="portrait"/>
<activity
android:name=".activity.MuseCenterActivity"
android:screenOrientation="portrait"
android:theme="@style/muse_Transparent"/>
</application>
</manifest>
......@@ -10,6 +10,7 @@ import org.json.JSONObject
/**
* Created by xj on 2019/9/6.
* 统一路由不要直接跳这个activity,有一个中间MuseCenterActivity
*/
@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{
const val ROUTER_MAIN_TAB = ROUTER_BASE + "main/tab"
//咨询下单页
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