@@ -0,0 +1,2 @@
|
||||
package com.mogo.module.guide.agreement
|
||||
|
||||
1
modules/mogo-module-guide/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1 @@
|
||||
<manifest package="com.mogo.module.guide" />
|
||||
@@ -0,0 +1,65 @@
|
||||
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)
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
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"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
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))
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.mogo.module.guide.fragment
|
||||
|
||||
import com.mogo.commons.mvp.IView
|
||||
|
||||
class GuideConstract {
|
||||
|
||||
interface View:IView{
|
||||
|
||||
}
|
||||
|
||||
interface Biz{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
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()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
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)
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
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)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
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)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
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)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
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)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
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)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
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)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
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())
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
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()
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?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>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?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>
|
||||
@@ -0,0 +1,42 @@
|
||||
<?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>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?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>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?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>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?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>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?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>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?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>
|
||||
|
After Width: | Height: | Size: 371 KiB |
|
After Width: | Height: | Size: 342 KiB |
|
After Width: | Height: | Size: 337 KiB |
|
After Width: | Height: | Size: 500 KiB |
|
After Width: | Height: | Size: 474 KiB |
|
After Width: | Height: | Size: 635 B |
|
After Width: | Height: | Size: 713 B |
|
After Width: | Height: | Size: 536 KiB |
|
After Width: | Height: | Size: 445 KiB |
|
After Width: | Height: | Size: 550 KiB |
|
After Width: | Height: | Size: 597 KiB |
|
After Width: | Height: | Size: 568 KiB |
|
After Width: | Height: | Size: 749 B |
|
After Width: | Height: | Size: 820 B |
|
After Width: | Height: | Size: 918 KiB |
|
After Width: | Height: | Size: 835 KiB |
|
After Width: | Height: | Size: 978 KiB |
|
After Width: | Height: | Size: 1.3 MiB |
|
After Width: | Height: | Size: 1004 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
1054
modules/mogo-module-guide/src/main/res/values-xhdpi-v4/dimens.xml
Normal file
6
modules/mogo-module-guide/src/main/res/values/color.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?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>
|
||||
1046
modules/mogo-module-guide/src/main/res/values/dimens.xml
Normal file
14
modules/mogo-module-guide/src/main/res/values/strings.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<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>
|
||||
@@ -0,0 +1,17 @@
|
||||
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)
|
||||
}
|
||||
}
|
||||