Commit bcd740123dd8ebffdda33fb735ddf98e785bb025
二维码扫描
Showing
10 changed files
with
243 additions
and
3 deletions
.idea/gradle.xml
| ... | ... | @@ -3,6 +3,9 @@ |
| 3 | 3 | <component name="GradleSettings"> |
| 4 | 4 | <option name="linkedExternalProjectsSettings"> |
| 5 | 5 | <GradleProjectSettings> |
| 6 | + <compositeConfiguration> | |
| 7 | + <compositeBuild compositeDefinitionSource="SCRIPT" /> | |
| 8 | + </compositeConfiguration> | |
| 6 | 9 | <option name="distributionType" value="DEFAULT_WRAPPED" /> |
| 7 | 10 | <option name="externalProjectPath" value="$PROJECT_DIR$" /> |
| 8 | 11 | <option name="modules"> | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/presenter/ALLScoreDetailFragmentPresenter.java
| ... | ... | @@ -63,6 +63,7 @@ public class ALLScoreDetailFragmentPresenter extends MvpBasePresenter<ALLScoreDe |
| 63 | 63 | mClient = new LBSTraceClient(context); |
| 64 | 64 | } |
| 65 | 65 | List<LatLng> allResultList = new ArrayList<>(); |
| 66 | + | |
| 66 | 67 | MyMapUtil.queryHistoryTrace(context, mClient, entityName, startTime, endTime, new MyMapUtil.CallBack() { |
| 67 | 68 | @Override |
| 68 | 69 | public void success(List<LatLng> resultPoints) { | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/RunRaceDetailFragmentView.java
| ... | ... | @@ -25,6 +25,7 @@ import com.baidu.location.LocationClientOption; |
| 25 | 25 | import com.baidu.mapapi.map.BaiduMap; |
| 26 | 26 | import com.baidu.mapapi.map.BitmapDescriptor; |
| 27 | 27 | import com.baidu.mapapi.map.BitmapDescriptorFactory; |
| 28 | +import com.baidu.mapapi.map.InfoWindow; | |
| 28 | 29 | import com.baidu.mapapi.map.MapStatus; |
| 29 | 30 | import com.baidu.mapapi.map.MapStatusUpdate; |
| 30 | 31 | import com.baidu.mapapi.map.MapStatusUpdateFactory; |
| ... | ... | @@ -1207,6 +1208,15 @@ public class RunRaceDetailFragmentView implements MvpView, SensorEventListener { |
| 1207 | 1208 | if (location == null || mMapView == null) { |
| 1208 | 1209 | return; |
| 1209 | 1210 | } |
| 1211 | +// if (null != baiduMap && null != startLatLng) { | |
| 1212 | +// int currentDiatance = (int) DistanceUtil.getDistance(new LatLng(location.getLatitude(), location.getLongitude()), startLatLng); | |
| 1213 | +// MyMapUtil.setStartInfoWindow(getContext(), baiduMap, new LatLng(location.getLatitude(), location.getLongitude()), currentDiatance + "", new InfoWindow.OnInfoWindowClickListener() { | |
| 1214 | +// @Override | |
| 1215 | +// public void onInfoWindowClick() { | |
| 1216 | +// | |
| 1217 | +// } | |
| 1218 | +// }); | |
| 1219 | +// } | |
| 1210 | 1220 | if (isFirstLoc) { |
| 1211 | 1221 | isFirstLoc = false; |
| 1212 | 1222 | if (location.getRadius() > Constant.LOCA_ACCURACY) { | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/ui/activity/RunRaceDetailActivity.java
| ... | ... | @@ -49,7 +49,7 @@ import java.util.List; |
| 49 | 49 | * |
| 50 | 50 | * @author ShinnyYang |
| 51 | 51 | */ |
| 52 | -@Route(path = "/moudle_pedometer/CollRunRaceDetailActivity") | |
| 52 | +@Route(path = "/moudle_pedometer/RunRaceDetailActivity") | |
| 53 | 53 | public class RunRaceDetailActivity extends QMUIFragmentActivity { |
| 54 | 54 | private QMUIFragment fragment; |
| 55 | 55 | private PermissionsUtils mPermissionsUtils = new PermissionsUtils();//权限申请 | ... | ... |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/utils/MyMapUtil.java
| ... | ... | @@ -7,10 +7,14 @@ import android.location.LocationManager; |
| 7 | 7 | import android.os.Handler; |
| 8 | 8 | import android.text.TextUtils; |
| 9 | 9 | import android.util.Log; |
| 10 | +import android.view.LayoutInflater; | |
| 11 | +import android.view.View; | |
| 12 | +import android.widget.TextView; | |
| 10 | 13 | import android.widget.Toast; |
| 11 | 14 | |
| 12 | 15 | import com.baidu.mapapi.map.BaiduMap; |
| 13 | 16 | import com.baidu.mapapi.map.BitmapDescriptorFactory; |
| 17 | +import com.baidu.mapapi.map.InfoWindow; | |
| 14 | 18 | import com.baidu.mapapi.map.MapStatusUpdate; |
| 15 | 19 | import com.baidu.mapapi.map.MapStatusUpdateFactory; |
| 16 | 20 | import com.baidu.mapapi.map.MarkerOptions; |
| ... | ... | @@ -27,6 +31,10 @@ import com.baidu.mapapi.search.geocode.ReverseGeoCodeOption; |
| 27 | 31 | import com.baidu.mapapi.search.geocode.ReverseGeoCodeResult; |
| 28 | 32 | import com.baidu.mapapi.utils.DistanceUtil; |
| 29 | 33 | import com.baidu.trace.LBSTraceClient; |
| 34 | +import com.baidu.trace.api.analysis.DrivingBehaviorRequest; | |
| 35 | +import com.baidu.trace.api.analysis.DrivingBehaviorResponse; | |
| 36 | +import com.baidu.trace.api.analysis.OnAnalysisListener; | |
| 37 | +import com.baidu.trace.api.analysis.StayPointResponse; | |
| 30 | 38 | import com.baidu.trace.api.track.DistanceRequest; |
| 31 | 39 | import com.baidu.trace.api.track.DistanceResponse; |
| 32 | 40 | import com.baidu.trace.api.track.HistoryTrackRequest; |
| ... | ... | @@ -61,6 +69,99 @@ public class MyMapUtil { |
| 61 | 69 | private static List<LatLng> trackPoints; |
| 62 | 70 | private static GeoCoder mSearch = null; // 搜索模块,也可去掉地图模块独立使用 |
| 63 | 71 | private static int queryGeoCount = 0; |
| 72 | + private static LBSTraceClient mClient = null; | |
| 73 | + private static InfoWindow startInfoWindow; | |
| 74 | + private static View startInfoView; | |
| 75 | + private static TextView tv_start_distance; | |
| 76 | + | |
| 77 | + /** | |
| 78 | + * 设置起点地图浮窗 | |
| 79 | + * | |
| 80 | + * @param context | |
| 81 | + * @param baiduMap | |
| 82 | + * @param startPoint | |
| 83 | + * @param msg | |
| 84 | + * @param listener | |
| 85 | + */ | |
| 86 | + public static void setStartInfoWindow(Context context, BaiduMap baiduMap, LatLng startPoint, String msg, InfoWindow.OnInfoWindowClickListener listener) { | |
| 87 | + if (null == baiduMap || null == startPoint) { | |
| 88 | + return; | |
| 89 | + } | |
| 90 | + if (null != startInfoWindow) { | |
| 91 | + baiduMap.hideInfoWindow(startInfoWindow); | |
| 92 | + startInfoWindow = null; | |
| 93 | + } | |
| 94 | + | |
| 95 | + if (null == startInfoView) { | |
| 96 | + startInfoView = LayoutInflater.from(context).inflate(R.layout.custom_info_window, null); | |
| 97 | + } | |
| 98 | + if (null == tv_start_distance && null != startInfoView) { | |
| 99 | + tv_start_distance = startInfoView.findViewById(R.id.tv_start_distance); | |
| 100 | + } | |
| 101 | + if (null != tv_start_distance) { | |
| 102 | + tv_start_distance.setText(msg); | |
| 103 | + } | |
| 104 | + if (null == startInfoWindow && null != startInfoView && null != startPoint) { | |
| 105 | + startInfoWindow = new InfoWindow(BitmapDescriptorFactory.fromView(startInfoView), startPoint, -47, listener); | |
| 106 | + baiduMap.showInfoWindow(startInfoWindow); | |
| 107 | + } | |
| 108 | + | |
| 109 | + | |
| 110 | + } | |
| 111 | + | |
| 112 | + /** | |
| 113 | + * 分析驾驶行为 | |
| 114 | + * | |
| 115 | + * @param context | |
| 116 | + * @param entityName | |
| 117 | + * @param startTime | |
| 118 | + * @param endTime | |
| 119 | + */ | |
| 120 | + private static int queryAnalysisNum = 0;//查询次数 | |
| 121 | + | |
| 122 | + public static void analysisDrivingBehavior(Context context, String entityName, long startTime, long endTime) { | |
| 123 | + if (null == mClient) { | |
| 124 | + mClient = new LBSTraceClient(context); | |
| 125 | + } | |
| 126 | + DrivingBehaviorRequest drivingBehaviorRequest = new DrivingBehaviorRequest(Constant.TAG, Constant.SERVICE_ID); | |
| 127 | + drivingBehaviorRequest.setStartTime(startTime); | |
| 128 | + drivingBehaviorRequest.setEndTime(endTime); | |
| 129 | + drivingBehaviorRequest.setEntityName(entityName); | |
| 130 | + //行为分析 | |
| 131 | + OnAnalysisListener onAnalysisListener = new OnAnalysisListener() { | |
| 132 | + @Override | |
| 133 | + public void onStayPointCallback(StayPointResponse stayPointResponse) { | |
| 134 | + | |
| 135 | + } | |
| 136 | + | |
| 137 | + @Override | |
| 138 | + public void onDrivingBehaviorCallback(DrivingBehaviorResponse drivingBehaviorResponse) { | |
| 139 | + if (null == drivingBehaviorRequest) { | |
| 140 | + queryAnalysisNum = 0; | |
| 141 | + return; | |
| 142 | + } | |
| 143 | + //鉴权失败 | |
| 144 | + if (14004 == drivingBehaviorResponse.getStatus()) { | |
| 145 | + //重新查询 | |
| 146 | + if (queryAnalysisNum < 3) { | |
| 147 | + new Handler().postDelayed(new Runnable() { | |
| 148 | + @Override | |
| 149 | + public void run() { | |
| 150 | + analysisDrivingBehavior(context, entityName, startTime, endTime); | |
| 151 | + queryAnalysisNum++; | |
| 152 | + } | |
| 153 | + }, 1000); | |
| 154 | + } | |
| 155 | + } else if (0 == drivingBehaviorResponse.getStatus()) { | |
| 156 | + queryAnalysisNum = 0; | |
| 157 | + } | |
| 158 | + Log.e(TAG, "onDrivingBehaviorCallback: "); | |
| 159 | + } | |
| 160 | + }; | |
| 161 | + if (null != mClient && null != drivingBehaviorRequest) { | |
| 162 | + mClient.queryDrivingBehavior(drivingBehaviorRequest, onAnalysisListener); | |
| 163 | + } | |
| 164 | + } | |
| 64 | 165 | |
| 65 | 166 | /** |
| 66 | 167 | * 进行逆地理查询 | ... | ... |
moudle_pedometer/src/main/res/drawable/bg_map_window_top_red.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<shape xmlns:android="http://schemas.android.com/apk/res/android"> | |
| 3 | + <solid android:color="#f44336" /> | |
| 4 | + <stroke | |
| 5 | + android:color="#f44336" | |
| 6 | + android:width="1dp" /> | |
| 7 | + <corners android:topLeftRadius="4dp" android:topRightRadius="4dp"/> | |
| 8 | +</shape> | |
| 0 | 9 | \ No newline at end of file | ... | ... |
moudle_pedometer/src/main/res/drawable/bg_map_window_whiite.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<shape xmlns:android="http://schemas.android.com/apk/res/android"> | |
| 3 | + <solid android:color="#ffffff" /> | |
| 4 | + <stroke | |
| 5 | + android:width="1dp" | |
| 6 | + android:color="#FFFFFF" /> | |
| 7 | + <corners android:radius="20dp" /> | |
| 8 | +</shape> | |
| 0 | 9 | \ No newline at end of file | ... | ... |
moudle_pedometer/src/main/res/drawable/bg_triangle_white.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> | |
| 3 | + | |
| 4 | + | |
| 5 | + <item android:id="@+id/shape_id"> | |
| 6 | + <!-- 倒三角 --> | |
| 7 | + <rotate | |
| 8 | + android:fromDegrees="45" | |
| 9 | + android:pivotX="135%" | |
| 10 | + android:pivotY="15%" | |
| 11 | + android:toDegrees="45"> | |
| 12 | + <shape android:shape="rectangle"> | |
| 13 | + <solid android:color="#ffffff" /> | |
| 14 | + <stroke | |
| 15 | + android:width="1dp" | |
| 16 | + android:color="#FFFFFF" /> | |
| 17 | + </shape> | |
| 18 | + </rotate> | |
| 19 | + </item> | |
| 20 | + | |
| 21 | + | |
| 22 | +</layer-list> | |
| 0 | 23 | \ No newline at end of file | ... | ... |
moudle_pedometer/src/main/res/layout/custom_info_window.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
| 3 | + android:layout_width="wrap_content" | |
| 4 | + android:layout_height="wrap_content" | |
| 5 | + android:maxWidth="250dp" | |
| 6 | + android:orientation="vertical"> | |
| 7 | + | |
| 8 | + <LinearLayout | |
| 9 | + android:id="@+id/ll_window_info" | |
| 10 | + android:layout_width="match_parent" | |
| 11 | + android:layout_height="wrap_content" | |
| 12 | + android:background="@drawable/bg_map_window_whiite" | |
| 13 | + android:orientation="vertical"> | |
| 14 | + | |
| 15 | + <LinearLayout | |
| 16 | + android:id="@+id/ll_top" | |
| 17 | + android:layout_width="match_parent" | |
| 18 | + android:layout_height="25dp" | |
| 19 | + android:background="@drawable/bg_map_window_top_red" | |
| 20 | + android:gravity="center_vertical" | |
| 21 | + android:orientation="horizontal" | |
| 22 | + android:paddingLeft="10dp" | |
| 23 | + android:paddingRight="10dp" | |
| 24 | + android:visibility="gone"> | |
| 25 | + | |
| 26 | + | |
| 27 | + <TextView | |
| 28 | + android:id="@+id/tv_num" | |
| 29 | + android:layout_width="wrap_content" | |
| 30 | + android:layout_height="wrap_content" | |
| 31 | + android:text="" | |
| 32 | + android:textColor="#ffffff" | |
| 33 | + android:textSize="12sp" /> | |
| 34 | + | |
| 35 | + </LinearLayout> | |
| 36 | + | |
| 37 | + <LinearLayout | |
| 38 | + android:layout_width="match_parent" | |
| 39 | + android:layout_height="match_parent" | |
| 40 | + android:gravity="center" | |
| 41 | + android:orientation="horizontal" | |
| 42 | + android:paddingLeft="15dp" | |
| 43 | + android:paddingTop="10dp" | |
| 44 | + android:paddingRight="15dp" | |
| 45 | + android:paddingBottom="10dp"> | |
| 46 | + | |
| 47 | + <TextView | |
| 48 | + android:layout_width="wrap_content" | |
| 49 | + android:layout_height="wrap_content" | |
| 50 | + android:text="距离起点:" | |
| 51 | + android:textColor="@color/text_black" | |
| 52 | + android:textSize="14sp" /> | |
| 53 | + | |
| 54 | + <TextView | |
| 55 | + android:id="@+id/tv_start_distance" | |
| 56 | + android:layout_width="wrap_content" | |
| 57 | + android:layout_height="wrap_content" | |
| 58 | + android:textColor="@color/text_black" | |
| 59 | + android:textSize="14sp" /> | |
| 60 | + | |
| 61 | + <TextView | |
| 62 | + android:layout_width="wrap_content" | |
| 63 | + android:layout_height="wrap_content" | |
| 64 | + android:text="米" | |
| 65 | + android:textColor="@color/text_black" | |
| 66 | + android:textSize="14sp" /> | |
| 67 | + | |
| 68 | + </LinearLayout> | |
| 69 | + | |
| 70 | + | |
| 71 | + </LinearLayout> | |
| 72 | + | |
| 73 | + <RelativeLayout | |
| 74 | + android:layout_width="match_parent" | |
| 75 | + android:layout_height="wrap_content" | |
| 76 | + android:layout_marginTop="-1.3dp"> | |
| 77 | + | |
| 78 | + <ImageView | |
| 79 | + android:id="@+id/iv_window_bottom" | |
| 80 | + android:layout_width="20dp" | |
| 81 | + android:layout_height="20dp" | |
| 82 | + android:layout_alignParentTop="true" | |
| 83 | + android:layout_centerHorizontal="true" | |
| 84 | + android:layout_marginTop="0dp" | |
| 85 | + android:background="@drawable/bg_triangle_white" /> | |
| 86 | + </RelativeLayout> | |
| 87 | +</LinearLayout> | |
| 0 | 88 | \ No newline at end of file | ... | ... |
moudle_pedometer/src/main/res/layout/fragment_run_race_detail.xml
| ... | ... | @@ -162,8 +162,8 @@ |
| 162 | 162 | android:padding="10dp"> |
| 163 | 163 | |
| 164 | 164 | <ImageView |
| 165 | - android:layout_width="12dp" | |
| 166 | - android:layout_height="20dp" | |
| 165 | + android:layout_width="9dp" | |
| 166 | + android:layout_height="14dp" | |
| 167 | 167 | android:background="@drawable/icon_run_white_back" /> |
| 168 | 168 | </LinearLayout> |
| 169 | 169 | ... | ... |