From 664834b83a4c50cac039bbfa49f5164ca9bf8e3c Mon Sep 17 00:00:00 2001
From: liugl <liugl@sinata.cn>
Date: 星期五, 07 八月 2020 17:05:17 +0800
Subject: [PATCH] 8.7

---
 app/src/main/java/com/okgoincar/netUtls/NetKit.kt |   36 +++++++++++++++++++++++++++++++++---
 1 files changed, 33 insertions(+), 3 deletions(-)

diff --git a/app/src/main/java/com/okgoincar/netUtls/NetKit.kt b/app/src/main/java/com/okgoincar/netUtls/NetKit.kt
index 0879799..b219b71 100644
--- a/app/src/main/java/com/okgoincar/netUtls/NetKit.kt
+++ b/app/src/main/java/com/okgoincar/netUtls/NetKit.kt
@@ -1,6 +1,7 @@
 package com.okgoincar.netUtls
 
 import android.content.Context
+import android.content.Intent
 import android.os.CountDownTimer
 import android.os.Handler
 import android.os.Looper
@@ -50,6 +51,12 @@
             clickAction(responseString)
         }
 
+        override fun onError(code: Int, msg: String?, resposeString: String?) {
+            super.onError(code, msg, resposeString)
+            if (showDialog)
+                dismissDialog()
+        }
+
     })
 }
 
@@ -68,6 +75,11 @@
         override fun success(responseString: String?) {
             dismissDialog()
             clickAction(responseString)
+        }
+
+        override fun onError(code: Int, msg: String?, resposeString: String?) {
+            super.onError(code, msg, resposeString)
+            dismissDialog()
         }
     })
 }
@@ -89,7 +101,7 @@
     return user.toInt()
 }
 
-fun getToken(): String {
+fun getToken(): String? {
     return CacheKey.getKeyStr("token")
 }
 
@@ -128,6 +140,14 @@
             clickActionError(msg)
         }
     })
+}
+
+fun sendAudio(context: Context,s: String?) {
+    val intent = Intent()
+    intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
+    intent.action = "com.wisdom.gps.action.tts"
+    intent.putExtra("msg", s)
+    context.sendBroadcast(intent)
 }
 
 
@@ -177,6 +197,12 @@
             clickAction(responseString)
         }
 
+        override fun onError(code: Int, msg: String?, resposeString: String?) {
+            super.onError(code, msg, resposeString)
+            if (showDialog)
+                dismissDialog()
+        }
+
     })
 }
 
@@ -200,6 +226,7 @@
         }
 
         override fun onError(code: Int, msg: String?, resposeString: String?) {
+            dismissDialog()
             clickActionError(resposeString)
         }
     })
@@ -227,7 +254,7 @@
 
         override fun onError(code: Int, msg: String?, resposeString: String?) {
             super.onError(code, msg, resposeString)
-
+            dismissDialog()
             clickActionError(msg)
         }
     })
@@ -248,6 +275,10 @@
     HttpManager.getInstance().post(api, map, object : MyObserver(context) {
         override fun success(responseString: String?) {
             clickAction(responseString)
+        }
+
+        override fun onError(code: Int, msg: String?, resposeString: String?) {
+            super.onError(code, msg, resposeString)
         }
     })
 }
@@ -306,7 +337,6 @@
     val timer by lazy {
         object : CountDownTimer(timeDown, 1000) {
             override fun onFinish() {
-                click(0)
             }
 
             override fun onTick(millisUntilFinished: Long) {

--
Gitblit v1.7.1