diff --git a/OCH/mogo-och-charter-passenger/src/main/java/com/mogo/och/bus/passenger/presenter/BusPassengerFunctionOrderPresenter.kt b/OCH/mogo-och-charter-passenger/src/main/java/com/mogo/och/bus/passenger/presenter/BusPassengerFunctionOrderPresenter.kt index 47ad1581fc..43d50a7518 100644 --- a/OCH/mogo-och-charter-passenger/src/main/java/com/mogo/och/bus/passenger/presenter/BusPassengerFunctionOrderPresenter.kt +++ b/OCH/mogo-och-charter-passenger/src/main/java/com/mogo/och/bus/passenger/presenter/BusPassengerFunctionOrderPresenter.kt @@ -67,8 +67,13 @@ class BusPassengerFunctionOrderPresenter(view: M1OrderLineFragment?) : CharterPassengerModel.setStatusChangeListener(TAG,this) CallerTelematicListenerManager.addListener(TAG, msgReceived) + extracted() + } + + private fun extracted() { val currentOrderStatus = CharterPassengerModel.getCurrentOrderStatus() - if(currentOrderStatus==OrderStatusEnum.OrderNoLine||currentOrderStatus==OrderStatusEnum.OrdersWithLine) { + onStatusChange(currentOrderStatus) + if (currentOrderStatus == OrderStatusEnum.OrderNoLine || currentOrderStatus == OrderStatusEnum.OrdersWithLine) { val hasSetLineAndSite = CharterPassengerModel.hasSetLineAndSite() if (hasSetLineAndSite != null) {// 已经设置了线路和站点 checkLine = hasSetLineAndSite.first @@ -141,27 +146,41 @@ class BusPassengerFunctionOrderPresenter(view: M1OrderLineFragment?) : override fun onFail(code: Int, msg: String?) { ToastUtils.showShort("查询站点失败") + mView?.setVisableByTrun(showNetError = true) + } + + override fun onError() { + super.onError() + ToastUtils.showShort("查询站点失败") + mView?.setVisableByTrun(showNetError = true) } }) } private fun queryLineList() { + mView?.setVisableByTrun(showLoading = true) BusPassengerServiceManager.queryLineList(context, object : OchCommonServiceCallback { override fun onSuccess(data: LineInfoListResponse?) { if (data?.data == null) return + mView?.setVisableByTrun(showBiz = true) mView?.lineAdapterSetData(data.data,checkLine) } override fun onFail(code: Int, msg: String) { ToastUtils.showShort("查询线路失败") + mView?.setVisableByTrun(showNetError = true) + } + + override fun onError() { + super.onError() + mView?.setVisableByTrun(showNetError = true) } }) } override fun onResume(owner: LifecycleOwner) { super.onResume(owner) - mView?.setViewByOrderStatus(CharterPassengerModel.getCurrentOrderStatus()) } override fun onDestroy(owner: LifecycleOwner) { @@ -273,15 +292,24 @@ class BusPassengerFunctionOrderPresenter(view: M1OrderLineFragment?) : } override fun onStatusChange(currentStatus: OrderStatusEnum) { - mView?.setViewByOrderStatus(currentStatus) + when (currentStatus) { + OrderStatusEnum.OrderNoLine -> { + mView?.setVisableByTrun(showBiz = true) + extracted() + } + OrderStatusEnum.OrdersWithLine ->{ + mView?.setVisableByTrun(showBiz = true) + } + else ->{ + mView?.setVisableByTrun(showNorOrder = true) + } + } } fun canSwitchLine():Boolean { val gnssSpeed = CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02().gnssSpeed if (gnssSpeed < 0.5) { - // TODO: 自驾中 需要 靠边停车中、到站 - // TODO: 没有自驾中 需要 靠边停车中、到站 when (CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo().state) { IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE -> {// 不可自动驾驶 return true diff --git a/OCH/mogo-och-charter-passenger/src/main/java/com/mogo/och/bus/passenger/ui/dialogfragment/fragment/M1OrderLineFragment.kt b/OCH/mogo-och-charter-passenger/src/main/java/com/mogo/och/bus/passenger/ui/dialogfragment/fragment/M1OrderLineFragment.kt index 140eb2ef76..3a2f6b65f9 100644 --- a/OCH/mogo-och-charter-passenger/src/main/java/com/mogo/och/bus/passenger/ui/dialogfragment/fragment/M1OrderLineFragment.kt +++ b/OCH/mogo-och-charter-passenger/src/main/java/com/mogo/och/bus/passenger/ui/dialogfragment/fragment/M1OrderLineFragment.kt @@ -1,8 +1,10 @@ package com.mogo.och.bus.passenger.ui.dialogfragment.fragment +import android.animation.ObjectAnimator import android.graphics.drawable.AnimationDrawable import android.os.Bundle import android.view.View +import android.view.animation.LinearInterpolator import androidx.recyclerview.widget.LinearLayoutManager import com.elegant.utils.UiThreadHandler import com.mogo.commons.mvp.MvpFragment @@ -23,6 +25,7 @@ import com.mogo.och.bus.passenger.view.BottomDecoration import com.mogo.och.common.module.utils.RxUtils import io.reactivex.disposables.Disposable import kotlinx.android.synthetic.main.m1_order_fragment.* +import kotlinx.android.synthetic.main.m1_order_loading.iv_loading_wait_ent import me.jessyan.autosize.utils.AutoSizeUtils /** @@ -44,6 +47,14 @@ class M1OrderLineFragment : private var subscribeDirverAgree: Disposable? = null private var subscribeDirverRefuse: Disposable? = null + private val loadingAni = + ObjectAnimator.ofFloat(iv_loading_wait_ent, "rotation", 0f, 90f, 180f, 270f, 360f) + .apply { + repeatCount = -1 + interpolator = LinearInterpolator() + duration = 1000 + } + override fun getLayoutId(): Int { return R.layout.m1_order_fragment @@ -57,6 +68,7 @@ class M1OrderLineFragment : CallerLogger.d(SceneConstant.M_BUS_P + TAG, "initViews") lineAdapter = OrderLineItemAdapter(requireContext(), lineList) siteAdapter = OrderSiteItemAdapter(requireContext(), siteList) + loadingAni.target = iv_loading_wait_ent rlv_line_list.layoutManager = LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false) rlv_line_list.addItemDecoration( @@ -163,23 +175,41 @@ class M1OrderLineFragment : } } - - fun setViewByOrderStatus(currentStatus: OrderStatusEnum) { - when (currentStatus) { - OrderStatusEnum.NoOrderUnuse -> { - // 无订单页面 - m1_order_noorder.visibility = View.VISIBLE - lsv_line_site.visibility = View.GONE - } - OrderStatusEnum.OrderNoLine -> { - // 选择线路页面 - m1_order_noorder.visibility = View.GONE - lsv_line_site.visibility = View.VISIBLE - } - OrderStatusEnum.OrdersWithLine -> { - // 选择线路页面 - m1_order_noorder.visibility = View.GONE - lsv_line_site.visibility = View.VISIBLE + fun setVisableByTrun( + showBiz: Boolean = false, + showNetError: Boolean = false, + showNorOrder: Boolean = false, + showLoading: Boolean = false + ) { + if(showBiz){ + // 选择线路页面 + m1_order_noorder.visibility = View.GONE + m1_order_neterror.visibility = View.GONE + lsv_line_site.visibility = View.VISIBLE + m1_order_loading.visibility = View.GONE + return + } + if(showNetError){ + m1_order_noorder.visibility = View.GONE + m1_order_neterror.visibility = View.VISIBLE + lsv_line_site.visibility = View.GONE + m1_order_loading.visibility = View.GONE + return + } + if(showNorOrder){ + m1_order_noorder.visibility = View.VISIBLE + m1_order_neterror.visibility = View.GONE + lsv_line_site.visibility = View.GONE + m1_order_loading.visibility = View.GONE + return + } + if(showLoading){ + m1_order_noorder.visibility = View.GONE + m1_order_neterror.visibility = View.GONE + lsv_line_site.visibility = View.GONE + m1_order_loading.visibility = View.VISIBLE + if (!loadingAni.isRunning) { + loadingAni.start() } } } @@ -196,7 +226,7 @@ class M1OrderLineFragment : override fun onDestroyView() { super.onDestroyView() - //loadingAni.cancel() + loadingAni.cancel() CallerLogger.d(SceneConstant.M_BUS_P + TAG, "onDestroyView") RxUtils.disposeSubscribe(subscribeDirverAgree) RxUtils.disposeSubscribe(subscribeDirverRefuse) diff --git a/OCH/mogo-och-charter-passenger/src/main/res/drawable-nodpi/m1_order_net_fail.png b/OCH/mogo-och-charter-passenger/src/main/res/drawable-nodpi/m1_order_net_fail.png new file mode 100644 index 0000000000..05b348e149 Binary files /dev/null and b/OCH/mogo-och-charter-passenger/src/main/res/drawable-nodpi/m1_order_net_fail.png differ diff --git a/OCH/mogo-och-charter-passenger/src/main/res/layout/m1_order_fragment.xml b/OCH/mogo-och-charter-passenger/src/main/res/layout/m1_order_fragment.xml index 1e4824f86c..932725b461 100644 --- a/OCH/mogo-och-charter-passenger/src/main/res/layout/m1_order_fragment.xml +++ b/OCH/mogo-och-charter-passenger/src/main/res/layout/m1_order_fragment.xml @@ -56,14 +56,13 @@ android:id="@+id/rv_site_list" android:layout_width="match_parent" android:layout_height="match_parent" - android:layout_marginTop="@dimen/dp_26" - /> - + android:layout_marginTop="@dimen/dp_26" /> + + android:layout_height="@dimen/dp_90" + android:background="@drawable/charter_p_selct_site_bottom_corner" + app:layout_constraintBottom_toBottomOf="parent" /> @@ -167,34 +166,34 @@ + android:textStyle="bold" + app:layout_constraintEnd_toEndOf="@+id/aciv_driver_agree_image" + app:layout_constraintStart_toStartOf="@+id/aciv_driver_agree_image" + app:layout_constraintTop_toBottomOf="@+id/aciv_driver_agree_image" /> + app:layout_constraintEnd_toEndOf="@+id/aciv_driver_agree_image" + app:layout_constraintStart_toStartOf="@+id/aciv_driver_agree_image" + app:layout_constraintTop_toBottomOf="@+id/aciv_driver_agree_title_top" /> + android:layout_height="wrap_content" + android:visibility="gone" + app:constraint_referenced_ids="aciv_driver_agree_image,aciv_driver_agree_title_top,aciv_driver_agree_title_bottom" /> @@ -211,24 +210,24 @@ + app:layout_constraintEnd_toEndOf="@+id/aciv_driver_refuse_image" + app:layout_constraintStart_toStartOf="@+id/aciv_driver_refuse_image" + app:layout_constraintTop_toBottomOf="@+id/aciv_driver_refuse_image" /> + android:layout_height="wrap_content" + android:visibility="gone" + app:constraint_referenced_ids="aciv_driver_refuse_image,aciv_driver_refuse_title" /> @@ -239,6 +238,16 @@ layout="@layout/m1_order_noorder" android:visibility="gone" /> + + + + diff --git a/OCH/mogo-och-charter-passenger/src/main/res/layout/m1_order_loading.xml b/OCH/mogo-och-charter-passenger/src/main/res/layout/m1_order_loading.xml new file mode 100644 index 0000000000..a2c08d102a --- /dev/null +++ b/OCH/mogo-och-charter-passenger/src/main/res/layout/m1_order_loading.xml @@ -0,0 +1,38 @@ + + + + + + + + \ No newline at end of file diff --git a/OCH/mogo-och-charter-passenger/src/main/res/layout/m1_order_net_fail.xml b/OCH/mogo-och-charter-passenger/src/main/res/layout/m1_order_net_fail.xml new file mode 100644 index 0000000000..4724f5aa1d --- /dev/null +++ b/OCH/mogo-och-charter-passenger/src/main/res/layout/m1_order_net_fail.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/OCH/mogo-och-charter-passenger/src/main/res/values/strings.xml b/OCH/mogo-och-charter-passenger/src/main/res/values/strings.xml index 1cde6d41fd..f7264de06a 100644 --- a/OCH/mogo-och-charter-passenger/src/main/res/values/strings.xml +++ b/OCH/mogo-och-charter-passenger/src/main/res/values/strings.xml @@ -49,6 +49,7 @@ 先关闭车门再启动吧~ 自驾系统繁忙,稍后再试试吧~ %1$s就要到啦! + 稍后再来看看吧