+ * mvp fragment + */ +public abstract class MvpDialogFragment< V extends IView, P extends Presenter< V > > extends DialogFragment implements IView { + + private Context mContext; + protected P mPresenter; + protected View mRootView; + + @Override + public void onAttach( Context context ) { + super.onAttach( context ); + mContext = context; + } + + @Nullable + @Override + public View onCreateView( @NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState ) { + if ( mRootView == null ) { + mRootView = inflater.inflate( getLayoutId(), container, false ); + } else { + ViewGroup viewGroup = ( ViewGroup ) mRootView.getParent(); + if ( viewGroup != null ) + viewGroup.removeView( mRootView ); + } + return mRootView; + } + + @Override + public void onViewCreated( @NonNull View view, @Nullable Bundle savedInstanceState ) { + super.onViewCreated( view, savedInstanceState ); + } + + /** + * 布局资源 + * + * @return + */ + protected abstract int getLayoutId(); + + @Override + public void onActivityCreated( @Nullable Bundle savedInstanceState ) { + super.onActivityCreated( savedInstanceState ); + initViews(); + mPresenter = createPresenter(); + getViewLifecycleOwner().getLifecycle().addObserver( mPresenter ); + } + + /** + * 初始化控件,必须在初始化完成之后才可以实例化presenter,避免 + * presenter 生命周期错乱 + */ + protected abstract void initViews(); + + /** + * 创建 presenter 实例 + * + * @return + */ + @NonNull + protected abstract P createPresenter(); + + @Nullable + protected < T extends View > T findViewById( int id ) { + if ( mRootView != null ) { + return ( T ) mRootView.findViewById( id ); + } + return null; + } + + @Nullable + @Override + public Context getContext() { + if ( mContext == null ) { + mContext = super.getContext(); + } + return mContext; + } + + @Override + public void onDestroyView() { + super.onDestroyView(); + if ( mPresenter != null ) { + getViewLifecycleOwner().getLifecycle().removeObserver( mPresenter ); + } + mPresenter = null; + mRootView = null; + mContext = null; + } +} diff --git a/gradle.properties b/gradle.properties index 832da15ccb..c412eb98ca 100644 --- a/gradle.properties +++ b/gradle.properties @@ -44,4 +44,5 @@ MOGO_CONNECTION_VERSION=1.0.0-SNAPSHOT MOGO_MODULE_NAVI_VERSION=1.0.0-SNAPSHOT MOGO_MODULE_SERVICE_VERSION=1.0.0-SNAPSHOT MOGO_MODULE_EXTENSIONS_VERSION=1.0.0-SNAPSHOT +CARCHATTING_VERSION=1.0.0-SNAPSHOT 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 6815b5ec0d..1ddd0337b9 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 @@ -71,7 +71,7 @@ public class AMapNaviViewWrapper implements IMogoMapView, // 设置是否开启自动黑夜模式切换,默认为false,不自动切换 options.setAutoNaviViewNightMode( false ); // 设置6秒后是否自动锁车 - options.setAutoLockCar( true ); + options.setAutoLockCar( false ); // 设置路线上的摄像头气泡是否显示 options.setCameraBubbleShow( true ); // 设置路线相关的配置属性,如:路线的路况颜色,路线上是否显示摄像头气泡等。 @@ -80,6 +80,8 @@ public class AMapNaviViewWrapper implements IMogoMapView, options.setCarBitmap( BitmapFactory.decodeResource( getContext().getResources(), R.drawable.ic_amap_navi_cursor ) ); // 设置指南针图标否在导航界面显示,默认显示。true,显示;false,隐藏。 options.setCompassEnabled( false ); + // 黑夜模式 + options.setNaviNight( true ); //设置路况光柱条是否显示(只适用于驾车导航,需要联网)。 options.setTrafficBarEnabled( false ); // 设置[实时交通图层开关按钮]是否显示(只适用于驾车导航,需要联网)。 @@ -391,8 +393,8 @@ public class AMapNaviViewWrapper implements IMogoMapView, @Override public void moveToCenter( MogoLatLng latLng ) { - if ( latLng == null ) { - Logger.e( TAG, "latlng = null" ); + if ( latLng == null || latLng.lat == 0.0d || latLng.lng == 0.0d ) { + Logger.e( TAG, "latlng = null or is illegal" ); return; } mMapView.getMap().animateCamera( CameraUpdateFactory.newLatLng( new LatLng( latLng.lat, latLng.lng ) ) ); diff --git a/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/navi/NaviListenerAdapter.java b/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/navi/NaviListenerAdapter.java index ffeec9b2b6..f5d9d1d93b 100644 --- a/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/navi/NaviListenerAdapter.java +++ b/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/navi/NaviListenerAdapter.java @@ -109,7 +109,7 @@ public class NaviListenerAdapter extends AMapNaviListenerAdapter { @Override public void onNaviInfoUpdate( NaviInfo naviInfo ) { - MogoNaviListenerHandler.getInstance().onNaviInfoUpdate( ObjectUtils.fromAMap( naviInfo ) ); + MogoNaviListenerHandler.getInstance().onNaviInfoUpdate( ObjectUtils.fromAMap( mContext, naviInfo ) ); mNaviOverlayHelper.handleNaviInfoUpdate( naviInfo ); } diff --git a/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/utils/IconTypeUtils.java b/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/utils/IconTypeUtils.java new file mode 100644 index 0000000000..46657869d0 --- /dev/null +++ b/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/utils/IconTypeUtils.java @@ -0,0 +1,96 @@ +package com.mogo.map.impl.amap.utils; + +import android.content.Context; +import android.util.SparseArray; + +import com.amap.api.navi.enums.IconType; + +/** + * @author congtaowang + * @since 2019-09-29 + *
+ * 描述 + */ +public class IconTypeUtils { + + private static SparseArray< String > sIconName = new SparseArray<>(); + + static { + sIconName.put( IconType.ARRIVED_DESTINATION, "到达目的地" ); + sIconName.put( IconType.ARRIVED_SERVICE_AREA, "到达服务区" ); + sIconName.put( IconType.ARRIVED_TOLLGATE, "到达收费站" ); + sIconName.put( IconType.ARRIVED_TUNNEL, "到达隧道" ); + sIconName.put( IconType.ARRIVED_WAYPOINT, "到达途经点" ); + sIconName.put( IconType.BRIDGE, "通过桥" ); + sIconName.put( IconType.BY_ELEVATOR, "电梯换层" ); + sIconName.put( IconType.BY_ESCALATOR, "扶梯换层" ); + sIconName.put( IconType.BY_STAIR, "楼梯换层" ); + sIconName.put( IconType.CABLEWAY, "通过索道" ); + sIconName.put( IconType.CHANNEL, "通过通道" ); + sIconName.put( IconType.CROSSWALK, "通过人行横道" ); + sIconName.put( IconType.CRUISE_ROUTE, "通过游船路线" ); + sIconName.put( IconType.DEFAULT, "自车" ); + sIconName.put( IconType.ENTER_BUILDING, "进入建筑物" ); + sIconName.put( IconType.ENTER_ROUNDABOUT, "进入环岛" ); + sIconName.put( IconType.ENTRY_LEFT_RING, "进入环岛" ); + sIconName.put( IconType.ENTRY_LEFT_RING_CONTINUE, "绕环岛直行" ); + sIconName.put( IconType.ENTRY_LEFT_RING_LEFT, "绕环岛左转" ); + sIconName.put( IconType.ENTRY_LEFT_RING_RIGHT, "绕环岛右转" ); + sIconName.put( IconType.ENTRY_LEFTRINGU_TURN, "绕环岛调头" ); + sIconName.put( IconType.ENTRY_RING_CONTINUE, "绕环岛直行" ); + sIconName.put( IconType.ENTRY_RING_LEFT, "绕环岛左转" ); + sIconName.put( IconType.ENTRY_RING_RIGHT, "绕环岛右转" ); + sIconName.put( IconType.ENTRY_RING_UTURN, "绕环岛调头" ); + sIconName.put( IconType.FERRY, "通过轮渡" ); + sIconName.put( IconType.LADDER, "通过阶梯" ); + sIconName.put( IconType.LEAVE_BUILDING, "离开建筑物" ); + sIconName.put( IconType.LEAVE_LEFT_RING, "驶出环岛" ); + sIconName.put( IconType.LEFT, "左转" ); + sIconName.put( IconType.LEFT_BACK, "左后" ); + sIconName.put( IconType.LEFT_FRONT, "左前方" ); + sIconName.put( IconType.LEFT_TURN_AROUND, "左转掉头" ); + sIconName.put( IconType.LIFT, "通过直梯" ); + sIconName.put( IconType.LOW_CROSS, "通过普通路口" ); + sIconName.put( IconType.LOW_TRAFFIC_CROSS, "红绿灯路口" ); + sIconName.put( IconType.NONE, "无定义" ); + sIconName.put( IconType.OUT_ROUNDABOUT, "驶出环岛" ); + sIconName.put( IconType.OVERPASS, "通过过街天桥" ); + sIconName.put( IconType.PARK, "通过公园" ); + sIconName.put( IconType.RIGHT, "右转" ); + sIconName.put( IconType.RIGHT_BACK, "右后方" ); + sIconName.put( IconType.RIGHT_FRONT, "右前方" ); + sIconName.put( IconType.SIGHTSEEING_BUSLINE, "通过观光车路线" ); + sIconName.put( IconType.SKY_CHANNEL, "通过空中通道" ); + sIconName.put( IconType.SLIDEWAY, "通过滑道" ); + sIconName.put( IconType.SLOPE, "通过斜坡" ); + sIconName.put( IconType.SPECIAL_CONTINUE, "顺行" ); + sIconName.put( IconType.SQUARE, "通过广场" ); + sIconName.put( IconType.STAIRCASE, "通过扶梯" ); + sIconName.put( IconType.STRAIGHT, "直行" ); + sIconName.put( IconType.SUBWAY, "通过地铁通道" ); + sIconName.put( IconType.U_TURN_RIGHT, "右转掉头" ); + sIconName.put( IconType.UNDERPASS, "通过地下通道" ); + sIconName.put( IconType.WALK_ROAD, "通过行人道路" ); + } + + private static int lastIconType = 0; + private static int lastIconResId = 0; + + public static String getNameByIconType( int iconType ) { + return sIconName.get( iconType ); + } + + public static int getResIdByIconType( Context context, int iconType ) { + try { + if ( iconType == lastIconType ) { + return lastIconResId; + } + int target = context.getResources().getIdentifier( "ic_" + iconType, "drawable", context.getPackageName() ); + lastIconType = iconType; + lastIconResId = target; + return target; + } catch ( Exception e ) { + return -1; + } + } +} diff --git a/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/utils/ObjectUtils.java b/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/utils/ObjectUtils.java index 943899af3e..b035a4fdf3 100644 --- a/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/utils/ObjectUtils.java +++ b/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/utils/ObjectUtils.java @@ -1,5 +1,6 @@ package com.mogo.map.impl.amap.utils; +import android.content.Context; import android.graphics.Bitmap; import android.view.View; @@ -622,7 +623,7 @@ public class ObjectUtils { return mogoPoiResult; } - public static MogoNaviInfo fromAMap( NaviInfo naviInfo ) { + public static MogoNaviInfo fromAMap( Context context, NaviInfo naviInfo ) { if ( naviInfo == null ) { return null; } @@ -631,7 +632,7 @@ public class ObjectUtils { mogoNaviInfo.setCurrentSpeed( naviInfo.getCurrentSpeed() ); mogoNaviInfo.setCurStepRetainDistance( naviInfo.getCurStepRetainDistance() ); mogoNaviInfo.setCurStepRetainTime( naviInfo.getCurStepRetainTime() ); - mogoNaviInfo.setIconType( naviInfo.getIconType() ); + mogoNaviInfo.setIconResId( IconTypeUtils.getResIdByIconType( context, naviInfo.getIconType() ) ); mogoNaviInfo.setNextRoadName( naviInfo.getNextRoadName() ); mogoNaviInfo.setPathRetainDistance( naviInfo.getPathRetainDistance() ); mogoNaviInfo.setPathRetainTime( naviInfo.getPathRetainTime() ); diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/ic_1.png b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_1.png new file mode 100755 index 0000000000..20d7a511d7 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_1.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/ic_10.png b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_10.png new file mode 100755 index 0000000000..a5c40ead1a Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_10.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/ic_11.png b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_11.png new file mode 100755 index 0000000000..91d900b074 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_11.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/ic_12.png b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_12.png new file mode 100755 index 0000000000..bfc7fcd20c Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_12.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/ic_13.png b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_13.png new file mode 100755 index 0000000000..1fb0f4b124 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_13.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/ic_14.png b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_14.png new file mode 100755 index 0000000000..71315ff1fe Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_14.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/ic_15.png b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_15.png new file mode 100755 index 0000000000..d8b2756563 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_15.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/ic_16.png b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_16.png new file mode 100755 index 0000000000..28a3ad9083 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_16.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/ic_17.png b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_17.png new file mode 100755 index 0000000000..6173de6527 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_17.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/ic_18.png b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_18.png new file mode 100755 index 0000000000..875c448856 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_18.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/ic_19.png b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_19.png new file mode 100755 index 0000000000..e6ef7d4c89 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_19.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/ic_2.png b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_2.png new file mode 100755 index 0000000000..7dc5d8dc52 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_2.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/ic_20.png b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_20.png new file mode 100755 index 0000000000..46da5389ea Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_20.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/ic_21.png b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_21.png new file mode 100755 index 0000000000..1da8dc8752 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_21.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/ic_22.png b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_22.png new file mode 100755 index 0000000000..79f705a317 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_22.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/ic_23.png b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_23.png new file mode 100755 index 0000000000..ca288d22cd Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_23.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/ic_24.png b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_24.png new file mode 100755 index 0000000000..e7ea611bc4 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_24.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/ic_25.png b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_25.png new file mode 100755 index 0000000000..982333b0ff Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_25.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/ic_26.png b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_26.png new file mode 100755 index 0000000000..864e7d9c31 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_26.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/ic_27.png b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_27.png new file mode 100755 index 0000000000..0f3087443c Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_27.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/ic_28.png b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_28.png new file mode 100755 index 0000000000..0ba4e195b8 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_28.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/ic_3.png b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_3.png new file mode 100755 index 0000000000..2dce00f26a Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_3.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/ic_4.png b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_4.png new file mode 100755 index 0000000000..7ff7329c6f Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_4.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/ic_5.png b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_5.png new file mode 100755 index 0000000000..7e76168488 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_5.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/ic_50.png b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_50.png new file mode 100755 index 0000000000..483c6ab5b9 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_50.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/ic_51.png b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_51.png new file mode 100755 index 0000000000..5c1e7e31aa Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_51.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/ic_52.png b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_52.png new file mode 100755 index 0000000000..5d59916fc9 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_52.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/ic_53.png b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_53.png new file mode 100755 index 0000000000..fb264f39df Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_53.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/ic_54.png b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_54.png new file mode 100755 index 0000000000..b4c5267c13 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_54.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/ic_55.png b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_55.png new file mode 100755 index 0000000000..a1575c7121 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_55.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/ic_56.png b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_56.png new file mode 100755 index 0000000000..fda44310fb Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_56.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/ic_57.png b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_57.png new file mode 100755 index 0000000000..dbbb2e2573 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_57.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/ic_58.png b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_58.png new file mode 100755 index 0000000000..035f4baa9e Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_58.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/ic_59.png b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_59.png new file mode 100755 index 0000000000..97e9992259 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_59.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/ic_6.png b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_6.png new file mode 100755 index 0000000000..de674eb2f0 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_6.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/ic_60.png b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_60.png new file mode 100755 index 0000000000..593bebdfe2 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_60.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/ic_61.png b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_61.png new file mode 100755 index 0000000000..73a955b984 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_61.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/ic_62.png b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_62.png new file mode 100755 index 0000000000..00f3dba4a4 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_62.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/ic_63.png b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_63.png new file mode 100755 index 0000000000..6f512f3285 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_63.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/ic_64.png b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_64.png new file mode 100755 index 0000000000..4b36a45509 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_64.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/ic_65.png b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_65.png new file mode 100755 index 0000000000..a2959b451a Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_65.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/ic_66.png b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_66.png new file mode 100755 index 0000000000..e4d37df07f Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_66.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/ic_67.png b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_67.png new file mode 100755 index 0000000000..c965683d9d Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_67.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/ic_68.png b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_68.png new file mode 100755 index 0000000000..cbceda1b64 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_68.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/ic_69.png b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_69.png new file mode 100755 index 0000000000..72cb98cefd Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_69.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/ic_7.png b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_7.png new file mode 100755 index 0000000000..0c70b8bf07 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_7.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/ic_8.png b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_8.png new file mode 100755 index 0000000000..aadc8dacef Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_8.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/ic_9.png b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_9.png new file mode 100755 index 0000000000..62ad187de8 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/ic_9.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/tc_10.png b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_10.png new file mode 100755 index 0000000000..957cf4e0f9 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_10.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/tc_11.png b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_11.png new file mode 100755 index 0000000000..5e355cc04b Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_11.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/tc_12.png b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_12.png new file mode 100755 index 0000000000..f9fed9f672 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_12.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/tc_13.png b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_13.png new file mode 100755 index 0000000000..7e1f7441b4 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_13.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/tc_14.png b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_14.png new file mode 100755 index 0000000000..68ed73eb62 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_14.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/tc_15.png b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_15.png new file mode 100755 index 0000000000..c6edbba61c Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_15.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/tc_16.png b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_16.png new file mode 100755 index 0000000000..981cf490f9 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_16.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/tc_17.png b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_17.png new file mode 100755 index 0000000000..8632e6f02f Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_17.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/tc_20.png b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_20.png new file mode 100755 index 0000000000..12c4090df8 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_20.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/tc_21.png b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_21.png new file mode 100755 index 0000000000..c792321a02 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_21.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/tc_22.png b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_22.png new file mode 100755 index 0000000000..3ff00967ab Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_22.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/tc_23.png b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_23.png new file mode 100755 index 0000000000..78515625ae Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_23.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/tc_24.png b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_24.png new file mode 100755 index 0000000000..84b9987a85 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_24.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/tc_25.png b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_25.png new file mode 100755 index 0000000000..1e35461890 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_25.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/tc_26.png b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_26.png new file mode 100755 index 0000000000..2a3b2f2842 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_26.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/tc_27.png b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_27.png new file mode 100755 index 0000000000..4425324bdd Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_27.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/tc_28.png b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_28.png new file mode 100755 index 0000000000..71d1957c17 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_28.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/tc_30.png b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_30.png new file mode 100755 index 0000000000..d6d27e1c27 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_30.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/tc_31.png b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_31.png new file mode 100755 index 0000000000..b4ef20fc32 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_31.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/tc_32.png b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_32.png new file mode 100755 index 0000000000..32cf624bf3 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_32.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/tc_33.png b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_33.png new file mode 100755 index 0000000000..2e9c584a23 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_33.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/tc_34.png b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_34.png new file mode 100755 index 0000000000..e98239a7b9 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_34.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/tc_35.png b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_35.png new file mode 100755 index 0000000000..98773fcf3c Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_35.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/tc_36.png b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_36.png new file mode 100755 index 0000000000..74f7b41ea7 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_36.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/tc_37.png b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_37.png new file mode 100755 index 0000000000..09d784ddb3 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_37.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/tc_38.png b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_38.png new file mode 100755 index 0000000000..b78739dcd8 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_38.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/tc_39.png b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_39.png new file mode 100755 index 0000000000..a83b1fb416 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_39.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/tc_40.png b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_40.png new file mode 100755 index 0000000000..844ba94558 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_40.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/tc_41.png b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_41.png new file mode 100755 index 0000000000..e8bb0199f4 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_41.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/tc_42.png b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_42.png new file mode 100755 index 0000000000..94847a4e32 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_42.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/tc_43.png b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_43.png new file mode 100755 index 0000000000..66cbb08569 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_43.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/tc_44.png b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_44.png new file mode 100755 index 0000000000..0595b2cb8a Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_44.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/tc_68.png b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_68.png new file mode 100755 index 0000000000..33aefe1714 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_68.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/tc_84.png b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_84.png new file mode 100755 index 0000000000..cb148b17aa Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_84.png differ diff --git a/libraries/map-amap/src/main/res/drawable-xhdpi/tc_85.png b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_85.png new file mode 100755 index 0000000000..0bdbc57f23 Binary files /dev/null and b/libraries/map-amap/src/main/res/drawable-xhdpi/tc_85.png differ diff --git a/libraries/mogo-map-api/src/main/java/com/mogo/map/marker/IMogoMarkerManager.java b/libraries/mogo-map-api/src/main/java/com/mogo/map/marker/IMogoMarkerManager.java index 17bf38602e..8eac9516c3 100644 --- a/libraries/mogo-map-api/src/main/java/com/mogo/map/marker/IMogoMarkerManager.java +++ b/libraries/mogo-map-api/src/main/java/com/mogo/map/marker/IMogoMarkerManager.java @@ -48,4 +48,11 @@ public interface IMogoMarkerManager { * @return */ List< IMogoMarker > getMarkers( String tag ); + + /** + * 仅保留指定类型的tag + * + * @param tag 需要保留的类型 + */ + void removeMarkersExcept( String tag ); } diff --git a/libraries/mogo-map-api/src/main/java/com/mogo/map/marker/MogoMarkersHandler.java b/libraries/mogo-map-api/src/main/java/com/mogo/map/marker/MogoMarkersHandler.java index b9cf9a6b1c..be1a9944a5 100644 --- a/libraries/mogo-map-api/src/main/java/com/mogo/map/marker/MogoMarkersHandler.java +++ b/libraries/mogo-map-api/src/main/java/com/mogo/map/marker/MogoMarkersHandler.java @@ -1,5 +1,7 @@ package com.mogo.map.marker; +import android.text.TextUtils; + import com.mogo.map.listener.IMogoMapListener; import com.mogo.map.listener.IMogoMapListenerRegister; @@ -112,4 +114,23 @@ public class MogoMarkersHandler implements IMogoMarkerClickListener, IMogoMarker } return false; } + + /** + * @param tag 需要保留的类型 + */ + public void deleteAllExcept( String tag ) { + if ( TextUtils.isEmpty( tag ) ) { + return; + } + List< IMogoMarker > mogoMarkerList = mServicesMarkers.remove( tag ); + for ( List< IMogoMarker > value : mServicesMarkers.values() ) { + if ( value != null && !value.isEmpty() ) { + for ( IMogoMarker mogoMarker : value ) { + mogoMarker.destroy(); + } + value.clear(); + } + } + mServicesMarkers.put( tag, mogoMarkerList ); + } } diff --git a/libraries/mogo-map-api/src/main/java/com/mogo/map/navi/MogoNaviInfo.java b/libraries/mogo-map-api/src/main/java/com/mogo/map/navi/MogoNaviInfo.java index 2d578f4ec5..1da3f6d630 100644 --- a/libraries/mogo-map-api/src/main/java/com/mogo/map/navi/MogoNaviInfo.java +++ b/libraries/mogo-map-api/src/main/java/com/mogo/map/navi/MogoNaviInfo.java @@ -3,6 +3,8 @@ package com.mogo.map.navi; import android.os.Parcel; import android.os.Parcelable; +import androidx.annotation.DrawableRes; + /** * @author congtaowang * @since 2019-12-25 @@ -32,9 +34,10 @@ public class MogoNaviInfo implements Parcelable { private int curStepRetainTime; /** - * 导航转向图标 + * 导航转向图标资源ID */ - private int iconType; + @DrawableRes + private int iconResId; /** * 下条路名 @@ -83,12 +86,12 @@ public class MogoNaviInfo implements Parcelable { this.curStepRetainTime = curStepRetainTime; } - public int getIconType() { - return iconType; + public int getIconResId() { + return iconResId; } - public void setIconType( int iconType ) { - this.iconType = iconType; + public void setIconResId( int iconResId ) { + this.iconResId = iconResId; } public String getNextRoadName() { @@ -126,7 +129,7 @@ public class MogoNaviInfo implements Parcelable { dest.writeInt( this.currentSpeed ); dest.writeInt( this.curStepRetainDistance ); dest.writeInt( this.curStepRetainTime ); - dest.writeInt( this.iconType ); + dest.writeInt( this.iconResId ); dest.writeString( this.nextRoadName ); dest.writeInt( this.pathRetainTime ); dest.writeInt( this.pathRetainDistance ); @@ -140,7 +143,7 @@ public class MogoNaviInfo implements Parcelable { this.currentSpeed = in.readInt(); this.curStepRetainDistance = in.readInt(); this.curStepRetainTime = in.readInt(); - this.iconType = in.readInt(); + this.iconResId = in.readInt(); this.nextRoadName = in.readString(); this.pathRetainTime = in.readInt(); this.pathRetainDistance = in.readInt(); diff --git a/libraries/mogo-map/src/main/java/com/mogo/map/MogoMarkerManager.java b/libraries/mogo-map/src/main/java/com/mogo/map/MogoMarkerManager.java index 0cd6aff6d8..7e9baa5ef9 100644 --- a/libraries/mogo-map/src/main/java/com/mogo/map/MogoMarkerManager.java +++ b/libraries/mogo-map/src/main/java/com/mogo/map/MogoMarkerManager.java @@ -76,4 +76,9 @@ public class MogoMarkerManager implements IMogoMarkerManager { public List< IMogoMarker > getMarkers( String tag ) { return MogoMarkersHandler.getInstance().getMarkers( tag ); } + + @Override + public void removeMarkersExcept( String tag ) { + MogoMarkersHandler.getInstance().deleteAllExcept( tag ); + } } diff --git a/modules/mogo-module-apps/build.gradle b/modules/mogo-module-apps/build.gradle index dde252e48c..35003b7077 100644 --- a/modules/mogo-module-apps/build.gradle +++ b/modules/mogo-module-apps/build.gradle @@ -27,6 +27,11 @@ android { } } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + } dependencies { diff --git a/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/AppNavigatorFragment.java b/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/AppNavigatorFragment.java new file mode 100644 index 0000000000..a3429b563f --- /dev/null +++ b/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/AppNavigatorFragment.java @@ -0,0 +1,65 @@ +package com.mogo.module.apps; + +import android.view.View; + +import androidx.annotation.NonNull; + +import com.alibaba.android.arouter.launcher.ARouter; +import com.mogo.commons.mvp.IView; +import com.mogo.commons.mvp.MvpFragment; +import com.mogo.commons.mvp.Presenter; +import com.mogo.service.MogoServicePaths; +import com.mogo.service.cardmanager.IMogoCardManager; + +/** + * @author congtaowang + * @since 2020-01-06 + *
+ * 描述 + */ +public class AppNavigatorFragment extends MvpFragment< IView, Presenter< IView > > implements IView { + + private View mNavigation; + private View mMusic; + private View mChat; + private View mApps; + + private IMogoCardManager mCardManager; + + private AppsFragment mAppsFragment; + + @Override + protected int getLayoutId() { + return R.layout.module_apps_fragment_apps_navigator; + } + + @Override + protected void initViews() { + + mCardManager = ( IMogoCardManager ) ARouter.getInstance().build( MogoServicePaths.PATH_CARD_MANAGER ).navigation( getContext() ); + + mNavigation = findViewById( R.id.module_apps_id_navigation ); + mMusic = findViewById( R.id.module_apps_id_music ); + mChat = findViewById( R.id.module_apps_id_chat ); + mApps = findViewById( R.id.module_apps_id_apps ); + mNavigation.setOnClickListener( view -> { + mCardManager.switch2( "CARD_TYPE_NAVIGATION" ); + } ); + mMusic.setOnClickListener( view -> { + mCardManager.switch2( "CARD_TYPE_SHARE_MUSIC" ); + } ); + mChat.setOnClickListener( view -> { + mCardManager.switch2( "CARD_TYPE_CARS_CHATTING" ); + } ); + mApps.setOnClickListener( view -> { + new AppsFragment().show( getChildFragmentManager(), AppsFragment.TAG ); + } ); + } + + @NonNull + @Override + protected Presenter< IView > createPresenter() { + return new Presenter< IView >( this ) { + }; + } +} 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 a0a9d22d67..2fd18f57d5 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 @@ -1,7 +1,9 @@ package com.mogo.module.apps; +import android.app.Dialog; import android.os.Bundle; import android.view.View; +import android.view.WindowManager; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -10,8 +12,11 @@ import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.google.android.material.bottomsheet.BottomSheetBehavior; +import com.mogo.commons.mvp.MvpDialogFragment; import com.mogo.commons.mvp.MvpFragment; import com.mogo.module.apps.model.AppInfo; +import com.mogo.utils.BitmapHelper; +import com.mogo.utils.WindowUtils; import java.util.List; @@ -21,9 +26,11 @@ import java.util.List; *
* 描述
*/
-public class AppsFragment extends MvpFragment< AppsView, AppsPresenter > implements AppsView {
+public class AppsFragment extends MvpDialogFragment< AppsView, AppsPresenter > implements AppsView {
- private BottomSheetBehavior mBottomSheetBehavior;
+ public static final String TAG = "AppsFragment";
+
+ // private BottomSheetBehavior mBottomSheetBehavior;
private RecyclerView mAppsList;
private AppsAdapter mAppsAdapter;
@@ -35,22 +42,36 @@ public class AppsFragment extends MvpFragment< AppsView, AppsPresenter > impleme
@Override
protected void initViews() {
mAppsList = findViewById( R.id.module_apps_id_apps );
- mAppsList.setLayoutManager( new GridLayoutManager( getContext(), 3 ) );
-
- mBottomSheetBehavior = BottomSheetBehavior.from( mAppsList );
- mBottomSheetBehavior.setSkipCollapsed( true );
- mBottomSheetBehavior.setBottomSheetCallback( new BottomSheetBehavior.BottomSheetCallback() {
- @Override
- public void onStateChanged( @NonNull View bottomSheet, int newState ) {
+ mAppsList.setLayoutManager( new GridLayoutManager( getContext(), 8 ) );
+// mBottomSheetBehavior = BottomSheetBehavior.from( mAppsList );
+// mBottomSheetBehavior.setSkipCollapsed( true );
+// mBottomSheetBehavior.setBottomSheetCallback( new BottomSheetBehavior.BottomSheetCallback() {
+// @Override
+// public void onStateChanged( @NonNull View bottomSheet, int newState ) {
+//
+// }
+//
+// @Override
+// public void onSlide( @NonNull View bottomSheet, float slideOffset ) {
+//
+// }
+// } );
+// mBottomSheetBehavior.setState( BottomSheetBehavior.STATE_COLLAPSED );
+ }
+ @Override
+ public void onStart() {
+ super.onStart();
+ super.onStart();
+ final Dialog dialog = getDialog();
+ if ( dialog != null ) {
+ if ( dialog.getWindow() != null ) {
+ final WindowManager.LayoutParams params = dialog.getWindow().getAttributes();
+ params.width = WindowUtils.getScreenWidth( getContext() );
+ params.height = WindowUtils.getScreenHeight( getContext() );
+ dialog.getWindow().setAttributes( params );
}
-
- @Override
- public void onSlide( @NonNull View bottomSheet, float slideOffset ) {
-
- }
- } );
- mBottomSheetBehavior.setState( BottomSheetBehavior.STATE_COLLAPSED );
+ }
}
@NonNull
@@ -76,11 +97,9 @@ public class AppsFragment extends MvpFragment< AppsView, AppsPresenter > impleme
}
private void bindListener() {
- mAppsAdapter.setOnClickListener(new View.OnClickListener() {
- @Override public void onClick(View v) {
- AppInfo tag = (AppInfo) v.getTag();
-
- }
- });
+ mAppsAdapter.setOnClickListener( view -> {
+ AppInfo app = ( AppInfo ) view.getTag();
+ mPresenter.launch( app );
+ } );
}
}
diff --git a/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/AppsFragmentProvider.java b/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/AppsFragmentProvider.java
index 03e8970e62..09a6a429e8 100644
--- a/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/AppsFragmentProvider.java
+++ b/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/AppsFragmentProvider.java
@@ -26,11 +26,11 @@ import com.mogo.service.module.ModuleType;
@Route( path = MogoModulePaths.PATH_MODULE_APPS )
public class AppsFragmentProvider implements IMogoModuleProvider {
- private AppsFragment mAppsFragment;
+ private AppNavigatorFragment mAppsFragment;
@Override
public Fragment createFragment( Context context, Bundle data ) {
- mAppsFragment = new AppsFragment();
+ mAppsFragment = new AppNavigatorFragment();
mAppsFragment.setArguments( data );
return mAppsFragment;
}
diff --git a/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/AppsPresenter.java b/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/AppsPresenter.java
index 99995c942e..aafde6d392 100644
--- a/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/AppsPresenter.java
+++ b/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/AppsPresenter.java
@@ -1,5 +1,6 @@
package com.mogo.module.apps;
+import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
@@ -83,4 +84,17 @@ public class AppsPresenter extends Presenter< AppsView > {
return appInfos;
}
+ public void launch( AppInfo appInfo ) {
+ if ( appInfo == null ) {
+ return;
+ }
+ Intent intent = getContext().getPackageManager().getLaunchIntentForPackage( appInfo.getPackageName() );
+ if ( intent == null ) {
+ Logger.e( TAG, "can't launch app: %s", appInfo.toString() );
+ return;
+ }
+ intent.addFlags( Intent.FLAG_ACTIVITY_NEW_TASK );
+ getContext().startActivity( intent );
+ }
+
}
diff --git a/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/model/AppInfo.java b/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/model/AppInfo.java
index f1c3fe5aa9..3f0896a955 100644
--- a/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/model/AppInfo.java
+++ b/modules/mogo-module-apps/src/main/java/com/mogo/module/apps/model/AppInfo.java
@@ -43,4 +43,14 @@ public class AppInfo {
public Drawable getIcon() {
return mIcon;
}
+
+ @Override
+ public String toString() {
+ return "AppInfo{" +
+ "mName='" + mName + '\'' +
+ ", mPackageName='" + mPackageName + '\'' +
+ ", mVersionName='" + mVersionName + '\'' +
+ ", mVersionCode=" + mVersionCode +
+ '}';
+ }
}
diff --git a/modules/mogo-module-apps/src/main/res/drawable-xhdpi/module_apps_ic_apps.png b/modules/mogo-module-apps/src/main/res/drawable-xhdpi/module_apps_ic_apps.png
new file mode 100755
index 0000000000..80ecfda0bd
Binary files /dev/null and b/modules/mogo-module-apps/src/main/res/drawable-xhdpi/module_apps_ic_apps.png differ
diff --git a/modules/mogo-module-apps/src/main/res/drawable-xhdpi/module_apps_ic_chat.png b/modules/mogo-module-apps/src/main/res/drawable-xhdpi/module_apps_ic_chat.png
new file mode 100755
index 0000000000..bff714a2cd
Binary files /dev/null and b/modules/mogo-module-apps/src/main/res/drawable-xhdpi/module_apps_ic_chat.png differ
diff --git a/modules/mogo-module-apps/src/main/res/drawable-xhdpi/module_apps_ic_music.png b/modules/mogo-module-apps/src/main/res/drawable-xhdpi/module_apps_ic_music.png
new file mode 100755
index 0000000000..8f5b1de38e
Binary files /dev/null and b/modules/mogo-module-apps/src/main/res/drawable-xhdpi/module_apps_ic_music.png differ
diff --git a/modules/mogo-module-apps/src/main/res/drawable-xhdpi/module_apps_ic_navigation.png b/modules/mogo-module-apps/src/main/res/drawable-xhdpi/module_apps_ic_navigation.png
new file mode 100755
index 0000000000..624484956b
Binary files /dev/null and b/modules/mogo-module-apps/src/main/res/drawable-xhdpi/module_apps_ic_navigation.png differ
diff --git a/modules/mogo-module-apps/src/main/res/layout/module_apps_fragment_apps.xml b/modules/mogo-module-apps/src/main/res/layout/module_apps_fragment_apps.xml
index d2d41058b9..b3c0033544 100644
--- a/modules/mogo-module-apps/src/main/res/layout/module_apps_fragment_apps.xml
+++ b/modules/mogo-module-apps/src/main/res/layout/module_apps_fragment_apps.xml
@@ -1,5 +1,18 @@
-
-
+ * 描述 + */ +public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresenter > implements EntranceView, IMogoNaviListener { + + + private View mSearch; + + private View mCommonAddress; + private View mHome; + private View mCompany; + + private View mUploadRoadCondition; + + private View mVRMode; + private View mMove2CurrentLocation; + + private NaviInfoView mNaviInfo; + private View mExitNavi; + + private IMogoMapService mService; + private IMogoMapUIController mMApUIController; + private IMogoLocationClient mMogoLocationClient; + private IMogoNavi mMogoNavi; + + @Override + protected int getLayoutId() { + return R.layout.module_ext_layout_entrance; + } + + @Override + protected void initViews() { + mCommonAddress = findViewById( R.id.module_map_id_common_address ); + + mSearch = findViewById( R.id.module_map_id_search ); + mSearch.setOnClickListener( view -> { + } ); + + mHome = findViewById( R.id.module_map_id_home ); + mHome.setOnClickListener( view -> { + } ); + + mCompany = findViewById( R.id.module_map_id_company ); + mCompany.setOnClickListener( view -> { + } ); + + mUploadRoadCondition = findViewById( R.id.module_map_id_upload_road_condition ); + mUploadRoadCondition.setOnClickListener( view -> { + } ); + + mVRMode = findViewById( R.id.module_map_id_vr_mode ); + mVRMode.setOnClickListener( view -> { + } ); + + mMove2CurrentLocation = findViewById( R.id.module_map_id_move2_current_location ); + mMove2CurrentLocation.setOnClickListener( view -> { + final MogoLocation location = mMogoLocationClient.getLastKnowLocation(); + if ( location != null ) { + mMApUIController.moveToCenter( new MogoLatLng( location.getLatitude(), location.getLongitude() ) ); + } + } ); + + mNaviInfo = findViewById( R.id.module_map_id_navi_info_panel ); + mExitNavi = findViewById( R.id.module_map_id_exit_navi ); + mExitNavi.setOnClickListener( view -> { + if ( mMogoNavi != null ) { + mMogoNavi.stopNavi(); + } + } ); + + } + + @NonNull + @Override + protected EntrancePresenter createPresenter() { + return new EntrancePresenter( this ); + } + + @Override + public void onActivityCreated( @Nullable Bundle savedInstanceState ) { + super.onActivityCreated( savedInstanceState ); + mService = ( IMogoMapService ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICES_MAP ).navigation( getContext() ); + mMApUIController = mService.getMapUIController(); + mMogoLocationClient = mService.getLocationClient( getContext() ); + mMogoNavi = mService.getNavi( getContext() ); + } + + + @Override + public void onInitNaviFailure() { + + } + + @Override + public void onInitNaviSuccess() { + + } + + @Override + public void onNaviInfoUpdate( MogoNaviInfo naviinfo ) { + if ( naviinfo == null ) { + return; + } + mNaviInfo.notifyChanged( naviinfo ); + } + + @Override + public void onStartNavi() { + mCommonAddress.setVisibility( View.GONE ); + mNaviInfo.setVisibility( View.VISIBLE ); + mExitNavi.setVisibility( View.VISIBLE ); + } + + @Override + public void onStopNavi() { + mCommonAddress.setVisibility( View.VISIBLE ); + mNaviInfo.setVisibility( View.GONE ); + mExitNavi.setVisibility( View.GONE ); + } +} diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntrancePresenter.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntrancePresenter.java new file mode 100644 index 0000000000..c6061be280 --- /dev/null +++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntrancePresenter.java @@ -0,0 +1,16 @@ +package com.mogo.module.extensions.entrance; + +import com.mogo.commons.mvp.Presenter; + +/** + * @author congtaowang + * @since 2020-01-07 + *
+ * 描述
+ */
+public class EntrancePresenter extends Presenter
+ * 描述
+ */
+@Route( path = ExtensionsModuleConst.PATH_ENTRANCE )
+public class EntranceProvider implements IMogoModuleProvider {
+
+ @Override
+ public Fragment createFragment( Context context, Bundle data ) {
+ EntranceFragment fragment = new EntranceFragment();
+ fragment.setArguments( data );
+ return fragment;
+ }
+
+ @Override
+ public View createView( Context context ) {
+ return null;
+ }
+
+ @NonNull
+ @Override
+ public String getModuleName() {
+ return null;
+ }
+
+ @Override
+ public IMogoModuleLifecycle getCardLifecycle() {
+ return null;
+ }
+
+ @Override
+ public IMogoMapListener getMapListener() {
+ return null;
+ }
+
+ @Override
+ public int getType() {
+ return ModuleType.TYPE_ENTRANCE;
+ }
+
+ @Override
+ public IMogoNaviListener getNaviListener() {
+ return null;
+ }
+
+ @Override
+ public IMogoLocationListener getLocationListener() {
+ return null;
+ }
+
+ @Override
+ public void init( Context context ) {
+
+ }
+}
diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceView.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceView.java
new file mode 100644
index 0000000000..9ea2e13101
--- /dev/null
+++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceView.java
@@ -0,0 +1,12 @@
+package com.mogo.module.extensions.entrance;
+
+import com.mogo.commons.mvp.IView;
+
+/**
+ * @author congtaowang
+ * @since 2020-01-07
+ *
+ * 描述
+ */
+public interface EntranceView extends IView {
+}
diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/navi/BaseNaviInfoView.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/navi/BaseNaviInfoView.java
new file mode 100644
index 0000000000..a0c76b7dad
--- /dev/null
+++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/navi/BaseNaviInfoView.java
@@ -0,0 +1,108 @@
+package com.mogo.module.extensions.navi;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.widget.ImageView;
+import android.widget.RelativeLayout;
+import android.widget.TextView;
+
+import androidx.annotation.Nullable;
+
+import com.mogo.map.impl.amap.utils.IconTypeUtils;
+import com.mogo.map.navi.MogoNaviInfo;
+
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+
+/**
+ * @author congtaowang
+ * @since 2019-10-03
+ *
+ * 描述
+ */
+public abstract class BaseNaviInfoView extends RelativeLayout {
+
+ public BaseNaviInfoView( Context context ) {
+ this( context, null );
+ }
+
+ public BaseNaviInfoView( Context context, @Nullable AttributeSet attrs ) {
+ this( context, attrs, 0 );
+ }
+
+ public BaseNaviInfoView( Context context, @Nullable AttributeSet attrs, int defStyleAttr ) {
+ super( context, attrs, defStyleAttr );
+ }
+
+ public void notifyChanged( MogoNaviInfo naviInfo ) {
+
+ }
+
+ protected void fillNextCrossTurning( TextView target, int nextIconType ) {
+ target.setText( "后" + IconTypeUtils.getNameByIconType( nextIconType ) );
+ }
+
+ protected void fillNextCrossIconType( ImageView target, int iconId ) {
+ if ( iconId > 0 ) {
+ target.setImageResource( iconId );
+ }
+ }
+
+ protected void fillNextCrossDistance( TextView target, TextView unit, int distance ) {
+ if ( distance >= 1000 ) {
+ target.setText( String.format( "%.1f", distance / 1000f ) );
+ unit.setText( "公里" );
+ } else {
+ target.setText( distance + "" );
+ unit.setText( "米" );
+ }
+ }
+
+ protected void fillFormatSurplusDistance( int m, StringBuilder builder ) {
+ if ( m >= 1000 ) {
+ builder.append( String.format( "%.1f公里", m / 1000f ) );
+ } else {
+ builder.append( m ).append( "米" );
+ }
+ }
+
+ protected void fillFormatTime( int seconds, StringBuilder builder ) {
+ int days = seconds / ( 24 * 60 * 60 );
+ if ( days > 0 ) {
+ builder.append( days ).append( "天" );
+ }
+ seconds -= days * 24 * 60 * 60;
+ int hours = seconds / ( 60 * 60 );
+ if ( hours > 0 ) {
+ builder.append( hours ).append( "小时" );
+ }
+ seconds -= hours * 60 * 60;
+ int min = seconds / 60;
+ builder.append( min > 1 ? min : 1 ).append( "分钟" );
+ }
+
+ protected void fillArriveTime( int seconds, StringBuilder builder ) {
+
+ int days = seconds / ( 24 * 60 * 60 );
+ if ( days > 0 ) {
+ builder.append( days ).append( "天后" );
+ } else {
+ seconds -= days * 24 * 60 * 60;
+ int hours = seconds / ( 60 * 60 );
+ seconds -= hours * 60 * 60;
+ int min = seconds / 60;
+ Calendar calendar = Calendar.getInstance();
+ int curHour = calendar.get( Calendar.HOUR_OF_DAY );
+ int curMin = calendar.get( Calendar.MINUTE );
+ if ( curHour + hours + ( curMin + min ) / 60 > 24 ) {
+ builder.append( "一天后" );
+ } else {
+ calendar.add( Calendar.HOUR_OF_DAY, hours );
+ calendar.add( Calendar.MINUTE, min );
+ SimpleDateFormat dateFormat = new SimpleDateFormat( "HH:mm" );
+ builder.append( dateFormat.format( calendar.getTime() ) );
+ }
+ }
+ builder.append( "到达" );
+ }
+}
diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/navi/NaviInfoView.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/navi/NaviInfoView.java
new file mode 100644
index 0000000000..8c34869f9c
--- /dev/null
+++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/navi/NaviInfoView.java
@@ -0,0 +1,100 @@
+package com.mogo.module.extensions.navi;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import androidx.annotation.Nullable;
+
+import com.mogo.map.navi.MogoNaviInfo;
+import com.mogo.module.extensions.R;
+
+/**
+ * @author congtaowang
+ * @since 2019-09-29
+ *
+ * 导航信息
+ */
+public class NaviInfoView extends BaseNaviInfoView {
+
+ private ImageView turnIcon;
+ private TextView distance;
+ private TextView distanceUnit;
+ private TextView nextRoad;
+ private TextView estimateInfo;
+
+ private StringBuilder mBuilder = new StringBuilder();
+
+ public NaviInfoView( Context context ) {
+ this( context, null );
+ }
+
+ public NaviInfoView( Context context, @Nullable AttributeSet attrs ) {
+ this( context, attrs, 0 );
+ }
+
+ public NaviInfoView( Context context, @Nullable AttributeSet attrs, int defStyleAttr ) {
+ super( context, attrs, defStyleAttr );
+ View.inflate( context, R.layout.module_map_layout_navi_info_panel, this );
+ turnIcon = findViewById( R.id.module_map_id_navi_next_info_road_turn_icon );
+ distance = findViewById( R.id.module_map_id_navi_next_info_distance );
+ distanceUnit = findViewById( R.id.module_map_id_navi_next_info_distance_unit );
+ nextRoad = findViewById( R.id.module_map_id_navi_next_info_road );
+ estimateInfo = findViewById( R.id.module_map_id_navi_arrive_destination_estimate_info );
+ }
+
+ @Override
+ public void notifyChanged( MogoNaviInfo naviInfo ) {
+ super.notifyChanged( naviInfo );
+ if ( naviInfo == null ) {
+ return;
+ }
+ fillNextCrossDistance( distance, distanceUnit, naviInfo.getCurStepRetainDistance() );
+ fillNextCrossIconType( turnIcon, naviInfo.getIconResId() );
+ nextRoad.setText( naviInfo.getNextRoadName() );
+
+ try {
+ mBuilder.delete( 0, mBuilder.length() );
+ } catch ( Exception e ) {
+ e.printStackTrace();
+ }
+ mBuilder.append( "剩余" );
+ fillFormatSurplusDistance( naviInfo.getPathRetainDistance(), mBuilder );
+ mBuilder.append( " " );
+ fillFormatTime( naviInfo.getPathRetainTime(), mBuilder );
+ mBuilder.append( "\n" );
+ fillArriveTime( naviInfo.getPathRetainTime(), mBuilder );
+
+ final String text = mBuilder.toString();
+ estimateInfo.setText( text );
+ }
+
+ /**
+ * 获取当行信息
+ *
+ * @return
+ */
+ public String getGuideInfo() {
+ StringBuilder builder = new StringBuilder();
+ if ( getVisibility() == VISIBLE ) {
+ builder.append( distance.getText() );
+ builder.append( nextRoad.getText() );
+ }
+ return builder.toString();
+ }
+
+ /**
+ * 获取剩余里程
+ *
+ * @return
+ */
+ public String getPathRetainDistance() {
+ StringBuilder builder = new StringBuilder();
+ if ( getVisibility() == VISIBLE ) {
+ builder.append( estimateInfo.getText() );
+ }
+ return builder.toString();
+ }
+}
diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/weather/Phenomena.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/weather/Phenomena.java
index fd39a92327..8b2f0fca5f 100644
--- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/weather/Phenomena.java
+++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/weather/Phenomena.java
@@ -2,6 +2,8 @@ package com.mogo.module.extensions.weather;
import android.text.TextUtils;
+import com.mogo.module.extensions.R;
+
import java.util.HashMap;
import java.util.Map;
@@ -9,68 +11,70 @@ import java.util.Map;
* @author Lzq
*/
public enum Phenomena {
- Sunny( "00", "晴", "Sunny" ),
- Cloudy( "01", "多云", "Cloudy" ),
- Overcast( "02", "阴", "Overcast" ),
+ Sunny( "00", "晴", "Sunny", R.drawable.ic_sunny ),
+ Cloudy( "01", "多云", "Cloudy", R.drawable.ic_cloudy ),
+ Overcast( "02", "阴", "Overcast", R.drawable.ic_overcast ),
- Shower( "03", "阵雨", "Shower" ),
- Thundershower( "04", "雷阵雨", "Thundershower" ),
- ThundershowerWithHail( "05", "雷阵雨伴有冰雹", "Thundershower with hail" ),
- Sleet( "06", "雨夹雪", "Sleet" ),
- LightRain( "07", "小雨", "Light rain" ),
- ModerateRain( "08", "中雨", "Moderate rain" ),
- HeavyRain( "09", "大雨", "Heavy rain" ),
- Storm( "10", "暴雨", "Storm" ),
- HeavyStorm( "11", "大暴雨", "Heavy storm" ),
- SevereStorm( "12", "特大暴雨", "Severe storm" ),
+ Shower( "03", "阵雨", "Shower", R.drawable.ic_shower ),
+ Thundershower( "04", "雷阵雨", "Thundershower", R.drawable.ic_thundershower ),
+ ThundershowerWithHail( "05", "雷阵雨伴有冰雹", "Thundershower with hail", R.drawable.ic_thundershower ),
+ Sleet( "06", "雨夹雪", "Sleet", R.drawable.ic_snow ),
+ LightRain( "07", "小雨", "Light rain", R.drawable.ic_light_rain ),
+ ModerateRain( "08", "中雨", "Moderate rain", R.drawable.ic_light_rain ),
+ HeavyRain( "09", "大雨", "Heavy rain", R.drawable.ic_heavy_rain ),
+ Storm( "10", "暴雨", "Storm", R.drawable.ic_heavy_rain ),
+ HeavyStorm( "11", "大暴雨", "Heavy storm", R.drawable.ic_heavy_rain ),
+ SevereStorm( "12", "特大暴雨", "Severe storm", R.drawable.ic_severe_storm ),
- SnowFlurry( "13", "阵雪", "Snow flurry" ),
- LightSnow( "14", "小雪", "Light snow" ),
- ModerateSnow( "15", "中雪", "Moderate snow" ),
- HeavySnow( "16", "大雪", "Heavy snow" ),
- Snowstorm( "17", "暴雪", "Snowstorm" ),
+ SnowFlurry( "13", "阵雪", "Snow flurry", R.drawable.ic_snow ),
+ LightSnow( "14", "小雪", "Light snow", R.drawable.ic_snow ),
+ ModerateSnow( "15", "中雪", "Moderate snow", R.drawable.ic_snow ),
+ HeavySnow( "16", "大雪", "Heavy snow", R.drawable.ic_snow ),
+ Snowstorm( "17", "暴雪", "Snowstorm", R.drawable.ic_snow ),
- Foggy( "18", "雾", "Foggy" ),
- IceRain( "19", "冻雨", "Ice rain" ),
- Duststorm( "20", "沙尘暴", "Duststorm" ),
+ Foggy( "18", "雾", "Foggy", R.drawable.ic_fog ),
+ IceRain( "19", "冻雨", "Ice rain", R.drawable.ic_heavy_rain ),
+ Duststorm( "20", "沙尘暴", "Duststorm", R.drawable.ic_duststorm ),
- LightToModerateRain( "21", "小到中雨", "Light to moderate rain" ),
- ModerateToHeavyRain( "22", "中到大雨", "Moderate to heavy rain" ),
- HeavyRainToStorm( "23", "大到大雨", "Heavy rain to storm" ),
- StormToHeavyStorm( "24", "暴雨到大暴雨", "Storm to heavy storm" ),
- HeavyToSevereStorm( "25", "大暴雨到特大暴雨", "Heavy to severe storm" ),
+ LightToModerateRain( "21", "小到中雨", "Light to moderate rain", R.drawable.ic_moderate_rain ),
+ ModerateToHeavyRain( "22", "中到大雨", "Moderate to heavy rain", R.drawable.ic_heavy_rain ),
+ HeavyRainToStorm( "23", "大到大雨", "Heavy rain to storm", R.drawable.ic_heavy_rain ),
+ StormToHeavyStorm( "24", "暴雨到大暴雨", "Storm to heavy storm", R.drawable.ic_severe_storm ),
+ HeavyToSevereStorm( "25", "大暴雨到特大暴雨", "Heavy to severe storm", R.drawable.ic_severe_storm ),
- LightToModerateSnow( "26", "小到中雪", "Light to moderate snow" ),
- ModerateToHeavySnow( "27", "中到大雪", "Moderate to heavy snow" ),
- HeavySnowToSnowStorm( "28", "大到暴雪", "Heavy snow to snowstorm" ),
+ LightToModerateSnow( "26", "小到中雪", "Light to moderate snow", R.drawable.ic_snow ),
+ ModerateToHeavySnow( "27", "中到大雪", "Moderate to heavy snow", R.drawable.ic_snow ),
+ HeavySnowToSnowStorm( "28", "大到暴雪", "Heavy snow to snowstorm", R.drawable.ic_snow ),
- Dust( "29", "浮尘", "Dust" ),
- Sand( "30", "扬沙", "Sand" ),
- SandStorm( "31", "强沙尘暴", "Sandstorm" ),
+ Dust( "29", "浮尘", "Dust", R.drawable.ic_dust_sand ),
+ Sand( "30", "扬沙", "Sand", R.drawable.ic_dust_sand ),
+ SandStorm( "31", "强沙尘暴", "Sandstorm", R.drawable.ic_duststorm ),
- Densefog( "32", "浓雾", "Dense fog" ),
- StrongFog( "49", "强浓雾", "Strong fog" ),
- DenseFog( "57", "大雾", "Dense fog" ),
- ExtraHeavyFog( "58", "特强浓雾", "Extra heavy fog" ),
+ Densefog( "32", "浓雾", "Dense fog", R.drawable.ic_fog ),
+ StrongFog( "49", "强浓雾", "Strong fog", R.drawable.ic_fog ),
+ DenseFog( "57", "大雾", "Dense fog", R.drawable.ic_fog ),
+ ExtraHeavyFog( "58", "特强浓雾", "Extra heavy fog", R.drawable.ic_fog ),
- Haze( "53", "霾", "Haze" ),
- ModerateHaze( "54", "中度霾", "Moderate haze" ),
- Severehaze( "55", "重度霾", "Severe haze" ),
- SevereHaze( "56", "严重霾", "Severe haze" ),
+ Haze( "53", "霾", "Haze", R.drawable.ic_haze ),
+ ModerateHaze( "54", "中度霾", "Moderate haze", R.drawable.ic_haze ),
+ Severehaze( "55", "重度霾", "Severe haze", R.drawable.ic_haze ),
+ SevereHaze( "56", "严重霾", "Severe haze", R.drawable.ic_haze ),
- Unknown( "99", "无", "Unknown" ),
+ Unknown( "99", "无", "Unknown", R.drawable.ic_unknown ),
- Rain( "301", "雨", "rain" ),
- Snow( "302", "雪", "snow" );
+ Rain( "301", "雨", "rain", R.drawable.ic_heavy_rain ),
+ Snow( "302", "雪", "snow", R.drawable.ic_snow );
public final String id;
public final String nameCn;
public final String nameEn;
+ public final int resId;
- Phenomena( String id, String nameCn, String nameEn ) {
+ Phenomena( String id, String nameCn, String nameEn, int resId ) {
this.id = id;
this.nameCn = nameCn;
this.nameEn = nameEn;
+ this.resId = resId;
}
static Map< String, Phenomena > mPhenomenas;
diff --git a/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/ic_cloudy.png b/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/ic_cloudy.png
new file mode 100755
index 0000000000..fee3071109
Binary files /dev/null and b/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/ic_cloudy.png differ
diff --git a/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/ic_dust_sand.png b/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/ic_dust_sand.png
new file mode 100755
index 0000000000..d6bdc42cc5
Binary files /dev/null and b/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/ic_dust_sand.png differ
diff --git a/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/ic_duststorm.png b/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/ic_duststorm.png
new file mode 100755
index 0000000000..510d168d17
Binary files /dev/null and b/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/ic_duststorm.png differ
diff --git a/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/ic_fog.png b/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/ic_fog.png
new file mode 100755
index 0000000000..53d738e171
Binary files /dev/null and b/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/ic_fog.png differ
diff --git a/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/ic_haze.png b/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/ic_haze.png
new file mode 100755
index 0000000000..5f849c95dc
Binary files /dev/null and b/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/ic_haze.png differ
diff --git a/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/ic_heavy_rain.png b/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/ic_heavy_rain.png
new file mode 100755
index 0000000000..041b44358b
Binary files /dev/null and b/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/ic_heavy_rain.png differ
diff --git a/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/ic_light_rain.png b/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/ic_light_rain.png
new file mode 100755
index 0000000000..bd633baec4
Binary files /dev/null and b/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/ic_light_rain.png differ
diff --git a/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/ic_moderate_rain.png b/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/ic_moderate_rain.png
new file mode 100755
index 0000000000..bd633baec4
Binary files /dev/null and b/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/ic_moderate_rain.png differ
diff --git a/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/ic_overcast.png b/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/ic_overcast.png
new file mode 100755
index 0000000000..9598476d19
Binary files /dev/null and b/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/ic_overcast.png differ
diff --git a/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/ic_severe_storm.png b/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/ic_severe_storm.png
new file mode 100755
index 0000000000..e7a3cf6b4d
Binary files /dev/null and b/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/ic_severe_storm.png differ
diff --git a/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/ic_shower.png b/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/ic_shower.png
new file mode 100755
index 0000000000..845717f32e
Binary files /dev/null and b/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/ic_shower.png differ
diff --git a/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/ic_snow.png b/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/ic_snow.png
new file mode 100755
index 0000000000..bce4861309
Binary files /dev/null and b/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/ic_snow.png differ
diff --git a/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/ic_sunny.png b/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/ic_sunny.png
new file mode 100755
index 0000000000..287ce9cc30
Binary files /dev/null and b/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/ic_sunny.png differ
diff --git a/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/ic_thunder.png b/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/ic_thunder.png
new file mode 100755
index 0000000000..ebc955f081
Binary files /dev/null and b/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/ic_thunder.png differ
diff --git a/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/ic_thundershower.png b/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/ic_thundershower.png
new file mode 100755
index 0000000000..e863a7b159
Binary files /dev/null and b/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/ic_thundershower.png differ
diff --git a/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/ic_unknown.png b/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/ic_unknown.png
new file mode 100755
index 0000000000..68dd2d64fd
Binary files /dev/null and b/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/ic_unknown.png differ
diff --git a/modules/mogo-module-map/src/main/res/drawable-xhdpi/module_map_ic_company.png b/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/module_map_ic_company.png
similarity index 100%
rename from modules/mogo-module-map/src/main/res/drawable-xhdpi/module_map_ic_company.png
rename to modules/mogo-module-extensions/src/main/res/drawable-xhdpi/module_map_ic_company.png
diff --git a/modules/mogo-module-map/src/main/res/drawable-xhdpi/module_map_ic_home.png b/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/module_map_ic_home.png
similarity index 100%
rename from modules/mogo-module-map/src/main/res/drawable-xhdpi/module_map_ic_home.png
rename to modules/mogo-module-extensions/src/main/res/drawable-xhdpi/module_map_ic_home.png
diff --git a/modules/mogo-module-map/src/main/res/drawable-xhdpi/module_map_ic_move2_current_location.png b/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/module_map_ic_move2_current_location.png
similarity index 100%
rename from modules/mogo-module-map/src/main/res/drawable-xhdpi/module_map_ic_move2_current_location.png
rename to modules/mogo-module-extensions/src/main/res/drawable-xhdpi/module_map_ic_move2_current_location.png
diff --git a/modules/mogo-module-map/src/main/res/drawable-xhdpi/module_map_ic_search.png b/modules/mogo-module-extensions/src/main/res/drawable-xhdpi/module_map_ic_search.png
similarity index 100%
rename from modules/mogo-module-map/src/main/res/drawable-xhdpi/module_map_ic_search.png
rename to modules/mogo-module-extensions/src/main/res/drawable-xhdpi/module_map_ic_search.png
diff --git a/modules/mogo-module-map/src/main/res/drawable/module_map_dw_common_corner_bkg.xml b/modules/mogo-module-extensions/src/main/res/drawable/module_map_dw_common_corner_bkg.xml
similarity index 100%
rename from modules/mogo-module-map/src/main/res/drawable/module_map_dw_common_corner_bkg.xml
rename to modules/mogo-module-extensions/src/main/res/drawable/module_map_dw_common_corner_bkg.xml
diff --git a/modules/mogo-module-extensions/src/main/res/drawable/module_map_dw_navi_info_extras_bkg.xml b/modules/mogo-module-extensions/src/main/res/drawable/module_map_dw_navi_info_extras_bkg.xml
new file mode 100644
index 0000000000..cc7147c272
--- /dev/null
+++ b/modules/mogo-module-extensions/src/main/res/drawable/module_map_dw_navi_info_extras_bkg.xml
@@ -0,0 +1,9 @@
+
+
- * 描述
+ * 描述:加载各个模块
*/
public class MainActivity extends MvpActivity< MainView, MainPresenter > implements MainView,
IMogoLocationListener,
@@ -67,13 +67,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
mCardsContainer = findViewById( R.id.module_main_id_cards_container );
mCardsContainer.setOrientation( OrientedViewPager.Orientation.VERTICAL );
- mCardsContainer.setOnPageChangeListener( new ViewPager.OnPageChangeListener() {
-
- @Override
- public void onPageScrolled( int position, float positionOffset, int positionOffsetPixels ) {
- Logger.i( TAG, "position = " + position );
- }
-
+ mCardsContainer.setOnPageChangeListener( new OnPageChangeListenerAdapter() {
@Override
public void onPageSelected( int position ) {
try {
@@ -83,19 +77,6 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
e.printStackTrace();
}
}
-
- @Override
- public void onPageScrollStateChanged( int state ) {
- if ( state == ViewPager.SCROLL_STATE_IDLE ) {
-// if ( mCurrentPosition == 0 ) {
-// mCurrentPosition = mCardModulesAdapter.getCount() - 3;
-// mCardsContainer.setCurrentItem( mCurrentPosition, false );
-// } else if ( mCurrentPosition == mCardModulesAdapter.getCount() - 2 ) {
-// mCurrentPosition = 1;
-// mCardsContainer.setCurrentItem( mCurrentPosition, false );
-// }
- }
- }
} );
}
@@ -107,6 +88,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
MogoModulePaths.addModule( new MogoModule( MogoModulePaths.PATH_MODULE_MAP, MogoModulePaths.PATH_MODULE_MAP ) );
MogoModulePaths.addModule( new MogoModule( ServiceConst.PATH_REFRESH_STRATEGY, ServiceConst.PATH_REFRESH_STRATEGY ) );
MogoModulePaths.addModule( new MogoModule( ExtensionsModuleConst.PATH_EXTENSION, ExtensionsModuleConst.TYPE ) );
+ MogoModulePaths.addModule( new MogoModule( ExtensionsModuleConst.PATH_ENTRANCE, ExtensionsModuleConst.TYPE_ENTRANCE ) );
mMogoModuleHandler = new MogoModulesManager( this );
mMogoMapService = ( IMogoMapService ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICES_MAP ).navigation();
@@ -128,6 +110,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
mMogoModuleHandler.loadMap( R.id.module_main_id_map_fragment_container );
mMogoModuleHandler.loadAppsList( R.id.module_main_id_fragment_container );
mMogoModuleHandler.loadExtensions( R.id.module_main_id_header_fragment_container );
+ mMogoModuleHandler.loadEntrances( R.id.module_main_id_entrance_fragment_container );
mLocationClient = mMogoMapService.getSingletonLocationClient( getApplicationContext() );
mLocationClient.addLocationListener( this );
@@ -163,11 +146,22 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
@Override
public boolean onMarkerClicked( IMogoMarker marker ) {
-// int mappedCardPosition = mCardModulesAdapter.getNextCardPosition( marker.getOwner(), mCurrentPosition );
-// mCardsContainer.setCurrentItem( mappedCardPosition, true );
+ switch2( marker.getOwner() );
return false;
}
+ @Override
+ public void switch2( String cardType ) {
+ if ( mCardModulesAdapter != null ) {
+ int position = mCardModulesAdapter.getProviderPosition( cardType );
+ if ( position != -1 ) {
+ mCardsContainer.setCurrentItem( position, false );
+ } else {
+ Logger.e( TAG, "Can't find type of %s's position", cardType );
+ }
+ }
+ }
+
@Override
protected void onDestroy() {
super.onDestroy();
diff --git a/modules/mogo-module-main/src/main/java/com/mogo/module/main/MainPresenter.java b/modules/mogo-module-main/src/main/java/com/mogo/module/main/MainPresenter.java
index 2117dc53c7..905d597035 100644
--- a/modules/mogo-module-main/src/main/java/com/mogo/module/main/MainPresenter.java
+++ b/modules/mogo-module-main/src/main/java/com/mogo/module/main/MainPresenter.java
@@ -1,6 +1,13 @@
package com.mogo.module.main;
+import android.text.TextUtils;
+
+import androidx.annotation.NonNull;
+import androidx.lifecycle.LifecycleOwner;
+import androidx.lifecycle.Observer;
+
import com.mogo.commons.mvp.Presenter;
+import com.mogo.module.main.livedata.CardSwitchLiveData;
/**
* @author congtaowang
@@ -13,4 +20,18 @@ public class MainPresenter extends Presenter< MainView > {
public MainPresenter( MainView view ) {
super( view );
}
+
+ @Override
+ public void onCreate( @NonNull LifecycleOwner owner ) {
+ super.onCreate( owner );
+ CardSwitchLiveData.getInstance().observeForever( new Observer< String >() {
+ @Override
+ public void onChanged( String s ) {
+ if ( TextUtils.isEmpty( s ) ) {
+ return;
+ }
+ mView.switch2( s );
+ }
+ } );
+ }
}
diff --git a/modules/mogo-module-main/src/main/java/com/mogo/module/main/MainView.java b/modules/mogo-module-main/src/main/java/com/mogo/module/main/MainView.java
index 1bec469b31..3803a0e42c 100644
--- a/modules/mogo-module-main/src/main/java/com/mogo/module/main/MainView.java
+++ b/modules/mogo-module-main/src/main/java/com/mogo/module/main/MainView.java
@@ -9,4 +9,6 @@ import com.mogo.commons.mvp.IView;
* 主页 view 接口
*/
public interface MainView extends IView {
+
+ void switch2( String cardType );
}
diff --git a/modules/mogo-module-main/src/main/java/com/mogo/module/main/MogoCardManager.java b/modules/mogo-module-main/src/main/java/com/mogo/module/main/MogoCardManager.java
new file mode 100644
index 0000000000..5fcd499113
--- /dev/null
+++ b/modules/mogo-module-main/src/main/java/com/mogo/module/main/MogoCardManager.java
@@ -0,0 +1,28 @@
+package com.mogo.module.main;
+
+import android.content.Context;
+
+import com.alibaba.android.arouter.facade.annotation.Route;
+import com.mogo.module.main.livedata.CardSwitchLiveData;
+import com.mogo.service.MogoServicePaths;
+import com.mogo.service.cardmanager.IMogoCardManager;
+
+/**
+ * @author congtaowang
+ * @since 2020-01-06
+ *
+ * 卡片控制
+ */
+@Route( path = MogoServicePaths.PATH_CARD_MANAGER )
+public class MogoCardManager implements IMogoCardManager {
+
+ @Override
+ public void switch2( String cardType ) {
+ CardSwitchLiveData.getInstance().postValue( cardType );
+ }
+
+ @Override
+ public void init( Context context ) {
+
+ }
+}
diff --git a/modules/mogo-module-main/src/main/java/com/mogo/module/main/cards/CardModulesAdapter.java b/modules/mogo-module-main/src/main/java/com/mogo/module/main/cards/CardModulesAdapter.java
index 806d216622..77a3a48ad7 100644
--- a/modules/mogo-module-main/src/main/java/com/mogo/module/main/cards/CardModulesAdapter.java
+++ b/modules/mogo-module-main/src/main/java/com/mogo/module/main/cards/CardModulesAdapter.java
@@ -65,34 +65,23 @@ public class CardModulesAdapter extends FragmentStatePagerAdapter {
}
/**
- * marker、卡片、语音等通过 launcher 切换到其他卡片。
+ * 获取对应卡片类型在列表中的位置
*
- * @param providerTag 卡片类型
- * @param currentPosition 当前卡片位置
- * @return 需要跳转到的卡片实际位置
+ * @param tag 卡片类型
+ * @return 列表中的位置
*/
- public int getNextCardPosition( String providerTag, int currentPosition ) {
- int position = 0;
- int currentFactPosition = getFactPosition( currentPosition );
- for ( IMogoModuleProvider provider : mProviders ) {
- if ( TextUtils.equals( providerTag, provider.getModuleName() ) ) {
- break;
+ public int getProviderPosition( String tag ) {
+ if ( mProviders != null ) {
+ for ( int i = 0; i < mProviders.size(); i++ ) {
+ IMogoModuleProvider provider = mProviders.get( i );
+ if ( provider != null ) {
+ if ( TextUtils.equals( provider.getModuleName(), tag ) ) {
+ return i;
+ }
+ }
}
- position++;
}
- int offset = 0;
- if ( currentFactPosition > position ) {
- // 下一个卡片在当前卡片前面
- offset = position - mProviders.size();
- } else if ( currentFactPosition < position ) {
- // 下一个卡片在当前卡片后面
- offset = mProviders.size() - position;
- }
- return currentPosition + offset;
+ return -1;
}
- @Override
- public void finishUpdate( @NonNull ViewGroup container ) {
- super.finishUpdate( container );
- }
}
diff --git a/modules/mogo-module-main/src/main/java/com/mogo/module/main/cards/MogoModulesHandler.java b/modules/mogo-module-main/src/main/java/com/mogo/module/main/cards/MogoModulesHandler.java
index bac3025f0c..41c4ec0712 100644
--- a/modules/mogo-module-main/src/main/java/com/mogo/module/main/cards/MogoModulesHandler.java
+++ b/modules/mogo-module-main/src/main/java/com/mogo/module/main/cards/MogoModulesHandler.java
@@ -54,6 +54,13 @@ public interface MogoModulesHandler extends IMogoMapListener,
*/
void loadExtensions( int containerId );
+ /**
+ * 加载快捷操作
+ *
+ * @param containerId
+ */
+ void loadEntrances( int containerId );
+
/**
* 设置某一个module可用
*
diff --git a/modules/mogo-module-main/src/main/java/com/mogo/module/main/cards/MogoModulesManager.java b/modules/mogo-module-main/src/main/java/com/mogo/module/main/cards/MogoModulesManager.java
index f044239821..95c3dfe253 100644
--- a/modules/mogo-module-main/src/main/java/com/mogo/module/main/cards/MogoModulesManager.java
+++ b/modules/mogo-module-main/src/main/java/com/mogo/module/main/cards/MogoModulesManager.java
@@ -119,6 +119,11 @@ public class MogoModulesManager implements MogoModulesHandler,
loadModuleByType( ModuleType.TYPE_EXTENSION, containerId );
}
+ @Override
+ public void loadEntrances( int containerId ) {
+ loadModuleByType( ModuleType.TYPE_ENTRANCE, containerId );
+ }
+
private void loadModuleByType( int type, int containerId ) {
if ( mModuleProviders.isEmpty() ) {
return;
diff --git a/modules/mogo-module-main/src/main/java/com/mogo/module/main/cards/OnPageChangeListenerAdapter.java b/modules/mogo-module-main/src/main/java/com/mogo/module/main/cards/OnPageChangeListenerAdapter.java
new file mode 100644
index 0000000000..f43f436c6e
--- /dev/null
+++ b/modules/mogo-module-main/src/main/java/com/mogo/module/main/cards/OnPageChangeListenerAdapter.java
@@ -0,0 +1,27 @@
+package com.mogo.module.main.cards;
+
+import androidx.viewpager.widget.ViewPager;
+
+/**
+ * @author congtaowang
+ * @since 2020-01-06
+ *
+ * 描述
+ */
+public class OnPageChangeListenerAdapter implements ViewPager.OnPageChangeListener {
+
+ @Override
+ public void onPageScrolled( int position, float positionOffset, int positionOffsetPixels ) {
+
+ }
+
+ @Override
+ public void onPageSelected( int position ) {
+
+ }
+
+ @Override
+ public void onPageScrollStateChanged( int state ) {
+
+ }
+}
diff --git a/modules/mogo-module-main/src/main/java/com/mogo/module/main/cards/PlaceholderFragment.java b/modules/mogo-module-main/src/main/java/com/mogo/module/main/cards/PlaceholderFragment.java
deleted file mode 100644
index 6b2c2b566c..0000000000
--- a/modules/mogo-module-main/src/main/java/com/mogo/module/main/cards/PlaceholderFragment.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.mogo.module.main.cards;
-
-import android.os.Bundle;
-
-import androidx.annotation.Nullable;
-
-import com.mogo.module.main.R;
-
-/**
- * @author congtaowang
- * @since 2019-12-31
- *
- * 描述
- */
-public class PlaceholderFragment extends UnDestroyedViewFragment {
-
- @Override
- protected int getLayoutId() {
- return R.layout.module_main_fragement_placeholder;
- }
-
- @Override
- public void onCreate( @Nullable Bundle savedInstanceState ) {
- super.onCreate( savedInstanceState );
- }
-}
diff --git a/modules/mogo-module-main/src/main/java/com/mogo/module/main/cards/PlaceholderFragmentProvider.java b/modules/mogo-module-main/src/main/java/com/mogo/module/main/cards/PlaceholderFragmentProvider.java
deleted file mode 100644
index 4109a1004e..0000000000
--- a/modules/mogo-module-main/src/main/java/com/mogo/module/main/cards/PlaceholderFragmentProvider.java
+++ /dev/null
@@ -1,101 +0,0 @@
-package com.mogo.module.main.cards;
-
-import android.content.Context;
-import android.graphics.Bitmap;
-import android.graphics.drawable.BitmapDrawable;
-import android.os.Bundle;
-import android.view.View;
-
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import androidx.fragment.app.Fragment;
-
-import com.mogo.commons.mvp.IView;
-import com.mogo.commons.mvp.MvpFragment;
-import com.mogo.commons.mvp.Presenter;
-import com.mogo.map.listener.IMogoMapListener;
-import com.mogo.map.location.IMogoLocationListener;
-import com.mogo.map.navi.IMogoNaviListener;
-import com.mogo.module.main.R;
-import com.mogo.service.module.IMogoModuleLifecycle;
-import com.mogo.service.module.IMogoModuleProvider;
-import com.mogo.service.module.ModuleType;
-
-/**
- * @author congtaowang
- * @since 2019-12-31
- *
- * 描述
- */
-public class PlaceholderFragmentProvider implements IMogoModuleProvider {
-
- private Fragment mCopyTarget;
- private PlaceholderFragment mUi;
-
- public void setCopyTarget( Fragment mUICopyTarget ) {
- this.mCopyTarget = mUICopyTarget;
- }
-
- public void renderTargetUI() {
- if ( mCopyTarget == null ) {
- return;
- }
- final View target = mCopyTarget.getView();
- if ( target == null ) {
- return;
- }
- target.setDrawingCacheEnabled( true );
- Bitmap result = target.getDrawingCache();
- result = target.getDrawingCache() != null ? result.copy( Bitmap.Config.ARGB_8888, false ) : null;
- if ( mUi.getView() != null ) {
- mUi.getView().setBackgroundDrawable( new BitmapDrawable( result ) );
- }
- }
-
- @Override
- public Fragment createFragment( Context context, Bundle data ) {
- mUi = new PlaceholderFragment();
- return mUi;
- }
-
- @Override
- public View createView( Context context ) {
- return null;
- }
-
- @NonNull
- @Override
- public String getModuleName() {
- return "placeholder";
- }
-
- @Override
- public IMogoModuleLifecycle getCardLifecycle() {
- return null;
- }
-
- @Override
- public IMogoMapListener getMapListener() {
- return null;
- }
-
- @Override
- public int getType() {
- return ModuleType.TYPE_CARD_FRAGMENT;
- }
-
- @Override
- public IMogoNaviListener getNaviListener() {
- return null;
- }
-
- @Override
- public IMogoLocationListener getLocationListener() {
- return null;
- }
-
- @Override
- public void init( Context context ) {
-
- }
-}
diff --git a/modules/mogo-module-main/src/main/java/com/mogo/module/main/cards/UnDestroyedViewFragment.java b/modules/mogo-module-main/src/main/java/com/mogo/module/main/cards/UnDestroyedViewFragment.java
deleted file mode 100644
index 29eb86e890..0000000000
--- a/modules/mogo-module-main/src/main/java/com/mogo/module/main/cards/UnDestroyedViewFragment.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package com.mogo.module.main.cards;
-
-import android.os.Bundle;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-
-import com.mogo.commons.mvp.IView;
-import com.mogo.commons.mvp.MvpFragment;
-import com.mogo.commons.mvp.Presenter;
-import com.mogo.module.main.R;
-
-/**
- * @author congtaowang
- * @since 2019-12-31
- *
- * 描述
- */
-public abstract class UnDestroyedViewFragment extends MvpFragment< IView, Presenter< IView > > implements IView {
-
- @Nullable
- @Override
- public View onCreateView( @NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState ) {
- if ( mRootView == null ) {
- return super.onCreateView( inflater, container, savedInstanceState );
- }
- return mRootView;
- }
-
- @Override
- protected void initViews() {
-
- }
-
- @NonNull
- @Override
- protected Presenter< IView > createPresenter() {
- return new Presenter< IView >( this ) {
- };
- }
-}
diff --git a/modules/mogo-module-main/src/main/java/com/mogo/module/main/cards/VerticalStackTransformer.java b/modules/mogo-module-main/src/main/java/com/mogo/module/main/cards/VerticalStackTransformer.java
index 44cde6ab7f..425bdc4af9 100644
--- a/modules/mogo-module-main/src/main/java/com/mogo/module/main/cards/VerticalStackTransformer.java
+++ b/modules/mogo-module-main/src/main/java/com/mogo/module/main/cards/VerticalStackTransformer.java
@@ -26,12 +26,10 @@ public class VerticalStackTransformer extends VerticalBaseTransformer {
protected void onTransform( View page, float position ) {
if ( position <= 0.0f ) {
page.setAlpha( 1.0f );
- Log.e( "onTransform", "position <= 0.0f ==>" + position );
page.setTranslationY( 0f );
//控制停止滑动切换的时候,只有最上面的一张卡片可以点击
page.setClickable( true );
} else {
- Log.e( "onTransform", "position <= 3.0f ==>" + position );
float scale = ( float ) ( page.getWidth() - WindowUtils.dip2px( context, spaceBetweenFirAndSecWith * position ) ) / ( float ) ( page.getWidth() );
//控制下面卡片的可见度
page.setAlpha( 1.0f );
diff --git a/modules/mogo-module-main/src/main/java/com/mogo/module/main/cards/ZoomOutPageTransformer.java b/modules/mogo-module-main/src/main/java/com/mogo/module/main/cards/ZoomOutPageTransformer.java
deleted file mode 100644
index b1a9aea583..0000000000
--- a/modules/mogo-module-main/src/main/java/com/mogo/module/main/cards/ZoomOutPageTransformer.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package com.mogo.module.main.cards;
-
-import android.view.View;
-
-import androidx.viewpager.widget.ViewPager;
-
-public class ZoomOutPageTransformer implements ViewPager.PageTransformer {
- private static final float MAX_SCALE = 1.0f;
- private static final float MIN_SCALE = 0.85f;//0.85f
-
- @Override
- public void transformPage( View view, float position ) {
-// //setScaleY只支持api11以上
- if ( position < -1 ) {
- view.setScaleX( MIN_SCALE );
- view.setScaleY( MIN_SCALE );
- } else if ( position <= 1 ) //a页滑动至b页 ; a页从 0.0 -1 ;b页从1 ~ 0.0
- { // [-1,1]
-// Log.e("TAG", view + " , " + position + "");
- float scaleFactor = MIN_SCALE + ( 1 - Math.abs( position ) ) * ( MAX_SCALE - MIN_SCALE );
- view.setScaleX( scaleFactor );
- //每次滑动后进行微小的移动目的是为了防止在三星的某些手机上出现两边的页面为显示的情况
- if ( position > 0 ) {
- view.setTranslationX( -scaleFactor * 2 );
- } else if ( position < 0 ) {
- view.setTranslationX( scaleFactor * 2 );
- }
- view.setScaleY( scaleFactor );
-
- } else { // (1,+Infinity]
-
- view.setScaleX( MIN_SCALE );
- view.setScaleY( MIN_SCALE );
-
- }
- }
-
-}
\ No newline at end of file
diff --git a/modules/mogo-module-main/src/main/java/com/mogo/module/main/livedata/CardSwitchLiveData.java b/modules/mogo-module-main/src/main/java/com/mogo/module/main/livedata/CardSwitchLiveData.java
new file mode 100644
index 0000000000..fafe630a3d
--- /dev/null
+++ b/modules/mogo-module-main/src/main/java/com/mogo/module/main/livedata/CardSwitchLiveData.java
@@ -0,0 +1,24 @@
+package com.mogo.module.main.livedata;
+
+import androidx.lifecycle.MutableLiveData;
+
+/**
+ * @author congtaowang
+ * @since 2020-01-06
+ *
+ * 切换卡片
+ */
+public class CardSwitchLiveData extends MutableLiveData< String > {
+
+ private CardSwitchLiveData() {
+ // private constructor
+ }
+
+ private static final class InstanceHolder {
+ private static final CardSwitchLiveData INSTANCE = new CardSwitchLiveData();
+ }
+
+ public static CardSwitchLiveData getInstance() {
+ return InstanceHolder.INSTANCE;
+ }
+}
diff --git a/modules/mogo-module-main/src/main/res/layout/module_main_activity_main.xml b/modules/mogo-module-main/src/main/res/layout/module_main_activity_main.xml
index 485feb099d..da46c8d320 100644
--- a/modules/mogo-module-main/src/main/res/layout/module_main_activity_main.xml
+++ b/modules/mogo-module-main/src/main/res/layout/module_main_activity_main.xml
@@ -1,49 +1,59 @@
-
+ * 卡片管理
+ */
+public interface IMogoCardManager extends IProvider {
+
+ /**
+ * 切换卡片
+ *
+ * @param cardType
+ */
+ void switch2( String cardType );
+}
diff --git a/services/mogo-service-api/src/main/java/com/mogo/service/module/ModuleType.java b/services/mogo-service-api/src/main/java/com/mogo/service/module/ModuleType.java
index 7ebd3a1079..f7fb47463f 100644
--- a/services/mogo-service-api/src/main/java/com/mogo/service/module/ModuleType.java
+++ b/services/mogo-service-api/src/main/java/com/mogo/service/module/ModuleType.java
@@ -48,4 +48,9 @@ public interface ModuleType {
* 小智、天气、时间等
*/
int TYPE_EXTENSION = 8;
+
+ /**
+ * 操作快捷入口
+ */
+ int TYPE_ENTRANCE = 9;
}
diff --git a/services/mogo-service/src/test/java/com/mogo/service/map/ExampleUnitTest.java b/services/mogo-service/src/test/java/com/mogo/service/map/ExampleUnitTest.java
deleted file mode 100644
index 6c7fa71433..0000000000
--- a/services/mogo-service/src/test/java/com/mogo/service/map/ExampleUnitTest.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.mogo.service.map;
-
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-/**
- * Example local unit test, which will execute on the development machine (host).
- *
- * @see Testing documentation
- */
-public class ExampleUnitTest {
- @Test
- public void addition_isCorrect() {
- assertEquals( 4, 2 + 2 );
- }
-}
\ No newline at end of file