Commit f1ddb047a76d6324e2c91630870cf5d41d7300b8
Merge branch 'master' of bj.gitlab.cnlive.com:cnlive-team/ModulePedometer
Showing
42 changed files
with
2678 additions
and
412 deletions
app/build.gradle
| @@ -28,15 +28,16 @@ android { | @@ -28,15 +28,16 @@ android { | ||
| 28 | buildConfigField("String", "APP_ID", stringValue("802_jhbqccxw08")) | 28 | buildConfigField("String", "APP_ID", stringValue("802_jhbqccxw08")) |
| 29 | buildConfigField("String", "APP_KEY", stringValue("9c5619e9be747bb3b925dd215ca5923d86f12c09b9394f")) | 29 | buildConfigField("String", "APP_KEY", stringValue("9c5619e9be747bb3b925dd215ca5923d86f12c09b9394f")) |
| 30 | buildConfigField("String", "APP_SCERET", stringValue("1e6380cb347255e777f72b5aa60f41daa68443a132aaea")) | 30 | buildConfigField("String", "APP_SCERET", stringValue("1e6380cb347255e777f72b5aa60f41daa68443a132aaea")) |
| 31 | -// BAIDU_MAP_APP_KEY: "OeotXc38bbnU7WmyKGA0VMahk4v35VG2" | ||
| 32 | - manifestPlaceholders = [ | 31 | +// BAIDU_MAP_APP_KEY: "OeotXc38bbnU7WmyKGA0VMahk4v35VG2" //测试 |
| 33 | 32 | ||
| 34 | - BAIDU_MAP_APP_KEY: "2IIsTtvX2FA88yvDrPZedc2ZvMhxyDbN" | 33 | + manifestPlaceholders = [ |
| 35 | 34 | ||
| 35 | +// BAIDU_MAP_APP_KEY: "2IIsTtvX2FA88yvDrPZedc2ZvMhxyDbN" | ||
| 36 | + BAIDU_MAP_APP_KEY: "OeotXc38bbnU7WmyKGA0VMahk4v35VG2" | ||
| 36 | 37 | ||
| 37 | ] | 38 | ] |
| 38 | } | 39 | } |
| 39 | -// BAIDU_MAP_APP_KEY: "Q7y9SGcZVs0tmhbNTiaz0jHm4S1xGzE2" | 40 | +// BAIDU_MAP_APP_KEY: "Q7y9SGcZVs0tmhbNTiaz0jHm4S1xGzE2"//正式 |
| 40 | // BAIDU_MAP_APP_KEY: "0bWeo04KKKHqTwozcqgyLZVd0oVhv3rZ" | 41 | // BAIDU_MAP_APP_KEY: "0bWeo04KKKHqTwozcqgyLZVd0oVhv3rZ" |
| 41 | 42 | ||
| 42 | release { | 43 | release { |
| @@ -45,7 +46,8 @@ android { | @@ -45,7 +46,8 @@ android { | ||
| 45 | buildConfigField("String", "APP_KEY", stringValue("0d57b045ec0c3988a682d94c644e66b9b8e0d2b8ef937d")) | 46 | buildConfigField("String", "APP_KEY", stringValue("0d57b045ec0c3988a682d94c644e66b9b8e0d2b8ef937d")) |
| 46 | buildConfigField("String", "APP_SCERET", stringValue("275e8dc29274a1186d82f65bc607c231d02bcb3bfd8976")) | 47 | buildConfigField("String", "APP_SCERET", stringValue("275e8dc29274a1186d82f65bc607c231d02bcb3bfd8976")) |
| 47 | manifestPlaceholders = [ | 48 | manifestPlaceholders = [ |
| 48 | - BAIDU_MAP_APP_KEY: "Q7y9SGcZVs0tmhbNTiaz0jHm4S1xGzE2" | 49 | +// BAIDU_MAP_APP_KEY: "Q7y9SGcZVs0tmhbNTiaz0jHm4S1xGzE2" |
| 50 | + BAIDU_MAP_APP_KEY: "0bWeo04KKKHqTwozcqgyLZVd0oVhv3rZ" | ||
| 49 | ] | 51 | ] |
| 50 | } | 52 | } |
| 51 | } | 53 | } |
app/src/main/java/com/example/modulepedometer/MainActivity.java
| @@ -6,6 +6,7 @@ import android.support.v7.app.AppCompatActivity; | @@ -6,6 +6,7 @@ import android.support.v7.app.AppCompatActivity; | ||
| 6 | import android.view.View; | 6 | import android.view.View; |
| 7 | 7 | ||
| 8 | import com.cnlive.moudle.collectionTrace.ui.activity.CollRunRaceDetailActivity; | 8 | import com.cnlive.moudle.collectionTrace.ui.activity.CollRunRaceDetailActivity; |
| 9 | +import com.cnlive.moudle.collectionTrace.ui.activity.CollRunningFinishActivity; | ||
| 9 | import com.cnlive.moudle.collectionTrace.ui.activity.RaceListActivity; | 10 | import com.cnlive.moudle.collectionTrace.ui.activity.RaceListActivity; |
| 10 | import com.cnlive.moudle.collectionTrace.ui.activity.RaceNameListActivity; | 11 | import com.cnlive.moudle.collectionTrace.ui.activity.RaceNameListActivity; |
| 11 | import com.cnlive.moudle.pedometer.ui.activity.MyRecordActivity; | 12 | import com.cnlive.moudle.pedometer.ui.activity.MyRecordActivity; |
| @@ -32,13 +33,14 @@ public class MainActivity extends AppCompatActivity { | @@ -32,13 +33,14 @@ public class MainActivity extends AppCompatActivity { | ||
| 32 | public void onClick(View v) { | 33 | public void onClick(View v) { |
| 33 | Intent intent = new Intent(MainActivity.this, RaceListActivity.class); | 34 | Intent intent = new Intent(MainActivity.this, RaceListActivity.class); |
| 34 | startActivity(intent); | 35 | startActivity(intent); |
| 36 | + //跳转界面 | ||
| 37 | +// CollRunningFinishActivity.startActivity(MainActivity.this); | ||
| 35 | } | 38 | } |
| 36 | }); | 39 | }); |
| 37 | findViewById(R.id.tool2).setOnClickListener(new View.OnClickListener() { | 40 | findViewById(R.id.tool2).setOnClickListener(new View.OnClickListener() { |
| 38 | @Override | 41 | @Override |
| 39 | public void onClick(View v) { | 42 | public void onClick(View v) { |
| 40 | SelfRecordActivity.newInstance(MainActivity.this, "10513196",null,null,null); | 43 | SelfRecordActivity.newInstance(MainActivity.this, "10513196",null,null,null); |
| 41 | -// startActivity(intent); | ||
| 42 | } | 44 | } |
| 43 | }); | 45 | }); |
| 44 | 46 |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/commonInfo/CollCommonInfo.java
| @@ -155,6 +155,49 @@ public class CollCommonInfo { | @@ -155,6 +155,49 @@ public class CollCommonInfo { | ||
| 155 | return MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).getBoolean("CollFirstStepSendTraceTip", true); | 155 | return MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).getBoolean("CollFirstStepSendTraceTip", true); |
| 156 | } | 156 | } |
| 157 | 157 | ||
| 158 | + /** | ||
| 159 | + * 设置用户昵称 | ||
| 160 | + * | ||
| 161 | + * @param context | ||
| 162 | + * @param nickName | ||
| 163 | + */ | ||
| 164 | + public static void setUserNickName(Context context, String nickName) { | ||
| 165 | + MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).putString("CollRunUserNickName", nickName); | ||
| 166 | + | ||
| 167 | + } | ||
| 168 | + | ||
| 169 | + /** | ||
| 170 | + * 获取用户昵称 | ||
| 171 | + * | ||
| 172 | + * @param context | ||
| 173 | + */ | ||
| 174 | + public static String getUserNickName(Context context) { | ||
| 175 | + return MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).getString("CollRunUserNickName", ""); | ||
| 176 | + | ||
| 177 | + } | ||
| 178 | + | ||
| 179 | + /** | ||
| 180 | + * 设置用户头像 | ||
| 181 | + * | ||
| 182 | + * @param context | ||
| 183 | + * @param userIcon | ||
| 184 | + */ | ||
| 185 | + public static void setUserIcon(Context context, String userIcon) { | ||
| 186 | + MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).putString("CollRunUserNickIcon", userIcon); | ||
| 187 | + | ||
| 188 | + } | ||
| 189 | + | ||
| 190 | + /** | ||
| 191 | + * 获取用户头像 | ||
| 192 | + * | ||
| 193 | + * @param context | ||
| 194 | + */ | ||
| 195 | + public static String getUserIcon(Context context) { | ||
| 196 | + return MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).getString("CollRunUserNickIcon", ""); | ||
| 197 | + | ||
| 198 | + } | ||
| 199 | + | ||
| 200 | + | ||
| 158 | /*重置 | 201 | /*重置 |
| 159 | * @param context | 202 | * @param context |
| 160 | */ | 203 | */ |
| @@ -165,7 +208,6 @@ public class CollCommonInfo { | @@ -165,7 +208,6 @@ public class CollCommonInfo { | ||
| 165 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("CollstepStartTime"); | 208 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("CollstepStartTime"); |
| 166 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("CollKeepAliveService"); | 209 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("CollKeepAliveService"); |
| 167 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("CollRunBaiduTraceService"); | 210 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("CollRunBaiduTraceService"); |
| 168 | - MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("CollstreetId"); | ||
| 169 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("CollFirstStepSendTraceTip"); | 211 | MySpHelper.getInstance(context, Context.MODE_MULTI_PROCESS).removeKey("CollFirstStepSendTraceTip"); |
| 170 | } | 212 | } |
| 171 | 213 |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/presenter/CollRunningFinishFragmetPresenter.java
| 1 | package com.cnlive.moudle.collectionTrace.frame.presenter; | 1 | package com.cnlive.moudle.collectionTrace.frame.presenter; |
| 2 | 2 | ||
| 3 | +import android.app.Activity; | ||
| 4 | +import android.os.Handler; | ||
| 5 | +import android.text.TextUtils; | ||
| 6 | +import android.util.Log; | ||
| 7 | + | ||
| 8 | +import com.baidu.mapapi.map.Overlay; | ||
| 9 | +import com.baidu.mapapi.model.LatLng; | ||
| 10 | +import com.cnlive.libs.base.logic.Logic; | ||
| 11 | +import com.cnlive.libs.base.logic.callback.DataCallback; | ||
| 12 | +import com.cnlive.libs.base.logic.callback.FailureCallback; | ||
| 13 | +import com.cnlive.libs.base.logic.callback.SuccessCallback; | ||
| 14 | +import com.cnlive.moudle.collectionTrace.commonInfo.CollCommonInfo; | ||
| 3 | import com.cnlive.moudle.collectionTrace.frame.view.CollRunningFinishFragmentView; | 15 | import com.cnlive.moudle.collectionTrace.frame.view.CollRunningFinishFragmentView; |
| 16 | +import com.cnlive.moudle.collectionTrace.model.CollectPoint; | ||
| 17 | +import com.cnlive.moudle.collectionTrace.utils.CollStepUtil; | ||
| 18 | +import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; | ||
| 19 | +import com.cnlive.moudle.pedometer.net.ApiServiceRunLin; | ||
| 20 | +import com.cnlive.moudle.pedometer.net.SubscriptionRequest; | ||
| 21 | +import com.cnlive.moudle.pedometer.net.bean.BaseInfo; | ||
| 22 | +import com.cnlive.moudle.pedometer.sql.entity.CollUserStepEntity; | ||
| 23 | +import com.cnlive.moudle.pedometer.sql.entity.FailedEntity; | ||
| 24 | +import com.cnlive.moudle.pedometer.ui.activity.LineUpAgainActivity; | ||
| 25 | +import com.cnlive.moudle.pedometer.ui.widget.SelectDialog; | ||
| 26 | +import com.cnlive.moudle.pedometer.utils.GsonUtil; | ||
| 27 | +import com.cnlive.moudle.pedometer.utils.MyMapUtil; | ||
| 28 | +import com.cnlive.moudle.pedometer.utils.QMUITipDialogUtil; | ||
| 29 | +import com.cnlive.moudle.pedometer.utils.StepUtil; | ||
| 30 | +import com.example.moudle_pedometer.R; | ||
| 4 | import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter; | 31 | import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter; |
| 5 | 32 | ||
| 33 | +import java.util.HashMap; | ||
| 34 | +import java.util.List; | ||
| 35 | +import java.util.Map; | ||
| 36 | + | ||
| 37 | +import io.reactivex.disposables.Disposable; | ||
| 38 | + | ||
| 6 | public class CollRunningFinishFragmetPresenter extends MvpBasePresenter<CollRunningFinishFragmentView> { | 39 | public class CollRunningFinishFragmetPresenter extends MvpBasePresenter<CollRunningFinishFragmentView> { |
| 40 | + | ||
| 41 | + public void uploadTraceDateToServer(Activity context, CollUserStepEntity userStepEntity, String roadmap) { | ||
| 42 | + QMUITipDialogUtil.loadingDialog(context, "正在上传数据", false); | ||
| 43 | + Map<String, String> paramsMap = new HashMap<>(); | ||
| 44 | + //赛事id | ||
| 45 | + if (!TextUtils.isEmpty(userStepEntity.getStreetId())) { | ||
| 46 | + String eventId = userStepEntity.getStreetId(); | ||
| 47 | + paramsMap.put("eventId", eventId); | ||
| 48 | + } | ||
| 49 | + //踩点图 | ||
| 50 | + if (!TextUtils.isEmpty(roadmap)) { | ||
| 51 | + paramsMap.put("roadmap", roadmap); | ||
| 52 | + } | ||
| 53 | + //运营人员sid | ||
| 54 | + paramsMap.put("darenId", CollCommonInfo.getUserId(context)); | ||
| 55 | + if (!TextUtils.isEmpty(userStepEntity.getImportPoint())) { | ||
| 56 | + List<CollectPoint> collectPoints = GsonUtil.jsonToList(userStepEntity.getImportPoint(), CollectPoint.class); | ||
| 57 | + //绘制运营打的点 | ||
| 58 | + if (null != collectPoints) { | ||
| 59 | + //根据打点集合,自适应缩放 | ||
| 60 | + CollectPoint startPoint = null; | ||
| 61 | + if (!TextUtils.isEmpty(userStepEntity.getCollStartPointData())) { | ||
| 62 | + startPoint = GsonUtil.GsonToBean(userStepEntity.getCollStartPointData(), CollectPoint.class); | ||
| 63 | + } | ||
| 64 | + CollectPoint endPoint = null; | ||
| 65 | + if (!TextUtils.isEmpty(userStepEntity.getCollEndPointData())) { | ||
| 66 | + endPoint = GsonUtil.GsonToBean(userStepEntity.getCollEndPointData(), CollectPoint.class); | ||
| 67 | + } | ||
| 68 | + if (null != startPoint) { | ||
| 69 | + collectPoints.add(0, startPoint); | ||
| 70 | + //起点 | ||
| 71 | + paramsMap.put("startLocation", startPoint.getPointName()); | ||
| 72 | + } | ||
| 73 | + if (null != endPoint) { | ||
| 74 | + collectPoints.add(endPoint); | ||
| 75 | + // 终点 | ||
| 76 | + paramsMap.put("endLocation", endPoint.getPointName()); | ||
| 77 | + | ||
| 78 | + } | ||
| 79 | + // 经纬度 | ||
| 80 | + paramsMap.put("latLongitude", GsonUtil.GsonString(collectPoints)); | ||
| 81 | + } | ||
| 82 | + } | ||
| 83 | + //全程里数 mileage | ||
| 84 | + if (!TextUtils.isEmpty(userStepEntity.getStepCount())) { | ||
| 85 | + double mileage = CollStepUtil.getWalkDistanceKM(Long.parseLong(userStepEntity.getStepCount())); | ||
| 86 | + paramsMap.put("mileage", mileage + ""); | ||
| 87 | + } | ||
| 88 | + //开始时间 | ||
| 89 | + if (0 != userStepEntity.getStartTimeStamp()) { | ||
| 90 | + paramsMap.put("startTime", userStepEntity.getStartTimeStamp() + ""); | ||
| 91 | + } | ||
| 92 | + //结束时间 | ||
| 93 | + if (0 != userStepEntity.getFinishTimeStamp()) { | ||
| 94 | + paramsMap.put("endTime", userStepEntity.getFinishTimeStamp() + ""); | ||
| 95 | + } | ||
| 96 | + //实体名称 | ||
| 97 | + paramsMap.put("entityName", CollCommonInfo.getUserId(context)); | ||
| 98 | + | ||
| 99 | + Logic.create(paramsMap).action(new Logic.Action<Map<String, String>, BaseInfo>() { | ||
| 100 | + @Override | ||
| 101 | + public Disposable action(Map<String, String> stringStringMap, DataCallback<BaseInfo> dataCallback) { | ||
| 102 | + return SubscriptionRequest.service(ApiServiceRunLin.class, api -> api.collSaveShoeLine(stringStringMap)).subscribe(context, dataCallback); | ||
| 103 | + } | ||
| 104 | + }).<BaseInfo>event() | ||
| 105 | + .setFailureCallback(new FailureCallback() { | ||
| 106 | + @Override | ||
| 107 | + public void onFailure(int code, String message) { | ||
| 108 | + if (getView() == null) { | ||
| 109 | + return; | ||
| 110 | + } | ||
| 111 | + QMUITipDialogUtil.dismessDialog(); | ||
| 112 | + SelectDialog selectDialog = new SelectDialog(context, "数据上传失败,是否重试?", "取消", new SelectDialog.DialogInterface() { | ||
| 113 | + @Override | ||
| 114 | + public void onClick(SelectDialog dialog) { | ||
| 115 | + dialog.dismiss(); | ||
| 116 | + } | ||
| 117 | + }, "重试", new SelectDialog.DialogInterface() { | ||
| 118 | + @Override | ||
| 119 | + public void onClick(SelectDialog dialog) { | ||
| 120 | + dialog.dismiss(); | ||
| 121 | + uploadTraceDateToServer(context, userStepEntity, roadmap); | ||
| 122 | + } | ||
| 123 | + }); | ||
| 124 | + selectDialog.setCancelable(false); | ||
| 125 | + selectDialog.setCanceledOnTouchOutside(false); | ||
| 126 | + if (!selectDialog.isShowing()) { | ||
| 127 | + selectDialog.show(); | ||
| 128 | + } | ||
| 129 | + } | ||
| 130 | + }).setSuccessCallback(new SuccessCallback<BaseInfo>() { | ||
| 131 | + @Override | ||
| 132 | + public void onSuccess(BaseInfo baseInfo) { | ||
| 133 | + if (getView() == null) { | ||
| 134 | + return; | ||
| 135 | + } | ||
| 136 | + QMUITipDialogUtil.dismessDialog(); | ||
| 137 | + QMUITipDialogUtil.successDialog(context, "数据上传成功", 1); | ||
| 138 | + //清空数据 | ||
| 139 | + CollStepUtil.clearRunData(context, CollCommonInfo.getUserId(context)); | ||
| 140 | + CollCommonInfo.reset(context); | ||
| 141 | + new Handler().postDelayed(new Runnable() { | ||
| 142 | + @Override | ||
| 143 | + public void run() { | ||
| 144 | + if (null != context) { | ||
| 145 | + context.finish(); | ||
| 146 | + } | ||
| 147 | + } | ||
| 148 | + }, 1000); | ||
| 149 | + } | ||
| 150 | + }).start(); | ||
| 151 | + } | ||
| 7 | } | 152 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/presenter/CollTraceListDetailFragmentPresenter.java
0 → 100644
| 1 | +package com.cnlive.moudle.collectionTrace.frame.presenter; | ||
| 2 | + | ||
| 3 | +import com.cnlive.moudle.collectionTrace.frame.view.CollTraceListDetailFragmentView; | ||
| 4 | +import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter; | ||
| 5 | + | ||
| 6 | +public class CollTraceListDetailFragmentPresenter extends MvpBasePresenter<CollTraceListDetailFragmentView> { | ||
| 7 | +} |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/CollRunRaceDetailFragmentView.java
| @@ -89,14 +89,11 @@ public class CollRunRaceDetailFragmentView implements MvpView, SensorEventListen | @@ -89,14 +89,11 @@ public class CollRunRaceDetailFragmentView implements MvpView, SensorEventListen | ||
| 89 | private LatLng endLatLng; | 89 | private LatLng endLatLng; |
| 90 | private final int START_MARK = 0;//起始点 | 90 | private final int START_MARK = 0;//起始点 |
| 91 | private final int END_MARK = 1;//终止点 | 91 | private final int END_MARK = 1;//终止点 |
| 92 | - | ||
| 93 | - private String startPoint = "首都师范大学南门"; | ||
| 94 | - private String endPoint = "首都师范大学篮球场"; | ||
| 95 | private String test = "[{\"latitude\":39.933889208848,\"latitudeE6\":3.9933889208848E7,\"longitude\":116.30900265517,\"longitudeE6\":1.1630900265517001E8},{\"latitude\":39.933868507347,\"latitudeE6\":3.9933868507347E7,\"longitude\":116.30865416508,\"longitudeE6\":1.1630865416508E8},{\"latitude\":39.934756505077,\"latitudeE6\":3.9934756505077E7,\"longitude\":116.30860516469,\"longitudeE6\":1.1630860516468999E8},{\"latitude\":39.934781620502,\"latitudeE6\":3.9934781620502E7,\"longitude\":116.30961013007,\"longitudeE6\":1.1630961013007E8},{\"latitude\":39.934881620374,\"latitudeE6\":3.9934881620374E7,\"longitude\":116.30960513008,\"longitudeE6\":1.1630960513008E8},{\"latitude\":39.934077623132,\"latitudeE6\":3.9934077623132E7,\"longitude\":116.30965812942,\"longitudeE6\":1.1630965812942E8},{\"latitude\":39.933972618463,\"latitudeE6\":3.9933972618463E7,\"longitude\":116.30962113087,\"longitudeE6\":1.1630962113087E8},{\"latitude\":39.933932608856,\"latitudeE6\":3.9933932608856E7,\"longitude\":116.30953913383,\"longitudeE6\":1.1630953913383E8}]"; | 92 | private String test = "[{\"latitude\":39.933889208848,\"latitudeE6\":3.9933889208848E7,\"longitude\":116.30900265517,\"longitudeE6\":1.1630900265517001E8},{\"latitude\":39.933868507347,\"latitudeE6\":3.9933868507347E7,\"longitude\":116.30865416508,\"longitudeE6\":1.1630865416508E8},{\"latitude\":39.934756505077,\"latitudeE6\":3.9934756505077E7,\"longitude\":116.30860516469,\"longitudeE6\":1.1630860516468999E8},{\"latitude\":39.934781620502,\"latitudeE6\":3.9934781620502E7,\"longitude\":116.30961013007,\"longitudeE6\":1.1630961013007E8},{\"latitude\":39.934881620374,\"latitudeE6\":3.9934881620374E7,\"longitude\":116.30960513008,\"longitudeE6\":1.1630960513008E8},{\"latitude\":39.934077623132,\"latitudeE6\":3.9934077623132E7,\"longitude\":116.30965812942,\"longitudeE6\":1.1630965812942E8},{\"latitude\":39.933972618463,\"latitudeE6\":3.9933972618463E7,\"longitude\":116.30962113087,\"longitudeE6\":1.1630962113087E8},{\"latitude\":39.933932608856,\"latitudeE6\":3.9933932608856E7,\"longitude\":116.30953913383,\"longitudeE6\":1.1630953913383E8}]"; |
| 96 | private LinkedList<LatLng> importLatLngs;//关键点 | 93 | private LinkedList<LatLng> importLatLngs;//关键点 |
| 97 | private LatLng startLatLng = new LatLng(39.934733, 116.308646);//起始点 | 94 | private LatLng startLatLng = new LatLng(39.934733, 116.308646);//起始点 |
| 98 | private List<LatLng> trackPoints; | 95 | private List<LatLng> trackPoints; |
| 99 | - private RunRaceDetailInfo runRaceDetailInfo; | 96 | + public RunRaceDetailInfo runRaceDetailInfo; |
| 100 | 97 | ||
| 101 | public CollRunRaceDetailFragmentView(CollRunRaceDetailFragment fragment) { | 98 | public CollRunRaceDetailFragmentView(CollRunRaceDetailFragment fragment) { |
| 102 | this.fragment = fragment; | 99 | this.fragment = fragment; |
| @@ -135,22 +132,48 @@ public class CollRunRaceDetailFragmentView implements MvpView, SensorEventListen | @@ -135,22 +132,48 @@ public class CollRunRaceDetailFragmentView implements MvpView, SensorEventListen | ||
| 135 | if (!TextUtils.isEmpty(runRaceDetailInfo.getTitle())) { | 132 | if (!TextUtils.isEmpty(runRaceDetailInfo.getTitle())) { |
| 136 | fragment.binding.includeStreet.tvRaceTitle.setText(runRaceDetailInfo.getTitle()); | 133 | fragment.binding.includeStreet.tvRaceTitle.setText(runRaceDetailInfo.getTitle()); |
| 137 | } | 134 | } |
| 138 | - fragment.binding.slidingLayout.setPanelHeight(ScreenUtil.dip2px(getContext(), 140)); | 135 | + |
| 136 | + //判断是否显示绑定轨迹按钮 | ||
| 137 | + if (runRaceDetailInfo.isTrackButton()) { | ||
| 138 | + //显示 | ||
| 139 | + fragment.binding.rlScrollViewAddTrace.setVisibility(View.VISIBLE); | ||
| 140 | + fragment.binding.slidingLayout.setPanelHeight(ScreenUtil.dip2px(getContext(), 140)); | ||
| 139 | // //根据标题行数,自动调整卡片大小 | 141 | // //根据标题行数,自动调整卡片大小 |
| 140 | - fragment.binding.includeStreet.tvRaceTitle.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() { | ||
| 141 | - @Override | ||
| 142 | - public boolean onPreDraw() { | ||
| 143 | - int line = fragment.binding.includeStreet.tvRaceTitle.getLineCount(); | ||
| 144 | - int height = fragment.binding.includeStreet.tvRaceTitle.getHeight(); | ||
| 145 | - if (line > 1) { | ||
| 146 | - int avgHeight = height / line;//平局高度 | ||
| 147 | - fragment.binding.slidingLayout.setPanelHeight(ScreenUtil.dip2px(getContext(), 140) + avgHeight * (line - 1)); | 142 | + fragment.binding.includeStreet.tvRaceTitle.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() { |
| 143 | + @Override | ||
| 144 | + public boolean onPreDraw() { | ||
| 145 | + int line = fragment.binding.includeStreet.tvRaceTitle.getLineCount(); | ||
| 146 | + int height = fragment.binding.includeStreet.tvRaceTitle.getHeight(); | ||
| 147 | + if (line > 1) { | ||
| 148 | + int avgHeight = height / line;//平局高度 | ||
| 149 | + fragment.binding.slidingLayout.setPanelHeight(ScreenUtil.dip2px(getContext(), 140) + avgHeight * (line - 1)); | ||
| 148 | 150 | ||
| 151 | + } | ||
| 152 | + fragment.binding.includeStreet.tvRaceTitle.getViewTreeObserver().removeOnPreDrawListener(this); | ||
| 153 | + return false; | ||
| 149 | } | 154 | } |
| 150 | - fragment.binding.includeStreet.tvRaceTitle.getViewTreeObserver().removeOnPreDrawListener(this); | ||
| 151 | - return false; | ||
| 152 | - } | ||
| 153 | - }); | 155 | + }); |
| 156 | + } else { | ||
| 157 | + //不显示 | ||
| 158 | + fragment.binding.rlScrollViewAddTrace.setVisibility(View.GONE); | ||
| 159 | + fragment.binding.slidingLayout.setPanelHeight(ScreenUtil.dip2px(getContext(), 100)); | ||
| 160 | +// //根据标题行数,自动调整卡片大小 | ||
| 161 | + fragment.binding.includeStreet.tvRaceTitle.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() { | ||
| 162 | + @Override | ||
| 163 | + public boolean onPreDraw() { | ||
| 164 | + int line = fragment.binding.includeStreet.tvRaceTitle.getLineCount(); | ||
| 165 | + int height = fragment.binding.includeStreet.tvRaceTitle.getHeight(); | ||
| 166 | + if (line > 1) { | ||
| 167 | + int avgHeight = height / line;//平局高度 | ||
| 168 | + fragment.binding.slidingLayout.setPanelHeight(ScreenUtil.dip2px(getContext(), 100) + avgHeight * (line - 1)); | ||
| 169 | + | ||
| 170 | + } | ||
| 171 | + fragment.binding.includeStreet.tvRaceTitle.getViewTreeObserver().removeOnPreDrawListener(this); | ||
| 172 | + return false; | ||
| 173 | + } | ||
| 174 | + }); | ||
| 175 | + | ||
| 176 | + } | ||
| 154 | //设置活动地点 | 177 | //设置活动地点 |
| 155 | if (!TextUtils.isEmpty(runRaceDetailInfo.getAddress())) { | 178 | if (!TextUtils.isEmpty(runRaceDetailInfo.getAddress())) { |
| 156 | fragment.binding.includeStreet.tvAddress.setText(runRaceDetailInfo.getAddress()); | 179 | fragment.binding.includeStreet.tvAddress.setText(runRaceDetailInfo.getAddress()); |
| @@ -193,6 +216,7 @@ public class CollRunRaceDetailFragmentView implements MvpView, SensorEventListen | @@ -193,6 +216,7 @@ public class CollRunRaceDetailFragmentView implements MvpView, SensorEventListen | ||
| 193 | GlideApp.with(getContext()).load(runRaceDetailInfo.getRoadmap()).into(fragment.binding.includeStreetIntroduce.ivRoadMao); | 216 | GlideApp.with(getContext()).load(runRaceDetailInfo.getRoadmap()).into(fragment.binding.includeStreetIntroduce.ivRoadMao); |
| 194 | 217 | ||
| 195 | } | 218 | } |
| 219 | + | ||
| 196 | //添加轨迹按钮点击事件 | 220 | //添加轨迹按钮点击事件 |
| 197 | fragment.binding.rlScrollViewAddTrace.setOnClickListener(new View.OnClickListener() { | 221 | fragment.binding.rlScrollViewAddTrace.setOnClickListener(new View.OnClickListener() { |
| 198 | @Override | 222 | @Override |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/CollRunningFinishFragmentView.java
| 1 | package com.cnlive.moudle.collectionTrace.frame.view; | 1 | package com.cnlive.moudle.collectionTrace.frame.view; |
| 2 | 2 | ||
| 3 | import android.content.Context; | 3 | import android.content.Context; |
| 4 | +import android.graphics.Bitmap; | ||
| 5 | +import android.graphics.BitmapFactory; | ||
| 6 | +import android.os.Handler; | ||
| 7 | +import android.support.v7.widget.LinearLayoutManager; | ||
| 8 | +import android.text.TextUtils; | ||
| 9 | +import android.util.Log; | ||
| 10 | +import android.view.MotionEvent; | ||
| 4 | import android.view.View; | 11 | import android.view.View; |
| 12 | +import android.widget.Toast; | ||
| 5 | 13 | ||
| 14 | +import com.baidu.location.LocationClient; | ||
| 15 | +import com.baidu.location.LocationClientOption; | ||
| 16 | +import com.baidu.mapapi.map.BaiduMap; | ||
| 17 | +import com.baidu.mapapi.map.BitmapDescriptorFactory; | ||
| 18 | +import com.baidu.mapapi.map.MapView; | ||
| 19 | +import com.baidu.mapapi.map.MyLocationConfiguration; | ||
| 20 | +import com.baidu.mapapi.map.Overlay; | ||
| 21 | +import com.baidu.mapapi.map.UiSettings; | ||
| 22 | +import com.baidu.mapapi.model.LatLng; | ||
| 23 | +import com.baidu.trace.LBSTraceClient; | ||
| 24 | +import com.baidu.trace.api.fence.AddMonitoredPersonResponse; | ||
| 25 | +import com.baidu.trace.api.fence.CreateFenceRequest; | ||
| 26 | +import com.baidu.trace.api.fence.CreateFenceResponse; | ||
| 27 | +import com.baidu.trace.api.fence.DeleteFenceResponse; | ||
| 28 | +import com.baidu.trace.api.fence.DeleteMonitoredPersonResponse; | ||
| 29 | +import com.baidu.trace.api.fence.FenceListResponse; | ||
| 30 | +import com.baidu.trace.api.fence.HistoryAlarmResponse; | ||
| 31 | +import com.baidu.trace.api.fence.ListMonitoredPersonResponse; | ||
| 32 | +import com.baidu.trace.api.fence.MonitoredStatusByLocationResponse; | ||
| 33 | +import com.baidu.trace.api.fence.MonitoredStatusResponse; | ||
| 34 | +import com.baidu.trace.api.fence.OnFenceListener; | ||
| 35 | +import com.baidu.trace.api.fence.UpdateFenceResponse; | ||
| 36 | +import com.baidu.trace.model.CoordType; | ||
| 37 | +import com.baidu.trace.model.SortType; | ||
| 38 | +import com.cnlive.libs.base.logic.Event; | ||
| 39 | +import com.cnlive.libs.base.logic.callback.FailureCallback; | ||
| 40 | +import com.cnlive.libs.base.logic.callback.SuccessCallback; | ||
| 41 | +import com.cnlive.moudle.collectionTrace.commonInfo.CollCommonInfo; | ||
| 42 | +import com.cnlive.moudle.collectionTrace.model.CollectPoint; | ||
| 43 | +import com.cnlive.moudle.collectionTrace.ui.adapter.CollFinishDetaiAdapter; | ||
| 6 | import com.cnlive.moudle.collectionTrace.ui.fragment.CollRunningFinishFragment; | 44 | import com.cnlive.moudle.collectionTrace.ui.fragment.CollRunningFinishFragment; |
| 45 | +import com.cnlive.moudle.collectionTrace.utils.CollStepUtil; | ||
| 46 | +import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; | ||
| 47 | +import com.cnlive.moudle.pedometer.model.Constant; | ||
| 7 | import com.cnlive.moudle.pedometer.model.RunningFinishBean; | 48 | import com.cnlive.moudle.pedometer.model.RunningFinishBean; |
| 49 | +import com.cnlive.moudle.pedometer.sql.entity.CollUserStepEntity; | ||
| 8 | import com.cnlive.moudle.pedometer.ui.fragment.RunningFinishFragment; | 50 | import com.cnlive.moudle.pedometer.ui.fragment.RunningFinishFragment; |
| 51 | +import com.cnlive.moudle.pedometer.ui.widget.SelectDialog; | ||
| 52 | +import com.cnlive.moudle.pedometer.upload.UploadLogic; | ||
| 53 | +import com.cnlive.moudle.pedometer.utils.BitmapUtil; | ||
| 54 | +import com.cnlive.moudle.pedometer.utils.GsonUtil; | ||
| 55 | +import com.cnlive.moudle.pedometer.utils.MyMapUtil; | ||
| 56 | +import com.cnlive.moudle.pedometer.utils.QMUITipDialogUtil; | ||
| 57 | +import com.cnlive.moudle.pedometer.utils.ScreenUtil; | ||
| 58 | +import com.cnlive.moudle.pedometer.utils.TimeUtil; | ||
| 59 | +import com.cnlive.strike.application.GlideApp; | ||
| 60 | +import com.example.moudle_pedometer.R; | ||
| 9 | import com.hannesdorfmann.mosby3.mvp.MvpView; | 61 | import com.hannesdorfmann.mosby3.mvp.MvpView; |
| 62 | +import com.qmuiteam.qmui.widget.dialog.QMUITipDialog; | ||
| 63 | +import com.sothree.slidinguppanel.SlidingUpPanelLayout; | ||
| 10 | 64 | ||
| 11 | -public class CollRunningFinishFragmentView implements MvpView { | 65 | +import java.io.File; |
| 66 | +import java.io.FileOutputStream; | ||
| 67 | +import java.text.SimpleDateFormat; | ||
| 68 | +import java.util.ArrayList; | ||
| 69 | +import java.util.Date; | ||
| 70 | +import java.util.List; | ||
| 71 | + | ||
| 72 | +public class CollRunningFinishFragmentView implements MvpView, OnFenceListener { | ||
| 12 | private CollRunningFinishFragment fragment; | 73 | private CollRunningFinishFragment fragment; |
| 74 | + private CollFinishDetaiAdapter adapter; | ||
| 75 | + public BaiduMap baiduMap; | ||
| 76 | + private MapView mMapView; | ||
| 77 | + private UiSettings mUiSettings; | ||
| 78 | + private LBSTraceClient mClient = null; | ||
| 79 | + private List<Overlay> allMapOverlays; | ||
| 80 | + private List<LatLng> queryResultPoints; | ||
| 81 | + private List<com.baidu.trace.model.LatLng> collectLatLngs; | ||
| 82 | + private CollUserStepEntity collUserStepEntity; | ||
| 13 | 83 | ||
| 14 | public CollRunningFinishFragmentView(CollRunningFinishFragment fragment) { | 84 | public CollRunningFinishFragmentView(CollRunningFinishFragment fragment) { |
| 15 | this.fragment = fragment; | 85 | this.fragment = fragment; |
| @@ -19,23 +89,89 @@ public class CollRunningFinishFragmentView implements MvpView { | @@ -19,23 +89,89 @@ public class CollRunningFinishFragmentView implements MvpView { | ||
| 19 | return fragment == null ? null : fragment.getActivity(); | 89 | return fragment == null ? null : fragment.getActivity(); |
| 20 | } | 90 | } |
| 21 | 91 | ||
| 22 | - public void initView(RunningFinishBean runningFinishBean) { | 92 | + public void initView(CollUserStepEntity collUserStepEntity) { |
| 93 | + this.collUserStepEntity = collUserStepEntity; | ||
| 94 | + allMapOverlays = new ArrayList<>(); | ||
| 95 | + //设置滑动卡片 | ||
| 96 | +// fragment.binding.slidingLayout.set | ||
| 97 | + //添加起点 | ||
| 98 | + CollectPoint startPoint = null; | ||
| 99 | + if (!TextUtils.isEmpty(collUserStepEntity.getCollStartPointData())) { | ||
| 100 | + startPoint = GsonUtil.GsonToBean(collUserStepEntity.getCollStartPointData(), CollectPoint.class); | ||
| 101 | + } | ||
| 102 | + CollectPoint endPoint = null; | ||
| 103 | + if (!TextUtils.isEmpty(collUserStepEntity.getCollEndPointData())) { | ||
| 104 | + endPoint = GsonUtil.GsonToBean(collUserStepEntity.getCollEndPointData(), CollectPoint.class); | ||
| 105 | + } | ||
| 106 | + //查询用户历史轨迹 | ||
| 107 | + if (0 != collUserStepEntity.getStartTimeStamp() && 0 != collUserStepEntity.getFinishTimeStamp()) { | ||
| 108 | + long startTime = collUserStepEntity.getStartTimeStamp(); | ||
| 109 | + long endTime = collUserStepEntity.getFinishTimeStamp(); | ||
| 110 | + //开始查询 | ||
| 111 | + queryWalkTrace(startTime, endTime); | ||
| 112 | + if (!TextUtils.isEmpty(collUserStepEntity.getImportPoint())) { | ||
| 113 | + List<CollectPoint> collectPoints = GsonUtil.jsonToList(collUserStepEntity.getImportPoint(), CollectPoint.class); | ||
| 114 | + //绘制运营打的点 | ||
| 115 | + if (null != collectPoints) { | ||
| 116 | + //根据打点集合,自适应缩放 | ||
| 117 | + MyMapUtil.setCollMapAutoZoom(baiduMap, collectPoints, -1.5f); | ||
| 118 | + for (CollectPoint point : collectPoints) { | ||
| 119 | + LatLng markLatLng = new LatLng(point.getLatitude(), point.getLongitude()); | ||
| 120 | + if (null != markLatLng) { | ||
| 121 | + //将点位显示到地图上 | ||
| 122 | + Overlay overlay = MyMapUtil.setMapMarker(getContext(), baiduMap, markLatLng, R.drawable.icon_map_import); | ||
| 123 | + if (null != overlay) { | ||
| 124 | + allMapOverlays.add(overlay); | ||
| 125 | + } | ||
| 126 | + } | ||
| 127 | + } | ||
| 128 | + } | ||
| 129 | + } | ||
| 130 | + } | ||
| 131 | + //设置用户昵称 | ||
| 132 | + String nickName = CommonInfo.getUserNickName(getContext()); | ||
| 133 | + fragment.binding.includeFinishUserInfo.tvUserNickName.setText(nickName); | ||
| 134 | + //设置用户头像 | ||
| 135 | + String faceUrl = CommonInfo.getUserIcon(getContext()); | ||
| 136 | + if (!TextUtils.isEmpty(faceUrl)) { | ||
| 137 | + GlideApp.with(getContext()).load(faceUrl).into(fragment.binding.includeFinishUserInfo.qmIvIcon); | ||
| 138 | + } | ||
| 139 | + //设置标题 | ||
| 140 | + if (!TextUtils.isEmpty(collUserStepEntity.getStreetTitle())) { | ||
| 141 | + fragment.binding.includeFinishUserInfo.tvStreetName.setText(collUserStepEntity.getStreetTitle()); | ||
| 142 | + } | ||
| 23 | //设置距离 | 143 | //设置距离 |
| 24 | - fragment.binding.includeFinishUserInfo.tvDistance.setText(runningFinishBean.getRunDistance()); | ||
| 25 | - //设置配速 | ||
| 26 | - fragment.binding.includeFinishUserInfo.tvSpeed.setText(runningFinishBean.getSpeed()); | ||
| 27 | - //设置用时 | ||
| 28 | - fragment.binding.includeFinishUserInfo.tvTimer.setText(runningFinishBean.getTime()); | ||
| 29 | - //设置日期 | ||
| 30 | - fragment.binding.includeFinishUserInfo.tvDate.setText(runningFinishBean.getDate()); | ||
| 31 | - //设置步数 | ||
| 32 | - fragment.binding.includeFinishStep.tvStep.setText(runningFinishBean.getStep()); | ||
| 33 | - //设置起点位置 | ||
| 34 | - fragment.binding.includeFinishRunRoute.tvStartPoint.setText(runningFinishBean.getStartPoint()); | ||
| 35 | - //设置终点位置 | ||
| 36 | - fragment.binding.includeFinishRunRoute.tvEndPoint.setText(runningFinishBean.getEndPoint()); | ||
| 37 | - //设置时间 | ||
| 38 | - fragment.binding.includeFinishRunRoute.tvTimer.setText(runningFinishBean.getTime()); | 144 | + if (!TextUtils.isEmpty(collUserStepEntity.getStepCount())) { |
| 145 | + fragment.binding.includeFinishUserInfo.tvDistance.setText(CollStepUtil.getWalkDistanceKM(Long.parseLong(collUserStepEntity.getStepCount())) + ""); | ||
| 146 | + } else { | ||
| 147 | + fragment.binding.includeFinishUserInfo.tvDistance.setText("0"); | ||
| 148 | + } | ||
| 149 | + if (0 != collUserStepEntity.getFinishTimeStamp()) { | ||
| 150 | + //设置日期 | ||
| 151 | + fragment.binding.includeFinishUserInfo.tvDate.setText(TimeUtil.getStampToTime(collUserStepEntity.getFinishTimeStamp() * 1000, "yyyy-MM-dd HH:mm")); | ||
| 152 | + } | ||
| 153 | + //设置适配器 | ||
| 154 | + if (!TextUtils.isEmpty(collUserStepEntity.getImportPoint())) { | ||
| 155 | + List<CollectPoint> collectPoints = GsonUtil.jsonToList(collUserStepEntity.getImportPoint(), CollectPoint.class); | ||
| 156 | + if (null == collectPoints) { | ||
| 157 | + collectPoints = new ArrayList<>(); | ||
| 158 | + } | ||
| 159 | + if (null != startPoint) { | ||
| 160 | + collectPoints.add(0, startPoint); | ||
| 161 | + } | ||
| 162 | + if (null != endPoint) { | ||
| 163 | + collectPoints.add(endPoint); | ||
| 164 | + } | ||
| 165 | + //格式化打的点 | ||
| 166 | + collectLatLngs = new ArrayList<>(); | ||
| 167 | + for (CollectPoint collectPoint : collectPoints) { | ||
| 168 | + collectLatLngs.add(new com.baidu.trace.model.LatLng(collectPoint.getLatitude(), collectPoint.getLongitude())); | ||
| 169 | + } | ||
| 170 | + adapter = new CollFinishDetaiAdapter(fragment.getActivity(), collectPoints); | ||
| 171 | + //设置 | ||
| 172 | + fragment.binding.includeFinishUserInfo.rvList.setLayoutManager(new LinearLayoutManager(fragment.getActivity())); | ||
| 173 | + fragment.binding.includeFinishUserInfo.rvList.setAdapter(adapter); | ||
| 174 | + } | ||
| 39 | //返回按钮点击 | 175 | //返回按钮点击 |
| 40 | fragment.binding.flBack.setOnClickListener(new View.OnClickListener() { | 176 | fragment.binding.flBack.setOnClickListener(new View.OnClickListener() { |
| 41 | @Override | 177 | @Override |
| @@ -46,5 +182,432 @@ public class CollRunningFinishFragmentView implements MvpView { | @@ -46,5 +182,432 @@ public class CollRunningFinishFragmentView implements MvpView { | ||
| 46 | fragment.getActivity().finish(); | 182 | fragment.getActivity().finish(); |
| 47 | } | 183 | } |
| 48 | }); | 184 | }); |
| 185 | + fragment.binding.rlScrollViewStartBtn.setOnTouchListener(new View.OnTouchListener() { | ||
| 186 | + @Override | ||
| 187 | + public boolean onTouch(View view, MotionEvent motionEvent) { | ||
| 188 | + if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) { | ||
| 189 | + //判断是否成功查询到轨迹点 | ||
| 190 | + if (null == queryResultPoints) { | ||
| 191 | + QMUITipDialogUtil.textDialog(getContext(), "正在获取轨迹信息,请稍后...", 1); | ||
| 192 | + } else { | ||
| 193 | + //隐藏面板视图 | ||
| 194 | +// fragment.binding.slidingLayout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN); | ||
| 195 | + fragment.binding.slidingLayout.setPanelHeight(ScreenUtil.dip2px(getContext(), 100)); | ||
| 196 | + fragment.binding.slidingLayout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED); | ||
| 197 | + //让运营选择最佳的截图 | ||
| 198 | + SelectDialog selectDialog = new SelectDialog(getContext(), "当前赛事图是否\n已经调整到最佳效果?", "否", new SelectDialog.DialogInterface() { | ||
| 199 | + @Override | ||
| 200 | + public void onClick(SelectDialog dialog) { | ||
| 201 | + dialog.dismiss(); | ||
| 202 | + } | ||
| 203 | + }, "是", new SelectDialog.DialogInterface() { | ||
| 204 | + @Override | ||
| 205 | + public void onClick(SelectDialog dialog) { | ||
| 206 | + if (null != allMapOverlays) { | ||
| 207 | + for (Overlay overlay : allMapOverlays) { | ||
| 208 | + overlay.remove(); | ||
| 209 | + } | ||
| 210 | + } | ||
| 211 | + dialog.dismiss(); | ||
| 212 | + QMUITipDialogUtil.loadingDialog(getContext(), "正在截取赛事图片,请稍后", false); | ||
| 213 | + //延迟一秒进行截图,以免把打的点都截取到 | ||
| 214 | + new Handler().postDelayed(new Runnable() { | ||
| 215 | + @Override | ||
| 216 | + public void run() { | ||
| 217 | + if (null != collectLatLngs && collectLatLngs.size() > 1) { | ||
| 218 | +// getBaiDuSnap(); | ||
| 219 | + addFence(); | ||
| 220 | + } | ||
| 221 | + } | ||
| 222 | + }, 1000); | ||
| 223 | + } | ||
| 224 | + }); | ||
| 225 | + selectDialog.setCanceledOnTouchOutside(false); | ||
| 226 | + selectDialog.setCancelable(false); | ||
| 227 | + selectDialog.show(); | ||
| 228 | + } | ||
| 229 | + } | ||
| 230 | + return false; | ||
| 231 | + } | ||
| 232 | + }); | ||
| 233 | +// //确定轨迹按钮点击事件 | ||
| 234 | +// fragment.binding.rlScrollViewStartBtn.setOnClickListener(new View.OnClickListener() { | ||
| 235 | +// @Override | ||
| 236 | +// public void onClick(View view) { | ||
| 237 | +// Log.e("aaa", "onClick: "); | ||
| 238 | +// //开始整合数据 | ||
| 239 | +// //判断是否成功查询到轨迹点 | ||
| 240 | +// if (null == queryResultPoints) { | ||
| 241 | +// QMUITipDialogUtil.textDialog(getContext(), "正在获取轨迹信息,请稍后...", 1); | ||
| 242 | +// } else { | ||
| 243 | +// //隐藏面板视图 | ||
| 244 | +//// fragment.binding.slidingLayout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN); | ||
| 245 | +// fragment.binding.slidingLayout.setPanelHeight(ScreenUtil.dip2px(getContext(),100)); | ||
| 246 | +// fragment.binding.slidingLayout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED); | ||
| 247 | +// //让运营选择最佳的截图 | ||
| 248 | +// SelectDialog selectDialog = new SelectDialog(getContext(), "当前赛事图是否\n已经调整到最佳效果?", "否", new SelectDialog.DialogInterface() { | ||
| 249 | +// @Override | ||
| 250 | +// public void onClick(SelectDialog dialog) { | ||
| 251 | +// dialog.dismiss(); | ||
| 252 | +// } | ||
| 253 | +// }, "是", new SelectDialog.DialogInterface() { | ||
| 254 | +// @Override | ||
| 255 | +// public void onClick(SelectDialog dialog) { | ||
| 256 | +// if (null != allMapOverlays) { | ||
| 257 | +// for (Overlay overlay : allMapOverlays) { | ||
| 258 | +// overlay.remove(); | ||
| 259 | +// } | ||
| 260 | +// } | ||
| 261 | +// dialog.dismiss(); | ||
| 262 | +// QMUITipDialogUtil.textDialog(getContext(), "正在截取赛事图片,请稍后", 1); | ||
| 263 | +// //延迟一秒进行截图,以免把打的点都截取到 | ||
| 264 | +// new Handler().postDelayed(new Runnable() { | ||
| 265 | +// @Override | ||
| 266 | +// public void run() { | ||
| 267 | +// baiduMap.snapshot(new BaiduMap.SnapshotReadyCallback() { | ||
| 268 | +// @Override | ||
| 269 | +// public void onSnapshotReady(Bitmap bitmap) { | ||
| 270 | +// if (null == bitmap) { | ||
| 271 | +// QMUITipDialogUtil.dismessDialog(); | ||
| 272 | +// QMUITipDialogUtil.failedDialog(getContext(), "赛事图片截取失败,请重试", 2); | ||
| 273 | +// return; | ||
| 274 | +// } | ||
| 275 | +// | ||
| 276 | +// //开始保存截屏 | ||
| 277 | +// try { | ||
| 278 | +// SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); | ||
| 279 | +// File image = new File(getContext().getExternalCacheDir() + "/location_screenshot_" + sdf.format(new Date()) + ".jpeg"); | ||
| 280 | +// FileOutputStream fos = new FileOutputStream(当前赛事图是否 | ||
| 281 | +//已经调整到最佳效果?image); | ||
| 282 | +// boolean b = bitmap.compress(Bitmap.CompressFormat.PNG, 100, fos); | ||
| 283 | +// fos.flush(); | ||
| 284 | +// fos.close(); | ||
| 285 | +// //获取保存截图地址 | ||
| 286 | +//// image.getAbsolutePath() | ||
| 287 | +// } catch (Exception e) { | ||
| 288 | +// QMUITipDialogUtil.dismessDialog(); | ||
| 289 | +// QMUITipDialogUtil.failedDialog(getContext(), "赛事图片截取失败,请重试", 2); | ||
| 290 | +// e.printStackTrace(); | ||
| 291 | +// } | ||
| 292 | +// } | ||
| 293 | +// }); | ||
| 294 | +// } | ||
| 295 | +// }, 1000); | ||
| 296 | +// } | ||
| 297 | +// }); | ||
| 298 | +// selectDialog.setCanceledOnTouchOutside(false); | ||
| 299 | +// selectDialog.setCancelable(false); | ||
| 300 | +// selectDialog.show(); | ||
| 301 | +// } | ||
| 302 | +// } | ||
| 303 | +// }); | ||
| 304 | + | ||
| 305 | + } | ||
| 306 | + | ||
| 307 | + private void queryWalkTrace(long startTime, long endTime) { | ||
| 308 | + MyMapUtil.queryHistoryTrace(getContext(), mClient, CommonInfo.getUserId(getContext()), startTime, endTime, new MyMapUtil.CallBack() { | ||
| 309 | + @Override | ||
| 310 | + public void success(List<LatLng> resultPoints) { | ||
| 311 | + queryResultPoints = resultPoints; | ||
| 312 | + if (null != resultPoints) { | ||
| 313 | + //绘制轨迹 | ||
| 314 | + MyMapUtil.drawHistoryTrack(getContext(), baiduMap, resultPoints, SortType.asc, R.color.green_round, R.drawable.icon_start, R.drawable.icon_end); | ||
| 315 | + } else { | ||
| 316 | + SelectDialog selectDialog = new SelectDialog(getContext(), "轨迹获取失败,是否重试?", "取消", new SelectDialog.DialogInterface() { | ||
| 317 | + @Override | ||
| 318 | + public void onClick(SelectDialog dialog) { | ||
| 319 | + dialog.dismiss(); | ||
| 320 | + } | ||
| 321 | + }, "重试", new SelectDialog.DialogInterface() { | ||
| 322 | + @Override | ||
| 323 | + public void onClick(SelectDialog dialog) { | ||
| 324 | + dialog.dismiss(); | ||
| 325 | + queryWalkTrace(startTime, endTime); | ||
| 326 | + } | ||
| 327 | + }); | ||
| 328 | + selectDialog.setCancelable(false); | ||
| 329 | + selectDialog.setCanceledOnTouchOutside(false); | ||
| 330 | + if (!selectDialog.isShowing()) { | ||
| 331 | + selectDialog.show(); | ||
| 332 | + } | ||
| 333 | + } | ||
| 334 | + } | ||
| 335 | + }); | ||
| 336 | + } | ||
| 337 | + | ||
| 338 | + private void getBaiDuSnap() { | ||
| 339 | + baiduMap.snapshot(new BaiduMap.SnapshotReadyCallback() { | ||
| 340 | + @Override | ||
| 341 | + public void onSnapshotReady(Bitmap bitmap) { | ||
| 342 | + QMUITipDialogUtil.dismessDialog(); | ||
| 343 | + if (null == bitmap) { | ||
| 344 | + QMUITipDialogUtil.failedDialog(getContext(), "赛事图片截取失败,请重试", 2); | ||
| 345 | + return; | ||
| 346 | + } | ||
| 347 | + //开始保存截屏 | ||
| 348 | + try { | ||
| 349 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); | ||
| 350 | + File image = new File(getContext().getExternalCacheDir() + "/location_screenshot_" + sdf.format(new Date()) + ".jpeg"); | ||
| 351 | + FileOutputStream fos = new FileOutputStream(image); | ||
| 352 | + boolean b = bitmap.compress(Bitmap.CompressFormat.PNG, 100, fos); | ||
| 353 | + fos.flush(); | ||
| 354 | + fos.close(); | ||
| 355 | + //获取保存截图地址 | ||
| 356 | + String roadMapPath = image.getAbsolutePath(); | ||
| 357 | + //开始上传 | ||
| 358 | + uploadRoadMapPic(roadMapPath); | ||
| 359 | + } catch (Exception e) { | ||
| 360 | + QMUITipDialogUtil.dismessDialog(); | ||
| 361 | + QMUITipDialogUtil.failedDialog(getContext(), "赛事图片截取失败,请重试", 2); | ||
| 362 | + e.printStackTrace(); | ||
| 363 | + } | ||
| 364 | + } | ||
| 365 | + }); | ||
| 366 | + } | ||
| 367 | + | ||
| 368 | + /** | ||
| 369 | + * 上传赛事图片 | ||
| 370 | + * | ||
| 371 | + * @param roadMapPath | ||
| 372 | + */ | ||
| 373 | + private void uploadRoadMapPic(String roadMapPath) { | ||
| 374 | + if (!TextUtils.isEmpty(roadMapPath)) { | ||
| 375 | + QMUITipDialogUtil.loadingDialog(getContext(), "正在上传赛事图片,请稍后", false); | ||
| 376 | + List<String> imagePaths = new ArrayList<>(); | ||
| 377 | + imagePaths.add(roadMapPath); | ||
| 378 | + UploadLogic.uploadAddressPicInfo(getContext(), imagePaths, new Event<String>() | ||
| 379 | + .setFailureCallback(new FailureCallback() { | ||
| 380 | + @Override | ||
| 381 | + public void onFailure(int i, String s) { | ||
| 382 | + QMUITipDialogUtil.dismessDialog(); | ||
| 383 | + SelectDialog selectDialog = new SelectDialog(getContext(), "赛事图片上传失败,是否重试?", "取消", new SelectDialog.DialogInterface() { | ||
| 384 | + @Override | ||
| 385 | + public void onClick(SelectDialog dialog) { | ||
| 386 | + dialog.dismiss(); | ||
| 387 | + } | ||
| 388 | + }, "重试", new SelectDialog.DialogInterface() { | ||
| 389 | + @Override | ||
| 390 | + public void onClick(SelectDialog dialog) { | ||
| 391 | + dialog.dismiss(); | ||
| 392 | + uploadRoadMapPic(roadMapPath); | ||
| 393 | + } | ||
| 394 | + }); | ||
| 395 | + selectDialog.setCancelable(false); | ||
| 396 | + selectDialog.setCanceledOnTouchOutside(false); | ||
| 397 | + if (!selectDialog.isShowing()) { | ||
| 398 | + selectDialog.show(); | ||
| 399 | + } | ||
| 400 | + | ||
| 401 | + } | ||
| 402 | + }) | ||
| 403 | + .setSuccessCallback(new SuccessCallback<String>() { | ||
| 404 | + @Override | ||
| 405 | + public void onSuccess(String data) { | ||
| 406 | + QMUITipDialogUtil.dismessDialog(); | ||
| 407 | + //开始把数据传到服务端 | ||
| 408 | + collUserStepEntity = CollStepUtil.getCollUserStepData(getContext(), CollCommonInfo.getUserId(getContext())); | ||
| 409 | + if (null != fragment.getPresenter() || null == fragment.getActivity() || null == collUserStepEntity || TextUtils.isEmpty(data)) { | ||
| 410 | + fragment.getPresenter().uploadTraceDateToServer(fragment.getActivity(), collUserStepEntity, data); | ||
| 411 | + } | ||
| 412 | + } | ||
| 413 | + }) | ||
| 414 | + ); | ||
| 415 | + // | ||
| 416 | + } | ||
| 417 | + } | ||
| 418 | + | ||
| 419 | + private void addFence() { | ||
| 420 | + QMUITipDialogUtil.dismessDialog(); | ||
| 421 | + QMUITipDialogUtil.loadingDialog(getContext(), "正在创建地理围栏", false); | ||
| 422 | + CreateFenceRequest createFenceRequest = null; | ||
| 423 | + int offset = Constant.FENCE_OFFSET;// 偏离距离 | ||
| 424 | + int denoise = Constant.FENCE_DENOISE; //围栏去噪精度 | ||
| 425 | + if (null != collUserStepEntity) { | ||
| 426 | + //赛事标题作为围栏名称 | ||
| 427 | + String eventId = collUserStepEntity.getStreetId(); | ||
| 428 | + if (mClient != null && !TextUtils.isEmpty(eventId) && null != collectLatLngs) { | ||
| 429 | + createFenceRequest = CreateFenceRequest.buildServerPolylineRequest(Constant.TAG, Constant.SERVICE_ID, eventId, "cc", collectLatLngs, offset, denoise, CoordType.gcj02); | ||
| 430 | + mClient.createFence(createFenceRequest, CollRunningFinishFragmentView.this); | ||
| 431 | + } | ||
| 432 | + } | ||
| 433 | + } | ||
| 434 | + | ||
| 435 | + // //判断地理围栏是否创建成功 | ||
| 436 | +// if (null != collUserStepEntity) { | ||
| 437 | +// if (TextUtils.isEmpty(collUserStepEntity.getFenceId())) { | ||
| 438 | +// //开始创建地理围栏 | ||
| 439 | +// QMUITipDialogUtil.loadingDialog(getContext(), "正在创建地理围栏", false); | ||
| 440 | +// CreateFenceRequest createFenceRequest = null; | ||
| 441 | +// int offset = Constant.FENCE_OFFSET;// 偏离距离 | ||
| 442 | +// int denoise = Constant.FENCE_DENOISE; //围栏去噪精度 | ||
| 443 | +// if (null != collUserStepEntity) { | ||
| 444 | +// //赛事标题作为围栏名称 | ||
| 445 | +// String fenceName = collUserStepEntity.getStreetTitle(); | ||
| 446 | +// if (mClient != null && !TextUtils.isEmpty(fenceName) && null != collectLatLngs) { | ||
| 447 | +// if (createFenceRequest == null) { | ||
| 448 | +// createFenceRequest = CreateFenceRequest.buildServerPolylineRequest(Constant.TAG, Constant.SERVICE_ID, fenceName, "", collectLatLngs, offset, denoise, CoordType.gcj02); | ||
| 449 | +// mClient.createFence(createFenceRequest, CollRunningFinishFragmentView.this); | ||
| 450 | +// } | ||
| 451 | +// } | ||
| 452 | +// } | ||
| 453 | +// } else { | ||
| 454 | +// //已经存在地理围栏(直接将数据传给服务器) | ||
| 455 | +// | ||
| 456 | +// } | ||
| 457 | +// } | ||
| 458 | + public void initMap() { | ||
| 459 | + this.mMapView = fragment.binding.mapView; | ||
| 460 | + if (baiduMap == null) { | ||
| 461 | + baiduMap = mMapView.getMap(); | ||
| 462 | + } | ||
| 463 | + if (mUiSettings == null) { | ||
| 464 | + mUiSettings = baiduMap.getUiSettings(); | ||
| 465 | + } | ||
| 466 | + if (mClient == null) { | ||
| 467 | + mClient = new LBSTraceClient(getContext()); | ||
| 468 | + } | ||
| 469 | + //启动所有手势 | ||
| 470 | + mUiSettings.setAllGesturesEnabled(true); | ||
| 471 | + //通过设置enable为true或false 选择是否显示缩放按钮 | ||
| 472 | + mMapView.showZoomControls(false); | ||
| 473 | + mUiSettings.setEnlargeCenterWithDoubleClickEnable(true); | ||
| 474 | + //隐藏自带的指南针,改用自定义指南针 杨帅 | ||
| 475 | + mUiSettings.setCompassEnabled(false); | ||
| 476 | + //显示定位图层 | ||
| 477 | + baiduMap.setMyLocationEnabled(false); | ||
| 478 | + LocationClientOption option = new LocationClientOption(); | ||
| 479 | + option.setOpenGps(true); // 打开gps | ||
| 480 | + //可选,设置返回经纬度坐标类型,默认GCJ02 | ||
| 481 | + //GCJ02:国测局坐标; | ||
| 482 | + //BD09ll:百度经纬度坐标; | ||
| 483 | + //BD09:百度墨卡托坐标; | ||
| 484 | + //海外地区定位,无需设置坐标类型,统一返回WGS84类型坐标 | ||
| 485 | + option.setCoorType("gcj02"); // 设置坐标类型 | ||
| 486 | + //可选,默认false,设置是否开启Gps定位 | ||
| 487 | + option.setOpenGps(true); | ||
| 488 | + //设置打开自动回调位置模式,该开关打开后,期间只要定位SDK检测到位置变化就会主动回调给开发者,该模式下开发者无需再关心定位间隔是多少,定位SDK本身发现位置变化就会及时回调给开发者 | ||
| 489 | + option.setOpenAutoNotifyMode(); | ||
| 490 | + //可选,默认高精度,设置定位模式,高精度,低功耗,仅设备 | ||
| 491 | + //LocationMode.Hight_Accuracy:高精度; | ||
| 492 | + //LocationMode. Battery_Saving:低功耗; | ||
| 493 | + //LocationMode. Device_Sensors:仅使用设备; | ||
| 494 | + option.setLocationMode(LocationClientOption.LocationMode.Hight_Accuracy); | ||
| 495 | + //可选,设置是否需要地址信息,默认不需要 | ||
| 496 | + option.setIsNeedAddress(false); | ||
| 497 | + //可选,设置是否需要地址描述 | ||
| 498 | + option.setIsNeedLocationDescribe(false); | ||
| 499 | + //可选,设置是否需要设备方向结果 | ||
| 500 | + option.setNeedDeviceDirect(false); | ||
| 501 | + //设置打开自动回调位置模式,该开关打开后,期间只要定位SDK检测到位置变化就会主动回调给开发者 | ||
| 502 | + //minTimeInterval - 最短定位时间间隔,单位毫秒,最小值0,开发者可以在设置希望的位置回调最短时间间隔 | ||
| 503 | + //minDistance - 最短定位距离间隔,单位米,最小值0,开发者可以设置希望的位置回调距离间隔 | ||
| 504 | + //locSensitivity - 定位变化敏感程度,LOC_SENSITIVITY_HIGHT,LOC_SENSITIVITY_MIDDLE,LOC_SENSITIVITY_LOW | ||
| 505 | + option.setOpenAutoNotifyMode(3000, 1, LocationClientOption.LOC_SENSITIVITY_HIGHT); | ||
| 506 | + //可选,定位SDK内部是一个service,并放到了独立进程。 | ||
| 507 | + //设置是否在stop的时候杀死这个进程,默认(建议)不杀死,即setIgnoreKillProcess(true) | ||
| 508 | + option.setIgnoreKillProcess(true); | ||
| 509 | + | ||
| 510 | + } | ||
| 511 | + | ||
| 512 | + public void onResume() { | ||
| 513 | + if (null != mMapView) { | ||
| 514 | + mMapView.onResume(); | ||
| 515 | + } | ||
| 516 | + } | ||
| 517 | + | ||
| 518 | + public void onPause() { | ||
| 519 | + if (null != mMapView) { | ||
| 520 | + mMapView.onPause(); | ||
| 521 | + } | ||
| 522 | + } | ||
| 523 | + | ||
| 524 | + public void onDestroy() { | ||
| 525 | + if (null != allMapOverlays) { | ||
| 526 | + for (Overlay overlay : allMapOverlays) { | ||
| 527 | + overlay.remove(); | ||
| 528 | + } | ||
| 529 | + allMapOverlays = null; | ||
| 530 | + baiduMap.clear(); | ||
| 531 | + } | ||
| 532 | + | ||
| 533 | + if (mMapView != null) { | ||
| 534 | + mMapView.onDestroy(); | ||
| 535 | + mMapView = null; | ||
| 536 | + } | ||
| 537 | + } | ||
| 538 | + | ||
| 539 | + /** | ||
| 540 | + * 常见围栏成功回调 | ||
| 541 | + * | ||
| 542 | + * @param createFenceResponse | ||
| 543 | + */ | ||
| 544 | + @Override | ||
| 545 | + public void onCreateFenceCallback(CreateFenceResponse createFenceResponse) { | ||
| 546 | + if (null == getContext() || null == createFenceResponse) { | ||
| 547 | + return; | ||
| 548 | + } | ||
| 549 | + Log.e("地理围栏", "状态: " + createFenceResponse.getStatus() + ",返回信息:" + createFenceResponse.getMessage()); | ||
| 550 | + //关闭提示框 | ||
| 551 | + QMUITipDialogUtil.dismessDialog(); | ||
| 552 | + //判断是否成功 | ||
| 553 | + if (0 == createFenceResponse.getStatus()) { | ||
| 554 | + //获取围栏id | ||
| 555 | + long fenceId = createFenceResponse.getFenceId(); | ||
| 556 | + Log.e("地理围栏", "创建围栏成功ID: " + fenceId + ",围栏名称" + createFenceResponse.getFenceName()); | ||
| 557 | + //保存到数据库中 | ||
| 558 | + CollStepUtil.setFenceId(getContext(), CollCommonInfo.getUserId(getContext()), fenceId + ""); | ||
| 559 | + //提交到后台 | ||
| 560 | + | ||
| 561 | + } else { | ||
| 562 | + //创建围栏失败 | ||
| 563 | + //创建提示信息 | ||
| 564 | + QMUITipDialogUtil.failedDialog(getContext(), createFenceResponse.getMessage(), 2); | ||
| 565 | + } | ||
| 566 | + | ||
| 567 | + } | ||
| 568 | + | ||
| 569 | + @Override | ||
| 570 | + public void onUpdateFenceCallback(UpdateFenceResponse updateFenceResponse) { | ||
| 571 | + | ||
| 572 | + } | ||
| 573 | + | ||
| 574 | + @Override | ||
| 575 | + public void onDeleteFenceCallback(DeleteFenceResponse deleteFenceResponse) { | ||
| 576 | + | ||
| 577 | + } | ||
| 578 | + | ||
| 579 | + @Override | ||
| 580 | + public void onFenceListCallback(FenceListResponse fenceListResponse) { | ||
| 581 | + | ||
| 582 | + } | ||
| 583 | + | ||
| 584 | + @Override | ||
| 585 | + public void onMonitoredStatusCallback(MonitoredStatusResponse monitoredStatusResponse) { | ||
| 586 | + | ||
| 587 | + } | ||
| 588 | + | ||
| 589 | + @Override | ||
| 590 | + public void onMonitoredStatusByLocationCallback(MonitoredStatusByLocationResponse monitoredStatusByLocationResponse) { | ||
| 591 | + | ||
| 592 | + } | ||
| 593 | + | ||
| 594 | + @Override | ||
| 595 | + public void onHistoryAlarmCallback(HistoryAlarmResponse historyAlarmResponse) { | ||
| 596 | + | ||
| 597 | + } | ||
| 598 | + | ||
| 599 | + @Override | ||
| 600 | + public void onAddMonitoredPersonCallback(AddMonitoredPersonResponse addMonitoredPersonResponse) { | ||
| 601 | + | ||
| 602 | + } | ||
| 603 | + | ||
| 604 | + @Override | ||
| 605 | + public void onDeleteMonitoredPersonCallback(DeleteMonitoredPersonResponse deleteMonitoredPersonResponse) { | ||
| 606 | + | ||
| 607 | + } | ||
| 608 | + | ||
| 609 | + @Override | ||
| 610 | + public void onListMonitoredPersonCallback(ListMonitoredPersonResponse listMonitoredPersonResponse) { | ||
| 611 | + | ||
| 49 | } | 612 | } |
| 50 | } | 613 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/CollRunningMapFragmentView.java
| @@ -32,11 +32,16 @@ import com.baidu.mapapi.map.Overlay; | @@ -32,11 +32,16 @@ import com.baidu.mapapi.map.Overlay; | ||
| 32 | import com.baidu.mapapi.map.UiSettings; | 32 | import com.baidu.mapapi.map.UiSettings; |
| 33 | import com.baidu.mapapi.model.LatLng; | 33 | import com.baidu.mapapi.model.LatLng; |
| 34 | import com.baidu.mapapi.utils.DistanceUtil; | 34 | import com.baidu.mapapi.utils.DistanceUtil; |
| 35 | +import com.baidu.trace.model.SortType; | ||
| 36 | +import com.cnlive.moudle.collectionTrace.model.CollectPoint; | ||
| 37 | +import com.cnlive.moudle.collectionTrace.service.CollStepService; | ||
| 38 | +import com.cnlive.moudle.collectionTrace.ui.activity.CollRunningFinishActivity; | ||
| 35 | import com.cnlive.moudle.collectionTrace.ui.fragment.CollRunningMapFragment; | 39 | import com.cnlive.moudle.collectionTrace.ui.fragment.CollRunningMapFragment; |
| 36 | import com.cnlive.moudle.collectionTrace.commonInfo.CollCommonInfo; | 40 | import com.cnlive.moudle.collectionTrace.commonInfo.CollCommonInfo; |
| 37 | import com.cnlive.moudle.pedometer.model.Constant; | 41 | import com.cnlive.moudle.pedometer.model.Constant; |
| 38 | import com.cnlive.moudle.pedometer.net.bean.RunRaceDetailInfo; | 42 | import com.cnlive.moudle.pedometer.net.bean.RunRaceDetailInfo; |
| 39 | import com.cnlive.moudle.pedometer.sql.entity.CollUserStepEntity; | 43 | import com.cnlive.moudle.pedometer.sql.entity.CollUserStepEntity; |
| 44 | +import com.cnlive.moudle.pedometer.ui.widget.SelectDialog; | ||
| 40 | import com.cnlive.moudle.pedometer.utils.BitmapUtil; | 45 | import com.cnlive.moudle.pedometer.utils.BitmapUtil; |
| 41 | import com.cnlive.moudle.pedometer.utils.ButtonAnimUtil; | 46 | import com.cnlive.moudle.pedometer.utils.ButtonAnimUtil; |
| 42 | import com.cnlive.moudle.collectionTrace.utils.CollStepUtil; | 47 | import com.cnlive.moudle.collectionTrace.utils.CollStepUtil; |
| @@ -60,26 +65,31 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener | @@ -60,26 +65,31 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener | ||
| 60 | private BitmapDescriptor mCurrentMarker;//定位图标 | 65 | private BitmapDescriptor mCurrentMarker;//定位图标 |
| 61 | private static int accuracyCircleFillColor; | 66 | private static int accuracyCircleFillColor; |
| 62 | private static int accuracyCircleStrokeColor; | 67 | private static int accuracyCircleStrokeColor; |
| 63 | - private static MyLocationData mylocation; | 68 | + private MyLocationData followMyLocation; |
| 64 | boolean isFirstLoc = true; // 是否首次定位 | 69 | boolean isFirstLoc = true; // 是否首次定位 |
| 65 | private MarkerOptions currentMark; | 70 | private MarkerOptions currentMark; |
| 66 | - private LatLng myCurLatLng; | ||
| 67 | private Double lastX = 0.0; | 71 | private Double lastX = 0.0; |
| 68 | private int mCurrentDirection = 0; | 72 | private int mCurrentDirection = 0; |
| 69 | - private double mCurrentLat = 0.0; | ||
| 70 | - private double mCurrentLon = 0.0; | ||
| 71 | private float mCurrentAccracy; | 73 | private float mCurrentAccracy; |
| 72 | // 定位相关 | 74 | // 定位相关 |
| 73 | private LocationClient mLocClient; | 75 | private LocationClient mLocClient; |
| 74 | public MyLocationListenner myListener = new MyLocationListenner(); | 76 | public MyLocationListenner myListener = new MyLocationListenner(); |
| 75 | - private final int DEFULT_ZOOM = 17; | 77 | + private int DEFULT_ZOOM = 17; |
| 76 | private boolean isFirstLoadMap = true; | 78 | private boolean isFirstLoadMap = true; |
| 77 | private Overlay currentLine; | 79 | private Overlay currentLine; |
| 78 | - private List<LatLng> currentPoints; | 80 | + private List<LatLng> currentWalkPoints;//用户当前行走的线的集合 |
| 79 | private CollUserStepEntity userStepEntity; | 81 | private CollUserStepEntity userStepEntity; |
| 80 | private String uid; | 82 | private String uid; |
| 81 | private RunRaceDetailInfo runRaceDetailInfo; | 83 | private RunRaceDetailInfo runRaceDetailInfo; |
| 82 | - private List<Overlay> overlays; | 84 | + private List<Overlay> allMapOverlays; |
| 85 | + private SelectDialog selectDialog; | ||
| 86 | + private SelectDialog endSelectDialog; | ||
| 87 | + private boolean isShowFollowAddress = false;//是否显示跟随地址 | ||
| 88 | + private boolean isShowEndFollowAddress = false;//是否显示结束跟随地址 | ||
| 89 | + | ||
| 90 | + private String currentAddress; | ||
| 91 | + private LatLng currentImportLatLng; | ||
| 92 | + private String employTime = "";//用时 | ||
| 83 | 93 | ||
| 84 | public CollRunningMapFragmentView(CollRunningMapFragment fragment) { | 94 | public CollRunningMapFragmentView(CollRunningMapFragment fragment) { |
| 85 | this.fragment = fragment; | 95 | this.fragment = fragment; |
| @@ -90,7 +100,10 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener | @@ -90,7 +100,10 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener | ||
| 90 | } | 100 | } |
| 91 | 101 | ||
| 92 | public void initView(RunRaceDetailInfo runRaceDetailInfo) { | 102 | public void initView(RunRaceDetailInfo runRaceDetailInfo) { |
| 93 | - currentPoints = new ArrayList<>(); | 103 | + //初始化打点提示框 |
| 104 | + initSelectDialog(); | ||
| 105 | + //初始化结束打点提示框 | ||
| 106 | + initFinishSelectDialog(); | ||
| 94 | this.runRaceDetailInfo = runRaceDetailInfo; | 107 | this.runRaceDetailInfo = runRaceDetailInfo; |
| 95 | uid = CollCommonInfo.getUserId(getContext()); | 108 | uid = CollCommonInfo.getUserId(getContext()); |
| 96 | userStepEntity = CollStepUtil.getCollUserStepData(getContext(), uid); | 109 | userStepEntity = CollStepUtil.getCollUserStepData(getContext(), uid); |
| @@ -111,26 +124,88 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener | @@ -111,26 +124,88 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener | ||
| 111 | fragment.binding.tvCurrentDiatance.setText(CollStepUtil.getWalkDistanceKM(Long.parseLong(userStepEntity.getStepCount())) + ""); | 124 | fragment.binding.tvCurrentDiatance.setText(CollStepUtil.getWalkDistanceKM(Long.parseLong(userStepEntity.getStepCount())) + ""); |
| 112 | } | 125 | } |
| 113 | //设置是否需要设置起点信息 | 126 | //设置是否需要设置起点信息 |
| 114 | - if (TextUtils.isEmpty(userStepEntity.getCollStartLatLng())||TextUtils.isEmpty(userStepEntity.getCollStartLatLngName())) { | 127 | + if (TextUtils.isEmpty(userStepEntity.getCollStartPointData())) { |
| 115 | //开始设置 | 128 | //开始设置 |
| 116 | if (!TextUtils.isEmpty(runRaceDetailInfo.getCollStartLatLng()) && !TextUtils.isEmpty(runRaceDetailInfo.getCollStartLntLngName())) { | 129 | if (!TextUtils.isEmpty(runRaceDetailInfo.getCollStartLatLng()) && !TextUtils.isEmpty(runRaceDetailInfo.getCollStartLntLngName())) { |
| 117 | - CollStepUtil.setCollStartPointData(getContext(), uid, runRaceDetailInfo.getCollStartLntLngName(), runRaceDetailInfo.getCollStartLatLng()); | 130 | + CollectPoint collectPoint = new CollectPoint(); |
| 131 | + LatLng latLng = GsonUtil.GsonToBean(runRaceDetailInfo.getCollStartLatLng(), LatLng.class); | ||
| 132 | + if (null != latLng) { | ||
| 133 | + collectPoint.setLatitude(latLng.latitude); | ||
| 134 | + collectPoint.setLongitude(latLng.longitude); | ||
| 135 | + collectPoint.setPointName(runRaceDetailInfo.getCollStartLntLngName()); | ||
| 136 | + CollStepUtil.setCollStartPointData(getContext(), uid, collectPoint); | ||
| 137 | + | ||
| 138 | + } | ||
| 118 | } | 139 | } |
| 119 | } | 140 | } |
| 120 | initChrom(); | 141 | initChrom(); |
| 121 | //初始化起点 | 142 | //初始化起点 |
| 122 | - overlays = new ArrayList<>(); | 143 | + allMapOverlays = new ArrayList<>(); |
| 123 | //打起点(重新获取数据) | 144 | //打起点(重新获取数据) |
| 124 | userStepEntity = CollStepUtil.getCollUserStepData(getContext(), uid); | 145 | userStepEntity = CollStepUtil.getCollUserStepData(getContext(), uid); |
| 125 | - if (!TextUtils.isEmpty(userStepEntity.getCollStartLatLng())) { | ||
| 126 | - LatLng startLatLng = GsonUtil.GsonToBean(userStepEntity.getCollStartLatLng(), LatLng.class); | ||
| 127 | - if (null != startLatLng) { | ||
| 128 | - List<Overlay> resultOverlays = MyMapUtil.setStartMarker(getContext(), baiduMap, startLatLng, R.drawable.icon_start); | ||
| 129 | - if (null != resultOverlays) { | ||
| 130 | - this.overlays.addAll(resultOverlays); | 146 | + //查询历史轨迹(用于用户返回后再次进入,无法显示轨迹问题) |
| 147 | + if (0 != userStepEntity.getStartTimeStamp()) { | ||
| 148 | + //获取当前时间戳 | ||
| 149 | + long currentTimeStamp = TimeUtil.getNowTimeStamp(); | ||
| 150 | + //获取用户开始时间 | ||
| 151 | + long userStartTime = userStepEntity.getStartTimeStamp(); | ||
| 152 | + double result = currentTimeStamp - userStartTime; | ||
| 153 | + //超过一分钟才进行查询 | ||
| 154 | + if (result > 1 * 60) { | ||
| 155 | + if (null != CollStepService.mClient) { | ||
| 156 | + MyMapUtil.queryHistoryTrace(getContext(), CollStepService.mClient, CollStepService.entityName, userStartTime, currentTimeStamp, new MyMapUtil.CallBack() { | ||
| 157 | + @Override | ||
| 158 | + public void success(List<LatLng> resultPoints) { | ||
| 159 | + if (null != resultPoints && resultPoints.size() > 1) { | ||
| 160 | + //绘制历史轨迹 | ||
| 161 | + MyMapUtil.drawHistoryTrack(getContext(), baiduMap, resultPoints, SortType.asc, R.color.green_round, R.drawable.icon_start, 0); | ||
| 162 | + //将最后一个点添加到用户走的线中 | ||
| 163 | + currentWalkPoints = new ArrayList<>(); | ||
| 164 | + currentWalkPoints.add(resultPoints.get(resultPoints.size() - 1)); | ||
| 165 | + } | ||
| 166 | + } | ||
| 167 | + }); | ||
| 168 | + } | ||
| 169 | + } else { | ||
| 170 | + //绘制起点 | ||
| 171 | + if (!TextUtils.isEmpty(userStepEntity.getCollStartPointData())) { | ||
| 172 | + CollectPoint collectPoint = GsonUtil.GsonToBean(userStepEntity.getCollStartPointData(), CollectPoint.class); | ||
| 173 | + if (null != collectPoint) { | ||
| 174 | + LatLng startLatLng = new LatLng(collectPoint.getLatitude(), collectPoint.getLongitude()); | ||
| 175 | + //把起点添加到用户走的实时轨迹中 | ||
| 176 | + currentWalkPoints = new ArrayList<>(); | ||
| 177 | + currentWalkPoints.add(startLatLng); | ||
| 178 | + List<Overlay> resultOverlays = MyMapUtil.setStartMarker(getContext(), baiduMap, startLatLng, R.drawable.icon_start); | ||
| 179 | + if (null != resultOverlays) { | ||
| 180 | + this.allMapOverlays.addAll(resultOverlays); | ||
| 181 | + } | ||
| 182 | + } | ||
| 183 | + } | ||
| 184 | + // | ||
| 185 | + } | ||
| 186 | + // | ||
| 187 | + } | ||
| 188 | + | ||
| 189 | + | ||
| 190 | + //更新可打点数量 | ||
| 191 | + int remainPointNum = updataCanTakePointCount(); | ||
| 192 | + if (remainPointNum != 0) { | ||
| 193 | + //展示点位信息 | ||
| 194 | + List<CollectPoint> collectPoints = CollStepUtil.getCollImportPointList(getContext(), CollCommonInfo.getUserId(getContext())); | ||
| 195 | + if (null != collectPoints) { | ||
| 196 | + for (CollectPoint point : collectPoints) { | ||
| 197 | + LatLng markLatLng = new LatLng(point.getLatitude(), point.getLongitude()); | ||
| 198 | + if (null != markLatLng) { | ||
| 199 | + //将点位显示到地图上 | ||
| 200 | + Overlay overlay = MyMapUtil.setMapMarker(getContext(), baiduMap, markLatLng, R.drawable.icon_map_import); | ||
| 201 | + if (null != overlay) { | ||
| 202 | + allMapOverlays.add(overlay); | ||
| 203 | + } | ||
| 204 | + } | ||
| 131 | } | 205 | } |
| 132 | } | 206 | } |
| 133 | } | 207 | } |
| 208 | + // | ||
| 134 | } | 209 | } |
| 135 | //返回键 | 210 | //返回键 |
| 136 | fragment.binding.flBack.setOnTouchListener(new View.OnTouchListener() { | 211 | fragment.binding.flBack.setOnTouchListener(new View.OnTouchListener() { |
| @@ -172,9 +247,144 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener | @@ -172,9 +247,144 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener | ||
| 172 | isFirstLoc = true; | 247 | isFirstLoc = true; |
| 173 | } | 248 | } |
| 174 | }); | 249 | }); |
| 250 | + //开始打点 | ||
| 251 | + fragment.binding.flTakeImportPoint.setOnClickListener(new View.OnClickListener() { | ||
| 252 | + @Override | ||
| 253 | + public void onClick(View view) { | ||
| 254 | + //更新可打点数量 | ||
| 255 | + int remainNum = updataCanTakePointCount(); | ||
| 256 | + if (remainNum != 0) { | ||
| 257 | + if (null != followMyLocation) { | ||
| 258 | + currentImportLatLng = new LatLng(followMyLocation.latitude, followMyLocation.longitude); | ||
| 259 | + } | ||
| 260 | + //获取当前地点 | ||
| 261 | + if (!TextUtils.isEmpty(currentAddress)) { | ||
| 262 | + selectDialog.setTipMessage("确定在" + "\"" + currentAddress + "\"" + "打点?"); | ||
| 263 | + selectDialog.show(); | ||
| 264 | + } else { | ||
| 265 | + isShowFollowAddress = true; | ||
| 266 | + Toast.makeText(getContext(), "正在获取当前地点信息,请稍后", Toast.LENGTH_SHORT).show(); | ||
| 267 | + } | ||
| 268 | + } else { | ||
| 269 | + Toast.makeText(getContext(), "打点数量超过最大限制,无法打点!", Toast.LENGTH_SHORT).show(); | ||
| 270 | + } | ||
| 271 | + } | ||
| 272 | + }); | ||
| 273 | + | ||
| 274 | + //结束按钮点击事件 | ||
| 275 | + fragment.binding.flEndPoint.setOnClickListener(new View.OnClickListener() { | ||
| 276 | + @Override | ||
| 277 | + public void onClick(View view) { | ||
| 278 | + if (null != followMyLocation) { | ||
| 279 | + currentImportLatLng = new LatLng(followMyLocation.latitude, followMyLocation.longitude); | ||
| 280 | + //获取当前地点 | ||
| 281 | + if (!TextUtils.isEmpty(currentAddress)) { | ||
| 282 | + endSelectDialog.setTipMessage("确定将" + "\"" + currentAddress + "\"" + "设为结束地点?"); | ||
| 283 | + endSelectDialog.show(); | ||
| 284 | + } else { | ||
| 285 | + isShowEndFollowAddress = true; | ||
| 286 | + Toast.makeText(getContext(), "正在获取当前地点信息,请稍后", Toast.LENGTH_SHORT).show(); | ||
| 287 | + } | ||
| 288 | + } | ||
| 289 | + } | ||
| 290 | + }); | ||
| 175 | 291 | ||
| 176 | } | 292 | } |
| 177 | 293 | ||
| 294 | + /** | ||
| 295 | + * 更新可打点位数量 | ||
| 296 | + * | ||
| 297 | + * @return | ||
| 298 | + */ | ||
| 299 | + private int updataCanTakePointCount() { | ||
| 300 | + //获取用户可打点的数量 | ||
| 301 | + int canTakePointCount = CollStepUtil.getCollImportPointSize(getContext(), CollCommonInfo.getUserId(getContext())); | ||
| 302 | + if (canTakePointCount < 98) { | ||
| 303 | + canTakePointCount = 98 - canTakePointCount; | ||
| 304 | + } else { | ||
| 305 | + canTakePointCount = 0; | ||
| 306 | + } | ||
| 307 | + fragment.binding.tvCanTakePointSize.setText("可打点数量:" + canTakePointCount + "个"); | ||
| 308 | + return canTakePointCount; | ||
| 309 | + } | ||
| 310 | + | ||
| 311 | + private void initSelectDialog() { | ||
| 312 | + if (selectDialog == null) { | ||
| 313 | + selectDialog = new SelectDialog(getContext(), "标题", "否", new SelectDialog.DialogInterface() { | ||
| 314 | + @Override | ||
| 315 | + public void onClick(SelectDialog dialog) { | ||
| 316 | + dialog.dismiss(); | ||
| 317 | + isShowFollowAddress = false; | ||
| 318 | + } | ||
| 319 | + }, "是", new SelectDialog.DialogInterface() { | ||
| 320 | + @Override | ||
| 321 | + public void onClick(SelectDialog dialog) { | ||
| 322 | + dialog.dismiss(); | ||
| 323 | + isShowFollowAddress = false; | ||
| 324 | + if (null == currentImportLatLng || TextUtils.isEmpty(currentAddress)) { | ||
| 325 | + return; | ||
| 326 | + } | ||
| 327 | + //将点位保存在数据库中 | ||
| 328 | + CollectPoint collectPoint = new CollectPoint(); | ||
| 329 | + collectPoint.setLatitude(currentImportLatLng.latitude); | ||
| 330 | + collectPoint.setLongitude(currentImportLatLng.longitude); | ||
| 331 | + collectPoint.setPointName(currentAddress); | ||
| 332 | + CollStepUtil.setCollImportPoints(getContext(), CollCommonInfo.getUserId(getContext()), collectPoint); | ||
| 333 | + //将点位显示到地图上 | ||
| 334 | + Overlay overlay = MyMapUtil.setMapMarker(getContext(), baiduMap, currentImportLatLng, R.drawable.icon_map_import); | ||
| 335 | + if (null != overlay) { | ||
| 336 | + allMapOverlays.add(overlay); | ||
| 337 | + } | ||
| 338 | + //更新可打点数量 | ||
| 339 | + updataCanTakePointCount(); | ||
| 340 | + } | ||
| 341 | + }); | ||
| 342 | + selectDialog.setCancelable(false); | ||
| 343 | + selectDialog.setCanceledOnTouchOutside(false); | ||
| 344 | + } | ||
| 345 | + } | ||
| 346 | + | ||
| 347 | + /** | ||
| 348 | + * 结束按钮 | ||
| 349 | + */ | ||
| 350 | + private void initFinishSelectDialog() { | ||
| 351 | + if (endSelectDialog == null) { | ||
| 352 | + endSelectDialog = new SelectDialog(getContext(), "标题", "否", new SelectDialog.DialogInterface() { | ||
| 353 | + @Override | ||
| 354 | + public void onClick(SelectDialog dialog) { | ||
| 355 | + dialog.dismiss(); | ||
| 356 | + isShowEndFollowAddress = false; | ||
| 357 | + } | ||
| 358 | + }, "是", new SelectDialog.DialogInterface() { | ||
| 359 | + @Override | ||
| 360 | + public void onClick(SelectDialog dialog) { | ||
| 361 | + dialog.dismiss(); | ||
| 362 | + isShowEndFollowAddress = false; | ||
| 363 | + if (null == currentImportLatLng || TextUtils.isEmpty(currentAddress)) { | ||
| 364 | + return; | ||
| 365 | + } | ||
| 366 | + //保存用户完成时间 | ||
| 367 | + CollStepUtil.setCollUserFinishTimeStamp(getContext(), CollCommonInfo.getUserId(getContext()), TimeUtil.getNowTimeStamp()); | ||
| 368 | + //设置终点信息 | ||
| 369 | + CollectPoint collectPoint = new CollectPoint(); | ||
| 370 | + collectPoint.setLatitude(currentImportLatLng.latitude); | ||
| 371 | + collectPoint.setLongitude(currentImportLatLng.longitude); | ||
| 372 | + collectPoint.setPointName(currentAddress); | ||
| 373 | + //设置用户用时 | ||
| 374 | + if (!TextUtils.isEmpty(employTime)) { | ||
| 375 | + CollStepUtil.setEmployTimeStamp(getContext(), CollCommonInfo.getUserId(getContext()), employTime); | ||
| 376 | + } | ||
| 377 | + //将终点数据保存在数据库中 | ||
| 378 | + CollStepUtil.setCollEndPointData(getContext(), CollCommonInfo.getUserId(getContext()), collectPoint); | ||
| 379 | + //跳转界面 | ||
| 380 | + CollRunningFinishActivity.startActivity(fragment.getActivity()); | ||
| 381 | + } | ||
| 382 | + }); | ||
| 383 | + endSelectDialog.setCancelable(false); | ||
| 384 | + endSelectDialog.setCanceledOnTouchOutside(false); | ||
| 385 | + } | ||
| 386 | + } | ||
| 387 | + | ||
| 178 | private void initChrom() { | 388 | private void initChrom() { |
| 179 | //设置计时监听 | 389 | //设置计时监听 |
| 180 | fragment.binding.chronometer.setOnChronometerTickListener(new Chronometer.OnChronometerTickListener() { | 390 | fragment.binding.chronometer.setOnChronometerTickListener(new Chronometer.OnChronometerTickListener() { |
| @@ -183,6 +393,8 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener | @@ -183,6 +393,8 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener | ||
| 183 | int hour = (int) ((SystemClock.elapsedRealtime() - chronometer.getBase()) / 1000 / 60 / 60); | 393 | int hour = (int) ((SystemClock.elapsedRealtime() - chronometer.getBase()) / 1000 / 60 / 60); |
| 184 | int minute = (int) ((SystemClock.elapsedRealtime() - chronometer.getBase()) / 1000 / 60) % 60; | 394 | int minute = (int) ((SystemClock.elapsedRealtime() - chronometer.getBase()) / 1000 / 60) % 60; |
| 185 | int second = (int) ((SystemClock.elapsedRealtime() - chronometer.getBase()) / 1000) % 60; | 395 | int second = (int) ((SystemClock.elapsedRealtime() - chronometer.getBase()) / 1000) % 60; |
| 396 | + employTime = (hour * 3600 + minute * 60 + second) + ""; | ||
| 397 | + | ||
| 186 | if (hour < 1) { | 398 | if (hour < 1) { |
| 187 | if (minute == 59 && second == 59) { | 399 | if (minute == 59 && second == 59) { |
| 188 | chronometer.setFormat("0" + "%s"); | 400 | chronometer.setFormat("0" + "%s"); |
| @@ -272,9 +484,9 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener | @@ -272,9 +484,9 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener | ||
| 272 | //LocationMode. Device_Sensors:仅使用设备; | 484 | //LocationMode. Device_Sensors:仅使用设备; |
| 273 | option.setLocationMode(LocationClientOption.LocationMode.Hight_Accuracy); | 485 | option.setLocationMode(LocationClientOption.LocationMode.Hight_Accuracy); |
| 274 | //可选,设置是否需要地址信息,默认不需要 | 486 | //可选,设置是否需要地址信息,默认不需要 |
| 275 | - option.setIsNeedAddress(false); | 487 | + option.setIsNeedAddress(true); |
| 276 | //可选,设置是否需要地址描述 | 488 | //可选,设置是否需要地址描述 |
| 277 | - option.setIsNeedLocationDescribe(false); | 489 | + option.setIsNeedLocationDescribe(true); |
| 278 | //可选,设置是否需要设备方向结果 | 490 | //可选,设置是否需要设备方向结果 |
| 279 | option.setNeedDeviceDirect(false); | 491 | option.setNeedDeviceDirect(false); |
| 280 | //设置打开自动回调位置模式,该开关打开后,期间只要定位SDK检测到位置变化就会主动回调给开发者 | 492 | //设置打开自动回调位置模式,该开关打开后,期间只要定位SDK检测到位置变化就会主动回调给开发者 |
| @@ -320,10 +532,88 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener | @@ -320,10 +532,88 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener | ||
| 320 | @Override | 532 | @Override |
| 321 | public void onReceiveLocation(BDLocation location) { | 533 | public void onReceiveLocation(BDLocation location) { |
| 322 | // map view 销毁后不在处理新接收的位置 | 534 | // map view 销毁后不在处理新接收的位置 |
| 323 | - if (location == null || mMapView == null) { | 535 | + if (location == null || mMapView == null || getContext() == null) { |
| 324 | return; | 536 | return; |
| 325 | } | 537 | } |
| 326 | 538 | ||
| 539 | + mCurrentAccracy = location.getRadius(); | ||
| 540 | + followMyLocation = new MyLocationData.Builder() | ||
| 541 | + .accuracy(location.getRadius()) | ||
| 542 | + // 此处设置开发者获取到的方向信息,顺时针0-360 | ||
| 543 | + .direction(mCurrentDirection).latitude(location.getLatitude()) | ||
| 544 | + .longitude(location.getLongitude()).build(); | ||
| 545 | +// if (followMyLocation == null || followMyLocation.latitude == 0 || followMyLocation.longitude == 0) { | ||
| 546 | +// return; | ||
| 547 | +// } | ||
| 548 | + MapStatus.Builder builder = new MapStatus.Builder(); | ||
| 549 | + //第一次定位 | ||
| 550 | + if (isFirstLoc) { | ||
| 551 | + isFirstLoc = false; | ||
| 552 | + if (location.getRadius() > Constant.LOCA_ACCURACY) { | ||
| 553 | + } | ||
| 554 | + baiduMap.setMyLocationData(followMyLocation); | ||
| 555 | + builder.target(new LatLng(followMyLocation.latitude, followMyLocation.longitude)).zoom(DEFULT_ZOOM); | ||
| 556 | + baiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build())); | ||
| 557 | + } else { | ||
| 558 | + //不是第一次定位状态 | ||
| 559 | + //过滤定位精度 | ||
| 560 | + if (location.getRadius() > Constant.LOCA_ACCURACY) { | ||
| 561 | + return; | ||
| 562 | + } | ||
| 563 | + if (null != currentWalkPoints && currentWalkPoints.size() > 0) { | ||
| 564 | + //进行判断 | ||
| 565 | + LatLng lastLatLng = currentWalkPoints.get(currentWalkPoints.size() - 1); | ||
| 566 | + LatLng curLatLng = new LatLng(location.getLatitude(), | ||
| 567 | + location.getLongitude()); | ||
| 568 | + if (DistanceUtil.getDistance(lastLatLng, curLatLng) > 0.5) { | ||
| 569 | + currentWalkPoints.add(curLatLng); | ||
| 570 | + } | ||
| 571 | + } else { | ||
| 572 | + currentWalkPoints.add(new LatLng(location.getLatitude(), | ||
| 573 | + location.getLongitude())); | ||
| 574 | + } | ||
| 575 | + | ||
| 576 | + //判断当前集合列表是否可以划线(至少两个点) | ||
| 577 | + if (currentWalkPoints != null && currentWalkPoints.size() > 1) { | ||
| 578 | + //判断当前是否已经在地图上画点 | ||
| 579 | + if (currentLine != null) { | ||
| 580 | + currentLine.remove(); | ||
| 581 | + } | ||
| 582 | + currentLine = MyMapUtil.drawMapLine(getContext(), baiduMap, currentWalkPoints, R.color.green_round); | ||
| 583 | + } | ||
| 584 | + } | ||
| 585 | + Log.e(TAG, "onReceiveLocation: 运行"); | ||
| 586 | + currentAddress = location.getLocationDescribe(); | ||
| 587 | + if (TextUtils.isEmpty(currentAddress)) { | ||
| 588 | + if (null != location.getAddress()) { | ||
| 589 | + currentAddress = location.getAddress().address; | ||
| 590 | + } | ||
| 591 | + } | ||
| 592 | + | ||
| 593 | + if (isShowFollowAddress && !TextUtils.isEmpty(currentAddress)) { | ||
| 594 | + if (isShowFollowAddress && selectDialog != null && !selectDialog.isShowing()) { | ||
| 595 | + if (!TextUtils.isEmpty(currentAddress)) { | ||
| 596 | + selectDialog.setTipMessage("确定将" + "\"" + currentAddress + "\"" + "设置开始地点?"); | ||
| 597 | + if (!selectDialog.isShowing()) { | ||
| 598 | + selectDialog.show(); | ||
| 599 | + } | ||
| 600 | + isShowFollowAddress = false; | ||
| 601 | + } | ||
| 602 | + } | ||
| 603 | + } | ||
| 604 | + //结束按钮 | ||
| 605 | + if (isShowEndFollowAddress && !TextUtils.isEmpty(currentAddress)) { | ||
| 606 | + if (isShowEndFollowAddress && endSelectDialog != null && !endSelectDialog.isShowing()) { | ||
| 607 | + if (!TextUtils.isEmpty(currentAddress)) { | ||
| 608 | + endSelectDialog.setTipMessage("确定将" + "\"" + currentAddress + "\"" + "设为结束地点?"); | ||
| 609 | + if (!endSelectDialog.isShowing()) { | ||
| 610 | + endSelectDialog.show(); | ||
| 611 | + } | ||
| 612 | + isShowEndFollowAddress = false; | ||
| 613 | + } | ||
| 614 | + } | ||
| 615 | + } | ||
| 616 | + | ||
| 327 | //正在搜索GPS信号 | 617 | //正在搜索GPS信号 |
| 328 | if (location.getGpsAccuracyStatus() == BDLocation.GPS_ACCURACY_UNKNOWN) { | 618 | if (location.getGpsAccuracyStatus() == BDLocation.GPS_ACCURACY_UNKNOWN) { |
| 329 | if (fragment.binding.tvGpsPopBg.getVisibility() != View.VISIBLE) { | 619 | if (fragment.binding.tvGpsPopBg.getVisibility() != View.VISIBLE) { |
| @@ -373,66 +663,9 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener | @@ -373,66 +663,9 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener | ||
| 373 | fragment.binding.ivGpsState.setBackground(getContext().getResources().getDrawable(R.drawable.rt_training_gps_3)); | 663 | fragment.binding.ivGpsState.setBackground(getContext().getResources().getDrawable(R.drawable.rt_training_gps_3)); |
| 374 | } | 664 | } |
| 375 | } | 665 | } |
| 666 | + } | ||
| 376 | 667 | ||
| 377 | - if (isFirstLoc) { | ||
| 378 | - isFirstLoc = false; | ||
| 379 | - if (location.getRadius() > Constant.LOCA_ACCURACY) { | ||
| 380 | - Toast.makeText(getContext(), "当前定位精度为:" + location.getRadius() + "米,请您移动至空旷地带!", Toast.LENGTH_SHORT).show(); | ||
| 381 | - } | ||
| 382 | - | ||
| 383 | - | ||
| 384 | - } else { | ||
| 385 | - //过滤定位精度 | ||
| 386 | - if (location.getRadius() > Constant.LOCA_ACCURACY) { | ||
| 387 | - return; | ||
| 388 | - } | ||
| 389 | - } | ||
| 390 | - mCurrentAccracy = location.getRadius(); | ||
| 391 | - mylocation = new MyLocationData.Builder() | ||
| 392 | - .accuracy(location.getRadius()) | ||
| 393 | - // 此处设置开发者获取到的方向信息,顺时针0-360 | ||
| 394 | - .direction(mCurrentDirection).latitude(location.getLatitude()) | ||
| 395 | - .longitude(location.getLongitude()).build(); | ||
| 396 | - if (mylocation == null || mylocation.latitude == 0 || mylocation.longitude == 0) { | ||
| 397 | - return; | ||
| 398 | - } | ||
| 399 | - MapStatus.Builder builder = new MapStatus.Builder(); | ||
| 400 | - //不是第一次定位状态 | ||
| 401 | - if (!isFirstLoc) { | ||
| 402 | - baiduMap.setMyLocationData(mylocation); | ||
| 403 | - builder.target(new LatLng(mylocation.latitude, mylocation.longitude)).zoom(DEFULT_ZOOM); | ||
| 404 | - baiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build())); | ||
| 405 | - if (currentPoints.size() > 0) { | ||
| 406 | - //进行判断 | ||
| 407 | - LatLng lastLatLng = currentPoints.get(currentPoints.size() - 1); | ||
| 408 | - LatLng curLatLng = new LatLng(location.getLatitude(), | ||
| 409 | - location.getLongitude()); | ||
| 410 | - if (DistanceUtil.getDistance(lastLatLng, curLatLng) > 0.5) { | ||
| 411 | - currentPoints.add(curLatLng); | ||
| 412 | - } | ||
| 413 | - } else { | ||
| 414 | - currentPoints.add(new LatLng(location.getLatitude(), | ||
| 415 | - location.getLongitude())); | ||
| 416 | - } | ||
| 417 | - | ||
| 418 | - //判断当前集合列表是否可以划线(至少两个点) | ||
| 419 | - if (currentPoints != null && currentPoints.size() > 1) { | ||
| 420 | - //判断当前是否已经在地图上画点 | ||
| 421 | - if (currentLine != null) { | ||
| 422 | - currentLine.remove(); | ||
| 423 | - } | ||
| 424 | - //开始划线 | ||
| 425 | - if (getContext() == null) { | ||
| 426 | - return; | ||
| 427 | - } | ||
| 428 | - currentLine = MyMapUtil.drawMapLine(getContext(), baiduMap, currentPoints, R.color.red); | ||
| 429 | - } | ||
| 430 | 668 | ||
| 431 | - } | ||
| 432 | - myCurLatLng = new LatLng(location.getLatitude(), | ||
| 433 | - location.getLongitude()); | ||
| 434 | - baiduMap.setMyLocationData(mylocation); | ||
| 435 | - } | ||
| 436 | } | 669 | } |
| 437 | 670 | ||
| 438 | 671 | ||
| @@ -483,13 +716,13 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener | @@ -483,13 +716,13 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener | ||
| 483 | double x = sensorEvent.values[SensorManager.DATA_X]; | 716 | double x = sensorEvent.values[SensorManager.DATA_X]; |
| 484 | if (Math.abs(x - lastX) > 1.0) { | 717 | if (Math.abs(x - lastX) > 1.0) { |
| 485 | mCurrentDirection = (int) x; | 718 | mCurrentDirection = (int) x; |
| 486 | - if (mylocation != null) { | ||
| 487 | - mylocation = new MyLocationData.Builder() | 719 | + if (followMyLocation != null) { |
| 720 | + followMyLocation = new MyLocationData.Builder() | ||
| 488 | .accuracy(mCurrentAccracy) | 721 | .accuracy(mCurrentAccracy) |
| 489 | // 此处设置开发者获取到的方向信息,顺时针0-360 | 722 | // 此处设置开发者获取到的方向信息,顺时针0-360 |
| 490 | - .direction(mCurrentDirection).latitude(mylocation.latitude) | ||
| 491 | - .longitude(mylocation.longitude).build(); | ||
| 492 | - baiduMap.setMyLocationData(mylocation); | 723 | + .direction(mCurrentDirection).latitude(followMyLocation.latitude) |
| 724 | + .longitude(followMyLocation.longitude).build(); | ||
| 725 | + baiduMap.setMyLocationData(followMyLocation); | ||
| 493 | } | 726 | } |
| 494 | } | 727 | } |
| 495 | lastX = x; | 728 | lastX = x; |
| @@ -506,12 +739,12 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener | @@ -506,12 +739,12 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener | ||
| 506 | * @param lastPoint | 739 | * @param lastPoint |
| 507 | */ | 740 | */ |
| 508 | public void setHistoryLastPoint(LatLng lastPoint) { | 741 | public void setHistoryLastPoint(LatLng lastPoint) { |
| 509 | - if (currentPoints != null) { | ||
| 510 | - currentPoints.clear(); | ||
| 511 | - currentPoints.add(lastPoint); | 742 | + if (currentWalkPoints != null) { |
| 743 | + currentWalkPoints.clear(); | ||
| 744 | + currentWalkPoints.add(lastPoint); | ||
| 512 | } else { | 745 | } else { |
| 513 | - currentPoints = new ArrayList<>(); | ||
| 514 | - currentPoints.add(lastPoint); | 746 | + currentWalkPoints = new ArrayList<>(); |
| 747 | + currentWalkPoints.add(lastPoint); | ||
| 515 | } | 748 | } |
| 516 | } | 749 | } |
| 517 | 750 | ||
| @@ -529,6 +762,13 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener | @@ -529,6 +762,13 @@ public class CollRunningMapFragmentView implements MvpView, SensorEventListener | ||
| 529 | } | 762 | } |
| 530 | 763 | ||
| 531 | public void onDestroy() { | 764 | public void onDestroy() { |
| 765 | + if (null != allMapOverlays) { | ||
| 766 | + for (Overlay overlay : allMapOverlays) { | ||
| 767 | + overlay.remove(); | ||
| 768 | + } | ||
| 769 | + allMapOverlays = null; | ||
| 770 | + baiduMap.clear(); | ||
| 771 | + } | ||
| 532 | if (mMapView != null) { | 772 | if (mMapView != null) { |
| 533 | mMapView.onDestroy(); | 773 | mMapView.onDestroy(); |
| 534 | mMapView = null; | 774 | mMapView = null; |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/CollTraceListDetailFragmentView.java
0 → 100644
| 1 | +package com.cnlive.moudle.collectionTrace.frame.view; | ||
| 2 | + | ||
| 3 | +import android.os.Handler; | ||
| 4 | +import android.support.v7.widget.LinearLayoutManager; | ||
| 5 | +import android.text.TextUtils; | ||
| 6 | +import android.view.MotionEvent; | ||
| 7 | +import android.view.View; | ||
| 8 | + | ||
| 9 | +import com.baidu.mapapi.map.BaiduMap; | ||
| 10 | +import com.baidu.mapapi.map.MapView; | ||
| 11 | +import com.baidu.mapapi.map.Overlay; | ||
| 12 | +import com.baidu.mapapi.map.UiSettings; | ||
| 13 | +import com.baidu.mapapi.model.LatLng; | ||
| 14 | +import com.baidu.trace.LBSTraceClient; | ||
| 15 | +import com.cnlive.moudle.collectionTrace.model.CollectPoint; | ||
| 16 | +import com.cnlive.moudle.collectionTrace.model.RaceNameListInfo; | ||
| 17 | +import com.cnlive.moudle.collectionTrace.ui.adapter.CollFinishDetaiAdapter; | ||
| 18 | +import com.cnlive.moudle.collectionTrace.ui.fragment.CollRunRaceDetailFragment; | ||
| 19 | +import com.cnlive.moudle.collectionTrace.ui.fragment.CollTraceListDetailFragment; | ||
| 20 | +import com.cnlive.moudle.collectionTrace.utils.CollStepUtil; | ||
| 21 | +import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; | ||
| 22 | +import com.cnlive.moudle.pedometer.ui.widget.SelectDialog; | ||
| 23 | +import com.cnlive.moudle.pedometer.utils.GsonUtil; | ||
| 24 | +import com.cnlive.moudle.pedometer.utils.MyMapUtil; | ||
| 25 | +import com.cnlive.moudle.pedometer.utils.QMUITipDialogUtil; | ||
| 26 | +import com.cnlive.moudle.pedometer.utils.ScreenUtil; | ||
| 27 | +import com.cnlive.moudle.pedometer.utils.TimeUtil; | ||
| 28 | +import com.cnlive.strike.application.GlideApp; | ||
| 29 | +import com.example.moudle_pedometer.R; | ||
| 30 | +import com.hannesdorfmann.mosby3.mvp.MvpView; | ||
| 31 | +import com.sothree.slidinguppanel.SlidingUpPanelLayout; | ||
| 32 | + | ||
| 33 | +import java.util.ArrayList; | ||
| 34 | +import java.util.List; | ||
| 35 | + | ||
| 36 | +public class CollTraceListDetailFragmentView implements MvpView { | ||
| 37 | + private CollTraceListDetailFragment fragment; | ||
| 38 | + private RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean; | ||
| 39 | + private CollFinishDetaiAdapter adapter; | ||
| 40 | + public BaiduMap baiduMap; | ||
| 41 | + private MapView mMapView; | ||
| 42 | + private UiSettings mUiSettings; | ||
| 43 | + private LBSTraceClient mClient = null; | ||
| 44 | + private List<Overlay> allMapOverlays; | ||
| 45 | + | ||
| 46 | + public CollTraceListDetailFragmentView(CollTraceListDetailFragment fragment) { | ||
| 47 | + this.fragment = fragment; | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + | ||
| 51 | + public void initView(RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean) { | ||
| 52 | + if (mClient == null) { | ||
| 53 | + mClient = new LBSTraceClient(fragment.getActivity()); | ||
| 54 | + } | ||
| 55 | + this.eventShoeLinesBean = eventShoeLinesBean; | ||
| 56 | + allMapOverlays = new ArrayList<>(); | ||
| 57 | + //设置滑动卡片 | ||
| 58 | +// fragment.binding.slidingLayout.set | ||
| 59 | + //添加起点 | ||
| 60 | + CollectPoint startPoint = null; | ||
| 61 | + List<CollectPoint> resultCollectPoints = null; | ||
| 62 | + if (!TextUtils.isEmpty(eventShoeLinesBean.getLatLongitude())) { | ||
| 63 | + resultCollectPoints = GsonUtil.jsonToList(eventShoeLinesBean.getLatLongitude(), CollectPoint.class); | ||
| 64 | + } | ||
| 65 | + //获取打点不为空 | ||
| 66 | + if (null != resultCollectPoints && resultCollectPoints.size() > 1) { | ||
| 67 | + //移除起点 | ||
| 68 | + resultCollectPoints.remove(0); | ||
| 69 | + //移除终点 | ||
| 70 | + resultCollectPoints.remove(resultCollectPoints.size() - 1); | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | +// //查询用户历史轨迹 | ||
| 74 | +// if (0 != collUserStepEntity.getStartTimeStamp() && 0 != collUserStepEntity.getFinishTimeStamp()) { | ||
| 75 | +// long startTime = collUserStepEntity.getStartTimeStamp(); | ||
| 76 | +// long endTime = collUserStepEntity.getFinishTimeStamp(); | ||
| 77 | +// //开始查询 | ||
| 78 | +// queryWalkTrace(startTime, endTime); | ||
| 79 | +// if (!TextUtils.isEmpty(collUserStepEntity.getImportPoint())) { | ||
| 80 | +// List<CollectPoint> collectPoints = GsonUtil.jsonToList(collUserStepEntity.getImportPoint(), CollectPoint.class); | ||
| 81 | +// //绘制运营打的点 | ||
| 82 | +// if (null != collectPoints) { | ||
| 83 | +// //根据打点集合,自适应缩放 | ||
| 84 | +// MyMapUtil.setCollMapAutoZoom(baiduMap, collectPoints, -1.5f); | ||
| 85 | +// for (CollectPoint point : collectPoints) { | ||
| 86 | +// LatLng markLatLng = new LatLng(point.getLatitude(), point.getLongitude()); | ||
| 87 | +// if (null != markLatLng) { | ||
| 88 | +// //将点位显示到地图上 | ||
| 89 | +// Overlay overlay = MyMapUtil.setMapMarker(getContext(), baiduMap, markLatLng, R.drawable.icon_map_import); | ||
| 90 | +// if (null != overlay) { | ||
| 91 | +// allMapOverlays.add(overlay); | ||
| 92 | +// } | ||
| 93 | +// } | ||
| 94 | +// } | ||
| 95 | +// } | ||
| 96 | +// } | ||
| 97 | +// } | ||
| 98 | +// //设置用户昵称 | ||
| 99 | +// String nickName = CommonInfo.getUserNickName(getContext()); | ||
| 100 | +// fragment.binding.includeFinishUserInfo.tvUserNickName.setText(nickName); | ||
| 101 | +// //设置用户头像 | ||
| 102 | +// String faceUrl = CommonInfo.getUserIcon(getContext()); | ||
| 103 | +// if (!TextUtils.isEmpty(faceUrl)) { | ||
| 104 | +// GlideApp.with(getContext()).load(faceUrl).into(fragment.binding.includeFinishUserInfo.qmIvIcon); | ||
| 105 | +// } | ||
| 106 | +// //设置标题 | ||
| 107 | +// if (!TextUtils.isEmpty(collUserStepEntity.getStreetTitle())) { | ||
| 108 | +// fragment.binding.includeFinishUserInfo.tvStreetName.setText(collUserStepEntity.getStreetTitle()); | ||
| 109 | +// } | ||
| 110 | +// //设置距离 | ||
| 111 | +// if (!TextUtils.isEmpty(collUserStepEntity.getStepCount())) { | ||
| 112 | +// fragment.binding.includeFinishUserInfo.tvDistance.setText(CollStepUtil.getWalkDistanceKM(Long.parseLong(collUserStepEntity.getStepCount())) + ""); | ||
| 113 | +// } else { | ||
| 114 | +// fragment.binding.includeFinishUserInfo.tvDistance.setText("0"); | ||
| 115 | +// } | ||
| 116 | +// if (0 != collUserStepEntity.getFinishTimeStamp()) { | ||
| 117 | +// //设置日期 | ||
| 118 | +// fragment.binding.includeFinishUserInfo.tvDate.setText(TimeUtil.getStampToTime(collUserStepEntity.getFinishTimeStamp() * 1000, "yyyy-MM-dd HH:mm")); | ||
| 119 | +// } | ||
| 120 | +// //设置适配器 | ||
| 121 | +// if (!TextUtils.isEmpty(collUserStepEntity.getImportPoint())) { | ||
| 122 | +// List<CollectPoint> collectPoints = GsonUtil.jsonToList(collUserStepEntity.getImportPoint(), CollectPoint.class); | ||
| 123 | +// if (null == collectPoints) { | ||
| 124 | +// collectPoints = new ArrayList<>(); | ||
| 125 | +// } | ||
| 126 | +// if (null != startPoint) { | ||
| 127 | +// collectPoints.add(0, startPoint); | ||
| 128 | +// } | ||
| 129 | +// if (null != endPoint) { | ||
| 130 | +// collectPoints.add(endPoint); | ||
| 131 | +// } | ||
| 132 | +// //格式化打的点 | ||
| 133 | +// collectLatLngs = new ArrayList<>(); | ||
| 134 | +// for (CollectPoint collectPoint : collectPoints) { | ||
| 135 | +// collectLatLngs.add(new com.baidu.trace.model.LatLng(collectPoint.getLatitude(), collectPoint.getLongitude())); | ||
| 136 | +// } | ||
| 137 | +// adapter = new CollFinishDetaiAdapter(fragment.getActivity(), collectPoints); | ||
| 138 | +// //设置 | ||
| 139 | +// fragment.binding.includeFinishUserInfo.rvList.setLayoutManager(new LinearLayoutManager(fragment.getActivity())); | ||
| 140 | +// fragment.binding.includeFinishUserInfo.rvList.setAdapter(adapter); | ||
| 141 | +// } | ||
| 142 | + //返回按钮点击 | ||
| 143 | + fragment.binding.flBack.setOnClickListener(new View.OnClickListener() { | ||
| 144 | + @Override | ||
| 145 | + public void onClick(View view) { | ||
| 146 | + if (fragment.getActivity() == null) { | ||
| 147 | + return; | ||
| 148 | + } | ||
| 149 | + fragment.getActivity().finish(); | ||
| 150 | + } | ||
| 151 | + }); | ||
| 152 | + fragment.binding.rlScrollViewStartBtn.setVisibility(View.GONE); | ||
| 153 | + } | ||
| 154 | + | ||
| 155 | + | ||
| 156 | +} |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/RaceNameListView.java
| 1 | package com.cnlive.moudle.collectionTrace.frame.view; | 1 | package com.cnlive.moudle.collectionTrace.frame.view; |
| 2 | 2 | ||
| 3 | import android.support.v7.widget.LinearLayoutManager; | 3 | import android.support.v7.widget.LinearLayoutManager; |
| 4 | +import android.util.Log; | ||
| 4 | import android.view.View; | 5 | import android.view.View; |
| 5 | 6 | ||
| 7 | +import com.baidu.trace.LBSTraceClient; | ||
| 8 | +import com.baidu.trace.api.fence.AddMonitoredPersonResponse; | ||
| 9 | +import com.baidu.trace.api.fence.CreateFenceResponse; | ||
| 10 | +import com.baidu.trace.api.fence.DeleteFenceResponse; | ||
| 11 | +import com.baidu.trace.api.fence.DeleteMonitoredPersonResponse; | ||
| 12 | +import com.baidu.trace.api.fence.FenceListRequest; | ||
| 13 | +import com.baidu.trace.api.fence.FenceListResponse; | ||
| 14 | +import com.baidu.trace.api.fence.HistoryAlarmResponse; | ||
| 15 | +import com.baidu.trace.api.fence.ListMonitoredPersonResponse; | ||
| 16 | +import com.baidu.trace.api.fence.MonitoredStatusByLocationResponse; | ||
| 17 | +import com.baidu.trace.api.fence.MonitoredStatusResponse; | ||
| 18 | +import com.baidu.trace.api.fence.OnFenceListener; | ||
| 19 | +import com.baidu.trace.api.fence.UpdateFenceResponse; | ||
| 20 | +import com.baidu.trace.model.CoordType; | ||
| 6 | import com.cnlive.libs.base.util.AlertUtil; | 21 | import com.cnlive.libs.base.util.AlertUtil; |
| 22 | +import com.cnlive.moudle.collectionTrace.commonInfo.CollCommonInfo; | ||
| 7 | import com.cnlive.moudle.collectionTrace.model.RaceNameListInfo; | 23 | import com.cnlive.moudle.collectionTrace.model.RaceNameListInfo; |
| 8 | import com.cnlive.moudle.collectionTrace.ui.activity.StartCollectTraceActivity; | 24 | import com.cnlive.moudle.collectionTrace.ui.activity.StartCollectTraceActivity; |
| 9 | import com.cnlive.moudle.collectionTrace.ui.adapter.RaceNameListAdapter; | 25 | import com.cnlive.moudle.collectionTrace.ui.adapter.RaceNameListAdapter; |
| 10 | import com.cnlive.moudle.collectionTrace.ui.fragment.RaceNameListFragment; | 26 | import com.cnlive.moudle.collectionTrace.ui.fragment.RaceNameListFragment; |
| 11 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; | 27 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; |
| 28 | +import com.cnlive.moudle.pedometer.model.Constant; | ||
| 12 | import com.cnlive.moudle.pedometer.net.bean.BaseInfo; | 29 | import com.cnlive.moudle.pedometer.net.bean.BaseInfo; |
| 30 | +import com.cnlive.moudle.pedometer.net.bean.RunRaceDetailInfo; | ||
| 13 | import com.cnlive.moudle.pedometer.ui.widget.SelectDialog; | 31 | import com.cnlive.moudle.pedometer.ui.widget.SelectDialog; |
| 14 | import com.example.moudle_pedometer.R; | 32 | import com.example.moudle_pedometer.R; |
| 15 | import com.hannesdorfmann.mosby3.mvp.MvpView; | 33 | import com.hannesdorfmann.mosby3.mvp.MvpView; |
| @@ -23,11 +41,13 @@ import java.util.List; | @@ -23,11 +41,13 @@ import java.util.List; | ||
| 23 | /** | 41 | /** |
| 24 | * Created by hanyayun 019/06/25. | 42 | * Created by hanyayun 019/06/25. |
| 25 | */ | 43 | */ |
| 26 | -public class RaceNameListView implements MvpView { | 44 | +public class RaceNameListView implements MvpView, OnFenceListener { |
| 45 | + private final String TAG = "RaceNameListView"; | ||
| 27 | RaceNameListFragment fragment; | 46 | RaceNameListFragment fragment; |
| 28 | public QMUITipDialog loadingDiaog; | 47 | public QMUITipDialog loadingDiaog; |
| 29 | List<RaceNameListInfo.EventShoeLinesBean> list = new ArrayList<>(); | 48 | List<RaceNameListInfo.EventShoeLinesBean> list = new ArrayList<>(); |
| 30 | private RaceNameListAdapter adapter; | 49 | private RaceNameListAdapter adapter; |
| 50 | + private LBSTraceClient mClient = null; | ||
| 31 | 51 | ||
| 32 | public RaceNameListView(RaceNameListFragment fragment) { | 52 | public RaceNameListView(RaceNameListFragment fragment) { |
| 33 | this.fragment = fragment; | 53 | this.fragment = fragment; |
| @@ -38,9 +58,21 @@ public class RaceNameListView implements MvpView { | @@ -38,9 +58,21 @@ public class RaceNameListView implements MvpView { | ||
| 38 | } | 58 | } |
| 39 | 59 | ||
| 40 | 60 | ||
| 41 | - public void initView(){ | 61 | + public void initView(RunRaceDetailInfo runRaceDetailInfo) { |
| 62 | + if (mClient == null) { | ||
| 63 | + mClient = new LBSTraceClient(fragment.getActivity()); | ||
| 64 | + } | ||
| 42 | fragment.binding.raceBack.setOnClickListener(v -> fragment.getActivity().finish()); | 65 | fragment.binding.raceBack.setOnClickListener(v -> fragment.getActivity().finish()); |
| 43 | - fragment.binding.intoPath.setOnClickListener(v -> StartCollectTraceActivity.newInstance(fragment.getActivity(),fragment.eventId)); | 66 | + |
| 67 | + fragment.binding.intoPath.setOnClickListener(new View.OnClickListener() { | ||
| 68 | + @Override | ||
| 69 | + public void onClick(View view) { | ||
| 70 | + if (null != runRaceDetailInfo) { | ||
| 71 | + StartCollectTraceActivity.newInstance(fragment.getActivity(), fragment.eventId, runRaceDetailInfo); | ||
| 72 | + } | ||
| 73 | + } | ||
| 74 | + }); | ||
| 75 | + | ||
| 44 | fragment.binding.raceTittle.setText("轨迹列表"); | 76 | fragment.binding.raceTittle.setText("轨迹列表"); |
| 45 | fragment.binding.refreshLayout.setRefreshHeader(new ClassicsHeader(fragment.getActivity())); | 77 | fragment.binding.refreshLayout.setRefreshHeader(new ClassicsHeader(fragment.getActivity())); |
| 46 | fragment.binding.refreshLayout.setRefreshFooter(new ClassicsFooter(fragment.getActivity())); | 78 | fragment.binding.refreshLayout.setRefreshFooter(new ClassicsFooter(fragment.getActivity())); |
| @@ -48,10 +80,10 @@ public class RaceNameListView implements MvpView { | @@ -48,10 +80,10 @@ public class RaceNameListView implements MvpView { | ||
| 48 | } | 80 | } |
| 49 | 81 | ||
| 50 | 82 | ||
| 51 | - public void bindingShoeLine(int position){ | 83 | + public void bindingShoeLine(int position) { |
| 52 | list.get(position).setIsEnable(0); | 84 | list.get(position).setIsEnable(0); |
| 53 | - for(int i = 0;i <list.size();i++){ | ||
| 54 | - if(i != position && list.get(i).getIsEnable() == 0){ | 85 | + for (int i = 0; i < list.size(); i++) { |
| 86 | + if (i != position && list.get(i).getIsEnable() == 0) { | ||
| 55 | list.get(i).setIsEnable(1); | 87 | list.get(i).setIsEnable(1); |
| 56 | } | 88 | } |
| 57 | } | 89 | } |
| @@ -59,18 +91,18 @@ public class RaceNameListView implements MvpView { | @@ -59,18 +91,18 @@ public class RaceNameListView implements MvpView { | ||
| 59 | } | 91 | } |
| 60 | 92 | ||
| 61 | 93 | ||
| 62 | - public void delectShoeLine(int position){ | 94 | + public void delectShoeLine(int position) { |
| 63 | list.remove(position); | 95 | list.remove(position); |
| 64 | adapter.notifyDataSetChanged(); | 96 | adapter.notifyDataSetChanged(); |
| 65 | } | 97 | } |
| 66 | 98 | ||
| 67 | - public void onSuccess(BaseInfo<RaceNameListInfo> raceNameListInfoBaseInfo){ | 99 | + public void onSuccess(BaseInfo<RaceNameListInfo> raceNameListInfoBaseInfo) { |
| 68 | hideLoading(); | 100 | hideLoading(); |
| 69 | - if(fragment.currentPage == 1){ | 101 | + if (fragment.currentPage == 1) { |
| 70 | list.clear(); | 102 | list.clear(); |
| 71 | list.addAll(raceNameListInfoBaseInfo.getData().getEventShoeLines()); | 103 | list.addAll(raceNameListInfoBaseInfo.getData().getEventShoeLines()); |
| 72 | - if(adapter == null){ | ||
| 73 | - adapter = new RaceNameListAdapter(list,fragment.getActivity()); | 104 | + if (adapter == null) { |
| 105 | + adapter = new RaceNameListAdapter(list, fragment.getActivity()); | ||
| 74 | fragment.binding.raceRecy.setAdapter(adapter); | 106 | fragment.binding.raceRecy.setAdapter(adapter); |
| 75 | adapter.setOnItemClick(new RaceNameListAdapter.OnItemClick() { | 107 | adapter.setOnItemClick(new RaceNameListAdapter.OnItemClick() { |
| 76 | @Override | 108 | @Override |
| @@ -81,7 +113,7 @@ public class RaceNameListView implements MvpView { | @@ -81,7 +113,7 @@ public class RaceNameListView implements MvpView { | ||
| 81 | adapter.setOnAddShoeLineClick(new RaceNameListAdapter.OnAddShoeLineClick() { | 113 | adapter.setOnAddShoeLineClick(new RaceNameListAdapter.OnAddShoeLineClick() { |
| 82 | @Override | 114 | @Override |
| 83 | public void onAddSholeLineClickListener(RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean, int position) { | 115 | public void onAddSholeLineClickListener(RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean, int position) { |
| 84 | - if(list.get(position).getIsEnable() == 0)return; | 116 | + if (list.get(position).getIsEnable() == 0) return; |
| 85 | SelectDialog selectDialog = new SelectDialog(fragment.getActivity(), "确定绑定该轨迹?", "否", new SelectDialog.DialogInterface() { | 117 | SelectDialog selectDialog = new SelectDialog(fragment.getActivity(), "确定绑定该轨迹?", "否", new SelectDialog.DialogInterface() { |
| 86 | @Override | 118 | @Override |
| 87 | public void onClick(SelectDialog dialog) { | 119 | public void onClick(SelectDialog dialog) { |
| @@ -91,7 +123,9 @@ public class RaceNameListView implements MvpView { | @@ -91,7 +123,9 @@ public class RaceNameListView implements MvpView { | ||
| 91 | @Override | 123 | @Override |
| 92 | public void onClick(SelectDialog dialog) { | 124 | public void onClick(SelectDialog dialog) { |
| 93 | dialog.cancel(); | 125 | dialog.cancel(); |
| 94 | - fragment.addShoeLine(eventShoeLinesBean,position); | 126 | + //查询当前赛事对应的轨迹列表 |
| 127 | + queryFenceList(eventShoeLinesBean.getEventId()); | ||
| 128 | +// fragment.addShoeLine(eventShoeLinesBean, position); | ||
| 95 | } | 129 | } |
| 96 | }); | 130 | }); |
| 97 | selectDialog.setCancelable(false); | 131 | selectDialog.setCancelable(false); |
| @@ -103,17 +137,17 @@ public class RaceNameListView implements MvpView { | @@ -103,17 +137,17 @@ public class RaceNameListView implements MvpView { | ||
| 103 | adapter.setOnDelectShoeLineClick(new RaceNameListAdapter.OnDelectShoeLineClick() { | 137 | adapter.setOnDelectShoeLineClick(new RaceNameListAdapter.OnDelectShoeLineClick() { |
| 104 | @Override | 138 | @Override |
| 105 | public void onDelectShoeLineClickListener(RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean, int position) { | 139 | public void onDelectShoeLineClickListener(RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean, int position) { |
| 106 | - if(list.get(position).getIsEnable() == 0)return; | 140 | + if (list.get(position).getIsEnable() == 0) return; |
| 107 | SelectDialog selectDialog = new SelectDialog(fragment.getActivity(), "确定删除该轨迹?", "否", new SelectDialog.DialogInterface() { | 141 | SelectDialog selectDialog = new SelectDialog(fragment.getActivity(), "确定删除该轨迹?", "否", new SelectDialog.DialogInterface() { |
| 108 | @Override | 142 | @Override |
| 109 | public void onClick(SelectDialog dialog) { | 143 | public void onClick(SelectDialog dialog) { |
| 110 | - dialog.cancel(); | 144 | + dialog.cancel(); |
| 111 | } | 145 | } |
| 112 | }, "是", new SelectDialog.DialogInterface() { | 146 | }, "是", new SelectDialog.DialogInterface() { |
| 113 | @Override | 147 | @Override |
| 114 | public void onClick(SelectDialog dialog) { | 148 | public void onClick(SelectDialog dialog) { |
| 115 | dialog.cancel(); | 149 | dialog.cancel(); |
| 116 | - fragment.delectShoeLine(eventShoeLinesBean,position); | 150 | + fragment.delectShoeLine(eventShoeLinesBean, position); |
| 117 | } | 151 | } |
| 118 | }); | 152 | }); |
| 119 | selectDialog.setCancelable(false); | 153 | selectDialog.setCancelable(false); |
| @@ -121,24 +155,24 @@ public class RaceNameListView implements MvpView { | @@ -121,24 +155,24 @@ public class RaceNameListView implements MvpView { | ||
| 121 | selectDialog.show(); | 155 | selectDialog.show(); |
| 122 | } | 156 | } |
| 123 | }); | 157 | }); |
| 124 | - }else { | 158 | + } else { |
| 125 | adapter.notifyDataSetChanged(); | 159 | adapter.notifyDataSetChanged(); |
| 126 | } | 160 | } |
| 127 | } | 161 | } |
| 128 | 162 | ||
| 129 | - if(list.size() != 0){ | 163 | + if (list.size() != 0) { |
| 130 | fragment.binding.empty.setVisibility(View.GONE); | 164 | fragment.binding.empty.setVisibility(View.GONE); |
| 131 | fragment.binding.refreshLayout.setVisibility(View.VISIBLE); | 165 | fragment.binding.refreshLayout.setVisibility(View.VISIBLE); |
| 132 | - }else { | 166 | + } else { |
| 133 | showEmpty(); | 167 | showEmpty(); |
| 134 | } | 168 | } |
| 135 | 169 | ||
| 136 | - if(raceNameListInfoBaseInfo.getData().getEventShoeLines().size() < fragment.pageSize){ | 170 | + if (raceNameListInfoBaseInfo.getData().getEventShoeLines().size() < fragment.pageSize) { |
| 137 | fragment.binding.refreshLayout.setEnableLoadMore(false); | 171 | fragment.binding.refreshLayout.setEnableLoadMore(false); |
| 138 | - }else { | 172 | + } else { |
| 139 | fragment.binding.refreshLayout.setEnableLoadMore(true); | 173 | fragment.binding.refreshLayout.setEnableLoadMore(true); |
| 140 | } | 174 | } |
| 141 | - if(fragment.currentPage > 1){ | 175 | + if (fragment.currentPage > 1) { |
| 142 | list.addAll(raceNameListInfoBaseInfo.getData().getEventShoeLines()); | 176 | list.addAll(raceNameListInfoBaseInfo.getData().getEventShoeLines()); |
| 143 | adapter.notifyDataSetChanged(); | 177 | adapter.notifyDataSetChanged(); |
| 144 | } | 178 | } |
| @@ -146,7 +180,7 @@ public class RaceNameListView implements MvpView { | @@ -146,7 +180,7 @@ public class RaceNameListView implements MvpView { | ||
| 146 | fragment.binding.refreshLayout.finishLoadMore(); | 180 | fragment.binding.refreshLayout.finishLoadMore(); |
| 147 | } | 181 | } |
| 148 | 182 | ||
| 149 | - public void showErr(String msg){ | 183 | + public void showErr(String msg) { |
| 150 | fragment.binding.refreshLayout.finishRefresh(); | 184 | fragment.binding.refreshLayout.finishRefresh(); |
| 151 | fragment.binding.refreshLayout.finishLoadMore(); | 185 | fragment.binding.refreshLayout.finishLoadMore(); |
| 152 | if (list.size() == 0) { | 186 | if (list.size() == 0) { |
| @@ -158,7 +192,7 @@ public class RaceNameListView implements MvpView { | @@ -158,7 +192,7 @@ public class RaceNameListView implements MvpView { | ||
| 158 | @Override | 192 | @Override |
| 159 | public void onClick(View v) { | 193 | public void onClick(View v) { |
| 160 | fragment.currentPage = 1; | 194 | fragment.currentPage = 1; |
| 161 | - fragment.getPresenter().setData(fragment.getActivity(), CommonInfo.getUserId(fragment.getActivity()),fragment.currentPage,fragment.pageSize); | 195 | + fragment.getPresenter().setData(fragment.getActivity(), CommonInfo.getUserId(fragment.getActivity()), fragment.currentPage, fragment.pageSize); |
| 162 | } | 196 | } |
| 163 | }); | 197 | }); |
| 164 | fragment.binding.empty.setLoadingShowing(false); | 198 | fragment.binding.empty.setLoadingShowing(false); |
| @@ -174,7 +208,7 @@ public class RaceNameListView implements MvpView { | @@ -174,7 +208,7 @@ public class RaceNameListView implements MvpView { | ||
| 174 | AlertUtil.showDeftToast(fragment.getActivity(), message); | 208 | AlertUtil.showDeftToast(fragment.getActivity(), message); |
| 175 | } | 209 | } |
| 176 | 210 | ||
| 177 | - public void showEmpty(){ | 211 | + public void showEmpty() { |
| 178 | fragment.binding.empty.setVisibility(View.VISIBLE); | 212 | fragment.binding.empty.setVisibility(View.VISIBLE); |
| 179 | fragment.binding.refreshLayout.setVisibility(View.GONE); | 213 | fragment.binding.refreshLayout.setVisibility(View.GONE); |
| 180 | fragment.binding.empty.show("没有相关数据", "", R.drawable.zhuangtai_kong); | 214 | fragment.binding.empty.show("没有相关数据", "", R.drawable.zhuangtai_kong); |
| @@ -188,4 +222,74 @@ public class RaceNameListView implements MvpView { | @@ -188,4 +222,74 @@ public class RaceNameListView implements MvpView { | ||
| 188 | public void hideLoading() { | 222 | public void hideLoading() { |
| 189 | if (loadingDiaog != null) loadingDiaog.dismiss(); | 223 | if (loadingDiaog != null) loadingDiaog.dismiss(); |
| 190 | } | 224 | } |
| 225 | + | ||
| 226 | + | ||
| 227 | + /** | ||
| 228 | + * 查询地理围栏 | ||
| 229 | + */ | ||
| 230 | + private void queryFenceList(String eventId) { | ||
| 231 | + FenceListRequest fenceListRequest = FenceListRequest.buildServerRequest(Constant.TAG, Constant.SERVICE_ID, eventId, null, CoordType.gcj02, 1, 5000); | ||
| 232 | + if (null != mClient || null != fenceListRequest) { | ||
| 233 | + mClient.queryFenceList(fenceListRequest, RaceNameListView.this); | ||
| 234 | + } | ||
| 235 | + } | ||
| 236 | + | ||
| 237 | + @Override | ||
| 238 | + public void onCreateFenceCallback(CreateFenceResponse createFenceResponse) { | ||
| 239 | + | ||
| 240 | + } | ||
| 241 | + | ||
| 242 | + @Override | ||
| 243 | + public void onUpdateFenceCallback(UpdateFenceResponse updateFenceResponse) { | ||
| 244 | + | ||
| 245 | + } | ||
| 246 | + | ||
| 247 | + @Override | ||
| 248 | + public void onDeleteFenceCallback(DeleteFenceResponse deleteFenceResponse) { | ||
| 249 | + | ||
| 250 | + } | ||
| 251 | + | ||
| 252 | + /** | ||
| 253 | + * 查询围栏列表回调接口 | ||
| 254 | + * | ||
| 255 | + * @param fenceListResponse | ||
| 256 | + */ | ||
| 257 | + @Override | ||
| 258 | + public void onFenceListCallback(FenceListResponse fenceListResponse) { | ||
| 259 | + if (null == fenceListResponse) { | ||
| 260 | + return; | ||
| 261 | + } | ||
| 262 | + Log.e(TAG, "onFenceListCallback:围栏数量 " + fenceListResponse.getFenceInfos().size() + ",fenceListResponse:" + fenceListResponse.getTotalSize()); | ||
| 263 | + | ||
| 264 | + } | ||
| 265 | + | ||
| 266 | + @Override | ||
| 267 | + public void onMonitoredStatusCallback(MonitoredStatusResponse monitoredStatusResponse) { | ||
| 268 | + | ||
| 269 | + } | ||
| 270 | + | ||
| 271 | + @Override | ||
| 272 | + public void onMonitoredStatusByLocationCallback(MonitoredStatusByLocationResponse monitoredStatusByLocationResponse) { | ||
| 273 | + | ||
| 274 | + } | ||
| 275 | + | ||
| 276 | + @Override | ||
| 277 | + public void onHistoryAlarmCallback(HistoryAlarmResponse historyAlarmResponse) { | ||
| 278 | + | ||
| 279 | + } | ||
| 280 | + | ||
| 281 | + @Override | ||
| 282 | + public void onAddMonitoredPersonCallback(AddMonitoredPersonResponse addMonitoredPersonResponse) { | ||
| 283 | + | ||
| 284 | + } | ||
| 285 | + | ||
| 286 | + @Override | ||
| 287 | + public void onDeleteMonitoredPersonCallback(DeleteMonitoredPersonResponse deleteMonitoredPersonResponse) { | ||
| 288 | + | ||
| 289 | + } | ||
| 290 | + | ||
| 291 | + @Override | ||
| 292 | + public void onListMonitoredPersonCallback(ListMonitoredPersonResponse listMonitoredPersonResponse) { | ||
| 293 | + | ||
| 294 | + } | ||
| 191 | } | 295 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/frame/view/StartTraceFragmentView.java
| @@ -29,11 +29,15 @@ import com.baidu.mapapi.map.UiSettings; | @@ -29,11 +29,15 @@ import com.baidu.mapapi.map.UiSettings; | ||
| 29 | import com.baidu.mapapi.model.LatLng; | 29 | import com.baidu.mapapi.model.LatLng; |
| 30 | import com.cnlive.moudle.collectionTrace.service.CollKeepLiveService; | 30 | import com.cnlive.moudle.collectionTrace.service.CollKeepLiveService; |
| 31 | import com.cnlive.moudle.collectionTrace.service.CollStepService; | 31 | import com.cnlive.moudle.collectionTrace.service.CollStepService; |
| 32 | +import com.cnlive.moudle.collectionTrace.ui.activity.CollRunRaceDetailActivity; | ||
| 32 | import com.cnlive.moudle.collectionTrace.ui.activity.CollRunningMapActivity; | 33 | import com.cnlive.moudle.collectionTrace.ui.activity.CollRunningMapActivity; |
| 33 | import com.cnlive.moudle.collectionTrace.ui.fragment.StartTraceFragment; | 34 | import com.cnlive.moudle.collectionTrace.ui.fragment.StartTraceFragment; |
| 34 | import com.cnlive.moudle.collectionTrace.commonInfo.CollCommonInfo; | 35 | import com.cnlive.moudle.collectionTrace.commonInfo.CollCommonInfo; |
| 36 | +import com.cnlive.moudle.collectionTrace.utils.CollStepUtil; | ||
| 37 | +import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; | ||
| 35 | import com.cnlive.moudle.pedometer.model.Constant; | 38 | import com.cnlive.moudle.pedometer.model.Constant; |
| 36 | import com.cnlive.moudle.pedometer.net.bean.RunRaceDetailInfo; | 39 | import com.cnlive.moudle.pedometer.net.bean.RunRaceDetailInfo; |
| 40 | +import com.cnlive.moudle.pedometer.sql.entity.CollUserStepEntity; | ||
| 37 | import com.cnlive.moudle.pedometer.ui.widget.SelectDialog; | 41 | import com.cnlive.moudle.pedometer.ui.widget.SelectDialog; |
| 38 | import com.cnlive.moudle.pedometer.utils.BitmapUtil; | 42 | import com.cnlive.moudle.pedometer.utils.BitmapUtil; |
| 39 | import com.cnlive.moudle.pedometer.utils.GsonUtil; | 43 | import com.cnlive.moudle.pedometer.utils.GsonUtil; |
| @@ -108,12 +112,12 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener { | @@ -108,12 +112,12 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener { | ||
| 108 | fragment.binding.btnIdentify.setOnClickListener(new View.OnClickListener() { | 112 | fragment.binding.btnIdentify.setOnClickListener(new View.OnClickListener() { |
| 109 | @Override | 113 | @Override |
| 110 | public void onClick(View view) { | 114 | public void onClick(View view) { |
| 111 | - isShowFollowAddress = true; | ||
| 112 | //获取当前地点 | 115 | //获取当前地点 |
| 113 | if (!TextUtils.isEmpty(currentAddress)) { | 116 | if (!TextUtils.isEmpty(currentAddress)) { |
| 114 | selectDialog.setTipMessage("确定将" + "\"" + currentAddress + "\"" + "设置开始地点?"); | 117 | selectDialog.setTipMessage("确定将" + "\"" + currentAddress + "\"" + "设置开始地点?"); |
| 115 | selectDialog.show(); | 118 | selectDialog.show(); |
| 116 | } else { | 119 | } else { |
| 120 | + isShowFollowAddress = true; | ||
| 117 | Toast.makeText(getContext(), "正在获取当前地点信息,请稍后", Toast.LENGTH_SHORT).show(); | 121 | Toast.makeText(getContext(), "正在获取当前地点信息,请稍后", Toast.LENGTH_SHORT).show(); |
| 118 | } | 122 | } |
| 119 | } | 123 | } |
| @@ -122,11 +126,77 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener { | @@ -122,11 +126,77 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener { | ||
| 122 | } | 126 | } |
| 123 | 127 | ||
| 124 | /** | 128 | /** |
| 129 | + * 检查是否又在正在运行的活动 | ||
| 130 | + */ | ||
| 131 | + public void checkIsHasRunningRace() { | ||
| 132 | + //先判断有没有数据 | ||
| 133 | + CollUserStepEntity userStepEntity = CollStepUtil.getCollUserStepData(getContext(), CommonInfo.getUserId(getContext())); | ||
| 134 | + if (null != userStepEntity) { | ||
| 135 | + String eventId = CollCommonInfo.getStreetId(getContext()); | ||
| 136 | + //判断赛事id是否相同 | ||
| 137 | + String runStreetId = userStepEntity.getStreetId(); | ||
| 138 | + //是相同赛事id | ||
| 139 | + if (eventId.equals(runStreetId)) { | ||
| 140 | + //赛事相同(询问用户是否继续 | ||
| 141 | + SelectDialog selectDialog = new SelectDialog(getContext(), "是否继续运动", "否", new SelectDialog.DialogInterface() { | ||
| 142 | + @Override | ||
| 143 | + public void onClick(SelectDialog dialog) { | ||
| 144 | + //删除数据 | ||
| 145 | + CollStepUtil.clearRunData(getContext(), CollCommonInfo.getUserId(getContext())); | ||
| 146 | + stopStepService(); | ||
| 147 | + //清除数据 | ||
| 148 | + CollCommonInfo.reset(getContext()); | ||
| 149 | + dialog.dismiss(); | ||
| 150 | + } | ||
| 151 | + }, "是", new SelectDialog.DialogInterface() { | ||
| 152 | + @Override | ||
| 153 | + public void onClick(SelectDialog dialog) { | ||
| 154 | + //继续运动 | ||
| 155 | + dialog.dismiss(); | ||
| 156 | + //检查百度是否正在运行 | ||
| 157 | + checkBaiduServiceState(); | ||
| 158 | + | ||
| 159 | + } | ||
| 160 | + }); | ||
| 161 | + selectDialog.setCancelable(false); | ||
| 162 | + selectDialog.setCanceledOnTouchOutside(false); | ||
| 163 | + selectDialog.show(); | ||
| 164 | + } | ||
| 165 | + //赛事id不同,但是有正在进行的赛事 | ||
| 166 | + else { | ||
| 167 | + //询问用户 | ||
| 168 | + SelectDialog selectDialog = new SelectDialog(getContext(), "你正在进行另一赛事,是否回到该赛事?", "否", new SelectDialog.DialogInterface() { | ||
| 169 | + @Override | ||
| 170 | + public void onClick(SelectDialog dialog) { | ||
| 171 | + //删除数据 | ||
| 172 | + CollStepUtil.clearRunData(getContext(), CollCommonInfo.getUserId(getContext())); | ||
| 173 | + stopStepService(); | ||
| 174 | + //清除数据 | ||
| 175 | + CollCommonInfo.reset(getContext()); | ||
| 176 | + dialog.dismiss(); | ||
| 177 | + } | ||
| 178 | + }, "是", new SelectDialog.DialogInterface() { | ||
| 179 | + @Override | ||
| 180 | + public void onClick(SelectDialog dialog) { | ||
| 181 | + //继续运动 | ||
| 182 | + dialog.dismiss(); | ||
| 183 | + //检查百度是否正在运行 | ||
| 184 | + checkBaiduServiceState(); | ||
| 185 | + } | ||
| 186 | + }); | ||
| 187 | + selectDialog.setCancelable(false); | ||
| 188 | + selectDialog.setCanceledOnTouchOutside(false); | ||
| 189 | + selectDialog.show(); | ||
| 190 | + } | ||
| 191 | + } | ||
| 192 | + } | ||
| 193 | + | ||
| 194 | + /** | ||
| 125 | * 启动计步服务 | 195 | * 启动计步服务 |
| 126 | */ | 196 | */ |
| 127 | public void startStepService(Context context) { | 197 | public void startStepService(Context context) { |
| 128 | - CollCommonInfo.setIsFirstStepSendTraceTip(getContext(), true); | ||
| 129 | - QMUITipDialogUtil.loadingDialog(getContext(), "请稍后", false); | 198 | + CollCommonInfo.setIsFirstStepSendTraceTip(context, true); |
| 199 | + QMUITipDialogUtil.loadingDialog(context, "请稍后", false); | ||
| 130 | if (CollCommonInfo.getStepStartTime(context) == 0) { | 200 | if (CollCommonInfo.getStepStartTime(context) == 0) { |
| 131 | CollCommonInfo.setStepStartTime(context, TimeUtil.getNowTimeStamp()); | 201 | CollCommonInfo.setStepStartTime(context, TimeUtil.getNowTimeStamp()); |
| 132 | } | 202 | } |
| @@ -149,9 +219,11 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener { | @@ -149,9 +219,11 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener { | ||
| 149 | startStepService(getContext()); | 219 | startStepService(getContext()); |
| 150 | } else { | 220 | } else { |
| 151 | CollRunningMapActivity.startActivity(fragment.getActivity(), runRaceDetailInfo); | 221 | CollRunningMapActivity.startActivity(fragment.getActivity(), runRaceDetailInfo); |
| 222 | + fragment.getActivity().finish(); | ||
| 152 | } | 223 | } |
| 153 | } else { | 224 | } else { |
| 154 | CollRunningMapActivity.startActivity(fragment.getActivity(), runRaceDetailInfo); | 225 | CollRunningMapActivity.startActivity(fragment.getActivity(), runRaceDetailInfo); |
| 226 | + fragment.getActivity().finish(); | ||
| 155 | } | 227 | } |
| 156 | } | 228 | } |
| 157 | 229 | ||
| @@ -305,13 +377,12 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener { | @@ -305,13 +377,12 @@ public class StartTraceFragmentView implements MvpView, SensorEventListener { | ||
| 305 | .longitude(location.getLongitude()).build(); | 377 | .longitude(location.getLongitude()).build(); |
| 306 | // currentAddress = location.getAddrStr(); | 378 | // currentAddress = location.getAddrStr(); |
| 307 | currentAddress = location.getLocationDescribe(); | 379 | currentAddress = location.getLocationDescribe(); |
| 308 | - if (selectDialog != null && selectDialog.isShowing()) { | ||
| 309 | - selectDialog.setTipMessage(currentAddress); | ||
| 310 | - } | ||
| 311 | if (isShowFollowAddress && selectDialog != null && !selectDialog.isShowing()) { | 380 | if (isShowFollowAddress && selectDialog != null && !selectDialog.isShowing()) { |
| 312 | if (!TextUtils.isEmpty(currentAddress)) { | 381 | if (!TextUtils.isEmpty(currentAddress)) { |
| 313 | selectDialog.setTipMessage("确定将" + "\"" + currentAddress + "\"" + "设置开始地点?"); | 382 | selectDialog.setTipMessage("确定将" + "\"" + currentAddress + "\"" + "设置开始地点?"); |
| 314 | - selectDialog.show(); | 383 | + if (!selectDialog.isShowing()) { |
| 384 | + selectDialog.show(); | ||
| 385 | + } | ||
| 315 | } | 386 | } |
| 316 | } | 387 | } |
| 317 | if (followMyLocation == null || followMyLocation.latitude == 0 || followMyLocation.longitude == 0) { | 388 | if (followMyLocation == null || followMyLocation.latitude == 0 || followMyLocation.longitude == 0) { |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/model/CollectPoint.java
| @@ -3,24 +3,24 @@ package com.cnlive.moudle.collectionTrace.model; | @@ -3,24 +3,24 @@ package com.cnlive.moudle.collectionTrace.model; | ||
| 3 | import com.baidu.mapapi.model.LatLng; | 3 | import com.baidu.mapapi.model.LatLng; |
| 4 | 4 | ||
| 5 | public class CollectPoint { | 5 | public class CollectPoint { |
| 6 | - private double lat; | ||
| 7 | - private double lng; | 6 | + private double latitude; |
| 7 | + private double longitude; | ||
| 8 | private String pointName; | 8 | private String pointName; |
| 9 | 9 | ||
| 10 | - public double getLat() { | ||
| 11 | - return lat; | 10 | + public double getLatitude() { |
| 11 | + return latitude; | ||
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | - public void setLat(double lat) { | ||
| 15 | - this.lat = lat; | 14 | + public void setLatitude(double latitude) { |
| 15 | + this.latitude = latitude; | ||
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | - public double getLng() { | ||
| 19 | - return lng; | 18 | + public double getLongitude() { |
| 19 | + return longitude; | ||
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | - public void setLng(double lng) { | ||
| 23 | - this.lng = lng; | 22 | + public void setLongitude(double longitude) { |
| 23 | + this.longitude = longitude; | ||
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | public String getPointName() { | 26 | public String getPointName() { |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/model/RaceNameListInfo.java
| 1 | package com.cnlive.moudle.collectionTrace.model; | 1 | package com.cnlive.moudle.collectionTrace.model; |
| 2 | 2 | ||
| 3 | +import java.io.Serializable; | ||
| 3 | import java.util.List; | 4 | import java.util.List; |
| 4 | 5 | ||
| 5 | /** | 6 | /** |
| 6 | * Created by hanyayun 019/06/25. | 7 | * Created by hanyayun 019/06/25. |
| 7 | */ | 8 | */ |
| 8 | -public class RaceNameListInfo { | 9 | +public class RaceNameListInfo implements Serializable { |
| 9 | 10 | ||
| 10 | 11 | ||
| 11 | /** | 12 | /** |
| @@ -32,7 +33,7 @@ public class RaceNameListInfo { | @@ -32,7 +33,7 @@ public class RaceNameListInfo { | ||
| 32 | this.eventShoeLines = eventShoeLines; | 33 | this.eventShoeLines = eventShoeLines; |
| 33 | } | 34 | } |
| 34 | 35 | ||
| 35 | - public static class EventShoeLinesBean { | 36 | + public static class EventShoeLinesBean implements Serializable { |
| 36 | /** | 37 | /** |
| 37 | * entityName : yangshuai | 38 | * entityName : yangshuai |
| 38 | * startTime : 1560127625 | 39 | * startTime : 1560127625 |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/activity/CollPedometerMainActivity.java
| @@ -68,9 +68,7 @@ public class CollPedometerMainActivity extends QMUIFragmentActivity { | @@ -68,9 +68,7 @@ public class CollPedometerMainActivity extends QMUIFragmentActivity { | ||
| 68 | notificationManagerCompat = NotificationManagerCompat.from(this); | 68 | notificationManagerCompat = NotificationManagerCompat.from(this); |
| 69 | isOpen = notificationManagerCompat.areNotificationsEnabled(); | 69 | isOpen = notificationManagerCompat.areNotificationsEnabled(); |
| 70 | if (isOpen) { | 70 | if (isOpen) { |
| 71 | - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { | ||
| 72 | -// ContextCompat.startForegroundService(CollPedometerMainActivity.this, new Intent(CollPedometerMainActivity.this, CollStepService.class)); | ||
| 73 | - } | 71 | + getPermissionsWithTip(); |
| 74 | } else { | 72 | } else { |
| 75 | goToSettingNo(); | 73 | goToSettingNo(); |
| 76 | } | 74 | } |
| @@ -118,7 +116,7 @@ public class CollPedometerMainActivity extends QMUIFragmentActivity { | @@ -118,7 +116,7 @@ public class CollPedometerMainActivity extends QMUIFragmentActivity { | ||
| 118 | protected void onResume() { | 116 | protected void onResume() { |
| 119 | super.onResume(); | 117 | super.onResume(); |
| 120 | check(); | 118 | check(); |
| 121 | - getPermissionsWithTip(); | 119 | + |
| 122 | } | 120 | } |
| 123 | 121 | ||
| 124 | private void addFragment(RunRaceDetailInfo runRaceDetailInfo) { | 122 | private void addFragment(RunRaceDetailInfo runRaceDetailInfo) { |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/activity/CollRunRaceDetailActivity.java
| @@ -11,8 +11,13 @@ import com.cnlive.libs.base.ui.QMUIFragment; | @@ -11,8 +11,13 @@ import com.cnlive.libs.base.ui.QMUIFragment; | ||
| 11 | import com.cnlive.libs.base.ui.QMUIFragmentActivity; | 11 | import com.cnlive.libs.base.ui.QMUIFragmentActivity; |
| 12 | import com.cnlive.libs.base.util.StatusBarUtil; | 12 | import com.cnlive.libs.base.util.StatusBarUtil; |
| 13 | import com.cnlive.libs.base.util.StatusBarUtil2; | 13 | import com.cnlive.libs.base.util.StatusBarUtil2; |
| 14 | +import com.cnlive.moudle.collectionTrace.commonInfo.CollCommonInfo; | ||
| 14 | import com.cnlive.moudle.collectionTrace.ui.fragment.CollRunMainFragment; | 15 | import com.cnlive.moudle.collectionTrace.ui.fragment.CollRunMainFragment; |
| 15 | import com.cnlive.moudle.collectionTrace.ui.fragment.CollRunRaceDetailFragment; | 16 | import com.cnlive.moudle.collectionTrace.ui.fragment.CollRunRaceDetailFragment; |
| 17 | +import com.cnlive.moudle.collectionTrace.utils.CollStepUtil; | ||
| 18 | +import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; | ||
| 19 | +import com.cnlive.moudle.pedometer.sql.entity.CollUserStepEntity; | ||
| 20 | +import com.cnlive.moudle.pedometer.ui.widget.SelectDialog; | ||
| 16 | import com.cnlive.moudle.pedometer.utils.CheckUtil; | 21 | import com.cnlive.moudle.pedometer.utils.CheckUtil; |
| 17 | import com.example.moudle_pedometer.R; | 22 | import com.example.moudle_pedometer.R; |
| 18 | 23 | ||
| @@ -26,9 +31,11 @@ public class CollRunRaceDetailActivity extends QMUIFragmentActivity { | @@ -26,9 +31,11 @@ public class CollRunRaceDetailActivity extends QMUIFragmentActivity { | ||
| 26 | private final String TAG = "CollRunRaceDetail"; | 31 | private final String TAG = "CollRunRaceDetail"; |
| 27 | private QMUIFragment fragment; | 32 | private QMUIFragment fragment; |
| 28 | 33 | ||
| 29 | - public static void newInstance(Context context,String eventId){ | ||
| 30 | - Intent intent = new Intent(context,CollRunRaceDetailActivity.class); | ||
| 31 | - intent.putExtra("eventId",eventId); | 34 | + public static void newInstance(Context context, String eventId) { |
| 35 | + CollCommonInfo.setStreetId(context, eventId); | ||
| 36 | + //先判断有没有数据 | ||
| 37 | + Intent intent = new Intent(context, CollRunRaceDetailActivity.class); | ||
| 38 | + intent.putExtra("eventId", eventId); | ||
| 32 | context.startActivity(intent); | 39 | context.startActivity(intent); |
| 33 | } | 40 | } |
| 34 | 41 |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/activity/CollRunningFinishActivity.java
| @@ -31,15 +31,13 @@ public class CollRunningFinishActivity extends QMUIFragmentActivity { | @@ -31,15 +31,13 @@ public class CollRunningFinishActivity extends QMUIFragmentActivity { | ||
| 31 | protected void onCreate(Bundle savedInstanceState) { | 31 | protected void onCreate(Bundle savedInstanceState) { |
| 32 | super.onCreate(savedInstanceState); | 32 | super.onCreate(savedInstanceState); |
| 33 | StatusBarUtil2.setColor(this, getResources().getColor(R.color.run_main_bg), 0); | 33 | StatusBarUtil2.setColor(this, getResources().getColor(R.color.run_main_bg), 0); |
| 34 | - if (getIntent().getSerializableExtra("runningFinishBean") != null) { | ||
| 35 | - addFragment((RunningFinishBean) getIntent().getSerializableExtra("runningFinishBean")); | ||
| 36 | - } | 34 | + addFragment(); |
| 37 | 35 | ||
| 38 | 36 | ||
| 39 | } | 37 | } |
| 40 | 38 | ||
| 41 | - private void addFragment(RunningFinishBean runningFinishBean) { | ||
| 42 | - QMUIFragment fragment =RunningFinishFragment.instance(runningFinishBean); | 39 | + private void addFragment() { |
| 40 | + QMUIFragment fragment =new CollRunningFinishFragment(); | ||
| 43 | getSupportFragmentManager().beginTransaction() | 41 | getSupportFragmentManager().beginTransaction() |
| 44 | .add(getContextViewId(), fragment, fragment.getClass().getSimpleName()) | 42 | .add(getContextViewId(), fragment, fragment.getClass().getSimpleName()) |
| 45 | .addToBackStack(fragment.getClass().getSimpleName()) | 43 | .addToBackStack(fragment.getClass().getSimpleName()) |
| @@ -54,9 +52,8 @@ public class CollRunningFinishActivity extends QMUIFragmentActivity { | @@ -54,9 +52,8 @@ public class CollRunningFinishActivity extends QMUIFragmentActivity { | ||
| 54 | } | 52 | } |
| 55 | } | 53 | } |
| 56 | 54 | ||
| 57 | - public static void startActivity(Activity activity, RunningFinishBean runningFinishBean) { | 55 | + public static void startActivity(Activity activity) { |
| 58 | Intent intent = new Intent(activity, CollRunningFinishActivity.class); | 56 | Intent intent = new Intent(activity, CollRunningFinishActivity.class); |
| 59 | - intent.putExtra("runningFinishBean", runningFinishBean); | ||
| 60 | activity.startActivity(intent); | 57 | activity.startActivity(intent); |
| 61 | } | 58 | } |
| 62 | } | 59 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/activity/CollTraceListDetailActivity.java
0 → 100644
| 1 | +package com.cnlive.moudle.collectionTrace.ui.activity; | ||
| 2 | + | ||
| 3 | +import android.os.Bundle; | ||
| 4 | + | ||
| 5 | +import com.cnlive.libs.base.ui.QMUIFragmentActivity; | ||
| 6 | +import com.cnlive.moudle.collectionTrace.model.RaceNameListInfo; | ||
| 7 | +import com.example.moudle_pedometer.R; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * 轨迹列表详情页 | ||
| 11 | + * | ||
| 12 | + * @author ShinnyYang | ||
| 13 | + */ | ||
| 14 | +public class CollTraceListDetailActivity extends QMUIFragmentActivity { | ||
| 15 | + private RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean; | ||
| 16 | + | ||
| 17 | + @Override | ||
| 18 | + protected int getContextViewId() { | ||
| 19 | + return R.id.fragment_coll_trace_list_detail; | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | + @Override | ||
| 23 | + protected void onCreate(Bundle savedInstanceState) { | ||
| 24 | + super.onCreate(savedInstanceState); | ||
| 25 | + eventShoeLinesBean = (RaceNameListInfo.EventShoeLinesBean) getIntent().getExtras().get("eventShoeLinesBean"); | ||
| 26 | + } | ||
| 27 | +} |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/activity/RaceNameListActivity.java
| @@ -8,6 +8,7 @@ import android.os.Bundle; | @@ -8,6 +8,7 @@ import android.os.Bundle; | ||
| 8 | import com.cnlive.libs.base.util.StatusBarUtil; | 8 | import com.cnlive.libs.base.util.StatusBarUtil; |
| 9 | import com.cnlive.libs.base.util.StatusBarUtil2; | 9 | import com.cnlive.libs.base.util.StatusBarUtil2; |
| 10 | import com.cnlive.moudle.collectionTrace.ui.fragment.RaceNameListFragment; | 10 | import com.cnlive.moudle.collectionTrace.ui.fragment.RaceNameListFragment; |
| 11 | +import com.cnlive.moudle.pedometer.net.bean.RunRaceDetailInfo; | ||
| 11 | import com.example.moudle_pedometer.R; | 12 | import com.example.moudle_pedometer.R; |
| 12 | 13 | ||
| 13 | 14 | ||
| @@ -17,9 +18,10 @@ import com.example.moudle_pedometer.R; | @@ -17,9 +18,10 @@ import com.example.moudle_pedometer.R; | ||
| 17 | */ | 18 | */ |
| 18 | public class RaceNameListActivity extends AppCompatActivity { | 19 | public class RaceNameListActivity extends AppCompatActivity { |
| 19 | 20 | ||
| 20 | - public static void newInstance(Context context,String eventId){ | ||
| 21 | - Intent intent = new Intent(context,RaceNameListActivity.class); | ||
| 22 | - intent.putExtra("eventId",eventId); | 21 | + public static void newInstance(Context context, String eventId, RunRaceDetailInfo runRaceDetailInfo) { |
| 22 | + Intent intent = new Intent(context, RaceNameListActivity.class); | ||
| 23 | + intent.putExtra("eventId", eventId); | ||
| 24 | + intent.putExtra("runRaceDetailInfo", runRaceDetailInfo); | ||
| 23 | context.startActivity(intent); | 25 | context.startActivity(intent); |
| 24 | } | 26 | } |
| 25 | 27 | ||
| @@ -29,6 +31,9 @@ public class RaceNameListActivity extends AppCompatActivity { | @@ -29,6 +31,9 @@ public class RaceNameListActivity extends AppCompatActivity { | ||
| 29 | StatusBarUtil.setStatusBarWrite(this); | 31 | StatusBarUtil.setStatusBarWrite(this); |
| 30 | StatusBarUtil2.setColor(this, getResources().getColor(R.color.white), 0); | 32 | StatusBarUtil2.setColor(this, getResources().getColor(R.color.white), 0); |
| 31 | setContentView(R.layout.activity_race_name_list); | 33 | setContentView(R.layout.activity_race_name_list); |
| 32 | - getSupportFragmentManager().beginTransaction().replace(R.id.race_container,RaceNameListFragment.newInstance(getIntent().getStringExtra("eventId"))).commit(); | 34 | + RunRaceDetailInfo runRaceDetailInfo = (RunRaceDetailInfo) getIntent().getExtras().getSerializable("runRaceDetailInfo"); |
| 35 | + if (null != runRaceDetailInfo) { | ||
| 36 | + getSupportFragmentManager().beginTransaction().replace(R.id.race_container, RaceNameListFragment.newInstance(getIntent().getStringExtra("eventId"), runRaceDetailInfo)).commit(); | ||
| 37 | + } | ||
| 33 | } | 38 | } |
| 34 | } | 39 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/activity/StartCollectTraceActivity.java
| 1 | package com.cnlive.moudle.collectionTrace.ui.activity; | 1 | package com.cnlive.moudle.collectionTrace.ui.activity; |
| 2 | 2 | ||
| 3 | +import android.Manifest; | ||
| 3 | import android.app.Activity; | 4 | import android.app.Activity; |
| 4 | import android.content.Context; | 5 | import android.content.Context; |
| 5 | import android.content.Intent; | 6 | import android.content.Intent; |
| 6 | import android.os.Bundle; | 7 | import android.os.Bundle; |
| 8 | +import android.provider.Settings; | ||
| 9 | +import android.support.annotation.NonNull; | ||
| 10 | +import android.util.Log; | ||
| 11 | +import android.widget.Toast; | ||
| 7 | 12 | ||
| 8 | import com.cnlive.libs.base.ui.QMUIFragment; | 13 | import com.cnlive.libs.base.ui.QMUIFragment; |
| 9 | import com.cnlive.libs.base.ui.QMUIFragmentActivity; | 14 | import com.cnlive.libs.base.ui.QMUIFragmentActivity; |
| @@ -11,14 +16,20 @@ import com.cnlive.libs.base.util.StatusBarUtil; | @@ -11,14 +16,20 @@ import com.cnlive.libs.base.util.StatusBarUtil; | ||
| 11 | import com.cnlive.libs.base.util.StatusBarUtil2; | 16 | import com.cnlive.libs.base.util.StatusBarUtil2; |
| 12 | import com.cnlive.moudle.collectionTrace.ui.fragment.StartTraceFragment; | 17 | import com.cnlive.moudle.collectionTrace.ui.fragment.StartTraceFragment; |
| 13 | import com.cnlive.moudle.pedometer.net.bean.RunRaceDetailInfo; | 18 | import com.cnlive.moudle.pedometer.net.bean.RunRaceDetailInfo; |
| 19 | +import com.cnlive.moudle.pedometer.utils.MyMapUtil; | ||
| 20 | +import com.cnlive.moudle.pedometer.utils.lib_permisshelper.PermissionsListener; | ||
| 21 | +import com.cnlive.moudle.pedometer.utils.lib_permisshelper.PermissionsUtils; | ||
| 14 | import com.example.moudle_pedometer.R; | 22 | import com.example.moudle_pedometer.R; |
| 15 | 23 | ||
| 16 | public class StartCollectTraceActivity extends QMUIFragmentActivity { | 24 | public class StartCollectTraceActivity extends QMUIFragmentActivity { |
| 17 | 25 | ||
| 26 | + private PermissionsUtils mPermissionsUtils;//权限申请 | ||
| 27 | + private RunRaceDetailInfo runRaceDetailInfo; | ||
| 18 | 28 | ||
| 19 | - public static void newInstance(Context context, String eventId) { | 29 | + public static void newInstance(Context context, String eventId,RunRaceDetailInfo runRaceDetailInfo) { |
| 20 | Intent intent = new Intent(context, StartCollectTraceActivity.class); | 30 | Intent intent = new Intent(context, StartCollectTraceActivity.class); |
| 21 | intent.putExtra("eventId", eventId); | 31 | intent.putExtra("eventId", eventId); |
| 32 | + intent.putExtra("runRaceDetailInfo", runRaceDetailInfo); | ||
| 22 | context.startActivity(intent); | 33 | context.startActivity(intent); |
| 23 | } | 34 | } |
| 24 | 35 | ||
| @@ -30,15 +41,20 @@ public class StartCollectTraceActivity extends QMUIFragmentActivity { | @@ -30,15 +41,20 @@ public class StartCollectTraceActivity extends QMUIFragmentActivity { | ||
| 30 | @Override | 41 | @Override |
| 31 | protected void onCreate(Bundle savedInstanceState) { | 42 | protected void onCreate(Bundle savedInstanceState) { |
| 32 | super.onCreate(savedInstanceState); | 43 | super.onCreate(savedInstanceState); |
| 44 | + mPermissionsUtils = new PermissionsUtils(); | ||
| 33 | StatusBarUtil.setStatusBarWrite(this); | 45 | StatusBarUtil.setStatusBarWrite(this); |
| 34 | StatusBarUtil2.setColor(this, getResources().getColor(R.color.white), 0); | 46 | StatusBarUtil2.setColor(this, getResources().getColor(R.color.white), 0); |
| 35 | - RunRaceDetailInfo runRaceDetailInfo = (RunRaceDetailInfo) getIntent().getExtras().getSerializable("runRaceDetailInfo"); | ||
| 36 | - if (null != runRaceDetailInfo) { | ||
| 37 | - addFragment(StartTraceFragment.newInstance(runRaceDetailInfo)); | ||
| 38 | - } | 47 | + runRaceDetailInfo = (RunRaceDetailInfo) getIntent().getExtras().getSerializable("runRaceDetailInfo"); |
| 48 | + | ||
| 39 | 49 | ||
| 40 | } | 50 | } |
| 41 | 51 | ||
| 52 | + @Override | ||
| 53 | + protected void onResume() { | ||
| 54 | + super.onResume(); | ||
| 55 | + getPermissionsWithTip(); | ||
| 56 | + } | ||
| 57 | + | ||
| 42 | private void addFragment(QMUIFragment fragment) { | 58 | private void addFragment(QMUIFragment fragment) { |
| 43 | getSupportFragmentManager().beginTransaction() | 59 | getSupportFragmentManager().beginTransaction() |
| 44 | .add(getContextViewId(), fragment, fragment.getClass().getSimpleName()) | 60 | .add(getContextViewId(), fragment, fragment.getClass().getSimpleName()) |
| @@ -51,4 +67,69 @@ public class StartCollectTraceActivity extends QMUIFragmentActivity { | @@ -51,4 +67,69 @@ public class StartCollectTraceActivity extends QMUIFragmentActivity { | ||
| 51 | intent.putExtra("runRaceDetailInfo", runRaceDetailInfo); | 67 | intent.putExtra("runRaceDetailInfo", runRaceDetailInfo); |
| 52 | activity.startActivity(intent); | 68 | activity.startActivity(intent); |
| 53 | } | 69 | } |
| 70 | + | ||
| 71 | + | ||
| 72 | + /** | ||
| 73 | + * 一次申请一组权限(使用拒绝弹框)点击事件 | ||
| 74 | + */ | ||
| 75 | + public void getPermissionsWithTip() { | ||
| 76 | + mPermissionsUtils | ||
| 77 | + .setPermissionsListener(new PermissionsListener() { | ||
| 78 | + @Override | ||
| 79 | + public void onDenied(String[] deniedPermissions) { | ||
| 80 | + getPermissionsWithTip(); | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + @Override | ||
| 84 | + public void onGranted() { | ||
| 85 | + | ||
| 86 | + //判断GPS是否开启 | ||
| 87 | + if (!MyMapUtil.isOPenGps(getApplicationContext())) { | ||
| 88 | + //开启GPS | ||
| 89 | + Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS); | ||
| 90 | + startActivityForResult(intent, 10); | ||
| 91 | + Toast.makeText(getApplicationContext(), getString(R.string.open_gps_tip), Toast.LENGTH_LONG).show(); | ||
| 92 | + } else { | ||
| 93 | + if (getCurrentFragment() == null) { | ||
| 94 | + if (null != runRaceDetailInfo) { | ||
| 95 | + addFragment(StartTraceFragment.newInstance(runRaceDetailInfo)); | ||
| 96 | + } | ||
| 97 | + } | ||
| 98 | + } | ||
| 99 | + } | ||
| 100 | + }) | ||
| 101 | + .withActivity(StartCollectTraceActivity.this) | ||
| 102 | + .getPermissions(StartCollectTraceActivity.this | ||
| 103 | + , 100 | ||
| 104 | + , Manifest.permission.INTERNET | ||
| 105 | + , Manifest.permission.READ_EXTERNAL_STORAGE | ||
| 106 | + , Manifest.permission.WRITE_EXTERNAL_STORAGE | ||
| 107 | + , Manifest.permission.ACCESS_FINE_LOCATION | ||
| 108 | + , Manifest.permission.ACCESS_COARSE_LOCATION | ||
| 109 | + ); | ||
| 110 | +// .getPermissionsWithTips(MainActivity.this | ||
| 111 | +// ,100 | ||
| 112 | +// , new String[]{"人家要录音","我们需要读取你的信息,磨磨唧唧的","我要上网","我要读内存卡","我要看日历","我要定位"} | ||
| 113 | +// , Manifest.permission.RECORD_AUDIO | ||
| 114 | +// , Manifest.permission.READ_SMS | ||
| 115 | +// , Manifest.permission.INTERNET | ||
| 116 | +// , Manifest.permission.READ_EXTERNAL_STORAGE | ||
| 117 | +// , Manifest.permission.READ_CALENDAR | ||
| 118 | +// , Manifest.permission.ACCESS_FINE_LOCATION); | ||
| 119 | + } | ||
| 120 | + | ||
| 121 | + | ||
| 122 | + /** | ||
| 123 | + * 权限回调 | ||
| 124 | + * | ||
| 125 | + * @param requestCode | ||
| 126 | + * @param permissions | ||
| 127 | + * @param grantResults | ||
| 128 | + */ | ||
| 129 | + @Override | ||
| 130 | + public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, | ||
| 131 | + @NonNull int[] grantResults) { | ||
| 132 | + super.onRequestPermissionsResult(requestCode, permissions, grantResults); | ||
| 133 | + mPermissionsUtils.dealResult(requestCode, permissions, grantResults); | ||
| 134 | + } | ||
| 54 | } | 135 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/adapter/CollFinishDetaiAdapter.java
0 → 100644
| 1 | +package com.cnlive.moudle.collectionTrace.ui.adapter; | ||
| 2 | + | ||
| 3 | +import android.app.Activity; | ||
| 4 | +import android.support.annotation.NonNull; | ||
| 5 | +import android.support.v7.widget.RecyclerView; | ||
| 6 | +import android.view.LayoutInflater; | ||
| 7 | +import android.view.View; | ||
| 8 | +import android.view.ViewGroup; | ||
| 9 | +import android.widget.TextView; | ||
| 10 | + | ||
| 11 | +import com.cnlive.moudle.collectionTrace.model.CollectPoint; | ||
| 12 | +import com.example.moudle_pedometer.R; | ||
| 13 | + | ||
| 14 | +import java.util.ArrayList; | ||
| 15 | +import java.util.List; | ||
| 16 | + | ||
| 17 | +/** | ||
| 18 | + * @author ShinnyYang | ||
| 19 | + */ | ||
| 20 | +public class CollFinishDetaiAdapter extends RecyclerView.Adapter<CollFinishDetaiAdapter.MyViewHolder> { | ||
| 21 | + | ||
| 22 | + private List<CollectPoint> list = new ArrayList<>(); | ||
| 23 | + private Activity context; | ||
| 24 | + | ||
| 25 | + public CollFinishDetaiAdapter(Activity context, List<CollectPoint> list) { | ||
| 26 | + this.list = list; | ||
| 27 | + this.context = context; | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + @NonNull | ||
| 31 | + @Override | ||
| 32 | + public MyViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) { | ||
| 33 | + View view = LayoutInflater.from(context).inflate(R.layout.item_coll_take_point, viewGroup, false); | ||
| 34 | + return new MyViewHolder(view); | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + @Override | ||
| 38 | + public void onBindViewHolder(@NonNull MyViewHolder myViewHolder, int i) { | ||
| 39 | + //设置打点名称 | ||
| 40 | + if (null == myViewHolder) { | ||
| 41 | + return; | ||
| 42 | + } | ||
| 43 | + if (0 == i) { | ||
| 44 | + //起点 | ||
| 45 | + myViewHolder.view_circle.setBackground(context.getResources().getDrawable(R.drawable.shape_circle_green)); | ||
| 46 | + myViewHolder.tv_point_type_tip.setText(context.getResources().getString(R.string.layout_street_start_point)); | ||
| 47 | + myViewHolder.view_line.setVisibility(View.VISIBLE); | ||
| 48 | + | ||
| 49 | + } else if (list.size() - 1 == i) { | ||
| 50 | + //终点 | ||
| 51 | + myViewHolder.view_circle.setBackground(context.getResources().getDrawable(R.drawable.shape_circle_red)); | ||
| 52 | + myViewHolder.tv_point_type_tip.setText(context.getResources().getString(R.string.layout_street_end_point)); | ||
| 53 | + myViewHolder.view_line.setVisibility(View.GONE); | ||
| 54 | + } else { | ||
| 55 | + myViewHolder.view_line.setVisibility(View.VISIBLE); | ||
| 56 | + //打点 | ||
| 57 | + myViewHolder.view_circle.setBackground(context.getResources().getDrawable(R.drawable.shape_circle_gray)); | ||
| 58 | +// myViewHolder.tv_point_type_tip.setText(context.getResources().getString(R.string.layout_coll_take_point_text)); | ||
| 59 | + if (i > 0) { | ||
| 60 | + myViewHolder.tv_point_type_tip.setText("(打点" + i + ")"); | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + } | ||
| 64 | + myViewHolder.tv_take_point.setText(list.get(i).getPointName()); | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + @Override | ||
| 68 | + public int getItemCount() { | ||
| 69 | + return list.size(); | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + class MyViewHolder extends RecyclerView.ViewHolder { | ||
| 73 | + | ||
| 74 | + public View view_circle; | ||
| 75 | + public TextView tv_point_type_tip; | ||
| 76 | + public TextView tv_take_point; | ||
| 77 | + public View view_line; | ||
| 78 | + | ||
| 79 | + | ||
| 80 | + public MyViewHolder(@NonNull View itemView) { | ||
| 81 | + super(itemView); | ||
| 82 | + this.view_circle = (View) itemView.findViewById(R.id.view_circle); | ||
| 83 | + this.tv_point_type_tip = (TextView) itemView.findViewById(R.id.tv_point_type_tip); | ||
| 84 | + this.tv_take_point = (TextView) itemView.findViewById(R.id.tv_take_point); | ||
| 85 | + this.view_line = (View) itemView.findViewById(R.id.view_line); | ||
| 86 | + } | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | +} |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/adapter/RunListAdapter.java
| @@ -13,6 +13,7 @@ import com.cnlive.moudle.collectionTrace.ui.activity.CollRunRaceDetailActivity; | @@ -13,6 +13,7 @@ import com.cnlive.moudle.collectionTrace.ui.activity.CollRunRaceDetailActivity; | ||
| 13 | import com.cnlive.moudle.collectionTrace.ui.activity.RaceNameListActivity; | 13 | import com.cnlive.moudle.collectionTrace.ui.activity.RaceNameListActivity; |
| 14 | import com.cnlive.moudle.collectionTrace.ui.activity.StartCollectTraceActivity; | 14 | import com.cnlive.moudle.collectionTrace.ui.activity.StartCollectTraceActivity; |
| 15 | import com.cnlive.moudle.pedometer.net.bean.RunLineInfo; | 15 | import com.cnlive.moudle.pedometer.net.bean.RunLineInfo; |
| 16 | +import com.cnlive.moudle.pedometer.net.bean.RunRaceDetailInfo; | ||
| 16 | import com.cnlive.moudle.pedometer.utils.TimeUtil; | 17 | import com.cnlive.moudle.pedometer.utils.TimeUtil; |
| 17 | import com.example.moudle_pedometer.R; | 18 | import com.example.moudle_pedometer.R; |
| 18 | 19 | ||
| @@ -45,9 +46,25 @@ public class RunListAdapter extends RecyclerView.Adapter<RunListAdapter.MyViewHo | @@ -45,9 +46,25 @@ public class RunListAdapter extends RecyclerView.Adapter<RunListAdapter.MyViewHo | ||
| 45 | myViewHolder.activity_time.setText(TimeUtil.getStampToTime(list.get(i).getStart_time(), "yyyy.MM.dd") + "——" + TimeUtil.getStampToTime(list.get(i).getEnd_time(), "yyyy.MM.dd")); | 46 | myViewHolder.activity_time.setText(TimeUtil.getStampToTime(list.get(i).getStart_time(), "yyyy.MM.dd") + "——" + TimeUtil.getStampToTime(list.get(i).getEnd_time(), "yyyy.MM.dd")); |
| 46 | myViewHolder.line_address.setText(list.get(i).getAddress() + " " + list.get(i).getMileage()); | 47 | myViewHolder.line_address.setText(list.get(i).getAddress() + " " + list.get(i).getMileage()); |
| 47 | //添加轨迹 | 48 | //添加轨迹 |
| 48 | - myViewHolder.add_path.setOnClickListener(v -> StartCollectTraceActivity.newInstance(context,list.get(i).getId()+"")); | ||
| 49 | - myViewHolder.path_list.setOnClickListener(v -> RaceNameListActivity.newInstance(context,list.get(i).getId()+"")); | ||
| 50 | - myViewHolder.item_ly.setOnClickListener(v -> CollRunRaceDetailActivity.newInstance(context,list.get(i).getId()+"")); | 49 | + myViewHolder.add_path.setOnClickListener(new View.OnClickListener() { |
| 50 | + @Override | ||
| 51 | + public void onClick(View view) { | ||
| 52 | + RunRaceDetailInfo runRaceDetailInfo = new RunRaceDetailInfo(); | ||
| 53 | + runRaceDetailInfo.setTitle(list.get(i).getTitle()); | ||
| 54 | + StartCollectTraceActivity.newInstance(context, list.get(i).getId() + "", runRaceDetailInfo); | ||
| 55 | + } | ||
| 56 | + }); | ||
| 57 | + myViewHolder.path_list.setOnClickListener(new View.OnClickListener() { | ||
| 58 | + @Override | ||
| 59 | + public void onClick(View view) { | ||
| 60 | + RunRaceDetailInfo runRaceDetailInfo = new RunRaceDetailInfo(); | ||
| 61 | + runRaceDetailInfo.setTitle(list.get(i).getTitle()); | ||
| 62 | + RaceNameListActivity.newInstance(context, list.get(i).getId() + "",runRaceDetailInfo); | ||
| 63 | + | ||
| 64 | + } | ||
| 65 | + }); | ||
| 66 | + | ||
| 67 | + myViewHolder.item_ly.setOnClickListener(v -> CollRunRaceDetailActivity.newInstance(context, list.get(i).getId() + "")); | ||
| 51 | } | 68 | } |
| 52 | 69 | ||
| 53 | @Override | 70 | @Override |
| @@ -55,7 +72,7 @@ public class RunListAdapter extends RecyclerView.Adapter<RunListAdapter.MyViewHo | @@ -55,7 +72,7 @@ public class RunListAdapter extends RecyclerView.Adapter<RunListAdapter.MyViewHo | ||
| 55 | return list.size(); | 72 | return list.size(); |
| 56 | } | 73 | } |
| 57 | 74 | ||
| 58 | - class MyViewHolder extends RecyclerView.ViewHolder{ | 75 | + class MyViewHolder extends RecyclerView.ViewHolder { |
| 59 | 76 | ||
| 60 | TextView line_name; | 77 | TextView line_name; |
| 61 | TextView activity_time; | 78 | TextView activity_time; |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/fragment/CollRunRaceDetailFragment.java
| @@ -9,8 +9,10 @@ import android.view.View; | @@ -9,8 +9,10 @@ import android.view.View; | ||
| 9 | import android.widget.Button; | 9 | import android.widget.Button; |
| 10 | 10 | ||
| 11 | import com.cnlive.libs.base.ui.QMUIFragment; | 11 | import com.cnlive.libs.base.ui.QMUIFragment; |
| 12 | +import com.cnlive.moudle.collectionTrace.commonInfo.CollCommonInfo; | ||
| 12 | import com.cnlive.moudle.collectionTrace.frame.presenter.CollRunRaceDetailFragmentPresenter; | 13 | import com.cnlive.moudle.collectionTrace.frame.presenter.CollRunRaceDetailFragmentPresenter; |
| 13 | import com.cnlive.moudle.collectionTrace.frame.view.CollRunRaceDetailFragmentView; | 14 | import com.cnlive.moudle.collectionTrace.frame.view.CollRunRaceDetailFragmentView; |
| 15 | +import com.cnlive.moudle.collectionTrace.ui.activity.RaceNameListActivity; | ||
| 14 | import com.cnlive.moudle.collectionTrace.ui.activity.StartCollectTraceActivity; | 16 | import com.cnlive.moudle.collectionTrace.ui.activity.StartCollectTraceActivity; |
| 15 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; | 17 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; |
| 16 | import com.cnlive.moudle.pedometer.model.Constant; | 18 | import com.cnlive.moudle.pedometer.model.Constant; |
| @@ -59,9 +61,13 @@ public class CollRunRaceDetailFragment extends QMUIFragment<CollRunRaceDetailFra | @@ -59,9 +61,13 @@ public class CollRunRaceDetailFragment extends QMUIFragment<CollRunRaceDetailFra | ||
| 59 | addTraceBtn.setOnClickListener(new View.OnClickListener() { | 61 | addTraceBtn.setOnClickListener(new View.OnClickListener() { |
| 60 | @Override | 62 | @Override |
| 61 | public void onClick(View view) { | 63 | public void onClick(View view) { |
| 62 | - //todo 自己测试用 | ||
| 63 | - getActivity().finish(); | ||
| 64 | - RunLineActivity.newInstance(getActivity(),null,null,null,null); | 64 | + if (null != getMvpView()) { |
| 65 | + if (null != getMvpView().runRaceDetailInfo) { | ||
| 66 | + RaceNameListActivity.newInstance(getActivity(), CollCommonInfo.getStreetId(getActivity()), getMvpView().runRaceDetailInfo); | ||
| 67 | + } else { | ||
| 68 | + QMUITipDialogUtil.failedDialog(getActivity(), "正在获取数据,请稍后", 1); | ||
| 69 | + } | ||
| 70 | + } | ||
| 65 | } | 71 | } |
| 66 | }); | 72 | }); |
| 67 | } | 73 | } |
| @@ -74,7 +80,9 @@ public class CollRunRaceDetailFragment extends QMUIFragment<CollRunRaceDetailFra | @@ -74,7 +80,9 @@ public class CollRunRaceDetailFragment extends QMUIFragment<CollRunRaceDetailFra | ||
| 74 | getMvpView().initMap(); | 80 | getMvpView().initMap(); |
| 75 | } | 81 | } |
| 76 | if (getPresenter() != null) { | 82 | if (getPresenter() != null) { |
| 77 | - getPresenter().getRunRaceDetailInfo(getActivity(), "116", CommonInfo.getUserId(getActivity()), "1"); | 83 | +// getPresenter().getRunRaceDetailInfo(getActivity(), "116", CommonInfo.getUserId(getActivity()), "1"); |
| 84 | + getPresenter().getRunRaceDetailInfo(getActivity(), CollCommonInfo.getStreetId(getActivity()), CommonInfo.getUserId(getActivity()), "1"); | ||
| 85 | + | ||
| 78 | } | 86 | } |
| 79 | 87 | ||
| 80 | } | 88 | } |
| @@ -177,5 +185,4 @@ public class CollRunRaceDetailFragment extends QMUIFragment<CollRunRaceDetailFra | @@ -177,5 +185,4 @@ public class CollRunRaceDetailFragment extends QMUIFragment<CollRunRaceDetailFra | ||
| 177 | // } | 185 | // } |
| 178 | 186 | ||
| 179 | 187 | ||
| 180 | - | ||
| 181 | } | 188 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/fragment/CollRunningFinishFragment.java
| @@ -7,24 +7,28 @@ import android.view.View; | @@ -7,24 +7,28 @@ import android.view.View; | ||
| 7 | import com.cnlive.libs.base.ui.QMUIFragment; | 7 | import com.cnlive.libs.base.ui.QMUIFragment; |
| 8 | import com.cnlive.moudle.collectionTrace.frame.presenter.CollRunningFinishFragmetPresenter; | 8 | import com.cnlive.moudle.collectionTrace.frame.presenter.CollRunningFinishFragmetPresenter; |
| 9 | import com.cnlive.moudle.collectionTrace.frame.view.CollRunningFinishFragmentView; | 9 | import com.cnlive.moudle.collectionTrace.frame.view.CollRunningFinishFragmentView; |
| 10 | +import com.cnlive.moudle.collectionTrace.utils.CollStepUtil; | ||
| 11 | +import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; | ||
| 10 | import com.cnlive.moudle.pedometer.frame.presenter.RunningFinishFragmetPresenter; | 12 | import com.cnlive.moudle.pedometer.frame.presenter.RunningFinishFragmetPresenter; |
| 11 | import com.cnlive.moudle.pedometer.model.RunningFinishBean; | 13 | import com.cnlive.moudle.pedometer.model.RunningFinishBean; |
| 14 | +import com.cnlive.moudle.pedometer.sql.entity.CollUserStepEntity; | ||
| 12 | import com.example.moudle_pedometer.R; | 15 | import com.example.moudle_pedometer.R; |
| 16 | +import com.example.moudle_pedometer.databinding.FragmentCollFinishRunMapBinding; | ||
| 13 | import com.example.moudle_pedometer.databinding.FragmentFinishRunMapBinding; | 17 | import com.example.moudle_pedometer.databinding.FragmentFinishRunMapBinding; |
| 14 | 18 | ||
| 15 | -public class CollRunningFinishFragment extends QMUIFragment<CollRunningFinishFragmentView, CollRunningFinishFragmetPresenter, FragmentFinishRunMapBinding> { | ||
| 16 | - private RunningFinishBean runningFinishBean; | 19 | +public class CollRunningFinishFragment extends QMUIFragment<CollRunningFinishFragmentView, CollRunningFinishFragmetPresenter, FragmentCollFinishRunMapBinding> { |
| 20 | +// private RunningFinishBean runningFinishBean; | ||
| 17 | 21 | ||
| 18 | - public static CollRunningFinishFragment instance(RunningFinishBean runningFinishBean) { | ||
| 19 | - CollRunningFinishFragment fragment = new CollRunningFinishFragment(); | ||
| 20 | - Bundle bundle = null; | ||
| 21 | - if (runningFinishBean != null) { | ||
| 22 | - bundle = new Bundle(); | ||
| 23 | - bundle.putSerializable("runningFinishBean", runningFinishBean); | ||
| 24 | - } | ||
| 25 | - fragment.setArguments(bundle); | ||
| 26 | - return fragment; | ||
| 27 | - } | 22 | +// public static CollRunningFinishFragment instance(RunningFinishBean runningFinishBean) { |
| 23 | +// CollRunningFinishFragment fragment = new CollRunningFinishFragment(); | ||
| 24 | +// Bundle bundle = null; | ||
| 25 | +// if (runningFinishBean != null) { | ||
| 26 | +// bundle = new Bundle(); | ||
| 27 | +// bundle.putSerializable("runningFinishBean", runningFinishBean); | ||
| 28 | +// } | ||
| 29 | +// fragment.setArguments(bundle); | ||
| 30 | +// return fragment; | ||
| 31 | +// } | ||
| 28 | 32 | ||
| 29 | @Override | 33 | @Override |
| 30 | protected int getToolbarId() { | 34 | protected int getToolbarId() { |
| @@ -38,21 +42,23 @@ public class CollRunningFinishFragment extends QMUIFragment<CollRunningFinishFra | @@ -38,21 +42,23 @@ public class CollRunningFinishFragment extends QMUIFragment<CollRunningFinishFra | ||
| 38 | 42 | ||
| 39 | @Override | 43 | @Override |
| 40 | protected int getLayoutId() { | 44 | protected int getLayoutId() { |
| 41 | - return R.layout.fragment_finish_run_map; | 45 | + return R.layout.fragment_coll_finish_run_map; |
| 42 | } | 46 | } |
| 43 | 47 | ||
| 44 | @Override | 48 | @Override |
| 45 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { | 49 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { |
| 46 | super.onViewCreated(view, savedInstanceState); | 50 | super.onViewCreated(view, savedInstanceState); |
| 47 | - if (getArguments() != null) { | ||
| 48 | - runningFinishBean = (RunningFinishBean) getArguments().getSerializable("runningFinishBean"); | ||
| 49 | - if (runningFinishBean != null) { | ||
| 50 | - if (getMvpView() != null) { | ||
| 51 | - getMvpView().initView(runningFinishBean); | ||
| 52 | - } | 51 | + if (null != getMvpView()) { |
| 52 | + getMvpView().initMap(); | ||
| 53 | + } | ||
| 54 | + CollUserStepEntity collUserStepEntity = CollStepUtil.getCollUserStepData(getContext(), CommonInfo.getUserId(getContext())); | ||
| 55 | + if (collUserStepEntity != null) { | ||
| 56 | + if (getMvpView() != null) { | ||
| 57 | + getMvpView().initView(collUserStepEntity); | ||
| 53 | } | 58 | } |
| 54 | } | 59 | } |
| 55 | } | 60 | } |
| 61 | + | ||
| 56 | /** | 62 | /** |
| 57 | * 屏蔽边缘返回 | 63 | * 屏蔽边缘返回 |
| 58 | * 杨帅 | 64 | * 杨帅 |
| @@ -64,4 +70,28 @@ public class CollRunningFinishFragment extends QMUIFragment<CollRunningFinishFra | @@ -64,4 +70,28 @@ public class CollRunningFinishFragment extends QMUIFragment<CollRunningFinishFra | ||
| 64 | return 0; | 70 | return 0; |
| 65 | 71 | ||
| 66 | } | 72 | } |
| 73 | + | ||
| 74 | + @Override | ||
| 75 | + public void onResume() { | ||
| 76 | + super.onResume(); | ||
| 77 | + if (null != getMvpView()) { | ||
| 78 | + getMvpView().onResume(); | ||
| 79 | + } | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + @Override | ||
| 83 | + public void onPause() { | ||
| 84 | + super.onPause(); | ||
| 85 | + if (null != getMvpView()) { | ||
| 86 | + getMvpView().onPause(); | ||
| 87 | + } | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + @Override | ||
| 91 | + public void onDestroy() { | ||
| 92 | + super.onDestroy(); | ||
| 93 | + if (null != getMvpView()) { | ||
| 94 | + getMvpView().onPause(); | ||
| 95 | + } | ||
| 96 | + } | ||
| 67 | } | 97 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/fragment/CollTraceListDetailFragment.java
0 → 100644
| 1 | +package com.cnlive.moudle.collectionTrace.ui.fragment; | ||
| 2 | + | ||
| 3 | +import android.os.Bundle; | ||
| 4 | +import android.support.annotation.Nullable; | ||
| 5 | +import android.view.View; | ||
| 6 | + | ||
| 7 | +import com.cnlive.libs.base.ui.QMUIFragment; | ||
| 8 | +import com.cnlive.moudle.collectionTrace.frame.presenter.CollTraceListDetailFragmentPresenter; | ||
| 9 | +import com.cnlive.moudle.collectionTrace.frame.view.CollTraceListDetailFragmentView; | ||
| 10 | +import com.cnlive.moudle.collectionTrace.model.RaceNameListInfo; | ||
| 11 | +import com.example.moudle_pedometer.R; | ||
| 12 | +import com.example.moudle_pedometer.databinding.FragmentCollFinishRunMapBinding; | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * 轨迹列表详情页 | ||
| 16 | + * | ||
| 17 | + * @author ShinnyYang | ||
| 18 | + */ | ||
| 19 | +public class CollTraceListDetailFragment extends QMUIFragment<CollTraceListDetailFragmentView, CollTraceListDetailFragmentPresenter, FragmentCollFinishRunMapBinding> { | ||
| 20 | + private RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean; | ||
| 21 | + | ||
| 22 | + public static CollTraceListDetailFragment newInstance(RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean) { | ||
| 23 | + CollTraceListDetailFragment fragment = new CollTraceListDetailFragment(); | ||
| 24 | + Bundle bundle = new Bundle(); | ||
| 25 | + bundle.putSerializable("eventShoeLinesBean", eventShoeLinesBean); | ||
| 26 | + fragment.setArguments(bundle); | ||
| 27 | + return fragment; | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + @Override | ||
| 31 | + protected int getToolbarId() { | ||
| 32 | + return 0; | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + @Override | ||
| 36 | + public String getTitle() { | ||
| 37 | + return null; | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + @Override | ||
| 41 | + protected int getLayoutId() { | ||
| 42 | + return R.layout.fragment_coll_finish_run_map; | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + @Override | ||
| 46 | + public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { | ||
| 47 | + super.onViewCreated(view, savedInstanceState); | ||
| 48 | + if (null != getArguments()) { | ||
| 49 | + eventShoeLinesBean = (RaceNameListInfo.EventShoeLinesBean) getArguments().get("eventShoeLinesBean"); | ||
| 50 | + if (null != eventShoeLinesBean) { | ||
| 51 | + | ||
| 52 | + } | ||
| 53 | + } | ||
| 54 | + } | ||
| 55 | +} |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/fragment/RaceNameListFragment.java
| @@ -9,25 +9,29 @@ import com.cnlive.libs.base.frame.fragment.MvpBindingFragment; | @@ -9,25 +9,29 @@ import com.cnlive.libs.base.frame.fragment.MvpBindingFragment; | ||
| 9 | import com.cnlive.moudle.collectionTrace.frame.presenter.RaceNameListPresenter; | 9 | import com.cnlive.moudle.collectionTrace.frame.presenter.RaceNameListPresenter; |
| 10 | import com.cnlive.moudle.collectionTrace.frame.view.RaceNameListView; | 10 | import com.cnlive.moudle.collectionTrace.frame.view.RaceNameListView; |
| 11 | import com.cnlive.moudle.collectionTrace.model.RaceNameListInfo; | 11 | import com.cnlive.moudle.collectionTrace.model.RaceNameListInfo; |
| 12 | +import com.cnlive.moudle.pedometer.net.bean.RunRaceDetailInfo; | ||
| 12 | import com.example.moudle_pedometer.R; | 13 | import com.example.moudle_pedometer.R; |
| 13 | import com.example.moudle_pedometer.databinding.FragmentRaceNameListBinding; | 14 | import com.example.moudle_pedometer.databinding.FragmentRaceNameListBinding; |
| 14 | 15 | ||
| 15 | /** | 16 | /** |
| 16 | * Created by hanyayun 019/06/25. | 17 | * Created by hanyayun 019/06/25. |
| 17 | */ | 18 | */ |
| 18 | -public class RaceNameListFragment extends MvpBindingFragment<RaceNameListView, RaceNameListPresenter,Object, FragmentRaceNameListBinding> { | 19 | +public class RaceNameListFragment extends MvpBindingFragment<RaceNameListView, RaceNameListPresenter, Object, FragmentRaceNameListBinding> { |
| 19 | 20 | ||
| 20 | public int currentPage = 1; | 21 | public int currentPage = 1; |
| 21 | public int pageSize = 10; | 22 | public int pageSize = 10; |
| 22 | public String eventId; | 23 | public String eventId; |
| 24 | + private RunRaceDetailInfo runRaceDetailInfo; | ||
| 23 | 25 | ||
| 24 | - public static RaceNameListFragment newInstance(String eventId){ | 26 | + public static RaceNameListFragment newInstance(String eventId, RunRaceDetailInfo runRaceDetailInfo) { |
| 25 | RaceNameListFragment fragment = new RaceNameListFragment(); | 27 | RaceNameListFragment fragment = new RaceNameListFragment(); |
| 26 | Bundle bundle = new Bundle(); | 28 | Bundle bundle = new Bundle(); |
| 27 | - bundle.putString("eventId",eventId); | 29 | + bundle.putString("eventId", eventId); |
| 30 | + bundle.putSerializable("runRaceDetailInfo", runRaceDetailInfo); | ||
| 28 | fragment.setArguments(bundle); | 31 | fragment.setArguments(bundle); |
| 29 | return fragment; | 32 | return fragment; |
| 30 | } | 33 | } |
| 34 | + | ||
| 31 | public RaceNameListFragment() { | 35 | public RaceNameListFragment() { |
| 32 | // Required empty public constructor | 36 | // Required empty public constructor |
| 33 | } | 37 | } |
| @@ -36,16 +40,25 @@ public class RaceNameListFragment extends MvpBindingFragment<RaceNameListView, R | @@ -36,16 +40,25 @@ public class RaceNameListFragment extends MvpBindingFragment<RaceNameListView, R | ||
| 36 | @Override | 40 | @Override |
| 37 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { | 41 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { |
| 38 | super.onViewCreated(view, savedInstanceState); | 42 | super.onViewCreated(view, savedInstanceState); |
| 39 | - if(getMvpView() != null) getMvpView().initView(); | ||
| 40 | - eventId = getArguments().getString("eventId"); | ||
| 41 | - getPresenter().setData(getActivity(),eventId,currentPage,pageSize); | ||
| 42 | - binding.refreshLayout.setOnRefreshListener(v ->{ | 43 | + |
| 44 | + if (null != getArguments()) { | ||
| 45 | + eventId = getArguments().getString("eventId"); | ||
| 46 | + runRaceDetailInfo = (RunRaceDetailInfo) getArguments().getSerializable("runRaceDetailInfo"); | ||
| 47 | + if (null != runRaceDetailInfo) { | ||
| 48 | + if (getMvpView() != null) { | ||
| 49 | + getMvpView().initView(runRaceDetailInfo); | ||
| 50 | + } | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + } | ||
| 54 | + getPresenter().setData(getActivity(), eventId, currentPage, pageSize); | ||
| 55 | + binding.refreshLayout.setOnRefreshListener(v -> { | ||
| 43 | currentPage = 1; | 56 | currentPage = 1; |
| 44 | - getPresenter().setData(getActivity(),eventId,currentPage,pageSize); | 57 | + getPresenter().setData(getActivity(), eventId, currentPage, pageSize); |
| 45 | }); | 58 | }); |
| 46 | - binding.refreshLayout.setOnLoadMoreListener(v ->{ | 59 | + binding.refreshLayout.setOnLoadMoreListener(v -> { |
| 47 | currentPage++; | 60 | currentPage++; |
| 48 | - getPresenter().setData(getActivity(),eventId,currentPage,pageSize); | 61 | + getPresenter().setData(getActivity(), eventId, currentPage, pageSize); |
| 49 | }); | 62 | }); |
| 50 | } | 63 | } |
| 51 | 64 | ||
| @@ -55,11 +68,11 @@ public class RaceNameListFragment extends MvpBindingFragment<RaceNameListView, R | @@ -55,11 +68,11 @@ public class RaceNameListFragment extends MvpBindingFragment<RaceNameListView, R | ||
| 55 | } | 68 | } |
| 56 | 69 | ||
| 57 | 70 | ||
| 58 | - public void addShoeLine(RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean,int position){ | ||
| 59 | - getPresenter().bindingShoeLine(getActivity(),eventShoeLinesBean.getId(),eventShoeLinesBean.getEventId(),position); | 71 | + public void addShoeLine(RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean, int position) { |
| 72 | + getPresenter().bindingShoeLine(getActivity(), eventShoeLinesBean.getId(), eventShoeLinesBean.getEventId(), position); | ||
| 60 | } | 73 | } |
| 61 | 74 | ||
| 62 | - public void delectShoeLine(RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean,int position){ | ||
| 63 | - getPresenter().delectShoeLine(getActivity(),eventShoeLinesBean.getId(),position); | 75 | + public void delectShoeLine(RaceNameListInfo.EventShoeLinesBean eventShoeLinesBean, int position) { |
| 76 | + getPresenter().delectShoeLine(getActivity(), eventShoeLinesBean.getId(), position); | ||
| 64 | } | 77 | } |
| 65 | } | 78 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/ui/fragment/StartTraceFragment.java
| @@ -77,6 +77,7 @@ public class StartTraceFragment extends QMUIFragment<StartTraceFragmentView, Sta | @@ -77,6 +77,7 @@ public class StartTraceFragment extends QMUIFragment<StartTraceFragmentView, Sta | ||
| 77 | //为系统的方向传感器注册监听器 | 77 | //为系统的方向传感器注册监听器 |
| 78 | mSensorManager.registerListener(getMvpView(), mSensorManager.getDefaultSensor(Sensor.TYPE_ORIENTATION), | 78 | mSensorManager.registerListener(getMvpView(), mSensorManager.getDefaultSensor(Sensor.TYPE_ORIENTATION), |
| 79 | SensorManager.SENSOR_DELAY_UI); | 79 | SensorManager.SENSOR_DELAY_UI); |
| 80 | + getMvpView().checkIsHasRunningRace(); | ||
| 80 | } | 81 | } |
| 81 | } | 82 | } |
| 82 | 83 | ||
| @@ -118,7 +119,8 @@ public class StartTraceFragment extends QMUIFragment<StartTraceFragmentView, Sta | @@ -118,7 +119,8 @@ public class StartTraceFragment extends QMUIFragment<StartTraceFragmentView, Sta | ||
| 118 | if (getMvpView() != null) { | 119 | if (getMvpView() != null) { |
| 119 | QMUITipDialogUtil.dismessDialog(); | 120 | QMUITipDialogUtil.dismessDialog(); |
| 120 | if (null != getMvpView()) { | 121 | if (null != getMvpView()) { |
| 121 | - CollRunningMapActivity.startActivity(getActivity(),getMvpView().runRaceDetailInfo); | 122 | + CollRunningMapActivity.startActivity(getActivity(), getMvpView().runRaceDetailInfo); |
| 123 | + getActivity().finish(); | ||
| 122 | } | 124 | } |
| 123 | } | 125 | } |
| 124 | } | 126 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/collectionTrace/utils/CollStepUtil.java
| @@ -12,6 +12,7 @@ import com.cnlive.moudle.pedometer.sql.db.DbCore; | @@ -12,6 +12,7 @@ import com.cnlive.moudle.pedometer.sql.db.DbCore; | ||
| 12 | import com.cnlive.moudle.pedometer.sql.entity.CollUserStepEntity; | 12 | import com.cnlive.moudle.pedometer.sql.entity.CollUserStepEntity; |
| 13 | import com.cnlive.moudle.pedometer.sql.entity.UserStepEntity; | 13 | import com.cnlive.moudle.pedometer.sql.entity.UserStepEntity; |
| 14 | import com.cnlive.moudle.pedometer.utils.GsonUtil; | 14 | import com.cnlive.moudle.pedometer.utils.GsonUtil; |
| 15 | +import com.cnlive.moudle.pedometer.utils.TimeUtil; | ||
| 15 | 16 | ||
| 16 | import java.text.SimpleDateFormat; | 17 | import java.text.SimpleDateFormat; |
| 17 | import java.util.ArrayList; | 18 | import java.util.ArrayList; |
| @@ -33,6 +34,141 @@ public class CollStepUtil { | @@ -33,6 +34,141 @@ public class CollStepUtil { | ||
| 33 | } | 34 | } |
| 34 | 35 | ||
| 35 | /** | 36 | /** |
| 37 | + * 设置围栏id | ||
| 38 | + * | ||
| 39 | + * @param context | ||
| 40 | + * @param uid | ||
| 41 | + * @param fenceID | ||
| 42 | + */ | ||
| 43 | + public static void setFenceId(Context context, String uid, String fenceID) { | ||
| 44 | + //先获取有没有 | ||
| 45 | + if (getCollUserStepData(context, uid) != null) { | ||
| 46 | + CollUserStepEntity entity = getCollUserStepData(context, uid); | ||
| 47 | + if (null != entity) { | ||
| 48 | + //设置围栏id | ||
| 49 | + entity.setFenceId(fenceID); | ||
| 50 | + //更新数据 | ||
| 51 | + updateCollStepData(context, entity); | ||
| 52 | + } | ||
| 53 | + } | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + /** | ||
| 57 | + * 设置用户整个赛事用时 | ||
| 58 | + * | ||
| 59 | + * @param context | ||
| 60 | + * @param uid | ||
| 61 | + */ | ||
| 62 | + public static void setEmployTimeStamp(Context context, String uid, String employTime) { | ||
| 63 | + //先获取有没有 | ||
| 64 | + if (getCollUserStepData(context, uid) != null) { | ||
| 65 | + CollUserStepEntity entity = getCollUserStepData(context, uid); | ||
| 66 | + if (null != entity) { | ||
| 67 | + //设置用户完成时间 | ||
| 68 | + entity.setEmployTime(employTime); | ||
| 69 | + //更新数据 | ||
| 70 | + updateCollStepData(context, entity); | ||
| 71 | + } | ||
| 72 | + } | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + /** | ||
| 76 | + * 设置用户结束地点数据 | ||
| 77 | + * | ||
| 78 | + * @param context | ||
| 79 | + * @param uid | ||
| 80 | + * @param collectPoint | ||
| 81 | + */ | ||
| 82 | + public static void setCollEndPointData(Context context, String uid, CollectPoint collectPoint) { | ||
| 83 | + //先获取有没有 | ||
| 84 | + if (getCollUserStepData(context, uid) != null) { | ||
| 85 | + CollUserStepEntity entity = getCollUserStepData(context, uid); | ||
| 86 | + if (null != entity) { | ||
| 87 | + //设置用户结束数据 | ||
| 88 | + entity.setCollEndPointData(GsonUtil.GsonString(collectPoint)); | ||
| 89 | + //更新数据 | ||
| 90 | + updateCollStepData(context, entity); | ||
| 91 | + } | ||
| 92 | + } | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + | ||
| 96 | + /** | ||
| 97 | + * 设置用户结束时间 | ||
| 98 | + * | ||
| 99 | + * @param context | ||
| 100 | + * @param uid | ||
| 101 | + * @param userFinishTime | ||
| 102 | + */ | ||
| 103 | + public static void setCollUserFinishTimeStamp(Context context, String uid, long userFinishTime) { | ||
| 104 | + //先获取有没有 | ||
| 105 | + if (getCollUserStepData(context, uid) != null) { | ||
| 106 | + CollUserStepEntity entity = getCollUserStepData(context, uid); | ||
| 107 | + if (null != entity) { | ||
| 108 | + //设置用户完成时间 | ||
| 109 | + entity.setFinishTimeStamp(userFinishTime); | ||
| 110 | + //更新数据 | ||
| 111 | + updateCollStepData(context, entity); | ||
| 112 | + } | ||
| 113 | + } | ||
| 114 | + } | ||
| 115 | + | ||
| 116 | + /** | ||
| 117 | + * 获取打点详细 | ||
| 118 | + * | ||
| 119 | + * @param context | ||
| 120 | + * @param uid | ||
| 121 | + */ | ||
| 122 | + public static List<CollectPoint> getCollImportPointList(Context context, String uid) { | ||
| 123 | + //先获取有没有 | ||
| 124 | + if (getCollUserStepData(context, uid) != null) { | ||
| 125 | + CollUserStepEntity entity = getCollUserStepData(context, uid); | ||
| 126 | + if (null != entity) { | ||
| 127 | + //判断有没有打过点 | ||
| 128 | + if (!TextUtils.isEmpty(entity.getImportPoint())) { | ||
| 129 | + //已经打过点,先把打的点取出来 | ||
| 130 | + List<CollectPoint> lngs = GsonUtil.jsonToList(entity.getImportPoint(), CollectPoint.class); | ||
| 131 | + if (null != lngs) { | ||
| 132 | + return lngs; | ||
| 133 | + } else { | ||
| 134 | + return null; | ||
| 135 | + } | ||
| 136 | + } | ||
| 137 | + } | ||
| 138 | + } | ||
| 139 | + return null; | ||
| 140 | + } | ||
| 141 | + | ||
| 142 | + | ||
| 143 | + /** | ||
| 144 | + * 获取打点数量重要点 | ||
| 145 | + * | ||
| 146 | + * @param context | ||
| 147 | + * @param uid | ||
| 148 | + */ | ||
| 149 | + public static int getCollImportPointSize(Context context, String uid) { | ||
| 150 | + //先获取有没有 | ||
| 151 | + if (getCollUserStepData(context, uid) != null) { | ||
| 152 | + CollUserStepEntity entity = getCollUserStepData(context, uid); | ||
| 153 | + if (null != entity) { | ||
| 154 | + //判断有没有打过点 | ||
| 155 | + if (!TextUtils.isEmpty(entity.getImportPoint())) { | ||
| 156 | + //已经打过点,先把打的点取出来 | ||
| 157 | + List<CollectPoint> lngs = GsonUtil.jsonToList(entity.getImportPoint(), CollectPoint.class); | ||
| 158 | + if (null != lngs) { | ||
| 159 | + return lngs.size(); | ||
| 160 | + } else { | ||
| 161 | + return 98; | ||
| 162 | + } | ||
| 163 | + } else { | ||
| 164 | + return 0; | ||
| 165 | + } | ||
| 166 | + } | ||
| 167 | + } | ||
| 168 | + return 98; | ||
| 169 | + } | ||
| 170 | + | ||
| 171 | + /** | ||
| 36 | * 初始化数据库 | 172 | * 初始化数据库 |
| 37 | * | 173 | * |
| 38 | * @param context | 174 | * @param context |
| @@ -53,16 +189,13 @@ public class CollStepUtil { | @@ -53,16 +189,13 @@ public class CollStepUtil { | ||
| 53 | * | 189 | * |
| 54 | * @param context | 190 | * @param context |
| 55 | * @param uid | 191 | * @param uid |
| 56 | - * @param startPointName | ||
| 57 | - * @param startPointLatLng | ||
| 58 | */ | 192 | */ |
| 59 | - public static void setCollStartPointData(Context context, String uid, String startPointName, String startPointLatLng) { | 193 | + public static void setCollStartPointData(Context context, String uid, CollectPoint collectPoint) { |
| 60 | //先获取有没有 | 194 | //先获取有没有 |
| 61 | if (getCollUserStepData(context, uid) != null) { | 195 | if (getCollUserStepData(context, uid) != null) { |
| 62 | CollUserStepEntity entity = getCollUserStepData(context, uid); | 196 | CollUserStepEntity entity = getCollUserStepData(context, uid); |
| 63 | if (null != entity) { | 197 | if (null != entity) { |
| 64 | - entity.setCollStartLatLngName(startPointName); | ||
| 65 | - entity.setCollStartLatLng(startPointLatLng); | 198 | + entity.setCollStartPointData(GsonUtil.GsonString(collectPoint)); |
| 66 | //更新数据 | 199 | //更新数据 |
| 67 | updateCollStepData(context, entity); | 200 | updateCollStepData(context, entity); |
| 68 | } | 201 | } |
| @@ -74,9 +207,9 @@ public class CollStepUtil { | @@ -74,9 +207,9 @@ public class CollStepUtil { | ||
| 74 | * | 207 | * |
| 75 | * @param context | 208 | * @param context |
| 76 | * @param uid | 209 | * @param uid |
| 77 | - * @param latLng | 210 | + * @param collectPoint |
| 78 | */ | 211 | */ |
| 79 | - public static void setImportPoints(Context context, String uid, LatLng latLng) { | 212 | + public static void setCollImportPoints(Context context, String uid, CollectPoint collectPoint) { |
| 80 | //先获取有没有 | 213 | //先获取有没有 |
| 81 | if (getCollUserStepData(context, uid) != null) { | 214 | if (getCollUserStepData(context, uid) != null) { |
| 82 | CollUserStepEntity entity = getCollUserStepData(context, uid); | 215 | CollUserStepEntity entity = getCollUserStepData(context, uid); |
| @@ -84,11 +217,11 @@ public class CollStepUtil { | @@ -84,11 +217,11 @@ public class CollStepUtil { | ||
| 84 | //判断有没有打过点 | 217 | //判断有没有打过点 |
| 85 | if (!TextUtils.isEmpty(entity.getImportPoint())) { | 218 | if (!TextUtils.isEmpty(entity.getImportPoint())) { |
| 86 | //已经打过点,先把打的点取出来 | 219 | //已经打过点,先把打的点取出来 |
| 87 | - List<LatLng> lngs = GsonUtil.jsonToList(entity.getImportPoint(), LatLng.class); | 220 | + List<CollectPoint> lngs = GsonUtil.jsonToList(entity.getImportPoint(), CollectPoint.class); |
| 88 | if (null != lngs) { | 221 | if (null != lngs) { |
| 89 | //加入新打的点 | 222 | //加入新打的点 |
| 90 | - if (!lngs.contains(latLng)) { | ||
| 91 | - lngs.add(latLng); | 223 | + if (!lngs.contains(collectPoint)) { |
| 224 | + lngs.add(collectPoint); | ||
| 92 | //重新设置打的点 | 225 | //重新设置打的点 |
| 93 | entity.setImportPoint(GsonUtil.GsonString(lngs)); | 226 | entity.setImportPoint(GsonUtil.GsonString(lngs)); |
| 94 | //更新数据 | 227 | //更新数据 |
| @@ -100,8 +233,8 @@ public class CollStepUtil { | @@ -100,8 +233,8 @@ public class CollStepUtil { | ||
| 100 | //没有打过点 | 233 | //没有打过点 |
| 101 | else { | 234 | else { |
| 102 | //则设置一个 | 235 | //则设置一个 |
| 103 | - List<LatLng> lngs = new ArrayList<>(); | ||
| 104 | - lngs.add(latLng); | 236 | + List<CollectPoint> lngs = new ArrayList<>(); |
| 237 | + lngs.add(collectPoint); | ||
| 105 | //重新设置打的点 | 238 | //重新设置打的点 |
| 106 | entity.setImportPoint(GsonUtil.GsonString(lngs)); | 239 | entity.setImportPoint(GsonUtil.GsonString(lngs)); |
| 107 | //更新数据 | 240 | //更新数据 |
| @@ -252,7 +385,7 @@ public class CollStepUtil { | @@ -252,7 +385,7 @@ public class CollStepUtil { | ||
| 252 | public static void clearRunData(Context context, String uid) { | 385 | public static void clearRunData(Context context, String uid) { |
| 253 | DbCore.init(context, dbName); | 386 | DbCore.init(context, dbName); |
| 254 | String CURRENT_DATE = getTodayDate(); | 387 | String CURRENT_DATE = getTodayDate(); |
| 255 | - List<CollUserStepEntity> list = DbCore.getDaoSession().getCollUserStepEntityDao().queryBuilder().where(CollUserStepEntityDao.Properties.UserId.eq(uid), CollUserStepEntityDao.Properties.Date.eq(CURRENT_DATE)).list(); | 388 | + List<CollUserStepEntity> list = DbCore.getDaoSession().getCollUserStepEntityDao().queryBuilder().where(CollUserStepEntityDao.Properties.UserId.eq(uid)).list(); |
| 256 | if (list != null && list.size() > 0) { | 389 | if (list != null && list.size() > 0) { |
| 257 | Log.e(TAG, "clearRunData: " + list.size()); | 390 | Log.e(TAG, "clearRunData: " + list.size()); |
| 258 | DbCore.getDaoSession().getCollUserStepEntityDao().deleteByKey(list.get(0).getUserId()); | 391 | DbCore.getDaoSession().getCollUserStepEntityDao().deleteByKey(list.get(0).getUserId()); |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/frame/view/RunningFinishFragmentView.java
| @@ -9,6 +9,7 @@ import com.baidu.mapapi.map.BaiduMap; | @@ -9,6 +9,7 @@ import com.baidu.mapapi.map.BaiduMap; | ||
| 9 | import com.baidu.mapapi.map.MapView; | 9 | import com.baidu.mapapi.map.MapView; |
| 10 | import com.baidu.mapapi.map.UiSettings; | 10 | import com.baidu.mapapi.map.UiSettings; |
| 11 | import com.baidu.mapapi.model.LatLng; | 11 | import com.baidu.mapapi.model.LatLng; |
| 12 | +import com.baidu.trace.LBSTraceClient; | ||
| 12 | import com.baidu.trace.model.SortType; | 13 | import com.baidu.trace.model.SortType; |
| 13 | import com.bumptech.glide.Glide; | 14 | import com.bumptech.glide.Glide; |
| 14 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; | 15 | import com.cnlive.moudle.pedometer.commonInfo.CommonInfo; |
| @@ -31,7 +32,6 @@ public class RunningFinishFragmentView implements MvpView { | @@ -31,7 +32,6 @@ public class RunningFinishFragmentView implements MvpView { | ||
| 31 | public BaiduMap baiduMap; | 32 | public BaiduMap baiduMap; |
| 32 | private MapView mMapView; | 33 | private MapView mMapView; |
| 33 | private UiSettings mUiSettings; | 34 | private UiSettings mUiSettings; |
| 34 | - | ||
| 35 | public RunningFinishFragmentView(RunningFinishFragment fragment) { | 35 | public RunningFinishFragmentView(RunningFinishFragment fragment) { |
| 36 | this.fragment = fragment; | 36 | this.fragment = fragment; |
| 37 | } | 37 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/model/Constant.java
| 1 | package com.cnlive.moudle.pedometer.model; | 1 | package com.cnlive.moudle.pedometer.model; |
| 2 | 2 | ||
| 3 | public class Constant { | 3 | public class Constant { |
| 4 | -// public static final long SERVICE_ID = 213511;//公司账号 | 4 | + // public static final long SERVICE_ID = 213511;//公司账号 |
| 5 | public static final long SERVICE_ID = 213553; | 5 | public static final long SERVICE_ID = 213553; |
| 6 | 6 | ||
| 7 | public static final int TAG = 1; | 7 | public static final int TAG = 1; |
| @@ -15,6 +15,9 @@ public class Constant { | @@ -15,6 +15,9 @@ public class Constant { | ||
| 15 | public static final int FRAGMENT_RUN_CHRONOMETER = 4;//同步计时器 | 15 | public static final int FRAGMENT_RUN_CHRONOMETER = 4;//同步计时器 |
| 16 | public static final int EXIT_RANGE = 5;//超出范围 | 16 | public static final int EXIT_RANGE = 5;//超出范围 |
| 17 | public static final int ENTER_RANGE = 6;//进入范围 | 17 | public static final int ENTER_RANGE = 6;//进入范围 |
| 18 | + | ||
| 19 | + | ||
| 20 | + /*****************************************运营工具****************************************************/ | ||
| 18 | public static final int COLL_SERVICE_STEP_COUNT_RESET_SPEED = 3;//重置速度 | 21 | public static final int COLL_SERVICE_STEP_COUNT_RESET_SPEED = 3;//重置速度 |
| 19 | public static final int COLL_SERVICE_STEP_COUNT_UPDATE = 0;//步数更新 | 22 | public static final int COLL_SERVICE_STEP_COUNT_UPDATE = 0;//步数更新 |
| 20 | public static final int COLL_START_TRACE_GATHER_SUCCESS = 7;//启动轨迹服务成功(运营) | 23 | public static final int COLL_START_TRACE_GATHER_SUCCESS = 7;//启动轨迹服务成功(运营) |
| @@ -27,5 +30,7 @@ public class Constant { | @@ -27,5 +30,7 @@ public class Constant { | ||
| 27 | public static final int LOCA_ACCURACY = 20;//定位过滤精度 | 30 | public static final int LOCA_ACCURACY = 20;//定位过滤精度 |
| 28 | public static final int LOCA_END_POINT_ACCURACY = 20;//终点位置比较精度 | 31 | public static final int LOCA_END_POINT_ACCURACY = 20;//终点位置比较精度 |
| 29 | public static final int LOCA_START_POINT_ACCURACY = 200;//起点位置比较精度 | 32 | public static final int LOCA_START_POINT_ACCURACY = 200;//起点位置比较精度 |
| 33 | + public static final int FENCE_OFFSET=70;//围栏偏离距离 | ||
| 34 | + public static final int FENCE_DENOISE=70;//围栏去噪精度 | ||
| 30 | 35 | ||
| 31 | } | 36 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/net/ApiServiceRunLin.java
| @@ -66,6 +66,15 @@ public interface ApiServiceRunLin { | @@ -66,6 +66,15 @@ public interface ApiServiceRunLin { | ||
| 66 | @POST("Daren/event/getRouteRecordList.action") | 66 | @POST("Daren/event/getRouteRecordList.action") |
| 67 | Observable<Result<BaseInfo<SelfRecordInfo>>> getSelfRecordInfo(@QueryMap() Map<String, String> maps); | 67 | Observable<Result<BaseInfo<SelfRecordInfo>>> getSelfRecordInfo(@QueryMap() Map<String, String> maps); |
| 68 | 68 | ||
| 69 | + | ||
| 70 | + /** | ||
| 71 | + * 保存个人约跑路线记录 | ||
| 72 | + */ | ||
| 73 | + @POST("Daren/event/routeRecord.action") | ||
| 74 | + Observable<Result<BaseInfo>> saveRouteData(@QueryMap() Map<String, String> maps); | ||
| 75 | + | ||
| 76 | + | ||
| 77 | +/***********************************************运营人员接口*****************************************************************/ | ||
| 69 | /** | 78 | /** |
| 70 | * 踩点轨迹列表 | 79 | * 踩点轨迹列表 |
| 71 | */ | 80 | */ |
| @@ -84,15 +93,11 @@ public interface ApiServiceRunLin { | @@ -84,15 +93,11 @@ public interface ApiServiceRunLin { | ||
| 84 | @POST("Daren/event/bindingShoeLine.action") | 93 | @POST("Daren/event/bindingShoeLine.action") |
| 85 | Observable<Result<BaseInfo>> bindingShoeLineInfo(@QueryMap() Map<String, String> maps); | 94 | Observable<Result<BaseInfo>> bindingShoeLineInfo(@QueryMap() Map<String, String> maps); |
| 86 | 95 | ||
| 87 | - | ||
| 88 | /** | 96 | /** |
| 89 | - * 保存个人约跑路线记录 | 97 | + * http://apiwjjtest.cnlive.com/Daren/event/saveShoeLine.action |
| 98 | + * 运营路线踩点 | ||
| 90 | */ | 99 | */ |
| 91 | - @POST("Daren/event/routeRecord.action") | ||
| 92 | - Observable<Result<BaseInfo>> saveRouteData(@QueryMap() Map<String, String> maps); | ||
| 93 | - | ||
| 94 | - | ||
| 95 | - | ||
| 96 | - | 100 | + @POST("Daren/event/saveShoeLine.action") |
| 101 | + Observable<Result<BaseInfo>> collSaveShoeLine(@QueryMap() Map<String, String> maps); | ||
| 97 | } | 102 | } |
| 98 | 103 |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/sql/dao/CollUserStepEntityDao.java
| @@ -40,13 +40,14 @@ public class CollUserStepEntityDao extends AbstractDao<CollUserStepEntity, Strin | @@ -40,13 +40,14 @@ public class CollUserStepEntityDao extends AbstractDao<CollUserStepEntity, Strin | ||
| 40 | public final static Property QueryTraceEndTime = new Property(13, long.class, "queryTraceEndTime", false, "QUERY_TRACE_END_TIME"); | 40 | public final static Property QueryTraceEndTime = new Property(13, long.class, "queryTraceEndTime", false, "QUERY_TRACE_END_TIME"); |
| 41 | public final static Property QueryEntityName = new Property(14, String.class, "queryEntityName", false, "QUERY_ENTITY_NAME"); | 41 | public final static Property QueryEntityName = new Property(14, String.class, "queryEntityName", false, "QUERY_ENTITY_NAME"); |
| 42 | public final static Property ContinueTime = new Property(15, long.class, "continueTime", false, "CONTINUE_TIME"); | 42 | public final static Property ContinueTime = new Property(15, long.class, "continueTime", false, "CONTINUE_TIME"); |
| 43 | - public final static Property FenceId = new Property(16, long.class, "fenceId", false, "FENCE_ID"); | 43 | + public final static Property FenceId = new Property(16, String.class, "fenceId", false, "FENCE_ID"); |
| 44 | public final static Property ImportPoint = new Property(17, String.class, "importPoint", false, "IMPORT_POINT"); | 44 | public final static Property ImportPoint = new Property(17, String.class, "importPoint", false, "IMPORT_POINT"); |
| 45 | public final static Property StreetTitle = new Property(18, String.class, "streetTitle", false, "STREET_TITLE"); | 45 | public final static Property StreetTitle = new Property(18, String.class, "streetTitle", false, "STREET_TITLE"); |
| 46 | public final static Property EndLatLng = new Property(19, String.class, "endLatLng", false, "END_LAT_LNG"); | 46 | public final static Property EndLatLng = new Property(19, String.class, "endLatLng", false, "END_LAT_LNG"); |
| 47 | public final static Property IsArriveEndPoint = new Property(20, boolean.class, "isArriveEndPoint", false, "IS_ARRIVE_END_POINT"); | 47 | public final static Property IsArriveEndPoint = new Property(20, boolean.class, "isArriveEndPoint", false, "IS_ARRIVE_END_POINT"); |
| 48 | - public final static Property CollStartLatLngName = new Property(21, String.class, "collStartLatLngName", false, "COLL_START_LAT_LNG_NAME"); | ||
| 49 | - public final static Property CollStartLatLng = new Property(22, String.class, "collStartLatLng", false, "COLL_START_LAT_LNG"); | 48 | + public final static Property CollStartPointData = new Property(21, String.class, "collStartPointData", false, "COLL_START_POINT_DATA"); |
| 49 | + public final static Property CollEndPointData = new Property(22, String.class, "collEndPointData", false, "COLL_END_POINT_DATA"); | ||
| 50 | + public final static Property EmployTime = new Property(23, String.class, "employTime", false, "EMPLOY_TIME"); | ||
| 50 | } | 51 | } |
| 51 | 52 | ||
| 52 | 53 | ||
| @@ -78,13 +79,14 @@ public class CollUserStepEntityDao extends AbstractDao<CollUserStepEntity, Strin | @@ -78,13 +79,14 @@ public class CollUserStepEntityDao extends AbstractDao<CollUserStepEntity, Strin | ||
| 78 | "\"QUERY_TRACE_END_TIME\" INTEGER NOT NULL ," + // 13: queryTraceEndTime | 79 | "\"QUERY_TRACE_END_TIME\" INTEGER NOT NULL ," + // 13: queryTraceEndTime |
| 79 | "\"QUERY_ENTITY_NAME\" TEXT," + // 14: queryEntityName | 80 | "\"QUERY_ENTITY_NAME\" TEXT," + // 14: queryEntityName |
| 80 | "\"CONTINUE_TIME\" INTEGER NOT NULL ," + // 15: continueTime | 81 | "\"CONTINUE_TIME\" INTEGER NOT NULL ," + // 15: continueTime |
| 81 | - "\"FENCE_ID\" INTEGER NOT NULL ," + // 16: fenceId | 82 | + "\"FENCE_ID\" TEXT," + // 16: fenceId |
| 82 | "\"IMPORT_POINT\" TEXT," + // 17: importPoint | 83 | "\"IMPORT_POINT\" TEXT," + // 17: importPoint |
| 83 | "\"STREET_TITLE\" TEXT," + // 18: streetTitle | 84 | "\"STREET_TITLE\" TEXT," + // 18: streetTitle |
| 84 | "\"END_LAT_LNG\" TEXT," + // 19: endLatLng | 85 | "\"END_LAT_LNG\" TEXT," + // 19: endLatLng |
| 85 | "\"IS_ARRIVE_END_POINT\" INTEGER NOT NULL ," + // 20: isArriveEndPoint | 86 | "\"IS_ARRIVE_END_POINT\" INTEGER NOT NULL ," + // 20: isArriveEndPoint |
| 86 | - "\"COLL_START_LAT_LNG_NAME\" TEXT," + // 21: collStartLatLngName | ||
| 87 | - "\"COLL_START_LAT_LNG\" TEXT);"); // 22: collStartLatLng | 87 | + "\"COLL_START_POINT_DATA\" TEXT," + // 21: collStartPointData |
| 88 | + "\"COLL_END_POINT_DATA\" TEXT," + // 22: collEndPointData | ||
| 89 | + "\"EMPLOY_TIME\" TEXT);"); // 23: employTime | ||
| 88 | } | 90 | } |
| 89 | 91 | ||
| 90 | /** Drops the underlying database table. */ | 92 | /** Drops the underlying database table. */ |
| @@ -136,7 +138,11 @@ public class CollUserStepEntityDao extends AbstractDao<CollUserStepEntity, Strin | @@ -136,7 +138,11 @@ public class CollUserStepEntityDao extends AbstractDao<CollUserStepEntity, Strin | ||
| 136 | stmt.bindString(15, queryEntityName); | 138 | stmt.bindString(15, queryEntityName); |
| 137 | } | 139 | } |
| 138 | stmt.bindLong(16, entity.getContinueTime()); | 140 | stmt.bindLong(16, entity.getContinueTime()); |
| 139 | - stmt.bindLong(17, entity.getFenceId()); | 141 | + |
| 142 | + String fenceId = entity.getFenceId(); | ||
| 143 | + if (fenceId != null) { | ||
| 144 | + stmt.bindString(17, fenceId); | ||
| 145 | + } | ||
| 140 | 146 | ||
| 141 | String importPoint = entity.getImportPoint(); | 147 | String importPoint = entity.getImportPoint(); |
| 142 | if (importPoint != null) { | 148 | if (importPoint != null) { |
| @@ -154,14 +160,19 @@ public class CollUserStepEntityDao extends AbstractDao<CollUserStepEntity, Strin | @@ -154,14 +160,19 @@ public class CollUserStepEntityDao extends AbstractDao<CollUserStepEntity, Strin | ||
| 154 | } | 160 | } |
| 155 | stmt.bindLong(21, entity.getIsArriveEndPoint() ? 1L: 0L); | 161 | stmt.bindLong(21, entity.getIsArriveEndPoint() ? 1L: 0L); |
| 156 | 162 | ||
| 157 | - String collStartLatLngName = entity.getCollStartLatLngName(); | ||
| 158 | - if (collStartLatLngName != null) { | ||
| 159 | - stmt.bindString(22, collStartLatLngName); | 163 | + String collStartPointData = entity.getCollStartPointData(); |
| 164 | + if (collStartPointData != null) { | ||
| 165 | + stmt.bindString(22, collStartPointData); | ||
| 166 | + } | ||
| 167 | + | ||
| 168 | + String collEndPointData = entity.getCollEndPointData(); | ||
| 169 | + if (collEndPointData != null) { | ||
| 170 | + stmt.bindString(23, collEndPointData); | ||
| 160 | } | 171 | } |
| 161 | 172 | ||
| 162 | - String collStartLatLng = entity.getCollStartLatLng(); | ||
| 163 | - if (collStartLatLng != null) { | ||
| 164 | - stmt.bindString(23, collStartLatLng); | 173 | + String employTime = entity.getEmployTime(); |
| 174 | + if (employTime != null) { | ||
| 175 | + stmt.bindString(24, employTime); | ||
| 165 | } | 176 | } |
| 166 | } | 177 | } |
| 167 | 178 | ||
| @@ -208,7 +219,11 @@ public class CollUserStepEntityDao extends AbstractDao<CollUserStepEntity, Strin | @@ -208,7 +219,11 @@ public class CollUserStepEntityDao extends AbstractDao<CollUserStepEntity, Strin | ||
| 208 | stmt.bindString(15, queryEntityName); | 219 | stmt.bindString(15, queryEntityName); |
| 209 | } | 220 | } |
| 210 | stmt.bindLong(16, entity.getContinueTime()); | 221 | stmt.bindLong(16, entity.getContinueTime()); |
| 211 | - stmt.bindLong(17, entity.getFenceId()); | 222 | + |
| 223 | + String fenceId = entity.getFenceId(); | ||
| 224 | + if (fenceId != null) { | ||
| 225 | + stmt.bindString(17, fenceId); | ||
| 226 | + } | ||
| 212 | 227 | ||
| 213 | String importPoint = entity.getImportPoint(); | 228 | String importPoint = entity.getImportPoint(); |
| 214 | if (importPoint != null) { | 229 | if (importPoint != null) { |
| @@ -226,14 +241,19 @@ public class CollUserStepEntityDao extends AbstractDao<CollUserStepEntity, Strin | @@ -226,14 +241,19 @@ public class CollUserStepEntityDao extends AbstractDao<CollUserStepEntity, Strin | ||
| 226 | } | 241 | } |
| 227 | stmt.bindLong(21, entity.getIsArriveEndPoint() ? 1L: 0L); | 242 | stmt.bindLong(21, entity.getIsArriveEndPoint() ? 1L: 0L); |
| 228 | 243 | ||
| 229 | - String collStartLatLngName = entity.getCollStartLatLngName(); | ||
| 230 | - if (collStartLatLngName != null) { | ||
| 231 | - stmt.bindString(22, collStartLatLngName); | 244 | + String collStartPointData = entity.getCollStartPointData(); |
| 245 | + if (collStartPointData != null) { | ||
| 246 | + stmt.bindString(22, collStartPointData); | ||
| 247 | + } | ||
| 248 | + | ||
| 249 | + String collEndPointData = entity.getCollEndPointData(); | ||
| 250 | + if (collEndPointData != null) { | ||
| 251 | + stmt.bindString(23, collEndPointData); | ||
| 232 | } | 252 | } |
| 233 | 253 | ||
| 234 | - String collStartLatLng = entity.getCollStartLatLng(); | ||
| 235 | - if (collStartLatLng != null) { | ||
| 236 | - stmt.bindString(23, collStartLatLng); | 254 | + String employTime = entity.getEmployTime(); |
| 255 | + if (employTime != null) { | ||
| 256 | + stmt.bindString(24, employTime); | ||
| 237 | } | 257 | } |
| 238 | } | 258 | } |
| 239 | 259 | ||
| @@ -261,13 +281,14 @@ public class CollUserStepEntityDao extends AbstractDao<CollUserStepEntity, Strin | @@ -261,13 +281,14 @@ public class CollUserStepEntityDao extends AbstractDao<CollUserStepEntity, Strin | ||
| 261 | cursor.getLong(offset + 13), // queryTraceEndTime | 281 | cursor.getLong(offset + 13), // queryTraceEndTime |
| 262 | cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // queryEntityName | 282 | cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // queryEntityName |
| 263 | cursor.getLong(offset + 15), // continueTime | 283 | cursor.getLong(offset + 15), // continueTime |
| 264 | - cursor.getLong(offset + 16), // fenceId | 284 | + cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // fenceId |
| 265 | cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // importPoint | 285 | cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // importPoint |
| 266 | cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // streetTitle | 286 | cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // streetTitle |
| 267 | cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // endLatLng | 287 | cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // endLatLng |
| 268 | cursor.getShort(offset + 20) != 0, // isArriveEndPoint | 288 | cursor.getShort(offset + 20) != 0, // isArriveEndPoint |
| 269 | - cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // collStartLatLngName | ||
| 270 | - cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22) // collStartLatLng | 289 | + cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // collStartPointData |
| 290 | + cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // collEndPointData | ||
| 291 | + cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23) // employTime | ||
| 271 | ); | 292 | ); |
| 272 | return entity; | 293 | return entity; |
| 273 | } | 294 | } |
| @@ -290,13 +311,14 @@ public class CollUserStepEntityDao extends AbstractDao<CollUserStepEntity, Strin | @@ -290,13 +311,14 @@ public class CollUserStepEntityDao extends AbstractDao<CollUserStepEntity, Strin | ||
| 290 | entity.setQueryTraceEndTime(cursor.getLong(offset + 13)); | 311 | entity.setQueryTraceEndTime(cursor.getLong(offset + 13)); |
| 291 | entity.setQueryEntityName(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); | 312 | entity.setQueryEntityName(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14)); |
| 292 | entity.setContinueTime(cursor.getLong(offset + 15)); | 313 | entity.setContinueTime(cursor.getLong(offset + 15)); |
| 293 | - entity.setFenceId(cursor.getLong(offset + 16)); | 314 | + entity.setFenceId(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16)); |
| 294 | entity.setImportPoint(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); | 315 | entity.setImportPoint(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17)); |
| 295 | entity.setStreetTitle(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); | 316 | entity.setStreetTitle(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18)); |
| 296 | entity.setEndLatLng(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); | 317 | entity.setEndLatLng(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19)); |
| 297 | entity.setIsArriveEndPoint(cursor.getShort(offset + 20) != 0); | 318 | entity.setIsArriveEndPoint(cursor.getShort(offset + 20) != 0); |
| 298 | - entity.setCollStartLatLngName(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21)); | ||
| 299 | - entity.setCollStartLatLng(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22)); | 319 | + entity.setCollStartPointData(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21)); |
| 320 | + entity.setCollEndPointData(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22)); | ||
| 321 | + entity.setEmployTime(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23)); | ||
| 300 | } | 322 | } |
| 301 | 323 | ||
| 302 | @Override | 324 | @Override |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/sql/entity/CollUserStepEntity.java
| @@ -23,20 +23,20 @@ public class CollUserStepEntity { | @@ -23,20 +23,20 @@ public class CollUserStepEntity { | ||
| 23 | private long queryTraceEndTime;//从服务器获取的结束时间呢 | 23 | private long queryTraceEndTime;//从服务器获取的结束时间呢 |
| 24 | private String queryEntityName;//从服务器获取的运营人员的实体名称 | 24 | private String queryEntityName;//从服务器获取的运营人员的实体名称 |
| 25 | private long continueTime;//继续运动时间 | 25 | private long continueTime;//继续运动时间 |
| 26 | - private long fenceId;//围栏id | 26 | + private String fenceId;//围栏id |
| 27 | private String importPoint;//关键点 | 27 | private String importPoint;//关键点 |
| 28 | private String streetTitle;//赛事标题 | 28 | private String streetTitle;//赛事标题 |
| 29 | private String endLatLng;//终点坐标 | 29 | private String endLatLng;//终点坐标 |
| 30 | private boolean isArriveEndPoint;//是否到达终点 | 30 | private boolean isArriveEndPoint;//是否到达终点 |
| 31 | - private String collStartLatLngName;//运营打点名称 | ||
| 32 | - private String collStartLatLng;//运营打点名称 | ||
| 33 | - | ||
| 34 | - @Generated(hash = 1127995406) | ||
| 35 | - public CollUserStepEntity(String userId, String date, String stepCount, long recordTime, double caloriesCount, | ||
| 36 | - String serverTraceData, long startTimeStamp, long finishTimeStamp, String streetId, int pauseCount, | ||
| 37 | - long userPauseTimeStamp, long chronometerBase, long queryTraceStartTime, long queryTraceEndTime, | ||
| 38 | - String queryEntityName, long continueTime, long fenceId, String importPoint, String streetTitle, | ||
| 39 | - String endLatLng, boolean isArriveEndPoint, String collStartLatLngName, String collStartLatLng) { | 31 | + private String collStartPointData;//运营打点名称和经纬度 |
| 32 | + private String collEndPointData;//运营结束打点名称和经纬度 | ||
| 33 | + private String employTime;//用时时间戳 | ||
| 34 | + | ||
| 35 | + @Generated(hash = 297618082) | ||
| 36 | + public CollUserStepEntity(String userId, String date, String stepCount, long recordTime, double caloriesCount, String serverTraceData, long startTimeStamp, | ||
| 37 | + long finishTimeStamp, String streetId, int pauseCount, long userPauseTimeStamp, long chronometerBase, long queryTraceStartTime, long queryTraceEndTime, | ||
| 38 | + String queryEntityName, long continueTime, String fenceId, String importPoint, String streetTitle, String endLatLng, boolean isArriveEndPoint, | ||
| 39 | + String collStartPointData, String collEndPointData, String employTime) { | ||
| 40 | this.userId = userId; | 40 | this.userId = userId; |
| 41 | this.date = date; | 41 | this.date = date; |
| 42 | this.stepCount = stepCount; | 42 | this.stepCount = stepCount; |
| @@ -58,8 +58,9 @@ public class CollUserStepEntity { | @@ -58,8 +58,9 @@ public class CollUserStepEntity { | ||
| 58 | this.streetTitle = streetTitle; | 58 | this.streetTitle = streetTitle; |
| 59 | this.endLatLng = endLatLng; | 59 | this.endLatLng = endLatLng; |
| 60 | this.isArriveEndPoint = isArriveEndPoint; | 60 | this.isArriveEndPoint = isArriveEndPoint; |
| 61 | - this.collStartLatLngName = collStartLatLngName; | ||
| 62 | - this.collStartLatLng = collStartLatLng; | 61 | + this.collStartPointData = collStartPointData; |
| 62 | + this.collEndPointData = collEndPointData; | ||
| 63 | + this.employTime = employTime; | ||
| 63 | } | 64 | } |
| 64 | 65 | ||
| 65 | @Generated(hash = 681143087) | 66 | @Generated(hash = 681143087) |
| @@ -195,13 +196,6 @@ public class CollUserStepEntity { | @@ -195,13 +196,6 @@ public class CollUserStepEntity { | ||
| 195 | this.continueTime = continueTime; | 196 | this.continueTime = continueTime; |
| 196 | } | 197 | } |
| 197 | 198 | ||
| 198 | - public long getFenceId() { | ||
| 199 | - return this.fenceId; | ||
| 200 | - } | ||
| 201 | - | ||
| 202 | - public void setFenceId(long fenceId) { | ||
| 203 | - this.fenceId = fenceId; | ||
| 204 | - } | ||
| 205 | 199 | ||
| 206 | public String getImportPoint() { | 200 | public String getImportPoint() { |
| 207 | return this.importPoint; | 201 | return this.importPoint; |
| @@ -235,24 +229,38 @@ public class CollUserStepEntity { | @@ -235,24 +229,38 @@ public class CollUserStepEntity { | ||
| 235 | this.isArriveEndPoint = isArriveEndPoint; | 229 | this.isArriveEndPoint = isArriveEndPoint; |
| 236 | } | 230 | } |
| 237 | 231 | ||
| 238 | - public String getCollStartLatLngName() { | ||
| 239 | - return this.collStartLatLngName; | 232 | + |
| 233 | + public String getCollStartPointData() { | ||
| 234 | + return this.collStartPointData; | ||
| 240 | } | 235 | } |
| 241 | 236 | ||
| 242 | - public void setCollStartLatLngName(String collStartLatLngName) { | ||
| 243 | - this.collStartLatLngName = collStartLatLngName; | 237 | + public void setCollStartPointData(String collStartPointData) { |
| 238 | + this.collStartPointData = collStartPointData; | ||
| 244 | } | 239 | } |
| 245 | 240 | ||
| 246 | - public String getCollStartLatLng() { | ||
| 247 | - return this.collStartLatLng; | 241 | + public String getCollEndPointData() { |
| 242 | + return this.collEndPointData; | ||
| 248 | } | 243 | } |
| 249 | 244 | ||
| 250 | - public void setCollStartLatLng(String collStartLatLng) { | ||
| 251 | - this.collStartLatLng = collStartLatLng; | 245 | + public void setCollEndPointData(String collEndPointData) { |
| 246 | + this.collEndPointData = collEndPointData; | ||
| 252 | } | 247 | } |
| 253 | 248 | ||
| 249 | + public String getEmployTime() { | ||
| 250 | + return this.employTime; | ||
| 251 | + } | ||
| 254 | 252 | ||
| 253 | + public void setEmployTime(String employTime) { | ||
| 254 | + this.employTime = employTime; | ||
| 255 | + } | ||
| 256 | + | ||
| 257 | + public String getFenceId() { | ||
| 258 | + return this.fenceId; | ||
| 259 | + } | ||
| 255 | 260 | ||
| 261 | + public void setFenceId(String fenceId) { | ||
| 262 | + this.fenceId = fenceId; | ||
| 263 | + } | ||
| 256 | 264 | ||
| 257 | 265 | ||
| 258 | } | 266 | } |
moudle_pedometer/src/main/java/com/cnlive/moudle/pedometer/utils/MyMapUtil.java
| @@ -32,6 +32,7 @@ import com.baidu.trace.model.ProcessOption; | @@ -32,6 +32,7 @@ import com.baidu.trace.model.ProcessOption; | ||
| 32 | import com.baidu.trace.model.SortType; | 32 | import com.baidu.trace.model.SortType; |
| 33 | import com.baidu.trace.model.StatusCodes; | 33 | import com.baidu.trace.model.StatusCodes; |
| 34 | import com.baidu.trace.model.TransportMode; | 34 | import com.baidu.trace.model.TransportMode; |
| 35 | +import com.cnlive.moudle.collectionTrace.model.CollectPoint; | ||
| 35 | import com.cnlive.moudle.pedometer.model.Constant; | 36 | import com.cnlive.moudle.pedometer.model.Constant; |
| 36 | import com.cnlive.moudle.pedometer.model.RoutePoint; | 37 | import com.cnlive.moudle.pedometer.model.RoutePoint; |
| 37 | import com.cnlive.moudle.pedometer.service.StepService; | 38 | import com.cnlive.moudle.pedometer.service.StepService; |
| @@ -52,6 +53,51 @@ public class MyMapUtil { | @@ -52,6 +53,51 @@ public class MyMapUtil { | ||
| 52 | private static int pageIndex = 1; | 53 | private static int pageIndex = 1; |
| 53 | private static List<LatLng> trackPoints; | 54 | private static List<LatLng> trackPoints; |
| 54 | 55 | ||
| 56 | + | ||
| 57 | + /** | ||
| 58 | + * 在地图上进行打点 | ||
| 59 | + * | ||
| 60 | + * @param context | ||
| 61 | + * @param baiduMap | ||
| 62 | + * @param startLatLng | ||
| 63 | + * @param startIconRes | ||
| 64 | + * @return | ||
| 65 | + */ | ||
| 66 | + public static Overlay setMapMarker(Context context, BaiduMap baiduMap, LatLng startLatLng, int startIconRes) { | ||
| 67 | + if (0 == startIconRes || null == startLatLng || null == context || null == baiduMap) { | ||
| 68 | + return null; | ||
| 69 | + } | ||
| 70 | + try { | ||
| 71 | + Bitmap pointBitmap = BitmapUtil.getBitmapFromDp(context, BitmapFactory.decodeResource(context.getResources(), startIconRes), 17, 30); | ||
| 72 | + OverlayOptions startOptions = null; | ||
| 73 | + if (pointBitmap != null) { | ||
| 74 | + startOptions = new MarkerOptions() | ||
| 75 | + .position(startLatLng) | ||
| 76 | + .icon(BitmapDescriptorFactory.fromBitmap(pointBitmap)) | ||
| 77 | + .animateType(MarkerOptions.MarkerAnimateType.grow); | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + if (startOptions != null) { | ||
| 81 | + return baiduMap.addOverlay(startOptions); | ||
| 82 | + | ||
| 83 | + } else { | ||
| 84 | + return null; | ||
| 85 | + } | ||
| 86 | + } catch ( | ||
| 87 | + Exception e) { | ||
| 88 | + return null; | ||
| 89 | + } | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + /** | ||
| 93 | + * 打上运营选择的开始点 | ||
| 94 | + * | ||
| 95 | + * @param context | ||
| 96 | + * @param baiduMap | ||
| 97 | + * @param startLatLng | ||
| 98 | + * @param startIconRes | ||
| 99 | + * @return | ||
| 100 | + */ | ||
| 55 | public static List<Overlay> setStartMarker(Context context, BaiduMap baiduMap, LatLng startLatLng, int startIconRes) { | 101 | public static List<Overlay> setStartMarker(Context context, BaiduMap baiduMap, LatLng startLatLng, int startIconRes) { |
| 56 | if (0 == startIconRes || null == startLatLng || null == context || null == baiduMap) { | 102 | if (0 == startIconRes || null == startLatLng || null == context || null == baiduMap) { |
| 57 | return null; | 103 | return null; |
| @@ -61,7 +107,10 @@ public class MyMapUtil { | @@ -61,7 +107,10 @@ public class MyMapUtil { | ||
| 61 | Bitmap pointBitmap = BitmapUtil.getBitmapFromDp(context, BitmapFactory.decodeResource(context.getResources(), startIconRes), 24, 30); | 107 | Bitmap pointBitmap = BitmapUtil.getBitmapFromDp(context, BitmapFactory.decodeResource(context.getResources(), startIconRes), 24, 30); |
| 62 | OverlayOptions startOptions = null; | 108 | OverlayOptions startOptions = null; |
| 63 | if (pointBitmap != null) { | 109 | if (pointBitmap != null) { |
| 64 | - startOptions = new MarkerOptions().position(startLatLng).icon(BitmapDescriptorFactory.fromBitmap(pointBitmap)); | 110 | + startOptions = new MarkerOptions() |
| 111 | + .position(startLatLng) | ||
| 112 | + .icon(BitmapDescriptorFactory.fromBitmap(pointBitmap)) | ||
| 113 | + .animateType(MarkerOptions.MarkerAnimateType.grow); | ||
| 65 | } | 114 | } |
| 66 | 115 | ||
| 67 | // 添加圆形范围 | 116 | // 添加圆形范围 |
| @@ -118,6 +167,33 @@ public class MyMapUtil { | @@ -118,6 +167,33 @@ public class MyMapUtil { | ||
| 118 | } | 167 | } |
| 119 | 168 | ||
| 120 | /** | 169 | /** |
| 170 | + * 根据点位信息,自动缩放地图 | ||
| 171 | + * | ||
| 172 | + * @param baiduMap | ||
| 173 | + * @param trackPoints | ||
| 174 | + * @param zoomBy | ||
| 175 | + */ | ||
| 176 | + public static void setCollMapAutoZoom(BaiduMap baiduMap, List<CollectPoint> trackPoints, float zoomBy) { | ||
| 177 | + LatLngBounds.Builder builder = new LatLngBounds.Builder(); | ||
| 178 | + List<LatLng> latLngs = new ArrayList<>(); | ||
| 179 | + for (int i = 0; i < trackPoints.size(); i++) { | ||
| 180 | + latLngs.add(new LatLng(trackPoints.get(i).getLatitude(), trackPoints.get(i).getLongitude())); | ||
| 181 | + } | ||
| 182 | + for (LatLng latLng : latLngs) { | ||
| 183 | + builder.include(latLng); | ||
| 184 | + } | ||
| 185 | + MapStatusUpdate mapStatusUpdate = MapStatusUpdateFactory.newLatLngBounds(builder.build()); | ||
| 186 | + baiduMap.setMapStatus(mapStatusUpdate); | ||
| 187 | + MapStatusUpdate msu = MapStatusUpdateFactory.zoomBy(zoomBy); | ||
| 188 | + baiduMap.setMapStatus(msu); | ||
| 189 | + //自动计算地图缩放 | ||
| 190 | +// MapStatus.Builder builder = new MapStatus.Builder(); | ||
| 191 | +// builder.target(MyMapUtil.getCenterZoomPosition(trackPoints)); | ||
| 192 | +// builder.zoom(MyMapUtil.getZoom(trackPoints)); | ||
| 193 | +// baiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build())); | ||
| 194 | + } | ||
| 195 | + | ||
| 196 | + /** | ||
| 121 | * 判断用户是否完成比赛 | 197 | * 判断用户是否完成比赛 |
| 122 | * | 198 | * |
| 123 | * @param importPoints | 199 | * @param importPoints |
| @@ -216,19 +292,19 @@ public class MyMapUtil { | @@ -216,19 +292,19 @@ public class MyMapUtil { | ||
| 216 | int total = response.getTotal(); | 292 | int total = response.getTotal(); |
| 217 | Log.e(TAG, "onHistoryTrackCallback: " + response.getMessage()); | 293 | Log.e(TAG, "onHistoryTrackCallback: " + response.getMessage()); |
| 218 | if (StatusCodes.SUCCESS != response.getStatus()) { | 294 | if (StatusCodes.SUCCESS != response.getStatus()) { |
| 219 | -// if (response.getStatus() == 14004) { | ||
| 220 | - //给3次重新查询的机会 | ||
| 221 | - if (queryNum < 4) { | ||
| 222 | - //重新查询 | ||
| 223 | -// new Handler().postDelayed(new Runnable() { | ||
| 224 | -// @Override | ||
| 225 | -// public void run() { | 295 | + if (response.getStatus() == 14004) { |
| 296 | + //给3次重新查询的机会 | ||
| 297 | + if (queryNum < 4) { | ||
| 298 | + //重新查询 | ||
| 299 | + new Handler().postDelayed(new Runnable() { | ||
| 300 | + @Override | ||
| 301 | + public void run() { | ||
| 226 | // //间隔3秒查一次 | 302 | // //间隔3秒查一次 |
| 227 | - queryHistoryTrace(context, mClient, entityName, startTime, endTime, callBack); | ||
| 228 | - queryNum++; | ||
| 229 | -// } | ||
| 230 | -// }, 1000); | ||
| 231 | - | 303 | + queryHistoryTrace(context, mClient, entityName, startTime, endTime, callBack); |
| 304 | + queryNum++; | ||
| 305 | + } | ||
| 306 | + }, 1000); | ||
| 307 | + } | ||
| 232 | } else { | 308 | } else { |
| 233 | if (callBack != null) { | 309 | if (callBack != null) { |
| 234 | callBack.success(null); | 310 | callBack.success(null); |
| @@ -317,18 +393,21 @@ public class MyMapUtil { | @@ -317,18 +393,21 @@ public class MyMapUtil { | ||
| 317 | /** | 393 | /** |
| 318 | * 绘制历史轨迹 | 394 | * 绘制历史轨迹 |
| 319 | */ | 395 | */ |
| 320 | - public static Overlay drawHistoryTrack(Context context, BaiduMap baiduMap, List<LatLng> points, SortType sortType, int lineColor, int startIconRes, int endIconRes) { | 396 | + public static List<Overlay> drawHistoryTrack(Context context, BaiduMap baiduMap, List<LatLng> points, SortType sortType, int lineColor, int startIconRes, int endIconRes) { |
| 321 | // 绘制新覆盖物前,清空之前的覆盖物 | 397 | // 绘制新覆盖物前,清空之前的覆盖物 |
| 322 | if (points == null || points.size() == 0 || lineColor == 0) { | 398 | if (points == null || points.size() == 0 || lineColor == 0) { |
| 323 | return null; | 399 | return null; |
| 324 | } | 400 | } |
| 401 | + List<Overlay> overlayList = new ArrayList<>(); | ||
| 325 | //只有一个点 | 402 | //只有一个点 |
| 326 | if (points.size() == 1) { | 403 | if (points.size() == 1) { |
| 327 | if (startIconRes != 0) { | 404 | if (startIconRes != 0) { |
| 328 | Bitmap pointBitmap = BitmapUtil.getBitmapFromDp(context, BitmapFactory.decodeResource(context.getResources(), startIconRes), 24, 30); | 405 | Bitmap pointBitmap = BitmapUtil.getBitmapFromDp(context, BitmapFactory.decodeResource(context.getResources(), startIconRes), 24, 30); |
| 329 | OverlayOptions startOptions = new MarkerOptions().position(points.get(0)).icon(BitmapDescriptorFactory.fromBitmap(pointBitmap)); | 406 | OverlayOptions startOptions = new MarkerOptions().position(points.get(0)).icon(BitmapDescriptorFactory.fromBitmap(pointBitmap)); |
| 330 | -// .zIndex(9).draggable(true); | ||
| 331 | - return baiduMap.addOverlay(startOptions); | 407 | + if (null != startOptions) { |
| 408 | + overlayList.add(baiduMap.addOverlay(startOptions)); | ||
| 409 | + } | ||
| 410 | + return overlayList; | ||
| 332 | } else { | 411 | } else { |
| 333 | return null; | 412 | return null; |
| 334 | } | 413 | } |
| @@ -349,8 +428,10 @@ public class MyMapUtil { | @@ -349,8 +428,10 @@ public class MyMapUtil { | ||
| 349 | OverlayOptions startOptions = null; | 428 | OverlayOptions startOptions = null; |
| 350 | if (startIconRes != 0) { | 429 | if (startIconRes != 0) { |
| 351 | startPointBitmap = BitmapUtil.getBitmapFromDp(context, BitmapFactory.decodeResource(context.getResources(), startIconRes), 24, 30); | 430 | startPointBitmap = BitmapUtil.getBitmapFromDp(context, BitmapFactory.decodeResource(context.getResources(), startIconRes), 24, 30); |
| 352 | - startOptions = new MarkerOptions().perspective(false).animateType(MarkerOptions.MarkerAnimateType.grow) | ||
| 353 | - .position(startPoint).icon(BitmapDescriptorFactory.fromBitmap(startPointBitmap)); | 431 | + if (null != startPointBitmap && null != startPoint) { |
| 432 | + startOptions = new MarkerOptions().perspective(false).animateType(MarkerOptions.MarkerAnimateType.grow) | ||
| 433 | + .position(startPoint).icon(BitmapDescriptorFactory.fromBitmap(startPointBitmap)); | ||
| 434 | + } | ||
| 354 | } | 435 | } |
| 355 | // .zIndex(9).draggable(true); | 436 | // .zIndex(9).draggable(true); |
| 356 | // 添加终点图标 | 437 | // 添加终点图标 |
| @@ -358,21 +439,35 @@ public class MyMapUtil { | @@ -358,21 +439,35 @@ public class MyMapUtil { | ||
| 358 | OverlayOptions endOptions = null; | 439 | OverlayOptions endOptions = null; |
| 359 | if (endIconRes != 0) { | 440 | if (endIconRes != 0) { |
| 360 | endPointBitmap = BitmapUtil.getBitmapFromDp(context, BitmapFactory.decodeResource(context.getResources(), endIconRes), 24, 30); | 441 | endPointBitmap = BitmapUtil.getBitmapFromDp(context, BitmapFactory.decodeResource(context.getResources(), endIconRes), 24, 30); |
| 361 | - endOptions = new MarkerOptions().position(endPoint).perspective(false).animateType(MarkerOptions.MarkerAnimateType.grow) | ||
| 362 | - .icon(BitmapDescriptorFactory.fromBitmap(endPointBitmap)); | 442 | + if (null != endPointBitmap && null != endPoint) { |
| 443 | + endOptions = new MarkerOptions().position(endPoint).perspective(false).animateType(MarkerOptions.MarkerAnimateType.grow) | ||
| 444 | + .icon(BitmapDescriptorFactory.fromBitmap(endPointBitmap)); | ||
| 445 | + } | ||
| 363 | } | 446 | } |
| 364 | // .zIndex(9).draggable(true); | 447 | // .zIndex(9).draggable(true); |
| 365 | 448 | ||
| 366 | // 添加路线(轨迹) | 449 | // 添加路线(轨迹) |
| 367 | - OverlayOptions polylineOptions = new PolylineOptions().width(10) | ||
| 368 | - .color(context.getResources().getColor(lineColor)).points(points); | 450 | + OverlayOptions polylineOptions = null; |
| 451 | + if (null != points) { | ||
| 452 | + polylineOptions = new PolylineOptions().width(10) | ||
| 453 | + .color(context.getResources().getColor(lineColor)).points(points); | ||
| 454 | + } | ||
| 369 | if (startOptions != null) { | 455 | if (startOptions != null) { |
| 370 | - baiduMap.addOverlay(startOptions); | 456 | + overlayList.add(baiduMap.addOverlay(startOptions)); |
| 371 | } | 457 | } |
| 372 | if (endOptions != null) { | 458 | if (endOptions != null) { |
| 373 | - baiduMap.addOverlay(endOptions); | 459 | + overlayList.add(baiduMap.addOverlay(endOptions)); |
| 460 | + } | ||
| 461 | + if (null != polylineOptions) { | ||
| 462 | + overlayList.add(baiduMap.addOverlay(polylineOptions)); | ||
| 463 | + } | ||
| 464 | + if (null != overlayList) { | ||
| 465 | + return overlayList; | ||
| 466 | + } else if (overlayList.size() == 0) { | ||
| 467 | + return null; | ||
| 468 | + } else { | ||
| 469 | + return null; | ||
| 374 | } | 470 | } |
| 375 | - return baiduMap.addOverlay(polylineOptions); | ||
| 376 | } | 471 | } |
| 377 | 472 | ||
| 378 | /** | 473 | /** |
moudle_pedometer/src/main/res/drawable-hdpi/icon_map_import.png
0 → 100644
1.4 KB
moudle_pedometer/src/main/res/drawable-xhdpi/icon_map_import.png
0 → 100644
1.21 KB
moudle_pedometer/src/main/res/drawable-xxhdpi/icon_map_import.png
0 → 100644
3.51 KB
moudle_pedometer/src/main/res/layout/fragment_coll_finish_run_map.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<layout xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 3 | + xmlns:app="http://schemas.android.com/apk/res-auto"> | ||
| 4 | + | ||
| 5 | + <FrameLayout | ||
| 6 | + android:layout_width="match_parent" | ||
| 7 | + android:layout_height="match_parent"> | ||
| 8 | + | ||
| 9 | + <com.sothree.slidinguppanel.SlidingUpPanelLayout xmlns:sothree="http://schemas.android.com/apk/res-auto" | ||
| 10 | + android:id="@+id/sliding_layout" | ||
| 11 | + android:layout_width="match_parent" | ||
| 12 | + android:layout_height="match_parent" | ||
| 13 | + android:gravity="bottom" | ||
| 14 | + sothree:umanoDragView="@+id/dragView" | ||
| 15 | + sothree:umanoFadeColor="@color/black_20" | ||
| 16 | + sothree:umanoOverlay="true" | ||
| 17 | + sothree:umanoPanelHeight="250dp" | ||
| 18 | + sothree:umanoParallaxOffset="0dp" | ||
| 19 | + sothree:umanoScrollableView="@+id/rv_list" | ||
| 20 | + sothree:umanoShadowHeight="0dp"> | ||
| 21 | + | ||
| 22 | + <!-- MAIN CONTENT --> | ||
| 23 | + <FrameLayout | ||
| 24 | + android:layout_width="match_parent" | ||
| 25 | + android:layout_height="match_parent"> | ||
| 26 | + | ||
| 27 | + <com.baidu.mapapi.map.MapView | ||
| 28 | + android:id="@+id/mapView" | ||
| 29 | + android:layout_width="match_parent" | ||
| 30 | + android:layout_height="match_parent"></com.baidu.mapapi.map.MapView> | ||
| 31 | + <!--地图上面加一层类似于全透明黑色蒙版--> | ||
| 32 | + <LinearLayout | ||
| 33 | + android:layout_width="match_parent" | ||
| 34 | + android:layout_height="match_parent" | ||
| 35 | + android:background="#0D000000" | ||
| 36 | + android:clickable="false" | ||
| 37 | + android:focusable="false" | ||
| 38 | + android:focusableInTouchMode="false"></LinearLayout> | ||
| 39 | + | ||
| 40 | + <FrameLayout | ||
| 41 | + android:id="@+id/fl_back" | ||
| 42 | + android:layout_width="55dp" | ||
| 43 | + android:layout_height="55dp" | ||
| 44 | + android:background="@drawable/button_fab_white" | ||
| 45 | + android:focusable="true"> | ||
| 46 | + | ||
| 47 | + <ImageView | ||
| 48 | + android:layout_width="12dp" | ||
| 49 | + android:layout_height="20dp" | ||
| 50 | + android:layout_gravity="center" | ||
| 51 | + android:layout_marginLeft="-2dp" | ||
| 52 | + android:background="@drawable/icon_back" | ||
| 53 | + android:focusable="false" /> | ||
| 54 | + </FrameLayout> | ||
| 55 | + | ||
| 56 | + <FrameLayout | ||
| 57 | + android:layout_width="55dp" | ||
| 58 | + android:layout_height="55dp" | ||
| 59 | + android:layout_gravity="right" | ||
| 60 | + android:background="@drawable/button_fab_white" | ||
| 61 | + android:focusable="true" | ||
| 62 | + android:visibility="gone"> | ||
| 63 | + | ||
| 64 | + <ImageView | ||
| 65 | + android:layout_width="19dp" | ||
| 66 | + android:layout_height="18dp" | ||
| 67 | + android:layout_gravity="center" | ||
| 68 | + android:background="@drawable/icon_share" /> | ||
| 69 | + </FrameLayout> | ||
| 70 | + <!----> | ||
| 71 | + | ||
| 72 | + | ||
| 73 | + </FrameLayout> | ||
| 74 | + | ||
| 75 | + <!-- SLIDING LAYOUT --> | ||
| 76 | + <FrameLayout | ||
| 77 | + android:id="@+id/dragView" | ||
| 78 | + android:layout_width="match_parent" | ||
| 79 | + android:layout_height="wrap_content" | ||
| 80 | + android:clickable="true" | ||
| 81 | + android:focusable="false" | ||
| 82 | + android:orientation="vertical"> | ||
| 83 | + | ||
| 84 | + | ||
| 85 | + <LinearLayout | ||
| 86 | + android:id="@+id/ll_root" | ||
| 87 | + android:layout_width="match_parent" | ||
| 88 | + android:layout_height="wrap_content" | ||
| 89 | + android:layout_marginBottom="40dp" | ||
| 90 | + android:orientation="vertical"> | ||
| 91 | + | ||
| 92 | + | ||
| 93 | + <!--用户个人信息--> | ||
| 94 | + <include | ||
| 95 | + android:id="@+id/include_finish_user_info" | ||
| 96 | + layout="@layout/layout_coll_finish_user_info" /> | ||
| 97 | + </LinearLayout> | ||
| 98 | + | ||
| 99 | + | ||
| 100 | + </FrameLayout> | ||
| 101 | + </com.sothree.slidinguppanel.SlidingUpPanelLayout> | ||
| 102 | + <!--按钮--> | ||
| 103 | + <LinearLayout | ||
| 104 | + android:id="@+id/rl_scrollView_startBtn" | ||
| 105 | + android:layout_width="match_parent" | ||
| 106 | + android:layout_height="40sp" | ||
| 107 | + android:layout_gravity="bottom" | ||
| 108 | + android:focusable="true" | ||
| 109 | + android:clickable="true" | ||
| 110 | + android:focusableInTouchMode="true" | ||
| 111 | + android:background="@color/green_round" | ||
| 112 | + android:gravity="center" | ||
| 113 | + android:tag="0"> | ||
| 114 | + | ||
| 115 | + | ||
| 116 | + <TextView | ||
| 117 | + android:id="@+id/tv_run_now" | ||
| 118 | + android:layout_width="wrap_content" | ||
| 119 | + android:layout_height="wrap_content" | ||
| 120 | + android:layout_centerInParent="true" | ||
| 121 | + android:layout_marginLeft="5dp" | ||
| 122 | + android:clickable="false" | ||
| 123 | + android:focusable="false" | ||
| 124 | + android:focusableInTouchMode="false" | ||
| 125 | + android:tag="0" | ||
| 126 | + android:text="确定轨迹" | ||
| 127 | + android:textColor="@color/white" | ||
| 128 | + android:textSize="18sp" /> | ||
| 129 | + </LinearLayout> | ||
| 130 | + </FrameLayout> | ||
| 131 | +</layout> | ||
| 0 | \ No newline at end of file | 132 | \ No newline at end of file |
moudle_pedometer/src/main/res/layout/fragment_collect_running_map.xml
| @@ -50,9 +50,9 @@ | @@ -50,9 +50,9 @@ | ||
| 50 | android:layout_width="80dp" | 50 | android:layout_width="80dp" |
| 51 | android:layout_height="35dp" | 51 | android:layout_height="35dp" |
| 52 | android:layout_gravity="right" | 52 | android:layout_gravity="right" |
| 53 | - android:scaleType="fitXY" | ||
| 54 | android:background="@drawable/gps_white_shadow" | 53 | android:background="@drawable/gps_white_shadow" |
| 55 | - android:gravity="center"> | 54 | + android:gravity="center" |
| 55 | + android:scaleType="fitXY"> | ||
| 56 | 56 | ||
| 57 | <TextView | 57 | <TextView |
| 58 | android:layout_width="wrap_content" | 58 | android:layout_width="wrap_content" |
| @@ -121,6 +121,7 @@ | @@ -121,6 +121,7 @@ | ||
| 121 | android:layout_height="wrap_content" | 121 | android:layout_height="wrap_content" |
| 122 | android:layout_gravity="center" | 122 | android:layout_gravity="center" |
| 123 | android:layout_marginBottom="5dp" | 123 | android:layout_marginBottom="5dp" |
| 124 | + android:focusable="false" | ||
| 124 | android:text="打点" | 125 | android:text="打点" |
| 125 | android:textColor="@color/text_black" | 126 | android:textColor="@color/text_black" |
| 126 | android:textSize="15sp" /> | 127 | android:textSize="15sp" /> |
| @@ -148,90 +149,108 @@ | @@ -148,90 +149,108 @@ | ||
| 148 | 149 | ||
| 149 | <LinearLayout | 150 | <LinearLayout |
| 150 | android:layout_width="match_parent" | 151 | android:layout_width="match_parent" |
| 151 | - android:layout_height="130dp" | 152 | + android:layout_height="140dp" |
| 152 | android:layout_gravity="bottom" | 153 | android:layout_gravity="bottom" |
| 153 | android:layout_marginBottom="10dp" | 154 | android:layout_marginBottom="10dp" |
| 154 | android:background="@drawable/white_shadow_bg" | 155 | android:background="@drawable/white_shadow_bg" |
| 156 | + android:orientation="vertical" | ||
| 155 | android:scaleX="1.02"> | 157 | android:scaleX="1.02"> |
| 156 | 158 | ||
| 159 | + <TextView | ||
| 160 | + android:id="@+id/tv_can_take_point_size" | ||
| 161 | + android:layout_width="wrap_content" | ||
| 162 | + android:layout_height="wrap_content" | ||
| 163 | + android:layout_marginLeft="30dp" | ||
| 164 | + android:layout_marginTop="10dp" | ||
| 165 | + android:text="可打点数量" | ||
| 166 | + android:textColor="@color/text_black" | ||
| 167 | + android:textSize="12sp" | ||
| 168 | + android:textStyle="bold" /> | ||
| 169 | + | ||
| 157 | <LinearLayout | 170 | <LinearLayout |
| 158 | - android:layout_width="0dp" | ||
| 159 | - android:layout_height="match_parent" | ||
| 160 | - android:layout_weight="1.2" | ||
| 161 | - android:gravity="center" | ||
| 162 | - android:orientation="vertical" | ||
| 163 | - android:paddingLeft="5dp" | ||
| 164 | - android:paddingRight="5dp"> | 171 | + android:layout_width="match_parent" |
| 172 | + android:layout_height="match_parent"> | ||
| 165 | 173 | ||
| 166 | - <TextView | ||
| 167 | - android:id="@+id/tv_current_speed" | ||
| 168 | - android:layout_width="wrap_content" | ||
| 169 | - android:layout_height="wrap_content" | ||
| 170 | - android:text="--" | ||
| 171 | - android:textColor="@color/black" | ||
| 172 | - android:textSize="20sp" | ||
| 173 | - android:textStyle="bold" /> | 174 | + <LinearLayout |
| 175 | + android:layout_width="0dp" | ||
| 176 | + android:layout_height="match_parent" | ||
| 177 | + android:layout_weight="1.2" | ||
| 178 | + android:gravity="center" | ||
| 179 | + android:orientation="vertical" | ||
| 180 | + android:paddingLeft="5dp" | ||
| 181 | + android:paddingRight="5dp"> | ||
| 174 | 182 | ||
| 175 | - <TextView | ||
| 176 | - android:layout_width="wrap_content" | ||
| 177 | - android:layout_height="wrap_content" | ||
| 178 | - android:layout_marginTop="10dp" | ||
| 179 | - android:text="配速" | ||
| 180 | - android:textColor="@color/black" | ||
| 181 | - android:textSize="15sp" /> | ||
| 182 | - </LinearLayout> | 183 | + <TextView |
| 184 | + android:id="@+id/tv_current_speed" | ||
| 185 | + android:layout_width="wrap_content" | ||
| 186 | + android:layout_height="wrap_content" | ||
| 187 | + android:text="--" | ||
| 188 | + android:textColor="@color/black" | ||
| 189 | + android:textSize="20sp" | ||
| 190 | + android:textStyle="bold" /> | ||
| 183 | 191 | ||
| 184 | - <LinearLayout | ||
| 185 | - android:layout_width="0dp" | ||
| 186 | - android:layout_height="match_parent" | ||
| 187 | - android:layout_weight="1.2" | ||
| 188 | - android:gravity="center" | ||
| 189 | - android:orientation="vertical"> | 192 | + <TextView |
| 193 | + android:layout_width="wrap_content" | ||
| 194 | + android:layout_height="wrap_content" | ||
| 195 | + android:layout_marginTop="10dp" | ||
| 196 | + android:text="配速" | ||
| 197 | + android:textColor="@color/black" | ||
| 198 | + android:textSize="15sp" /> | ||
| 199 | + </LinearLayout> | ||
| 190 | 200 | ||
| 191 | - <Chronometer | ||
| 192 | - android:id="@+id/chronometer" | ||
| 193 | - android:layout_width="wrap_content" | ||
| 194 | - android:layout_height="wrap_content" | ||
| 195 | - android:format="00:00:00" | ||
| 196 | - android:textColor="@color/black" | ||
| 197 | - android:textSize="20sp" | ||
| 198 | - android:textStyle="bold" /> | 201 | + <LinearLayout |
| 202 | + android:layout_width="0dp" | ||
| 203 | + android:layout_height="match_parent" | ||
| 204 | + android:layout_weight="1.2" | ||
| 205 | + android:gravity="center" | ||
| 206 | + android:orientation="vertical"> | ||
| 199 | 207 | ||
| 200 | - <TextView | ||
| 201 | - android:layout_width="wrap_content" | ||
| 202 | - android:layout_height="wrap_content" | ||
| 203 | - android:layout_marginTop="10dp" | ||
| 204 | - android:text="用时" | ||
| 205 | - android:textColor="@color/black" | ||
| 206 | - android:textSize="15sp" /> | ||
| 207 | - </LinearLayout> | 208 | + <Chronometer |
| 209 | + android:id="@+id/chronometer" | ||
| 210 | + android:layout_width="wrap_content" | ||
| 211 | + android:layout_height="wrap_content" | ||
| 212 | + android:format="00:00:00" | ||
| 213 | + android:textColor="@color/black" | ||
| 214 | + android:textSize="20sp" | ||
| 215 | + android:textStyle="bold" /> | ||
| 208 | 216 | ||
| 217 | + <TextView | ||
| 218 | + android:layout_width="wrap_content" | ||
| 219 | + android:layout_height="wrap_content" | ||
| 220 | + android:layout_marginTop="10dp" | ||
| 221 | + android:text="用时" | ||
| 222 | + android:textColor="@color/black" | ||
| 223 | + android:textSize="15sp" /> | ||
| 224 | + </LinearLayout> | ||
| 209 | 225 | ||
| 210 | - <LinearLayout | ||
| 211 | - android:layout_width="0dp" | ||
| 212 | - android:layout_height="match_parent" | ||
| 213 | - android:layout_weight="1" | ||
| 214 | - android:gravity="center" | ||
| 215 | - android:orientation="vertical" | ||
| 216 | - android:paddingLeft="5dp" | ||
| 217 | - android:paddingRight="5dp"> | ||
| 218 | 226 | ||
| 219 | - <TextView | ||
| 220 | - android:id="@+id/tv_current_diatance" | ||
| 221 | - android:layout_width="wrap_content" | ||
| 222 | - android:layout_height="wrap_content" | ||
| 223 | - android:text="--" | ||
| 224 | - android:textColor="@color/black" | ||
| 225 | - android:textSize="20sp" | ||
| 226 | - android:textStyle="bold" /> | 227 | + <LinearLayout |
| 228 | + android:layout_width="0dp" | ||
| 229 | + android:layout_height="match_parent" | ||
| 230 | + android:layout_marginRight="10dp" | ||
| 231 | + android:layout_weight="1" | ||
| 232 | + android:gravity="center" | ||
| 233 | + android:orientation="vertical" | ||
| 234 | + android:paddingLeft="5dp" | ||
| 235 | + android:paddingRight="5dp"> | ||
| 227 | 236 | ||
| 228 | - <TextView | ||
| 229 | - android:layout_width="wrap_content" | ||
| 230 | - android:layout_height="wrap_content" | ||
| 231 | - android:layout_marginTop="10dp" | ||
| 232 | - android:text="距离(km)" | ||
| 233 | - android:textColor="@color/black" | ||
| 234 | - android:textSize="15sp" /> | 237 | + <TextView |
| 238 | + android:id="@+id/tv_current_diatance" | ||
| 239 | + android:layout_width="wrap_content" | ||
| 240 | + android:layout_height="wrap_content" | ||
| 241 | + android:text="--" | ||
| 242 | + android:textColor="@color/black" | ||
| 243 | + android:textSize="20sp" | ||
| 244 | + android:textStyle="bold" /> | ||
| 245 | + | ||
| 246 | + <TextView | ||
| 247 | + android:layout_width="wrap_content" | ||
| 248 | + android:layout_height="wrap_content" | ||
| 249 | + android:layout_marginTop="10dp" | ||
| 250 | + android:text="距离(km)" | ||
| 251 | + android:textColor="@color/black" | ||
| 252 | + android:textSize="15sp" /> | ||
| 253 | + </LinearLayout> | ||
| 235 | </LinearLayout> | 254 | </LinearLayout> |
| 236 | 255 | ||
| 237 | </LinearLayout> | 256 | </LinearLayout> |
moudle_pedometer/src/main/res/layout/item_coll_take_point.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="match_parent" | ||
| 4 | + android:layout_height="wrap_content" | ||
| 5 | + android:orientation="vertical"> | ||
| 6 | + | ||
| 7 | + <LinearLayout | ||
| 8 | + android:layout_width="match_parent" | ||
| 9 | + android:layout_height="wrap_content" | ||
| 10 | + android:gravity="center_vertical"> | ||
| 11 | + | ||
| 12 | + <View | ||
| 13 | + android:id="@+id/view_circle" | ||
| 14 | + android:layout_width="6dp" | ||
| 15 | + android:layout_height="6dp" | ||
| 16 | + android:layout_marginLeft="15dp" | ||
| 17 | + android:background="@drawable/shape_circle_gray" /> | ||
| 18 | + | ||
| 19 | + <TextView | ||
| 20 | + android:id="@+id/tv_point_type_tip" | ||
| 21 | + android:layout_width="wrap_content" | ||
| 22 | + android:layout_height="wrap_content" | ||
| 23 | + android:layout_marginLeft="10dp" | ||
| 24 | + android:text="@string/layout_coll_take_point_text" | ||
| 25 | + android:textColor="@color/text_gray" | ||
| 26 | + android:textSize="12sp" /> | ||
| 27 | + | ||
| 28 | + <TextView | ||
| 29 | + android:id="@+id/tv_take_point" | ||
| 30 | + android:layout_width="wrap_content" | ||
| 31 | + android:layout_height="wrap_content" | ||
| 32 | + android:layout_marginLeft="10dp" | ||
| 33 | + android:text="--" | ||
| 34 | + android:textColor="@color/black" | ||
| 35 | + android:textSize="12sp" /> | ||
| 36 | + </LinearLayout> | ||
| 37 | + <!--竖线--> | ||
| 38 | + <View | ||
| 39 | + android:id="@+id/view_line" | ||
| 40 | + android:layout_width="1dp" | ||
| 41 | + android:layout_height="18dp" | ||
| 42 | + android:layout_marginLeft="17dp" | ||
| 43 | + android:layout_marginTop="-3dp" | ||
| 44 | + android:background="@color/vertical_line" /> | ||
| 45 | +</LinearLayout> | ||
| 0 | \ No newline at end of file | 46 | \ No newline at end of file |
moudle_pedometer/src/main/res/layout/layout_coll_finish_user_info.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<layout xmlns:android="http://schemas.android.com/apk/res/android"> | ||
| 3 | + | ||
| 4 | + <FrameLayout xmlns:app="http://schemas.android.com/apk/res-auto" | ||
| 5 | + android:layout_width="match_parent" | ||
| 6 | + android:layout_height="match_parent"> | ||
| 7 | + | ||
| 8 | + <LinearLayout | ||
| 9 | + android:layout_width="match_parent" | ||
| 10 | + android:layout_height="match_parent" | ||
| 11 | + android:layout_marginTop="30dp" | ||
| 12 | + android:background="@color/white" | ||
| 13 | + android:orientation="vertical"> | ||
| 14 | + | ||
| 15 | + <TextView | ||
| 16 | + android:id="@+id/tv_user_nickName" | ||
| 17 | + android:layout_width="wrap_content" | ||
| 18 | + android:layout_height="wrap_content" | ||
| 19 | + android:layout_marginLeft="80dp" | ||
| 20 | + android:layout_marginTop="10dp" | ||
| 21 | + android:text="--" | ||
| 22 | + android:textColor="@color/text_black" | ||
| 23 | + android:textSize="13sp" /> | ||
| 24 | + <!----> | ||
| 25 | + <LinearLayout | ||
| 26 | + android:layout_width="match_parent" | ||
| 27 | + android:layout_height="wrap_content" | ||
| 28 | + android:gravity="center_vertical"> | ||
| 29 | + | ||
| 30 | + <LinearLayout | ||
| 31 | + android:layout_width="0dp" | ||
| 32 | + android:layout_height="wrap_content" | ||
| 33 | + android:layout_weight="1" | ||
| 34 | + android:orientation="vertical"> | ||
| 35 | + | ||
| 36 | + <TextView | ||
| 37 | + android:id="@+id/tv_street_name" | ||
| 38 | + android:layout_width="wrap_content" | ||
| 39 | + android:layout_height="wrap_content" | ||
| 40 | + android:layout_marginLeft="15dp" | ||
| 41 | + android:layout_marginTop="15dp" | ||
| 42 | + android:text="--" | ||
| 43 | + android:textColor="@color/text_black" | ||
| 44 | + android:textSize="15sp" /> | ||
| 45 | + | ||
| 46 | + <TextView | ||
| 47 | + android:id="@+id/tv_date" | ||
| 48 | + android:layout_width="wrap_content" | ||
| 49 | + android:layout_height="wrap_content" | ||
| 50 | + android:layout_marginLeft="15dp" | ||
| 51 | + android:layout_marginTop="5dp" | ||
| 52 | + android:text="--" | ||
| 53 | + android:textColor="@color/text_gray" | ||
| 54 | + android:textSize="10sp" /> | ||
| 55 | + </LinearLayout> | ||
| 56 | + <!----> | ||
| 57 | + <LinearLayout | ||
| 58 | + android:layout_width="0dp" | ||
| 59 | + android:layout_height="wrap_content" | ||
| 60 | + android:layout_weight="1" | ||
| 61 | + android:gravity="right|bottom"> | ||
| 62 | + | ||
| 63 | + <TextView | ||
| 64 | + android:id="@+id/tv_distance" | ||
| 65 | + android:layout_width="wrap_content" | ||
| 66 | + android:layout_height="wrap_content" | ||
| 67 | + android:layout_marginRight="10dp" | ||
| 68 | + android:text="--" | ||
| 69 | + android:textColor="@color/text_black" | ||
| 70 | + android:textSize="45sp" | ||
| 71 | + android:textStyle="bold" /> | ||
| 72 | + | ||
| 73 | + <TextView | ||
| 74 | + android:layout_width="wrap_content" | ||
| 75 | + android:layout_height="wrap_content" | ||
| 76 | + android:layout_marginRight="15dp" | ||
| 77 | + android:text="公里" | ||
| 78 | + android:textColor="@color/text_black" | ||
| 79 | + android:textSize="15sp" /> | ||
| 80 | + </LinearLayout> | ||
| 81 | + <!----> | ||
| 82 | + </LinearLayout> | ||
| 83 | + <!--横线--> | ||
| 84 | + <View | ||
| 85 | + android:layout_width="match_parent" | ||
| 86 | + android:layout_height="1dp" | ||
| 87 | + android:layout_marginLeft="10dp" | ||
| 88 | + android:layout_marginTop="10dp" | ||
| 89 | + android:layout_marginRight="10dp" | ||
| 90 | + android:background="@color/line" /> | ||
| 91 | + <!--起点--> | ||
| 92 | + <!--打点--> | ||
| 93 | + <LinearLayout | ||
| 94 | + android:layout_width="match_parent" | ||
| 95 | + android:layout_height="wrap_content" | ||
| 96 | + android:layout_marginTop="-3dp" | ||
| 97 | + android:gravity="center_vertical"> | ||
| 98 | + | ||
| 99 | + <android.support.v7.widget.RecyclerView | ||
| 100 | + android:id="@+id/rv_list" | ||
| 101 | + android:layout_width="match_parent" | ||
| 102 | + android:layout_height="wrap_content" | ||
| 103 | + android:paddingTop="10dp" | ||
| 104 | + android:paddingBottom="10dp"></android.support.v7.widget.RecyclerView> | ||
| 105 | + </LinearLayout> | ||
| 106 | + <!----> | ||
| 107 | + </LinearLayout> | ||
| 108 | + | ||
| 109 | + <com.qmuiteam.qmui.widget.QMUIRadiusImageView | ||
| 110 | + android:id="@+id/qm_iv_icon" | ||
| 111 | + android:layout_width="60dp" | ||
| 112 | + android:layout_height="60dp" | ||
| 113 | + android:layout_marginLeft="10dp" | ||
| 114 | + android:background="@drawable/tc_ic_workout_level_adjust_coach" | ||
| 115 | + app:qmui_corner_radius="100dp" /> | ||
| 116 | + </FrameLayout> | ||
| 117 | +</layout> | ||
| 0 | \ No newline at end of file | 118 | \ No newline at end of file |
moudle_pedometer/src/main/res/values/ids.xml
| @@ -14,5 +14,5 @@ | @@ -14,5 +14,5 @@ | ||
| 14 | <item name="fragment_all_score_detail" type="id" /> | 14 | <item name="fragment_all_score_detail" type="id" /> |
| 15 | <!--进行中的活动--> | 15 | <!--进行中的活动--> |
| 16 | <item name="fragment_ongoing" type="id" /> | 16 | <item name="fragment_ongoing" type="id" /> |
| 17 | - | 17 | + <item name="fragment_coll_trace_list_detail" type="id" /> |
| 18 | </resources> | 18 | </resources> |
moudle_pedometer/src/main/res/values/strings.xml
| @@ -90,6 +90,7 @@ | @@ -90,6 +90,7 @@ | ||
| 90 | <string name="no_fail_line_text_tip">没有上传失败的路线哦</string> | 90 | <string name="no_fail_line_text_tip">没有上传失败的路线哦</string> |
| 91 | <string name="run_race_far_tip">您距离起点较远\n请到达起点附近再开始</string> | 91 | <string name="run_race_far_tip">您距离起点较远\n请到达起点附近再开始</string> |
| 92 | <string name="run_race_arrive_end_tip">您已到达终点附近\n可以结束运动了</string> | 92 | <string name="run_race_arrive_end_tip">您已到达终点附近\n可以结束运动了</string> |
| 93 | + <string name="layout_coll_take_point_text">(打点)</string> | ||
| 93 | 94 | ||
| 94 | 95 | ||
| 95 | </resources> | 96 | </resources> |