[8.0.0]
[fea] [没有订单时 销毁 中间模块]
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,25 +34,25 @@
|
||||
app:layout_constraintStart_toEndOf="@+id/midStartGuideline"
|
||||
app:layout_constraintEnd_toStartOf="@id/rightStartGuideline">
|
||||
|
||||
<com.mogo.eagle.core.function.view.PredictionLayout
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/preContainer"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:background="@drawable/taxi_p_home_middle_top_bg"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_676" />
|
||||
android:layout_height="@dimen/dp_676"/>
|
||||
|
||||
<com.mogo.eagle.core.function.view.DecisionLayout
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/decContainer"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:background="@drawable/taxi_p_home_middle_bottom_bg"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_676"
|
||||
/>
|
||||
|
||||
android:layout_height="@dimen/dp_676"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
@@ -148,19 +148,33 @@
|
||||
|
||||
<androidx.appcompat.widget.AppCompatButton
|
||||
android:elevation="6dp"
|
||||
android:id="@+id/acbtn_show_hdmap"
|
||||
android:text="展示高精"
|
||||
android:id="@+id/acbtn_show_hdmap_create"
|
||||
android:text="展示二屏幕_创建view"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatButton
|
||||
app:layout_constraintTop_toBottomOf="@+id/acbtn_show_hdmap"
|
||||
android:id="@+id/acbtn_show_all"
|
||||
android:elevation="6dp"
|
||||
android:text="都展示"
|
||||
android:id="@+id/acbtn_show_hdmap_destory"
|
||||
app:layout_constraintTop_toBottomOf="@+id/acbtn_show_hdmap_create"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:text="展示二屏幕_删除view"
|
||||
android:visibility="gone"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatButton
|
||||
android:id="@+id/acbtn_show_all"
|
||||
app:layout_constraintTop_toBottomOf="@+id/acbtn_show_hdmap_destory"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:elevation="6dp"
|
||||
android:visibility="gone"
|
||||
android:text="展示三屏幕"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</merge>
|
||||
5
OCH/taxi/unmanned-passenger/src/main/res/values/ids.xml
Normal file
5
OCH/taxi/unmanned-passenger/src/main/res/values/ids.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<item name="prediction_layout_id" type="id" />
|
||||
<item name="decision_layout_id" type="id" />
|
||||
</resources>
|
||||
Reference in New Issue
Block a user