[6.5.1_exam]Taxi增加座椅压力

This commit is contained in:
xuxinchao
2024-07-31 17:07:51 +08:00
parent cca38246cc
commit 57edc8dffb
9 changed files with 176 additions and 7 deletions

View File

@@ -12,6 +12,7 @@ import android.view.ViewGroup;
import android.view.animation.LinearInterpolator;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
@@ -25,13 +26,16 @@ import com.mogo.commons.mvp.IView;
import com.mogo.commons.mvp.MvpFragment;
import com.mogo.commons.mvp.Presenter;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
import com.mogo.eagle.core.function.api.setting.ISeatPressureEventListener;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager;
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager;
import com.mogo.eagle.core.function.call.setting.CallerSeatPressureManager;
import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxBubbleView;
import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxButtonView;
import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxListView;
import com.mogo.eagle.core.function.hmi.ui.setting.SeatPressureSettingView;
import com.mogo.eagle.core.function.view.MapBizView;
import com.mogo.eagle.core.function.smp.view.SmallMapView;
import com.mogo.eagle.core.function.view.MapRoamView;
@@ -56,7 +60,7 @@ import me.jessyan.autosize.utils.AutoSizeUtils;
*
* @author tongchenfei
*/
public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V>> extends MvpFragment<V, P> implements IMogoMapListener {
public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V>> extends MvpFragment<V, P> implements IMogoMapListener , ISeatPressureEventListener {
private static final String TAG = "BaseOchFragment";
private RelativeLayout ctvAutopilotStatusRL;
@@ -85,6 +89,9 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
private OverMapDialog overMapDialog;
protected LinearLayout mSeatPressureBtn;//座椅压力
protected SeatPressureSettingView seatPressureSettingView;
private final Handler mHandler = new Handler(Looper.getMainLooper());
@Override
@@ -205,6 +212,18 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
overMapDialog.showDialog();
}
});
//座椅压力
mSeatPressureBtn = findViewById(R.id.module_och_taxi_seat_pressure);
seatPressureSettingView = findViewById(R.id.seatPressureSettingView);
assert mSeatPressureBtn != null;
mSeatPressureBtn.setOnClickListener(view -> {
if(seatPressureSettingView.getVisibility() == View.VISIBLE){
seatPressureSettingView.setVisibility(View.GONE);
}else{
seatPressureSettingView.setVisibility(View.VISIBLE);
}
});
CallerSeatPressureManager.INSTANCE.addListener(TAG,this);
}
@Override
@@ -279,6 +298,7 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
taxiRottingNaviFragment = null;
smallMapView = null;
CallerAutopilotRecordListenerManager.INSTANCE.removeListener(TAG);
CallerSeatPressureManager.INSTANCE.removeListener(TAG);
}
@Override
@@ -570,4 +590,17 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
public void setGuidHide(){
acivShowGuid.setVisibility(View.GONE);
}
/**
* 设置座椅是否有人状态
* @param isPress 是否有人
*/
@Override
public void onUpdateBgEvent(boolean isPress) {
if(isPress){
mSeatPressureBtn.setBackgroundResource(R.drawable.taxi_operation_status_select_bg);
}else{
mSeatPressureBtn.setBackgroundResource(R.drawable.taxi_operation_status_bg);
}
}
}

View File

@@ -337,6 +337,7 @@
app:roma_open_bg="@drawable/common_driver_roma_press" />
<com.mogo.och.common.module.wigets.map.drawline.LineView
android:id="@+id/lineView"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@id/rtv_switch"
android:layout_marginStart="-11dp"
@@ -352,6 +353,37 @@
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" />
<!--考试-座椅压力-->
<LinearLayout
android:id="@+id/module_och_taxi_seat_pressure"
android:layout_width="@dimen/module_mogo_och_operation_status_bg_width"
android:layout_height="@dimen/module_mogo_och_operation_status_bg_height"
android:layout_marginLeft="40dp"
android:layout_marginBottom="@dimen/module_mogo_och_margin_bottom"
android:elevation="@dimen/dp_10"
android:gravity="center"
android:background="@drawable/taxi_operation_status_bg"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@id/lineView">
<ImageView
android:layout_width="@dimen/dp_64"
android:layout_height="@dimen/dp_64"
android:layout_gravity="center"
android:src="@drawable/icon_seat_pressure"
/>
</LinearLayout>
<!--座椅压力设置-->
<com.mogo.eagle.core.function.hmi.ui.setting.SeatPressureSettingView
android:id="@+id/seatPressureSettingView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="@id/module_och_taxi_seat_pressure"
app:layout_constraintBottom_toBottomOf="@id/module_och_taxi_seat_pressure"
app:layout_constraintStart_toEndOf="@id/module_och_taxi_seat_pressure"
android:layout_marginStart="@dimen/dp_40"
android:visibility="gone"
/>
<Button
android:id="@+id/btnAutopilotDisable"

View File

@@ -16,11 +16,13 @@ import com.mogo.commons.mvp.MvpFragment
import com.mogo.commons.mvp.Presenter
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotRecordListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.api.setting.ISeatPressureEventListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getState
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
import com.mogo.eagle.core.function.call.setting.CallerSeatPressureManager
import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxButtonView
import com.mogo.eagle.core.function.hmi.ui.widget.ParallelDriveView
import com.mogo.eagle.core.utilcode.kotlin.onClick
@@ -47,7 +49,9 @@ import kotlinx.android.synthetic.main.unmanned_taxi_base_fragment.module_mogo_oc
import kotlinx.android.synthetic.main.unmanned_taxi_base_fragment.module_mogo_och_station_panel_container
import kotlinx.android.synthetic.main.unmanned_taxi_base_fragment.module_och_autopilot_iv
import kotlinx.android.synthetic.main.unmanned_taxi_base_fragment.module_och_autopilot_tv
import kotlinx.android.synthetic.main.unmanned_taxi_base_fragment.module_och_taxi_seat_pressure
import kotlinx.android.synthetic.main.unmanned_taxi_base_fragment.parallelDriveView
import kotlinx.android.synthetic.main.unmanned_taxi_base_fragment.seatPressureSettingView
import kotlinx.android.synthetic.main.unmanned_taxi_base_fragment.smallMapView
import kotlinx.android.synthetic.main.unmanned_taxi_base_fragment.startAutopilotAnimationView
import kotlinx.android.synthetic.main.unmanned_taxi_base_fragment.taxi_close_navi_icon
@@ -55,12 +59,13 @@ import kotlinx.android.synthetic.main.unmanned_taxi_base_fragment.viewDriverMsgB
import kotlinx.android.synthetic.main.unmanned_taxi_base_fragment.viewDriverMsgBoxButton
import kotlinx.android.synthetic.main.unmanned_taxi_base_fragment.viewDriverMsgBoxList
/**
* @author: wangmingjun
* @date: 2023/7/24
*/
abstract class BaseTaxiTabFragment<V : IView, P : Presenter<V>> : MvpFragment<V, P>(),
IMogoMapListener, IMoGoAutopilotRecordListener {
IMogoMapListener, IMoGoAutopilotRecordListener, ISeatPressureEventListener {
companion object {
const val TAG = "BaseTaxiTabFragment"
}
@@ -204,6 +209,16 @@ abstract class BaseTaxiTabFragment<V : IView, P : Presenter<V>> : MvpFragment<V,
overMapDialog?.showDialog()
}
}
//座椅压力
module_och_taxi_seat_pressure.setOnClickListener {
if (seatPressureSettingView!!.visibility == View.VISIBLE) {
seatPressureSettingView!!.visibility = View.GONE
} else {
seatPressureSettingView!!.visibility = View.VISIBLE
}
}
CallerSeatPressureManager.addListener(TAG,this);
}
abstract fun stopAutoStartAutopilot()
@@ -243,6 +258,7 @@ abstract class BaseTaxiTabFragment<V : IView, P : Presenter<V>> : MvpFragment<V,
smallMapView?.onDestroy()
startAutopilotAnimationView.cancelCountdown()
CallerAutopilotRecordListenerManager.removeListener(TAG)
CallerSeatPressureManager.removeListener(TAG)
super.onDestroyView()
}
@@ -541,4 +557,16 @@ abstract class BaseTaxiTabFragment<V : IView, P : Presenter<V>> : MvpFragment<V,
fun setGuidHide() {
aciv_show_guid.visibility = View.GONE
}
/**
* 设置座椅是否有人状态
* @param isPress 是否有人
*/
override fun onUpdateBgEvent(isPress: Boolean) {
if (isPress) {
module_och_taxi_seat_pressure.setBackgroundResource(R.drawable.taxi_operation_status_select_bg)
} else {
module_och_taxi_seat_pressure.setBackgroundResource(R.drawable.taxi_operation_status_bg)
}
}
}

View File

@@ -342,6 +342,7 @@
app:roma_open_bg="@drawable/common_driver_roma_press" />
<com.mogo.och.common.module.wigets.map.drawline.LineView
android:id="@+id/lineView"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@id/rtv_switch"
android:layout_marginStart="-11dp"
@@ -349,6 +350,38 @@
android:layout_width="@dimen/dp_142"
android:layout_height="@dimen/dp_142"/>
<!--考试-座椅压力-->
<LinearLayout
android:id="@+id/module_och_taxi_seat_pressure"
android:layout_width="@dimen/module_mogo_och_operation_status_bg_width"
android:layout_height="@dimen/module_mogo_och_operation_status_bg_height"
android:layout_marginLeft="40dp"
android:layout_marginBottom="@dimen/module_mogo_och_margin_bottom"
android:elevation="@dimen/dp_10"
android:gravity="center"
android:background="@drawable/taxi_operation_status_bg"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@id/lineView">
<ImageView
android:layout_width="@dimen/dp_64"
android:layout_height="@dimen/dp_64"
android:layout_gravity="center"
android:src="@drawable/icon_seat_pressure"
/>
</LinearLayout>
<!--座椅压力设置-->
<com.mogo.eagle.core.function.hmi.ui.setting.SeatPressureSettingView
android:id="@+id/seatPressureSettingView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="@id/module_och_taxi_seat_pressure"
app:layout_constraintBottom_toBottomOf="@id/module_och_taxi_seat_pressure"
app:layout_constraintStart_toEndOf="@id/module_och_taxi_seat_pressure"
android:layout_marginStart="@dimen/dp_40"
android:visibility="gone"
/>
<com.mogo.eagle.core.function.hmi.ui.widget.RomaDistanceView
android:layout_width="wrap_content"
android:layout_height="wrap_content"

View File

@@ -5,6 +5,7 @@ import android.util.AttributeSet
import android.view.LayoutInflater
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
import com.mogo.eagle.core.function.call.setting.CallerSeatPressureManager
import com.mogo.eagle.core.function.hmi.R
import kotlinx.android.synthetic.main.view_seat_pressure_setting.view.tb_co_driver
import kotlinx.android.synthetic.main.view_seat_pressure_setting.view.tb_main_driver
@@ -41,6 +42,7 @@ class SeatPressureSettingView @JvmOverloads constructor(
}
mainDriverStatus = isChecked
CallerAutoPilotControlManager.sendSeatPressure(mainDriverStatus,coDriverStatus,rearRowStatus)
updateBtnBg(mainDriverStatus,coDriverStatus,rearRowStatus)
}
//副驾
tb_co_driver.isChecked = coDriverStatus
@@ -50,6 +52,7 @@ class SeatPressureSettingView @JvmOverloads constructor(
}
coDriverStatus = isChecked
CallerAutoPilotControlManager.sendSeatPressure(mainDriverStatus,coDriverStatus,rearRowStatus)
updateBtnBg(mainDriverStatus,coDriverStatus,rearRowStatus)
}
//后排
tb_rear_row.isChecked = rearRowStatus
@@ -59,8 +62,18 @@ class SeatPressureSettingView @JvmOverloads constructor(
}
rearRowStatus = isChecked
CallerAutoPilotControlManager.sendSeatPressure(mainDriverStatus,coDriverStatus,rearRowStatus)
updateBtnBg(mainDriverStatus,coDriverStatus,rearRowStatus)
}
}
private fun updateBtnBg(driver: Boolean,copilot: Boolean,backRow: Boolean){
if(driver || copilot || backRow){
//主驾、副驾、后排只要有一个位置有人则开关按钮就显示有人状态
CallerSeatPressureManager.invokeUpdateBgEvent(true)
}else{
//所有座位都没有人则显示无人状态
CallerSeatPressureManager.invokeUpdateBgEvent(false)
}
}
}

View File

@@ -0,0 +1,10 @@
package com.mogo.eagle.core.function.api.setting
/**
* 座椅压力事件监听回调接口
*/
interface ISeatPressureEventListener {
fun onUpdateBgEvent(isPress: Boolean){}
}

View File

@@ -1,18 +1,19 @@
package com.mogo.eagle.core.function.call.setting
import com.mogo.eagle.core.function.api.setting.ITakeOverEventListener
import com.mogo.eagle.core.function.api.setting.ISeatPressureEventListener
import com.mogo.eagle.core.function.call.base.CallerBase
import java.util.concurrent.ConcurrentHashMap
/**
* 接管请求事件监听管理
* 座椅压力事件监听管理
*/
object CallerTakeOverManager: CallerBase<ITakeOverEventListener>() {
object CallerSeatPressureManager: CallerBase<ISeatPressureEventListener>() {
fun invokeTakeOverEvent(isShow: Boolean){
fun invokeUpdateBgEvent(isPress: Boolean){
M_LISTENERS.forEach {
val tag = it.key
val listener = it.value
listener.onTakeOverEvent(isShow)
listener.onUpdateBgEvent(isPress)
}
}

View File

@@ -0,0 +1,19 @@
package com.mogo.eagle.core.function.call.setting
import com.mogo.eagle.core.function.api.setting.ITakeOverEventListener
import com.mogo.eagle.core.function.call.base.CallerBase
/**
* 接管请求事件监听管理
*/
object CallerTakeOverManager: CallerBase<ITakeOverEventListener>() {
fun invokeTakeOverEvent(isShow: Boolean){
M_LISTENERS.forEach {
val tag = it.key
val listener = it.value
listener.onTakeOverEvent(isShow)
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB