diff --git a/.idea/misc.xml b/.idea/misc.xml index 703e5d4b89..8a8f75bfe2 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -5,7 +5,7 @@ - + diff --git a/app/build.gradle b/app/build.gradle index a0bb93f8fd..13a08c24df 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -61,6 +61,10 @@ dependencies { // implementation rootProject.ext.dependencies.moduledemo // implementation rootProject.ext.dependencies.moduledemo2 + implementation rootProject.ext.dependencies.modulechatting + + + implementation rootProject.ext.dependencies.moduleonlinecar if (Boolean.valueOf(RELEASE)) { api rootProject.ext.dependencies.modulemain diff --git a/app/src/androidTest/java/com/mogo/launcher/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/mogo/launcher/ExampleInstrumentedTest.java deleted file mode 100644 index 2784cd1c3f..0000000000 --- a/app/src/androidTest/java/com/mogo/launcher/ExampleInstrumentedTest.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.mogo.launcher; - -import android.content.Context; - -import androidx.test.platform.app.InstrumentationRegistry; -import androidx.test.ext.junit.runners.AndroidJUnit4; - -import org.junit.Test; -import org.junit.runner.RunWith; - -import static org.junit.Assert.*; - -/** - * Instrumented test, which will execute on an Android device. - * - * @see Testing documentation - */ -@RunWith( AndroidJUnit4.class ) -public class ExampleInstrumentedTest { - @Test - public void useAppContext() { - // Context of the app under test. - Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); - - assertEquals( "com.mogo.launcher", appContext.getPackageName() ); - } -} diff --git a/app/src/main/java/com/mogo/launcher/MogoApplication.java b/app/src/main/java/com/mogo/launcher/MogoApplication.java index 87f83e0486..99bc7c5980 100644 --- a/app/src/main/java/com/mogo/launcher/MogoApplication.java +++ b/app/src/main/java/com/mogo/launcher/MogoApplication.java @@ -5,8 +5,11 @@ import android.content.Context; import androidx.multidex.MultiDex; import com.mogo.commons.AbsMogoApplication; +import com.mogo.commons.debug.DebugConfig; +import com.mogo.module.carchatting.CallChatConstant; import com.mogo.module.common.MogoModule; import com.mogo.module.common.MogoModulePaths; +import com.mogo.module.onlinecar.OnLineCarConstants; import com.mogo.tanlu.constant.TanluConstants; /** @@ -22,7 +25,10 @@ public class MogoApplication extends AbsMogoApplication { super.onCreate(); // MogoModulePaths.addModule( new MogoModule( DemoConstants.TAG, "CARD_DEMO" ) ); // MogoModulePaths.addModule( new MogoModule( Demo2Constants.TAG, "CARD_DEMO2" ) ); + DebugConfig.setNetMode( DebugConfig.NET_MODE_QA ); MogoModulePaths.addModule( new MogoModule( TanluConstants.TAG, "CARD_TYPE_ROAD_CODITION" ) ); + MogoModulePaths.addModule(new MogoModule(OnLineCarConstants.TAG, "CARD_TYPE_ROAD_ONLINECAR")); + MogoModulePaths.addModule(new MogoModule( CallChatConstant.PROVIDER, CallChatConstant.MODULE_NAME)); } @Override diff --git a/app/src/test/java/com/mogo/launcher/ExampleUnitTest.java b/app/src/test/java/com/mogo/launcher/ExampleUnitTest.java deleted file mode 100644 index cde4cc10d4..0000000000 --- a/app/src/test/java/com/mogo/launcher/ExampleUnitTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.mogo.launcher; - -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 diff --git a/config.gradle b/config.gradle index a09c88791e..2026aa5774 100644 --- a/config.gradle +++ b/config.gradle @@ -94,6 +94,8 @@ ext { moduleapps : "com.mogo.module:module-apps:${MOGO_MODULE_APPS_VERSION}", mogoconnection : "com.mogo.connection:mogo-connection:${MOGO_CONNECTION_VERSION}", moduleextensions : "com.mogo.module:module-extensions:${MOGO_MODULE_EXTENSIONS_VERSION}", + modulechatting : "com.mogo.module.carchatting:module-carchatting:${CARCHATTING_VERSION}", + moduleonlinecar : "com.mogo.module:module-onlinecar:${MOGO_MODULE_ONLINECAR_VERSION}", // 长链 socketsdk : 'com.zhidao.socketsdk:socketsdk:2.1.0', diff --git a/foudations/mogo-commons/src/main/java/com/mogo/commons/mvp/MvpDialogFragment.java b/foudations/mogo-commons/src/main/java/com/mogo/commons/mvp/MvpDialogFragment.java new file mode 100644 index 0000000000..bcd2e6412a --- /dev/null +++ b/foudations/mogo-commons/src/main/java/com/mogo/commons/mvp/MvpDialogFragment.java @@ -0,0 +1,106 @@ +package com.mogo.commons.mvp; + +import android.content.Context; +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 androidx.fragment.app.DialogFragment; +import androidx.fragment.app.Fragment; + +/** + * @author congtaowang + * @since 2019-12-23 + *

+ * 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/foudations/mogo-connection/src/main/java/com/mogo/connection/socket/SocketManager.java b/foudations/mogo-connection/src/main/java/com/mogo/connection/socket/SocketManager.java index 783931c3ff..e5fe7f1b36 100644 --- a/foudations/mogo-connection/src/main/java/com/mogo/connection/socket/SocketManager.java +++ b/foudations/mogo-connection/src/main/java/com/mogo/connection/socket/SocketManager.java @@ -31,7 +31,6 @@ public class SocketManager implements IMogoSocketManager, OnSocketReceiveCallbac private static final String TAG = "SocketManager"; - public static final int MSG_PRODUCT_LINE = MogoCommon.Product.mogoBussiness_VALUE; private static final int MSG_HEADER_TYPE = MogoConnsvr.MsgType.mogoMsgTypeDispatchSvrNoRspReq_VALUE; @@ -86,7 +85,7 @@ public class SocketManager implements IMogoSocketManager, OnSocketReceiveCallbac Logger.d( TAG, "received msg type = %d", msgType ); IMogoOnMessageListener listener = mListeners.get( msgType ); if ( listener != null ) { - listener.onMsgReceived( GsonUtil.objectFromJson( payload.getPayload().toString(), listener.target() ) ); + listener.onMsgReceived( GsonUtil.objectFromJson( payload.getPayload().toStringUtf8(), listener.target() ) ); } } catch ( InvalidProtocolBufferException e ) { Logger.e( TAG, "parse msg error.", e ); diff --git a/gradle.properties b/gradle.properties index 832da15ccb..8a7f1f677d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -44,4 +44,6 @@ 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 +MOGO_MODULE_ONLINECAR_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..e705ae6eac 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 ) ) ); @@ -486,4 +488,13 @@ public class AMapNaviViewWrapper implements IMogoMapView, } return null; } + + @Override + public void setPointToCenter( double mapCenterX, double mapCenterY ) { + if ( checkAMapView() ) { + AMapNaviViewOptions options = mMapView.getViewOptions(); + options.setPointToCenter( mapCenterX, mapCenterY ); + mMapView.setViewOptions( options ); + } + } } 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/uicontroller/AMapUIController.java b/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/uicontroller/AMapUIController.java index aaba68efe3..26e98dee48 100644 --- a/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/uicontroller/AMapUIController.java +++ b/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/uicontroller/AMapUIController.java @@ -129,4 +129,11 @@ public class AMapUIController implements IMogoMapUIController { } return null; } + + @Override + public void setPointToCenter( double mapCenterX, double mapCenterY ) { + if ( mClient != null ) { + mClient.setPointToCenter( mapCenterX, mapCenterY ); + } + } } 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-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.java b/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.java index e0f5e57790..a9968af5ec 100644 --- a/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.java +++ b/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.java @@ -87,4 +87,12 @@ public interface IMogoMapUIController { * @return */ MogoLatLng getCameraSouthWestPosition(); + + /** + * 设置地图中心点 + * + * @param mapCenterX x 点位置x值与地图宽度的比例 + * @param mapCenterY y 点位置x值与地图高度的比例 + */ + void setPointToCenter( double mapCenterX, double mapCenterY ); } diff --git a/libraries/mogo-map-api/src/main/res/drawable-xhdpi/map_api_ic_current_location.png b/libraries/mogo-map-api/src/main/res/drawable-xhdpi/map_api_ic_current_location.png index 58f3550408..65cecf9af2 100644 Binary files a/libraries/mogo-map-api/src/main/res/drawable-xhdpi/map_api_ic_current_location.png and b/libraries/mogo-map-api/src/main/res/drawable-xhdpi/map_api_ic_current_location.png differ diff --git a/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapUIController.java b/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapUIController.java index 3c58121cd9..b6ab623020 100644 --- a/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapUIController.java +++ b/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapUIController.java @@ -122,4 +122,11 @@ public class MogoMapUIController implements IMogoMapUIController { } return null; } + + @Override + public void setPointToCenter( double mapCenterX, double mapCenterY ) { + if ( mDelegate != null ) { + mDelegate.setPointToCenter( mapCenterX, mapCenterY ); + } + } } 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..0a83e3b9d6 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 @@ -10,6 +10,7 @@ import androidx.fragment.app.Fragment; import com.alibaba.android.arouter.facade.annotation.Route; import com.mogo.map.listener.IMogoMapListener; import com.mogo.map.location.IMogoLocationListener; +import com.mogo.map.marker.IMogoMarkerClickListener; import com.mogo.map.navi.IMogoNaviListener; import com.mogo.module.common.MogoModulePaths; import com.mogo.service.module.IMogoModuleLifecycle; @@ -26,11 +27,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; } @@ -75,4 +76,9 @@ public class AppsFragmentProvider implements IMogoModuleProvider { public void init( Context context ) { } + + @Override + public IMogoMarkerClickListener getMarkerClickListener() { + return null; + } } 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 @@ - - + + + + + + + + + + + + + + @@ -9,6 +22,5 @@ android:layout_width="match_parent" android:layout_height="match_parent" app:behavior_hideable="false" - app:behavior_peekHeight="76dp" - app:layout_behavior="@string/bottom_sheet_behavior" /> - \ No newline at end of file + app:behavior_peekHeight="76dp" /> + \ No newline at end of file diff --git a/modules/mogo-module-apps/src/main/res/layout/module_apps_fragment_apps_navigator.xml b/modules/mogo-module-apps/src/main/res/layout/module_apps_fragment_apps_navigator.xml new file mode 100644 index 0000000000..07f9fae0cc --- /dev/null +++ b/modules/mogo-module-apps/src/main/res/layout/module_apps_fragment_apps_navigator.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/modules/mogo-module-apps/src/main/res/layout/module_apps_item_app.xml b/modules/mogo-module-apps/src/main/res/layout/module_apps_item_app.xml index 3f995c1085..ade4edbf41 100644 --- a/modules/mogo-module-apps/src/main/res/layout/module_apps_item_app.xml +++ b/modules/mogo-module-apps/src/main/res/layout/module_apps_item_app.xml @@ -3,6 +3,7 @@ xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:gravity="center" android:orientation="vertical"> + android:layout_height="wrap_content" + android:gravity="center" + android:maxLines="2" /> \ No newline at end of file diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/ModuleType.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/ModuleType.java index 9723e975e8..9d8995fa9c 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/ModuleType.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/ModuleType.java @@ -48,4 +48,9 @@ public interface ModuleType { * 小智、天气、时间等 */ int TYPE_EXTENSION = 8; + + /** + * 操作快捷入口 + */ + int TYPE_ENTRANCE = 9; } diff --git a/modules/mogo-module-extensions/build.gradle b/modules/mogo-module-extensions/build.gradle index fc86f87817..8b4348232b 100644 --- a/modules/mogo-module-extensions/build.gradle +++ b/modules/mogo-module-extensions/build.gradle @@ -27,13 +27,16 @@ android { } } + compileOptions { + targetCompatibility 1.8 + sourceCompatibility 1.8 + } + } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation rootProject.ext.dependencies.androidxappcompat implementation rootProject.ext.dependencies.androidxconstraintlayout implementation rootProject.ext.dependencies.arouter diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/ExtensionsModuleConst.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/ExtensionsModuleConst.java index 7cf63d02b0..2d86954222 100644 --- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/ExtensionsModuleConst.java +++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/ExtensionsModuleConst.java @@ -8,9 +8,19 @@ package com.mogo.module.extensions; */ public class ExtensionsModuleConst { + /** + * 顶部UI + */ public static final String PATH_EXTENSION = "/extension/ui"; + /** + * 快捷操作入口:定位、 + */ + public static final String PATH_ENTRANCE = "/extension/entrance"; + public static final String TYPE = "extension"; + public static final String TYPE_ENTRANCE = "entrance"; + } diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/ExtensionsModuleProvider.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/ExtensionsModuleProvider.java index 2a9ff20faf..991ef5d737 100644 --- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/ExtensionsModuleProvider.java +++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/ExtensionsModuleProvider.java @@ -10,6 +10,7 @@ import androidx.fragment.app.Fragment; import com.alibaba.android.arouter.facade.annotation.Route; import com.mogo.map.listener.IMogoMapListener; import com.mogo.map.location.IMogoLocationListener; +import com.mogo.map.marker.IMogoMarkerClickListener; import com.mogo.map.navi.IMogoNaviListener; import com.mogo.service.module.IMogoModuleLifecycle; import com.mogo.service.module.IMogoModuleProvider; @@ -71,4 +72,9 @@ public class ExtensionsModuleProvider implements IMogoModuleProvider { public void init( Context context ) { } + + @Override + public IMogoMarkerClickListener getMarkerClickListener() { + return null; + } } diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/ExtensionsPresenter.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/ExtensionsPresenter.java index 682a3ea9eb..c668d6baf8 100644 --- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/ExtensionsPresenter.java +++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/ExtensionsPresenter.java @@ -104,7 +104,7 @@ public class ExtensionsPresenter extends Presenter< ExtensionsView > implements String temp = getContext().getResources().getString( R.string.module_ext_str_weather_temp_format, weatherInfo.getTemperature() ); Phenomena phenomena = Phenomena.getById( weatherInfo.getPhenomena() ); String desc = phenomena == null ? "" : phenomena.nameCn; - int resId = 0; + int resId = phenomena.resId; mView.renderWeatherInfo( temp, desc, resId ); } diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java new file mode 100644 index 0000000000..34d5cd812c --- /dev/null +++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java @@ -0,0 +1,155 @@ +package com.mogo.module.extensions.entrance; + +import android.app.Activity; +import android.graphics.Color; +import android.graphics.drawable.ColorDrawable; +import android.os.Bundle; +import android.view.View; +import android.view.ViewGroup; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +import com.alibaba.android.arouter.launcher.ARouter; +import com.mogo.commons.mvp.MvpFragment; +import com.mogo.commons.mvp.Presenter; +import com.mogo.map.MogoLatLng; +import com.mogo.map.location.IMogoLocationClient; +import com.mogo.map.location.MogoLocation; +import com.mogo.map.navi.IMogoNavi; +import com.mogo.map.navi.IMogoNaviListener; +import com.mogo.map.navi.MogoNaviInfo; +import com.mogo.map.uicontroller.IMogoMapUIController; +import com.mogo.module.extensions.R; +import com.mogo.module.extensions.navi.NaviInfoView; +import com.mogo.service.MogoServicePaths; +import com.mogo.service.map.IMogoMapService; + +/** + * @author congtaowang + * @since 2020-01-07 + *

+ * 描述 + */ +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 -> { + + ViewGroup group = ( ( Activity ) getContext() ).findViewById( android.R.id.content ); + final View child = new View(getContext()); + child.setBackground( new ColorDrawable( Color.RED ) ); + group.addView( child ); + } ); + + 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 { + + public EntrancePresenter( EntranceView view ) { + super( view ); + } +} diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceProvider.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceProvider.java new file mode 100644 index 0000000000..6e818b3d9c --- /dev/null +++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceProvider.java @@ -0,0 +1,81 @@ +package com.mogo.module.extensions.entrance; + +import android.content.Context; +import android.os.Bundle; +import android.view.View; + +import androidx.annotation.NonNull; +import androidx.fragment.app.Fragment; + +import com.alibaba.android.arouter.facade.annotation.Route; +import com.mogo.map.listener.IMogoMapListener; +import com.mogo.map.location.IMogoLocationListener; +import com.mogo.map.marker.IMogoMarkerClickListener; +import com.mogo.map.navi.IMogoNaviListener; +import com.mogo.module.extensions.ExtensionsModuleConst; +import com.mogo.service.module.IMogoModuleLifecycle; +import com.mogo.service.module.IMogoModuleProvider; +import com.mogo.service.module.ModuleType; + +/** + * @author congtaowang + * @since 2020-01-07 + *

+ * 描述 + */ +@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 ) { + + } + + @Override + public IMogoMarkerClickListener getMarkerClickListener() { + return null; + } +} 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/net/NetApiServices.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/net/NetApiServices.java new file mode 100644 index 0000000000..6a553dd22b --- /dev/null +++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/net/NetApiServices.java @@ -0,0 +1,25 @@ +package com.mogo.module.extensions.net; + +import com.mogo.module.extensions.weather.WebWeatherData; + +import io.reactivex.Observer; +import retrofit2.http.GET; +import retrofit2.http.Query; + +/** + * @author congtaowang + * @since 2020-01-07 + *

+ * 描述 + */ +public interface NetApiServices { + + /** + * 天气接口 + * + * @param area 城市Id + * @return + */ + @GET( "/common/?type=observe&key=a2c37c5b84a29761bf0abf8b98e6b708" ) + Observer< WebWeatherData > requestWeatherData( @Query( "area" ) String area ); +} 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/java/com/mogo/module/extensions/weather/WebWeatherData.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/weather/WebWeatherData.java new file mode 100644 index 0000000000..57235ac0b5 --- /dev/null +++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/weather/WebWeatherData.java @@ -0,0 +1,47 @@ +package com.mogo.module.extensions.weather; + +import com.google.gson.annotations.SerializedName; + +/** + * @author congtaowang + * @since 2020-01-07 + *

+ * 天气数据描述 + */ +public class WebWeatherData { + + @SerializedName( "observe" ) + public ObserveDataType observe; + + /** + * 实时数据 + */ + public static class ObserveDataType { + @SerializedName( "101010200" ) + public ObserveData data; + } + + /** + * 实时数据对象 + */ + public static class ObserveData { + @SerializedName( "1001002" ) + public Data data; + } + + /** + * what the fuck. + */ + public static class Data { + @SerializedName( "000" ) + public String time; + @SerializedName( "001" ) + public String phenomena; + @SerializedName( "002" ) + public String temperature; + @SerializedName( "003" ) + public String windForce; + @SerializedName( "004" ) + public String windDirection; + } +} 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 @@ + + + + + + + + + \ No newline at end of file diff --git a/modules/mogo-module-extensions/src/main/res/drawable/module_map_dw_navi_info_panel_bkg.xml b/modules/mogo-module-extensions/src/main/res/drawable/module_map_dw_navi_info_panel_bkg.xml new file mode 100644 index 0000000000..f21cba570e --- /dev/null +++ b/modules/mogo-module-extensions/src/main/res/drawable/module_map_dw_navi_info_panel_bkg.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/modules/mogo-module-map/src/main/res/drawable/module_map_dw_upload_road_condition_bkg.xml b/modules/mogo-module-extensions/src/main/res/drawable/module_map_dw_upload_road_condition_bkg.xml similarity index 100% rename from modules/mogo-module-map/src/main/res/drawable/module_map_dw_upload_road_condition_bkg.xml rename to modules/mogo-module-extensions/src/main/res/drawable/module_map_dw_upload_road_condition_bkg.xml diff --git a/modules/mogo-module-extensions/src/main/res/layout/module_ext_layout_entrance.xml b/modules/mogo-module-extensions/src/main/res/layout/module_ext_layout_entrance.xml new file mode 100644 index 0000000000..7b3d2a893d --- /dev/null +++ b/modules/mogo-module-extensions/src/main/res/layout/module_ext_layout_entrance.xml @@ -0,0 +1,149 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/modules/mogo-module-extensions/src/main/res/layout/module_ext_layout_extensions.xml b/modules/mogo-module-extensions/src/main/res/layout/module_ext_layout_extensions.xml index 05ec75c36a..758656e960 100644 --- a/modules/mogo-module-extensions/src/main/res/layout/module_ext_layout_extensions.xml +++ b/modules/mogo-module-extensions/src/main/res/layout/module_ext_layout_extensions.xml @@ -4,6 +4,7 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="@dimen/dp_120" + android:background="#0C0C0C " android:orientation="vertical" android:paddingLeft="@dimen/dp_70" android:paddingRight="@dimen/dp_70"> @@ -13,6 +14,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/module_ext_ic_voice" + app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintTop_toTopOf="parent" /> @@ -24,9 +26,9 @@ android:text="@string/module_ext_str_voice_msg" android:textColor="@color/module_ext_color_voice_text" android:textSize="@dimen/dp_32" - app:layout_constraintBottom_toBottomOf="@+id/module_ext_id_voice" + app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toRightOf="@+id/module_ext_id_voice" - app:layout_constraintTop_toTopOf="@+id/module_ext_id_voice" /> + app:layout_constraintTop_toTopOf="parent" /> + + + + + + + + + + + + \ No newline at end of file diff --git a/modules/mogo-module-extensions/src/main/res/values/strings.xml b/modules/mogo-module-extensions/src/main/res/values/strings.xml index 09466eae59..c64b22ee19 100644 --- a/modules/mogo-module-extensions/src/main/res/values/strings.xml +++ b/modules/mogo-module-extensions/src/main/res/values/strings.xml @@ -14,4 +14,7 @@ 周六 ··· + + 搜索目的地 + 上报\n路况 diff --git a/modules/mogo-module-main/src/main/java/com/mogo/module/main/MainActivity.java b/modules/mogo-module-main/src/main/java/com/mogo/module/main/MainActivity.java index 5d96764978..897daa5f61 100644 --- a/modules/mogo-module-main/src/main/java/com/mogo/module/main/MainActivity.java +++ b/modules/mogo-module-main/src/main/java/com/mogo/module/main/MainActivity.java @@ -4,7 +4,6 @@ import android.os.Bundle; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import androidx.viewpager.widget.ViewPager; import com.alibaba.android.arouter.launcher.ARouter; import com.mogo.commons.mvp.MvpActivity; @@ -13,14 +12,18 @@ import com.mogo.map.location.IMogoLocationListener; import com.mogo.map.location.MogoLocation; import com.mogo.map.marker.IMogoMarker; import com.mogo.map.marker.IMogoMarkerClickListener; +import com.mogo.map.uicontroller.IMogoMapUIController; import com.mogo.module.common.MogoModule; import com.mogo.module.common.MogoModulePaths; import com.mogo.module.extensions.ExtensionsModuleConst; import com.mogo.module.main.cards.CardModulesAdapter; import com.mogo.module.main.cards.MogoModulesHandler; import com.mogo.module.main.cards.MogoModulesManager; +import com.mogo.module.main.cards.OnPageChangeListenerAdapter; import com.mogo.module.main.cards.OrientedViewPager; import com.mogo.module.main.cards.VerticalStackTransformer; +import com.mogo.module.main.fragmentmanager.FragmentStack; +import com.mogo.module.service.MarkerServiceHandler; import com.mogo.module.service.ServiceConst; import com.mogo.service.MogoServicePaths; import com.mogo.service.connection.IMogoSocketManager; @@ -34,7 +37,7 @@ import java.util.List; * @author congtaowang * @since 2019-12-23 *

- * 描述 + * 描述:加载各个模块 */ public class MainActivity extends MvpActivity< MainView, MainPresenter > implements MainView, IMogoLocationListener, @@ -43,6 +46,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme private static final String TAG = "MainActivity"; private IMogoMapService mMogoMapService; + private IMogoMapUIController mMogoMapUIController; private MogoModulesHandler mMogoModuleHandler; private IMogoSocketManager mMogoSocketManager; @@ -67,13 +71,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,20 +81,9 @@ 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 ); -// } - } - } } ); + + FragmentStack.getInstance().init( this, R.id.module_main_id_search_fragment ); } @Override @@ -107,6 +94,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(); @@ -116,18 +104,23 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme mMogoMapService.getHostListenerRegister().registerMarkerClickListener( this ); } + mMogoMapUIController = mMogoMapService.getMapUIController(); + mMogoModuleHandler.loadModules(); mMogoModuleHandler.onMapLoadedCallback( new Runnable() { @Override public void run() { Logger.d( TAG, "map loaded." + Thread.currentThread().getName() ); loadModules(); + + mMogoMapUIController.setPointToCenter( 0.66145, 0.590688 ); } } ); // 加载地图,触发地图加载完毕回调,在初始化其他卡片模块,保证卡片模块可以正确获取地图相关服务。 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 +156,30 @@ 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 + public void onBackPressed() { + super.onBackPressed(); + if ( getSupportFragmentManager().getBackStackEntryCount() > 0 ) { + getSupportFragmentManager().popBackStack(); + } + } + @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/fragmentmanager/FragmentStack.java b/modules/mogo-module-main/src/main/java/com/mogo/module/main/fragmentmanager/FragmentStack.java new file mode 100644 index 0000000000..42d6b9c350 --- /dev/null +++ b/modules/mogo-module-main/src/main/java/com/mogo/module/main/fragmentmanager/FragmentStack.java @@ -0,0 +1,114 @@ +package com.mogo.module.main.fragmentmanager; + +import android.app.Activity; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentTransaction; + +import com.mogo.utils.logger.Logger; + +import java.util.Stack; + +/** + * @author congtaowang + * @since 2020-01-08 + *

+ * fragment 任务栈 + */ +public class FragmentStack { + + private static final String TAG = "FragmentStack"; + + private static volatile FragmentStack sInstance; + + private Stack< Fragment > mFragmentStack = new Stack<>(); + private FragmentManager mFragmentManager; + private FragmentTransaction mFragmentTransaction; + private int mContainerId; + private Activity mActivity; + private Fragment mCurrentFragment; + + private FragmentStackTransactionListener mFragmentStackTransactionListener; + + private FragmentStack() { + } + + public static FragmentStack getInstance() { + if ( sInstance == null ) { + synchronized ( FragmentStack.class ) { + if ( sInstance == null ) { + sInstance = new FragmentStack(); + } + } + } + return sInstance; + } + + public synchronized void release() { + sInstance = null; + } + + public void init( AppCompatActivity activity, int containerId ) { + mActivity = activity; + mFragmentManager = activity.getSupportFragmentManager(); + mContainerId = containerId; + mFragmentTransaction = mFragmentManager.beginTransaction(); + } + + public void push( Fragment fragment, String tag ) { + if ( fragment == null ) { + return; + } + if ( mFragmentStack.contains( fragment ) ) { + Logger.w( TAG, "fragment has already in stack." ); + return; + } + if ( mCurrentFragment != null ) { + mFragmentTransaction.hide( mCurrentFragment ); + } + mFragmentTransaction.add( mContainerId, fragment, tag ); + mFragmentTransaction.addToBackStack( null ); + mFragmentTransaction.commitAllowingStateLoss(); + mFragmentStack.push( fragment ); + mCurrentFragment = fragment; + + if ( getFragmentStackTransactionListener() != null ) { + getFragmentStackTransactionListener().onTransaction(); + } + } + + public void pop() { + if ( mCurrentFragment != null ) { + mFragmentTransaction.remove( mCurrentFragment ); + } + if ( mFragmentStack.isEmpty() ) { + mFragmentTransaction.commitAllowingStateLoss(); + mCurrentFragment = null; + } else { + Fragment fragment = mFragmentStack.pop(); + if ( fragment != null ) { + mFragmentTransaction.show( fragment ); + mFragmentTransaction.commitAllowingStateLoss(); + } + mCurrentFragment = fragment; + } + + if ( getFragmentStackTransactionListener() != null ) { + getFragmentStackTransactionListener().onTransaction(); + } + } + + public boolean isEmpty() { + return mFragmentStack.isEmpty(); + } + + public FragmentStackTransactionListener getFragmentStackTransactionListener() { + return mFragmentStackTransactionListener; + } + + public void setFragmentStackTransactionListener( FragmentStackTransactionListener fragmentStackTransactionListener ) { + this.mFragmentStackTransactionListener = fragmentStackTransactionListener; + } +} diff --git a/modules/mogo-module-main/src/main/java/com/mogo/module/main/fragmentmanager/FragmentStackTransactionListener.java b/modules/mogo-module-main/src/main/java/com/mogo/module/main/fragmentmanager/FragmentStackTransactionListener.java new file mode 100644 index 0000000000..628a6ec496 --- /dev/null +++ b/modules/mogo-module-main/src/main/java/com/mogo/module/main/fragmentmanager/FragmentStackTransactionListener.java @@ -0,0 +1,12 @@ +package com.mogo.module.main.fragmentmanager; + +/** + * @author congtaowang + * @since 2020-01-08 + *

+ * fragment 栈发生变化 + */ +public interface FragmentStackTransactionListener { + + void onTransaction(); +} diff --git a/modules/mogo-module-main/src/main/java/com/mogo/module/main/fragmentmanager/MogoFragmentManager.java b/modules/mogo-module-main/src/main/java/com/mogo/module/main/fragmentmanager/MogoFragmentManager.java new file mode 100644 index 0000000000..40a364fdb9 --- /dev/null +++ b/modules/mogo-module-main/src/main/java/com/mogo/module/main/fragmentmanager/MogoFragmentManager.java @@ -0,0 +1,34 @@ +package com.mogo.module.main.fragmentmanager; + +import android.content.Context; + +import androidx.fragment.app.Fragment; + +import com.alibaba.android.arouter.facade.annotation.Route; +import com.mogo.service.MogoServicePaths; +import com.mogo.service.fragmentmanager.IMogoFragmentManager; + +/** + * @author congtaowang + * @since 2020-01-08 + *

+ * 描述 + */ +@Route( path = MogoServicePaths.PATH_FRAGMENT_MANAGER ) +public class MogoFragmentManager implements IMogoFragmentManager { + + @Override + public void push( Fragment fragment, String tag ) { + FragmentStack.getInstance().push( fragment, tag ); + } + + @Override + public void pop() { + FragmentStack.getInstance().pop(); + } + + @Override + public void init( Context context ) { + + } +} 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..5fa6036a70 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,65 @@ - - + + android:layout_height="match_parent" + app:layout_constraintLeft_toRightOf="@+id/module_main_id_fragment_container" + app:layout_constraintRight_toRightOf="parent" /> - + android:orientation="vertical"> + + app:layout_constraintTop_toTopOf="parent" /> - - - - - + android:layout_marginTop="@dimen/dp_10"> + + + + + + + + + + - \ No newline at end of file + + + \ No newline at end of file diff --git a/modules/mogo-module-map/src/main/java/com/mogo/module/map/MapFragment.java b/modules/mogo-module-map/src/main/java/com/mogo/module/map/MapFragment.java index ae1c0af2e7..24e6b114d6 100644 --- a/modules/mogo-module-map/src/main/java/com/mogo/module/map/MapFragment.java +++ b/modules/mogo-module-map/src/main/java/com/mogo/module/map/MapFragment.java @@ -1,23 +1,14 @@ package com.mogo.module.map; import android.os.Bundle; -import android.view.View; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import com.alibaba.android.arouter.launcher.ARouter; import com.mogo.commons.mvp.MvpFragment; import com.mogo.map.IMogoMap; import com.mogo.map.IMogoUiSettings; -import com.mogo.map.MogoLatLng; import com.mogo.map.MogoMapView; -import com.mogo.map.location.IMogoLocationClient; -import com.mogo.map.location.MogoLocation; -import com.mogo.map.uicontroller.IMogoMapUIController; -import com.mogo.module.common.MogoModulePaths; -import com.mogo.service.MogoServicePaths; -import com.mogo.service.map.IMogoMapService; /** * @author congtaowang @@ -32,20 +23,6 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter > implements private MogoMapView mMogoMapView; private IMogoMap mMogoMap; - private View mSearch; - private View mHome; - - private View mCompany; - - private View mUploadRoadCondition; - - private View mVRMode; - private View mMove2CurrentLocation; - - private IMogoMapService mService; - private IMogoMapUIController mMApUIController; - private IMogoLocationClient mMogoLocationClient; - @Override protected int getLayoutId() { return R.layout.module_map_fragment_map; @@ -56,35 +33,6 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter > implements mMogoMapView = findViewById( R.id.module_map_id_map ); mMogoMap = mMogoMapView.getMap(); mMogoMap.getUIController().showMyLocation( true ); - - mSearch = findViewById( R.id.module_map_id_search ); - mSearch.setOnClickListener( view -> { - ARouter.getInstance().build(MogoModulePaths.PATH_MODULE_NAV_ACTIVITY).navigation(getActivity()); - } ); - - 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() ) ); - } - } ); } @NonNull @@ -100,9 +48,6 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter > implements mMogoMapView.onCreate( savedInstanceState ); } initMapView(); - mService = ( IMogoMapService ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICES_MAP ).navigation( getContext() ); - mMApUIController = mService.getMapUIController(); - mMogoLocationClient = mService.getLocationClient( getContext() ); } @Override diff --git a/modules/mogo-module-map/src/main/java/com/mogo/module/map/MapFragmentProvider.java b/modules/mogo-module-map/src/main/java/com/mogo/module/map/MapFragmentProvider.java index c35cfb054a..86038c722e 100644 --- a/modules/mogo-module-map/src/main/java/com/mogo/module/map/MapFragmentProvider.java +++ b/modules/mogo-module-map/src/main/java/com/mogo/module/map/MapFragmentProvider.java @@ -10,6 +10,7 @@ import androidx.fragment.app.Fragment; import com.alibaba.android.arouter.facade.annotation.Route; import com.mogo.map.listener.IMogoMapListener; import com.mogo.map.location.IMogoLocationListener; +import com.mogo.map.marker.IMogoMarkerClickListener; import com.mogo.map.navi.IMogoNaviListener; import com.mogo.module.common.MogoModulePaths; import com.mogo.service.module.IMogoModuleLifecycle; @@ -75,4 +76,9 @@ public class MapFragmentProvider implements IMogoModuleProvider { public IMogoLocationListener getLocationListener() { return null; } + + @Override + public IMogoMarkerClickListener getMarkerClickListener() { + return null; + } } diff --git a/modules/mogo-module-map/src/main/res/layout/module_map_fragment_map.xml b/modules/mogo-module-map/src/main/res/layout/module_map_fragment_map.xml index 038b269721..30ae83c338 100644 --- a/modules/mogo-module-map/src/main/res/layout/module_map_fragment_map.xml +++ b/modules/mogo-module-map/src/main/res/layout/module_map_fragment_map.xml @@ -9,120 +9,4 @@ android:layout_width="match_parent" android:layout_height="match_parent" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/mogo-module-map/src/main/res/values/strings.xml b/modules/mogo-module-map/src/main/res/values/strings.xml index 344eed0558..fab4c86972 100644 --- a/modules/mogo-module-map/src/main/res/values/strings.xml +++ b/modules/mogo-module-map/src/main/res/values/strings.xml @@ -1,5 +1,3 @@ mogo-module-map - 搜索目的地 - 上报\n路况 diff --git a/modules/mogo-module-search/src/main/java/com/mogo/module/navi/ui/search/SearchFragmentProvider.java b/modules/mogo-module-search/src/main/java/com/mogo/module/navi/ui/search/SearchFragmentProvider.java index faa155aa31..8c8bb585fa 100644 --- a/modules/mogo-module-search/src/main/java/com/mogo/module/navi/ui/search/SearchFragmentProvider.java +++ b/modules/mogo-module-search/src/main/java/com/mogo/module/navi/ui/search/SearchFragmentProvider.java @@ -8,6 +8,7 @@ import androidx.fragment.app.Fragment; import com.alibaba.android.arouter.facade.annotation.Route; import com.mogo.map.listener.IMogoMapListener; import com.mogo.map.location.IMogoLocationListener; +import com.mogo.map.marker.IMogoMarkerClickListener; import com.mogo.map.navi.IMogoNaviListener; import com.mogo.module.common.MogoModulePaths; import com.mogo.service.module.IMogoModuleLifecycle; @@ -73,4 +74,9 @@ public class SearchFragmentProvider implements IMogoModuleProvider { public void init( Context context ) { } + + @Override + public IMogoMarkerClickListener getMarkerClickListener() { + return null; + } } diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/MarkerServiceHandler.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/MarkerServiceHandler.java new file mode 100644 index 0000000000..0f9c08acef --- /dev/null +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/MarkerServiceHandler.java @@ -0,0 +1,66 @@ +package com.mogo.module.service; + +import android.content.Context; + +import com.alibaba.android.arouter.launcher.ARouter; +import com.mogo.map.marker.IMogoMarkerManager; +import com.mogo.module.service.entity.MarkerResponse; +import com.mogo.service.MogoServicePaths; +import com.mogo.service.connection.IMogoOnMessageListener; +import com.mogo.service.connection.IMogoSocketManager; +import com.mogo.service.imageloader.IMogoImageloader; +import com.mogo.service.map.IMogoMapService; +import com.mogo.utils.logger.Logger; + +/** + * author : donghongyu + * e-mail : 1358506549@qq.com + * date : 2020-01-0718:54 + * desc : 持有服务接口实例 + * version: 1.0 + */ +public class MarkerServiceHandler { + + private static IMogoMapService mMapService; + private static IMogoMarkerManager mMarkerManager; + private static IMogoImageloader mImageloader; + private static IMogoSocketManager mMogoSocketManager; + + public static void init(Context context) { + mMapService = (IMogoMapService) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICES_MAP).navigation(context); + mImageloader = (IMogoImageloader) ARouter.getInstance().build(MogoServicePaths.PATH_UTILS_IMAGE_LOADER).navigation(context); + mMarkerManager = mMapService.getMarkerManager(context); + + mMogoSocketManager = (IMogoSocketManager) ARouter.getInstance().build(MogoServicePaths.PATH_SOCKET_MANAGER).navigation(); + mMogoSocketManager.registerOnMessageListener(401001, new IMogoOnMessageListener() { + + @Override + public Class target() { + return MarkerResponse.class; + } + + @Override + public void onMsgReceived(MarkerResponse obj) { + Logger.e("donghongyu", "===" + obj); + } + + }); + } + + public static IMogoMapService getMapService() { + return mMapService; + } + + public static IMogoMarkerManager getMarkerManager() { + return mMarkerManager; + } + + public static IMogoImageloader getImageloader() { + return mImageloader; + } + + public static IMogoSocketManager getMogoSocketManager() { + return mMogoSocketManager; + } + +} diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServiceProvider.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServiceProvider.java index b95d9e0004..0d41f56a8c 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServiceProvider.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServiceProvider.java @@ -18,6 +18,7 @@ import com.mogo.map.MogoLatLng; import com.mogo.map.listener.IMogoMapListener; import com.mogo.map.location.IMogoLocationListener; import com.mogo.map.location.MogoLocation; +import com.mogo.map.marker.IMogoMarkerClickListener; import com.mogo.map.marker.IMogoMarkerManager; import com.mogo.map.model.MogoPoi; import com.mogo.map.navi.IMogoNaviListener; @@ -204,6 +205,9 @@ public class MogoServiceProvider implements IMogoModuleProvider, mUiController = mMogoMapService.getMapUIController(); mStatusManager = ( IMogoStatusManager ) ARouter.getInstance().build( MogoServicePaths.PATH_STATUS_MANAGER ).navigation( context ); mStatusManager.registerStatusChangedListener( ServiceConst.TYPE, StatusDescriptor.USER_INTERACTED, this ); + + //TODO 初始化地图地图绘制大而全的Marker + MarkerServiceHandler.init(mContext); } @Override @@ -418,4 +422,9 @@ public class MogoServiceProvider implements IMogoModuleProvider, mRefreshRemainingTime += mAutoRefreshStrategy.getInterruptInterval(); } } + + @Override + public IMogoMarkerClickListener getMarkerClickListener() { + return null; + } } diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/entity/MarkerLocation.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/entity/MarkerLocation.java index e48747e67f..d9f1b04e22 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/entity/MarkerLocation.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/entity/MarkerLocation.java @@ -11,9 +11,9 @@ public class MarkerLocation { @SerializedName("angle") private String mAngle; @SerializedName("lat") - private String mLat; + private double mLat; @SerializedName("lon") - private String mLon; + private double mLon; public String getAddress() { return mAddress; @@ -31,19 +31,19 @@ public class MarkerLocation { mAngle = angle; } - public String getLat() { + public double getLat() { return mLat; } - public void setLat(String lat) { + public void setLat(double lat) { mLat = lat; } - public String getLon() { + public double getLon() { return mLon; } - public void setLon(String lon) { + public void setLon(double lon) { mLon = lon; } diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/entity/MarkerResponse.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/entity/MarkerResponse.java index 0591349344..b86a116671 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/entity/MarkerResponse.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/entity/MarkerResponse.java @@ -47,4 +47,13 @@ public class MarkerResponse { mSign = sign; } + @Override + public String toString() { + return "MarkerResponse{" + + "mCode=" + mCode + + ", mMsg='" + mMsg + '\'' + + ", mResult=" + mResult + + ", mSign='" + mSign + '\'' + + '}'; + } } diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/entity/MarkerUserInfo.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/entity/MarkerUserInfo.java index c0d7c20577..89274f1187 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/entity/MarkerUserInfo.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/entity/MarkerUserInfo.java @@ -3,11 +3,13 @@ package com.mogo.module.service.entity; import com.google.gson.annotations.SerializedName; +import java.util.Calendar; + @SuppressWarnings("unused") public class MarkerUserInfo { @SerializedName("age") - private String mAge; + private int mAge; @SerializedName("gender") private int mGender; @SerializedName("sn") @@ -20,10 +22,56 @@ public class MarkerUserInfo { private String mUserName; public String getAge() { - return mAge; + Calendar cal = Calendar.getInstance(); + int year = cal.get(Calendar.YEAR); + + //2020-30=1990 + int age = year - mAge; + String ageStr = "" + age; + char[] ageChars = ageStr.toCharArray(); + + //1990 + char ageChar = ageChars[2]; + + String ageString = "未知"; + + switch (ageChar) { + case '0': + ageString = "00后"; + break; + case '1': + ageString = "10后"; + break; + case '2': + ageString = "20后"; + break; + case '3': + ageString = "30后"; + break; + case '4': + ageString = "40后"; + break; + case '5': + ageString = "50后"; + break; + case '6': + ageString = "60后"; + break; + case '7': + ageString = "70后"; + break; + case '8': + ageString = "80后"; + break; + case '9': + ageString = "90后"; + break; + } + + return ageString; } - public void setAge(String age) { + public void setAge(int age) { mAge = age; } diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/network/RefreshApiService.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/network/RefreshApiService.java index d7327c28dc..06a99a2843 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/network/RefreshApiService.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/network/RefreshApiService.java @@ -22,6 +22,6 @@ public interface RefreshApiService { @FormUrlEncoded @POST( "/yycp-launcherSnapshot/launcherSnapshot/querySnapshotAsync" ) - Observable< BaseData > refreshData( @QueryMap Map< String, Object > params, + Observable< BaseData > refreshData( @FieldMap Map< String, Object > parameters ); } diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/network/RefreshBody.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/network/RefreshBody.java index 2200ed394a..11f0d33453 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/network/RefreshBody.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/network/RefreshBody.java @@ -11,7 +11,7 @@ import java.util.List; */ public class RefreshBody { - public List< String > dataType = new ArrayList<>(); +// public List< String > dataType = new ArrayList<>(); public int limit = 50;// 请求数量 public int radius = 2_000; // 地理围栏半径(米) public LatLon location; diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/network/RefreshModel.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/network/RefreshModel.java index 004825d28f..477a9c25a4 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/network/RefreshModel.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/network/RefreshModel.java @@ -4,6 +4,7 @@ import android.content.Context; import com.alibaba.android.arouter.launcher.ARouter; import com.mogo.commons.data.BaseData; +import com.mogo.commons.debug.DebugConfig; import com.mogo.commons.network.ParamsProvider; import com.mogo.commons.network.SubscribeImpl; import com.mogo.commons.network.Utils; @@ -28,13 +29,28 @@ import io.reactivex.schedulers.Schedulers; */ public class RefreshModel { + public static final String HOST_DEV = "http://dzt-test.zhidaohulian.com"; + public static final String HOST_TEST = "http://dzt-test.zhidaohulian.com"; + public static final String HOST_PRODUCT = "https://dzt.zhidaohulian.com"; + private final Context mContext; private RefreshApiService mRefreshApiService; public RefreshModel( Context context ) { this.mContext = context; IMogoNetwork network = ( IMogoNetwork ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICES_NETWORK ).navigation( context ); - this.mRefreshApiService = network.create( RefreshApiService.class, "http://www.baidu.com/" ); + this.mRefreshApiService = network.create( RefreshApiService.class, getNetHost() ); + } + + private String getNetHost() { + switch ( DebugConfig.getNetMode() ) { + case DebugConfig.NET_MODE_DEV: + return HOST_DEV; + case DebugConfig.NET_MODE_QA: + return HOST_TEST; + default: + return HOST_PRODUCT; + } } public void refreshData( MogoLatLng latLng, int radius, final RefreshCallback callback ) { @@ -47,7 +63,7 @@ public class RefreshModel { refreshBody.location = new RefreshBody.LatLon( latLng.lat, latLng.lng ); refreshBody.radius = radius; field.put( "data", GsonUtil.jsonFromObject( refreshBody ) ); - mRefreshApiService.refreshData( query, field ) + mRefreshApiService.refreshData( field ) .subscribeOn( Schedulers.io() ) .observeOn( AndroidSchedulers.mainThread() ) .subscribe( new SubscribeImpl< BaseData >( RequestOptions.create( mContext ) ) { diff --git a/modules/mogo-module-tanlu/src/androidTest/java/com/zhidao/tanlu/ExampleInstrumentedTest.java b/modules/mogo-module-tanlu/src/androidTest/java/com/zhidao/tanlu/ExampleInstrumentedTest.java deleted file mode 100644 index 51d57e90b8..0000000000 --- a/modules/mogo-module-tanlu/src/androidTest/java/com/zhidao/tanlu/ExampleInstrumentedTest.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.zhidao.tanlu; - -import android.content.Context; - -import androidx.test.platform.app.InstrumentationRegistry; -import androidx.test.ext.junit.runners.AndroidJUnit4; - -import org.junit.Test; -import org.junit.runner.RunWith; - -import static org.junit.Assert.*; - -/** - * Instrumented test, which will execute on an Android device. - * - * @see Testing documentation - */ -@RunWith(AndroidJUnit4.class) -public class ExampleInstrumentedTest { - @Test - public void useAppContext() { - // Context of the app under test. - Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); - - assertEquals("com.zhidao.tanlu.test", appContext.getPackageName()); - } -} diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/tanlu/fragment/TanluCardViewFragment.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/tanlu/fragment/TanluCardViewFragment.java index 3abfaf7578..5c6975ad1d 100644 --- a/modules/mogo-module-tanlu/src/main/java/com/mogo/tanlu/fragment/TanluCardViewFragment.java +++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/tanlu/fragment/TanluCardViewFragment.java @@ -2,8 +2,10 @@ package com.mogo.tanlu.fragment; import android.graphics.Bitmap; import android.os.Bundle; +import android.text.Html; import android.view.MotionEvent; import android.view.View; +import android.widget.RelativeLayout; import android.widget.TextView; import androidx.annotation.NonNull; @@ -39,6 +41,7 @@ import com.mogo.utils.TipToast; import com.mogo.utils.logger.Logger; import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder; +import java.util.ArrayList; import java.util.List; import static com.mogo.tanlu.video.VideoInitKt.initVideo; @@ -61,21 +64,28 @@ public class TanluCardViewFragment extends MvpFragment> //map private IMogoMarker mPoiMarker; - // private int position = -1; private IMogoMarkerManager mMarkerManager; private IMogoMapService mMogoMapService; //media private GSYVideoOptionBuilder gsyVideoOptionBuilder = new GSYVideoOptionBuilder(); - private String videoUrl = "http://ivi.bupt.edu.cn/hls/cctv1hd.m3u8"; - private String imageUrl = "https://oimagec4.ydstatic.com/image?id=-5397300958976572132&product=adpublish&w=520&h=347"; + private String mVideoUrl = "http://ivi.bupt.edu.cn/hls/cctv1hd.m3u8"; + private String mImageUrl = "https://oimagec4.ydstatic.com/image?id=-5397300958976572132&product=adpublish&w=520&h=347"; SimpleCoverVideoPlayer simpleCoverVideoPlayer; AutoZoomInImageView autoZoomInImageView; private IMogoImageloader mogoImageloader; private TextView mPreviousTv; private TextView mNextTv; + private RelativeLayout mRootLayout; + private RelativeLayout mEmptyLayout; + private TextView mEmptyTv; + private TextView mAddressTv; + private TextView mDistanceTv; + private TextView mTimeTv; + + private List markerExploreWayList = new ArrayList<>(); + private int currentPosition = -1; //卡片媒体当前位置 - private List markerExploreWayList; @Override protected int getLayoutId() { @@ -89,21 +99,29 @@ public class TanluCardViewFragment extends MvpFragment> autoZoomInImageView = findViewById(R.id.tanlu_photo_imageView); mPreviousTv = findViewById(R.id.tv_previous_res); mNextTv = findViewById(R.id.tv_next_res); + mRootLayout = findViewById(R.id.layout_data_show); + mEmptyLayout = findViewById(R.id.layout_empty_data_show); + mEmptyTv = findViewById(R.id.tv_main_empty); + mAddressTv = findViewById(R.id.tv_information_media_content); + mDistanceTv = findViewById(R.id.tv_distance_video); + mTimeTv = findViewById(R.id.tv_information_media_time); + mPreviousTv.setOnClickListener(this); mNextTv.setOnClickListener(this); + mEmptyTv.setOnClickListener(this); simpleCoverVideoPlayer.setVisibility(View.VISIBLE); autoZoomInImageView.setVisibility(View.GONE); //视频配置 - gsyVideoOptionBuilder.setUrl(videoUrl).setCacheWithPlay(false).setPlayTag(TAG) + gsyVideoOptionBuilder.setUrl(mVideoUrl).setCacheWithPlay(false).setPlayTag(TAG) .build(simpleCoverVideoPlayer); // simpleCoverVideoPlayer.getStartButton().performClick(); simpleCoverVideoPlayer.getStartButton().setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Logger.d(TAG, "simpleCoverVideoPlayer onClick -------> "); - FullMediaActivity.Companion.launch(getActivity(), videoUrl, "image"); + FullMediaActivity.Companion.launch(getActivity(), mVideoUrl, "image", "东城区环球贸易中心", 1300000300); } }); @@ -111,7 +129,6 @@ public class TanluCardViewFragment extends MvpFragment> mogoImageloader = (IMogoImageloader) ARouter.getInstance().build(MogoServicePaths.PATH_UTILS_IMAGE_LOADER).navigation(); //地图marker mMogoMapService = (IMogoMapService) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICES_MAP).navigation(getActivity()); - } @Override @@ -133,17 +150,14 @@ public class TanluCardViewFragment extends MvpFragment> //判断是图片还是视频,第一个时,上一个不可点击 simpleCoverVideoPlayer.setVisibility(View.VISIBLE); autoZoomInImageView.setVisibility(View.GONE); - //视频配置 - gsyVideoOptionBuilder.setUrl(videoUrl).setCacheWithPlay(false).setPlayTag(TAG) + gsyVideoOptionBuilder.setUrl(mVideoUrl).setCacheWithPlay(false).setPlayTag(TAG) .build(simpleCoverVideoPlayer); } else if (id == R.id.tv_next_res) { //下一个 //判断是图片还是视频,最后一个时,下一个不可点击 - //图片显示 autoZoomInImageView.setVisibility(View.VISIBLE); simpleCoverVideoPlayer.setVisibility(View.GONE); -// mogoImageloader.displayImage(imageUrl, autoZoomInImageView); - mogoImageloader.downloadImage(getActivity(), imageUrl, new IMogoImageLoaderListener() { + mogoImageloader.downloadImage(getActivity(), mImageUrl, new IMogoImageLoaderListener() { @Override public void onStart() { Logger.d(TAG, "onStart ------>"); @@ -162,7 +176,8 @@ public class TanluCardViewFragment extends MvpFragment> Logger.e(TAG, "onFailure -----E->" + e); } }); - + } else if (id == R.id.tv_main_empty) { //TODO 上报路况,逻辑 + Logger.d(TAG, "tv_main_empty click -----> "); } } @@ -178,12 +193,10 @@ public class TanluCardViewFragment extends MvpFragment> .startZoomInByScaleDeltaAndDuration(0.2f, 1000, 500); } }); - } - /** - * marker点击事件 TODO + * marker点击事件 * * @param marker * @return @@ -192,23 +205,78 @@ public class TanluCardViewFragment extends MvpFragment> public boolean onMarkerClicked(IMogoMarker marker) { //点击marker以后,确认他的位置?然后点击下一个操作 MarkerExploreWay exploreWay = (MarkerExploreWay) marker.getObject(); - + if (exploreWay != null && exploreWay.getFileType() != null) { + if (exploreWay.getFileType().equals("0")) { //图片 + refreshPhotoData(exploreWay); + } else if (exploreWay.getFileType().equals("1")) { //视频 + refreshVideoData(exploreWay); + } + } else { + Logger.e(TAG, "onMarkerClicked exploreWay == null "); + } return true; } /** - * 刷新单个数据,更新位置positon TODO + * 刷新单个视频数据,更新位置positon */ -// private void refreshSingleData() { -// markerExploreWayList -// } + private void refreshVideoData(MarkerExploreWay markerExploreWay) { + if (markerExploreWay.getItems() == null) { + return; + } + + if (markerExploreWay.getItems().size() == 0) { + return; + } + + String videoUrl = markerExploreWay.getItems().get(0).getUrl(); + + //判断是图片还是视频,第一个时,上一个不可点击 + simpleCoverVideoPlayer.setVisibility(View.VISIBLE); + autoZoomInImageView.setVisibility(View.GONE); + //视频配置 + gsyVideoOptionBuilder.setUrl(videoUrl).setCacheWithPlay(false).setPlayTag(TAG) + .build(simpleCoverVideoPlayer); + + } /** - * - * @return + * 刷新单个图片数据 */ -// private void + private void refreshPhotoData(MarkerExploreWay markerExploreWay) { + if (markerExploreWay.getItems() == null) { + return; + } + + if (markerExploreWay.getItems().size() == 0) { + return; + } + + String thumbnailUrl = markerExploreWay.getItems().get(0).getThumbnail(); + Logger.d(TAG, "refreshPhotoData thumbnailUrl ------>" + thumbnailUrl); + autoZoomInImageView.setVisibility(View.VISIBLE); + simpleCoverVideoPlayer.setVisibility(View.GONE); + mogoImageloader.downloadImage(getActivity(), thumbnailUrl, new IMogoImageLoaderListener() { + @Override + public void onStart() { + Logger.d(TAG, "onStart ------>"); + } + + @Override + public void onCompleted(Bitmap bitmap) { + Logger.d(TAG, "onCompleted ------>"); + autoZoomInImageView.setImageBitmap(bitmap); + //动画 + handleImageAnimation(); + } + + @Override + public void onFailure(Exception e) { + Logger.e(TAG, "onFailure -----E->" + e); + } + }); + } @NonNull @@ -218,23 +286,53 @@ public class TanluCardViewFragment extends MvpFragment> }; } - //TODO C位事件,如何获取数据,需要有默认数据 + /** + * C位事件,如何获取数据,需要有默认数据 TODO + * 如果只有一个数据,不显示上下切换按钮,没有数据显示空页面 + */ @Override public void onPerform() { Logger.d(TAG, "tanlu卡片 有效 ---->"); mMarkerManager = mMogoMapService.getMarkerManager(getActivity()); List markers = mMarkerManager.getMarkers("CARD_TYPE_ROAD_CODITION"); - for (int i = 0; i < markers.size(); i++) { - markers.get(i).getObject(); - } + if (markers != null && markers.size() > 0) { + mEmptyLayout.setVisibility(View.GONE); + mRootLayout.setVisibility(View.VISIBLE); + Logger.d(TAG, "onPerform markers.size() =" + markers.size()); + for (int i = 0; i < markers.size(); i++) { + markerExploreWayList.add((MarkerExploreWay) markers.get(i).getObject()); + } + if (markers.size() == 1) { + mPreviousTv.setVisibility(View.GONE); + mNextTv.setVisibility(View.GONE); + } else { + mPreviousTv.setVisibility(View.VISIBLE); + mNextTv.setVisibility(View.VISIBLE); + } + + //展示第一个数据 + MarkerExploreWay markerExploreWay = markerExploreWayList.get(0); + if (markerExploreWay != null && markerExploreWay.getFileType() != null) { + if (markerExploreWay.getFileType().equals("0")) { //图片 + refreshPhotoData(markerExploreWay); + } else if (markerExploreWay.getFileType().equals("1")) { //视频 + refreshVideoData(markerExploreWay); + } + } + } else { + mEmptyLayout.setVisibility(View.VISIBLE); + mRootLayout.setVisibility(View.GONE); + mEmptyTv.setText(Html.fromHtml(getContext().getString(R.string.main_empty_content))); + } } - - //TODO 离开C位事件 + /** + * 离开C位事件 + */ @Override public void onDisable() { - Logger.e(TAG, "tanlu卡片 无效 ----->"); + Logger.d(TAG, "tanlu卡片 无效 ----->"); } @Override diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/tanlu/fragment/TanluCardViewProvider.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/tanlu/fragment/TanluCardViewProvider.java index 8710a2a56f..b804bd33e0 100644 --- a/modules/mogo-module-tanlu/src/main/java/com/mogo/tanlu/fragment/TanluCardViewProvider.java +++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/tanlu/fragment/TanluCardViewProvider.java @@ -9,6 +9,7 @@ import androidx.fragment.app.Fragment; import com.alibaba.android.arouter.facade.annotation.Route; import com.mogo.map.listener.IMogoMapListener; import com.mogo.map.location.IMogoLocationListener; +import com.mogo.map.marker.IMogoMarkerClickListener; import com.mogo.map.navi.IMogoNaviListener; import com.mogo.service.module.IMogoModuleLifecycle; import com.mogo.service.module.IMogoModuleProvider; @@ -77,4 +78,8 @@ public class TanluCardViewProvider implements IMogoModuleProvider { return fragment; } + @Override + public IMogoMarkerClickListener getMarkerClickListener() { + return null; + } } diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/tanlu/fragment/TanluInfoWindowAdapter.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/tanlu/fragment/TanluInfoWindowAdapter.java deleted file mode 100644 index 654903888b..0000000000 --- a/modules/mogo-module-tanlu/src/main/java/com/mogo/tanlu/fragment/TanluInfoWindowAdapter.java +++ /dev/null @@ -1,131 +0,0 @@ -package com.mogo.tanlu.fragment; - -import android.content.Context; -import android.graphics.Bitmap; -import android.view.LayoutInflater; -import android.view.View; -import android.widget.Button; -import android.widget.TextView; - -import com.mogo.map.marker.IMogoInfoWindowAdapter; -import com.mogo.map.marker.IMogoMarker; -import com.mogo.map.marker.MogoMarkerOptions; -import com.mogo.map.navi.IMogoNavi; -import com.mogo.map.navi.MogoNaviConfig; -import com.mogo.map.search.geo.MogoPoiItem; -import com.mogo.service.imageloader.IMogoImageLoaderListener; -import com.mogo.service.imageloader.IMogoImageloader; -import com.mogo.service.imageloader.MogoImageView; -import com.mogo.tanlu.R; -import com.mogo.utils.WindowUtils; -import com.mogo.utils.logger.Logger; -import java.text.SimpleDateFormat; -import java.util.Date; - -/** - * @author congtaowang - * @since 2019-12-24 - *

- * 描述 - */ -public class TanluInfoWindowAdapter implements IMogoInfoWindowAdapter { - - private static final String TAG = "DemoInfoWindowAdapter"; - - private Context mContext; - private IMogoNavi mNavi; - private IMogoImageloader mImageloader; - - public TanluInfoWindowAdapter(Context mContext, IMogoNavi mNavi, IMogoImageloader iMogoImageloader ) { - this.mContext = mContext; - this.mNavi = mNavi; - this.mImageloader = iMogoImageloader; - } - - @Override - public View getInfoWindow( IMogoMarker marker ) { - if ( marker.getObject() instanceof MogoPoiItem ) { - View view = LayoutInflater.from( mContext ).inflate( R.layout.tanlu_poi_info_window, null ); - renderPoiVew( view, marker, ( ( MogoPoiItem ) marker.getObject() ) ); - return view; - } else { - View view = LayoutInflater.from( mContext ).inflate( R.layout.tanlu_info_window, null ); - renderView( view, marker ); - return view; - } - - } - - private void renderView( View view, final IMogoMarker marker ) { - final TextView time = view.findViewById( R.id.demo_module_id_iw_time ); - Button refresh = view.findViewById( R.id.demo_module_id_iw_refresh ); - time.setText( new SimpleDateFormat( "yyyyMMdd HHMMSS" ).format( new Date() ) ); - refresh.setOnClickListener( new View.OnClickListener() { - @Override - public void onClick( View v ) { - marker.showInfoWindow(); - } - } ); - Button navi2 = view.findViewById( R.id.demo_module_id_iw_navito ); - navi2.setOnClickListener( new View.OnClickListener() { - @Override - public void onClick( View v ) { - if ( mNavi != null ) { - mNavi.naviTo( marker.getPosition(), new MogoNaviConfig() ); - } - } - } ); - Button stopNavi = view.findViewById( R.id.demo_module_id_iw_navi_stop ); - stopNavi.setOnClickListener( new View.OnClickListener() { - @Override - public void onClick( View v ) { - if ( mNavi != null ) { - mNavi.stopNavi(); - } - } - } ); - } - - private void renderPoiVew( View view, final IMogoMarker marker, MogoPoiItem item ) { - final TextView time = view.findViewById( R.id.demo_module_id_iw_poi_title ); - time.setText( item.getTitle() ); - Button navi2 = view.findViewById( R.id.demo_module_id_iw_poi_navito ); - navi2.setOnClickListener( new View.OnClickListener() { - @Override - public void onClick( View v ) { - if ( mNavi != null ) { - mNavi.naviTo( marker.getPosition(), new MogoNaviConfig() ); - } - marker.hideInfoWindow(); - marker.remove(); - } - } ); - } - - public View getMarkerView( final MogoMarkerOptions options ) { - final View view = LayoutInflater.from( mContext ).inflate( R.layout.tanlu_bubble_marker, null ); - final MogoImageView icon = view.findViewById( R.id.icon ); - mImageloader.displayImage( "http://imgnews.gmw.cn/attachement/jpg/site2/20191229/00d86176ed0b1f71f4580f.jpg", icon, WindowUtils.dip2px( mContext, 50 ), WindowUtils.dip2px( mContext, 50 ), - new IMogoImageLoaderListener() { - @Override - public void onStart() { - - } - - @Override - public void onCompleted( Bitmap bitmap ) { - // 刷新图标 - Logger.d( TAG, "loaded." ); - options.icon( view ); - options.notifyObservers(); - } - - @Override - public void onFailure( Exception e ) { - - } - } ); - return view; - } -} - diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/tanlu/net/TanluApiService.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/tanlu/net/TanluApiService.java new file mode 100644 index 0000000000..1af02b5e43 --- /dev/null +++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/tanlu/net/TanluApiService.java @@ -0,0 +1,25 @@ +package com.mogo.tanlu.net; + +import com.mogo.commons.data.BaseData; + +import java.util.Map; + +import io.reactivex.Observable; +import retrofit2.http.FieldMap; +import retrofit2.http.FormUrlEncoded; +import retrofit2.http.POST; +import retrofit2.http.QueryMap; + +/** + * @author lixiaopeng + * @description 探路相关接口定义 + * @since 2020-01-07 + */ +public interface TanluApiService { + + @FormUrlEncoded + @POST( "" ) + Observable refreshData(@QueryMap Map< String, Object > params, + @FieldMap Map< String, Object > parameters ); + +} diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/tanlu/util/StringUitl.kt b/modules/mogo-module-tanlu/src/main/java/com/mogo/tanlu/util/StringUitl.kt new file mode 100644 index 0000000000..f15770ced8 --- /dev/null +++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/tanlu/util/StringUitl.kt @@ -0,0 +1,17 @@ +package com.mogo.tanlu.util + +import android.text.format.DateFormat + +const val format = "yy/MM/dd kk:mm:ss" + +fun formatDate(time: Long): String { + return DateFormat.format(format, time).toString() +} + +fun convertVar(param: Any?): Any? { + return if (param is String) { + "\"$param\"" + } else { + param + } +} \ No newline at end of file diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/tanlu/video/FullMediaActivity.kt b/modules/mogo-module-tanlu/src/main/java/com/mogo/tanlu/video/FullMediaActivity.kt index b995ac516b..76164cfe92 100644 --- a/modules/mogo-module-tanlu/src/main/java/com/mogo/tanlu/video/FullMediaActivity.kt +++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/tanlu/video/FullMediaActivity.kt @@ -8,6 +8,7 @@ import androidx.appcompat.app.AppCompatActivity import com.mogo.tanlu.R import com.mogo.tanlu.model.Informations import com.mogo.tanlu.util.HideControl +import com.mogo.tanlu.util.formatDate import com.mogo.utils.logger.Logger import com.shuyu.gsyvideoplayer.GSYVideoManager import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder @@ -20,12 +21,12 @@ import java.util.* class FullMediaActivity : AppCompatActivity(), View.OnClickListener { companion object { - const val PARAM_MEDIA_DATA = "PARAM_MEDIA_DATA" - const val PARAM_MEDIA_POSITION_CALLBACK = "PARAM_MEDIA_POSITION_CALLBACK" const val TAG = "FullMediaActivity" const val PARAM_VIDEO_URL = "param_video_url" const val PARAM_THUMB_URL = "param_thumb_url" + const val PARAM_ADDRESS = "param_address" + const val PARAM_TIME = "generate_time" // fun launch(context: Activity, strategyInfo: List, position: Int) { @@ -37,22 +38,24 @@ class FullMediaActivity : AppCompatActivity(), View.OnClickListener { // context.overridePendingTransition(0, 0) // } - fun launch(context: Activity, videoUrl: String, thumbnail: String) { + fun launch(context: Activity, videoUrl: String, thumbnail: String, address: String, generateTime: Long) { val intent = Intent(context, FullMediaActivity::class.java) intent.putExtra(PARAM_VIDEO_URL, videoUrl) intent.putExtra(PARAM_THUMB_URL, thumbnail) + intent.putExtra(PARAM_ADDRESS, address) + intent.putExtra(PARAM_TIME, generateTime) context.startActivity(intent) context.overridePendingTransition(0, 0) } } - private var strategyInfo: ArrayList = arrayListOf() - private var currentImgPosition: Int = 0 - private var currentPosition: Int = 50 + private var control = HideControl() private var gsyVideoOptionBuilder = GSYVideoOptionBuilder() private var videoUrl: String? = null private var thumbUrl: String? = null + private var address: String? = null + private var generateTime: Long = 0 @@ -68,8 +71,10 @@ class FullMediaActivity : AppCompatActivity(), View.OnClickListener { videoUrl = intent.getStringExtra(PARAM_VIDEO_URL) thumbUrl = intent.getStringExtra(PARAM_THUMB_URL) - - Logger.e("liyz", "videoUrl = $videoUrl --->thumbUrl = $thumbUrl") + address = intent.getStringExtra(PARAM_ADDRESS) + generateTime = intent.getLongExtra(PARAM_TIME, 0) + Logger.d("liyz", "FullMediaActivityvideoUrl = $videoUrl --->thumbUrl = $thumbUrl") + Logger.d("liyz", "FullMediaActivity address = $address --->generateTime = $generateTime") } override fun onResume() { @@ -86,7 +91,6 @@ class FullMediaActivity : AppCompatActivity(), View.OnClickListener { //需要监听完成事件 private fun setListener() { iv_media_back.setOnClickListener(this) - //重置timer video_view.addSingleClickListener(object : MediaCoverVideoPlayer.SingleClickListener { @@ -113,8 +117,8 @@ class FullMediaActivity : AppCompatActivity(), View.OnClickListener { private fun updateInformation() { - tv_media_title_content.text = "北京市" - tv_media_title_time.text = "2020-1-6" + tv_media_title_content.text = address + tv_media_title_time.text = formatDate(generateTime) } @@ -124,7 +128,6 @@ class FullMediaActivity : AppCompatActivity(), View.OnClickListener { iv_media_back -> { handleBack() } - } } } @@ -136,7 +139,6 @@ class FullMediaActivity : AppCompatActivity(), View.OnClickListener { } private fun handleBack() { - Logger.d("liyz", "handleBack ------> finish ") finish() } diff --git a/modules/mogo-module-tanlu/src/main/res/layout/tanlu_bubble_marker.xml b/modules/mogo-module-tanlu/src/main/res/layout/tanlu_bubble_marker.xml deleted file mode 100644 index 5e06488b24..0000000000 --- a/modules/mogo-module-tanlu/src/main/res/layout/tanlu_bubble_marker.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/modules/mogo-module-tanlu/src/main/res/layout/tanlu_card_view.xml b/modules/mogo-module-tanlu/src/main/res/layout/tanlu_card_view.xml deleted file mode 100644 index 03c7c97f3b..0000000000 --- a/modules/mogo-module-tanlu/src/main/res/layout/tanlu_card_view.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - -