This commit is contained in:
lixiaopeng
2021-01-21 15:51:30 +08:00
parent d396c301bc
commit ef36803a8a
26 changed files with 110 additions and 151 deletions

1
.idea/gradle.xml generated
View File

@@ -22,6 +22,7 @@
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
<option name="useQualifiedModuleNames" value="true" />
</GradleProjectSettings>
</option>
</component>

View File

@@ -43,4 +43,7 @@ dependencies {
implementation 'com.elegant.spi:api:1.0.9'
annotationProcessor 'com.elegant.spi:compiler:1.0.3'
implementation project(path: ':foudations:mogo-passport')
implementation project(path: ':foudations:mogo-commons')
}

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mogo.tanlu">
package="com.mogo.cloud">
</manifest>

View File

@@ -0,0 +1,45 @@
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) {
}
}

View File

@@ -0,0 +1,13 @@
package com.mogo.cloud.api;
import com.mogo.cloud.bean.InformationBody;
/**
* @author lixiaopeng
* @description
* @since 2021/1/20
*/
public interface ILoadUpload {
void loadUpload(String sn, InformationBody informationBody, ITanluUploadCallback callback);
}

View File

@@ -0,0 +1,13 @@
package com.mogo.cloud.api;
import com.mogo.cloud.bean.RoadInfos;
/**
* @author lixiaopeng
* @description
* @since 2021/1/20
*/
public interface IRoadInfoSearchCallback {
void onSuccess(RoadInfos result);
void onFailure(int code);
}

View File

@@ -1,13 +1,13 @@
package com.mogo.tanlu.api;
package com.mogo.cloud.api;
import com.mogo.tanlu.bean.UploadResult;
import com.mogo.cloud.bean.UploadResult;
/**
* @author lixiaopeng
* @description
* @since 2021/1/20
*/
public interface ITanluUpload {
public interface ITanluUploadCallback {
void onSuccess(UploadResult result);
void onFailure(int code);
}

View File

@@ -1,4 +1,4 @@
package com.mogo.tanlu.bean;
package com.mogo.cloud.bean;
import java.io.Serializable;

View File

@@ -1,8 +1,8 @@
package com.mogo.tanlu.bean;
package com.mogo.cloud.bean;
import android.text.TextUtils;
import com.mogo.tanlu.bean.location.MarkerLocation;
import com.mogo.cloud.bean.location.MarkerLocation;
import java.io.Serializable;
import java.util.List;

View File

@@ -1,4 +1,4 @@
package com.mogo.tanlu.bean;
package com.mogo.cloud.bean;
import android.text.TextUtils;

View File

@@ -1,4 +1,4 @@
package com.mogo.tanlu.bean;
package com.mogo.cloud.bean;
import android.text.TextUtils;

View File

@@ -1,6 +1,6 @@
package com.mogo.tanlu.bean;
package com.mogo.cloud.bean;
import com.mogo.tanlu.bean.location.Location;
import com.mogo.cloud.bean.location.Location;
import java.util.ArrayList;

View File

@@ -1,4 +1,4 @@
package com.mogo.tanlu.bean;
package com.mogo.cloud.bean;
import java.util.List;

View File

@@ -1,4 +1,4 @@
package com.mogo.tanlu.bean;
package com.mogo.cloud.bean;
import java.io.Serializable;

View File

@@ -1,4 +1,4 @@
package com.mogo.tanlu.bean.location;
package com.mogo.cloud.bean.location;
import java.io.Serializable;

View File

@@ -1,4 +1,4 @@
package com.mogo.tanlu.bean.location;
package com.mogo.cloud.bean.location;
import android.text.TextUtils;

View File

@@ -1,4 +1,4 @@
package com.mogo.tanlu.bean.location;
package com.mogo.cloud.bean.location;
import android.os.Parcel;
import android.os.Parcelable;

View File

@@ -1,4 +1,4 @@
package com.mogo.tanlu.constant;
package com.mogo.cloud.constant;
/**
* @author lixiaopeng

View File

@@ -0,0 +1,13 @@
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 {
}

View File

@@ -1,7 +1,7 @@
package com.mogo.tanlu.net;
package com.mogo.cloud.net;
import com.mogo.tanlu.bean.RoadInfos;
import com.mogo.tanlu.bean.UploadResult;
import com.mogo.cloud.bean.RoadInfos;
import com.mogo.cloud.bean.UploadResult;
import java.util.Map;

View File

@@ -1,67 +0,0 @@
package com.mogo.tanlu;
import android.os.Bundle;
import android.os.PersistableBundle;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import com.elegant.spi.AbstractDelegateManager;
import com.mogo.tanlu.api.ILoadUpload;
import com.mogo.tanlu.api.ITanluUpload;
import com.mogo.tanlu.bean.InformationBody;
import com.mogo.tanlu.bean.UploadResult;
/**
* @author lixiaopeng
* @description 纯测试,没有注册类
* @since 2021/1/20
*/
public class TestActivity extends AppCompatActivity {
// private TanluDelegateManager testDelegateManager;
private UploadDelegateManager uploadDelegateManager;
@Override
public void onCreate(@Nullable Bundle savedInstanceState, @Nullable PersistableBundle persistentState) {
super.onCreate(savedInstanceState, persistentState);
// testDelegateManager = new TanluDelegateManager();
uploadDelegateManager = new UploadDelegateManager();
}
//如何回调回去成功和失败,
//如何更加简化使用api
//是不是意味着使用方也需要添加spi
public class UploadDelegateManager extends AbstractDelegateManager<ILoadUpload> {
public UploadDelegateManager() {
//加载实现了spi接口的自定义服务
loadDelegates(TestActivity.this, ILoadUpload.class, new DelegateListener<ILoadUpload>() {
@Override
public void onDelegate(String unit, ILoadUpload p) {
//加载成功调用各个服务自定义show方法 TODO
p.loadUpload("F803EB2046PZD00228", new InformationBody());
}
});
}
}
//实现AbstractDelegateManager
// public class TanluDelegateManager extends AbstractDelegateManager<ITanluUpload> {
// public TanluDelegateManager() {
// //加载实现了spi接口的自定义服务
// loadDelegates(TestActivity.this, ITanluUpload.class, new DelegateListener<ITanluUpload>() {
// @Override
// public void onDelegate(String unit, ITanluUpload p) {
// //加载成功调用各个服务自定义show方法
// p.onFailure(0);
// p.onSuccess(new UploadResult());
// }
// });
// }
// }
}

View File

@@ -1,13 +0,0 @@
package com.mogo.tanlu.api;
import com.mogo.tanlu.bean.InformationBody;
/**
* @author lixiaopeng
* @description
* @since 2021/1/20
*/
public interface ILoadUpload {
void loadUpload(String sn, InformationBody informationBody);
}

View File

@@ -1,22 +0,0 @@
package com.mogo.tanlu.impl;
import android.util.Log;
import com.elegant.spi.annotations.Service;
import com.mogo.tanlu.api.ILoadUpload;
import com.mogo.tanlu.bean.InformationBody;
/**
* @author lixiaopeng
* @description 请求上报
* @since 2021/1/20
*/
@Service(value = LoadUploadImpl.class, unit = "tanlu")
public class LoadUploadImpl implements ILoadUpload {
@Override
public void loadUpload(String sn, InformationBody informationBody) {
//TODO
Log.d("liyz", "loadUpload sn = " + sn);
}
}

View File

@@ -1,27 +0,0 @@
package com.mogo.tanlu.impl;
import android.util.Log;
import com.elegant.spi.annotations.Service;
import com.mogo.tanlu.api.ITanluUpload;
import com.mogo.tanlu.bean.UploadResult;
/**
* @author lixiaopeng
* @description
* @since 2021/1/20
*/
@Service(value = ITanluUpload.class, unit = "tanlu")
public class TanluUploadImpl implements ITanluUpload {
@Override
public void onSuccess(UploadResult result) {
Log.d("liyz", "onSuccess ----->");
}
@Override
public void onFailure(int code) {
Log.e("liyz", "onFailure ----->");
}
}

View File

@@ -1,4 +1,4 @@
package com.mogo.tanlu;
package com.mogo.cloud;
import org.junit.Test;