[6.7.0][启自驾] feat: 增加启自驾父容器 View;
feat: 增驾调用 Och 自定义 view 接口&provider ;
This commit is contained in:
@@ -8,6 +8,6 @@ class FacadeConst {
|
||||
// OCH arouter 路由path
|
||||
const val DRIVER_PATH = "/driver/api"
|
||||
const val PASSENGER_PATH = "/passenger/api"
|
||||
|
||||
const val OCH_VIEW_PATH = "/och/view/api"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.mogo.och.facade.view
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.view.Gravity
|
||||
import android.view.View
|
||||
import android.widget.TextView
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.mogo.eagle.core.function.api.och.IOchCustomViewProvider
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.och.facade.constant.FacadeConst
|
||||
import kotlin.random.Random
|
||||
|
||||
@Route(path = FacadeConst.OCH_VIEW_PATH)
|
||||
class OchCustomViewProvider : IOchCustomViewProvider {
|
||||
|
||||
companion object {
|
||||
const val TAG = "OchCustomViewProvider"
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
CallerLogger.d(TAG, "init")
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建 Och业务层 自定义View
|
||||
*/
|
||||
override fun createOchBusinessView(context: Context?): View? {
|
||||
return context?.let {
|
||||
TextView(it).apply {
|
||||
text = "业务自定义View"
|
||||
gravity = Gravity.CENTER
|
||||
setBackgroundColor(
|
||||
Color.rgb(
|
||||
Random.nextInt(256),
|
||||
Random.nextInt(256),
|
||||
Random.nextInt(256)
|
||||
)
|
||||
)
|
||||
}
|
||||
} ?: null
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建 自动自动驾驶 自定义 View
|
||||
*/
|
||||
override fun createStartAutopilotView(context: Context?): View? {
|
||||
return context?.let {
|
||||
TextView(it).apply {
|
||||
text = "启动自动驾驶"
|
||||
gravity = Gravity.CENTER
|
||||
setBackgroundColor(
|
||||
Color.rgb(
|
||||
Random.nextInt(256),
|
||||
Random.nextInt(256),
|
||||
Random.nextInt(256)
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user