diff --git a/.gradle/5.6.4/executionHistory/executionHistory.bin b/.gradle/5.6.4/executionHistory/executionHistory.bin
index a18d586..dc60665 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 e2f8a32..a373e32 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/fileContent/fileContent.lock b/.gradle/5.6.4/fileContent/fileContent.lock
index 1f7a89f..3be010a 100644
Binary files a/.gradle/5.6.4/fileContent/fileContent.lock and b/.gradle/5.6.4/fileContent/fileContent.lock differ
diff --git a/.gradle/5.6.4/fileHashes/fileHashes.bin b/.gradle/5.6.4/fileHashes/fileHashes.bin
index de42c52..af39b31 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 114a835..a682a41 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 d55c32e..eb300c5 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 78aa09a..10a254f 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 6a5948e..00f2d0c 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 cfd0ece..11fb4bb 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 320fc87..94e7268 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 236e0a4..4d49910 100644
Binary files a/.gradle/buildOutputCleanup/buildOutputCleanup.lock and b/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ
diff --git a/.gradle/buildOutputCleanup/cache.properties b/.gradle/buildOutputCleanup/cache.properties
index 262375e..050b5c4 100644
--- a/.gradle/buildOutputCleanup/cache.properties
+++ b/.gradle/buildOutputCleanup/cache.properties
@@ -1,2 +1,2 @@
-#Thu Sep 14 18:07:54 GMT+08:00 2023
+#Mon Mar 04 15:33:52 GMT+08:00 2024
gradle.version=5.6.4
diff --git a/.gradle/buildOutputCleanup/outputFiles.bin b/.gradle/buildOutputCleanup/outputFiles.bin
index 22e3ddf..80631de 100644
Binary files a/.gradle/buildOutputCleanup/outputFiles.bin and b/.gradle/buildOutputCleanup/outputFiles.bin differ
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
index fb7f4a8..61a9130 100644
--- a/.idea/compiler.xml
+++ b/.idea/compiler.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
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 e5e1578..e726093 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
@@ -19,6 +19,12 @@
+
+
+
+
+
+
diff --git a/.idea/libraries/Gradle__com_andkulikov_transitionseverywhere_2_0_0_beta01_aar.xml b/.idea/libraries/Gradle__com_andkulikov_transitionseverywhere_2_0_0_beta01_aar.xml
new file mode 100644
index 0000000..39566e8
--- /dev/null
+++ b/.idea/libraries/Gradle__com_andkulikov_transitionseverywhere_2_0_0_beta01_aar.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
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 cd3fd47..ad9bf9e 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
@@ -7,6 +7,8 @@
+
+
@@ -27,6 +29,12 @@
+
+
+
+
+
+
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 c2169c8..25ed522 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
@@ -19,6 +19,12 @@
+
+
+
+
+
+
diff --git a/.idea/libraries/Gradle__com_google_android_exoplayer_exoplayer_r1_5_11_aar.xml b/.idea/libraries/Gradle__com_google_android_exoplayer_exoplayer_r1_5_11_aar.xml
new file mode 100644
index 0000000..44bb24f
--- /dev/null
+++ b/.idea/libraries/Gradle__com_google_android_exoplayer_exoplayer_r1_5_11_aar.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__com_jakewharton_disklrucache_2_0_2.xml b/.idea/libraries/Gradle__com_jakewharton_disklrucache_2_0_2.xml
new file mode 100644
index 0000000..6b3961f
--- /dev/null
+++ b/.idea/libraries/Gradle__com_jakewharton_disklrucache_2_0_2.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
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 55cd282..1e904ea 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
@@ -19,6 +19,12 @@
+
+
+
+
+
+
diff --git a/.idea/libraries/Gradle__com_shuyu_gsyVideoPlayer_arm64_8_1_2_aar.xml b/.idea/libraries/Gradle__com_shuyu_gsyVideoPlayer_arm64_8_1_2_aar.xml
new file mode 100644
index 0000000..0a6fe1b
--- /dev/null
+++ b/.idea/libraries/Gradle__com_shuyu_gsyVideoPlayer_arm64_8_1_2_aar.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__com_shuyu_gsyVideoPlayer_armv5_8_1_2_aar.xml b/.idea/libraries/Gradle__com_shuyu_gsyVideoPlayer_armv5_8_1_2_aar.xml
new file mode 100644
index 0000000..24078c1
--- /dev/null
+++ b/.idea/libraries/Gradle__com_shuyu_gsyVideoPlayer_armv5_8_1_2_aar.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__com_shuyu_gsyVideoPlayer_armv7a_8_1_2_aar.xml b/.idea/libraries/Gradle__com_shuyu_gsyVideoPlayer_armv7a_8_1_2_aar.xml
new file mode 100644
index 0000000..57e48f3
--- /dev/null
+++ b/.idea/libraries/Gradle__com_shuyu_gsyVideoPlayer_armv7a_8_1_2_aar.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__com_shuyu_gsyVideoPlayer_base_8_1_2_aar.xml b/.idea/libraries/Gradle__com_shuyu_gsyVideoPlayer_base_8_1_2_aar.xml
new file mode 100644
index 0000000..e107f8d
--- /dev/null
+++ b/.idea/libraries/Gradle__com_shuyu_gsyVideoPlayer_base_8_1_2_aar.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__com_shuyu_gsyVideoPlayer_java_8_1_2_aar.xml b/.idea/libraries/Gradle__com_shuyu_gsyVideoPlayer_java_8_1_2_aar.xml
new file mode 100644
index 0000000..73434da
--- /dev/null
+++ b/.idea/libraries/Gradle__com_shuyu_gsyVideoPlayer_java_8_1_2_aar.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__com_shuyu_gsyVideoPlayer_x64_8_1_2_aar.xml b/.idea/libraries/Gradle__com_shuyu_gsyVideoPlayer_x64_8_1_2_aar.xml
new file mode 100644
index 0000000..1fe4259
--- /dev/null
+++ b/.idea/libraries/Gradle__com_shuyu_gsyVideoPlayer_x64_8_1_2_aar.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__com_shuyu_gsyVideoPlayer_x86_8_1_2_aar.xml b/.idea/libraries/Gradle__com_shuyu_gsyVideoPlayer_x86_8_1_2_aar.xml
new file mode 100644
index 0000000..826b547
--- /dev/null
+++ b/.idea/libraries/Gradle__com_shuyu_gsyVideoPlayer_x86_8_1_2_aar.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__com_shuyu_gsyvideoplayer_androidvideocache_8_1_2_aar.xml b/.idea/libraries/Gradle__com_shuyu_gsyvideoplayer_androidvideocache_8_1_2_aar.xml
new file mode 100644
index 0000000..de05a6a
--- /dev/null
+++ b/.idea/libraries/Gradle__com_shuyu_gsyvideoplayer_androidvideocache_8_1_2_aar.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__com_zhouyou_rxeasyhttp_2_1_5_aar.xml b/.idea/libraries/Gradle__com_zhouyou_rxeasyhttp_2_1_5_aar.xml
new file mode 100644
index 0000000..8089807
--- /dev/null
+++ b/.idea/libraries/Gradle__com_zhouyou_rxeasyhttp_2_1_5_aar.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__tv_danmaku_ijk_media_ijkplayer_exo_0_8_8_aar.xml b/.idea/libraries/Gradle__tv_danmaku_ijk_media_ijkplayer_exo_0_8_8_aar.xml
new file mode 100644
index 0000000..7afbfcb
--- /dev/null
+++ b/.idea/libraries/Gradle__tv_danmaku_ijk_media_ijkplayer_exo_0_8_8_aar.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Gradle__tv_danmaku_ijk_media_ijkplayer_java_0_8_8_aar.xml b/.idea/libraries/Gradle__tv_danmaku_ijk_media_ijkplayer_java_0_8_8_aar.xml
new file mode 100644
index 0000000..cd6664c
--- /dev/null
+++ b/.idea/libraries/Gradle__tv_danmaku_ijk_media_ijkplayer_java_0_8_8_aar.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 8482e52..87da9c4 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -9,7 +9,7 @@
-
+
diff --git a/.idea/modules/app/taxiapp-ktl.app.iml b/.idea/modules/app/taxiapp-ktl.app.iml
index 832d093..7b306fc 100644
--- a/.idea/modules/app/taxiapp-ktl.app.iml
+++ b/.idea/modules/app/taxiapp-ktl.app.iml
@@ -31,7 +31,7 @@
-
+
@@ -94,11 +94,11 @@
-
-
-
+
+
+
@@ -147,12 +147,14 @@
+
+
@@ -168,6 +170,8 @@
+
+
@@ -201,6 +205,16 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/.idea/modules/kurolibrary/taxiapp-ktl.kurolibrary.iml b/.idea/modules/kurolibrary/taxiapp-ktl.kurolibrary.iml
index e505853..e0c9a52 100644
--- a/.idea/modules/kurolibrary/taxiapp-ktl.kurolibrary.iml
+++ b/.idea/modules/kurolibrary/taxiapp-ktl.kurolibrary.iml
@@ -88,10 +88,10 @@
-
+
diff --git a/.idea/modules/kurotool/taxiapp-ktl.kurotool.iml b/.idea/modules/kurotool/taxiapp-ktl.kurotool.iml
index 2d5d1e4..57efefa 100644
--- a/.idea/modules/kurotool/taxiapp-ktl.kurotool.iml
+++ b/.idea/modules/kurotool/taxiapp-ktl.kurotool.iml
@@ -89,11 +89,11 @@
-
-
-
-
+
+
+
+
diff --git a/app/build.gradle b/app/build.gradle
index fc8b9e8..efe13df 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -21,8 +21,8 @@ android {
applicationId "net.sysolution.taxiapp"
minSdkVersion 21
targetSdkVersion 29
- versionCode 244
- versionName "3.3.3-beta26.4.0.1-release"
+ versionCode 249
+ versionName "3.3.3-beta26.4.0.8-debug"
//alphaxx - 预览版本,不会对外发布,由测试人员测试,会有很多bug
//Betaxx - 公开测试版本,会发给其他工作人员,会有较多版本
@@ -60,7 +60,9 @@ android {
26.3.9.96 播放时长为广告素材的播放时长
26.3.9.98 记录taxiApp当天的运行时间
26.3.9.99 优化日志上传,改为一天只传一次昨天的播放记录。
- 优化定点广告频繁切换会出现黑屏问题
+ 优化定点广告频z繁切换会出现黑屏问题
+ 3.3.3-beta26.4.0.6-release 优化GPS,播放日志,运行时长上报功能
+ 3.3.3-beta26.4.0.7-release 优化GPS上报,每次取250条数据,小于250条时等待8分钟后再次上传
**/
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -113,7 +115,7 @@ android {
//每升级一次数据库加一
greendao {
- schemaVersion 44
+ schemaVersion 46
daoPackage 'cn.trans88.taxiappkotlin.logic.dao'
targetGenDir 'src/main/java'
}
@@ -207,4 +209,14 @@ dependencies {
// implementation 'com.google.android.exoplayer:exoplayer-ui:2.14.2'
// implementation 'com.github.Trans88:KuroLibrary:0.1.3'
+ implementation 'com.zhouyou:rxeasyhttp:2.1.5'
+
+ implementation 'com.shuyu:gsyVideoPlayer-java:8.1.2'
+
+ //根据你的需求ijk模式的so
+ implementation 'com.shuyu:gsyVideoPlayer-armv5:8.1.2'
+ implementation 'com.shuyu:gsyVideoPlayer-armv7a:8.1.2'
+ implementation 'com.shuyu:gsyVideoPlayer-arm64:8.1.2'
+ implementation 'com.shuyu:gsyVideoPlayer-x64:8.1.2'
+ implementation 'com.shuyu:gsyVideoPlayer-x86:8.1.2'
}
diff --git a/app/src/main/java/cn/trans88/taxiappkotlin/Configurations.java b/app/src/main/java/cn/trans88/taxiappkotlin/Configurations.java
index 10dbf59..76aa19f 100644
--- a/app/src/main/java/cn/trans88/taxiappkotlin/Configurations.java
+++ b/app/src/main/java/cn/trans88/taxiappkotlin/Configurations.java
@@ -351,6 +351,18 @@ public class Configurations {
context.getSharedPreferences("config", Context.MODE_PRIVATE).edit().putBoolean("isCustomLogo", b).apply();
}
+ /**
+ * 是否使用软解码
+ * @return
+ */
+ public boolean isSoftDecode(){
+ return context.getSharedPreferences("config", Context.MODE_PRIVATE).getBoolean("isSoftDecode", false);
+ }
+
+ public void isSoftDecodeSave(Boolean b){
+ context.getSharedPreferences("config", Context.MODE_PRIVATE).edit().putBoolean("isSoftDecode", b).apply();
+ }
+
/**
* taxiApp开始运行时间
* @return
@@ -375,16 +387,28 @@ public class Configurations {
context.getSharedPreferences("config", Context.MODE_PRIVATE).edit().putLong("endRunTime", startTime).apply();
}
+ /**
+ * taxiApp每次启动的总运行时间
+ * @return
+ */
+ public Long sumRunTime(){
+ return context.getSharedPreferences("config", Context.MODE_PRIVATE).getLong("sumRunTime",0);
+ }
+
+ public void sumRunTimeSave(long runtime){
+ context.getSharedPreferences("config", Context.MODE_PRIVATE).edit().putLong("sumRunTime", runtime).apply();
+ }
+
/**
* taxiApp当天总的运行时间
* @return
*/
- public long sumRunTime(){
- return context.getSharedPreferences("config", Context.MODE_PRIVATE).getLong("sumRunTime",0L);
+ public Long todaySumRunTime(){
+ return context.getSharedPreferences("config", Context.MODE_PRIVATE).getLong("todaySumRunTime",0);
}
- public void sumRunTimeSave(Long startTime){
- context.getSharedPreferences("config", Context.MODE_PRIVATE).edit().putLong("sumRunTime", startTime).apply();
+ public void todaySumRunTimeSave(long runtime){
+ context.getSharedPreferences("config", Context.MODE_PRIVATE).edit().putLong("todaySumRunTime", runtime).apply();
}
public String runtimeJsonString(){
diff --git a/app/src/main/java/cn/trans88/taxiappkotlin/TaxiApp.kt b/app/src/main/java/cn/trans88/taxiappkotlin/TaxiApp.kt
index fa76df5..c97f8ef 100644
--- a/app/src/main/java/cn/trans88/taxiappkotlin/TaxiApp.kt
+++ b/app/src/main/java/cn/trans88/taxiappkotlin/TaxiApp.kt
@@ -26,9 +26,14 @@ import cn.trans88.taxiappkotlin.util.KuroTimer
import cn.trans88.taxiappkotlin.util.YoungUtil
import com.facebook.stetho.Stetho
import com.google.gson.Gson
+import com.shuyu.gsyvideoplayer.player.IjkPlayerManager
+import com.shuyu.gsyvideoplayer.player.PlayerFactory
+import com.shuyu.gsyvideoplayer.utils.GSYVideoType
import com.trs88.kurolibrary.log.*
import com.trs88.kurolibrary.restful.retrofit.KuroApiFactory
+import com.zhouyou.http.EasyHttp
import io.reactivex.plugins.RxJavaPlugins
+import tv.danmaku.ijk.media.player.IjkMediaPlayer
import java.io.*
import java.util.*
import java.util.concurrent.CopyOnWriteArrayList
@@ -81,6 +86,9 @@ class TaxiApp:Application() {
var isPositionRefresh = false
+ //是否软解码
+ var isSoftDecode = false
+
companion object{
private var instance:Application? =null
fun instance() = instance!!
@@ -115,12 +123,18 @@ class TaxiApp:Application() {
override fun onCreate() {
super.onCreate()
instance = this
+ PlayerFactory.setPlayManager(IjkPlayerManager::class.java) //ijk模式
+ GSYVideoType.setShowType(GSYVideoType.SCREEN_MATCH_FULL)
+ //关闭IJK日志
+ IjkPlayerManager.setLogLevel(IjkMediaPlayer.IJK_LOG_SILENT)
val helperDaoDB = HelperDaoDB(this, "taxi-app-database.db", null)
val db = helperDaoDB.writableDatabase
daoMaster = DaoMaster(db)
daoSession = daoMaster.newSession()
+
+ EasyHttp.init(this)
//add by yzd @20211130 用config替换原有的配置文件
Configurations.config(this).init();
//初始化异常捕捉 //yzd 注释于20211110
diff --git a/app/src/main/java/cn/trans88/taxiappkotlin/aidl/localserver/TaxiServiceAIDL.kt b/app/src/main/java/cn/trans88/taxiappkotlin/aidl/localserver/TaxiServiceAIDL.kt
index a80ee42..33773a8 100644
--- a/app/src/main/java/cn/trans88/taxiappkotlin/aidl/localserver/TaxiServiceAIDL.kt
+++ b/app/src/main/java/cn/trans88/taxiappkotlin/aidl/localserver/TaxiServiceAIDL.kt
@@ -63,11 +63,11 @@ class TaxiServiceAIDL:Service() {
when (type) {
"BindAccount" -> {
val bindModel = Gson().fromJson(jsonString, BindModel::class.java)
- if (bindModel.server!=null && bindModel.server!=""){
- bindModel.server =bindModel.server+"/"
+ if (bindModel.server != null && bindModel.server!=""){
+ bindModel.server = bindModel.server+"/"
}
- if (bindModel.server!=null && bindModel.server!=""){
+ if (bindModel.server != null && bindModel.server!=""){
bindModel.tlsServer = bindModel.tlsServer+"/"
}
diff --git a/app/src/main/java/cn/trans88/taxiappkotlin/logic/dao/DaoMaster.java b/app/src/main/java/cn/trans88/taxiappkotlin/logic/dao/DaoMaster.java
index 21a48cc..4454b9c 100644
--- a/app/src/main/java/cn/trans88/taxiappkotlin/logic/dao/DaoMaster.java
+++ b/app/src/main/java/cn/trans88/taxiappkotlin/logic/dao/DaoMaster.java
@@ -14,10 +14,10 @@ import org.greenrobot.greendao.identityscope.IdentityScopeType;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
- * Master of DAO (schema version 44): knows all DAOs.
+ * Master of DAO (schema version 46): knows all DAOs.
*/
public class DaoMaster extends AbstractDaoMaster {
- public static final int SCHEMA_VERSION = 44;
+ public static final int SCHEMA_VERSION = 46;
/** Creates underlying database table using DAOs. */
public static void createAllTables(Database db, boolean ifNotExists) {
@@ -29,6 +29,7 @@ public class DaoMaster extends AbstractDaoMaster {
PlayLoggerDao.createTable(db, ifNotExists);
PositionAdvertiseDao.createTable(db, ifNotExists);
RegionsDao.createTable(db, ifNotExists);
+ RunTimeDataDao.createTable(db, ifNotExists);
SanleAdvertiseDao.createTable(db, ifNotExists);
ScheduleDao.createTable(db, ifNotExists);
SectionDao.createTable(db, ifNotExists);
@@ -46,6 +47,7 @@ public class DaoMaster extends AbstractDaoMaster {
PlayLoggerDao.dropTable(db, ifExists);
PositionAdvertiseDao.dropTable(db, ifExists);
RegionsDao.dropTable(db, ifExists);
+ RunTimeDataDao.dropTable(db, ifExists);
SanleAdvertiseDao.dropTable(db, ifExists);
ScheduleDao.dropTable(db, ifExists);
SectionDao.dropTable(db, ifExists);
@@ -77,6 +79,7 @@ public class DaoMaster extends AbstractDaoMaster {
registerDaoClass(PlayLoggerDao.class);
registerDaoClass(PositionAdvertiseDao.class);
registerDaoClass(RegionsDao.class);
+ registerDaoClass(RunTimeDataDao.class);
registerDaoClass(SanleAdvertiseDao.class);
registerDaoClass(ScheduleDao.class);
registerDaoClass(SectionDao.class);
diff --git a/app/src/main/java/cn/trans88/taxiappkotlin/logic/dao/DaoSession.java b/app/src/main/java/cn/trans88/taxiappkotlin/logic/dao/DaoSession.java
index c77101d..6a707ee 100644
--- a/app/src/main/java/cn/trans88/taxiappkotlin/logic/dao/DaoSession.java
+++ b/app/src/main/java/cn/trans88/taxiappkotlin/logic/dao/DaoSession.java
@@ -16,6 +16,7 @@ import cn.trans88.taxiappkotlin.logic.model.Order;
import cn.trans88.taxiappkotlin.logic.model.PlayLogger;
import cn.trans88.taxiappkotlin.logic.model.PositionAdvertise;
import cn.trans88.taxiappkotlin.logic.model.Regions;
+import cn.trans88.taxiappkotlin.logic.model.RunTimeData;
import cn.trans88.taxiappkotlin.logic.model.SanleAdvertise;
import cn.trans88.taxiappkotlin.logic.model.Schedule;
import cn.trans88.taxiappkotlin.logic.model.Section;
@@ -30,6 +31,7 @@ import cn.trans88.taxiappkotlin.logic.dao.OrderDao;
import cn.trans88.taxiappkotlin.logic.dao.PlayLoggerDao;
import cn.trans88.taxiappkotlin.logic.dao.PositionAdvertiseDao;
import cn.trans88.taxiappkotlin.logic.dao.RegionsDao;
+import cn.trans88.taxiappkotlin.logic.dao.RunTimeDataDao;
import cn.trans88.taxiappkotlin.logic.dao.SanleAdvertiseDao;
import cn.trans88.taxiappkotlin.logic.dao.ScheduleDao;
import cn.trans88.taxiappkotlin.logic.dao.SectionDao;
@@ -53,6 +55,7 @@ public class DaoSession extends AbstractDaoSession {
private final DaoConfig playLoggerDaoConfig;
private final DaoConfig positionAdvertiseDaoConfig;
private final DaoConfig regionsDaoConfig;
+ private final DaoConfig runTimeDataDaoConfig;
private final DaoConfig sanleAdvertiseDaoConfig;
private final DaoConfig scheduleDaoConfig;
private final DaoConfig sectionDaoConfig;
@@ -67,6 +70,7 @@ public class DaoSession extends AbstractDaoSession {
private final PlayLoggerDao playLoggerDao;
private final PositionAdvertiseDao positionAdvertiseDao;
private final RegionsDao regionsDao;
+ private final RunTimeDataDao runTimeDataDao;
private final SanleAdvertiseDao sanleAdvertiseDao;
private final ScheduleDao scheduleDao;
private final SectionDao sectionDao;
@@ -101,6 +105,9 @@ public class DaoSession extends AbstractDaoSession {
regionsDaoConfig = daoConfigMap.get(RegionsDao.class).clone();
regionsDaoConfig.initIdentityScope(type);
+ runTimeDataDaoConfig = daoConfigMap.get(RunTimeDataDao.class).clone();
+ runTimeDataDaoConfig.initIdentityScope(type);
+
sanleAdvertiseDaoConfig = daoConfigMap.get(SanleAdvertiseDao.class).clone();
sanleAdvertiseDaoConfig.initIdentityScope(type);
@@ -124,6 +131,7 @@ public class DaoSession extends AbstractDaoSession {
playLoggerDao = new PlayLoggerDao(playLoggerDaoConfig, this);
positionAdvertiseDao = new PositionAdvertiseDao(positionAdvertiseDaoConfig, this);
regionsDao = new RegionsDao(regionsDaoConfig, this);
+ runTimeDataDao = new RunTimeDataDao(runTimeDataDaoConfig, this);
sanleAdvertiseDao = new SanleAdvertiseDao(sanleAdvertiseDaoConfig, this);
scheduleDao = new ScheduleDao(scheduleDaoConfig, this);
sectionDao = new SectionDao(sectionDaoConfig, this);
@@ -138,6 +146,7 @@ public class DaoSession extends AbstractDaoSession {
registerDao(PlayLogger.class, playLoggerDao);
registerDao(PositionAdvertise.class, positionAdvertiseDao);
registerDao(Regions.class, regionsDao);
+ registerDao(RunTimeData.class, runTimeDataDao);
registerDao(SanleAdvertise.class, sanleAdvertiseDao);
registerDao(Schedule.class, scheduleDao);
registerDao(Section.class, sectionDao);
@@ -154,6 +163,7 @@ public class DaoSession extends AbstractDaoSession {
playLoggerDaoConfig.clearIdentityScope();
positionAdvertiseDaoConfig.clearIdentityScope();
regionsDaoConfig.clearIdentityScope();
+ runTimeDataDaoConfig.clearIdentityScope();
sanleAdvertiseDaoConfig.clearIdentityScope();
scheduleDaoConfig.clearIdentityScope();
sectionDaoConfig.clearIdentityScope();
@@ -193,6 +203,10 @@ public class DaoSession extends AbstractDaoSession {
return regionsDao;
}
+ public RunTimeDataDao getRunTimeDataDao() {
+ return runTimeDataDao;
+ }
+
public SanleAdvertiseDao getSanleAdvertiseDao() {
return sanleAdvertiseDao;
}
diff --git a/app/src/main/java/cn/trans88/taxiappkotlin/logic/dao/DaoUtil.kt b/app/src/main/java/cn/trans88/taxiappkotlin/logic/dao/DaoUtil.kt
index d4a5aa0..d25790b 100644
--- a/app/src/main/java/cn/trans88/taxiappkotlin/logic/dao/DaoUtil.kt
+++ b/app/src/main/java/cn/trans88/taxiappkotlin/logic/dao/DaoUtil.kt
@@ -23,6 +23,7 @@ object DaoUtil {
private var mScheduleDao:ScheduleDao
private var mRegionsDao:RegionsDao
private var mContainerDao:ContainerDao
+ private var mRunTimeDataDao:RunTimeDataDao
init {
// helperDaoDB = HelperDaoDB(TaxiApp.instance(), DB_NAME, null)
@@ -39,6 +40,7 @@ object DaoUtil {
mScheduleDao = daoSession.scheduleDao
mRegionsDao = daoSession.regionsDao
mContainerDao = daoSession.containerDao
+ mRunTimeDataDao = daoSession.runTimeDataDao
}
@Synchronized
@@ -82,6 +84,11 @@ object DaoUtil {
return mSanleAdvertiseDao
}
+ @Synchronized
+ fun getRunTimeDao(): RunTimeDataDao {
+ return mRunTimeDataDao
+ }
+
@Synchronized
fun getPositionAdvertise(): PositionAdvertiseDao = mPositionAdvertiseDao
@@ -203,4 +210,11 @@ object DaoUtil {
}
}
+ /**
+ * 删除已上传的运行时长数据
+ */
+ fun deleteIsUpRunTimeData(){
+ getRunTimeDao().queryBuilder().where(RunTimeDataDao.Properties.IsUpload.eq(1)).buildDelete().executeDeleteWithoutDetachingEntities()
+ }
+
}
\ No newline at end of file
diff --git a/app/src/main/java/cn/trans88/taxiappkotlin/logic/dao/RunTimeDataDao.java b/app/src/main/java/cn/trans88/taxiappkotlin/logic/dao/RunTimeDataDao.java
new file mode 100644
index 0000000..29dd6e6
--- /dev/null
+++ b/app/src/main/java/cn/trans88/taxiappkotlin/logic/dao/RunTimeDataDao.java
@@ -0,0 +1,171 @@
+package cn.trans88.taxiappkotlin.logic.dao;
+
+import android.database.Cursor;
+import android.database.sqlite.SQLiteStatement;
+
+import org.greenrobot.greendao.AbstractDao;
+import org.greenrobot.greendao.Property;
+import org.greenrobot.greendao.internal.DaoConfig;
+import org.greenrobot.greendao.database.Database;
+import org.greenrobot.greendao.database.DatabaseStatement;
+
+import cn.trans88.taxiappkotlin.logic.model.RunTimeData;
+
+// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
+/**
+ * DAO for table "RUN_TIME_DATA".
+*/
+public class RunTimeDataDao extends AbstractDao {
+
+ public static final String TABLENAME = "RUN_TIME_DATA";
+
+ /**
+ * Properties of entity RunTimeData.
+ * Can be used for QueryBuilder and for referencing column names.
+ */
+ public static class Properties {
+ public final static Property AutoId = new Property(0, Long.class, "autoId", true, "_id");
+ public final static Property CardId = new Property(1, String.class, "cardId", false, "CARD_ID");
+ public final static Property SumRuntime = new Property(2, Long.class, "sumRuntime", false, "SUM_RUNTIME");
+ public final static Property StartRuntime = new Property(3, Long.class, "startRuntime", false, "START_RUNTIME");
+ public final static Property IsUpload = new Property(4, Integer.class, "isUpload", false, "IS_UPLOAD");
+ }
+
+
+ public RunTimeDataDao(DaoConfig config) {
+ super(config);
+ }
+
+ public RunTimeDataDao(DaoConfig config, DaoSession daoSession) {
+ super(config, daoSession);
+ }
+
+ /** Creates the underlying database table. */
+ public static void createTable(Database db, boolean ifNotExists) {
+ String constraint = ifNotExists? "IF NOT EXISTS ": "";
+ db.execSQL("CREATE TABLE " + constraint + "\"RUN_TIME_DATA\" (" + //
+ "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: autoId
+ "\"CARD_ID\" TEXT," + // 1: cardId
+ "\"SUM_RUNTIME\" INTEGER," + // 2: sumRuntime
+ "\"START_RUNTIME\" INTEGER," + // 3: startRuntime
+ "\"IS_UPLOAD\" INTEGER);"); // 4: isUpload
+ }
+
+ /** Drops the underlying database table. */
+ public static void dropTable(Database db, boolean ifExists) {
+ String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"RUN_TIME_DATA\"";
+ db.execSQL(sql);
+ }
+
+ @Override
+ protected final void bindValues(DatabaseStatement stmt, RunTimeData entity) {
+ stmt.clearBindings();
+
+ Long autoId = entity.getAutoId();
+ if (autoId != null) {
+ stmt.bindLong(1, autoId);
+ }
+
+ String cardId = entity.getCardId();
+ if (cardId != null) {
+ stmt.bindString(2, cardId);
+ }
+
+ Long sumRuntime = entity.getSumRuntime();
+ if (sumRuntime != null) {
+ stmt.bindLong(3, sumRuntime);
+ }
+
+ Long startRuntime = entity.getStartRuntime();
+ if (startRuntime != null) {
+ stmt.bindLong(4, startRuntime);
+ }
+
+ Integer isUpload = entity.getIsUpload();
+ if (isUpload != null) {
+ stmt.bindLong(5, isUpload);
+ }
+ }
+
+ @Override
+ protected final void bindValues(SQLiteStatement stmt, RunTimeData entity) {
+ stmt.clearBindings();
+
+ Long autoId = entity.getAutoId();
+ if (autoId != null) {
+ stmt.bindLong(1, autoId);
+ }
+
+ String cardId = entity.getCardId();
+ if (cardId != null) {
+ stmt.bindString(2, cardId);
+ }
+
+ Long sumRuntime = entity.getSumRuntime();
+ if (sumRuntime != null) {
+ stmt.bindLong(3, sumRuntime);
+ }
+
+ Long startRuntime = entity.getStartRuntime();
+ if (startRuntime != null) {
+ stmt.bindLong(4, startRuntime);
+ }
+
+ Integer isUpload = entity.getIsUpload();
+ if (isUpload != null) {
+ stmt.bindLong(5, isUpload);
+ }
+ }
+
+ @Override
+ public Long readKey(Cursor cursor, int offset) {
+ return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0);
+ }
+
+ @Override
+ public RunTimeData readEntity(Cursor cursor, int offset) {
+ RunTimeData entity = new RunTimeData( //
+ cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // autoId
+ cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // cardId
+ cursor.isNull(offset + 2) ? null : cursor.getLong(offset + 2), // sumRuntime
+ cursor.isNull(offset + 3) ? null : cursor.getLong(offset + 3), // startRuntime
+ cursor.isNull(offset + 4) ? null : cursor.getInt(offset + 4) // isUpload
+ );
+ return entity;
+ }
+
+ @Override
+ public void readEntity(Cursor cursor, RunTimeData entity, int offset) {
+ entity.setAutoId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
+ entity.setCardId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
+ entity.setSumRuntime(cursor.isNull(offset + 2) ? null : cursor.getLong(offset + 2));
+ entity.setStartRuntime(cursor.isNull(offset + 3) ? null : cursor.getLong(offset + 3));
+ entity.setIsUpload(cursor.isNull(offset + 4) ? null : cursor.getInt(offset + 4));
+ }
+
+ @Override
+ protected final Long updateKeyAfterInsert(RunTimeData entity, long rowId) {
+ entity.setAutoId(rowId);
+ return rowId;
+ }
+
+ @Override
+ public Long getKey(RunTimeData entity) {
+ if(entity != null) {
+ return entity.getAutoId();
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public boolean hasKey(RunTimeData entity) {
+ return entity.getAutoId() != null;
+ }
+
+ @Override
+ protected final boolean isEntityUpdateable() {
+ return true;
+ }
+
+}
diff --git a/app/src/main/java/cn/trans88/taxiappkotlin/logic/model/RunTimeData.java b/app/src/main/java/cn/trans88/taxiappkotlin/logic/model/RunTimeData.java
new file mode 100644
index 0000000..f97f215
--- /dev/null
+++ b/app/src/main/java/cn/trans88/taxiappkotlin/logic/model/RunTimeData.java
@@ -0,0 +1,71 @@
+package cn.trans88.taxiappkotlin.logic.model;
+
+import com.google.gson.annotations.Expose;
+
+import org.greenrobot.greendao.annotation.Entity;
+import org.greenrobot.greendao.annotation.Id;
+
+import java.io.Serializable;
+import org.greenrobot.greendao.annotation.Generated;
+
+/**
+ * @Author: LJH
+ * @Time: 2024/2/29
+ * @description:
+ */
+@Entity
+public class RunTimeData implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ @Expose(serialize = false,deserialize = false)
+ @Id(autoincrement = true)
+ private Long autoId;
+
+ private String cardId; //设备id
+ private Long sumRuntime; //上一次开机的总运行时长
+ private Long startRuntime; //上一次开机的开始运行时间
+ private Integer isUpload; //是否上传 0 未上传; 1 已上传
+ @Generated(hash = 710149355)
+ public RunTimeData(Long autoId, String cardId, Long sumRuntime,
+ Long startRuntime, Integer isUpload) {
+ this.autoId = autoId;
+ this.cardId = cardId;
+ this.sumRuntime = sumRuntime;
+ this.startRuntime = startRuntime;
+ this.isUpload = isUpload;
+ }
+ @Generated(hash = 1108588427)
+ public RunTimeData() {
+ }
+ public Long getAutoId() {
+ return this.autoId;
+ }
+ public void setAutoId(Long autoId) {
+ this.autoId = autoId;
+ }
+ public String getCardId() {
+ return this.cardId;
+ }
+ public void setCardId(String cardId) {
+ this.cardId = cardId;
+ }
+ public Long getSumRuntime() {
+ return this.sumRuntime;
+ }
+ public void setSumRuntime(Long sumRuntime) {
+ this.sumRuntime = sumRuntime;
+ }
+ public Long getStartRuntime() {
+ return this.startRuntime;
+ }
+ public void setStartRuntime(Long startRuntime) {
+ this.startRuntime = startRuntime;
+ }
+ public Integer getIsUpload() {
+ return this.isUpload;
+ }
+ public void setIsUpload(Integer isUpload) {
+ this.isUpload = isUpload;
+ }
+
+}
diff --git a/app/src/main/java/cn/trans88/taxiappkotlin/logic/model/SoftDecode.java b/app/src/main/java/cn/trans88/taxiappkotlin/logic/model/SoftDecode.java
new file mode 100644
index 0000000..3098e06
--- /dev/null
+++ b/app/src/main/java/cn/trans88/taxiappkotlin/logic/model/SoftDecode.java
@@ -0,0 +1,37 @@
+package cn.trans88.taxiappkotlin.logic.model;
+
+/**
+ * @Author: LJH
+ * @Time: 2024/3/14
+ * @description:
+ */
+public class SoftDecode {
+
+ private String id;
+ private String task_id;
+ private boolean isSoftDeCode;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getTask_id() {
+ return task_id;
+ }
+
+ public void setTask_id(String task_id) {
+ this.task_id = task_id;
+ }
+
+ public boolean isSoftDeCode() {
+ return isSoftDeCode;
+ }
+
+ public void setSoftDeCode(boolean softDeCode) {
+ isSoftDeCode = softDeCode;
+ }
+}
diff --git a/app/src/main/java/cn/trans88/taxiappkotlin/logic/model/SoftDecodeState.java b/app/src/main/java/cn/trans88/taxiappkotlin/logic/model/SoftDecodeState.java
new file mode 100644
index 0000000..35b2bdc
--- /dev/null
+++ b/app/src/main/java/cn/trans88/taxiappkotlin/logic/model/SoftDecodeState.java
@@ -0,0 +1,18 @@
+package cn.trans88.taxiappkotlin.logic.model;
+
+/**
+ * @Author: LJH
+ * @Time: 2024/3/14
+ * @description:
+ */
+public class SoftDecodeState extends SanleResponse{
+ private Boolean softDecode = false;
+
+ public Boolean getSoftDecode() {
+ return softDecode;
+ }
+
+ public void setSoftDecode(Boolean softDecode) {
+ this.softDecode = softDecode;
+ }
+}
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 b5e0176..4141bca 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
@@ -16,6 +16,7 @@ import cn.trans88.taxiappkotlin.logic.Repository
import cn.trans88.taxiappkotlin.logic.Repository.taxiApp
import cn.trans88.taxiappkotlin.logic.dao.DaoUtil
import cn.trans88.taxiappkotlin.logic.model.*
+import cn.trans88.taxiappkotlin.net.EasyHttpTool
import cn.trans88.taxiappkotlin.play.RefreshPlayer
import cn.trans88.taxiappkotlin.ui.play.PlayActivity
import cn.trans88.taxiappkotlin.ui.play.isSendedLog
@@ -33,6 +34,9 @@ import com.trs88.kurolibrary.execute.KuroExecutor
import com.trs88.kurolibrary.file.KuroFileUtil
import com.trs88.kurolibrary.file.PostFileCallBack
import com.xixun.xy.conn.aidl.ConnService
+import com.zhouyou.http.EasyHttp
+import com.zhouyou.http.callback.SimpleCallBack
+import com.zhouyou.http.exception.ApiException
import net.sysolution.taxiapp.ITaxiListener
import okhttp3.*
import okhttp3.MediaType.Companion.toMediaTypeOrNull
@@ -67,6 +71,11 @@ object ConnManger {
// val BaseUrl ="http://taxihub.cn:2346/"
private var connService: ConnService? = null
+ @Volatile
+ var sendPlayerLogSwitch: Boolean = false
+ @Volatile
+ var sendGPSLogSwitch: Boolean = false
+
/**
* 注册App
*/
@@ -177,10 +186,13 @@ object ConnManger {
val registerToken = Configurations.config(TaxiApp.instance()).registerToken()
//不是默认账号则存入conn
if (!registerToken.equals(defaultToken)){
+ if (isBindOrTransfer){
+ isBindOrTransfer = false
+ }
"is not defaultToken,save message to conn.".loge()
initConnectMessage()
//测试平台要加
-// setServerToConn()
+// setServerToConn()
} else {
//是默认账号,看看conn有没保存信息,如果有则重新注册一遍
if (connService != null){
@@ -194,7 +206,10 @@ object ConnManger {
}
// sendLogger()
- sendLocation()
+// sendLocation()
+ startPlayLogThread()
+ startLocationThread()
+// debugLocation()
//edit by ljh @2023/9/1
WsManager.isRegister = false
WsManager.initWebSocket()
@@ -207,9 +222,9 @@ object ConnManger {
isRegisterSuccess = false
// val timer = Timer()
//验证conn的信息
- if (isBindOrTransfer){
- isBindOrTransfer = false
- }
+// if (isBindOrTransfer){
+// isBindOrTransfer = false
+// }
DelayTimer.timer({ registerApp() }, 4000)
}
})
@@ -447,7 +462,13 @@ object ConnManger {
val parse = ("application/json;charset=UTF-8").toMediaTypeOrNull()
val body = RequestBody.create(parse, requestJson)
- val okHttpClient = OkHttpClient()
+// val okHttpClient = OkHttpClient()
+ //edit by ljh @2024/2/26
+ val okHttpClient = OkHttpClient.Builder()
+ .connectTimeout(80, TimeUnit.SECONDS)
+ .readTimeout(80, TimeUnit.SECONDS)
+ .writeTimeout(80, TimeUnit.SECONDS)
+ .build()
//YoungUtil.YoungLog("准备上传坐标,上传地址:${SaveSimpleData.getLogServiceUrl()}")
YoungUtil.YoungLog("准备上传坐标")
YoungUtil.YoungLog("sendLocation:${requestJson}")
@@ -461,8 +482,7 @@ object ConnManger {
call.enqueue(object : Callback {
override fun onFailure(call: Call, e: IOException) {
YoungUtil.YoungLog("上传坐标失败:${e.message}")
- //日志存卡里
-// taxiApp.saveLog("上传坐标失败,不删除失败的数据")
+
// DaoUtil.getLocationDao().deleteAll()
}
@@ -498,7 +518,18 @@ object ConnManger {
taxiApp.gpsTimer = Timer()
taxiApp.gpsTimer?.schedule(object : TimerTask() {
override fun run() {
- sendLocationToWeb()
+ //edit by ljh @2024/2/28
+ val locations = DaoUtil.getLocations()
+ if (locations.isNotEmpty()) {
+
+ val requestJson: String = ProcessingCommands.gson.toJson(locations)
+ //edit by ljh @2023/10/12
+ for (location in locations) {
+ DaoUtil.getLocationDao().delete(location)
+ }
+ EasyHttpTool.sendGPSToServer(requestJson)
+ }
+// sendLocationToWeb()
// sendLocation()
}
}, 5000,10000)
@@ -507,7 +538,18 @@ object ConnManger {
taxiApp.gpsTimer = Timer()
taxiApp.gpsTimer?.schedule(object : TimerTask() {
override fun run() {
- sendLocationToWeb()
+ //edit by ljh @2024/2/28
+ val locations = DaoUtil.getLocations()
+ if (locations.isNotEmpty()) {
+
+ val requestJson: String = ProcessingCommands.gson.toJson(locations)
+ //edit by ljh @2023/10/12
+ for (location in locations) {
+ DaoUtil.getLocationDao().delete(location)
+ }
+ EasyHttpTool.sendGPSToServer(requestJson)
+ }
+// sendLocationToWeb()
// sendLocation()
}
}, 5000,60 * 60 * 1000)
@@ -515,6 +557,135 @@ object ConnManger {
}
}
+ /**
+ * 启动发送坐标线程
+ */
+ fun startLocationThread(){
+ if (Configurations.config(TaxiApp.instance()).gpsSwitch()) {
+ if (!sendGPSLogSwitch){
+ thread {
+ "启动发送坐标线程".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 requestJson: String = ProcessingCommands.gson.toJson(upLocations)
+ "提交GPS数据 $requestJson".logd()
+ val parse = ("application/json;charset=UTF-8").toMediaTypeOrNull()
+ val body = RequestBody.create(parse, requestJson)
+ EasyHttp.post(Configurations.config(TaxiApp.instance()).logServiceUrl() + "postGpsLocationLog")
+ .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()
+ try {
+ Thread.sleep(3*60*1000L)
+ }catch (e: Exception) {
+ "${e?.message}".loge()
+ e.printStackTrace()
+ }
+ }
+ }
+ }
+ } else {
+ "gps日志线程已经启动了,无需再次启动!".loge()
+ }
+
+ }
+ }
+
+ /**
+ * 提交GPS数据接口测试
+ */
+ fun debugLocation(){
+ "开始提交GPS数据接口测试".logd()
+ thread {
+ while (true){
+ "提交GPS数据接口测试".logd()
+ val locations = mutableListOf()
+ for (i in 0 .. 1000){
+ for (j in 0 .. 1000){}
+ val location = Location().apply {
+ timestamp = System.currentTimeMillis()
+ longitude = 22.665534200203726
+ latitude = 113.91975187778473
+ bearing = 1F
+ speed = 1F
+ distance = 99F
+ elapse = 2
+ }
+ locations.add(location)
+ }
+ val jsonStr = ProcessingCommands.gson.toJson(locations)
+ "提交测试的GPS数据 $jsonStr".logd()
+ val parse = ("application/json;charset=UTF-8").toMediaTypeOrNull()
+ val body = RequestBody.create(parse, jsonStr)
+ EasyHttp.post(Configurations.config(TaxiApp.instance()).logServiceUrl() + "postGpsLocationLog")
+ .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()
+
+ }
+
+ override fun onSuccess(t: String?) {
+ "上传测试的GPS数据成功 $t".loge()
+ locations.clear()
+
+ }
+ })
+ try {
+ Thread.sleep(3*60*1000L)
+ }catch (e: Exception) {
+ "${e?.message}".loge()
+ e.printStackTrace()
+ }
+ }
+ }
+
+
+ }
+
/**
* 播放次数到了,发送终止广告指令
@@ -693,7 +864,8 @@ object ConnManger {
"playLoggers size: ${playLoggers.size}".logd()
val requestJson = getLogSummaryJson(playLoggers)
if (requestJson.isNotEmpty()){
- sendLogsSummaryToWeb(requestJson)
+ EasyHttpTool.sendPlayLogToServer(requestJson)
+// sendLogsSummaryToWeb(requestJson)
}
}
}
@@ -743,7 +915,6 @@ object ConnManger {
YoungUtil.YoungLog("上传日志成功:${response.message},response isSuccessful ${response.isSuccessful}${response.code}")
if (response.code == 200) {
Configurations.config(taxiApp).logSummaryJsonStringSave("")
- isSendedLog = false
} else {
"服务器没回复200,重新上传日志摘要".loge()
"3s后重新上传日志摘要".loge()
@@ -767,11 +938,11 @@ object ConnManger {
* 获取昨天的日志概要Json数据
*/
private fun getLogSummaryJson(playLoggers:List):String{
- val cacheJson = Configurations.config(taxiApp).logSummaryJsonString()
- if (!cacheJson.isNullOrEmpty()){
- "cacheJson:$cacheJson".logd()
- return cacheJson
- }
+// val cacheJson = Configurations.config(taxiApp).logSummaryJsonString()
+// if (!cacheJson.isNullOrEmpty()){
+// "cacheJson:$cacheJson".logd()
+// return cacheJson
+// }
var jsonStr = ""
if (!playLoggers.isNullOrEmpty()){
val summaryList = ArrayList()
@@ -803,7 +974,7 @@ object ConnManger {
DaoUtil.getPlayLogger().delete(playLogger)
}
jsonStr = Gson().toJson(summaryList)
- Configurations.config(taxiApp).logSummaryJsonStringSave(jsonStr)
+// Configurations.config(taxiApp).logSummaryJsonStringSave(jsonStr)
}
"日志概要json:$jsonStr".loge()
return jsonStr
@@ -892,6 +1063,41 @@ object ConnManger {
}
}
+ /**
+ * 提交播放日志
+ */
+ fun startPlayLogThread(){
+ if (Configurations.config(TaxiApp.instance()).loggerSwitch()) {
+ if (!sendPlayerLogSwitch){
+ thread {
+ "提交播放日志线程启动".logd()
+ sendPlayerLogSwitch = true
+ while (true){
+ val playerLogs = DaoUtil.getPlayLoggers()
+ "播放日志数据数量:${playerLogs.size}".logd()
+ if (playerLogs.size>10){
+
+ EasyHttpTool.sendPlayLogToServer()
+
+ } else {
+
+ try {
+ Thread.sleep(60*1000L)
+ }catch (e: Exception){
+ "Exception:${e.message}".loge()
+ e.printStackTrace()
+ }
+ }
+ }
+ }
+ } else {
+ "播放日志线程已经启动了,无需再次启动!".loge()
+ }
+ }
+ }
+
+
+
/**
* 定时发送播放日志摘要
*/
@@ -909,7 +1115,8 @@ object ConnManger {
"定时上传日志摘要,playLoggers size: ${playLoggers.size}".logd()
val requestJson = getLogSummaryJson(playLoggers)
if (requestJson.isNotEmpty() && logsSummaryTimer == null){
- sendLogsSummaryToWeb(requestJson)
+ EasyHttpTool.sendPlayLogToServer(requestJson)
+// sendLogsSummaryToWeb(requestJson)
}
}
},interval*60*1000L,interval*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 eea0471..0a995b8 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
@@ -307,7 +307,7 @@ public class JoeyDownloadManager {
if(soFarBytes >= totalBytes){
try{
Thread.sleep(500);
- }catch (Exception e){}
+ } catch (Exception e){}
AdvertiseProcess advertiseProcess =new AdvertiseProcess();
advertiseProcess.setAd_id(task.getTag().toString());
advertiseProcess.setProgress(String.valueOf(100));
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 92707fe..7ef182e 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
@@ -26,7 +26,6 @@ import com.trs88.kurolibrary.execute.KuroExecutor
import com.trs88.kurolibrary.file.KuroFileUtil
import java.io.*
import java.util.*
-import kotlin.collections.ArrayList
object ProcessingCommands {
@@ -82,8 +81,10 @@ object ProcessingCommands {
"get_advertise_order" -> sendOrderInfo(task,baseTask.type)
"update_player_log_switch" -> playLoggerSwitch(task,baseTask.type)
"update_gps_log_switch" -> gpsSwitch(task,baseTask.type)
+ "soft_decode_switch" -> isSoftDecodeSwitch(task,baseTask.type)
//获取播放日志开关状态
"get_player_log_state" -> getLoggerSwitch(task,baseTask.type)
+ "get_soft_decode" -> getSoftDecodeState(task,baseTask.type)
//设置日志上传间隔
"set_log_interval" -> setLogInterval(task,baseTask.type)
"get_log_interval" -> getLogInterval(task,baseTask.type)
@@ -112,7 +113,9 @@ object ProcessingCommands {
//edit by yzd @20211201
//Settings.gpsSwitch =gpsSwitch.isTurn_on
Configurations.config(TaxiApp.instance()).gpsSwitchSave(gpsSwitch.isTurn_on)
- ConnManger.sendLocation()
+// ConnManger.sendLocation()
+ //edit by ljh @2024/2/29 定点数据上传优化
+ ConnManger.startLocationThread()
// if (gpsSwitch.isTurn_on){
// ConnManger.sendLocation()
// }
@@ -170,7 +173,7 @@ object ProcessingCommands {
val baseResponse = gson.fromJson(task)
val sanleResponse = LoggerState()
val turn_on = Configurations.config(TaxiApp.instance()).loggerSwitch()
- "getLoggerSwitch-->当前播放日志开关状态:$turn_on".logd()
+ "getLoggerSwitch --> 当前播放日志开关状态:$turn_on".logd()
sanleResponse.type = type
sanleResponse.id = baseResponse.id
@@ -216,7 +219,12 @@ object ProcessingCommands {
val response = gson.toJson(sanleResponse)
send(response)
+
//debug
+ //测试软解码开关
+// taxiApp.isSoftDecode = !taxiApp.isSoftDecode
+
+ //测试gps
// val lat2 = 22.665534200203726
// val lon2 = 113.91975187778473
// val lat3 = 23.665534200203726
@@ -238,21 +246,20 @@ object ProcessingCommands {
}
/**
- * 实时获取当天taixApp运行时间
+ * 实时获取本次启动后的taixApp运行时间
*/
private fun getTodayRuntime(task: String, type: String) {
val baseResponse = gson.fromJson(task)
val sanleResponse = TodayRunTime()
- val startRuntime = Configurations.config(TaxiApp.instance()).startRunTime()
- val endRuntime = Configurations.config(TaxiApp.instance()).endRunTime()
- val sumRuntime = Configurations.config(TaxiApp.instance()).sumRunTime()
- val todayRuntime = endRuntime - startRuntime + sumRuntime
- "getTodayRuntime-->当前taxiApp运行时间:$todayRuntime".logd()
+// val startRuntime = Configurations.config(TaxiApp.instance()).startRunTime()
+// val endRuntime = Configurations.config(TaxiApp.instance()).endRunTime()
+ val todaySumRunTime = Configurations.config(TaxiApp.instance()).todaySumRunTime()
+ "getTodayRuntime-->当天taxiApp运行时间:$todaySumRunTime".logd()
sanleResponse.type = type
sanleResponse.id = baseResponse.id
sanleResponse.task_id = baseResponse.task_id
- sanleResponse.runtime = todayRuntime
+ sanleResponse.runtime = todaySumRunTime
val response = gson.toJson(sanleResponse)
send(response)
}
@@ -272,6 +279,7 @@ object ProcessingCommands {
// ConnManger.loggerTimer?.purge()
// ConnManger.sendLogger()
+ ConnManger.startPlayLogThread()
}
baseResponse.type = type
@@ -279,6 +287,41 @@ object ProcessingCommands {
send(response)
}
+ /**
+ * 是否设置软解码
+ * @param task String
+ * @param type String
+ */
+ private fun isSoftDecodeSwitch(task: String, type: String) {
+ val baseResponse = gson.fromJson(task)
+ val loggerSwitch = gson.fromJson(task)
+ //edit by ljh @2024/3/14
+ Configurations.config(TaxiApp.instance()).isSoftDecodeSave(loggerSwitch.isSoftDeCode)
+ taxiApp.isSoftDecode = loggerSwitch.isSoftDeCode
+
+ baseResponse.type = type
+ val response = gson.toJson(baseResponse)
+ send(response)
+ }
+
+ /**
+ * 获取软解码开关状态
+ */
+ private fun getSoftDecodeState(task: String, type: String) {
+ val baseResponse = gson.fromJson(task)
+ val sanleResponse = SoftDecodeState()
+ val turn_on = Configurations.config(TaxiApp.instance()).isSoftDecode()
+ "getSoftDecodeState --> 当前软解码开关状态开关状态:$turn_on".logd()
+
+ sanleResponse.type = type
+ sanleResponse.id = baseResponse.id
+ sanleResponse.task_id = baseResponse.task_id
+ sanleResponse.softDecode = turn_on
+ val response = gson.toJson(sanleResponse)
+ send(response)
+ }
+
+
/**
* 设置日志上传周期
*/
diff --git a/app/src/main/java/cn/trans88/taxiappkotlin/net/EasyHttpResult.kt b/app/src/main/java/cn/trans88/taxiappkotlin/net/EasyHttpResult.kt
new file mode 100644
index 0000000..7bbf3da
--- /dev/null
+++ b/app/src/main/java/cn/trans88/taxiappkotlin/net/EasyHttpResult.kt
@@ -0,0 +1,15 @@
+package cn.trans88.taxiappkotlin.net
+
+import com.zhouyou.http.model.ApiResult
+
+/**
+ *
+ * @Author: LJH
+ * @Time: 2024/2/28
+ * @description:
+ */
+class EasyHttpResult :ApiResult(){
+
+ var message:String = ""
+
+}
\ No newline at end of file
diff --git a/app/src/main/java/cn/trans88/taxiappkotlin/net/EasyHttpTool.kt b/app/src/main/java/cn/trans88/taxiappkotlin/net/EasyHttpTool.kt
new file mode 100644
index 0000000..ce8720c
--- /dev/null
+++ b/app/src/main/java/cn/trans88/taxiappkotlin/net/EasyHttpTool.kt
@@ -0,0 +1,204 @@
+package cn.trans88.taxiappkotlin.net
+
+import cn.trans88.taxiappkotlin.Configurations
+import cn.trans88.taxiappkotlin.TaxiApp
+import cn.trans88.taxiappkotlin.ext.logd
+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.RunTimeData
+import cn.trans88.taxiappkotlin.logic.model.RuntimeJson
+import cn.trans88.taxiappkotlin.logic.network.ProcessingCommands
+import cn.trans88.taxiappkotlin.ui.advertise.AdvertiseType
+import com.google.gson.Gson
+import com.google.gson.reflect.TypeToken
+import com.zhouyou.http.EasyHttp
+import okhttp3.MediaType.Companion.toMediaTypeOrNull
+import okhttp3.RequestBody
+import com.zhouyou.http.callback.SimpleCallBack
+import com.zhouyou.http.exception.ApiException
+import java.util.stream.Collectors
+
+
+/**
+ *
+ * @Author: LJH
+ * @Time: 2024/2/28
+ * @description:
+ */
+object EasyHttpTool {
+
+ /**
+ * 提交运行时长
+ * @param runtimeJson String
+ */
+ fun sendRunTimeToServer(runtimeJson: String){
+ "sendRunTimeToServer run".logd()
+ val parse = ("application/json;charset=UTF-8").toMediaTypeOrNull()
+ val body = RequestBody.create(parse, runtimeJson)
+ EasyHttp.post(Configurations.config(TaxiApp.instance()).logServiceUrl() + "postRunningTimeLog")
+ .readTimeOut(80*1000)
+ .writeTimeOut(80*1000)
+ .connectTimeout(80*1000)
+ .headers("Authorization", "Bearer ${Configurations.config(TaxiApp.instance()).appToken()}")
+ .headers("Accept-Encoding", "gzip")
+ .requestBody(body)
+ .retryCount(5)//本次请求重试次数
+ .retryDelay(600)//本次请求重试延迟时间600ms
+ .execute(object :SimpleCallBack(){
+ override fun onError(e: ApiException?) {
+ "上传运行时长失败:${e?.message}".loge()
+ }
+
+ override fun onSuccess(t: String?) {
+ "上传运行时长成功:${t}".loge()
+ }
+ })
+ }
+
+ /**
+ * 提交运行时长
+ */
+ fun sendRunTimeToServer(){
+ val sumTimeList = DaoUtil.getRunTimeDao().queryBuilder().where(
+ RunTimeDataDao.Properties.IsUpload.eq(0)).list()
+ "未提交的运行时长数量sumTimeList size: ${sumTimeList?.size}".logd()
+ if (!sumTimeList.isNullOrEmpty()){
+
+ for (runTimeData in sumTimeList) {
+ val runtimeJson = RuntimeJson(runTimeData.cardId,runTimeData.sumRuntime,runTimeData.startRuntime)
+ val runtimeJsonStr = Gson().toJson(runtimeJson)
+ "提交运行时长sendRunTimeToServer:$runtimeJsonStr".logd()
+ val parse = ("application/json;charset=UTF-8").toMediaTypeOrNull()
+ val body = RequestBody.create(parse, runtimeJsonStr)
+ EasyHttp.post(Configurations.config(TaxiApp.instance()).logServiceUrl() + "postRunningTimeLog")
+ .readTimeOut(80*1000)
+ .writeTimeOut(80*1000)
+ .connectTimeout(80*1000)
+ .headers("Authorization", "Bearer ${Configurations.config(TaxiApp.instance()).appToken()}")
+ .headers("Accept-Encoding", "gzip")
+ .requestBody(body)
+ .retryCount(5)//本次请求重试次数
+ .retryDelay(600)//本次请求重试延迟时间600ms
+ .execute(object :SimpleCallBack(){
+ override fun onError(e: ApiException?) {
+ "上传运行时长失败:${e?.message}".loge()
+ }
+
+ override fun onSuccess(t: String?) {
+ "上传运行时长成功:${t}".loge()
+ runTimeData.isUpload = 1
+ DaoUtil.getRunTimeDao().update(runTimeData)
+ "将提交的runTimeData标记成已上传".logd()
+ }
+ })
+ }
+
+// val lists:List = sumTimeList.map {
+// RuntimeJson(it.cardId,it.sumRuntime,it.startRuntime)
+// }
+
+
+// val runtimeJson = Gson().toJson(lists)
+
+ }
+
+ }
+
+
+ /**
+ * 提交日志摘要
+ * @param gpsJson String
+ */
+ fun sendPlayLogToServer(logJson: String){
+ "提交日志摘要 $logJson".logd()
+ val parse = ("application/json;charset=UTF-8").toMediaTypeOrNull()
+ val body = RequestBody.create(parse, logJson)
+ EasyHttp.post(Configurations.config(TaxiApp.instance()).logServiceUrl() + "postPlayerLogPlus")
+ .readTimeOut(80*1000)
+ .writeTimeOut(80*1000)
+ .connectTimeout(80*1000)
+ .headers("Authorization", "Bearer ${Configurations.config(TaxiApp.instance()).appToken()}")
+ .headers("Accept-Encoding", "gzip")
+ .requestBody(body)
+ .retryCount(5) //本次请求重试次数
+ .retryDelay(600) //本次请求重试延迟时间600ms
+ .execute(object :SimpleCallBack(){
+ override fun onError(e: ApiException?) {
+ "上传日志摘要失败:${e?.message}".loge()
+ }
+
+ override fun onSuccess(t: String?) {
+ "上传日志摘要成功 $t".loge()
+ }
+ })
+ }
+
+
+ /**
+ * 提交GPS数据
+ * @param gpsJson String
+ */
+ fun sendGPSToServer(gpsJson: String){
+ "提交GPS数据 $gpsJson".logd()
+ val parse = ("application/json;charset=UTF-8").toMediaTypeOrNull()
+ val body = RequestBody.create(parse, gpsJson)
+ EasyHttp.post(Configurations.config(TaxiApp.instance()).logServiceUrl() + "postGpsLocationLog")
+ .readTimeOut(80*1000)
+ .writeTimeOut(80*1000)
+ .connectTimeout(80*1000)
+ .headers("Authorization", "Bearer ${Configurations.config(TaxiApp.instance()).appToken()}")
+ .requestBody(body)
+ .retryCount(5) //本次请求重试次数
+ .retryDelay(600) //本次请求重试延迟时间600ms
+ .syncRequest(true)//设置同步请求
+ .execute(object :SimpleCallBack(){
+ override fun onError(e: ApiException?) {
+ "上传GPS数据失败:${e?.message}".loge()
+ }
+
+ override fun onSuccess(t: String?) {
+ "上传GPS数据成功 $t".loge()
+ }
+ })
+ }
+
+ /**
+ * 上传10条播放日志
+ */
+ fun sendPlayLogToServer(){
+ val tenPlayLogs = DaoUtil.getPlayLogger().queryBuilder().limit(10).build().list()
+ val logJson = ProcessingCommands.gson.toJson(tenPlayLogs)
+ "提交日志Json $logJson".logd()
+ val parse = ("application/json;charset=UTF-8").toMediaTypeOrNull()
+ val body = RequestBody.create(parse, logJson)
+ EasyHttp.post(Configurations.config(TaxiApp.instance()).logServiceUrl() + "postPlayerLog")
+ .readTimeOut(80*1000)
+ .writeTimeOut(80*1000)
+ .connectTimeout(80*1000)
+ .headers("Authorization", "Bearer ${Configurations.config(TaxiApp.instance()).appToken()}")
+ .headers("Accept-Encoding", "gzip")
+ .requestBody(body)
+ .retryCount(5) //本次请求重试次数
+ .retryDelay(600) //本次请求重试延迟时间600ms
+ .syncRequest(true)//设置同步请求
+ .execute(object :SimpleCallBack(){
+ override fun onError(e: ApiException?) {
+ "上传日志失败:${e?.message}".loge()
+ try {
+ Thread.sleep(60*1000L)
+ }catch (e: Exception){
+ "Exception:${e.message}".loge()
+ e.printStackTrace()
+ }
+ }
+
+ override fun onSuccess(t: String?) {
+ "上传日志成功 $t".loge()
+ DaoUtil.getPlayLogger().deleteInTx(tenPlayLogs)
+ "删除日志成功".loge()
+ }
+ })
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/cn/trans88/taxiappkotlin/ui/play/EmptyControlVideo.java b/app/src/main/java/cn/trans88/taxiappkotlin/ui/play/EmptyControlVideo.java
new file mode 100644
index 0000000..ab31758
--- /dev/null
+++ b/app/src/main/java/cn/trans88/taxiappkotlin/ui/play/EmptyControlVideo.java
@@ -0,0 +1,57 @@
+package cn.trans88.taxiappkotlin.ui.play;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.MotionEvent;
+
+import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer;
+
+import cn.trans88.taxiappkotlin.R;
+
+/**
+ * 无任何控制ui的播放
+ * Created by guoshuyu on 2017/8/6.
+ */
+public class EmptyControlVideo extends StandardGSYVideoPlayer {
+
+ public EmptyControlVideo(Context context, Boolean fullFlag) {
+ super(context, fullFlag);
+ }
+
+ public EmptyControlVideo(Context context) {
+ super(context);
+ }
+
+ public EmptyControlVideo(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ @Override
+ public int getLayoutId() {
+ return R.layout.empty_control_video;
+ }
+
+ @Override
+ protected void touchSurfaceMoveFullLogic(float absDeltaX, float absDeltaY) {
+ super.touchSurfaceMoveFullLogic(absDeltaX, absDeltaY);
+ //不给触摸快进,如果需要,屏蔽下方代码即可
+ mChangePosition = false;
+
+ //不给触摸音量,如果需要,屏蔽下方代码即可
+ mChangeVolume = false;
+
+ //不给触摸亮度,如果需要,屏蔽下方代码即可
+ mBrightness = false;
+ }
+
+// @Override
+// protected void touchDoubleUp() {
+// //super.touchDoubleUp();
+// //不需要双击暂停
+// }
+ @Override
+ protected void touchDoubleUp(MotionEvent e) {
+ //super.touchDoubleUp();
+ //不需要双击暂停
+ }
+}
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 21c818d..0a8e7c4 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
@@ -33,8 +33,10 @@ import cn.trans88.taxiappkotlin.logic.dao.PlayLoggerDao
import cn.trans88.taxiappkotlin.logic.gps.GpsReceiver
import cn.trans88.taxiappkotlin.logic.model.Advertise
import cn.trans88.taxiappkotlin.logic.model.Location
+import cn.trans88.taxiappkotlin.logic.model.RunTimeData
import cn.trans88.taxiappkotlin.logic.model.RuntimeJson
import cn.trans88.taxiappkotlin.logic.network.*
+import cn.trans88.taxiappkotlin.net.EasyHttpTool
import cn.trans88.taxiappkotlin.play.RefreshPlayer
import cn.trans88.taxiappkotlin.ui.advertise.AdvertiseType
import cn.trans88.taxiappkotlin.ui.broadcaskReceiver.BusCallback
@@ -54,11 +56,16 @@ import com.permissionx.guolindev.PermissionX
import com.trs88.kurolibrary.execute.KuroExecutor
import com.trs88.kurolibrary.util.MainHandler
import com.xixun.xy.conn.aidl.ConnService
+import com.zhouyou.http.EasyHttp
import kotlinx.android.synthetic.main.activity_main.*
import java.io.File
import java.lang.ref.WeakReference
import java.util.*
+import kotlin.concurrent.thread
+//未校时或没网时卡的初始时间存在为1970年的情况,
+// 时间至少大于1970-10-02 00:21:26才有可能已经校时完成
+const val NOVALIDTIME = 23646086L
class PlayActivity : AppCompatActivity(), NetworkCallback, BusCallback, OnScreenSizeListener {
val CREATE_VIEW_MSG = 11111111
@@ -77,6 +84,7 @@ class PlayActivity : AppCompatActivity(), NetworkCallback, BusCallback, OnScreen
private var saveRuntimeTimer:Timer? = null
private var startSaveRunTimer:Timer? = null
+ private var sumTimeTimer:Timer? = null
val handler = MyHandler(this)
@@ -93,6 +101,8 @@ class PlayActivity : AppCompatActivity(), NetworkCallback, BusCallback, OnScreen
super.onCreate(savedInstanceState)
YoungUtil.YoungLog("playActivity onCreate")
TaxiApp.isActive = true
+ ConnManger.sendGPSLogSwitch = false
+ ConnManger.sendPlayerLogSwitch = false
//防止息屏
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
@@ -128,7 +138,9 @@ class PlayActivity : AppCompatActivity(), NetworkCallback, BusCallback, OnScreen
val loggerSwitch = Configurations.config(this).loggerSwitch()
val gpsSwitch = Configurations.config(this).gpsSwitch()
- "loggerSwitch ------> $loggerSwitch,gpsSwitch -----------> $gpsSwitch".logd()
+ val isSoftDecode = Configurations.config(this).isSoftDecode()
+ taxiApp.isSoftDecode = isSoftDecode
+ "loggerSwitch ------> $loggerSwitch,gpsSwitch -----------> $gpsSwitch,isSoftDecode----->$isSoftDecode".logd()
JoeyDownloadManager.getInstance().setCallBack(this)
@@ -187,11 +199,66 @@ class PlayActivity : AppCompatActivity(), NetworkCallback, BusCallback, OnScreen
}
mLocationManager?.removeUpdates(getLocationListener())
}
- saveStartTime()
},30 * 1000)
+ saveStartTimeThread()
// testLocation()
}
+ fun saveStartTimeThread(){
+ thread {
+ while (true) {
+ var cacheStartTime:Long = configurations.startRunTime()
+ var currentTime = System.currentTimeMillis()
+ "saveStartTimeThread ---> 当前系统时间:currentTime:$currentTime".loge()
+ "saveStartTimeThread ---> 上一次的启动时间:cacheStartTime:$cacheStartTime".loge()
+ if (currentTime > NOVALIDTIME && currentTime > cacheStartTime) {
+ //如果上一次启动时间和当前时间相比是第二天,重置当天的总运行时长,todaySunRuntime
+ var dayType = DateUtil.getDaysDiff(currentTime,cacheStartTime)
+ if (dayType != DayType.IS_SAME_DAY.ordinal){
+ "第二天了,重置当天的运行时长".logd()
+ configurations.todaySumRunTimeSave(0)
+ }
+
+ //删除已提交的运行时长数据
+ DaoUtil.deleteIsUpRunTimeData()
+
+ //如果上次缓存的总运行时长大于0,取出存到数据库中
+ val cacheSumTime = configurations.sumRunTime()
+ "cacheSumTime ---> 上一次的运行时长:cacheSumTime:$cacheSumTime".loge()
+
+ if (cacheSumTime > 0 && cacheStartTime > NOVALIDTIME){
+ val cardId = configurations.cardId()
+ val runTimeData = RunTimeData()
+ runTimeData.cardId = cardId
+ runTimeData.sumRuntime = cacheSumTime
+ runTimeData.isUpload = 0
+ runTimeData.startRuntime = cacheStartTime
+ DaoUtil.getRunTimeDao().insert(runTimeData)
+ }
+
+ //提交未上传的运行时长数据
+ EasyHttpTool.sendRunTimeToServer()
+
+ //重新初始化startRunTime为当前启动时间,sumRuntime为0
+ configurations.startRunTimeSave(currentTime)
+ configurations.sumRunTimeSave(0)
+ //开启定时器,让sumRunTime累加
+ startSaveSumTimer()
+ //跳出循环
+ break
+ } else {
+ "系统时间尚未校时,80s后重新获取系统时间".loge()
+ try {
+ Thread.sleep(80*1000)
+ } catch (e:Exception) {
+ e.printStackTrace()
+ }
+ }
+ }
+
+ }
+ }
+
/**
* 保存开始运行时间
*/
@@ -200,7 +267,7 @@ class PlayActivity : AppCompatActivity(), NetworkCallback, BusCallback, OnScreen
var currentTime = System.currentTimeMillis()
"saveStartTime ---> currentTime:$currentTime".loge()
- if (currentTime > 23646086L && currentTime > cacheStartTime){
+ if (currentTime > NOVALIDTIME && currentTime > cacheStartTime){
startSaveRunTimer?.let {
it.purge()
@@ -219,20 +286,20 @@ class PlayActivity : AppCompatActivity(), NetworkCallback, BusCallback, OnScreen
configurations.startRunTimeSave(currentTime)
configurations.endRunTimeSave(currentTime)
configurations.firstRunTimeSave(currentTime)
- configurations.sumRunTimeSave(0L)
+ configurations.sumRunTimeSave(0)
configurations.runtimeJsonStringSave("")
startRuntimeTimer()
}
DayType.IS_SAME_DAY.ordinal -> {//同一天重启
isSendedLog = false
- val logSummaryJson = configurations.logSummaryJsonString()
- if (!logSummaryJson.isNullOrEmpty()){
- "同一天重启,之前的日志数据没传,重新上传".loge()
- ConnManger.sendLogsSummary()
- } else {
- isSendedLog = false
- }
+// val logSummaryJson = configurations.logSummaryJsonString()
+// if (!logSummaryJson.isNullOrEmpty()){
+// "同一天重启,之前的日志数据没传,重新上传".loge()
+// ConnManger.sendLogsSummary()
+// } else {
+// isSendedLog = false
+// }
sendLogInterval()
@@ -249,10 +316,14 @@ class PlayActivity : AppCompatActivity(), NetworkCallback, BusCallback, OnScreen
//测试上报接口
// val runtimeJson = RuntimeJson(configurations.cardId(),todaySumRuntime,lastStartRuntime)
+// val jsonStr = Gson().toJson(runtimeJson)
+// "测试数据:$jsonStr".loge()
+
+
// configurations.runtimeJsonStringSave(Gson().toJson(runtimeJson))
- if (!configurations.runtimeJsonString().isNullOrEmpty()){
- ConnManger.sendRuntimeToWeb()
- }
+// if (!configurations.runtimeJsonString().isNullOrEmpty()){
+// ConnManger.sendRuntimeToWeb()
+// }
//保存新的开始运行时间,和结束时间
configurations.startRunTimeSave(currentTime)
@@ -274,20 +345,23 @@ class PlayActivity : AppCompatActivity(), NetworkCallback, BusCallback, OnScreen
//提交昨天一整天的运行时间
val firstRuntime = configurations.firstRunTime()
val runtimeJson = RuntimeJson(configurations.cardId(),yesterdaySumTime,firstRuntime)
- configurations.runtimeJsonStringSave(Gson().toJson(runtimeJson))
- ConnManger.sendRuntimeToWeb()
+// configurations.runtimeJsonStringSave(Gson().toJson(runtimeJson))
+ //edit by ljh on 2024/2/28
+ //优化上传运行时长方式
+ EasyHttpTool.sendRunTimeToServer(Gson().toJson(runtimeJson))
+// ConnManger.sendRuntimeToWeb()
//保存新的开始运行时间,和结束时间
configurations.startRunTimeSave(currentTime)
configurations.endRunTimeSave(currentTime)
configurations.firstRunTimeSave(currentTime)
- configurations.sumRunTimeSave(0L)
+ configurations.sumRunTimeSave(0)
startRuntimeTimer()
}
else -> {
configurations.startRunTimeSave(currentTime)
configurations.endRunTimeSave(currentTime)
configurations.firstRunTimeSave(currentTime)
- configurations.sumRunTimeSave(0L)
+ configurations.sumRunTimeSave(0)
sendLogInterval()
}
}
@@ -314,6 +388,49 @@ class PlayActivity : AppCompatActivity(), NetworkCallback, BusCallback, OnScreen
}
}
+
+ /**
+ * 启动计算运行时长的计时器
+ */
+ private fun startSaveSumTimer(){
+ sumTimeTimer?.purge()
+ sumTimeTimer?.cancel()
+ sumTimeTimer = Timer()
+ "计算运行时长的计时器启动".logd()
+ sumTimeTimer?.schedule(object : TimerTask(){
+ override fun run() {
+
+ val startRuntime = configurations.startRunTime()
+ val currentTime = System.currentTimeMillis()
+ val currentType = DateUtil.getDaysDiff(currentTime,startRuntime)
+ var cacheSumRunTime = configurations.sumRunTime()
+ var cacheTodaySumRunTime = configurations.todaySumRunTime()
+ if (currentType == DayType.IS_SECOND_DAY.ordinal){
+ "当前时间已经是第二天了,记录一次".logd()
+ val cardId = configurations.cardId()
+ val rumTimeData = RunTimeData()
+ rumTimeData.isUpload = 0
+ rumTimeData.cardId = cardId
+ rumTimeData.sumRuntime = cacheSumRunTime
+ rumTimeData.startRuntime = startRuntime
+ DaoUtil.getRunTimeDao().insert(rumTimeData)
+
+ //重新初始化startRunTime为当前启动时间,sumRuntime为0
+ configurations.startRunTimeSave(currentTime)
+ configurations.sumRunTimeSave(0)
+ configurations.todaySumRunTimeSave(0)
+ cacheTodaySumRunTime = 0
+ cacheSumRunTime = 0
+ }
+
+ //每30s累加一次
+ "当前运行时长cacheSumRunTime:${cacheSumRunTime},累加30s".logd()
+ configurations.sumRunTimeSave(cacheSumRunTime+30*1000L)
+ configurations.todaySumRunTimeSave(cacheTodaySumRunTime+30*1000L)
+ }
+ },30*1000L,30*1000L)
+ }
+
/**
* 启动计算运行时长的计时器
*/
@@ -332,22 +449,22 @@ class PlayActivity : AppCompatActivity(), NetworkCallback, BusCallback, OnScreen
val type = DateUtil.getDaysDiff(endRuntime,startRuntime)
val currentType = DateUtil.getDaysDiff(currentTime,startRuntime)
val isSecond = DayType.IS_SECOND_DAY.ordinal == currentType
- if (isSecond && Repository.taxiApp.sendLogTimes == 0) {
- //当前时间被手动设置成第二天了,提交一次运行时长数据
- isSendedLog = true
- val lastRunTime = endRuntime - startRuntime
- val yesterdayRuntime = configurations.sumRunTime() + lastRunTime
- //提交昨天一整天的运行时间
- val firstRuntime = configurations.firstRunTime()
- val runtimeJson = RuntimeJson(configurations.cardId(),yesterdayRuntime,firstRuntime)
- configurations.runtimeJsonStringSave(Gson().toJson(runtimeJson))
- ConnManger.sendRuntimeToWeb()
-
- //提交一次日志数据
- ConnManger.sendLogsSummary()
-
- Repository.taxiApp.sendLogTimes = 1
- }
+// if (isSecond && Repository.taxiApp.sendLogTimes == 0) {
+// //当前时间被手动设置成第二天了,提交一次运行时长数据
+// isSendedLog = true
+// val lastRunTime = endRuntime - startRuntime
+// val yesterdayRuntime = configurations.sumRunTime() + lastRunTime
+// //提交昨天一整天的运行时间
+// val firstRuntime = configurations.firstRunTime()
+// val runtimeJson = RuntimeJson(configurations.cardId(),yesterdayRuntime,firstRuntime)
+// configurations.runtimeJsonStringSave(Gson().toJson(runtimeJson))
+// ConnManger.sendRuntimeToWeb()
+//
+// //提交一次日志数据
+// ConnManger.sendLogsSummary()
+//
+// Repository.taxiApp.sendLogTimes = 1
+// }
if (DayType.IS_SECOND_DAY.ordinal == type) {
ConnManger.sendLogsSummary()
@@ -357,12 +474,14 @@ class PlayActivity : AppCompatActivity(), NetworkCallback, BusCallback, OnScreen
//提交昨天一整天的运行时间
val firstRuntime = configurations.firstRunTime()
val runtimeJson = RuntimeJson(configurations.cardId(),yesterdayRuntime,firstRuntime)
- configurations.runtimeJsonStringSave(Gson().toJson(runtimeJson))
- ConnManger.sendRuntimeToWeb()
+// configurations.runtimeJsonStringSave(Gson().toJson(runtimeJson))
+// ConnManger.sendRuntimeToWeb()
+ //edit by ljh on 2024/2/28
+ EasyHttpTool.sendRunTimeToServer(Gson().toJson(runtimeJson))
//保存新的开始运行时间,和结束时间
configurations.startRunTimeSave(endRuntime)
configurations.firstRunTimeSave(endRuntime)
- configurations.sumRunTimeSave(0L)
+ configurations.sumRunTimeSave(0)
}
configurations.endRunTimeSave(endRuntime+30*1000L)
diff --git a/app/src/main/java/cn/trans88/taxiappkotlin/ui/play/PlayView.kt b/app/src/main/java/cn/trans88/taxiappkotlin/ui/play/PlayView.kt
index 5678559..2c57a12 100644
--- a/app/src/main/java/cn/trans88/taxiappkotlin/ui/play/PlayView.kt
+++ b/app/src/main/java/cn/trans88/taxiappkotlin/ui/play/PlayView.kt
@@ -25,6 +25,7 @@ import cn.trans88.taxiappkotlin.TaxiApp
import cn.trans88.taxiappkotlin.TaxiApp.Companion.HAOSHENG
import cn.trans88.taxiappkotlin.ext.logd
import cn.trans88.taxiappkotlin.ext.loge
+import cn.trans88.taxiappkotlin.logic.Repository
import cn.trans88.taxiappkotlin.logic.model.Advertise
import cn.trans88.taxiappkotlin.logic.model.BackgroundType
import cn.trans88.taxiappkotlin.logic.model.TextInfo
@@ -37,6 +38,7 @@ import com.bumptech.glide.Glide
import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.bumptech.glide.request.RequestOptions
import com.google.gson.Gson
+import com.shuyu.gsyvideoplayer.listener.GSYSampleCallBack
import kotlinx.android.synthetic.main.activity_main.view.*
import java.io.File
@@ -134,51 +136,69 @@ fun View.createView(context: Context, advertise: Advertise, seek: Int): View? {
// YoungUtil.YoungLog("初始化视频控件耗时:${currentTimeMillis - System.currentTimeMillis()}")
// video = jVideoView
// }
-
-//MediaPlayer
-// YoungUtil.YoungLog("素材是视频:${Configurations.config(TaxiApp.instance()).downloadUrl()}${advertise.media_url}")
- val currentTimeMillis = System.currentTimeMillis()
-
- val jVideoView = JVideoView(context)
-
- jVideoView.videoPath = advertise.pathName
-
- jVideoView.setOnPreparedListener { mediaPlayer ->
- mediaPlayer.isLooping = false
- YoungUtil.YoungLog("视频准备完成,当前线程${Looper.getMainLooper().thread === Thread.currentThread()}")
- YoungUtil.YoungLog("视频的播放时长${jVideoView.duration}")
- try {
- mediaPlayer.start()
- } catch (e:Exception){
- "播放异常:${e.printStackTrace()}".loge()
- if (mediaPlayer.isLooping){
- mediaPlayer.stop()
+ if (Repository.taxiApp.isSoftDecode){
+ "SoftDecode 使用的是软解码".logd()
+ //ijk GSYPlayer
+ val videoPlayer = EmptyControlVideo(context)
+ videoPlayer.setUp(advertise.pathName,true,"")
+ videoPlayer.startPlayLogic()
+ videoPlayer.setVideoAllCallBack(object : GSYSampleCallBack(){
+ override fun onPrepared(url: String?, vararg objects: Any?) {
+ super.onPrepared(url, *objects)
+ "视频准备完成".logd()
+ }
+ })
+ video = videoPlayer
+ } else {
+ "使用的是硬解码".logd()
+ //MediaPlayer
+ YoungUtil.YoungLog("素材是视频:${Configurations.config(TaxiApp.instance()).downloadUrl()}${advertise.media_url}")
+ val currentTimeMillis = System.currentTimeMillis()
+
+ val jVideoView = JVideoView(context)
+
+ jVideoView.videoPath = advertise.pathName
+
+ jVideoView.setOnPreparedListener { mediaPlayer ->
+ mediaPlayer.isLooping = false
+ YoungUtil.YoungLog("视频准备完成,当前线程${Looper.getMainLooper().thread === Thread.currentThread()}")
+ YoungUtil.YoungLog("视频的播放时长${jVideoView.duration}")
+ try {
+ mediaPlayer.start()
+ } catch (e:Exception){
+ "播放异常:${e.printStackTrace()}".loge()
+ if (mediaPlayer.isLooping){
+ mediaPlayer.stop()
+ }
+ mediaPlayer.reset()
+ jVideoView.videoPath = advertise.pathName
+ mediaPlayer.prepare()
+ mediaPlayer.start()
}
- mediaPlayer.reset()
- jVideoView.videoPath = advertise.pathName
- mediaPlayer.prepare()
- mediaPlayer.start()
}
+
+ jVideoView.setOnErrorListener { mp, what, ext ->
+ val whatMsg = when(what){
+ MediaPlayer.MEDIA_ERROR_UNKNOWN -> "UNKNOWN_error"
+ else -> "SERVER_DIED"
+ }
+ val extraMsg = when(ext){
+ MediaPlayer.MEDIA_ERROR_IO -> {
+ "IO_Error"
+ }
+ MediaPlayer.MEDIA_ERROR_MALFORMED -> "ERROR_MALFORMED"
+ MediaPlayer.MEDIA_ERROR_UNSUPPORTED -> "ERROR_UNSUPPORTED"
+ else -> "ERROR_TIMED_OUT"
+ }
+ "extraMsg:$extraMsg,whatMsg:$whatMsg".loge()
+ true
+ }
+ YoungUtil.YoungLog("初始化视频控件耗时:${currentTimeMillis - System.currentTimeMillis()}")
+ video = jVideoView
}
- jVideoView.setOnErrorListener { mp, what, ext ->
- val whatMsg = when(what){
- MediaPlayer.MEDIA_ERROR_UNKNOWN -> "UNKNOWN_error"
- else -> "SERVER_DIED"
- }
- val extraMsg = when(ext){
- MediaPlayer.MEDIA_ERROR_IO -> {
- "IO_Error"
- }
- MediaPlayer.MEDIA_ERROR_MALFORMED -> "ERROR_MALFORMED"
- MediaPlayer.MEDIA_ERROR_UNSUPPORTED -> "ERROR_UNSUPPORTED"
- else -> "ERROR_TIMED_OUT"
- }
- "extraMsg:$extraMsg,whatMsg:$whatMsg".loge()
- true
- }
- YoungUtil.YoungLog("初始化视频控件耗时:${currentTimeMillis - System.currentTimeMillis()}")
- video = jVideoView
+
+
//其他
// if (Build.VERSION.SDK_INT >= 26) {
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 a017e91..6e456d4 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
@@ -83,6 +83,8 @@ import java.util.*
//todo 这里不应该持有ui,应该要建立对应的livedata去回调给ui
//如果是第二天,但是第一天日志没传完,就设为true
var isSendedLog: Boolean = true
+//从缓存获取次数达到8888次后,从数据库获取一次数据,并更新缓存
+const val MAX_CACHE: Int = 8888
class PlayViewModel(val lifecycle: Lifecycle, private val fl_play: FrameLayout, private val imageView: ImageView) : ViewModel(), GpsInformationListener, IPlay, LifecycleObserver {
private val providerMap = HashMap()
@@ -803,26 +805,9 @@ class PlayViewModel(val lifecycle: Lifecycle, private val fl_play: FrameLayout,
// val roundingDuration = Math.ceil((curLogger!!.duration.toDouble() / 1000)) * 1000
// curLogger!!.duration = roundingDuration.toLong()
// DaoUtil.getPlayLoggerDao().insert(curLogger)
-// "存储日志:${curLogger?.begin_play_ts}".loge()
+ "存储日志:${curLogger?.begin_play_ts}".loge()
// "当前日志数量:${DaoUtil.getPlayLoggers().size}".logd()
- if (isSendedLog){
- cachePlayLoggers.add(curLogger!!)
- "缓存日志数据:${curLogger.toString()}".loge()
- } else {
- "存储日志数据:${curLogger.toString()}".loge()
- val logs = DaoUtil.getPlayLoggers()
- "当前日志数据size:${logs.size}".logd()
- for (log in logs) {
- "日志数据:${log.toString()}"
- }
- DaoUtil.getPlayLoggerDao().insert(curLogger)
- for (cachePlayLogger in cachePlayLoggers) {
- "存储缓存的日志数据insert cachePlayLogger${cachePlayLogger.toString()}".logd()
- DaoUtil.getPlayLoggerDao().insert(cachePlayLogger)
- }
- cachePlayLoggers.clear()
- }
-
+ DaoUtil.getPlayLoggerDao().insert(curLogger)
}
curLogger = null
}
@@ -907,7 +892,7 @@ class PlayViewModel(val lifecycle: Lifecycle, private val fl_play: FrameLayout,
//edit by ljh @2023/8/28
regionCacheSwitch -= 1
if (regionCacheSwitch<=0){
- regionCacheSwitch = 8888
+ regionCacheSwitch = MAX_CACHE
taxiApp.regionsList.clear()
}
// val regions = DaoUtil.getRegion().loadAll()
@@ -944,7 +929,7 @@ class PlayViewModel(val lifecycle: Lifecycle, private val fl_play: FrameLayout,
taxiApp.regionsList.clear()
DaoUtil.getRegion().update(region)
}
- }else{
+ } else {
DaoUtil.getRegion().update(region)
}
@@ -1107,11 +1092,12 @@ 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)
- }
- }
+// location.distance?.let {
+// if (it < 10000f){
+// DaoUtil.getLocationDao().insert(location)
+// }
+// }
+ DaoUtil.getLocationDao().insert(location)
curLocation = location
//debug 将日志存卡里看location信息对不对
// taxiApp.saveLog(location.toString())
diff --git a/app/src/main/java/cn/trans88/taxiappkotlin/util/DateUtil.java b/app/src/main/java/cn/trans88/taxiappkotlin/util/DateUtil.java
index 477dfce..75a2bd5 100644
--- a/app/src/main/java/cn/trans88/taxiappkotlin/util/DateUtil.java
+++ b/app/src/main/java/cn/trans88/taxiappkotlin/util/DateUtil.java
@@ -22,6 +22,7 @@ public class DateUtil {
public static SimpleDateFormat dateTimeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
/**
* 获取任务第一次执行的开始或者结束日期
* @param weekDay
@@ -146,10 +147,10 @@ public class DateUtil {
Log.d("yzd_t", "daysDiff: " + daysDiff);
if (daysDiff == 1) {
- Log.d("yzd_t","currentTimeStamp对应的时间是lastTimeStamp的后一天的时间。");
+ Log.d("yzd_t","对比当前时间是第二天");
dayType = DayType.IS_SECOND_DAY.ordinal();
} else if (daysDiff == 0) {
- Log.d("yzd_t","currentTimeStamp对应的时间不是lastTimeStamp的后一天的时间。");
+ Log.d("yzd_t","对比当前时间是同一天");
dayType = DayType.IS_SAME_DAY.ordinal();
}
diff --git a/app/src/main/res/layout/empty_control_video.xml b/app/src/main/res/layout/empty_control_video.xml
new file mode 100644
index 0000000..7b0929a
--- /dev/null
+++ b/app/src/main/res/layout/empty_control_video.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
diff --git a/debug/output.json b/debug/output.json
index 82e9216..2f69bc5 100644
--- a/debug/output.json
+++ b/debug/output.json
@@ -1 +1 @@
-[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":242,"versionName":"3.3.3-beta26.3.9.99-debug","enabled":true,"outputFile":"TaxiApp_v3.3.3-beta26.3.9.99-debug{242}.apk","fullName":"debug","baseName":"debug","dirName":""},"path":"TaxiApp_v3.3.3-beta26.3.9.99-debug{242}.apk","properties":{}}]
\ No newline at end of file
+[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":245,"versionName":"3.3.3-beta26.4.0.5-debug","enabled":true,"outputFile":"TaxiApp_v3.3.3-beta26.4.0.5-debug{245}.apk","fullName":"debug","baseName":"debug","dirName":""},"path":"TaxiApp_v3.3.3-beta26.4.0.5-debug{245}.apk","properties":{}}]
\ No newline at end of file
diff --git a/local.properties b/local.properties
index d9bb47d..d70b3ff 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.
-#Wed Dec 20 15:01:02 GMT+08:00 2023
+#Mon Mar 18 15:40:17 GMT+08:00 2024
sdk.dir=D\:\\Android\\sdk
diff --git a/release/output.json b/release/output.json
index fb9c882..fcc39a0 100644
--- a/release/output.json
+++ b/release/output.json
@@ -1 +1 @@
-[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":244,"versionName":"3.3.3-beta26.4.0.1-release","enabled":true,"outputFile":"TaxiApp_v3.3.3-beta26.4.0.1-release{244}.apk","fullName":"release","baseName":"release","dirName":""},"path":"TaxiApp_v3.3.3-beta26.4.0.1-release{244}.apk","properties":{}}]
\ No newline at end of file
+[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":249,"versionName":"3.3.3-beta26.4.0.8-debug","enabled":true,"outputFile":"TaxiApp_v3.3.3-beta26.4.0.8-debug{249}.apk","fullName":"release","baseName":"release","dirName":""},"path":"TaxiApp_v3.3.3-beta26.4.0.8-debug{249}.apk","properties":{}}]
\ No newline at end of file