fix bug
This commit is contained in:
@@ -13,9 +13,9 @@ object GuideBizManager {
|
||||
private var serviceApi: IMogoServiceApis? = null
|
||||
|
||||
fun init() {
|
||||
Logger.d("GuideBizManager","init===================================")
|
||||
// initService()
|
||||
// addGuideFragmentToStack()
|
||||
Logger.d("GuideBizManager", "init===================================")
|
||||
initService()
|
||||
addGuideFragmentToStack()
|
||||
}
|
||||
|
||||
private fun initService() {
|
||||
@@ -33,4 +33,10 @@ object GuideBizManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun removeGuideFragmentToStack() {
|
||||
serviceApi?.let {
|
||||
it.fragmentManagerApi.pop()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import androidx.fragment.app.Fragment
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter
|
||||
import com.mogo.module.guide.guide.*
|
||||
|
||||
class GuideAdapter(fragmentActivity: Fragment) : FragmentStateAdapter(fragmentActivity) {
|
||||
class GuideAdapter(fragmentActivity: GuideFragment) : FragmentStateAdapter(fragmentActivity) {
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
return guideList.size
|
||||
@@ -28,12 +28,12 @@ class GuideAdapter(fragmentActivity: Fragment) : FragmentStateAdapter(fragmentAc
|
||||
|
||||
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())
|
||||
guideList.add(GUIDE_PAGE_CARD, GuideCardFragment(fragmentActivity))
|
||||
guideList.add(GUIDE_PAGE_ONLINE_CAR, GuideOnLineCarFragment(fragmentActivity))
|
||||
guideList.add(GUIDE_PAGE_NAVIGATION, GuideNavigationFragment(fragmentActivity))
|
||||
guideList.add(GUIDE_PAGE_LOCATION, GuideLocationFragment(fragmentActivity))
|
||||
guideList.add(GUIDE_PAGE_APP_LIST, GuideAppListFragment(fragmentActivity))
|
||||
guideList.add(GUIDE_PAGE_ENTRY_MAIN, GuideEntryMainFragment(fragmentActivity))
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,10 @@
|
||||
package com.mogo.module.guide.fragment
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.module.authorize.authprovider.invoke.AuthorizeConstant
|
||||
import com.mogo.module.authorize.authprovider.module.IMogoAuthorizeModuleManager
|
||||
import com.mogo.module.guide.GuideBizManager
|
||||
import com.mogo.module.guide.R
|
||||
import com.mogo.utils.logger.Logger
|
||||
import kotlinx.android.synthetic.main.module_guide_fragment.*
|
||||
@@ -19,10 +23,38 @@ class GuideFragment : MvpFragment<GuideConstract.View, GuidePresenter>(), GuideC
|
||||
return GuidePresenter(this)
|
||||
}
|
||||
|
||||
private var adapter: GuideAdapter? = null
|
||||
|
||||
override fun initViews() {
|
||||
Logger.d(TAG, "init Views")
|
||||
// val adapter = GuideAdapter(this)
|
||||
// moduleGuideViewPager.adapter = adapter
|
||||
adapter = GuideAdapter(this)
|
||||
moduleGuideViewPager.adapter = adapter
|
||||
}
|
||||
|
||||
fun moveToNext() {
|
||||
val count = adapter?.itemCount
|
||||
if (moduleGuideViewPager.currentItem != count) {
|
||||
moduleGuideViewPager.currentItem = moduleGuideViewPager.currentItem + 1
|
||||
}
|
||||
}
|
||||
|
||||
fun moveToLast() {
|
||||
moduleGuideViewPager.setCurrentItem(adapter!!.itemCount, false)
|
||||
}
|
||||
|
||||
fun closeGuideFragment() {
|
||||
Logger.d(TAG, "closeGuideFragment")
|
||||
val authorizeInvoke = ARouter.getInstance().build(AuthorizeConstant.PROVIDER_MODULE).navigation()
|
||||
if (authorizeInvoke is IMogoAuthorizeModuleManager) {
|
||||
if (authorizeInvoke.needAuthorize()) {
|
||||
authorizeInvoke.invokeAuthorizeForShow()
|
||||
} else {
|
||||
destroy()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun destroy() {
|
||||
GuideBizManager.removeGuideFragmentToStack()
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,20 @@
|
||||
package com.mogo.module.guide.guide
|
||||
|
||||
import android.view.View
|
||||
import com.mogo.commons.mvp.IView
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.mogo.module.guide.R
|
||||
import com.mogo.module.guide.fragment.GuideFragment
|
||||
import kotlinx.android.synthetic.main.module_guide_item_app_list.*
|
||||
|
||||
class GuideAppListFragment : MvpFragment<IView, Presenter<IView>>() {
|
||||
class GuideAppListFragment : MvpFragment<IView, Presenter<IView>>, View.OnClickListener {
|
||||
|
||||
private var containerFragment: GuideFragment? = null
|
||||
|
||||
constructor(containerFragment: GuideFragment) {
|
||||
this.containerFragment = containerFragment
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.module_guide_item_app_list
|
||||
@@ -16,7 +25,19 @@ class GuideAppListFragment : MvpFragment<IView, Presenter<IView>>() {
|
||||
}
|
||||
|
||||
override fun initViews() {
|
||||
moduleGuideAppListNext.setOnClickListener(this)
|
||||
moduleGuideAppListSkip.setOnClickListener(this)
|
||||
}
|
||||
|
||||
override fun onClick(v: View) {
|
||||
when (v.id) {
|
||||
R.id.moduleGuideAppListNext -> {
|
||||
containerFragment?.moveToNext()
|
||||
}
|
||||
R.id.moduleGuideAppListSkip -> {
|
||||
containerFragment?.moveToLast()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class GuideAppListPresenter : Presenter<IView> {
|
||||
|
||||
@@ -1,11 +1,20 @@
|
||||
package com.mogo.module.guide.guide
|
||||
|
||||
import android.view.View
|
||||
import com.mogo.commons.mvp.IView
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.mogo.module.guide.R
|
||||
import com.mogo.module.guide.fragment.GuideFragment
|
||||
import kotlinx.android.synthetic.main.module_guide_item_card.*
|
||||
|
||||
class GuideCardFragment : MvpFragment<IView, Presenter<IView>>() {
|
||||
class GuideCardFragment : MvpFragment<IView, Presenter<IView>>, View.OnClickListener {
|
||||
|
||||
private var containerFragment:GuideFragment? = null
|
||||
|
||||
constructor(containerFragment:GuideFragment){
|
||||
this.containerFragment = containerFragment
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.module_guide_item_card
|
||||
@@ -16,7 +25,19 @@ class GuideCardFragment : MvpFragment<IView, Presenter<IView>>() {
|
||||
}
|
||||
|
||||
override fun initViews() {
|
||||
moduleGuideCardNext.setOnClickListener(this)
|
||||
moduleGuideCardSkip.setOnClickListener(this)
|
||||
}
|
||||
|
||||
override fun onClick(v: View) {
|
||||
when (v.id) {
|
||||
R.id.moduleGuideCardNext -> {
|
||||
containerFragment?.moveToNext()
|
||||
}
|
||||
R.id.moduleGuideCardSkip -> {
|
||||
containerFragment?.moveToLast()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class GuideCardPresenter : Presenter<IView> {
|
||||
|
||||
@@ -1,11 +1,20 @@
|
||||
package com.mogo.module.guide.guide
|
||||
|
||||
import android.view.View
|
||||
import com.mogo.commons.mvp.IView
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.mogo.module.guide.R
|
||||
import com.mogo.module.guide.fragment.GuideFragment
|
||||
import kotlinx.android.synthetic.main.module_guide_item_entry_main.*
|
||||
|
||||
class GuideEntryMainFragment : MvpFragment<IView, Presenter<IView>>() {
|
||||
class GuideEntryMainFragment : MvpFragment<IView, Presenter<IView>>,View.OnClickListener {
|
||||
|
||||
private var containerFragment: GuideFragment? = null
|
||||
|
||||
constructor(containerFragment: GuideFragment) {
|
||||
this.containerFragment = containerFragment
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.module_guide_item_entry_main
|
||||
@@ -16,9 +25,16 @@ class GuideEntryMainFragment : MvpFragment<IView, Presenter<IView>>() {
|
||||
}
|
||||
|
||||
override fun initViews() {
|
||||
|
||||
moduleGuideEntryMain.setOnClickListener(this)
|
||||
}
|
||||
|
||||
override fun onClick(v: View) {
|
||||
when(v.id){
|
||||
R.id.moduleGuideEntryMain -> {
|
||||
containerFragment?.closeGuideFragment()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class GuideEntryPresenter : Presenter<IView> {
|
||||
|
||||
|
||||
@@ -1,11 +1,20 @@
|
||||
package com.mogo.module.guide.guide
|
||||
|
||||
import android.view.View
|
||||
import com.mogo.commons.mvp.IView
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.mogo.module.guide.R
|
||||
import com.mogo.module.guide.fragment.GuideFragment
|
||||
import kotlinx.android.synthetic.main.module_guide_item_location.*
|
||||
|
||||
class GuideLocationFragment : MvpFragment<IView, Presenter<IView>>() {
|
||||
class GuideLocationFragment : MvpFragment<IView, Presenter<IView>>, View.OnClickListener {
|
||||
|
||||
private var containerFragment: GuideFragment? = null
|
||||
|
||||
constructor(containerFragment: GuideFragment) {
|
||||
this.containerFragment = containerFragment
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.module_guide_item_location
|
||||
@@ -16,7 +25,19 @@ class GuideLocationFragment : MvpFragment<IView, Presenter<IView>>() {
|
||||
}
|
||||
|
||||
override fun initViews() {
|
||||
moduleGuideLocationNext.setOnClickListener(this)
|
||||
moduleGuideLocationSkip.setOnClickListener(this)
|
||||
}
|
||||
|
||||
override fun onClick(v: View) {
|
||||
when (v.id) {
|
||||
R.id.moduleGuideLocationNext -> {
|
||||
containerFragment?.moveToNext()
|
||||
}
|
||||
R.id.moduleGuideLocationSkip -> {
|
||||
containerFragment?.moveToLast()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class GuideLocationPresenter : Presenter<IView> {
|
||||
|
||||
@@ -1,11 +1,20 @@
|
||||
package com.mogo.module.guide.guide
|
||||
|
||||
import android.view.View
|
||||
import com.mogo.commons.mvp.IView
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.mogo.module.guide.R
|
||||
import com.mogo.module.guide.fragment.GuideFragment
|
||||
import kotlinx.android.synthetic.main.module_guide_item_navigation.*
|
||||
|
||||
class GuideNavigationFragment : MvpFragment<IView, Presenter<IView>>() {
|
||||
class GuideNavigationFragment : MvpFragment<IView, Presenter<IView>>, View.OnClickListener {
|
||||
|
||||
private var containerFragment: GuideFragment? = null
|
||||
|
||||
constructor(containerFragment: GuideFragment) {
|
||||
this.containerFragment = containerFragment
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.module_guide_item_navigation
|
||||
@@ -16,7 +25,19 @@ class GuideNavigationFragment : MvpFragment<IView, Presenter<IView>>() {
|
||||
}
|
||||
|
||||
override fun initViews() {
|
||||
moduleGuideNavigationNext.setOnClickListener(this)
|
||||
moduleGuideNavigationSkip.setOnClickListener(this)
|
||||
}
|
||||
|
||||
override fun onClick(v: View) {
|
||||
when (v.id) {
|
||||
R.id.moduleGuideNavigationNext -> {
|
||||
containerFragment?.moveToNext()
|
||||
}
|
||||
R.id.moduleGuideNavigationSkip -> {
|
||||
containerFragment?.moveToLast()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class GuideNavigationPresenter : Presenter<IView> {
|
||||
|
||||
@@ -1,11 +1,20 @@
|
||||
package com.mogo.module.guide.guide
|
||||
|
||||
import android.view.View
|
||||
import com.mogo.commons.mvp.IView
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.mogo.module.guide.R
|
||||
import com.mogo.module.guide.fragment.GuideFragment
|
||||
import kotlinx.android.synthetic.main.module_guide_item_online_car.*
|
||||
|
||||
class GuideOnLineCarFragment : MvpFragment<IView, Presenter<IView>>() {
|
||||
class GuideOnLineCarFragment : MvpFragment<IView, Presenter<IView>>, View.OnClickListener {
|
||||
|
||||
private var containerFragment: GuideFragment? = null
|
||||
|
||||
constructor(containerFragment: GuideFragment) {
|
||||
this.containerFragment = containerFragment
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.module_guide_item_online_car
|
||||
@@ -16,7 +25,19 @@ class GuideOnLineCarFragment : MvpFragment<IView, Presenter<IView>>() {
|
||||
}
|
||||
|
||||
override fun initViews() {
|
||||
moduleGuideOnLineCarNext.setOnClickListener(this)
|
||||
moduleGuideOnLineCarSkip.setOnClickListener(this)
|
||||
}
|
||||
|
||||
override fun onClick(v: View) {
|
||||
when (v.id) {
|
||||
R.id.moduleGuideOnLineCarNext -> {
|
||||
containerFragment?.moveToNext()
|
||||
}
|
||||
R.id.moduleGuideOnLineCarSkip -> {
|
||||
containerFragment?.moveToLast()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class GuideOnLineCarPresenter : Presenter<IView> {
|
||||
|
||||
Reference in New Issue
Block a user