diff --git a/OCH/taxi/unmanned-passenger/src/main/java/com/mogo/och/unmanned/passenger/ui/homepage/HomeView.kt b/OCH/taxi/unmanned-passenger/src/main/java/com/mogo/och/unmanned/passenger/ui/homepage/HomeView.kt index f2b49ae340..8493f3a364 100644 --- a/OCH/taxi/unmanned-passenger/src/main/java/com/mogo/och/unmanned/passenger/ui/homepage/HomeView.kt +++ b/OCH/taxi/unmanned-passenger/src/main/java/com/mogo/och/unmanned/passenger/ui/homepage/HomeView.kt @@ -12,24 +12,20 @@ import androidx.constraintlayout.widget.Guideline import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.findViewTreeViewModelStoreOwner import com.mogo.eagle.core.data.map.MogoLatLng -import com.mogo.eagle.core.function.view.DecisionLayout -import com.mogo.eagle.core.function.view.PredictionLayout import com.mogo.eagle.core.utilcode.kotlin.onClick import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.och.bridge.autopilot.location.OchLocationManager -import com.mogo.och.common.module.utils.RxUtils import com.mogo.och.unmanned.passenger.ui.bar.LeftBarView import com.mogo.och.unmanned.taxi.passenger.R import kotlinx.android.synthetic.main.taxi_p_home.view.acbtn_show_all -import kotlinx.android.synthetic.main.taxi_p_home.view.acbtn_show_hdmap_create -import kotlinx.android.synthetic.main.taxi_p_home.view.acbtn_show_hdmap_destory +import kotlinx.android.synthetic.main.taxi_p_home.view.acbtn_show_hdmap import kotlinx.android.synthetic.main.taxi_p_home.view.decContainer import kotlinx.android.synthetic.main.taxi_p_home.view.hdMapView +import kotlinx.android.synthetic.main.taxi_p_home.view.preContainer import kotlinx.android.synthetic.main.taxi_p_home.view.lbv_go2_center import kotlinx.android.synthetic.main.taxi_p_home.view.leftEndGuideline import kotlinx.android.synthetic.main.taxi_p_home.view.midContainer import kotlinx.android.synthetic.main.taxi_p_home.view.midStartGuideline -import kotlinx.android.synthetic.main.taxi_p_home.view.preContainer class HomeView @JvmOverloads constructor( context: Context, @@ -47,9 +43,6 @@ class HomeView @JvmOverloads constructor( private var viewModel: HomeViewModel?=null - private var predictionLayout: PredictionLayout? = null - private var decisionLayout: DecisionLayout? = null - private fun initView() { @@ -61,21 +54,18 @@ class HomeView @JvmOverloads constructor( private fun initlistener() { lbv_go2_center.setOrderIdCallback(object : LeftBarView.LeftBarCallback{ override fun setGo2CenterClick() { - //切换到地图中间 + //切换到地图中间 hdMapView.getUI()?.let { val wgs02Location = OchLocationManager.getWgs02Location() it.moveToCenter(MogoLatLng(wgs02Location.latitude, wgs02Location.longitude)) } - //overMapView.displayCustomOverView() + //overMapView.displayCustomOverView() } }) - acbtn_show_hdmap_create.onClick { - showHdMap(false) - } - acbtn_show_hdmap_destory.onClick { - showHdMap(true) + acbtn_show_hdmap.onClick { + showHdMap() } acbtn_show_all.onClick { showAmapAndHdMap() @@ -86,82 +76,51 @@ class HomeView @JvmOverloads constructor( /** * 展示两屏幕 */ - fun showHdMap(destoryMap: Boolean){ - CallerLogger.d(TAG,"展示高德 不展示高精") - if(destoryMap){ - leftEndGuideline.setGuidelinePercent(0.666f) - lbv_go2_center.visibility = VISIBLE - midContainer.visibility = GONE - destoryMaps() - }else{ - if(predictionLayout==null||decisionLayout==null){ - createMaps() - leftEndGuideline.setGuidelinePercent(0.666f) - lbv_go2_center.visibility = VISIBLE - midContainer.visibility = GONE - }else { - leftEndGuideline.setGuidelinePercent(0.666f) - lbv_go2_center.visibility = VISIBLE - midContainer.visibility = GONE - } - } - + fun showHdMap(){ + updateViewState(true,false,false) } /** * 展示3屏 */ fun showAmapAndHdMap(){ - // 展示预测地图和高精地图 - CallerLogger.d(TAG,"展示高德地图和高精地图") - if(predictionLayout==null||decisionLayout==null){ - createMaps() - midStartGuideline.setGuidelinePercent(0.333f) - leftEndGuideline.setGuidelinePercent(0.333f) - lbv_go2_center.visibility = GONE - midContainer.visibility = VISIBLE - }else { - midStartGuideline.setGuidelinePercent(0.333f) - leftEndGuideline.setGuidelinePercent(0.333f) - lbv_go2_center.visibility = GONE - midContainer.visibility = VISIBLE - } + updateViewState(true,true,false) } fun onCreate(savedInstanceState: Bundle?) { hdMapView.onCreate(savedInstanceState) - predictionLayout?.onCreate(savedInstanceState) - decisionLayout?.onCreate(savedInstanceState) + preContainer.onCreate(savedInstanceState) + decContainer.onCreate(savedInstanceState) } fun onSaveInstanceState(outState: Bundle) { hdMapView.onSaveInstanceState(outState) - predictionLayout?.onSaveInstanceState(outState) - decisionLayout?.onSaveInstanceState(outState) + preContainer.onSaveInstanceState(outState) + decContainer.onSaveInstanceState(outState) } fun onResume() { hdMapView.onResume() - predictionLayout?.onResume() - decisionLayout?.onResume() + preContainer.onResume() + decContainer.onResume() } fun onLowMemory() { hdMapView.onLowMemory() - predictionLayout?.onLowMemory() - decisionLayout?.onLowMemory() + preContainer.onLowMemory() + decContainer.onLowMemory() } fun onPause() { hdMapView.onPause() - predictionLayout?.onPause() - decisionLayout?.onPause() + preContainer.onPause() + decContainer.onPause() } fun onDestroy() { hdMapView.onDestroy() - predictionLayout?.onDestroy() - decisionLayout?.onDestroy() + preContainer.onDestroy() + decContainer.onDestroy() } override fun onAttachedToWindow() { @@ -290,40 +249,12 @@ class HomeView @JvmOverloads constructor( } } - override fun showTwoScreen(destoryMap:Boolean) { - showHdMap(destoryMap) + override fun showTwoScreen() { + showHdMap() } override fun showThreeScreen() { showAmapAndHdMap() } - private fun createMaps(){ - if(predictionLayout == null){ - predictionLayout = PredictionLayout(context) - predictionLayout?.id = R.id.prediction_layout_id - preContainer.addView(predictionLayout) - predictionLayout?.onCreate(null) - predictionLayout?.onResume() - } - if(decisionLayout == null){ - decisionLayout = DecisionLayout(context) - decisionLayout?.id = R.id.decision_layout_id - decContainer.addView(decisionLayout) - decisionLayout?.onCreate(null) - decisionLayout?.onResume() - } - } - - private fun destoryMaps() { - predictionLayout?.onDestroy() - decisionLayout?.onDestroy() - RxUtils.createSubscribe(50) { - preContainer.removeView(predictionLayout) - decContainer.removeView(decisionLayout) - predictionLayout = null - decisionLayout = null - } - } - } \ No newline at end of file diff --git a/OCH/taxi/unmanned-passenger/src/main/java/com/mogo/och/unmanned/passenger/ui/homepage/HomeViewModel.kt b/OCH/taxi/unmanned-passenger/src/main/java/com/mogo/och/unmanned/passenger/ui/homepage/HomeViewModel.kt index e0bd69becc..355b465fd2 100644 --- a/OCH/taxi/unmanned-passenger/src/main/java/com/mogo/och/unmanned/passenger/ui/homepage/HomeViewModel.kt +++ b/OCH/taxi/unmanned-passenger/src/main/java/com/mogo/och/unmanned/passenger/ui/homepage/HomeViewModel.kt @@ -35,7 +35,7 @@ class HomeViewModel : ViewModel(), BridgeListener, OrderListener { } interface HomeCallback { - fun showTwoScreen(destoryMap:Boolean) + fun showTwoScreen() fun showThreeScreen() } @@ -56,31 +56,19 @@ class HomeViewModel : ViewModel(), BridgeListener, OrderListener { fun checkScreenChange(){ CallerLogger.d(TAG,"havePredictionInfos:${havePredictionInfos}--haveTrajectoryInfos:${haveTrajectoryInfos}--order:${order}") - - if(order==null){ - // 进入双屏 需要销毁创建4张地图 + if(order!=null&&havePredictionInfos&&havePredictionInfos){ + FunctionBuildConfig.isDrawDecIdentifyData = true + FunctionBuildConfig.isDrawPreIdentifyData = true + // 展示三联屏 + BizLoopManager.runInMainThread{ + this.viewCallback?.showThreeScreen() + } + }else{ FunctionBuildConfig.isDrawDecIdentifyData = false FunctionBuildConfig.isDrawPreIdentifyData = false // 展示二联屏幕 BizLoopManager.runInMainThread{ - this.viewCallback?.showTwoScreen(true) - } - }else{ - if(havePredictionInfos&&haveTrajectoryInfos){ - // 进入三屏幕 - FunctionBuildConfig.isDrawDecIdentifyData = true - FunctionBuildConfig.isDrawPreIdentifyData = true - // 展示三联屏 - BizLoopManager.runInMainThread{ - this.viewCallback?.showThreeScreen() - } - }else{ - // 进入双屏 需要隐藏 - FunctionBuildConfig.isDrawDecIdentifyData = false - FunctionBuildConfig.isDrawPreIdentifyData = false - BizLoopManager.runInMainThread{ - this.viewCallback?.showTwoScreen(false) - } + this.viewCallback?.showTwoScreen() } } } diff --git a/OCH/taxi/unmanned-passenger/src/main/res/layout/taxi_p_home.xml b/OCH/taxi/unmanned-passenger/src/main/res/layout/taxi_p_home.xml index 8995cc8f02..a16b67fb3b 100644 --- a/OCH/taxi/unmanned-passenger/src/main/res/layout/taxi_p_home.xml +++ b/OCH/taxi/unmanned-passenger/src/main/res/layout/taxi_p_home.xml @@ -34,25 +34,25 @@ app:layout_constraintStart_toEndOf="@+id/midStartGuideline" app:layout_constraintEnd_toStartOf="@id/rightStartGuideline"> - - + android:layout_height="@dimen/dp_676" /> - - + android:layout_height="@dimen/dp_676" + /> + @@ -148,33 +148,19 @@ - - - - + \ No newline at end of file