[charter]

[3.2.0]
[弱网、网络加载页面]
This commit is contained in:
yangyakun
2023-05-22 18:56:50 +08:00
parent 03470a195e
commit 8219a95d08
7 changed files with 209 additions and 52 deletions

View File

@@ -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<LineInfoListResponse> {
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

View File

@@ -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)

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

View File

@@ -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" />
<View
app:layout_constraintBottom_toBottomOf="parent"
android:background="@drawable/charter_p_selct_site_bottom_corner"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_90"/>
android:layout_height="@dimen/dp_90"
android:background="@drawable/charter_p_selct_site_bottom_corner"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -167,34 +166,34 @@
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/aciv_driver_agree_title_top"
app:layout_constraintStart_toStartOf="@+id/aciv_driver_agree_image"
app:layout_constraintEnd_toEndOf="@+id/aciv_driver_agree_image"
app:layout_constraintTop_toBottomOf="@+id/aciv_driver_agree_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_34"
android:text="确认完毕!"
android:textColor="@color/bus_p_m1_112b57"
android:textStyle="bold"
android:textSize="@dimen/dp_34"
android:layout_marginTop="@dimen/dp_34"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
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" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/aciv_driver_agree_title_bottom"
app:layout_constraintStart_toStartOf="@+id/aciv_driver_agree_image"
app:layout_constraintEnd_toEndOf="@+id/aciv_driver_agree_image"
app:layout_constraintTop_toBottomOf="@+id/aciv_driver_agree_title_top"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="小助手已记录您的选择。"
android:textColor="@color/bus_p_m1_112b57"
android:textSize="@dimen/dp_29"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
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" />
<androidx.constraintlayout.widget.Group
android:id="@+id/group_driver_agrenn_line"
app:constraint_referenced_ids="aciv_driver_agree_image,aciv_driver_agree_title_top,aciv_driver_agree_title_bottom"
android:visibility="gone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
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" />
<!--endregion 司机同意显示-->
<!--region 司机拒绝显示-->
@@ -211,24 +210,24 @@
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/aciv_driver_refuse_title"
app:layout_constraintStart_toStartOf="@+id/aciv_driver_refuse_image"
app:layout_constraintEnd_toEndOf="@+id/aciv_driver_refuse_image"
app:layout_constraintTop_toBottomOf="@+id/aciv_driver_refuse_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_35"
android:gravity="center"
android:text="啊哦,加载失败了\n联系车内领航员或尝试再次提交。"
android:textColor="@color/bus_p_m1_112b57"
android:textSize="@dimen/dp_34"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
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" />
<androidx.constraintlayout.widget.Group
android:id="@+id/aciv_driver_refuse_group"
android:visibility="gone"
app:constraint_referenced_ids="aciv_driver_refuse_image,aciv_driver_refuse_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
android:layout_height="wrap_content"
android:visibility="gone"
app:constraint_referenced_ids="aciv_driver_refuse_image,aciv_driver_refuse_title" />
<!--endregion 司机拒绝显示-->
@@ -239,6 +238,16 @@
layout="@layout/m1_order_noorder"
android:visibility="gone" />
<include
android:id="@+id/m1_order_neterror"
layout="@layout/m1_order_net_fail"
android:visibility="gone" />
<include
android:id="@+id/m1_order_loading"
layout="@layout/m1_order_loading"
android:visibility="gone" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/ll_noorder"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:gravity="center"
android:orientation="vertical"
xmlns:app="http://schemas.android.com/apk/res-auto">
<ImageView
android:id="@+id/iv_loading_wait_ent"
android:layout_width="@dimen/dp_71"
android:layout_height="@dimen/dp_73"
android:src="@drawable/bus_p_loading"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.372" />
<TextView
android:id="@+id/tv_loading_wait_driver_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="63dp"
android:text="加载中 请稍等"
android:gravity="center"
android:textColor="@color/bus_p_m1_4a5375"
android:textSize="@dimen/dp_30"
app:layout_constraintEnd_toEndOf="@+id/iv_loading_wait_driver"
app:layout_constraintStart_toStartOf="@+id/iv_loading_wait_driver"
app:layout_constraintTop_toBottomOf="@+id/iv_loading_wait_driver" />
</LinearLayout>

View File

@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/ll_noorder"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<!-- 无订单页面 -->
<ImageView
android:layout_width="@dimen/dp_387"
android:layout_height="@dimen/dp_230"
android:src="@drawable/m1_order_net_fail"
android:layout_marginTop="@dimen/dp_68"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_see_next_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_42"
android:text="@string/m1_net_error"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginBottom="@dimen/dp_99"
android:textColor="@color/bus_p_m1_112b57"
android:textSize="@dimen/dp_29" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_42"
android:text="网络不佳"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toTopOf="@+id/tv_see_next_time"
android:layout_marginBottom="@dimen/dp_5"
android:textColor="@color/bus_p_m1_112b57"
android:textSize="@dimen/dp_34" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -49,6 +49,7 @@
<string name="m1_close_door_and_startauto">先关闭车门再启动吧~</string>
<string name="m1_start_auto_fail">自驾系统繁忙,稍后再试试吧~</string>
<string name="arrived_station_left_100">%1$s就要到啦</string>
<string name="m1_net_error">稍后再来看看吧</string>
<!-- <string name="m1_novice_guidance_tts">正在为您靠边停车,扶稳坐好哟</string>-->
<!-- <string name="m1_novice_guidance_tts">靠边停车成功</string>-->
<!-- <string name="m1_novice_guidance_tts">车辆系统繁忙,请稍后再试</string>-->