diff --git a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/constant/TaxiPassengerConst.kt b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/constant/TaxiPassengerConst.kt index d3655b9b35..15cc6dad4f 100644 --- a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/constant/TaxiPassengerConst.kt +++ b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/constant/TaxiPassengerConst.kt @@ -20,15 +20,15 @@ class TaxiPassengerConst { const val LOOP_PERIOD_1S = 1 * 1000L const val LOOP_DELAY = 100L - // 订单总里程 - const val SP_KEY_ORDER_SUM_DIS = "SP_KEY_ORDER_SUM_DIS" - //实时查询订单剩余时间 和 剩余里程 轮询间隔2s const val LOOP_CALCULATEROUTE_2S = 2 * 1000L // 开始服务启动自动驾驶等待时间(埋点上传) const val LOOP_PERIOD_15S = 15 * 1000L + const val TAXI_AVERAGE_SPEED = 38 + + // 埋点key:接管后点击'自动驾驶'按钮启动 const val EVENT_KEY_RESTART_AUTOPILOT = "event_key_och_taxi_restart_autopilot" // 埋点key:开始服务开启自动驾驶(成功/失败) diff --git a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/model/TaxiPassengerModel.kt b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/model/TaxiPassengerModel.kt index 21fbbe84e3..fa4b262c37 100644 --- a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/model/TaxiPassengerModel.kt +++ b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/model/TaxiPassengerModel.kt @@ -40,7 +40,6 @@ import com.mogo.och.taxi.passenger.constant.TaxiPassengerOrderStatusEnum import com.mogo.och.taxi.passenger.constant.TaxiPassengerOrderStatusEnum.Companion.valueOf import com.mogo.och.taxi.passenger.network.TaxiPassengerServiceManager import com.mogo.och.taxi.passenger.utils.TaxiPassengerAnalyticsManager -import io.reactivex.disposables.Disposable import java.util.concurrent.ConcurrentHashMap /** @@ -95,7 +94,7 @@ object TaxiPassengerModel { */ fun release() { startOrStopOrderLoop(false) - startOrStopQueryOrderRemaining(false) + //startOrStopQueryOrderRemaining(false) releaseListeners() } @@ -211,8 +210,18 @@ object TaxiPassengerModel { //监听网络变化,避免启动机器时无网导致无法更新订单信息 private val distanceListener: IDistanceListener = object : IDistanceListener { + var allDistance = 0f override fun stationDistanceCallback(stationDistance: Float) { - SharedPrefsMgr.getInstance(mContext!!).putInt(TaxiPassengerConst.SP_KEY_ORDER_SUM_DIS, stationDistance.toInt()) + allDistance = stationDistance + } + + override fun distanceCallback(distance: Float) { + + val lastTime: Double = distance / TaxiPassengerConst.TAXI_AVERAGE_SPEED * 3.6 //秒 + + for (callback in mOrderStatusCallbackMap.values) { + callback.onCurrentOrderDistToEndChanged(distance.toLong(),lastTime.toLong(),allDistance.toInt()) + } } } private val mNetWorkIntentListener = IMogoIntentListener { intentStr, intent -> @@ -241,43 +250,6 @@ object TaxiPassengerModel { } } - fun startOrStopQueryOrderRemaining(isStart: Boolean) { - if (isStart) { - BizLoopManager.setLoopFunction(MQUERYORDERREMAINING,LoopInfo(2, TaxiPassengerModel::queryOrderRemaining)) - } else { - BizLoopManager.removeLoopFunction(MQUERYORDERREMAINING) - } - } - - /** - * 查询订单剩余里程和时间 - */ - private fun queryOrderRemaining() { - if (currentOCHOrder == null) return - TaxiPassengerServiceManager.queryOrderRemaining( - currentOCHOrder!!.orderNo, - object : OchCommonServiceCallback { - override fun onSuccess(data: TaxiPassengerOrderQueryRemainingResp) { - if (data.data != null) { - e(M_TAXI_P + TAG, "distance = " + data.data.distance + " ,duration = " + data.data.duration) - val stationDistance = SharedPrefsMgr.getInstance(mContext!!).getInt(TaxiPassengerConst.SP_KEY_ORDER_SUM_DIS, 0) - for (callback in mOrderStatusCallbackMap.values) { - callback.onCurrentOrderDistToEndChanged(data.data.distance, data.data.duration,stationDistance) - } - } - } - - override fun onFail(code: Int, msg: String) {} - }) - } - - /** - * 订单结束或者取消的时候, 刷新导航标识位以及缓存的数据 - */ - fun recoverNaviInfo() { - SharedPrefsMgr.getInstance(mContext!!).remove(TaxiPassengerConst.SP_KEY_ORDER_SUM_DIS) - } - fun checkPhoneAndUpdateStatus( phoneTail: String?, commonCallback: ITaxiPassengerCommonCallback? @@ -328,28 +300,26 @@ object TaxiPassengerModel { } TaxiPassengerOrderStatusEnum.OnTheWayToEnd -> { CallerFuncBizManager.bizProvider.queryV2XEvents() //全览模式的V2X事件轮询开始 - startOrStopQueryOrderRemaining(true) + //startOrStopQueryOrderRemaining(true) AutopilotManager.updateAutopilotControlParameters() startOrStopReadyToAutopilotLoop(false) setStation() CallerOrderListenerManager.invokeOrderStatus(true) } TaxiPassengerOrderStatusEnum.ArriveAtEnd -> { - recoverNaviInfo() AutopilotManager.clearAutopilotControlParameters() - startOrStopQueryOrderRemaining(false) + //startOrStopQueryOrderRemaining(false) CallerOrderListenerManager.invokeOrderStatus(false) cleanStation() } TaxiPassengerOrderStatusEnum.JourneyCompleted -> { AutopilotManager.clearAutopilotControlParameters() - startOrStopQueryOrderRemaining(false) + //startOrStopQueryOrderRemaining(false) cleanStation() } TaxiPassengerOrderStatusEnum.Cancel -> { - recoverNaviInfo() AutopilotManager.clearAutopilotControlParameters() - startOrStopQueryOrderRemaining(false) + //startOrStopQueryOrderRemaining(false) startOrStopReadyToAutopilotLoop(false) cleanStation() } diff --git a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/CustomSeekBar.java b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/CustomSeekBar.java deleted file mode 100644 index c551fd993d..0000000000 --- a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/CustomSeekBar.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.mogo.och.taxi.passenger.ui; - -import android.content.Context; -import android.graphics.Canvas; -import android.util.AttributeSet; -import android.view.MotionEvent; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.appcompat.widget.AppCompatSeekBar; - -/** - * @author: wangmingjun - * @date: 2022/3/21 - */ -public class CustomSeekBar extends AppCompatSeekBar { - - private boolean touch = false; //是否支持拖动, 默认为不可以 - - public CustomSeekBar(@NonNull Context context) { - super(context); - } - - public CustomSeekBar(@NonNull Context context, @Nullable AttributeSet attrs) { - super(context, attrs); - } - - public CustomSeekBar(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - } - - @Override - protected synchronized void onDraw(Canvas canvas) { - super.onDraw(canvas); - } - - public void setTouch(boolean touch) { - this.touch = touch; - } - - /** - * onTouchEvent 处理 - */ - @Override - public boolean onTouchEvent(MotionEvent event) { - if (touch) { - return super.onTouchEvent(event); - } - return false; - } -} diff --git a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/ITaxiPassengerMapDirectionView.kt b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/ITaxiPassengerMapDirectionView.kt deleted file mode 100644 index 4db01025e5..0000000000 --- a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/ITaxiPassengerMapDirectionView.kt +++ /dev/null @@ -1,24 +0,0 @@ -package com.mogo.och.taxi.passenger.ui - -import com.amap.api.maps.model.LatLng - -/** - * @author xiaoyuzhou - * @date 2021/6/24 11:33 上午 - */ -interface ITaxiPassengerMapDirectionView { - /** - * 绘制路径线 - */ - fun drawablePolyline() - - /** - * 清除路径线 - */ - fun clearPolyline() - - /** - * 设置路径中起终点marker - */ - fun setLineMarker(startStation: LatLng, endStation: LatLng) -} \ No newline at end of file diff --git a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/TaxiPassengerTrafficLightView.kt b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/TaxiPassengerTrafficLightView.kt deleted file mode 100644 index 464e7a67a2..0000000000 --- a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/TaxiPassengerTrafficLightView.kt +++ /dev/null @@ -1,200 +0,0 @@ -package com.mogo.och.taxi.passenger.ui - -import android.content.Context -import android.util.AttributeSet -import android.view.LayoutInflater -import android.widget.LinearLayout -import com.mogo.eagle.core.data.enums.DataSourceType -import com.mogo.eagle.core.data.enums.TrafficLightEnum -import com.mogo.eagle.core.function.api.datacenter.union.IMoGoTrafficLightListener -import com.mogo.eagle.core.function.call.v2x.CallerTrafficLightListenerManager -import com.mogo.eagle.core.utilcode.util.UiThreadHandler -import com.mogo.och.taxi.passenger.R -import kotlinx.android.synthetic.main.taxi_p_traffic_light_view.view.* - -/** - * Taxi乘客端:红绿灯view - * - * Created on 2022/3/14 - */ -class TaxiPassengerTrafficLightView @JvmOverloads constructor( - context: Context?, - attrs: AttributeSet? = null, - defStyleAttr: Int = 0 -) : LinearLayout(context, attrs, defStyleAttr), IMoGoTrafficLightListener { - - companion object { - private const val TAG = "TaxiPassengerTrafficLightView" - } - - private var mCurrentLightId = TrafficLightEnum.BLACK - - init { - init(context) - } - - private fun init(context: Context?) { - LayoutInflater.from(context).inflate(R.layout.taxi_p_traffic_light_view, this, true) - } - - override fun onAttachedToWindow() { - super.onAttachedToWindow() - CallerTrafficLightListenerManager.addListener(TAG, this) - } - - override fun onDetachedFromWindow() { - super.onDetachedFromWindow() - CallerTrafficLightListenerManager.removeListener(TAG) - } - - /** - * 展示红绿灯预警 - * - * @param checkLightId 0-都是默认,1-红,2-黄,3-绿 - * @param lightSource 1:云端下发;2:自车感知 - */ - override fun showTrafficLight(checkLightId: TrafficLightEnum, lightSource: DataSourceType) { - super.showTrafficLight(checkLightId, lightSource) - mCurrentLightId = checkLightId - updateTrafficLightIcon(checkLightId) - } - - /** - * 关闭红绿灯预警展示,并重制灯态 - */ - override fun disableTrafficLight() { - super.disableTrafficLight() - UiThreadHandler.post { - mCurrentLightId = TrafficLightEnum.BLACK - this@TaxiPassengerTrafficLightView.visibility = GONE - } - } - - /** - * @param redNum 红灯倒计时 - * @param yellowNum 黄灯倒计时 - * @param greenNum 绿灯倒计时 - */ - override fun changeCountdownTrafficLightNum(redNum: Int, yellowNum: Int, greenNum: Int) { - super.changeCountdownTrafficLightNum(redNum, yellowNum, greenNum) - resetView() - when (mCurrentLightId) { - TrafficLightEnum.RED -> changeCountdownRed(redNum) - TrafficLightEnum.YELLOW -> changeCountdownYellow(yellowNum) - TrafficLightEnum.GREEN -> changeCountdownGreen(greenNum) - else -> UiThreadHandler.post { taxi_p_traffic_light_time_tv.text = "" } - } - } - - override fun changeCountdownRed(redNum: Int) { - super.changeCountdownRed(redNum) - UiThreadHandler.post { - if (redNum > 0) { - resetView() - taxi_p_traffic_light_time_tv.setVertrial(true) - taxi_p_traffic_light_time_tv.setmColorList( - intArrayOf( - resources.getColor(R.color.taxi_p_traffic_light_red_color_up), - resources.getColor(R.color.taxi_p_traffic_light_red_color_down) - ) - ) - taxi_p_traffic_light_time_tv.text = redNum.toString() - } else { - disableTrafficLightCountDown() - taxi_p_traffic_light_time_tv.text = "" - } - } - } - - override fun changeCountdownGreen(greenNum: Int) { - super.changeCountdownGreen(greenNum) - UiThreadHandler.post { - if (greenNum > 0) { - resetView() - taxi_p_traffic_light_time_tv.setVertrial(true) - taxi_p_traffic_light_time_tv.setmColorList( - intArrayOf( - resources.getColor(R.color.taxi_p_traffic_light_green_color_up), - resources.getColor(R.color.taxi_p_traffic_light_green_color_down) - ) - ) - taxi_p_traffic_light_time_tv.text = greenNum.toString() - } else { - disableTrafficLightCountDown() - taxi_p_traffic_light_time_tv.text = "" - } - } - } - - override fun changeCountdownYellow(yellowNum: Int) { - super.changeCountdownYellow(yellowNum) - UiThreadHandler.post { - if (yellowNum > 0) { - resetView() - taxi_p_traffic_light_time_tv.setVertrial(true) - taxi_p_traffic_light_time_tv.setmColorList( - intArrayOf( - resources.getColor(R.color.taxi_p_traffic_light_yellow_color_up), - resources.getColor(R.color.taxi_p_traffic_light_yellow_color_down) - ) - ) - taxi_p_traffic_light_time_tv.text = yellowNum.toString() - } else { - disableTrafficLightCountDown() - taxi_p_traffic_light_time_tv.text = "" - } - } - } - - /** - * 更新红绿灯icon - * - * @param lightId 0-都是默认,1-红,2-黄,3-绿 - */ - private fun updateTrafficLightIcon(lightId: TrafficLightEnum) { - UiThreadHandler.post { - when (lightId) { - TrafficLightEnum.RED -> { - taxi_p_traffic_light_iv.setBackgroundResource(R.drawable.taxi_p_light_red_nor) - this@TaxiPassengerTrafficLightView.visibility = VISIBLE - } - TrafficLightEnum.YELLOW -> { - taxi_p_traffic_light_iv.setBackgroundResource(R.drawable.taxi_p_lightyellow_nor) - this@TaxiPassengerTrafficLightView.visibility = VISIBLE - } - TrafficLightEnum.GREEN -> { - taxi_p_traffic_light_iv.setBackgroundResource(R.drawable.taxi_p_light_green_nor) - this@TaxiPassengerTrafficLightView.visibility = VISIBLE - } - else -> this@TaxiPassengerTrafficLightView.visibility = GONE - } - } - } - - override fun disableTrafficLightCountDown() { - super.disableTrafficLightCountDown() - UiThreadHandler.post { - val layoutParams = layoutParams - if (layoutParams is MarginLayoutParams) { - layoutParams.width = - resources.getDimension(R.dimen.taxi_p_traffic_light_icon_size).toInt() - setLayoutParams(layoutParams) - taxi_p_traffic_light_time_tv.visibility = GONE - taxi_p_traffic_light_bg.layoutParams.width = - resources.getDimension(R.dimen.dp_124).toInt() - } - } - } - - private fun resetView() { - val layoutParams = layoutParams - if (layoutParams is MarginLayoutParams) { - val lp = layoutParams - lp.width = resources.getDimension(R.dimen.taxi_p_traffic_light_layout_width).toInt() - setLayoutParams(lp) - taxi_p_traffic_light_time_tv.visibility = VISIBLE - taxi_p_traffic_light_bg.layoutParams.width = - resources.getDimension(R.dimen.taxi_p_traffic_light_bg_width).toInt() - } - } -} \ No newline at end of file diff --git a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/TaxiPassengerV2XNotificationView.java b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/TaxiPassengerV2XNotificationView.java deleted file mode 100644 index c05c0d4fad..0000000000 --- a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/TaxiPassengerV2XNotificationView.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.mogo.och.taxi.passenger.ui; - -import android.content.Context; -import android.graphics.drawable.Drawable; -import android.util.AttributeSet; -import android.view.Gravity; -import android.view.LayoutInflater; -import android.widget.ImageView; -import android.widget.TextView; - -import com.mogo.eagle.core.data.enums.SidePattern; -import com.mogo.eagle.core.function.api.hmi.view.IViewNotification; -import com.mogo.eagle.core.utilcode.util.UiThreadHandler; -import com.mogo.och.taxi.passenger.R; - -import org.jetbrains.annotations.Nullable; - -/** - * V2X预警事件view:通过FloatWindow呈现,无需加入到自定义layout中 - * - * Created on 2022/3/16 - */ -public class TaxiPassengerV2XNotificationView extends IViewNotification { - - private ImageView mV2XNotificationIcon; - private TextView mV2XNotificationText; - - public TaxiPassengerV2XNotificationView(@Nullable Context context) { - this(context, null, 0); - } - - public TaxiPassengerV2XNotificationView(@Nullable Context context, @Nullable AttributeSet attrs) { - this(context, attrs, 0); - } - - public TaxiPassengerV2XNotificationView(@Nullable Context context, @Nullable AttributeSet attrs, - int defStyleAttr) { - super(context, attrs, defStyleAttr); - init(context); - } - - private void init(Context context) { - LayoutInflater.from(context).inflate(R.layout.taxi_p_v2x_notification_view, this, - true); - - mV2XNotificationIcon = findViewById(R.id.taxi_p_v2x_notification_icon_iv); - mV2XNotificationText = findViewById(R.id.taxi_p_v2x_notification_text_tv); - - // 设置View的出场位置 - setSidePattern(SidePattern.LEFT); - setLayoutGravity(Gravity.LEFT | Gravity.TOP); - // 设置View的停留位置:相对屏幕左上角的位置 -// setOffsetX(getResources(). -// getDimensionPixelSize(R.dimen.taxi_p_v2x_notification_view_margin_left)); -// setOffsetY(getResources(). -// getDimensionPixelSize(R.dimen.taxi_p_v2x_notification_view_margin_top)); - setPadding(getResources(). - getDimensionPixelSize(R.dimen.taxi_p_v2x_notification_view_margin_left), getResources(). - getDimensionPixelSize(R.dimen.taxi_p_v2x_notification_view_margin_top), 0, 0); - } - - @Override - public void setWarningIcon(int warningIcon) { - super.setWarningIcon(warningIcon); - UiThreadHandler.post(() -> { - mV2XNotificationIcon.setImageResource(warningIcon); - }); - } - - @Override - public void setWarningIcon(@Nullable Drawable drawable) { - super.setWarningIcon(drawable); - UiThreadHandler.post(() -> { - mV2XNotificationIcon.setImageDrawable(drawable); - }); - } - - @Override - public void setWarningContent(@Nullable CharSequence warningContent) { - super.setWarningContent(warningContent); - UiThreadHandler.post(() -> { - mV2XNotificationText.setText(warningContent); - }); - } - - @Override - public void setWarningContent(int warningContentId) { - super.setWarningContent(warningContentId); - UiThreadHandler.post(() -> { - mV2XNotificationText.setText(warningContentId); - }); - } -} diff --git a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/video/VideoActivity.kt b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/video/VideoActivity.kt deleted file mode 100644 index c15fc585ee..0000000000 --- a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/video/VideoActivity.kt +++ /dev/null @@ -1,375 +0,0 @@ -package com.mogo.och.taxi.passenger.ui.video - -import android.content.Context -import android.content.Intent -import android.content.res.Resources -import android.graphics.Color -import android.net.Uri -import android.os.Bundle -import android.os.Looper -import android.view.View -import android.widget.TextView -import androidx.appcompat.app.AppCompatActivity -import androidx.appcompat.widget.AppCompatImageView -import androidx.constraintlayout.widget.ConstraintLayout -import androidx.recyclerview.widget.RecyclerView -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.bean.TaxiPassengerVideoPlay -import com.mogo.och.taxi.passenger.constant.TaxiPassengerConst -import com.mogo.och.taxi.passenger.event.FinishActivity -import com.mogo.och.taxi.passenger.ui.video.layoutmanage.CarouselLayoutManager -import com.mogo.och.taxi.passenger.ui.video.layoutmanage.CarouselZoomPostLayoutListener -import com.mogo.och.taxi.passenger.ui.video.layoutmanage.CenterScrollListener -import com.mogo.och.taxi.passenger.utils.FixMemoryLeak -import com.mogo.och.taxi.passenger.widget.ConsultVideoPlayer -import com.mogo.och.taxi.passenger.widget.indicator.IndicatorView -import com.mogo.och.taxi.passenger.widget.indicator.enums.IndicatorOrientation -import com.mogo.och.taxi.passenger.widget.indicator.enums.IndicatorSlideMode -import com.mogo.och.taxi.passenger.widget.indicator.enums.IndicatorStyle -import com.shuyu.gsyvideoplayer.video.base.GSYVideoView -import me.jessyan.autosize.AutoSizeCompat -import org.greenrobot.eventbus.EventBus -import org.greenrobot.eventbus.Subscribe -import org.greenrobot.eventbus.ThreadMode -import rx.Observable -import rx.Observer -import rx.Subscription -import rx.android.schedulers.AndroidSchedulers -import rx.schedulers.Schedulers -import java.util.concurrent.TimeUnit -import kotlin.math.floor - - -class VideoActivity : AppCompatActivity() { - - private var rvVideoPlaylist: RecyclerView? = null - private lateinit var indicatorView: IndicatorView - private lateinit var clContain: ConstraintLayout - private lateinit var acivTitleIcon: AppCompatImageView - private lateinit var tvTitle: TextView - private var subscribe: Subscription? = null - private val TAG = "mulprocessVideoActivity" - - private val arrayListOf = ArrayList() - - - companion object { - const val VIDEOTYPE = "VIDEOTYPE" - const val VIDEOTYPE_CONSULT = 0 - const val VIDEOTYPE_MOIES = 1 - const val VIDEOTYPE_CLOSE = 2 - - const val EVENT_FINISH = 0 - - fun startActivity(context: Context, videoType: Int, sumDis: Int) { - val intent = Intent(context, VideoActivity::class.java) - intent.putExtra(VIDEOTYPE, videoType) - intent.putExtra(TaxiPassengerConst.SP_KEY_ORDER_SUM_DIS, sumDis) - context.startActivity(intent) - } - } - - private var videotype = VIDEOTYPE_CONSULT - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - EventBus.getDefault().register(this) - setContentView(R.layout.taxi_p_arrived_mogo_consult) - initView() - configPage() - } - - override fun onNewIntent(intent: Intent?) { - super.onNewIntent(intent) - setIntent(intent) - configPage() - } - - private fun configPage() { - FullVideoUtils.dismissOverlayView(true) - releaseOnNewInstance() - when (intent.getIntExtra(VIDEOTYPE, VIDEOTYPE_CONSULT)) { - VIDEOTYPE_CONSULT -> { - videotype = VIDEOTYPE_CONSULT - acivTitleIcon.setImageResource(R.drawable.taxi_p_mogo_consult_title_icon) - tvTitle.text = "蘑菇资讯" - initConsultData() - } - VIDEOTYPE_MOIES -> { - videotype = VIDEOTYPE_MOIES - acivTitleIcon.setImageResource(R.drawable.taxi_p_mogo_movies_title_icon) - tvTitle.text = "影视娱乐" - initMoviesData() - } - } - initListener() - initData() - } - - private fun initConsultData() { - arrayListOf.clear() - arrayListOf.add( - TaxiPassengerVideoPlay( - "https://img.zhidaohulian.com/fileServer/online_car_hailing/1655708596763/全车型混剪增加红旗车队.m4v", - "https://img.zhidaohulian.com/fileServer/online_car_hailing/1655969511280/车队.png", - "蘑菇车联覆盖生活的方方面面" - ) - ) - arrayListOf.add( - TaxiPassengerVideoPlay( - "https://img.zhidaohulian.com/fileServer/online_car_hailing/1655708554279/红旗车队.m4v", - "https://img.zhidaohulian.com/fileServer/online_car_hailing/1655969553174/红旗重新排版.png", - "蘑菇车联之红旗车队" - ) - ) - arrayListOf.add( - TaxiPassengerVideoPlay( - "https://img.zhidaohulian.com/fileServer/online_car_hailing/1655708499497/大运会合作解说版.m4v", - "https://img.zhidaohulian.com/fileServer/online_car_hailing/1655969536177/大运会.png", - "蘑菇车联牵手成都大运会" - ) - ) - arrayListOf.add( - TaxiPassengerVideoPlay( - "https://img.zhidaohulian.com/fileServer/online_car_hailing/1655708409810/20210610重新排版3屏.m4v", - "https://img.zhidaohulian.com/fileServer/online_car_hailing/1655969579713/三屏.png", - "多视角体验蘑菇车联自动驾驶" - ) - ) - } - - private fun initMoviesData() { - arrayListOf.clear() - arrayListOf.add( - TaxiPassengerVideoPlay( - "https://img.zhidaohulian.com/fileServer/online_car_hailing/1656558672856/小宝宝.mp4", - "https://img.zhidaohulian.com/fileServer/online_car_hailing/1656559345882/1.png", - "小宝宝" - ) - ) - arrayListOf.add( - TaxiPassengerVideoPlay( - "https://img.zhidaohulian.com/fileServer/online_car_hailing/1656558697055/小猫.mp4", - "https://img.zhidaohulian.com/fileServer/online_car_hailing/1656559367261/2.png", - "小猫" - ) - ) - arrayListOf.add( - TaxiPassengerVideoPlay( - "https://img.zhidaohulian.com/fileServer/online_car_hailing/1656558730074/星空.mp4", - "https://img.zhidaohulian.com/fileServer/online_car_hailing/1656559406169/4.png", - "星空" - ) - ) - arrayListOf.add( - TaxiPassengerVideoPlay( - "https://img.zhidaohulian.com/fileServer/online_car_hailing/1656558644708/海浪.mp4", - "https://img.zhidaohulian.com/fileServer/online_car_hailing/1656559384635/3.png", - "星空" - ) - ) - } - - private fun initData() { - val carouselLayoutManager = CarouselLayoutManager(CarouselLayoutManager.HORIZONTAL, true) - carouselLayoutManager.setPostLayoutListener(CarouselZoomPostLayoutListener()) - carouselLayoutManager.maxVisibleItems = 1 - indicatorView.notifyDataChanged(arrayListOf.size) - indicatorView.setSlideMode(IndicatorSlideMode.SCALE) - indicatorView.setOrientation(IndicatorOrientation.INDICATOR_HORIZONTAL) - indicatorView.setIndicatorStyle(IndicatorStyle.ROUND_RECT) - indicatorView.setSliderColor( - Color.parseColor("#FFFFFF"), Color.parseColor("#26C5FD"), - Color.parseColor("#26C5FD") - ) - indicatorView.setSliderWidth(9f, 54f) - indicatorView.setSliderHeight(9f) - indicatorView.setSliderGap(36f) - rvVideoPlaylist?.addOnScrollListener(object : CenterScrollListener() { - var prePlayerPosition = 0 - override fun pageSelect(recyclerView: RecyclerView?, newState: Int) { - //播放视频 - val (centerItemPosition: Int, player) = getPlayer(carouselLayoutManager) - indicatorView.onPageSelected(centerItemPosition) - if (player is ConsultVideoPlayer) { - if (prePlayerPosition != centerItemPosition) { - if (player.currentState == GSYVideoView.CURRENT_STATE_PAUSE) { - player.onVideoReset() - } - val playerHolder = - carouselLayoutManager.findViewByPosition(prePlayerPosition) - val prePlayer = - playerHolder?.findViewById(R.id.video_item_player) - prePlayer?.onVideoReset() - val taxiPassengerVideoPlay = arrayListOf[centerItemPosition] - setBackageAndPlayNext(taxiPassengerVideoPlay) - } else { - player.onVideoResume(false) - } - } - prePlayerPosition = centerItemPosition - } - - override fun pageStop() { - val (_: Int, player) = getPlayer(carouselLayoutManager) - if (player is ConsultVideoPlayer) { - player.onVideoPause() - } - } - - }) - carouselLayoutManager.addOnDargAutoDiffListener { adapterPosition, currentPosition -> - val fl = adapterPosition - floor(adapterPosition) - var currentIndex = currentPosition - if (fl > 0.5) { - if (currentPosition == 0) { - currentIndex = rvVideoPlaylist?.adapter!!.itemCount - 1 - } else { - currentIndex -= 1 - } - } - indicatorView.onPageScrolled(currentIndex, fl, 0) - } - val recyclerVideoAdapter = RecyclerVideoAdapter(this, arrayListOf, rvVideoPlaylist) - recyclerVideoAdapter.setOnThumbImageClilckListener { - val (_: Int, player) = getPlayer(carouselLayoutManager) - if (player is ConsultVideoPlayer) { - player.onVideoReset() - player.thumbImageViewLayout.visibility = View.VISIBLE - } - rvVideoPlaylist?.smoothScrollToPosition(it) - } - rvVideoPlaylist?.layoutManager = carouselLayoutManager - rvVideoPlaylist?.setHasFixedSize(true) - rvVideoPlaylist?.adapter = recyclerVideoAdapter - } - - private fun getPlayer(carouselLayoutManager: CarouselLayoutManager): Pair { - val centerItemPosition: Int = carouselLayoutManager.centerItemPosition - val playerHolder = carouselLayoutManager.findViewByPosition(centerItemPosition) - val player = playerHolder?.findViewById(R.id.video_item_player) - return Pair(centerItemPosition, player) - } - - private fun initListener() { - } - - private fun initView() { - rvVideoPlaylist = findViewById(R.id.rv_video_playlist) - indicatorView = findViewById(R.id.indicatorView) - clContain = findViewById(R.id.cl_contain) - acivTitleIcon = findViewById(R.id.aciv_title_icon) - tvTitle = findViewById(R.id.tv_mogo_consult) - acivTitleIcon.setOnClickListener { - //finish() - } - } - - - private fun setBackageAndPlayNext(taxiPassengerVideoPlay: TaxiPassengerVideoPlay) { - // 设置背景图片 - } - - override fun onAttachedToWindow() { - super.onAttachedToWindow() - val sumDis = intent.getIntExtra(TaxiPassengerConst.SP_KEY_ORDER_SUM_DIS, 0) - FloatingDistanceInfoUtils.showOverlayView(this, sumDis = sumDis) - } - - override fun onResume() { - super.onResume() - val carouselLayoutManager = rvVideoPlaylist?.layoutManager as CarouselLayoutManager - val (centerItemPosition: Int, player) = getPlayer(carouselLayoutManager) - if (centerItemPosition < 0) { - setBackageAndPlayNext(arrayListOf[0]) - } - player?.let { - if (player.isIfCurrentIsFullscreen) {// 全屏了 - - } else { - when (player.currentState) { - GSYVideoView.CURRENT_STATE_PAUSE -> { - player.onVideoResume(false) - } - GSYVideoView.CURRENT_STATE_PLAYING -> { - } - else -> { - - } - } - } - - } - - } - - override fun onPause() { - super.onPause() - val carouselLayoutManager = rvVideoPlaylist?.layoutManager as CarouselLayoutManager - val (centerItemPosition: Int, player) = getPlayer(carouselLayoutManager) - player?.let { - if (player is ConsultVideoPlayer) { - // 离开应用 暂停视频 - // 关闭 onDetachedFromWindow 会reset - if (player.isIfCurrentIsFullscreen) {// 全屏了 - } else { - player.onVideoPause() - } - } - } - cancleSubscribe() - } - - @Subscribe(threadMode = ThreadMode.MAIN) - fun finishActivity(event: FinishActivity) { - CallerLogger.d(SceneConstant.M_TAXI_P + TAG, "finishActivity(event)") - cancleSubscribe() - val intent = Intent() - val parse = Uri.parse("mogo://launcher/main/switch2?type=launch") - intent.data = parse - intent.flags = Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP - startActivity(intent) - finish() - } - - override fun onDestroy() { - CallerLogger.d(SceneConstant.M_TAXI_P + TAG, "onDestroy()") - super.onDestroy() - EventBus.getDefault().unregister(this) - releaseOnNewInstance() - FloatingDistanceInfoUtils.dismissOverlayView() - FixMemoryLeak.fixLeak(this) - cancleSubscribe() - } - - private fun cancleSubscribe() { - subscribe?.let { - if (!it.isUnsubscribed) { - it.unsubscribe() - } - } - } - - private fun releaseOnNewInstance() { - if (rvVideoPlaylist != null && rvVideoPlaylist?.layoutManager != null) { - val carouselLayoutManager = rvVideoPlaylist?.layoutManager as CarouselLayoutManager - val (_: Int, player) = getPlayer(carouselLayoutManager) - player?.let { - player.currentPlayer.release() - player.onVideoReset() - } - } - FullVideoUtils.dismissOverlayView(true) - } - - override fun onBackPressed() {} - - override fun getResources(): Resources? { - if (Looper.myLooper() == Looper.getMainLooper()) { - AutoSizeCompat.autoConvertDensityOfGlobal(super.getResources()) - } - return super.getResources() - } -} \ No newline at end of file diff --git a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/widget/ConsultVideoPlayer.kt b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/widget/ConsultVideoPlayer.kt index 97a5c30bac..05b17cb50b 100644 --- a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/widget/ConsultVideoPlayer.kt +++ b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/widget/ConsultVideoPlayer.kt @@ -145,12 +145,10 @@ class ConsultVideoPlayer : StandardGSYVideoPlayer { override fun onWindowFocusChanged(hasWindowFocus: Boolean) { super.onWindowFocusChanged(hasWindowFocus) - if(isIfCurrentIsFullscreen&&smalllPlayer!=null){ - if(hasWindowFocus){//获取焦点 - onVideoResume() - }else{ - onVideoPause() - } + if(hasWindowFocus){//获取焦点 + onVideoResume() + }else{ + onVideoPause() } } diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/layout/taxi_p_arrived_mogo_consult.xml b/OCH/mogo-och-taxi-passenger/src/main/res/layout/taxi_p_arrived_mogo_consult.xml deleted file mode 100644 index 30c569cd84..0000000000 --- a/OCH/mogo-och-taxi-passenger/src/main/res/layout/taxi_p_arrived_mogo_consult.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/OCH/mogo-och-taxi-passenger/src/main/res/layout/taxi_p_base_fragment.xml b/OCH/mogo-och-taxi-passenger/src/main/res/layout/taxi_p_base_fragment.xml index 632bc4d995..7fd5dbf2fc 100644 --- a/OCH/mogo-och-taxi-passenger/src/main/res/layout/taxi_p_base_fragment.xml +++ b/OCH/mogo-och-taxi-passenger/src/main/res/layout/taxi_p_base_fragment.xml @@ -14,6 +14,10 @@ app:endPointDrawable="@drawable/taxi_p_map_view_dir_end" app:mapStyleExtraPath="style_extra.data" app:mapStylePath="style.data" + app:leftPadding="80" + app:rightPadding="80" + app:topPadding="120" + app:bottomPadding="160" /> @@ -108,14 +112,6 @@ app:user="taxi_p" /> - -