Merge branch 'feature/v1.0.0' of gitlab.zhidaoauto.com:ecos/yycp-service/Launcher into feature/v1.0.0
This commit is contained in:
@@ -95,6 +95,7 @@ ext {
|
||||
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}",
|
||||
|
||||
// 长链
|
||||
|
||||
@@ -3,15 +3,24 @@ package com.mogo.module.service;
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.marker.IMogoMarkerManager;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
import com.mogo.module.service.entity.MarkerResponse;
|
||||
import com.mogo.module.service.marker.MapMarkerView;
|
||||
import com.mogo.module.service.marker.MarkerInfoWindowAdapter;
|
||||
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.TipToast;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
@@ -20,17 +29,32 @@ import com.mogo.utils.logger.Logger;
|
||||
* version: 1.0
|
||||
*/
|
||||
public class MarkerServiceHandler {
|
||||
private static final String TAG = "MarkerServiceHandler";
|
||||
|
||||
private static MogoMarkerClickListener mogoMarkerClickListener;
|
||||
|
||||
private static IMogoMapService mMapService;
|
||||
private static IMogoMarkerManager mMarkerManager;
|
||||
private static IMogoNavi mNavi;
|
||||
|
||||
private static IMogoImageloader mImageloader;
|
||||
private static IMogoSocketManager mMogoSocketManager;
|
||||
private static MarkerInfoWindowAdapter markerInfoWindowAdapter;
|
||||
|
||||
public static void init(Context context) {
|
||||
private static Context mContext;
|
||||
|
||||
public static void init(final Context context) {
|
||||
mContext = 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);
|
||||
mNavi = mMapService.getNavi(context);
|
||||
markerInfoWindowAdapter = new MarkerInfoWindowAdapter(context, getNavi(), getImageloader());
|
||||
|
||||
|
||||
mogoMarkerClickListener = new MogoMarkerClickListener();
|
||||
|
||||
// 长连接
|
||||
mMogoSocketManager = (IMogoSocketManager) ARouter.getInstance().build(MogoServicePaths.PATH_SOCKET_MANAGER).navigation();
|
||||
mMogoSocketManager.registerOnMessageListener(401001, new IMogoOnMessageListener<MarkerResponse>() {
|
||||
|
||||
@@ -42,6 +66,10 @@ public class MarkerServiceHandler {
|
||||
@Override
|
||||
public void onMsgReceived(MarkerResponse obj) {
|
||||
Logger.e("donghongyu", "===" + obj);
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
drawMapMarker();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
@@ -55,6 +83,10 @@ public class MarkerServiceHandler {
|
||||
return mMarkerManager;
|
||||
}
|
||||
|
||||
public static IMogoNavi getNavi() {
|
||||
return mNavi;
|
||||
}
|
||||
|
||||
public static IMogoImageloader getImageloader() {
|
||||
return mImageloader;
|
||||
}
|
||||
@@ -63,4 +95,31 @@ public class MarkerServiceHandler {
|
||||
return mMogoSocketManager;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 地图上的Marker点击回调
|
||||
*/
|
||||
static class MogoMarkerClickListener implements IMogoMarkerClickListener {
|
||||
|
||||
@Override
|
||||
public boolean onMarkerClicked(IMogoMarker marker) {
|
||||
TipToast.shortTip("点击了大而全中的Marker");
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void drawMapMarker() {
|
||||
MapMarkerView mapMarkerView = new MapMarkerView(mContext);
|
||||
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
.icon(mapMarkerView)
|
||||
.owner(TAG)
|
||||
.latitude(38.574525d + new Random().nextDouble())
|
||||
.longitude(115.41733d + new Random().nextDouble());
|
||||
IMogoMarker marker = getMarkerManager().addMarker(TAG, options);
|
||||
marker.setInfoWindowAdapter(markerInfoWindowAdapter);
|
||||
marker.setOnMarkerClickListener(mogoMarkerClickListener);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.view.LayoutInflater;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
|
||||
import com.mogo.module.service.R;
|
||||
|
||||
@@ -16,7 +17,7 @@ import com.mogo.module.service.R;
|
||||
* desc : 地图Marker图标带文本信息
|
||||
* version: 1.0
|
||||
*/
|
||||
public class MapMarkerInfoView extends LinearLayout {
|
||||
public class MapMarkerInfoView extends ConstraintLayout {
|
||||
public MapMarkerInfoView(Context context) {
|
||||
super(context);
|
||||
initView(context);
|
||||
|
||||
@@ -3,9 +3,9 @@ package com.mogo.module.service.marker;
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
|
||||
import com.mogo.module.service.R;
|
||||
|
||||
@@ -16,7 +16,7 @@ import com.mogo.module.service.R;
|
||||
* desc : 地图Marker图标
|
||||
* version: 1.0
|
||||
*/
|
||||
public class MapMarkerView extends LinearLayout {
|
||||
public class MapMarkerView extends ConstraintLayout {
|
||||
public MapMarkerView(Context context) {
|
||||
super(context);
|
||||
initView(context);
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.mogo.module.service.marker;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
|
||||
import com.mogo.map.marker.IMogoInfoWindowAdapter;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
import com.mogo.service.imageloader.IMogoImageloader;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020-01-0818:11
|
||||
* desc :
|
||||
* version: 1.0
|
||||
*/
|
||||
public class MarkerInfoWindowAdapter implements IMogoInfoWindowAdapter {
|
||||
|
||||
private static final String TAG = "MarkerInfoWindowAdapter";
|
||||
|
||||
private Context mContext;
|
||||
private IMogoNavi mNavi;
|
||||
private IMogoImageloader mImageloader;
|
||||
|
||||
public MarkerInfoWindowAdapter(Context mContext, IMogoNavi mNavi, IMogoImageloader iMogoImageloader) {
|
||||
this.mContext = mContext;
|
||||
this.mNavi = mNavi;
|
||||
this.mImageloader = iMogoImageloader;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getInfoWindow(IMogoMarker marker) {
|
||||
MapMarkerInfoView mapMarkerInfoView = new MapMarkerInfoView(mContext);
|
||||
return mapMarkerInfoView;
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.0 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 902 B |
@@ -12,6 +12,4 @@
|
||||
</shape >
|
||||
</rotate >
|
||||
</item >
|
||||
|
||||
|
||||
</layer-list >
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" >
|
||||
android:orientation="vertical"
|
||||
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout" >
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivBg"
|
||||
@@ -11,7 +13,6 @@
|
||||
android:layout_height="@dimen/dp_105"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/bg_map_marker_blue"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
@@ -27,4 +28,14 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout >
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivCar"
|
||||
android:layout_width="@dimen/dp_34"
|
||||
android:layout_height="@dimen/dp_64"
|
||||
android:rotation="270"
|
||||
android:src="@drawable/icon_map_marker_car_blue"
|
||||
app:layout_constraintEnd_toEndOf="@+id/ivBg"
|
||||
app:layout_constraintStart_toStartOf="@+id/ivBg"
|
||||
app:layout_constraintTop_toBottomOf="@+id/ivBg" />
|
||||
</merge >
|
||||
@@ -1,32 +1,66 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal" >
|
||||
android:orientation="horizontal"
|
||||
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvMarkerContent"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/llMarkerContent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="@dimen/dp_94"
|
||||
android:background="@drawable/bg_map_marker_blue_info"
|
||||
android:drawableLeft="@drawable/icon_default"
|
||||
android:drawablePadding="@dimen/dp_20"
|
||||
android:gravity="center"
|
||||
android:text="诗一样的女子"
|
||||
android:textColor="#ffffff"
|
||||
android:textSize="@dimen/sp_32"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintTop_toTopOf="parent" >
|
||||
|
||||
<com.mogo.service.imageloader.MogoImageView
|
||||
android:id="@+id/ivUserHead"
|
||||
android:layout_width="@dimen/dp_80"
|
||||
android:layout_height="@dimen/dp_80"
|
||||
android:background="@drawable/icon_default"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:miv_failureHolder="@drawable/icon_default"
|
||||
app:miv_overlayImageId="@drawable/icon_default"
|
||||
app:miv_placeHolder="@drawable/icon_default"
|
||||
app:miv_shape="circle" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvMarkerContent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/dp_20"
|
||||
android:gravity="center"
|
||||
android:text="诗一样的女子"
|
||||
android:textColor="#ffffff"
|
||||
android:textSize="@dimen/sp_32"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/ivUserHead"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/ivUserHead"
|
||||
app:layout_constraintTop_toTopOf="@+id/ivUserHead" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout >
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivReverseTriangle"
|
||||
android:layout_width="27dp"
|
||||
android:layout_height="15dp"
|
||||
android:layout_width="10dp"
|
||||
android:layout_height="10dp"
|
||||
android:src="@drawable/bg_shape_reverse_triangle_blue"
|
||||
app:layout_constraintEnd_toEndOf="@+id/tvMarkerContent"
|
||||
app:layout_constraintStart_toStartOf="@+id/tvMarkerContent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvMarkerContent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout >
|
||||
app:layout_constraintEnd_toEndOf="@+id/llMarkerContent"
|
||||
app:layout_constraintStart_toStartOf="@+id/llMarkerContent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/llMarkerContent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivCar"
|
||||
android:layout_width="@dimen/dp_34"
|
||||
android:layout_height="@dimen/dp_64"
|
||||
android:rotation="270"
|
||||
android:src="@drawable/icon_map_marker_car_blue"
|
||||
app:layout_constraintEnd_toEndOf="@+id/ivReverseTriangle"
|
||||
app:layout_constraintStart_toStartOf="@+id/ivReverseTriangle"
|
||||
app:layout_constraintTop_toBottomOf="@+id/ivReverseTriangle" />
|
||||
</merge >
|
||||
Reference in New Issue
Block a user