[3.3.2]
[行程显示逻辑]
This commit is contained in:
@@ -1,207 +1,223 @@
|
||||
package com.mogo.och.taxi.passenger.presenter;
|
||||
package com.mogo.och.taxi.passenger.presenter
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_TAXI_P;
|
||||
|
||||
import android.os.Looper;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.eagle.core.function.call.biz.CallerFuncBizManager;
|
||||
import com.mogo.eagle.core.function.call.order.CallerOrderListenerManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.common.module.manager.OCHAdasAbilityManager;
|
||||
import com.mogo.och.taxi.passenger.bean.TaxiPassengerOrderQueryRespBean;
|
||||
import com.mogo.och.taxi.passenger.callback.IOCHTaxiPassengerOrderStatusCallback;
|
||||
import com.mogo.och.taxi.passenger.callback.ITaxiPassengerCommonCallback;
|
||||
import com.mogo.och.taxi.passenger.constant.TaxiPassengerOrderStatusEnum;
|
||||
import com.mogo.och.taxi.passenger.model.AutopilotManager;
|
||||
import com.mogo.och.taxi.passenger.model.TaxiPassengerModel;
|
||||
import com.mogo.och.taxi.passenger.ui.TaxiPassengerBaseFragment;
|
||||
import android.os.Looper
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.mogo.eagle.core.function.call.biz.CallerFuncBizManager.bizProvider
|
||||
import com.mogo.eagle.core.function.call.order.CallerOrderListenerManager.invokeOrderStatus
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.och.common.module.manager.OCHAdasAbilityManager
|
||||
import com.mogo.och.taxi.passenger.bean.TaxiPassengerOrderQueryRespBean
|
||||
import com.mogo.och.taxi.passenger.callback.IOCHTaxiPassengerOrderStatusCallback
|
||||
import com.mogo.och.taxi.passenger.constant.TaxiPassengerOrderStatusEnum
|
||||
import com.mogo.och.taxi.passenger.model.AutopilotManager
|
||||
import com.mogo.och.taxi.passenger.model.AutopilotManager.clearAutopilotControlParameters
|
||||
import com.mogo.och.taxi.passenger.model.AutopilotManager.updateAutopilotControlParameters
|
||||
import com.mogo.och.taxi.passenger.model.TaxiPassengerModel
|
||||
import com.mogo.och.taxi.passenger.ui.TaxiPassengerBaseFragment
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/3/4
|
||||
*/
|
||||
public class BaseTaxiPassengerPresenter extends Presenter<TaxiPassengerBaseFragment> implements
|
||||
IOCHTaxiPassengerOrderStatusCallback {
|
||||
class BaseTaxiPassengerPresenter(view: TaxiPassengerBaseFragment?) :
|
||||
Presenter<TaxiPassengerBaseFragment?>(view), IOCHTaxiPassengerOrderStatusCallback {
|
||||
@Volatile
|
||||
private var mCurrentPassengerOrder: TaxiPassengerOrderQueryRespBean.Result? = null //当前订单
|
||||
|
||||
private static final String TAG = BaseTaxiPassengerPresenter.class.getSimpleName();
|
||||
|
||||
private volatile TaxiPassengerOrderQueryRespBean.Result mCurrentPassengerOrder = null; //当前订单
|
||||
|
||||
public BaseTaxiPassengerPresenter(TaxiPassengerBaseFragment view) {
|
||||
super(view);
|
||||
TaxiPassengerModel.INSTANCE.init(AbsMogoApplication.getApp());
|
||||
OCHAdasAbilityManager.getInstance().init(AbsMogoApplication.getApp());
|
||||
initListeners();
|
||||
init {
|
||||
TaxiPassengerModel.init(AbsMogoApplication.getApp())
|
||||
OCHAdasAbilityManager.getInstance().init(AbsMogoApplication.getApp())
|
||||
initListeners()
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate( @NonNull LifecycleOwner owner ) {
|
||||
super.onCreate( owner );
|
||||
CallerLogger.INSTANCE.d( M_TAXI_P + TAG, "网约车-出租车拿到订单" );
|
||||
override fun onCreate(owner: LifecycleOwner) {
|
||||
super.onCreate(owner)
|
||||
d(SceneConstant.M_TAXI_P + TAG, "网约车-出租车拿到订单")
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy( @NonNull LifecycleOwner owner ) {
|
||||
super.onDestroy( owner );
|
||||
|
||||
releaseListeners();
|
||||
TaxiPassengerModel.INSTANCE.release();
|
||||
OCHAdasAbilityManager.getInstance().release();
|
||||
override fun onDestroy(owner: LifecycleOwner) {
|
||||
super.onDestroy(owner)
|
||||
releaseListeners()
|
||||
TaxiPassengerModel.release()
|
||||
OCHAdasAbilityManager.getInstance().release()
|
||||
}
|
||||
|
||||
private void initListeners() {
|
||||
TaxiPassengerModel.INSTANCE.setOrderStatusCallback("BaseTaxiPassengerPresenter",this);
|
||||
private fun initListeners() {
|
||||
TaxiPassengerModel.setOrderStatusCallback("BaseTaxiPassengerPresenter", this)
|
||||
}
|
||||
|
||||
private void releaseListeners() {
|
||||
TaxiPassengerModel.INSTANCE.setOrderStatusCallback("BaseTaxiPassengerPresenter",null);
|
||||
private fun releaseListeners() {
|
||||
TaxiPassengerModel.setOrderStatusCallback("BaseTaxiPassengerPresenter", null)
|
||||
}
|
||||
|
||||
private void runOnUIThread( Runnable executor ) {
|
||||
if ( executor == null ) {
|
||||
return;
|
||||
private fun runOnUIThread(executor: Runnable?) {
|
||||
if (executor == null) {
|
||||
return
|
||||
}
|
||||
if ( Looper.myLooper() != Looper.getMainLooper() ) {
|
||||
UiThreadHandler.post( executor );
|
||||
if (Looper.myLooper() != Looper.getMainLooper()) {
|
||||
UiThreadHandler.post(executor)
|
||||
} else {
|
||||
executor.run();
|
||||
executor.run()
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCurrentOrderStatusChanged(TaxiPassengerOrderQueryRespBean.Result order) {
|
||||
override fun onCurrentOrderStatusChanged(order: TaxiPassengerOrderQueryRespBean.Result?) {
|
||||
// CallerLogger.INSTANCE.d(M_TAXI_P + TAG, GsonUtil.jsonFromObject(order));
|
||||
if (mCurrentPassengerOrder == null){
|
||||
mCurrentPassengerOrder = order; //当前无订单
|
||||
updateOrderView(order);
|
||||
}else if (mCurrentPassengerOrder.orderStatus != order.orderStatus) {
|
||||
mCurrentPassengerOrder = order;
|
||||
updateOrderView(order);
|
||||
if (mCurrentPassengerOrder == null) {
|
||||
mCurrentPassengerOrder = order //当前无订单
|
||||
updateOrderView(order)
|
||||
} else if (mCurrentPassengerOrder!!.orderStatus != order!!.orderStatus) {
|
||||
mCurrentPassengerOrder = order
|
||||
updateOrderView(order)
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCurrentOrderDistToEndChanged(long meters, long timeInSecond,int stationDistance) {
|
||||
|
||||
override fun onCurrentOrderDistToEndChanged(
|
||||
meters: Long,
|
||||
timeInSecond: Long,
|
||||
stationDistance: Int
|
||||
) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDriverHasCheckedPilotCondition(boolean isBoarded) {
|
||||
CallerLogger.INSTANCE.d(M_TAXI_P+TAG,"isBoarded = "+isBoarded);
|
||||
runOnUIThread(() -> {
|
||||
mView.updateStartAutopilotBtnStatus(isBoarded);
|
||||
});
|
||||
override fun onDriverHasCheckedPilotCondition(isBoarded: Boolean) {
|
||||
d(SceneConstant.M_TAXI_P + TAG, "isBoarded = $isBoarded")
|
||||
runOnUIThread { mView!!.updateStartAutopilotBtnStatus(isBoarded) }
|
||||
}
|
||||
|
||||
private void updateOrderView(TaxiPassengerOrderQueryRespBean.Result order) {
|
||||
CallerLogger.INSTANCE.d(M_TAXI_P+TAG,"updateOrderView = "+order.orderStatus);
|
||||
private fun updateOrderView(order: TaxiPassengerOrderQueryRespBean.Result?) {
|
||||
d(SceneConstant.M_TAXI_P + TAG, "updateOrderView = " + order!!.orderStatus)
|
||||
setItineraryVisibility()
|
||||
// 70 取消订单
|
||||
if (TaxiPassengerOrderStatusEnum.Cancel.getCode() == order.orderStatus){
|
||||
runOnUIThread(() -> {
|
||||
mView.showOrHideServingOrderFragment(false);
|
||||
mView.showOrHideOverMapViewFragment(false);
|
||||
mView.showOrHideStartAutopilotView(false,false);
|
||||
mView.showOrHidePressengerCheckPager(false, "",
|
||||
"", "", "", "");
|
||||
mView.showOrHideArrivedEndLayout(false,"","");
|
||||
});
|
||||
TaxiPassengerModel.INSTANCE.recoverNaviInfo();
|
||||
AutopilotManager.INSTANCE.clearAutopilotControlParameters();
|
||||
TaxiPassengerModel.INSTANCE.startOrStopQueryOrderRemaining(false);
|
||||
TaxiPassengerModel.INSTANCE.startOrStopReadyToAutopilotLoop(false);
|
||||
TaxiPassengerModel.INSTANCE.cleanStation();
|
||||
return;
|
||||
if (TaxiPassengerOrderStatusEnum.Cancel.code == order.orderStatus) {
|
||||
runOnUIThread {
|
||||
mView!!.showOrHideOverMapViewFragment(false)
|
||||
mView!!.showOrHideStartAutopilotView(false, false)
|
||||
mView!!.showOrHidePressengerCheckPager(
|
||||
false, "",
|
||||
"", "", "", ""
|
||||
)
|
||||
mView!!.showOrHideArrivedEndLayout(false, "", "")
|
||||
}
|
||||
TaxiPassengerModel.recoverNaviInfo()
|
||||
clearAutopilotControlParameters()
|
||||
TaxiPassengerModel.startOrStopQueryOrderRemaining(false)
|
||||
TaxiPassengerModel.startOrStopReadyToAutopilotLoop(false)
|
||||
TaxiPassengerModel.cleanStation()
|
||||
return
|
||||
}
|
||||
// 20 司机到达上车点
|
||||
if (TaxiPassengerOrderStatusEnum.ArriveAtStart.getCode() == order.orderStatus) {
|
||||
runOnUIThread(() -> {
|
||||
mView.preOrderThankPageTenlogic(order.startSiteAddr,
|
||||
order.endSiteAddr, order.passengerNum, order.carNumber, order.passengerPhone);
|
||||
});
|
||||
return;
|
||||
if (TaxiPassengerOrderStatusEnum.ArriveAtStart.code == order.orderStatus) {
|
||||
runOnUIThread {
|
||||
mView!!.preOrderThankPageTenlogic(
|
||||
order.startSiteAddr,
|
||||
order.endSiteAddr, order.passengerNum, order.carNumber, order.passengerPhone
|
||||
)
|
||||
}
|
||||
return
|
||||
}
|
||||
// TODO: 2022/6/10 若乘客端确认已经上车,则显示开始行程按钮 并且不可点击 暗
|
||||
// TODO: 2022/6/10 乘客已上车 需要开启轮询司机确认可以开启自动驾驶的接口
|
||||
// TODO: 2022/6/10 若司机端已经确认,则显示开始行程按钮 并且可点击,第二步的轮询停止
|
||||
//TODO: 2022/6/10 若订单取消或者隐藏则关掉开始行程界面,轮询也要取消
|
||||
if (TaxiPassengerOrderStatusEnum.UserArriveAtStart.getCode() == order.orderStatus){
|
||||
runOnUIThread(() ->{
|
||||
CallerLogger.INSTANCE.d(M_TAXI_P+TAG,"UserArriveAtStart");
|
||||
mView.showOrHideStartAutopilotView(true,false);
|
||||
});
|
||||
if (TaxiPassengerOrderStatusEnum.UserArriveAtStart.code == order.orderStatus) {
|
||||
runOnUIThread {
|
||||
d(SceneConstant.M_TAXI_P + TAG, "UserArriveAtStart")
|
||||
mView!!.showOrHideStartAutopilotView(true, false)
|
||||
}
|
||||
//开启轮询司机是否已准备好开启自动驾驶的环境
|
||||
TaxiPassengerModel.INSTANCE.startDriverReadyToAutopilotLoop();
|
||||
TaxiPassengerModel.INSTANCE.setStation();
|
||||
TaxiPassengerModel.startDriverReadyToAutopilotLoop()
|
||||
TaxiPassengerModel.setStation()
|
||||
}
|
||||
if (TaxiPassengerOrderStatusEnum.OnTheWayToEnd.getCode() == order.orderStatus){
|
||||
runOnUIThread(() ->{
|
||||
mView.showOrHideStartAutopilotView(false,false);
|
||||
mView.showOrHideServingOrderFragment(true);
|
||||
});
|
||||
CallerFuncBizManager.getBizProvider().queryV2XEvents();//全览模式的V2X事件轮询开始
|
||||
TaxiPassengerModel.INSTANCE.startOrStopQueryOrderRemaining(true);
|
||||
AutopilotManager.INSTANCE.updateAutopilotControlParameters();
|
||||
TaxiPassengerModel.INSTANCE.startOrStopReadyToAutopilotLoop(false);
|
||||
TaxiPassengerModel.INSTANCE.setStation();
|
||||
if (TaxiPassengerOrderStatusEnum.OnTheWayToEnd.code == order.orderStatus) {
|
||||
runOnUIThread {
|
||||
mView!!.showOrHideStartAutopilotView(false, false)
|
||||
}
|
||||
bizProvider.queryV2XEvents() //全览模式的V2X事件轮询开始
|
||||
TaxiPassengerModel.startOrStopQueryOrderRemaining(true)
|
||||
updateAutopilotControlParameters()
|
||||
TaxiPassengerModel.startOrStopReadyToAutopilotLoop(false)
|
||||
TaxiPassengerModel.setStation()
|
||||
}
|
||||
// 30 用户到达上车点 并通过了手机号后四位验证
|
||||
// 40 服务中
|
||||
if (TaxiPassengerOrderStatusEnum.UserArriveAtStart.getCode() == order.orderStatus
|
||||
|| TaxiPassengerOrderStatusEnum.OnTheWayToEnd.getCode() == order.orderStatus){
|
||||
runOnUIThread(() -> {
|
||||
mView.showOrHideArrivedEndLayout(false,"","");
|
||||
mView.showOrHidePressengerCheckPager(false, "",
|
||||
"", "", "", "");
|
||||
if(TaxiPassengerOrderStatusEnum.OnTheWayToEnd.getCode() == order.orderStatus){
|
||||
CallerOrderListenerManager.INSTANCE.invokeOrderStatus(true);
|
||||
if (TaxiPassengerOrderStatusEnum.UserArriveAtStart.code == order.orderStatus
|
||||
|| TaxiPassengerOrderStatusEnum.OnTheWayToEnd.code == order.orderStatus
|
||||
) {
|
||||
runOnUIThread {
|
||||
mView!!.showOrHideArrivedEndLayout(false, "", "")
|
||||
mView!!.showOrHidePressengerCheckPager(
|
||||
false, "",
|
||||
"", "", "", ""
|
||||
)
|
||||
if (TaxiPassengerOrderStatusEnum.OnTheWayToEnd.code == order.orderStatus) {
|
||||
invokeOrderStatus(true)
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// 50 到达终点 乘客可以评价
|
||||
if (TaxiPassengerOrderStatusEnum.ArriveAtEnd.getCode() == order.orderStatus){
|
||||
TaxiPassengerModel.INSTANCE.recoverNaviInfo();
|
||||
mView.showOrHideOverMapViewFragment(false);
|
||||
AutopilotManager.INSTANCE.clearAutopilotControlParameters();
|
||||
TaxiPassengerModel.INSTANCE.startOrStopQueryOrderRemaining(false);
|
||||
runOnUIThread(() -> {
|
||||
mView.showOrHideServingOrderFragment(false);
|
||||
mView.showOrHideArrivedEndLayout(true, order.endSiteAddr,order.orderNo);
|
||||
CallerOrderListenerManager.INSTANCE.invokeOrderStatus(false);
|
||||
});
|
||||
TaxiPassengerModel.INSTANCE.cleanStation();
|
||||
return;
|
||||
if (TaxiPassengerOrderStatusEnum.ArriveAtEnd.code == order.orderStatus) {
|
||||
TaxiPassengerModel.recoverNaviInfo()
|
||||
mView!!.showOrHideOverMapViewFragment(false)
|
||||
clearAutopilotControlParameters()
|
||||
TaxiPassengerModel.startOrStopQueryOrderRemaining(false)
|
||||
runOnUIThread {
|
||||
mView!!.showOrHideArrivedEndLayout(true, order.endSiteAddr, order.orderNo)
|
||||
invokeOrderStatus(false)
|
||||
}
|
||||
TaxiPassengerModel.cleanStation()
|
||||
return
|
||||
}
|
||||
// 60 服务完成 页面
|
||||
if (TaxiPassengerOrderStatusEnum.JourneyCompleted.getCode() == order.orderStatus){
|
||||
AutopilotManager.INSTANCE.clearAutopilotControlParameters();
|
||||
TaxiPassengerModel.INSTANCE.startOrStopQueryOrderRemaining(false);
|
||||
mCurrentPassengerOrder = null;
|
||||
TaxiPassengerModel.INSTANCE.cleanStation();
|
||||
if (TaxiPassengerOrderStatusEnum.JourneyCompleted.code == order.orderStatus) {
|
||||
clearAutopilotControlParameters()
|
||||
TaxiPassengerModel.startOrStopQueryOrderRemaining(false)
|
||||
mCurrentPassengerOrder = null
|
||||
TaxiPassengerModel.cleanStation()
|
||||
}
|
||||
}
|
||||
|
||||
public void checkAndUpdateStatus(String phone){
|
||||
TaxiPassengerModel.INSTANCE.checkPhoneAndUpdateStatus(phone, new ITaxiPassengerCommonCallback() {
|
||||
@Override
|
||||
public void onCommonCallback() {
|
||||
mView.showOrHidePressengerCheckPager(false,"","","","","");
|
||||
}
|
||||
});
|
||||
fun checkAndUpdateStatus(phone: String?) {
|
||||
TaxiPassengerModel.checkPhoneAndUpdateStatus(phone) {
|
||||
mView!!.showOrHidePressengerCheckPager(
|
||||
false,
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
""
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 开启自动驾驶
|
||||
*/
|
||||
public void startAutopilot(){
|
||||
AutopilotManager.INSTANCE.startAutopilot();
|
||||
fun startAutopilot() {
|
||||
AutopilotManager.startAutopilot()
|
||||
}
|
||||
|
||||
}
|
||||
fun setItineraryVisibility() {
|
||||
UiThreadHandler.post {
|
||||
when (TaxiPassengerModel.curOrderStatus) {
|
||||
TaxiPassengerOrderStatusEnum.None -> mView?.showOrHideServingOrderFragment(false)
|
||||
TaxiPassengerOrderStatusEnum.OnTheWayToStart -> mView?.showOrHideServingOrderFragment(true)
|
||||
TaxiPassengerOrderStatusEnum.ArriveAtStart -> mView?.showOrHideServingOrderFragment(false)
|
||||
TaxiPassengerOrderStatusEnum.UserArriveAtStart -> mView?.showOrHideServingOrderFragment(true)
|
||||
TaxiPassengerOrderStatusEnum.OnTheWayToEnd -> mView?.showOrHideServingOrderFragment(true)
|
||||
TaxiPassengerOrderStatusEnum.ArriveAtEnd -> mView?.showOrHideServingOrderFragment(true)
|
||||
TaxiPassengerOrderStatusEnum.JourneyCompleted -> mView?.showOrHideServingOrderFragment(false)
|
||||
TaxiPassengerOrderStatusEnum.Cancel -> mView?.showOrHideServingOrderFragment(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val TAG = BaseTaxiPassengerPresenter::class.java.simpleName
|
||||
}
|
||||
}
|
||||
@@ -83,7 +83,7 @@ class TaxiPassengerBaseFragment() :
|
||||
BottomBar.SelectView.PRECISIONMAP -> {
|
||||
overMapView.visibility = View.GONE
|
||||
mapBizView.visibility = View.VISIBLE
|
||||
itinerary.visibility = View.VISIBLE
|
||||
presenter?.setItineraryVisibility()
|
||||
ck_setting.visibility = View.VISIBLE
|
||||
if (DeviceUtils.isLenovoModel() || DeviceUtils.isEB5Model()) {
|
||||
romaPView.visibility = View.VISIBLE
|
||||
@@ -97,7 +97,7 @@ class TaxiPassengerBaseFragment() :
|
||||
BottomBar.SelectView.OVERMAPVIEW -> {
|
||||
overMapView.visibility = View.VISIBLE
|
||||
mapBizView.visibility = View.GONE
|
||||
itinerary.visibility = View.VISIBLE
|
||||
presenter?.setItineraryVisibility()
|
||||
ck_setting.visibility = View.VISIBLE
|
||||
romaPView.visibility = View.GONE
|
||||
rv_location_center.visibility = View.VISIBLE
|
||||
@@ -107,7 +107,7 @@ class TaxiPassengerBaseFragment() :
|
||||
BottomBar.SelectView.VIDEO -> {
|
||||
overMapView.visibility = View.GONE
|
||||
mapBizView.visibility = View.GONE
|
||||
itinerary.visibility = View.GONE
|
||||
presenter?.setItineraryVisibility()
|
||||
ck_setting.visibility = View.GONE
|
||||
romaPView.visibility = View.GONE
|
||||
rv_location_center.visibility = View.GONE
|
||||
@@ -225,10 +225,23 @@ class TaxiPassengerBaseFragment() :
|
||||
* @param isShow
|
||||
*/
|
||||
fun showOrHideServingOrderFragment(isShow: Boolean) {
|
||||
if (isShow) {
|
||||
itinerary.visibility = View.VISIBLE
|
||||
} else {
|
||||
itinerary.visibility = View.GONE
|
||||
when (bottom.getCurrentPage()) {
|
||||
BottomBar.SelectView.OVERMAPVIEW,BottomBar.SelectView.PRECISIONMAP -> {
|
||||
if (isShow) {
|
||||
if(itinerary.visibility!=View.VISIBLE) {
|
||||
itinerary.visibility = View.VISIBLE
|
||||
}
|
||||
} else {
|
||||
if(itinerary.visibility!=View.GONE) {
|
||||
itinerary.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
BottomBar.SelectView.VIDEO,BottomBar.SelectView.NONE -> {
|
||||
if(itinerary.visibility!=View.GONE) {
|
||||
itinerary.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.mogo.och.taxi.passenger.ui.orderinfo
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.drawable.ClipDrawable
|
||||
import android.graphics.drawable.GradientDrawable
|
||||
import android.graphics.drawable.LayerDrawable
|
||||
import android.graphics.drawable.ScaleDrawable
|
||||
@@ -9,16 +8,11 @@ import android.os.Build
|
||||
import android.util.AttributeSet
|
||||
import android.view.Gravity
|
||||
import android.view.LayoutInflater
|
||||
import android.widget.ProgressBar
|
||||
import androidx.appcompat.widget.AppCompatTextView
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.findViewTreeViewModelStoreOwner
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.och.taxi.passenger.R
|
||||
import com.mogo.och.taxi.passenger.model.TaxiPassengerModel
|
||||
import kotlinx.android.synthetic.main.taxi_p_itinerary.view.actv_arrived_time
|
||||
import kotlinx.android.synthetic.main.taxi_p_itinerary.view.actv_distance
|
||||
import kotlinx.android.synthetic.main.taxi_p_itinerary.view.actv_distance_unit
|
||||
@@ -100,7 +94,7 @@ class ItineraryView : ConstraintLayout, OrderInfoViewModel.ItineraryViewCallback
|
||||
}
|
||||
|
||||
var prePercentage = 0f
|
||||
val needChangeStyleNumber = 0.98622
|
||||
val needChangeStyleNumber = 0.99
|
||||
|
||||
override fun setDistanceInfo(surplusdistance:String,distanceUnit:String,
|
||||
surplusTime:String,surplusTimeUnit:String,
|
||||
@@ -113,6 +107,11 @@ class ItineraryView : ConstraintLayout, OrderInfoViewModel.ItineraryViewCallback
|
||||
actv_arrived_time.text= arrivedTime
|
||||
|
||||
if(stationDistance>0&&alreadyGone<stationDistance){
|
||||
|
||||
if (progress_distance.max != stationDistance) {
|
||||
progress_distance.max = stationDistance
|
||||
}
|
||||
|
||||
val currentPercentage = alreadyGone.toFloat() / stationDistance
|
||||
if((prePercentage>needChangeStyleNumber) xor (currentPercentage>needChangeStyleNumber)){
|
||||
if(currentPercentage>needChangeStyleNumber){
|
||||
@@ -120,17 +119,15 @@ class ItineraryView : ConstraintLayout, OrderInfoViewModel.ItineraryViewCallback
|
||||
}else{
|
||||
setDrawable(true)
|
||||
}
|
||||
progress_distance.progress = alreadyGone
|
||||
}else{
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
progress_distance.setProgress(alreadyGone,true)
|
||||
}else{
|
||||
progress_distance.progress = alreadyGone
|
||||
}
|
||||
}
|
||||
prePercentage = currentPercentage
|
||||
|
||||
if (progress_distance.max != stationDistance) {
|
||||
progress_distance.max = stationDistance
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
progress_distance.setProgress(alreadyGone,true)
|
||||
}else{
|
||||
progress_distance.progress = alreadyGone
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -84,6 +84,7 @@
|
||||
<!-- 路程信息 -->
|
||||
<com.mogo.och.taxi.passenger.ui.orderinfo.ItineraryView
|
||||
android:id="@+id/itinerary"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@+id/bottom"
|
||||
android:layout_width="@dimen/dp_842"
|
||||
|
||||
Reference in New Issue
Block a user