opt
This commit is contained in:
1
.idea/gradle.xml
generated
1
.idea/gradle.xml
generated
@@ -22,6 +22,7 @@
|
||||
</set>
|
||||
</option>
|
||||
<option name="resolveModulePerSourceSet" value="false" />
|
||||
<option name="useQualifiedModuleNames" value="true" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
|
||||
@@ -36,6 +36,8 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.androidxconstraintlayout
|
||||
implementation project(path: ':foudations:mogo-passport')
|
||||
implementation project(path: ':foudations:mogo-commons')
|
||||
implementation project(path: ':modules:mogo-tanlu')
|
||||
|
||||
// implementation 'com.mogo.cloud:passport:1.0.0'
|
||||
implementation rootProject.ext.dependencies.rxjava
|
||||
implementation rootProject.ext.dependencies.rxandroid
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
package="com.mogo.cloud">
|
||||
|
||||
<application
|
||||
android:name=".MoGoApplication"
|
||||
android:name="com.mogo.cloud.MoGoApplication"
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
@@ -25,7 +25,7 @@
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".network.NetworkActivity"
|
||||
android:name="com.mogo.cloud.network.NetworkActivity"
|
||||
android:label="网络测试">
|
||||
|
||||
</activity>
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package com.mogo.cloud;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.mogo.cloud.network.NetworkActivity;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClient;
|
||||
|
||||
/**
|
||||
@@ -17,6 +19,9 @@ public class PassPortActivity extends AppCompatActivity {
|
||||
private TextView tvSn;
|
||||
private TextView tvToken;
|
||||
|
||||
private Button btnJumpToNet;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -25,11 +30,17 @@ public class PassPortActivity extends AppCompatActivity {
|
||||
btnRefreshToken = findViewById(R.id.btnRefreshToken);
|
||||
tvSn = findViewById(R.id.tvSn);
|
||||
tvToken = findViewById(R.id.tvToken);
|
||||
btnJumpToNet = findViewById(R.id.btnJumpToNet);
|
||||
|
||||
btnRefreshToken.setOnClickListener(v -> {
|
||||
tvSn.setText("SN:" + MoGoAiCloudClient.getInstance().getAiCloudClientConfig().getSn());
|
||||
tvToken.setText("Token:" + MoGoAiCloudClient.getInstance().getAiCloudClientConfig().getToken());
|
||||
});
|
||||
|
||||
btnJumpToNet.setOnClickListener(v -> {
|
||||
Intent intent = new Intent(this, NetworkActivity.class);
|
||||
startActivity(intent);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.mogo.cloud.network;
|
||||
|
||||
import com.mogo.cloud.network.V2XRoadDataRes;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.cloud.network;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
@@ -10,6 +11,10 @@ import androidx.appcompat.app.AppCompatActivity;
|
||||
import com.google.gson.Gson;
|
||||
import com.mogo.cloud.R;
|
||||
import com.mogo.cloud.commons.network.RetrofitFactory;
|
||||
import com.mogo.cloud.tanlu.UploadManager;
|
||||
import com.mogo.cloud.tanlu.api.ITanluUploadCallback;
|
||||
import com.mogo.cloud.tanlu.bean.InformationBody;
|
||||
import com.mogo.cloud.tanlu.bean.UploadResult;
|
||||
|
||||
|
||||
import java.util.HashMap;
|
||||
@@ -38,16 +43,35 @@ public class NetworkActivity extends AppCompatActivity {
|
||||
tvResult = (TextView) findViewById(R.id.tv_result);
|
||||
apiService = RetrofitFactory.INSTANCE.getInstance("http://dzt-test.zhidaozhixing.com")
|
||||
.create(ApiService.class);
|
||||
|
||||
btn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
tvResult.setText("结果显示");
|
||||
queryRoadData("ZD802C1938L10797");
|
||||
// queryHelpSignal("ZD802C1938L10797");
|
||||
// queryRoadData("ZD802C1938L10797");
|
||||
// queryHelpSignal("ZD802C1938L10797");
|
||||
|
||||
UploadManager.getInstance(NetworkActivity.this).loadUpload(new InformationBody(), new ITanluUploadCallback() {
|
||||
@Override
|
||||
public void onSuccess(UploadResult result) {
|
||||
Log.d("liyz", "result.id = " + result.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(int code) {
|
||||
Log.d("liyz", " code = " + code);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.d("liyz", "onError e = " + e);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void queryRoadData(String sn) {
|
||||
if (apiService != null) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
|
||||
@@ -29,4 +29,11 @@
|
||||
android:text="Token:"
|
||||
android:textSize="20dp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnJumpToNet"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="跳转到网络测试" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -58,8 +58,8 @@ dependencies {
|
||||
api rootProject.ext.dependencies.retrofitadapter
|
||||
api rootProject.ext.dependencies.retrofitconvertergson
|
||||
api rootProject.ext.dependencies.retrofitconverterscalars
|
||||
implementation project(path: ':foudations:mogo-httpdns')
|
||||
implementation project(path: ':foudations:mogo-passport')
|
||||
// api 'com.mogo.cloud:passport:1.0.0'
|
||||
// api 'com.mogo.cloud:httpdns:1.0.0'
|
||||
api project(path: ':foudations:mogo-httpdns')
|
||||
api project(path: ':foudations:mogo-passport')
|
||||
|
||||
|
||||
}
|
||||
@@ -1,14 +1,13 @@
|
||||
plugins {
|
||||
id 'com.android.library'
|
||||
}
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-android-extensions'
|
||||
|
||||
android {
|
||||
compileSdkVersion 30
|
||||
buildToolsVersion "30.0.3"
|
||||
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 26
|
||||
targetSdkVersion 30
|
||||
minSdkVersion rootProject.ext.android.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.android.targetSdkVersion
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
@@ -29,21 +28,15 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
implementation rootProject.ext.dependencies.androidxccorektx
|
||||
|
||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||
implementation 'com.google.android.material:material:1.2.1'
|
||||
testImplementation 'junit:junit:4.+'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
||||
implementation rootProject.ext.dependencies.androidxappcompat
|
||||
implementation rootProject.ext.dependencies.androidxconstraintlayout
|
||||
|
||||
implementation rootProject.ext.dependencies.retrofit
|
||||
implementation rootProject.ext.dependencies.retrofitconvertergson
|
||||
implementation rootProject.ext.dependencies.gson
|
||||
implementation rootProject.ext.dependencies.rxjava
|
||||
|
||||
implementation 'com.elegant.spi:api:1.0.9'
|
||||
annotationProcessor 'com.elegant.spi:compiler:1.0.3'
|
||||
|
||||
implementation project(path: ':foudations:mogo-passport')
|
||||
implementation rootProject.ext.dependencies.rxandroid
|
||||
implementation project(path: ':foudations:mogo-commons')
|
||||
|
||||
}
|
||||
4
modules/mogo-tanlu/gradle.properties
Normal file
4
modules/mogo-tanlu/gradle.properties
Normal file
@@ -0,0 +1,4 @@
|
||||
GROUP=com.mogo.cloud
|
||||
POM_ARTIFACT_ID=tanlu
|
||||
VERSION_CODE=1
|
||||
VERSION_NAME=1.0.0
|
||||
@@ -1,26 +0,0 @@
|
||||
package com.mogo.cloud;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class ExampleInstrumentedTest {
|
||||
@Test
|
||||
public void useAppContext() {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||
assertEquals("com.mogo.tanlu.test", appContext.getPackageName());
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mogo.cloud">
|
||||
package="com.mogo.cloud.tanlu">
|
||||
|
||||
</manifest>
|
||||
@@ -1,45 +0,0 @@
|
||||
package com.mogo.cloud;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.cloud.api.ITanluUploadCallback;
|
||||
import com.mogo.cloud.bean.InformationBody;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description
|
||||
* @since 2021/1/21
|
||||
*/
|
||||
public class UploadManager {
|
||||
private static UploadManager sInstance;
|
||||
private Context mContext;
|
||||
|
||||
private UploadManager (Context context) {
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
public static UploadManager getInstance(Context context) {
|
||||
if (sInstance == null) {
|
||||
synchronized (UploadManager.class) {
|
||||
sInstance = new UploadManager(context);
|
||||
}
|
||||
}
|
||||
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param sn
|
||||
* @param informationBody
|
||||
* @param callback
|
||||
*/
|
||||
public void loadUpload(String sn, InformationBody informationBody, ITanluUploadCallback callback) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package com.mogo.cloud.impl;
|
||||
|
||||
import com.mogo.cloud.api.ILoadUpload;
|
||||
import com.mogo.cloud.api.ITanluUploadCallback;
|
||||
import com.mogo.cloud.bean.InformationBody;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 请求上报
|
||||
* @since 2021/1/20
|
||||
*/
|
||||
public class LoadUploadImpl {
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package com.mogo.cloud.tanlu;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.mogo.cloud.commons.network.RetrofitFactory;
|
||||
import com.mogo.cloud.tanlu.api.ITanluUploadCallback;
|
||||
import com.mogo.cloud.tanlu.bean.InformationBody;
|
||||
import com.mogo.cloud.tanlu.bean.UploadResult;
|
||||
import com.mogo.cloud.tanlu.net.TanluApiService;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClient;
|
||||
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description
|
||||
* @since 2021/1/21
|
||||
*/
|
||||
public class UploadManager {
|
||||
private static final String TAG = "UploadManager";
|
||||
private static UploadManager sInstance;
|
||||
private Context mContext;
|
||||
private TanluApiService apiService;
|
||||
|
||||
|
||||
private UploadManager (Context context) {
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
public static UploadManager getInstance(Context context) {
|
||||
if (sInstance == null) {
|
||||
synchronized (UploadManager.class) {
|
||||
sInstance = new UploadManager(context);
|
||||
}
|
||||
}
|
||||
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param informationBody
|
||||
* @param callback
|
||||
*
|
||||
*/
|
||||
public void loadUpload(InformationBody informationBody, ITanluUploadCallback callback) {
|
||||
apiService = RetrofitFactory.INSTANCE.getInstance("http://dzt-test.zhidaozhixing.com")
|
||||
.create(TanluApiService.class);
|
||||
|
||||
Gson gson = new Gson();
|
||||
Map<String, String> map = new HashMap<>();
|
||||
// map.put("sn", MoGoAiCloudClient.getInstance().getAiCloudClientConfig().getSn()); //TODO
|
||||
// map.put("data", gson.toJson(informationBody));
|
||||
|
||||
map.put("sn", "F803EB2046PZD00228");
|
||||
map.put("data", "{\"addr\":\"北京市东城区小黄庄北街2号靠近中国银行(北京安贞桥支行)\",\"areaCode\":\"110101\",\"areaName\":\"东城区\",\"cityCode\":\"010\",\"cityName\":\"北京市\",\"data\":\"[{\\\"thumbnail\\\":\\\"http://petchfile-1255510688.cos.ap-beijing.myqcloud.com/CarPad/com.zhidao.roadcondition/F803EB2046PZD00228/F803EB2046PZD00228_20210121165329/Thumbnail1611219200669.jpg\\\",\\\"url\\\":\\\"http://petchfile-1255510688.cos.ap-beijing.myqcloud.com/CarPad/com.zhidao.roadcondition/F803EB2046PZD00228/F803EB2046PZD00228_20210121165329/compress_video_20210121165307.mp4\\\"}]\",\"direction\":0.0,\"fromType\":\"2\",\"generateTime\":1611219213616,\"infoTimeout\":240,\"infoType\":1,\"isShare\":false,\"lat\":39.968317,\"lon\":116.410892,\"mainInfoId\":0,\"poiType\":\"10008\",\"provinceName\":\"北京市\",\"sn\":\"F803EB2046PZD00228\",\"speed\":0.0,\"street\":\"小黄庄北街\",\"trafficInfoType\":\"\",\"type\":1,\"uid\":0}");
|
||||
|
||||
Log.d(TAG, "sn = " + MoGoAiCloudClient.getInstance().getAiCloudClientConfig().getSn());
|
||||
apiService.uploadInformation(map)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<UploadResult>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.d(TAG, "onSubscribe -----> ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(UploadResult result) {
|
||||
Log.d(TAG, "onNext -----> ");
|
||||
callback.onSuccess(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e(TAG, "onError -----> e " + e);
|
||||
callback.onError(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.d(TAG, "onComplete -----> ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.mogo.cloud.api;
|
||||
package com.mogo.cloud.tanlu.api;
|
||||
|
||||
|
||||
import com.mogo.cloud.bean.InformationBody;
|
||||
import com.mogo.cloud.tanlu.bean.InformationBody;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.mogo.cloud.api;
|
||||
package com.mogo.cloud.tanlu.api;
|
||||
|
||||
import com.mogo.cloud.bean.RoadInfos;
|
||||
import com.mogo.cloud.tanlu.bean.RoadInfos;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
@@ -10,4 +10,5 @@ import com.mogo.cloud.bean.RoadInfos;
|
||||
public interface IRoadInfoSearchCallback {
|
||||
void onSuccess(RoadInfos result);
|
||||
void onFailure(int code);
|
||||
void onError(Throwable e);
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.mogo.cloud.api;
|
||||
package com.mogo.cloud.tanlu.api;
|
||||
|
||||
import com.mogo.cloud.bean.UploadResult;
|
||||
import com.mogo.cloud.tanlu.bean.UploadResult;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
@@ -10,4 +10,5 @@ import com.mogo.cloud.bean.UploadResult;
|
||||
public interface ITanluUploadCallback {
|
||||
void onSuccess(UploadResult result);
|
||||
void onFailure(int code);
|
||||
void onError(Throwable e);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.cloud.bean;
|
||||
package com.mogo.cloud.tanlu.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.mogo.cloud.bean;
|
||||
package com.mogo.cloud.tanlu.bean;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.cloud.bean.location.MarkerLocation;
|
||||
import com.mogo.cloud.tanlu.bean.location.MarkerLocation;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.cloud.bean;
|
||||
package com.mogo.cloud.tanlu.bean;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.cloud.bean;
|
||||
package com.mogo.cloud.tanlu.bean;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.mogo.cloud.bean;
|
||||
package com.mogo.cloud.tanlu.bean;
|
||||
|
||||
import com.mogo.cloud.bean.location.Location;
|
||||
import com.mogo.cloud.tanlu.bean.location.Location;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.cloud.bean;
|
||||
package com.mogo.cloud.tanlu.bean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.cloud.bean;
|
||||
package com.mogo.cloud.tanlu.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.cloud.bean.location;
|
||||
package com.mogo.cloud.tanlu.bean.location;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.cloud.bean.location;
|
||||
package com.mogo.cloud.tanlu.bean.location;
|
||||
|
||||
|
||||
import android.text.TextUtils;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.cloud.bean.location;
|
||||
package com.mogo.cloud.tanlu.bean.location;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.cloud.constant;
|
||||
package com.mogo.cloud.tanlu.constant;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.mogo.cloud.net;
|
||||
package com.mogo.cloud.tanlu.net;
|
||||
|
||||
import com.mogo.cloud.bean.RoadInfos;
|
||||
import com.mogo.cloud.bean.UploadResult;
|
||||
import com.mogo.cloud.tanlu.bean.RoadInfos;
|
||||
import com.mogo.cloud.tanlu.bean.UploadResult;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.mogo.cloud;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
public class ExampleUnitTest {
|
||||
@Test
|
||||
public void addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user