Merge branch 'dev' into dev_custom_map

This commit is contained in:
wangcongtao
2020-08-04 16:26:20 +08:00
14 changed files with 150 additions and 74 deletions

2
.idea/misc.xml generated
View File

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

View File

@@ -2,7 +2,7 @@
project.dependencies {
if (Boolean.valueOf(RELEASE)) {
d8xxImplementation rootProject.ext.dependencies.moduleventpanel
d8xxImplementation rootProject.ext.dependencies.moduleventpanelnoop
d82xImplementation rootProject.ext.dependencies.moduleventpanelnoop
em1Implementation rootProject.ext.dependencies.moduleventpanelnoop
@@ -12,7 +12,7 @@ project.dependencies {
f8xxImplementation rootProject.ext.dependencies.moduleventpanelnoop
em3Implementation rootProject.ext.dependencies.moduleventpanelnoop
} else {
d8xxImplementation project(':modules:mogo-module-event-panel')
d8xxImplementation project(':modules:mogo-module-event-panel-noop')
d82xImplementation project(':modules:mogo-module-event-panel-noop')
em1Implementation project(':modules:mogo-module-event-panel-noop')

View File

@@ -4,9 +4,11 @@ import android.content.Context;
import com.amap.api.services.core.AMapException;
import com.amap.api.services.geocoder.GeocodeAddress;
import com.amap.api.services.geocoder.GeocodeQuery;
import com.amap.api.services.geocoder.GeocodeResult;
import com.amap.api.services.geocoder.GeocodeSearch;
import com.amap.api.services.geocoder.RegeocodeAddress;
import com.amap.api.services.geocoder.RegeocodeQuery;
import com.amap.api.services.geocoder.RegeocodeResult;
import com.mogo.map.exception.MogoMapException;
import com.mogo.map.impl.amap.utils.ObjectUtils;
@@ -16,6 +18,7 @@ import com.mogo.map.search.geo.MogoGeocodeAddress;
import com.mogo.map.search.geo.MogoRegeocodeAddress;
import com.mogo.map.search.geo.query.MogoGeocodeQuery;
import com.mogo.map.search.geo.query.MogoRegeocodeQuery;
import com.mogo.utils.logger.Logger;
import java.util.ArrayList;
import java.util.List;
@@ -28,6 +31,8 @@ import java.util.List;
*/
public class GeocodeSearchClient implements IMogoGeoSearch, GeocodeSearch.OnGeocodeSearchListener {
private static final String TAG = "GeocodeSearchClient";
private GeocodeSearch mClient;
private IMogoGeoSearchListener mListener;
@@ -74,14 +79,32 @@ public class GeocodeSearchClient implements IMogoGeoSearch, GeocodeSearch.OnGeoc
@Override
public void getFromLocationAsyn( MogoRegeocodeQuery query ) {
if ( mClient != null ) {
mClient.getFromLocationAsyn( ObjectUtils.fromMogo( query ) );
if ( query == null ) {
Logger.e( TAG, "query parameter is null." );
return;
}
RegeocodeQuery origin = ObjectUtils.fromMogo( query );
if ( origin == null || !query.check() ) {
Logger.e( TAG, "query parameter is null or no point parameter." );
return;
}
mClient.getFromLocationAsyn( origin );
}
}
@Override
public void getFromLocationNameAsyn( MogoGeocodeQuery query ) {
if ( mClient != null ) {
mClient.getFromLocationNameAsyn( ObjectUtils.fromMogo( query ) );
if ( query == null ) {
Logger.e( TAG, "query parameter is null." );
return;
}
GeocodeQuery origin = ObjectUtils.fromMogo( query );
if ( origin == null || !query.check() ) {
Logger.e( TAG, "query parameter is null or locationName is empty." );
return;
}
mClient.getFromLocationNameAsyn( origin );
}
}

View File

@@ -2,6 +2,7 @@ package com.mogo.map.search.geo.query;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;
/**
* @author congtaowang
@@ -29,6 +30,12 @@ public class MogoGeocodeQuery implements Parcelable {
this.city = city;
}
public boolean check(){
if ( TextUtils.isEmpty( locationName ) ) {
return false;
}
return true;
}
@Override
public int describeContents() {

View File

@@ -50,6 +50,18 @@ public class MogoRegeocodeQuery implements Parcelable {
this.poiType = poiType;
}
public boolean check() {
if ( point == null ) {
return false;
}
if ( point.lat < 1 && point.lon < 1 ) {
return false;
}
if ( radius < 0 ) {
return false;
}
return true;
}
@Override
public int describeContents() {

View File

@@ -21,6 +21,7 @@ import com.mogo.module.apps.model.AppEnum;
import com.mogo.module.apps.model.AppInfo;
import com.mogo.module.apps.model.NavigatorApps;
import com.mogo.module.apps.view.OnAiAssistClickListener;
import com.mogo.service.fragmentmanager.FragmentStackTransactionListener;
import com.mogo.utils.AppUtils;
import com.mogo.utils.CommonUtils;
@@ -33,7 +34,9 @@ import java.util.Map;
* <p>
* 描述
*/
public class AppNavigatorFragment extends MvpFragment< AppNavigatorView, AppNavigatorPresenter > implements AppNavigatorView {
public class AppNavigatorFragment extends MvpFragment< AppNavigatorView, AppNavigatorPresenter >
implements AppNavigatorView,
FragmentStackTransactionListener {
private static final String TAG = "AppNavigatorFragment";
@@ -74,14 +77,17 @@ public class AppNavigatorFragment extends MvpFragment< AppNavigatorView, AppNavi
mAIAssist.performClick();
} );
AppServiceHandler.getApis().getFragmentManagerApi().addMainFragmentStackTransactionListener( size -> {
// 主页 fragment 栈变化的时候,改变动画状态
if ( size == 0 ) {
mAnim.start();
} else {
mAnim.stop();
}
} );
AppServiceHandler.getApis().getFragmentManagerApi().addMainFragmentStackTransactionListener( this );
}
@Override
public void onTransaction( int size ) {
// 主页 fragment 栈变化的时候,改变动画状态
if ( size == 0 ) {
mAnim.start();
} else {
mAnim.stop();
}
}
@Override
@@ -151,5 +157,6 @@ public class AppNavigatorFragment extends MvpFragment< AppNavigatorView, AppNavi
if ( mPresenter != null ) {
mPresenter.onDestroy( getViewLifecycleOwner() );
}
AppServiceHandler.getApis().getFragmentManagerApi().removeMainFragmentStackTransactionListener( this );
}
}

View File

@@ -115,6 +115,7 @@ public class AppNavigatorPresenter extends Presenter< AppNavigatorView > impleme
@Override
public void onDestroy( @NonNull LifecycleOwner owner ) {
super.onDestroy( owner );
AppServiceHandler.getApis().getRegisterCenterApi().unregisterMogoNaviListener( TAG );
AppServiceHandler.getApis().getIntentManagerApi().unregisterIntentListener( AppsConst.COMMAND_OPERATION, this );
}

View File

@@ -45,7 +45,6 @@ public class AppsPresenter extends Presenter< AppsView > {
private IMogoServiceApis mApis;
private IMogoCardManager mCardManager;
private IMogoStatusManager mMogoStatusManager;
public AppsPresenter( AppsView view ) {
super( view );
@@ -71,7 +70,6 @@ public class AppsPresenter extends Presenter< AppsView > {
} );
mAnalytics = mApis.getAnalyticsApi();
mMogoStatusManager = mApis.getStatusManagerApi();
}
private void renderAppsList() {

View File

@@ -45,9 +45,7 @@ public class BackToMainHomeManager {
return;
}
if ( mStatusManager.isAppListUIShow() ) {
mApis.getIntentManagerApi().invoke( Intent.ACTION_CLOSE_SYSTEM_DIALOGS, new Intent() );
}
mApis.getIntentManagerApi().invoke( Intent.ACTION_CLOSE_SYSTEM_DIALOGS, new Intent() );
Logger.d( TAG, "返回桌面" );

View File

@@ -1,5 +1,6 @@
package com.mogo.module.extensions.entrance;
import android.content.Intent;
import android.graphics.Rect;
import android.os.Bundle;
import android.text.TextUtils;
@@ -44,6 +45,7 @@ import com.mogo.service.MogoServicePaths;
import com.mogo.service.analytics.IMogoAnalytics;
import com.mogo.service.entrance.ButtonIndex;
import com.mogo.service.fragmentmanager.IMogoFragmentManager;
import com.mogo.service.intent.IMogoIntentListener;
import com.mogo.service.map.IMogoMapService;
import com.mogo.service.module.IMogoRegisterCenter;
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
@@ -72,7 +74,8 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
IMogoNaviListener,
IMogoMapListener,
IMogoAimlessModeListener,
IMogoStatusChangedListener {
IMogoStatusChangedListener,
IMogoIntentListener{
private static final String TAG = "EntranceFragment";
@@ -192,7 +195,6 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
UiThreadHandler.removeCallbacks(mLockCarRunnable);
}
mStatusManager.setUserInteractionStatus(TAG, true, false);
MapCenterPointStrategy.restoreLastScene( mMApUIController );
mMApUIController.recoverLockMode();
}
});
@@ -241,23 +243,12 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
}
});
mApis.getIntentManagerApi().registerIntentListener( AUTONAVI_STANDARD_BROADCAST_RECV, (( intentStr, intent ) -> {
int key_type = intent.getIntExtra( "KEY_TYPE", 0 );
int type = intent.getIntExtra( "EXTRA_TYPE", -1 );
int opera_type = intent.getIntExtra( "EXTRA_OPERA", -1 );
if ( key_type == 10027 ) {
if ( opera_type == 0 ) {
mCameraMode.setSelected( false );
} else if ( opera_type == 1 ) {
mCameraMode.setSelected( true );
}
mCameraMode.setText( getString( mCameraMode.isSelected() ? R.string.mode_car_up : R.string.mode_north_up ) );
} else if( key_type == 10021 ){
onStopNavi();
}
}) );
MogoEntranceButtons.save( ButtonIndex.BUTTON1, findViewById( R.id.module_entrance_id_button1 ) );
MogoEntranceButtons.save( ButtonIndex.BUTTON2, findViewById( R.id.module_entrance_id_button2 ) );
mApis.getIntentManagerApi().registerIntentListener(AUTONAVI_STANDARD_BROADCAST_RECV, this);
MogoEntranceButtons.save(ButtonIndex.BUTTON1,
findViewById(R.id.module_entrance_id_button1));
MogoEntranceButtons.save(ButtonIndex.BUTTON2,
findViewById(R.id.module_entrance_id_button2));
mDisplayOverviewBounds = new Rect(
ResourcesHelper.getDimensionPixelSize(getContext(),
@@ -355,6 +346,22 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
TopViewAnimHelper.getInstance().removeAllView();
}
@Override
public void onIntentReceived(String intentStr, Intent intent) {
int key_type = intent.getIntExtra("KEY_TYPE", 0);
int type = intent.getIntExtra("EXTRA_TYPE", -1);
int opera_type = intent.getIntExtra("EXTRA_OPERA", -1);
if (key_type == 10027) {
if (opera_type == 0) {
mCameraMode.setSelected(false);
} else if (opera_type == 1) {
mCameraMode.setSelected(true);
}
mCameraMode.setText(getString(mCameraMode.isSelected() ?
R.string.mode_car_up : R.string.mode_north_up));
}
}
@Override
public void onNaviInfoUpdate(MogoNaviInfo naviinfo) {
if (naviinfo == null) {
@@ -374,7 +381,8 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
TopViewAnimHelper.getInstance().showNaviView();
mMApUIController.changeMapMode(mCameraMode.isSelected() ? EnumMapUI.NorthUP_2D :
EnumMapUI.CarUp_2D);
MapCenterPointStrategy.setMapCenterPointBySceneAndDelay(mMApUIController, Scene.NAVI, 500, () -> {
MapCenterPointStrategy.setMapCenterPointBySceneAndDelay(mMApUIController, Scene.NAVI, 500
, () -> {
return !mMogoNavi.isNaviing();
});
if (CustomNaviInterrupter.getInstance().interrupt()) {
@@ -575,4 +583,23 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
mCameraMode.setSelected(ui == EnumMapUI.NorthUP_2D);
mCameraMode.setText(getString(ui == EnumMapUI.NorthUP_2D ? R.string.mode_car_up : R.string.mode_north_up));
}
@Override
public void onDestroy() {
super.onDestroy();
if ( mMogoRegisterCenter != null ) {
mMogoRegisterCenter.unregisterMogoNaviListener(ExtensionsModuleConst.TYPE_ENTRANCE);
mMogoRegisterCenter.unregisterMogoMapListener(ExtensionsModuleConst.TYPE_ENTRANCE);
mMogoRegisterCenter.unregisterMogoAimlessModeListener(TAG);
}
if ( mStatusManager != null ) {
mStatusManager.unregisterStatusChangedListener(TAG, StatusDescriptor.UPLOADING, this);
mStatusManager.unregisterStatusChangedListener(TAG, StatusDescriptor.DISPLAY_OVERVIEW, this);
}
if ( mApis != null ) {
if ( mApis.getIntentManagerApi() != null ) {
mApis.getIntentManagerApi().unregisterIntentListener(AUTONAVI_STANDARD_BROADCAST_RECV, this);
}
}
}
}

View File

@@ -311,6 +311,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
mMogoMapUIController = null;
mMogoFragmentManager = null;
mServiceApis.getAdasControllerApi().release();
Logger.d( TAG, "destroy." );
mServiceApis.getRefreshStrategyControllerApi().clearAllData();
AIAssist.getInstance( this ).release();
}

View File

@@ -32,8 +32,8 @@ import com.mogo.utils.UiThreadHandler
import com.mogo.utils.glide.GlideApp
class FloatView constructor(
private val pushViewModel: PushViewModel,
private val context: Context
private val pushViewModel: PushViewModel,
private val context: Context
) {
companion object {
@@ -50,7 +50,7 @@ class FloatView constructor(
}
open abstract inner class PushView(context: Context) : FrameLayout(context),
PushViewController {
PushViewController {
lateinit var appIcon: ImageView
lateinit var titleIconContainer: View
lateinit var pushTitle: TextView
@@ -103,7 +103,7 @@ class FloatView constructor(
}
fun hasTextContent(bean: PushBean?): Boolean =
bean?.content?.isNullOrEmpty()?.not() ?: false
bean?.content?.isNullOrEmpty()?.not() ?: false
fun hasImgContent(bean: PushBean?): Boolean = bean?.QRCode?.isNullOrEmpty()?.not() ?: false
@@ -139,9 +139,9 @@ class FloatView constructor(
pushImage.layoutParams = params
ThreadPoolService.execute {
val bmp = stringConverterBitmap(
bean.QRCode,
getQrImgWidth(),
getQrImgHeight()
bean.QRCode,
getQrImgWidth(),
getQrImgHeight()
)
UiThreadHandler.post {
pushImage.setImageBitmap(bmp)
@@ -220,6 +220,8 @@ class FloatView constructor(
return
}
}
pushViewModel.pushBean?.showTimeout = 0
updateTimer()
}
override fun onViewAdded(view: View?) {
@@ -248,23 +250,23 @@ class FloatView constructor(
}
override fun getImgWidth(): Int =
context.resources.getDimensionPixelSize(R.dimen.module_push_ui_image_width)
context.resources.getDimensionPixelSize(R.dimen.module_push_ui_image_width)
override fun getImgHeight(): Int =
context.resources.getDimensionPixelSize(R.dimen.module_push_ui_image_height)
context.resources.getDimensionPixelSize(R.dimen.module_push_ui_image_height)
override fun getQrImgWidth(): Int =
context.resources.getDimensionPixelSize(R.dimen.module_push_ui_image_height)
context.resources.getDimensionPixelSize(R.dimen.module_push_ui_image_height)
override fun getQrImgHeight(): Int =
context.resources.getDimensionPixelSize(R.dimen.module_push_ui_image_height)
context.resources.getDimensionPixelSize(R.dimen.module_push_ui_image_height)
}
inner class PushViewInWindowView(context: Context) : PushView(context), View.OnTouchListener {
private val mContentContainer: View
private val mWindowManager =
context.getSystemService(Context.WINDOW_SERVICE) as WindowManager
context.getSystemService(Context.WINDOW_SERVICE) as WindowManager
private val params = WindowManager.LayoutParams()
@@ -302,8 +304,8 @@ class FloatView constructor(
mWindowManager.updateViewLayout(this, params)
}
translationXAnimation(
-ResourcesHelper.getDimension(context, R.dimen.module_push_ui_width_vertical),
0f
-ResourcesHelper.getDimension(context, R.dimen.module_push_ui_width_vertical),
0f
) {
if (pushViewModel.pushBean != null) {
startClosePush()
@@ -312,17 +314,17 @@ class FloatView constructor(
}
private fun translationXAnimation(
from: Float,
to: Float,
doOnEnd: (animator: Animator) -> Unit
from: Float,
to: Float,
doOnEnd: (animator: Animator) -> Unit
) {
val transitionXAnimator: ObjectAnimator =
ObjectAnimator.ofFloat(
this,
View.TRANSLATION_X,
from,
to
)
ObjectAnimator.ofFloat(
this,
View.TRANSLATION_X,
from,
to
)
transitionXAnimator.duration = 200
transitionXAnimator.doOnEnd(doOnEnd)
transitionXAnimator.start()
@@ -333,7 +335,7 @@ class FloatView constructor(
var paddingBottom: Int = 0
if (pushButton.isVisible) {
paddingBottom =
context.resources.getDimensionPixelSize(R.dimen.module_push_content_paddingBottom_vertical)
context.resources.getDimensionPixelSize(R.dimen.module_push_content_paddingBottom_vertical)
}
mContentContainer.setPadding(0, 0, 0, paddingBottom)
}
@@ -341,8 +343,8 @@ class FloatView constructor(
override fun hide() {
super.hide()
translationXAnimation(
this.x,
-ResourcesHelper.getDimension(context, R.dimen.module_push_ui_width_vertical)
this.x,
-ResourcesHelper.getDimension(context, R.dimen.module_push_ui_width_vertical)
) {
Logger.d(TAG, "here")
this.x = 0f
@@ -413,16 +415,16 @@ class FloatView constructor(
}
override fun getImgWidth(): Int =
context.resources.getDimensionPixelSize(R.dimen.module_push_ui_image_width_vertical)
context.resources.getDimensionPixelSize(R.dimen.module_push_ui_image_width_vertical)
override fun getImgHeight(): Int =
context.resources.getDimensionPixelSize(R.dimen.module_push_ui_image_height_vertical)
context.resources.getDimensionPixelSize(R.dimen.module_push_ui_image_height_vertical)
override fun getQrImgWidth(): Int =
context.resources.getDimensionPixelSize(R.dimen.module_push_image_qr_size_vertical)
context.resources.getDimensionPixelSize(R.dimen.module_push_image_qr_size_vertical)
override fun getQrImgHeight(): Int =
context.resources.getDimensionPixelSize(R.dimen.module_push_image_qr_size_vertical)
context.resources.getDimensionPixelSize(R.dimen.module_push_image_qr_size_vertical)
}
private val delayClosePush: Runnable
@@ -524,8 +526,8 @@ class FloatView constructor(
private fun startClosePush() {
uiHandler.removeCallbacks(delayClosePush)
uiHandler.postDelayed(
delayClosePush,
1000L
delayClosePush,
1000L
)
}

View File

@@ -7,14 +7,14 @@ import androidx.annotation.Nullable;
import com.mogo.commons.voice.AIAssist;
import com.mogo.commons.voice.IMogoVoiceCmdCallBack;
import com.mogo.commons.voice.VoicePreemptType;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.v2x.manager.IMoGoV2XStatusManager;
import com.mogo.module.v2x.scenario.IV2XScenario;
import com.mogo.module.v2x.scenario.view.IV2XButton;
import com.mogo.module.v2x.scenario.view.IV2XMarker;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
import com.mogo.module.v2x.manager.IMoGoV2XStatusManager;
import com.mogo.module.v2x.utils.V2XUtils;
import com.mogo.utils.logger.Logger;

View File

@@ -55,11 +55,11 @@ public class V2XSeekHelpScenario extends AbsV2XScenario<List<V2XMarkerEntity>> i
public void init(@Nullable V2XMessageEntity<List<V2XMarkerEntity>> v2XMessageEntity) {
setV2XMessageEntity(v2XMessageEntity);
AIAssist.getInstance(V2XUtils.getApp()).speakTTSVoice("发现其他车主的求助信息");
// 广播给ADAS和Launcher卡片
V2XRoadEventEntity eventEntity = new V2XRoadEventEntity();
eventEntity.setPoiType(V2XPoiTypeEnum.ALERT_CAR_TROUBLE_WARNING + "");
eventEntity.setExpireTime(30000);
eventEntity.setTts("发现其他车主的求助信息");
eventEntity.setAlarmContent("其他车主求助");
ADASUtils.broadcastToADAS(V2XServiceManager.getContext(), eventEntity);