[taxi-p]
[到达目的地]
This commit is contained in:
yangyakun
2023-12-23 23:06:37 +08:00
parent 71c2464fc6
commit 9b0d68aeae
51 changed files with 396 additions and 468 deletions

View File

@@ -1,24 +0,0 @@
package com.mogo.och.taxi.passenger;
import androidx.annotation.IdRes;
import androidx.fragment.app.FragmentActivity;
import com.mogo.eagle.core.function.api.base.IMoGoFunctionProvider;
public
/**
* @author congtaowang
* @since 2021/1/15
*
* 网约车抽象接口
*/
interface IMogoOCH extends IMoGoFunctionProvider {
/**
* 初始化网约车容器
*
* @param activity
* @param containerId 容器ID
*/
void createCoverage(FragmentActivity activity, @IdRes int containerId);
}

View File

@@ -12,6 +12,7 @@ import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.commons.module.status.IMogoStatusChangedListener;
import com.mogo.commons.module.status.MogoStatusManager;
import com.mogo.commons.module.status.StatusDescriptor;
import com.mogo.eagle.core.function.api.base.IMoGoFunctionProvider;
import com.mogo.eagle.core.function.call.setting.CallerMoGoUiSettingManager;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.och.taxi.passenger.constant.TaxiPassengerConst;
@@ -28,7 +29,7 @@ public
* 网约车-出租车-乘客端
*/
@Route(path = TaxiPassengerConst.PATH)
class MogoOCHTaxiPassenger implements IMogoOCH {
class MogoOCHTaxiPassenger implements IMoGoFunctionProvider {
private static final String TAG = "MogoOCHTaxiPassenger";
private TaxiPassengerBaseFragment ochTaxiPassengerFragment;
@@ -74,11 +75,6 @@ class MogoOCHTaxiPassenger implements IMogoOCH {
}
}
@Override
public void createCoverage(FragmentActivity activity, int containerId) {
}
@NotNull
@Override
public String getFunctionName() {

View File

@@ -19,15 +19,15 @@ import com.mogo.och.taxi.passenger.ui.statusview.StatusBarView;
@Route( path = MogoServicePaths.PATH_STATUS_VIEW_MANAGER )
public class StatusViewManager implements IStatusViewLayout {
private StatusBarView statusBarView;
@NonNull
@Override
public View getStatusView(Context context) {
return new StatusBarView(context);
return statusBarView;
}
@Override
public void init(Context context) {
statusBarView = new StatusBarView(context);
}
}

View File

@@ -1,9 +1,16 @@
package com.mogo.och.taxi.passenger.ui
import android.animation.Animator
import android.animation.AnimatorSet
import android.animation.ObjectAnimator
import android.annotation.SuppressLint
import android.os.Bundle
import android.view.View
import com.alibaba.android.arouter.launcher.ARouter
import com.mogo.commons.mvp.MvpFragment
import com.mogo.commons.voice.AIAssist
import com.mogo.eagle.core.data.constants.MogoServicePaths
import com.mogo.eagle.core.function.api.hmi.view.IStatusViewLayout
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.utilcode.kotlin.onClick
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
@@ -21,6 +28,7 @@ import com.mogo.och.taxi.passenger.ui.arrived.ArrivedView
import com.mogo.och.taxi.passenger.ui.bottom.BottomBar
import com.mogo.och.taxi.passenger.ui.check.TaxiPassengerCheckView
import com.mogo.och.taxi.passenger.ui.startautopilot.StartAutopilotView
import com.mogo.och.taxi.passenger.ui.statusview.StatusBarView
import kotlinx.android.synthetic.main.taxi_p_base_fragment.*
import java.lang.ref.WeakReference
@@ -36,11 +44,6 @@ class TaxiPassengerBaseFragment() :
MvpFragment<TaxiPassengerBaseFragment?, BaseTaxiPassengerPresenter?>(), IMogoMapListener,
TaxiPassengerTaxiView {
/**
* 到达目的地
*/
private var mArrivedEndView: WeakReference<ArrivedView?>? = null
/**
* 手机号后四位验证
*/
@@ -51,6 +54,9 @@ class TaxiPassengerBaseFragment() :
*/
private var mStartAutopilotView: WeakReference<StartAutopilotView?>? = null
private var statusBarView: StatusBarView? = null
override fun getLayoutId(): Int {
return R.layout.taxi_p_base_fragment
}
@@ -68,6 +74,15 @@ class TaxiPassengerBaseFragment() :
mapBizView!!.onCreate(savedInstanceState)
overMapView.onCreateView(savedInstanceState)
overMapView.hideResetView()
(ARouter.getInstance().build(MogoServicePaths.PATH_STATUS_VIEW_MANAGER)
.navigation() as? IStatusViewLayout)?.apply {
val statusView = getStatusView(requireContext())
if (statusView is StatusBarView) {
statusBarView = statusView
}
}
}
private fun initListener() {
@@ -253,22 +268,18 @@ class TaxiPassengerBaseFragment() :
* @param isShow true 展示 false 隐藏
*/
fun showOrHideArrivedEndLayout(isShow: Boolean) {
// chekAndStartAutopilotView.visibility = View.GONE
if (isShow) {
exitFullVideoScreen(true)
if (mArrivedEndView == null || mArrivedEndView!!.get() == null) {
mArrivedEndView = WeakReference(ArrivedView(context))
}
mArrivedEndView?.get()?.let {
OverlayViewUtils.showOverlayView(activity, it, R.style.och_window_anim_alpha)
RxUtils.createSubscribe(500) {
it.setDataAndStartAnimation()
VoiceNotice.showNotice("已到达目的地,带好随身物品,右侧下车更安全!期待下次再见", AIAssist.LEVEL2)
}
arrivedView.aniArrived(true)
showOrHide(false)
RxUtils.createSubscribe(500) {
arrivedView.setDataAndStartAnimation()
VoiceNotice.showNotice("已到达目的地,带好随身物品,右侧下车更安全!期待下次再见", AIAssist.LEVEL2)
}
} else {
mArrivedEndView?.get()?.let {
OverlayViewUtils.dismissOverlayView(it)
}
showOrHide(true)
arrivedView.aniArrived(false)
}
}
@@ -319,6 +330,135 @@ class TaxiPassengerBaseFragment() :
bottom.setCheckIndex(BottomBar.SelectView.OVERMAPVIEW)
}
private fun showOrHide(isShow: Boolean){
val animatorSet = AnimatorSet()
val allAnimator = mutableListOf<Animator>()
allAnimator.addAll(aniStatusBar(isShow))
allAnimator.addAll(aniBottomBar(isShow))
allAnimator.addAll(aniSpeedSettingRow(isShow,speedView))
allAnimator.addAll(aniSpeedSettingRow(isShow,romaPView))
allAnimator.addAll(aniSpeedSettingRow(isShow,romaDistanceView))
allAnimator.addAll(aniSpeedSettingRow(isShow,ck_setting))
allAnimator.addAll(aniOrderInfo(isShow))
animatorSet.playTogether(allAnimator)
animatorSet.start()
}
@SuppressLint("ObjectAnimatorBinding")
fun aniStatusBar(show:Boolean):List<Animator>{
val statusBar = mutableListOf<Animator>()
val translationYStart: Float
val translationYEnd: Float
val alphaStart: Float
val alphaEnd: Float
if(show){
translationYStart = -statusBarView!!.height.toFloat()
translationYEnd = 0f
alphaStart = 0.3f
alphaEnd = 1f
}else{
translationYStart = 0f
translationYEnd = -statusBarView!!.height.toFloat()
alphaStart = 1f
alphaEnd = 0.3f
}
statusBar.add(ObjectAnimator.ofFloat(statusBarView, "translationY", translationYStart, translationYEnd).apply {
duration = 1000
})
//ofFloatMove.duration = 1000
statusBar.add( ObjectAnimator.ofFloat(statusBarView, "alpha", alphaStart, alphaEnd).apply {
duration = 1000
})
return statusBar
}
private fun aniBottomBar(show:Boolean):List<Animator>{
val statusBar = mutableListOf<Animator>()
val translationYStart: Float
val translationYEnd: Float
val alphaStart: Float
val alphaEnd: Float
if(show){
translationYStart = bottom!!.height.toFloat()
translationYEnd = 0f
alphaStart = 0.3f
alphaEnd = 1f
}else{
translationYStart = 0f
translationYEnd = bottom!!.height.toFloat()
alphaStart = 1f
alphaEnd = 0.3f
}
statusBar.add(ObjectAnimator.ofFloat(bottom, "translationY", translationYStart, translationYEnd).apply {
duration = 1000
})
statusBar.add(ObjectAnimator.ofFloat(bottom, "alpha", alphaStart, alphaEnd).apply {
duration = 1000
})
return statusBar
}
private fun aniSpeedSettingRow(show:Boolean,view:View):List<Animator>{
val statusBar = mutableListOf<Animator>()
val translationYStart: Float
val translationYEnd: Float
val alphaStart: Float
val alphaEnd: Float
if(show){
translationYStart = -view.height.toFloat()
translationYEnd = 0f
alphaStart = 0.0f
alphaEnd = 1f
}else{
translationYStart = 0f
translationYEnd = -view.height.toFloat()
alphaStart = 1f
alphaEnd = 0.0f
}
statusBar.add(ObjectAnimator.ofFloat(view, "translationY", translationYStart, translationYEnd).apply {
duration = 1000
})
statusBar.add(ObjectAnimator.ofFloat(view, "alpha", alphaStart, alphaEnd).apply {
duration = 1000
})
return statusBar
}
private fun aniOrderInfo(show:Boolean):List<Animator>{
val statusBar = mutableListOf<Animator>()
val translationYStart: Float
val translationYEnd: Float
val alphaStart: Float
val alphaEnd: Float
if(show){
translationYStart = itinerary.height.toFloat()/5
translationYEnd = 0f
alphaStart = 0.0f
alphaEnd = 1f
}else{
translationYStart = 0f
translationYEnd = itinerary.height.toFloat()/5
alphaStart = 1f
alphaEnd = 0.0f
}
statusBar.add(ObjectAnimator.ofFloat(itinerary, "translationY", translationYStart, translationYEnd).apply {
duration = 1000
})
statusBar.add(ObjectAnimator.ofFloat(itinerary, "alpha", alphaStart, alphaEnd).apply {
duration = 1000
})
return statusBar
}
companion object {
@JvmField
val TAG = "TaxiPassengerBaseFragment"

View File

@@ -1,135 +0,0 @@
package com.mogo.och.taxi.passenger.ui.arrived
import android.content.*
import android.graphics.BitmapFactory
import android.util.*
import androidx.core.util.Pools
import com.mogo.eagle.core.data.config.*
import com.mogo.eagle.core.function.api.autopilot.*
import com.mogo.eagle.core.function.api.lookaround.*
import com.mogo.eagle.core.function.api.lookaround.data.*
import com.mogo.eagle.core.function.call.autopilot.*
import com.mogo.eagle.core.utilcode.mogo.*
import com.zhjt.mogo.adas.data.*
import com.zhjt.mogo.adas.data.bean.*
import kotlinx.coroutines.*
import kotlinx.coroutines.channels.*
import kotlinx.coroutines.channels.Channel.Factory.CONFLATED
import kotlinx.coroutines.flow.*
import java.util.concurrent.atomic.AtomicInteger
import kotlin.concurrent.*
internal class AroundProviderImpl: IMoGoBackCameraVideoListener, IMoGoRoboBusJinlvM1StitchedVideoListener {
companion object {
private const val TAG = "AroundProviderImpl"
}
@OptIn(ExperimentalCoroutinesApi::class)
private var channel: Channel<LookAroundData> = Channel(CONFLATED)
get() {
return if (field.isClosedForReceive || field.isClosedForSend) {
Channel(CONFLATED)
} else {
field
}
}
private val pool by lazy { Pools.SynchronizedPool<LookAroundData>(10) }
private val bitmapWidth by lazy { AtomicInteger(0) }
private val bitmapHeight by lazy { AtomicInteger(0) }
//276,319,147,366
private val targetX by lazy { AtomicInteger(0) }
private val targetY by lazy { AtomicInteger(0) }
private val targetWidth by lazy { AtomicInteger(0) }
private val targetHeight by lazy { AtomicInteger(0) }
private val scope by lazy { CoroutineScope(Dispatchers.IO + SupervisorJob()) }
@Volatile
private var job: Job? = null
fun init() {
CallerBackCameraVideoListenerManager.addListener(TAG, this)
CallerRoboBusJinlvM1StitchedVideoListenerManager.addListener(TAG, this)
}
fun removeListener() {
CallerBackCameraVideoListenerManager.removeListener(TAG)
CallerRoboBusJinlvM1StitchedVideoListenerManager.removeListener(TAG)
}
@OptIn(ExperimentalCoroutinesApi::class)
fun flow(): Flow<LookAroundData> = channelFlow {
val iterator = this@AroundProviderImpl.channel.iterator()
while (iterator.hasNext()) {
send(iterator.next())
}
}.flowOn(Dispatchers.IO)
override fun onRoboBusJinlvM1StitchedVideo(data: ByteArray) {
if (bitmapWidth.get() == 0 || bitmapHeight.get() == 0) {
val options = BitmapFactory.Options()
options.inJustDecodeBounds = true
BitmapFactory.decodeByteArray(data,0 , data.size, options)
bitmapWidth.set(options.outWidth)
bitmapHeight.set(options.outHeight)
}
Log.d(TAG, "-- onRoboBusJinlvM1StitchedVideo -- bitmap:[${bitmapWidth.get()}, ${bitmapHeight.get()}] -- data: ${data.size}")
var old = pool.acquire()
try {
if (old == null) {
old = LookAroundData(data, bitmapWidth.get(), bitmapHeight.get(), targetX.get(), targetY.get(), targetWidth.get(), targetHeight.get())
} else {
old.data = data
old.bitmapWidth = bitmapWidth.get()
old.bitmapHeight = bitmapHeight.get()
old.targetX = targetX.get()
old.targetY = targetY.get()
old.targetWidth = targetWidth.get()
old.targetHeight = targetHeight.get()
}
channel.trySend(old)
} finally {
if (old != null) {
pool.release(old)
}
}
}
override fun onBackCameraVideo(data: ByteArray) {
if (bitmapWidth.get() == 0 || bitmapHeight.get() == 0) {
val options = BitmapFactory.Options()
options.inJustDecodeBounds = true
BitmapFactory.decodeByteArray(data,0 , data.size, options)
bitmapWidth.set(options.outWidth)
bitmapHeight.set(options.outHeight)
}
Log.d(TAG, "-- onSweeperFutianBackCameraVideo -- bitmap:[${bitmapWidth.get()}, ${bitmapHeight.get()}] -- data: ${data.size}")
var old = pool.acquire()
try {
if (old == null) {
old = LookAroundData(data, bitmapWidth.get(), bitmapHeight.get(), targetX.get(), targetY.get(), targetWidth.get(), targetHeight.get())
} else {
old.data = data
old.bitmapWidth = bitmapWidth.get()
old.bitmapHeight = bitmapHeight.get()
old.targetX = targetX.get()
old.targetY = targetY.get()
old.targetWidth = targetWidth.get()
old.targetHeight = targetHeight.get()
}
channel.trySend(old)
} finally {
if (old != null) {
pool.release(old)
}
}
}
}

View File

@@ -1,27 +1,24 @@
package com.mogo.och.taxi.passenger.ui.arrived
import android.animation.Animator
import android.animation.AnimatorListenerAdapter
import android.animation.ObjectAnimator
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import androidx.lifecycle.ViewModelProvider
import com.mogo.commons.AbsMogoApplication
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.CallerLogger.d
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.core.utilcode.util.OverlayViewUtils
import com.mogo.och.common.module.utils.FrameAnimatorContainer
import com.mogo.och.common.module.utils.BigFrameAnimatorContainer
import com.mogo.och.common.module.utils.RxUtils
import com.mogo.och.taxi.passenger.R
import com.mogo.och.taxi.passenger.widget.WindowRelativeLayout
import com.shuyu.gsyvideoplayer.GSYVideoManager
import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder
import com.shuyu.gsyvideoplayer.listener.GSYSampleCallBack
import io.reactivex.disposables.Disposable
import kotlinx.android.synthetic.main.taxi_p_arrived_end_panel.view.aciv_bg
import kotlinx.android.synthetic.main.taxi_p_arrived_end_panel.view.aciv_close
import kotlinx.android.synthetic.main.taxi_p_arrived_end_panel.view.actv_endstation
import kotlinx.android.synthetic.main.taxi_p_arrived_end_panel.view.iv_xiaozhi_belt
import kotlinx.android.synthetic.main.taxi_p_arrived_end_panel.view.svp_frame
import kotlinx.android.synthetic.main.taxi_p_arrived_end_panel.view.v_video_right_rear_view
@@ -42,73 +39,54 @@ class ArrivedView : WindowRelativeLayout, ArrivedViewModel.ArrivedViewCallback {
private var subscribe: Disposable?=null
private val gsyVideoOptionBuilder = GSYVideoOptionBuilder()
private var taxiPxiaozhiLove: BigFrameAnimatorContainer?=null
var arrivedVisilityChangeListenr:ArrivedVisilityChangeListenr?=null
private var taxiPxiaozhiLove: FrameAnimatorContainer?=null
private fun initView() {
d(SceneConstant.M_TAXI_P + TAG, "initView")
LayoutInflater.from(context).inflate(R.layout.taxi_p_arrived_end_panel, this, true)
svp_frame.setBackgroundResource(R.drawable.tail_ani_0000)
svp_frame.setIsTouchWiget(false)
svp_frame.setIsTouchWigetFull(false)
svp_frame.enableshowProgressDialog = false
svp_frame.enableDoubleClick = false
GSYVideoManager.instance().enableRawPlay(AbsMogoApplication.getApp())
val url = "android.resource://" + context.packageName + "/" + R.raw.end_video
gsyVideoOptionBuilder.setUrl(url)
.setCacheWithPlay(false)
.setPlayTag("TaxiPassengerArrivedView")
.build(svp_frame)
aciv_close.onClick {
OverlayViewUtils.dismissOverlayView(this)
visibility = View.GONE
}
taxiPxiaozhiLove = FrameAnimatorContainer(R.array.xiaozhi_love, 48,iv_xiaozhi_belt)
taxiPxiaozhiLove?.setOnAnimStopListener(object :FrameAnimatorContainer.OnAnimationStoppedListener{
taxiPxiaozhiLove = BigFrameAnimatorContainer(R.array.arrived_dest, 31,aciv_bg,isOnce = true)
taxiPxiaozhiLove?.setOnAnimStopListener(object : BigFrameAnimatorContainer.OnAnimationStoppedListener{
override fun AnimationStopped() {
CallerLogger.d(SceneConstant.M_TAXI_P + TAG, "动画暂停")
d(SceneConstant.M_TAXI_P + TAG, "动画暂停")
}
})
}
override fun onVisibilityAggregated(isVisible: Boolean) {
super.onVisibilityAggregated(isVisible)
d(SceneConstant.M_TAXI_P + TAG, "展示---:${isVisible}")
if (isVisible) {
taxiPxiaozhiLove = BigFrameAnimatorContainer(R.array.arrived_dest, 31,aciv_bg,isOnce = true)
taxiPxiaozhiLove?.start()
v_video_right_rear_view.resetView()
} else {
v_video_right_rear_view.resetView()
taxiPxiaozhiLove = null
RxUtils.disposeSubscribe(subscribe)
}
arrivedVisilityChangeListenr?.isShow(isVisible)
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
val viewModel = ViewModelProvider(this).get(ArrivedViewModel::class.java)
viewModel.setViewCallback(this)
taxiPxiaozhiLove?.start()
v_video_right_rear_view.resetView()
}
override fun onDetachedFromWindow() {
svp_frame.setBackgroundResource(R.drawable.tail_ani_0000)
svp_frame.setVideoAllCallBack(null)
svp_frame.onVideoReset()
svp_frame.release()
taxiPxiaozhiLove?.stop()
v_video_right_rear_view.resetView()
super.onDetachedFromWindow()
subscribe?.let {
if (!it.isDisposed) {
it.dispose()
}
}
}
/**
* 设置目的地重置星星状态
*/
fun setDataAndStartAnimation() {
svp_frame.setVideoAllCallBack(object : GSYSampleCallBack() {
override fun onAutoComplete(url: String?, vararg objects: Any?) {
svp_frame.setBackgroundResource(R.drawable.tail_ani_0090)
}
})
svp_frame.startPlayLogic()
RxUtils.createSubscribe(60_000) {
OverlayViewUtils.dismissOverlayView(this@ArrivedView)
subscribe = RxUtils.createSubscribe(60_000) {
visibility = View.GONE
}
}
@@ -128,4 +106,37 @@ class ArrivedView : WindowRelativeLayout, ArrivedViewModel.ArrivedViewCallback {
actv_endstation.text = stationName
}
fun aniArrived(show:Boolean){
RxUtils.createSubscribe(500) {
val alphaStart: Float
val alphaEnd: Float
if(show){
alphaStart = 0.0f
alphaEnd = 1f
visibility = View.VISIBLE
}else{
alphaStart = 1f
alphaEnd = 0.0f
visibility = View.GONE
}
ObjectAnimator.ofFloat(this@ArrivedView, "alpha", alphaStart, alphaEnd).apply {
duration = 2000
addListener(object : AnimatorListenerAdapter(){
override fun onAnimationEnd(animation: Animator) {
d(TAG,"onAnimationEndcarrivedView")
if(show){
visibility = View.VISIBLE
}else{
visibility = View.GONE
}
}
})
}.start()
}
}
interface ArrivedVisilityChangeListenr{
fun isShow(show: Boolean)
}
}

View File

@@ -1,171 +0,0 @@
package com.mogo.och.taxi.passenger.ui.arrived
import android.content.*
import android.graphics.*
import android.graphics.Paint.Style.STROKE
import android.os.Handler
import android.os.HandlerThread
import android.os.SystemClock
import android.util.*
import android.view.SurfaceHolder
import android.view.SurfaceView
import android.widget.Toast
import com.mogo.eagle.core.function.api.autopilot.*
import com.mogo.eagle.core.function.api.lookaround.data.*
import com.mogo.eagle.core.function.call.autopilot.*
import com.mogo.eagle.core.function.call.devatools.*
import com.mogo.eagle.core.utilcode.kotlin.*
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.eagle.core.utilcode.util.Utils
import com.mogo.eagle.core.widget.media.video.TextureVideoViewOutlineProvider
import kotlinx.coroutines.*
import kotlinx.coroutines.Runnable
import kotlinx.coroutines.flow.*
import java.util.concurrent.atomic.AtomicReference
import kotlin.math.*
class RightRearCamSurfaceView: SurfaceView, SurfaceHolder.Callback, Runnable {
constructor(context: Context?) : super(context)
constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs)
constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr)
companion object {
private const val TAG = "M1LookAroundView"
}
init {
holder.addCallback(this)
}
private val handler by lazy { AtomicReference<Handler>() }
private val lookAroundDataProvider by lazy { AroundProviderImpl() }
private val bitmapPaint by lazy { Paint(Paint.ANTI_ALIAS_FLAG or Paint.FILTER_BITMAP_FLAG).also { it.xfermode = null } }
@Volatile
private var surfaceWidth = 0
@Volatile
private var surfaceHeight = 0
@Volatile
private var isSurfaceValid = false
@Volatile
private var data: LookAroundData? = null
override fun surfaceCreated(holder: SurfaceHolder) {
val old = handler.get()
if (old == null) {
handler.set(HandlerThread("look-around-drawer").let { it.start(); Handler(it.looper) })
} else {
old.looper.quitSafely()
handler.set(HandlerThread("look-around-drawer").let { it.start(); Handler(it.looper) })
}
handler.get()?.removeCallbacks(this)
handler.get()?.post(this)
isSurfaceValid = true
}
override fun surfaceChanged(holder: SurfaceHolder, format: Int, width: Int, height: Int) {
this.surfaceWidth = width
this.surfaceHeight = height
}
override fun surfaceDestroyed(holder: SurfaceHolder) {
isSurfaceValid = false
}
override fun run() {
var isTimedBlock = false
try {
if (!isSurfaceValid) {
isTimedBlock = true
return
}
if (this.surfaceWidth <= 0 || this.surfaceHeight <= 0) {
isTimedBlock = true
return
}
val data = this.data ?: return
val bitmapWidth = data.bitmapWidth
val bitmapHeight = data.bitmapHeight
val scaleX = this.surfaceWidth * 1.0f / bitmapWidth
val scaleY = this.surfaceHeight * 1.0f / bitmapHeight
val bytes = data.data
if (bytes == null) {
isTimedBlock = true
return
}
val canvas = holder.lockCanvas()
try {
if (canvas == null) {
isTimedBlock = true
return
}
//1. 绘制图片
val bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.size)
if (bitmap == null) {
isTimedBlock = true
return
}
try {
canvas.save()
canvas.scale(scaleX, scaleY)
canvas.drawBitmap(bitmap, 0f, 0f, bitmapPaint)
} finally {
canvas.restore()
if (!bitmap.isRecycled) {
bitmap.recycle()
}
}
} finally {
if (canvas != null) {
holder.unlockCanvasAndPost(canvas)
}
}
} finally {
if (isTimedBlock) {
try {
Thread.sleep(2000)
} catch (ignore: Exception) { }
}
handler.get().post(this)
}
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
Log.d(TAG, "--- 发起订阅 ---")
CallerAutoPilotControlManager.setIsSubscribeBackCameraVideoVideo(1, true)
lookAroundDataProvider.init()
scope.launch(ThreadUtils.getCpuPool().asCoroutineDispatcher()) {
lookAroundDataProvider.flow().also { flow ->
flow.onEach {
Log.d(TAG, "-- onEach ---:$it")
//if (it.isValid()) {
data = it
//}
}.collect()
}
}
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
Log.d(TAG, "--- 取消订阅 ---")
CallerAutoPilotControlManager.setIsSubscribeBackCameraVideoVideo(1, false)
lookAroundDataProvider.removeListener()
handler.get()?.looper?.quitSafely()
}
override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
super.onSizeChanged(w, h, oldw, oldh)
outlineProvider = TextureVideoViewOutlineProvider(36f)
clipToOutline = true
}
}

View File

@@ -0,0 +1,51 @@
package com.mogo.och.taxi.passenger.ui.speed
import android.content.Context
import android.os.Build
import android.util.AttributeSet
import android.view.LayoutInflater
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
import com.mogo.och.taxi.passenger.R
class SpeedView : ConstraintLayout, IMoGoChassisLocationGCJ02Listener {
private val TAG = "ItineraryView"
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)
private fun initView() {
LayoutInflater.from(context).inflate(R.layout.taxt_p_speed, this, true)
}
override fun onVisibilityAggregated(isVisible: Boolean) {
super.onVisibilityAggregated(isVisible)
if(isVisible){
CallerChassisLocationGCJ02ListenerManager.addListener(TAG, 4, this)
}else{
CallerChassisLocationGCJ02ListenerManager.removeListener(TAG)
}
}
init {
try {
initView()
} catch (e: Exception) {
e.printStackTrace()
}
}
override fun onChassisLocationGCJ02(mogoLocation: MogoLocation?) {
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 808 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 801 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 861 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 867 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 842 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 800 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 759 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 723 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 736 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 726 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 745 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 804 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 804 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 840 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 869 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 685 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 749 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 754 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 768 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 694 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 698 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 675 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 731 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 640 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 678 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 663 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 700 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 566 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 580 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 623 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:tools="http://schemas.android.com/tools" xmlns:android="http://schemas.android.com/apk/res/android" tools:ignore="MissingDefaultResource">
<item android:drawable="@drawable/taxi_p_setting_checked" android:state_focused="true" android:state_pressed="true" />
<item android:drawable="@drawable/taxi_p_setting_checked" android:state_focused="false" android:state_pressed="true" />
<item android:drawable="@drawable/taxi_p_setting_checked" android:state_checked="true" />
<item android:drawable="@drawable/taxi_p_setting_normal" android:state_checked="false" />
<item android:drawable="@drawable/taxi_p_setting_checked" android:state_selected="true" />
<item android:drawable="@drawable/taxi_p_setting_checked" android:state_focused="true" />
<item android:drawable="@drawable/taxi_p_setting_normal" />
<item android:drawable="@drawable/taxt_p_setting_checked" android:state_focused="true" android:state_pressed="true" />
<item android:drawable="@drawable/taxt_p_setting_checked" android:state_focused="false" android:state_pressed="true" />
<item android:drawable="@drawable/taxt_p_setting_checked" android:state_checked="true" />
<item android:drawable="@drawable/taxt_p_setting_normal" android:state_checked="false" />
<item android:drawable="@drawable/taxt_p_setting_checked" android:state_selected="true" />
<item android:drawable="@drawable/taxt_p_setting_checked" android:state_focused="true" />
<item android:drawable="@drawable/taxt_p_setting_normal" />
</selector>

View File

@@ -7,8 +7,8 @@
android:layout_height="match_parent"
tools:ignore="MissingDefaultResource">
<com.mogo.eagle.core.widget.media.video.SimpleVideoPlayer
android:id="@+id/svp_frame"
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/aciv_bg"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintStart_toStartOf="parent"
@@ -58,48 +58,4 @@
android:layout_width="@dimen/dp_900"
android:layout_height="@dimen/dp_506"/>
<View
android:id="@+id/v_xiaozhi_belt_info_bg"
app:layout_constraintBottom_toTopOf="@+id/iv_xiaozhi_belt"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginEnd="@dimen/dp_50"
android:background="@drawable/taxi_p_xiaozhibelt_info"
android:layout_marginBottom="-60dp"
android:layout_width="@dimen/dp_600"
android:layout_height="@dimen/dp_339"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actv_title_01"
app:layout_constraintStart_toStartOf="@+id/v_xiaozhi_belt_info_bg"
app:layout_constraintEnd_toEndOf="@+id/v_xiaozhi_belt_info_bg"
app:layout_constraintTop_toTopOf="@+id/v_xiaozhi_belt_info_bg"
android:layout_marginTop="@dimen/dp_45"
android:text="带好随身物品,右侧下车\n更安全"
android:textSize="@dimen/dp_44"
android:textColor="@android:color/white"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatTextView
app:layout_constraintBottom_toBottomOf="@+id/v_xiaozhi_belt_info_bg"
app:layout_constraintStart_toStartOf="@+id/actv_title_01"
android:layout_marginBottom="@dimen/dp_67"
android:text="记得在小程序完成支付哦~"
android:textColor="@android:color/white"
android:textSize="@dimen/dp_44"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<ImageView
android:id="@+id/iv_xiaozhi_belt"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_width="@dimen/dp_360"
android:layout_height="@dimen/dp_360"
android:layout_marginBottom="@dimen/dp_m_30"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -49,6 +49,15 @@
app:pnc_size="@dimen/dp_40"
app:pnc_txt_style="@style/AudioFileInfoOverlayText" />
<com.mogo.och.taxi.passenger.ui.speed.SpeedView
android:id="@+id/speedView"
android:layout_width="@dimen/dp_240"
android:layout_height="@dimen/dp_120"
android:layout_marginTop="@dimen/dp_100"
android:layout_marginStart="@dimen/dp_50"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<CheckBox
android:id="@+id/ck_setting"
android:layout_width="@dimen/dp_120"
@@ -57,7 +66,7 @@
android:layout_marginTop="@dimen/dp_100"
android:background="@drawable/taxi_p_setting_selector"
android:button="@null"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintStart_toEndOf="@+id/speedView"
app:layout_constraintTop_toTopOf="parent" />
<com.mogo.och.taxi.passenger.ui.systemsetting.TaxiPSettingView
@@ -74,10 +83,10 @@
android:id="@+id/romaPView"
android:layout_width="@dimen/dp_120"
android:layout_height="@dimen/dp_120"
android:layout_marginStart="@dimen/dp_220"
android:layout_marginStart="@dimen/dp_60"
android:layout_marginTop="100dp"
android:background="@drawable/taxi_p_bg_roma_selector"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintStart_toEndOf="@+id/ck_setting"
app:layout_constraintTop_toTopOf="parent"
app:roma_close="@drawable/taxi_p_bg_roma_selector"
app:roma_open="@drawable/taxi_p_roma_checked" />
@@ -88,10 +97,10 @@
android:layout_height="@dimen/dp_120"
android:layout_marginStart="@dimen/dp_50"
android:layout_marginTop="100dp"
app:roma_distance_bg="@drawable/roma_distance_bg"
app:layout_constraintLeft_toRightOf="@+id/romaPView"
app:layout_constraintTop_toTopOf="parent"
app:roma_change_dis_color="true"
app:roma_distance_bg="@drawable/roma_distance_bg" />
app:roma_change_dis_color="true" />
<TextView
android:id="@+id/rv_location_center"
@@ -141,6 +150,13 @@
android:layout_height="@dimen/dp_160"
app:layout_constraintBottom_toBottomOf="parent" />
<com.mogo.och.taxi.passenger.ui.arrived.ArrivedView
android:id="@+id/arrivedView"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<com.mogo.och.common.module.wigets.ZhiView
android:id="@+id/aciv_xiaozhi_normal"
android:layout_width="@dimen/dp_360"
@@ -162,8 +178,8 @@
<com.mogo.och.taxi.passenger.ui.debug.DebugView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_120"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="@dimen/dp_240"
android:layout_height="@dimen/dp_120"
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">
<View
android:id="@+id/v_bottom_bg"
android:layout_width="@dimen/dp_240"
android:layout_height="@dimen/dp_120"
android:background="@drawable/taxi_p_speed_bg"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actv_speed_value"
app:layout_constraintHorizontal_chainStyle="packed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/taxi_p_203555"
android:textSize="@dimen/dp_78"
android:layout_marginEnd="@dimen/dp_6"
android:fontFamily="@font/din"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@+id/actv_speed_unit"
android:text="68" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actv_speed_unit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/taxi_p_203555"
android:layout_marginStart="@dimen/dp_6"
android:textSize="@dimen/dp_32"
app:layout_constraintBaseline_toBaselineOf="@+id/actv_speed_value"
android:fontFamily="@font/din"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/actv_speed_value"
app:layout_constraintEnd_toEndOf="parent"
android:text="KM/h" />
</merge>

View File

@@ -225,4 +225,44 @@
<item>@drawable/xiaozhi_belt_048</item>
</string-array>
<string-array name="arrived_dest">
<item>@drawable/arrive_dest_000</item>
<item>@drawable/arrive_dest_001</item>
<item>@drawable/arrive_dest_002</item>
<item>@drawable/arrive_dest_003</item>
<item>@drawable/arrive_dest_004</item>
<item>@drawable/arrive_dest_005</item>
<item>@drawable/arrive_dest_006</item>
<item>@drawable/arrive_dest_007</item>
<item>@drawable/arrive_dest_008</item>
<item>@drawable/arrive_dest_009</item>
<item>@drawable/arrive_dest_011</item>
<item>@drawable/arrive_dest_011</item>
<item>@drawable/arrive_dest_012</item>
<item>@drawable/arrive_dest_013</item>
<item>@drawable/arrive_dest_014</item>
<item>@drawable/arrive_dest_015</item>
<item>@drawable/arrive_dest_016</item>
<item>@drawable/arrive_dest_017</item>
<item>@drawable/arrive_dest_018</item>
<item>@drawable/arrive_dest_019</item>
<item>@drawable/arrive_dest_020</item>
<item>@drawable/arrive_dest_021</item>
<item>@drawable/arrive_dest_022</item>
<item>@drawable/arrive_dest_023</item>
<item>@drawable/arrive_dest_024</item>
<item>@drawable/arrive_dest_025</item>
<item>@drawable/arrive_dest_026</item>
<item>@drawable/arrive_dest_027</item>
<item>@drawable/arrive_dest_028</item>
<item>@drawable/arrive_dest_029</item>
<item>@drawable/arrive_dest_030</item>
</string-array>
</resources>