[taxi-p]
[动画调整]
This commit is contained in:
yangyakun
2023-12-27 16:37:23 +08:00
parent 4069c077c4
commit d13c015a27
57 changed files with 92 additions and 668 deletions

View File

@@ -65,16 +65,22 @@ class BaseTaxiPassengerPresenter(view: TaxiPassengerBaseFragment?) :
order?.let {
setItineraryVisibility()
when (TaxiPassengerModel.curOrderStatus) {
TaxiPassengerOrderStatusEnum.OnTheWayToStart -> {
// 10 接驾中
mView?.showOrHideCheckAndStartAutopilotView(2)
mView?.showOrHideArrivedEndLayout(isShow = false)
overMapViewClear()
}
TaxiPassengerOrderStatusEnum.ArriveAtStart -> {
// 20 司机到达上车点
mView?.showOrHideArrivedEndLayout(isShow = false)
mView?.showOrHideCheckAndStartAutopilotView(0)
overMapViewClear()
}
TaxiPassengerOrderStatusEnum.UserArriveAtStart -> {
// 30 乘客到达上车点
mView?.showOrHideArrivedEndLayout(isShow = false)
mView?.showOrHideCheckAndStartAutopilotView(1)
overMapViewClear()
}
@@ -90,7 +96,6 @@ class BaseTaxiPassengerPresenter(view: TaxiPassengerBaseFragment?) :
TaxiPassengerOrderStatusEnum.ArriveAtEnd -> {
// 50 到达终点 乘客可以评价
mView?.showOrHideArrivedEndLayout(true)
mView?.showOrHideCheckAndStartAutopilotView(2)
overMapViewClear()
}
TaxiPassengerOrderStatusEnum.JourneyCompleted -> {

View File

@@ -291,8 +291,10 @@ class TaxiPassengerBaseFragment() :
VoiceNotice.showNotice("已到达目的地,带好随身物品,右侧下车更安全!期待下次再见", AIAssist.LEVEL2)
}
} else {
showOrHide(true,"隐藏到达目的地")
arrivedView.aniArrived(false)
if(arrivedView.visibility!=View.GONE) {
showOrHide(true, "隐藏到达目的地")
arrivedView.aniArrived(false)
}
}
}

View File

@@ -123,7 +123,7 @@ class ArrivedView : WindowRelativeLayout, ArrivedViewModel.ArrivedViewCallback {
visibility = View.GONE
}
ObjectAnimator.ofFloat(this@ArrivedView, "alpha", alphaStart, alphaEnd).apply {
duration = 2000
duration = 1000
addListener(object : AnimatorListenerAdapter(){
override fun onAnimationEnd(animation: Animator) {
d(TAG,"onAnimationEndcarrivedView")

View File

@@ -1,250 +0,0 @@
package com.mogo.och.taxi.passenger.ui.check
import android.content.Context
import android.graphics.Typeface
import android.text.Spannable
import android.text.SpannableStringBuilder
import android.text.style.TextAppearanceSpan
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import android.widget.RelativeLayout
import android.widget.TextView
import com.mogo.commons.voice.AIAssist
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
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.ToastUtils
import com.mogo.och.common.module.utils.FrameAnimatorContainer
import com.mogo.och.common.module.voice.VoiceNotice
import com.mogo.och.taxi.passenger.R
import com.mogo.och.taxi.passenger.callback.ITaxiPassengerCommonValueCallback
import com.mogo.och.taxi.passenger.ui.arrived.ArrivedView
import kotlinx.android.synthetic.main.taxi_p_passenger_check_panel.view.iv_zhi_normal
import kotlinx.android.synthetic.main.taxi_p_passenger_check_panel.view.tv_passenger_count
import kotlinx.android.synthetic.main.taxi_p_passenger_check_panel.view.tv_passenger_end
import kotlinx.android.synthetic.main.taxi_p_passenger_check_panel.view.tv_passenger_start
import kotlinx.android.synthetic.main.taxi_p_passenger_check_panel.view.tv_taxi_passenger_number_back
import kotlinx.android.synthetic.main.taxi_p_passenger_check_panel.view.tv_taxi_passenger_number_eight
import kotlinx.android.synthetic.main.taxi_p_passenger_check_panel.view.tv_taxi_passenger_number_first
import kotlinx.android.synthetic.main.taxi_p_passenger_check_panel.view.tv_taxi_passenger_number_five
import kotlinx.android.synthetic.main.taxi_p_passenger_check_panel.view.tv_taxi_passenger_number_four
import kotlinx.android.synthetic.main.taxi_p_passenger_check_panel.view.tv_taxi_passenger_number_fourth
import kotlinx.android.synthetic.main.taxi_p_passenger_check_panel.view.tv_taxi_passenger_number_nine
import kotlinx.android.synthetic.main.taxi_p_passenger_check_panel.view.tv_taxi_passenger_number_one
import kotlinx.android.synthetic.main.taxi_p_passenger_check_panel.view.tv_taxi_passenger_number_second
import kotlinx.android.synthetic.main.taxi_p_passenger_check_panel.view.tv_taxi_passenger_number_seven
import kotlinx.android.synthetic.main.taxi_p_passenger_check_panel.view.tv_taxi_passenger_number_six
import kotlinx.android.synthetic.main.taxi_p_passenger_check_panel.view.tv_taxi_passenger_number_submit
import kotlinx.android.synthetic.main.taxi_p_passenger_check_panel.view.tv_taxi_passenger_number_third
import kotlinx.android.synthetic.main.taxi_p_passenger_check_panel.view.tv_taxi_passenger_number_three
import kotlinx.android.synthetic.main.taxi_p_passenger_check_panel.view.tv_taxi_passenger_number_two
import kotlinx.android.synthetic.main.taxi_p_passenger_check_panel.view.tv_taxi_passenger_number_zero
/**
* V2X预警事件view通过FloatWindow呈现无需加入到自定义layout中
*
* Created on 2022/3/16
*/
class TaxiPassengerCheckView :RelativeLayout, View.OnClickListener {
constructor(context: Context?) : super(context)
constructor(context: Context?, attributeSet: AttributeSet) : super(context, attributeSet)
constructor(context: Context?, attributeSet: AttributeSet, defStyleAttr: Int) : super(context, attributeSet, defStyleAttr)
constructor(context: Context?, attributeSet: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attributeSet, defStyleAttr, defStyleRes)
var iTaxiPassengerCommonValueCallback: ITaxiPassengerCommonValueCallback<String>?=null
private var index = 0
private var phone = ""
private val numSelect = arrayOfNulls<Int>(4)
private val numSelectTextView = arrayOfNulls<TextView>(4)
private var taxiPxiaozhiCheck: FrameAnimatorContainer?=null
private fun initView(context: Context) {
d(SceneConstant.M_TAXI_P + TAG, "initView")
LayoutInflater.from(context).inflate(R.layout.taxi_p_passenger_check_panel, this, true)
keyBoardLogic()
numSelectTextView[0] = tv_taxi_passenger_number_first
numSelectTextView[1] = tv_taxi_passenger_number_second
numSelectTextView[2] = tv_taxi_passenger_number_third
numSelectTextView[3] = tv_taxi_passenger_number_fourth
taxiPxiaozhiCheck = FrameAnimatorContainer(R.array.xiaozhi_normal, 12,iv_zhi_normal)
taxiPxiaozhiCheck?.setOnAnimStopListener(object : FrameAnimatorContainer.OnAnimationStoppedListener{
override fun AnimationStopped() {
CallerLogger.d(SceneConstant.M_TAXI_P + ArrivedView.TAG, "动画暂停")
}
})
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
taxiPxiaozhiCheck?.start()
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
taxiPxiaozhiCheck?.stop()
}
private fun keyBoardLogic() {
tv_taxi_passenger_number_one.setOnClickListener(this)
tv_taxi_passenger_number_two.setOnClickListener(this)
tv_taxi_passenger_number_three.setOnClickListener(this)
tv_taxi_passenger_number_four.setOnClickListener(this)
tv_taxi_passenger_number_five.setOnClickListener(this)
tv_taxi_passenger_number_six.setOnClickListener(this)
tv_taxi_passenger_number_seven.setOnClickListener(this)
tv_taxi_passenger_number_eight.setOnClickListener(this)
tv_taxi_passenger_number_nine.setOnClickListener(this)
tv_taxi_passenger_number_zero.setOnClickListener(this)
tv_taxi_passenger_number_back.setOnClickListener(this)
tv_taxi_passenger_number_submit.setOnClickListener(this)
tv_taxi_passenger_number_first.setOnClickListener(this)
tv_taxi_passenger_number_second.setOnClickListener(this)
tv_taxi_passenger_number_third.setOnClickListener(this)
tv_taxi_passenger_number_fourth.setOnClickListener(this)
}
override fun onClick(v: View?) {
when (v?.id) {
R.id.tv_taxi_passenger_number_one -> {showNumver(1)}
R.id.tv_taxi_passenger_number_two -> {showNumver(2)}
R.id.tv_taxi_passenger_number_three-> {showNumver(3)}
R.id.tv_taxi_passenger_number_four-> {showNumver(4)}
R.id.tv_taxi_passenger_number_five -> {showNumver(5)}
R.id.tv_taxi_passenger_number_six -> {showNumver(6)}
R.id.tv_taxi_passenger_number_seven -> {showNumver(7)}
R.id.tv_taxi_passenger_number_eight -> {showNumver(8)}
R.id.tv_taxi_passenger_number_nine -> {showNumver(9)}
R.id.tv_taxi_passenger_number_zero -> {showNumver(0)}
R.id.tv_taxi_passenger_number_back -> {deleteNumver()}
R.id.tv_taxi_passenger_number_first -> {selectIndex(0)}
R.id.tv_taxi_passenger_number_second -> {selectIndex(1)}
R.id.tv_taxi_passenger_number_third -> {selectIndex(2)}
R.id.tv_taxi_passenger_number_fourth -> {selectIndex(3)}
R.id.tv_taxi_passenger_number_submit -> {clearNumber()}
else -> {}
}
}
private fun checkAndCommit() {
val numberStr = "${numSelect[0]}${numSelect[1]}${numSelect[2]}${numSelect[3]}"
if(!phone.endsWith(numberStr)){
ToastUtils.showLong("请输入正确的手机尾号")
VoiceNotice.showNotice("验证失败!再检查一下吧~", AIAssist.LEVEL2)
return
}
iTaxiPassengerCommonValueCallback?.onCommonCallback(numberStr)
}
private fun selectIndex(i: Int) {
index = i
changeStyle()
}
private fun showNumver(number: Int) {
if (index in 0..3) {
numSelect[index] = number
numSelectTextView[index]!!.text = number.toString()
if(index!=3){
index++
}
changeStyle()
numSelect.forEach {
if(it==null){
return
}
}
checkAndCommit()
}
}
private fun clearNumber(){
for(i in numSelect.indices){
numSelect[i] = null
}
numSelectTextView.forEach {
it?.text = ""
}
index = 0
changeStyle()
}
private fun deleteNumver() {
if (index in 0..3) {
if(numSelect[index]==null){
if(index!=0){
index--
}
changeStyle()
//return
}
numSelect[index] = null
numSelectTextView[index]!!.text = ""
}
}
private fun changeStyle() {
numSelectTextView.forEachIndexed { indexIn, textView ->
if(indexIn==index){
numSelectTextView[index]!!.setBackgroundResource(R.drawable.bg_taxi_p_checked_input_background)
numSelectTextView[index]!!.setTextColor(resources.getColor(android.R.color.white))
numSelectTextView[index]!!.setShadowLayer(0f,0f,0f,
resources.getColor(android.R.color.white))
}else{
numSelectTextView[indexIn]!!.setBackgroundResource(R.drawable.taxi_p_check_input_background)
numSelectTextView[indexIn]!!.setTextColor(resources.getColor(R.color.taxi_p_FF282F62))
numSelectTextView[indexIn]!!.setShadowLayer(20f,0f,2f,
resources.getColor(android.R.color.white))
}
}
}
fun setData(
startSiteAddr: String?,
endSiteAddr: String?,
passengerNum: String?,
carNumber: String?,
phone: String?
) {
this.phone = phone?:""
val sb = SpannableStringBuilder("乘客数:$passengerNum") // 包装字体内容
sb.setSpan(
TextAppearanceSpan("default",
Typeface.NORMAL,100,
resources.getColorStateList(R.color.taxi_p_FFFFC836) ,null ),
4, 5, Spannable.SPAN_INCLUSIVE_INCLUSIVE)
tv_passenger_count.text = sb
tv_passenger_start.text = "起 点 : $startSiteAddr"
tv_passenger_end.text = "终 点 : $endSiteAddr"
for(i in numSelect.indices){
numSelect[i] = null
}
numSelectTextView.forEach {
it?.text = ""
}
}
companion object {
const val TAG = "TaxiPassengerCheckView"
}
init {
try {
initView(context)
} catch (e: Exception) {
e.printStackTrace()
}
}
}

View File

@@ -135,7 +135,7 @@ class ChekAndStartAutopilotView : WindowRelativeLayout,
startAutopilotView.visibility = View.GONE
startAutopilotClose.visibility = View.GONE
ObjectAnimator.ofFloat(this@ChekAndStartAutopilotView, "alpha", alphaStart, alphaEnd).apply {
duration = 3000
duration = 1000
}.start()
}
1 -> {

View File

@@ -14,6 +14,7 @@ import com.mogo.och.common.module.manager.devicemanage.data.DoorState
import com.mogo.och.common.module.utils.FrameAnimatorContainer
import com.mogo.och.taxi.passenger.R
import com.mogo.och.taxi.passenger.widget.WindowRelativeLayout
import kotlinx.android.synthetic.main.taxt_p_start_autopilot_view.view.aciv_middle_car
import kotlinx.android.synthetic.main.taxt_p_start_autopilot_view.view.actv_front_left_door
import kotlinx.android.synthetic.main.taxt_p_start_autopilot_view.view.actv_front_right_door
import kotlinx.android.synthetic.main.taxt_p_start_autopilot_view.view.actv_orderinfo
@@ -57,7 +58,7 @@ class StartAutopilotView : WindowRelativeLayout, StartAutopilotViewModel.StartAu
private fun initView() {
LayoutInflater.from(context).inflate(R.layout.taxt_p_start_autopilot_view, this, true)
taxiPStartAutopilotCar = FrameAnimatorContainer(
R.array.taxi_p_start_autopilot_car, 20, taxi_p_autopilot_starting
R.array.taxi_p_start_autopilot_car, 20, taxi_p_autopilot_starting, initFirstFrame = false
)
taxiPStartAutopilotCar?.setOnAnimStopListener(object :
FrameAnimatorContainer.OnAnimationStoppedListener {
@@ -133,6 +134,7 @@ class StartAutopilotView : WindowRelativeLayout, StartAutopilotViewModel.StartAu
if(isVisible){
taxi_p_start_autopilot.background = null
taxi_p_start_autopilot.text = resources.getString(R.string.taxi_p_start_autopilot_txt)
taxi_p_autopilot_starting.setImageResource(R.drawable.light_00018)
}else{
unableStartAutopilot()
goneAllDoorState()
@@ -143,12 +145,14 @@ class StartAutopilotView : WindowRelativeLayout, StartAutopilotViewModel.StartAu
private fun resetView() {
taxi_p_autopilot_starting.visibility = View.GONE
aciv_middle_car.visibility = View.GONE
taxi_p_autopilot_btn_bg.visibility = View.GONE
taxi_p_start_autopilot.visibility = View.GONE
}
fun showStartAutopilot(){
taxi_p_autopilot_starting.visibility = View.VISIBLE
aciv_middle_car.visibility = View.VISIBLE
taxi_p_autopilot_btn_bg.visibility = View.VISIBLE
taxi_p_start_autopilot.visibility = View.VISIBLE
taxiPStartAutopilot?.reStart()

View File

@@ -1,283 +0,0 @@
package com.mogo.och.taxi.passenger.ui.startautopilot
import android.annotation.SuppressLint
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import androidx.core.content.ContextCompat
import androidx.core.content.res.ResourcesCompat
import androidx.lifecycle.ViewModelProvider
import com.elegant.utils.UiThreadHandler
import com.mogo.eagle.core.data.config.HdMapBuildConfig
import com.mogo.eagle.core.utilcode.kotlin.onClick
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.core.utilcode.util.OverlayViewUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.och.common.module.manager.devicemanage.data.DoorPosition
import com.mogo.och.common.module.manager.devicemanage.data.DoorState
import com.mogo.och.common.module.utils.FrameAnimatorContainer
import com.mogo.och.taxi.passenger.R
import com.mogo.och.taxi.passenger.widget.WindowRelativeLayout
import kotlinx.android.synthetic.main.taxi_p_start_autopilot_view.view.actv_front_left_door
import kotlinx.android.synthetic.main.taxi_p_start_autopilot_view.view.actv_front_right_door
import kotlinx.android.synthetic.main.taxi_p_start_autopilot_view.view.actv_orderinfo
import kotlinx.android.synthetic.main.taxi_p_start_autopilot_view.view.actv_rear_left_door
import kotlinx.android.synthetic.main.taxi_p_start_autopilot_view.view.actv_rear_right_door
import kotlinx.android.synthetic.main.taxi_p_start_autopilot_view.view.iv_xiaozhi_belt
import kotlinx.android.synthetic.main.taxi_p_start_autopilot_view.view.starting_autopilot_view_close
import kotlinx.android.synthetic.main.taxi_p_start_autopilot_view.view.taxi_p_autopilot_btn_bg
import kotlinx.android.synthetic.main.taxi_p_start_autopilot_view.view.taxi_p_autopilot_starting
import kotlinx.android.synthetic.main.taxi_p_start_autopilot_view.view.taxi_p_start_autopilot
import kotlinx.android.synthetic.main.taxi_p_start_autopilot_view.view.cl_car_type
/**
* @author: wangmingjun
* @date: 2022/6/14
*/
class StartAutopilotView : WindowRelativeLayout, StartAutopilotViewModel.StartAutopilotCallback {
constructor(context: Context) : super(context)
constructor(context: Context, attributeSet: AttributeSet) : super(context, attributeSet)
constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int) : super(
context,
attributeSet,
defStyleAttr
)
constructor(
context: Context,
attributeSet: AttributeSet,
defStyleAttr: Int,
defStyleRes: Int
) : super(context, attributeSet, defStyleAttr, defStyleRes)
companion object {
private val TAG = StartAutopilotView::class.java.simpleName
private const val TIMER_START_AUTOPILOT_INTERVAL = 20 * 1000L
}
var isStarting = false
private var taxiPStartAutopilot: FrameAnimatorContainer? = null
private var taxiPStartAutopilotCar: FrameAnimatorContainer? = null
private var taxiPXiaozhiBelt: FrameAnimatorContainer? = null
init {
initView()
}
private fun initView() {
LayoutInflater.from(context).inflate(R.layout.taxi_p_start_autopilot_view, this, true)
taxiPStartAutopilotCar = FrameAnimatorContainer(
R.array.taxi_p_start_autopilot_car,
20,
taxi_p_autopilot_starting
)
taxiPStartAutopilotCar?.setOnAnimStopListener(object :
FrameAnimatorContainer.OnAnimationStoppedListener {
override fun AnimationStopped() {
CallerLogger.d(SceneConstant.M_TAXI_P + TAG, "动画暂停")
}
})
taxiPStartAutopilot =
FrameAnimatorContainer(R.array.taxi_p_start_autopilot, 15, taxi_p_autopilot_btn_bg,false)
taxiPStartAutopilot?.setOnAnimStopListener(object :
FrameAnimatorContainer.OnAnimationStoppedListener {
override fun AnimationStopped() {
CallerLogger.d(SceneConstant.M_TAXI_P + TAG, "动画暂停")
}
})
taxiPXiaozhiBelt = FrameAnimatorContainer(R.array.xiaozhi_belt, 24, iv_xiaozhi_belt)
taxiPXiaozhiBelt?.setOnAnimStopListener(object :
FrameAnimatorContainer.OnAnimationStoppedListener {
override fun AnimationStopped() {
CallerLogger.d(SceneConstant.M_TAXI_P + TAG, "动画暂停")
}
})
}
private fun startAutopilotBgAnimatorDrawable(isStart: Boolean) {
if (isStart) {
taxiPStartAutopilot?.start()
} else {
taxiPStartAutopilot?.stop()
}
}
@SuppressLint("UseCompatLoadingForDrawables")
override fun handleStartAutopilotBtnStatus(isClickable: Boolean) {
taxi_p_autopilot_starting?.setImageResource(R.drawable.light_00003)
updateStartAutopilotBtnStatus(isClickable)
if (isClickable) { //高亮可点击状态下动画一直进行
startAutopilotBgAnimatorDrawable(true)
} else { // 置灰色可点击状态下动画停止
startAutopilotBgAnimatorDrawable(false)
}
}
override fun setOrderInfo(show: String) {
actv_orderinfo.text = show
}
override fun setDoorStatus(doorPosition: DoorPosition, state: DoorState) {
when (doorPosition) {
DoorPosition.FRONT_LEFT -> {
if (state == DoorState.OPEN) {
actv_front_left_door.visibility = VISIBLE
} else {
actv_front_left_door.visibility = GONE
}
}
DoorPosition.FRONT_RIGHT -> {
if (state == DoorState.OPEN) {
actv_front_right_door.visibility = VISIBLE
} else {
actv_front_right_door.visibility = GONE
}
}
DoorPosition.REAR_LEFT -> {
if (state == DoorState.OPEN) {
actv_rear_left_door.visibility = VISIBLE
} else {
actv_rear_left_door.visibility = GONE
}
}
DoorPosition.REAR_RIGHT -> {
if (state == DoorState.OPEN) {
actv_rear_right_door.visibility = VISIBLE
} else {
actv_rear_right_door.visibility = GONE
}
}
else -> {
}
}
}
fun closeAllAnimsAndView() {
isStarting = false
clearStartingAnimFrame()
clearBgAnimDrawable()
OverlayViewUtils.dismissOverlayView(this)
}
private fun updateStartAutopilotBtnStatus(isBoarded: Boolean) {
taxi_p_start_autopilot?.let {
if (isBoarded) {
it.setTextColor(
ContextCompat.getColor(context, android.R.color.white)
)
it.background = null
} else {
it.background =
ContextCompat.getDrawable(context, R.drawable.taxi_p_start_autopilot_txt_btn_bg)
taxi_p_autopilot_btn_bg!!.background = null
it.setTextColor(
ContextCompat.getColor(context, R.color.taxi_p_4dffffff)
)
}
it.tag = isBoarded
it.text = resources.getString(R.string.taxi_p_start_autopilot_txt)
}
}
private fun startingCarBgAnimatorDrawable(isStart: Boolean) {
if (isStart) {
taxi_p_autopilot_starting!!.setImageResource(0)
taxiPStartAutopilotCar?.start()
} else {
taxiPStartAutopilotCar?.stop()
taxi_p_autopilot_starting!!.setImageResource(R.drawable.light_00003)
}
}
private fun startOrStopLoadingAnim(start: Boolean) {
startingCarBgAnimatorDrawable(start)
if (start) {
isStarting = true
taxi_p_start_autopilot?.text = resources.getString(R.string.taxi_p_start_autopilot_loading)
taxi_p_start_autopilot?.setTextColor(
ContextCompat.getColor(context, android.R.color.white)
)
startingAutopilotCountDown()
} else {
clearBgAnimDrawable()
isStarting = false
handleStartAutopilotBtnStatus(true)
}
}
private fun clearBgAnimDrawable() {
taxiPStartAutopilot?.stop()
}
fun clearStartingAnimFrame() {
taxiPStartAutopilotCar?.stop()
}
private fun startingAutopilotCountDown() {
UiThreadHandler.postDelayed({
//未启动成功20s后做处理
if (isStarting) { //判断动画是否在进行
ToastUtils.showLong(R.string.taxi_p_start_autopilot_fail_10s_tip)
updateStatusCountDownOver()
}
}, TIMER_START_AUTOPILOT_INTERVAL)
}
private fun updateStatusCountDownOver() {
isStarting = false
startingCarBgAnimatorDrawable(false)
taxi_p_start_autopilot?.text = resources.getString(R.string.taxi_p_start_autopilot_txt)
}
override fun onVisibilityChanged(changedView: View, visibility: Int) {
super.onVisibilityChanged(changedView, visibility)
if (HdMapBuildConfig.currentCarVrIconRes == R.raw.hq_h9) {
cl_car_type.setBackgroundResource(R.drawable.taxi_p_start_panel__hq_bg)
} else {
cl_car_type.setBackgroundResource(R.drawable.taxi_p_start_panel__df_bg)
}
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
val viewModel = ViewModelProvider(this).get(StartAutopilotViewModel::class.java)
viewModel.setStartAutopilotCallback(this)
taxi_p_start_autopilot.onClick {
//开启动画和自动驾驶
if (!(taxi_p_start_autopilot!!.tag as Boolean)) {
ToastUtils.showLong(R.string.taxi_p_start_autopilot_un_click_tip)
return@onClick
}
if (!isStarting) {
startOrStopLoadingAnim(true)
viewModel.startAutopilot()
}
}
starting_autopilot_view_close.onClick {
closeAllAnimsAndView()
}
taxiPXiaozhiBelt?.start()
}
override fun onDetachedFromWindow() {
isStarting = false
clearStartingAnimFrame()
clearBgAnimDrawable()
taxiPXiaozhiBelt?.stop()
super.onDetachedFromWindow()
}
}

View File

@@ -1,90 +0,0 @@
package com.mogo.och.taxi.passenger.ui.startautopilot
import androidx.lifecycle.ViewModel
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
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.devicemanage.data.DoorPosition
import com.mogo.och.taxi.passenger.callback.IOCHTaxiPassengerOrderStatusCallback
import com.mogo.och.taxi.passenger.model.AutopilotManager
import com.mogo.och.taxi.passenger.model.TaxiPassengerModel
import com.mogo.och.common.module.manager.devicemanage.TaxiDoorStateManager
import com.mogo.och.common.module.manager.devicemanage.callback.DoorStateCallback
import com.mogo.och.common.module.manager.devicemanage.data.DoorState
class StartAutopilotViewModel : ViewModel(), IOCHTaxiPassengerOrderStatusCallback,
DoorStateCallback {
private val TAG = StartAutopilotViewModel::class.java.simpleName
private var viewCallback: StartAutopilotCallback? = null
init {
TaxiPassengerModel.setOrderStatusCallback(TAG, this)
TaxiDoorStateManager.addListener(TAG,this)
}
fun setStartAutopilotCallback(viewCallback: StartAutopilotCallback) {
this.viewCallback = viewCallback
TaxiPassengerModel.startOrStopReadyToAutopilotLoop(true)
setOrderInfo()
}
private fun setOrderInfo() {
val currentOCHOrder = TaxiPassengerModel.currentOCHOrder
currentOCHOrder?.let {
val phone = it.passengerPhone
val show = if (phone.length > 8) {
//截取电话号码前三位
val phoneNumPre = phone.substring(0, 3)
//截取电话号码后四位
val phoneNumFix = phone.substring(7)
"用户:$phoneNumPre****$phoneNumFix 目的地:${it.endSiteAddr}"
} else {
"用户:${phone} 目的地:${it.endSiteAddr}"
}
viewCallback?.setOrderInfo(show)
}
}
override fun onCleared() {
super.onCleared()
this.viewCallback = null
TaxiPassengerModel.setOrderStatusCallback(TAG, null)
TaxiDoorStateManager.removeListener(TAG)
}
override fun onDriverHasCheckedPilotCondition(isBoarded: Boolean) {
viewCallback?.handleStartAutopilotBtnStatus(isBoarded)
}
/**
* 开启自动驾驶
*/
fun startAutopilot() {
AutopilotManager.startAutopilot()
}
override fun hasOpenDoor(have: Boolean) {
CallerLogger.d(SceneConstant.M_TAXI_P + TAG, "车门是否开着:${have}")
}
override fun doorStateChangeCallback(position: DoorPosition, state: DoorState) {
CallerLogger.d(SceneConstant.M_TAXI_P + TAG, "门太变化:${position}--${state}")
runMain(position,state)
}
private fun runMain(posttion:DoorPosition,state: DoorState){
UiThreadHandler.post({
viewCallback?.setDoorStatus(posttion,state)
},UiThreadHandler.MODE.QUEUE)
}
interface StartAutopilotCallback {
fun handleStartAutopilotBtnStatus(isBoarded: Boolean)
fun setOrderInfo(show: String)
fun setDoorStatus(doorPosition: DoorPosition, state: DoorState)
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 73 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -9,11 +9,12 @@
<ImageView
android:id="@+id/taxi_p_autopilot_starting"
android:layout_width="@dimen/dp_1600"
android:layout_height="1200dp"
android:layout_marginTop="@dimen/dp_150"
android:layout_width="@dimen/dp_900"
android:layout_height="@dimen/dp_408"
android:layout_marginTop="@dimen/dp_610"
android:layout_gravity="center_horizontal"
android:src="@drawable/light_00003"
android:src="@drawable/light_00018"
android:scaleType="fitXY"
android:visibility="gone"
tools:visibility="visible"
app:layout_constraintLeft_toLeftOf="parent"
@@ -21,6 +22,22 @@
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/aciv_middle_car"
android:src="@drawable/taxi_p_startautopilt_car_top"
android:visibility="gone"
tools:visibility="visible"
android:layout_width="@dimen/dp_301"
android:layout_height="@dimen/dp_288"
android:layout_marginEnd="@dimen/dp_13"
android:layout_marginBottom="@dimen/dp_100"
app:layout_constraintTop_toTopOf="@+id/taxi_p_autopilot_starting"
app:layout_constraintBottom_toBottomOf="@+id/taxi_p_autopilot_starting"
app:layout_constraintStart_toStartOf="@+id/taxi_p_autopilot_starting"
app:layout_constraintEnd_toEndOf="@+id/taxi_p_autopilot_starting"
/>
<ImageView
android:id="@+id/taxi_p_autopilot_btn_bg"
android:layout_width="1000dp"
@@ -52,13 +69,6 @@
app:layout_constraintLeft_toLeftOf="@+id/taxi_p_autopilot_btn_bg"
app:layout_constraintRight_toRightOf="@+id/taxi_p_autopilot_btn_bg" />
<View
app:layout_constraintBottom_toBottomOf="parent"
android:background="@drawable/taxi_p_start_autopilot_bottom_bg"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_250"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actv_orderinfo"
app:layout_constraintBottom_toBottomOf="parent"
@@ -81,7 +91,7 @@
<androidx.constraintlayout.widget.Guideline
android:id="@+id/gl_horizontal_center"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.5"
app:layout_constraintGuide_percent="0.58"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
@@ -90,6 +100,7 @@
android:id="@+id/actv_front_right_door"
android:gravity="center"
android:visibility="gone"
tools:visibility="visible"
app:layout_constraintTop_toTopOf="@+id/gl_horizontal_center"
app:layout_constraintBottom_toBottomOf="@+id/gl_horizontal_center"
app:layout_constraintStart_toStartOf="@+id/gl_vertical_center"
@@ -105,6 +116,7 @@
android:id="@+id/actv_front_left_door"
android:gravity="center"
android:visibility="gone"
tools:visibility="visible"
app:layout_constraintTop_toTopOf="@+id/gl_horizontal_center"
app:layout_constraintBottom_toBottomOf="@+id/gl_horizontal_center"
app:layout_constraintEnd_toStartOf="@+id/gl_vertical_center"
@@ -121,6 +133,7 @@
android:id="@+id/actv_rear_left_door"
android:gravity="center"
android:visibility="gone"
tools:visibility="visible"
app:layout_constraintEnd_toStartOf="@+id/gl_vertical_center"
app:layout_constraintTop_toBottomOf="@+id/gl_horizontal_center"
android:layout_marginEnd="@dimen/dp_135"
@@ -136,6 +149,7 @@
android:id="@+id/actv_rear_right_door"
android:gravity="center"
android:visibility="gone"
tools:visibility="visible"
app:layout_constraintStart_toEndOf="@+id/gl_vertical_center"
app:layout_constraintTop_toBottomOf="@+id/gl_horizontal_center"
android:layout_marginStart="@dimen/dp_135"

View File

@@ -54,6 +54,10 @@
<item>@drawable/light_00011</item>
<item>@drawable/light_00012</item>
<item>@drawable/light_00013</item>
<item>@drawable/light_00014</item>
<item>@drawable/light_00015</item>
<item>@drawable/light_00016</item>
<item>@drawable/light_00017</item>
</string-array>
<string-array name="xiaozhi_love">

View File

@@ -71,16 +71,12 @@ class BaseTaxiPassengerPresenter(view: TaxiPassengerBaseFragment?) :
TaxiPassengerOrderStatusEnum.ArriveAtStart -> {
// 20 司机到达上车点
mView?.showOrHideArrivedEndLayout(isShow = false)
mView?.showOrHideCheckAndStartAutopilotView(0)
overMapViewClear()
}
TaxiPassengerOrderStatusEnum.UserArriveAtStart -> {
// 30 乘客到达上车点
mView?.showOrHideArrivedEndLayout(isShow = false)
mView?.showOrHideCheckAndStartAutopilotView(1)
overMapViewClear()
}
@@ -97,8 +93,6 @@ class BaseTaxiPassengerPresenter(view: TaxiPassengerBaseFragment?) :
TaxiPassengerOrderStatusEnum.ArriveAtEnd -> {
// 50 到达终点 乘客可以评价
mView?.showOrHideArrivedEndLayout(true)
mView?.showOrHideCheckAndStartAutopilotView(2)
overMapViewClear()
}

View File

@@ -287,8 +287,10 @@ class TaxiPassengerBaseFragment() :
VoiceNotice.showNotice("已到达目的地,带好随身物品,右侧下车更安全!期待下次再见", AIAssist.LEVEL2)
}
} else {
showOrHide(true)
arrivedView.aniArrived(false)
if(arrivedView.visibility!=View.GONE) {
showOrHide(true)
arrivedView.aniArrived(false)
}
}
}

View File

@@ -128,7 +128,7 @@ class ArrivedView : WindowRelativeLayout, ArrivedViewModel.ArrivedViewCallback {
visibility = View.GONE
}
ObjectAnimator.ofFloat(this@ArrivedView, "alpha", alphaStart, alphaEnd).apply {
duration = 2000
duration = 1000
addListener(object :AnimatorListenerAdapter(){
override fun onAnimationEnd(animation: Animator) {
CallerLogger.d(TaxiPassengerBaseFragment.TAG,"onAnimationEndcarrivedView")

View File

@@ -139,7 +139,7 @@ class ChekAndStartAutopilotView : WindowRelativeLayout,
startAutopilotView.visibility = View.GONE
startAutopilotClose.visibility = View.GONE
ObjectAnimator.ofFloat(this@ChekAndStartAutopilotView, "alpha", alphaStart, alphaEnd).apply {
duration = 3000
duration = 1000
}.start()
}
1 -> {

View File

@@ -14,6 +14,7 @@ import com.mogo.och.common.module.manager.devicemanage.data.DoorState
import com.mogo.och.common.module.utils.FrameAnimatorContainer
import com.mogo.och.taxi.passenger.R
import com.mogo.och.taxi.passenger.widget.WindowRelativeLayout
import kotlinx.android.synthetic.main.taxt_u_p_start_autopilot_view.view.aciv_middle_car
import kotlinx.android.synthetic.main.taxt_u_p_start_autopilot_view.view.actv_front_left_door
import kotlinx.android.synthetic.main.taxt_u_p_start_autopilot_view.view.actv_front_right_door
import kotlinx.android.synthetic.main.taxt_u_p_start_autopilot_view.view.actv_orderinfo
@@ -133,6 +134,7 @@ class StartAutopilotView : WindowRelativeLayout, StartAutopilotViewModel.StartAu
if(isVisible){
taxi_p_start_autopilot.background = null
taxi_p_start_autopilot.text = resources.getString(R.string.taxi_p_start_autopilot_txt)
taxi_p_autopilot_starting.setImageResource(R.drawable.light_00018)
}else{
unableStartAutopilot()
goneAllDoorState()
@@ -143,12 +145,14 @@ class StartAutopilotView : WindowRelativeLayout, StartAutopilotViewModel.StartAu
private fun resetView() {
taxi_p_autopilot_starting.visibility = View.GONE
aciv_middle_car.visibility = View.GONE
taxi_p_autopilot_btn_bg.visibility = View.GONE
taxi_p_start_autopilot.visibility = View.GONE
}
fun showStartAutopilot(){
taxi_p_autopilot_starting.visibility = View.VISIBLE
aciv_middle_car.visibility = View.VISIBLE
taxi_p_autopilot_btn_bg.visibility = View.VISIBLE
taxi_p_start_autopilot.visibility = View.VISIBLE
taxiPStartAutopilot?.reStart()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 73 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -9,11 +9,12 @@
<ImageView
android:id="@+id/taxi_p_autopilot_starting"
android:layout_width="@dimen/dp_1600"
android:layout_height="1200dp"
android:layout_marginTop="@dimen/dp_150"
android:layout_width="@dimen/dp_900"
android:layout_height="@dimen/dp_408"
android:layout_marginTop="@dimen/dp_610"
android:layout_gravity="center_horizontal"
android:src="@drawable/light_00003"
android:src="@drawable/light_00018"
android:scaleType="fitXY"
android:visibility="gone"
tools:visibility="visible"
app:layout_constraintLeft_toLeftOf="parent"
@@ -21,6 +22,22 @@
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/aciv_middle_car"
android:src="@drawable/taxi_p_startautopilt_car_top"
android:visibility="gone"
tools:visibility="visible"
android:layout_width="@dimen/dp_301"
android:layout_height="@dimen/dp_288"
android:layout_marginEnd="@dimen/dp_13"
android:layout_marginBottom="@dimen/dp_100"
app:layout_constraintTop_toTopOf="@+id/taxi_p_autopilot_starting"
app:layout_constraintBottom_toBottomOf="@+id/taxi_p_autopilot_starting"
app:layout_constraintStart_toStartOf="@+id/taxi_p_autopilot_starting"
app:layout_constraintEnd_toEndOf="@+id/taxi_p_autopilot_starting"
/>
<ImageView
android:id="@+id/taxi_p_autopilot_btn_bg"
android:layout_width="1000dp"
@@ -38,13 +55,13 @@
android:id="@+id/taxi_p_start_autopilot"
android:visibility="gone"
tools:visibility="visible"
android:layout_width="@dimen/taxi_p_start_autopilot_btn_width"
android:layout_width="@dimen/dp_520"
android:layout_height="@dimen/dp_152"
android:gravity="center"
android:layout_marginBottom="@dimen/dp_175"
android:text="@string/taxi_p_start_autopilot_txt"
android:textColor="@color/taxi_p_start_autopilot_txt_color"
android:textSize="@dimen/taxi_p_start_autopilot_txt_size"
android:textColor="@android:color/white"
android:textSize="@dimen/dp_52"
android:textStyle="bold"
android:layout_marginStart="@dimen/dp_15"
android:background="@drawable/taxt_u_p_start_autopilot_txt_btn_bg"
@@ -52,13 +69,6 @@
app:layout_constraintLeft_toLeftOf="@+id/taxi_p_autopilot_btn_bg"
app:layout_constraintRight_toRightOf="@+id/taxi_p_autopilot_btn_bg" />
<View
app:layout_constraintBottom_toBottomOf="parent"
android:background="@drawable/taxt_u_p_start_autopilot_bottom_bg"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_250"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actv_orderinfo"
app:layout_constraintBottom_toBottomOf="parent"
@@ -81,7 +91,7 @@
<androidx.constraintlayout.widget.Guideline
android:id="@+id/gl_horizontal_center"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.5"
app:layout_constraintGuide_percent="0.58"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
@@ -90,6 +100,7 @@
android:id="@+id/actv_front_right_door"
android:gravity="center"
android:visibility="gone"
tools:visibility="visible"
app:layout_constraintTop_toTopOf="@+id/gl_horizontal_center"
app:layout_constraintBottom_toBottomOf="@+id/gl_horizontal_center"
app:layout_constraintStart_toStartOf="@+id/gl_vertical_center"
@@ -105,6 +116,7 @@
android:id="@+id/actv_front_left_door"
android:gravity="center"
android:visibility="gone"
tools:visibility="visible"
app:layout_constraintTop_toTopOf="@+id/gl_horizontal_center"
app:layout_constraintBottom_toBottomOf="@+id/gl_horizontal_center"
app:layout_constraintEnd_toStartOf="@+id/gl_vertical_center"
@@ -121,6 +133,7 @@
android:id="@+id/actv_rear_left_door"
android:gravity="center"
android:visibility="gone"
tools:visibility="visible"
app:layout_constraintEnd_toStartOf="@+id/gl_vertical_center"
app:layout_constraintTop_toBottomOf="@+id/gl_horizontal_center"
android:layout_marginEnd="@dimen/dp_135"
@@ -136,6 +149,7 @@
android:id="@+id/actv_rear_right_door"
android:gravity="center"
android:visibility="gone"
tools:visibility="visible"
app:layout_constraintStart_toEndOf="@+id/gl_vertical_center"
app:layout_constraintTop_toBottomOf="@+id/gl_horizontal_center"
android:layout_marginStart="@dimen/dp_135"

View File

@@ -54,6 +54,10 @@
<item>@drawable/light_00011</item>
<item>@drawable/light_00012</item>
<item>@drawable/light_00013</item>
<item>@drawable/light_00014</item>
<item>@drawable/light_00015</item>
<item>@drawable/light_00016</item>
<item>@drawable/light_00017</item>
</string-array>
<string-array name="xiaozhi_love">