This commit is contained in:
unknown
2020-03-27 20:21:16 +08:00
26 changed files with 446 additions and 247 deletions

View File

@@ -2,6 +2,7 @@ package com.mogo.module.extensions.entrance;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.Rect;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
@@ -54,6 +55,7 @@ import com.mogo.service.module.IMogoAddressManager;
import com.mogo.service.module.IMogoModuleProvider;
import com.mogo.service.module.IMogoRegisterCenter;
import com.mogo.service.statusmanager.IMogoStatusManager;
import com.mogo.utils.WindowUtils;
import java.util.ArrayList;
import java.util.Arrays;
@@ -61,6 +63,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import retrofit2.http.HEAD;
/**
* @author congtaowang
* @since 2020-01-07
@@ -117,6 +121,7 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
private TextView ivMode;
private IMogoPolyline iMogoPolyline;
public static boolean isClickShare;
@Override
protected int getLayoutId() {
@@ -129,7 +134,7 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
mIMogoAuthorizeModuleManager = (IMogoAuthorizeModuleManager) ARouter.getInstance().build(AuthorizeConstant.PROVIDER_MODULE).navigation(getContext());
mIMogoAuthorizeModuleManager.registerAuthorizeListener(AuthorizeInvokerConstant.AUTHORIZE_TYPE_LAUNCHER_SHARE, this);
mEntrancePresenter = new EntrancePresenter(getContext(), this, mIMogoAuthorizeModuleManager);
mEntrancePresenter = new EntrancePresenter( getContext(), this, mIMogoAuthorizeModuleManager );
mMogoFragmentManager = mApis.getFragmentManagerApi();
mMogoAddressManager = mApis.getAddressManagerApi();
@@ -138,7 +143,7 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
mSearch = findViewById( R.id.module_entrance_id_search );
mSearch.setOnClickListener( view -> {
setMarkerStatus(true);
setMarkerStatus( true );
mSearchProvider = ( IMogoModuleProvider ) ARouter.getInstance()
.build( MogoModulePaths.PATH_MODULE_SEARCH )
.navigation();
@@ -153,7 +158,7 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
mHome = findViewById( R.id.module_entrance_id_home );
mHome.setOnClickListener( view -> {
setMarkerStatus(true);
setMarkerStatus( true );
mMogoAddressManager.goHome();
mApis.getAdasControllerApi().closeADAS();
@@ -161,7 +166,7 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
mCompany = findViewById( R.id.module_entrance_id_company );
mCompany.setOnClickListener( view -> {
setMarkerStatus(true);
setMarkerStatus( true );
mMogoAddressManager.goCompany();
mApis.getAdasControllerApi().closeADAS();
@@ -169,11 +174,36 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
mUploadRoadCondition = findViewById( R.id.module_entrance_id_upload_road_condition );
mUploadRoadCondition.setOnClickListener( view -> {
ShareControl.getInstance( getActivity() ).showDialog();
traceData( "1" );
isClickShare = true;
if (mIMogoAuthorizeModuleManager.needAuthorize()) {
mIMogoAuthorizeModuleManager.invokeAuthorization(AuthorizeInvokerConstant.AUTHORIZE_TYPE_LAUNCHER_SHARE);
} else {
ShareControl.getInstance( getActivity() ).showDialog();
traceData( "1" );
}
} );
mVRMode = findViewById( R.id.module_entrance_id_vr_mode );
mVRMode.setOnClickListener( view -> {
mMogoStatusManager.setUserInteractionStatus( TAG, true, false );
Rect mBoundRect = new Rect();
final int paddingTop = WindowUtils.dip2px( getContext(), 250 );
final int paddingBottom = WindowUtils.dip2px( getContext(), 150 );
final int paddingRight = WindowUtils.dip2px( getContext(), 150 );
final int paddingLeft = WindowUtils.dip2px( getContext(), 650 );
mBoundRect.bottom = paddingBottom;
mBoundRect.top = paddingTop;
mBoundRect.left = paddingLeft;
mBoundRect.right = paddingRight;
mMApUIController.showBounds( TAG,
new MogoLatLng(
mService.getSingletonLocationClient( getContext() ).getLastKnowLocation().getLatitude(),
mService.getSingletonLocationClient( getContext() ).getLastKnowLocation().getLongitude()
),
Arrays.asList( new MogoLatLng( 39.9736012000, 116.4220762300 ) ),
mBoundRect,
false );
} );
mMove2CurrentLocation = findViewById( R.id.module_entrance_id_move2_current_location );
@@ -223,36 +253,38 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
mSpeedLimitUnit = findViewById( R.id.module_entrance_id_speed_limit_unit );
mApis.getIntentManagerApi().registerIntentListener(AUTONAVI_STANDARD_BROADCAST_RECV, new IMogoIntentListener() {
@Override public void onIntentReceived(String intentStr, Intent intent) {
int key_type = intent.getIntExtra("KEY_TYPE", 0);
mApis.getIntentManagerApi().registerIntentListener( AUTONAVI_STANDARD_BROADCAST_RECV, new IMogoIntentListener() {
@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) {
ivMode.setSelected(false);
} else if (opera_type == 1) {
ivMode.setSelected(true);
int type = intent.getIntExtra( "EXTRA_TYPE", -1 );
int opera_type = intent.getIntExtra( "EXTRA_OPERA", -1 );
if ( key_type == 10027 ) {
if ( opera_type == 0 ) {
ivMode.setSelected( false );
} else if ( opera_type == 1 ) {
ivMode.setSelected( true );
}
ivMode.setText(
getString( ivMode.isSelected() ? R.string.mode_car_up : R.string.mode_north_up ) );
getString( ivMode.isSelected() ? R.string.mode_car_up : R.string.mode_north_up ) );
}
}
});
} );
}
protected void setMarkerStatus(boolean show){
protected void setMarkerStatus( boolean show ) {
mMogoStatusManager.setSearchUIShow(
MogoModulePaths.PATH_FRAGMENT_SEARCH_CATEGORY, show
MogoModulePaths.PATH_FRAGMENT_SEARCH_CATEGORY, show
);
}
private static final String AUTONAVI_STANDARD_BROADCAST_RECV =
"AUTONAVI_STANDARD_BROADCAST_RECV";
"AUTONAVI_STANDARD_BROADCAST_RECV";
@NonNull
@Override
protected EntrancePresenter createPresenter() {
@@ -280,28 +312,34 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
@Override
public void onDestroyView() {
super.onDestroyView();
if (mEntrancePresenter != null) {
if ( mEntrancePresenter != null ) {
mEntrancePresenter.unregisterUnWake();
}
isClickShare = false;
mIMogoAuthorizeModuleManager.unregisterAuthorizeListener(AuthorizeInvokerConstant.AUTHORIZE_TYPE_LAUNCHER_SHARE);
}
@Override
public void authorizeSuccess() {
Log.d(TAG, "authorizeSuccess --------> ");
mEntrancePresenter.handleNeedAuthorizeCmd();
Log.d(TAG, "authorizeSuccess --------> isClickShare = " + isClickShare);
if (isClickShare) {
ShareControl.getInstance( getActivity() ).showDialog();
traceData( "1" );
} else {
mEntrancePresenter.handleNeedAuthorizeCmd();
}
}
@Override
public void authorizeFailed(String errorMsg) {
Log.e(TAG, "authorizeFailed --------> ");
public void authorizeFailed( String errorMsg ) {
Log.e( TAG, "authorizeFailed --------> " );
}
@Override
public void forbiddenVoiceWhenAuthorize(String cmd) {
Log.d(TAG, "forbiddenVoiceWhenAuthorize --------> ");
public void forbiddenVoiceWhenAuthorize( String cmd ) {
Log.d( TAG, "forbiddenVoiceWhenAuthorize --------> " );
}
@@ -328,7 +366,7 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
ivMode.setVisibility( View.VISIBLE );
mExitNavi.setVisibility( View.VISIBLE );
mMApUIController.setPointToCenter( 0.675926, 0.77552 );
mMApUIController.changeMapMode(ivMode.isSelected()?EnumMapUI.NorthUP_2D :EnumMapUI.CarUp_2D );
mMApUIController.changeMapMode( ivMode.isSelected() ? EnumMapUI.NorthUP_2D : EnumMapUI.CarUp_2D );
}
@Override
@@ -339,7 +377,7 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
mExitNavi.setVisibility( View.GONE );
mSpeedLimit.setVisibility( View.GONE );
mMApUIController.setPointToCenter( 0.66145, 0.590688 );
mMApUIController.changeMapMode(EnumMapUI.NorthUP_2D);
mMApUIController.changeMapMode( EnumMapUI.NorthUP_2D );
}
@Override

View File

@@ -142,6 +142,8 @@ public class EntrancePresenter extends Presenter<EntranceView> {
@Override
public void onIntentReceived(String intentStr, Intent intent) {
mVoiceCmdType = intentStr;
EntranceFragment.isClickShare = false;
String data = intent.getStringExtra("data");
Log.d(TAG, "唤醒 mogoIntentListener intentStr =" + intentStr + ">>data =" + data + " >>> needAuthorize = " + mIMogoAuthorizeModuleManager.needAuthorize(AUTHORIZE_TYPE_LAUNCHER_SHARE));
if (intentStr.equals(ExtensionsModuleConst.GO_TO_SHARE)) { //我要分享 --ok