diff --git a/app/build.gradle b/app/build.gradle index 9172cdd059..cfece5f7c6 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -188,10 +188,25 @@ dependencies { } } +//android.applicationVariants.all { variant -> +// variant.outputs.all { //这里修改apk文件名 +// outputFileName = "Launcher2.0_V${android.defaultConfig.versionName}_${getCurrentDate()}_${variant.name}_${getGitCommit()}.apk" +// println outputFileName +// } +//} + android.applicationVariants.all { variant -> - variant.outputs.all { //这里修改apk文件名 - outputFileName = "Launcher2.0_V${android.defaultConfig.versionName}_${getCurrentDate()}_${variant.name}_${getGitCommit()}.apk" - println outputFileName + def buildTime = new Date().format("yyyyMMdd", TimeZone.getTimeZone("GMT+08:00")) + def flavor = variant.productFlavors.collect { it.name }.join('-') + + variant.outputs.all { output -> + outputFileName = [ + rootProject.applicationName, + "v${variant.versionName}", + buildTime, + flavor.length() > 0 ? "[${flavor}]" : "", + variant.buildType.name + ].findAll { it.length() > 0 }.join('_') << ".apk" } } diff --git a/app/src/main/java/com/mogo/launcher/MogoApplication.java b/app/src/main/java/com/mogo/launcher/MogoApplication.java index 3b339d9a2d..b2c9f7f484 100644 --- a/app/src/main/java/com/mogo/launcher/MogoApplication.java +++ b/app/src/main/java/com/mogo/launcher/MogoApplication.java @@ -55,7 +55,7 @@ public class MogoApplication extends AbsMogoApplication { MogoModulePaths.addModule(new MogoModule(AdCardConstants.TAG, AdCardConstants.MODULE_NAME)); MogoModulePaths.addModule(new MogoModule(MediaConstants.TAG, MediaConstants.MODULE_TYPE)); MogoModulePaths.addModule(new MogoModule(CallChatConstant.PROVIDER, CallChatConstant.MODULE_NAME)); - MogoModulePaths.addModule(new MogoModule(TanluConstants.TAG, TanluConstants.MODEL_NAME)); +// MogoModulePaths.addModule(new MogoModule(TanluConstants.TAG, TanluConstants.MODEL_NAME)); MogoModulePaths.addModule(new MogoModule(OnLineCarConstants.TAG, OnLineCarConstants.MODULE_NAME)); MogoModulePaths.addModule(new MogoModule(V2XConst.PATH_V2X_UI, V2XConst.PATH_V2X_UI)); diff --git a/gradle.properties b/gradle.properties index bf7b67a9c8..84350bc66e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -72,4 +72,10 @@ MOGO_MODULE_MEDIA_VERSION=1.0.4.3 # 推送 MOGO_MODULE_PUSH_VERSION=1.0.1 # 广告资源位 -MOGO_MODULE_AD_CARD_VERSION=1.0.1 \ No newline at end of file +MOGO_MODULE_AD_CARD_VERSION=1.0.1 + +## 产品库必备配置 +applicationId=com.mogo.launcer +applicationName=Launcer2.0 +appVersionCode=1 +appVersionName=1.0.0 \ No newline at end of file diff --git a/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/AMapNaviViewWrapper.java b/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/AMapNaviViewWrapper.java index 5c62d54fd3..341fc8b0c4 100644 --- a/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/AMapNaviViewWrapper.java +++ b/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/AMapNaviViewWrapper.java @@ -17,7 +17,6 @@ import android.view.animation.Interpolator; import com.amap.api.maps.AMap; import com.amap.api.maps.AMapUtils; import com.amap.api.maps.CameraUpdateFactory; -import com.amap.api.maps.LocationSource; import com.amap.api.maps.model.BitmapDescriptorFactory; import com.amap.api.maps.model.CameraPosition; import com.amap.api.maps.model.LatLng; diff --git a/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/AppsFragment.java b/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/AppsFragment.java index 9e7fc0f6ce..ed3de2b4a8 100644 --- a/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/AppsFragment.java +++ b/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/AppsFragment.java @@ -50,7 +50,7 @@ public class AppsFragment extends MvpFragment< AppsView, AppsPresenter > impleme mExit.setOnClickListener( view -> { if ( getActivity() != null ) { getActivity().finish(); - getActivity().overridePendingTransition( R.anim.module_apps_anim_enter, R.anim.module_apps_anim_exit); + getActivity().overridePendingTransition( 0, R.anim.module_apps_anim_exit); } } ); // mAppsList = findViewById( R.id.module_apps_id_apps ); diff --git a/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/AppsListActivity.java b/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/AppsListActivity.java index 82c116ec6f..d72b53e10a 100644 --- a/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/AppsListActivity.java +++ b/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/AppsListActivity.java @@ -2,9 +2,11 @@ package com.mogo.module.apps; import android.app.Activity; import android.content.Intent; +import android.os.Bundle; import android.view.View; import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import com.alibaba.android.arouter.launcher.ARouter; import com.google.android.material.bottomsheet.BottomSheetBehavior; @@ -27,7 +29,12 @@ public class AppsListActivity extends MvpActivity< AppsListView, AppsListPresent public static void start( Activity context ) { Intent starter = new Intent( context, AppsListActivity.class ); context.startActivity( starter ); - context.overridePendingTransition( R.anim.module_apps_anim_enter, R.anim.module_apps_anim_exit); + } + + @Override + protected void onCreate( @Nullable Bundle savedInstanceState ) { + overridePendingTransition( R.anim.module_apps_anim_enter, 0); + super.onCreate( savedInstanceState ); } @Override diff --git a/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/model/NavigatorApps.java b/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/model/NavigatorApps.java index 1bb4271c82..1b64ff1bb8 100644 --- a/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/model/NavigatorApps.java +++ b/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/model/NavigatorApps.java @@ -14,6 +14,7 @@ import java.util.List; public class NavigatorApps { private static AppInfo app = new AppInfo( "导航", "com.mogo.launcher.navi.search", "", 0, null, R.drawable.module_apps_ic_navigator_navi ); + private static AppInfo app_ = new AppInfo( "导航", "com.mogo.launcher.navi.search", "", 0, null, R.drawable.module_apps_ic_navigator_navi_disable ); private static AppInfo app2 = new AppInfo( "音乐", "com.pvetec.musics", "", 0, null, R.drawable.module_apps_ic_navigator_media ); private static AppInfo app3 = new AppInfo( "个人中心", "com.zhidao.auto.personal", "", 0, null, R.drawable.module_apps_ic_navigator_personcenter ); private static AppInfo app4 = new AppInfo( "全部应用", "com.mogo.launcher.applist", "", 0, null, R.drawable.module_apps_ic_navigator_applist ); @@ -29,6 +30,7 @@ public class NavigatorApps { public static List< AppInfo > getAppsWithoutNavigation() { List< AppInfo > sApps = new ArrayList<>(); + sApps.add( app_ ); sApps.add( app2 ); sApps.add( app3 ); sApps.add( app4 ); diff --git a/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/receiver/AppInstallReceiver.java b/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/receiver/AppInstallReceiver.java index e3e599243f..1ea5fa4216 100644 --- a/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/receiver/AppInstallReceiver.java +++ b/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/receiver/AppInstallReceiver.java @@ -4,7 +4,9 @@ package com.mogo.module.apps.receiver; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; +import android.text.TextUtils; +import com.mogo.module.apps.AppServiceHandler; import com.mogo.module.apps.model.AppsModel; public class AppInstallReceiver extends BroadcastReceiver { @@ -14,6 +16,9 @@ public class AppInstallReceiver extends BroadcastReceiver { if ( intent.getAction().equals( Intent.ACTION_PACKAGE_ADDED ) ) { String packageName = intent.getData().getSchemeSpecificPart(); AppsModel.getInstance( context ).appAdded( packageName ); + if ( TextUtils.equals( packageName, "com.zhidao.autopilot" ) ) { + AppServiceHandler.getApis().getAdasControllerApi().showADAS(); + } } if ( intent.getAction().equals( Intent.ACTION_PACKAGE_REMOVED ) ) { String packageName = intent.getData().getSchemeSpecificPart(); @@ -21,6 +26,9 @@ public class AppInstallReceiver extends BroadcastReceiver { } if ( intent.getAction().equals( Intent.ACTION_PACKAGE_REPLACED ) ) { String packageName = intent.getData().getSchemeSpecificPart(); + if ( TextUtils.equals( packageName, "com.zhidao.autopilot" ) ) { + AppServiceHandler.getApis().getAdasControllerApi().showADAS(); + } } if ( intent.getAction().equals( Intent.ACTION_PACKAGE_CHANGED ) ) { String packageName = intent.getData().getSchemeSpecificPart(); diff --git a/modules/mogo-module-apps/src/main/res/values-ldpi/dimens.xml b/modules/mogo-module-apps/src/main/res/values-ldpi/dimens.xml index faac054011..fb55520395 100644 --- a/modules/mogo-module-apps/src/main/res/values-ldpi/dimens.xml +++ b/modules/mogo-module-apps/src/main/res/values-ldpi/dimens.xml @@ -21,9 +21,9 @@ 50px 50px - 140px - 140px - 30px - 64px - 64px + 78px + 78px + 16px + 78px + 78px \ No newline at end of file diff --git a/modules/mogo-module-back/src/main/java/com/mogo/module/back/BackToMainHomeManager.java b/modules/mogo-module-back/src/main/java/com/mogo/module/back/BackToMainHomeManager.java index b356e030de..20818c844d 100644 --- a/modules/mogo-module-back/src/main/java/com/mogo/module/back/BackToMainHomeManager.java +++ b/modules/mogo-module-back/src/main/java/com/mogo/module/back/BackToMainHomeManager.java @@ -72,7 +72,11 @@ public class BackToMainHomeManager { params.x = AbsMogoApplication.getApp().getResources().getDimensionPixelOffset( R.dimen.module_back_main_home_icon_left ); params.y = AbsMogoApplication.getApp().getResources().getDimensionPixelOffset( R.dimen.module_back_main_home_icon_top ); params.gravity = Gravity.LEFT | Gravity.CENTER; - params.type = getFitWindowParamsType(); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + params.type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY; + } else { + params.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT; + } params.format = PixelFormat.RGBA_8888; params.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; windowManager.addView( mBackView, params ); @@ -83,18 +87,4 @@ public class BackToMainHomeManager { WindowManagerViewHelper.removeView( mBackView ); } - private static int getFitWindowParamsType() { - int type; - if ( Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1 ) { - // Need request permission. - type = WindowManager.LayoutParams.TYPE_PHONE; - } else if ( Build.MODEL.equalsIgnoreCase( "MI 5" ) ) { - // MI 5 phone not display crawler dot in android 7.0 - type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT; - } else { - // It's will be dismissed automatically 3s after showing in Android 25. - type = WindowManager.LayoutParams.TYPE_TOAST; - } - return type; - } } diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerCardResult.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerCardResult.java index 1a8e044cf8..be7c7bbe23 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerCardResult.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerCardResult.java @@ -9,11 +9,12 @@ public class MarkerCardResult implements Serializable { private List dataType; // 要查询的类型 private List carChat; - private List exploreWay; - private List onlineCar; private List shareMusic; private List noveltyInfo; + private List onlineCar; + private List exploreWay; + public List getCarChat() { return carChat; } diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerExploreWay.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerExploreWay.java index 073c45bee0..00fdbf8552 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerExploreWay.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerExploreWay.java @@ -9,6 +9,7 @@ import java.util.List; @SuppressWarnings("unused") public class MarkerExploreWay implements Serializable { + private String infoId; private String type;//卡片类型, private String sn; private MarkerLocation location;//位置信息 @@ -20,6 +21,7 @@ public class MarkerExploreWay implements Serializable { private String cityName;//:"城市名称", private double distance;//距离 private MarkerUserInfo userInfo;//用户信息 + private String poiType; private List items;//视频地址和图片地址 public String getAddr() { @@ -121,6 +123,20 @@ public class MarkerExploreWay implements Serializable { this.userInfo = userInfo; } + public String getPoiType() { + return poiType; + } + + + public String getInfoId() { + return infoId; + } + + public MarkerExploreWay setInfoId( String infoId ) { + this.infoId = infoId; + return this; + } + @Override public String toString() { return "MarkerExploreWay{" + diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerPoiTypeEnum.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerPoiTypeEnum.java index 6060810e56..e57e3270fe 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerPoiTypeEnum.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerPoiTypeEnum.java @@ -36,4 +36,6 @@ public interface MarkerPoiTypeEnum { public String FOURS_ACCIDENT = "10013"; //身边 public String FOURS_NEALY = "10014"; + //实时路况 + public String FOURS_LIVING = "10015"; } \ No newline at end of file diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java index bc82a3cdc3..34867b8492 100644 --- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java +++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java @@ -50,6 +50,7 @@ import com.mogo.service.statusmanager.IMogoStatusChangedListener; import com.mogo.service.statusmanager.IMogoStatusManager; import com.mogo.service.statusmanager.StatusDescriptor; import com.mogo.utils.ResourcesHelper; +import com.mogo.utils.UiThreadHandler; import com.mogo.utils.logger.Logger; import java.util.HashMap; @@ -162,6 +163,17 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent private Rect mDisplayOverviewBounds; + private Runnable mLockCarRunnable = new Runnable() { + @Override + public void run() { + if ( !mStatusManager.isDisplayOverview() ) { + return; + } + mStatusManager.setDisplayOverview( TAG, false ); + mMApUIController.recoverLockMode(); + } + }; + @Override protected int getLayoutId() { return R.layout.module_ext_layout_entrance; @@ -197,8 +209,11 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent mDisplayOverview.setOnClickListener( view -> { if ( !mStatusManager.isDisplayOverview() ) { mMApUIController.displayOverview( mDisplayOverviewBounds ); + UiThreadHandler.removeCallbacks( mLockCarRunnable ); + UiThreadHandler.postDelayed( mLockCarRunnable, 20_000 ); } else { mMApUIController.recoverLockMode(); + UiThreadHandler.removeCallbacks( mLockCarRunnable ); } mStatusManager.setDisplayOverview( TAG, !mStatusManager.isDisplayOverview() ); } ); @@ -212,6 +227,10 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent mMApUIController.setLockZoom( 16 ); mMApUIController.changeZoom( 16.0f ); } + if ( mStatusManager.isDisplayOverview() ) { + mMogoStatusManager.setDisplayOverview( TAG, false ); + UiThreadHandler.removeCallbacks( mLockCarRunnable ); + } mMogoStatusManager.setUserInteractionStatus( TAG, true, false ); mMApUIController.recoverLockMode(); } diff --git a/modules/mogo-module-extensions/src/main/res/drawable/module_ext_drawable_weather_bkg.xml b/modules/mogo-module-extensions/src/main/res/drawable/module_ext_drawable_weather_bkg.xml index 700b8df8e0..90fb7a2eaf 100644 --- a/modules/mogo-module-extensions/src/main/res/drawable/module_ext_drawable_weather_bkg.xml +++ b/modules/mogo-module-extensions/src/main/res/drawable/module_ext_drawable_weather_bkg.xml @@ -3,7 +3,7 @@ - + \ No newline at end of file diff --git a/modules/mogo-module-extensions/src/main/res/layout/module_ext_layout_entrance.xml b/modules/mogo-module-extensions/src/main/res/layout/module_ext_layout_entrance.xml index 77d36f91e1..ab7a83b8e4 100644 --- a/modules/mogo-module-extensions/src/main/res/layout/module_ext_layout_entrance.xml +++ b/modules/mogo-module-extensions/src/main/res/layout/module_ext_layout_entrance.xml @@ -15,9 +15,9 @@ - - - - - + @@ -89,8 +82,8 @@ android:layout_width="@dimen/module_ext_operation_panel_share_width" android:layout_height="@dimen/module_ext_operation_panel_share_height" android:layout_marginBottom="@dimen/module_ext_operation_panel_share_marginBottom" - app:layout_constraintBottom_toTopOf="@+id/module_entrance_id_operation_panel" - app:layout_constraintRight_toRightOf="@+id/module_entrance_id_operation_panel" + app:layout_constraintBottom_toTopOf="@+id/module_entrance_id_move2_current_location" + app:layout_constraintRight_toRightOf="@+id/module_entrance_id_move2_current_location" app:layout_goneMarginBottom="@dimen/module_ext_operation_panel_share_goneMarginBottom"> 20px 1px - 58px + 66px 20px 34.5px 58px @@ -38,16 +38,16 @@ 31.4px 1.2px 58px - 58px - 58px + 66px + 66px 21px 20px 34.5px 20px - 64px - 64px + 66px + 66px 20px 32px 20px @@ -56,7 +56,7 @@ 8px - 64px + 66px 32px 32px @@ -71,14 +71,14 @@ 18.48px 16px 22px - 28px + 16px 15px 15px 11.73px - 1058px - 210px + 544px + 117px 85px 85px 13px @@ -100,16 +100,29 @@ -1px 30px - 40px - 40px + 23px + 23px 15px 15px 5px + 20px + 14px + 20px + 14px + 20px + 14px + 34px + 8px + 8px 534px 100px 68px 32px - 240px + 16px + 142px + 66px + 66px + 16px \ No newline at end of file diff --git a/modules/mogo-module-extensions/src/main/res/values-xhdpi/dimens.xml b/modules/mogo-module-extensions/src/main/res/values-xhdpi/dimens.xml index b062b26c4a..7b89df54dc 100644 --- a/modules/mogo-module-extensions/src/main/res/values-xhdpi/dimens.xml +++ b/modules/mogo-module-extensions/src/main/res/values-xhdpi/dimens.xml @@ -101,6 +101,15 @@ 15px 15px 5px + 50px + 37px + 26px + 37px + 26px + 37px + 26px + 15px + 15px 952px @@ -108,5 +117,9 @@ 122px 61px 240px + 30px + 120px + 120px + 30px \ No newline at end of file diff --git a/modules/mogo-module-extensions/src/main/res/values/dimens.xml b/modules/mogo-module-extensions/src/main/res/values/dimens.xml index 65fd20b2ac..e30e6f8ee9 100644 --- a/modules/mogo-module-extensions/src/main/res/values/dimens.xml +++ b/modules/mogo-module-extensions/src/main/res/values/dimens.xml @@ -119,5 +119,8 @@ 61px 30px 240px + 120px + 120px + 30px \ No newline at end of file diff --git a/modules/mogo-module-main/src/main/res/values-ldpi/dimens.xml b/modules/mogo-module-main/src/main/res/values-ldpi/dimens.xml index 410eaa7f32..0ba4ec9f22 100644 --- a/modules/mogo-module-main/src/main/res/values-ldpi/dimens.xml +++ b/modules/mogo-module-main/src/main/res/values-ldpi/dimens.xml @@ -1,7 +1,7 @@ - 200px + 300px 8px 352px 370px @@ -16,11 +16,11 @@ 320px 319px - 200px - 30px - 30px - 830px - 800px - 30px + 110px + 16px + 15px + 460px + 444px + 16px \ No newline at end of file diff --git a/modules/mogo-module-main/src/main/res/values-xhdpi/dimens.xml b/modules/mogo-module-main/src/main/res/values-xhdpi/dimens.xml index 4d1f9fdb5b..ee84bb8039 100644 --- a/modules/mogo-module-main/src/main/res/values-xhdpi/dimens.xml +++ b/modules/mogo-module-main/src/main/res/values-xhdpi/dimens.xml @@ -1,7 +1,7 @@ - 200px + 300px 10px 660px 690px diff --git a/modules/mogo-module-main/src/main/res/values/dimens.xml b/modules/mogo-module-main/src/main/res/values/dimens.xml index 3589fe1e5d..af1335b972 100644 --- a/modules/mogo-module-main/src/main/res/values/dimens.xml +++ b/modules/mogo-module-main/src/main/res/values/dimens.xml @@ -1,7 +1,7 @@ - 200px + 150px 10px 660px 690px diff --git a/modules/mogo-module-map/src/main/java/com/mogo/module/map/MapPresenter.java b/modules/mogo-module-map/src/main/java/com/mogo/module/map/MapPresenter.java index 4b740e501a..f71aceddb0 100644 --- a/modules/mogo-module-map/src/main/java/com/mogo/module/map/MapPresenter.java +++ b/modules/mogo-module-map/src/main/java/com/mogo/module/map/MapPresenter.java @@ -8,6 +8,7 @@ import android.graphics.Rect; import android.text.TextUtils; import androidx.annotation.NonNull; +import androidx.annotation.UiThread; import androidx.lifecycle.LifecycleOwner; import com.alibaba.android.arouter.launcher.ARouter; @@ -63,6 +64,18 @@ public class MapPresenter extends Presenter< MapView > implements private IMogoSettingManager mSettingManager; private Rect mDisplayOverviewBounds; + + private Runnable mLockCarRunnable = new Runnable() { + @Override + public void run() { + if ( !mStatusManager.isDisplayOverview() ) { + return; + } + mStatusManager.setDisplayOverview( TAG, false ); + mView.getUIController().recoverLockMode(); + } + }; + public MapPresenter( MapView view ) { super( view ); initBroadcast(); @@ -221,6 +234,7 @@ public class MapPresenter extends Presenter< MapView > implements mStatusManager.setDisplayOverview( TAG, false ); mView.getUIController().recoverLockMode(); AIAssist.getInstance( getContext() ).speakTTSVoice( "已为您继续导航" ); + UiThreadHandler.removeCallbacks( mLockCarRunnable ); } else { mLauncher.backToLauncher( getContext() ); UiThreadHandler.postDelayed( () -> { @@ -228,6 +242,7 @@ public class MapPresenter extends Presenter< MapView > implements mStatusManager.setDisplayOverview( TAG, false ); mView.getUIController().recoverLockMode(); AIAssist.getInstance( getContext() ).speakTTSVoice( "已为您继续导航" ); + UiThreadHandler.removeCallbacks( mLockCarRunnable ); } catch ( Exception e ) { e.printStackTrace(); } @@ -258,6 +273,8 @@ public class MapPresenter extends Presenter< MapView > implements AIAssist.getInstance( getContext() ).speakTTSVoice( "展示全程路线" ); }, 2_000L ); } + + UiThreadHandler.postDelayed( mLockCarRunnable, 20_000 ); } private void zoomMap( boolean zoomIn ) { diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServices.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServices.java index cf67cd97c5..ed01a0a9e2 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServices.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServices.java @@ -751,10 +751,13 @@ public class MogoServices implements IMogoMapListener, mStatusManager.setADASUIShow( ServiceConst.TYPE, status == 1 ); } else if ( Intent.ACTION_POWER_CONNECTED.equals( command ) ) { mStatusManager.setAccStatus( ServiceConst.TYPE, true ); + Logger.d( TAG, "acc status: %s", true ); } else if ( Intent.ACTION_POWER_DISCONNECTED.equals( command ) ) { mStatusManager.setAccStatus( ServiceConst.TYPE, false ); + Logger.d( TAG, "acc status: %s", false ); } else if ( MogoReceiver.ACTION_NWD_ACC.equals( command ) ) { int state = intent.getByteExtra( MogoReceiver.PARAM_ACC_STATUS, ( byte ) 0 ); + Logger.d( TAG, "acc status: %s", state == 1 ); mStatusManager.setAccStatus( ServiceConst.TYPE, state == 1 ); } else if ( MogoReceiver.ACTION_VOICE_UI.equals( command ) ) { String val = intent.getStringExtra( MogoReceiver.PARRAM_WAKE_STATUS ); diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/ServiceConst.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/ServiceConst.java index 304c284b98..41282ef6bc 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/ServiceConst.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/ServiceConst.java @@ -85,7 +85,7 @@ public class ServiceConst { /** * 20 s */ - public static final int DEFAULT_AUTO_REFRESH_WHEN_INTERRUPT = 20 * 1_000; + public static final int DEFAULT_AUTO_REFRESH_WHEN_INTERRUPT = 30 * 1_000; /** * 所有卡片显示的每类点的最大数据量 diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerInfoView.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerInfoView.java index d272ae9046..bb991fdae9 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerInfoView.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerInfoView.java @@ -12,6 +12,7 @@ import androidx.annotation.Nullable; import androidx.constraintlayout.widget.ConstraintLayout; import com.mogo.map.marker.MogoMarkerOptions; +import com.mogo.module.common.entity.MarkerExploreWay; import com.mogo.module.common.entity.MarkerNoveltyInfo; import com.mogo.module.common.entity.MarkerOnlineCar; import com.mogo.module.common.entity.MarkerPoiTypeEnum; @@ -36,193 +37,145 @@ public class MapMarkerInfoView extends MapMarkerBaseView { private ConstraintLayout clMarkerContent; private ImageView ivReverseTriangle; - public MapMarkerInfoView(Context context) { - super(context); + public MapMarkerInfoView( Context context ) { + super( context ); } - public MapMarkerInfoView(Context context, @Nullable AttributeSet attrs) { - super(context, attrs); + public MapMarkerInfoView( Context context, @Nullable AttributeSet attrs ) { + super( context, attrs ); } - public MapMarkerInfoView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); + public MapMarkerInfoView( Context context, @Nullable AttributeSet attrs, int defStyleAttr ) { + super( context, attrs, defStyleAttr ); } - public MapMarkerInfoView(Context context, MarkerShowEntity markerShowEntity, MogoMarkerOptions options) { - super(context); + public MapMarkerInfoView( Context context, MarkerShowEntity markerShowEntity, MogoMarkerOptions options ) { + super( context ); mOptions = options; - updateView(markerShowEntity); + updateView( markerShowEntity ); } - protected void initView(Context context) { - LayoutInflater.from(context).inflate(R.layout.view_map_marker_info, this); - ivUserHead = findViewById(R.id.ivUserHead); - ivIcon = findViewById(R.id.ivIcon); - clMarkerContent = findViewById(R.id.clMarkerContent); - ivReverseTriangle = findViewById(R.id.ivReverseTriangle); - ivCar = findViewById(R.id.ivCar); - tvMarkerContent = findViewById(R.id.tvMarkerContent); + protected void initView( Context context ) { + LayoutInflater.from( context ).inflate( R.layout.view_map_marker_info, this ); + ivUserHead = findViewById( R.id.ivUserHead ); + ivIcon = findViewById( R.id.ivIcon ); + clMarkerContent = findViewById( R.id.clMarkerContent ); + ivReverseTriangle = findViewById( R.id.ivReverseTriangle ); + ivCar = findViewById( R.id.ivCar ); + tvMarkerContent = findViewById( R.id.tvMarkerContent ); } - public void updateView(MarkerShowEntity markerShowEntity) { + public void updateView( MarkerShowEntity markerShowEntity ) { try { Object bindObj = markerShowEntity.getBindObj(); - switch (markerShowEntity.getMarkerType()) { + ivCar.setImageResource( R.drawable.icon_map_marker_location_yellow ); + clMarkerContent.setBackgroundResource( R.drawable.bg_map_marker_yellow_info ); + ivReverseTriangle.setImageResource( R.drawable.bg_shape_reverse_yellow ); + switch ( markerShowEntity.getMarkerType() ) { case ServiceConst.CARD_TYPE_CARS_CHATTING: case ServiceConst.CARD_TYPE_USER_DATA: - ivUserHead.setVisibility(View.VISIBLE); - ivIcon.setVisibility(View.INVISIBLE); - loadImageWithMarker(markerShowEntity); - ivCar.setImageResource(R.drawable.icon_map_marker_car_gray); + ivUserHead.setVisibility( View.VISIBLE ); + ivIcon.setVisibility( View.INVISIBLE ); + loadImageWithMarker( markerShowEntity ); + ivCar.setImageResource( R.drawable.icon_map_marker_car_gray ); //ivCar.setRotation(new Random().nextInt(360)); - ivCar.setRotation((float) markerShowEntity.getMarkerLocation().getAngle()); - - if (bindObj instanceof MarkerOnlineCar) { - if (((MarkerOnlineCar) bindObj).getUserInfo().getGenderValue() == 0) { - clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_blue_info); - ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_blue); - } else { - clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_purple_info); - ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_purple); - } - } - + ivCar.setRotation( ( float ) markerShowEntity.getMarkerLocation().getAngle() ); break; case ServiceConst.CARD_TYPE_ROAD_CONDITION: - ivUserHead.setVisibility(View.INVISIBLE); - ivIcon.setVisibility(View.VISIBLE); - - ivIcon.setImageResource(R.drawable.icon_map_marker_road_block_up); - clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_blue_info); - ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_blue); - ivCar.setImageResource(R.drawable.icon_map_marker_location_blue); - break; case ServiceConst.CARD_TYPE_NOVELTY: - ivUserHead.setVisibility(View.INVISIBLE); - ivIcon.setVisibility(View.VISIBLE); - ivCar.setImageResource(R.drawable.icon_map_marker_location_blue); + ivUserHead.setVisibility( View.INVISIBLE ); + ivIcon.setVisibility( View.VISIBLE ); - if (bindObj instanceof MarkerNoveltyInfo) { - switch (((MarkerNoveltyInfo) bindObj).getPoiType()) { + if ( bindObj instanceof MarkerExploreWay ) { + switch ( ( ( MarkerExploreWay ) bindObj ).getPoiType() ) { case MarkerPoiTypeEnum.GAS_STATION: - ivIcon.setImageResource(R.drawable.icon_map_marker_refuel); - clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_orange_info); - ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_orange); + ivIcon.setImageResource( R.drawable.icon_map_marker_refuel ); break; case MarkerPoiTypeEnum.TRAFFIC_CHECK: - ivIcon.setImageResource(R.drawable.icon_map_marker_road_check); - clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_green_info); - ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_green); + ivIcon.setImageResource( R.drawable.icon_map_marker_road_check2_light ); break; case MarkerPoiTypeEnum.ROAD_CLOSED: - ivIcon.setImageResource(R.drawable.icon_map_marker_road_block_off); - clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_dark_blue_info); - ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_dark_blue); + ivIcon.setImageResource( R.drawable.icon_map_marker_road_block_off2_light ); break; case MarkerPoiTypeEnum.SHOP_DISCOUNT: - ivIcon.setImageResource(R.drawable.icon_map_marker_shop_discount); - clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_red_info); - ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_red); + ivIcon.setImageResource( R.drawable.icon_map_marker_shop_discount ); break; case MarkerPoiTypeEnum.FOURS_4S: - ivIcon.setImageResource(R.drawable.icon_map_marker_4s); - clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_dark_blue_info); - ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_dark_blue); + ivIcon.setImageResource( R.drawable.icon_map_marker_4s ); break; case MarkerPoiTypeEnum.FOURS_ROAD_WORK: - ivIcon.setImageResource(R.drawable.icon_map_marker_road_work); - clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_dark_blue_info); - ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_dark_blue); + ivIcon.setImageResource( R.drawable.icon_map_marker_road_work2_light ); break; case MarkerPoiTypeEnum.FOURS_BLOCK_UP: - ivIcon.setImageResource(R.drawable.icon_map_marker_road_block_up); - clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_blue_info); - ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_blue); + ivIcon.setImageResource( R.drawable.icon_map_marker_road_block_up2_light ); break; case MarkerPoiTypeEnum.FOURS_PONDING: - ivIcon.setImageResource(R.drawable.icon_map_marker_pondingl); - clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_blue_info); - ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_blue); + ivIcon.setImageResource( R.drawable.icon_map_marker_pondingl2_light ); break; case MarkerPoiTypeEnum.FOURS_SHOP_FREE: - ivIcon.setImageResource(R.drawable.icon_map_marker_shop); - clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_dark_green_info); - ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_dark_green); + ivIcon.setImageResource( R.drawable.icon_map_marker_shop ); break; case MarkerPoiTypeEnum.FOURS_FOG: - ivIcon.setImageResource(R.drawable.module_service_ic_rc_dark_frog2); - clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_grey_info); - ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_grey); + ivIcon.setImageResource( R.drawable.module_service_ic_rc_dark_frog2_light ); break; case MarkerPoiTypeEnum.FOURS_ICE: - ivIcon.setImageResource(R.drawable.module_service_ic_rc_freeze2); - clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_blue_info); - ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_blue); + ivIcon.setImageResource( R.drawable.module_service_ic_rc_freeze2_light ); break; case MarkerPoiTypeEnum.FOURS_PARKING: - ivIcon.setImageResource(R.drawable.module_service_ic_rc_parking2); - clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_dark_blue_info); - ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_dark_blue); + ivIcon.setImageResource( R.drawable.module_service_ic_rc_parking2 ); break; case MarkerPoiTypeEnum.FOURS_ACCIDENT: - ivIcon.setImageResource(R.drawable.module_service_ic_rc_accident2); - clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_red_info); - ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_red); + ivIcon.setImageResource( R.drawable.module_service_ic_rc_accident3_light ); break; case MarkerPoiTypeEnum.FOURS_NEALY: - ivIcon.setImageResource(R.drawable.icon_map_marker_shear_news); - clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_blue_info); - ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_blue); + ivIcon.setImageResource( R.drawable.icon_map_marker_shear_news ); + break; + case MarkerPoiTypeEnum.FOURS_LIVING: + ivIcon.setImageResource( R.drawable.icon_map_marker_living_light ); break; default: - ivIcon.setImageResource(R.drawable.icon_map_marker_shear_news); - clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_dark_blue_info); - ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_dark_blue); + ivIcon.setImageResource( R.drawable.icon_map_marker_shear_news ); break; } } break; case ServiceConst.CARD_TYPE_SHARE_MUSIC: - ivUserHead.setVisibility(View.INVISIBLE); - ivIcon.setVisibility(View.VISIBLE); + ivUserHead.setVisibility( View.INVISIBLE ); + ivIcon.setVisibility( View.VISIBLE ); - clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_purple_info); - ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_triangle_purple); - ivCar.setImageResource(R.drawable.icon_map_marker_location_blue); - - if (bindObj instanceof MarkerShareMusic) { + if ( bindObj instanceof MarkerShareMusic ) { // 2 为书籍听书,3 为新闻,1 为qq音乐,int - switch (((MarkerShareMusic) bindObj).getShareType()) { + switch ( ( ( MarkerShareMusic ) bindObj ).getShareType() ) { case 1: - ivIcon.setImageResource(R.drawable.icon_map_marker_misic); + ivIcon.setImageResource( R.drawable.icon_map_marker_misic ); break; case 2: - ivIcon.setImageResource(R.drawable.icon_map_marker_book); + ivIcon.setImageResource( R.drawable.icon_map_marker_book ); break; case 3: - ivIcon.setImageResource(R.drawable.icon_map_marker_news); + ivIcon.setImageResource( R.drawable.icon_map_marker_news ); break; default: - ivIcon.setImageResource(R.drawable.icon_map_marker_misic); + ivIcon.setImageResource( R.drawable.icon_map_marker_misic ); break; } } break; } - if (!TextUtils.isEmpty(markerShowEntity.getTextContent())) { + if ( !TextUtils.isEmpty( markerShowEntity.getTextContent() ) ) { String content; - if (markerShowEntity.getTextContent().length() > 8) { - content = markerShowEntity.getTextContent().substring(0, 7) + "..."; + if ( markerShowEntity.getTextContent().length() > 8 ) { + content = markerShowEntity.getTextContent().substring( 0, 7 ) + "..."; } else { content = markerShowEntity.getTextContent(); } - tvMarkerContent.setText(content); + tvMarkerContent.setText( content ); } - } catch (Exception e) { + } catch ( Exception e ) { e.printStackTrace(); } } diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerManager.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerManager.java index b8a97d8206..c67685661c 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerManager.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerManager.java @@ -222,19 +222,6 @@ public class MapMarkerManager implements IMogoMarkerClickListener, trackData( mLastDataResult ); } - /** - * 是否是语音搜索的在线车辆数据:目前根据返回数据判断 - * - * @param markerCardResult - * @return - */ - private boolean isOnlineCarDataOnly( MarkerCardResult markerCardResult ) { - if ( markerCardResult != null && markerCardResult.getDataType() != null && markerCardResult.getDataType().size() == 1 && markerCardResult.getDataType().contains( ServiceConst.CARD_TYPE_USER_DATA ) ) { - return true; - } - return false; - } - /** * 根据类型绘制 * @@ -260,12 +247,8 @@ public class MapMarkerManager implements IMogoMarkerClickListener, */ private void drawAllMarker( MarkerCardResult markerCardResult ) { List< MarkerExploreWay > exploreWayList = markerCardResult.getExploreWay(); -// List< MarkerShareMusic > shareMusicList = markerCardResult.getShareMusic(); - List< MarkerNoveltyInfo > noveltyInfoList = markerCardResult.getNoveltyInfo(); drawRoadConditionMarker( exploreWayList, ServiceConst.MAX_AMOUNT_ALL ); -// drawShareMusicMarker( shareMusicList, ServiceConst.MAX_AMOUNT_ALL ); - drawNoveltyMarker( noveltyInfoList, ServiceConst.MAX_AMOUNT_ALL ); } /** @@ -318,6 +301,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener, } int size = getAppropriateSize( maxAmount, exploreWayList ); Map< String, IMogoMarker > existCarMap = purgeMarkerData( exploreWayList, ModuleNames.CARD_TYPE_ROAD_CONDITION ); + Logger.i( TAG, "existCarMap: size = %d", existCarMap.size() ); for ( int i = 0; i < size; i++ ) { MarkerExploreWay markerExploreWay = exploreWayList.get( i ); if ( !markerExploreWay.getCanLive() ) { @@ -332,6 +316,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener, String sn = getCarSnFromEntity( markerExploreWay ); IMogoMarker mogoMarker = existCarMap.get( sn ); if ( mogoMarker == null ) { + Logger.d( TAG, "draw road condition, sn = %s", sn ); drawMapMarker( markerShowEntity ); } } @@ -453,7 +438,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener, } else if ( entity instanceof MarkerNoveltyInfo ) { return ( ( MarkerNoveltyInfo ) entity ).getSn(); } else if ( entity instanceof MarkerExploreWay ) { - return ( ( MarkerExploreWay ) entity ).getUserInfo().getSn(); + return ( ( MarkerExploreWay ) entity ).getInfoId(); } } catch ( Exception e ) { @@ -494,76 +479,12 @@ public class MapMarkerManager implements IMogoMarkerClickListener, return; } JSONArray array = new JSONArray(); - List< MarkerOnlineCar > onlineCarList = markerCardResult.getOnlineCar(); List< MarkerExploreWay > exploreWayList = markerCardResult.getExploreWay(); - List< MarkerShareMusic > shareMusicList = markerCardResult.getShareMusic(); - List< MarkerNoveltyInfo > noveltyInfoList = markerCardResult.getNoveltyInfo(); - int size = onlineCarList == null ? 0 : onlineCarList.size(); - fillPoiTypeTrackBody( array, ModuleNames.CARD_TYPE_USER_DATA, size ); + int size = 0; size = exploreWayList == null ? 0 : exploreWayList.size(); fillPoiTypeTrackBody( array, ModuleNames.CARD_TYPE_ROAD_CONDITION, size ); - size = noveltyInfoList == null ? 0 : noveltyInfoList.size(); - JSONObject novelty = fillPoiTypeTrackBody( array, ModuleNames.CARD_TYPE_NOVELTY, size ); - if ( noveltyInfoList != null ) { - Map< String, Integer > counter = new HashMap<>(); - for ( MarkerNoveltyInfo markerNoveltyInfo : noveltyInfoList ) { - if ( markerNoveltyInfo == null ) { - continue; - } - String childType = markerNoveltyInfo.getPoiType(); - if ( !counter.containsKey( childType ) ) { - counter.put( childType, 0 ); - } - int s = counter.get( childType ).intValue(); - counter.put( childType, s + 1 ); - } - if ( !counter.isEmpty() ) { - JSONArray onlineCarJsonArray = new JSONArray(); - for ( Map.Entry< String, Integer > entry : counter.entrySet() ) { - fillPoiChildTypeTrackBody( onlineCarJsonArray, entry.getKey(), entry.getValue() ); - } - if ( onlineCarJsonArray.length() > 0 ) { - try { - novelty.put( "content", onlineCarJsonArray ); - } catch ( JSONException e ) { - e.printStackTrace(); - } - } - } - } - - size = shareMusicList == null ? 0 : shareMusicList.size(); - JSONObject shareMusic = fillPoiTypeTrackBody( array, ModuleNames.CARD_TYPE_SHARE_MUSIC, size ); - if ( shareMusicList != null ) { - Map< String, Integer > counter = new HashMap<>(); - for ( MarkerShareMusic markerShareMusic : shareMusicList ) { - if ( markerShareMusic == null ) { - continue; - } - String childType = markerShareMusic.getShareType() + ""; - if ( !counter.containsKey( childType ) ) { - counter.put( childType, 0 ); - } - int s = counter.get( childType ).intValue(); - counter.put( childType, s + 1 ); - } - if ( !counter.isEmpty() ) { - JSONArray shareMusicJsonArray = new JSONArray(); - for ( Map.Entry< String, Integer > entry : counter.entrySet() ) { - fillPoiChildTypeTrackBody( shareMusicJsonArray, entry.getKey(), entry.getValue() ); - } - if ( shareMusicJsonArray.length() > 0 ) { - try { - shareMusic.put( "content", shareMusicJsonArray ); - } catch ( JSONException e ) { - e.printStackTrace(); - } - } - } - } - try { if ( array.length() == 0 ) { return; @@ -585,12 +506,8 @@ public class MapMarkerManager implements IMogoMarkerClickListener, if ( mLastDataResult == null ) { return; } -// List onlineCarList = mLastDataResult.getOnlineCar(); List< MarkerExploreWay > exploreWayList = mLastDataResult.getExploreWay(); - List< MarkerNoveltyInfo > noveltyInfoList = mLastDataResult.getNoveltyInfo(); -// dispatchDataToBis(ServiceConst.CARD_TYPE_USER_DATA, onlineCarList == null ?new ArrayList<>() : onlineCarList); dispatchDataToBis( ServiceConst.CARD_TYPE_ROAD_CONDITION, exploreWayList == null ? new ArrayList<>() : exploreWayList ); - dispatchDataToBis( ServiceConst.CARD_TYPE_NOVELTY, noveltyInfoList == null ? new ArrayList<>() : noveltyInfoList ); } /** diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerView.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerView.java index 7679c23839..6479b123ab 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerView.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerView.java @@ -9,6 +9,7 @@ import android.widget.ImageView; import androidx.annotation.Nullable; import com.mogo.map.marker.MogoMarkerOptions; +import com.mogo.module.common.entity.MarkerExploreWay; import com.mogo.module.common.entity.MarkerNoveltyInfo; import com.mogo.module.common.entity.MarkerOnlineCar; import com.mogo.module.common.entity.MarkerPoiTypeEnum; @@ -31,156 +32,137 @@ public class MapMarkerView extends MapMarkerBaseView { private ImageView ivBg; - public MapMarkerView(Context context) { - super(context); + public MapMarkerView( Context context ) { + super( context ); } - public MapMarkerView(Context context, @Nullable AttributeSet attrs) { - super(context, attrs); + public MapMarkerView( Context context, @Nullable AttributeSet attrs ) { + super( context, attrs ); } - public MapMarkerView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); + public MapMarkerView( Context context, @Nullable AttributeSet attrs, int defStyleAttr ) { + super( context, attrs, defStyleAttr ); } - public MapMarkerView(Context context, MarkerShowEntity markerShowEntity, MogoMarkerOptions options) { - super(context); + public MapMarkerView( Context context, MarkerShowEntity markerShowEntity, MogoMarkerOptions options ) { + super( context ); mOptions = options; - updateView(markerShowEntity); + updateView( markerShowEntity ); } - protected void initView(Context context) { - LayoutInflater.from(context).inflate(R.layout.view_map_marker, this); - ivUserHead = findViewById(R.id.ivUserHead); - ivIcon = findViewById(R.id.ivIcon); - ivCar = findViewById(R.id.ivCar); - ivBg = findViewById(R.id.ivBg); - clMarkerTopView = findViewById(R.id.clMarkerTopView); + protected void initView( Context context ) { + LayoutInflater.from( context ).inflate( R.layout.view_map_marker, this ); + ivUserHead = findViewById( R.id.ivUserHead ); + ivIcon = findViewById( R.id.ivIcon ); + ivCar = findViewById( R.id.ivCar ); + ivBg = findViewById( R.id.ivBg ); + clMarkerTopView = findViewById( R.id.clMarkerTopView ); } - public void updateView(MarkerShowEntity markerShowEntity) { + public void updateView( MarkerShowEntity markerShowEntity ) { try { Object bindObj = markerShowEntity.getBindObj(); - switch (markerShowEntity.getMarkerType()) { + ivBg.setImageResource( R.drawable.bg_map_marker_dark ); + switch ( markerShowEntity.getMarkerType() ) { case ServiceConst.CARD_TYPE_CARS_CHATTING: case ServiceConst.CARD_TYPE_USER_DATA: - ivUserHead.setVisibility(View.VISIBLE); - ivIcon.setVisibility(View.INVISIBLE); - loadImageWithMarker(markerShowEntity); - ivCar.setImageResource(R.drawable.icon_map_marker_car_gray); - ivCar.setRotation((float) markerShowEntity.getMarkerLocation().getAngle()); + ivUserHead.setVisibility( View.VISIBLE ); + ivIcon.setVisibility( View.INVISIBLE ); + loadImageWithMarker( markerShowEntity ); + ivCar.setImageResource( R.drawable.icon_map_marker_car_gray ); + ivCar.setRotation( ( float ) markerShowEntity.getMarkerLocation().getAngle() ); // ivCar.setRotation(new Random().nextInt(360)); - clMarkerTopView.setVisibility(View.GONE); - if (bindObj instanceof MarkerOnlineCar) { - if (((MarkerOnlineCar) bindObj).getUserInfo().getGenderValue() == 0) { - ivBg.setImageResource(R.drawable.bg_map_marker_blue); + clMarkerTopView.setVisibility( View.GONE ); + if ( bindObj instanceof MarkerOnlineCar ) { + if ( ( ( MarkerOnlineCar ) bindObj ).getUserInfo().getGenderValue() == 0 ) { } else { - ivBg.setImageResource(R.drawable.bg_map_marker_purple); } } break; case ServiceConst.CARD_TYPE_ROAD_CONDITION: - ivUserHead.setVisibility(View.INVISIBLE); - ivIcon.setVisibility(View.VISIBLE); - - ivIcon.setImageResource(R.drawable.icon_map_marker_road_block_up); - ivBg.setImageResource(R.drawable.bg_map_marker_blue); - ivCar.setImageResource(R.drawable.icon_map_marker_location_blue); - break; case ServiceConst.CARD_TYPE_NOVELTY: - ivUserHead.setVisibility(View.INVISIBLE); - ivIcon.setVisibility(View.VISIBLE); + ivUserHead.setVisibility( View.INVISIBLE ); + ivIcon.setVisibility( View.VISIBLE ); - ivCar.setImageResource(R.drawable.icon_map_marker_location_blue); + ivCar.setImageResource( R.drawable.icon_map_marker_location_yellow ); - if (bindObj instanceof MarkerNoveltyInfo) { - switch (((MarkerNoveltyInfo) bindObj).getPoiType()) { + if ( bindObj instanceof MarkerExploreWay ) { + switch ( ( ( MarkerExploreWay ) bindObj ).getPoiType() ) { case MarkerPoiTypeEnum.GAS_STATION: - ivIcon.setImageResource(R.drawable.icon_map_marker_refuel); - ivBg.setImageResource(R.drawable.bg_map_marker_oragne); + ivIcon.setImageResource( R.drawable.icon_map_marker_refuel ); break; case MarkerPoiTypeEnum.TRAFFIC_CHECK: - ivIcon.setImageResource(R.drawable.icon_map_marker_road_check); - ivBg.setImageResource(R.drawable.bg_map_marker_green); + ivIcon.setImageResource( R.drawable.icon_map_marker_road_check2 ); break; case MarkerPoiTypeEnum.ROAD_CLOSED: - ivIcon.setImageResource(R.drawable.icon_map_marker_road_block_off); - ivBg.setImageResource(R.drawable.bg_map_marker_blue_dark); + ivIcon.setImageResource( R.drawable.icon_map_marker_road_block_off2 ); break; case MarkerPoiTypeEnum.SHOP_DISCOUNT: - ivIcon.setImageResource(R.drawable.icon_map_marker_shop_discount); - ivBg.setImageResource(R.drawable.bg_map_marker_red); + ivIcon.setImageResource( R.drawable.icon_map_marker_shop_discount ); break; case MarkerPoiTypeEnum.FOURS_4S: - ivIcon.setImageResource(R.drawable.icon_map_marker_4s); - ivBg.setImageResource(R.drawable.bg_map_marker_blue); + ivIcon.setImageResource( R.drawable.icon_map_marker_4s ); break; case MarkerPoiTypeEnum.FOURS_ROAD_WORK: - ivIcon.setImageResource(R.drawable.icon_map_marker_road_work); - ivBg.setImageResource(R.drawable.bg_map_marker_blue_dark); + ivIcon.setImageResource( R.drawable.icon_map_marker_road_work2 ); break; case MarkerPoiTypeEnum.FOURS_BLOCK_UP: - ivIcon.setImageResource(R.drawable.icon_map_marker_road_block_up); - ivBg.setImageResource(R.drawable.bg_map_marker_blue); + ivIcon.setImageResource( R.drawable.icon_map_marker_road_block_up2 ); break; case MarkerPoiTypeEnum.FOURS_PONDING: - ivIcon.setImageResource(R.drawable.icon_map_marker_pondingl); - ivBg.setImageResource(R.drawable.bg_map_marker_blue); + ivIcon.setImageResource( R.drawable.icon_map_marker_pondingl2 ); break; case MarkerPoiTypeEnum.FOURS_SHOP_FREE: - ivIcon.setImageResource(R.drawable.icon_map_marker_shop); - ivBg.setImageResource(R.drawable.bg_map_marker_green_dark); + ivIcon.setImageResource( R.drawable.icon_map_marker_shop ); break; case MarkerPoiTypeEnum.FOURS_FOG: - ivBg.setImageResource(R.drawable.module_service_ic_rc_dark_frog); + ivIcon.setImageResource( R.drawable.module_service_ic_rc_dark_frog2 ); break; case MarkerPoiTypeEnum.FOURS_ICE: - ivBg.setImageResource(R.drawable.module_service_ic_rc_freeze); - break; - case MarkerPoiTypeEnum.FOURS_PARKING: - ivBg.setImageResource(R.drawable.module_service_ic_rc_parking); + ivIcon.setImageResource( R.drawable.module_service_ic_rc_freeze2 ); break; case MarkerPoiTypeEnum.FOURS_ACCIDENT: - ivBg.setImageResource(R.drawable.module_service_ic_rc_accident); + ivIcon.setImageResource( R.drawable.module_service_ic_rc_accident3 ); break; case MarkerPoiTypeEnum.FOURS_NEALY: - ivIcon.setImageResource(R.drawable.icon_map_marker_shear_news); - ivBg.setImageResource(R.drawable.bg_map_marker_blue); + ivIcon.setImageResource( R.drawable.icon_map_marker_shear_news ); break; + case MarkerPoiTypeEnum.FOURS_LIVING: + ivIcon.setImageResource( R.drawable.icon_map_marker_living ); + break; + case MarkerPoiTypeEnum.FOURS_PARKING: default: - ivIcon.setImageResource(R.drawable.icon_map_marker_shear_news); - ivBg.setImageResource(R.drawable.bg_map_marker_blue_dark); + ivIcon.setImageResource( R.drawable.icon_map_marker_shear_news ); break; } } break; case ServiceConst.CARD_TYPE_SHARE_MUSIC: - ivUserHead.setVisibility(View.INVISIBLE); - ivIcon.setVisibility(View.VISIBLE); - ivBg.setImageResource(R.drawable.bg_map_marker_purple); - ivCar.setImageResource(R.drawable.icon_map_marker_location_blue); + ivUserHead.setVisibility( View.INVISIBLE ); + ivIcon.setVisibility( View.VISIBLE ); + ivCar.setImageResource( R.drawable.icon_map_marker_location_yellow ); - if (bindObj instanceof MarkerShareMusic) { + if ( bindObj instanceof MarkerShareMusic ) { // 2 为书籍听书,3 为新闻,1 为qq音乐,int - switch (((MarkerShareMusic) bindObj).getShareType()) { + switch ( ( ( MarkerShareMusic ) bindObj ).getShareType() ) { case 1: - ivIcon.setImageResource(R.drawable.icon_map_marker_misic); + ivIcon.setImageResource( R.drawable.icon_map_marker_misic ); break; case 2: - ivIcon.setImageResource(R.drawable.icon_map_marker_book); + ivIcon.setImageResource( R.drawable.icon_map_marker_book ); break; case 3: - ivIcon.setImageResource(R.drawable.icon_map_marker_news); + ivIcon.setImageResource( R.drawable.icon_map_marker_news ); break; default: - ivIcon.setImageResource(R.drawable.icon_map_marker_misic); + ivIcon.setImageResource( R.drawable.icon_map_marker_misic ); break; } } break; } - } catch (Exception e) { + } catch ( Exception e ) { e.printStackTrace(); } } diff --git a/modules/mogo-module-service/src/main/res/drawable-ldpi/module_service_ic_rc_dark_frog2.png b/modules/mogo-module-service/src/main/res/drawable-ldpi/module_service_ic_rc_dark_frog2.png old mode 100644 new mode 100755 index ad2cfca0c4..1222b2b6c7 Binary files a/modules/mogo-module-service/src/main/res/drawable-ldpi/module_service_ic_rc_dark_frog2.png and b/modules/mogo-module-service/src/main/res/drawable-ldpi/module_service_ic_rc_dark_frog2.png differ diff --git a/modules/mogo-module-service/src/main/res/drawable-ldpi/module_service_ic_rc_freeze2.png b/modules/mogo-module-service/src/main/res/drawable-ldpi/module_service_ic_rc_freeze2.png old mode 100644 new mode 100755 index e9befa363b..c363e5feda Binary files a/modules/mogo-module-service/src/main/res/drawable-ldpi/module_service_ic_rc_freeze2.png and b/modules/mogo-module-service/src/main/res/drawable-ldpi/module_service_ic_rc_freeze2.png differ diff --git a/modules/mogo-module-service/src/main/res/drawable-xhdpi/module_service_ic_rc_dark_frog2.png b/modules/mogo-module-service/src/main/res/drawable-xhdpi/module_service_ic_rc_dark_frog2.png old mode 100644 new mode 100755 index 107ac5bce6..787101fbb1 Binary files a/modules/mogo-module-service/src/main/res/drawable-xhdpi/module_service_ic_rc_dark_frog2.png and b/modules/mogo-module-service/src/main/res/drawable-xhdpi/module_service_ic_rc_dark_frog2.png differ diff --git a/modules/mogo-module-service/src/main/res/drawable-xhdpi/module_service_ic_rc_freeze2.png b/modules/mogo-module-service/src/main/res/drawable-xhdpi/module_service_ic_rc_freeze2.png old mode 100644 new mode 100755 index c7f02cd852..d34779845e Binary files a/modules/mogo-module-service/src/main/res/drawable-xhdpi/module_service_ic_rc_freeze2.png and b/modules/mogo-module-service/src/main/res/drawable-xhdpi/module_service_ic_rc_freeze2.png differ diff --git a/services/mogo-service-api/src/main/java/com/mogo/service/module/IMogoModuleLifecycle.java b/services/mogo-service-api/src/main/java/com/mogo/service/module/IMogoModuleLifecycle.java index dc2dad5741..7234996fbe 100644 --- a/services/mogo-service-api/src/main/java/com/mogo/service/module/IMogoModuleLifecycle.java +++ b/services/mogo-service-api/src/main/java/com/mogo/service/module/IMogoModuleLifecycle.java @@ -22,4 +22,5 @@ public interface IMogoModuleLifecycle { * accOn 事件回调 */ void accOn(); + } diff --git a/services/mogo-service/build.gradle b/services/mogo-service/build.gradle index 3cd53dffe6..1b26b1e000 100644 --- a/services/mogo-service/build.gradle +++ b/services/mogo-service/build.gradle @@ -48,6 +48,7 @@ dependencies { implementation rootProject.ext.dependencies.mogocommons implementation rootProject.ext.dependencies.mogoserviceapi implementation rootProject.ext.dependencies.mogoconnection + implementation rootProject.ext.dependencies.modulecommon } else { api project(":libraries:mogo-map") implementation project(":libraries:mogo-map-api") @@ -55,6 +56,7 @@ dependencies { implementation project(":foudations:mogo-commons") implementation project(":services:mogo-service-api") implementation project(":foudations:mogo-connection") + implementation project(":modules:mogo-module-common") } } diff --git a/services/mogo-service/src/main/java/com/mogo/service/impl/adas/MogoADASController.java b/services/mogo-service/src/main/java/com/mogo/service/impl/adas/MogoADASController.java index cadd1e446f..c38edf1b56 100644 --- a/services/mogo-service/src/main/java/com/mogo/service/impl/adas/MogoADASController.java +++ b/services/mogo-service/src/main/java/com/mogo/service/impl/adas/MogoADASController.java @@ -1,13 +1,16 @@ package com.mogo.service.impl.adas; +import android.app.ActivityManager; import android.app.Application; import android.content.Context; import android.content.Intent; +import android.content.pm.ApplicationInfo; import android.os.RemoteException; import com.alibaba.android.arouter.facade.annotation.Route; import com.mogo.commons.AbsMogoApplication; import com.mogo.map.MogoOverlayManager; +import com.mogo.module.common.utils.CarSeries; import com.mogo.service.MogoServicePaths; import com.mogo.service.adas.IMogoADASController; import com.mogo.service.impl.MogoServiceApis; @@ -20,6 +23,8 @@ import com.zhidao.autopilot.support.api.AutopilotServiceManage; import org.json.JSONObject; +import java.util.List; + /** * @author congtaowang * @since 2020-03-10 @@ -61,6 +66,11 @@ public class MogoADASController implements IMogoADASController { public void showADAS() { Logger.d( TAG, "show adas" ); + if ( !isProcessRunning( AbsMogoApplication.getApp(), getPackageUid( AbsMogoApplication.getApp(), "com.zhidiao.autopilot" ) ) ) { + init( AbsMogoApplication.getApp() ); + } + + int delay = CarSeries.getSeries() == CarSeries.CAR_SERIES_F80X ? 0 : 500; UiThreadHandler.postDelayed( () -> { try { @@ -84,7 +94,7 @@ public class MogoADASController implements IMogoADASController { Logger.e( TAG, e1, "error." ); } } - }, 500 ); + }, delay ); } @Override @@ -122,4 +132,38 @@ public class MogoADASController implements IMogoADASController { public void init( Context context ) { AutopilotServiceManage.getInstance().init( context ); } + + //获取已安装应用的 uid,-1 表示未安装此应用或程序异常 + public static int getPackageUid( Context context, String packageName ) { + try { + ApplicationInfo applicationInfo = context.getPackageManager().getApplicationInfo( packageName, 0 ); + if ( applicationInfo != null ) { + return applicationInfo.uid; + } + } catch ( Exception e ) { + return -1; + } + return -1; + } + + /** + * 判断某一 uid 的程序是否有正在运行的进程,即是否存活 + * Created by cafeting on 2017/2/4. + * + * @param context 上下文 + * @param uid 已安装应用的 uid + * @return true 表示正在运行,false 表示没有运行 + */ + public static boolean isProcessRunning( Context context, int uid ) { + ActivityManager am = ( ActivityManager ) context.getSystemService( Context.ACTIVITY_SERVICE ); + List< ActivityManager.RunningServiceInfo > runningServiceInfos = am.getRunningServices( 200 ); + if ( runningServiceInfos.size() > 0 ) { + for ( ActivityManager.RunningServiceInfo appProcess : runningServiceInfos ) { + if ( uid == appProcess.uid ) { + return true; + } + } + } + return false; + } }