修改module-byd为module-splash,暂未使用module-splash-noop模块

This commit is contained in:
tongchenfei
2020-07-15 19:05:07 +08:00
parent e525cd7f3e
commit 413b0f2a99
35 changed files with 76 additions and 96 deletions

View File

@@ -0,0 +1,24 @@
package com.zhidao.mogo.module.splash
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.zhidao.mogo.module.byd.test", appContext.packageName)
}
}

View File

@@ -0,0 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.zhidao.mogo.module.splash">
/
</manifest>

View File

@@ -0,0 +1,6 @@
package com.zhidao.mogo.module.splash
object BydConst {
const val MODULE_NAME = "MODULE_SPLASH"
const val PATH_NAME = "/splash/api"
}

View File

@@ -0,0 +1,76 @@
package com.zhidao.mogo.module.splash
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.commons.debug.DebugConfig
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.service.module.IMogoModuleLifecycle
import com.mogo.service.module.IMogoModuleProvider
import com.mogo.utils.logger.Logger
import com.zhidao.mogo.module.splash.BydConst.MODULE_NAME
import com.zhidao.mogo.module.splash.BydConst.PATH_NAME
import com.zhidao.mogo.module.splash.fragment.BydSplashFragment
/**
* 比亚迪车机provider
*
* @author tongchenfei
*/
@Route(path = PATH_NAME)
class BydProvider : IMogoModuleProvider {
override fun getNaviListener(): IMogoNaviListener? {
return null
}
override fun getLocationListener(): IMogoLocationListener? {
return null
}
override fun getType(): Int {
return 0
}
override fun getMarkerClickListener(): IMogoMarkerClickListener? {
return null
}
override fun init(context: Context?) {
Logger.d(MODULE_NAME, "比亚迪模块初始化===")
}
override fun getMapListener(): IMogoMapListener? {
return null
}
override fun getAppPackage(): String {
return ""
}
override fun createView(context: Context?): View? {
return null
}
override fun createFragment(context: Context?, data: Bundle?): Fragment? = if (DebugConfig.getCarMachineType() == DebugConfig.CAR_MACHINE_TYPE_BYD) {
BydSplashFragment()
} else {
null
}
override fun getModuleName(): String {
return MODULE_NAME
}
override fun getAppName(): String {
return ""
}
override fun getCardLifecycle(): IMogoModuleLifecycle? {
return null
}
}

View File

@@ -0,0 +1,19 @@
package com.zhidao.mogo.module.splash.fragment
import com.mogo.commons.mvp.MvpFragment
import com.zhidao.mogo.module.splash.R
import com.zhidao.mogo.module.splash.presenter.BydSplashPresenter
import kotlinx.android.synthetic.main.fragment_byd_splash.*
class BydSplashFragment :MvpFragment<BydSplashFragment,BydSplashPresenter>(){
override fun getLayoutId(): Int = R.layout.fragment_byd_splash
override fun initViews() {
tvByd.setOnClickListener {
activity!!.supportFragmentManager.beginTransaction().remove(this).commit()
}
}
override fun createPresenter(): BydSplashPresenter = BydSplashPresenter(this)
}

View File

@@ -0,0 +1,7 @@
package com.zhidao.mogo.module.splash.presenter
import com.mogo.commons.mvp.Presenter
import com.zhidao.mogo.module.splash.fragment.BydSplashFragment
class BydSplashPresenter(view: BydSplashFragment) : Presenter<BydSplashFragment>(view) {
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View File

@@ -0,0 +1,23 @@
<?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="#fff">
<TextView
android:id="@+id/tvByd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#fff"
android:drawableTop="@drawable/binli"
android:drawablePadding="10dp"
android:gravity="center"
android:text="比亚迪"
android:textSize="40sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,17 @@
package com.zhidao.mogo.module.splash
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)
}
}