opt
This commit is contained in:
@@ -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;
|
||||
@@ -126,10 +128,10 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
@Override
|
||||
protected void initViews() {
|
||||
mApis = ( IMogoServiceApis ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICE_APIS ).navigation( getContext() );
|
||||
mIMogoAuthorizeModuleManager = (IMogoAuthorizeModuleManager) ARouter.getInstance().build(AuthorizeConstant.PROVIDER_MODULE).navigation(getContext());
|
||||
mIMogoAuthorizeModuleManager.registerAuthorizeListener(AuthorizeInvokerConstant.AUTHORIZE_TYPE_LAUNCHER_SHARE_NOVELTY, this);
|
||||
mIMogoAuthorizeModuleManager = ( IMogoAuthorizeModuleManager ) ARouter.getInstance().build( AuthorizeConstant.PROVIDER_MODULE ).navigation( getContext() );
|
||||
mIMogoAuthorizeModuleManager.registerAuthorizeListener( AuthorizeInvokerConstant.AUTHORIZE_TYPE_LAUNCHER_SHARE_NOVELTY, this );
|
||||
|
||||
mEntrancePresenter = new EntrancePresenter(getContext(), this, mIMogoAuthorizeModuleManager);
|
||||
mEntrancePresenter = new EntrancePresenter( getContext(), this, mIMogoAuthorizeModuleManager );
|
||||
mMogoFragmentManager = mApis.getFragmentManagerApi();
|
||||
mMogoAddressManager = mApis.getAddressManagerApi();
|
||||
|
||||
@@ -138,7 +140,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 +155,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 +163,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();
|
||||
|
||||
@@ -174,6 +176,26 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
} );
|
||||
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 +245,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 +304,28 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
if (mEntrancePresenter != null) {
|
||||
if ( mEntrancePresenter != null ) {
|
||||
mEntrancePresenter.unregisterUnWake();
|
||||
}
|
||||
|
||||
mIMogoAuthorizeModuleManager.unregisterAuthorizeListener(AuthorizeInvokerConstant.AUTHORIZE_TYPE_LAUNCHER_SHARE_NOVELTY);
|
||||
mIMogoAuthorizeModuleManager.unregisterAuthorizeListener( AuthorizeInvokerConstant.AUTHORIZE_TYPE_LAUNCHER_SHARE_NOVELTY );
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void authorizeSuccess() {
|
||||
Log.d(TAG, "authorizeSuccess --------> ");
|
||||
Log.d( TAG, "authorizeSuccess --------> " );
|
||||
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 +352,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 +363,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
|
||||
|
||||
Reference in New Issue
Block a user