[M2] 1、注释定位频率设定 2、倒计时问题 3、M2 走马灯

This commit is contained in:
wangmingjun
2023-03-08 00:32:11 +08:00
parent 29ae93e933
commit fffe9d4187
10 changed files with 107 additions and 29 deletions

View File

@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mogo.och.bus.passenger">
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
</manifest>

View File

@@ -1,9 +1,5 @@
package com.mogo.och.bus.passenger.constant
import com.mogo.commons.debug.DebugConfig
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
/**
* Created on 2021/12/6
*/

View File

@@ -101,7 +101,7 @@ class PM2DrivingModel private constructor() {
// 定位监听
CallerChassisLocationGCJ02ListenerManager.addListener(TAG, mMapLocationListener)
CallerChassisLocationGCJ02ListenerManager.setListenerHz(TAG,2)//设置2hz, 1s返回2次
// CallerChassisLocationGCJ02ListenerManager.setListenerHz(TAG,2)//设置2hz, 1s返回2次
//司乘屏通信监听
CallerTelematicListenerManager.addListener(TAG,mReceivedMsgListener)

View File

@@ -84,11 +84,13 @@ class AdvanceGSYVideoPlayer: StandardGSYVideoPlayer {
//失去焦点声音压低
override fun onLossTransientCanDuck() {
// setStreamVolume(0.2f)
setNeedMute(true)
}
//获取焦点声音恢复
override fun onGankAudio() {
// setStreamVolume(5.0f)
setNeedMute(false)
}
private fun setStreamVolume(percent: Float){
@@ -100,4 +102,8 @@ class AdvanceGSYVideoPlayer: StandardGSYVideoPlayer {
}
mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC,volume,0)
}
private fun setNeedMute(isMute: Boolean){
gsyVideoManager?.player?.setNeedMute(isMute)
}
}

View File

@@ -2,24 +2,23 @@ package com.mogo.och.bus.passenger.ui.widget.video
import android.annotation.SuppressLint
import android.content.Context
import android.os.Environment
import android.util.AttributeSet
import android.widget.ImageView
import android.widget.RelativeLayout
import com.alibaba.idst.nui.FileUtil
import com.bumptech.glide.Glide
import com.bumptech.glide.request.RequestOptions
import com.mogo.eagle.core.utilcode.breakpoint.Config
import com.mogo.eagle.core.utilcode.breakpoint.bean.ThreadBean
import com.mogo.eagle.core.utilcode.breakpoint.callback.IDownload
import com.mogo.eagle.core.utilcode.breakpoint.utils.DownloadUtils
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
import com.mogo.eagle.core.utilcode.util.BitmapHelper
import com.mogo.eagle.core.utilcode.util.FileUtils
import com.mogo.eagle.core.utilcode.util.ThreadPoolService
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.och.bus.passenger.R
import com.mogo.och.common.module.utils.OCHThreadPoolManager
import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder
import com.shuyu.gsyvideoplayer.listener.GSYSampleCallBack
import java.io.File
import java.io.FilenameFilter
import java.lang.Exception
/**
@@ -38,8 +37,10 @@ class AdvanceVideoView @JvmOverloads constructor(
private var downloadVideoName = ""
private var fileNetPath: String? = ""
private var cacheImageUrl: String? = ""
private var mVideoDirPath: String? = ""
init {
mVideoDirPath = context.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS)?.absolutePath + File.separator
initView()
}
@@ -110,8 +111,12 @@ class AdvanceVideoView @JvmOverloads constructor(
fun clearLocalErrorVideo(){
if (downloadVideoName.isNotEmpty()
&& FileUtils.isFileExists(Config.downLoadPath + downloadVideoName)){
FileUtils.delete(Config.downLoadPath + downloadVideoName)
&& FileUtil.isFileExist(mVideoDirPath + downloadVideoName)){
FileUtil.delete(mVideoDirPath + downloadVideoName,object: FilenameFilter{
override fun accept(dir: File?, name: String?): Boolean {
return true
}
})
}
}
@@ -131,7 +136,11 @@ class AdvanceVideoView @JvmOverloads constructor(
mOnCompletionListener = onCompletionListener
//判断是否已经下载
if (downloadVideoName.isNotEmpty()){
if (FileUtils.isFileExists(Config.downLoadPath + downloadVideoName)){
Logger.d(ImageAndVideoRotation.TAG,
"video local url = $mVideoDirPath$downloadVideoName"
)
var file = File(mVideoDirPath,downloadVideoName)
if (file.exists()){
Logger.d(ImageAndVideoRotation.TAG, "have cache startPlay")
startPlay()
return
@@ -143,7 +152,7 @@ class AdvanceVideoView @JvmOverloads constructor(
private fun startDownLoadVideo(){
//下载视频, 下载成功后再播放
Logger.d(ImageAndVideoRotation.TAG, "startDownLoadVideo")
DownloadUtils.downLoad(context,fileNetPath, Config.downLoadPath
DownloadUtils.downLoad(context,fileNetPath,mVideoDirPath
,downloadVideoName,5,downListener)
}
@@ -151,7 +160,7 @@ class AdvanceVideoView @JvmOverloads constructor(
try {
Logger.d(ImageAndVideoRotation.TAG, "startPlay")
gsyVideoOptionBuilder = GSYVideoOptionBuilder()
gsyVideoOptionBuilder?.setUrl("file:///mnt/sdcard/downloads/$downloadVideoName")
gsyVideoOptionBuilder?.setUrl("file://$mVideoDirPath$downloadVideoName") // "/data/user/0/com.mogo.launcher.f/files/downloads/"
?.setPlayTag(downloadVideoName)
?.setCacheWithPlay(false)
?.setThumbPlay(false)
@@ -192,7 +201,7 @@ class AdvanceVideoView @JvmOverloads constructor(
}
override fun onProgress(url: String?, length: Int) {
// Logger.d(ImageAndVideoRotation.TAG, "download-onProgress")
Logger.d(ImageAndVideoRotation.TAG, "download-onProgress== $length")
}
override fun onFinished(url: String?, threadBean: ThreadBean?) {

View File

@@ -119,7 +119,7 @@
app:layout_constraintLeft_toLeftOf="@+id/speed_tv"
android:textColor="@color/m2_line_during_tv_color"/>
<com.mogo.och.common.module.wigets.MarqueeTextView
<com.mogo.och.common.module.wigets.MoreFocusMarqueeTextView
android:id="@+id/station_name_tv"
android:layout_width="0dp"
android:layout_height="wrap_content"
@@ -164,7 +164,7 @@
app:layout_constraintStart_toStartOf="@+id/speed_tv"
app:layout_constraintEnd_toEndOf="@+id/img_line_location_bg"/>
<androidx.appcompat.widget.AppCompatTextView
<TextView
android:id="@+id/no_line_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -176,7 +176,8 @@
app:layout_constraintLeft_toLeftOf="@+id/speed_tv"
android:textColor="@color/m2_no_line_tv_color"/>
<com.mogo.och.common.module.wigets.MarqueeTextView
<com.mogo.och.common.module.wigets.MoreFocusMarqueeTextView
android:id="@+id/line_name_tv"
android:layout_width="0dp"
android:layout_height="wrap_content"

View File

@@ -156,7 +156,7 @@ public class OrderModel {
loginService = (LoginService) ARouter.getInstance().build(OchCommonConst.LOGINSERVICE).navigation();
// 定位监听
CallerChassisLocationGCJ02ListenerManager.INSTANCE.addListener(TAG, mMapLocationListener);
CallerChassisLocationGCJ02ListenerManager.INSTANCE.setListenerHz(TAG,5);//设置5hz, 1s返回一次
// CallerChassisLocationGCJ02ListenerManager.INSTANCE.setListenerHz(TAG,2);//设置5hz, 1s返回一次
MogoStatusManager.getInstance().registerStatusChangedListener(TAG, StatusDescriptor.VR_MODE, mMogoStatusChangedListener);

View File

@@ -75,7 +75,11 @@ class DriverM1Fragment : CharterBaseFragment<DriverM1Fragment?, DriverM1Presente
}
fun updateCountDown(minutes: Long) {
startCountDownTimer(minutes,LOOP_PERIOD_60S)
if (minutes + LOOP_PERIOD_60S >= 0){
startCountDownTimer(minutes + LOOP_PERIOD_60S,LOOP_PERIOD_60S)
}else{
clearCountDownTimer()
}
}
override fun onDestroyView() {
@@ -165,10 +169,7 @@ class DriverM1Fragment : CharterBaseFragment<DriverM1Fragment?, DriverM1Presente
private fun startCountDownTimer(total: Long, countDownInterval:Long){
if (countDownTimer != null){
countDownTimer?.cancel()
countDownTimer = null
}
clearCountDownTimer()
countDownTimer = object : CountDownTimer(total,countDownInterval){
override fun onTick(millisUntilFinished: Long) {
var minute = millisUntilFinished/1000/60
@@ -189,4 +190,11 @@ class DriverM1Fragment : CharterBaseFragment<DriverM1Fragment?, DriverM1Presente
}.start()
}
private fun clearCountDownTimer() {
if (countDownTimer != null){
countDownTimer?.cancel()
countDownTimer = null
}
}
}

View File

@@ -107,7 +107,7 @@ class DriverM1Model {
mContext = context
// 定位监听
CallerChassisLocationGCJ02ListenerManager.addListener(TAG, mMapLocationListener)
CallerChassisLocationGCJ02ListenerManager.setListenerHz(TAG,2)
// CallerChassisLocationGCJ02ListenerManager.setListenerHz(TAG,2)
//开启自驾后 异常信息返回
OCHAdasAbilityManager.getInstance().setAdasStartFailureCallback(mAdasStartFailureListener)
@@ -655,9 +655,7 @@ class DriverM1Model {
}
d(SceneConstant.M_CHARTER_D,"checkOrderCountDown = "+ GsonUtils.toJson(data.data))
val gap = data.data.endTime - data.data.currentTime
if (gap >= 0){
mOrderCallback?.updateOverCountDown(gap)
}
mOrderCallback?.updateOverCountDown(gap)
}
override fun onFail(code: Int, msg: String?) {

View File

@@ -0,0 +1,58 @@
package com.mogo.och.common.module.wigets;
import android.content.Context;
import android.graphics.Rect;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.ViewDebug;
public class MoreFocusMarqueeTextView extends androidx.appcompat.widget.AppCompatTextView{
public MoreFocusMarqueeTextView(Context context) {
this(context, null);
}
public MoreFocusMarqueeTextView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public MoreFocusMarqueeTextView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
//设置文字内容超过textView宽度时候以跑马灯的形式
setEllipsize(TextUtils.TruncateAt.MARQUEE);
//设置焦点
setFocusable(true);
//设置触摸模式下是否可以获得焦点
setFocusableInTouchMode(true);
//设置跑马灯循环次数 -1为always 无限循环 3就是3次 4就是4次 0没试过
setMarqueeRepeatLimit(-1);
}
@Override
@ViewDebug.ExportedProperty(category = "focus")
public boolean isFocused() {
return true;
}
@Override
protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) {
if (focused)
super.onFocusChanged(true, direction, previouslyFocusedRect);
}
@Override
public void onWindowFocusChanged(boolean hasWindowFocus) {
if (hasWindowFocus){}
super.onWindowFocusChanged(true);
}
@Override
@ViewDebug.ExportedProperty
public boolean isSelected() {
return true;
}
}