opt
This commit is contained in:
@@ -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