[6.7.0]
[fea] [启动自驾添加到容器中]
This commit is contained in:
@@ -4,6 +4,7 @@ import android.content.Context
|
||||
import android.view.View
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.alibaba.android.arouter.facade.template.IProvider
|
||||
import com.mogo.och.common.module.wigets.autopilot.AutopilotState
|
||||
|
||||
interface CommonService : IProvider {
|
||||
|
||||
@@ -15,4 +16,12 @@ interface CommonService : IProvider {
|
||||
|
||||
fun invokeByName(type:String,value:Any){}
|
||||
|
||||
fun createOchBusinessView(context: Context?):View?{return null}
|
||||
|
||||
fun createStartAutopilotView(context: Context?):View?{
|
||||
return context?.let {
|
||||
AutopilotState(it)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,7 +10,6 @@ import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import androidx.fragment.app.FragmentManager
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.commons.env.ProjectUtils
|
||||
import com.mogo.commons.utils.MogoAnalyticUtils
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
@@ -45,7 +44,10 @@ abstract class FacadeProvider : IMoGoFunctionProvider, ILoginCallback {
|
||||
private var containerId = 0
|
||||
private var activity: FragmentActivity? = null
|
||||
private val TAG = "FacadeProvider"
|
||||
private var commonService: CommonService? = null
|
||||
private var _commonService: CommonService? = null
|
||||
val commonService:CommonService?
|
||||
get() = _commonService
|
||||
|
||||
override fun init(context: Context) {
|
||||
d(TAG, "FacadeProvider:init")
|
||||
LoginStatusManager.addListener(TAG, this)
|
||||
@@ -69,7 +71,7 @@ abstract class FacadeProvider : IMoGoFunctionProvider, ILoginCallback {
|
||||
CallerHmiManager.hideToolsView()
|
||||
ToggleDebugView.toggleDebugView.dismiss()
|
||||
SopView.sopView.dismiss()
|
||||
commonService?.resetFragment()
|
||||
_commonService?.resetFragment()
|
||||
removeStatusBar()
|
||||
LoginStatusManager.getFragment()
|
||||
}
|
||||
@@ -145,8 +147,8 @@ abstract class FacadeProvider : IMoGoFunctionProvider, ILoginCallback {
|
||||
}
|
||||
|
||||
private fun getFragmentByServeName(serviceName: String): Fragment {
|
||||
commonService = ARouter.getInstance().build(serviceName).navigation() as CommonService?
|
||||
return if (commonService == null) {
|
||||
_commonService = ARouter.getInstance().build(serviceName).navigation() as CommonService?
|
||||
return if (_commonService == null) {
|
||||
try {
|
||||
LoginStatusManager.getFragment()
|
||||
} catch (e: ClassNotFoundException) {
|
||||
@@ -158,7 +160,7 @@ abstract class FacadeProvider : IMoGoFunctionProvider, ILoginCallback {
|
||||
Fragment()
|
||||
}
|
||||
} else {
|
||||
commonService!!.getFragment()
|
||||
_commonService!!.getFragment()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,7 +218,7 @@ abstract class FacadeProvider : IMoGoFunctionProvider, ILoginCallback {
|
||||
SopView.sopView.dismiss()
|
||||
CallerHmiManager.dismissFSMExceptionStatusWindow()
|
||||
CallerHmiManager.hideStatusSummaryDialog()
|
||||
commonService?.resetFragment()
|
||||
_commonService?.resetFragment()
|
||||
val fragment = LoginStatusManager.getFragment()
|
||||
val supportFragmentManager: FragmentManager? = activity?.supportFragmentManager
|
||||
if (supportFragmentManager != null) {
|
||||
@@ -249,7 +251,7 @@ abstract class FacadeProvider : IMoGoFunctionProvider, ILoginCallback {
|
||||
contentView.fitsSystemWindows = false
|
||||
decorView.clipToPadding = false
|
||||
var statusBarView = decorView.findViewWithTag<View>("status_bar")
|
||||
val statusBar = commonService?.getStatusBarView(it)
|
||||
val statusBar = _commonService?.getStatusBarView(it)
|
||||
if(statusBarView==null){
|
||||
|
||||
}else{
|
||||
@@ -272,7 +274,7 @@ abstract class FacadeProvider : IMoGoFunctionProvider, ILoginCallback {
|
||||
return
|
||||
}
|
||||
}
|
||||
CallerLogger.d(TAG, "添加statusBar---${commonService}")
|
||||
CallerLogger.d(TAG, "添加statusBar---${_commonService}")
|
||||
decorView.addView(statusBarView, statusBarLP)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
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.alibaba.android.arouter.launcher.ARouter
|
||||
import com.mogo.eagle.core.function.api.och.IOchCustomViewProvider
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.och.common.module.biz.provider.CommonService
|
||||
import com.mogo.och.facade.constant.FacadeConst
|
||||
import com.mogo.och.facade.route.FacadeProvider
|
||||
import kotlin.random.Random
|
||||
|
||||
@Route(path = FacadeConst.OCH_VIEW_PATH)
|
||||
@@ -18,45 +18,41 @@ class OchCustomViewProvider : IOchCustomViewProvider {
|
||||
const val TAG = "OchCustomViewProvider"
|
||||
}
|
||||
|
||||
private var commonService: CommonService?=null
|
||||
|
||||
override fun init(context: Context?) {
|
||||
CallerLogger.d(TAG, "init")
|
||||
getCommontService(context)
|
||||
}
|
||||
|
||||
private fun getCommontService(context: Context?){
|
||||
val temp = ARouter.getInstance().build(FacadeConst.DRIVER_PATH).navigation(context)
|
||||
if(temp is FacadeProvider){
|
||||
commonService = temp.commonService
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建 Och业务层 自定义View
|
||||
*/
|
||||
override fun createOchBusinessView(context: Context?): View? {
|
||||
if(commonService==null){
|
||||
getCommontService(context)
|
||||
}
|
||||
return context?.let {
|
||||
TextView(it).apply {
|
||||
text = "业务自定义View"
|
||||
gravity = Gravity.CENTER
|
||||
setBackgroundColor(
|
||||
Color.rgb(
|
||||
Random.nextInt(256),
|
||||
Random.nextInt(256),
|
||||
Random.nextInt(256)
|
||||
)
|
||||
)
|
||||
}
|
||||
} ?: null
|
||||
commonService?.createOchBusinessView(it)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建 自动自动驾驶 自定义 View
|
||||
*/
|
||||
override fun createStartAutopilotView(context: Context?): View? {
|
||||
if(commonService==null){
|
||||
getCommontService(context)
|
||||
}
|
||||
return context?.let {
|
||||
TextView(it).apply {
|
||||
text = "启动自动驾驶"
|
||||
gravity = Gravity.CENTER
|
||||
setBackgroundColor(
|
||||
Color.rgb(
|
||||
Random.nextInt(256),
|
||||
Random.nextInt(256),
|
||||
Random.nextInt(256)
|
||||
)
|
||||
)
|
||||
}
|
||||
commonService?.createStartAutopilotView(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.och.weaknet
|
||||
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
@@ -15,6 +16,7 @@ import com.mogo.och.weaknet.repository.db.repository.TaskRepository
|
||||
import com.mogo.och.weaknet.repository.db.repository.TaskSiteRepository
|
||||
import com.mogo.och.weaknet.ui.fragment.ShuttleFragment
|
||||
import com.mogo.och.weaknet.model.LineModel
|
||||
import com.mogo.och.weaknet.ui.bizswitch.SwitchBizView
|
||||
import com.mogo.och.weaknet.util.BusAnalyticsManager
|
||||
|
||||
/**
|
||||
@@ -53,4 +55,9 @@ class ShuttleDriverProvider : CommonServiceImpl() {
|
||||
LineModel.release()
|
||||
}
|
||||
|
||||
override fun createOchBusinessView(context: Context?): View? {
|
||||
return context?.let {
|
||||
SwitchBizView(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,10 +25,10 @@
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/startAutoPilotContainer"
|
||||
android:layout_width="@dimen/dp_226"
|
||||
android:layout_height="@dimen/dp_226"
|
||||
android:layout_marginTop="@dimen/dp_44"
|
||||
android:layout_marginRight="@dimen/dp_68"
|
||||
android:layout_width="@dimen/dp_282"
|
||||
android:layout_height="@dimen/dp_282"
|
||||
android:layout_marginTop="@dimen/dp_18_5"
|
||||
android:layout_marginRight="@dimen/dp_43"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
<dimen name="dp_16_5">16.5dp</dimen>
|
||||
<dimen name="dp_17">17dp</dimen>
|
||||
<dimen name="dp_18">18dp</dimen>
|
||||
<dimen name="dp_18_5">18.5dp</dimen>
|
||||
<dimen name="dp_19">19dp</dimen>
|
||||
<dimen name="dp_20">20dp</dimen>
|
||||
<dimen name="dp_21">21dp</dimen>
|
||||
|
||||
Reference in New Issue
Block a user