This commit is contained in:
wangcongtao
2020-01-03 10:31:05 +08:00
parent aaf91855e9
commit cffe6f626a
28 changed files with 754 additions and 30 deletions

View File

@@ -87,6 +87,7 @@ ext {
modulecommon : "com.mogo.module:module-common:${MOGO_MODULE_COMMON_VERSION}",
modulemain : "com.mogo.module:module-main:${MOGO_MODULE_MAIN_VERSION}",
modulemap : "com.mogo.module:module-map:${MOGO_MODULE_MAP_VERSION}",
moduleservice : "com.mogo.module:module-service:${MOGO_MODULE_SERVICE_VERSION}",
mogoservice : "com.mogo.service:mogo-service:${MOGO_SERVICE_VERSION}",
mogoserviceapi : "com.mogo.service:mogo-service-api:${MOGO_SERVICE_API_VERSION}",
moduleapps : "com.mogo.module:module-apps:${MOGO_MODULE_APPS_VERSION}",
@@ -99,5 +100,8 @@ ext {
//
jetbrainsannotationsjava5: "org.jetbrains:annotations-java5:15.0",
// 统一登录
accountsdk : "com.zhidao.accountservice:account-sdk:1.0.0.1@aar",
]
}

View File

@@ -38,8 +38,10 @@ dependencies {
annotationProcessor rootProject.ext.dependencies.aroutercompiler
if (Boolean.valueOf(RELEASE)) {
implementation rootProject.ext.dependencies.mogoutils
compileOnly rootProject.ext.dependencies.mogomapapi
} else {
implementation project(":foudations:mogo-utils")
compileOnly project(":libraries:mogo-map-api")
}
}

View File

@@ -1,12 +1,28 @@
package com.mogo.commons;
import android.app.Application;
import android.content.Context;
import com.alibaba.android.arouter.launcher.ARouter;
import com.bumptech.glide.load.model.GlideUrl;
import com.elegant.analytics.Analytics;
import com.elegant.analytics.AnalyticsConfig;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.commons.network.AllAllowedHostnameVerifier;
import com.mogo.commons.network.Constants;
import com.mogo.commons.network.ParamsUtil;
import com.mogo.commons.network.X509TrustManagerImpl;
import com.mogo.utils.TipToast;
import com.mogo.utils.glide.GlideApp;
import com.mogo.utils.network.NetConfig;
import java.io.InputStream;
import java.security.SecureRandom;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import okhttp3.OkHttpClient;
/**
* @author congtaowang
@@ -48,6 +64,39 @@ public class AbsMogoApplication extends Application {
// 初始化toast
TipToast.init( sApp, null );
initNetConfig();
initAccountSdk();
}
private static void initNetConfig() {
try {
SSLContext sc = getSslContext();
NetConfig.instance().setSslContext( sc );
} catch ( Exception e ) {
}
NetConfig.instance().setSignaturePrefix( Constants.SIGN_PREFIX )
.setPublicParams( ParamsUtil.getStaticParams() )
.setHostnameVerifier( new AllAllowedHostnameVerifier() )
.setLoggable( DebugConfig.isDebug() );
}
/**
* 忽略 https 验证
*
* @return
* @throws Exception
*/
private static SSLContext getSslContext() throws Exception {
SSLContext sc = null;
sc = SSLContext.getInstance( "SSL" );
sc.init( null, new TrustManager[]{new X509TrustManagerImpl()}, new SecureRandom() );
return sc;
}
private static void initAccountSdk(){
// AccountClientManager.init(context,businessType,appId);
}
}

View File

@@ -1,7 +1,7 @@
package com.mogo.commons.analytics;
import com.elegant.analytics.Analytics;
import com.mogo.commons.network.ParamUtils;
import com.mogo.commons.network.ParamsUtil;
import java.util.Map;
@@ -20,7 +20,7 @@ public class AnalyticsUtils {
* @param properties 事件参数
*/
public static void track( String event, Map< String, Object > properties ) {
Analytics.getInstance().setCustomParams( ParamUtils.getAnalyticsParameters() );
Analytics.getInstance().setCustomParams( ParamsUtil.getAnalyticsCustomParams() );
Analytics.getInstance().track( event, properties );
}
}

View File

@@ -0,0 +1,27 @@
package com.mogo.commons.network;
public interface Constants {
String UTF_8 = "UTF-8";
String KEY_PHONE = "user_phone";
String KEY_TOKEN = "user_token ";
String KEY_USER_ID = "userId";
String KEY_DISPLAY_NAME = "displayName";
String KEY_SN = "sn";
String OS = "Android-Car";
String KEY_SOURCE = ServerParam.SOURCE;
String DEFAULT_SOURCE = "appLauncher";
// 车机已绑定状态
int STATUS_BIND = 1;
String KEY_TICKET = "ticket";
/**
* signsalt
*/
String SIGN_PREFIX = "JGjZx6";
}

View File

@@ -0,0 +1,27 @@
package com.mogo.commons.network;
import android.text.TextUtils;
import com.mogo.utils.logger.Logger;
import com.mogo.utils.network.BaseParams;
import com.mogo.utils.network.HttpParams;
/**
* Created by congtaowang on 2018/10/21.
*/
public class HttpParamsEx extends HttpParams {
private static final String TAG = "HttpParamsEx";
@Override
public BaseParams put( String key, Object value ) {
if ( !TextUtils.isEmpty( key ) ) {
if ( value == null ) {
Logger.e( TAG, "%s with illegal value", key );
}
}
return super.put( key, value );
}
}

View File

@@ -0,0 +1,42 @@
package com.mogo.commons.network;
import com.mogo.map.location.MogoLocation;
/**
* @author congtaowang
* @since 2020-01-02
* <p>
* 缓存当前经纬度位置,便于接口请求
*/
public class LocationHelper {
private static volatile LocationHelper sInstance;
private LocationHelper() {
}
public static LocationHelper getInstance() {
if ( sInstance == null ) {
synchronized ( LocationHelper.class ) {
if ( sInstance == null ) {
sInstance = new LocationHelper();
}
}
}
return sInstance;
}
public synchronized void release() {
sInstance = null;
}
private MogoLocation mMogoLocation;
public MogoLocation getMogoLocation() {
return mMogoLocation;
}
public void setMogoLocation( MogoLocation mogoLocation ) {
this.mMogoLocation = mogoLocation;
}
}

View File

@@ -1,16 +0,0 @@
package com.mogo.commons.network;
import java.util.Map;
/**
* @author congtaowang
* @since 2019-12-23
* <p>
* 描述
*/
public class ParamUtils {
public static Map< String, Object > getAnalyticsParameters() {
return null;
}
}

View File

@@ -0,0 +1,72 @@
package com.mogo.commons.network;
import android.content.Context;
import com.mogo.utils.CheckUtils;
import com.mogo.utils.network.HttpParams;
import com.mogo.utils.network.NetConfig;
import com.mogo.utils.network.ServerParam;
import com.mogo.utils.network.utils.SignUtil;
import java.util.Map;
import java.util.Set;
public class ParamsProvider {
private static Map< String, Object > getParams( Context context ) {
return getParams( context, new HttpParams(), Constants.SIGN_PREFIX );
}
private static Map< String, Object > getParams( Context context, HttpParams httpParams, String salt ) {
final Map< String, Object > publicParams = NetConfig.instance().getPublicParams();
if ( !CheckUtils.isEmpty( publicParams ) ) {
for ( Map.Entry< String, Object > entry : publicParams.entrySet() ) {
httpParams.put( entry.getKey(), entry.getValue() );
}
}
final Map< String, Object > dynamicParams = ParamsUtil.getDynamicParams();
if ( !CheckUtils.isEmpty( dynamicParams ) ) {
for ( Map.Entry< String, Object > entry : dynamicParams.entrySet() ) {
httpParams.put( entry.getKey(), entry.getValue() );
}
}
httpParams.put( ServerParam.SIGNATURE, SignUtil.createSign( httpParams.getParamsMap(), salt ) );
return httpParams.getParamsMap();
}
public static final class Builder {
private HttpParams mHttpParams;
private Context mContext;
public Builder( Context context ) {
this.mHttpParams = new HttpParamsEx();
this.mContext = context;
}
public Builder append( String key, Object value ) {
mHttpParams.put( key, value );
return this;
}
public Builder append( Map< String, Object > keyValuePairs ) {
if ( keyValuePairs != null && !keyValuePairs.isEmpty() ) {
final Set< Map.Entry< String, Object > > entries = keyValuePairs.entrySet();
for ( Map.Entry< String, Object > entry : entries ) {
this.append( entry.getKey(), entry.getValue() );
}
}
return this;
}
public Map< String, Object > build() {
return build( Constants.SIGN_PREFIX );
}
public Map< String, Object > build( String salt ) {
return getParams( mContext, mHttpParams, salt );
}
}
}

View File

@@ -0,0 +1,153 @@
package com.mogo.commons.network;
import android.os.Build;
import android.text.TextUtils;
import androidx.annotation.NonNull;
import androidx.collection.ArrayMap;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.map.location.MogoLocation;
import com.mogo.utils.CommonUtils;
import com.mogo.utils.DeviceIdUtils;
import com.mogo.utils.WindowUtils;
import com.mogo.utils.logger.Logger;
import com.mogo.utils.network.utils.GsonUtil;
import com.zhidao.auto.platform.util.DeviceUtil;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.Map;
import java.util.Set;
import okhttp3.RequestBody;
public class ParamsUtil {
private static final String TAG = "ParamsUtil";
public static Map< String, Object > getDynamicParams() {
Map< String, Object > params = new ArrayMap();
final MogoLocation location = LocationHelper.getInstance().getMogoLocation();
if ( location != null ) {
params.put( ServerParam.CITY_CODE, location.getCityCode() );
params.put( ServerParam.AD_CODE, location.getAdCode() );
params.put( ServerParam.LAT, location.getLatitude() );
params.put( ServerParam.LNG, location.getLongitude() );
}
params.put( ServerParam.NET_TYPE, CommonUtils.getNetworkType( AbsMogoApplication.getApp() ) );
params.put( ServerParam.CELL_ID, Utils.getCellId( AbsMogoApplication.getApp() ) );
params.put( ServerParam.DISPLAY_ID, DeviceUtil.getSystemVersion() );
params.put( ServerParam.SN, Utils.getSn() );
return params;
}
private static final Map< String, Object > STATIC_PARAMS = new ArrayMap<>();
static {
STATIC_PARAMS.put( ServerParam.BRAND, Build.BRAND );
STATIC_PARAMS.put( ServerParam.MANUFACTURER, Build.MANUFACTURER );
STATIC_PARAMS.put( ServerParam.MODEL, Build.MODEL );
STATIC_PARAMS.put( ServerParam.PRODUCT, Build.PRODUCT );
STATIC_PARAMS.put( ServerParam.OS, Constants.OS );
STATIC_PARAMS.put( ServerParam.OS_VERSION, Build.VERSION.RELEASE );
STATIC_PARAMS.put( ServerParam.MOBILE_MODEL, CommonUtils.getModel() );
STATIC_PARAMS.put( ServerParam.VERSION_CODE, CommonUtils.getVersionCode( AbsMogoApplication.getApp() ) );
STATIC_PARAMS.put( ServerParam.VERSION_NAME, CommonUtils.getVersionName( AbsMogoApplication.getApp() ) );
STATIC_PARAMS.put( ServerParam.SCREEN_PIXELS, WindowUtils.getScreenPixels( AbsMogoApplication.getApp() ) );
STATIC_PARAMS.put( ServerParam.ANDROID_ID, CommonUtils.getAndroidID( AbsMogoApplication.getApp() ) );
STATIC_PARAMS.put( ServerParam.DEVICE_ID, DeviceIdUtils.getDeviceId( AbsMogoApplication.getApp() ) );
STATIC_PARAMS.put( ServerParam.IMEI, CommonUtils.getIMEI( AbsMogoApplication.getApp() ) );
STATIC_PARAMS.put( ServerParam.IMSI, CommonUtils.getIMSI( AbsMogoApplication.getApp() ) );
STATIC_PARAMS.put( ServerParam.END_POINT, ServerParam.END_POINT_CAR );
}
public static Map< String, Object > getStaticParams() {
return STATIC_PARAMS;
}
public static Map< String, Object > getAnalyticsCustomParams() {
Map< String, Object > map = new ArrayMap<>();
map.put( "debug", DebugConfig.isDebug() ? 1 : 0 );
return map;
}
public static RequestBody convert( Map< String, Object > map ) {
String json = GsonUtil.getGson().toJson( map );
Logger.d( TAG, "request params: %s", json );
RequestBody requestBody = RequestBody.create( okhttp3.MediaType.parse( "application/json; charset=utf-8" ), json );
return requestBody;
}
/**
* post 请求only
*
* @param url 地址
* @param params 参数 (公共+业务+签名)
* @param businessParams query 串中不需要保留的参数,一般为业务参数
* @return
*/
public static String toQueryUrl( @NonNull String url, Map< String, Object > params, Map< String, Object > businessParams ) {
if ( TextUtils.isEmpty( url ) ) {
return url;
}
params = diff( params, businessParams );
if ( params == null || params.isEmpty() ) {
return url;
}
final Set< String > keys = params.keySet();
StringBuilder builder = new StringBuilder();
for ( String key : keys ) {
if ( TextUtils.isEmpty( key ) ) {
Logger.w( TAG, "key is illegal" );
continue;
}
final Object value = params.get( key );
if ( value == null ) {
Logger.w( TAG, "%s - value is illegal", key );
continue;
}
String targetValue = value.toString();
try {
targetValue = URLEncoder.encode( targetValue, "utf-8" );
} catch ( UnsupportedEncodingException e ) {
targetValue = value.toString();
}
builder.append( key ).append( "=" ).append( targetValue ).append( "&" );
}
String queryString = builder.toString();
if ( queryString.endsWith( "&" ) ) {
queryString = queryString.substring( 0, queryString.length() - 1 );
}
if ( !url.endsWith( "?" ) ) {
url += "?";
}
return url + queryString;
}
/**
* @param parent 全部参数
* @param child 业务参数
* @return
*/
public static Map< String, Object > diff( Map< String, Object > parent, Map< String, Object > child ) {
if ( parent == null || parent.isEmpty() || child == null || child.isEmpty() ) {
return parent;
}
for ( String key : child.keySet() ) {
if ( TextUtils.isEmpty( key ) || TextUtils.equals( "extra_id", key ) ) {
continue;
}
parent.remove( key );
}
return parent;
}
}

View File

@@ -0,0 +1,45 @@
package com.mogo.commons.network;
class ServerParam {
public static final String LAT = "lat";
public static final String LNG = "lng";
public static final String CITY_CODE = "cityCode";
public static final String AD_CODE = "adCode";
public static final String SELECTED_AD_CODE = "selectedAdCode";
// 用户名
public static final String DISPLAY_NAME = "displayName";
public static final String OS = "os";
public static final String BRAND = "brand";
public static final String MANUFACTURER = "manufacturer";
public static final String MODEL = "model";
public static final String OS_VERSION = "osVersion";
public static final String PRODUCT = "product";
// 系统版本号
public static final String DISPLAY_ID = "displayId";
public static final String MOBILE_MODEL = "hardWareModel";
public static final String CELL_ID = "cellId";
public static final String IMEI = "imei";
public static final String IMSI = "imsi";
public static final String SOURCE = "source";
public static final String NET_TYPE = "netType";
public static final String VERSION_CODE = "appVersionCode";
public static final String VERSION_NAME = "appVersion";
public static final String SCREEN_PIXELS = "pixels";
public static final String ANDROID_ID = "androidId";
public static final String DEVICE_ID = "deviceId";
public static final String SN = "sn";
public static final String CHANNEL = "channel";
public static final String USER_ID = "userId";
public static final String FILE = "file";
public static final String END_POINT = "endPoint";
public static final String END_POINT_CAR = "CAR";
public static final String PHONE = "phone";
public static final String TICKET = "ticket";
}

View File

@@ -0,0 +1,91 @@
package com.mogo.commons.network;
import android.content.Context;
import com.mogo.commons.data.BaseData;
import com.mogo.utils.logger.Logger;
import com.mogo.utils.network.RequestOptions;
import com.mogo.utils.network.utils.GsonUtil;
import com.mogo.utils.network.utils.Util;
import rx.Subscriber;
/**
* Created by congtaowang on 2018/10/14.
*/
public abstract class SubscribeImpl< T extends BaseData > extends Subscriber< T > {
protected final RequestOptions mRequestOptions;
private static final String TAG = "SubscribeImpl";
private boolean mAutoTipMsg = true;
public SubscribeImpl( RequestOptions requestOptions ) {
mRequestOptions = requestOptions;
}
public SubscribeImpl( RequestOptions requestOptions, boolean autoTipMsg ) {
this( requestOptions );
mAutoTipMsg = autoTipMsg;
}
@Override
public void onStart() {
super.onStart();
if ( !Util.checkAlive( mRequestOptions.getCaller() ) ) {
unsubscribe();
return;
}
final Context context = Util.getContext( mRequestOptions.getCaller() );
}
@Override
public void onCompleted() {
onFinish();
}
private void onFinish() {
onUnsubscribe();
if ( !Util.checkAlive( mRequestOptions.getCaller() ) ) {
unsubscribe();
}
}
private void onUnsubscribe() {
final Context context = Util.getContext( mRequestOptions.getCaller() );
}
@Override
public void onError( Throwable e ) {
onFinish();
Logger.e( TAG, e, "occur when net request." );
}
@Override
public void onNext( T o ) {
if ( o != null ) {
if ( o.code != 0 ) {
onError( o.msg, o.code );
} else {
onSuccess( o );
}
} else {
onError( "", -1 );
}
}
public void onSuccess( T o ) {
Logger.e( TAG, GsonUtil.jsonFromObject( o ) );
}
public void onError( String message, int code ) {
Logger.e( TAG, "%d - %s", code, message );
}
private static boolean isTicketUpdated = false;
private void onUpdateTicket() {
}
}

View File

@@ -0,0 +1,79 @@
package com.mogo.commons.network;
import android.Manifest;
import android.content.Context;
import android.content.pm.PackageManager;
import android.telephony.CellLocation;
import android.telephony.TelephonyManager;
import android.telephony.cdma.CdmaCellLocation;
import android.telephony.gsm.GsmCellLocation;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
/**
* Created by congtaowang on 2018/3/29.
*/
class Utils {
public static String getCellId( Context context ) {
TelephonyManager tm = ( TelephonyManager ) context.getSystemService( Context.TELEPHONY_SERVICE );
if ( tm == null ) {
return "";
}
PackageManager pm = context.getPackageManager();
boolean accessCoarseLocationPermission = ( PackageManager.PERMISSION_GRANTED ==
pm.checkPermission( Manifest.permission.ACCESS_COARSE_LOCATION, context.getPackageName() ) );
boolean accessFineLocationPermission = ( PackageManager.PERMISSION_GRANTED ==
pm.checkPermission( Manifest.permission.ACCESS_FINE_LOCATION, context.getPackageName() ) );
if ( !accessCoarseLocationPermission || !accessFineLocationPermission )
return "noPermission";
CellLocation location = null;
try {
location = tm.getCellLocation();
} catch ( Exception e ) {
e.printStackTrace();
}
if ( location != null ) {
// Gsm网络 , 联通移动的网络属于这一套
if ( location instanceof GsmCellLocation ) {
GsmCellLocation gsmLoc = ( GsmCellLocation ) location;
int cellid = gsmLoc.getCid();
return String.valueOf( cellid );
// Cdma网络 , 电信网络属于这一种
} else if ( location instanceof CdmaCellLocation ) {
CdmaCellLocation cdmaLoc = ( CdmaCellLocation ) location;
return String.valueOf( cdmaLoc.getBaseStationId() );
}
}
return "";
}
public static final String GET = "get";
public static final String GSM_SERIAL = "gsm.serial";
public static final String PROPERTIES = "android.os.SystemProperties";
public static String getSn() {
String serial = "";
try {
Class< ? > c = Class.forName( PROPERTIES );
Method get = c.getMethod( GET, String.class );
serial = ( String ) get.invoke( c, GSM_SERIAL );
} catch ( ClassNotFoundException var3 ) {
var3.printStackTrace();
} catch ( NoSuchMethodException var4 ) {
var4.printStackTrace();
} catch ( InvocationTargetException var5 ) {
var5.printStackTrace();
} catch ( IllegalAccessException var6 ) {
var6.printStackTrace();
}
return serial;
}
}

View File

@@ -17,7 +17,7 @@ public class RequestOptions {
private Context context;
private Map< String, Object > parameter;
private CharSequence loadingMessage;
private boolean loading;
private boolean loading = false;
private boolean cancelable;
private boolean cancelableOnTouchOutside;
@@ -65,7 +65,7 @@ public class RequestOptions {
/**
* Mutator for indicating whether loading message should be displayed while request is ongoing
*/
public RequestOptions loading( boolean loading ) {
private RequestOptions loading( boolean loading ) {
this.loading = loading;
return this;
}
@@ -73,7 +73,7 @@ public class RequestOptions {
/**
* Mutator for loading message
*/
public RequestOptions loadingMessage( CharSequence loadingMessage ) {
private RequestOptions loadingMessage( CharSequence loadingMessage ) {
this.loading = true;
this.loadingMessage = loadingMessage;
return this;

View File

@@ -17,6 +17,8 @@ org.gradle.jvmargs=-Xmx1536m
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
## maven 配置
RELEASE_REPOSITORY_URL=http://nexus.zhidaoauto.com/repository/maven-releases/
SNAPSHOT_REPOSITORY_URL=http://nexus.zhidaoauto.com/repository/maven-snapshots/
USERNAME=xintai
@@ -40,4 +42,5 @@ MOGO_SERVICE_API_VERSION=1.0.0-SNAPSHOT
MOGO_MODULE_APPS_VERSION=1.0.0-SNAPSHOT
MOGO_CONNECTION_VERSION=1.0.0-SNAPSHOT
MOGO_MODULE_NAVI_VERSION=1.0.0-SNAPSHOT
MOGO_MODULE_SERVICE_VERSION=1.0.0-SNAPSHOT

View File

@@ -10,6 +10,7 @@ import android.view.View;
import com.amap.api.maps.AMap;
import com.amap.api.maps.CameraUpdateFactory;
import com.amap.api.maps.model.BitmapDescriptorFactory;
import com.amap.api.maps.model.CameraPosition;
import com.amap.api.maps.model.LatLng;
import com.amap.api.maps.model.Marker;
import com.amap.api.maps.model.MyLocationStyle;
@@ -45,7 +46,8 @@ public class AMapNaviViewWrapper implements IMogoMapView, IMogoMapUIController,
AMap.OnMapClickListener,
AMap.OnPolylineClickListener,
AMapNaviViewListener,
AMapMessageListener {
AMapMessageListener,
AMap.OnCameraChangeListener {
private static final String TAG = "AMapNaviViewWrapper";
@@ -139,6 +141,7 @@ public class AMapNaviViewWrapper implements IMogoMapView, IMogoMapUIController,
if ( mMapView.getMap() != null ) {
mMapView.getMap().setOnPOIClickListener( this );
mMapView.getMap().setOnMapClickListener( this );
mMapView.getMap().setOnCameraChangeListener( this );
}
AMapMessageManager.getInstance().registerAMapMessageListener( this );
}
@@ -443,4 +446,14 @@ public class AMapNaviViewWrapper implements IMogoMapView, IMogoMapUIController,
public void onNaviInfoUpdat( NaviInfo naviInfo ) {
}
@Override
public void onCameraChange( CameraPosition cameraPosition ) {
}
@Override
public void onCameraChangeFinish( CameraPosition cameraPosition ) {
}
}

View File

@@ -4,7 +4,6 @@ import android.view.MotionEvent;
import com.mogo.map.MogoLatLng;
import com.mogo.map.model.MogoPoi;
import com.mogo.map.navi.IMogoNaviListener;
import com.mogo.map.uicontroller.EnumMapUI;
/**

View File

@@ -137,7 +137,7 @@ public class MogoModulesManager implements MogoModulesHandler,
@Override
public void loadPushService() {
IMogoModuleProvider provider = ( IMogoModuleProvider ) ARouter.getInstance().build( "" ).navigation( mActivity.getApplicationContext() );
IMogoModuleProvider provider = ( IMogoModuleProvider ) ARouter.getInstance().build( "/push/ui" ).navigation( mActivity.getApplicationContext() );
if ( provider != null ) {
if ( provider.getType() == IMogoModuleProvider.TYPE_SERVICE ) {

View File

@@ -0,0 +1 @@
/build

View File

@@ -0,0 +1,48 @@
apply plugin: 'com.android.library'
android {
compileSdkVersion rootProject.ext.android.compileSdkVersion
buildToolsVersion rootProject.ext.android.buildToolsVersion
defaultConfig {
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
versionCode Integer.valueOf(VERSION_CODE)
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation rootProject.ext.dependencies.androidxappcompat
implementation rootProject.ext.dependencies.androidxconstraintlayout
implementation rootProject.ext.dependencies.arouter
annotationProcessor rootProject.ext.dependencies.aroutercompiler
if (Boolean.valueOf(RELEASE)) {
api rootProject.ext.dependencies.mogomap
api rootProject.ext.dependencies.mogomapapi
api rootProject.ext.dependencies.mogoutils
api rootProject.ext.dependencies.mogocommons
api rootProject.ext.dependencies.mogoserviceapi
implementation rootProject.ext.dependencies.modulecommon
} else {
api project(":libraries:mogo-map")
api project(":libraries:mogo-map-api")
api project(":foudations:mogo-utils")
api project(":foudations:mogo-commons")
api project(':services:mogo-service-api')
implementation project(':modules:mogo-module-common')
}
}

View File

@@ -0,0 +1,3 @@
GROUP=com.mogo.module
POM_ARTIFACT_ID=module-service
VERSION_CODE=1

View File

@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View File

@@ -0,0 +1,2 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mogo.module.service" />

View File

@@ -0,0 +1,59 @@
package com.mogo.module.service;
import android.app.Service;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import androidx.fragment.app.Fragment;
import com.mogo.map.listener.IMogoMapListener;
import com.mogo.map.location.IMogoLocationListener;
import com.mogo.map.navi.IMogoNaviListener;
import com.mogo.service.module.IMogoModuleLifecycle;
import com.mogo.service.module.IMogoModuleProvider;
/**
* @author congtaowang
* @since 2020-01-03
* <p>
* service 服务:负责数据上传策略
*/
public abstract class MogoServiceProvider extends Service implements IMogoModuleProvider {
@Override
public final Fragment createFragment( Context context, Bundle data ) {
return null;
}
@Override
public final View createView( Context context ) {
return null;
}
@Override
public final IMogoModuleLifecycle getCardLifecycle() {
return null;
}
@Override
public IMogoMapListener getMapListener() {
return null;
}
@Override
public int getType() {
return TYPE_SERVICE;
}
@Override
public IMogoNaviListener getNaviListener() {
return null;
}
@Override
public IMogoLocationListener getLocationListener() {
return null;
}
}

View File

@@ -0,0 +1,3 @@
<resources>
<string name="app_name">mogo-module-service</string>
</resources>

View File

@@ -9,9 +9,8 @@ include ':modules:mogo-module-map'
include ':modules:mogo-module-common'
include ':modules:mogo-module-main'
include ':modules:mogo-module-navi'
//include ':demo:demo-module-map'
//include ':demo:demo-module-map2'
include ':modules:mogo-module-tanlu'
include ':modules:mogo-module-service'
include ':libraries:map-amap'
//include ':libraries:map-baidu'
include ':libraries:mogo-map-api'

View File

@@ -10,9 +10,7 @@
./gradlew :services:mogo-service:clean :services:mogo-service:uploadArchives
./gradlew :modules:mogo-module-common:clean :modules:mogo-module-common:uploadArchives
./gradlew :modules:mogo-module-map:clean :modules:mogo-module-map:uploadArchives
./gradlew :demo:demo-module-map:clean :demo:demo-module-map:uploadArchives
./gradlew :demo:demo-module-map2:clean :demo:demo-module-map2:uploadArchives
./gradlew :demo:tanlu-module:clean :demo:tanlu-module:uploadArchives
./gradlew :modules:mogo-module-tanlu:clean :modules:mogo-module-tanlu:uploadArchives
./gradlew :modules:mogo-module-apps:clean :modules:mogo-module-apps:uploadArchives
./gradlew :modules:mogo-module-service:clean :modules:mogo-module-service:uploadArchives
./gradlew :modules:mogo-module-main:clean :modules:mogo-module-main:uploadArchives
./gradlew :demo:mogo-module-tanlu:clean :demo:mogo-module-tanlu:uploadArchives