opt
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.mogo.map.impl.amap.navi;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
|
||||
import com.amap.api.maps.model.Polyline;
|
||||
import com.amap.api.navi.AMapNavi;
|
||||
@@ -170,6 +171,13 @@ public class NaviClient implements IMogoNavi {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCalculatePathDisplayBounds( Rect bounds ) {
|
||||
if ( mAMapNaviListener != null ) {
|
||||
mAMapNaviListener.setCalculatePathDisplayBounds(bounds);
|
||||
}
|
||||
}
|
||||
|
||||
// -- end
|
||||
|
||||
private boolean checkAMapNavi() {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.map.impl.amap.navi;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
|
||||
import com.amap.api.maps.model.Polyline;
|
||||
import com.amap.api.navi.AMapNavi;
|
||||
@@ -185,4 +186,10 @@ public class NaviListenerAdapter extends AMapNaviListenerAdapter {
|
||||
mNaviOverlayHelper.clearCalculatedOverlay();
|
||||
}
|
||||
}
|
||||
|
||||
public void setCalculatePathDisplayBounds( Rect bounds ){
|
||||
if ( mNaviOverlayHelper != null ) {
|
||||
mNaviOverlayHelper.setCalculatePathDisplayBounds(bounds);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ public class NaviOverlayHelper implements OnCalculatePathItemClickInteraction {
|
||||
|
||||
private int mSelectedPathId;
|
||||
private CalculatePathItem mSelectedCalculatePathItem;
|
||||
private SoftReference< OnCalculatePathItemClickInteraction > mLineClickInteractionRef;
|
||||
private OnCalculatePathItemClickInteraction mLineClickInteraction;
|
||||
|
||||
public NaviOverlayHelper( AMapNavi mAMapNavi, AMap mAMap, Context mContext ) {
|
||||
this.mAMapNavi = mAMapNavi;
|
||||
@@ -157,7 +157,7 @@ public class NaviOverlayHelper implements OnCalculatePathItemClickInteraction {
|
||||
if ( i == 0 ) {
|
||||
mSelectedPathId = item.getId();
|
||||
mSelectedCalculatePathItem = item;
|
||||
wrapper.setStartBitmap( R.drawable.ic_search_poi_location ).setEndBitmap( R.drawable.ic_search_choice_point );
|
||||
wrapper.setStartBitmap( R.drawable.ic_navi_start ).setEndBitmap( R.drawable.ic_navi_target );
|
||||
mAMapNavi.selectRouteId( item.getId() );
|
||||
}
|
||||
wrapper.addToMap();
|
||||
@@ -196,8 +196,8 @@ public class NaviOverlayHelper implements OnCalculatePathItemClickInteraction {
|
||||
if ( mPaths != null && !mPaths.isEmpty() ) {
|
||||
for ( MogoCalculatePath path : mPaths ) {
|
||||
if ( TextUtils.equals( path.getTagId(), polyline.getId() ) ) {
|
||||
if ( mLineClickInteractionRef != null && mLineClickInteractionRef.get() != null ) {
|
||||
mLineClickInteractionRef.get().onItemClicked( path.getTagId() );
|
||||
if ( mLineClickInteraction != null ) {
|
||||
mLineClickInteraction.onItemClicked( path.getTagId() );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -317,9 +317,12 @@ public class NaviOverlayHelper implements OnCalculatePathItemClickInteraction {
|
||||
}
|
||||
|
||||
public void setLineClickInteraction( OnCalculatePathItemClickInteraction lineClickInteraction ) {
|
||||
if ( mLineClickInteractionRef != null ) {
|
||||
mLineClickInteractionRef.clear();
|
||||
mLineClickInteraction = lineClickInteraction;
|
||||
}
|
||||
|
||||
public void setCalculatePathDisplayBounds( Rect bounds ) {
|
||||
if ( bounds != null ) {
|
||||
mBoundRect = bounds;
|
||||
}
|
||||
mLineClickInteractionRef = new SoftReference<>( lineClickInteraction );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.mogo.map.navi;
|
||||
|
||||
import android.graphics.Rect;
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
|
||||
import java.util.List;
|
||||
@@ -95,4 +97,11 @@ public interface IMogoNavi {
|
||||
*/
|
||||
void clearCalculatePaths();
|
||||
|
||||
/**
|
||||
* 设置显示规划路线的范围
|
||||
*
|
||||
* @param bounds 范围
|
||||
*/
|
||||
void setCalculatePathDisplayBounds( Rect bounds );
|
||||
|
||||
}
|
||||
|
||||
BIN
libraries/mogo-map-api/src/main/res/drawable-xhdpi/ic_navi_start.png
Executable file
BIN
libraries/mogo-map-api/src/main/res/drawable-xhdpi/ic_navi_start.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 4.3 KiB |
BIN
libraries/mogo-map-api/src/main/res/drawable-xhdpi/ic_navi_target.png
Executable file
BIN
libraries/mogo-map-api/src/main/res/drawable-xhdpi/ic_navi_target.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 3.7 KiB |
@@ -1,6 +1,7 @@
|
||||
package com.mogo.map;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
|
||||
import com.mogo.map.impl.amap.navi.NaviClient;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
@@ -127,4 +128,11 @@ public class MogoNavi implements IMogoNavi {
|
||||
mDelegate.clearCalculatePaths();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCalculatePathDisplayBounds( Rect bounds ) {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.setCalculatePathDisplayBounds( bounds );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.module.common.MogoModulePaths;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.cardmanager.IMogoCardManager;
|
||||
import com.mogo.service.fragmentmanager.FragmentDescriptor;
|
||||
import com.mogo.service.fragmentmanager.IMogoFragmentManager;
|
||||
import com.mogo.service.module.IMogoModuleProvider;
|
||||
@@ -27,12 +26,10 @@ import com.mogo.service.module.IMogoModuleProvider;
|
||||
public class AppNavigatorFragment extends MvpFragment< IView, Presenter< IView > > implements IView {
|
||||
|
||||
private View mNavigation;
|
||||
private View mMusic;
|
||||
private View mChat;
|
||||
private View mMediaCenter;
|
||||
private View mCarSettings;
|
||||
private View mApps;
|
||||
|
||||
private IMogoCardManager mCardManager;
|
||||
|
||||
private AppsFragment mAppsFragment;
|
||||
private IMogoFragmentManager mMogoFragmentManager;
|
||||
|
||||
@@ -49,23 +46,20 @@ public class AppNavigatorFragment extends MvpFragment< IView, Presenter< IView >
|
||||
@Override
|
||||
protected void initViews() {
|
||||
|
||||
mCardManager = ( IMogoCardManager ) ARouter.getInstance().build( MogoServicePaths.PATH_CARD_MANAGER ).navigation( getContext() );
|
||||
mMogoFragmentManager = ( IMogoFragmentManager ) ARouter.getInstance().build( MogoServicePaths.PATH_FRAGMENT_MANAGER ).navigation();
|
||||
|
||||
mNavigation = findViewById( R.id.module_apps_id_navigation );
|
||||
mMusic = findViewById( R.id.module_apps_id_music );
|
||||
mChat = findViewById( R.id.module_apps_id_chat );
|
||||
mMediaCenter = findViewById( R.id.module_apps_ic_media_center );
|
||||
mCarSettings = findViewById( R.id.module_apps_ic_car_settings );
|
||||
mApps = findViewById( R.id.module_apps_id_apps );
|
||||
mNavigation.setOnClickListener( view -> {
|
||||
mSearchProvider = ( IMogoModuleProvider ) ARouter.getInstance().build( MogoModulePaths.PATH_MODULE_SEARCH ).navigation();
|
||||
final Fragment fragment = mSearchProvider.createFragment( getContext(), null );
|
||||
mMogoFragmentManager.push( new FragmentDescriptor.Builder().fragment( fragment ).tag( MogoModulePaths.PATH_FRAGMENT_SEARCH ).notifyMainModule( true ).build() );
|
||||
} );
|
||||
mMusic.setOnClickListener( view -> {
|
||||
mCardManager.switch2( "CARD_TYPE_SHARE_MUSIC" );
|
||||
mMediaCenter.setOnClickListener( view -> {
|
||||
} );
|
||||
mChat.setOnClickListener( view -> {
|
||||
mCardManager.switch2( "CARD_TYPE_CARS_CHATTING" );
|
||||
mCarSettings.setOnClickListener( view -> {
|
||||
} );
|
||||
mApps.setOnClickListener( view -> {
|
||||
mAppsFragment = new AppsFragment();
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
@@ -13,18 +13,18 @@
|
||||
android:src="@drawable/module_apps_ic_navigation" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/module_apps_id_music"
|
||||
android:id="@+id/module_apps_ic_media_center"
|
||||
android:layout_width="@dimen/dp_119"
|
||||
android:layout_height="@dimen/dp_119"
|
||||
android:layout_marginLeft="@dimen/dp_61"
|
||||
android:src="@drawable/module_apps_ic_music" />
|
||||
android:src="@drawable/module_apps_ic_media_center" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/module_apps_id_chat"
|
||||
android:id="@+id/module_apps_ic_car_settings"
|
||||
android:layout_width="@dimen/dp_119"
|
||||
android:layout_height="@dimen/dp_119"
|
||||
android:layout_marginLeft="@dimen/dp_61"
|
||||
android:src="@drawable/module_apps_ic_chat" />
|
||||
android:src="@drawable/module_apps_ic_car_settings" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/module_apps_id_apps"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.module.map;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
|
||||
@@ -16,6 +17,8 @@ import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.map.IMogoMapService;
|
||||
import com.mogo.service.voice.IMogoVoiceListener;
|
||||
import com.mogo.utils.ResourcesHelper;
|
||||
import com.mogo.utils.WindowUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.Map;
|
||||
@@ -41,6 +44,14 @@ public class MapPresenter extends Presenter< MapView > implements IMogoVoiceList
|
||||
super.onCreate( owner );
|
||||
mMogoMapService = ( IMogoMapService ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICES_MAP ).navigation( getContext() );
|
||||
registerUnWakeupCmd();
|
||||
|
||||
IMogoNavi mogoNavi = mMogoMapService.getNavi( getContext() );
|
||||
mogoNavi.setCalculatePathDisplayBounds( new Rect(
|
||||
ResourcesHelper.getDimensionPixelSize( getContext(), R.dimen.dp_730 ) + WindowUtils.dip2px( getContext(), 80 ),
|
||||
ResourcesHelper.getDimensionPixelSize( getContext(), R.dimen.dp_120 ) + WindowUtils.dip2px( getContext(), 80 ),
|
||||
WindowUtils.dip2px( getContext(), 80 ),
|
||||
WindowUtils.dip2px( getContext(), 80 )
|
||||
) );
|
||||
}
|
||||
|
||||
private void registerUnWakeupCmd() {
|
||||
@@ -157,7 +168,7 @@ public class MapPresenter extends Presenter< MapView > implements IMogoVoiceList
|
||||
mView.getUIController().changeMapMode( EnumMapUI.Type_Night );
|
||||
} else if ( action == 1 ) {
|
||||
mView.getUIController().changeMapMode( EnumMapUI.Type_Light );
|
||||
} else if( action == 2){
|
||||
} else if ( action == 2 ) {
|
||||
mView.getUIController().changeMapMode( EnumMapUI.Type_AUTO_LIGHT_Night );
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -220,6 +220,7 @@ public class MogoServiceProvider implements IMogoModuleProvider,
|
||||
mUiController = mMogoMapService.getMapUIController();
|
||||
mStatusManager = ( IMogoStatusManager ) ARouter.getInstance().build( MogoServicePaths.PATH_STATUS_MANAGER ).navigation( context );
|
||||
mStatusManager.registerStatusChangedListener( ServiceConst.TYPE, StatusDescriptor.USER_INTERACTED, this );
|
||||
mStatusManager.registerStatusChangedListener( ServiceConst.TYPE, StatusDescriptor.SEARCH_UI, this );
|
||||
|
||||
//TODO 初始化地图地图绘制大而全的Marker
|
||||
MarkerServiceHandler.init( mContext );
|
||||
|
||||
Reference in New Issue
Block a user