优化代码
This commit is contained in:
@@ -27,8 +27,6 @@ import io.reactivex.schedulers.Schedulers;
|
||||
public class NetworkActivity extends AppCompatActivity {
|
||||
private Button btn;
|
||||
private TextView tvResult;
|
||||
|
||||
|
||||
private ApiService apiService;
|
||||
|
||||
|
||||
@@ -44,8 +42,8 @@ public class NetworkActivity extends AppCompatActivity {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
tvResult.setText("结果显示");
|
||||
// queryRoadData("ZD802C1938L10797");
|
||||
queryHelpSignal("ZD802C1938L10797");
|
||||
queryRoadData("ZD802C1938L10797");
|
||||
// queryHelpSignal("ZD802C1938L10797");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
GROUP=com.mogo.cloud
|
||||
POM_ARTIFACT_ID=commons
|
||||
VERSION_CODE=1
|
||||
VERSION_NAME=1.0.0
|
||||
VERSION_NAME=1.0.1-snapshots
|
||||
@@ -1,5 +0,0 @@
|
||||
package com.mogo.cloud.commons
|
||||
|
||||
class Sample {
|
||||
|
||||
}
|
||||
@@ -5,14 +5,7 @@ package com.mogo.cloud.commons.network
|
||||
* describe:
|
||||
*/
|
||||
class NetConstants {
|
||||
|
||||
companion object {
|
||||
/** 无数据 */
|
||||
const val NO_DATA = -800
|
||||
|
||||
/** 数据返回正常 */
|
||||
const val OK = 0
|
||||
|
||||
const val READ_TIMEOUT = 20000L
|
||||
const val WRITE_TIMEOUT = 20000L
|
||||
const val CONNECT_TIMEOUT = 15000L
|
||||
|
||||
@@ -16,7 +16,7 @@ import java.util.concurrent.TimeUnit
|
||||
*
|
||||
* @Author: wujifei
|
||||
* @CreateDate: 1/20/21 12:16 AM
|
||||
* @Description: 描述
|
||||
* @Description: 获取OkHttpClient
|
||||
*/
|
||||
class OkHttpFactory private constructor() {
|
||||
companion object {
|
||||
|
||||
@@ -9,7 +9,7 @@ import retrofit2.converter.gson.GsonConverterFactory
|
||||
*
|
||||
* @Author: wujifei
|
||||
* @CreateDate: 1/19/21 11:21 PM
|
||||
* @Description: 描述
|
||||
* @Description: 获取Retrofit实例
|
||||
*/
|
||||
object RetrofitFactory {
|
||||
private val sRpcServiceMap: MutableMap<String, Retrofit?> = ArrayMap()
|
||||
|
||||
@@ -6,7 +6,7 @@ import okhttp3.Response
|
||||
|
||||
/**
|
||||
* created by wujifei on 2021/1/20 15:18
|
||||
* describe:
|
||||
* describe:header携带信息
|
||||
*/
|
||||
class HeaderNetworkInterceptor : Interceptor {
|
||||
override fun intercept(chain: Interceptor.Chain): Response {
|
||||
|
||||
@@ -9,7 +9,11 @@ import java.util.*
|
||||
|
||||
/**
|
||||
* created by wujifei on 2021/1/20 12:51
|
||||
* describe:
|
||||
* describe:网络工具
|
||||
*/
|
||||
|
||||
/**
|
||||
* 根据host获取InetAddress
|
||||
*/
|
||||
@Throws(UnknownHostException::class)
|
||||
fun lookup(hostname: String?): List<InetAddress?>? {
|
||||
|
||||
Reference in New Issue
Block a user