add module of authorize and guide ,wait to finish

This commit is contained in:
unknown
2020-03-25 13:20:26 +08:00
parent f00fa093cb
commit 280c519229
101 changed files with 4017 additions and 10 deletions

View File

@@ -0,0 +1,24 @@
package com.mogo.module.guide.agreement
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.mogo.module.guide.agreement.test", appContext.packageName)
}
}

View File

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

View File

@@ -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)
}
}
}
}

View File

@@ -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"
}
}

View File

@@ -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
}
}

View File

@@ -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())
}
}

View File

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

View File

@@ -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
}
}

View File

@@ -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)
}
}

View File

@@ -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)
}
}

View File

@@ -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)
}
}

View File

@@ -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)
}
}

View File

@@ -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)
}
}

View File

@@ -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)
}
}

View File

@@ -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)
}
}

View File

@@ -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)
}
}

View File

@@ -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)
}
}

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape>
<corners android:radius="@dimen/dp_53" />
<gradient android:endColor="#FF31A8AA" android:startColor="#FF0068CB" />
</shape>
</item>
<item>
<shape>
<corners android:radius="@dimen/dp_53" />
<gradient android:endColor="#5CC1FF" android:startColor="#3E7FFC" />
</shape>
</item>
</selector>

View File

@@ -0,0 +1,15 @@
<?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" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
</LinearLayout>

View File

@@ -0,0 +1,34 @@
<?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"
android:background="@mipmap/module_guide_item_app_list">
<TextView
android:id="@+id/moduleGuideAppListNext"
android:layout_width="@dimen/dp_299"
android:layout_height="@dimen/dp_106"
android:layout_marginRight="@dimen/dp_521"
android:layout_marginBottom="@dimen/dp_132"
android:background="@drawable/module_guide_selector_blue"
android:gravity="center"
android:text="@string/module_guide_item_next_step"
android:textColor="@android:color/white"
android:textSize="@dimen/dp_44"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<TextView
android:id="@+id/moduleGuideAppListSkip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_77"
android:layout_marginRight="@dimen/dp_77"
android:gravity="center"
android:text="@string/module_guide_skip"
android:textColor="@color/module_guide_blue_3B91FF"
android:textSize="@dimen/dp_44"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,34 @@
<?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"
android:background="@mipmap/module_guide_item_card">
<TextView
android:id="@+id/moduleGuideCardNext"
android:layout_width="@dimen/dp_299"
android:layout_height="@dimen/dp_106"
android:layout_marginRight="@dimen/dp_592"
android:layout_marginBottom="@dimen/dp_205"
android:background="@drawable/module_guide_selector_blue"
android:gravity="center"
android:text="@string/module_guide_item_next_step"
android:textColor="@android:color/white"
android:textSize="@dimen/dp_44"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<TextView
android:id="@+id/moduleGuideCardSkip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_77"
android:layout_marginRight="@dimen/dp_77"
android:gravity="center"
android:text="@string/module_guide_skip"
android:textColor="@color/module_guide_blue_3B91FF"
android:textSize="@dimen/dp_44"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,22 @@
<?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"
android:background="@mipmap/module_guide_item_entry_main">
<TextView
android:id="@+id/moduleGuideEntryMain"
android:layout_width="@dimen/dp_299"
android:layout_height="@dimen/dp_106"
android:layout_marginBottom="@dimen/dp_132"
android:background="@drawable/module_guide_selector_blue"
android:gravity="center"
android:text="@string/module_guide_item_entry_main"
android:textColor="@android:color/white"
android:textSize="@dimen/dp_44"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,34 @@
<?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"
android:background="@mipmap/module_guide_item_location">
<TextView
android:id="@+id/moduleGuideLocationNext"
android:layout_width="@dimen/dp_299"
android:layout_height="@dimen/dp_106"
android:layout_marginLeft="@dimen/dp_787"
android:layout_marginBottom="@dimen/dp_125"
android:background="@drawable/module_guide_selector_blue"
android:gravity="center"
android:text="@string/module_guide_item_next_step"
android:textColor="@android:color/white"
android:textSize="@dimen/dp_44"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="@+id/moduleGuideLocationSkip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_77"
android:layout_marginRight="@dimen/dp_77"
android:gravity="center"
android:text="@string/module_guide_skip"
android:textColor="@color/module_guide_blue_3B91FF"
android:textSize="@dimen/dp_44"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,34 @@
<?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"
android:background="@mipmap/module_guide_item_navigation">
<TextView
android:id="@+id/moduleGuideNavigationNext"
android:layout_width="@dimen/dp_299"
android:layout_height="@dimen/dp_106"
android:layout_marginLeft="@dimen/dp_787"
android:layout_marginBottom="@dimen/dp_125"
android:background="@drawable/module_guide_selector_blue"
android:gravity="center"
android:text="@string/module_guide_item_next_step"
android:textColor="@android:color/white"
android:textSize="@dimen/dp_44"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="@+id/moduleGuideNavigationSkip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_77"
android:layout_marginRight="@dimen/dp_77"
android:gravity="center"
android:text="@string/module_guide_skip"
android:textColor="@color/module_guide_blue_3B91FF"
android:textSize="@dimen/dp_44"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,34 @@
<?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"
android:background="@mipmap/module_guide_item_online_car">
<TextView
android:id="@+id/moduleGuideOnLineCarNext"
android:layout_width="@dimen/dp_299"
android:layout_height="@dimen/dp_106"
android:layout_marginLeft="@dimen/dp_850"
android:layout_marginBottom="@dimen/dp_95"
android:background="@drawable/module_guide_selector_blue"
android:gravity="center"
android:text="@string/module_guide_item_next_step"
android:textColor="@android:color/white"
android:textSize="@dimen/dp_44"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="@+id/moduleGuideOnLineCarSkip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_77"
android:layout_marginRight="@dimen/dp_77"
android:gravity="center"
android:text="@string/module_guide_skip"
android:textColor="@color/module_guide_blue_3B91FF"
android:textSize="@dimen/dp_44"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 322 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 423 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 329 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 386 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 320 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 335 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 KiB

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

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

View File

@@ -0,0 +1,6 @@
<resources>
<string name="app_name">mogo-module-guide-agreement</string>
<string name="module_guide_item_entry_main">进入首页</string>
<string name="module_guide_item_next_step">下一步</string>
<string name="module_guide_skip">跳过教程</string>
</resources>

View File

@@ -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)
}
}