diff --git a/.gradle/5.6.4/executionHistory/executionHistory.bin b/.gradle/5.6.4/executionHistory/executionHistory.bin
index d512a7a..3fdc8da 100644
Binary files a/.gradle/5.6.4/executionHistory/executionHistory.bin and b/.gradle/5.6.4/executionHistory/executionHistory.bin differ
diff --git a/.gradle/5.6.4/executionHistory/executionHistory.lock b/.gradle/5.6.4/executionHistory/executionHistory.lock
index 8c9d276..b4e5333 100644
Binary files a/.gradle/5.6.4/executionHistory/executionHistory.lock and b/.gradle/5.6.4/executionHistory/executionHistory.lock differ
diff --git a/.gradle/5.6.4/fileHashes/fileHashes.bin b/.gradle/5.6.4/fileHashes/fileHashes.bin
index cac2a08..d24afcb 100644
Binary files a/.gradle/5.6.4/fileHashes/fileHashes.bin and b/.gradle/5.6.4/fileHashes/fileHashes.bin differ
diff --git a/.gradle/5.6.4/fileHashes/fileHashes.lock b/.gradle/5.6.4/fileHashes/fileHashes.lock
index 83d4f52..7e05775 100644
Binary files a/.gradle/5.6.4/fileHashes/fileHashes.lock and b/.gradle/5.6.4/fileHashes/fileHashes.lock differ
diff --git a/.gradle/5.6.4/fileHashes/resourceHashesCache.bin b/.gradle/5.6.4/fileHashes/resourceHashesCache.bin
index a9065bc..7cbf554 100644
Binary files a/.gradle/5.6.4/fileHashes/resourceHashesCache.bin and b/.gradle/5.6.4/fileHashes/resourceHashesCache.bin differ
diff --git a/.gradle/5.6.4/javaCompile/classAnalysis.bin b/.gradle/5.6.4/javaCompile/classAnalysis.bin
index 79466dd..387ece3 100644
Binary files a/.gradle/5.6.4/javaCompile/classAnalysis.bin and b/.gradle/5.6.4/javaCompile/classAnalysis.bin differ
diff --git a/.gradle/5.6.4/javaCompile/jarAnalysis.bin b/.gradle/5.6.4/javaCompile/jarAnalysis.bin
index bbdba0a..d8b46ec 100644
Binary files a/.gradle/5.6.4/javaCompile/jarAnalysis.bin and b/.gradle/5.6.4/javaCompile/jarAnalysis.bin differ
diff --git a/.gradle/5.6.4/javaCompile/javaCompile.lock b/.gradle/5.6.4/javaCompile/javaCompile.lock
index 9ce092f..501c4c7 100644
Binary files a/.gradle/5.6.4/javaCompile/javaCompile.lock and b/.gradle/5.6.4/javaCompile/javaCompile.lock differ
diff --git a/.gradle/5.6.4/javaCompile/taskHistory.bin b/.gradle/5.6.4/javaCompile/taskHistory.bin
index 207f61a..9f3bd47 100644
Binary files a/.gradle/5.6.4/javaCompile/taskHistory.bin and b/.gradle/5.6.4/javaCompile/taskHistory.bin differ
diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock
index ee174bb..4d75e78 100644
Binary files a/.gradle/buildOutputCleanup/buildOutputCleanup.lock and b/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ
diff --git a/.gradle/buildOutputCleanup/outputFiles.bin b/.gradle/buildOutputCleanup/outputFiles.bin
index 5145c6f..ab051f4 100644
Binary files a/.gradle/buildOutputCleanup/outputFiles.bin and b/.gradle/buildOutputCleanup/outputFiles.bin differ
diff --git a/.idea/libraries/Gradle__com_amitshekhar_android_debug_db_base_1_0_6_aar.xml b/.idea/libraries/Gradle__com_amitshekhar_android_debug_db_base_1_0_6_aar.xml
index 9aab57f..3fff01f 100644
--- a/.idea/libraries/Gradle__com_amitshekhar_android_debug_db_base_1_0_6_aar.xml
+++ b/.idea/libraries/Gradle__com_amitshekhar_android_debug_db_base_1_0_6_aar.xml
@@ -28,6 +28,12 @@
+
+
+
+
+
+
diff --git a/.idea/libraries/Gradle__com_facebook_stetho_stetho_1_5_1_aar.xml b/.idea/libraries/Gradle__com_facebook_stetho_stetho_1_5_1_aar.xml
index 8210167..4d19277 100644
--- a/.idea/libraries/Gradle__com_facebook_stetho_stetho_1_5_1_aar.xml
+++ b/.idea/libraries/Gradle__com_facebook_stetho_stetho_1_5_1_aar.xml
@@ -10,6 +10,9 @@
+
+
+
@@ -39,6 +42,15 @@
+
+
+
+
+
+
+
+
+
diff --git a/.idea/libraries/Gradle__com_github_yuweiguocn_GreenDaoUpgradeHelper_v2_2_1_aar.xml b/.idea/libraries/Gradle__com_github_yuweiguocn_GreenDaoUpgradeHelper_v2_2_1_aar.xml
index fbada33..51f425a 100644
--- a/.idea/libraries/Gradle__com_github_yuweiguocn_GreenDaoUpgradeHelper_v2_2_1_aar.xml
+++ b/.idea/libraries/Gradle__com_github_yuweiguocn_GreenDaoUpgradeHelper_v2_2_1_aar.xml
@@ -28,6 +28,15 @@
+
+
+
+
+
+
+
+
+
diff --git a/.idea/libraries/Gradle__com_orhanobut_logger_2_2_0_aar.xml b/.idea/libraries/Gradle__com_orhanobut_logger_2_2_0_aar.xml
index a8ce350..e527686 100644
--- a/.idea/libraries/Gradle__com_orhanobut_logger_2_2_0_aar.xml
+++ b/.idea/libraries/Gradle__com_orhanobut_logger_2_2_0_aar.xml
@@ -28,6 +28,15 @@
+
+
+
+
+
+
+
+
+
diff --git a/.idea/modules/app/taxiapp-ktl.app.iml b/.idea/modules/app/taxiapp-ktl.app.iml
index 9fc31d2..ffd8e70 100644
--- a/.idea/modules/app/taxiapp-ktl.app.iml
+++ b/.idea/modules/app/taxiapp-ktl.app.iml
@@ -31,7 +31,7 @@
-
+
@@ -94,10 +94,10 @@
-
+
-
+
diff --git a/.idea/modules/kurolibrary/taxiapp-ktl.kurolibrary.iml b/.idea/modules/kurolibrary/taxiapp-ktl.kurolibrary.iml
index e0c9a52..06795d9 100644
--- a/.idea/modules/kurolibrary/taxiapp-ktl.kurolibrary.iml
+++ b/.idea/modules/kurolibrary/taxiapp-ktl.kurolibrary.iml
@@ -32,7 +32,7 @@
-
+
@@ -87,11 +87,11 @@
-
-
-
-
+
+
+
+
diff --git a/.idea/modules/kurotool/taxiapp-ktl.kurotool.iml b/.idea/modules/kurotool/taxiapp-ktl.kurotool.iml
index 57efefa..192b1fc 100644
--- a/.idea/modules/kurotool/taxiapp-ktl.kurotool.iml
+++ b/.idea/modules/kurotool/taxiapp-ktl.kurotool.iml
@@ -32,7 +32,7 @@
-
+
@@ -89,10 +89,10 @@
-
-
+
+
diff --git a/app/build.gradle b/app/build.gradle
index b802971..8c678fe 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -21,8 +21,8 @@ android {
applicationId "net.sysolution.taxiapp"
minSdkVersion 21
targetSdkVersion 29
- versionCode 253
- versionName "3.3.3-beta26.4.1.2-release"
+ versionCode 256
+ versionName "3.3.3-beta26.4.1.5-release"
//alphaxx - 预览版本,不会对外发布,由测试人员测试,会有很多bug
//Betaxx - 公开测试版本,会发给其他工作人员,会有较多版本
@@ -64,6 +64,8 @@ android {
3.3.3-beta26.4.0.6-release 优化GPS,播放日志,运行时长上报功能
3.3.3-beta26.4.0.7-release 优化GPS上报,每次取250条数据,小于250条时等待8分钟后再次上传
3.3.3-beta26.4.1.2-release 修复收到的GPS卫星数量为0时频繁刷新问题
+ 3.3.3-beta26.4.1.4-release 有GPS日志时,每次100条以内的日志进行上报,上报成功继续上报剩余的日志,传完为止,上报失败或无gps日志时,每隔2分钟后重新监测日志进行上报
+ 3.3.3-beta26.4.1.5-release 修复有计次广告的时候重启后过了好几分钟才播的问题
**/
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
diff --git a/app/src/main/java/cn/trans88/taxiappkotlin/TaxiApp.kt b/app/src/main/java/cn/trans88/taxiappkotlin/TaxiApp.kt
index 5809d10..5f6d86a 100644
--- a/app/src/main/java/cn/trans88/taxiappkotlin/TaxiApp.kt
+++ b/app/src/main/java/cn/trans88/taxiappkotlin/TaxiApp.kt
@@ -75,8 +75,8 @@ class TaxiApp:Application() {
//gps日志定时器
var gpsTimer: Timer? = null
- //播放日志定时器
- var playerLogTimer: Timer? = null
+ //存储静止点坐标定时器
+ var quietGpsTimer: Timer? = null
//播放日志摘要定时器
var playerLogSummaryTimer: Timer? = null
diff --git a/app/src/main/java/cn/trans88/taxiappkotlin/logic/Repository.kt b/app/src/main/java/cn/trans88/taxiappkotlin/logic/Repository.kt
index 233afbd..b84e761 100644
--- a/app/src/main/java/cn/trans88/taxiappkotlin/logic/Repository.kt
+++ b/app/src/main/java/cn/trans88/taxiappkotlin/logic/Repository.kt
@@ -95,6 +95,7 @@ object Repository {
}
fun getTestPlayCircularList(): MutableList? {
+ "getTestPlayCircularList".logd()
//#edit by ljh @2023/2/23
//如果正在播放的是多时段的定时广告,则返回定时广告的播放列表,否则返回不定时的播放列表
val taxiApp:TaxiApp = TaxiApp.instance() as TaxiApp
@@ -107,48 +108,6 @@ object Repository {
return list
}
- fun getAdvertiseNext(): Advertise? {
-// return getPlayAdvertise(circularListMap[getPlayLevels()])
- val isTimedAdvertise = Configurations.config(taxiApp.activity).isTimedAdvertise
-// val advertise = getNextPlayAdvertise(myListMap[getTestPlayLevels()])
- val advertise = if (isTimedAdvertise){
- getNextPlayAdvertise(taxiApp.timedAds)
- } else {
- getNextPlayAdvertise(myListMap[getTestPlayLevels()])
- }
- "getAdvertiseNext() -> advertise:${advertise}".loge()
- return advertise
- }
-
- /**
- * 拿到将要播放的广告
- */
- private fun getNextPlayAdvertise(list: MutableList?): Advertise? {
- YoungUtil.YoungLog("getNextPlayAdvertise")
- var nextIndex = currentListOrder + 1
- list?.let {
- if (it.isEmpty()) {
- return null
- }
- for (index in 0..list.size) {
-
- //防止下标越界
- if (nextIndex >= list.size) {
- nextIndex = 0
- }
-
- //YoungUtil.YoungLog("当前播放的广告list位数 : $currentListOrder")
- val advertise = list[nextIndex]
-
- if (advertise.isAllowPlay()) {
- //YoungUtil.YoungLog("拿到广告花费时间 :${System.currentTimeMillis() - currentTimeMillis}")
- YoungUtil.YoungLog("拿到下一个广告:" + advertise.ad_id)
- return advertise
- }
- }
- }
- return null
- }
/**
@@ -214,43 +173,6 @@ object Repository {
return null
}
- /**
- * 拿到将要播放的广告
- */
- private fun getTestPlayAdvertiseByTempList(list: MutableList?): Advertise? {
- YoungUtil.YoungLog("getTestPlayAdvertiseByTempList")
- val currentTimeMillis = System.currentTimeMillis()
- list?.let {
- if (it.isEmpty()) {
- "播放列表是空的".loge()
- return null
- }
- //防止如果需求定点广告切换成普通广告,但是要继续上次普通广告的播放,然后现在的广告列表数改变,下标越界的情况
-// if(currentListOrder>=list.size){
-// currentListOrder=0
-// }
-
- for (index in 0..list.size) {
-
- //防止下标越界
- if (currentListOrder >= list.size) {
- currentListOrder = 0
- }
-
- //YoungUtil.YoungLog("当前播放的广告list位数 : $currentListOrder")
- val advertise = list[currentListOrder]
-
- if (advertise.isAllowPlay()) {
- //YoungUtil.YoungLog("拿到广告花费时间 :${System.currentTimeMillis() - currentTimeMillis}")
- YoungUtil.YoungLog("拿到广告:" + advertise.ad_id)
- return advertise
- }
- }
-
- }
- return null
- }
-
/**
* 拿到应该播放的等级
@@ -456,7 +378,7 @@ object Repository {
if (newAdvertise.isAllowPlay()) {
//#edit by ljh @2023/2/23 myListMap集合只存放不是定时插播的广告
if (!newAdvertise.isTimedAd){
- "广告准备ok 加入Mylist 广告ad_id:${newAdvertise.ad_id},是否是最后一个广告:${newAdvertise.isLast},belongto: ${newAdvertise.belongTo}".loge("Repository")
+ "广告准备ok 加入Mylist 广告ad_id:${newAdvertise.ad_id},是否是最后一个广告:${newAdvertise.isLast},belongto: ${newAdvertise.belongTo}".loge()
myListMap[newAdvertise.belongTo]?.add(newAdvertise)
} else if(isTimedAdNow && newAdvertise.isTimedAd && newAdvertise.is_exclusive) {
taxiApp.timedAds.forEach {
@@ -470,6 +392,8 @@ object Repository {
// myListMap[newAdvertise.belongTo]?.add(newAdvertise)
} else {
YoungUtil.YoungLog("广告不满足不加入播放列表:${newAdvertise.ad_id}")
+ //edit by ljh @2023/8/14
+ taxiApp.daoAds.clear()
}
}
} catch (e:Exception){
@@ -544,7 +468,7 @@ object Repository {
if (playViewModel == null) {
playViewModel = viewModel
}
- refreshMyList()
+// refreshMyList()
// refreshCircularList()
// playViewModel?.refreshAdvertise(getAdvertiseTEST())
playViewModel?.refreshAdvertise()
@@ -588,14 +512,16 @@ object Repository {
val syncTimeModel = getSyncSingleTime(currentSyncTime, getTestPlayCircularList())
YoungUtil.YoungLog("播放方式为同步播放,同步时间:${syncTimeModel.delay}=============================================")
val currentTimeMillis = System.currentTimeMillis()
- val advertise = getAdvertiseTEST()
+// val advertise = getAdvertiseTEST()
val getAdvertiseSyncTime = syncTimeModel.delay-(System.currentTimeMillis()-currentTimeMillis)
YoungUtil.YoungLog("获取到广告的时间 校准同步时间:$getAdvertiseSyncTime")
// handler.postDelayed(SyncTimerTask(playViewModel!!, advertise, syncTimeModel.currentPosition), syncTimeModel.delay)
+ "即将播放的视频索引:${syncTimeModel.currentPosition}".logd()
kuroTimer.cancel()
kuroTimer.purge()
kuroTimer = KuroTimer()
- kuroTimer.schedule(SyncTimerTask(playViewModel!!, advertise, syncTimeModel.currentPosition), syncTimeModel.delay)
+// kuroTimer.schedule(SyncTimerTask(playViewModel!!, advertise, syncTimeModel.currentPosition), syncTimeModel.delay)
+ kuroTimer.schedule(SyncTimerTask(playViewModel!!, null, syncTimeModel.currentPosition), syncTimeModel.delay)
} else {
//非同步播放或者定点播放
YoungUtil.YoungLog("播放方式为非同步播放")
diff --git a/app/src/main/java/cn/trans88/taxiappkotlin/logic/network/ConnManger.kt b/app/src/main/java/cn/trans88/taxiappkotlin/logic/network/ConnManger.kt
index 8130658..861da85 100644
--- a/app/src/main/java/cn/trans88/taxiappkotlin/logic/network/ConnManger.kt
+++ b/app/src/main/java/cn/trans88/taxiappkotlin/logic/network/ConnManger.kt
@@ -514,10 +514,10 @@ object ConnManger {
"启动发送坐标线程".logd()
sendGPSLogSwitch = true
while (true) {
- val locations = DaoUtil.getLocations()
- "locations size:${locations.size}".logd()
- if (locations.isNotEmpty()){
- val upLocations = DaoUtil.getLocationDao().queryBuilder().limit(250).build().list()
+// val locations = DaoUtil.getLocations()
+ val upLocations = DaoUtil.getLocationDao().queryBuilder().limit(100).build().list()
+ "locations size:${upLocations.size}".logd()
+ if (upLocations.isNotEmpty()){
val requestJson: String = ProcessingCommands.gson.toJson(upLocations)
"提交GPS数据 $requestJson".logd()
val parse = ("application/json;charset=UTF-8").toMediaTypeOrNull()
@@ -528,6 +528,7 @@ object ConnManger {
val request = Request.Builder()
.url(url)
.addHeader("Authorization", "Bearer ${Configurations.config(TaxiApp.instance()).appToken()}")
+// .addHeader("Accept-Encoding", "gzip")
.post(body)
.build()
val response = OkHttpTool.getInstance().client.newCall(request).execute()
@@ -537,58 +538,23 @@ object ConnManger {
DaoUtil.getLocationDao().deleteInTx(upLocations)
"删除GPS日志成功,upLocations.size:${upLocations.size}".logd()
- if(upLocations.size < 250) {
- Thread.sleep(8*60*1000L)
- }
+// if(upLocations.size < 250) {
+// Thread.sleep(8*60*1000L)
+// }
} else {
"上传GPS日志失败".loge()
- Thread.sleep(3*60*1000L)
+ Thread.sleep(2*60*1000L)
}
} catch (e: Exception) {
- "Exception:${e.message}".loge()
- Thread.sleep(3*60*1000L)
+ "up logs failed,Exception:${e.message}".loge()
+ Thread.sleep(2*60*1000L)
}
-// EasyHttp.post(url)
-// .readTimeOut(80*1000) //读超时80s,单位毫秒
-// .writeTimeOut(80*1000) //写超时80s,单位毫秒
-// .connectTimeout(80*1000) //连接超时80s,单位毫秒
-// .headers("Authorization", "Bearer ${Configurations.config(TaxiApp.instance()).appToken()}")
-// .requestBody(body)
-// .retryCount(5) //网络不好自动重试5次
-// .retryDelay(600) //本次请求重试延迟时间600ms
-// .syncRequest(true)//设置同步请求
-// .execute(object : SimpleCallBack(){
-// override fun onError(e: ApiException?) {
-// "上传GPS数据失败:${e?.message}".loge()
-// try {
-// Thread.sleep(3*60*1000L)
-// }catch (e: Exception) {
-// "${e?.message}".loge()
-// e.printStackTrace()
-// }
-// }
-//
-// override fun onSuccess(t: String?) {
-// "上传GPS数据成功 $t".loge()
-// DaoUtil.getLocationDao().deleteInTx(upLocations)
-// "删除GPS数据成功".logd()
-// }
-// })
-// if(upLocations.size<250) {
-// try {
-// Thread.sleep(8*60*1000L)
-// } catch (e: Exception) {
-// "${e?.message}".loge()
-// e.printStackTrace()
-// }
-// }
-
} else {
- "gps数据小于0条不上传,3分钟后再次查询".logd()
+ "gps数据小于0条不上传,2分钟后再次查询".logd()
try {
- Thread.sleep(3*60*1000L)
- }catch (e: Exception) {
+ Thread.sleep(2*60*1000L)
+ } catch (e: Exception) {
"${e?.message}".loge()
e.printStackTrace()
}
@@ -1018,25 +984,7 @@ object ConnManger {
}
- /**
- * 发送播放日志
- */
- fun sendLogger() {
- taxiApp.playerLogTimer?.let {
- it.cancel()
- it.purge()
- }
- //edit by yzd @20211201
- //if (Settings.loggerSwitch) {
- if (Configurations.config(TaxiApp.instance()).loggerSwitch()) {
- taxiApp.playerLogTimer = Timer()
- taxiApp.playerLogTimer?.schedule(object :TimerTask(){
- override fun run() {
- sendLoggerToWeb()
- }
- },5000,30000)
- }
- }
+
/**
* 提交播放日志
@@ -1048,10 +996,11 @@ object ConnManger {
"提交播放日志线程启动".logd()
sendPlayerLogSwitch = true
while (true){
- val playerLogs = DaoUtil.getPlayLoggers()
+// val playerLogs = DaoUtil.getPlayLoggers()
+ val playerLogs = DaoUtil.getPlayLogger().queryBuilder().limit(100).build().list()
"播放日志数据数量:${playerLogs.size}".logd()
if (playerLogs.size>10){
- EasyHttpTool.sendPlayLogToServer()
+ EasyHttpTool.sendPlayLogToServer(playerLogs)
} else {
try {
Thread.sleep(60*1000L)
diff --git a/app/src/main/java/cn/trans88/taxiappkotlin/logic/network/JoeyDownloadManager.java b/app/src/main/java/cn/trans88/taxiappkotlin/logic/network/JoeyDownloadManager.java
index 576d408..74160e7 100644
--- a/app/src/main/java/cn/trans88/taxiappkotlin/logic/network/JoeyDownloadManager.java
+++ b/app/src/main/java/cn/trans88/taxiappkotlin/logic/network/JoeyDownloadManager.java
@@ -40,7 +40,7 @@ public class JoeyDownloadManager {
private static IPlay iPlay;
//edit by ljh 2022/11/29
private static final int RETRY_TIMES = 600;
- private static int downloadCount =100;//重试的次数
+ private static int downloadCount = 100;//重试的次数
private static Application app;
// private LastThread lastThread = null;//执行最后一次
diff --git a/app/src/main/java/cn/trans88/taxiappkotlin/logic/network/ProcessingCommands.kt b/app/src/main/java/cn/trans88/taxiappkotlin/logic/network/ProcessingCommands.kt
index 65f63cb..483da4b 100644
--- a/app/src/main/java/cn/trans88/taxiappkotlin/logic/network/ProcessingCommands.kt
+++ b/app/src/main/java/cn/trans88/taxiappkotlin/logic/network/ProcessingCommands.kt
@@ -336,7 +336,7 @@ object ProcessingCommands {
Configurations.config(TaxiApp.instance()).loggerSwitchSave(true)
if (loggerInterval.interval > -1){
Configurations.config(TaxiApp.instance()).logIntervalSave(loggerInterval.interval)
- ConnManger.sendLogSummaryByInterval(loggerInterval.interval)
+// ConnManger.sendLogSummaryByInterval(loggerInterval.interval)
}
baseResponse.type = type
@@ -1036,7 +1036,7 @@ object ProcessingCommands {
"${task_id}计次播放,该广告播放次数为${sanleAdvertise.play_numbers}".logd()
}
- if (time_section != null && time_section.size>0){
+ if (time_section != null && time_section.size>0 && !isCount){
isTimedAd = true
"${task_id}是分时段播放广告".loge()
}
diff --git a/app/src/main/java/cn/trans88/taxiappkotlin/net/EasyHttpTool.kt b/app/src/main/java/cn/trans88/taxiappkotlin/net/EasyHttpTool.kt
index ab3cbd8..083081d 100644
--- a/app/src/main/java/cn/trans88/taxiappkotlin/net/EasyHttpTool.kt
+++ b/app/src/main/java/cn/trans88/taxiappkotlin/net/EasyHttpTool.kt
@@ -7,6 +7,7 @@ import cn.trans88.taxiappkotlin.ext.loge
import cn.trans88.taxiappkotlin.logic.dao.AdvertiseDao
import cn.trans88.taxiappkotlin.logic.dao.DaoUtil
import cn.trans88.taxiappkotlin.logic.dao.RunTimeDataDao
+import cn.trans88.taxiappkotlin.logic.model.PlayLogger
import cn.trans88.taxiappkotlin.logic.model.RunTimeData
import cn.trans88.taxiappkotlin.logic.model.RuntimeJson
import cn.trans88.taxiappkotlin.logic.network.ProcessingCommands
@@ -168,9 +169,8 @@ object EasyHttpTool {
/**
* 上传100条播放日志
*/
- fun sendPlayLogToServer(){
- val tenPlayLogs = DaoUtil.getPlayLogger().queryBuilder().limit(100).build().list()
- val logJson = ProcessingCommands.gson.toJson(tenPlayLogs)
+ fun sendPlayLogToServer(dbPlayerLogs:List){
+ val logJson = ProcessingCommands.gson.toJson(dbPlayerLogs)
"提交日志Json $logJson".logd()
val parse = ("application/json;charset=UTF-8").toMediaTypeOrNull()
val body = RequestBody.create(parse, logJson)
@@ -188,14 +188,14 @@ object EasyHttpTool {
"response body:${response?.body?.string().toString()}".logd()
if (response.isSuccessful){
"上传日志成功 ".logd()
- DaoUtil.getPlayLogger().deleteInTx(tenPlayLogs)
+ DaoUtil.getPlayLogger().deleteInTx(dbPlayerLogs)
"删除日志成功".logd()
} else {
"上传日志失败".loge()
Thread.sleep(60*1000L)
}
} catch (e: Exception) {
- "Exception:${e.message}".loge()
+ "提交失败Exception:${e.message}".loge()
Thread.sleep(60*1000L)
}
diff --git a/app/src/main/java/cn/trans88/taxiappkotlin/ui/play/PlayActivity.kt b/app/src/main/java/cn/trans88/taxiappkotlin/ui/play/PlayActivity.kt
index 0a8e7c4..a29b0bd 100644
--- a/app/src/main/java/cn/trans88/taxiappkotlin/ui/play/PlayActivity.kt
+++ b/app/src/main/java/cn/trans88/taxiappkotlin/ui/play/PlayActivity.kt
@@ -331,7 +331,7 @@ class PlayActivity : AppCompatActivity(), NetworkCallback, BusCallback, OnScreen
startRuntimeTimer()
}
DayType.IS_SECOND_DAY.ordinal -> {
- ConnManger.sendLogsSummary()
+// ConnManger.sendLogsSummary()
sendLogInterval()
//先计算上次重启前的运行时间
val lastSumTime = configurations.sumRunTime()
@@ -384,7 +384,7 @@ class PlayActivity : AppCompatActivity(), NetworkCallback, BusCallback, OnScreen
val logInterval = configurations.logInterval()
"logInterval:$logInterval".logd()
if (logInterval > 0){
- ConnManger.sendLogSummaryByInterval(logInterval)
+// ConnManger.sendLogSummaryByInterval(logInterval)
}
}
@@ -467,7 +467,7 @@ class PlayActivity : AppCompatActivity(), NetworkCallback, BusCallback, OnScreen
// }
if (DayType.IS_SECOND_DAY.ordinal == type) {
- ConnManger.sendLogsSummary()
+// ConnManger.sendLogsSummary()
val lastRunTime = endRuntime - startRuntime
val yesterdayRuntime = configurations.sumRunTime() + lastRunTime
@@ -672,9 +672,10 @@ class PlayActivity : AppCompatActivity(), NetworkCallback, BusCallback, OnScreen
*/
fun cancelCustomView(){
YoungUtil.YoungLog("取消自定义显示,路线、左转右转等..")
-
- ll_bus.visibility = View.GONE
- img_other_screen.visibility = View.GONE
+ runOnUiThread{
+ ll_bus.visibility = View.GONE
+ img_other_screen.visibility = View.GONE
+ }
fl_play.apply {
val logoView = this.findViewWithTag("logo")
diff --git a/app/src/main/java/cn/trans88/taxiappkotlin/ui/play/PlayViewModel.kt b/app/src/main/java/cn/trans88/taxiappkotlin/ui/play/PlayViewModel.kt
index 524df94..a73a757 100644
--- a/app/src/main/java/cn/trans88/taxiappkotlin/ui/play/PlayViewModel.kt
+++ b/app/src/main/java/cn/trans88/taxiappkotlin/ui/play/PlayViewModel.kt
@@ -85,6 +85,8 @@ import java.util.*
var isSendedLog: Boolean = true
//从缓存获取次数达到8888次后,从数据库获取一次数据,并更新缓存
const val MAX_CACHE: Int = 8888
+// 跳跃点的距离阈值,单位为米
+const val JUMP_THRESHOLD = 10000.0f
class PlayViewModel(val lifecycle: Lifecycle, private val fl_play: FrameLayout, private val imageView: ImageView) : ViewModel(), GpsInformationListener, IPlay, LifecycleObserver {
private val providerMap = HashMap()
@@ -504,6 +506,8 @@ class PlayViewModel(val lifecycle: Lifecycle, private val fl_play: FrameLayout,
if(!advertise.isCount){
setCurAdvertise(advertise)
+ } else {
+ curAdvertise = advertise
}
//edit by yzd @2022-09-09
@@ -598,17 +602,22 @@ class PlayViewModel(val lifecycle: Lifecycle, private val fl_play: FrameLayout,
//用来防止有多余的view没有删除。
if (fl_play.childCount > 1) {
- fl_play.post {
+ fl_play.postDelayed({
YoungUtil.YoungLog("删除View,FrameLayout有多少子视图:${fl_play.childCount}")
if (fl_play.childCount > 1) {
val childView = fl_play[0]
+ //edit by ljh on2024/5/9
+ if (childView is EmptyControlVideo) {
+ "上一个图层是软解码视图,释放资源,is EmptyControlVideo".loge()
+ childView.release()
+ }
if (childView != null) {
fl_play.removeView(childView)
}
}
- }
+ },2000L)
// fl_play.postDelayed({
// YoungUtil.YoungLog("删除View,FrameLayout有多少子视图:${fl_play.childCount}")
@@ -1073,6 +1082,12 @@ class PlayViewModel(val lifecycle: Lifecycle, private val fl_play: FrameLayout,
//edit by ljh@2023/8/22
if (distanceLocation > 20) {
// Log.d("LCT","DistanceUtil --> distanceLocation:$distanceLocation")
+ //edit by ljh@2024/5/9
+ taxiApp.quietGpsTimer?.apply {
+ cancel()
+ purge()
+ }
+ taxiApp.quietGpsTimer = null
// edit by yzd @20211201
// if (Settings.gpsSwitch) {
@@ -1096,13 +1111,14 @@ class PlayViewModel(val lifecycle: Lifecycle, private val fl_play: FrameLayout,
}
//过滤掉距离过大的数据,edit by ljh 2023/8/8
-// location.distance?.let {
-// if (it < 10000f){
-// DaoUtil.getLocationDao().insert(location)
-// }
-// }
- DaoUtil.getLocationDao().insert(location)
- curLocation = location
+ location.distance?.let {
+ if (it < JUMP_THRESHOLD){
+ DaoUtil.getLocationDao().insert(location)
+ // 如果不是跳跃点,更新上一个有效点的坐标
+ curLocation = location
+ }
+ }
+// DaoUtil.getLocationDao().insert(location)
//debug 将日志存卡里看location信息对不对
// taxiApp.saveLog(location.toString())
} else {
@@ -1127,7 +1143,22 @@ class PlayViewModel(val lifecycle: Lifecycle, private val fl_play: FrameLayout,
}
}
} else {
- YoungUtil.YoungLog("当前位置坐标距离上一个点小于20,不记录")
+ YoungUtil.YoungLog("当前位置坐标距离上一个点小于20")
+ //edit by ljh@2024/5/9
+ val lon = String.format("%.7f", longitude).toDouble()
+ val lat = String.format("%.7f", latitude).toDouble()
+ val location = Location().apply {
+ timestamp = System.currentTimeMillis()
+ setLongitude(lon)
+ setLatitude(lat)
+ setBearing(bearing)
+ setSpeed(speed)
+// val floatArray = FloatArray(1)
+// distanceBetween(curLocation?.latitude!!, curLocation?.longitude!!, latitude, longitude, floatArray)
+ distance = distanceLocation.toFloat()
+ elapse = timestamp - curLocation?.timestamp!!
+ }
+ saveQuietGPS(location)
return
}
} else {
@@ -1136,6 +1167,23 @@ class PlayViewModel(val lifecycle: Lifecycle, private val fl_play: FrameLayout,
}
}
+ /**
+ * 存储静止点
+ * @param location Location
+ */
+ private fun saveQuietGPS(location: Location) {
+ if (taxiApp.quietGpsTimer == null) {
+ "开启存储静止点的定时器".logd()
+ taxiApp.quietGpsTimer = Timer()
+ taxiApp.quietGpsTimer?.schedule(object :TimerTask(){
+ override fun run() {
+ "三分钟没收到非静止的点了,存储静止点:${location.timestamp}".logd()
+ DaoUtil.getLocationDao().insert(location)
+ }
+ },3*60*1000,3*60*1000)
+ }
+ }
+
/**
* 判断是否当前是否已经在播当前区域的定点广告
*/
diff --git a/app/src/main/java/cn/trans88/taxiappkotlin/ui/play/PlayerRule.kt b/app/src/main/java/cn/trans88/taxiappkotlin/ui/play/PlayerRule.kt
index b498f0b..65dcf70 100644
--- a/app/src/main/java/cn/trans88/taxiappkotlin/ui/play/PlayerRule.kt
+++ b/app/src/main/java/cn/trans88/taxiappkotlin/ui/play/PlayerRule.kt
@@ -4,6 +4,7 @@ import android.os.Handler
import cn.trans88.kurotool.util.TimeUtil
import cn.trans88.taxiappkotlin.ext.logd
import cn.trans88.taxiappkotlin.ext.loge
+import cn.trans88.taxiappkotlin.logic.Repository
import cn.trans88.taxiappkotlin.logic.dao.AdvertiseDao
import cn.trans88.taxiappkotlin.logic.dao.AdvertiseDao.Properties
import cn.trans88.taxiappkotlin.logic.dao.DaoUtil
@@ -91,6 +92,7 @@ fun Advertise.isAllowPlay(): Boolean {
if (advertise == null){
YoungUtil.YoungLog("广告已经下坎不再播放:${this.ad_id}")
+
return false
}
diff --git a/app/src/main/java/cn/trans88/taxiappkotlin/util/SyncUtil.kt b/app/src/main/java/cn/trans88/taxiappkotlin/util/SyncUtil.kt
index 19d68ef..759be95 100644
--- a/app/src/main/java/cn/trans88/taxiappkotlin/util/SyncUtil.kt
+++ b/app/src/main/java/cn/trans88/taxiappkotlin/util/SyncUtil.kt
@@ -118,9 +118,9 @@ object SyncUtil {
sum += advertise.duration.toInt()
- if (sum>=passModuleTime){
- currentPosition =index+1
- delay =sum -passModuleTime
+ if (sum >= passModuleTime){
+ currentPosition = index+1
+ delay = sum - passModuleTime
if (currentPosition >= list.size) {
YoungUtil.YoungLog("同步时当前播放广告位置大于列表长度,重置为0")
diff --git a/local.properties b/local.properties
index aad7036..a7e99fe 100644
--- a/local.properties
+++ b/local.properties
@@ -4,5 +4,5 @@
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
-#Thu Apr 18 17:50:04 GMT+08:00 2024
+#Tue May 21 14:20:34 GMT+08:00 2024
sdk.dir=D\:\\Android\\sdk
diff --git a/release/output.json b/release/output.json
index 8f70e2c..9dfc415 100644
--- a/release/output.json
+++ b/release/output.json
@@ -1 +1 @@
-[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":253,"versionName":"3.3.3-beta26.4.1.2-release","enabled":true,"outputFile":"TaxiApp_v3.3.3-beta26.4.1.2-release{253}.apk","fullName":"release","baseName":"release","dirName":""},"path":"TaxiApp_v3.3.3-beta26.4.1.2-release{253}.apk","properties":{}}]
\ No newline at end of file
+[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":256,"versionName":"3.3.3-beta26.4.1.5-release","enabled":true,"outputFile":"TaxiApp_v3.3.3-beta26.4.1.5-release{256}.apk","fullName":"release","baseName":"release","dirName":""},"path":"TaxiApp_v3.3.3-beta26.4.1.5-release{256}.apk","properties":{}}]
\ No newline at end of file