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 6a7e480c80..f2b49ae340 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,20 +12,24 @@ 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
+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.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,
@@ -43,6 +47,9 @@ class HomeView @JvmOverloads constructor(
private var viewModel: HomeViewModel?=null
+ private var predictionLayout: PredictionLayout? = null
+ private var decisionLayout: DecisionLayout? = null
+
private fun initView() {
@@ -64,8 +71,11 @@ class HomeView @JvmOverloads constructor(
})
- acbtn_show_hdmap.onClick {
- showHdMap()
+ acbtn_show_hdmap_create.onClick {
+ showHdMap(false)
+ }
+ acbtn_show_hdmap_destory.onClick {
+ showHdMap(true)
}
acbtn_show_all.onClick {
showAmapAndHdMap()
@@ -76,51 +86,82 @@ class HomeView @JvmOverloads constructor(
/**
* 展示两屏幕
*/
- fun showHdMap(){
- updateViewState(true,false,false)
+ 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
+ }
+ }
+
}
/**
* 展示3屏
*/
fun showAmapAndHdMap(){
- updateViewState(true,true,false)
+ // 展示预测地图和高精地图
+ 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
+ }
}
fun onCreate(savedInstanceState: Bundle?) {
hdMapView.onCreate(savedInstanceState)
- preContainer.onCreate(savedInstanceState)
- decContainer.onCreate(savedInstanceState)
+ predictionLayout?.onCreate(savedInstanceState)
+ decisionLayout?.onCreate(savedInstanceState)
}
fun onSaveInstanceState(outState: Bundle) {
hdMapView.onSaveInstanceState(outState)
- preContainer.onSaveInstanceState(outState)
- decContainer.onSaveInstanceState(outState)
+ predictionLayout?.onSaveInstanceState(outState)
+ decisionLayout?.onSaveInstanceState(outState)
}
fun onResume() {
hdMapView.onResume()
- preContainer.onResume()
- decContainer.onResume()
+ predictionLayout?.onResume()
+ decisionLayout?.onResume()
}
fun onLowMemory() {
hdMapView.onLowMemory()
- preContainer.onLowMemory()
- decContainer.onLowMemory()
+ predictionLayout?.onLowMemory()
+ decisionLayout?.onLowMemory()
}
fun onPause() {
hdMapView.onPause()
- preContainer.onPause()
- decContainer.onPause()
+ predictionLayout?.onPause()
+ decisionLayout?.onPause()
}
fun onDestroy() {
hdMapView.onDestroy()
- preContainer.onDestroy()
- decContainer.onDestroy()
+ predictionLayout?.onDestroy()
+ decisionLayout?.onDestroy()
}
override fun onAttachedToWindow() {
@@ -249,12 +290,40 @@ class HomeView @JvmOverloads constructor(
}
}
- override fun showTwoScreen() {
- showHdMap()
+ override fun showTwoScreen(destoryMap:Boolean) {
+ showHdMap(destoryMap)
}
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 355b465fd2..e0bd69becc 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()
+ fun showTwoScreen(destoryMap:Boolean)
fun showThreeScreen()
}
@@ -56,19 +56,31 @@ class HomeViewModel : ViewModel(), BridgeListener, OrderListener {
fun checkScreenChange(){
CallerLogger.d(TAG,"havePredictionInfos:${havePredictionInfos}--haveTrajectoryInfos:${haveTrajectoryInfos}--order:${order}")
- if(order!=null&&havePredictionInfos&&havePredictionInfos){
- FunctionBuildConfig.isDrawDecIdentifyData = true
- FunctionBuildConfig.isDrawPreIdentifyData = true
- // 展示三联屏
- BizLoopManager.runInMainThread{
- this.viewCallback?.showThreeScreen()
- }
- }else{
+
+ if(order==null){
+ // 进入双屏 需要销毁创建4张地图
FunctionBuildConfig.isDrawDecIdentifyData = false
FunctionBuildConfig.isDrawPreIdentifyData = false
// 展示二联屏幕
BizLoopManager.runInMainThread{
- this.viewCallback?.showTwoScreen()
+ 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)
+ }
}
}
}
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 10dd33baef..8995cc8f02 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,19 +148,33 @@
+
+
+
\ No newline at end of file
diff --git a/OCH/taxi/unmanned-passenger/src/main/res/values/ids.xml b/OCH/taxi/unmanned-passenger/src/main/res/values/ids.xml
new file mode 100644
index 0000000000..b9a90c85af
--- /dev/null
+++ b/OCH/taxi/unmanned-passenger/src/main/res/values/ids.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file