Merge branch 'dev' of gitlab.zhidaoauto.com:ecos/yycp-service/Launcher into dev
This commit is contained in:
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<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>
|
||||
@@ -55,7 +55,7 @@ android {
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
manifest.srcFile 'src/independent/AndroidManifest.xml'
|
||||
manifest.srcFile 'src/main/AndroidManifest.xml'
|
||||
}
|
||||
launcher {
|
||||
manifest.srcFile 'src/launcher/AndroidManifest.xml'
|
||||
|
||||
@@ -70,7 +70,7 @@ MOGO_MODULE_GUIDESHOW_PROVIDER_VERSION=1.0.2-SNAPSHOT
|
||||
# 在线车辆F
|
||||
MOGO_MODULE_ONLINECAR_VERSION=1.0.3.2
|
||||
# v2x
|
||||
MOGO_MODULE_V2X_VERSION=1.0.23
|
||||
MOGO_MODULE_V2X_VERSION=1.0.24
|
||||
# 媒体卡片
|
||||
MOGO_MODULE_MEDIA_VERSION=1.0.4.11
|
||||
# 推送
|
||||
|
||||
@@ -29,6 +29,15 @@
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
</intent-filter>
|
||||
|
||||
<intent-filter>
|
||||
<data
|
||||
android:host="launcher"
|
||||
android:path="/main/share"
|
||||
android:scheme="mogo" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -17,6 +17,8 @@ public class MainIndependentActivity extends MainActivity {
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
// 独立app需要在onCreate里面增加处理scheme的情况
|
||||
mPresenter.handleSchemeIntent(getIntent());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -14,7 +14,8 @@ import com.mogo.module.apps.R;
|
||||
* 基础类:均衡器、方控学习、蓝牙、FM、车载设置、AUX
|
||||
*/
|
||||
public enum AppEnum {
|
||||
|
||||
// 爱趣听
|
||||
WeCarFlow("爱趣听","com.tencent.wecarflow", R.drawable.module_apps_ic_we_car_flow ),
|
||||
//"QQ音乐",
|
||||
QQMusic( "QQ音乐", "com.pvetec.musics", R.drawable.module_apps_ic_qq_music ),
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 4.1 KiB |
@@ -34,7 +34,10 @@ public class BackToMainHomeManager {
|
||||
}
|
||||
|
||||
public static void backToLauncher() {
|
||||
|
||||
if (mStatusManager == null) {
|
||||
Logger.e(TAG,"未初始化完成");
|
||||
return;
|
||||
}
|
||||
if ( mStatusManager.isMainPageOnResume() ) {
|
||||
if ( mStatusManager.isSearchUIShow() ) {
|
||||
mFragmentManager.clearAll();
|
||||
|
||||
@@ -36,10 +36,14 @@ class CustomNaviInterrupter implements Interrupter {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否用自己的导航
|
||||
* @return true-用高德公版车机版地图 false-用Launcher自己的导航
|
||||
*/
|
||||
@Override
|
||||
public boolean interrupt() {
|
||||
if ( AppUtils.isAppInstalled( AbsMogoApplication.getApp(), "com.autonavi.amapauto" )
|
||||
|| DebugConfig.isUseCustomNavi() ) {
|
||||
|| !DebugConfig.isUseCustomNavi() ) {
|
||||
Logger.d( TAG, "do not use custom map function." );
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -11,8 +11,12 @@ import androidx.annotation.Nullable;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.module.extensions.userinfo.UserInfo;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
/**
|
||||
* 天气,消息,个人头像
|
||||
*
|
||||
* @author congtaowang
|
||||
* @since 2020-01-05
|
||||
* <p>
|
||||
@@ -92,4 +96,9 @@ public class ExtensionsFragment extends MvpFragment< ExtensionsView, ExtensionsP
|
||||
mMsgContainer.setVisibility( hasMsg ? View.VISIBLE : View.GONE );
|
||||
mMsgCounter.setText( amount > MAX_DISPLAY_MSG_AMOUNT ? getString( R.string.module_ext_str_dots ) : String.valueOf( amount ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderUserInfo(UserInfo userInfo) {
|
||||
Logger.d(TAG, "renderUserInfo: " + userInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,36 @@
|
||||
package com.mogo.module.extensions;
|
||||
|
||||
import android.util.ArrayMap;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.module.extensions.net.UserInfoNetApiServices;
|
||||
import com.mogo.module.extensions.userinfo.UserInfo;
|
||||
import com.mogo.module.extensions.userinfo.UserInfoConstant;
|
||||
import com.mogo.module.extensions.userinfo.UserInfoResponse;
|
||||
import com.mogo.module.extensions.utils.ExtensionsConfig;
|
||||
import com.mogo.module.extensions.weather.Phenomena;
|
||||
import com.mogo.module.extensions.weather.WeatherCallback;
|
||||
import com.mogo.module.extensions.weather.WeatherInfo;
|
||||
import com.mogo.module.extensions.weather.WeatherModel;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.network.IMogoNetwork;
|
||||
import com.mogo.service.statusmanager.IMogoMsgCenter;
|
||||
import com.mogo.service.statusmanager.IMogoMsgCenterListener;
|
||||
import com.mogo.utils.digest.DigestUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidao.auto.platform.util.DeviceUtil;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.SingleObserver;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
|
||||
/**
|
||||
@@ -29,9 +48,13 @@ public class ExtensionsPresenter extends Presenter< ExtensionsView > implements
|
||||
|
||||
private IMogoMsgCenter mMsgCenter;
|
||||
|
||||
private IMogoNetwork mNetWork;
|
||||
|
||||
public ExtensionsPresenter( ExtensionsView view ) {
|
||||
super( view );
|
||||
mWeatherModel = new WeatherModel( getContext() );
|
||||
mNetWork =
|
||||
((IMogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(view.getContext())).getNetworkApi();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -65,6 +88,10 @@ public class ExtensionsPresenter extends Presenter< ExtensionsView > implements
|
||||
@Override
|
||||
public void onResume( @NonNull LifecycleOwner owner ) {
|
||||
super.onResume( owner );
|
||||
if(ExtensionsConfig.needRequestUserInfo()){
|
||||
// 相当于每次onResume都会请求一下个人信息,目的是能够相对及时的同步手机端的个人信息修改
|
||||
requestUserInfo();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -82,4 +109,49 @@ public class ExtensionsPresenter extends Presenter< ExtensionsView > implements
|
||||
mMsgCenter.unregisterMsgCenterListener( this );
|
||||
}
|
||||
}
|
||||
|
||||
private UserInfo userInfo;
|
||||
public void requestUserInfo() {
|
||||
Map<String, String> params = new ArrayMap<>();
|
||||
params.put("sn", DeviceUtil.getSn());
|
||||
params.put("source", "2");
|
||||
String sign = createSign(params, "JGqZw9");
|
||||
params.put("sig", sign);
|
||||
mNetWork.create(UserInfoNetApiServices.class, UserInfoConstant.getUserInfoBaseUrl()).requestUserInfo(params).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new SingleObserver<UserInfoResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(UserInfoResponse userInfoBaseResponse) {
|
||||
userInfo = userInfoBaseResponse.getResult();
|
||||
Logger.d(TAG, "获取个人信息成功: " + userInfo);
|
||||
mView.renderUserInfo(userInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
e.printStackTrace();
|
||||
Logger.e(TAG, e, "获取个人信息失败==");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private String createSign(Map<String, String> map, String salt) {
|
||||
try {
|
||||
StringBuilder queryString = new StringBuilder();
|
||||
for (Map.Entry<String, String> entry : map.entrySet()) {
|
||||
queryString.append(entry.getKey())
|
||||
.append("=")
|
||||
.append(entry.getValue())
|
||||
.append("&");
|
||||
}
|
||||
queryString.append("key=").append(DigestUtils.shaHex(salt));
|
||||
return DigestUtils.shaHex(queryString.toString()).toUpperCase();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Logger.e(TAG, e, "createSign()");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.module.extensions;
|
||||
|
||||
import com.mogo.commons.mvp.IView;
|
||||
import com.mogo.module.extensions.userinfo.UserInfo;
|
||||
import com.mogo.module.extensions.weather.WeatherInfo;
|
||||
|
||||
/**
|
||||
@@ -27,4 +28,10 @@ public interface ExtensionsView extends IView {
|
||||
* @param amount 消息数量
|
||||
*/
|
||||
void renderMsgInfo( boolean hasMsg, int amount );
|
||||
|
||||
/**
|
||||
* 刷新个人信息
|
||||
* @param userInfo 个人信息
|
||||
*/
|
||||
void renderUserInfo(UserInfo userInfo);
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ import com.mogo.module.authorize.authprovider.invoke.AuthorizeConstant;
|
||||
import com.mogo.module.authorize.authprovider.module.IMogoAcquireAuthorizeListener;
|
||||
import com.mogo.module.authorize.authprovider.module.IMogoAuthorizeModuleManager;
|
||||
import com.mogo.module.common.dialog.WMDialog;
|
||||
import com.mogo.module.common.map.CustomNaviInterrupter;
|
||||
import com.mogo.module.common.map.MapCenterPointStrategy;
|
||||
import com.mogo.module.common.map.Scene;
|
||||
import com.mogo.module.extensions.ExtensionsModuleConst;
|
||||
@@ -222,13 +223,7 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
// }
|
||||
// });
|
||||
// 原始逻辑
|
||||
isClickShare = true;
|
||||
if ( mIMogoAuthorizeModuleManager.needAuthorize( AUTHORIZE_TYPE_LAUNCHER_SHARE ) ) {
|
||||
mIMogoAuthorizeModuleManager.invokeAuthorization( AUTHORIZE_TYPE_LAUNCHER_SHARE );
|
||||
} else {
|
||||
ShareControl.getInstance( getActivity() ).showDialog();
|
||||
traceData( "1" );
|
||||
}
|
||||
showShareDialog();
|
||||
} );
|
||||
|
||||
mDisplayOverview = findViewById( R.id.module_ext_id_display_overview );
|
||||
@@ -348,6 +343,16 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
mNaviInfo.inflate( rootView );
|
||||
}
|
||||
|
||||
public void showShareDialog() {
|
||||
isClickShare = true;
|
||||
if ( mIMogoAuthorizeModuleManager.needAuthorize( AUTHORIZE_TYPE_LAUNCHER_SHARE ) ) {
|
||||
mIMogoAuthorizeModuleManager.invokeAuthorization( AUTHORIZE_TYPE_LAUNCHER_SHARE );
|
||||
} else {
|
||||
mApis.getShareManager().showShareDialog();
|
||||
traceData( "1" );
|
||||
}
|
||||
}
|
||||
|
||||
private static final String AUTONAVI_STANDARD_BROADCAST_RECV = "AUTONAVI_STANDARD_BROADCAST_RECV";
|
||||
|
||||
@NonNull
|
||||
@@ -395,7 +400,7 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
public void authorizeSuccess() {
|
||||
Log.d( TAG, "authorizeSuccess --------> isClickShare = " + isClickShare );
|
||||
if ( isClickShare ) {
|
||||
ShareControl.getInstance( getActivity() ).showDialog();
|
||||
mApis.getShareManager().showShareDialog();
|
||||
traceData( "1" );
|
||||
} else {
|
||||
mEntrancePresenter.handleNeedAuthorizeCmd();
|
||||
@@ -428,13 +433,19 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
@Override
|
||||
public void onStartNavi() {
|
||||
TopViewAnimHelper.getInstance().showNaviView();
|
||||
mExitNavi.setVisibility( View.VISIBLE );
|
||||
mMApUIController.changeMapMode( mCameraMode.isSelected() ? EnumMapUI.NorthUP_2D : EnumMapUI.CarUp_2D );
|
||||
MapCenterPointStrategy.setMapCenterPointBySceneAndDelay( mMApUIController, Scene.NAVI, 500, () -> {
|
||||
return !mMogoNavi.isNaviing();
|
||||
} );
|
||||
mDisplayOverview.setVisibility( View.VISIBLE );
|
||||
mCameraMode.setVisibility( View.VISIBLE );
|
||||
if(CustomNaviInterrupter.getInstance().interrupt()){
|
||||
mDisplayOverview.setVisibility(View.GONE);
|
||||
mCameraMode.setVisibility(View.GONE);
|
||||
mExitNavi.setVisibility( View.GONE );
|
||||
}else {
|
||||
mExitNavi.setVisibility( View.VISIBLE );
|
||||
mDisplayOverview.setVisibility(View.VISIBLE);
|
||||
mCameraMode.setVisibility( View.VISIBLE );
|
||||
}
|
||||
mApis.getAnalyticsApi().track( "Navigation_begin", new HashMap<>() );
|
||||
}
|
||||
|
||||
@@ -507,7 +518,11 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
} else {
|
||||
mDisplayOverviewText.setText( "全览" );
|
||||
mDisplayOverviewText.setTextSize( TypedValue.COMPLEX_UNIT_PX, getResources().getDimensionPixelSize( R.dimen.module_ext_display_overview_textSize_large ) );
|
||||
mCameraMode.setVisibility( View.VISIBLE );
|
||||
if(CustomNaviInterrupter.getInstance().interrupt()){
|
||||
mCameraMode.setVisibility(View.GONE);
|
||||
}else {
|
||||
mCameraMode.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -549,9 +564,4 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
// 30s 后无论成功与否,停止动画
|
||||
mUploadFrameAnimHandler.sendEmptyMessageDelayed( MSG_STOP_ANIM, 30_000 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refreshUserInfo( UserInfo userInfo ) {
|
||||
Logger.d( TAG, "刷新用户信息: " + userInfo );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.commons.voice.IMogoVoiceCmdCallBack;
|
||||
import com.mogo.module.authorize.authprovider.module.IMogoAuthorizeModuleManager;
|
||||
import com.mogo.module.authorize.model.BaseResponse;
|
||||
import com.mogo.module.extensions.ExtensionsModuleConst;
|
||||
import com.mogo.module.extensions.net.UserInfoNetApiServices;
|
||||
import com.mogo.module.extensions.userinfo.UserInfo;
|
||||
@@ -22,6 +21,8 @@ import com.mogo.module.extensions.userinfo.UserInfoConstant;
|
||||
import com.mogo.module.extensions.userinfo.UserInfoResponse;
|
||||
import com.mogo.module.extensions.utils.ExtensionsConfig;
|
||||
import com.mogo.module.share.ShareControl;
|
||||
import com.mogo.module.share.manager.ServiceApisManager;
|
||||
import com.mogo.module.share.manager.UploadHelper;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.analytics.IMogoAnalytics;
|
||||
@@ -65,9 +66,6 @@ public class EntrancePresenter extends Presenter<EntranceView> {
|
||||
private String mVoiceCmdType; //一级命令
|
||||
private String mVoiceCmdShareType; //对某些一级命令里面细分的类型做处理
|
||||
private IMogoStatusManager mStatusManager;
|
||||
private IMogoNetwork mNetWork;
|
||||
|
||||
private UserInfo userInfo = null;
|
||||
|
||||
public EntrancePresenter(Context context, EntranceView view,
|
||||
IMogoAuthorizeModuleManager authorizeModuleManager) {
|
||||
@@ -79,8 +77,6 @@ public class EntrancePresenter extends Presenter<EntranceView> {
|
||||
mogoIntentManager = apis.getIntentManagerApi();
|
||||
mIMogoAuthorizeModuleManager = authorizeModuleManager;
|
||||
mStatusManager = apis.getStatusManagerApi();
|
||||
mNetWork = apis.getNetworkApi();
|
||||
|
||||
|
||||
registerUnWake();
|
||||
registerAwakeVoice();
|
||||
@@ -100,9 +96,6 @@ public class EntrancePresenter extends Presenter<EntranceView> {
|
||||
@Override
|
||||
public void onResume(@NonNull LifecycleOwner owner) {
|
||||
super.onResume(owner);
|
||||
if (ExtensionsConfig.needRequestUserInfo() && userInfo == null) {
|
||||
requestUserInfo();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -119,7 +112,7 @@ public class EntrancePresenter extends Presenter<EntranceView> {
|
||||
if (mIMogoAuthorizeModuleManager.needAuthorize(AUTHORIZE_TYPE_LAUNCHER_SHARE)) {
|
||||
mIMogoAuthorizeModuleManager.invokeAuthorization(AUTHORIZE_TYPE_LAUNCHER_SHARE);
|
||||
} else {
|
||||
ShareControl.getInstance(mContext).dismissDialog();
|
||||
ServiceApisManager.serviceApis.getShareManager().dismissShareDialog();
|
||||
}
|
||||
} else if (cmd.equals(ExtensionsModuleConst.UPLOAD_ROAD_BLOCK)) { //上报拥堵
|
||||
if (mIMogoAuthorizeModuleManager.needAuthorize(AUTHORIZE_TYPE_LAUNCHER_SHARE)) {
|
||||
@@ -227,7 +220,7 @@ public class EntrancePresenter extends Presenter<EntranceView> {
|
||||
if (mIMogoAuthorizeModuleManager.needAuthorize(AUTHORIZE_TYPE_LAUNCHER_SHARE)) {
|
||||
mIMogoAuthorizeModuleManager.invokeAuthorization(AUTHORIZE_TYPE_LAUNCHER_SHARE);
|
||||
} else {
|
||||
ShareControl.getInstance(mContext).showDialog();
|
||||
ServiceApisManager.serviceApis.getShareManager().dismissShareDialog();
|
||||
Log.d(TAG, "mogoIntentListener 我要分享 ----> ");
|
||||
traceData("2");
|
||||
}
|
||||
@@ -258,7 +251,7 @@ public class EntrancePresenter extends Presenter<EntranceView> {
|
||||
if (mIMogoAuthorizeModuleManager.needAuthorize(AUTHORIZE_TYPE_LAUNCHER_SHARE)) {
|
||||
mIMogoAuthorizeModuleManager.invokeAuthorization(AUTHORIZE_TYPE_LAUNCHER_SHARE);
|
||||
} else {
|
||||
ShareControl.getInstance(mContext).dismissDialog();
|
||||
ServiceApisManager.serviceApis.getShareManager().dismissShareDialog();
|
||||
Log.d(TAG, "mogoIntentListener 关闭分享框 唤醒 ----> ");
|
||||
}
|
||||
} else if (intentStr.equals(ExtensionsModuleConst.NO_REPLY_SHARE_DIALOG_CLOSE)) {
|
||||
@@ -266,7 +259,7 @@ public class EntrancePresenter extends Presenter<EntranceView> {
|
||||
if (mIMogoAuthorizeModuleManager.needAuthorize(AUTHORIZE_TYPE_LAUNCHER_SHARE)) {
|
||||
mIMogoAuthorizeModuleManager.invokeAuthorization(AUTHORIZE_TYPE_LAUNCHER_SHARE);
|
||||
} else {
|
||||
ShareControl.getInstance(mContext).dismissDialog();
|
||||
ServiceApisManager.serviceApis.getShareManager().dismissShareDialog();
|
||||
Logger.d(TAG, "mogoIntentListener 两次未回复关闭对话框");
|
||||
}
|
||||
} else if (intentStr.equals(ExtensionsModuleConst.UPLOAD_ROAD_CONDITION)) { //上报路况
|
||||
@@ -290,7 +283,7 @@ public class EntrancePresenter extends Presenter<EntranceView> {
|
||||
if (!TextUtils.isEmpty(mVoiceCmdType)) {
|
||||
if (mVoiceCmdType.equals(ExtensionsModuleConst.CANCLE_SHARE) || mVoiceCmdType.equals(ExtensionsModuleConst.CLOSE)
|
||||
|| mVoiceCmdType.equals(ExtensionsModuleConst.SHARE_DIALOG_CLOSE) || mVoiceCmdType.equals(ExtensionsModuleConst.NO_REPLY_SHARE_DIALOG_CLOSE)) { //关闭分享弹框
|
||||
ShareControl.getInstance(mContext).dismissDialog();
|
||||
ServiceApisManager.serviceApis.getShareManager().dismissShareDialog();
|
||||
} else if (mVoiceCmdType.equals(ExtensionsModuleConst.GO_TO_SHARE)) { //打开分享弹框
|
||||
if (!TextUtils.isEmpty(mVoiceCmdShareType)) {
|
||||
if (mVoiceCmdShareType.equals("封路")) {
|
||||
@@ -304,7 +297,7 @@ public class EntrancePresenter extends Presenter<EntranceView> {
|
||||
uploadTrfficCheck();
|
||||
}
|
||||
} else {
|
||||
ShareControl.getInstance(mContext).showDialog();
|
||||
ServiceApisManager.serviceApis.getShareManager().showShareDialog();
|
||||
Log.d(TAG, "handleNeedAuthorizeCmd 我要分享 ----> ");
|
||||
traceData("2");
|
||||
}
|
||||
@@ -333,7 +326,7 @@ public class EntrancePresenter extends Presenter<EntranceView> {
|
||||
sendShareReceiver(REPORT_TANLU_BLOCK);
|
||||
Logger.d("EntrancePresenter", "mogoIntentListener 上报路况 ----> ");
|
||||
traceTypeData("1");
|
||||
ShareControl.getInstance(mContext).dismissDialog();
|
||||
ServiceApisManager.serviceApis.getShareManager().dismissShareDialog();
|
||||
}
|
||||
|
||||
private void uploadTrfficCheck() {
|
||||
@@ -341,7 +334,7 @@ public class EntrancePresenter extends Presenter<EntranceView> {
|
||||
sendShareReceiver(REPORT_TANLU_TRAFFIC_CHECK);
|
||||
Logger.d("EntrancePresenter", "mogoIntentListener 分享交通检查 ----> ");
|
||||
traceTypeData("3");
|
||||
ShareControl.getInstance(mContext).dismissDialog();
|
||||
ServiceApisManager.serviceApis.getShareManager().dismissShareDialog();
|
||||
}
|
||||
|
||||
private void uploadRoadClosed() {
|
||||
@@ -349,7 +342,7 @@ public class EntrancePresenter extends Presenter<EntranceView> {
|
||||
sendShareReceiver(REPORT_TANLU_CLOSURE);
|
||||
Logger.d("EntrancePresenter", "mogoIntentListener 分享封路 ----> ");
|
||||
traceTypeData("4");
|
||||
ShareControl.getInstance(mContext).dismissDialog();
|
||||
ServiceApisManager.serviceApis.getShareManager().dismissShareDialog();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -368,7 +361,7 @@ public class EntrancePresenter extends Presenter<EntranceView> {
|
||||
// intent.setData(Uri.parse("freshthing://com.zhidao.fresh.things/shareOilPrice"));
|
||||
// getContext().startActivity(intent);
|
||||
// traceTypeData("2");
|
||||
// ShareControl.getInstance(mContext).dismissDialog();
|
||||
// ServiceApisManager.serviceApis.getShareManager().dismissShareDialog();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -376,12 +369,7 @@ public class EntrancePresenter extends Presenter<EntranceView> {
|
||||
*/
|
||||
private void sendShareReceiver(String type) {
|
||||
Logger.d("EntrancePresenter", "TanluCardViewFragment sendShareReceiver ---->");
|
||||
Intent intent = new Intent();
|
||||
intent.setAction("com.zhidao.roadcondition.share");
|
||||
intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
|
||||
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
|
||||
intent.putExtra("type", type);
|
||||
getContext().sendBroadcast(intent);
|
||||
UploadHelper.INSTANCE.upload(getContext(),type);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -415,48 +403,4 @@ public class EntrancePresenter extends Presenter<EntranceView> {
|
||||
AIAssist.getInstance(mContext).unregisterUnWakeupCommand(ExtensionsModuleConst.UPLOAD_TRAFFIC_CHECK);
|
||||
AIAssist.getInstance(mContext).unregisterUnWakeupCommand(ExtensionsModuleConst.UPLOAD_ROAD_CLOSURE);
|
||||
}
|
||||
|
||||
public void requestUserInfo() {
|
||||
Map<String, String> params = new ArrayMap<>();
|
||||
params.put("sn", DeviceUtil.getSn());
|
||||
params.put("source", "2");
|
||||
String sign = createSign(params, "JGqZw9");
|
||||
params.put("sig", sign);
|
||||
mNetWork.create(UserInfoNetApiServices.class, UserInfoConstant.getUserInfoBaseUrl()).requestUserInfo(params).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new SingleObserver<UserInfoResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(UserInfoResponse userInfoBaseResponse) {
|
||||
userInfo = userInfoBaseResponse.getResult();
|
||||
Logger.d(TAG, "获取个人信息成功: " + userInfo);
|
||||
mView.refreshUserInfo(userInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
e.printStackTrace();
|
||||
Logger.e(TAG, e, "获取个人信息失败==");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private String createSign(Map<String, String> map, String salt) {
|
||||
try {
|
||||
StringBuilder queryString = new StringBuilder();
|
||||
for (Map.Entry<String, String> entry : map.entrySet()) {
|
||||
queryString.append(entry.getKey())
|
||||
.append("=")
|
||||
.append(entry.getValue())
|
||||
.append("&");
|
||||
}
|
||||
queryString.append("key=").append(DigestUtils.shaHex(salt));
|
||||
return DigestUtils.shaHex(queryString.toString()).toUpperCase();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Logger.e(TAG, e, "createSign()");
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,4 @@ import com.mogo.module.extensions.userinfo.UserInfo;
|
||||
* 描述
|
||||
*/
|
||||
public interface EntranceView extends IView {
|
||||
|
||||
void refreshUserInfo(UserInfo userInfo);
|
||||
|
||||
}
|
||||
|
||||
@@ -95,4 +95,19 @@ public class UserInfo {
|
||||
public void setActiveTime(String activeTime) {
|
||||
this.activeTime = activeTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UserInfo{" +
|
||||
"userId='" + userId + '\'' +
|
||||
", phone='" + phone + '\'' +
|
||||
", displayName='" + displayName + '\'' +
|
||||
", additionalOne=" + additionalOne +
|
||||
", headImgurl='" + headImgurl + '\'' +
|
||||
", ownerAuthState=" + ownerAuthState +
|
||||
", score=" + score +
|
||||
", memberLevel='" + memberLevel + '\'' +
|
||||
", activeTime='" + activeTime + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,6 +80,12 @@ public class SchemeIntent implements IMogoStatusChangedListener {
|
||||
case "/main/switch2":
|
||||
handleSwitch2Action( target );
|
||||
break;
|
||||
case "/main/share":
|
||||
Logger.d(TAG,"收到打开分享框的scheme,准备打开分享框");
|
||||
mApis.getShareManager().showShareDialog();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation fileTree(dir: 'libs', include: ['*.aar'])
|
||||
|
||||
annotationProcessor rootProject.ext.dependencies.aroutercompiler
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
|
||||
Binary file not shown.
@@ -8,6 +8,7 @@
|
||||
<uses-permission android:name="android.permission.ACTION_MANAGE_OVERLAY_PERMISSION" />
|
||||
<uses-permission android:name="android.permission.TYPE_APPLICATION_OVERLAY" />
|
||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
|
||||
<uses-permission android:name="com.tencent.wecarflow.PLAY_CONTROL" />
|
||||
|
||||
<application>
|
||||
<receiver android:name=".receiver.MediaSpeechReceiver">
|
||||
|
||||
@@ -14,15 +14,12 @@ import com.mogo.map.navi.IMogoNaviListener;
|
||||
import com.mogo.service.module.IMogoModuleLifecycle;
|
||||
import com.mogo.service.module.IMogoModuleProvider;
|
||||
import com.mogo.service.module.ModuleType;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
@Route( path = MediaConstants.TAG )
|
||||
public class MediaCardViewProvider implements IMogoModuleProvider {
|
||||
|
||||
private static final String TAG = "MediaCardViewProvider";
|
||||
|
||||
private MediaWindow mMediaWindow;
|
||||
|
||||
|
||||
@Override
|
||||
public Fragment createFragment( Context context, Bundle data ) {
|
||||
@@ -35,10 +32,8 @@ public class MediaCardViewProvider implements IMogoModuleProvider {
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
ServiceMediaHandler.init( context );
|
||||
|
||||
mMediaWindow = new MediaWindow();
|
||||
mMediaWindow.initMedia(context);
|
||||
|
||||
MediaWindow2 mediaWindow2 = new MediaWindow2();
|
||||
mediaWindow2.initMedia(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -181,8 +181,12 @@ public class MediaWindow implements MediaView{
|
||||
}
|
||||
|
||||
if (first || mMediaInfoData.getPlayState() == 1 || mMediaInfoData.getPlayState() == 2) {
|
||||
if (mWindowMaxTime != null) mWindowMaxTime.setText(Utils.calculateTime((int) mMediaInfoData.getMaxTime()));
|
||||
if (mWindowCurrTime != null) mWindowCurrTime.setText(Utils.calculateTime((int) mMediaInfoData.getCurTime()));
|
||||
if (mWindowMaxTime != null){
|
||||
mWindowMaxTime.setText(Utils.calculateTime((int) mMediaInfoData.getMaxTime()));
|
||||
}
|
||||
if (mWindowCurrTime != null){
|
||||
mWindowCurrTime.setText(Utils.calculateTime((int) mMediaInfoData.getCurTime()));
|
||||
}
|
||||
}
|
||||
|
||||
if (mCircleImg != null){
|
||||
@@ -286,7 +290,9 @@ public class MediaWindow implements MediaView{
|
||||
}
|
||||
|
||||
|
||||
if (mCircleImg != null) mCircleImg.stopAnim();
|
||||
if (mCircleImg != null){
|
||||
mCircleImg.stopAnim();
|
||||
}
|
||||
|
||||
if (type == 1 || type == 2 || type ==3){
|
||||
UiThreadHandler.removeCallbacks(mRunnable);
|
||||
@@ -417,10 +423,18 @@ public class MediaWindow implements MediaView{
|
||||
bookid = leTingNewsData.getSid();
|
||||
}
|
||||
|
||||
if (mediaName == null) mediaName = "";
|
||||
if (artist == null) artist = "";
|
||||
if (cover == null) cover = "";
|
||||
if (bookid == null) bookid = "";
|
||||
if (mediaName == null){
|
||||
mediaName = "";
|
||||
}
|
||||
if (artist == null){
|
||||
artist = "";
|
||||
}
|
||||
if (cover == null){
|
||||
cover = "";
|
||||
}
|
||||
if (bookid == null){
|
||||
bookid = "";
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -0,0 +1,242 @@
|
||||
package com.mogo.module.media;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
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.WeCarFlowPresenter;
|
||||
import com.mogo.module.media.utils.LaunchUtils;
|
||||
import com.mogo.module.media.utils.MusicControlBroadCast;
|
||||
import com.mogo.module.media.utils.Utils;
|
||||
import com.mogo.module.media.view.IMusicView;
|
||||
import com.mogo.module.media.widget.AnimCircleImageView;
|
||||
import com.mogo.module.media.widget.NoScrollSeekBar;
|
||||
import com.mogo.module.media.widget.ScrollingTextView;
|
||||
import com.mogo.utils.TipToast;
|
||||
import com.mogo.utils.glide.GlideApp;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
/**
|
||||
* 适配爱趣听的window
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class MediaWindow2 implements IMusicView {
|
||||
|
||||
public static final String TAG = MediaWindow2.class.getName();
|
||||
private Context mContext;
|
||||
private WeCarFlowPresenter mPresenter;
|
||||
|
||||
private MediaInfoData mMediaInfoData = new MediaInfoData();
|
||||
|
||||
private View mWindowView;
|
||||
private AnimCircleImageView mCircleImg;
|
||||
private ScrollingTextView mScrollText;
|
||||
private ImageView mWindowPlayPause;
|
||||
private ImageView mWindowPlayNext;
|
||||
private LinearLayout mWindowMediaCenter;
|
||||
private TextView mWindowCurrTime;
|
||||
private TextView mWindowMaxTime;
|
||||
private NoScrollSeekBar mWindowProgress;
|
||||
|
||||
private boolean mHasAddWindow = false;
|
||||
private boolean mTwoChange = false;
|
||||
private boolean isFirstPlay = false;
|
||||
|
||||
public void initMedia(Context context) {
|
||||
mContext = context;
|
||||
mPresenter = new WeCarFlowPresenter(this);
|
||||
mPresenter.init(context);
|
||||
|
||||
isFirstPlay = true;
|
||||
}
|
||||
|
||||
private void addWindowView() {
|
||||
if (ServiceMediaHandler.getMogoWindowManager() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mHasAddWindow) {
|
||||
mHasAddWindow = true;
|
||||
mWindowView =
|
||||
LayoutInflater.from(mContext).inflate(R.layout.module_media_music_window_alert_layout, null);
|
||||
mWindowView.setVisibility(View.VISIBLE);
|
||||
mCircleImg = mWindowView.findViewById(R.id.window_circle_img);
|
||||
mScrollText = mWindowView.findViewById(R.id.window_scroll_txt);
|
||||
mWindowPlayPause = mWindowView.findViewById(R.id.window_play_pause);
|
||||
mWindowPlayNext = mWindowView.findViewById(R.id.window_music_next);
|
||||
mWindowMediaCenter = mWindowView.findViewById(R.id.window_media_center);
|
||||
mWindowCurrTime = mWindowView.findViewById(R.id.window_current_time);
|
||||
mWindowMaxTime = mWindowView.findViewById(R.id.window_max_time);
|
||||
mWindowProgress = mWindowView.findViewById(R.id.window_progress_bar);
|
||||
if (mWindowPlayPause != null) {
|
||||
mWindowPlayPause.setImageResource(R.drawable.module_media_window_pop_pause);
|
||||
}
|
||||
int yPos =
|
||||
getContext().getResources().getDimensionPixelOffset(R.dimen.module_media_music_state_location);
|
||||
int xPos =
|
||||
getContext().getResources().getDimensionPixelOffset(R.dimen.module_media_music_state_location_x);
|
||||
ServiceMediaHandler.getMogoWindowManager().addView(mWindowView, xPos, yPos, false);
|
||||
updateWindowUI(true);
|
||||
mWindowMediaCenter.setOnClickListener(new NoDoubleClickListener() {
|
||||
@Override
|
||||
public void onClicks(View view) {
|
||||
openAqtApp();
|
||||
}
|
||||
});
|
||||
|
||||
mWindowPlayPause.setOnClickListener(new NoDoubleClickListener() {
|
||||
@Override
|
||||
public void onClicks(View view) {
|
||||
if (mMediaInfoData != null) {
|
||||
if (mMediaInfoData.getPlayState() == MusicConstant.PLAY_STATE_PAUSE_OR_STOP) {
|
||||
mPresenter.play(mMediaInfoData);
|
||||
} else {
|
||||
// 没有做详细判断,不是暂停就是播放
|
||||
mPresenter.pause(mMediaInfoData);
|
||||
}
|
||||
} else {
|
||||
openAqtApp();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
mWindowPlayNext.setOnClickListener(new NoDoubleClickListener() {
|
||||
@Override
|
||||
public void onClicks(View view) {
|
||||
if (mPresenter != null) {
|
||||
mPresenter.next();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void updateWindowUI() {
|
||||
updateWindowUI(false);
|
||||
}
|
||||
|
||||
private void updateWindowUI(boolean first) {
|
||||
if (mWindowView == null) {
|
||||
return;
|
||||
}
|
||||
if (mMediaInfoData != null) {
|
||||
if (mMediaInfoData.getType() == MusicConstant.PLAY_STATE_ERROR||isFirstPlay) {
|
||||
mWindowView.setVisibility(View.GONE);
|
||||
} else {
|
||||
mWindowView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
} else {
|
||||
mWindowView.setVisibility(View.GONE);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mScrollText != null) {
|
||||
mScrollText.setText(mMediaInfoData.getMediaName());
|
||||
}
|
||||
|
||||
if (first || mMediaInfoData.getPlayState() == MusicConstant.PLAY_STATE_PLAYING || mMediaInfoData.getPlayState() == MusicConstant.PLAY_STATE_BUFF) {
|
||||
if (mWindowMaxTime != null) {
|
||||
mWindowMaxTime.setText(Utils.calculateTime((int) mMediaInfoData.getMaxTime()));
|
||||
}
|
||||
if (mWindowCurrTime != null) {
|
||||
mWindowCurrTime.setText(Utils.calculateTime((int) mMediaInfoData.getCurTime()));
|
||||
}
|
||||
}
|
||||
|
||||
if (mCircleImg != null) {
|
||||
com.bumptech.glide.request.RequestOptions options =
|
||||
new com.bumptech.glide.request.RequestOptions()
|
||||
.placeholder(R.drawable.module_media_share_default_icon);
|
||||
GlideApp.with(mContext).applyDefaultRequestOptions(options).load(mMediaInfoData.getMediaImg()).into(mCircleImg);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Context getContext() {
|
||||
return mContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMusicPlaying() {
|
||||
Logger.d(TAG, "onMusicPlaying===" + mMediaInfoData);
|
||||
isFirstPlay = false;
|
||||
updateWindowUI(false);
|
||||
if (mWindowPlayPause != null) {
|
||||
mWindowPlayPause.setImageResource(R.drawable.module_media_window_pop_play);
|
||||
}
|
||||
|
||||
if (mCircleImg != null) {
|
||||
mCircleImg.startAnim();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMusicPause() {
|
||||
Logger.d(TAG, "onMusicPause: ===" + mMediaInfoData);
|
||||
if (mWindowPlayPause != null) {
|
||||
mWindowPlayPause.setImageResource(R.drawable.module_media_window_pop_pause);
|
||||
}
|
||||
|
||||
if (mCircleImg != null) {
|
||||
mCircleImg.stopAnim();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMusicStopped() {
|
||||
Logger.d(TAG, "onMusicStopped===" + mMediaInfoData);
|
||||
if (mWindowPlayPause != null) {
|
||||
mWindowPlayPause.setImageResource(R.drawable.module_media_window_pop_pause);
|
||||
}
|
||||
|
||||
if (mCircleImg != null) {
|
||||
mCircleImg.stopAnim();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMediaInfoChanged(MediaInfoData mediaInfoData) {
|
||||
Logger.d(TAG, "onMediaInfoChanged: " + mediaInfoData);
|
||||
mMediaInfoData = mediaInfoData;
|
||||
addWindowView();
|
||||
updateWindowUI();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMusicProgress(long current, long total) {
|
||||
// Logger.d(TAG, "onMusicProgress==current: " + current + " total: " + total);
|
||||
if (mMediaInfoData != null) {
|
||||
mMediaInfoData.setCurTime((int) current);
|
||||
mMediaInfoData.setMaxTime((int) total);
|
||||
}
|
||||
if (mWindowCurrTime != null) {
|
||||
mWindowCurrTime.setText(Utils.calculateTime((int) current));
|
||||
mWindowMaxTime.setText(Utils.calculateTime((int) total));
|
||||
}
|
||||
try {
|
||||
int progress =
|
||||
(int) ((current * 1.0f * 100) / (total * 1.0f));
|
||||
if (mWindowProgress != null) {
|
||||
mWindowProgress.setProgress(progress);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void openAqtApp() {
|
||||
try {
|
||||
LaunchUtils.launchByPkg(mContext, "com.tencent.wecarflow");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.mogo.module.media.constants;
|
||||
|
||||
/**
|
||||
* 音频相关常量
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class MusicConstant {
|
||||
public static final int PLAY_STATE_PLAYING = 1;
|
||||
public static final int PLAY_STATE_BUFF = 2;
|
||||
public static final int PLAY_STATE_PAUSE_OR_STOP = 0;
|
||||
public static final int PLAY_STATE_ERROR = -1;
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.mogo.module.media.model;
|
||||
|
||||
import com.mogo.module.media.constants.MusicConstant;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class MediaInfoData implements Serializable {
|
||||
@@ -142,4 +144,13 @@ public class MediaInfoData implements Serializable {
|
||||
public void setBookInfo(String bookInfo) {
|
||||
this.bookInfo = bookInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MediaInfoData{" +
|
||||
"mediaName='" + mediaName + '\'' +
|
||||
", mediaImg='" + mediaImg + '\'' +
|
||||
", playState=" + playState +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.mogo.module.media.presenter;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.commons.mvp.IView;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.module.media.model.MediaInfoData;
|
||||
|
||||
/**
|
||||
* 媒体播放presenter基类,目前没有整合到原MediaPresenter中,原来的qq音乐,喜马拉雅和懒人听书下掉了
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public abstract class BaseMediaPresenter<V extends IView> extends Presenter<V> {
|
||||
public BaseMediaPresenter(V view) {
|
||||
super(view);
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化
|
||||
*
|
||||
* @param context 上下文
|
||||
*/
|
||||
public abstract void init(Context context);
|
||||
|
||||
/**
|
||||
* 播放音乐
|
||||
* @param mediaInfoData 待播放音乐信息
|
||||
*/
|
||||
public abstract void play(MediaInfoData mediaInfoData);
|
||||
|
||||
/**
|
||||
* 暂停播放
|
||||
* @param mediaInfoData 待暂停音乐信息
|
||||
*/
|
||||
public abstract void pause(MediaInfoData mediaInfoData);
|
||||
|
||||
/**
|
||||
* 停止播放
|
||||
* @param mediaInfoData 待停止播放音乐信息
|
||||
*/
|
||||
public abstract void stop(MediaInfoData mediaInfoData);
|
||||
|
||||
/**
|
||||
* 上一首
|
||||
*/
|
||||
public abstract void pre();
|
||||
|
||||
/**
|
||||
* 下一首
|
||||
*/
|
||||
public abstract void next();
|
||||
}
|
||||
@@ -0,0 +1,198 @@
|
||||
package com.mogo.module.media.presenter;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.module.media.MediaConstants;
|
||||
import com.mogo.module.media.constants.MusicConstant;
|
||||
import com.mogo.module.media.model.MediaInfoData;
|
||||
import com.mogo.module.media.view.IMusicView;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.tencent.wecarflow.flowoutside.sdk.BindListener;
|
||||
import com.tencent.wecarflow.flowoutside.sdk.FlowPlayControl;
|
||||
import com.tencent.wecarflow.flowoutside.sdk.MediaChangeListener;
|
||||
import com.tencent.wecarflow.flowoutside.sdk.MediaInfo;
|
||||
import com.tencent.wecarflow.flowoutside.sdk.PlayStateListener;
|
||||
import com.tencent.wecarflow.flowoutside.sdk.QueryCallback;
|
||||
|
||||
/**
|
||||
* 爱趣听presenter
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class WeCarFlowPresenter extends BaseMediaPresenter<IMusicView> {
|
||||
private static final String TAG = "WeCarFlowPresenter";
|
||||
public WeCarFlowPresenter(IMusicView view) {
|
||||
super(view);
|
||||
}
|
||||
|
||||
private Context context;
|
||||
|
||||
private MediaInfoData currentMedia;
|
||||
|
||||
private boolean isBind = true;
|
||||
private IMogoServiceApis serviceApis;
|
||||
|
||||
private QueryCallback<Boolean> isPlayingCallback = new QueryCallback<Boolean>() {
|
||||
@Override
|
||||
public void onError(int i) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Boolean aBoolean) {
|
||||
currentMedia.setPlayState(aBoolean ? MusicConstant.PLAY_STATE_PLAYING :
|
||||
MusicConstant.PLAY_STATE_PAUSE_OR_STOP);
|
||||
if (mView != null) {
|
||||
mView.onMediaInfoChanged(currentMedia);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private QueryCallback<MediaInfo> currentCallback = new QueryCallback<MediaInfo>() {
|
||||
@Override
|
||||
public void onError(int i) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(MediaInfo mediaInfo) {
|
||||
currentMedia.setMediaName(mediaInfo.getMediaName());
|
||||
currentMedia.setMediaImg(mediaInfo.getMediaImage());
|
||||
if (mView != null) {
|
||||
mView.onMediaInfoChanged(currentMedia);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
this.context = context;
|
||||
currentMedia = new MediaInfoData();
|
||||
|
||||
serviceApis =
|
||||
(IMogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(context);
|
||||
|
||||
serviceApis.getStatusManagerApi().registerStatusChangedListener(MediaConstants.MODULE_TYPE, StatusDescriptor.MAIN_PAGE_RESUME, new IMogoStatusChangedListener() {
|
||||
@Override
|
||||
public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) {
|
||||
if (isTrue) {
|
||||
Logger.d(TAG, "onResume, isBind: " + isBind);
|
||||
// 需要在resume时候判断绑定关系是否正常
|
||||
if (!isBind) {
|
||||
// 未绑定,需要重新绑定,同时第一次绑定初始化也是在此处
|
||||
FlowPlayControl.getInstance().bindPlayService(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
FlowPlayControl.getInstance().addBindListener(new BindListener() {
|
||||
@Override
|
||||
public void onServiceConnected() {
|
||||
Logger.d(TAG, "onServiceConnected===");
|
||||
isBind = true;
|
||||
FlowPlayControl.getInstance().queryPlaying(isPlayingCallback);
|
||||
FlowPlayControl.getInstance().queryCurrent(currentCallback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onServiceDisconnected() {
|
||||
Logger.e(TAG, "onServiceDisconnected===");
|
||||
isBind = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindDied() {
|
||||
Logger.e(TAG, "onBindDied===");
|
||||
isBind = false;
|
||||
}
|
||||
});
|
||||
|
||||
FlowPlayControl.getInstance().addMediaChangeListener(new MediaChangeListener() {
|
||||
@Override
|
||||
public void onMediaChange(MediaInfo mediaInfo) {
|
||||
Logger.d(TAG, "onMediaChange: " + mediaInfo);
|
||||
Logger.d(TAG, "onMediaChange, img: " + mediaInfo.getMediaImage());
|
||||
currentMedia.setMediaName(mediaInfo.getMediaName());
|
||||
currentMedia.setMediaImg(mediaInfo.getMediaImage());
|
||||
mView.onMediaInfoChanged(currentMedia);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFavorChange(boolean b) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
FlowPlayControl.getInstance().addPlayStateListener(new PlayStateListener() {
|
||||
@Override
|
||||
public void onStart() {
|
||||
if (mView != null && currentMedia != null) {
|
||||
currentMedia.setPlayState(MusicConstant.PLAY_STATE_PLAYING);
|
||||
mView.onMusicPlaying();
|
||||
mView.onMediaInfoChanged(currentMedia);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
if (mView != null && currentMedia != null) {
|
||||
currentMedia.setPlayState(MusicConstant.PLAY_STATE_PAUSE_OR_STOP);
|
||||
mView.onMusicPause();
|
||||
mView.onMediaInfoChanged(currentMedia);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop() {
|
||||
if (mView != null && currentMedia != null) {
|
||||
currentMedia.setPlayState(MusicConstant.PLAY_STATE_PAUSE_OR_STOP);
|
||||
mView.onMusicStopped();
|
||||
mView.onMediaInfoChanged(currentMedia);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProgress(String s, long current, long total) {
|
||||
if (mView != null) {
|
||||
mView.onMusicProgress(current, total);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
FlowPlayControl.getInstance().bindPlayService(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void play(MediaInfoData mediaInfoData) {
|
||||
FlowPlayControl.getInstance().doPlay();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pause(MediaInfoData mediaInfoData) {
|
||||
FlowPlayControl.getInstance().doPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop(MediaInfoData mediaInfoData) {
|
||||
FlowPlayControl.getInstance().doStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pre() {
|
||||
FlowPlayControl.getInstance().doPre();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void next() {
|
||||
FlowPlayControl.getInstance().doNext();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.mogo.module.media.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-02-03
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class LaunchUtils {
|
||||
|
||||
/**
|
||||
* 通过包名启动app
|
||||
*
|
||||
* @param context
|
||||
* @param pkg 包名
|
||||
*/
|
||||
public static void launchByPkg( Context context, String pkg ) throws Exception {
|
||||
Intent intent = getLaunchIntentForPackage( context, pkg );
|
||||
intent.addFlags( Intent.FLAG_ACTIVITY_NEW_TASK );
|
||||
context.startActivity( intent );
|
||||
}
|
||||
|
||||
public static Intent getLaunchIntentForPackage( Context context, String pkg ) {
|
||||
return context.getPackageManager().getLaunchIntentForPackage( pkg );
|
||||
}
|
||||
}
|
||||
@@ -459,21 +459,23 @@ public class MusicControlBroadCast {
|
||||
}
|
||||
}
|
||||
|
||||
// return null;
|
||||
MediaInfoData mediaInfoData = new MediaInfoData();
|
||||
mediaInfoData.setMediaId("001jiOrk2g389Y");
|
||||
mediaInfoData.setBookInfo("");
|
||||
mediaInfoData.setType(1);
|
||||
mediaInfoData.setMediaName("恭喜发财 (广场舞)");
|
||||
mediaInfoData.setMediaSinger("刘德华");
|
||||
mediaInfoData.setMediaType("物流派");
|
||||
mediaInfoData.setPlayState(0);
|
||||
mediaInfoData.setLocalMedia(false);
|
||||
mediaInfoData.setCurTime(0);
|
||||
mediaInfoData.setMaxTime(410*1000);
|
||||
mediaInfoData.setMediaUrl("http://isure.stream.qqmusic.qq.com/C200000s2wCd3pzdnA.m4a?guid=2000001271&vkey=8CE1A876F5079A6E4E9BCB8306252EF152F3D4F237B3BF4C1450B50BA7E065D3D55A0735FD2E957B129E83FF7D7D5D398479D53FE2171DF0&uin=&fromtag=50");
|
||||
mediaInfoData.setMediaImg("http://music.qq.com/musicbox/img/uccpic_error.jpg");
|
||||
return mediaInfoData;//刘德华的恭喜发财
|
||||
return null;
|
||||
|
||||
// 测试代码吧?
|
||||
// MediaInfoData mediaInfoData = new MediaInfoData();
|
||||
// mediaInfoData.setMediaId("001jiOrk2g389Y");
|
||||
// mediaInfoData.setBookInfo("");
|
||||
// mediaInfoData.setType(1);
|
||||
// mediaInfoData.setMediaName("恭喜发财 (广场舞)");
|
||||
// mediaInfoData.setMediaSinger("刘德华");
|
||||
// mediaInfoData.setMediaType("物流派");
|
||||
// mediaInfoData.setPlayState(0);
|
||||
// mediaInfoData.setLocalMedia(false);
|
||||
// mediaInfoData.setCurTime(0);
|
||||
// mediaInfoData.setMaxTime(410*1000);
|
||||
// mediaInfoData.setMediaUrl("http://isure.stream.qqmusic.qq.com/C200000s2wCd3pzdnA.m4a?guid=2000001271&vkey=8CE1A876F5079A6E4E9BCB8306252EF152F3D4F237B3BF4C1450B50BA7E065D3D55A0735FD2E957B129E83FF7D7D5D398479D53FE2171DF0&uin=&fromtag=50");
|
||||
// mediaInfoData.setMediaImg("http://music.qq.com/musicbox/img/uccpic_error.jpg");
|
||||
// return mediaInfoData;//刘德华的恭喜发财
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.mogo.module.media.view;
|
||||
|
||||
import com.mogo.commons.mvp.IView;
|
||||
import com.mogo.module.media.model.MediaInfoData;
|
||||
|
||||
/**
|
||||
* 音频显示类的接口
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public interface IMusicView extends IView {
|
||||
void onMediaInfoChanged(MediaInfoData mediaInfoData);
|
||||
|
||||
void onMusicPlaying();
|
||||
|
||||
void onMusicPause();
|
||||
|
||||
void onMusicStopped();
|
||||
|
||||
void onMusicProgress(long current,long total);
|
||||
}
|
||||
@@ -2,10 +2,13 @@ package com.mogo.module.share;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.module.share.dialog.LaucherShareDialog;
|
||||
import com.mogo.module.share.manager.ServiceApisManager;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.share.IMogoShareManager;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
/**
|
||||
@@ -13,55 +16,28 @@ import com.mogo.utils.logger.Logger;
|
||||
* @description 分享弹框接口
|
||||
* @since 2020-01-10
|
||||
*/
|
||||
public class ShareControl implements IShareControl {
|
||||
@Route(path = MogoServicePaths.PATH_SHARE)
|
||||
public class ShareControl implements IMogoShareManager {
|
||||
|
||||
private static volatile ShareControl sInstance;
|
||||
private Context mContext;
|
||||
private LaucherShareDialog mShareDialog;
|
||||
|
||||
private IMogoServiceApis mogoServiceApis;
|
||||
|
||||
private ShareControl(Context context) {
|
||||
mContext = context;
|
||||
mogoServiceApis =
|
||||
(IMogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(context);
|
||||
}
|
||||
|
||||
public IMogoServiceApis getMogoServiceApis(){
|
||||
return mogoServiceApis;
|
||||
}
|
||||
|
||||
public static ShareControl getInstance(Context context) {
|
||||
if (sInstance == null) {
|
||||
synchronized (ShareControl.class) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new ShareControl(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void showDialog() {
|
||||
|
||||
boolean isAdasShow = mogoServiceApis.getStatusManagerApi().isADASShow();
|
||||
Logger.d("ShareControl", "showDialog 判断adas是否展示: " + isAdasShow);
|
||||
// if (isAdasShow) {
|
||||
// mogoServiceApis.getAdasControllerApi().closeADAS();
|
||||
// }
|
||||
|
||||
public void showShareDialog() {
|
||||
mShareDialog = new LaucherShareDialog(mContext);
|
||||
// mShareDialog.setCanceledOnTouchOutside(true);
|
||||
mShareDialog.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dismissDialog() {
|
||||
public void dismissShareDialog() {
|
||||
if (mShareDialog != null) {
|
||||
mShareDialog.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
mContext = context;
|
||||
ServiceApisManager.INSTANCE.init(context);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.mogo.module.share.constant.ShareConstants
|
||||
import com.mogo.module.share.constant.ShareConstants.*
|
||||
import com.mogo.module.share.manager.ServiceApisManager
|
||||
import com.mogo.module.share.manager.UploadHelper
|
||||
import com.mogo.utils.logger.Logger
|
||||
import org.json.JSONObject
|
||||
@@ -24,7 +25,8 @@ class ShareVoiceCmdReceiver : BroadcastReceiver() {
|
||||
val seekHelp = Intent(context, VoiceCmdService::class.java)
|
||||
seekHelp.putExtra(ShareConstants.VOICE_CMD_SERVICE_EVENT_KEY, ShareConstants.VOICE_CMD_SERVICE_SEEK_HELP)
|
||||
context.startService(seekHelp)
|
||||
ShareControl.getInstance(context).dismissDialog()
|
||||
ServiceApisManager.serviceApis.shareManager.dismissShareDialog()
|
||||
// ShareControl.getInstance(context).dismissDialog()
|
||||
}
|
||||
VOICE_CMD_GO_TO_SHARE ->{
|
||||
val ob = JSONObject(intent.getStringExtra("data") ?: "").opt("ob")
|
||||
@@ -32,23 +34,28 @@ class ShareVoiceCmdReceiver : BroadcastReceiver() {
|
||||
when (ob) {
|
||||
"积水"->{
|
||||
UploadHelper.upload(context, TYPE_STAGNANT_WATER)
|
||||
ShareControl.getInstance(context).dismissDialog()
|
||||
ServiceApisManager.serviceApis.shareManager.dismissShareDialog()
|
||||
// ShareControl.getInstance(context).dismissDialog()
|
||||
}
|
||||
"积冰"->{
|
||||
UploadHelper.upload(context, TYPE_ROAD_ICY)
|
||||
ShareControl.getInstance(context).dismissDialog()
|
||||
ServiceApisManager.serviceApis.shareManager.dismissShareDialog()
|
||||
// ShareControl.getInstance(context).dismissDialog()
|
||||
}
|
||||
"雾"->{
|
||||
UploadHelper.upload(context, TYPE_DENSE_FOG)
|
||||
ShareControl.getInstance(context).dismissDialog()
|
||||
ServiceApisManager.serviceApis.shareManager.dismissShareDialog()
|
||||
// ShareControl.getInstance(context).dismissDialog()
|
||||
}
|
||||
"交通事故"->{
|
||||
UploadHelper.upload(context, TYPE_ACCIDENT)
|
||||
ShareControl.getInstance(context).dismissDialog()
|
||||
ServiceApisManager.serviceApis.shareManager.dismissShareDialog()
|
||||
// ShareControl.getInstance(context).dismissDialog()
|
||||
}
|
||||
"施工"->{
|
||||
UploadHelper.upload(context, TYPE_ROAD_CONSTRUCTION)
|
||||
ShareControl.getInstance(context).dismissDialog()
|
||||
ServiceApisManager.serviceApis.shareManager.dismissShareDialog()
|
||||
// ShareControl.getInstance(context).dismissDialog()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -59,7 +66,8 @@ class ShareVoiceCmdReceiver : BroadcastReceiver() {
|
||||
// 上报实时路况
|
||||
Logger.d(TAG, "分享框准备触发上报实时路况")
|
||||
UploadHelper.upload(context, TYPE_REAL_TIME_TRAFFIC)
|
||||
ShareControl.getInstance(context).dismissDialog()
|
||||
ServiceApisManager.serviceApis.shareManager.dismissShareDialog()
|
||||
// ShareControl.getInstance(context).dismissDialog()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,8 +66,8 @@ public class LaucherShareDialog implements View.OnClickListener {
|
||||
|
||||
public LaucherShareDialog(@NonNull Context context) {
|
||||
this.mContext = context;
|
||||
mAnalytics = ShareControl.getInstance(context).getMogoServiceApis().getAnalyticsApi();
|
||||
mApis = (IMogoServiceApis) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICE_APIS ).navigation(context);
|
||||
mAnalytics = mApis.getAnalyticsApi();
|
||||
mStatusManager = mApis.getStatusManagerApi();
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import com.mogo.commons.data.BaseData
|
||||
import com.mogo.commons.network.SubscribeImpl
|
||||
import com.mogo.commons.voice.AIAssist
|
||||
import com.mogo.commons.voice.IMogoVoiceCmdCallBack
|
||||
import com.mogo.module.share.ShareControl
|
||||
import com.mogo.module.share.bean.SeekRecord
|
||||
import com.mogo.module.share.bean.SeekRequest
|
||||
import com.mogo.module.share.bean.getJson
|
||||
@@ -20,7 +19,6 @@ import com.mogo.utils.storage.SharedPrefsMgr
|
||||
import com.zhidao.auto.platform.util.DeviceUtil
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* 故障求助管理类,相关故障求助操作的具体实现类
|
||||
@@ -73,7 +71,6 @@ object SeekHelpManager {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 寻求帮助,是开始故障求助的入口
|
||||
* 由于当前需求仅需要提供这一个方法,所以context的初始化放到了此方法,后面如果有增加,需要把这部分提出去
|
||||
@@ -88,7 +85,8 @@ object SeekHelpManager {
|
||||
this.context = context
|
||||
}
|
||||
aiAssist = AIAssist.getInstance(context)
|
||||
isSeekHelp = ShareControl.getInstance(SeekHelpManager.context).mogoServiceApis.statusManagerApi.isSeekHelping
|
||||
|
||||
isSeekHelp = ServiceApisManager.serviceApis.statusManagerApi.isSeekHelping
|
||||
Logger.d(TAG, "开始故障求助上报---${isSeekHelp}")
|
||||
seekListenerList.add(seekHelpListener)
|
||||
when {
|
||||
@@ -157,11 +155,11 @@ object SeekHelpManager {
|
||||
val seekRequest = SeekRequest(DeviceUtil.getSn())
|
||||
val param = mutableMapOf("data" to seekRequest.getJson())
|
||||
|
||||
ShareControl.getInstance(context).mogoServiceApis.networkApi.create(ShareApiService::class.java, HttpConstant.getNetHost()).sendHelpSignal(param).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(object : SubscribeImpl<BaseData>(RequestOptions.create(context)) {
|
||||
ServiceApisManager.serviceApis.networkApi.create(ShareApiService::class.java, HttpConstant.getNetHost()).sendHelpSignal(param).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(object : SubscribeImpl<BaseData>(RequestOptions.create(context)) {
|
||||
override fun onSuccess(o: BaseData?) {
|
||||
super.onSuccess(o)
|
||||
// 接口请求成功,内部同步v2x状态,通知adas,改变自车图标
|
||||
ShareControl.getInstance(context).mogoServiceApis.statusManagerApi.setSeekHelping("ShareDialog", true)
|
||||
ServiceApisManager.serviceApis.statusManagerApi.setSeekHelping("ShareDialog", true)
|
||||
SharedPrefsMgr.getInstance(context!!).putLong("seek_help_time", System.currentTimeMillis())
|
||||
isSeekHelp = true
|
||||
aiAssist?.speakTTSVoice("已发布求助信息,将为你通知其他车主")
|
||||
@@ -213,11 +211,11 @@ object SeekHelpManager {
|
||||
fun debugCancelSeek() {
|
||||
val seekRequest = SeekRequest(DeviceUtil.getSn(), 0)
|
||||
val param = mutableMapOf("data" to seekRequest.getJson())
|
||||
ShareControl.getInstance(context).mogoServiceApis.networkApi.create(ShareApiService::class.java, HttpConstant.getNetHost()).sendHelpSignal(param).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(object : SubscribeImpl<BaseData>(RequestOptions.create(context)) {
|
||||
ServiceApisManager.serviceApis.networkApi.create(ShareApiService::class.java, HttpConstant.getNetHost()).sendHelpSignal(param).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(object : SubscribeImpl<BaseData>(RequestOptions.create(context)) {
|
||||
override fun onSuccess(o: BaseData?) {
|
||||
super.onSuccess(o)
|
||||
// 接口请求成功,内部同步v2x状态,通知adas,改变自车图标
|
||||
ShareControl.getInstance(context).mogoServiceApis.statusManagerApi.setSeekHelping("ShareDialog", false)
|
||||
ServiceApisManager.serviceApis.statusManagerApi.setSeekHelping("ShareDialog", false)
|
||||
isSeekHelp = false
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.mogo.module.share.manager
|
||||
|
||||
import android.content.Context
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.mogo.service.IMogoServiceApis
|
||||
import com.mogo.service.MogoServicePaths
|
||||
|
||||
/**
|
||||
* 全局管理IMogoServiceApis
|
||||
*/
|
||||
object ServiceApisManager {
|
||||
lateinit var serviceApis: IMogoServiceApis
|
||||
|
||||
fun init(context: Context) {
|
||||
serviceApis = ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(context) as IMogoServiceApis
|
||||
}
|
||||
}
|
||||
@@ -11,10 +11,10 @@ import com.mogo.utils.logger.Logger
|
||||
*/
|
||||
object UploadHelper {
|
||||
fun upload(context:Context, type: String) {
|
||||
ShareControl.getInstance(context).mogoServiceApis.statusManagerApi.setUploadingStatus("CARD_TYPE_ROAD_CONDITION", true)
|
||||
ServiceApisManager.serviceApis.statusManagerApi.setUploadingStatus("CARD_TYPE_ROAD_CONDITION", true)
|
||||
Logger.d("UploadHelper", "upload ----> $type")
|
||||
val intent = Intent()
|
||||
intent.action = "com.zhidao.roadcondition.share"
|
||||
intent.action = "com.zhidao.share.roadcondition.action"
|
||||
intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND)
|
||||
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES)
|
||||
intent.putExtra("type", type)
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.mogo.service.module.IMogoRegisterCenter;
|
||||
import com.mogo.service.module.IMogoSearchManager;
|
||||
import com.mogo.service.module.IMogoSettingManager;
|
||||
import com.mogo.service.network.IMogoNetwork;
|
||||
import com.mogo.service.share.IMogoShareManager;
|
||||
import com.mogo.service.statusmanager.IMogoMsgCenter;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.strategy.IMogoRefreshStrategyController;
|
||||
@@ -194,4 +195,10 @@ public interface IMogoServiceApis extends IProvider {
|
||||
* @return
|
||||
*/
|
||||
IMogoMarkerService getMarkerService();
|
||||
|
||||
/**
|
||||
* 其他模块调用分享框的显示和隐藏
|
||||
* @return
|
||||
*/
|
||||
IMogoShareManager getShareManager();
|
||||
}
|
||||
|
||||
@@ -170,6 +170,7 @@ public class MogoServicePaths {
|
||||
/**
|
||||
* 顶部1/2屏管理
|
||||
*/
|
||||
@Deprecated
|
||||
public static final String PATH_EXTENSIONS_TOP_VIEW_MANAGER = "/topview/api";
|
||||
|
||||
/**
|
||||
@@ -177,4 +178,10 @@ public class MogoServicePaths {
|
||||
*/
|
||||
@Deprecated
|
||||
public static final String PATH_MARKER_SERVICE = "/mogomarker/api";
|
||||
|
||||
/**
|
||||
* 其他模块调用分享框
|
||||
*/
|
||||
@Deprecated
|
||||
public static final String PATH_SHARE = "/extensions/share";
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.mogo.service.share;
|
||||
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
|
||||
/**
|
||||
* 分享框管理接口
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public interface IMogoShareManager extends IProvider {
|
||||
/**
|
||||
* 显示分享框
|
||||
*/
|
||||
void showShareDialog();
|
||||
|
||||
/**
|
||||
* 隐藏分享框
|
||||
*/
|
||||
void dismissShareDialog();
|
||||
}
|
||||
@@ -30,6 +30,7 @@ import com.mogo.service.module.IMogoRegisterCenter;
|
||||
import com.mogo.service.module.IMogoSearchManager;
|
||||
import com.mogo.service.module.IMogoSettingManager;
|
||||
import com.mogo.service.network.IMogoNetwork;
|
||||
import com.mogo.service.share.IMogoShareManager;
|
||||
import com.mogo.service.statusmanager.IMogoMsgCenter;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.strategy.IMogoRefreshStrategyController;
|
||||
@@ -171,7 +172,12 @@ public class MogoServiceApis implements IMogoServiceApis {
|
||||
return getApiInstance( IMogoMarkerService.class, MogoServicePaths.PATH_MARKER_SERVICE );
|
||||
}
|
||||
|
||||
private static < T extends IProvider > T getApiInstance( Class< T > clazz, String path ) {
|
||||
@Override
|
||||
public IMogoShareManager getShareManager() {
|
||||
return getApiInstance(IMogoShareManager.class,MogoServicePaths.PATH_SHARE);
|
||||
}
|
||||
|
||||
private static < T extends IProvider > T getApiInstance(Class< T > clazz, String path ) {
|
||||
T inst = SingletonsHolder.get( clazz );
|
||||
if ( inst == null ) {
|
||||
synchronized ( sLock ) {
|
||||
|
||||
Reference in New Issue
Block a user