Merge branch 'dev' of gitlab.zhidaoauto.com:ecos/yycp-service/Launcher into dev

This commit is contained in:
wangcongtao
2020-08-03 11:10:44 +08:00
10 changed files with 118 additions and 3 deletions

3
.idea/gradle.xml generated
View File

@@ -41,6 +41,9 @@
<option value="$PROJECT_DIR$/modules/mogo-module-map" />
<option value="$PROJECT_DIR$/modules/mogo-module-media" />
<option value="$PROJECT_DIR$/modules/mogo-module-obu" />
<option value="$PROJECT_DIR$/modules/mogo-module-push" />
<option value="$PROJECT_DIR$/modules/mogo-module-push-base" />
<option value="$PROJECT_DIR$/modules/mogo-module-push-noop" />
<option value="$PROJECT_DIR$/modules/mogo-module-search" />
<option value="$PROJECT_DIR$/modules/mogo-module-service" />
<option value="$PROJECT_DIR$/modules/mogo-module-share" />

2
.idea/misc.xml generated
View File

@@ -4,7 +4,7 @@
<asm skipDebug="false" skipFrames="false" skipCode="false" expandFrames="false" />
<groovy codeStyle="LEGACY" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="JDK" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
</project>

View File

@@ -259,6 +259,7 @@ dependencies {
implementation rootProject.ext.dependencies.moduletanlu, {
exclude group: 'com.mogo.module', module: 'module-share'
}
implementation rootProject.ext.dependencies.mogologlib
if (Boolean.valueOf(RELEASE)) {
launcherImplementation rootProject.ext.dependencies.modulemainlauncher

View File

@@ -73,6 +73,7 @@ public class MogoApplication extends AbsMogoApplication {
MogoModulePaths.addBaseModule( new MogoModule( ServiceConst.PATH_REFRESH_STRATEGY, ServiceConst.PATH_REFRESH_STRATEGY ) );
MogoModulePaths.addBaseModule( new MogoModule( V2XConst.PATH_V2X_UI, V2XConst.PATH_V2X_UI ) );
MogoModulePaths.addModule( new MogoModule( PushUIConstants.PATH, PushUIConstants.NAME ) );
MogoModulePaths.addModule(new MogoModule(MogoServicePaths.PATH_LOG_LIB, "LogLib"));
if ( !DebugConfig.isLauncher() ) {
PersistentManager.getInstance().initManager( this );

View File

@@ -172,6 +172,8 @@ targetSdkVersion : 22,
// 基础服务实现
mogobaseservicesdk : "com.mogo.base:services-sdk:${MOGO_BASE_SERVICES_SDK_VERSION}",
mogobaseserviceapk : "com.mogo.base:services-apk:${MOGO_BASE_SERVICES_APK_VERSION}",
// loglib
mogologlib : "com.mogo.module:module-loglib:${LOGLIB_VERSION}",
// google
googlezxing : "com.google.zxing:core:3.3.3",

View File

@@ -100,6 +100,9 @@ MOGO_MODULE_OBU_VERSION = 1.2.1.10-SNAPSHOT
MOGO_MODULE_SPLASH_VERSION = 1.0.0-SNAPSHOT
MOGO_MODULE_SPLASH_NOOP_VERSION = 1.0.0-SNAPSHOT
# loglib
LOGLIB_VERSION = 1.0.0-SNAPSHOT
## 产品库必备配置产品库自动对versionCode和versionName版本进行升级
applicationId=com.mogo.launcer
applicationName=IntelligentPilot

View File

@@ -0,0 +1,52 @@
package com.mogo.module.media.presenter;
import android.content.Context;
import com.mogo.module.media.model.MediaInfoData;
import com.mogo.module.media.view.IMusicView;
/**
* 空presenter实现为了减少各种空判断
*
* @author tongchenfei
*/
public class NoopPresenter extends BaseMediaPresenter<IMusicView> {
public NoopPresenter(IMusicView view) {
super(view);
}
@Override
public void init(Context context) {
}
@Override
public void play(MediaInfoData mediaInfoData) {
}
@Override
public void pause(MediaInfoData mediaInfoData) {
}
@Override
public void stop(MediaInfoData mediaInfoData) {
}
@Override
public void pre() {
}
@Override
public void next() {
}
@Override
public void openApp() {
}
}

View File

@@ -0,0 +1,45 @@
package com.mogo.module.media.presenter;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import com.mogo.module.media.view.IMusicView;
import java.util.List;
/**
* Presenter简单工厂根据包名判断选择哪个presenter
*
* @author tongchenfei
*/
public class PresenterFactory {
private static final String KW_PKG_NAME = "cn.kuwo.kwmusiccar";
private static final String WE_CAR_FLOW_PKG_NAME = "com.tencent.wecarflow";
/**
* 获取泛型是IMusicView的BaseMediaPresenter
*
* @param context 上下文,用来遍历机器上的包名
* @param view IMusicView用来做view展示
* @return presenter
*/
public static BaseMediaPresenter<IMusicView> createMusicViewPresenter(Context context,
IMusicView view) {
BaseMediaPresenter<IMusicView> result = null;
PackageManager pkm = context.getPackageManager();
List<PackageInfo> pkgInfoList = pkm.getInstalledPackages(0);
// 只做了两级优先级判断,比较简单
for (PackageInfo pkgInfo : pkgInfoList) {
if (pkgInfo.packageName.equals(KW_PKG_NAME)) {
result = new KwPresenter(view);
} else if (pkgInfo.packageName.equals(WE_CAR_FLOW_PKG_NAME) && result == null) {
result = new WeCarFlowPresenter(view);
}
}
if (result == null) {
result = new NoopPresenter(view);
}
return result;
}
}

View File

@@ -17,7 +17,9 @@ import com.mogo.module.media.ServiceMediaHandler;
import com.mogo.module.media.constants.MusicConstant;
import com.mogo.module.media.listener.NoDoubleClickListener;
import com.mogo.module.media.model.MediaInfoData;
import com.mogo.module.media.presenter.BaseMediaPresenter;
import com.mogo.module.media.presenter.KwPresenter;
import com.mogo.module.media.presenter.PresenterFactory;
import com.mogo.module.media.utils.Utils;
import com.mogo.module.media.view.IMusicView;
import com.mogo.module.media.widget.AnimCircleImageView;
@@ -41,7 +43,7 @@ public class MediaWindow2 implements IMusicView {
public static final String TAG = MediaWindow2.class.getName();
private Context mContext;
private KwPresenter mPresenter;
private BaseMediaPresenter<IMusicView> mPresenter;
private MediaInfoData mMediaInfoData = new MediaInfoData();
@@ -60,7 +62,7 @@ public class MediaWindow2 implements IMusicView {
public void initMedia(Context context) {
mContext = context;
mPresenter = new KwPresenter(this);
mPresenter = PresenterFactory.createMusicViewPresenter(context, this);
mPresenter.init(context);
if(DebugConfig.isLauncher()) {

View File

@@ -226,4 +226,10 @@ public class MogoServicePaths {
*/
@Deprecated
public static final String PATH_AGREEMENT = "/agreement/showFragment";
/**
* 日志上传
*/
@Deprecated
public static final String PATH_LOG_LIB = "/loglib/api";
}