删除 independent 依赖

This commit is contained in:
董宏宇
2021-09-01 11:59:16 +08:00
parent 447c2e5fe2
commit a607680b44
408 changed files with 0 additions and 20607 deletions

View File

@@ -1 +0,0 @@
/build

View File

@@ -1,70 +0,0 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.alibaba.arouter'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion rootProject.ext.android.compileSdkVersion
defaultConfig {
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
versionCode Integer.valueOf(VERSION_CODE)
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
//ARouter apt 参数
kapt {
useBuildCache = false
arguments {
arg("AROUTER_MODULE_NAME",project.getName() )
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation rootProject.ext.dependencies.kotlinstdlibjdk7
implementation rootProject.ext.dependencies.androidxccorektx
implementation rootProject.ext.dependencies.coroutinescore
implementation rootProject.ext.dependencies.coroutinesandroid
implementation rootProject.ext.dependencies.androidxappcompat
implementation rootProject.ext.dependencies.androidxconstraintlayout
implementation rootProject.ext.dependencies.androidxviewpager2
implementation rootProject.ext.dependencies.arouter
kapt rootProject.ext.dependencies.aroutercompiler
implementation rootProject.ext.dependencies.indicator
if (Boolean.valueOf(RELEASE)) {
implementation rootProject.ext.dependencies.mogoutils
implementation rootProject.ext.dependencies.mogocommons
implementation rootProject.ext.dependencies.mogoserviceapi
implementation rootProject.ext.dependencies.mogomoduleauth
implementation rootProject.ext.dependencies.modulecommon
} else {
implementation project(":foudations:mogo-utils")
implementation project(":foudations:mogo-commons")
implementation project(':services:mogo-service-api')
implementation project(':modules:mogo-module-authorize')
implementation project(":modules:mogo-module-common")
}
}
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()

View File

@@ -1,3 +0,0 @@
GROUP=com.mogo.module
POM_ARTIFACT_ID=module-guide
VERSION_CODE=1

View File

@@ -1,21 +0,0 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View File

@@ -1,2 +0,0 @@
package com.mogo.module.guide.agreement

View File

@@ -1 +0,0 @@
<manifest package="com.mogo.module.guide" />

View File

@@ -1,65 +0,0 @@
package com.mogo.module.guide
import com.alibaba.android.arouter.launcher.ARouter
import com.mogo.module.authorize.authprovider.invoke.AuthorizeConstant
import com.mogo.module.authorize.authprovider.invoke.AuthorizeInvokerConstant.Companion.AUTHORIZE_TYPE_LAUNCHER_MAIN
import com.mogo.module.authorize.authprovider.module.IMogoAuthorizeModuleManager
import com.mogo.module.guide.GuideConstant.Companion.PATH_GUIDE_MODULE_NAME
import com.mogo.module.guide.fragment.GuideFragment
import com.mogo.module.guide.util.SharedPreferenceUtil.hasGuide
import com.mogo.module.guide.util.SharedPreferenceUtil.setGuideFinish
import com.mogo.module.guide.util.SharedPreferenceUtil.setGuideRecord
import com.mogo.service.IMogoServiceApis
import com.mogo.service.MogoServicePaths
import com.mogo.service.fragmentmanager.FragmentDescriptor
import com.mogo.utils.UiThreadHandler
import com.mogo.utils.logger.Logger
object GuideBizManager {
private var serviceApi: IMogoServiceApis? = null
fun init() {
Logger.d("GuideBizManager", "init===================================")
initService()
addGuideFragmentToStack()
}
private fun initService() {
val mogoService = ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation()
if (mogoService is IMogoServiceApis && serviceApi == null) {
serviceApi = mogoService
serviceApi?.adasControllerApi?.closeADAS()
}
}
private fun addGuideFragmentToStack() {
if (!hasGuide()) {
serviceApi?.let {
val builderWrapper = FragmentDescriptor.Builder().fragment(GuideFragment())
.tag(PATH_GUIDE_MODULE_NAME).build()
it.fragmentManagerApi.push(builderWrapper)
}
}
}
fun removeGuideFragmentToStack() {
Logger.d("GuideBizManager", "removeGuideFragmentToStack")
setGuideFinish()
setGuideRecord()
serviceApi?.fragmentManagerApi?.pop()
serviceApi?.adasControllerApi?.showADAS()
}
fun invokeAuthorize() {
UiThreadHandler.postDelayed({
val authorizeInvoke = ARouter.getInstance().build(AuthorizeConstant.PROVIDER_MODULE).navigation()
if (authorizeInvoke is IMogoAuthorizeModuleManager) {
if (authorizeInvoke.needAuthorize(AUTHORIZE_TYPE_LAUNCHER_MAIN)) {
authorizeInvoke.invokeAuthorizeForShow()
}
}
}, 3000L)
}
}

View File

@@ -1,16 +0,0 @@
package com.mogo.module.guide
class GuideConstant {
companion object {
/**
* 展示用户引导模块地址
*/
const val PATH_GUIDE_FRAGMENT = "/guide/showFragment"
/**
* provider模块实例名称(暂时仅有卡片用到)
*/
const val PATH_GUIDE_MODULE_NAME = "GUIDE_MODULE_NAME"
}
}

View File

@@ -1,68 +0,0 @@
package com.mogo.module.guide
import android.content.Context
import android.os.Bundle
import android.view.View
import androidx.fragment.app.Fragment
import com.alibaba.android.arouter.facade.annotation.Route
import com.mogo.map.listener.IMogoMapListener
import com.mogo.map.location.IMogoLocationListener
import com.mogo.map.marker.IMogoMarkerClickListener
import com.mogo.map.navi.IMogoNaviListener
import com.mogo.module.guide.GuideConstant.Companion.PATH_GUIDE_FRAGMENT
import com.mogo.module.guide.GuideConstant.Companion.PATH_GUIDE_MODULE_NAME
import com.mogo.service.module.IMogoModuleProvider
import com.mogo.service.module.ModuleType
import com.mogo.utils.logger.Logger
@Route(path = PATH_GUIDE_FRAGMENT)
class MogoGuideProvider : IMogoModuleProvider {
/**
* 卡片用到
*/
override fun createFragment(context: Context?, data: Bundle?): Fragment? {
return null
}
override fun createView(context: Context?): View? {
return null
}
override fun getModuleName(): String {
return PATH_GUIDE_MODULE_NAME
}
override fun getMapListener(): IMogoMapListener? {
return null
}
override fun getType(): Int {
return ModuleType.TYPE_SERVICE
}
override fun getNaviListener(): IMogoNaviListener? {
return null
}
override fun getLocationListener(): IMogoLocationListener? {
return null
}
override fun getMarkerClickListener(): IMogoMarkerClickListener? {
return null
}
override fun init(context: Context?) {
Logger.d("MogoGuideProvider", "init====")
GuideBizManager.init()
}
override fun getAppPackage(): String? {
return null
}
override fun getAppName(): String? {
return null
}
}

View File

@@ -1,35 +0,0 @@
package com.mogo.module.guide.fragment
import androidx.fragment.app.Fragment
import androidx.viewpager2.adapter.FragmentStateAdapter
import com.mogo.module.guide.guide.*
class GuideAdapter(fragmentActivity: GuideFragment) : FragmentStateAdapter(fragmentActivity) {
override fun getItemCount(): Int {
return guideList.size
}
override fun createFragment(position: Int): Fragment {
return guideList[position]
}
private val guideList: MutableList<Fragment> = mutableListOf()
companion object {
const val GUIDE_PAGE_ONE = 0
const val GUIDE_PAGE_TWO = 1
const val GUIDE_PAGE_THREE = 2
const val GUIDE_PAGE_FOUR = 3
const val GUIDE_PAGE_FIVE = 4
}
init {
guideList.add(GUIDE_PAGE_ONE, GuideStageOneFragment(fragmentActivity))
guideList.add(GUIDE_PAGE_TWO, GuideStageTwoFragment(fragmentActivity))
guideList.add(GUIDE_PAGE_THREE, GuideStageThreeFragment(fragmentActivity))
guideList.add(GUIDE_PAGE_FOUR, GuideStageFourFragment(fragmentActivity))
guideList.add(GUIDE_PAGE_FIVE, GuideStageFiveFragment(fragmentActivity))
}
}

View File

@@ -1,14 +0,0 @@
package com.mogo.module.guide.fragment
import com.mogo.commons.mvp.IView
class GuideConstract {
interface View:IView{
}
interface Biz{
}
}

View File

@@ -1,138 +0,0 @@
package com.mogo.module.guide.fragment
import android.view.View
import androidx.recyclerview.widget.RecyclerView
import com.mogo.commons.mvp.MvpFragment
import com.mogo.commons.voice.IMogoVoiceCmdCallBack
import com.mogo.module.guide.GuideBizManager
import com.mogo.module.guide.R
import com.mogo.module.guide.util.AnalyticsUtil
import com.mogo.module.guide.util.AnalyticsUtil.INVOKE_TRACK_PASS_TIME
import com.mogo.module.guide.util.AnalyticsUtil.INVOKE_TRACK_PLAY_PASS_ID
import com.mogo.module.guide.util.AnalyticsUtil.INVOKE_TRACK_PLAY_TIME
import com.mogo.module.guide.util.breakOffSpeak
import com.mogo.module.guide.util.speak
import com.mogo.utils.logger.Logger
import com.zhpan.indicator.enums.IndicatorSlideMode
import com.zhpan.indicator.enums.IndicatorStyle
import kotlinx.android.synthetic.main.module_guide_fragment.*
import kotlinx.android.synthetic.main.module_guide_item_include.*
class GuideFragment : MvpFragment<GuideConstract.View, GuidePresenter>(), GuideConstract.View {
companion object {
const val TAG = "GuideFragment"
}
private var duringTime: Long = 0L
private var recordCount = 0
override fun getLayoutId(): Int {
return R.layout.module_guide_fragment
}
override fun createPresenter(): GuidePresenter {
return GuidePresenter(this)
}
private var adapter: GuideAdapter? = null
override fun initViews() {
Logger.d(TAG, "init Views")
duringTime = System.currentTimeMillis()
adapter = GuideAdapter(this)
moduleGuideViewPager.adapter = adapter
(moduleGuideViewPager.getChildAt(0) as RecyclerView).layoutManager!!.isItemPrefetchEnabled = false
@Suppress("DEPRECATION")
moduleGuideIndicator.setSliderColor(context!!.resources.getColor(R.color.module_guide_indicator_dark), context!!.resources.getColor(R.color.module_guide_indicator_white))
.setSliderWidth(context!!.resources.getDimension(R.dimen.dp_22))
.setSlideMode(IndicatorSlideMode.NORMAL)
.setIndicatorStyle(IndicatorStyle.CIRCLE)
.setupWithViewPager(moduleGuideViewPager)
visibleRight()
module_guide_page_left.setOnClickListener {
moveToBack()
}
module_guide_page_right.setOnClickListener {
moveToNext()
}
module_guide_tv_next_step.setOnClickListener {
if( (moduleGuideViewPager.currentItem + 1) == adapter!!.itemCount){
closeGuideFragment()
}else{
moveToNext()
}
}
}
fun visibleLeft() {
module_guide_page_left.visibility = View.VISIBLE
}
fun invisibleLeft() {
module_guide_page_left.visibility = View.GONE
}
fun visibleRight() {
module_guide_page_right.visibility = View.VISIBLE
module_guide_tv_next_step.text = context!!.resources.getString(R.string.module_guide_item_next_step)
}
fun invisibleRight() {
module_guide_page_right.visibility = View.GONE
module_guide_tv_next_step.text = context!!.resources.getString(R.string.module_guide_finish)
}
fun moveToNext() {
val count = adapter?.itemCount
if (moduleGuideViewPager.currentItem != count) {
moduleGuideViewPager.currentItem = moduleGuideViewPager.currentItem + 1
}
}
private fun moveToBack() {
val count = adapter?.itemCount
val backCount = moduleGuideViewPager.currentItem - 1
if (moduleGuideViewPager.currentItem != count) {
moduleGuideViewPager.currentItem = backCount
}
}
fun closeGuideFragment() {
recordCount = moduleGuideViewPager.currentItem + 1
destroy()
}
private fun track() {
val recordTime = System.currentTimeMillis() - duringTime
AnalyticsUtil.track(INVOKE_TRACK_PLAY_PASS_ID,
hashMapOf(INVOKE_TRACK_PASS_TIME to recordCount
, INVOKE_TRACK_PLAY_TIME to recordTime))
Logger.d(TAG, "closeGuideFragment -> recordTime : $recordTime , recordCount : $recordCount")
}
private fun destroy() {
GuideBizManager.removeGuideFragmentToStack()
}
private fun invokeAuthorize() {
GuideBizManager.invokeAuthorize()
}
override fun onDestroyView() {
closeGuideFragment()
super.onDestroyView()
}
override fun onDestroy() {
super.onDestroy()
track()
breakOffSpeak(context!!)
speak(context!!, context!!.resources.getString(R.string.module_guide_voice_page_end), object : IMogoVoiceCmdCallBack {
override fun onTTSEnd(ttsId: String?, tts: String?) {
}
})
invokeAuthorize()
}
}

View File

@@ -1,18 +0,0 @@
package com.mogo.module.guide.fragment
import androidx.lifecycle.LifecycleOwner
import com.mogo.commons.mvp.Presenter
class GuidePresenter : Presenter<GuideConstract.View>, GuideConstract.Biz {
constructor(view: GuideConstract.View) : super(view)
companion object{
const val TAG = "GuidePresenter"
}
override fun onCreate(owner: LifecycleOwner) {
super.onCreate(owner)
}
}

View File

@@ -1,57 +0,0 @@
package com.mogo.module.guide.guide
import com.mogo.commons.debug.DebugConfig
import com.mogo.commons.mvp.IView
import com.mogo.commons.mvp.MvpFragment
import com.mogo.commons.mvp.Presenter
import com.mogo.commons.voice.IMogoVoiceCmdCallBack
import com.mogo.module.guide.R
import com.mogo.module.guide.fragment.GuideFragment
import com.mogo.module.guide.util.breakOffSpeak
import com.mogo.module.guide.util.speak
import kotlinx.android.synthetic.main.module_guide_item_stage_five.*
import kotlinx.android.synthetic.main.module_guide_item_stage_four.*
class GuideStageFiveFragment : MvpFragment<IView, Presenter<IView>> {
private var containerFragment: GuideFragment? = null
constructor(containerFragment: GuideFragment) {
this.containerFragment = containerFragment
}
override fun getLayoutId(): Int {
return R.layout.module_guide_item_stage_five
}
override fun createPresenter(): Presenter<IView> {
return GuideLocationPresenter(this)
}
override fun initViews() {
if(!DebugConfig.isLauncher()){
@Suppress("DEPRECATION")
moduleGuidePageFive.background = context!!.resources!!.getDrawable(R.mipmap.module_guide_item_stage_five)
}
}
override fun onResume() {
super.onResume()
containerFragment?.invisibleRight()
breakOffSpeak(context!!)
speak(context!!, context!!.resources.getString(R.string.module_guide_voice_page_five), object : IMogoVoiceCmdCallBack {
override fun onSpeakEnd(speakText: String?) {
if(!isVisible){
return
}
containerFragment?.closeGuideFragment()
}
})
}
class GuideLocationPresenter : Presenter<IView> {
constructor(view: IView?) : super(view)
}
}

View File

@@ -1,58 +0,0 @@
package com.mogo.module.guide.guide
import com.mogo.commons.debug.DebugConfig
import com.mogo.commons.mvp.IView
import com.mogo.commons.mvp.MvpFragment
import com.mogo.commons.mvp.Presenter
import com.mogo.commons.voice.IMogoVoiceCmdCallBack
import com.mogo.module.guide.R
import com.mogo.module.guide.fragment.GuideFragment
import com.mogo.module.guide.util.breakOffSpeak
import com.mogo.module.guide.util.speak
import kotlinx.android.synthetic.main.module_guide_item_stage_four.*
import kotlinx.android.synthetic.main.module_guide_item_stage_three.*
class GuideStageFourFragment : MvpFragment<IView, Presenter<IView>> {
private var containerFragment: GuideFragment? = null
constructor(containerFragment: GuideFragment) {
this.containerFragment = containerFragment
}
override fun getLayoutId(): Int {
return R.layout.module_guide_item_stage_four
}
override fun createPresenter(): Presenter<IView> {
return GuideNavigationPresenter(this)
}
override fun initViews() {
if(!DebugConfig.isLauncher()){
@Suppress("DEPRECATION")
moduleGuidePageFour.background = context!!.resources!!.getDrawable(R.mipmap.module_guide_item_stage_four)
}
}
override fun onResume() {
super.onResume()
containerFragment?.visibleLeft()
containerFragment?.visibleRight()
breakOffSpeak(context!!)
speak(context!!, context!!.resources.getString(R.string.module_guide_voice_page_four), object : IMogoVoiceCmdCallBack {
override fun onSpeakEnd(speakText: String?) {
if(!isVisible){
return
}
containerFragment?.moveToNext()
}
})
}
class GuideNavigationPresenter : Presenter<IView> {
constructor(view: IView?) : super(view)
}
}

View File

@@ -1,57 +0,0 @@
package com.mogo.module.guide.guide
import com.mogo.commons.debug.DebugConfig
import com.mogo.commons.mvp.IView
import com.mogo.commons.mvp.MvpFragment
import com.mogo.commons.mvp.Presenter
import com.mogo.commons.voice.IMogoVoiceCmdCallBack
import com.mogo.module.guide.R
import com.mogo.module.guide.fragment.GuideFragment
import com.mogo.module.guide.util.breakOffSpeak
import com.mogo.module.guide.util.speak
import kotlinx.android.synthetic.main.module_guide_item_stage_one.*
class GuideStageOneFragment : MvpFragment<IView, Presenter<IView>> {
private var containerFragment: GuideFragment? = null
constructor(containerFragment: GuideFragment) {
this.containerFragment = containerFragment
}
override fun getLayoutId(): Int {
return R.layout.module_guide_item_stage_one
}
override fun createPresenter(): Presenter<IView> {
return GuideStartPresenter(this)
}
override fun initViews() {
containerFragment?.visibleRight()
if(!DebugConfig.isLauncher()){
@Suppress("DEPRECATION")
moduleGuidePageOne.background = context!!.resources!!.getDrawable(R.mipmap.module_guide_item_stage_one)
}
}
override fun onResume() {
super.onResume()
containerFragment?.invisibleLeft()
breakOffSpeak(context!!)
speak(context!!, context!!.resources.getString(R.string.module_guide_voice_page_one), object : IMogoVoiceCmdCallBack {
override fun onSpeakEnd(speakText: String?) {
if (!isVisible) {
return
}
containerFragment?.moveToNext()
}
})
}
class GuideStartPresenter : Presenter<IView> {
constructor(view: IView?) : super(view)
}
}

View File

@@ -1,58 +0,0 @@
package com.mogo.module.guide.guide
import com.mogo.commons.debug.DebugConfig
import com.mogo.commons.mvp.IView
import com.mogo.commons.mvp.MvpFragment
import com.mogo.commons.mvp.Presenter
import com.mogo.commons.voice.IMogoVoiceCmdCallBack
import com.mogo.module.guide.R
import com.mogo.module.guide.fragment.GuideFragment
import com.mogo.module.guide.util.breakOffSpeak
import com.mogo.module.guide.util.speak
import kotlinx.android.synthetic.main.module_guide_item_stage_three.*
import kotlinx.android.synthetic.main.module_guide_item_stage_two.*
class GuideStageThreeFragment : MvpFragment<IView, Presenter<IView>> {
private var containerFragment: GuideFragment? = null
constructor(containerFragment: GuideFragment) {
this.containerFragment = containerFragment
}
override fun getLayoutId(): Int {
return R.layout.module_guide_item_stage_three
}
override fun createPresenter(): Presenter<IView> {
return GuideOnLineCarPresenter(this)
}
override fun initViews() {
if(!DebugConfig.isLauncher()){
@Suppress("DEPRECATION")
moduleGuidePageThree.background = context!!.resources!!.getDrawable(R.mipmap.module_guide_item_stage_three)
}
}
override fun onResume() {
super.onResume()
containerFragment?.visibleLeft()
containerFragment?.visibleRight()
breakOffSpeak(context!!)
speak(context!!, context!!.resources.getString(R.string.module_guide_voice_page_three), object : IMogoVoiceCmdCallBack {
override fun onSpeakEnd(speakText: String?) {
if(!isVisible){
return
}
containerFragment?.moveToNext()
}
})
}
class GuideOnLineCarPresenter : Presenter<IView> {
constructor(view: IView?) : super(view)
}
}

View File

@@ -1,58 +0,0 @@
package com.mogo.module.guide.guide
import com.mogo.commons.debug.DebugConfig
import com.mogo.commons.mvp.IView
import com.mogo.commons.mvp.MvpFragment
import com.mogo.commons.mvp.Presenter
import com.mogo.commons.voice.IMogoVoiceCmdCallBack
import com.mogo.module.guide.R
import com.mogo.module.guide.fragment.GuideFragment
import com.mogo.module.guide.util.breakOffSpeak
import com.mogo.module.guide.util.speak
import kotlinx.android.synthetic.main.module_guide_item_stage_one.*
import kotlinx.android.synthetic.main.module_guide_item_stage_two.*
class GuideStageTwoFragment : MvpFragment<IView, Presenter<IView>> {
private var containerFragment: GuideFragment? = null
constructor(containerFragment: GuideFragment) {
this.containerFragment = containerFragment
}
override fun getLayoutId(): Int {
return R.layout.module_guide_item_stage_two
}
override fun createPresenter(): Presenter<IView> {
return GuideCardPresenter(this)
}
override fun initViews() {
if(!DebugConfig.isLauncher()){
@Suppress("DEPRECATION")
moduleGuidePageTwo.background = context!!.resources!!.getDrawable(R.mipmap.module_guide_item_stage_two)
}
}
override fun onResume() {
super.onResume()
containerFragment?.visibleLeft()
containerFragment?.visibleRight()
breakOffSpeak(context!!)
speak(context!!, context!!.resources.getString(R.string.module_guide_voice_page_two), object : IMogoVoiceCmdCallBack {
override fun onSpeakEnd(speakText: String?) {
if(!isVisible){
return
}
containerFragment?.moveToNext()
}
})
}
class GuideCardPresenter : Presenter<IView> {
constructor(view: IView?) : super(view)
}
}

View File

@@ -1,25 +0,0 @@
package com.mogo.module.guide.util
import com.alibaba.android.arouter.launcher.ARouter
import com.mogo.service.IMogoServiceApis
import com.mogo.service.MogoServicePaths
import com.mogo.service.analytics.IMogoAnalytics
object AnalyticsUtil {
const val INVOKE_TRACK_PLAY_PASS_ID = "v2x_play_pass"
const val INVOKE_TRACK_PASS_TIME = "pass_time"
const val INVOKE_TRACK_PLAY_TIME = "play_time"
private var trackRouter: IMogoAnalytics? = null
fun track(eventType: String, data: MutableMap<String, Any>? = hashMapOf()) {
if (trackRouter == null) {
val arouter = ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation()
if (arouter is IMogoServiceApis) {
trackRouter = arouter.analyticsApi
}
}
trackRouter!!.track(eventType, data)
}
}

View File

@@ -1,22 +0,0 @@
package com.mogo.module.guide.util
import com.mogo.commons.AbsMogoApplication
import com.mogo.module.common.utils.SPConst.getSPGuideRecord
import com.mogo.module.common.utils.SPConst.getSpGuide
import com.mogo.utils.storage.SharedPrefsMgr
object SharedPreferenceUtil {
fun hasGuide(): Boolean {
return SharedPrefsMgr.getInstance(AbsMogoApplication.getApp()).getBoolean(getSpGuide(), false)
}
fun setGuideFinish() {
SharedPrefsMgr.getInstance(AbsMogoApplication.getApp()).putBoolean(getSpGuide(), true)
}
fun setGuideRecord() {
SharedPrefsMgr.getInstance(AbsMogoApplication.getApp()).putLong(getSPGuideRecord(), System.currentTimeMillis())
}
}

View File

@@ -1,14 +0,0 @@
package com.mogo.module.guide.util
import android.content.Context
import com.mogo.commons.voice.AIAssist
import com.mogo.commons.voice.IMogoVoiceCmdCallBack
import com.mogo.commons.voice.VoicePreemptType
fun speak(context: Context, text: String, callBack: IMogoVoiceCmdCallBack?) {
AIAssist.getInstance(context).speakTTSVoice(text, VoicePreemptType.PREEMPT_TYPE_IMMEADIATELY, callBack)
}
fun breakOffSpeak(context: Context){
AIAssist.getInstance(context).breakOffSpeak()
}

View File

@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="@dimen/dp_15"/>
<gradient android:angle="180" android:startColor="#42B2FD" android:endColor="#1F7BF9"/>
</shape>

View File

@@ -1,28 +0,0 @@
<?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="match_parent">
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/moduleGuideViewPager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.zhpan.indicator.IndicatorView
android:id="@+id/moduleGuideIndicator"
android:layout_width="@dimen/dp_30"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dp_84"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" />
<include
android:id="@+id/module_guide_include"
layout="@layout/module_guide_item_include" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -1,42 +0,0 @@
<?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="match_parent">
<ImageView
android:id="@+id/module_guide_page_right"
android:layout_width="@dimen/dp_54"
android:layout_height="@dimen/dp_90"
android:layout_marginRight="@dimen/dp_92"
android:visibility="gone"
android:src="@mipmap/module_guide_right_page"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/module_guide_page_left"
android:layout_width="@dimen/dp_54"
android:layout_height="@dimen/dp_90"
android:layout_marginLeft="@dimen/dp_92"
android:visibility="gone"
android:src="@mipmap/module_guide_left_page"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/module_guide_tv_next_step"
android:layout_width="@dimen/dp_159"
android:layout_height="@dimen/dp_64"
android:layout_marginTop="@dimen/dp_18"
android:layout_marginRight="@dimen/dp_55"
android:background="@drawable/module_guide_blue_corner"
android:gravity="center"
android:text="@string/module_guide_item_next_step"
android:textColor="#FFFFFF"
android:textSize="@dimen/dp_37"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/moduleGuidePageFive"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@mipmap/module_guide_item_stage_five_launcher">
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/moduleGuidePageFour"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@mipmap/module_guide_item_stage_four_launcher">
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/moduleGuidePageOne"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@mipmap/module_guide_item_stage_one_launcher">
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/moduleGuidePageThree"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@mipmap/module_guide_item_stage_three_launcher">
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/moduleGuidePageTwo"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@mipmap/module_guide_item_stage_two_launcher">
</androidx.constraintlayout.widget.ConstraintLayout>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 371 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 342 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 337 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 500 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 474 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 635 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 713 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 536 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 445 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 550 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 597 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 568 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 749 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 820 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 918 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 835 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 978 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1004 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="module_guide_blue_3B91FF">#3B91FF</color>
<color name="module_guide_indicator_dark">#33ffffff</color>
<color name="module_guide_indicator_white">#ffffff</color>
</resources>

File diff suppressed because it is too large Load Diff

View File

@@ -1,14 +0,0 @@
<resources>
<string name="app_name">mogo-module-guide-agreement</string>
<string name="module_guide_main">左滑了解更多</string>
<string name="module_guide_item_entry_main">进入首页</string>
<string name="module_guide_item_next_step">下一步</string>
<string name="module_guide_finish">结束</string>
<string name="module_guide_voice_page_one">欢迎使用’蘑菇车联‘,您下次可以直接对我说,打开’蘑菇车联‘来直接进入应用,点击左下方按钮进行摄像头设置</string>
<string name="module_guide_voice_page_two">左边是道路事件的播报,点击右边地图上的事件标示可以查看事件详情,或者直接唤醒小智说,中关村附近堵不堵,来查询目的地周围路况</string>
<string name="module_guide_voice_page_three">这里是道路信息显示,点击后可查看事件详情</string>
<string name="module_guide_voice_page_four">这里是事件汇总,您可以查看您参与的事件和您的分享记录</string>
<string name="module_guide_voice_page_five">更多设置,在左上角的设置功能中,点击右下角的分享,可以把路况分享给其他车友,或者直接唤醒小智说,上报路况</string>
<string name="module_guide_voice_page_end">我们希望让您的出行更加安全高效,更多功能等着你去发现,快去体验体验吧</string>
</resources>

View File

@@ -1,17 +0,0 @@
package com.mogo.module.guide.agreement
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}

View File

@@ -1,14 +0,0 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx

View File

@@ -1,73 +0,0 @@
apply plugin: 'com.android.library'
apply plugin: 'com.alibaba.arouter'
android {
compileSdkVersion rootProject.ext.android.compileSdkVersion
buildToolsVersion rootProject.ext.android.buildToolsVersion
defaultConfig {
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
versionCode Integer.valueOf(VERSION_CODE)
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
javaCompileOptions {
annotationProcessorOptions {
arguments = [AROUTER_MODULE_NAME: project.getName()]
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.aar'])
annotationProcessor rootProject.ext.dependencies.aroutercompiler
implementation rootProject.ext.dependencies.arouter
implementation rootProject.ext.dependencies.rxandroid
implementation rootProject.ext.dependencies.androidxappcompat
implementation rootProject.ext.dependencies.androidxconstraintlayout
// 爱趣听sdk上传到了公司的maven用来规避RELEASE时ClassDefNotFound异常后续若爱趣听有新的sdk也需要上传maven
implementation "com.mogo.tencent.wecarflow:mogo-wecarflow:+@aar"
implementation "com.mogo.kwmusic:mogo-kwmusic:+"
implementation rootProject.ext.dependencies.callchatprovider
if (Boolean.valueOf(RELEASE)) {
implementation rootProject.ext.dependencies.mogomap
implementation rootProject.ext.dependencies.mogoutils
implementation rootProject.ext.dependencies.mogocommons
implementation rootProject.ext.dependencies.mogoserviceapi
implementation rootProject.ext.dependencies.mogoservice
implementation rootProject.ext.dependencies.moduleservice
implementation rootProject.ext.dependencies.modulecommon
implementation rootProject.ext.dependencies.mogomoduleauth
} else {
implementation project(":libraries:mogo-map")
implementation project(":foudations:mogo-utils")
implementation project(":foudations:mogo-commons")
implementation project(':services:mogo-service-api')
implementation project(':services:mogo-service')
implementation project(':modules:mogo-module-common')
implementation project(':modules:mogo-module-service')
implementation project(':modules:mogo-module-authorize')
}
}
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()

View File

@@ -1,11 +0,0 @@
#-----MediaModule-----
-dontwarn com.mogo.module.media.**
-keep class com.mogo.module.media.api.* { *; }
-keep class com.mogo.module.media.constants.* { *; }
-keep class com.mogo.module.media.model.** { *; }
-keep class com.mogo.module.media.view.* { *; }
-keep class com.mogo.module.media.widget.** { *; }
-keep class com.mogo.module.media.receiver.* { *; }
-keep class com.mogo.module.media.utils.OnBitmapToLocalListener
-keep class com.mogo.module.media.utils.OnCompressListener
-keep class com.mogo.module.media.MediaConstants{*;}

View File

@@ -1,3 +0,0 @@
GROUP=com.mogo.module
POM_ARTIFACT_ID=module-media
VERSION_CODE=1

View File

@@ -1,35 +0,0 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
#-----MediaModule-----
-dontwarn com.mogo.module.media.**
-keep class com.mogo.module.media.listener.** { *; }
-keep class com.mogo.module.media.model.** { *; }
-keep class com.mogo.module.media.view.** { *; }
-keep class com.mogo.module.media.widget.** { *; }
-keep class com.mogo.module.media.api.** { *; }
-keep class com.mogo.module.media.constants.** { *; }
-keep class com.mogo.module.media.presenter.** { *; }
-keep class com.mogo.module.media.receiver.** { *; }
-keep class com.mogo.module.media.utils.OnBitmapToLocalListener
-keep class com.mogo.module.media.utils.OnCompressListener
-keep class com.mogo.module.media.MediaConstants

View File

@@ -1,27 +0,0 @@
package com.mogo.module.media;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.mogo.module.media", appContext.getPackageName());
}
}

View File

@@ -1,23 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mogo.module.media">
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACTION_MANAGE_OVERLAY_PERMISSION" />
<uses-permission android:name="android.permission.TYPE_APPLICATION_OVERLAY" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="com.tencent.wecarflow.PLAY_CONTROL" />
<application>
<receiver android:name=".receiver.MediaSpeechReceiver">
<intent-filter>
<action android:name="com.speech.adapter.send" />
<action android:name="com.zhidao.speech.awake.notify" />
<action android:name="com.zhidao.mediacenter.voiceltnews" />
</intent-filter>
</receiver>
</application>
</manifest>

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

File diff suppressed because one or more lines are too long

View File

@@ -1,99 +0,0 @@
package com.mogo.module.media;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import androidx.fragment.app.Fragment;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.map.listener.IMogoMapListener;
import com.mogo.map.location.IMogoLocationListener;
import com.mogo.map.marker.IMogoMarkerClickListener;
import com.mogo.map.navi.IMogoNaviListener;
import com.mogo.module.media.window.MediaWindow2;
import com.mogo.service.module.IMogoModuleLifecycle;
import com.mogo.service.module.IMogoModuleProvider;
import com.mogo.service.module.ModuleType;
@Route( path = MediaConstants.TAG )
public class MediaCardViewProvider implements IMogoModuleProvider {
private static final String TAG = "MediaCardViewProvider";
private MediaWindow2 mediaWindow2;
@Override
public Fragment createFragment( Context context, Bundle data ) {
// fragment = new MediaCardViewFragment();
// fragment.setArguments( data );
// Logger.i( TAG, "createFragment" );
return null;
}
@Override
public void init( Context context ) {
ServiceMediaHandler.init( context );
mediaWindow2 = new MediaWindow2();
mediaWindow2.initMedia(context);
}
@Override
public String getModuleName() {
return MediaConstants.MODULE_TYPE;
}
@Override
public View createView( Context context ) {
// don't
return null;
}
@Override
public int getType() {
return ModuleType.TYPE_CARD_FRAGMENT;
}
@Override
public IMogoNaviListener getNaviListener() {
return null;
}
@Override
public IMogoModuleLifecycle getCardLifecycle() {
return null;
}
@Override
public IMogoMapListener getMapListener() {
return null;
}
@Override
public IMogoLocationListener getLocationListener() {
return null;
}
@Override
public IMogoMarkerClickListener getMarkerClickListener() {
return null;
}
@Override
public String getAppPackage() {
return "";
}
@Override
public String getAppName() {
return "";
}
@Override
public void onDestroy() {
if ( mediaWindow2 != null ) {
mediaWindow2.onDestroy();
}
mediaWindow2 = null;
}
}

View File

@@ -1,9 +0,0 @@
package com.mogo.module.media;
/**
* 卡片类型 name
*/
public class MediaConstants {
public static final String TAG = "/media/ui";
public static final String MODULE_TYPE = "CARD_TYPE_SHARE_MUSIC";
}

View File

@@ -1,206 +0,0 @@
package com.mogo.module.media;
import android.content.Context;
import com.alibaba.android.arouter.launcher.ARouter;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.map.location.IMogoLocationClient;
import com.mogo.map.marker.IMogoMarkerManager;
import com.mogo.map.navi.IMogoNavi;
import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.module.authorize.authprovider.invoke.AuthorizeConstant;
import com.mogo.module.authorize.authprovider.module.IMogoAuthorizeModuleManager;
import com.mogo.service.MogoServicePaths;
import com.mogo.service.adas.IMogoADASController;
import com.mogo.service.analytics.IMogoAnalytics;
import com.mogo.service.cardmanager.IMogoCardManager;
import com.mogo.service.datamanager.IMogoDataManager;
import com.mogo.service.imageloader.IMogoImageloader;
import com.mogo.service.impl.MogoServiceApis;
import com.mogo.service.intent.IMogoIntentManager;
import com.mogo.service.map.IMogoMapService;
import com.mogo.service.module.IMogoActionManager;
import com.mogo.service.module.IMogoMarkerService;
import com.mogo.service.module.IMogoRegisterCenter;
import com.mogo.service.network.IMogoNetwork;
import com.mogo.service.statusmanager.IMogoStatusManager;
import com.mogo.service.windowview.IMogoWindowManager;
import com.zhidao.carchattingprovider.ICarsChattingProvider;
/**
* <p>
* 持有服务接口实例
*/
public class ServiceMediaHandler {
private static MogoServiceApis mApis;
private static IMogoMapService mMapService;
private static IMogoLocationClient mLocationClient;
private static IMogoMarkerManager mMarkerManager;
private static IMogoMapUIController mMapUIController;
private static IMogoImageloader mImageloader;
private static IMogoNetwork mMogoNetWorkService;
private static IMogoWindowManager mMogoWindowManager;
private static IMogoCardManager mMogoCardManager;
private static IMogoAnalytics mMogoAnalytis;
private static IMogoRegisterCenter mMogoRegisterCenter;
private static IMogoIntentManager mMogoVoiceManager;
private static IMogoStatusManager mIMogoStatusManager;
private static IMogoNavi mMogoNavi;
private static IMogoDataManager mMogoDataManager;
private static IMogoActionManager mMogoActionManager;
private static IMogoADASController mMogoADASController;
private static IMogoAuthorizeModuleManager mMogoAuthorizeModuleManager;
private static IMogoMarkerService sMarkerService;
private static ICarsChattingProvider sCarsChattingProvider;
public static void init(Context context) {
mApis = (MogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(context);
mMapService = mApis.getMapServiceApi();
mImageloader = mApis.getImageLoaderApi();
mLocationClient = mMapService.getLocationClient(context);
mMarkerManager = mMapService.getMarkerManager(context);
mMapUIController = mMapService.getMapUIController();//zoomTo
mMogoNetWorkService = mApis.getNetworkApi();
mMogoWindowManager = mApis.getWindowManagerApi();
mMogoCardManager = mApis.getCardManagerApi();
mMogoAnalytis = mApis.getAnalyticsApi();
mMogoRegisterCenter = mApis.getRegisterCenterApi();
mMogoVoiceManager = mApis.getIntentManagerApi();
mIMogoStatusManager = mApis.getStatusManagerApi();
mMogoNavi = mMapService.getNavi( context );
mMogoDataManager = mApis.getDataManagerApi();
mMogoActionManager = mApis.getActionManagerApi();
mMogoADASController = mApis.getAdasControllerApi();
mMogoAuthorizeModuleManager = (IMogoAuthorizeModuleManager) ARouter.getInstance().build(AuthorizeConstant.PROVIDER_MODULE).navigation(context);
sMarkerService = mApis.getMarkerService();
sCarsChattingProvider = ARouter.getInstance().navigation( ICarsChattingProvider.class );
}
public static IMogoADASController getMogoADASController(){
isApisNull(mMogoADASController);
return mMogoADASController;
}
public static IMogoMapService getMapService() {
isApisNull(mMapService);
return mMapService;
}
public static IMogoLocationClient getLocationClient() {
isApisNull(mLocationClient);
return mLocationClient;
}
public static IMogoMarkerManager getMarkerManager() {
isApisNull(mMarkerManager);
return mMarkerManager;
}
public static IMogoMapUIController getMapUIController() {
isApisNull(mMapUIController);
return mMapUIController;
}
public static IMogoImageloader getImageloader() {
isApisNull(mImageloader);
return mImageloader;
}
public static IMogoNetwork getMogoNetWorkService(){
isApisNull(mMogoNetWorkService);
return mMogoNetWorkService;
}
public static IMogoWindowManager getMogoWindowManager() {
isApisNull(mMogoWindowManager);
return mMogoWindowManager;
}
public static IMogoCardManager getMogoCardManager() {
isApisNull(mMogoCardManager);
return mMogoCardManager;
}
public static IMogoAnalytics getMogoAnalytis() {
isApisNull(mMogoAnalytis);
return mMogoAnalytis;
}
/**
* 1 2 3 dev qa release
* @return
*/
public static int getCurrentEvent(){
return DebugConfig.getNetMode();
}
public static IMogoRegisterCenter getMogoRegisterCenter(){
isApisNull(mMogoRegisterCenter);
return mMogoRegisterCenter;
}
public static IMogoIntentManager getMogoVoiceManager(){
isApisNull(mMogoVoiceManager);
return mMogoVoiceManager;
}
public static IMogoStatusManager getIMogoStatusManager(){
isApisNull(mIMogoStatusManager);
return mIMogoStatusManager;
}
public static IMogoNavi getMogoNavi(){
isApisNull(mMogoNavi);
return mMogoNavi;}
public static IMogoDataManager getMogoDataManager(){
isApisNull(mMogoDataManager);
return mMogoDataManager;
}
public static MogoServiceApis getApis() {
return mApis;
}
/**
* 这个注册的第一个参数是模块名称,目的是只给当前显示的卡片分发事件
* @return
*/
public static IMogoActionManager getMogoctionManager(){
isApisNull(mMogoActionManager);
return mMogoActionManager;
}
public static IMogoAuthorizeModuleManager getMogoAuthorizeModuleManager(){
isApisNull(mMogoAuthorizeModuleManager);
return mMogoAuthorizeModuleManager;
}
public static boolean isObjStaticNull(Object object){
if (mApis == null || object == null){
return true;
}
return false;
}
public static IMogoMarkerService getMarkerService() {
isApisNull(sMarkerService);
return sMarkerService;
}
public static ICarsChattingProvider getCarsChattingApis() {
isApisNull( sCarsChattingProvider );
return sCarsChattingProvider;
}
public static void isApisNull( Object object){
if (isObjStaticNull(object)){
init(AbsMogoApplication.getApp());
}
}
}

View File

@@ -1,79 +0,0 @@
package com.mogo.module.media.api;
import com.mogo.commons.data.BaseData;
import com.mogo.module.common.entity.MarkerResponse;
import com.mogo.module.media.model.ShareLikeData;
import com.mogo.module.media.model.ShareMediaMarkerInfoData;
import com.mogo.module.media.model.ShareSuccessResult;
import com.mogo.module.media.model.ShowShareData;
import java.util.Map;
import io.reactivex.Observable;
import okhttp3.RequestBody;
import retrofit2.http.Body;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.Headers;
import retrofit2.http.POST;
import retrofit2.http.QueryMap;
import retrofit2.http.Url;
public interface MediaDztService {
/**
* 查询音频分享信息
*/
@GET("/sunflower/os/music/car/v1/selectByPrimaryKey")
Observable<ShareLikeData> selectByPrimaryKey(@QueryMap Map<String, Object> params);
/**
* 分享音乐
*/
@Headers({"Content-type:application/json;charset=UTF-8"})
@POST
Observable<ShareSuccessResult> shareMusic(@Url String url, @Body RequestBody body);
/**
* 好友分享的歌
*/
@GET("/sunflower/os/music/car/v1/getFriendsMusic")
Observable<ShareMediaMarkerInfoData> getFriendShareMusic(@QueryMap Map<String, Object> params);
/**
* 是否需要触发分享
*/
@GET("/sunflower/os/music/car/v1/checkShare")
Observable<ShowShareData> getShouldPushShare(@QueryMap Map<String, Object> params);
/**
* 开始音乐
*/
@FormUrlEncoded
@POST("/yycp-launcherSnapshot/mediaShare/mediaStart")
Observable<BaseData> startedMusic(@FieldMap Map<String, Object> params );
/**
* 停止音乐
*/
@FormUrlEncoded
@POST("/yycp-launcherSnapshot/mediaShare/mediaPause")
Observable<BaseData> stopMusic(@FieldMap Map<String, Object> params );
/**
* 点赞分享
*/
@Headers({"Content-type:application/json;charset=UTF-8"})
@POST
Observable<BaseData> likeShare(@Url String url, @Body RequestBody body);
/**
* 获取附近分享的歌传入一个type单独拉取模块的markerdata
*/
@FormUrlEncoded
@POST("/yycp-launcherSnapshot/launcherSnapshot/querySnapshotSync")
Observable<MarkerResponse> getNearShareMusic(@FieldMap Map<String, Object> params );
}

View File

@@ -1,12 +0,0 @@
package com.mogo.module.media.constants;
public interface BaseUrlConstants {
String DEV_BASE_URL = "http://dzt-dev.zhidaohulian.com";
String QA_BASE_URL = "http://dzt-test.zhidaozhixing.com";
String SHOW_BASE_URL = "http://dzt-show.zhidaozhixing.com";
String RELEASE_BASE_URL = "http://dzt.zhidaohulian.com";
String SHARE_MUSIC_URL = "/sunflower/os/music/car/v1/osMusiceShare";
String SHARE_MUSIC_LIKE_URL = "/sunflower/os/music/car/v1/likedShareMusic";
}

View File

@@ -1,18 +0,0 @@
package com.mogo.module.media.constants;
public interface Constants {
int ONE_KB = 1024;
int ONE_MB = ONE_KB * 1024;
int SIZE_DEFAULT = 2048;
int SIZE_LIMIT = 2048;
String IMAGE_COMPRESS_PATH = "image/compress/";
//storage
String SHOW_SHARE_PUSH_TIME = "show_share_push_time";
//his music
String LAST_TIME_LISTEN_MEDIA_MUSIC = "last_time_listen_media_music";
String MEDIA_UNIQUE_NAME = "media_unique_name";
}

View File

@@ -1,28 +0,0 @@
package com.mogo.module.media.constants;
public interface EventConstants {
String EVENT_QQ_OPEN_SHARE_DIALOG_SHOW = "card_QQMusic_pop";//打开分享弹窗 type 1、click2、小智语音
String EVENT_QQ_SHARE_DIALOG_OK = "card_QQMusic_affirm";//弹窗内选择“确认”
String EVENT_QQ_SHARE_DIALOG_CANCLE = "card_QQMusic_close";//弹窗内选择“取消”
String EVENT_QQ_MUSIC_START = "QQMusicBegin";// 音乐开始 type 1、click2、小智语音3、卡片
String EVENT_QQ_MUSIC_PAUSE = "QQMusicSuspend";// 音乐暂停 type 1、click2、小智语音3、卡片
String EVENT_QQ_LAST_PLAY = "QQMusicTheLast";//qq音乐上一章 type 1、click2、小智语音3、卡片
String EVENT_QQ_Next_PLAY = "QQMusicNext";//qq音乐下一章 type 1、click2、小智语音3、卡片
String EVENT_BOOK_OPEN_SHARE_DIALOG_SHOW = "card_Book_pop";//打开分享弹窗 type 1、click2、小智语音
String EVENT_BOOK_SHARE_DIALOG_OK = "card_Book_affirm";//弹窗内选择“确认”
String EVENT_BOOK_SHARE_DIALOG_CANCLE = "card_Book_close";//弹窗内选择“取消”
String EVENT_BOOK_MUSIC_START = "BookBegin";// 书开始 type 1、click2、小智语音3、卡片
String EVENT_BOOK_MUSIC_PAUSE = "BookSuspend";// 书暂停 type 1、click2、小智语音3、卡片
String EVENT_BOOK_LAST_PLAY = "BookTheLast";//懒人听书上一章 type 1、click2、小智语音3、卡片
String EVENT_BOOK_Next_PLAY = "BookNext";//懒人听书下一章 type 1、click2、小智语音3、卡片
String EVENT_NEWS_OPEN_SHARE_DIALOG_SHOW = "card_News_pop";//打开分享弹窗 type 1、click2、小智语音
String EVENT_NEWS_SHARE_DIALOG_OK = "card_News_affirm";//弹窗内选择“确认”
String EVENT_NEWS_SHARE_DIALOG_CANCLE = "card_News_close";//弹窗内选择“取消”
String EVENT_NEWS_MUSIC_START = "NewsBegin";// 新闻开始 type 1、click2、小智语音3、卡片
String EVENT_NEWS_MUSIC_PAUSE = "NewsSuspend";// 新闻暂停 type 1、click2、小智语音3、卡片
String EVENT_NEWS_LAST_PLAY = "NewsTheLast";//新闻上一章 type 1、click2、小智语音3、卡片
String EVENT_NEWS_Next_PLAY = "NewsNext";//新闻下一章 type 1、click2、小智语音3、卡片
}

View File

@@ -1,13 +0,0 @@
package com.mogo.module.media.constants;
public interface LeTingFieldConstants {
String curTime = "curTime";//当前播放时长
String maxTime = "maxTime";//书籍总时长
String type = "type";//2 为书籍听书3 为新闻 1 qq音乐
String mediaName = "mediaName";//新书标题,新闻标题
String artist = "artist";//新书来源,新闻来源
String cover = "cover";//作者封面,封面
String bookName = "bookName";//书籍名
String playState = "playState";//1 播放 2 缓冲 0 暂停/停止 -1 播放错误
String bookInfo = "bookInfo";//书本实例
}

View File

@@ -1,13 +0,0 @@
package com.mogo.module.media.constants;
/**
* 音频相关常量
*
* @author tongchenfei
*/
public class MusicConstant {
public static final int PLAY_STATE_PLAYING = 1;
public static final int PLAY_STATE_BUFF = 2;
public static final int PLAY_STATE_PAUSE_OR_STOP = 0;
public static final int PLAY_STATE_ERROR = -1;
}

View File

@@ -1,18 +0,0 @@
package com.mogo.module.media.constants;
public interface QQMusicFieldConstants {
String curTime = "curTime";//当前播放时长
String maxTime = "maxTime";//书籍总时长
String type = "type";//2 为书籍听书3 为新闻,1 为qq音乐
String mediaName = "mediaName";//歌曲名
String playState = "playState";//1 播放 2 缓冲 0 暂停/停止 -1 播放错误
String mediaUrl = "mediaUrl";//音乐url
String mediaSinger = "mediaSinger";//歌手名
String mediaImgUrl = "mediaImgUrl";//封面
String mediaType = "mediaType";//歌曲类别
String mediaMid = "mediaMid";//song mid
String isLocalMedia = "isLocalMedia";//是否是本地歌曲
String mediaPlayMode = "mediaPlayMode";//播放模式
String mediaAlbumName = "mediaAlbumName";//专辑名
}

View File

@@ -1,50 +0,0 @@
package com.mogo.module.media.constants;
public interface VoiceConstants {
String SHARE_QQ_MUSIC = "确认分享该歌曲,你可对我说确认或取消";
String SHARE_LANREN_MUSIC = "确认分享本书,你可对我说确认或取消";
String SHARE_LETINGNES_MUSIC = "确认分享新闻,你可对我说确认或取消";
String COMMAND_SHARE_MUSIC_PUSH_MESSAGE ="可把歌曲,书籍,新闻分享给附近的车友,语音回复分享即可分享";
String[] COMMAND_SHARE_MUSIC_PUSH_MESSAGE_OK = {"分享"};
String[] COMMAND_SHARE_MUSIC_PUSH_MESSAGE_CANCEL = { "不分享"};
String[] COMMAND_NO_WAKEUP_MUSIC_SHARE = {"分享歌曲","分享音乐","分享这首歌","帮我分享一下这个歌","把这首歌分享一下"};
String COMMAND_NO_WAKEUP_SHARE_MUSIC_CMD = "media_card_music_no_wake_share";
String[] COMMAND_NO_WAKEUP_BOOK_SHARE = {"分享书","分享这本书","帮我分享一下这本书","把这本书分享一下"};
String COMMAND_NO_WAKEUP_SHARE_BOOK_CMD = "media_card_book_no_wake_share";
String[] COMMAND_NO_WAKEUP_NEWS_SHARE = {"分享新闻","分享这条新闻","把这条新闻分享一下","帮我分享一下这条新闻"};
String COMMAND_NO_WAKEUP_SHARE_NEWS_CMD = "media_card_news_no_wake_share";
String[] COMMAND_NO_WAKEUP_BOOK_MUSIC_SHARE = {"分享"};
String COMMAND_NO_WAKEUP_SHARE_BOOK_MUSIC_CMD = "media_card_book_music_no_wake_share";
String[] COMMAND_SHARE_MUSIC_OK = {"确认", "","分享"};
String[] COMMAND_NO_SHARE_MUSIC_CANCEL = {"取消", "不分享"};
String[] COMMAND_OPEN_MUSIC = {"**打开**音乐**","打开音乐","帮我打开一下音乐好不好","打开一下音乐好不好","帮我打开音乐","打开音乐谢谢"};
String COMMAND_OPEN_MUSIC_CMD = "media_card_open_music";
String[] COMMAND_CLOSE_MUSIC = {"**关闭**音乐**","关闭音乐","退出音乐","帮我关闭一下音乐好不好","关闭一下音乐好不好","帮我关闭音乐","关闭那个音乐","关闭音乐谢谢"};
String COMMAND_CLOSE_MUSIC_CMD = "media_card_close_music";
String[] COMMAND_NEAR_MUSIC = {"附近的歌","附近的人听的歌","附近的人听的音乐","周围的人听的歌","周围的人听的音乐"};
String COMMAND_NEAR_MUSIC_CMD = "media_card_near_music";
String[] COMMAND_FRIEND_MUSIC = {"好友听的歌","好友听的音乐","播放好友的歌","放好友的歌","听好友的歌","播放好友的音乐","放好友的音乐","听好友的音乐"};
String COMMAND_FRIEND_MUSIC_CMD = "media_card_friend_music";
String[] COMMAND_QUERY_MUSIC_NAME = {"这歌是什么","这歌叫啥","这首歌叫什么名字","歌名是什么","这首歌的名字","这首音乐叫什么","这个歌是啥"};
String COMMAND_QUERY_MUSIC_NAME_CMD = "media_card_query_music_name";
String[] COMMAND_QUERY_MUSIC_SINGER = {"这首歌是谁唱的","这歌谁唱的","这首歌的歌手","这首歌的歌手是谁","查一下这首歌的歌手"};
String COMMAND_QUERY_MUSIC_SINGERME_CMD = "media_card_query_music_singer";
String[] COMMAND_SHARE_DIALOG_TIMEOUT_CLOSE = {"关闭","取消","关闭分享","取消分享","关闭弹窗","取消弹窗","不分享"};
String COMMAND_SHARE_DIALOG_TIMEOUT_CLOSE_COMMAND = "share_dialog_timeout_close_command";
String[] COMMAND_SHARE_DIALOG_TIMEOUT_OK = {"确认","确定","分享","确认分享","确定分享"};
String COMMAND_SHARE_DIALOG_TIMEOUT_OK_COMMAND = "share_dialog_timeout_confirm_command";
}

View File

@@ -1,121 +0,0 @@
package com.mogo.module.media.dialog;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import androidx.annotation.Nullable;
import androidx.fragment.app.DialogFragment;
import com.mogo.utils.TipToast;
public abstract class BaseDialogFragment extends DialogFragment {
protected Bundle mBundle;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mBundle = savedInstanceState == null ? getArguments() : savedInstanceState;
if (mBundle == null) {
mBundle = new Bundle();
}
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
}
@Override
public void onSaveInstanceState(Bundle outState) {
if (mBundle != null) {
outState.putAll(mBundle);
}
super.onSaveInstanceState(outState);
}
public void openActivity(Class<? extends Activity> cls) {
openActivity(cls, null);
}
public void openActivity(Class<? extends Activity> cls, Bundle bundle) {
Intent intent = new Intent();
if (bundle != null) {
intent.putExtras(bundle);
}
intent.setClass(getActivity(), cls);
startActivity(intent);
}
public void openActivity(String url, Bundle bundle) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
if (bundle != null) {
intent.putExtras(bundle);
}
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
startActivity(intent);
}
public void openActivityForResult(Class<? extends Activity> cls, Bundle bundle, int requestCode) {
Intent intent = new Intent();
if (bundle != null) {
intent.putExtras(bundle);
}
intent.setClass(getActivity(), cls);
startActivityForResult(intent, requestCode);
}
public void backForResult(int resultCode, Bundle bundle) {
Intent intent = new Intent();
if (bundle != null) {
intent.putExtras(bundle);
}
getActivity().setResult(resultCode, intent);
getActivity().finish();
}
public void backToActivity(Class<? extends Activity> cls, Bundle bundle) {
Intent intent = new Intent();
if (bundle != null) {
intent.putExtras(bundle);
}
intent.setClass(getActivity(), cls);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
startActivity(intent);
}
@Override
public Context getContext() {
return super.getContext();
}
public boolean isVisibleToUser() {
return isResumed();
}
public void showToast(CharSequence toast) {
TipToast.shortTip(toast.toString());
}
public void showInputMethod(View view) {
if (getContext() == null) return;
InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
if (imm != null) {
imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
}
}
public void hideInputMethod(View view) {
if (getContext() == null) return;
InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
if (imm != null) {
imm.hideSoftInputFromWindow(view.getWindowToken(),InputMethodManager.HIDE_NOT_ALWAYS);
}
}
}

View File

@@ -1,229 +0,0 @@
package com.mogo.module.media.dialog;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.text.TextUtils;
import android.text.method.LinkMovementMethod;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.View;
import android.widget.TextView;
import androidx.annotation.NonNull;
import com.mogo.module.media.R;
public class CustomDialog extends Dialog {
TextView txtOk;
TextView txtCancel;
TextView txtTitle;
TextView txtContent;
TextView txtSubContent;
private int mContentSize = 0;
private int mContentColor = 0;
private int mBtnSize = 0;
private int mSubContentSize = 0;
private int mContentLeftPadding = 0;
private View.OnClickListener onOkListener, onCancelListener;
private String title, subContent, okText, cancelText;
private CharSequence content;
private boolean isAutoDismissDialog = true;
private int contentGravity = Gravity.CENTER;
private int subContentGravity = Gravity.LEFT;
private boolean isContentClickSpanEnable = false;
public CustomDialog(@NonNull Context context) {
super(context);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.module_media_dialog_cutom_layout);
initView();
if (TextUtils.isEmpty(title)) {
txtTitle.setVisibility(View.GONE);
} else {
txtTitle.setText(title);
txtTitle.setVisibility(View.VISIBLE);
}
if (mContentSize > 0){
txtContent.setTextSize(TypedValue.COMPLEX_UNIT_PX,mContentSize);
}
if (mSubContentSize > 0){
txtSubContent.setTextSize(TypedValue.COMPLEX_UNIT_PX,mSubContentSize);
}
if (mContentColor > 0){
txtContent.setTextColor(mContentColor);
}
if (mContentLeftPadding > 0){
txtContent.setPadding(mContentLeftPadding,0,mContentLeftPadding,0);
}
if ( content instanceof String) {
content = ( (String) content ).replace( "\\n", "\n" );
}
txtContent.setText(content);
if (TextUtils.isEmpty(subContent)) {
txtSubContent.setVisibility(View.GONE);
} else {
txtSubContent.setVisibility(View.VISIBLE);
txtSubContent.setText(subContent);
}
txtSubContent.setGravity(subContentGravity);
if (mBtnSize > 0){
txtOk.setTextSize(TypedValue.COMPLEX_UNIT_PX,mBtnSize);
txtCancel.setTextSize(TypedValue.COMPLEX_UNIT_PX,mBtnSize);
}
if (!TextUtils.isEmpty(okText)) {
txtOk.setVisibility(View.VISIBLE);
txtOk.setText(okText);
} else {
txtOk.setVisibility(View.GONE);
}
if (!TextUtils.isEmpty(cancelText)) {
txtCancel.setVisibility(View.VISIBLE);
txtCancel.setText(cancelText);
} else {
txtCancel.setVisibility(View.GONE);
}
txtOk.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (isAutoDismissDialog) {
dismiss();
}
if (onOkListener != null) {
onOkListener.onClick(v);
}
}
});
txtCancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (isAutoDismissDialog) {
dismiss();
}
if (onCancelListener != null) {
onCancelListener.onClick(v);
}
}
});
txtContent.setGravity( contentGravity );
if ( isContentClickSpanEnable ) {
txtContent.setMovementMethod( LinkMovementMethod.getInstance() );
}
}
private void initView() {
txtOk = findViewById(R.id.txt_ok);
txtCancel = findViewById(R.id.txt_cancel);
txtTitle = findViewById(R.id.txt_title);
txtContent = findViewById(R.id.txt_content);
txtSubContent = findViewById(R.id.txt_sub_content);
}
public void setTitle(String title) {
this.title = title;
}
public void setContent(CharSequence content) {
this.content = content;
}
public void setSubContent(String subContent) {
this.subContent = subContent;
}
public void setContentGravity(int gravity) {
contentGravity = gravity;
}
public void hiddenBtnCancel() {
txtCancel.setVisibility(View.GONE);
}
public void setOnOkClickListener(String okText, View.OnClickListener onOkClickListener) {
this.okText = okText;
this.onOkListener = onOkClickListener;
}
public void setOnOkClickListener(View.OnClickListener onOkClickListener) {
setOnOkClickListener("确定", onOkClickListener);
}
public void setOnCancelListener(String cancelText, View.OnClickListener onCancelListener) {
this.cancelText = cancelText;
this.onCancelListener = onCancelListener;
}
public void setOnCancelListener(View.OnClickListener onCancelListener) {
setOnCancelListener("取消", onCancelListener);
}
public void setAutoDismissDialog(boolean autoDismissDialog) {
isAutoDismissDialog = autoDismissDialog;
}
public void setBtnTextSize(int size){
mBtnSize = size;
}
public void setContentTextSize(int size){
mContentSize = size;
}
public void setSubContentTextSize(int size){
mSubContentSize = size;
}
public void setContentColor(int color){
mContentColor = color;
}
public int getContentGravity() {
return contentGravity;
}
public int getSubContentGravity() {
return subContentGravity;
}
public void setSubContentGravity(int subContentGravity) {
this.subContentGravity = subContentGravity;
}
public void setContentClickSpanEnable(boolean contentClickSpanEnable ) {
isContentClickSpanEnable = contentClickSpanEnable;
}
public int getContentLeftPadding() {
return mContentLeftPadding;
}
public void setContentLeftPadding(int mContentLeftPadding) {
this.mContentLeftPadding = mContentLeftPadding;
}
}

View File

@@ -1,445 +0,0 @@
package com.mogo.module.media.dialog;
import android.app.Dialog;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Resources;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.mogo.commons.network.ParamsProvider;
import com.mogo.commons.network.ParamsUtil;
import com.mogo.commons.network.SubscribeImpl;
import com.mogo.commons.voice.AIAssist;
import com.mogo.commons.voice.IMogoVoiceCmdCallBack;
import com.mogo.map.location.MogoLocation;
import com.mogo.module.common.entity.MarkerShareMusic;
import com.mogo.module.media.MediaConstants;
import com.mogo.module.media.R;
import com.mogo.module.media.ServiceMediaHandler;
import com.mogo.module.media.api.MediaDztService;
import com.mogo.module.media.constants.BaseUrlConstants;
import com.mogo.module.media.constants.EventConstants;
import com.mogo.module.media.constants.VoiceConstants;
import com.mogo.module.media.listener.MogoVoiceCmdCallBackImp;
import com.mogo.module.media.model.MediaInfoData;
import com.mogo.module.media.model.ShareSuccessResult;
import com.mogo.module.media.utils.BaseUrlManager;
import com.mogo.module.media.utils.MediaAnalyticsUtils;
import com.mogo.module.media.utils.ToastHelper;
import com.mogo.module.media.widget.RoundedImageView;
import com.mogo.utils.TipToast;
import com.mogo.utils.glide.GlideApp;
import com.mogo.utils.logger.Logger;
import com.mogo.utils.network.RequestOptions;
import java.util.HashMap;
import java.util.Map;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
/**
* media 分享dialog
*/
public class MediaShareDialogFragment extends BaseDialogFragment {
private Disposable mDisposable;
private Context context;
private Callback callback;
private RoundedImageView mMediaImg;
private TextView mMediaName;
private TextView mMediaSinger;
private TextView mOk;
private TextView mCancel;
private TextView mDialogContent;
private MediaInfoData mMediaInfoData;
private VoiceCallBack voiceCallBack = new VoiceCallBack();
private boolean shareSuccess = false;
private MarkerShareMusic markerShareMusic;
private boolean navi = false;
private ShareOkReceiver mShareOkReceiver;
public interface Callback {
void onShareDialogShow();
void onShareDialogDismiss(boolean success,MarkerShareMusic markerShareMusic);
}
public static final String TAG = "MediaShareDialogFragment";
public static MediaShareDialogFragment newInstance(MediaInfoData data,boolean navi) {
Bundle args = new Bundle();
args.putSerializable("data", data);
args.putBoolean("navi",navi);
MediaShareDialogFragment fragment = new MediaShareDialogFragment();
fragment.setArguments(args);
return fragment;
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
this.context = context;
if (getParentFragment() instanceof Callback) {
callback = ((Callback) getParentFragment());
} else if (context instanceof Callback) {
callback = ((Callback) context);
}
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
final Dialog dialog = getDialog();
if (dialog != null) {
dialog.setCanceledOnTouchOutside(false);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
if (dialog.getWindow() != null) {
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(0));
}
}
return inflater.inflate(R.layout.module_media_share_fragment_view, null);
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
if (callback != null) {
callback.onShareDialogShow();
}
try {
mMediaInfoData = (MediaInfoData) getArguments().getSerializable("data");
navi = getArguments().getBoolean("navi");
} catch (Exception e) {
e.printStackTrace();
}
initViews();
registerMediaReceiver();
registerCloseNoWakeUp();
}
private class VoiceCallBack implements IMogoVoiceCmdCallBack {
@Override
public void onCmdSelected(String cmd) {
}
@Override
public void onCmdAction(String speakText) {
//确认
shareMusic(mMediaInfoData,false);
Logger.d("MediaShareDialogFragment","qa onCmdAction"+speakText);
}
@Override
public void onCmdCancel(String speakText) {
//取消
dissMisDialog(false);
Logger.d("MediaShareDialogFragment","qa onCmdCancel");
}
@Override
public void onSpeakEnd(String speakText) {
Logger.d("MediaShareDialogFragment","qa onSpeakEnd");
}
@Override
public void onSpeakSelectTimeOut(String speakText) {
if (!navi) registerCloseNoWakeUp();
Logger.d("MediaShareDialogFragment","qa onSpeakSelectTimeOut");
}
}
private void registerMediaReceiver() {
mShareOkReceiver = new ShareOkReceiver();
IntentFilter filterone = new IntentFilter();
filterone.addAction("com.zhidao.speech.awake.notify");
getContext().registerReceiver(mShareOkReceiver, filterone);
}
private void unRegisterMediaReceiver() {
try {
getContext().unregisterReceiver(mShareOkReceiver);
} catch (Exception e) {
e.printStackTrace();
}
}
private class ShareOkReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
try {
if (intent != null){
String cmdStr = intent.getStringExtra("command");
if(cmdStr.equals("com.zhidao.multiMedia.share.comfirm")){
shareMusic(mMediaInfoData,false);
}else if (cmdStr.equals("com.zhidao.multiMedia.share.cancel")){
dissMisDialog(false);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
private void registerCloseNoWakeUp() {
AIAssist.getInstance(getActivity()).registerUnWakeupCommand(VoiceConstants.COMMAND_SHARE_DIALOG_TIMEOUT_CLOSE_COMMAND
, VoiceConstants.COMMAND_SHARE_DIALOG_TIMEOUT_CLOSE
,new MogoVoiceCmdCallBackImp(){
@Override
public void onCmdSelected(String cmd) {
super.onCmdSelected(cmd);
if (cmd.equals(VoiceConstants.COMMAND_SHARE_DIALOG_TIMEOUT_CLOSE_COMMAND)){
dismissAllowingStateLoss();
}
Logger.d("MediaShareDialogFragment","registerUnWakeupCommand onCmdSelected");
}
@Override
public void onSpeakEnd(String speakText) {
super.onSpeakEnd(speakText);
Logger.d("MediaShareDialogFragment","registerUnWakeupCommand onSpeakEnd"+speakText);
}
@Override
public void onSpeakSelectTimeOut(String speakText) {
super.onSpeakSelectTimeOut(speakText);
Logger.d("MediaShareDialogFragment","registerUnWakeupCommand onSpeakSelectTimeOut");
}
});
AIAssist.getInstance(getActivity()).registerUnWakeupCommand(VoiceConstants.COMMAND_SHARE_DIALOG_TIMEOUT_OK_COMMAND
, VoiceConstants.COMMAND_SHARE_DIALOG_TIMEOUT_OK
,new MogoVoiceCmdCallBackImp(){
@Override
public void onCmdSelected(String cmd) {
super.onCmdSelected(cmd);
if (cmd.equals(VoiceConstants.COMMAND_SHARE_DIALOG_TIMEOUT_OK_COMMAND)){
shareMusic(mMediaInfoData,false);
}
}
@Override
public void onSpeakEnd(String speakText) {
super.onSpeakEnd(speakText);
}
@Override
public void onSpeakSelectTimeOut(String speakText) {
super.onSpeakSelectTimeOut(speakText);
}
});
}
private void initViews() {
mMediaImg = getView().findViewById(R.id.media_img);
mMediaName = getView().findViewById(R.id.media_name);
mMediaSinger = getView().findViewById(R.id.media_singer);
mOk = getView().findViewById(R.id.txt_ok);
mCancel = getView().findViewById(R.id.txt_cancle);
mDialogContent = getView().findViewById(R.id.media_dialog_content);
mCancel.setOnClickListener(view -> {
dissMisDialog(true);
});
mOk.setOnClickListener(view -> {
shareMusic(mMediaInfoData,true);
});
if (mMediaInfoData != null) {
if (mMediaInfoData.getMediaImg() != null) {
com.bumptech.glide.request.RequestOptions options = new com.bumptech.glide.request.RequestOptions()
.placeholder(R.drawable.module_media_share_default_rect_icon);
GlideApp.with(getActivity()).applyDefaultRequestOptions(options).load(mMediaInfoData.getMediaImg()).into(mMediaImg);
}
if (mMediaInfoData.getMediaName() != null) {
mMediaName.setText(mMediaInfoData.getMediaName());
}
if (mMediaInfoData.getMediaSinger() != null) {
mMediaSinger.setText(mMediaInfoData.getMediaSinger());
}
if (mMediaInfoData.getType() == 1) {
mDialogContent.setText(context.getResources().getString(R.string.module_media_share_qq_music));
} else if (mMediaInfoData.getType() == 2){
mDialogContent.setText(context.getResources().getString(R.string.module_media_share_lan_ren));
} else if (mMediaInfoData.getType() == 3){
mDialogContent.setText(context.getResources().getString(R.string.module_media_share_le_ting_news));
}
}
}
private void dissMisDialog(boolean click) {
dismissAllowingStateLoss();
try {
if (mMediaInfoData != null){
HashMap<String, Object> hashMap = new HashMap<>();
hashMap.put("type",click ?1:2);
String trackId = "";
if (mMediaInfoData.getType() == 1){
trackId = EventConstants.EVENT_QQ_SHARE_DIALOG_CANCLE;
}else if (mMediaInfoData.getType() == 2){
trackId = EventConstants.EVENT_BOOK_SHARE_DIALOG_CANCLE;
}else if (mMediaInfoData.getType() == 3){
trackId = EventConstants.EVENT_NEWS_SHARE_DIALOG_CANCLE;
}
MediaAnalyticsUtils.track(trackId ,hashMap);
}
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void onDismiss(DialogInterface dialog) {
super.onDismiss(dialog);
try {
unRegisterMediaReceiver();
AIAssist.getInstance(getActivity()).unregisterUnWakeupCommand(VoiceConstants.COMMAND_SHARE_DIALOG_TIMEOUT_CLOSE_COMMAND);
AIAssist.getInstance(getActivity()).unregisterUnWakeupCommand(VoiceConstants.COMMAND_SHARE_DIALOG_TIMEOUT_OK_COMMAND);
if (mDisposable != null && !mDisposable.isDisposed()) {
mDisposable.dispose();
}
if (callback != null) {
callback.onShareDialogDismiss(shareSuccess,markerShareMusic);
}
} catch (Exception e) {
e.printStackTrace();
}
}
private void shareMusic(MediaInfoData mCurrentMusic,boolean click) {
if (mCurrentMusic == null) return;
markerShareMusic = new MarkerShareMusic();
try {
if (mMediaInfoData != null){
HashMap<String, Object> hashMap = new HashMap<>();
hashMap.put("type",click ? 1:2);
String trackId = "";
if (mMediaInfoData.getType() == 1){
trackId = EventConstants.EVENT_QQ_SHARE_DIALOG_OK;
}else if (mMediaInfoData.getType() == 2){
trackId = EventConstants.EVENT_BOOK_SHARE_DIALOG_OK;
}else if (mMediaInfoData.getType() == 3){
trackId = EventConstants.EVENT_NEWS_SHARE_DIALOG_OK;
}
MediaAnalyticsUtils.track(trackId ,hashMap);
}
} catch (Exception e) {
e.printStackTrace();
}
final Map<String, Object> businessParams = new HashMap<>();
final MogoLocation location = ServiceMediaHandler.getLocationClient().getLastKnowLocation();
if (location != null) {
businessParams.put("address", location.getAddress());
}
businessParams.put("bookInfo", mCurrentMusic.getBookInfo());
businessParams.put("mediaDuration", mCurrentMusic.getMaxTime() + "");
businessParams.put("mediaId", mCurrentMusic.getMediaId());
businessParams.put("mediaImg", mCurrentMusic.getMediaImg());
businessParams.put("mediaName", mCurrentMusic.getMediaName());
businessParams.put("mediaSinger", mCurrentMusic.getMediaSinger());
businessParams.put("mediaType", mCurrentMusic.getMediaType());
businessParams.put("mediaUrl", mCurrentMusic.getMediaUrl());
businessParams.put("shareType", mCurrentMusic.getType());
ParamsProvider.Builder builder = new ParamsProvider.Builder(getContext());
if (location != null) {
builder.append("lat", location.getLatitude());
builder.append("lng", location.getLongitude());
}else{
TipToast.shortTip("分享失败,定位出错请重试!");
shareSuccess = false;
dismissAllowingStateLoss();
return;
}
final Map<String, Object> params = builder
.append(businessParams)
.build();
Observable<ShareSuccessResult> observable = ServiceMediaHandler.getMogoNetWorkService().create(MediaDztService.class, BaseUrlManager.getDztBaseUrl())
.shareMusic(ParamsUtil.toQueryUrl(BaseUrlManager.getDztBaseUrl() + BaseUrlConstants.SHARE_MUSIC_URL, params, businessParams), ParamsUtil.convert(businessParams));
observable
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new SubscribeImpl<ShareSuccessResult>(RequestOptions.create(getContext())) {
@Override
public void onSubscribe(Disposable d) {
mDisposable = d;
}
@Override
public void onSuccess(ShareSuccessResult resultData) {
try {
ToastHelper.showShortSuccess(getContext(), getContext().getResources().getString(R.string.module_media_share_success));
if (!navi) AIAssist.getInstance(getActivity()).speakTTSVoice(getContext().getResources().getString(R.string.module_media_share_success),null);
shareSuccess = true;
if (resultData != null && resultData.result != null){
markerShareMusic = resultData.result;
markerShareMusic.setType(MediaConstants.MODULE_TYPE);
}
dismissAllowingStateLoss();
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void onError(Throwable e) {
super.onError(e);
try {
ToastHelper.showShortError(getContext(), getContext().getResources().getString(R.string.module_media_share_fail));
TipToast.shortTip("分享失败");
if (!navi)AIAssist.getInstance(getActivity()).speakTTSVoice(getContext().getResources().getString(R.string.module_media_share_fail),null);
dismissAllowingStateLoss();
} catch (Exception ex) {
ex.printStackTrace();
}
}
@Override
public void onError(String message, int code) {
super.onError(message, code);
try {
ToastHelper.showShortError(getContext(), getContext().getResources().getString(R.string.module_media_share_fail));
TipToast.shortTip(!TextUtils.isEmpty(message)?message:"分享失败");
if (!navi)AIAssist.getInstance(getActivity()).speakTTSVoice(!TextUtils.isEmpty(message)?message:"分享失败",null);
dismissAllowingStateLoss();
} catch (Exception e) {
e.printStackTrace();
}
}
}
);
}
}

View File

@@ -1,30 +0,0 @@
package com.mogo.module.media.listener;
import com.mogo.commons.voice.IMogoVoiceCmdCallBack;
public abstract class MogoVoiceCmdCallBackImp implements IMogoVoiceCmdCallBack {
@Override
public void onCmdSelected(String cmd) {
}
@Override
public void onCmdAction(String speakText) {
}
@Override
public void onCmdCancel(String speakText) {
}
@Override
public void onSpeakEnd(String speakText) {
}
@Override
public void onSpeakSelectTimeOut(String speakText) {
}
}

View File

@@ -1,24 +0,0 @@
package com.mogo.module.media.listener;
import android.view.View;
public abstract class NoDoubleClickListener implements View.OnClickListener {
public static final int MIN_CLICK_DELAY_TIME = 700;
private long lastClickTime = 0;
@Override
public void onClick(View v) {
long currentTime = System.currentTimeMillis();
if ((currentTime - lastClickTime) > MIN_CLICK_DELAY_TIME) {
lastClickTime = currentTime;
onClicks(v);
}
}
public abstract void onClicks(View view);
}

View File

@@ -1,100 +0,0 @@
package com.mogo.module.media.model;
import java.io.Serializable;
public class LanRenInsertData implements Serializable {
/**
* announcer : 动之以情
* auth : 耗子扛大刀
* bookId : 28862
* cover : http://bookpic.lrts.me/b8d33429fa0840578207c1685e8fa22a_180x254.jpg
* desc : 传说中的兵之王者,神秘莫测的杀手之王,带着仇恨与疑惑进入都市寻找仇敌!
* isCollect : false
* name : 特种军医在都市
* sections : 447
* typeName : 都市传说
*/
private String announcer;
private String auth;
private int bookId;
private String cover;
private String desc;
private boolean isCollect;
private String name;
private int sections;
private String typeName;
public String getAnnouncer() {
return announcer;
}
public void setAnnouncer(String announcer) {
this.announcer = announcer;
}
public String getAuth() {
return auth;
}
public void setAuth(String auth) {
this.auth = auth;
}
public int getBookId() {
return bookId;
}
public void setBookId(int bookId) {
this.bookId = bookId;
}
public String getCover() {
return cover;
}
public void setCover(String cover) {
this.cover = cover;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public boolean isIsCollect() {
return isCollect;
}
public void setIsCollect(boolean isCollect) {
this.isCollect = isCollect;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getSections() {
return sections;
}
public void setSections(int sections) {
this.sections = sections;
}
public String getTypeName() {
return typeName;
}
public void setTypeName(String typeName) {
this.typeName = typeName;
}
}

View File

@@ -1,130 +0,0 @@
package com.mogo.module.media.model;
import java.io.Serializable;
public class LeTingNewsData implements Serializable {
/**
* catalog_id : channel_recommend
* catalog_name : 推荐
* title : 内蒙古:妈妈去武汉打“怪兽”
* hms : 02:20
* image : https://image.leting.io/a066db4d5c615605e79c3235d9f54669.jpg
* sid : Pfzgptk29ZG86N0JStE5l-1srtNmDnAwBBLMCm-2l7QvQAP7vq0G_Jlm6YM8z9kHb97sJVd5mJ_2zW5EWtahbQ==
* source : 北京您早
* source_icon : https://image.leting.io/a77d7b23030e49007c148a563c386dbe.jpg
* pub_time : 0
* updated_at : 0
* duration : 140
* hot : 0
*/
private String catalog_id;
private String catalog_name;
private String title;
private String hms;
private String image;
private String sid;
private String source;
private String source_icon;
private int pub_time;
private int updated_at;
private int duration;
private int hot;
public String getCatalog_id() {
return catalog_id;
}
public void setCatalog_id(String catalog_id) {
this.catalog_id = catalog_id;
}
public String getCatalog_name() {
return catalog_name;
}
public void setCatalog_name(String catalog_name) {
this.catalog_name = catalog_name;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getHms() {
return hms;
}
public void setHms(String hms) {
this.hms = hms;
}
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
public String getSid() {
return sid;
}
public void setSid(String sid) {
this.sid = sid;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
public String getSource_icon() {
return source_icon;
}
public void setSource_icon(String source_icon) {
this.source_icon = source_icon;
}
public int getPub_time() {
return pub_time;
}
public void setPub_time(int pub_time) {
this.pub_time = pub_time;
}
public int getUpdated_at() {
return updated_at;
}
public void setUpdated_at(int updated_at) {
this.updated_at = updated_at;
}
public int getDuration() {
return duration;
}
public void setDuration(int duration) {
this.duration = duration;
}
public int getHot() {
return hot;
}
public void setHot(int hot) {
this.hot = hot;
}
}

View File

@@ -1,156 +0,0 @@
package com.mogo.module.media.model;
import com.mogo.module.media.constants.MusicConstant;
import java.io.Serializable;
public class MediaInfoData implements Serializable {
//QQ音乐懒人听书乐听头条 2 为书籍听书3 为新闻,1 为qq音乐
private int type;
private String mediaId;//qq音乐id书的bookId
//qq音乐url 懒人听书为“”
private String mediaUrl;
//歌曲名 ,当前播放书名,新闻标题内容
private String mediaName;
//演唱歌手,当前章节,新闻来源
private String mediaSinger;
//歌曲封面,书籍封面,新闻预览图
private String mediaImg;
//音乐类别,类似经典 流行只有qq特有
private String mediaType;
private int maxTime;//音频总时长
private String bookInfo;//懒人听书json串
//当前播放时长,可以不加,播放进度单独独立出来
private int curTime;
//是否是本地音频只有qq音乐
private boolean isLocalMedia;//本地
//播放模式,顺序,单曲循环,随机
private int mediaPlayMode;
//1 播放 2 缓冲 0 暂停/停止 -1 播放错误
private int playState;
public String getMediaId() {
return mediaId;
}
public void setMediaId(String mediaId) {
this.mediaId = mediaId;
}
public String getMediaUrl() {
return mediaUrl;
}
public void setMediaUrl(String mediaUrl) {
this.mediaUrl = mediaUrl;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public int getPlayState() {
return playState;
}
public void setPlayState(int playState) {
this.playState = playState;
}
public String getMediaName() {
return mediaName;
}
public void setMediaName(String mediaName) {
this.mediaName = mediaName;
}
public String getMediaSinger() {
return mediaSinger;
}
public void setMediaSinger(String mediaSinger) {
this.mediaSinger = mediaSinger;
}
public String getMediaImg() {
return mediaImg;
}
public void setMediaImg(String mediaImg) {
this.mediaImg = mediaImg;
}
public int getMaxTime() {
return maxTime;
}
public void setMaxTime(int maxTime) {
this.maxTime = maxTime;
}
public int getCurTime() {
return curTime;
}
public void setCurTime(int curTime) {
this.curTime = curTime;
}
public String getMediaType() {
return mediaType;
}
public void setMediaType(String mediaType) {
this.mediaType = mediaType;
}
public boolean isLocalMedia() {
return isLocalMedia;
}
public void setLocalMedia(boolean localMedia) {
isLocalMedia = localMedia;
}
public int getMediaPlayMode() {
return mediaPlayMode;
}
public void setMediaPlayMode(int mediaPlayMode) {
this.mediaPlayMode = mediaPlayMode;
}
public String getBookInfo() {
return bookInfo;
}
public void setBookInfo(String bookInfo) {
this.bookInfo = bookInfo;
}
@Override
public String toString() {
return "MediaInfoData{" +
"mediaName='" + mediaName + '\'' +
", mediaImg='" + mediaImg + '\'' +
", playState=" + playState +
'}';
}
}

View File

@@ -1,7 +0,0 @@
package com.mogo.module.media.model;
import java.io.Serializable;
public class MediaInfoDataEvent implements Serializable {
public MediaInfoData data;
}

View File

@@ -1,7 +0,0 @@
package com.mogo.module.media.model;
import java.io.Serializable;
public class MediaProcessEvent implements Serializable {
public int process;
}

View File

@@ -1,76 +0,0 @@
package com.mogo.module.media.model;
import java.util.List;
public class NearShareRequestParameter {
/**
* location : {"lat":31,"lon":116}
* radius : 1000
* dataType : ["CARD_TYPE_CARS_CHATTING","CARD_TYPE_ROAD_CODITION"]
* limit : 100
*/
private LocationBean location;
private int radius;
private int limit;
private List<String> dataType;
public LocationBean getLocation() {
return location;
}
public void setLocation(LocationBean location) {
this.location = location;
}
public int getRadius() {
return radius;
}
public void setRadius(int radius) {
this.radius = radius;
}
public int getLimit() {
return limit;
}
public void setLimit(int limit) {
this.limit = limit;
}
public List<String> getDataType() {
return dataType;
}
public void setDataType(List<String> dataType) {
this.dataType = dataType;
}
public static class LocationBean {
/**
* lat : 31.0
* lon : 116.0
*/
private double lat;
private double lon;
public double getLat() {
return lat;
}
public void setLat(double lat) {
this.lat = lat;
}
public double getLon() {
return lon;
}
public void setLon(double lon) {
this.lon = lon;
}
}
}

View File

@@ -1,58 +0,0 @@
package com.mogo.module.media.model;
import java.io.Serializable;
public class QQMediaListData implements Serializable {
//唯一区分歌曲
private String mediaUrl;
//歌曲名 ,当前播放书名,新闻标题内容
private String mediaName;
//演唱歌手,当前章节,新闻来源
private String mediaSinger;
private String mediaImgUrl;
private String mediaMid;
public String getMediaMid() {
return mediaMid;
}
public void setMediaMid(String mediaMid) {
this.mediaMid = mediaMid;
}
public String getMediaUrl() {
return mediaUrl;
}
public void setMediaUrl(String mediaUrl) {
this.mediaUrl = mediaUrl;
}
public String getMediaName() {
return mediaName;
}
public void setMediaName(String mediaName) {
this.mediaName = mediaName;
}
public String getMediaSinger() {
return mediaSinger;
}
public void setMediaSinger(String mediaSinger) {
this.mediaSinger = mediaSinger;
}
public String getMediaImgUrl() {
return mediaImgUrl;
}
public void setMediaImgUrl(String mediaImgUrl) {
this.mediaImgUrl = mediaImgUrl;
}
}

View File

@@ -1,20 +0,0 @@
package com.mogo.module.media.model;
import com.mogo.commons.data.BaseData;
public class ShareLikeData extends BaseData {
public ShareLikeDataResult result;
public static class ShareLikeDataResult{
public boolean checkLiked;
public int likedCount;
public String mediaId;
public String mediaUrl;
public int type; //1真是数据 2虚拟数据
public long userId;
public String userImg;
public String userName;
}
}

View File

@@ -1,15 +0,0 @@
package com.mogo.module.media.model;
import java.io.Serializable;
public class ShareMediaJsonData implements Serializable {
public String type;
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}

View File

@@ -1,47 +0,0 @@
package com.mogo.module.media.model;
import com.mogo.commons.data.BaseData;
import com.mogo.module.common.entity.MarkerShareMusic;
import java.util.ArrayList;
/**
MarkerShareMusic 结构说明:
* bookInfo : 懒人听书实体json串
* id : 100
* likeNumber : 99
* location : {"address":"北京市朝阳区三里屯街道108号","angle":"36.5","lat":"39.989368","lon":"116.480888"}
* mediaId : 音乐id
* mediaImg : 歌曲封面img url
* mediaName : 歌曲名
* mediaSinger : 歌手名
* mediaUrl : 歌曲url
* shareContentText : 分享的文字
* shareType : 1
* type : 卡片类型
* userInfo : {"age":"00后","gender":"男也可以012根据实际库存返回即可","sn":"018209312809312","userHead":"https://www.baidu.com/img/baidu_jgylogo3.png","userId":1,"userName":"用户昵称"}
*/
public class ShareMediaMarkerInfoData extends BaseData {
public ShareMediaMarkerInfoDataResult result;
public ShareMediaMarkerInfoDataResult getResult() {
return result;
}
public void setResult(ShareMediaMarkerInfoDataResult result) {
this.result = result;
}
public static class ShareMediaMarkerInfoDataResult{
public ArrayList<MarkerShareMusic> shareMusic;
public ArrayList<MarkerShareMusic> getShareMusic() {
return shareMusic;
}
public void setShareMusic(ArrayList<MarkerShareMusic> shareMusic) {
this.shareMusic = shareMusic;
}
}
}

View File

@@ -1,16 +0,0 @@
package com.mogo.module.media.model;
import com.mogo.commons.data.BaseData;
import com.mogo.module.common.entity.MarkerShareMusic;
public class ShareSuccessResult extends BaseData {
public MarkerShareMusic result;
public MarkerShareMusic getResult() {
return result;
}
public void setResult(MarkerShareMusic result) {
this.result = result;
}
}

View File

@@ -1,27 +0,0 @@
package com.mogo.module.media.model;
import com.mogo.commons.data.BaseData;
public class ShowShareData extends BaseData {
public ShowShareResult result;
public ShowShareResult getResult() {
return result;
}
public void setResult(ShowShareResult result) {
this.result = result;
}
public static class ShowShareResult{
public boolean check;
public boolean isCheck() {
return check;
}
public void setCheck(boolean check) {
this.check = check;
}
}
}

View File

@@ -1,29 +0,0 @@
package com.mogo.module.media.model.url;
import java.io.Serializable;
public class UrlData implements Serializable {
private String dztUrl;
private String apiUrl;
public UrlData(String dztUrl, String apiUrl) {
this.dztUrl = dztUrl;
this.apiUrl = apiUrl;
}
public String getDztUrl() {
return dztUrl;
}
public void setDztUrl(String dztUrl) {
this.dztUrl = dztUrl;
}
public String getApiUrl() {
return apiUrl;
}
public void setApiUrl(String apiUrl) {
this.apiUrl = apiUrl;
}
}

View File

@@ -1,58 +0,0 @@
package com.mogo.module.media.presenter;
import android.content.Context;
import com.mogo.commons.mvp.IView;
import com.mogo.commons.mvp.Presenter;
import com.mogo.module.media.model.MediaInfoData;
/**
* 媒体播放presenter基类目前没有整合到原MediaPresenter中原来的qq音乐喜马拉雅和懒人听书下掉了
*
* @author tongchenfei
*/
public abstract class BaseMediaPresenter<V extends IView> extends Presenter<V> {
public BaseMediaPresenter(V view) {
super(view);
}
/**
* 初始化
*
* @param context 上下文
*/
public abstract void init(Context context);
/**
* 播放音乐
* @param mediaInfoData 待播放音乐信息
*/
public abstract void play(MediaInfoData mediaInfoData);
/**
* 暂停播放
* @param mediaInfoData 待暂停音乐信息
*/
public abstract void pause(MediaInfoData mediaInfoData);
/**
* 停止播放
* @param mediaInfoData 待停止播放音乐信息
*/
public abstract void stop(MediaInfoData mediaInfoData);
/**
* 上一首
*/
public abstract void pre();
/**
* 下一首
*/
public abstract void next();
/**
* 打开对应的应用
*/
public abstract void openApp();
}

View File

@@ -1,259 +0,0 @@
package com.mogo.module.media.presenter;
import android.content.Context;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.media.MediaConstants;
import com.mogo.module.media.constants.MusicConstant;
import com.mogo.module.media.model.MediaInfoData;
import com.mogo.module.media.view.IMusicView;
import com.mogo.service.IMogoServiceApis;
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
import com.mogo.service.statusmanager.StatusDescriptor;
import cn.kuwo.autosdk.api.KWAPI;
import cn.kuwo.autosdk.api.OnGetSongImgUrlListener;
import cn.kuwo.autosdk.api.PlayState;
import cn.kuwo.autosdk.api.PlayerStatus;
import cn.kuwo.base.bean.Music;
/**
* 适配酷我的presenter
*
* @author tongchenfei
*/
public class KwPresenter extends BaseMediaPresenter<IMusicView> {
private static final String TAG = "KwPresenter";
private KWAPI kwapi;
private boolean isBind = false;
private MediaInfoData currentMedia = new MediaInfoData();
public KwPresenter(IMusicView view) {
super(view);
}
@Override
public void init(Context context) {
kwapi = KWAPI.createKWAPI(context, "auto");
kwapi.registerConnectedListener(b -> {
Log.d(TAG, "onConnected: " + b);
Log.d(TAG, "onConnected: " + b);
isBind = b;
if (!isBind) {
mView.onMusicStopped();
}else{
PlayerStatus currentState = kwapi.getPlayerStatus();
Log.d(TAG, "check current status: " + currentState);
Log.d(TAG, "check current status: " + currentState);
if(currentState == PlayerStatus.BUFFERING||currentState == PlayerStatus.PLAYING){
currentMedia.setPlayState(MusicConstant.PLAY_STATE_PLAYING);
kwapi.getSongPicUrl(kwapi.getNowPlayingMusic(), onGetSongImgUrlListener);
startTrackTrackProgress();
mView.onMusicPlaying();
}
}
});
kwapi.registerExitListener(() -> {
Log.d(TAG, "onExit===");
Log.d(TAG, "onExit===");
mView.onAppExit();
});
kwapi.registerPlayerStatusListener((playerStatus, music) -> {
if ( music == null ) {
return;
}
Log.d(TAG, "onPlayerStatusListener: " + playerStatus + " music: " + music.name);
switch (playerStatus) {
case BUFFERING:
if (currentMedia.getMediaName() == null || !currentMedia.getMediaName().equals(music.name)) {
// 说明是切了新歌,需要及时同步一下状态
currentMedia.setPlayState(MusicConstant.PLAY_STATE_PLAYING);
currentMedia.setMediaName(music.name);
currentMedia.setMediaImg("");
mView.onMediaInfoChanged(currentMedia);
mView.onMusicPlaying();
}
kwapi.getSongPicUrl(music, onGetSongImgUrlListener);
break;
case PLAYING:
if (currentMedia.getMediaName() == null || !currentMedia.getMediaName().equals(music.name)) {
// 说明是切了新歌,需要及时同步一下状态
currentMedia.setPlayState(MusicConstant.PLAY_STATE_PLAYING);
currentMedia.setMediaName(music.name);
currentMedia.setMediaImg("");
mView.onMediaInfoChanged(currentMedia);
}
currentMedia.setPlayState(MusicConstant.PLAY_STATE_PLAYING);
kwapi.getSongPicUrl(music, onGetSongImgUrlListener);
startTrackTrackProgress();
mView.onMusicPlaying();
break;
case INIT:
case PAUSE:
case STOP:
currentMedia.setPlayState(MusicConstant.PLAY_STATE_PAUSE_OR_STOP);
stopTrackTrackProgress();
mView.onMusicPause();
break;
default:
break;
}
});
IMogoServiceApis serviceApis = MogoApisHandler.getInstance().getApis();
serviceApis.getStatusManagerApi().registerStatusChangedListener(MediaConstants.MODULE_TYPE, StatusDescriptor.MAIN_PAGE_RESUME, new IMogoStatusChangedListener() {
@Override
public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) {
if (isTrue) {
Log.d(TAG, "onResume, isBind: " + isBind);
Log.d(TAG, "onResume, isBind: " + isBind);
// 需要在resume时候判断绑定关系是否正常
if (!isBind) {
// 未绑定,需要重新绑定,同时第一次绑定初始化也是在此处
kwapi.bindAutoSdkService();
}else if(kwapi.isKuwoRunning()){
Music currentMusic = kwapi.getNowPlayingMusic();
if (currentMedia.getMediaName() == null && currentMusic != null) {
// 当前处于绑定状态,且有音乐信息,需判断是否正在播放,进行界面刷新
Log.d(TAG, "step1==" + currentMusic.name);
if (kwapi.getPlayerStatus() == PlayerStatus.BUFFERING || kwapi.getPlayerStatus() == PlayerStatus.PLAYING) {
Log.d(TAG, "当前可能正在播放音乐,需要更新=1=" + currentMusic.name);
currentMedia.setMediaName(currentMusic.name);
currentMedia.setPlayState(MusicConstant.PLAY_STATE_PLAYING);
mView.onMediaInfoChanged(currentMedia);
mView.onMusicPlaying();
kwapi.getSongPicUrl(currentMusic, onGetSongImgUrlListener);
} else if (kwapi.getPlayerStatus() == PlayerStatus.INIT) {
Log.d(TAG, "当前可能正在播放音乐,需要更新=3=" + currentMusic.name);
currentMedia.setMediaName(currentMusic.name);
currentMedia.setPlayState(MusicConstant.PLAY_STATE_PAUSE_OR_STOP);
mView.onMediaInfoChanged(currentMedia);
mView.onMusicStopped();
}
} else if (currentMedia.getMediaName() != null && currentMusic != null && !currentMedia.getMediaName().equals(currentMusic.name)) {
Log.d(TAG, "step2==media: " + currentMedia.getMediaName() + " " +
"musicName: " + currentMusic.name + " status: " + kwapi.getPlayerStatus());
if (kwapi.getPlayerStatus() == PlayerStatus.BUFFERING || kwapi.getPlayerStatus() == PlayerStatus.PLAYING) {
Log.d(TAG, "当前可能正在播放音乐,需要更新=2=" + currentMusic.name);
currentMedia.setMediaName(currentMusic.name);
currentMedia.setPlayState(MusicConstant.PLAY_STATE_PLAYING);
mView.onMediaInfoChanged(currentMedia);
mView.onMusicPlaying();
kwapi.getSongPicUrl(currentMusic, onGetSongImgUrlListener);
}else if (kwapi.getPlayerStatus() == PlayerStatus.INIT) {
Log.d(TAG, "当前可能正在播放音乐,需要更新=4=" + currentMusic.name);
currentMedia.setMediaName(currentMusic.name);
currentMedia.setPlayState(MusicConstant.PLAY_STATE_PAUSE_OR_STOP);
mView.onMediaInfoChanged(currentMedia);
mView.onMusicStopped();
}
}
}
}
}
});
kwapi.bindAutoSdkService();
}
@Override
public void play(MediaInfoData mediaInfoData) {
if (kwapi.isKuwoRunning()) {
kwapi.setPlayState(PlayState.STATE_PLAY);
} else {
kwapi.startAPP(true);
}
}
@Override
public void pause(MediaInfoData mediaInfoData) {
if (kwapi.isKuwoRunning()) {
kwapi.setPlayState(PlayState.STATE_PAUSE);
}else{
kwapi.startAPP(true);
}
}
@Override
public void stop(MediaInfoData mediaInfoData) {
}
@Override
public void pre() {
if (kwapi.isKuwoRunning()) {
kwapi.setPlayState(PlayState.STATE_PRE);
}
}
@Override
public void next() {
if (kwapi.isKuwoRunning()) {
kwapi.setPlayState(PlayState.STATE_NEXT);
}else{
kwapi.startAPP(true);
}
}
private Handler.Callback callback = new Handler.Callback() {
@Override
public boolean handleMessage(Message msg) {
if (isTrackingProgress) {
mView.onMusicProgress(kwapi.getCurrentPos(), kwapi.getCurrentMusicDuration());
msg.getTarget().sendEmptyMessageDelayed(MSG_TRACK_PROGRESS,
MSG_TRACK_PROGRESS_DELAY);
}
return false;
}
};
private Handler handler = new Handler(callback);
private static final int MSG_TRACK_PROGRESS = 1001;
private static final long MSG_TRACK_PROGRESS_DELAY = 1000;
private boolean isTrackingProgress = false;
private void startTrackTrackProgress() {
if(!isTrackingProgress) {
isTrackingProgress = true;
handler.sendEmptyMessageDelayed(MSG_TRACK_PROGRESS, MSG_TRACK_PROGRESS_DELAY);
}
}
private void stopTrackTrackProgress() {
if(isTrackingProgress) {
isTrackingProgress = false;
handler.removeMessages(MSG_TRACK_PROGRESS);
}
}
private OnGetSongImgUrlListener onGetSongImgUrlListener = new OnGetSongImgUrlListener() {
@Override
public void onGetSongImgUrlSucessed(Music music, String s) {
if(currentMedia.getPlayState() == MusicConstant.PLAY_STATE_PLAYING) {
currentMedia.setMediaName(music.name);
currentMedia.setMediaImg(s);
Log.d(TAG,
"onGetSongImgUrlSucessed: " + currentMedia);
handler.post(() -> mView.onMediaInfoChanged(currentMedia));
}
}
@Override
public void onGetSongImgUrlFailed(Music music, int i) {
Log.e(TAG, "onGetSongImgUrlFailed: " + i);
}
};
@Override
public void openApp(){
kwapi.startAPP(true);
}
}

View File

@@ -1,532 +0,0 @@
package com.mogo.module.media.presenter;
import android.text.TextUtils;
import androidx.annotation.NonNull;
import androidx.lifecycle.LifecycleOwner;
import com.mogo.commons.data.BaseData;
import com.mogo.commons.mvp.Presenter;
import com.mogo.commons.network.ParamsProvider;
import com.mogo.commons.network.ParamsUtil;
import com.mogo.commons.network.SubscribeImpl;
import com.mogo.commons.voice.AIAssist;
import com.mogo.map.location.MogoLocation;
import com.mogo.module.common.entity.MarkerResponse;
import com.mogo.module.common.entity.MarkerShareMusic;
import com.mogo.module.media.MediaConstants;
import com.mogo.module.media.R;
import com.mogo.module.media.ServiceMediaHandler;
import com.mogo.module.media.api.MediaDztService;
import com.mogo.module.media.constants.BaseUrlConstants;
import com.mogo.module.media.constants.EventConstants;
import com.mogo.module.media.model.MediaInfoData;
import com.mogo.module.media.model.NearShareRequestParameter;
import com.mogo.module.media.model.ShareLikeData;
import com.mogo.module.media.model.ShareMediaMarkerInfoData;
import com.mogo.module.media.model.ShareSuccessResult;
import com.mogo.module.media.model.ShowShareData;
import com.mogo.module.media.utils.BaseUrlManager;
import com.mogo.module.media.utils.MediaAnalyticsUtils;
import com.mogo.module.media.utils.StorageManager;
import com.mogo.module.media.utils.ToastHelper;
import com.mogo.module.media.view.MediaView;
import com.mogo.utils.TipToast;
import com.mogo.utils.network.RequestOptions;
import com.mogo.utils.network.utils.GsonUtil;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Consumer;
import io.reactivex.schedulers.Schedulers;
public class MediaPresenter extends Presenter<MediaView> {
private static final String TAG = "MediaPresenter";
private ArrayList<Disposable> mDisPosables;
public MediaPresenter(MediaView view) {
super(view);
}
@Override
public void onCreate(@NonNull LifecycleOwner owner) {
super.onCreate(owner);
}
public void getFriendMusic() {
final ParamsProvider.Builder builder = new ParamsProvider.Builder(getContext());
final MogoLocation location = ServiceMediaHandler.getLocationClient().getLastKnowLocation();
if (location != null) {
builder.append("address", location.getAddress());
builder.append("lat", location.getLatitude());
builder.append("lng", location.getLongitude());
}
Map<String, Object> parameters = builder.build();
Observable<ShareMediaMarkerInfoData> observable = ServiceMediaHandler.getMogoNetWorkService().
create(MediaDztService.class, BaseUrlManager.getDztBaseUrl()).getFriendShareMusic(parameters);
observable
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new SubscribeImpl<ShareMediaMarkerInfoData>(RequestOptions.create(getContext())) {
@Override
public void onSubscribe(Disposable d) {
addDispose(d);
}
@Override
public void onSuccess(ShareMediaMarkerInfoData resultData) {
if (resultData != null && resultData.getResult() != null
&& resultData.getResult().getShareMusic() != null
&& resultData.getResult().getShareMusic().size() > 0){
mView.loadFriendShareMusicSuccess(resultData.getResult().getShareMusic());
}else{
TipToast.shortTip("您的好友未分享过歌曲");
AIAssist.getInstance(mView.getContext()).speakTTSVoice("您的好友未分享过歌曲",null);
}
}
@Override
public void onError(Throwable e) {
super.onError(e);
TipToast.shortTip("获取好友的歌失败");
}
@Override
public void onError(String message, int code) {
super.onError(message, code);
TipToast.shortTip("获取好友的歌失败");
}
}
);
}
/**
* 开始音乐播放的接口
* @param mCurrentMusic
*/
public void startedMusic(MediaInfoData mCurrentMusic) {
if (mCurrentMusic == null)return;
final ParamsProvider.Builder builder = new ParamsProvider.Builder(getContext());
HashMap<String, Object> hashMap = new HashMap<>();
hashMap.put("mediaType", mCurrentMusic.getType());
hashMap.put("shareData", mCurrentMusic);
builder.append("data", GsonUtil.jsonFromObject(hashMap));
Map<String, Object> parameters = builder.build();
Observable<BaseData> observable = ServiceMediaHandler.getMogoNetWorkService().
create(MediaDztService.class, BaseUrlManager.getDztBaseUrl()).startedMusic(parameters);
observable
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(getContext())) {
@Override
public void onSubscribe(Disposable d) {
addDispose(d);
}
@Override
public void onSuccess(BaseData resultData) {
}
@Override
public void onError(Throwable e) {
super.onError(e);
}
@Override
public void onError(String message, int code) {
super.onError(message, code);
}
}
);
}
/**
* 请求附近的
*/
public void getNearShareMusic() {
final ParamsProvider.Builder builder = new ParamsProvider.Builder(getContext());
NearShareRequestParameter nearData = new NearShareRequestParameter();
NearShareRequestParameter.LocationBean locationBean = new NearShareRequestParameter.LocationBean();
final MogoLocation location = ServiceMediaHandler.getLocationClient().getLastKnowLocation();
if ( location != null ) {
locationBean.setLat(locationBean.getLat());
locationBean.setLon(locationBean.getLon());
}
nearData.setLocation(locationBean);
nearData.setLimit(10);
nearData.setRadius(2000);
ArrayList<String> list = new ArrayList<>();
list.add(MediaConstants.MODULE_TYPE);
nearData.setDataType(list);
builder.append("data", GsonUtil.jsonFromObject(nearData));
Map<String, Object> parameters = builder.build();
Observable<MarkerResponse> observable = ServiceMediaHandler.getMogoNetWorkService().
create(MediaDztService.class, BaseUrlManager.getDztBaseUrl()).getNearShareMusic(parameters);
Disposable disposable = observable
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(
new Consumer<MarkerResponse>() {
@Override
public void accept(MarkerResponse markerResponse) throws Exception {
if (markerResponse != null && markerResponse.getCode() == 0
&& markerResponse.getResult() != null
&& markerResponse.getResult().getShareMusic() != null
&& markerResponse.getResult().getShareMusic().size() > 0){
mView.loadNearShareMusicSuccess(markerResponse.getResult().getShareMusic());
}else{
AIAssist.getInstance(mView.getContext()).speakTTSVoice("当前暂无分享的歌曲",null);
}
}
},
new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
TipToast.shortTip("获取附近的歌失败");
}
}
);
addDispose(disposable);
}
/**
* 停止音乐播放的接口
*/
public void stopMusic() {
final ParamsProvider.Builder builder = new ParamsProvider.Builder(getContext());
Map<String, Object> parameters = builder.build();
Observable<BaseData> observable = ServiceMediaHandler.getMogoNetWorkService().
create(MediaDztService.class, BaseUrlManager.getDztBaseUrl()).stopMusic(parameters);
observable
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(getContext())) {
@Override
public void onSubscribe(Disposable d) {
addDispose(d);
}
@Override
public void onSuccess(BaseData resultData) {
}
@Override
public void onError(Throwable e) {
super.onError(e);
}
@Override
public void onError(String message, int code) {
super.onError(message, code);
}
}
);
}
public void getShouldShare() {
final ParamsProvider.Builder builder = new ParamsProvider.Builder(getContext());
Map<String, Object> parameters = builder.build();
Observable<ShowShareData> observable = ServiceMediaHandler.getMogoNetWorkService().
create(MediaDztService.class, BaseUrlManager.getDztBaseUrl()).getShouldPushShare(parameters);
observable
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new SubscribeImpl<ShowShareData>(RequestOptions.create(getContext())) {
@Override
public void onSubscribe(Disposable d) {
addDispose(d);
}
@Override
public void onSuccess(ShowShareData resultData) {
//存储请求了触发分享的接口每次accon一次
StorageManager.setShowPushShareTime(System.currentTimeMillis()+"");
if (resultData != null && resultData.result != null){
mView.showSharePush(resultData.result.check);
}
}
@Override
public void onError(Throwable e) {
super.onError(e);
}
@Override
public void onError(String message, int code) {
super.onError(message, code);
}
}
);
}
public void selectByPrimaryKey(int id,String mediaId){
final ParamsProvider.Builder builder = new ParamsProvider.Builder(getContext());
builder.append("id",id);
Map<String, Object> parameters = builder.build();
Observable<ShareLikeData> observable = ServiceMediaHandler.getMogoNetWorkService().
create(MediaDztService.class, BaseUrlManager.getDztBaseUrl()).selectByPrimaryKey(parameters);
observable
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new SubscribeImpl<ShareLikeData>(RequestOptions.create(getContext())) {
@Override
public void onSubscribe(Disposable d) {
addDispose(d);
}
@Override
public void onSuccess(ShareLikeData resultData) {
//存储请求了触发分享的接口每次accon一次
if (resultData == null){
return;
}
if (resultData.result == null){
return;
}
mView.loadShareLikeDataResultSuccess(resultData.result,mediaId);
}
@Override
public void onError(Throwable e) {
super.onError(e);
TipToast.shortTip("加载点赞信息失败,请重试");
}
@Override
public void onError(String message, int code) {
super.onError(message, code);
TipToast.shortTip("加载点赞信息失败,请重试");
}
}
);
}
public void likeShare(ShareLikeData.ShareLikeDataResult likeDataResult){
final Map<String, Object> businessParams = new HashMap<>();
final MogoLocation location = ServiceMediaHandler.getLocationClient().getLastKnowLocation();
businessParams.put("musicId", likeDataResult.mediaId);
businessParams.put("musicUrl", likeDataResult.mediaUrl);
businessParams.put("userId", likeDataResult.userId);
businessParams.put("userType", likeDataResult.type);
ParamsProvider.Builder builder = new ParamsProvider.Builder(getContext());
if (location != null) {
builder.append("lat", location.getLatitude());
builder.append("lng", location.getLongitude());
}
final Map<String, Object> params = builder
.append(businessParams)
.build();
Observable<BaseData> observable = ServiceMediaHandler.getMogoNetWorkService().create(MediaDztService.class, BaseUrlManager.getDztBaseUrl())
.likeShare(ParamsUtil.toQueryUrl(BaseUrlManager.getDztBaseUrl() + BaseUrlConstants.SHARE_MUSIC_LIKE_URL, params, businessParams), ParamsUtil.convert(businessParams));
observable
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(getContext())) {
@Override
public void onSubscribe(Disposable d) {
addDispose(d);
}
@Override
public void onSuccess(BaseData resultData) {
mView.likeShareSuccess();
TipToast.shortTip("点赞成功");
}
@Override
public void onError(Throwable e) {
super.onError(e);
TipToast.shortTip("点赞失败,请重试");
}
@Override
public void onError(String message, int code) {
super.onError(message, code);
TipToast.shortTip(message != null ?message:"点赞失败,请重试");
}
}
);
}
public void addDispose(Disposable subscription){
if (subscription != null){
if (mDisPosables == null) mDisPosables = new ArrayList<>();
mDisPosables.add(subscription);
}
}
public String getPackageName(MediaInfoData mMediaInfoData){
if (mMediaInfoData == null) return "";
if (mMediaInfoData.getType() == 1){
return "com.pvetec.musics";
}else if (mMediaInfoData.getType() == 2){
return "com.zhidao.lrts";
}else if (mMediaInfoData.getType() == 3){
return "com.zhidao.ltnews";
}else{
return "";
}
}
public String getAppName(MediaInfoData mMediaInfoData){
if (mMediaInfoData == null) return "";
if (mMediaInfoData.getType() == 1){
return "QQ音乐";
}else if (mMediaInfoData.getType() == 2){
return "懒人听书";
}else if (mMediaInfoData.getType() == 3){
return "乐听头条";
}else{
return "";
}
}
public void shareMusic(MediaInfoData mCurrentMusic,boolean click) {
if (mCurrentMusic == null) return;
try {
if (mCurrentMusic != null){
HashMap<String, Object> hashMap = new HashMap<>();
hashMap.put("type",click ? 1:2);
String trackId = "";
if (mCurrentMusic.getType() == 1){
trackId = EventConstants.EVENT_QQ_SHARE_DIALOG_OK;
}else if (mCurrentMusic.getType() == 2){
trackId = EventConstants.EVENT_BOOK_SHARE_DIALOG_OK;
}else if (mCurrentMusic.getType() == 3){
trackId = EventConstants.EVENT_NEWS_SHARE_DIALOG_OK;
}
MediaAnalyticsUtils.track(trackId ,hashMap);
}
} catch (Exception e) {
e.printStackTrace();
}
final Map<String, Object> businessParams = new HashMap<>();
final MogoLocation location = ServiceMediaHandler.getLocationClient().getLastKnowLocation();
if (location != null) {
businessParams.put("address", location.getAddress());
}
businessParams.put("bookInfo", mCurrentMusic.getBookInfo());
businessParams.put("mediaDuration", mCurrentMusic.getMaxTime() + "");
businessParams.put("mediaId", mCurrentMusic.getMediaId());
businessParams.put("mediaImg", mCurrentMusic.getMediaImg());
businessParams.put("mediaName", mCurrentMusic.getMediaName());
businessParams.put("mediaSinger", mCurrentMusic.getMediaSinger());
businessParams.put("mediaType", mCurrentMusic.getMediaType());
businessParams.put("mediaUrl", mCurrentMusic.getMediaUrl());
businessParams.put("shareType", mCurrentMusic.getType());
ParamsProvider.Builder builder = new ParamsProvider.Builder(getContext());
if (location != null) {
builder.append("lat", location.getLatitude());
builder.append("lng", location.getLongitude());
}else{
TipToast.shortTip("分享失败,定位出错请重试!");
return;
}
final Map<String, Object> params = builder
.append(businessParams)
.build();
Observable<ShareSuccessResult> observable = ServiceMediaHandler.getMogoNetWorkService().create(MediaDztService.class, BaseUrlManager.getDztBaseUrl())
.shareMusic(ParamsUtil.toQueryUrl(BaseUrlManager.getDztBaseUrl() + BaseUrlConstants.SHARE_MUSIC_URL, params, businessParams), ParamsUtil.convert(businessParams));
observable
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new SubscribeImpl<ShareSuccessResult>(com.mogo.utils.network.RequestOptions.create(getContext())) {
@Override
public void onSubscribe(Disposable d) {
super.onSubscribe(d);
addDispose(d);
}
@Override
public void onSuccess(ShareSuccessResult resultData) {
try {
ToastHelper.showShortSuccess(getContext(), getContext().getResources().getString(R.string.module_media_share_success));
AIAssist.getInstance(getContext()).speakTTSVoice(getContext().getResources().getString(R.string.module_media_share_success),null);
if (resultData != null && resultData.result != null){
MarkerShareMusic markerShareMusic = resultData.result;
markerShareMusic.setType(MediaConstants.MODULE_TYPE);
mView.shareSuccessResult(true,markerShareMusic);
}
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void onError(Throwable e) {
super.onError(e);
try {
ToastHelper.showShortError(getContext(), getContext().getResources().getString(R.string.module_media_share_fail));
TipToast.shortTip("分享失败");
AIAssist.getInstance(getContext()).speakTTSVoice(getContext().getResources().getString(R.string.module_media_share_fail),null);
} catch (Exception ex) {
ex.printStackTrace();
}
}
@Override
public void onError(String message, int code) {
super.onError(message, code);
try {
ToastHelper.showShortError(getContext(), getContext().getResources().getString(R.string.module_media_share_fail));
TipToast.shortTip(!TextUtils.isEmpty(message)?message:"分享失败");
AIAssist.getInstance(getContext()).speakTTSVoice(!TextUtils.isEmpty(message)?message:"分享失败",null);
} catch (Exception e) {
e.printStackTrace();
}
}
}
);
}
@Override
public void onDestroy(@NonNull LifecycleOwner owner) {
super.onDestroy(owner);
if (mDisPosables != null && !mDisPosables.isEmpty()) {
for (Disposable subscription : mDisPosables) {
if (subscription == null || subscription.isDisposed()) {
continue;
}
subscription.dispose();
}
mDisPosables.clear();
mDisPosables = null;
}
}
}

Some files were not shown because too many files have changed in this diff Show More