add module of authorize and guide ,wait to finish
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package com.mogo.module.guide
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.mogo.module.guide.fragment.GuideFragment
|
||||
import com.mogo.module.guide.util.SharedPreferenceUtil.hasGuide
|
||||
import com.mogo.service.IMogoServiceApis
|
||||
import com.mogo.service.MogoServicePaths
|
||||
import com.mogo.service.fragmentmanager.FragmentDescriptor
|
||||
|
||||
object GuideBizManager {
|
||||
|
||||
private var serviceApi: IMogoServiceApis? = null
|
||||
|
||||
fun init() {
|
||||
initService()
|
||||
// addGuideFragmentToStack()
|
||||
}
|
||||
|
||||
private fun initService() {
|
||||
val mogoService = ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation()
|
||||
if (mogoService is IMogoServiceApis) {
|
||||
serviceApi = mogoService
|
||||
}
|
||||
}
|
||||
|
||||
private fun addGuideFragmentToStack() {
|
||||
if (!hasGuide()) {
|
||||
serviceApi?.let {
|
||||
val builderWrapper = FragmentDescriptor.Builder().fragment(GuideFragment()).build()
|
||||
it.fragmentManagerApi.push(builderWrapper)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.mogo.module.guide
|
||||
|
||||
class GuideConstant {
|
||||
|
||||
companion object {
|
||||
/**
|
||||
* 展示用户引导或者用户协议模块地址
|
||||
*/
|
||||
const val PATH_GUIDE_AGREEMENT_FRAGMENT = "/guideAgreement/showFragment"
|
||||
|
||||
/**
|
||||
* provider模块实例名称(暂时仅有卡片用到)
|
||||
*/
|
||||
const val PATH_GUIDE_AGREEMENT_MODULE_NAME = "GUIDE_AND_AGREEMENT"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
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_AGREEMENT_FRAGMENT
|
||||
import com.mogo.module.guide.GuideConstant.Companion.PATH_GUIDE_AGREEMENT_MODULE_NAME
|
||||
import com.mogo.service.module.IMogoModuleLifecycle
|
||||
import com.mogo.service.module.IMogoModuleProvider
|
||||
import com.mogo.service.module.ModuleType
|
||||
|
||||
@Route(path = PATH_GUIDE_AGREEMENT_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_AGREEMENT_MODULE_NAME
|
||||
}
|
||||
|
||||
override fun getCardLifecycle(): IMogoModuleLifecycle? {
|
||||
return null
|
||||
}
|
||||
|
||||
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?) {
|
||||
GuideBizManager.init()
|
||||
}
|
||||
|
||||
override fun getAppPackage(): String? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun getAppName(): String? {
|
||||
return null
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.mogo.module.guide.fragment
|
||||
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter
|
||||
import com.mogo.module.guide.guide.*
|
||||
|
||||
class GuideAdapter(fragmentActivity: FragmentActivity) : 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_START = 0
|
||||
const val GUIDE_PAGE_CARD = 1
|
||||
const val GUIDE_PAGE_ONLINE_CAR = 2
|
||||
const val GUIDE_PAGE_NAVIGATION = 3
|
||||
const val GUIDE_PAGE_LOCATION = 4
|
||||
const val GUIDE_PAGE_APP_LIST = 5
|
||||
const val GUIDE_PAGE_ENTRY_MAIN = 6
|
||||
}
|
||||
|
||||
init {
|
||||
guideList.add(GUIDE_PAGE_START, GuideStartFragment())
|
||||
guideList.add(GUIDE_PAGE_CARD, GuideCardFragment())
|
||||
guideList.add(GUIDE_PAGE_ONLINE_CAR, GuideOnLineCarFragment())
|
||||
guideList.add(GUIDE_PAGE_NAVIGATION, GuideNavigationFragment())
|
||||
guideList.add(GUIDE_PAGE_LOCATION, GuideLocationFragment())
|
||||
guideList.add(GUIDE_PAGE_APP_LIST, GuideAppListFragment())
|
||||
guideList.add(GUIDE_PAGE_ENTRY_MAIN, GuideEntryMainFragment())
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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,28 @@
|
||||
package com.mogo.module.guide.fragment
|
||||
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.module.guide.R
|
||||
import com.mogo.utils.logger.Logger
|
||||
import kotlinx.android.synthetic.main.module_guide_fragment.*
|
||||
|
||||
class GuideFragment : MvpFragment<GuideConstract.View, GuidePresenter>(), GuideConstract.View {
|
||||
|
||||
companion object {
|
||||
const val TAG = "GuideFragment"
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.module_guide_fragment
|
||||
}
|
||||
|
||||
override fun createPresenter(): GuidePresenter {
|
||||
return GuidePresenter(this)
|
||||
}
|
||||
|
||||
override fun initViews() {
|
||||
Logger.d(TAG, "init Views")
|
||||
// val adapter = GuideAdapter(context!!)
|
||||
// moduleGuideViewPager.adapter = adapter
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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,27 @@
|
||||
package com.mogo.module.guide.guide
|
||||
|
||||
import com.mogo.commons.mvp.IView
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.mogo.module.guide.R
|
||||
|
||||
class GuideAppListFragment : MvpFragment<IView, Presenter<IView>>() {
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.module_guide_item_app_list
|
||||
}
|
||||
|
||||
override fun createPresenter(): Presenter<IView> {
|
||||
return GuideAppListPresenter(this)
|
||||
}
|
||||
|
||||
override fun initViews() {
|
||||
|
||||
}
|
||||
|
||||
class GuideAppListPresenter : Presenter<IView> {
|
||||
|
||||
constructor(view: IView?) : super(view)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.mogo.module.guide.guide
|
||||
|
||||
import com.mogo.commons.mvp.IView
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.mogo.module.guide.R
|
||||
|
||||
class GuideCardFragment : MvpFragment<IView, Presenter<IView>>() {
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.module_guide_item_card
|
||||
}
|
||||
|
||||
override fun createPresenter(): Presenter<IView> {
|
||||
return GuideCardPresenter(this)
|
||||
}
|
||||
|
||||
override fun initViews() {
|
||||
|
||||
}
|
||||
|
||||
class GuideCardPresenter : Presenter<IView> {
|
||||
|
||||
constructor(view: IView?) : super(view)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.mogo.module.guide.guide
|
||||
|
||||
import com.mogo.commons.mvp.IView
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.mogo.module.guide.R
|
||||
|
||||
class GuideEntryMainFragment : MvpFragment<IView, Presenter<IView>>() {
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.module_guide_item_entry_main
|
||||
}
|
||||
|
||||
override fun createPresenter(): Presenter<IView> {
|
||||
return GuideEntryPresenter(this)
|
||||
}
|
||||
|
||||
override fun initViews() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
class GuideEntryPresenter : Presenter<IView> {
|
||||
|
||||
constructor(view: IView?) : super(view)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.mogo.module.guide.guide
|
||||
|
||||
import com.mogo.commons.mvp.IView
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.mogo.module.guide.R
|
||||
|
||||
class GuideLocationFragment : MvpFragment<IView, Presenter<IView>>() {
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.module_guide_item_location
|
||||
}
|
||||
|
||||
override fun createPresenter(): Presenter<IView> {
|
||||
return GuideLocationPresenter(this)
|
||||
}
|
||||
|
||||
override fun initViews() {
|
||||
|
||||
}
|
||||
|
||||
class GuideLocationPresenter : Presenter<IView> {
|
||||
|
||||
constructor(view: IView?) : super(view)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.mogo.module.guide.guide
|
||||
|
||||
import com.mogo.commons.mvp.IView
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.mogo.module.guide.R
|
||||
|
||||
class GuideNavigationFragment : MvpFragment<IView, Presenter<IView>>() {
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.module_guide_item_navigation
|
||||
}
|
||||
|
||||
override fun createPresenter(): Presenter<IView> {
|
||||
return GuideNavigationPresenter(this)
|
||||
}
|
||||
|
||||
override fun initViews() {
|
||||
|
||||
}
|
||||
|
||||
class GuideNavigationPresenter : Presenter<IView> {
|
||||
|
||||
constructor(view: IView?) : super(view)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.mogo.module.guide.guide
|
||||
|
||||
import com.mogo.commons.mvp.IView
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.mogo.module.guide.R
|
||||
|
||||
class GuideOnLineCarFragment : MvpFragment<IView, Presenter<IView>>() {
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.module_guide_item_online_car
|
||||
}
|
||||
|
||||
override fun createPresenter(): Presenter<IView> {
|
||||
return GuideOnLineCarPresenter(this)
|
||||
}
|
||||
|
||||
override fun initViews() {
|
||||
|
||||
}
|
||||
|
||||
class GuideOnLineCarPresenter : Presenter<IView> {
|
||||
|
||||
constructor(view: IView?) : super(view)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.mogo.module.guide.guide
|
||||
|
||||
import com.mogo.commons.mvp.IView
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.mogo.module.guide.R
|
||||
|
||||
class GuideStartFragment : MvpFragment<IView, Presenter<IView>>() {
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.module_guide_item_start
|
||||
}
|
||||
|
||||
override fun createPresenter(): Presenter<IView> {
|
||||
return GuideStartPresenter(this)
|
||||
}
|
||||
|
||||
override fun initViews() {
|
||||
|
||||
}
|
||||
|
||||
class GuideStartPresenter : Presenter<IView> {
|
||||
|
||||
constructor(view: IView?) : super(view)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.mogo.module.guide.util
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.utils.storage.SharedPrefsMgr
|
||||
|
||||
object SharedPreferenceUtil {
|
||||
|
||||
const val HAS_GUIDE = "HAS_GUIDE"
|
||||
|
||||
fun hasGuide(): Boolean {
|
||||
return SharedPrefsMgr.getInstance(AbsMogoApplication.getApp()).getBoolean(HAS_GUIDE, false)
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user