Commit bef23df6 by 徐健

FM模块接口暴露

parent 2bb31177
...@@ -19,9 +19,11 @@ import com.ydl.component.mvp.DemoPresenter ...@@ -19,9 +19,11 @@ import com.ydl.component.mvp.DemoPresenter
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
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.mvp.lce.BaseLceActivity import com.ydl.ydlcommon.mvp.lce.BaseLceActivity
import com.ydl.ydlcommon.router.IYDLRouterConstant import com.ydl.ydlcommon.router.IYDLRouterConstant
import com.yidianling.common.tools.ToastUtil import com.yidianling.common.tools.ToastUtil
import com.yidianling.fm.api.service.IFMService
import com.yidianling.tests.home.TestHomeActivity import com.yidianling.tests.home.TestHomeActivity
import kotlinx.android.synthetic.main.activity_main.* import kotlinx.android.synthetic.main.activity_main.*
...@@ -102,7 +104,8 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>( ...@@ -102,7 +104,8 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(
} }
bt_to_fm.setOnClickListener { bt_to_fm.setOnClickListener {
YDLRouterManager.router(IYDLRouterConstant.ROUTER_FM_LIST) startActivity(ModularServiceManager.provide(IFMService::class.java).fmListIntent(this))
// YDLRouterManager.router(IYDLRouterConstant.ROUTER_FM_LIST)
} }
} }
......
ext { ext {
kotlin_version = '1.3.21' kotlin_version = '1.3.21'
dev_mode = true dev_mode = false
ydl_app = [ ydl_app = [
appName : "心理咨询壹点灵", appName : "心理咨询壹点灵",
...@@ -175,6 +175,7 @@ ext { ...@@ -175,6 +175,7 @@ ext {
"ydl-platform" : 'com.ydl:ydl-platform:0.0.10@aar', "ydl-platform" : 'com.ydl:ydl-platform:0.0.10@aar',
"ydl-m-user-api" : 'com.ydl:m-user-api:0.0.5', "ydl-m-user-api" : 'com.ydl:m-user-api:0.0.5',
"ydl-webview" : 'com.ydl:ydl-webview:0.0.14@aar', "ydl-webview" : 'com.ydl:ydl-webview:0.0.14@aar',
"ydl-m-muse-api" : 'com.ydl:m-muse-api:0.0.1@aar' "ydl-m-muse-api" : 'com.ydl:m-muse-api:0.0.1@aar',
"ydl-m-fm-api" : 'com.ydl:m-fm-api:0.0.1@aar'
] ]
} }
...@@ -24,7 +24,7 @@ modular { ...@@ -24,7 +24,7 @@ modular {
groupId = "com.ydl" groupId = "com.ydl"
artifactId = "m-fm-api" artifactId = "m-fm-api"
//开发时注释掉版本号,发布api时打开 //开发时注释掉版本号,发布api时打开
//version = "0.0.1" version = "0.0.1"
// API 层打包时需要引入的依赖 // API 层打包时需要引入的依赖
apiDependencies { apiDependencies {
implementation "com.google.code.gson:gson:2.8.2" implementation "com.google.code.gson:gson:2.8.2"
......
package com.yidianling.fm; package com.yidianling.fm;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Color; import android.graphics.Color;
import android.os.Bundle;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager;
import android.widget.PopupWindow; import android.widget.PopupWindow;
...@@ -35,8 +38,10 @@ public class FMActivity extends BaseActivity { ...@@ -35,8 +38,10 @@ public class FMActivity extends BaseActivity {
private PopupWindow popupWindow; private PopupWindow popupWindow;
public static Intent newIntent(Activity activity) {
Intent intent = new Intent(activity, FMActivity.class);
return intent;
}
@Override @Override
protected int layoutResId() { protected int layoutResId() {
return R.layout.fm_activity_fm; return R.layout.fm_activity_fm;
......
package com.yidianling.fm.modular
import android.app.Activity
import android.content.Context
import android.content.Intent
import com.alibaba.android.arouter.facade.annotation.Route
import com.ydl.media.audio.AudioPlayer
import com.ydl.media.view.PlayerFloatHelper
import com.yidianling.fm.FMActivity
import com.yidianling.fm.FMDetailActivity
import com.yidianling.fm.api.service.IFMService
/**
* Created by xj on 2019/11/6.
*/
@Route(path = "/fm/FMService")
class FMServiceImpl : IFMService {
constructor()
override fun init(context: Context?) {
}
/**
* 打开FM列表页面
*/
override fun fmListIntent(activity: Activity): Intent {
return FMActivity.newIntent(activity)
}
/**
* 打开FM播放页面
*/
override fun fmDetailIntent(activity: Activity, id: Int): Intent {
return FMDetailActivity.newIntent(activity, id)
}
/**
* 打开FM播放页面
*/
override fun fmDetailIntent(activity: Activity, id: Int, isSplash: Boolean): Intent {
return FMDetailActivity.newIntent(activity, id, isSplash)
}
/**
* 获取FM播放ID
*/
override fun getFmId(): Int {
return PlayerFloatHelper.getFmId()
}
/**
* 关闭音乐播放
*/
override fun closePlayer() {
if (AudioPlayer.get().isPlaying) {
AudioPlayer.get().stopPlayer()
}
}
/**
* 判断是否正在播放中
*/
override fun isPlaying(): Boolean {
return AudioPlayer.get().isPlaying
}
/**
* 暂停播放
*/
override fun pause(){
AudioPlayer.get().pausePlayer()
}
override fun replay() {}
}
\ No newline at end of file
...@@ -15,7 +15,6 @@ object FMIn { ...@@ -15,7 +15,6 @@ object FMIn {
fun isLogin(): Boolean { fun isLogin(): Boolean {
return ModularServiceManager.provide(IUserService::class.java).isLogin() return ModularServiceManager.provide(IUserService::class.java).isLogin()
// return RouterManager.getUserRouter()?.isLogin()?:false
} }
fun mainIntent(activity: Activity): Intent? { fun mainIntent(activity: Activity): Intent? {
......
package com.yidianling.fm.api.service package com.yidianling.fm.api.service
import android.app.Activity
import android.content.Intent
import com.alibaba.android.arouter.facade.template.IProvider import com.alibaba.android.arouter.facade.template.IProvider
/** /**
...@@ -7,4 +9,19 @@ import com.alibaba.android.arouter.facade.template.IProvider ...@@ -7,4 +9,19 @@ import com.alibaba.android.arouter.facade.template.IProvider
*/ */
interface IFMService: IProvider{ interface IFMService: IProvider{
fun fmListIntent(activity: Activity): Intent
fun fmDetailIntent(activity: Activity, id: Int): Intent
fun fmDetailIntent(activity: Activity, id: Int, isSplash: Boolean): Intent
fun getFmId(): Int
fun closePlayer()
fun isPlaying(): Boolean
fun pause()
fun replay()
} }
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<color name="fm_google_green">#fdbd00</color> <color name="fm_google_green">#FFDD33</color>
</resources> </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