diff --git a/OCH/mogo-och-bus-passenger/src/m2/java/com/mogo/och/bus/passenger/callback/AutoPilotStatusCallback.kt b/OCH/mogo-och-bus-passenger/src/m2/java/com/mogo/och/bus/passenger/callback/AutoPilotStatusCallback.kt new file mode 100644 index 0000000000..efb7410ba2 --- /dev/null +++ b/OCH/mogo-och-bus-passenger/src/m2/java/com/mogo/och/bus/passenger/callback/AutoPilotStatusCallback.kt @@ -0,0 +1,14 @@ +package com.mogo.och.bus.passenger.callback + +/** + * @author: wangmingjun + * @date: 2023/2/13 + */ +interface AutoPilotStatusCallback { + /** + * false: 未开启自驾, true : 开启自驾 + */ + fun updateAutoStatus(isOpen: Boolean) + + fun updateAutoStatus(status: Int) +} \ No newline at end of file diff --git a/OCH/mogo-och-bus-passenger/src/m2/java/com/mogo/och/bus/passenger/model/PM2DrivingModel.kt b/OCH/mogo-och-bus-passenger/src/m2/java/com/mogo/och/bus/passenger/model/PM2DrivingModel.kt index 0e47a35b16..3b05d79aa0 100644 --- a/OCH/mogo-och-bus-passenger/src/m2/java/com/mogo/och/bus/passenger/model/PM2DrivingModel.kt +++ b/OCH/mogo-och-bus-passenger/src/m2/java/com/mogo/och/bus/passenger/model/PM2DrivingModel.kt @@ -4,6 +4,7 @@ import android.content.Context import android.os.Handler import com.mogo.cloud.commons.utils.CoordinateUtils import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo +import com.mogo.eagle.core.data.config.FunctionBuildConfig import com.mogo.eagle.core.data.map.MogoLocation import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener @@ -19,6 +20,7 @@ import com.mogo.och.bus.passenger.bean.PM2OperationStatusResponse import com.mogo.och.bus.passenger.bean.PM2RoutesResponse import com.mogo.och.bus.passenger.bean.PM2RoutesResult import com.mogo.och.bus.passenger.bean.PM2Station +import com.mogo.och.bus.passenger.callback.AutoPilotStatusCallback import com.mogo.och.bus.passenger.callback.DrivingInfoCallback import com.mogo.och.bus.passenger.constant.BusPassengerConst import com.mogo.och.bus.passenger.network.PM2ModelLoopManager @@ -39,14 +41,18 @@ class PM2DrivingModel private constructor() { private var mRoutePoints = mutableListOf() private var routesResult: PM2RoutesResult? = null + private var mCurrentAutoStatus = -1 + var mStations = mutableListOf() - private var mNextStationIndex = 0 // 要到达站的index + private var mNextStationIndex = 0 // A-B要到达站的index + private var isGoingToNextStation = false //是否前往下一站过程中 private var mTwoStationsRouts = mutableListOf() private var mPreRouteIndex = 0 private var mWipePreIndex = 0 - private var mDrivingInfoCallback : DrivingInfoCallback? = null //行程信息 + private var mDrivingInfoCallback: DrivingInfoCallback? = null //行程信息 + private var mAutoStatusCallback: AutoPilotStatusCallback? = null //自动驾驶状态 private val handler = Handler(Handler.Callback { msg -> if (msg.what == MSG_QUERY_BUS_P_STATION) { @@ -78,7 +84,7 @@ class PM2DrivingModel private constructor() { CallerChassisLocationGCJ02ListenerManager.setListenerHz(TAG,5)//设置5hz, 1s返回一次 } - public fun releaseListener(){ + fun releaseListener(){ //自动驾驶状态监听 CallerAutoPilotStatusListenerManager.removeListener(TAG) @@ -90,6 +96,10 @@ class PM2DrivingModel private constructor() { mDrivingInfoCallback = drivingInfoCallback } + fun setAutoStatusCallback(autoPilotStatusCallback: AutoPilotStatusCallback){ + mAutoStatusCallback = autoPilotStatusCallback + } + private val mMapLocationListener: IMoGoChassisLocationGCJ02Listener = object : IMoGoChassisLocationGCJ02Listener{ override fun onChassisLocationGCJ02(mogoLocation: MogoLocation?) { @@ -116,7 +126,22 @@ class PM2DrivingModel private constructor() { override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) { super.onAutopilotStatusResponse(autoPilotStatusInfo) - //todo 自动驾驶状态展示, 注意美化模式下的处理 + val status = autoPilotStatusInfo.state + if (mCurrentAutoStatus == status) return + + if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING != status){ + //美化模式下且行程中 + if (FunctionBuildConfig.isDemoMode && + mNextStationIndex>= 0 && mNextStationIndex <= mStations.size - 1 + && isGoingToNextStation){ + mAutoStatusCallback?.updateAutoStatus(true) + }else{//非美化模式下 + mAutoStatusCallback?.updateAutoStatus(false) + } + + }else{//自驾状态 2 + mAutoStatusCallback?.updateAutoStatus(true) + } } } @@ -163,6 +188,7 @@ class PM2DrivingModel private constructor() { if (data?.result == null || data.result.sites == null) { routesResult = null mNextStationIndex = 0 + isGoingToNextStation = false startOrStopCalculateRouteInfo(false) mDrivingInfoCallback?.showNoTaskView(true) return @@ -177,6 +203,7 @@ class PM2DrivingModel private constructor() { override fun onFail(code: Int, msg: String?) { if (code == 1003) { routesResult = null + isGoingToNextStation = false startOrStopCalculateRouteInfo(false) queryDriverOperationDelay() return @@ -197,20 +224,22 @@ class PM2DrivingModel private constructor() { mStations.addAll(stations) for (i in stations.indices) { val station: PM2Station = stations[i] - if (station.drivingStatus === BusPassengerConst.STATION_STATUS_STOPPED + if (station.drivingStatus == BusPassengerConst.STATION_STATUS_STOPPED && station.isLeaving && i + 1 < stations.size) { // mRouteLineInfoCallback.updateStationsInfo(stations, i + 1, false) if (mNextStationIndex != i + 1) { mTwoStationsRouts.clear() startRemainRouteInfo() } + isGoingToNextStation = true mNextStationIndex = i + 1 return - } else if (station.drivingStatus === BusPassengerConst.STATION_STATUS_STOPPED && !station.isLeaving) { + } else if (station.drivingStatus == BusPassengerConst.STATION_STATUS_STOPPED && !station.isLeaving) { if (i == 0) { startOrStopRouteAndWipe(false) } mPreRouteIndex = 0 + isGoingToNextStation = false startOrStopCalculateRouteInfo(false) // mRouteLineInfoCallback.updateStationsInfo(stations, i, true) return diff --git a/OCH/mogo-och-bus-passenger/src/m2/java/com/mogo/och/bus/passenger/presenter/PM2DrivingPresenter.kt b/OCH/mogo-och-bus-passenger/src/m2/java/com/mogo/och/bus/passenger/presenter/PM2DrivingPresenter.kt index 78d188a64e..825ee65c8d 100644 --- a/OCH/mogo-och-bus-passenger/src/m2/java/com/mogo/och/bus/passenger/presenter/PM2DrivingPresenter.kt +++ b/OCH/mogo-och-bus-passenger/src/m2/java/com/mogo/och/bus/passenger/presenter/PM2DrivingPresenter.kt @@ -3,12 +3,13 @@ package com.mogo.och.bus.passenger.presenter import androidx.lifecycle.LifecycleOwner import com.mogo.commons.mvp.Presenter import com.mogo.eagle.core.utilcode.util.UiThreadHandler +import com.mogo.och.bus.passenger.callback.AutoPilotStatusCallback import com.mogo.och.bus.passenger.callback.DrivingInfoCallback import com.mogo.och.bus.passenger.model.PM2DrivingModel import com.mogo.och.bus.passenger.ui.PM2DrivingInfoFragment class PM2DrivingPresenter(view: PM2DrivingInfoFragment?) : - Presenter(view), DrivingInfoCallback { + Presenter(view), DrivingInfoCallback, AutoPilotStatusCallback { init { PM2DrivingModel.INSTANCE.init(context) @@ -22,6 +23,7 @@ class PM2DrivingPresenter(view: PM2DrivingInfoFragment?) : private fun initListener(){ PM2DrivingModel.INSTANCE.setDrivingInfoCallback(this) + PM2DrivingModel.INSTANCE.setAutoStatusCallback(this) } private fun destroyListener(){ @@ -58,4 +60,14 @@ class PM2DrivingPresenter(view: PM2DrivingInfoFragment?) : override fun showNoTaskView(isTrue: Boolean) { TODO("Not yet implemented") } + + override fun updateAutoStatus(isOpen: Boolean) { + UiThreadHandler.post { + mView?.updateAutoStatus(isOpen) + } + } + + override fun updateAutoStatus(status: Int) { + TODO("Not yet implemented") + } } \ No newline at end of file diff --git a/OCH/mogo-och-bus-passenger/src/m2/java/com/mogo/och/bus/passenger/ui/PM2DrivingInfoFragment.kt b/OCH/mogo-och-bus-passenger/src/m2/java/com/mogo/och/bus/passenger/ui/PM2DrivingInfoFragment.kt index 066aeec53a..d7dcdd3041 100644 --- a/OCH/mogo-och-bus-passenger/src/m2/java/com/mogo/och/bus/passenger/ui/PM2DrivingInfoFragment.kt +++ b/OCH/mogo-och-bus-passenger/src/m2/java/com/mogo/och/bus/passenger/ui/PM2DrivingInfoFragment.kt @@ -1,9 +1,13 @@ package com.mogo.och.bus.passenger.ui import android.os.Bundle +import androidx.core.content.ContextCompat import com.mogo.commons.mvp.MvpFragment +import com.mogo.eagle.core.utilcode.util.DateTimeUtils import com.mogo.och.bus.passenger.R import com.mogo.och.bus.passenger.presenter.PM2DrivingPresenter +import com.mogo.och.common.module.utils.DateTimeUtil +import com.mogo.och.common.module.utils.DateTimeUtil.* import kotlinx.android.synthetic.m2.p_m2_driving_info_fragment.* /** @@ -53,7 +57,7 @@ class PM2DrivingInfoFragment : } fun updateCarPlateNum(plateNum : String){ - car_plate_tv.text = plateNum + } fun updateTaskName(name: String){ @@ -65,17 +69,39 @@ class PM2DrivingInfoFragment : } fun updateCurrentTime(){ -// current_time_tv.text = -// current_weekday_tv.text = + current_time_tv.text = formatCalendarToString( + DateTimeUtils.getCurrentDateTime(),HH_mm) + + val date = formatCalendarToString( + DateTimeUtils.getCurrentDateTime(), yyyy_MM_dd) + val weekDay = DateTimeUtils.getWeekDayFromCalendar1(DateTimeUtils.getCurrentDateTime()) + current_weekday_tv.text = "$date $weekDay" + + } fun changeOperationStatus(status:Boolean){ + if (!status){ //暂无路线 + + }else{ + + } } override fun createPresenter(): PM2DrivingPresenter { return PM2DrivingPresenter(this) } + fun updateAutoStatus(isAutoPilot: Boolean) { + if (isAutoPilot){ + context?.let { auto_tv.setTextColor(ContextCompat.getColor(it,R.color.m2_p_white_color)) } + context?.let { auto_tv.background = ContextCompat.getDrawable(it,R.drawable.auto_button_bg) } + }else{ + context?.let { auto_tv.setTextColor(ContextCompat.getColor(it,R.color.m2_button_auto_tv_color)) } + context?.let { auto_tv.background = ContextCompat.getDrawable(it,R.drawable.bg_p_m2_auto_bg) } + } + } + companion object { private val TAG = PM2DrivingInfoFragment::class.java.simpleName } diff --git a/OCH/mogo-och-bus-passenger/src/m2/res/drawable-nodpi/auto_button_bg.png b/OCH/mogo-och-bus-passenger/src/m2/res/drawable-nodpi/auto_button_bg.png new file mode 100644 index 0000000000..fb4ddc5279 Binary files /dev/null and b/OCH/mogo-och-bus-passenger/src/m2/res/drawable-nodpi/auto_button_bg.png differ diff --git a/OCH/mogo-och-bus-passenger/src/m2/res/drawable-nodpi/clock_bg.png b/OCH/mogo-och-bus-passenger/src/m2/res/drawable-nodpi/clock_bg.png new file mode 100644 index 0000000000..a380c3f3b7 Binary files /dev/null and b/OCH/mogo-och-bus-passenger/src/m2/res/drawable-nodpi/clock_bg.png differ diff --git a/OCH/mogo-och-bus-passenger/src/m2/res/drawable-nodpi/img_drive_bg.png b/OCH/mogo-och-bus-passenger/src/m2/res/drawable-nodpi/img_drive_bg.png new file mode 100644 index 0000000000..3ad9edb859 Binary files /dev/null and b/OCH/mogo-och-bus-passenger/src/m2/res/drawable-nodpi/img_drive_bg.png differ diff --git a/OCH/mogo-och-bus-passenger/src/m2/res/drawable-nodpi/img_line_bg.png b/OCH/mogo-och-bus-passenger/src/m2/res/drawable-nodpi/img_line_bg.png new file mode 100644 index 0000000000..8b8529c4b2 Binary files /dev/null and b/OCH/mogo-och-bus-passenger/src/m2/res/drawable-nodpi/img_line_bg.png differ diff --git a/OCH/mogo-och-bus-passenger/src/m2/res/drawable-nodpi/img_time_bg.png b/OCH/mogo-och-bus-passenger/src/m2/res/drawable-nodpi/img_time_bg.png new file mode 100644 index 0000000000..23f7320c56 Binary files /dev/null and b/OCH/mogo-och-bus-passenger/src/m2/res/drawable-nodpi/img_time_bg.png differ diff --git a/OCH/mogo-och-bus-passenger/src/m2/res/drawable-nodpi/m2_line_location_bg.png b/OCH/mogo-och-bus-passenger/src/m2/res/drawable-nodpi/m2_line_location_bg.png new file mode 100644 index 0000000000..bac6030216 Binary files /dev/null and b/OCH/mogo-och-bus-passenger/src/m2/res/drawable-nodpi/m2_line_location_bg.png differ diff --git a/OCH/mogo-och-bus-passenger/src/m2/res/drawable/bg_p_m2_auto_bg.xml b/OCH/mogo-och-bus-passenger/src/m2/res/drawable/bg_p_m2_auto_bg.xml new file mode 100644 index 0000000000..321b67dfc3 --- /dev/null +++ b/OCH/mogo-och-bus-passenger/src/m2/res/drawable/bg_p_m2_auto_bg.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/OCH/mogo-och-bus-passenger/src/m2/res/layout/p_m2_driving_info_fragment.xml b/OCH/mogo-och-bus-passenger/src/m2/res/layout/p_m2_driving_info_fragment.xml index 12bd19f1e0..6120ab8f89 100644 --- a/OCH/mogo-och-bus-passenger/src/m2/res/layout/p_m2_driving_info_fragment.xml +++ b/OCH/mogo-och-bus-passenger/src/m2/res/layout/p_m2_driving_info_fragment.xml @@ -1,144 +1,162 @@ + android:layout_height="@dimen/dp_556"> - + + app:layout_constraintLeft_toLeftOf="@+id/img_drive_bg" + android:layout_marginLeft="@dimen/dp_24" + app:layout_constraintTop_toTopOf="@+id/img_drive_bg" + tools:ignore="SpUsage" /> - + - + + app:layout_constraintTop_toTopOf="@+id/img_line_location_bg" + app:layout_constraintLeft_toLeftOf="@+id/speed_tv" + android:textColor="@color/m2_line_name_tv_color"/> + app:layout_constraintLeft_toLeftOf="@+id/task_name_tv" + app:layout_constraintTop_toBottomOf="@+id/task_name_tv" + android:textColor="@color/m2_line_during_tv_color"/> - + + + + android:text="--" + app:layout_constraintTop_toTopOf="@+id/img_time_clock_bg" + app:layout_constraintLeft_toLeftOf="@+id/speed_tv" + android:textColor="@color/m2_current_time_tv_color"/> - - - - - + app:layout_constraintLeft_toLeftOf="@+id/current_time_tv" + app:layout_constraintTop_toBottomOf="@+id/current_time_tv" + android:textSize="@dimen/dp_18" + android:text="--" + android:textColor="@color/m2_line_during_tv_color"/> - + \ No newline at end of file diff --git a/OCH/mogo-och-bus-passenger/src/m2/res/layout/p_m2_hpmap_fragment.xml b/OCH/mogo-och-bus-passenger/src/m2/res/layout/p_m2_hpmap_fragment.xml index 5070519a7a..fec8fd6cd4 100644 --- a/OCH/mogo-och-bus-passenger/src/m2/res/layout/p_m2_hpmap_fragment.xml +++ b/OCH/mogo-och-bus-passenger/src/m2/res/layout/p_m2_hpmap_fragment.xml @@ -13,19 +13,19 @@ - - - - - - + - - - - - - - + \ No newline at end of file diff --git a/OCH/mogo-och-bus-passenger/src/m2/res/layout/p_m2_video_fragment.xml b/OCH/mogo-och-bus-passenger/src/m2/res/layout/p_m2_video_fragment.xml index e21fb3554b..000b849619 100644 --- a/OCH/mogo-och-bus-passenger/src/m2/res/layout/p_m2_video_fragment.xml +++ b/OCH/mogo-och-bus-passenger/src/m2/res/layout/p_m2_video_fragment.xml @@ -1,8 +1,7 @@ + android:layout_height="@dimen/dp_565"> diff --git a/OCH/mogo-och-bus-passenger/src/m2/res/values/colors.xml b/OCH/mogo-och-bus-passenger/src/m2/res/values/colors.xml index 141bde1f54..e17de7a855 100644 --- a/OCH/mogo-och-bus-passenger/src/m2/res/values/colors.xml +++ b/OCH/mogo-och-bus-passenger/src/m2/res/values/colors.xml @@ -1,32 +1,12 @@ - #2D3E5F - #CCE9EFFC - #C7D2E1 - #2D3E5F - #0043FF - #2D3E5F - #596A8A - #D8E5F8 - #FFB327 - #2D3E5F - #0043FF - #276AFE - #0043FF - #276AFE - #FFC125 - #FF8131 - #31BFF2 - #3257E9 - #FFFFFF - #CDDBF6 - #2D3E5F - #0043FF - #2D3E5F - #E6E9EFFC - #33394C63 - #2D3E5F - #33394C63 + #FFFFFF + #0B1E38 + #2D3E5F + #B3C0D4ED + #0B1E38 + #5D7199 + #0B1E38 #FFFFA28B #FFDA1100 diff --git a/OCH/mogo-och-bus/src/jinlvvan/java/com/mogo/och/bus/model/OrderModel.java b/OCH/mogo-och-bus/src/jinlvvan/java/com/mogo/och/bus/model/OrderModel.java index 9f75b34091..f2f1ec6931 100644 --- a/OCH/mogo-och-bus/src/jinlvvan/java/com/mogo/och/bus/model/OrderModel.java +++ b/OCH/mogo-och-bus/src/jinlvvan/java/com/mogo/och/bus/model/OrderModel.java @@ -499,7 +499,7 @@ public class OrderModel { String lineTime = DateTimeUtil.formatLongToString( busRoutesResult.getTaskTime(), - DateTimeUtil.TAXI_HH_mm); + DateTimeUtil.HH_mm); if (arrivingOrArrivedStationIndex == 0 || arrivingOrArrivedStation.getDrivingStatus() == STATION_STATUS_STOPPED diff --git a/OCH/mogo-och-common-module/src/main/java/com/mogo/och/common/module/utils/DateTimeUtil.java b/OCH/mogo-och-common-module/src/main/java/com/mogo/och/common/module/utils/DateTimeUtil.java index 310b8cb3bd..d1a2639515 100644 --- a/OCH/mogo-och-common-module/src/main/java/com/mogo/och/common/module/utils/DateTimeUtil.java +++ b/OCH/mogo-och-common-module/src/main/java/com/mogo/och/common/module/utils/DateTimeUtil.java @@ -11,11 +11,12 @@ import java.util.Date; * @date: 2022/5/6 */ public class DateTimeUtil { - public static final String TAXI_HH_mm = "HH:mm"; - public static final String TAXI_MM_dd = "MM-dd"; - public static final String TAXI_MM_dd_HH_mm = "MM-dd HH:mm"; - public static final String TAXI_yyyy_MM_dd = "yyyy-MM-dd"; - public static final String TAXI_yyyy_MM_dd_HH_mm = "yyyy-MM-dd HH:mm"; + public static final String HH_mm = "HH:mm"; + public static final String MM_dd = "MM-dd"; + public static final String MM_dd_HH_mm = "MM-dd HH:mm"; + public static final String yyyy_MM_dd = "yyyy-MM-dd"; + public static final String yy_MM_dd = "yy-MM-dd"; + public static final String yyyy_MM_dd_HH_mm = "yyyy-MM-dd HH:mm"; public static String formatCalendarToString(Calendar calendar, String format){ if (calendar == null) return ""; @@ -30,8 +31,8 @@ public class DateTimeUtil { public static boolean compareDateIsCurrentDay(Calendar targetCalendar){ Calendar currentCale = DateTimeUtils.getCurrentDateTime(); - String currentDay = formatCalendarToString(currentCale, TAXI_yyyy_MM_dd); - if (currentDay.equals(formatCalendarToString(targetCalendar, TAXI_yyyy_MM_dd))){ + String currentDay = formatCalendarToString(currentCale, yyyy_MM_dd); + if (currentDay.equals(formatCalendarToString(targetCalendar, yyyy_MM_dd))){ return true; }else { return false; diff --git a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/TaxiPassengerServingOrderFragment.java b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/TaxiPassengerServingOrderFragment.java index 0ddf08b2b7..9d1de00f4f 100644 --- a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/TaxiPassengerServingOrderFragment.java +++ b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/TaxiPassengerServingOrderFragment.java @@ -334,7 +334,7 @@ public class TaxiPassengerServingOrderFragment extends Calendar beforeTime = Calendar.getInstance(); beforeTime.add(Calendar.MINUTE,time); - String arriveTime = DateTimeUtil.formatCalendarToString(beforeTime,DateTimeUtil.TAXI_HH_mm); + String arriveTime = DateTimeUtil.formatCalendarToString(beforeTime,DateTimeUtil.HH_mm); updateOrderDisAndTimeView(remainDis, disUnit,time, arriveTime); updateDriveProcessLoading(new Long(meters).intValue()); } diff --git a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/leftmenu/LeftMenuOpen.kt b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/leftmenu/LeftMenuOpen.kt index 25e67ec138..47c031144a 100644 --- a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/leftmenu/LeftMenuOpen.kt +++ b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/leftmenu/LeftMenuOpen.kt @@ -429,7 +429,7 @@ object LeftMenuOpen { val beforeTime = Calendar.getInstance() beforeTime.add(Calendar.MINUTE, time) //到达时间 - val arriveTime = DateTimeUtil.formatCalendarToString(beforeTime, DateTimeUtil.TAXI_HH_mm) + val arriveTime = DateTimeUtil.formatCalendarToString(beforeTime, DateTimeUtil.HH_mm) FloatingDistanceInfoUtils.setDistance(meters,remainDis,disUnit,time,arriveTime) }else{ FloatingDistanceInfoUtils.setSpeed(speed) diff --git a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/TaxiBeingServerdOrdersFragment.java b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/TaxiBeingServerdOrdersFragment.java index 6eeca67db6..f03cec0009 100644 --- a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/TaxiBeingServerdOrdersFragment.java +++ b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/TaxiBeingServerdOrdersFragment.java @@ -22,7 +22,6 @@ import com.mogo.eagle.core.data.map.CenterLine; import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener; import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager; import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager; -import com.mogo.eagle.core.function.call.map.CallerSmpManager; import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import com.mogo.eagle.core.utilcode.util.DateTimeUtils; import com.mogo.eagle.core.utilcode.util.ToastUtils; @@ -34,7 +33,6 @@ import com.mogo.och.common.module.map.ICommonNaviChangedCallback; import com.mogo.och.common.module.utils.DateTimeUtil; import com.mogo.och.common.module.utils.NumberFormatUtil; import com.mogo.och.common.module.utils.OCHThreadPoolManager; -import com.mogo.och.common.module.utils.ToastUtilsOch; import com.mogo.och.common.module.voice.VoiceNotice; import com.mogo.och.common.module.wigets.OCHCommitDialog; import com.mogo.och.taxi.R; @@ -239,8 +237,8 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment mOrderOtherContent3.setVisibility(View.GONE); Calendar currentCale = DateTimeUtils.getCurrentDateTime(); - String currentHM = DateTimeUtil.formatCalendarToString(currentCale, DateTimeUtil.TAXI_HH_mm); - String currentDay = DateTimeUtil.formatCalendarToString(currentCale, DateTimeUtil.TAXI_yyyy_MM_dd); + String currentHM = DateTimeUtil.formatCalendarToString(currentCale, DateTimeUtil.HH_mm); + String currentDay = DateTimeUtil.formatCalendarToString(currentCale, DateTimeUtil.yyyy_MM_dd); String strHtml11 = "已于
" + "" + currentHM + "" + "" + " " + "到达乘客上车地点"; @@ -251,13 +249,13 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment mStationTv32.setText(order.endSiteAddr); currentCale.add(Calendar.MINUTE, 10); String strHtml13 = ""; - if (currentDay.equals(DateTimeUtil.formatCalendarToString(currentCale, DateTimeUtil.TAXI_yyyy_MM_dd))) { + if (currentDay.equals(DateTimeUtil.formatCalendarToString(currentCale, DateTimeUtil.yyyy_MM_dd))) { strHtml13 = "免费等待至 " - + "" + DateTimeUtil.formatCalendarToString(currentCale, DateTimeUtil.TAXI_HH_mm) + ""; + + "" + DateTimeUtil.formatCalendarToString(currentCale, DateTimeUtil.HH_mm) + ""; } else { strHtml13 = "免费等待至" - + "" + DateTimeUtil.formatCalendarToString(currentCale, DateTimeUtil.TAXI_MM_dd_HH_mm) + ""; + + "" + DateTimeUtil.formatCalendarToString(currentCale, DateTimeUtil.MM_dd_HH_mm) + ""; } mDistanceAndTime3.setText(Html.fromHtml(strHtml13)); @@ -315,16 +313,16 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment Calendar currentCale = DateTimeUtils.getCurrentDateTime(); Calendar startCale = DateTimeUtil.formatLongToCalendar(order.bookingTime); - String currentDay = DateTimeUtil.formatCalendarToString(currentCale, DateTimeUtil.TAXI_yyyy_MM_dd); - String startDay = DateTimeUtil.formatCalendarToString(startCale, DateTimeUtil.TAXI_yyyy_MM_dd); + String currentDay = DateTimeUtil.formatCalendarToString(currentCale, DateTimeUtil.yyyy_MM_dd); + String startDay = DateTimeUtil.formatCalendarToString(startCale, DateTimeUtil.yyyy_MM_dd); String strHtml1 = ""; if (currentDay.equals(startDay)) { strHtml1 = "乘客将于
" - + "" + DateTimeUtil.formatCalendarToString(startCale, DateTimeUtil.TAXI_HH_mm) + "" + + "" + DateTimeUtil.formatCalendarToString(startCale, DateTimeUtil.HH_mm) + "" + " 用车"; } else { strHtml1 = "乘客将于
" - + "" + DateTimeUtil.formatCalendarToString(startCale, DateTimeUtil.TAXI_MM_dd_HH_mm) + "" + + "" + DateTimeUtil.formatCalendarToString(startCale, DateTimeUtil.MM_dd_HH_mm) + "" + " 用车"; } mOrderOtherContent3.setText(Html.fromHtml(strHtml1)); diff --git a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/TaxiGrabOrderFragment.java b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/TaxiGrabOrderFragment.java index 0634edb51d..bde0c5a017 100644 --- a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/TaxiGrabOrderFragment.java +++ b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/TaxiGrabOrderFragment.java @@ -94,12 +94,12 @@ public class TaxiGrabOrderFragment extends BaseTaxiUIFragment implements View.On mGrabResultAnimView.setVisibility(View.GONE); Calendar calendar = DateTimeUtil.formatLongToCalendar(order.bookingTime); if (DateTimeUtil.compareDateIsCurrentDay(calendar)){ - mOrderReserverTime.setText("用车时间:今天 "+ DateTimeUtil.formatCalendarToString(calendar, DateTimeUtil.TAXI_HH_mm)); - VoiceNotice.showNotice("预约单,今天"+ DateTimeUtil.formatCalendarToString(calendar, DateTimeUtil.TAXI_HH_mm)+"从" + mOrderReserverTime.setText("用车时间:今天 "+ DateTimeUtil.formatCalendarToString(calendar, DateTimeUtil.HH_mm)); + VoiceNotice.showNotice("预约单,今天"+ DateTimeUtil.formatCalendarToString(calendar, DateTimeUtil.HH_mm)+"从" +order.startSiteAddr+"到"+order.endSiteAddr); }else { - mOrderReserverTime.setText("用车时间:"+ DateTimeUtil.formatCalendarToString(calendar, DateTimeUtil.TAXI_MM_dd_HH_mm)); - VoiceNotice.showNotice("预约单,"+ DateTimeUtil.formatCalendarToString(calendar, DateTimeUtil.TAXI_MM_dd)+"从" + mOrderReserverTime.setText("用车时间:"+ DateTimeUtil.formatCalendarToString(calendar, DateTimeUtil.MM_dd_HH_mm)); + VoiceNotice.showNotice("预约单,"+ DateTimeUtil.formatCalendarToString(calendar, DateTimeUtil.MM_dd)+"从" +order.startSiteAddr+"到"+order.endSiteAddr); } mOrderStartStation.setText(order.startSiteAddr); diff --git a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/TaxiPersonalDialogFragment.java b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/TaxiPersonalDialogFragment.java index decb6b1f7f..fe488af13e 100644 --- a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/TaxiPersonalDialogFragment.java +++ b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/TaxiPersonalDialogFragment.java @@ -398,7 +398,7 @@ public class TaxiPersonalDialogFragment extends Button orderStatusBt, Button orderTypeBt, TextView orderNumTv){ Calendar calendar= Calendar.getInstance(); calendar.setTimeInMillis(queryRespBean.createTime); - orderTimeTv.setText(DateTimeUtil.formatCalendarToString(calendar, DateTimeUtil.TAXI_HH_mm)); + orderTimeTv.setText(DateTimeUtil.formatCalendarToString(calendar, DateTimeUtil.HH_mm)); startStationTv.setText(queryRespBean.startSiteAddr); endStationTv.setText(queryRespBean.endSiteAddr); orderStatusBt.setText(getOrderStatus(queryRespBean.orderStatus,orderStatusBt)); diff --git a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/TaxiReserveOrdersFragment.java b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/TaxiReserveOrdersFragment.java index 6df0b8065d..0796ebd2e9 100644 --- a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/TaxiReserveOrdersFragment.java +++ b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/ui/TaxiReserveOrdersFragment.java @@ -130,9 +130,9 @@ public class TaxiReserveOrdersFragment extends BaseTaxiUIFragment { OrderQueryRespBean.Result order = datas.get(position); Calendar calendar = DateTimeUtil.formatLongToCalendar(order.bookingTime); if (DateTimeUtil.compareDateIsCurrentDay(calendar)){ - viewHolder.orderTime.setText("用车时间:今天"+ DateTimeUtil.formatCalendarToString(calendar, DateTimeUtil.TAXI_HH_mm)); + viewHolder.orderTime.setText("用车时间:今天"+ DateTimeUtil.formatCalendarToString(calendar, DateTimeUtil.HH_mm)); }else { - viewHolder.orderTime.setText("用车时间:"+ DateTimeUtil.formatCalendarToString(calendar, DateTimeUtil.TAXI_MM_dd_HH_mm)); + viewHolder.orderTime.setText("用车时间:"+ DateTimeUtil.formatCalendarToString(calendar, DateTimeUtil.MM_dd_HH_mm)); } viewHolder.orderCancel.setOnClickListener(new View.OnClickListener() { @Override diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/MMsgBoxBubbleView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/MMsgBoxBubbleView.kt new file mode 100644 index 0000000000..7f26f51f5d --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/MMsgBoxBubbleView.kt @@ -0,0 +1,79 @@ +package com.mogo.eagle.core.function.hmi.ui.msgbox + +import android.app.Activity +import android.content.Context +import android.util.AttributeSet +import android.view.LayoutInflater +import androidx.constraintlayout.widget.ConstraintLayout +import androidx.recyclerview.widget.LinearLayoutManager +import com.mogo.eagle.core.data.msgbox.MsgBoxBean +import com.mogo.eagle.core.data.msgbox.MsgBoxType +import com.mogo.eagle.core.data.msgbox.MsgCategory +import com.mogo.eagle.core.function.api.msgbox.IMsgBoxListener +import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager +import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxListenerManager +import com.mogo.eagle.core.function.hmi.R +import com.mogo.eagle.core.function.hmi.ui.msgbox.adapter.MMsgBoxBubbleAdapter +import com.mogo.eagle.core.function.msgbox.MsgBoxConfig +import com.mogo.eagle.core.utilcode.util.UiThreadHandler +import kotlinx.android.synthetic.main.layout_m_msg_box_bubble.view.* + +class MMsgBoxBubbleView @JvmOverloads constructor( + context: Context, + attrs: AttributeSet? = null, + defStyleAttr: Int = 0 +) : ConstraintLayout(context, attrs, defStyleAttr), IMsgBoxListener { + + private val TAG = "MMsgBoxBubbleView" + private val dataList :ArrayList = ArrayList() + private var mMsgBoxBubbleAdapter: MMsgBoxBubbleAdapter?= null + private var isShowData = true + + init { + LayoutInflater.from(context).inflate(R.layout.layout_m_msg_box_bubble, this, true) + initView() + } + + private fun initView(){ + val linearLayoutManager = LinearLayoutManager(context) + linearLayoutManager.orientation = LinearLayoutManager.VERTICAL + mMsgBoxBubbleAdapter = MMsgBoxBubbleAdapter(context as Activity) + rvMBubbleList.adapter = mMsgBoxBubbleAdapter + rvMBubbleList.layoutManager = linearLayoutManager + } + + /** + * 是否展示接收消息,消息盒子打开状态下不再展示气泡消息 + * @param show true 展示;false 不展示 + */ + fun isShowData(show: Boolean){ + isShowData = show + } + + override fun onDataChanged(category: MsgCategory, msgBoxList: MsgBoxBean) { + UiThreadHandler.post { + if(category == MsgCategory.NOTICE){ + if(msgBoxList.type == MsgBoxType.NOTICE || msgBoxList.type == MsgBoxType.V2X + || msgBoxList.type == MsgBoxType.OBU){ + MsgBoxConfig.noticeList.add(msgBoxList) + if(isShowData){ + CallerMsgBoxEventListenerManager.invokeUpdateTipListener(true) + dataList.add(msgBoxList) + mMsgBoxBubbleAdapter?.setData(dataList) + } + } + } + } + } + + override fun onAttachedToWindow() { + super.onAttachedToWindow() + CallerMsgBoxListenerManager.addListener(TAG,this) + } + + override fun onDetachedFromWindow() { + super.onDetachedFromWindow() + CallerMsgBoxListenerManager.removeListener(TAG) + } + +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/MMsgBoxButtonView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/MMsgBoxButtonView.kt new file mode 100644 index 0000000000..29d36332f3 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/MMsgBoxButtonView.kt @@ -0,0 +1,85 @@ +package com.mogo.eagle.core.function.hmi.ui.msgbox + +import android.content.Context +import android.util.AttributeSet +import android.view.LayoutInflater +import android.view.View +import androidx.constraintlayout.widget.ConstraintLayout +import com.mogo.eagle.core.data.msgbox.MsgBoxBean +import com.mogo.eagle.core.function.api.msgbox.IMsgBoxEventListener +import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager +import com.mogo.eagle.core.function.hmi.R +import kotlinx.android.synthetic.main.view_m1_msg_box_button.view.* + +class MMsgBoxButtonView @JvmOverloads constructor( + context: Context, + attrs: AttributeSet? = null, + defStyleAttr: Int = 0 +): ConstraintLayout(context, attrs, defStyleAttr), IMsgBoxEventListener { + + companion object { + const val TAG = "MMsgBoxButtonView" + } + + private var clickListener: ClickListener? = null + + init{ + LayoutInflater.from(context).inflate(R.layout.view_m1_msg_box_button, this, true) + initView() + } + + private fun initView(){ + cbMsgBoxM1.setOnCheckedChangeListener { _, isChecked -> + clickListener?.showMsgBoxList(isChecked) + msgBoxMTipView.visibility = View.GONE + } + } + + override fun onAttachedToWindow() { + super.onAttachedToWindow() + CallerMsgBoxEventListenerManager.addListener(TAG,this) + } + + override fun onDetachedFromWindow() { + super.onDetachedFromWindow() + CallerMsgBoxEventListenerManager.removeListener(TAG) + } + + override fun onSummaryClickEvent() { + + } + + /** + * 更新新消息提醒红点 + * @param isShow true:展示;false:不展示 + */ + override fun onUpdateTipEvent(isShow: Boolean) { + if(isShow){ + msgBoxMTipView.visibility = View.VISIBLE + }else{ + msgBoxMTipView.visibility = View.GONE + } + } + + override fun onBubbleOperationClickEvent(msgBoxBean: MsgBoxBean) { + cbMsgBoxM1.performClick() + } + + override fun onBubbleV2XClickEvent(msgBoxBean: MsgBoxBean) { + cbMsgBoxM1.performClick() + } + + override fun onBubbleReportClickEvent(msgBoxBean: MsgBoxBean) { + cbMsgBoxM1.performClick() + } + + fun setClickListener(clickListener: ClickListener) { + this.clickListener = clickListener + } + + interface ClickListener{ + fun showMsgBoxList(show: Boolean) + } + + +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/MMsgBoxListView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/MMsgBoxListView.kt new file mode 100644 index 0000000000..19098003da --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/MMsgBoxListView.kt @@ -0,0 +1,105 @@ +package com.mogo.eagle.core.function.hmi.ui.msgbox + +import android.app.Activity +import android.content.Context +import android.util.AttributeSet +import android.view.LayoutInflater +import androidx.constraintlayout.widget.ConstraintLayout +import androidx.recyclerview.widget.DividerItemDecoration +import androidx.recyclerview.widget.LinearLayoutManager +import com.mogo.eagle.core.data.msgbox.MsgBoxBean +import com.mogo.eagle.core.data.msgbox.MsgBoxType +import com.mogo.eagle.core.data.msgbox.MsgCategory +import com.mogo.eagle.core.function.api.msgbox.IMsgBoxEventListener +import com.mogo.eagle.core.function.api.msgbox.IMsgBoxListener +import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager +import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxListenerManager +import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager +import com.mogo.eagle.core.function.hmi.R +import com.mogo.eagle.core.function.hmi.ui.msgbox.adapter.MMsgBoxListAdapter +import com.mogo.eagle.core.utilcode.util.ResourceUtils.getDrawable +import com.mogo.eagle.core.utilcode.util.UiThreadHandler +import kotlinx.android.synthetic.main.layout_m_msg_box_list.view.* + +class MMsgBoxListView @JvmOverloads constructor( + context: Context, + attrs: AttributeSet? = null, + defStyleAttr: Int = 0 +) : ConstraintLayout(context, attrs, defStyleAttr), IMsgBoxListener, IMsgBoxEventListener { + + private val TAG = "MMsgBoxListView" + var mMsgBoxListAdapter: MMsgBoxListAdapter?= null + private var noticeList: ArrayList ?= null + + init{ + LayoutInflater.from(context).inflate(R.layout.layout_m_msg_box_list, this, true) + initView() + } + + private fun initView(){ + val linearLayoutManager = LinearLayoutManager(context) + linearLayoutManager.orientation = LinearLayoutManager.VERTICAL + val divider = DividerItemDecoration(context, linearLayoutManager.orientation) + getDrawable(R.drawable.rv_divider_line_m)?.let { divider.setDrawable(it) } + mMsgBoxListAdapter = MMsgBoxListAdapter(context as Activity) + rvMList.adapter = mMsgBoxListAdapter + rvMList.layoutManager = linearLayoutManager + rvMList.addItemDecoration(divider) + //获取通知消息列表 + noticeList= CallerMsgBoxManager.getCachedNotifyData() as ArrayList? + noticeList = noticeList?.let { ArrayList(it.reversed()) } + noticeList?.let { + mMsgBoxListAdapter?.setData(it) + } + + } + + override fun onDataChanged(category: MsgCategory, msgBoxList: MsgBoxBean) { + UiThreadHandler.post{ + if(category == MsgCategory.NOTICE){ + if(msgBoxList.type == MsgBoxType.NOTICE || msgBoxList.type == MsgBoxType.V2X + || msgBoxList.type == MsgBoxType.OBU){ + noticeList?.add(0,msgBoxList) + noticeList?.let { + mMsgBoxListAdapter?.setData(it) + } + } + } + } + } + + override fun onAttachedToWindow() { + super.onAttachedToWindow() + CallerMsgBoxListenerManager.addListener(TAG,this) + CallerMsgBoxEventListenerManager.addListener(TAG,this) + } + + override fun onDetachedFromWindow() { + super.onDetachedFromWindow() + CallerMsgBoxListenerManager.removeListener(TAG) + CallerMsgBoxEventListenerManager.removeListener(TAG) + } + + override fun onSummaryClickEvent() { + + } + + override fun onUpdateTipEvent(isShow: Boolean) { + + } + + override fun onBubbleOperationClickEvent(msgBoxBean: MsgBoxBean) { + + } + + override fun onBubbleV2XClickEvent(msgBoxBean: MsgBoxBean) { + noticeList?.let { + rvMList.scrollToPosition(it.indexOf(msgBoxBean)) + } + } + + override fun onBubbleReportClickEvent(msgBoxBean: MsgBoxBean) { + + } + +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/MMsgBoxBubbleAdapter.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/MMsgBoxBubbleAdapter.kt new file mode 100644 index 0000000000..add1c7f5de --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/MMsgBoxBubbleAdapter.kt @@ -0,0 +1,176 @@ +package com.mogo.eagle.core.function.hmi.ui.msgbox.adapter + +import android.app.Activity +import android.os.CountDownTimer +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.ImageView +import android.widget.TextView +import androidx.recyclerview.widget.RecyclerView +import com.mogo.eagle.core.data.enums.DataSourceType +import com.mogo.eagle.core.data.enums.EventTypeEnumNew +import com.mogo.eagle.core.data.msgbox.* +import com.mogo.eagle.core.utilcode.mogo.glide.GlideApp +import com.mogo.eagle.core.function.call.hmi.CallerHmiManager +import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager +import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager +import com.mogo.eagle.core.function.hmi.R +import com.mogo.eagle.core.utilcode.mogo.glide.transform.GlideRoundedCornersTransform +import com.mogo.eagle.core.utilcode.util.TimeUtils +import com.mogo.eagle.core.utilcode.util.TimeUtils.getHourMinFormat +import com.mogo.eagle.core.widget.RoundCanClickConstraintLayout + +class MMsgBoxBubbleAdapter(private val activity: Activity): RecyclerView.Adapter() { + + private var data: ArrayList ?= null + + private val notice: Int = 1 + private val v2x: Int = 2 + private val summary: Int = 3 + + var countDownTimer: CountDownTimer?=null + + fun setData(data: ArrayList){ + this.data = data + if(data.size>3){ + data.removeAt(0) + } + notifyDataSetChanged() + } + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { + return when (viewType) { + notice -> { + val view = LayoutInflater.from(parent.context).inflate(R.layout.item_m_msg_box_notice,parent,false) + BubbleNoticeHolder(view) + } + summary -> { + val view = LayoutInflater.from(parent.context).inflate(R.layout.item_m_msg_box_summary,parent,false) + BubbleSummaryHolder(view) + } + else -> { + val view = LayoutInflater.from(parent.context).inflate(R.layout.item_m_msg_box_v2x,parent,false) + BubbleV2XHolder(view) + } + } + } + + override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) { + when (holder) { + is BubbleNoticeHolder -> { + data?.let { + val noticeFrCloudMsg = it[position].bean as NoticeFrCloudMsg + if(noticeFrCloudMsg.type == 0){ + val noticeNormalData = noticeFrCloudMsg.noticeNormalData + holder.tvMNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat()) + holder.tvMNoticeContent.text = noticeNormalData?.content + GlideApp.with(activity).load(noticeNormalData?.imageUrl).optionalTransform( + GlideRoundedCornersTransform( + 20f, + GlideRoundedCornersTransform.CornerType.ALL + ) + ).into(holder.ivMNoticeImage) + holder.tvMNoticeCheck.setOnClickListener { + //云公告 + noticeNormalData?.let { it1 -> CallerHmiManager.showNoticeNormalData(it1) } + } + }else if(noticeFrCloudMsg.type == 1){ + val noticeTrafficStylePushData = noticeFrCloudMsg.trafficPushData + holder.tvMNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat()) + holder.tvMNoticeContent.text = noticeTrafficStylePushData?.content + GlideApp.with(activity).load(noticeTrafficStylePushData?.poiImgUrl).optionalTransform( + GlideRoundedCornersTransform( + 20f, + GlideRoundedCornersTransform.CornerType.ALL + ) + ).into(holder.ivMNoticeImage) + holder.tvMNoticeCheck.setOnClickListener { + //云公告 + noticeTrafficStylePushData?.let { it1 -> CallerHmiManager.showTrafficBanner(it1) } + } + } + + } + } + is BubbleV2XHolder -> { + data?.let { + val msgBoxBean = it[position] + val v2XMsg = msgBoxBean.bean as V2XMsg + holder.tvMV2XTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat()) + holder.tvMV2XContent.text = v2XMsg.content + holder.ivMV2XImage.setImageDrawable(activity.resources.getDrawable( + EventTypeEnumNew.getUpdateIconRes(v2XMsg.type))) + holder.clMVeXLayout.setOnClickListener { + CallerMsgBoxEventListenerManager.invokeBubbleV2XListener(msgBoxBean) + } + } + } + is BubbleSummaryHolder -> { + data?.let { + val summaryMsg= it[position].bean as V2XMsg + holder.tvMSummaryTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat()) + holder.tvMSummaryContent.text = summaryMsg.content + holder.tvMSummaryCheck.setOnClickListener { + //跳转全览模式 +// CallerHmiManager.showSmallFragment() + CallerMsgBoxEventListenerManager.invokeSummaryListener() + } + } + } + } + + val msgBoxBean: MsgBoxBean = data!![position] + countDownTimer =object: CountDownTimer(CallerMsgBoxManager.getDismissTime(),1000){ + override fun onTick(p0: Long) { + + } + + override fun onFinish() { + data?.remove(msgBoxBean) + notifyDataSetChanged() +// notifyItemRemoved(index) +// notifyItemRangeChanged(index,recordTypeEntity.size-index) + } + + } + countDownTimer?.start() + } + + override fun getItemCount() = data?.size ?: 0 + + override fun getItemViewType(position: Int): Int { + return if(data!![position].type == MsgBoxType.NOTICE){ + notice + }else if(data!![position].type == MsgBoxType.V2X && data!![position].sourceType == DataSourceType.SUMMARY){ + summary + } else{ + v2x + } + } + + //Notice + class BubbleNoticeHolder(itemView: View): RecyclerView.ViewHolder(itemView){ + var ivMNoticeImage: ImageView = itemView.findViewById(R.id.ivMNoticeImage) + var tvMNoticeTitle: TextView = itemView.findViewById(R.id.tvMNoticeTitle) + var tvMNoticeContent: TextView = itemView.findViewById(R.id.tvMNoticeContent) + var tvMNoticeCheck: TextView = itemView.findViewById(R.id.tvMNoticeCheck) + var tvMNoticeTime: TextView = itemView.findViewById(R.id.tvMNoticeTime) + } + + //OBU、V2X + class BubbleV2XHolder(itemView: View): RecyclerView.ViewHolder(itemView){ + var ivMV2XImage: ImageView = itemView.findViewById(R.id.ivMV2XImage) + var tvMV2XTime: TextView = itemView.findViewById(R.id.tvMV2XTime) + var tvMV2XContent: TextView = itemView.findViewById(R.id.tvMV2XContent) + var clMVeXLayout: RoundCanClickConstraintLayout = itemView.findViewById(R.id.clMVeXLayout) + } + + //汇总消息 + class BubbleSummaryHolder(itemView: View): RecyclerView.ViewHolder(itemView){ + var tvMSummaryContent: TextView = itemView.findViewById(R.id.tvMSummaryContent) + var tvMSummaryCheck: TextView = itemView.findViewById(R.id.tvMSummaryCheck) + var tvMSummaryTime: TextView = itemView.findViewById(R.id.tvMSummaryTime) + } + +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/MMsgBoxListAdapter.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/MMsgBoxListAdapter.kt new file mode 100644 index 0000000000..dc29be12d2 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/msgbox/adapter/MMsgBoxListAdapter.kt @@ -0,0 +1,150 @@ +package com.mogo.eagle.core.function.hmi.ui.msgbox.adapter + +import android.app.Activity +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.ImageView +import android.widget.TextView +import androidx.recyclerview.widget.RecyclerView +import com.mogo.eagle.core.data.enums.DataSourceType +import com.mogo.eagle.core.data.enums.EventTypeEnumNew +import com.mogo.eagle.core.data.msgbox.MsgBoxBean +import com.mogo.eagle.core.data.msgbox.MsgBoxType +import com.mogo.eagle.core.data.msgbox.NoticeFrCloudMsg +import com.mogo.eagle.core.data.msgbox.V2XMsg +import com.mogo.eagle.core.function.call.hmi.CallerHmiManager +import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxEventListenerManager +import com.mogo.eagle.core.function.hmi.R +import com.mogo.eagle.core.utilcode.mogo.glide.transform.GlideRoundedCornersTransform +import com.mogo.eagle.core.utilcode.util.TimeUtils +import com.mogo.eagle.core.utilcode.util.TimeUtils.getHourMinFormat +import com.mogo.eagle.core.utilcode.mogo.glide.GlideApp + +class MMsgBoxListAdapter(private val activity: Activity): RecyclerView.Adapter() { + + private var data: List ?= null + + private val notice: Int = 1 + private val v2x: Int = 2 + private val summary: Int = 3 + + fun setData(data: List){ + this.data = data + notifyDataSetChanged() + } + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { + return when (viewType) { + notice -> { + val view = LayoutInflater.from(parent.context).inflate(R.layout.item_m_msg_list_notice,parent,false) + ListNoticeHolder(view) + } + summary -> { + val view = LayoutInflater.from(parent.context).inflate(R.layout.item_m_msg_list_summary,parent,false) + ListSummaryHolder(view) + } + else -> { + val view = LayoutInflater.from(parent.context).inflate(R.layout.item_m_msg_list_v2x,parent,false) + ListV2XHolder(view) + } + } + } + + override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) { + when (holder) { + is ListNoticeHolder -> { + data?.let { + val noticeFrCloudMsg = it[position].bean as NoticeFrCloudMsg + if(noticeFrCloudMsg.type == 0){ + val noticeNormalData = noticeFrCloudMsg.noticeNormalData + holder.tvMNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat()) + holder.tvMNoticeContent.text = noticeNormalData?.content + GlideApp.with(activity).load(noticeNormalData?.imageUrl).optionalTransform( + GlideRoundedCornersTransform( + 20f, + GlideRoundedCornersTransform.CornerType.ALL + ) + ).into(holder.ivMNoticeImage) + holder.tvMNoticeCheck.setOnClickListener { + //云公告 + noticeNormalData?.let { it1 -> CallerHmiManager.showNoticeNormalData(it1) } + } + }else if(noticeFrCloudMsg.type == 1){ + val noticeTrafficStylePushData = noticeFrCloudMsg.trafficPushData + holder.tvMNoticeTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat()) + holder.tvMNoticeContent.text = noticeTrafficStylePushData?.content + GlideApp.with(activity).load(noticeTrafficStylePushData?.poiImgUrl).optionalTransform( + GlideRoundedCornersTransform( + 20f, + GlideRoundedCornersTransform.CornerType.ALL + ) + ).into(holder.ivMNoticeImage) + holder.tvMNoticeCheck.setOnClickListener { + //云公告 + noticeTrafficStylePushData?.let { it1 -> CallerHmiManager.showTrafficBanner(it1) } + } + } + } + } + is ListV2XHolder -> { + data?.let { + val msgBoxBean = it[position] + val v2XMsg = msgBoxBean.bean as V2XMsg + holder.tvMV2XTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat()) + holder.tvMV2XContent.text = v2XMsg.content + holder.ivMV2XImage.setImageDrawable(activity.resources.getDrawable( + EventTypeEnumNew.getUpdateIconRes(v2XMsg.type))) + } + } + is ListSummaryHolder -> { + data?.let { + val summaryMsg= it[position].bean as V2XMsg + holder.tvMSummaryTime.text = TimeUtils.millis2String(it[position].timestamp,getHourMinFormat()) + holder.tvMSummaryContent.text = summaryMsg.content + holder.tvMSummaryCheck.setOnClickListener { + //跳转全览模式 +// CallerHmiManager.showSmallFragment() + CallerMsgBoxEventListenerManager.invokeSummaryListener() + } + } + } + } + } + + override fun getItemCount() = data?.size ?: 0 + + override fun getItemViewType(position: Int): Int { + return if(data!![position].type == MsgBoxType.NOTICE){ + notice + }else if(data!![position].type == MsgBoxType.V2X && data!![position].sourceType == DataSourceType.SUMMARY){ + summary + } else{ + v2x + } + } + + //Notice + class ListNoticeHolder(itemView: View): RecyclerView.ViewHolder(itemView){ + var ivMNoticeImage: ImageView = itemView.findViewById(R.id.ivMNoticeImage) + var tvMNoticeTitle: TextView = itemView.findViewById(R.id.tvMNoticeTitle) + var tvMNoticeContent: TextView = itemView.findViewById(R.id.tvMNoticeContent) + var tvMNoticeCheck: TextView = itemView.findViewById(R.id.tvMNoticeCheck) + var tvMNoticeTime: TextView = itemView.findViewById(R.id.tvMNoticeTime) + } + + //OBU、V2X + class ListV2XHolder(itemView: View): RecyclerView.ViewHolder(itemView){ + var ivMV2XImage: ImageView = itemView.findViewById(R.id.ivMV2XImage) + var tvMV2XTime: TextView = itemView.findViewById(R.id.tvMV2XTime) + var tvMV2XContent: TextView = itemView.findViewById(R.id.tvMV2XContent) + } + + //汇总消息 + class ListSummaryHolder(itemView: View): RecyclerView.ViewHolder(itemView){ + var tvMSummaryContent: TextView = itemView.findViewById(R.id.tvMSummaryContent) + var tvMSummaryCheck: TextView = itemView.findViewById(R.id.tvMSummaryCheck) + var tvMSummaryTime: TextView = itemView.findViewById(R.id.tvMSummaryTime) + } + +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_msg_box_m_normal.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_msg_box_m_normal.png new file mode 100644 index 0000000000..858ead6571 Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_msg_box_m_normal.png differ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_msg_box_m_select.png b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_msg_box_m_select.png new file mode 100644 index 0000000000..500dc5a450 Binary files /dev/null and b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable-xhdpi/icon_msg_box_m_select.png differ diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/rv_divider_line_m.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/rv_divider_line_m.xml new file mode 100644 index 0000000000..6dfeab3203 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/rv_divider_line_m.xml @@ -0,0 +1,8 @@ + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/selector_msg_box_m.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/selector_msg_box_m.xml new file mode 100644 index 0000000000..e1cbe83c46 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/selector_msg_box_m.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_m_msg_box_notice.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_m_msg_box_notice.xml new file mode 100644 index 0000000000..ff62ba2a18 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_m_msg_box_notice.xml @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_m_msg_box_summary.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_m_msg_box_summary.xml new file mode 100644 index 0000000000..d8b8480c30 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_m_msg_box_summary.xml @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_m_msg_box_v2x.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_m_msg_box_v2x.xml new file mode 100644 index 0000000000..1714adfa15 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_m_msg_box_v2x.xml @@ -0,0 +1,51 @@ + + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_m_msg_list_notice.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_m_msg_list_notice.xml new file mode 100644 index 0000000000..b63bcf7478 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_m_msg_list_notice.xml @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_m_msg_list_summary.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_m_msg_list_summary.xml new file mode 100644 index 0000000000..6c41f48932 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_m_msg_list_summary.xml @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_m_msg_list_v2x.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_m_msg_list_v2x.xml new file mode 100644 index 0000000000..0c60db148f --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/item_m_msg_list_v2x.xml @@ -0,0 +1,46 @@ + + + + + + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/layout_m_msg_box_bubble.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/layout_m_msg_box_bubble.xml new file mode 100644 index 0000000000..43bd8f8e43 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/layout_m_msg_box_bubble.xml @@ -0,0 +1,8 @@ + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/layout_m_msg_box_list.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/layout_m_msg_box_list.xml new file mode 100644 index 0000000000..ffe09f8cfe --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/layout_m_msg_box_list.xml @@ -0,0 +1,21 @@ + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_m1_msg_box_button.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_m1_msg_box_button.xml new file mode 100644 index 0000000000..8bb164354d --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_m1_msg_box_button.xml @@ -0,0 +1,31 @@ + + + + + + + + + + \ No newline at end of file