1.依据信号强弱,判定是否允许作业;2删除照片、数据逻辑修改,包括——已提交成功,删照片,不删数据 作业界面中途退出采集,删照片,不删数据,待提交页面,提交过程中,点击删除,不允许删除;3.删除所选照片,删除不全问题4.待提交页面,删除任务,解锁重领后,旧数据未释放问题; 5.提交后桩站不匹配问题
This commit is contained in:
@@ -119,9 +119,6 @@
|
||||
<activity
|
||||
android:name=".activity.GuidanceActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".activity.TestActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<provider
|
||||
android:name="androidx.core.content.FileProvider"
|
||||
|
||||
@@ -37,6 +37,8 @@ import java.util.Date;
|
||||
public class GuidanceActivity extends BaseActivity {
|
||||
private FrameLayout frameLayout;
|
||||
private View loginTaskItem, taskItem, refreshItem, screenItem, locationItem, gatherItem, submitItem, submittedItem, discoverItem, myHeadItem, dataItem, withdrawItem;
|
||||
private File logFile;
|
||||
private StringBuilder guidanceBuilder;
|
||||
private Handler handler = new Handler(new Handler.Callback() {
|
||||
@Override
|
||||
public boolean handleMessage(@NonNull Message msg) {
|
||||
@@ -92,8 +94,6 @@ public class GuidanceActivity extends BaseActivity {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
private File logFile;
|
||||
private StringBuilder guidanceBuilder;
|
||||
|
||||
@Override
|
||||
protected int getLayout() {
|
||||
@@ -104,7 +104,6 @@ public class GuidanceActivity extends BaseActivity {
|
||||
protected void initView() {
|
||||
super.initView();
|
||||
frameLayout = findViewById(R.id.layout_frame);
|
||||
|
||||
SharedPreferences sharedPreferences = this.getSharedPreferences(Constant.MESSAGE_TYPE, Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor sharedEdit = sharedPreferences.edit();
|
||||
@SuppressLint("SimpleDateFormat")
|
||||
@@ -277,7 +276,6 @@ public class GuidanceActivity extends BaseActivity {
|
||||
handler.sendMessageDelayed(message, 500);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void initGuide() {
|
||||
@@ -338,4 +336,5 @@ public class GuidanceActivity extends BaseActivity {
|
||||
guidanceBuilder.append("\r\n");
|
||||
FileUtils.writeFile(logFile.getAbsolutePath(), guidanceBuilder.toString(), true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -144,13 +144,11 @@ public class HomeActivity extends BaseActivity {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//点击table layout效果
|
||||
@Override
|
||||
public void onTabUnselected(TabLayout.Tab tab) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabReselected(TabLayout.Tab tab) {
|
||||
|
||||
@@ -216,7 +214,6 @@ public class HomeActivity extends BaseActivity {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if (!BackHandlerHelper.handleBackPress(this)) {
|
||||
@@ -237,5 +234,4 @@ public class HomeActivity extends BaseActivity {
|
||||
super.onDestroy();
|
||||
PoiDatabase.destroy();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import android.content.res.Configuration;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.text.format.Formatter;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
@@ -21,6 +22,7 @@ import androidx.annotation.Nullable;
|
||||
|
||||
import com.github.lazylibrary.util.FileUtils;
|
||||
import com.lzy.okgo.model.HttpParams;
|
||||
import com.lzy.okgo.model.Progress;
|
||||
import com.navinfo.outdoor.R;
|
||||
import com.navinfo.outdoor.api.Constant;
|
||||
import com.navinfo.outdoor.base.BaseActivity;
|
||||
@@ -29,10 +31,9 @@ import com.navinfo.outdoor.bean.UserDetailBean;
|
||||
import com.navinfo.outdoor.http.Callback;
|
||||
import com.navinfo.outdoor.http.HttpInterface;
|
||||
import com.navinfo.outdoor.http.OkGoBuilder;
|
||||
import com.navinfo.outdoor.http.UploadCallBack;
|
||||
import com.navinfo.outdoor.util.Base64;
|
||||
import com.navinfo.outdoor.util.Md5Util;
|
||||
import com.navinfo.outdoor.util.SpeakMode;
|
||||
import com.navinfo.outdoor.util.SystemTTS;
|
||||
import com.navinfo.outdoor.util.TimestampUtil;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
@@ -204,7 +205,7 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
|
||||
.url(HttpInterface.USER_LOGIN_OAUTH_TOKEN)
|
||||
.cls(LoginOauthTokenBean.class)
|
||||
.params(httpParams);
|
||||
okGoBuilder.postRequest(new Callback<LoginOauthTokenBean>() {
|
||||
okGoBuilder.postRequest(new UploadCallBack<LoginOauthTokenBean>() {
|
||||
@Override
|
||||
public void onSuccess(LoginOauthTokenBean response, int id) {
|
||||
dismissLoadingDialog();
|
||||
@@ -234,6 +235,9 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadProgress(Progress progress) { }
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e, int id) {
|
||||
dismissLoadingDialog();
|
||||
|
||||
@@ -27,6 +27,7 @@ import com.kongzue.dialog.interfaces.OnDialogButtonClickListener;
|
||||
import com.kongzue.dialog.util.BaseDialog;
|
||||
import com.kongzue.dialog.v3.MessageDialog;
|
||||
import com.lzy.okgo.model.HttpParams;
|
||||
import com.lzy.okgo.model.Progress;
|
||||
import com.navinfo.outdoor.R;
|
||||
import com.navinfo.outdoor.api.Constant;
|
||||
import com.navinfo.outdoor.base.BaseActivity;
|
||||
@@ -37,6 +38,7 @@ import com.navinfo.outdoor.bean.UserDetailBean;
|
||||
import com.navinfo.outdoor.http.Callback;
|
||||
import com.navinfo.outdoor.http.HttpInterface;
|
||||
import com.navinfo.outdoor.http.OkGoBuilder;
|
||||
import com.navinfo.outdoor.http.UploadCallBack;
|
||||
import com.navinfo.outdoor.util.APKVersionCodeUtils;
|
||||
import com.navinfo.outdoor.util.Base64;
|
||||
import com.navinfo.outdoor.util.Md5Util;
|
||||
@@ -90,15 +92,6 @@ public class MainActivity extends BaseActivity {
|
||||
return R.layout.activity_main;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
super.initData();
|
||||
//必须全局才可以改变样式
|
||||
/* DialogSettings.style = DialogSettings.STYLE.STYLE_IOS;
|
||||
DialogSettings.init();//初始化清空 BaseDialog 队列*/
|
||||
}
|
||||
|
||||
|
||||
private void initPermission() {
|
||||
XXPermissions.with(this)
|
||||
// 申请安装包权限
|
||||
@@ -214,12 +207,6 @@ public class MainActivity extends BaseActivity {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setIcon(android.R.drawable.ic_dialog_info);
|
||||
builder.setMessage("请升级APP版本至" + bodyBean.getVersion());
|
||||
/* builder.setMessage("本次升级说明:\n" +
|
||||
"1.修复一些闪退、丢任务、丢数据、卡顿问题\n" +
|
||||
"2.修复点击保存,持续提示问题,上传任务中也可继续作业\n" +
|
||||
"3.修复连拍照片错乱问题\n" +
|
||||
"4.修复起终点判断问题\n" +
|
||||
"5.新增默认地图缩放比例、身份证姓名自动识别功能");*/
|
||||
builder.setCancelable(false);
|
||||
if (bodyBean.getUpdateState() == 0) {//非必须更新
|
||||
builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
|
||||
@@ -374,7 +361,7 @@ public class MainActivity extends BaseActivity {
|
||||
.url(HttpInterface.USER_LOGIN_OAUTH_TOKEN)
|
||||
.cls(LoginOauthTokenBean.class)
|
||||
.params(httpParams);
|
||||
okGoBuilder.postRequest(new Callback<LoginOauthTokenBean>() {
|
||||
okGoBuilder.postRequest(new UploadCallBack<LoginOauthTokenBean>() {
|
||||
@Override
|
||||
public void onSuccess(LoginOauthTokenBean response, int id) {
|
||||
dismissLoadingDialog();
|
||||
@@ -401,6 +388,11 @@ public class MainActivity extends BaseActivity {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadProgress(Progress progress) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e, int id) {
|
||||
dismissLoadingDialog();
|
||||
|
||||
@@ -124,7 +124,8 @@ public class PhotographActivity extends BaseActivity implements View.OnClickList
|
||||
photographBuilder.append(TimestampUtil.time()).append(",").append("cameraView 用户横屏拍摄 ,");
|
||||
}
|
||||
File file = new File(photo_path);
|
||||
/*File destFolder = new File(file.getParentFile().getAbsolutePath()+"aaa");
|
||||
/*
|
||||
File destFolder = new File(file.getParentFile().getAbsolutePath()+"aaa");
|
||||
if (!destFolder.exists()) {
|
||||
destFolder.mkdirs();
|
||||
}*/
|
||||
|
||||
@@ -148,8 +148,6 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
@Override
|
||||
protected void initView() {
|
||||
super.initView();
|
||||
removables = new ArrayList<>();//存储轨迹的marker
|
||||
layerChange = findViewById(R.id.layer_change);
|
||||
if (getIntent() != null) {
|
||||
finalVideoPath = getIntent().getStringExtra(Constant.INTENT_JPG_PATH);
|
||||
type = getIntent().getIntExtra(Constant.INTENT_TYPE, 0);
|
||||
@@ -166,6 +164,8 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
}
|
||||
}
|
||||
}
|
||||
removables = new ArrayList<>();//存储轨迹的marker
|
||||
layerChange = findViewById(R.id.layer_change);
|
||||
formatter = new SimpleDateFormat("yyyyMMdd HHmmss");
|
||||
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
||||
systemTTS = SystemTTS.getInstance(PicturesActivity.this);
|
||||
@@ -173,7 +173,6 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
tvMapView.setOnClickListener(this);
|
||||
ivPicRoadImage = findViewById(R.id.iv_pic);
|
||||
ivPicVideoImage = findViewById(R.id.iv_pic_video);
|
||||
|
||||
Button btnSwitch = findViewById(R.id.btn_switch);
|
||||
btnSwitch.setOnClickListener(this);
|
||||
RadioGroup radioGroupPicture = findViewById(R.id.radio_group_picture);
|
||||
@@ -288,33 +287,6 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
if (result != null && result.getData() != null && result.getData().length > 0) {
|
||||
super.onPictureTaken(result);
|
||||
isBack = true;
|
||||
|
||||
|
||||
//判断当前的信号强度
|
||||
if (!isGPS){
|
||||
int gpsRssi = Constant.currentLocation.getGPSRssi();
|
||||
if (gpsRssi==0){//无信号
|
||||
stopTimer();
|
||||
capturePicture.setChecked(false);
|
||||
if (radioPicture != 1) {
|
||||
capturePicture.setText("开始采集");
|
||||
capturePicture.setChecked(false);
|
||||
}
|
||||
return;
|
||||
}else if (gpsRssi==1){//信号弱
|
||||
stopTimer();
|
||||
capturePicture.setChecked(false);
|
||||
if (radioPicture != 1) {
|
||||
capturePicture.setText("开始采集");
|
||||
capturePicture.setChecked(false);
|
||||
}
|
||||
return;
|
||||
}else if (gpsRssi==2){//信号中
|
||||
isGPS=true;
|
||||
}else if (gpsRssi==3){//信号强
|
||||
isGPS=true;
|
||||
}
|
||||
}
|
||||
// 如果当前手机是竖向,则不
|
||||
if (isOration) {
|
||||
if (Objects.requireNonNull(camera.getPictureSize()).getWidth() < camera.getPictureSize().getHeight()) {
|
||||
|
||||
@@ -13,7 +13,6 @@ import com.navinfo.outdoor.base.BaseActivity;
|
||||
* */
|
||||
public class RegardMapActivity extends BaseActivity implements View.OnClickListener {
|
||||
|
||||
|
||||
@Override
|
||||
protected int getLayout() {
|
||||
return R.layout.activity_regard_map;
|
||||
@@ -24,7 +23,6 @@ public class RegardMapActivity extends BaseActivity implements View.OnClickLis
|
||||
super.initView();
|
||||
ImageView ivFilterFinal =findViewById(R.id.iv_filter_final);
|
||||
ivFilterFinal.setOnClickListener(this);
|
||||
TextView tvPhone = findViewById(R.id.tv_phone);
|
||||
TextView tvMapLink =findViewById(R.id.tv_map_link);
|
||||
tvMapLink.setOnClickListener(this);
|
||||
TextView tvOfficialLink =findViewById(R.id.tv_official_link);
|
||||
|
||||
@@ -1,602 +0,0 @@
|
||||
package com.navinfo.outdoor.activity;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Matrix;
|
||||
import android.os.Message;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.lzy.okgo.OkGo;
|
||||
import com.lzy.okgo.model.HttpParams;
|
||||
import com.navinfo.outdoor.R;
|
||||
import com.navinfo.outdoor.adapter.MarkerAdapter;
|
||||
import com.navinfo.outdoor.api.Constant;
|
||||
import com.navinfo.outdoor.base.BaseActivity;
|
||||
import com.navinfo.outdoor.bean.JobSearchBean;
|
||||
import com.navinfo.outdoor.http.Callback;
|
||||
import com.navinfo.outdoor.http.HttpInterface;
|
||||
import com.navinfo.outdoor.http.OkGoBuilder;
|
||||
import com.navinfo.outdoor.room.PoiEntity;
|
||||
import com.navinfo.outdoor.util.Geohash;
|
||||
import com.navinfo.outdoor.util.GeometryTools;
|
||||
import com.navinfo.outdoor.util.MarkerClusterItem;
|
||||
import com.navinfo.outdoor.util.MyTecentLocationSource;
|
||||
import com.tencent.map.geolocation.TencentLocation;
|
||||
import com.tencent.tencentmap.mapsdk.maps.CameraUpdate;
|
||||
import com.tencent.tencentmap.mapsdk.maps.CameraUpdateFactory;
|
||||
import com.tencent.tencentmap.mapsdk.maps.Projection;
|
||||
import com.tencent.tencentmap.mapsdk.maps.TencentMap;
|
||||
import com.tencent.tencentmap.mapsdk.maps.TextureMapView;
|
||||
import com.tencent.tencentmap.mapsdk.maps.UiSettings;
|
||||
import com.tencent.tencentmap.mapsdk.maps.interfaces.Removable;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptor;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptorFactory;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.CameraPosition;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.Marker;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.MarkerOptions;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.MyLocationStyle;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.Polygon;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.PolygonOptions;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.Polyline;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.PolylineOptions;
|
||||
import com.tencent.tencentmap.mapsdk.vector.utils.clustering.ClusterManager;
|
||||
import com.tencent.tencentmap.mapsdk.vector.utils.clustering.algo.NonHierarchicalDistanceBasedAlgorithm;
|
||||
import com.tencent.tencentmap.mapsdk.vector.utils.clustering.view.DefaultClusterRenderer;
|
||||
import com.vividsolutions.jts.geom.Geometry;
|
||||
import com.vividsolutions.jts.geom.MultiPoint;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.tencent.tencentmap.mapsdk.maps.model.MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER;
|
||||
|
||||
public class TestActivity extends BaseActivity {
|
||||
|
||||
private TencentMap tencentMap;
|
||||
private List<Removable> removables;
|
||||
private final int MARKER_DOT = 3;
|
||||
private final int MARKER_LINE = 2;
|
||||
private final int MARKER_FACE = 1;
|
||||
private ClusterManager<MarkerClusterItem> clusterItemClusterManager;
|
||||
private HashMap<String, List<Marker>> stringListHashMap;
|
||||
private ArrayList<LatLng> listLatLng;
|
||||
|
||||
@Override
|
||||
protected int getLayout() {
|
||||
return R.layout.activity_test;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
super.initData();
|
||||
removables = new ArrayList<>();//存储网络数据的marker数据(线,面,点)
|
||||
stringListHashMap = new HashMap<>();//key :wkt,value :存储的数据类型
|
||||
//存储的多点latLng
|
||||
listLatLng = new ArrayList<>();
|
||||
initList(Constant.currentLocation);
|
||||
}
|
||||
|
||||
private void initList(TencentLocation tencentLocation) {
|
||||
int task_type = Constant.TASK_TYPE;
|
||||
int limit_type = Constant.LIMIT_TYPE;
|
||||
int taskStatus = Constant.TASK_STARTUP;
|
||||
if (taskStatus == 1 || taskStatus == 2 || taskStatus == 3) {
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.JOB_SEARCH_WORD;
|
||||
obtain.obj = null;
|
||||
EventBus.getDefault().post(obtain);
|
||||
return;
|
||||
}
|
||||
//获取中心点位置
|
||||
LatLng mapCenterPoint = tencentMap.getCameraPosition().target;
|
||||
String centerEncode = null;
|
||||
if (mapCenterPoint != null) {
|
||||
centerEncode = Geohash.getInstance().encode(mapCenterPoint.latitude, mapCenterPoint.longitude);
|
||||
}
|
||||
String userEncode = Geohash.getInstance().encode(tencentLocation.getLatitude(), tencentLocation.getLongitude());
|
||||
OkGo.getInstance().cancelTag(this);
|
||||
showLoadingDialog();
|
||||
// 请求方式和请求url
|
||||
|
||||
HttpParams httpParams = new HttpParams();
|
||||
httpParams.put("userGeo", userEncode);
|
||||
httpParams.put("centerGeo", centerEncode);
|
||||
httpParams.put("pageSize", Constant.NUMBER);
|
||||
int treasurePage = 1;
|
||||
httpParams.put("pageNum", treasurePage);
|
||||
httpParams.put("type", task_type);
|
||||
httpParams.put("isExclusive", limit_type);
|
||||
OkGoBuilder okGoBuilder = OkGoBuilder.getInstance()
|
||||
.time(30)
|
||||
.Builder(this)
|
||||
.url(HttpInterface.TASK_LIST)
|
||||
.cls(JobSearchBean.class)
|
||||
.params(httpParams)
|
||||
.token(Constant.ACCESS_TOKEN);
|
||||
okGoBuilder.getRequest(new Callback<JobSearchBean>() {
|
||||
@Override
|
||||
public void onSuccess(JobSearchBean response, int id) {
|
||||
dismissLoadingDialog();
|
||||
if (response.getCode() == 200) {
|
||||
JobSearchBean.BodyBean body = response.getBody();
|
||||
if (body != null) {
|
||||
Log.d("TAG", "onSuccess: " + response.getBody().toString());
|
||||
for (int i = 0; i < removables.size(); i++) {
|
||||
removables.get(i).remove();
|
||||
}
|
||||
removables.clear();
|
||||
stringListHashMap.clear();
|
||||
List<JobSearchBean.BodyBean.ListBean> list = response.getBody().getList();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
JobSearchBean.BodyBean.ListBean listBean = list.get(i);
|
||||
String encodeStr = list.get(i).getGeo();
|
||||
// 解密geo
|
||||
Geometry geoMe = GeometryTools.createGeometry(Geohash.getInstance().decode(encodeStr));
|
||||
String geo = geoMe.toString();
|
||||
listBean.setGeo(geo);
|
||||
Log.d("TAG", "onSuccess: " + geo);
|
||||
Geometry geometry = GeometryTools.createGeometry(geo);
|
||||
LatLng latLng = null;
|
||||
switch (geometry.getGeometryType()) {
|
||||
case "Point": //点
|
||||
latLng = GeometryTools.createLatLng(geo);
|
||||
break;
|
||||
case "LineString": //线
|
||||
BitmapDescriptor bitmapLine = null;
|
||||
if (listBean.getType() == 3) {//poi录像
|
||||
bitmapLine = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_arrows);
|
||||
} else if (listBean.getType() == 4) {//道路录像
|
||||
bitmapLine = BitmapDescriptorFactory.fromResource(R.drawable.road_arrows);
|
||||
}
|
||||
List<LatLng> latLineString = GeometryTools.getLatLags(geo);
|
||||
// 构造 PolylineOptions
|
||||
PolylineOptions polylineOptions = new PolylineOptions()
|
||||
.addAll(latLineString)// 折线设置圆形线头
|
||||
.lineCap(true)// 折线的颜色为绿色
|
||||
.color(Color.parseColor("#0096FF"))// 折线宽度为5像素
|
||||
.width(10)
|
||||
.arrow(true)
|
||||
//.borderColor(0xffff0000) // 还可以添加描边颜色
|
||||
//.borderWidth(1) // 描边颜色的宽度,线宽还是 25 像素,不过填充的部分宽度为 `width` - 2 * `borderWidth`
|
||||
.arrowSpacing(100)
|
||||
.arrowTexture(bitmapLine);
|
||||
// 绘制折线
|
||||
Polyline polyline = tencentMap.addPolyline(polylineOptions);
|
||||
polyline.setZIndex(MARKER_LINE);
|
||||
removables.add(polyline);
|
||||
if (latLineString != null && latLineString.size() > 0) {
|
||||
latLng = latLineString.get(0);
|
||||
}
|
||||
break;
|
||||
case "Polygon": //面
|
||||
List<LatLng> latPolygon = GeometryTools.getLatLags(geo);
|
||||
Polygon polygon = tencentMap.addPolygon(new PolygonOptions().
|
||||
addAll(latPolygon).//连接封闭图形的点
|
||||
fillColor(Color.parseColor("#97E0E7EC")). //填充颜色为红色
|
||||
strokeColor(0xff000000).//边线颜色为黑色
|
||||
strokeWidth(5));//边线宽度15像素
|
||||
polygon.setZIndex(MARKER_FACE);
|
||||
removables.add(polygon);
|
||||
com.vividsolutions.jts.geom.Point centroid = geometry.getCentroid();
|
||||
double x = centroid.getX();
|
||||
double y = centroid.getY();
|
||||
latLng = new LatLng();
|
||||
latLng.setLatitude(y);
|
||||
latLng.setLongitude(x);
|
||||
/* if (latPolygon != null && latPolygon.size() > 0) {
|
||||
latLng = latPolygon.get(0);
|
||||
}*/
|
||||
break;
|
||||
}
|
||||
switch (list.get(i).getType()) {
|
||||
case 1://poi
|
||||
BitmapDescriptor poiDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi);
|
||||
//poiDescriptor.getForager().setScale(50);
|
||||
assert latLng != null;
|
||||
Marker poiMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiDescriptor).alpha(0.9f)
|
||||
.anchor(0.5f, 1.0f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
poiMarker.setZIndex(MARKER_DOT);
|
||||
poiMarker.setTag(listBean);
|
||||
removables.add(poiMarker);
|
||||
poiMarker.setClickable(true);
|
||||
onMarker(geo, poiMarker);
|
||||
break;
|
||||
case 2://充电站
|
||||
BitmapDescriptor chargeDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_charge);
|
||||
assert latLng != null;
|
||||
Marker stationMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(chargeDescriptor).alpha(0.9f)
|
||||
.anchor(0.5f, 1.0f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
stationMarker.setZIndex(MARKER_DOT);
|
||||
stationMarker.setTag(listBean);
|
||||
removables.add(stationMarker);
|
||||
stationMarker.setClickable(true);
|
||||
onMarker(geo, stationMarker);
|
||||
break;
|
||||
case 3://poi录像
|
||||
BitmapDescriptor poiVideoDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_video);
|
||||
assert latLng != null;
|
||||
Marker poiVideoMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiVideoDescriptor).alpha(0.9f)
|
||||
.anchor(0.5f, 1.0f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
poiVideoMarker.setTag(listBean);
|
||||
poiVideoMarker.setZIndex(MARKER_DOT);
|
||||
removables.add(poiVideoMarker);
|
||||
poiVideoMarker.setClickable(true);
|
||||
onMarker(geo, poiVideoMarker);
|
||||
break;
|
||||
case 4://道路录像
|
||||
BitmapDescriptor roadDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_road);
|
||||
assert latLng != null;
|
||||
Marker roadMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(roadDescriptor).alpha(0.9f)
|
||||
.anchor(0.5f, 1.0f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
roadMarker.setZIndex(MARKER_DOT);
|
||||
roadMarker.setTag(listBean);
|
||||
removables.add(roadMarker);
|
||||
roadMarker.setClickable(true);
|
||||
onMarker(geo, roadMarker);
|
||||
break;
|
||||
case 5://其他
|
||||
BitmapDescriptor otherDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other);
|
||||
assert latLng != null;
|
||||
Marker otherMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(otherDescriptor).alpha(0.9f)
|
||||
.anchor(0.5f, 1.0f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
otherMarker.setZIndex(MARKER_DOT);
|
||||
otherMarker.setTag(listBean);
|
||||
removables.add(otherMarker);
|
||||
otherMarker.setClickable(true);
|
||||
onMarker(geo, otherMarker);
|
||||
break;
|
||||
case 6://面状任务
|
||||
BitmapDescriptor Descriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_facet);
|
||||
assert latLng != null;
|
||||
Marker planarMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(Descriptor).alpha(0.9f)
|
||||
.anchor(0.5f, 1.0f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
planarMarker.setZIndex(MARKER_DOT);
|
||||
planarMarker.setTag(listBean);
|
||||
removables.add(planarMarker);
|
||||
planarMarker.setClickable(true);
|
||||
onMarker(geo, planarMarker);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
listLatLng.clear();
|
||||
for (Map.Entry<String, List<Marker>> entry : stringListHashMap.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
List<Marker> markerList = stringListHashMap.get(key);
|
||||
assert markerList != null;
|
||||
Log.d("TAG", ": " + markerList.toString());
|
||||
Log.d("TAG", ": " + entry.getValue() + "-" + entry.getKey());
|
||||
LatLng lng = GeometryTools.createLatLng(key);
|
||||
listLatLng.add(lng);
|
||||
}
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.JOB_SEARCH_WORD;
|
||||
obtain.obj = response;
|
||||
EventBus.getDefault().post(obtain);
|
||||
} else {
|
||||
Toast.makeText(TestActivity.this, response.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e, int id) {
|
||||
dismissLoadingDialog();
|
||||
Log.d("TAG", "onError: " + e.getMessage() + "");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void onMarker(String geo, Marker marker) {
|
||||
if (!stringListHashMap.containsKey(geo)) {
|
||||
List<Marker> markers = new ArrayList<>();
|
||||
markers.add(marker);
|
||||
stringListHashMap.put(geo, markers);
|
||||
} else {
|
||||
List<Marker> markers = stringListHashMap.get(geo);
|
||||
assert markers != null;
|
||||
markers.add(marker);
|
||||
stringListHashMap.put(geo, markers);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
super.initView();
|
||||
TextureMapView tvMap = findViewById(R.id.iv_map);
|
||||
tencentMap = tvMap.getMap();
|
||||
//获取地图UI 设置对象
|
||||
UiSettings uiSettings = tencentMap.getUiSettings();
|
||||
//设置logo的大小
|
||||
uiSettings.setLogoScale(0.7f);
|
||||
uiSettings.setRotateGesturesEnabled(false);//禁止地图旋转手势.
|
||||
uiSettings.setTiltGesturesEnabled(false);//禁止倾斜手势.
|
||||
//uiSettings.setAllGesturesEnabled(false);
|
||||
setLocMarkerStyle(LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER);
|
||||
// initCluster();
|
||||
initNewMarker();
|
||||
}
|
||||
|
||||
private void initNewMarker() {
|
||||
tencentMap.setOnMapClickListener(new TencentMap.OnMapClickListener() {
|
||||
@Override
|
||||
public void onMapClick(LatLng latLng) {
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
tencentMap.setOnMarkerClickListener(new TencentMap.OnMarkerClickListener() {
|
||||
@Override
|
||||
public boolean onMarkerClick(Marker marker) {
|
||||
LatLng latLng = marker.getPosition();
|
||||
ArrayList<LatLng> latLngs = new ArrayList<>();//存储的是内部的屏幕点坐标
|
||||
Projection projection = tencentMap.getProjection();
|
||||
android.graphics.Point point = projection.toScreenLocation(latLng);//转换为屏幕坐标
|
||||
int minX = point.x - 200;
|
||||
int minY = point.y - 200;
|
||||
int maxX = point.x + 200;
|
||||
int maxY = point.y + 200;
|
||||
point.set(minX, minY);
|
||||
latLngs.add(new LatLng(projection.fromScreenLocation(point)));
|
||||
point.set(maxX, minY);
|
||||
latLngs.add(new LatLng(projection.fromScreenLocation(point)));
|
||||
point.set(maxX, maxY);
|
||||
latLngs.add(new LatLng(projection.fromScreenLocation(point)));
|
||||
point.set(minX, maxY);
|
||||
latLngs.add(new LatLng(projection.fromScreenLocation(point)));
|
||||
point.set(minX, minY);
|
||||
latLngs.add(new LatLng(projection.fromScreenLocation(point)));
|
||||
com.vividsolutions.jts.geom.Polygon polygon = GeometryTools.createPolygon(latLngs);
|
||||
//多点
|
||||
MultiPoint multiPoint = GeometryTools.createMultiPoint(listLatLng);
|
||||
//拿到覆蓋點
|
||||
Geometry intersection = polygon.intersection(multiPoint);
|
||||
String geometryType = intersection.getGeometryType();
|
||||
ArrayList<PoiEntity> poiEntityArrayList = new ArrayList<>();
|
||||
if (geometryType.equals("MultiPoint")) {
|
||||
List<LatLng> latList = GeometryTools.getLatList(intersection);
|
||||
for (int i = 0; i < latList.size(); i++) {
|
||||
LatLng latL = latList.get(i);
|
||||
Geometry geometry = GeometryTools.createGeometry(latL);
|
||||
Log.d("TAG", "onMarkerClick: " + geometry.toString());
|
||||
List<Marker> markerList = stringListHashMap.get(geometry.toText());
|
||||
if (markerList != null) {
|
||||
for (Marker mar : markerList) {
|
||||
JobSearchBean.BodyBean.ListBean listBean = (JobSearchBean.BodyBean.ListBean) mar.getTag();
|
||||
if (listBean != null) {
|
||||
PoiEntity poiListEntity = new PoiEntity();
|
||||
poiListEntity.setTaskId(listBean.getId());
|
||||
poiListEntity.setGeoWkt(listBean.getGeo());
|
||||
poiListEntity.setName(listBean.getName());
|
||||
poiListEntity.setAddress(listBean.getAddress());
|
||||
poiListEntity.setTelPhone(listBean.getTelephone() + "");
|
||||
poiListEntity.setPrecision(listBean.getPrice() + "");
|
||||
poiListEntity.setDist(listBean.getDist() + "");
|
||||
poiListEntity.setDescribe(listBean.getMemo());
|
||||
poiListEntity.setGeoWkt(listBean.getGeo());
|
||||
poiListEntity.setCreateTime(listBean.getEndDate());
|
||||
poiListEntity.setType(listBean.getType());
|
||||
String beanGeo = listBean.getGeo();
|
||||
String geo = Geohash.getInstance().decode(beanGeo);
|
||||
Geometry gens = GeometryTools.createGeometry(geo);
|
||||
switch (gens.getGeometryType()) {
|
||||
case "Point": //点
|
||||
LatLng lng = GeometryTools.createLatLng(geo);
|
||||
poiListEntity.setX(lng.longitude + "");
|
||||
poiListEntity.setY(lng.latitude + "");
|
||||
break;
|
||||
case "LineString": //线
|
||||
case "Polygon": //面
|
||||
List<LatLng> latLineString = GeometryTools.getLatLags(geo);
|
||||
assert latLineString != null;
|
||||
poiListEntity.setX(latLineString.get(0).longitude + "");
|
||||
poiListEntity.setY(latLineString.get(0).latitude + "");
|
||||
break;
|
||||
}
|
||||
poiEntityArrayList.add(poiListEntity);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
customDialog(poiEntityArrayList);
|
||||
} else {
|
||||
Log.d("TAG", "onMapClick: " + geometryType);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
/* tencentMap.setOnMarkerClickListener(new TencentMap.OnMarkerClickListener() {
|
||||
@Override
|
||||
public boolean onMarkerClick(Marker marker) {
|
||||
if (marker.getTag().equals("marker")) {
|
||||
Toast.makeText(TestActivity.this, marker.getId()+" ", Toast.LENGTH_SHORT).show();
|
||||
//中心点的圆
|
||||
// Geometry geometry = GeometryTools.createGeometry();
|
||||
// 多 点
|
||||
MultiPoint multiPoint = GeometryTools.createMultiPoint(markerLatlng);
|
||||
// 点与多点直接形成的交叉点
|
||||
if (multiPoint != null) {
|
||||
Geometry intersection = geometry.intersection(multiPoint);
|
||||
intersection.getGeometryType()
|
||||
Coordinate[] coordinates = intersection.getCoordinates();
|
||||
if (coordinates != null && coordinates.length > 0) {
|
||||
LatLng geo = new LatLng(coordinates[0].y, coordinates[0].x);
|
||||
BitmapDescriptor chargeDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_charge);
|
||||
tencentMap.addMarker(new MarkerOptions(geo).icon(chargeDescriptor).alpha(0.9f)
|
||||
.anchor(0.5f, 1.0f)
|
||||
.flat(true)
|
||||
.clockwise(false));
|
||||
Log.d("yyyy", "initNewMarker: " + geo);
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});*/
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义登录对话框
|
||||
*/
|
||||
public void customDialog(List<PoiEntity> list) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(TestActivity.this);
|
||||
final AlertDialog dialog = builder.create();
|
||||
View dialogView = View.inflate(this, R.layout.layout_marker_dialog, null);
|
||||
dialog.setView(dialogView);
|
||||
Window win = dialog.getWindow();
|
||||
win.setGravity(Gravity.BOTTOM); // 这里控制弹出的位置
|
||||
win.getDecorView().setPadding(0, 0, 0, 0);
|
||||
WindowManager.LayoutParams lp = win.getAttributes();
|
||||
lp.width = WindowManager.LayoutParams.MATCH_PARENT;
|
||||
lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
|
||||
dialog.getWindow().setBackgroundDrawable(null);
|
||||
win.setAttributes(lp);
|
||||
dialog.show();
|
||||
RecyclerView recyclerView = dialogView.findViewById(R.id.rv_marker_view);
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(this));
|
||||
MarkerAdapter markerAdapter = new MarkerAdapter(list, TestActivity.this);
|
||||
recyclerView.setAdapter(markerAdapter);
|
||||
markerAdapter.setOnBankClick(new MarkerAdapter.OnBankClick() {
|
||||
@Override
|
||||
public void onClick(PoiEntity poiEntity) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initCluster() {
|
||||
// 实例化点聚合管理者
|
||||
clusterItemClusterManager = new ClusterManager<>(this, tencentMap);
|
||||
//默认聚合策略,调用是不必添加,如果需要其他聚合策略可以按以下代码修改
|
||||
NonHierarchicalDistanceBasedAlgorithm<MarkerClusterItem> hierarchicalDistanceBasedAlgorithm = new NonHierarchicalDistanceBasedAlgorithm<>(this);
|
||||
//设置点聚合生效距离,以dp为代码
|
||||
hierarchicalDistanceBasedAlgorithm.setMaxDistanceAtZoom(35);
|
||||
//设置策略
|
||||
clusterItemClusterManager.setAlgorithm(hierarchicalDistanceBasedAlgorithm);
|
||||
//设置聚合渲染器,默认使用的是DefaultClusterRenderer,可以不调用下列代码
|
||||
DefaultClusterRenderer<MarkerClusterItem> markerClusterItemDefaultClusterRenderer = new DefaultClusterRenderer<>(this, tencentMap, clusterItemClusterManager);
|
||||
//设置最小聚合数量,默认为4.这里设置为2,即有两个以上不包括2个marker 才会聚合
|
||||
markerClusterItemDefaultClusterRenderer.setMinClusterSize(2);
|
||||
//定义聚合的分段,当超过五个不足10个的时候,显示5+ ,其他分段同理
|
||||
markerClusterItemDefaultClusterRenderer.setBuckets(new int[]{5, 10, 15, 20, 25, 50, 100, 200});
|
||||
clusterItemClusterManager.setRenderer(markerClusterItemDefaultClusterRenderer);
|
||||
//添加聚合
|
||||
List<MarkerClusterItem> items = new ArrayList<>();
|
||||
items.add(new MarkerClusterItem(39.984059, 116.307621));
|
||||
items.add(new MarkerClusterItem(39.981954, 116.304703));
|
||||
items.add(new MarkerClusterItem(39.984355, 116.312256));
|
||||
items.add(new MarkerClusterItem(39.980442, 116.315346));
|
||||
items.add(new MarkerClusterItem(39.981527, 116.308994));
|
||||
items.add(new MarkerClusterItem(39.979751, 116.310539));
|
||||
items.add(new MarkerClusterItem(39.977252, 116.305776));
|
||||
items.add(new MarkerClusterItem(39.984026, 116.316419));
|
||||
items.add(new MarkerClusterItem(39.976956, 116.314874));
|
||||
items.add(new MarkerClusterItem(39.978501, 116.311827));
|
||||
items.add(new MarkerClusterItem(39.980277, 116.312814));
|
||||
items.add(new MarkerClusterItem(39.980236, 116.369022));
|
||||
items.add(new MarkerClusterItem(39.978838, 116.368486));
|
||||
items.add(new MarkerClusterItem(39.977161, 116.367488));
|
||||
items.add(new MarkerClusterItem(39.915398, 116.396713));
|
||||
items.add(new MarkerClusterItem(39.937645, 116.455421));
|
||||
items.add(new MarkerClusterItem(39.896304, 116.321182));
|
||||
items.add(new MarkerClusterItem(31.254487, 121.452827));
|
||||
items.add(new MarkerClusterItem(31.225133, 121.485443));
|
||||
items.add(new MarkerClusterItem(31.216912, 121.442528));
|
||||
items.add(new MarkerClusterItem(31.251552, 121.500893));
|
||||
items.add(new MarkerClusterItem(31.249204, 121.455917));
|
||||
items.add(new MarkerClusterItem(22.546885, 114.042892));
|
||||
items.add(new MarkerClusterItem(22.538086, 113.999805));
|
||||
items.add(new MarkerClusterItem(22.534756, 114.082031));
|
||||
clusterItemClusterManager.addItems(items);
|
||||
tencentMap.setOnCameraChangeListener(clusterItemClusterManager);
|
||||
tencentMap.setOnCameraChangeListener(new TencentMap.OnCameraChangeListener() {
|
||||
@Override
|
||||
public void onCameraChange(CameraPosition cameraPosition) {
|
||||
clusterItemClusterManager.cluster();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCameraChangeFinished(CameraPosition cameraPosition) {
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 设置定位图标样式
|
||||
*/
|
||||
private void setLocMarkerStyle(int style) {
|
||||
tencentMap.setLocationSource(new MyTecentLocationSource(this));
|
||||
tencentMap.setMyLocationEnabled(true);
|
||||
MyLocationStyle locationStyle = new MyLocationStyle();
|
||||
locationStyle = locationStyle.myLocationType(style);
|
||||
//创建图标
|
||||
BitmapDescriptor bitmapDescriptor = BitmapDescriptorFactory.fromBitmap(getBitMap());
|
||||
locationStyle.icon(bitmapDescriptor);
|
||||
//设置定位圆形区域的边框宽度;
|
||||
locationStyle.fillColor(getResources().getColor(android.R.color.transparent));
|
||||
locationStyle.strokeWidth(1);
|
||||
tencentMap.setMyLocationStyle(locationStyle);
|
||||
}
|
||||
|
||||
private Bitmap getBitMap() {
|
||||
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.location);
|
||||
int width = bitmap.getWidth();
|
||||
int height = bitmap.getHeight();
|
||||
int newWidth = 55;
|
||||
int newHeight = 55;
|
||||
float widthScale = ((float) newWidth) / width;
|
||||
float heightScale = ((float) newHeight) / height;
|
||||
Matrix matrix = new Matrix();
|
||||
matrix.postScale(widthScale, heightScale);
|
||||
bitmap = Bitmap.createBitmap(bitmap, 0, 0, width, height, matrix, true);
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onEventMessageMainThread(Message msg) {
|
||||
if (msg.what == Constant.EVENT_WHAT_LOCATION_CHANGE) { // 用户位置更新
|
||||
if (tencentMap != null) {
|
||||
TencentLocation tencentLocation = (TencentLocation) msg.obj;
|
||||
CameraUpdate cameraSigma = CameraUpdateFactory.newCameraPosition(
|
||||
new CameraPosition(new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()), //中心点坐标,地图目标经纬度
|
||||
tencentMap.getCameraPosition().zoom, //目标缩放级别
|
||||
0, //目标倾斜角
|
||||
tencentLocation.getBearing())); //目标旋转角 0~360° (正北方为0)
|
||||
tencentMap.animateCamera(cameraSigma);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -24,6 +24,7 @@ import com.kongzue.dialog.interfaces.OnDialogButtonClickListener;
|
||||
import com.kongzue.dialog.util.BaseDialog;
|
||||
import com.kongzue.dialog.v3.MessageDialog;
|
||||
import com.lzy.okgo.model.HttpParams;
|
||||
import com.lzy.okgo.model.Progress;
|
||||
import com.navinfo.outdoor.R;
|
||||
import com.navinfo.outdoor.api.Constant;
|
||||
import com.navinfo.outdoor.base.BaseActivity;
|
||||
@@ -33,6 +34,7 @@ import com.navinfo.outdoor.bean.UserBean;
|
||||
import com.navinfo.outdoor.http.Callback;
|
||||
import com.navinfo.outdoor.http.HttpInterface;
|
||||
import com.navinfo.outdoor.http.OkGoBuilder;
|
||||
import com.navinfo.outdoor.http.UploadCallBack;
|
||||
import com.navinfo.outdoor.util.FlushTokenUtil;
|
||||
import com.navinfo.outdoor.util.GetJsonDataUtil;
|
||||
import com.navinfo.outdoor.util.RegexUtil;
|
||||
@@ -48,14 +50,14 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 用户资料
|
||||
/*
|
||||
用户资料
|
||||
*/
|
||||
public class UserActivity extends BaseActivity implements View.OnClickListener {
|
||||
private List<JsonBean> options1Items = new ArrayList<>();
|
||||
private ArrayList<ArrayList<String>> options2Items = new ArrayList<>();
|
||||
private ArrayList<ArrayList<ArrayList<String>>> options3Items = new ArrayList<>();
|
||||
private ArrayList<ArrayList<ArrayList<CityBean>>> cityItems = new ArrayList<>();
|
||||
private List<List<String>> options2Items = new ArrayList<>();
|
||||
private List<List<List<String>>> options3Items = new ArrayList<>();
|
||||
private List<List<List<CityBean>>> cityItems = new ArrayList<>();
|
||||
private TextView region;
|
||||
private EditText etPhone, etQq, etMailbox;
|
||||
private String region_id;
|
||||
@@ -243,7 +245,7 @@ public class UserActivity extends BaseActivity implements View.OnClickListener {
|
||||
.cls(UserBean.class)
|
||||
.token(Constant.ACCESS_TOKEN)
|
||||
.params(httpParams);
|
||||
okGoBuilder.postRequest(new Callback<UserBean>() {
|
||||
okGoBuilder.postRequest(new UploadCallBack<UserBean>() {
|
||||
@Override
|
||||
public void onSuccess(UserBean response, int id) {
|
||||
dismissLoadingDialog();
|
||||
@@ -270,6 +272,11 @@ public class UserActivity extends BaseActivity implements View.OnClickListener {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadProgress(Progress progress) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e, int id) {
|
||||
dismissLoadingDialog();
|
||||
@@ -340,21 +347,21 @@ public class UserActivity extends BaseActivity implements View.OnClickListener {
|
||||
* 关键逻辑在于循环体
|
||||
*/
|
||||
String JsonData = new GetJsonDataUtil().getJson(UserActivity.this, "prov_city_county.json");//获取assets目录下的json文件数据
|
||||
ArrayList<JsonBean> jsonBean = parseData(JsonData);//用GOON 转成实体
|
||||
List<JsonBean> jsonBean = parseData(JsonData);//用GOON 转成实体
|
||||
/* 添加省份数据
|
||||
* 注意:如果是添加的JavaBean实体,则实体类需要实现 IPickerViewData 接口,
|
||||
* PickerView会通过getPickerViewText方法获取字符串显示出来。
|
||||
*/
|
||||
options1Items = jsonBean;
|
||||
for (int i = 0; i < jsonBean.size(); i++) {//遍历省份
|
||||
ArrayList<String> CityList = new ArrayList<>();//该省的城市列表(第二级)
|
||||
ArrayList<ArrayList<CityBean>> city_AreaList = new ArrayList<>();//该省的所有地区列表(第三级)
|
||||
ArrayList<ArrayList<String>> Province_AreaList = new ArrayList<>();//该省的所有地区列表(第三级)
|
||||
List<String> CityList = new ArrayList<>();//该省的城市列表(第二级)
|
||||
List<List<CityBean>> city_AreaList = new ArrayList<>();//该省的所有地区列表(第三级)
|
||||
List<List<String>> Province_AreaList = new ArrayList<>();//该省的所有地区列表(第三级)
|
||||
for (int c = 0; c < jsonBean.get(i).getCitys().size(); c++) {//遍历该省份的所有城市
|
||||
String CityName = jsonBean.get(i).getCitys().get(c).getCity();
|
||||
CityList.add(CityName);//添加城市
|
||||
ArrayList<CityBean> AreaList = new ArrayList<>();//该城市的所有地区列表
|
||||
ArrayList<String> City_AreaList = new ArrayList<>();//该城市的所有地区列表
|
||||
List<CityBean> AreaList = new ArrayList<>();//该城市的所有地区列表
|
||||
List<String> City_AreaList = new ArrayList<>();//该城市的所有地区列表
|
||||
//如果无地区数据,建议添加空字符串,防止数据为null 导致三个选项长度不匹配造成崩溃
|
||||
if (jsonBean.get(i).getCitys().get(c).getCounties() == null || jsonBean.get(i).getCitys().get(c).getCounties().size() == 0) {
|
||||
AreaList.add(new CityBean("", ""));
|
||||
@@ -372,13 +379,14 @@ public class UserActivity extends BaseActivity implements View.OnClickListener {
|
||||
options2Items.add(CityList);
|
||||
/*添加地区数据*/
|
||||
options3Items.add(Province_AreaList);
|
||||
|
||||
cityItems.add(city_AreaList);
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<JsonBean> parseData(String result) {
|
||||
public List<JsonBean> parseData(String result) {
|
||||
//GOON 解析
|
||||
ArrayList<JsonBean> detail = new ArrayList<>();
|
||||
List<JsonBean> detail = new ArrayList<>();
|
||||
try {
|
||||
JSONArray data = new JSONArray(result);
|
||||
Gson gson = new Gson();
|
||||
|
||||
@@ -28,7 +28,6 @@ import java.util.Map;
|
||||
* 详情页
|
||||
*/
|
||||
public class WebActivity extends BaseActivity implements View.OnClickListener {
|
||||
|
||||
private WebView nWebView;
|
||||
|
||||
@Override
|
||||
@@ -113,33 +112,4 @@ public class WebActivity extends BaseActivity implements View.OnClickListener {
|
||||
}
|
||||
}
|
||||
|
||||
// 监听
|
||||
private static class MyWebViewClient extends WebViewClient {
|
||||
@Override
|
||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||
return super.shouldOverrideUrlLoading(view, url);
|
||||
}
|
||||
|
||||
@SuppressLint("SetJavaScriptEnabled")
|
||||
@Override
|
||||
public void onPageFinished(WebView view, String url) {
|
||||
view.getSettings().setJavaScriptEnabled(true);
|
||||
super.onPageFinished(view, url);
|
||||
// html加载完成之后,添加监听图片的点击js函数
|
||||
// addImageClickListener();
|
||||
}
|
||||
|
||||
@SuppressLint("SetJavaScriptEnabled")
|
||||
@Override
|
||||
public void onPageStarted(WebView view, String url, Bitmap favicon) {
|
||||
view.getSettings().setJavaScriptEnabled(true);
|
||||
Log.d("TAG", "addImageClickListener: 开始加载");
|
||||
super.onPageStarted(view, url, favicon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
|
||||
super.onReceivedError(view, errorCode, description, failingUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,13 +33,13 @@ public class BankAdapter extends RecyclerView.Adapter<BankAdapter.ViewHolder> {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull @NotNull ViewGroup parent, int viewType) {
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View inflate = LayoutInflater.from(context).inflate(R.layout.bankadapteritem, parent, false);
|
||||
return new ViewHolder(inflate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull @NotNull ViewHolder holder, int position) {
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
holder.titer.setText(bankPathBeans.get(position).getLabel());
|
||||
holder.itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
||||
@@ -71,6 +71,7 @@ public class CapacityItemAdapter extends RecyclerView.Adapter<CapacityItemAdapte
|
||||
tvReams = itemView.findViewById(R.id.tv_capacity_through);
|
||||
}
|
||||
}
|
||||
|
||||
public interface setOnClick{
|
||||
void onClick(int position);
|
||||
}
|
||||
|
||||
@@ -150,11 +150,10 @@ public class CapacityMeasureAdapter extends RecyclerView.Adapter<CapacityMeasure
|
||||
super(itemView);
|
||||
llOption = itemView.findViewById(R.id.ll_option);
|
||||
tvMeasure = itemView.findViewById(R.id.tv_measure_text1);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* 获取被勾选的数据
|
||||
*/
|
||||
private void updateCheckedMap(String questionId, CompoundButton currentButton, ViewGroup group) {
|
||||
|
||||
@@ -60,7 +60,6 @@ public class ImagePagerAdapter extends PagerAdapter {
|
||||
View view = LayoutInflater.from(context).inflate(R.layout.details_imageshow_item, null);
|
||||
full_image = (ImageView)view.findViewById(R.id.full_image);
|
||||
Glide.with(context).load(impsUrl.get(position)).into(full_image);
|
||||
|
||||
((ViewPager) container).addView(view);
|
||||
return view;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@ public class IssueProblemAdapter extends RecyclerView.Adapter<IssueProblemAdapte
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
final View issueItem = LayoutInflater.from(context).inflate(R.layout.issue_problem_item, parent, false);
|
||||
|
||||
return new ViewHolder(issueItem);
|
||||
}
|
||||
|
||||
@@ -57,7 +56,6 @@ public class IssueProblemAdapter extends RecyclerView.Adapter<IssueProblemAdapte
|
||||
|
||||
static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
TextView tvIssue;
|
||||
|
||||
public ViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
tvIssue = itemView.findViewById(R.id.tv_issue_title);
|
||||
|
||||
@@ -29,13 +29,13 @@ public class MarkerAdapter extends RecyclerView.Adapter<MarkerAdapter.ViewHolder
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull @NotNull ViewGroup parent, int viewType) {
|
||||
public ViewHolder onCreateViewHolder( @NotNull ViewGroup parent, int viewType) {
|
||||
View inflate = LayoutInflater.from(context).inflate(R.layout.item_marker, parent, false);
|
||||
return new ViewHolder(inflate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull @NotNull ViewHolder holder, int position) {
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
PoiEntity poiEntity = poiEntities.get(position);
|
||||
if (poiEntity.getTaskStatus()==0||poiEntity.getTaskStatus()==1){
|
||||
switch (poiEntity.getType()){
|
||||
|
||||
@@ -31,15 +31,14 @@ public class MessageAdapter extends RecyclerView.Adapter<MessageAdapter.ViewHold
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@NotNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull @NotNull ViewGroup parent, int viewType) {
|
||||
public ViewHolder onCreateViewHolder( @NotNull ViewGroup parent, int viewType) {
|
||||
View inflate = LayoutInflater.from(context).inflate(R.layout.message_item, parent, false);
|
||||
return new ViewHolder(inflate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull @NotNull ViewHolder holder, int position) {
|
||||
public void onBindViewHolder( @NotNull ViewHolder holder, int position) {
|
||||
holder.tvMessageTitle.setText(messageList.get(position).getTitle());
|
||||
holder.tvMessageDest.setText(messageList.get(position).getSubtitle());
|
||||
holder.tvMessageTime.setText(messageList.get(position).getCreatetime());
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
package com.navinfo.outdoor.adapter;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -19,45 +22,77 @@ import com.navinfo.outdoor.R;
|
||||
import com.navinfo.outdoor.activity.ImageShowActivity;
|
||||
import com.navinfo.outdoor.activity.VideoActivity;
|
||||
import com.navinfo.outdoor.bean.FileBean;
|
||||
import com.navinfo.outdoor.room.PoiDatabase;
|
||||
import com.navinfo.outdoor.room.PoiEntity;
|
||||
import com.navinfo.outdoor.util.AWMp4ParserHelper;
|
||||
import com.navinfo.outdoor.util.PoiEntityDeleteUtil;
|
||||
import com.navinfo.outdoor.util.RotateTransformation;
|
||||
import com.navinfo.outdoor.util.SearchUpdateTxt;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
/* String[] split = fileBeans.get(i).getFile().getName().split(".webp");
|
||||
SearchUpdateTxt.initTxt(file.getAbsolutePath(),split[0]);*/
|
||||
|
||||
/**
|
||||
* 查看拍照成果的activity
|
||||
*/
|
||||
|
||||
public class PhotoAdapter extends RecyclerView.Adapter<PhotoAdapter.ViewHolder> {
|
||||
private List<FileBean> fileBeans;
|
||||
private final Vector<FileBean> fileBeans = new Vector<>();
|
||||
private Context context;
|
||||
private File file;
|
||||
|
||||
public PhotoAdapter(List<FileBean> files, Context context) {
|
||||
this.fileBeans = files;
|
||||
public PhotoAdapter(File file, Context context) {
|
||||
this.file = file;
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public void deleteFile(FileBean fileBeanList) {
|
||||
for (int i = 0; i < fileBeans.size(); i++) {
|
||||
String path = fileBeans.get(i).getFile().getPath();
|
||||
if (fileBeanList.getFile().getPath().equals(path)) {
|
||||
fileBeans.set(i,fileBeanList);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < fileBeans.size(); i++) {
|
||||
boolean check = fileBeans.get(i).isCheck();
|
||||
if (check){
|
||||
fileBeans.get(i).getFile().delete();
|
||||
fileBeans.remove(fileBeans.get(i));
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
public void setFileBeans(List<FileBean> allRoad) {
|
||||
this.fileBeans.clear();
|
||||
this.fileBeans.addAll(allRoad);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
//条目删除
|
||||
public void CheckedDelete() {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
synchronized (fileBeans) {
|
||||
Iterator<FileBean> iterator = fileBeans.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
FileBean fileBean = (FileBean) iterator.next();
|
||||
boolean check = fileBean.isCheck();
|
||||
if (check) {
|
||||
fileBean.getFile().delete();
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
handler.sendEmptyMessage(0x105);
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
Handler handler = new Handler() {
|
||||
@SuppressLint("HandlerLeak")
|
||||
@Override
|
||||
public void handleMessage(@NonNull @NotNull Message msg) {
|
||||
super.handleMessage(msg);
|
||||
switch (msg.what) {
|
||||
case 0x105:
|
||||
notifyDataSetChanged();
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
@@ -71,7 +106,7 @@ public class PhotoAdapter extends RecyclerView.Adapter<PhotoAdapter.ViewHolder>
|
||||
File file = fileBean.getFile();
|
||||
if (file.exists()) {
|
||||
AWMp4ParserHelper.getInstance().loadFirstWithGlide(context, Uri.fromFile(file).toString(), holder.ivPhoto, 500);
|
||||
// Glide.with(context).load(file).apply(RequestOptions.bitmapTransform(new RotateTransformation(0))).into(holder.ivPhoto);
|
||||
// Glide.with(context).load(file).apply(RequestOptions.bitmapTransform(new RotateTransformation(0))).into(holder.ivPhoto);
|
||||
}
|
||||
holder.ivPhoto.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
@@ -82,7 +117,7 @@ public class PhotoAdapter extends RecyclerView.Adapter<PhotoAdapter.ViewHolder>
|
||||
}
|
||||
Intent intent = new Intent(context, ImageShowActivity.class);
|
||||
intent.putExtra("info", arrayList);
|
||||
intent.putExtra("type",position);
|
||||
intent.putExtra("type", position);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
});
|
||||
@@ -90,10 +125,7 @@ public class PhotoAdapter extends RecyclerView.Adapter<PhotoAdapter.ViewHolder>
|
||||
holder.cbPhoto.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
if (photoClickItem != null) {
|
||||
fileBean.setCheck(isChecked);
|
||||
photoClickItem.item(isChecked, fileBean);
|
||||
}
|
||||
fileBean.setCheck(isChecked);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -107,7 +139,7 @@ public class PhotoAdapter extends RecyclerView.Adapter<PhotoAdapter.ViewHolder>
|
||||
private ImageView ivPhoto;
|
||||
private CheckBox cbPhoto;
|
||||
|
||||
public ViewHolder(@NonNull @NotNull View itemView) {
|
||||
public ViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
ivPhoto = itemView.findViewById(R.id.iv_photo);
|
||||
cbPhoto = itemView.findViewById(R.id.check_photo);
|
||||
|
||||
@@ -28,17 +28,17 @@ public class PoiTaskAdapter extends RecyclerView.Adapter<PoiTaskAdapter.ViewHold
|
||||
this.listBeans = listBeans;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull @NotNull ViewGroup parent, int viewType) {
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View inflate = LayoutInflater.from(context).inflate(R.layout.has_sumit_item, parent, false);
|
||||
return new ViewHolder(inflate);
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull @NotNull ViewHolder holder, int position) {
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
HasSubmitBean.BodyBean.ListBean listBean = listBeans.get(position);
|
||||
holder.tvnName.setText(listBean.getName());
|
||||
holder.tvTime.setText(listBean.getCreateTime());
|
||||
@@ -66,7 +66,7 @@ public class PoiTaskAdapter extends RecyclerView.Adapter<PoiTaskAdapter.ViewHold
|
||||
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
TextView tvnName, tvTime, tvMany, tvMassage, tvAuditStatus;
|
||||
|
||||
public ViewHolder(@NonNull @NotNull View itemView) {
|
||||
public ViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
tvnName = itemView.findViewById(R.id.tv_has_name);
|
||||
tvTime = itemView.findViewById(R.id.tv_createTime);
|
||||
|
||||
@@ -8,22 +8,18 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.navinfo.outdoor.R;
|
||||
import com.navinfo.outdoor.room.ChargingPileEntity;
|
||||
import com.navinfo.outdoor.room.PoiDatabase;
|
||||
import com.navinfo.outdoor.room.PoiEntity;
|
||||
import com.navinfo.outdoor.util.PoiEntityDeleteUtil;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
@@ -46,6 +42,7 @@ public class StaySubmitAdapter extends RecyclerView.Adapter<StaySubmitAdapter.Vi
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
|
||||
//全选
|
||||
public void setAllDataChecked(boolean isChecked) {
|
||||
for (PoiEntity entity : this.allRoad) {
|
||||
@@ -63,7 +60,8 @@ public class StaySubmitAdapter extends RecyclerView.Adapter<StaySubmitAdapter.Vi
|
||||
while (iterator.hasNext()) {
|
||||
PoiEntity poiEntity = (PoiEntity) iterator.next();
|
||||
if (poiEntity.isChecked()) {
|
||||
PoiEntityDeleteUtil.getInstance().deleteUtil(context,poiEntity);
|
||||
PoiEntityDeleteUtil.getInstance().deleteUtil(context, poiEntity);
|
||||
poiEntity.setChecked(false);
|
||||
poiEntity.setTaskStatus(100);
|
||||
PoiDatabase.getInstance(context).getPoiDao().updatePoiEntity(poiEntity);
|
||||
iterator.remove();
|
||||
@@ -75,16 +73,15 @@ public class StaySubmitAdapter extends RecyclerView.Adapter<StaySubmitAdapter.Vi
|
||||
}).start();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@NotNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull @NotNull ViewGroup parent, int viewType) {
|
||||
public ViewHolder onCreateViewHolder(@NotNull ViewGroup parent, int viewType) {
|
||||
View inflate = LayoutInflater.from(context).inflate(R.layout.stay_item, parent, false);
|
||||
return new ViewHolder(inflate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull @NotNull ViewHolder holder, int position) {
|
||||
public void onBindViewHolder(@NotNull ViewHolder holder, int position) {
|
||||
PoiEntity poiEntity = allRoad.get(position);
|
||||
holder.tvName.setText(poiEntity.getName());
|
||||
holder.tvDay.setText(poiEntity.getCreateTime());
|
||||
@@ -113,11 +110,10 @@ public class StaySubmitAdapter extends RecyclerView.Adapter<StaySubmitAdapter.Vi
|
||||
}
|
||||
|
||||
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
private TextView tvName;
|
||||
private TextView tvDay;
|
||||
private TextView tvName, tvDay;
|
||||
private CheckBox cbUnSubmit;
|
||||
|
||||
public ViewHolder(@NonNull @NotNull View itemView) {
|
||||
public ViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
tvName = itemView.findViewById(R.id.tv_road_name);
|
||||
tvDay = itemView.findViewById(R.id.tv_road_day);
|
||||
@@ -139,11 +135,9 @@ public class StaySubmitAdapter extends RecyclerView.Adapter<StaySubmitAdapter.Vi
|
||||
};
|
||||
|
||||
public onClickItem onClickItem;
|
||||
|
||||
public void setOnClickItem(StaySubmitAdapter.onClickItem onClickItem) {
|
||||
public void setOnClickItem(onClickItem onClickItem) {
|
||||
this.onClickItem = onClickItem;
|
||||
}
|
||||
|
||||
public interface onClickItem {
|
||||
void item(int position, PoiEntity allRoad);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TaskExplainAdapter2 extends RecyclerView.Adapter<TaskExplainAdapter2.ViewHolder2> {
|
||||
private List<TaskPrefectureBean.BodyBean.ListBean> explainList2 ;
|
||||
private List<TaskPrefectureBean.BodyBean.ListBean> explainList2;
|
||||
private Context context;
|
||||
|
||||
public TaskExplainAdapter2(List<TaskPrefectureBean.BodyBean.ListBean> explainList2, Context context) {
|
||||
|
||||
@@ -29,10 +29,10 @@ public class TaskPrefectureAdapter extends RecyclerView.Adapter<TaskPrefectureAd
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View mView = LayoutInflater.from(context).inflate(R.layout.task_prefecture_item, parent, false);
|
||||
//int parentHeight= parent.getHeight();
|
||||
// parent.getWidth();
|
||||
// ViewGroup.LayoutParams layoutParams = viewHolder.itemView.getLayoutParams();
|
||||
// layoutParams.height = (parentHeight/ 6);
|
||||
/* int parentHeight= parent.getHeight();
|
||||
parent.getWidth();
|
||||
ViewGroup.LayoutParams layoutParams = viewHolder.itemView.getLayoutParams();
|
||||
layoutParams.height = (parentHeight/ 6);*/
|
||||
return new ViewHolder(mView);
|
||||
}
|
||||
|
||||
@@ -58,9 +58,7 @@ public class TaskPrefectureAdapter extends RecyclerView.Adapter<TaskPrefectureAd
|
||||
}
|
||||
|
||||
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
TextView tvTitle;
|
||||
TextView tvDest;
|
||||
TextView tvTime;
|
||||
TextView tvTitle, tvDest, tvTime;
|
||||
public ViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
tvTitle=itemView.findViewById(R.id.tv_title);
|
||||
|
||||
@@ -101,6 +101,7 @@ public class VideoAdapter extends RecyclerView.Adapter<VideoAdapter.ViewHolder>
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return fileBeans.size();
|
||||
|
||||
@@ -32,26 +32,27 @@ public class WithdrawalAdapter extends RecyclerView.Adapter<WithdrawalAdapter.On
|
||||
public WithdrawalAdapter(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
public void withClearData(){
|
||||
if (dataBeans!=null){
|
||||
|
||||
public void withClearData() {
|
||||
if (dataBeans != null) {
|
||||
dataBeans.clear();
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@NotNull
|
||||
@Override
|
||||
public OnViewHolder onCreateViewHolder(@NonNull @NotNull ViewGroup parent, int viewType) {
|
||||
public OnViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View inflate = LayoutInflater.from(context).inflate(R.layout.task_prefecture_item, parent, false);
|
||||
return new OnViewHolder(inflate);
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull @NotNull OnViewHolder holder, int position) {
|
||||
public void onBindViewHolder(@NonNull OnViewHolder holder, int position) {
|
||||
if (dataBeans != null && dataBeans.size() > position) {
|
||||
WithdrawalBean.BodyBean.ListBean listBean = dataBeans.get(position);
|
||||
holder.tvTitle.setText(listBean.getExchangePrice()+"元");
|
||||
holder.tvTitle.setText(listBean.getExchangePrice() + "元");
|
||||
holder.tvTime.setText(listBean.getCommitDate());
|
||||
holder.tvDec.setText(listBean.getAdminConfirm() == 0 ? "未审核" : "已审核");
|
||||
}
|
||||
@@ -65,7 +66,7 @@ public class WithdrawalAdapter extends RecyclerView.Adapter<WithdrawalAdapter.On
|
||||
public static class OnViewHolder extends RecyclerView.ViewHolder {
|
||||
private TextView tvTitle, tvDec, tvTime;
|
||||
|
||||
public OnViewHolder(@NonNull @NotNull View itemView) {
|
||||
public OnViewHolder(@NotNull View itemView) {
|
||||
super(itemView);
|
||||
tvTitle = itemView.findViewById(R.id.tv_title);
|
||||
tvDec = itemView.findViewById(R.id.tv_dest);
|
||||
|
||||
@@ -39,6 +39,7 @@ public class Constant {
|
||||
//下载文件
|
||||
public static final String NABISCO_APk = ROOT_FOLDER + "/apk";
|
||||
public static String LOG_FOLDER = ROOT_FOLDER + "/log";
|
||||
public static String GPS_LOG_FOLDER = ROOT_FOLDER + "/gps_log";
|
||||
public static int TelLength = 0;
|
||||
|
||||
public static void initRootFolder(String userId) {
|
||||
@@ -166,7 +167,7 @@ public class Constant {
|
||||
public static SlidingUpPanelLayout SLIDING_LAYOUT = null;//設置
|
||||
public static boolean IS_FILTER_LIST_ITEM = true;//poi页面的查重
|
||||
public static TencentMap.OnMarkerClickListener markerClickListener = null;
|
||||
public static final String NAVIN_FO = "11.18";//版本日期
|
||||
public static final String NAVIN_FO = "11.25";//版本日期
|
||||
|
||||
//marker
|
||||
public static final BitmapDescriptor MARKER_POI_SHOW = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_show);
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
package com.navinfo.outdoor.base;
|
||||
|
||||
public interface BaseCallBack<T> {
|
||||
void onSuccess(T t);
|
||||
void onFail(String error);
|
||||
}
|
||||
@@ -52,6 +52,7 @@ public abstract class BaseDrawerFragment extends BaseFragment {
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initEvent() {
|
||||
super.initEvent();
|
||||
@@ -60,8 +61,8 @@ public abstract class BaseDrawerFragment extends BaseFragment {
|
||||
obtain.what = Constant.MAIN_BUTTON_VISITABLE;
|
||||
obtain.obj = View.GONE;
|
||||
EventBus.getDefault().post(obtain);
|
||||
|
||||
}
|
||||
|
||||
public void moveLatlng(LatLng latLng, TencentMap.CancelableCallback cancelableCallback) {
|
||||
CameraUpdate cameraSigma = CameraUpdateFactory.newCameraPosition(new CameraPosition(
|
||||
latLng, //中心点坐标,地图目标经纬度
|
||||
@@ -76,11 +77,9 @@ public abstract class BaseDrawerFragment extends BaseFragment {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onHiddenChanged(boolean hidden) {
|
||||
super.onHiddenChanged(hidden);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -97,6 +96,7 @@ public abstract class BaseDrawerFragment extends BaseFragment {
|
||||
MapManager.getInstance().getTencentMap().setOnMarkerClickListener(null);
|
||||
}
|
||||
}
|
||||
|
||||
public void setSlidingUpPanelLayout(SlidingUpPanelLayout slidingUpPanelLayout) {
|
||||
if (slidingUpPanelLayout!=null) {
|
||||
this.slidingPaneLayout = slidingUpPanelLayout;
|
||||
@@ -149,11 +149,11 @@ public abstract class BaseDrawerFragment extends BaseFragment {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
}
|
||||
|
||||
|
||||
protected abstract PoiEntity initPoiEntityByUI( PoiEntity entity);
|
||||
protected abstract PoiCheckResult checkPoiEntity(PoiEntity entity);
|
||||
protected abstract ChargingPileEntity initChargingPileEntityByUI( ChargingPileEntity entity);
|
||||
protected abstract PoiCheckResult checkChargingPileEntity(ChargingPileEntity entity);
|
||||
|
||||
public class PoiCheckResult {
|
||||
private int code; // 0 检查成功,1:失败
|
||||
private String msg;
|
||||
@@ -174,4 +174,5 @@ public abstract class BaseDrawerFragment extends BaseFragment {
|
||||
this.msg = msg;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -57,7 +57,6 @@ public abstract class BaseFragment extends Fragment implements FragmentBackHandl
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
package com.navinfo.outdoor.base;
|
||||
|
||||
public abstract class BaseMVPActivity <P extends BasePresenter,V extends BaseView> extends BaseActivity{
|
||||
protected P presenter;
|
||||
|
||||
@Override
|
||||
protected void initMVP() {
|
||||
super.initMVP();
|
||||
presenter= initMVPPresenter();
|
||||
if (presenter!=null){
|
||||
presenter.setView(initMVPView());
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract V initMVPView();
|
||||
|
||||
protected abstract P initMVPPresenter();
|
||||
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package com.navinfo.outdoor.base;
|
||||
|
||||
public abstract class BaseMVPFragment<P extends BasePresenter,V extends BaseView> extends BaseFragment{
|
||||
protected P presenter;
|
||||
|
||||
@Override
|
||||
protected void initMvp() {
|
||||
super.initMvp();
|
||||
presenter= initMVPPresenter();
|
||||
if (presenter!=null){
|
||||
presenter.setView(initMVPView());
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract V initMVPView();
|
||||
|
||||
protected abstract P initMVPPresenter();
|
||||
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
package com.navinfo.outdoor.base;
|
||||
|
||||
import io.reactivex.disposables.CompositeDisposable;
|
||||
|
||||
public abstract class BaseModel {
|
||||
private CompositeDisposable compositeDisposable;
|
||||
public void onDestroy(){
|
||||
if (compositeDisposable!=null){
|
||||
compositeDisposable.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
package com.navinfo.outdoor.base;
|
||||
|
||||
import android.net.ParseException;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.navinfo.outdoor.api.UserApplication;
|
||||
import com.google.gson.JsonParseException;
|
||||
|
||||
import org.json.JSONException;
|
||||
|
||||
import java.io.InterruptedIOException;
|
||||
import java.net.ConnectException;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
import io.reactivex.subscribers.ResourceSubscriber;
|
||||
import retrofit2.HttpException;
|
||||
|
||||
public abstract class BaseObserver<T> extends ResourceSubscriber <T> {
|
||||
@Override
|
||||
public void onNext(T t) {
|
||||
onSuccess(t);
|
||||
}
|
||||
public abstract void onSuccess(T t);
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("TAG", "error:" + e.getMessage());
|
||||
//对异常进行分类,不同的异常提示用户不同的信息
|
||||
if (e instanceof HttpException) {
|
||||
// HTTP错误
|
||||
onFail("HTTP错误");
|
||||
} else if (e instanceof ConnectException
|
||||
|| e instanceof UnknownHostException) {
|
||||
// 连接错误
|
||||
onFail("连接错误");
|
||||
} else if (e instanceof InterruptedIOException) {
|
||||
// 连接超时
|
||||
onFail("连接超时");
|
||||
} else if (e instanceof JsonParseException
|
||||
|| e instanceof JSONException
|
||||
|| e instanceof ParseException) {
|
||||
// 解析错误
|
||||
onFail("解析错误");
|
||||
} else {
|
||||
onFail(e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
protected void onFail(String error){
|
||||
Toast.makeText(UserApplication.getUserApplication(), error, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package com.navinfo.outdoor.base;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public abstract class BasePresenter<V extends BaseView> {
|
||||
protected V view;
|
||||
private ArrayList<BaseModel> list=new ArrayList<>();
|
||||
public void setView(V view) {
|
||||
this.view = view;
|
||||
}
|
||||
|
||||
public BasePresenter() {
|
||||
initModel();
|
||||
}
|
||||
public void onDestroy(){
|
||||
view=null;
|
||||
if (list.size()>0){
|
||||
for (BaseModel baseModel : list) {
|
||||
baseModel.onDestroy();
|
||||
}
|
||||
list.clear();
|
||||
}
|
||||
}
|
||||
public void addModel(BaseModel baseModel){
|
||||
list.add(baseModel);
|
||||
}
|
||||
protected abstract void initModel();
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
package com.navinfo.outdoor.base;
|
||||
|
||||
public interface BaseView<T> {
|
||||
void onSuccess(T t);
|
||||
void onFail(String error);
|
||||
}
|
||||
@@ -11,11 +11,12 @@ public class Collector {
|
||||
|
||||
public static void addActivity(Activity activity){
|
||||
activityList.add(activity);
|
||||
|
||||
}
|
||||
|
||||
public static void removeActivity(Activity activity) {
|
||||
activityList.remove(activity);
|
||||
}
|
||||
|
||||
public static void finishAll() {
|
||||
for (Activity activity : activityList) {
|
||||
if (!activity.isFinishing()) {
|
||||
|
||||
@@ -94,7 +94,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
private int sign_exist = 0;
|
||||
private int cp_availableState = 0;
|
||||
private String buffer1 = "", buffer2 = "", buffer3 = "", buffer4 = "", buffer5 = "";
|
||||
private StringBuffer openType = new StringBuffer();
|
||||
|
||||
private CheckBox checkButton1, checkButton2, checkButton3, checkButton4, checkButton5;
|
||||
private String pid;
|
||||
private String station;
|
||||
@@ -252,8 +252,8 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
chargingPileBuilder.append(TimestampUtil.time()).append(",").append("点击了checkButton2 的按钮,");
|
||||
if (isChecked) {
|
||||
buffer2 = "2,";
|
||||
checkButton1.setChecked(false);
|
||||
buffer2 = "2,";
|
||||
} else {
|
||||
buffer2 = "";
|
||||
}
|
||||
@@ -265,8 +265,8 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
chargingPileBuilder.append(TimestampUtil.time()).append(",").append("点击了checkButton3 的按钮,");
|
||||
if (isChecked) {
|
||||
buffer3 = "3,";
|
||||
checkButton1.setChecked(false);
|
||||
buffer3 = "3,";
|
||||
} else {
|
||||
buffer3 = "";
|
||||
}
|
||||
@@ -278,8 +278,8 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
chargingPileBuilder.append(TimestampUtil.time()).append(",").append("点击了checkButton4 的按钮,");
|
||||
if (isChecked) {
|
||||
buffer4 = "4,";
|
||||
checkButton1.setChecked(false);
|
||||
buffer4 = "4,";
|
||||
} else {
|
||||
buffer4 = "";
|
||||
}
|
||||
@@ -291,8 +291,8 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
chargingPileBuilder.append(TimestampUtil.time()).append(",").append("点击了checkButton5 的按钮,");
|
||||
if (isChecked) {
|
||||
buffer5 = "5,";
|
||||
checkButton1.setChecked(false);
|
||||
buffer5 = "5,";
|
||||
} else {
|
||||
buffer5 = "";
|
||||
}
|
||||
@@ -405,7 +405,6 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
rlScutcheon.setVisibility(View.VISIBLE);
|
||||
rlDevice.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
sign_exist = 1;
|
||||
break;
|
||||
}
|
||||
@@ -963,11 +962,11 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
private void disables() {
|
||||
checkBoxLife.setEnabled(false);
|
||||
tvNameContent.setEnabled(false);
|
||||
checkButton1.setEnabled(false);//开放状态1
|
||||
/*checkButton1.setEnabled(false);//开放状态1
|
||||
checkButton2.setEnabled(false);//开放状态2
|
||||
checkButton3.setEnabled(false);//开放状态3
|
||||
checkButton4.setEnabled(false);//开放状态4
|
||||
checkButton5.setEnabled(false);//开放状态5
|
||||
checkButton5.setEnabled(false);//开放状态5*/
|
||||
spinnerType.setEnabled(false);//充电地面层
|
||||
rlPanorama.setEnabled(false);//全景照片
|
||||
rlCoding.setEnabled(false);//充电桩编码
|
||||
@@ -1011,7 +1010,6 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
super.initData();
|
||||
@@ -1239,15 +1237,13 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
}).build();
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
initPileSharePre();
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* 防止当页面崩溃后出现数据丢失
|
||||
*/
|
||||
public void initPileSharePre() {
|
||||
@@ -1510,14 +1506,16 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
chargingPileEntity.setFid(pid);
|
||||
}
|
||||
if (buffer1 != null && !buffer1.equals("")) {
|
||||
chargingPileEntity.setCp_openType(buffer1);
|
||||
String substring = buffer1.substring(0, buffer1.length() - 1);
|
||||
chargingPileEntity.setCp_openType(substring);
|
||||
} else {
|
||||
StringBuffer openType = new StringBuffer();
|
||||
openType.reverse();
|
||||
openType.append(buffer2);
|
||||
openType.append(buffer3);
|
||||
openType.append(buffer4);
|
||||
openType.append(buffer5);
|
||||
if (openType != null && !"".contentEquals(openType) && openType.length() > 0) {
|
||||
if ( !"".contentEquals(openType) && openType.length() > 0) {
|
||||
String charAt = openType.deleteCharAt(openType.length() - 1).toString();
|
||||
chargingPileEntity.setCp_openType(charAt);
|
||||
} else {
|
||||
@@ -1551,7 +1549,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
return poiCheckResult;
|
||||
}
|
||||
if (exist == 0) {
|
||||
if (entity.getCp_openType() == null) {
|
||||
if (entity.getCp_openType() == null||entity.getCp_openType().equals("")) {
|
||||
poiCheckResult.setCode(1);
|
||||
poiCheckResult.setMsg("开放状态未勾选");
|
||||
return poiCheckResult;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.navinfo.outdoor.fragment;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
@@ -559,7 +560,6 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
file.delete();
|
||||
tvInternal.setTag(null);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
});
|
||||
@@ -1008,28 +1008,53 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
}
|
||||
}
|
||||
if (Constant.isPresent) {
|
||||
if (showPoiEntity == null) {
|
||||
showPoiEntity = new PoiEntity();
|
||||
}
|
||||
if (showPoiEntity.getTaskStatus() == 0 || showPoiEntity.getTaskStatus() == 1 || showPoiEntity.getTaskStatus() == 2 || showPoiEntity.getTaskStatus() == 5) {
|
||||
initRoadSaveLocal(true);
|
||||
} else {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
PoiEntity poiDaoPoiEntity = PoiDatabase.getInstance(getContext()).getPoiDao().getPoiEntity(showPoiEntity.getId());
|
||||
// 首先批量保存充电站对应的充电桩数据
|
||||
saveChargingPileByChargingStation(showPoiEntity);
|
||||
Objects.requireNonNull(getActivity()).runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
stationUploadByNetWork(poiDaoPoiEntity, chargingStationList);
|
||||
Constant.isPresent = false;
|
||||
}
|
||||
});
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (showPoiEntity == null) {
|
||||
showPoiEntity = new PoiEntity();
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
PoiEntity poiEntity = PoiDatabase.getInstance(getContext()).getPoiDao().getPoiEntity(showPoiEntity.getId());
|
||||
if (poiEntity == null) {
|
||||
if (showPoiEntity.getTaskStatus() == 0 || showPoiEntity.getTaskStatus() == 1 || showPoiEntity.getTaskStatus() == 2 || showPoiEntity.getTaskStatus() == 5) {
|
||||
Objects.requireNonNull(getActivity()).runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
initRoadSaveLocal(true);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
saveChargingPileByChargingStation(showPoiEntity);
|
||||
Objects.requireNonNull(getActivity()).runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
stationUploadByNetWork(showPoiEntity, chargingStationList);
|
||||
Constant.isPresent = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
if (poiEntity.getTaskStatus() == 0 || poiEntity.getTaskStatus() == 1 || poiEntity.getTaskStatus() == 2 || poiEntity.getTaskStatus() == 5) {
|
||||
Objects.requireNonNull(getActivity()).runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
initRoadSaveLocal(true);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
saveChargingPileByChargingStation(poiEntity);
|
||||
Objects.requireNonNull(getActivity()).runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
stationUploadByNetWork(poiEntity, chargingStationList);
|
||||
Constant.isPresent = false;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
} else {
|
||||
Toast.makeText(getContext(), "该任务正在提交中", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
@@ -1113,49 +1138,6 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 上传充电桩数据
|
||||
*/
|
||||
private void chargingPileUploadNetWork(ChargingPileEntity chargingPileEntity) {
|
||||
if (chargingPileEntity == null || chargingPileEntity.getBodyId() == 0) {
|
||||
Toast.makeText(getActivity(), "没有保存本地", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
List<File> chargingPileFileList = new ArrayList<>();
|
||||
if (chargingPileEntity.getPhotos() != null && !chargingPileEntity.getPhotos().isEmpty()) {
|
||||
for (String photoPath : chargingPileEntity.getPhotos()) {
|
||||
chargingPileFileList.add(new File(photoPath));
|
||||
}
|
||||
}
|
||||
try {
|
||||
HttpParams httpParams = new HttpParams();
|
||||
httpParams.put("auditId", chargingPileEntity.getBodyId());
|
||||
Response execute = OkGoBuilder.getInstance()
|
||||
.time(0)
|
||||
.url(HttpInterface.CS_TASK_UP_LOAD_PIC)
|
||||
.params(httpParams)
|
||||
.token(Constant.ACCESS_TOKEN)
|
||||
.fileList(chargingPileFileList)
|
||||
.postFileSynchronization();
|
||||
if (execute != null) {
|
||||
assert execute.body() != null;
|
||||
String pileUpLoadResultStr = execute.body().string();
|
||||
PoiUploadBean uploadBeanResult = new Gson().fromJson(pileUpLoadResultStr, PoiUploadBean.class);
|
||||
if (uploadBeanResult != null) {
|
||||
if (uploadBeanResult.getCode() == 200) {
|
||||
// PoiDatabase.getInstance(getActivity()).getChargingPileDao().deleteChargingPileEntity(chargingPileEntity);
|
||||
for (int i = 0; i < chargingPileFileList.size(); i++) {
|
||||
chargingPileFileList.get(i).delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void initRoadSaveLocal(boolean isLocal) {
|
||||
XXPermissions.with(this)
|
||||
//读写权限
|
||||
@@ -1227,47 +1209,104 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
if (getActivity() != null) {
|
||||
okGoBuilder.getRequest(PreserveUtils.getInstance().getChargingPreserveCallback(getActivity(), poiEntity));
|
||||
getActivity().getSupportFragmentManager().popBackStack();//回退
|
||||
WaitDialog.show((AppCompatActivity) getActivity(), "任务正在后台保存中,请稍候...");
|
||||
WaitDialog.show((AppCompatActivity) getActivity(), "任务已保存本地,请稍后");
|
||||
WaitDialog.dismiss(1000);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 根据充电站数据检查充电桩数据,如果没有网络保存,则批量网络上传
|
||||
*/
|
||||
private void saveChargingPileUploadChargingStation(PoiEntity chargingStationPoiEntity) {
|
||||
if (chargingStationPoiEntity != null) {
|
||||
// 首先批量上传充电桩数据
|
||||
List<ChargingPileEntity> chargingPileEntityList = PoiDatabase.getInstance(getActivity()).getChargingPileDao().getChargingPileByStationId(chargingStationPoiEntity.getId());
|
||||
if (chargingPileEntityList != null && !chargingPileEntityList.isEmpty()) {
|
||||
for (ChargingPileEntity chargingPileEntity : chargingPileEntityList) {
|
||||
if (chargingPileEntity.getBodyId() != 0) {
|
||||
chargingPileUploadNetWork(chargingPileEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 上传充电桩数据
|
||||
*/
|
||||
private void chargingPileUploadNetWork(ChargingPileEntity chargingPileEntity) {
|
||||
List<File> chargingPileFileList = new ArrayList<>();
|
||||
if (chargingPileEntity.getPhotos() != null && !chargingPileEntity.getPhotos().isEmpty()) {
|
||||
for (String photoPath : chargingPileEntity.getPhotos()) {
|
||||
chargingPileFileList.add(new File(photoPath));
|
||||
}
|
||||
}
|
||||
try {
|
||||
HttpParams httpParams = new HttpParams();
|
||||
httpParams.put("auditId", chargingPileEntity.getBodyId());
|
||||
Response execute = OkGoBuilder.getInstance()
|
||||
.time(0)
|
||||
.url(HttpInterface.CS_TASK_UP_LOAD_PIC)
|
||||
.params(httpParams)
|
||||
.token(Constant.ACCESS_TOKEN)
|
||||
.fileList(chargingPileFileList)
|
||||
.postFileSynchronization();
|
||||
if (execute != null) {
|
||||
assert execute.body() != null;
|
||||
String pileUpLoadResultStr = execute.body().string();
|
||||
PoiUploadBean uploadBeanResult = new Gson().fromJson(pileUpLoadResultStr, PoiUploadBean.class);
|
||||
if (uploadBeanResult != null) {
|
||||
if (uploadBeanResult.getCode() == 200) {
|
||||
PoiDatabase.getInstance(getActivity()).getChargingPileDao().deleteChargingPileEntity(chargingPileEntity);
|
||||
for (int i = 0; i < chargingPileFileList.size(); i++) {
|
||||
chargingPileFileList.get(i).delete();
|
||||
}
|
||||
Log.d("TAGSS", "chargingPileUploadNetWork: 充电桩" + chargingPileEntity.getName() + "上传成功");
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void stationUploadByNetWork(PoiEntity poiEntity, ArrayList<File> chargingStationList) {
|
||||
if (poiEntity == null) {
|
||||
Toast.makeText(getActivity(), "没有保存本地", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
showLoadingDialog();
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// 首先批量上传充电桩数据
|
||||
List<ChargingPileEntity> chargingPileEntityList = PoiDatabase.getInstance(getActivity()).getChargingPileDao().getChargingPileByStationId(poiEntity.getId());
|
||||
if (chargingPileEntityList != null && !chargingPileEntityList.isEmpty()) {
|
||||
for (ChargingPileEntity chargingPileEntity : chargingPileEntityList) {
|
||||
if (chargingPileEntity.getBodyId() != 0) {
|
||||
chargingPileUploadNetWork(chargingPileEntity);
|
||||
saveChargingPileUploadChargingStation(poiEntity);
|
||||
if (getActivity() != null) {
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
dismissLoadingDialog();
|
||||
HttpParams httpParams = new HttpParams();
|
||||
httpParams.put("auditId", poiEntity.getBodyId());
|
||||
OkGoBuilder okGoBuilder = OkGoBuilder.getInstance()
|
||||
.time(0)
|
||||
.Builder(getActivity())
|
||||
.url(HttpInterface.C_TASK_UP_LOAD_PIC)
|
||||
.cls(PoiUploadBean.class)
|
||||
.fileList(chargingStationList)
|
||||
.token(Constant.ACCESS_TOKEN)
|
||||
.params(httpParams);
|
||||
okGoBuilder.postFileAsynchronous(UploadUtils.getInstance().getChargingUploadCallback(getActivity(), showPoiEntity, chargingStationList));
|
||||
getActivity().getSupportFragmentManager().popBackStack();//回退
|
||||
Log.d("TAGSS", "stationUploadByNetWork: 充电站" + poiEntity.getName() + "上传成功");
|
||||
WaitDialog.show((AppCompatActivity) getActivity(), "任务正在后台上传中,请稍候...");
|
||||
WaitDialog.dismiss(3000);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
HttpParams httpParams = new HttpParams();
|
||||
httpParams.put("auditId", poiEntity.getBodyId());
|
||||
OkGoBuilder okGoBuilder = OkGoBuilder.getInstance()
|
||||
.time(0)
|
||||
.Builder(getActivity())
|
||||
.url(HttpInterface.C_TASK_UP_LOAD_PIC)
|
||||
.fileList(chargingStationList)
|
||||
.token(Constant.ACCESS_TOKEN)
|
||||
.params(httpParams)
|
||||
.cls(PoiUploadBean.class);
|
||||
if (getActivity() != null) {
|
||||
okGoBuilder.postFileAsynchronous(UploadUtils.getInstance().getChargingUploadCallback(getActivity(), showPoiEntity, chargingStationList));
|
||||
getActivity().getSupportFragmentManager().popBackStack();//回退
|
||||
WaitDialog.show((AppCompatActivity) getActivity(), "任务正在后台上传中,请稍候...");
|
||||
WaitDialog.dismiss(3000);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1310,6 +1349,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Log.d("TAGSS", "run:充电站 保存成功");
|
||||
stationUploadByNetWork(poiEntity, chargingStationList);
|
||||
Constant.isPresent = false;
|
||||
}
|
||||
@@ -1581,6 +1621,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
httpParams.put("memo", chargingPileEntity.getMemo());
|
||||
httpParams.put("ffid", bodyId);
|
||||
HashMap<String, Object> hashMap = new HashMap<>();
|
||||
hashMap.clear();
|
||||
hashMap.put("cp_openType", chargingPileEntity.getCp_openType());
|
||||
hashMap.put("cp_floor", chargingPileEntity.getCp_floor());
|
||||
hashMap.put("cp_availableState", chargingPileEntity.getCp_availableState());
|
||||
@@ -1600,9 +1641,12 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
ChargingPileSaveBean chargingPileSaveBean = gson.fromJson(responseBodyStr, ChargingPileSaveBean.class);
|
||||
if (chargingPileSaveBean.getCode() != 200) {
|
||||
return;
|
||||
} else {
|
||||
chargingPileEntity.setBodyId(chargingPileSaveBean.getBody());
|
||||
InsertAndUpdateUtils.getInstance().insertOrUpdateChargingPile(getActivity(), chargingPileEntity); // 更新当前充电桩的bodyId
|
||||
Log.d("TAGSS", "saveChargingPileByWork: 充电桩" + chargingPileEntity.getName() + "保存成功");
|
||||
}
|
||||
chargingPileEntity.setBodyId(chargingPileSaveBean.getBody());
|
||||
InsertAndUpdateUtils.getInstance().insertOrUpdateChargingPile(getActivity(), chargingPileEntity); // 更新当前充电桩的bodyId
|
||||
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
@@ -1692,9 +1736,10 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
poiEntity.setChecked(false);
|
||||
poiEntity.setTaskStatus(100);
|
||||
PoiDatabase.getInstance(getContext()).getPoiDao().updatePoiEntity(poiEntity);
|
||||
/* if (showPoiEntity != null) {
|
||||
if (showPoiEntity != null) {
|
||||
List<ChargingPileEntity> chargingPileEntityList = PoiDatabase.getInstance(getActivity()).getChargingPileDao().getChargingPileByStationId(showPoiEntity.getId());
|
||||
if (chargingPileEntityList != null && !chargingPileEntityList.isEmpty()) {
|
||||
for (ChargingPileEntity chargingPileEntity : chargingPileEntityList) {
|
||||
@@ -1710,10 +1755,10 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
//initList();
|
||||
initList();
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.JOB_WORD_MONITOR;
|
||||
obtain.obj = true;
|
||||
|
||||
@@ -15,8 +15,6 @@ import java.util.Objects;
|
||||
* 联系我们的Fragment
|
||||
*/
|
||||
public class ContactFragment extends BaseFragment implements View.OnClickListener {
|
||||
|
||||
|
||||
public static ContactFragment newInstance(Bundle bundle) {
|
||||
ContactFragment fragment = new ContactFragment();
|
||||
fragment.setArguments(bundle);
|
||||
|
||||
@@ -165,9 +165,9 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
|
||||
poiEntity.setName(list.get(i).getName());
|
||||
poiEntity.setGeoWkt(list.get(i).getGeo());
|
||||
poiEntity.setAddress(list.get(i).getAddress());
|
||||
poiEntity.setTelPhone(list.get(i).getTelephone() + "");
|
||||
poiEntity.setPrecision(list.get(i).getPrice() + "");
|
||||
poiEntity.setDist(list.get(i).getDist() + "");
|
||||
poiEntity.setTelPhone(String.valueOf(list.get(i).getTelephone()));
|
||||
poiEntity.setPrecision(String.valueOf(list.get(i).getPrice()));
|
||||
poiEntity.setDist(String.valueOf(list.get(i).getDist()));
|
||||
poiEntity.setType(list.get(i).getType());
|
||||
poiEntity.setRecord_way(list.get(i).getCanReceived());
|
||||
poiEntity.setIsExclusive(list.get(i).getIsExclusive());
|
||||
@@ -278,11 +278,6 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
|
||||
}else if (Constant.TASK_STARTUP ==2){
|
||||
tvType.setText("已领取(网络)");
|
||||
}
|
||||
/* else if (Constant.TASK_STATUS == 2) {
|
||||
tvType.setText("未保存");
|
||||
} else if (Constant.TASK_STATUS == 3) {
|
||||
tvType.setText("已保存");
|
||||
}*/
|
||||
Button btnFilter = findViewById(R.id.btn_filter);
|
||||
btnFilter.setOnClickListener(this);
|
||||
checkOk = findViewById(R.id.check_ok);
|
||||
|
||||
@@ -16,6 +16,7 @@ import android.widget.Toast;
|
||||
|
||||
import com.github.lazylibrary.util.FileUtils;
|
||||
import com.lzy.okgo.model.HttpParams;
|
||||
import com.lzy.okgo.model.Progress;
|
||||
import com.navinfo.outdoor.R;
|
||||
import com.navinfo.outdoor.activity.FragmentManagement;
|
||||
import com.navinfo.outdoor.activity.LoginActivity;
|
||||
@@ -26,6 +27,7 @@ import com.navinfo.outdoor.bean.UserBean;
|
||||
import com.navinfo.outdoor.http.Callback;
|
||||
import com.navinfo.outdoor.http.HttpInterface;
|
||||
import com.navinfo.outdoor.http.OkGoBuilder;
|
||||
import com.navinfo.outdoor.http.UploadCallBack;
|
||||
import com.navinfo.outdoor.util.Base64;
|
||||
import com.navinfo.outdoor.util.RegexUtil;
|
||||
import com.navinfo.outdoor.util.TimestampUtil;
|
||||
@@ -176,7 +178,7 @@ public class ForgetPawFragment extends BaseFragment implements View.OnClickListe
|
||||
.token(null)
|
||||
.params(httpParams)
|
||||
.cls(UserBean.class)
|
||||
.postRequest(new Callback<UserBean>() {
|
||||
.postRequest(new UploadCallBack<UserBean>() {
|
||||
@Override
|
||||
public void onSuccess(UserBean response, int id) {
|
||||
dismissLoadingDialog();
|
||||
@@ -194,6 +196,11 @@ public class ForgetPawFragment extends BaseFragment implements View.OnClickListe
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadProgress(Progress progress) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e, int id) {
|
||||
dismissLoadingDialog();
|
||||
|
||||
@@ -41,6 +41,7 @@ import com.navinfo.outdoor.util.FlushTokenUtil;
|
||||
import com.navinfo.outdoor.util.Geohash;
|
||||
import com.navinfo.outdoor.util.GeometryTools;
|
||||
import com.navinfo.outdoor.util.TimestampUtil;
|
||||
import com.tencent.lbssearch.httpresponse.Poi;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
||||
import com.vividsolutions.jts.geom.Geometry;
|
||||
|
||||
@@ -271,6 +272,17 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
case R.id.btn_gather://立即采集
|
||||
gatherGetBuilder.append(TimestampUtil.time()).append(",").append("点击了立即采集的按钮 ,");
|
||||
//如果是领取的任务或者是新得任务就只能在当前用户位置方圆5000以内才可以使用
|
||||
if (poiEntity.getType()== 3 || poiEntity.getType() == 4) {
|
||||
//判断当前的信号强度
|
||||
int gpsRssi = Constant.currentLocation.getGPSRssi();
|
||||
if (gpsRssi == 0) {//无信号
|
||||
Toast.makeText(getActivity(), "无信号,无法作业", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else if (gpsRssi == 1) {//信号弱
|
||||
Toast.makeText(getActivity(), "无信号,无法作业", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (poiEntity.getTaskStatus() < 2) {
|
||||
double latitude = Constant.currentLocation.getLatitude();
|
||||
double longitude = Constant.currentLocation.getLongitude();
|
||||
@@ -279,6 +291,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
double geometry = GeometryTools.distanceToDouble(startLatLng, endLatLng);
|
||||
if (geometry > 5000) {
|
||||
Toast.makeText(getActivity(), "作业不在领取范围内,无法领取", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
if (geometry > 50) {
|
||||
// Voice.sprat("注意在附近50米范围内进行采集",0);
|
||||
@@ -307,6 +320,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
poiEntity.setChecked(false);
|
||||
poiEntity.setTaskStatus(100);
|
||||
PoiDatabase.getInstance(getContext()).getPoiDao().updatePoiEntity(poiEntity);
|
||||
Objects.requireNonNull(getActivity()).runOnUiThread(new Runnable() {
|
||||
@@ -370,7 +384,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
PoiEntity taskIdPoiEntity = PoiDatabase.getInstance(getContext()).getPoiDao().getTaskIdPoiEntity(poiEntity.getTaskId());
|
||||
PoiEntity taskIdPoiEntity = PoiDatabase.getInstance(getContext()).getPoiDao().getPoiEntity(poiEntity.getId());
|
||||
if (taskIdPoiEntity == null) {
|
||||
PoiEntity chargingStationEntity = new PoiEntity();
|
||||
chargingStationEntity.setTaskId(poiEntity.getTaskId());
|
||||
@@ -419,7 +433,6 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
}
|
||||
InsertAndUpdateUtils.getInstance().insertOrUpdateChargingPile(getContext(), chargingPileEntityList);
|
||||
}
|
||||
// senMessageMarker(chargingStationEntity.getType(), chargingStationEntity.getY(), chargingStationEntity.getX());
|
||||
if (statusId == 1 || statusId == 5) {
|
||||
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), chargingStationEntity);
|
||||
}
|
||||
@@ -621,6 +634,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
poiEntity.setChecked(false);
|
||||
poiEntity.setTaskStatus(100);
|
||||
PoiDatabase.getInstance(getContext()).getPoiDao().updatePoiEntity(poiEntity);
|
||||
/* if (poiEntity.getType() == 2) {
|
||||
@@ -716,7 +730,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
} else if (response.getCode() == 230) {
|
||||
FlushTokenUtil.flushToken(getActivity());
|
||||
} else {
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
Objects.requireNonNull(getActivity()).runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Toast.makeText(getActivity(), "" + response.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
@@ -765,6 +779,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
poiEntity.setChecked(false);
|
||||
poiEntity.setTaskStatus(100);
|
||||
PoiDatabase.getInstance(getContext()).getPoiDao().updatePoiEntity(poiEntity);
|
||||
}
|
||||
@@ -772,7 +787,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
} else if (response.getCode() == 230) {
|
||||
FlushTokenUtil.flushToken(getActivity());
|
||||
} else {
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
Objects.requireNonNull(getActivity()).runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Toast.makeText(getActivity(), "" + response.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
@@ -821,7 +836,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
PoiEntity taskIdPoiEntity = PoiDatabase.getInstance(getContext()).getPoiDao().getTaskIdPoiEntity(poiEntity.getTaskId());
|
||||
PoiEntity taskIdPoiEntity = PoiDatabase.getInstance(getContext()).getPoiDao().getPoiEntity(poiEntity.getId());
|
||||
if (taskIdPoiEntity == null) {//数据库没有这条数据
|
||||
ReceivedPoiBean.BodyBean listBean = response.getBody();
|
||||
PoiEntity poiListEntity = new PoiEntity();
|
||||
@@ -859,7 +874,6 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
poiListEntity.setY(latLineString.get(0).latitude + "");
|
||||
break;
|
||||
}
|
||||
//senMessageMarker(poiEntity.getType(), poiEntity.getY(), poiEntity.getX());
|
||||
if (statusId == 1 || statusId == 5) {
|
||||
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiListEntity);
|
||||
}
|
||||
@@ -910,7 +924,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
} else if (response.getCode() == 230) {
|
||||
FlushTokenUtil.flushToken(getActivity());
|
||||
} else {
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
Objects.requireNonNull(getActivity()).runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Toast.makeText(getActivity(), "" + response.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
@@ -965,7 +979,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
PoiEntity taskIdPoiEntity = PoiDatabase.getInstance(getContext()).getPoiDao().getTaskIdPoiEntity(poiEntity.getTaskId());
|
||||
PoiEntity taskIdPoiEntity = PoiDatabase.getInstance(getContext()).getPoiDao().getPoiEntity(poiEntity.getId());
|
||||
if (taskIdPoiEntity == null) {//数据库没有这条数据
|
||||
PoiEntity poiListEntity = new PoiEntity();
|
||||
poiListEntity.setTaskId(poiEntity.getTaskId());
|
||||
@@ -995,7 +1009,6 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
||||
poiListEntity.setY(latLineString.get(0).latitude + "");
|
||||
break;
|
||||
}
|
||||
//senMessageMarker(poiEntity.getType(), poiEntity.getY(), poiEntity.getX());
|
||||
if (statusId == 1 || statusId == 5) {
|
||||
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiListEntity);
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ import com.kongzue.dialog.util.BaseDialog;
|
||||
import com.kongzue.dialog.util.DialogSettings;
|
||||
import com.kongzue.dialog.v3.MessageDialog;
|
||||
import com.lzy.okgo.model.HttpParams;
|
||||
import com.lzy.okgo.model.Progress;
|
||||
import com.navinfo.outdoor.R;
|
||||
import com.navinfo.outdoor.activity.PhotographActivity;
|
||||
import com.navinfo.outdoor.adapter.BankAdapter;
|
||||
@@ -45,6 +46,7 @@ import com.navinfo.outdoor.bean.BankPhoneBean;
|
||||
import com.navinfo.outdoor.http.Callback;
|
||||
import com.navinfo.outdoor.http.HttpInterface;
|
||||
import com.navinfo.outdoor.http.OkGoBuilder;
|
||||
import com.navinfo.outdoor.http.UploadCallBack;
|
||||
import com.navinfo.outdoor.util.FlushTokenUtil;
|
||||
import com.navinfo.outdoor.util.GetJsonDataUtil;
|
||||
import com.navinfo.outdoor.util.PhotoUtils;
|
||||
@@ -276,7 +278,7 @@ public class GatheringFragment extends BaseFragment implements View.OnClickListe
|
||||
.token(Constant.ACCESS_TOKEN)
|
||||
.params(httpParams)
|
||||
.fileList(gatheringList);
|
||||
okGoBuilder.postFileAsynchronous(new Callback<BankPhoneBean>() {
|
||||
okGoBuilder.postFileAsynchronous(new UploadCallBack<BankPhoneBean>() {
|
||||
@Override
|
||||
public void onSuccess(BankPhoneBean response, int id) {
|
||||
dismissLoadingDialog();
|
||||
@@ -303,6 +305,12 @@ public class GatheringFragment extends BaseFragment implements View.OnClickListe
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadProgress(Progress progress) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e, int id) {
|
||||
dismissLoadingDialog();
|
||||
|
||||
@@ -18,6 +18,7 @@ public class GradeFragment extends BaseFragment implements View.OnClickListener{
|
||||
fragment.setArguments(bundle);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayout() {
|
||||
return R.layout.grade_fragment;
|
||||
@@ -28,12 +29,12 @@ public class GradeFragment extends BaseFragment implements View.OnClickListener{
|
||||
super.initData();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
ImageView ivGrade = findViewById(R.id.iv_grade);
|
||||
super.initView();
|
||||
ivGrade.setOnClickListener(this);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -42,4 +43,5 @@ public class GradeFragment extends BaseFragment implements View.OnClickListener{
|
||||
Objects.requireNonNull(getActivity()).finish();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ import java.util.Objects;
|
||||
* 记录-已提交
|
||||
*/
|
||||
public class HasSubmitFragment extends BaseFragment implements View.OnClickListener {
|
||||
private TextView auditProcess, auditThrough, auditNotThrough, chargingAuditProcess, chargingAuditThrough, chargingAuditNotThrough, roadAuditProcess, roadAuditThrough, roadAuditNotThrough, otherAuditProcess, otherAuditThrough, otherAuditNotThrough, poiVideoAuditProcess, poiVideoAuditThrough, poiVideoAuditProcessAbleNotThrough;
|
||||
private TextView auditProcess, auditThrough, auditNotThrough, chargingAuditProcess, chargingAuditThrough, chargingAuditNotThrough, roadAuditProcess, roadAuditThrough, roadAuditNotThrough, otherAuditProcess, otherAuditThrough, otherAuditNotThrough, poiVideoAuditProcess, poiVideoAuditThrough, poiVideoAuditNotThrough;
|
||||
private StringBuilder hasSubmitBuilder;
|
||||
private File logFile;
|
||||
private HasSubmitBean.BodyBean hasSubmitBeanBody;
|
||||
@@ -80,26 +80,30 @@ public class HasSubmitFragment extends BaseFragment implements View.OnClickListe
|
||||
auditProcess = findViewById(R.id.audit_process);
|
||||
auditThrough = findViewById(R.id.audit_through);
|
||||
auditNotThrough = findViewById(R.id.audit_not_through);
|
||||
|
||||
ConstraintLayout clRoad = findViewById(R.id.cl_road);
|
||||
clRoad.setOnClickListener(this);
|
||||
roadAuditProcess = findViewById(R.id.road_audit_process);
|
||||
roadAuditThrough = findViewById(R.id.road_audit_through);
|
||||
roadAuditNotThrough = findViewById(R.id.road_audit_not_through);
|
||||
|
||||
ConstraintLayout clCharging = findViewById(R.id.cl_charging);
|
||||
clCharging.setOnClickListener(this);
|
||||
chargingAuditProcess = findViewById(R.id.charging_audit_process);
|
||||
chargingAuditThrough = findViewById(R.id.charging_audit_through);
|
||||
chargingAuditNotThrough = findViewById(R.id.charging_audit_not_through);
|
||||
|
||||
ConstraintLayout clOther = findViewById(R.id.cl_other);
|
||||
clOther.setOnClickListener(this);
|
||||
otherAuditProcess = findViewById(R.id.other_audit_process);
|
||||
otherAuditThrough = findViewById(R.id.other_audit_through);
|
||||
otherAuditNotThrough = findViewById(R.id.other_audit_not_through);
|
||||
|
||||
ConstraintLayout clPoiVideo = findViewById(R.id.cl_poiVideo);
|
||||
clPoiVideo.setOnClickListener(this);
|
||||
poiVideoAuditProcess = findViewById(R.id.poiVideo_audit_process);
|
||||
poiVideoAuditThrough = findViewById(R.id.poiVideo_audit_through);
|
||||
poiVideoAuditProcessAbleNotThrough = findViewById(R.id.poiVideo_audit_process_audit_not_through);
|
||||
poiVideoAuditNotThrough = findViewById(R.id.poiVideo_audit_not_through);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -182,7 +186,6 @@ public class HasSubmitFragment extends BaseFragment implements View.OnClickListe
|
||||
String message = e.getMessage();
|
||||
assert message != null;
|
||||
if (message.equals("timeout") || message.equals("Read time out")) {
|
||||
|
||||
if (getActivity() != null) {
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
@@ -192,7 +195,6 @@ public class HasSubmitFragment extends BaseFragment implements View.OnClickListe
|
||||
});
|
||||
}
|
||||
} else {
|
||||
|
||||
if (getActivity() != null) {
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
@@ -377,7 +379,7 @@ public class HasSubmitFragment extends BaseFragment implements View.OnClickListe
|
||||
public void run() {
|
||||
poiVideoAuditProcess.setText(hasSubmitBeanBody.getAuditingCount() + "");
|
||||
poiVideoAuditThrough.setText(hasSubmitBeanBody.getPassCount() + "");
|
||||
poiVideoAuditProcessAbleNotThrough.setText(hasSubmitBeanBody.getNotPassCount() + "");
|
||||
poiVideoAuditNotThrough.setText(hasSubmitBeanBody.getNotPassCount() + "");
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -543,7 +545,6 @@ public class HasSubmitFragment extends BaseFragment implements View.OnClickListe
|
||||
roadIntent.putExtra("type", 4);
|
||||
startActivity(roadIntent);
|
||||
break;
|
||||
|
||||
case R.id.cl_charging:
|
||||
hasSubmitBuilder.append(TimestampUtil.time()).append(",").append("点击了charging item跳转到charging列表 ,");
|
||||
Intent chargingIntent = new Intent(getContext(), FragmentManagement.class);
|
||||
|
||||
@@ -58,13 +58,10 @@ public class IssueFragment extends BaseFragment implements View.OnClickListener
|
||||
@Override
|
||||
protected void initData() {
|
||||
super.initData();
|
||||
initNetWork(true);
|
||||
|
||||
|
||||
|
||||
initNetWork();
|
||||
}
|
||||
|
||||
private void initNetWork(boolean b) {
|
||||
private void initNetWork() {
|
||||
showLoadingDialog();
|
||||
HttpParams httpParams = new HttpParams();
|
||||
httpParams.put("fid", 1);
|
||||
@@ -123,15 +120,6 @@ public class IssueFragment extends BaseFragment implements View.OnClickListener
|
||||
issueProblemAdapter = new IssueProblemAdapter(getActivity());
|
||||
mainIssueRecycler.setAdapter(issueProblemAdapter);
|
||||
mainIssueRecycler.getDefaultFootView().setNoMoreHint("成功加载完毕");
|
||||
mainIssueRecycler.setLoadingListener(new XRecyclerView.LoadingListener() {
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadMore() {
|
||||
}
|
||||
});
|
||||
|
||||
issueProblemAdapter.setOnIssueClick(new IssueProblemAdapter.OnIssueClick() {
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.navinfo.outdoor.fragment;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
@@ -39,6 +40,7 @@ public class IssueWebFragment extends BaseFragment implements View.OnClickListen
|
||||
return R.layout.fragment_issue_web;
|
||||
}
|
||||
|
||||
@SuppressLint("SetJavaScriptEnabled")
|
||||
@Override
|
||||
protected void initView() {
|
||||
super.initView();
|
||||
|
||||
@@ -147,13 +147,13 @@ public class MineFragment extends BaseFragment implements View.OnClickListener {
|
||||
if (response.getCode() == 200) {
|
||||
GetPriceBean.BodyBean body = response.getBody();
|
||||
if (body != null) {
|
||||
Double userPrice = body.getUserPrice();
|
||||
String minePrice = format2( body.getUserPrice());
|
||||
if (getActivity() != null) {
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@SuppressLint("SetTextI18n")
|
||||
@Override
|
||||
public void run() {
|
||||
tvMoney.setText(userPrice + "");
|
||||
tvMoney.setText(minePrice + "");
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -250,12 +250,15 @@ public class MineFragment extends BaseFragment implements View.OnClickListener {
|
||||
Intent intentPrivilege = new Intent(getActivity(), FragmentManagement.class);
|
||||
intentPrivilege.putExtra("tag", 18);
|
||||
startActivity(intentPrivilege);*/
|
||||
|
||||
/* mainBuilder.append("点击了item 跳转到我的等级 ,");
|
||||
Intent intentGrade = new Intent(getActivity(), FragmentManagement.class);
|
||||
intentGrade.putExtra("tag", 17);
|
||||
startActivity(intentGrade);*/
|
||||
|
||||
Toast.makeText(getActivity(), "该功能以后上新,敬请期待", Toast.LENGTH_SHORT).show();
|
||||
break;
|
||||
|
||||
case R.id.btn_withdraw://提现页面
|
||||
mainBuilder.append(TimestampUtil.time()).append(",").append("点击了去提现的按钮 ,");
|
||||
Intent intentWithdraw = new Intent(getActivity(), FragmentManagement.class);
|
||||
@@ -277,12 +280,14 @@ public class MineFragment extends BaseFragment implements View.OnClickListener {
|
||||
intentContact.putExtra("tag", 21);
|
||||
startActivity(intentContact);
|
||||
break;
|
||||
|
||||
case R.id.rl_about://关于
|
||||
mainBuilder.append(TimestampUtil.time()).append(",").append("点击了item 跳转到关于页面 ,");
|
||||
Intent intentAbout = new Intent(getActivity(), FragmentManagement.class);
|
||||
intentAbout.putExtra("tag", 23);
|
||||
startActivity(intentAbout);
|
||||
break;
|
||||
|
||||
case R.id.btn_quit://退出登录
|
||||
mainBuilder.append(TimestampUtil.time()).append(",").append("点击了退出登录的按钮 ,");
|
||||
Intent intent = new Intent(getContext(), LoginActivity.class);
|
||||
@@ -304,6 +309,15 @@ public class MineFragment extends BaseFragment implements View.OnClickListener {
|
||||
mainBuilder.append(TimestampUtil.time()).append(",").append("onStop ,");
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存小数点后两位
|
||||
*/
|
||||
public static String format2(double value) {
|
||||
DecimalFormat df = new DecimalFormat("0.00");
|
||||
df.setRoundingMode(RoundingMode.HALF_UP);
|
||||
return df.format(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
if (EventBus.getDefault().isRegistered(this))//加上判断
|
||||
|
||||
@@ -559,15 +559,52 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
otherUploadList.add(new File(tagPictures));
|
||||
}
|
||||
if (Constant.isPresent) {
|
||||
if (showPoiEntity == null) {
|
||||
showPoiEntity = new PoiEntity();
|
||||
}
|
||||
if (showPoiEntity.getTaskStatus() == 1 || showPoiEntity.getTaskStatus() == 2 || showPoiEntity.getTaskStatus() == 0 || showPoiEntity.getTaskStatus() == 5) {
|
||||
initPoiSaveLocal(true);
|
||||
} else {
|
||||
otherUploadByNet(showPoiEntity.getBodyId(), otherUploadList);
|
||||
Constant.isPresent = false;
|
||||
}
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (showPoiEntity == null) {
|
||||
showPoiEntity = new PoiEntity();
|
||||
}
|
||||
PoiEntity poiEntity = PoiDatabase.getInstance(getContext()).getPoiDao().getPoiEntity(showPoiEntity.getId());
|
||||
if (poiEntity == null) {
|
||||
if (showPoiEntity.getTaskStatus() == 1 || showPoiEntity.getTaskStatus() == 2 || showPoiEntity.getTaskStatus() == 0 || showPoiEntity.getTaskStatus() == 5) {
|
||||
Objects.requireNonNull(getActivity()).runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
initPoiSaveLocal(true);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Objects.requireNonNull(getActivity()).runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
otherUploadByNet(showPoiEntity.getBodyId(), otherUploadList);
|
||||
Constant.isPresent = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
if (poiEntity.getTaskStatus() == 1 || poiEntity.getTaskStatus() == 2 || poiEntity.getTaskStatus() == 0 || poiEntity.getTaskStatus() == 5) {
|
||||
Objects.requireNonNull(getActivity()).runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
initPoiSaveLocal(true);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Objects.requireNonNull(getActivity()).runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
otherUploadByNet(poiEntity.getBodyId(), otherUploadList);
|
||||
Constant.isPresent = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}).start();
|
||||
} else {
|
||||
Toast.makeText(getContext(), "该任务正在提交中", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
@@ -639,10 +676,10 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
.cls(PoiSaveBean.class)
|
||||
.params(httpParams)
|
||||
.token(Constant.ACCESS_TOKEN);
|
||||
if (getActivity()!=null){
|
||||
if (getActivity() != null) {
|
||||
okGoBuilder.getRequest(PreserveUtils.getInstance().getOtherPreserveCallback(getActivity(), poiEntity));
|
||||
getActivity().getSupportFragmentManager().popBackStack();//回退
|
||||
WaitDialog.show((AppCompatActivity) getActivity(), "任务正在后台保存中,请稍候...");
|
||||
WaitDialog.show((AppCompatActivity) getActivity(), "任务已保存本地,请稍后");
|
||||
WaitDialog.dismiss(1000);
|
||||
}
|
||||
}
|
||||
@@ -894,11 +931,12 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
poiEntity.setChecked(false);
|
||||
poiEntity.setTaskStatus(100);
|
||||
PoiDatabase.getInstance(getContext()).getPoiDao().updatePoiEntity(poiEntity);
|
||||
}
|
||||
}).start();
|
||||
//initList();
|
||||
initList();
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.JOB_WORD_MONITOR;
|
||||
obtain.obj = true;
|
||||
|
||||
@@ -48,10 +48,10 @@ import java.util.Objects;
|
||||
*/
|
||||
public class PhotoFragment extends BaseFragment implements View.OnClickListener {
|
||||
private ArrayList<FileBean> fileBeans;
|
||||
private ArrayList<FileBean> deleteFiles;
|
||||
private PhotoAdapter photoAdapter;
|
||||
private File logFile;
|
||||
private StringBuilder photoBuilder;
|
||||
private File fileTxt;
|
||||
|
||||
public static PhotoFragment newInstance(Bundle bundle) {
|
||||
PhotoFragment fragment = new PhotoFragment();
|
||||
@@ -106,17 +106,17 @@ public class PhotoFragment extends BaseFragment implements View.OnClickListener
|
||||
ivPhotoFinal.setOnClickListener(this);
|
||||
TextView tvPhotoAlbumDelete = (TextView) findViewById(R.id.tv_photo_album_delete);
|
||||
tvPhotoAlbumDelete.setOnClickListener(this);
|
||||
deleteFiles = new ArrayList<>();
|
||||
deleteFiles.clear();
|
||||
if (showPoiEntity != null) {
|
||||
String id = showPoiEntity.getId();
|
||||
fileBeans = new ArrayList<>();
|
||||
List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(id);
|
||||
List<File> fileArrayList = new ArrayList<>();
|
||||
if (fileListByUUID.size()>2){
|
||||
if (fileListByUUID.size() > 2) {
|
||||
for (int i = 0; i < fileListByUUID.size(); i++) {
|
||||
if (!fileListByUUID.get(i).getPath().contains("paper.txt")){
|
||||
if (!fileListByUUID.get(i).getPath().contains("paper.txt")) {
|
||||
fileArrayList.add(fileListByUUID.get(i));
|
||||
}else {
|
||||
fileTxt = fileListByUUID.get(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -127,14 +127,14 @@ public class PhotoFragment extends BaseFragment implements View.OnClickListener
|
||||
String[] split2 = o2.getName().split(".webp");
|
||||
int i = Integer.parseInt(split[0]);
|
||||
int i2 = Integer.parseInt(split2[0]);
|
||||
if (i>i2){
|
||||
if (i > i2) {
|
||||
return 1;
|
||||
}else {
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
});
|
||||
if (fileArrayList.size()>0){
|
||||
if (fileArrayList.size() > 0) {
|
||||
for (int i = 0; i < fileArrayList.size(); i++) {
|
||||
if (fileArrayList.get(i).getPath().contains(".webp") && !fileArrayList.get(i).getPath().contains("paper.txt")) {
|
||||
if (fileArrayList.get(i).exists()) {
|
||||
@@ -143,31 +143,15 @@ public class PhotoFragment extends BaseFragment implements View.OnClickListener
|
||||
}
|
||||
}
|
||||
}
|
||||
if (showPoiEntity.getTaskStatus()==3){
|
||||
if (showPoiEntity.getTaskStatus() == 3) {
|
||||
tvPhotoAlbumDelete.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
RecyclerView photoRecycler = findViewById(R.id.photo_album_recycler);
|
||||
photoRecycler.setLayoutManager(new GridLayoutManager(getContext(), 2));
|
||||
photoAdapter = new PhotoAdapter(fileBeans, getContext());
|
||||
photoAdapter = new PhotoAdapter(fileTxt, getContext());
|
||||
photoAdapter.setFileBeans(fileBeans);
|
||||
photoRecycler.setAdapter(photoAdapter);
|
||||
photoAdapter.setPhotoClickItem(new PhotoAdapter.photoClickItem() {
|
||||
@Override
|
||||
public void item(boolean isChecked, FileBean fileBean) {
|
||||
photoBuilder.append(TimestampUtil.time()).append("图片页面点击了item ,");
|
||||
if (isChecked) {
|
||||
deleteFiles.add(fileBean);
|
||||
} else {
|
||||
if (deleteFiles != null) {
|
||||
for (int i = 0; i < deleteFiles.size(); i++) {
|
||||
if (fileBean.getFile().getPath().equals(deleteFiles.get(i).getFile().getPath())) {
|
||||
deleteFiles.remove(fileBean);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -197,7 +181,6 @@ public class PhotoFragment extends BaseFragment implements View.OnClickListener
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Subscribe
|
||||
public void onEvent(Message data) {
|
||||
|
||||
@@ -215,13 +198,8 @@ public class PhotoFragment extends BaseFragment implements View.OnClickListener
|
||||
break;
|
||||
case R.id.tv_photo_album_delete:
|
||||
photoBuilder.append(TimestampUtil.time()).append("图片页面点击了删除 ,");
|
||||
if (fileBeans != null) {
|
||||
for (int i = 0; i < fileBeans.size(); i++) {
|
||||
photoAdapter.deleteFile(fileBeans.get(i));
|
||||
}
|
||||
} else {
|
||||
Toast.makeText(getContext(), "请选择要删除的数据后才可以删除", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
photoAdapter.CheckedDelete();
|
||||
photoAdapter.notifyDataSetChanged();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -780,15 +780,52 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
poiPicList.add(new File(tagCard));
|
||||
}
|
||||
if (Constant.isPresent) {
|
||||
if (showPoiEntity == null) {
|
||||
showPoiEntity = new PoiEntity();
|
||||
}
|
||||
if (showPoiEntity.getTaskStatus() == 1 || showPoiEntity.getTaskStatus() == 2 || showPoiEntity.getTaskStatus() == 0 || showPoiEntity.getTaskStatus() == 5) {
|
||||
initPoiSaveLocal(true);
|
||||
} else {
|
||||
poiUploadByNetWork(showPoiEntity.getBodyId(), poiPicList);
|
||||
Constant.isPresent = false;
|
||||
}
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (showPoiEntity == null) {
|
||||
showPoiEntity = new PoiEntity();
|
||||
}
|
||||
PoiEntity poiEntity = PoiDatabase.getInstance(getContext()).getPoiDao().getPoiEntity(showPoiEntity.getId());
|
||||
if (poiEntity == null) {
|
||||
if (showPoiEntity.getTaskStatus() == 1 || showPoiEntity.getTaskStatus() == 2 || showPoiEntity.getTaskStatus() == 0 || showPoiEntity.getTaskStatus() == 5) {
|
||||
Objects.requireNonNull(getActivity()).runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
initPoiSaveLocal(true);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Objects.requireNonNull(getActivity()).runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
poiUploadByNetWork(showPoiEntity.getBodyId(), poiPicList);
|
||||
Constant.isPresent = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
if (poiEntity.getTaskStatus() == 1 || poiEntity.getTaskStatus() == 2 || poiEntity.getTaskStatus() == 0 || poiEntity.getTaskStatus() == 5) {
|
||||
Objects.requireNonNull(getActivity()).runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
initPoiSaveLocal(true);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Objects.requireNonNull(getActivity()).runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
poiUploadByNetWork(showPoiEntity.getBodyId(), poiPicList);
|
||||
Constant.isPresent = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}).start();
|
||||
} else {
|
||||
Toast.makeText(getContext(), "该任务正在提交中", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
@@ -994,7 +1031,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
if (getActivity()!=null){
|
||||
okGoBuilder.getRequest(PreserveUtils.getInstance().getPoiPreserveCallback(getActivity(), poiEntity));
|
||||
getActivity().getSupportFragmentManager().popBackStack();//回退
|
||||
WaitDialog.show((AppCompatActivity) getActivity(), "任务正在后台保存中,请稍候...");
|
||||
WaitDialog.show((AppCompatActivity) getActivity(), "任务已保存本地,请稍后");
|
||||
WaitDialog.dismiss(1000);
|
||||
}
|
||||
}
|
||||
@@ -1300,11 +1337,12 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
poiEntity.setChecked(false);
|
||||
poiEntity.setTaskStatus(100);
|
||||
PoiDatabase.getInstance(getActivity()).getPoiDao().updatePoiEntity(poiEntity);
|
||||
}
|
||||
}).start();
|
||||
//initList();
|
||||
initList();
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.JOB_WORD_MONITOR;
|
||||
obtain.obj = true;
|
||||
|
||||
@@ -599,7 +599,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
if (getActivity() != null) {
|
||||
okGoBuilder.getRequest(PreserveUtils.getInstance().getPoiVideoPreserveCallback(getActivity(), poiEntity));
|
||||
getActivity().getSupportFragmentManager().popBackStack();//回退
|
||||
WaitDialog.show((AppCompatActivity) getActivity(), "任务正在后台保存中,请稍候...");
|
||||
WaitDialog.show((AppCompatActivity) getActivity(), "任务已保存本地,请稍后");
|
||||
WaitDialog.dismiss(1000);
|
||||
}
|
||||
|
||||
@@ -632,7 +632,6 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
WaitDialog.show((AppCompatActivity) getActivity(), "任务正在后台上传中,请稍候...");
|
||||
WaitDialog.dismiss(3000);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void poiVideoSave(PoiEntity poiEntity) {
|
||||
@@ -819,18 +818,19 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
poiEntity.setChecked(false);
|
||||
poiEntity.setTaskStatus(100);
|
||||
PoiDatabase.getInstance(getActivity()).getPoiDao().updatePoiEntity(poiEntity);
|
||||
}
|
||||
}).start();
|
||||
/*if (poiEntity.getId() != null) {
|
||||
if (poiEntity.getId() != null) {
|
||||
List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(poiEntity.getId());
|
||||
for (int i = 0; i < fileListByUUID.size(); i++) {
|
||||
fileListByUUID.get(i).delete();
|
||||
}
|
||||
File filePath = AWMp4ParserHelper.getInstance().getFilePath(poiEntity.getId());
|
||||
filePath.delete();
|
||||
}*/
|
||||
}
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.JOB_WORD_MONITOR;
|
||||
obtain.obj = true;
|
||||
|
||||
@@ -19,6 +19,7 @@ import androidx.annotation.Nullable;
|
||||
|
||||
import com.github.lazylibrary.util.FileUtils;
|
||||
import com.lzy.okgo.model.HttpParams;
|
||||
import com.lzy.okgo.model.Progress;
|
||||
import com.navinfo.outdoor.R;
|
||||
import com.navinfo.outdoor.activity.LoginActivity;
|
||||
import com.navinfo.outdoor.api.Constant;
|
||||
@@ -28,6 +29,7 @@ import com.navinfo.outdoor.bean.UserBean;
|
||||
import com.navinfo.outdoor.http.Callback;
|
||||
import com.navinfo.outdoor.http.HttpInterface;
|
||||
import com.navinfo.outdoor.http.OkGoBuilder;
|
||||
import com.navinfo.outdoor.http.UploadCallBack;
|
||||
import com.navinfo.outdoor.util.Base64;
|
||||
import com.navinfo.outdoor.util.Md5Util;
|
||||
import com.navinfo.outdoor.util.RegexUtil;
|
||||
@@ -249,7 +251,7 @@ public class RegisterFragment extends BaseFragment implements View.OnClickListen
|
||||
.token(null)
|
||||
.params(httpParams)
|
||||
.cls(UserBean.class);
|
||||
okGoBuilder.postRequest(new Callback<UserBean>() {
|
||||
okGoBuilder.postRequest(new UploadCallBack<UserBean>() {
|
||||
@Override
|
||||
public void onSuccess(UserBean response, int id) {
|
||||
dismissLoadingDialog();
|
||||
@@ -269,6 +271,11 @@ public class RegisterFragment extends BaseFragment implements View.OnClickListen
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadProgress(Progress progress) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e, int id) {
|
||||
dismissLoadingDialog();
|
||||
|
||||
@@ -551,7 +551,6 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
} else {
|
||||
roadSaveWork(poiEntity);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -589,7 +588,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
if (getActivity()!=null){
|
||||
okGoBuilder.getRequest(PreserveUtils.getInstance().getRoadPreserveCallback(getActivity(), poiEntity));
|
||||
getActivity().getSupportFragmentManager().popBackStack();//回退
|
||||
WaitDialog.show((AppCompatActivity) getActivity(), "任务正在后台保存中,请稍候...");
|
||||
WaitDialog.show((AppCompatActivity) getActivity(), "任务已保存本地,请稍后");
|
||||
WaitDialog.dismiss(1000);
|
||||
}
|
||||
|
||||
@@ -812,18 +811,19 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
poiEntity.setChecked(false);
|
||||
poiEntity.setTaskStatus(100);
|
||||
PoiDatabase.getInstance(getContext()).getPoiDao().updatePoiEntity(poiEntity);
|
||||
}
|
||||
}).start();
|
||||
/*if (poiEntity.getId() != null) {
|
||||
if (poiEntity.getId() != null) {
|
||||
List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(poiEntity.getId());
|
||||
for (int i = 0; i < fileListByUUID.size(); i++) {
|
||||
fileListByUUID.get(i).delete();
|
||||
}
|
||||
File filePath = AWMp4ParserHelper.getInstance().getFilePath(poiEntity.getId());
|
||||
filePath.delete();
|
||||
}*/
|
||||
}
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.JOB_WORD_MONITOR;
|
||||
obtain.obj = true;
|
||||
|
||||
@@ -68,6 +68,7 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
|
||||
private CheckBox cbSelect;
|
||||
private File logFile;
|
||||
private StringBuilder staySubmitBuilder;
|
||||
private TextView tvNumber;
|
||||
|
||||
public static StaySubmitFragment newInstance(Bundle bundle) {
|
||||
StaySubmitFragment fragment = new StaySubmitFragment();
|
||||
@@ -88,6 +89,7 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
|
||||
return R.layout.fragment_stay_submit;
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
@Override
|
||||
protected void initView() {
|
||||
super.initView();
|
||||
@@ -99,6 +101,7 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
|
||||
tvDelete.setOnClickListener(this);
|
||||
tvStayType = findViewById(R.id.tv_stay_type);
|
||||
Button btnStaySubmit = findViewById(R.id.btn_stay_submit);
|
||||
tvNumber = findViewById(R.id.tv_number);
|
||||
btnStaySubmit.setOnClickListener(this);
|
||||
RecyclerView stayXrv = findViewById(R.id.stay_xrv);
|
||||
stayXrv.setLayoutManager(new LinearLayoutManager(getActivity()));
|
||||
@@ -114,6 +117,7 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
|
||||
subObtain.what = Constant.EVENT_WORK_HOME;
|
||||
subObtain.obj = true;
|
||||
EventBus.getDefault().post(subObtain);
|
||||
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.EVENT_WHAT_COMPLETE_TASK;
|
||||
obtain.obj = poiEntity;
|
||||
@@ -219,32 +223,39 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
|
||||
case R.id.cl_stay_type://1 "POI"2 "充电站"3 "POI录像"4 "道路录像"5 "其他"6 "面状任务"
|
||||
staySubmitBuilder.append(TimestampUtil.time()).append(",").append("点击了待提交的类型 ,");
|
||||
BottomMenu.show((AppCompatActivity) Objects.requireNonNull(getContext()), new String[]{"全部", "poi", "充电站", "poi录像", "道路录像", "其他"}, new OnMenuItemClickListener() {
|
||||
@SuppressLint("SetTextI18n")
|
||||
@Override
|
||||
public void onClick(String text, int index) {
|
||||
switch (index) {
|
||||
case 0:
|
||||
List<PoiEntity> entities = initRoadWord(0);
|
||||
staySubmitAdapter.setAllRoad(entities);
|
||||
tvNumber.setText(String.valueOf(staySubmitAdapter.getAllRoad().size()));
|
||||
break;
|
||||
case 1:
|
||||
List<PoiEntity> poiEntities = initRoadWord(1);
|
||||
staySubmitAdapter.setAllRoad(poiEntities);
|
||||
tvNumber.setText(String.valueOf(staySubmitAdapter.getAllRoad().size()));
|
||||
break;
|
||||
case 2:
|
||||
List<PoiEntity> stationEntities = initRoadWord(2);
|
||||
staySubmitAdapter.setAllRoad(stationEntities);
|
||||
tvNumber.setText(String.valueOf(staySubmitAdapter.getAllRoad().size()));
|
||||
break;
|
||||
case 3:
|
||||
List<PoiEntity> poiVideoEntities = initRoadWord(3);
|
||||
staySubmitAdapter.setAllRoad(poiVideoEntities);
|
||||
tvNumber.setText(String.valueOf(staySubmitAdapter.getAllRoad().size()));
|
||||
break;
|
||||
case 4:
|
||||
List<PoiEntity> roadEntities = initRoadWord(4);
|
||||
staySubmitAdapter.setAllRoad(roadEntities);
|
||||
tvNumber.setText(String.valueOf(staySubmitAdapter.getAllRoad().size()));
|
||||
break;
|
||||
case 5:
|
||||
List<PoiEntity> otherEntities = initRoadWord(5);
|
||||
staySubmitAdapter.setAllRoad(otherEntities);
|
||||
tvNumber.setText(String.valueOf(staySubmitAdapter.getAllRoad().size()));
|
||||
break;
|
||||
}
|
||||
tvStayType.setText(text);
|
||||
@@ -373,11 +384,13 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
|
||||
} else {
|
||||
roadEntities.clear();
|
||||
}
|
||||
|
||||
if (newEntities == null) {
|
||||
newEntities = new ArrayList<>();
|
||||
} else {
|
||||
newEntities.clear();
|
||||
}
|
||||
|
||||
PoiDatabase roadDatabase = PoiDatabase.getInstance(getContext());
|
||||
if (roadDatabase != null) {
|
||||
PoiDao roadDao = roadDatabase.getPoiDao();
|
||||
@@ -399,6 +412,9 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
|
||||
roadEntities.addAll(roadAll);
|
||||
staySubmitAdapter.setAllRoad(roadEntities);
|
||||
staySubmitAdapter.notifyDataSetChanged();
|
||||
if (tvNumber!=null){
|
||||
tvNumber.setText(String.valueOf(staySubmitAdapter.getAllRoad().size()));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -411,7 +427,7 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
|
||||
Toast.makeText(getActivity(), "无法读取数据库,请尝试重启程序!", Toast.LENGTH_SHORT).show();
|
||||
UMCrash.generateCustomLog("无法读取数据库", "自定义");
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
Toast.makeText(getActivity(), "数据库创建失败,请关闭程序重新进入", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,11 +10,13 @@ import com.navinfo.outdoor.base.BaseFragment;
|
||||
* 发现-任务说明的Item点击进入Web页面
|
||||
*/
|
||||
public class TaskExWebFragment extends BaseFragment implements View.OnClickListener {
|
||||
|
||||
public static TaskExWebFragment newInstance(Bundle bundle) {
|
||||
TaskExWebFragment fragment = new TaskExWebFragment();
|
||||
fragment.setArguments(bundle);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayout() {
|
||||
return R.layout.fragment_task_ex_web;
|
||||
|
||||
@@ -23,6 +23,7 @@ import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@@ -48,12 +49,11 @@ import com.kongzue.dialog.v3.MessageDialog;
|
||||
import com.kongzue.dialog.v3.ShareDialog;
|
||||
import com.lzy.okgo.OkGo;
|
||||
import com.lzy.okgo.model.HttpParams;
|
||||
import com.lzy.okgo.model.Progress;
|
||||
import com.navinfo.outdoor.R;
|
||||
import com.navinfo.outdoor.activity.FragmentManagement;
|
||||
import com.navinfo.outdoor.activity.MainActivity;
|
||||
import com.navinfo.outdoor.adapter.MarkerAdapter;
|
||||
import com.navinfo.outdoor.api.Constant;
|
||||
import com.navinfo.outdoor.api.UserApplication;
|
||||
import com.navinfo.outdoor.base.BaseDrawerFragment;
|
||||
import com.navinfo.outdoor.base.BaseFragment;
|
||||
import com.navinfo.outdoor.bean.GetPhoneBean;
|
||||
@@ -63,8 +63,8 @@ import com.navinfo.outdoor.bean.UserBean;
|
||||
import com.navinfo.outdoor.http.Callback;
|
||||
import com.navinfo.outdoor.http.HttpInterface;
|
||||
import com.navinfo.outdoor.http.OkGoBuilder;
|
||||
import com.navinfo.outdoor.http.UploadCallBack;
|
||||
import com.navinfo.outdoor.room.ChargingPileEntity;
|
||||
import com.navinfo.outdoor.room.PoiDao;
|
||||
import com.navinfo.outdoor.room.PoiDatabase;
|
||||
import com.navinfo.outdoor.room.PoiEntity;
|
||||
import com.navinfo.outdoor.util.FlushTokenUtil;
|
||||
@@ -80,7 +80,6 @@ import com.sothree.slidinguppanel.SlidingUpPanelLayout;
|
||||
import com.tencent.map.geolocation.TencentLocation;
|
||||
import com.tencent.tencentmap.mapsdk.maps.CameraUpdate;
|
||||
import com.tencent.tencentmap.mapsdk.maps.CameraUpdateFactory;
|
||||
import com.tencent.tencentmap.mapsdk.maps.MapView;
|
||||
import com.tencent.tencentmap.mapsdk.maps.Projection;
|
||||
import com.tencent.tencentmap.mapsdk.maps.TencentMap;
|
||||
import com.tencent.tencentmap.mapsdk.maps.TextureMapView;
|
||||
@@ -165,6 +164,10 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
return false;
|
||||
}
|
||||
});
|
||||
TextView tvGps;
|
||||
private TextView tvTenantGaps;
|
||||
private StringBuilder gpsBuilder;
|
||||
private File gpsLogFile;
|
||||
|
||||
public static TreasureFragment newInstance(Bundle bundle) {
|
||||
TreasureFragment fragment = new TreasureFragment();
|
||||
@@ -195,6 +198,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
ivSubmit.setOnClickListener(this);
|
||||
ivMessage = findViewById(R.id.iv_message);
|
||||
ivMessage.setOnClickListener(this);
|
||||
tvGps = findViewById(R.id.tv_GPS);
|
||||
tvTenantGaps = findViewById(R.id.tv_tencent_GPS);
|
||||
mapView = findViewById(R.id.treasure_map);
|
||||
tencentMap = mapView.getMap();
|
||||
// 设置地图宽高为屏幕的宽高
|
||||
@@ -564,7 +569,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
.cls(UserBean.class)
|
||||
.params(httpParams)
|
||||
.token(Constant.ACCESS_TOKEN);
|
||||
okGoBuilder.postRequest(new Callback<UserBean>() {
|
||||
okGoBuilder.postRequest(new UploadCallBack<UserBean>() {
|
||||
@Override
|
||||
public void onSuccess(UserBean response, int id) {
|
||||
dismissLoadingDialog();
|
||||
@@ -591,6 +596,11 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadProgress(Progress progress) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e, int id) {
|
||||
dismissLoadingDialog();
|
||||
@@ -1529,6 +1539,25 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
if (latLng != null) {
|
||||
MapManager.getInstance().animateMapLocation2TopCenter(latLng, 0.5f, 0.25f);
|
||||
}
|
||||
} else if (data.what == Constant.EVENT_WHAT_LOCATION_CHANGE) { // 用户位置更新
|
||||
if (tencentMap != null) {
|
||||
TencentLocation tencentLocation = (TencentLocation) data.obj;
|
||||
// gpsBuilder.append("腾讯:定位坐标").append("y:").append(tencentLocation.getLatitude()).append(",").append("x:").append(tencentLocation.getLongitude()).append(";");
|
||||
int gpsRssi = tencentLocation.getGPSRssi();
|
||||
if (gpsRssi == 0) {
|
||||
//gpsBuilder.append(TimestampUtil.time()).append(";").append("信号强度:").append("无信号").append(";").append("\r\n");
|
||||
tvTenantGaps.setText("信号强度:无信号");
|
||||
} else if (gpsRssi == 1) {
|
||||
//gpsBuilder.append(TimestampUtil.time()).append(";").append("信号强度:").append("弱").append(";").append("\r\n");
|
||||
tvTenantGaps.setText("信号强度:弱");
|
||||
} else if (gpsRssi == 2) {
|
||||
//gpsBuilder.append(TimestampUtil.time()).append(";").append("信号强度:").append("中").append(";").append("\r\n");
|
||||
tvTenantGaps.setText("信号强度:中");
|
||||
} else if (gpsRssi == 3) {
|
||||
//gpsBuilder.append(TimestampUtil.time()).append(";").append("信号强度:").append("强").append(";").append("\r\n");
|
||||
tvTenantGaps.setText("信号强度:强");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1709,10 +1738,12 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
}
|
||||
super.onDestroy();
|
||||
mapView.onDestroy();
|
||||
// new GPSUtils(Objects.requireNonNull(getActivity())).Remove();
|
||||
treasureBuilder.append(TimestampUtil.time()).append(",").append("onDestroy");
|
||||
treasureBuilder.append("\r\n");
|
||||
FileUtils.writeFile(logFile.getAbsolutePath(), treasureBuilder.toString(), true);
|
||||
|
||||
/* gpsBuilder.append("\r\n");
|
||||
FileUtils.writeFile(gpsLogFile.getAbsolutePath(), gpsBuilder.toString(), true);*/
|
||||
if (bigMarker != null) {
|
||||
bigMarker.remove();
|
||||
}
|
||||
@@ -1942,8 +1973,27 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
@Override
|
||||
public void onGranted(List<String> permissions, boolean all) {
|
||||
if (all) {
|
||||
/* SharedPreferences sharedPreferences = Objects.requireNonNull(getActivity()).getSharedPreferences(Constant.MESSAGE_TYPE, Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor sharedEdit = sharedPreferences.edit();
|
||||
@SuppressLint("SimpleDateFormat")
|
||||
DateFormat formatter = new SimpleDateFormat("yyyyMMdd");
|
||||
String newFormat = formatter.format(new Date(System.currentTimeMillis()));
|
||||
String GPS_time = sharedPreferences.getString("GPS_time", null);
|
||||
if (GPS_time == null) {
|
||||
sharedEdit.putString("GPS_time", newFormat);
|
||||
sharedEdit.apply();
|
||||
gpsLogFile = new File(Constant.GPS_LOG_FOLDER + "/" + newFormat + ".txt");
|
||||
} else {
|
||||
if (GPS_time.equals(newFormat)) {
|
||||
gpsLogFile = new File(Constant.GPS_LOG_FOLDER + "/" + GPS_time + ".txt");
|
||||
} else {
|
||||
gpsLogFile = new File(Constant.GPS_LOG_FOLDER + "/" + newFormat + ".txt");
|
||||
}
|
||||
}
|
||||
gpsBuilder = new StringBuilder();*/
|
||||
//建立定位
|
||||
initLocation();
|
||||
// initGpsLocation();
|
||||
} else {
|
||||
dismissLoadingDialog();
|
||||
Toast.makeText(getActivity(), "申请权限失败", Toast.LENGTH_SHORT).show();
|
||||
@@ -1969,8 +2019,26 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
});
|
||||
}
|
||||
|
||||
//获取gps定位
|
||||
private void initGpsLocation() {
|
||||
/* GPSUtils gpsUtils = new GPSUtils(Objects.requireNonNull(getActivity()));
|
||||
gpsUtils.setOnClickGPSStatus(new GPSUtils.OnClickGPSStatus() {
|
||||
@SuppressLint("SetTextI18n")
|
||||
@Override
|
||||
public void onGpsCount(int count) {
|
||||
tvGps.setText("卫星颗数:" + count);
|
||||
gpsBuilder.append(TimestampUtil.time()).append(";").append("GPS:卫星颗数:").append(count).append(" ;");
|
||||
Location location = GPSUtils.getLocation();
|
||||
if (location != null) {
|
||||
gpsBuilder.append(TimestampUtil.time()).append(";").append("GPS:坐标").append("y: ").append(location.getLatitude()).append(" ,").append("x: ").append(location.getLongitude()).append(" ;").append("\r\n");
|
||||
} else {
|
||||
gpsBuilder.append(TimestampUtil.time()).append(";").append("GPS:").append("获取当前位置信息为空;").append("\r\n");
|
||||
}
|
||||
}
|
||||
});*/
|
||||
}
|
||||
|
||||
/* 设置定位图标样式*/
|
||||
/*设置定位图标样式*/
|
||||
private void setLocMarkerStyle() {
|
||||
locationStyle = new MyLocationStyle();
|
||||
locationStyle.myLocationType(MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER);
|
||||
@@ -2012,9 +2080,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
/*
|
||||
* 控制主界面各个按钮的显示状态
|
||||
*/
|
||||
/*控制主界面各个按钮的显示状态*/
|
||||
private void setMainButtonVisitable(int visitable) {
|
||||
ivZoomAdd.setVisibility(visitable);
|
||||
ivZoomDel.setVisibility(visitable);
|
||||
@@ -2024,11 +2090,11 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
ivSubmit.setVisibility(visitable);
|
||||
ivFilter.setVisibility(visitable);
|
||||
ivMessage.setVisibility(visitable);
|
||||
//tvGps.setVisibility(visitable);
|
||||
tvTenantGaps.setVisibility(visitable);
|
||||
}
|
||||
|
||||
/**
|
||||
* marker 的监听
|
||||
*/
|
||||
/* marker 的监听*/
|
||||
TencentMap.OnMarkerClickListener markerClickListener = new TencentMap.OnMarkerClickListener() {
|
||||
@Override
|
||||
public boolean onMarkerClick(Marker marker) {
|
||||
@@ -2079,7 +2145,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
initEntity(marker, true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -2156,7 +2221,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
} else {
|
||||
poiEntityArrayList.add(poiEntity);
|
||||
}
|
||||
|
||||
} else {
|
||||
JobSearchBean.BodyBean.ListBean listBean = (JobSearchBean.BodyBean.ListBean) marker.getTag();
|
||||
if (listBean != null) {
|
||||
@@ -2212,16 +2276,12 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取屏幕中心点位置
|
||||
*/
|
||||
/*获取屏幕中心点位置*/
|
||||
public LatLng getMapCenterPoint() {
|
||||
return tencentMap.getCameraPosition().target;
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义dialog
|
||||
*/
|
||||
/* 自定义dialog*/
|
||||
public void customDialog(List<PoiEntity> list, Marker marker) {
|
||||
AlertDialog dialog = builder.create();
|
||||
treasureBuilder.append(TimestampUtil.time()).append("customDialog-打开了自定义的dialog,");
|
||||
@@ -2330,11 +2390,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置map 的大小
|
||||
*
|
||||
* @param newConfig
|
||||
*/
|
||||
/* 设置map 的大小*/
|
||||
@Override
|
||||
public void onConfigurationChanged(@NonNull Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
@@ -2346,5 +2402,4 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
mapView.onSizeChanged(measuredHeight, measuredWidth, measuredWidth, measuredHeight);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -26,6 +26,7 @@ import com.kongzue.dialog.util.BaseDialog;
|
||||
import com.kongzue.dialog.util.DialogSettings;
|
||||
import com.kongzue.dialog.v3.MessageDialog;
|
||||
import com.lzy.okgo.model.HttpParams;
|
||||
import com.lzy.okgo.model.Progress;
|
||||
import com.navinfo.outdoor.R;
|
||||
import com.navinfo.outdoor.activity.PhotographActivity;
|
||||
import com.navinfo.outdoor.api.Constant;
|
||||
@@ -36,6 +37,7 @@ import com.navinfo.outdoor.bean.NameAuthenticationBean;
|
||||
import com.navinfo.outdoor.http.Callback;
|
||||
import com.navinfo.outdoor.http.HttpInterface;
|
||||
import com.navinfo.outdoor.http.OkGoBuilder;
|
||||
import com.navinfo.outdoor.http.UploadCallBack;
|
||||
import com.navinfo.outdoor.util.FlushTokenUtil;
|
||||
import com.navinfo.outdoor.util.PhotoUtils;
|
||||
import com.navinfo.outdoor.util.TimestampUtil;
|
||||
@@ -67,14 +69,14 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
|
||||
private TextView tvCard2;
|
||||
private ImageView ivHera3;
|
||||
private TextView tvCard3;
|
||||
/*private LinearLayout linearHint;
|
||||
private TextView tvTitle;
|
||||
private LinearLayout linearLayout;
|
||||
private View userAttestView;*/
|
||||
private ImageView useCamera;
|
||||
private File logFile;
|
||||
private StringBuilder userAttestationBuilder;
|
||||
private SharedPreferences.Editor sharedPreEditor;
|
||||
/*private LinearLayout linearHint;
|
||||
private TextView tvTitle;
|
||||
private LinearLayout linearLayout;
|
||||
private View userAttestView;*/
|
||||
|
||||
public static UserAttestationFragment newInstance(Bundle bundle) {
|
||||
UserAttestationFragment fragment = new UserAttestationFragment();
|
||||
@@ -178,19 +180,19 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
|
||||
useCamera.setEnabled(false);
|
||||
}
|
||||
String tv1 = sharedPreferences.getString("tvCard1", null);
|
||||
if (tv1!=null){
|
||||
if (tv1 != null) {
|
||||
File tvFile = new File(tv1);
|
||||
String andGetPath = PhotoUtils.showPhotoAndGetPath(tvFile, ivAttestation1);
|
||||
tvCard1.setTag(andGetPath);
|
||||
}
|
||||
String tv2 = sharedPreferences.getString("tvCard2", null);
|
||||
if (tv2!=null){
|
||||
if (tv2 != null) {
|
||||
File tvFile = new File(tv2);
|
||||
String andGetPath = PhotoUtils.showPhotoAndGetPath(tvFile, ivAttestation2);
|
||||
tvCard1.setTag(andGetPath);
|
||||
}
|
||||
String tv3 = sharedPreferences.getString("tvCard3", null);
|
||||
if (tv3!=null){
|
||||
if (tv3 != null) {
|
||||
File tvFile = new File(tv3);
|
||||
String andGetPath = PhotoUtils.showPhotoAndGetPath(tvFile, ivAttestation3);
|
||||
tvCard1.setTag(andGetPath);
|
||||
@@ -312,7 +314,7 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
|
||||
.token(Constant.ACCESS_TOKEN)
|
||||
.params(httpParams)
|
||||
.fileList(takePhoneList);
|
||||
okGoBuilder.postFileAsynchronous(new Callback<NameAuthenticationBean>() {
|
||||
okGoBuilder.postFileAsynchronous(new UploadCallBack<NameAuthenticationBean>() {
|
||||
@Override
|
||||
public void onSuccess(NameAuthenticationBean response, int id) {
|
||||
dismissLoadingDialog();
|
||||
@@ -337,14 +339,19 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadProgress(Progress progress) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e, int id) {
|
||||
dismissLoadingDialog();
|
||||
String message = e.getMessage();
|
||||
assert message != null;
|
||||
if (message.equals("timeout")||message.equals("Read time out")){
|
||||
if (message.equals("timeout") || message.equals("Read time out")) {
|
||||
Toast.makeText(getActivity(), "请求超时", Toast.LENGTH_SHORT).show();
|
||||
}else {
|
||||
} else {
|
||||
Toast.makeText(getActivity(), message, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
Log.d("TAG", "onSuccess: 失败" + e.getMessage() + "");
|
||||
@@ -368,7 +375,7 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
|
||||
tvCard1.setTag(null);
|
||||
}
|
||||
String andGetPath = PhotoUtils.showPhotoAndGetPath(videoFile, ivAttestation1);
|
||||
sharedPreEditor.putString("tvCard1",videoFile.getAbsolutePath());
|
||||
sharedPreEditor.putString("tvCard1", videoFile.getAbsolutePath());
|
||||
sharedPreEditor.apply();
|
||||
tvCard1.setTag(andGetPath);
|
||||
}
|
||||
@@ -387,7 +394,7 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
|
||||
}
|
||||
String andGetPath = PhotoUtils.showPhotoAndGetPath(videoFile, ivAttestation2);
|
||||
tvCard2.setTag(andGetPath);
|
||||
sharedPreEditor.putString("tvCard2",videoFile.getAbsolutePath());
|
||||
sharedPreEditor.putString("tvCard2", videoFile.getAbsolutePath());
|
||||
sharedPreEditor.apply();
|
||||
}
|
||||
ivHera2.setVisibility(View.GONE);
|
||||
@@ -405,7 +412,7 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
|
||||
}
|
||||
String andGetPath = PhotoUtils.showPhotoAndGetPath(videoFile, ivAttestation3);
|
||||
tvCard3.setTag(andGetPath);
|
||||
sharedPreEditor.putString("tvCard3",videoFile.getAbsolutePath());
|
||||
sharedPreEditor.putString("tvCard3", videoFile.getAbsolutePath());
|
||||
sharedPreEditor.apply();
|
||||
}
|
||||
ivHera3.setVisibility(View.GONE);
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.navinfo.outdoor.http;
|
||||
|
||||
import com.lzy.okgo.model.Progress;
|
||||
|
||||
/**
|
||||
* 作用:
|
||||
*/
|
||||
@@ -13,6 +15,7 @@ public interface Callback<T> {
|
||||
*/
|
||||
void onSuccess(T response, int id);
|
||||
|
||||
|
||||
/**
|
||||
* 数据失败时候回调
|
||||
*
|
||||
|
||||
@@ -1,57 +1,59 @@
|
||||
package com.navinfo.outdoor.http;
|
||||
|
||||
public class HttpInterface {
|
||||
public static final String IP_= "http://dtxbmaps.navinfo.com/dtxb/m4";//正式接口
|
||||
public static final String IP= "http://dtxbmaps.navinfo.com/dtxb_test/m4";//测试接口
|
||||
public static final String IP_ = "http://dtxbmaps.navinfo.com/dtxb/m4";//正式接口
|
||||
public static final String IP = "http://dtxbmaps.navinfo.com/dtxb_test/m4";//测试接口
|
||||
public static final String USER_PATH = "/user/";//我的
|
||||
public static final String MSG_LIST_PATH = "/msgList/";//发现
|
||||
public static final String USER_LOGIN_PATH = "/userlogin/";//登录
|
||||
public static final String PRICE_PATH = "/price/";//提现
|
||||
public static final String TASK_PATH = "/task/";//任务
|
||||
|
||||
|
||||
public static final String USER_PATH ="/user/";//我的
|
||||
public static final String MSG_LIST_PATH ="/msgList/";//发现
|
||||
public static final String USER_LOGIN_PATH ="/userlogin/";//登录
|
||||
public static final String PRICE_PATH ="/price/";//提现
|
||||
public static final String TASK_PATH ="/task/";//任务
|
||||
/*
|
||||
public static final String TEST_GUIDANCE_IP = "http://172.21.98.90:9999/m4";//引导页完成接口
|
||||
public static final String APK_IP = "http://172.23.139.4:8001/";
|
||||
public static String IP1 = "http://dtxbmaps.navinfo.com/dtxb/msg/";
|
||||
public static final String DATA_IP = "http://172.23.139.4:9999/m4";//接口
|
||||
*/
|
||||
|
||||
/*用户版本升级*/
|
||||
// dtxbmaps.navinfo.com/dtxb/m4/user/appVersion/checkVersion?version=155&operationType=android
|
||||
// 172.23.139.4:8001/appVersion/checkVersion?version=155&operationType=android //version是版本 operationType固定值 安卓 get
|
||||
public static String APP_CHECK_VERSION; //版本升级
|
||||
public static String APP_CHECK_VERSION = null; //版本升级
|
||||
|
||||
public static void initAppPath(String userId) {
|
||||
APP_CHECK_VERSION = IP + USER_PATH + "appVersion/" + userId + "/checkVersion"; //版本升级
|
||||
}
|
||||
/* 我的
|
||||
Path=/m4/user/*
|
||||
*/
|
||||
//172.23.139.4:8001/m4/user/update
|
||||
public static String USER_UPDATE;//用户资料
|
||||
//172.23.139.4:8001/m4/userBankcard/update
|
||||
public static String USER_BANKCARD_UP_DATA; //绑定银行卡
|
||||
//172.23.139.4:8001/m4/userAuth/add
|
||||
public static String USER_AUTH_ADD; //实名认证
|
||||
//172.23.139.4:9999/m4/user/userLocation/1/userLocation post 参数 geom:geohash加密
|
||||
public static String USER_LOCATION; //上传用户坐标
|
||||
//dtxbmaps.navinfo.com/dtxb/m4/user/user/1/getUserDetailByUserid/1?datetime=1628749294718
|
||||
public static String USER_DETAIL_BY_USER_ID; //获取用户信息
|
||||
//172.21.98.90:9999/m4/user/userGuide/1/insertUserGuide
|
||||
public static String INSERT_USER_GUIDE;//引导页完成接口
|
||||
/*发现
|
||||
* Path=/m4/msgList/**
|
||||
|
||||
/* 我的
|
||||
Path=/m4/user/*
|
||||
*/
|
||||
public static String MSG_CONTENT;//发现 -富文本详情页请求
|
||||
public static String LIST_TASK;//任务专区
|
||||
public static String LIST_EVENT;//活动专区
|
||||
public static String LIST_TASK_EXPLAIN;//任务说明
|
||||
//172.23.139.4:8001/m4/user/update
|
||||
public static String USER_UPDATE = null;//用户资料
|
||||
//172.23.139.4:8001/m4/userBankcard/update
|
||||
public static String USER_BANKCARD_UP_DATA = null; //绑定银行卡
|
||||
//172.23.139.4:8001/m4/userAuth/add
|
||||
public static String USER_AUTH_ADD = null; //实名认证
|
||||
//172.23.139.4:9999/m4/user/userLocation/1/userLocation post 参数 geom:geohash加密
|
||||
public static String USER_LOCATION = null; //上传用户坐标
|
||||
//dtxbmaps.navinfo.com/dtxb/m4/user/user/1/getUserDetailByUserid/1?datetime=1628749294718
|
||||
public static String USER_DETAIL_BY_USER_ID = null; //获取用户信息
|
||||
//172.21.98.90:9999/m4/user/userGuide/1/insertUserGuide
|
||||
public static String INSERT_USER_GUIDE = null;//引导页完成接口
|
||||
/* 发现
|
||||
* Path=/m4/msgList/**
|
||||
*/
|
||||
public static String MSG_CONTENT = null;//发现 -富文本详情页请求
|
||||
public static String LIST_TASK = null;//任务专区
|
||||
public static String LIST_EVENT = null;//活动专区
|
||||
public static String LIST_TASK_EXPLAIN = null;//任务说明
|
||||
//172.23.139.4:8002/findAndMessage/1/msg_list?fid=1&pageNum=1&pageSize=2
|
||||
public static String MSG_LISt;//发现查询接口
|
||||
public static String MSG_LISt = null;//发现查询接口
|
||||
//172.23.139.4:8002/findAndMessage/1/exam_content?id=11
|
||||
public static String EXAM_CONTENT;//发现 -能力测评获取试题接口
|
||||
public static String EXAM_CONTENT = null;//发现 -能力测评获取试题接口
|
||||
//172.23.139.4:8002/findAndMessage/1/submitExam
|
||||
public static String EXAM_SUBMIT;//发现 -能力测评提交试卷 post
|
||||
/*登录
|
||||
public static String EXAM_SUBMIT = null;//发现 -能力测评提交试卷 post
|
||||
/* 登录
|
||||
* Path=/m4/userlogin/**
|
||||
*/
|
||||
//172.23.139.4:9999/m4/userlogin/oauth/token
|
||||
@@ -64,72 +66,73 @@ public class HttpInterface {
|
||||
public static String USER_FORGET_PASSWORD = IP + USER_PATH + "user/forgetPassword";//忘记密码
|
||||
//Flat
|
||||
//dtxbmaps.navinfo.com/dtxb/m4/user/phone/message?mobile=18811794839&type=2
|
||||
/*提现 金额
|
||||
/* 提现 金额
|
||||
* Path=/m4/price/**
|
||||
*/
|
||||
//172.23.139.4:8004/userPrice/1/getPrice
|
||||
public static String GET_PRICE=null;//我的-总资产
|
||||
public static String GET_PRICE = null;//我的-总资产
|
||||
//172.23.139.4:8004/userPrice/1/userPriceExchange?exchangeMoney=10&payType=1
|
||||
public static String USER_PRICE_EXCHANGE=null;//我的-财务信息-提现
|
||||
public static String USER_PRICE_EXCHANGE = null;//我的-财务信息-提现
|
||||
//dtxbmaps.navinfo.com/dtxb/m4/price/priceExchange/1/getList?datetime=1628647356815
|
||||
public static String PRICE_EXCHANGE=null;//提现记录
|
||||
public static String PRICE_EXCHANGE = null;//提现记录
|
||||
/*任务
|
||||
* Path=/m4/task/**
|
||||
*/
|
||||
///m4/task/task/10/receiveTasks 参数:taskIds
|
||||
public static String RECEIVE_TASK=null;//批量领取
|
||||
public static String RECEIVE_TASK = null;//批量领取
|
||||
//172.23.139.4:8003/m4/task/1/getList
|
||||
public static String TASK_LIST=null; //任务搜索
|
||||
public static String TASK_LIST = null; //任务搜索
|
||||
//172.23.139.4:8003/othertask/1/receivedOthertask
|
||||
public static String RECEIVED_OTHER_TASK=null;//其他-领取任务
|
||||
public static String RECEIVED_OTHER_TASK = null;//其他-领取任务
|
||||
//172.23.139.4:8003/poitask/1/receivedPoitask/1
|
||||
public static String RECEIVED_POI_TASK=null;//poi-领取任务
|
||||
public static String RECEIVED_POI_TASK = null;//poi-领取任务
|
||||
//172.23.139.4:8003/poitask/1/submitPoitask?taskId=5001&name=测试修改名称&address=测试修改地址&existence=1&geo=1rn7exd5uhxy&memo=测试备注...33.
|
||||
public static String SUBMIT_POI_TASK=null;//poi-保存本地
|
||||
public static String SUBMIT_POI_TASK = null;//poi-保存本地
|
||||
//172.23.139.4:8003/othertask/1/submitOhtertask?taskId=5001&name=测试修改名称&address=测试修改地址&existence=1&geo=1rn7exd5uhxy&memo=测试备注
|
||||
public static String SUBMIT_OTHER_TASK=null;//其他-保存本地
|
||||
public static String SUBMIT_OTHER_TASK = null;//其他-保存本地
|
||||
//172.23.139.4:8003/othertask/1/uploadpic
|
||||
public static String OTHER_TASK_UPLOAD_PIC=null;//其他-上传
|
||||
public static String OTHER_TASK_UPLOAD_PIC = null;//其他-上传
|
||||
//172.23.139.4:8003/ctask/1/receivedCtask/8608
|
||||
public static String RECEIVED_CTASK=null;//充电站-领取任务
|
||||
public static String RECEIVED_CTASK = null;//充电站-领取任务
|
||||
//172.23.139.4:8003/ctask/1/submitCtask?id=8608&name=充电站&address=地址&telephone=18812345678|14712345678&geo=1rn7exd5uhxy&memo=测试备注&sptype=1
|
||||
public static String SUBMIT_CTASK=null;//充电站-保存本地
|
||||
public static String SUBMIT_CTASK = null;//充电站-保存本地
|
||||
//172.23.139.4:8003/cstask/1/submitCstask?taskId=0&name=充电站&geo=1rn7exd5uhxy&memo=测试备注&sptype=1&ffid=104&existence=1&detail={"cp_openType":"1,2","cp_floor":1,"cp_availableState":0,"sign_exist":0}
|
||||
public static String SUBMIT_CSTASK=null;//充电桩保存
|
||||
public static String SUBMIT_CSTASK = null;//充电桩保存
|
||||
//172.23.139.4:8003/poitask/1/uploadpic
|
||||
public static String POI_TASK_UPLOAD_PIC=null;//poi-上传
|
||||
public static String POI_TASK_UPLOAD_PIC = null;//poi-上传
|
||||
//172.23.139.4:8003/roadtask/1/receivedRoadtask/8569
|
||||
public static String RECEIVED_ROAD_TASK=null;//道路任务获取
|
||||
public static String RECEIVED_ROAD_TASK = null;//道路任务获取
|
||||
//172.23.139.4:8003/poivideotask/1/receivedPoivideotask/8569
|
||||
public static String RECEIVED_POI_VIDEO_TASK=null;//poi录像任务获取
|
||||
public static String RECEIVED_POI_VIDEO_TASK = null;//poi录像任务获取
|
||||
// 172.23.139.4:8003/poivideotask/1/submitPoivideotask
|
||||
public static String INSIDE_API_LIST=null;//poi录像 保存
|
||||
public static String INSIDE_API_LIST = null;//poi录像 保存
|
||||
//172.23.139.4:8003/poivideotask/1/uploadpic
|
||||
public static String POI_VIDEO_UPLOAD_PIC=null;//poi录像-上传
|
||||
public static String POI_VIDEO_UPLOAD_PIC = null;//poi录像-上传
|
||||
//172.23.139.4:8003/roadtask/1/submitRoadtask?taskId=0&name=段哥&address=二娃&memo=1rn7exd5uhxy&workType=2
|
||||
public static String ROAD_TASK_SUBMIT=null;//道路录像-保存本地
|
||||
public static String ROAD_TASK_SUBMIT = null;//道路录像-保存本地
|
||||
//172.23.139.4:8003/roadtask/1/uploadpic
|
||||
public static String ROAD_TASK_UPLOAD_PIC=null;//道路录像—上传
|
||||
public static String ROAD_TASK_UPLOAD_PIC = null;//道路录像—上传
|
||||
//172.23.139.4:8003/m4/task/1/getPhone?geo=1rn7exd5uhxy
|
||||
public static String GET_PHONES=null;//电话区号和电话位数
|
||||
public static String GET_PHONES = null;//电话区号和电话位数
|
||||
//172.23.139.4:8003/cstask/1/uploadpic
|
||||
public static String CS_TASK_UP_LOAD_PIC=null;//充电桩-上传
|
||||
public static String CS_TASK_UP_LOAD_PIC = null;//充电桩-上传
|
||||
//172.23.139.4:8003/ctask/1/uploadpic
|
||||
public static String C_TASK_UP_LOAD_PIC=null;//充电站-上传
|
||||
public static String C_TASK_UP_LOAD_PIC = null;//充电站-上传
|
||||
//172.23.139.4:8003/m4/task/1/taskName?geo=1rn7exd5uhxy&name=四维
|
||||
public static String TASK_NAME=null;//poi-查重
|
||||
public static String TASK_NAME = null;//poi-查重
|
||||
//172.23.139.4:8003/m4/task/1/getCommitList?type=2&pageSize=10&pageNum=1
|
||||
public static String GET_COMMIT_LIST=null;//纪录——已提交
|
||||
public static String RECEIVED_POLYGON_TASK=null; //面状任务任务领取
|
||||
public static String GET_COMMIT_LIST = null;//纪录——已提交
|
||||
public static String RECEIVED_POLYGON_TASK = null; //面状任务任务领取
|
||||
//172.23.139.4:8003/m4/task/1/unReceivedTask?taskIds=&auditIds=214,278 取消领取的接口
|
||||
public static String UNRECEIVED_POLYGON_TASK=null;//所有類型结束领取
|
||||
public static String COMPLETE=null;//面状任务结束领取
|
||||
public static String SUBMIT_POLYGON_TASK=null;//面状任务开始采集
|
||||
public static String UNRECEIVED_POLYGON_TASK = null;//所有類型结束领取
|
||||
public static String COMPLETE = null;//面状任务结束领取
|
||||
public static String SUBMIT_POLYGON_TASK = null;//面状任务开始采集
|
||||
//dtxbmaps.navinfo.com/dtxb_test/m4/msgList/InfoPush/28/push?type=0
|
||||
public static String MESSAGE_INFO_PUSH=null;//消息通知
|
||||
public static String MESSAGE_INFO_PUSH = null;//消息通知
|
||||
|
||||
public static void initHttpInter(String USERID) {
|
||||
/* 我的
|
||||
* Path=/m4/user/*
|
||||
* Path=/m4/user/*
|
||||
*/
|
||||
//172.23.139.4:8001/m4/user/update
|
||||
USER_UPDATE = IP + USER_PATH + "user/" + USERID + "/update";//用户资料
|
||||
@@ -143,7 +146,7 @@ public class HttpInterface {
|
||||
USER_DETAIL_BY_USER_ID = IP + USER_PATH + "user/" + USERID + "/getUserDetailByUserid/" + USERID; //获取用户信息
|
||||
//172.21.98.90:9999/m4/user/userGuide/1/insertUserGuide
|
||||
INSERT_USER_GUIDE = IP + USER_PATH + "userGuide/" + USERID + "/insertUserGuide";//引导页完成接口
|
||||
/* 发现
|
||||
/*发现
|
||||
* Path=/m4/msgList/**
|
||||
*/
|
||||
MSG_CONTENT = IP + MSG_LIST_PATH + "findAndMessage/" + USERID + "/msg_content";//发现 -富文本详情页请求
|
||||
@@ -170,7 +173,7 @@ public class HttpInterface {
|
||||
*Path=/m4/task/**
|
||||
*/
|
||||
///m4/task/task/10/receiveTasks 参数:taskIds
|
||||
RECEIVE_TASK=IP +TASK_PATH+"task/"+USERID+"/receiveTasks";//批量领取
|
||||
RECEIVE_TASK = IP + TASK_PATH + "task/" + USERID + "/receiveTasks";//批量领取
|
||||
//172.23.139.4:8003/m4/task/1/getList
|
||||
TASK_LIST = IP + TASK_PATH + "task/" + USERID + "/getList"; //任务搜索
|
||||
//172.23.139.4:8003/othertask/1/receivedOthertask
|
||||
@@ -219,6 +222,7 @@ public class HttpInterface {
|
||||
COMPLETE = IP + TASK_PATH + "polygonTask/" + USERID + "/complete";//面状任务结束领取
|
||||
SUBMIT_POLYGON_TASK = IP + TASK_PATH + "polygonTask/" + USERID + "/submitPolygontask";//面状任务开始采集
|
||||
}
|
||||
|
||||
public static String CONTACT_US = "";//联系我们
|
||||
public static String ABOUT_MAP = "";//关于 -关于地图寻宝
|
||||
public static String MAP_AGREEMENT = "";//地图寻宝服务协议
|
||||
|
||||
@@ -18,6 +18,7 @@ public abstract class JsonCallback<T> extends AbsCallback<T> {
|
||||
|
||||
private Type mType;
|
||||
private Class<T> clazz;
|
||||
|
||||
public JsonCallback() {
|
||||
}
|
||||
|
||||
|
||||
@@ -12,8 +12,10 @@ import com.lzy.okgo.cache.CacheEntity;
|
||||
import com.lzy.okgo.cache.CacheMode;
|
||||
import com.lzy.okgo.model.HttpHeaders;
|
||||
import com.lzy.okgo.model.HttpParams;
|
||||
import com.lzy.okgo.model.Progress;
|
||||
import com.lzy.okgo.model.Response;
|
||||
import com.lzy.okgo.request.PostRequest;
|
||||
import com.lzy.okgo.request.base.ProgressRequestBody;
|
||||
import com.navinfo.outdoor.api.UserApplication;
|
||||
import com.navinfo.outdoor.bean.PoiUploadBean;
|
||||
import com.navinfo.outdoor.util.Md5Util;
|
||||
@@ -32,10 +34,11 @@ import java.util.concurrent.TimeUnit;
|
||||
import okhttp3.FormBody;
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.RequestBody;
|
||||
|
||||
/**
|
||||
* 作用:OKGO帮助类-建造者模式
|
||||
* 作用:OK GO帮助类-建造者模式
|
||||
*/
|
||||
|
||||
public class OkGoBuilder<T> {
|
||||
@@ -153,6 +156,7 @@ public class OkGoBuilder<T> {
|
||||
|
||||
/**
|
||||
* post 发现-能力测评:
|
||||
* @param callback 回调
|
||||
*/
|
||||
public void postCapacity(Callback<T> callback) {
|
||||
if (!NetWorkUtils.iConnected(UserApplication.userApplication)) { // 当前网络不可用
|
||||
@@ -198,8 +202,9 @@ public class OkGoBuilder<T> {
|
||||
|
||||
/**
|
||||
* post异步请求
|
||||
* @param callback 回调
|
||||
*/
|
||||
public void postRequest(Callback<T> callback) {
|
||||
public void postRequest(UploadCallBack<T> callback) {
|
||||
if (!NetWorkUtils.iConnected(UserApplication.userApplication)) { // 当前网络不可用
|
||||
callback.onError(new Throwable("网络不可用"), 2);
|
||||
return;
|
||||
@@ -218,7 +223,7 @@ public class OkGoBuilder<T> {
|
||||
// .cacheKey("cacheKey")
|
||||
// 缓存模式,详细请看缓存介绍
|
||||
// .cacheMode(CacheMode.DEFAULT)
|
||||
.execute(new DialogCallback<T>(clazz) {
|
||||
.execute(new JsonCallback<T>(clazz) {
|
||||
@Override
|
||||
public void onSuccess(Response<T> response) {
|
||||
if (response.code() == 200) {
|
||||
@@ -242,6 +247,12 @@ public class OkGoBuilder<T> {
|
||||
UMCrash.generateCustomLog("网络请求报错-位置:OKGOBuilder" + throwable, "UmengException");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadProgress(Progress progress) {
|
||||
super.uploadProgress(progress);
|
||||
callback.uploadProgress(progress);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -274,9 +285,7 @@ public class OkGoBuilder<T> {
|
||||
|
||||
/**
|
||||
* post 文件 同步请求
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
* @return null
|
||||
*/
|
||||
public okhttp3.Response postFileSynchronization() {
|
||||
initTimeOut(time);
|
||||
@@ -290,7 +299,6 @@ public class OkGoBuilder<T> {
|
||||
// 请求的 tag, 主要用于取消对应的请求
|
||||
.params(params)
|
||||
.addFileParams("file", files)
|
||||
|
||||
.tag(this)
|
||||
.execute();
|
||||
} catch (IOException e) {
|
||||
@@ -302,12 +310,9 @@ public class OkGoBuilder<T> {
|
||||
|
||||
/**
|
||||
* post 文件 异步请求
|
||||
*
|
||||
* @param
|
||||
* @param callback
|
||||
* @return
|
||||
* @param callback 回调
|
||||
*/
|
||||
public void postFileAsynchronous(Callback callback) {
|
||||
public void postFileAsynchronous(UploadCallBack<T> callback) {
|
||||
if (!NetWorkUtils.iConnected(UserApplication.userApplication)) { // 当前网络不可用
|
||||
callback.onError(new Throwable("网络不可用"), 2);
|
||||
return;
|
||||
@@ -328,7 +333,7 @@ public class OkGoBuilder<T> {
|
||||
// .cacheKey("cacheKey")
|
||||
// 缓存模式,详细请看缓存介绍
|
||||
// .cacheMode(CacheMode.DEFAULT)
|
||||
.execute(new DialogCallback<T>(clazz) {
|
||||
.execute(new JsonCallback<T>(clazz) {
|
||||
@Override
|
||||
public void onSuccess(Response<T> response) {
|
||||
if (response.code() == 200) {
|
||||
@@ -340,7 +345,6 @@ public class OkGoBuilder<T> {
|
||||
|
||||
@Override
|
||||
public void onError(Response<T> response) {
|
||||
super.onError(response);
|
||||
Throwable throwable = response.getException();
|
||||
if (throwable != null) {
|
||||
throwable.printStackTrace();
|
||||
@@ -352,12 +356,16 @@ public class OkGoBuilder<T> {
|
||||
UMCrash.generateCustomLog("网络请求报错-位置:OKGOBuilder" + throwable, "UmengException");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadProgress(Progress progress) {
|
||||
callback.uploadProgress(progress);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* get异步请求
|
||||
/* get异步请求
|
||||
*/
|
||||
public void getRequest(Callback<T> callback) {
|
||||
if (!NetWorkUtils.iConnected(UserApplication.userApplication)) { // 当前网络不可用
|
||||
@@ -404,7 +412,7 @@ public class OkGoBuilder<T> {
|
||||
/**
|
||||
* get同步请求
|
||||
*
|
||||
* @return
|
||||
* @return null
|
||||
*/
|
||||
public okhttp3.Response getSynchronization() {
|
||||
initTimeOut(time);
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.navinfo.outdoor.http;
|
||||
|
||||
import com.lzy.okgo.model.Progress;
|
||||
|
||||
public interface UploadCallBack<T> {
|
||||
/**
|
||||
* 数据成功时候回调
|
||||
*
|
||||
* @param response 成功回调接口
|
||||
* @param id 成功码
|
||||
*/
|
||||
void onSuccess(T response, int id);
|
||||
/**
|
||||
* 数据上传时候进度
|
||||
*
|
||||
* @param progress 上传进度
|
||||
*/
|
||||
void uploadProgress(Progress progress);
|
||||
/**
|
||||
* 数据失败时候回调
|
||||
*
|
||||
* @param e 失败回调异常
|
||||
* @param id 失败码
|
||||
*/
|
||||
void onError(Throwable e, int id);
|
||||
|
||||
}
|
||||
@@ -14,7 +14,7 @@ import java.util.List;
|
||||
|
||||
import static androidx.room.ForeignKey.CASCADE;
|
||||
|
||||
/**
|
||||
/*
|
||||
* 充电桩的表结构
|
||||
* PoiEntity实体类的id和ChargingPileEntity实体类的pileId相关联
|
||||
* 注解中包含Delete = CASCADE, 你可以告诉SQLite,如果相应的PoiEntity实例被删除,那么删除这个PoiEntity下的所有ChargingPileEntity。
|
||||
|
||||
@@ -42,7 +42,7 @@ public class PoiEntity implements Serializable {
|
||||
private String y;//纬度
|
||||
private String detail;//需要保存的数据的wkt
|
||||
private String dist;//距离用户位置
|
||||
private int taskStatus;//任务状态 0.未领取 1.已领取,5 立即采集,2.未保存(保存到本地但未提交成功),3.已保存(保存到本地提交成功),4已上传(结束采集)6上传中,100 上传成功,200 上传失败
|
||||
private int taskStatus;//任务状态 0.未领取 1.已领取,5 立即采集,2.未保存(保存到本地但未提交成功),3.已保存(保存到本地提交成功),4已上传(结束采集)
|
||||
private int type;//1 "POI"2 "充电站"3 "POI录像"4 "道路录像"5 "其他"6 "面状任务"
|
||||
private int station_type;//1."充电站"2 "充换电站"3 "充电桩组"4 "换电站"5 "门牌", "公交:6 情报:7
|
||||
private int isLocalData;//是否是本地数据 0,服务 1,本地
|
||||
|
||||
@@ -148,7 +148,7 @@ public class ContactView {
|
||||
return itemView;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* 获取数据
|
||||
*/
|
||||
public List<PhoneBean> getPoiBeanListByRootView() {
|
||||
@@ -174,7 +174,7 @@ public class ContactView {
|
||||
return poiBeans;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* 检验数据
|
||||
*/
|
||||
public boolean getPhoneBean() {
|
||||
@@ -205,8 +205,6 @@ public class ContactView {
|
||||
|
||||
/**
|
||||
* 检验数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public int getPhoneList() {
|
||||
List<PhoneBean> list = getPoiBeanListByRootView();
|
||||
@@ -236,8 +234,6 @@ public class ContactView {
|
||||
|
||||
/**
|
||||
* 整理数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getList() {
|
||||
List<PhoneBean> list = getPoiBeanListByRootView();
|
||||
|
||||
@@ -56,8 +56,10 @@ public class AWMp4ParserHelper {
|
||||
|
||||
private final static String PREFIX_VIDEO_HANDLER = "vide";
|
||||
private final static String PREFIX_AUDIO_HANDLER = "soun";
|
||||
|
||||
/**
|
||||
* 合并视频
|
||||
*
|
||||
* @param inputVideos
|
||||
* @param outputPath
|
||||
* @throws IOException
|
||||
@@ -102,17 +104,18 @@ public class AWMp4ParserHelper {
|
||||
* */
|
||||
/**
|
||||
* 返回视频播放总时长
|
||||
*
|
||||
* @param vedioFile
|
||||
* @return
|
||||
*/
|
||||
public long getVedioTotalTime(File vedioFile){
|
||||
if (!vedioFile.exists()){
|
||||
Log.e("getVedioTotalTime","视频文件不存在");
|
||||
public long getVedioTotalTime(File vedioFile) {
|
||||
if (!vedioFile.exists()) {
|
||||
Log.e("getVedioTotalTime", "视频文件不存在");
|
||||
return 0;
|
||||
}
|
||||
MediaMetadataRetriever retriever = new MediaMetadataRetriever();
|
||||
retriever.setDataSource(vedioFile.getAbsolutePath());
|
||||
String timeString = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION);
|
||||
String timeString = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION);
|
||||
long time = Long.valueOf(timeString);
|
||||
return time;
|
||||
}
|
||||
@@ -193,34 +196,34 @@ public class AWMp4ParserHelper {
|
||||
|
||||
/**
|
||||
* 生成mp4文件拍摄的生成路径
|
||||
* */
|
||||
*/
|
||||
public File obtainMp4FilePath(String uuid, Object tag) {
|
||||
if (tag == null) {
|
||||
return new File(Constant.PICTURE_FOLDER,uuid+"-0.mp4");
|
||||
return new File(Constant.PICTURE_FOLDER, uuid + "-0.mp4");
|
||||
}
|
||||
List<File> fileList = (List<File>) tag;
|
||||
if (fileList == null || fileList.isEmpty()) {
|
||||
return new File(Constant.PICTURE_FOLDER,uuid+"-0.mp4");
|
||||
return new File(Constant.PICTURE_FOLDER, uuid + "-0.mp4");
|
||||
}
|
||||
int maxIndex = 0;
|
||||
for (int i = 0; i < fileList.size(); i++) {
|
||||
File file = fileList.get(i);
|
||||
if (file!=null) {
|
||||
if (file != null) {
|
||||
String[] fileSplite = file.getName().replace(".mp4", "").split("-");
|
||||
if (fileSplite!=null&&fileSplite.length>0&&fileSplite[fileSplite.length-1]!=null) {
|
||||
int index = Integer.parseInt(fileSplite[fileSplite.length-1]);
|
||||
if (index>=maxIndex) {
|
||||
if (fileSplite != null && fileSplite.length > 0 && fileSplite[fileSplite.length - 1] != null) {
|
||||
int index = Integer.parseInt(fileSplite[fileSplite.length - 1]);
|
||||
if (index >= maxIndex) {
|
||||
maxIndex = index;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return new File(Constant.PICTURE_FOLDER,uuid+"-"+(maxIndex+1)+".mp4");
|
||||
return new File(Constant.PICTURE_FOLDER, uuid + "-" + (maxIndex + 1) + ".mp4");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据文件夹路径生成最新的视频文件路径
|
||||
* */
|
||||
*/
|
||||
public File obtainMp4FilePath(String folderPath) {
|
||||
if (folderPath == null) {
|
||||
return null;
|
||||
@@ -232,33 +235,32 @@ public class AWMp4ParserHelper {
|
||||
File[] fileList = folderFile.listFiles(new FileFilter() {
|
||||
@Override
|
||||
public boolean accept(File pathname) {
|
||||
if (pathname.getName().endsWith(".mp4")){
|
||||
if (pathname.getName().endsWith(".mp4")) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
if (fileList == null || fileList.length==0) {
|
||||
return new File(folderPath+"/0.mp4");
|
||||
if (fileList == null || fileList.length == 0) {
|
||||
return new File(folderPath + "/0.mp4");
|
||||
}
|
||||
int maxIndex = 0;
|
||||
for (int i = 0; i < fileList.length; i++) {
|
||||
File file = fileList[i];
|
||||
if (file!=null) {
|
||||
if (file != null) {
|
||||
int index = Integer.parseInt(file.getName().replace(".mp4", ""));
|
||||
if (index>=maxIndex) {
|
||||
if (index >= maxIndex) {
|
||||
maxIndex = index;
|
||||
}
|
||||
}
|
||||
}
|
||||
return new File(folderPath+"/"+(maxIndex+1)+".mp4");
|
||||
return new File(folderPath + "/" + (maxIndex + 1) + ".mp4");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 根据文件夹路径生成最新的视频文件路径
|
||||
* */
|
||||
*/
|
||||
public File obtainWebpFilePath(String folderPath) {
|
||||
if (folderPath == null) {
|
||||
return null;
|
||||
@@ -270,26 +272,26 @@ public class AWMp4ParserHelper {
|
||||
File[] fileList = folderFile.listFiles(new FileFilter() {
|
||||
@Override
|
||||
public boolean accept(File pathname) {
|
||||
if (pathname.getName().endsWith(".webp")){
|
||||
if (pathname.getName().endsWith(".webp")) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
if (fileList == null || fileList.length==0) {
|
||||
return new File(folderPath+"/0.webp");
|
||||
if (fileList == null || fileList.length == 0) {
|
||||
return new File(folderPath + "/0.webp");
|
||||
}
|
||||
int maxIndex = 0;
|
||||
for (int i = 0; i < fileList.length; i++) {
|
||||
File file = fileList[i];
|
||||
if (file!=null) {
|
||||
if (file != null) {
|
||||
int index = Integer.parseInt(file.getName().replace(".webp", ""));
|
||||
if (index>=maxIndex) {
|
||||
if (index >= maxIndex) {
|
||||
maxIndex = index;
|
||||
}
|
||||
}
|
||||
}
|
||||
return new File(folderPath+"/"+(maxIndex+1)+".webp");
|
||||
return new File(folderPath + "/" + (maxIndex + 1) + ".webp");
|
||||
}
|
||||
|
||||
public File obtainJpgFilePath(String folderPath) {
|
||||
@@ -303,62 +305,63 @@ public class AWMp4ParserHelper {
|
||||
File[] fileList = folderFile.listFiles(new FileFilter() {
|
||||
@Override
|
||||
public boolean accept(File pathname) {
|
||||
if (pathname.getName().endsWith(".jpg")){
|
||||
if (pathname.getName().endsWith(".jpg")) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
if (fileList == null || fileList.length==0) {
|
||||
return new File(folderPath+"/0.jpg");
|
||||
if (fileList == null || fileList.length == 0) {
|
||||
return new File(folderPath + "/0.jpg");
|
||||
}
|
||||
int maxIndex = 0;
|
||||
for (int i = 0; i < fileList.length; i++) {
|
||||
File file = fileList[i];
|
||||
if (file!=null) {
|
||||
if (file != null) {
|
||||
int index = Integer.parseInt(file.getName().replace(".jpg", ""));
|
||||
if (index>=maxIndex) {
|
||||
if (index >= maxIndex) {
|
||||
maxIndex = index;
|
||||
}
|
||||
}
|
||||
}
|
||||
return new File(folderPath+"/"+(maxIndex+1)+".jpg");
|
||||
return new File(folderPath + "/" + (maxIndex + 1) + ".jpg");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据提供的uuid,获取指定目录下所有的文件
|
||||
* */
|
||||
*/
|
||||
public List<File> getFileListByUUID(String uuid) {
|
||||
List<File> fileList = new ArrayList<>();
|
||||
if (StringUtils.isEmpty(uuid)) {
|
||||
return fileList;
|
||||
}
|
||||
File folderFile = new File(Constant.PICTURE_FOLDER+"/"+uuid+"/");
|
||||
File folderFile = new File(Constant.PICTURE_FOLDER + "/" + uuid + "/");
|
||||
if (!folderFile.exists()) {
|
||||
folderFile.mkdirs();
|
||||
return fileList;
|
||||
}
|
||||
for (File videoFile: folderFile.listFiles()) {
|
||||
for (File videoFile : folderFile.listFiles()) {
|
||||
fileList.add(videoFile);
|
||||
}
|
||||
return fileList;
|
||||
}
|
||||
public File getFilePath(String uuid){
|
||||
File folderFile = new File(Constant.PICTURE_FOLDER+"/"+uuid);
|
||||
|
||||
public File getFilePath(String uuid) {
|
||||
File folderFile = new File(Constant.PICTURE_FOLDER + "/" + uuid);
|
||||
return folderFile;
|
||||
}
|
||||
|
||||
public String getVideoFileListStr(List<File> videoFileList) {
|
||||
StringBuilder resultStrBuilder = new StringBuilder("");
|
||||
if (videoFileList == null || videoFileList.size()<=0){
|
||||
if (videoFileList == null || videoFileList.size() <= 0) {
|
||||
return resultStrBuilder.toString();
|
||||
}
|
||||
|
||||
for (int i = 0; i < videoFileList.size(); i++) {
|
||||
File f = videoFileList.get(i);
|
||||
resultStrBuilder.append(f.getAbsolutePath());
|
||||
if (i < videoFileList.size() -1) {
|
||||
if (i < videoFileList.size() - 1) {
|
||||
resultStrBuilder.append(",");
|
||||
}
|
||||
}
|
||||
@@ -367,7 +370,7 @@ public class AWMp4ParserHelper {
|
||||
|
||||
/**
|
||||
* 根据视频文件列表,获取到对应的轨迹数据
|
||||
* */
|
||||
*/
|
||||
public List<LatLng> getLineStringByFileList(List<File> videoFileList) {
|
||||
List<LatLng> latLngs = new ArrayList<>();
|
||||
if (videoFileList == null || videoFileList.isEmpty()) {
|
||||
@@ -379,7 +382,7 @@ public class AWMp4ParserHelper {
|
||||
|
||||
String path = videoFile.getPath() + ".txt";
|
||||
List<String> strings = FileUtils.readFileToList(path, "utf-8");
|
||||
if (strings!=null) {
|
||||
if (strings != null) {
|
||||
for (int i = 0; i < strings.size(); i++) {
|
||||
String[] split = strings.get(i).split(",");
|
||||
LatLng latLng = new LatLng();
|
||||
@@ -399,7 +402,7 @@ public class AWMp4ParserHelper {
|
||||
|
||||
/**
|
||||
* 根据图片文件列表,获取到对应的轨迹数据
|
||||
* */
|
||||
*/
|
||||
public List<LatLng> getLinePhotoByList(List<File> videoFileList) {
|
||||
List<LatLng> latLags = new ArrayList<>();
|
||||
if (videoFileList == null || videoFileList.isEmpty()) {
|
||||
@@ -407,10 +410,10 @@ public class AWMp4ParserHelper {
|
||||
}
|
||||
|
||||
for (int m = 0; m < videoFileList.size(); m++) {
|
||||
if (videoFileList.get(m).getPath().contains("paper.txt")){
|
||||
if (videoFileList.get(m).getPath().contains("paper.txt")) {
|
||||
File path = videoFileList.get(m);
|
||||
List<String> strings = FileUtils.readFileToList(path.getPath(), "utf-8");
|
||||
if (strings!=null) {
|
||||
if (strings != null) {
|
||||
for (int i = 0; i < strings.size(); i++) {
|
||||
String[] split = strings.get(i).split(",");
|
||||
LatLng latLng = new LatLng();
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
package com.navinfo.outdoor.util;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.navinfo.outdoor.bean.Info;
|
||||
import com.navinfo.outdoor.room.PoiDao;
|
||||
import com.navinfo.outdoor.room.PoiDatabase;
|
||||
import com.navinfo.outdoor.room.PoiEntity;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 删除数据库 已提交的数据,和本地的图片
|
||||
*/
|
||||
public class DataDeleteUtil {
|
||||
public void initData(Context context, List<PoiEntity> poiEntities) {
|
||||
PoiDatabase poiDatabase = PoiDatabase.getInstance(context);
|
||||
PoiDao poiDao = poiDatabase.getPoiDao();
|
||||
for (int i = 0; i < poiEntities.size(); i++) {
|
||||
int taskStatus = poiEntities.get(i).getTaskStatus();
|
||||
if (taskStatus==1){
|
||||
poiDao.deleteFormName(taskStatus);
|
||||
List<Info> photoInfo = poiEntities.get(i).getPhotoInfo();
|
||||
for (int i1 = 0; i1 < photoInfo.size(); i1++) {
|
||||
File deleteImage = new File(photoInfo.get(i1).getPhoto());
|
||||
deleteImage.delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,12 +14,14 @@ import com.kongzue.dialog.util.BaseDialog;
|
||||
import com.kongzue.dialog.util.DialogSettings;
|
||||
import com.kongzue.dialog.v3.MessageDialog;
|
||||
import com.lzy.okgo.model.HttpParams;
|
||||
import com.lzy.okgo.model.Progress;
|
||||
import com.navinfo.outdoor.api.Constant;
|
||||
import com.navinfo.outdoor.bean.LoginOauthTokenBean;
|
||||
import com.navinfo.outdoor.bean.UserDetailBean;
|
||||
import com.navinfo.outdoor.http.Callback;
|
||||
import com.navinfo.outdoor.http.HttpInterface;
|
||||
import com.navinfo.outdoor.http.OkGoBuilder;
|
||||
import com.navinfo.outdoor.http.UploadCallBack;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -67,7 +69,7 @@ public class FlushTokenUtil {
|
||||
.url(HttpInterface.USER_LOGIN_OAUTH_TOKEN)
|
||||
.params(httpParams)
|
||||
.cls(LoginOauthTokenBean.class);
|
||||
okGoBuilder.postRequest(new Callback<LoginOauthTokenBean>() {
|
||||
okGoBuilder.postRequest(new UploadCallBack<LoginOauthTokenBean>() {
|
||||
@Override
|
||||
public void onSuccess(LoginOauthTokenBean response, int id) {
|
||||
if (response.getCode() == 200) {
|
||||
@@ -96,6 +98,11 @@ public class FlushTokenUtil {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadProgress(Progress progress) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e, int id) {
|
||||
String message = e.getMessage();
|
||||
|
||||
@@ -25,203 +25,214 @@ import java.util.Locale;
|
||||
@SuppressLint("MissingPermission")
|
||||
public class GPSUtils {
|
||||
|
||||
// private static LocationManager mLocationManager;
|
||||
//
|
||||
// private static final String TAG = "GPSUtils";
|
||||
//
|
||||
// private static Location mLocation = null;
|
||||
//
|
||||
// private static Activity mContext;
|
||||
//
|
||||
// public GPSUtils(Activity context) {
|
||||
// this.mContext = context;
|
||||
// mLocationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
|
||||
//
|
||||
// // 判断GPS是否正常启动
|
||||
// if (!mLocationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
|
||||
// Toast.makeText(context, "请开启GPS导航...", Toast.LENGTH_SHORT).show();
|
||||
// // 返回开启GPS导航设置界面
|
||||
// Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
|
||||
// context.startActivityForResult(intent, 0);
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// // 为获取地理位置信息时设置查询条件
|
||||
// String bestProvider = mLocationManager.getBestProvider(getCriteria(), true);
|
||||
// // 获取位置信息
|
||||
// // 如果不设置查询要求,getLastKnownLocation方法传人的参数为LocationManager.GPS_PROVIDER
|
||||
// Location location = mLocationManager.getLastKnownLocation(bestProvider);
|
||||
//// getLocationData(location);
|
||||
// mLocation = location;
|
||||
// // 监听状态
|
||||
// mLocationManager.addGpsStatusListener(listener);
|
||||
//
|
||||
// // 绑定监听,有4个参数
|
||||
// // 参数1,设备:有GPS_PROVIDER和NETWORK_PROVIDER两种
|
||||
// // 参数2,位置信息更新周期,单位毫秒
|
||||
// // 参数3,位置变化最小距离:当位置距离变化超过此值时,将更新位置信息
|
||||
// // 参数4,监听
|
||||
// // 备注:参数2和3,如果参数3不为0,则以参数3为准;参数3为0,则通过时间来定时更新;两者为0,则随时刷新
|
||||
//
|
||||
// // 1秒更新一次,或最小位移变化超过1米更新一次;
|
||||
// // 注意:此处更新准确度非常低,推荐在service里面启动一个Thread,在run中sleep(10000);然后执行handler.sendMessage(),更新位置
|
||||
// mLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 1, locationListener);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 返回查询条件
|
||||
// *
|
||||
// * @return
|
||||
// */
|
||||
// private static Criteria getCriteria() {
|
||||
// Criteria criteria = new Criteria();
|
||||
// // 设置定位精确度 Criteria.ACCURACY_COARSE比较粗略,Criteria.ACCURACY_FINE则比较精细
|
||||
// criteria.setAccuracy(Criteria.ACCURACY_FINE);
|
||||
// // 设置是否要求速度
|
||||
// criteria.setSpeedRequired(false);
|
||||
// // 设置是否允许运营商收费
|
||||
// criteria.setCostAllowed(false);
|
||||
// // 设置是否需要方位信息
|
||||
// criteria.setBearingRequired(false);
|
||||
// // 设置是否需要海拔信息
|
||||
// criteria.setAltitudeRequired(false);
|
||||
// // 设置对电源的需求
|
||||
// criteria.setPowerRequirement(Criteria.POWER_LOW);
|
||||
// return criteria;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * @return Location--->getLongitude()获取经度/getLatitude()获取纬度
|
||||
// */
|
||||
// public static Location getLocation() {
|
||||
// if (mLocation == null) {
|
||||
// Log.e("GPSUtils", "setLocationData: 获取当前位置信息为空");
|
||||
// return null;
|
||||
// }
|
||||
// return mLocation;
|
||||
// }
|
||||
//
|
||||
// public static String getLocalCity(){
|
||||
// if (mLocation==null){
|
||||
// Log.e("GPSUtils", "getLocalCity: 获取城市信息为空");
|
||||
// return "";
|
||||
// }
|
||||
// List<Address> result = getAddress(mLocation);
|
||||
//
|
||||
// String city = "";
|
||||
// if (result != null && result.size() > 0) {
|
||||
// city = result.get(0).getLocality();//获取城市
|
||||
// }
|
||||
// return city;
|
||||
// }
|
||||
//
|
||||
// public static String getAddressStr(){
|
||||
// if (mLocation==null){
|
||||
// Log.e("GPSUtils", "getAddressStr: 获取详细地址信息为空");
|
||||
// return "";
|
||||
// }
|
||||
// List<Address> result = getAddress(mLocation);
|
||||
//
|
||||
// String address = "";
|
||||
// if (result != null && result.size() > 0) {
|
||||
// address = result.get(0).getAddressLine(0);//获取详细地址
|
||||
// }
|
||||
// return address;
|
||||
// }
|
||||
//
|
||||
// // 位置监听
|
||||
// private static LocationListener locationListener = new LocationListener() {
|
||||
//
|
||||
// //位置信息变化时触发
|
||||
// public void onLocationChanged(Location location) {
|
||||
// mLocation = location;
|
||||
// Log.i(TAG, "时间:" + location.getTime());
|
||||
// Log.i(TAG, "经度:" + location.getLongitude());
|
||||
// Log.i(TAG, "纬度:" + location.getLatitude());
|
||||
// Log.i(TAG, "海拔:" + location.getAltitude());
|
||||
// }
|
||||
//
|
||||
// //GPS状态变化时触发
|
||||
// public void onStatusChanged(String provider, int status, Bundle extras) {
|
||||
// switch (status) {
|
||||
// // GPS状态为可见时
|
||||
// case LocationProvider.AVAILABLE:
|
||||
// Log.i(TAG, "当前GPS状态为可见状态");
|
||||
// break;
|
||||
// // GPS状态为服务区外时
|
||||
// case LocationProvider.OUT_OF_SERVICE:
|
||||
// Log.i(TAG, "当前GPS状态为服务区外状态");
|
||||
// break;
|
||||
// // GPS状态为暂停服务时
|
||||
// case LocationProvider.TEMPORARILY_UNAVAILABLE:
|
||||
// Log.i(TAG, "当前GPS状态为暂停服务状态");
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// //GPS开启时触发
|
||||
// public void onProviderEnabled(String provider) {
|
||||
// Location location = mLocationManager.getLastKnownLocation(provider);
|
||||
// mLocation = location;
|
||||
// }
|
||||
//
|
||||
// //GPS禁用时触发
|
||||
// public void onProviderDisabled(String provider) {
|
||||
// mLocation = null;
|
||||
// }
|
||||
// };
|
||||
//
|
||||
// // 获取地址信息
|
||||
// private static List<Address> getAddress(Location location) {
|
||||
// List<Address> result = null;
|
||||
// try {
|
||||
// if (location != null) {
|
||||
// Geocoder gc = new Geocoder(mContext, Locale.getDefault());
|
||||
// result = gc.getFromLocation(location.getLatitude(),
|
||||
// location.getLongitude(), 1);
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// return result;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// // 状态监听
|
||||
// GpsStatus.Listener listener = new GpsStatus.Listener() {
|
||||
// public void onGpsStatusChanged(int event) {
|
||||
// switch (event) {
|
||||
// // 第一次定位
|
||||
// case GpsStatus.GPS_EVENT_FIRST_FIX:
|
||||
// Log.i(TAG, "第一次定位");
|
||||
// break;
|
||||
// // 卫星状态改变
|
||||
// case GpsStatus.GPS_EVENT_SATELLITE_STATUS:
|
||||
// Log.i(TAG, "卫星状态改变");
|
||||
// GpsStatus gpsStatus = mLocationManager.getGpsStatus(null);
|
||||
// // 获取卫星颗数的默认最大值
|
||||
// int maxSatellites = gpsStatus.getMaxSatellites();
|
||||
// // 创建一个迭代器保存所有卫星
|
||||
// Iterator<GpsSatellite> iters = gpsStatus.getSatellites()
|
||||
// .iterator();
|
||||
// int count = 0;
|
||||
// while (iters.hasNext() && count <= maxSatellites) {
|
||||
// GpsSatellite s = iters.next();
|
||||
// count++;
|
||||
// }
|
||||
// System.out.println("搜索到:" + count + "颗卫星");
|
||||
// break;
|
||||
// // 定位启动
|
||||
// case GpsStatus.GPS_EVENT_STARTED:
|
||||
// Log.i(TAG, "定位启动");
|
||||
// break;
|
||||
// // 定位结束
|
||||
// case GpsStatus.GPS_EVENT_STOPPED:
|
||||
// Log.i(TAG, "定位结束");
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// };
|
||||
private static LocationManager mLocationManager;
|
||||
|
||||
private static final String TAG = "GPSUtils";
|
||||
|
||||
private static Location mLocation = null;
|
||||
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private static Activity mContext;
|
||||
|
||||
public GPSUtils(Activity context) {
|
||||
mContext = context;
|
||||
mLocationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
|
||||
// 判断GPS是否正常启动
|
||||
if (!mLocationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
|
||||
Toast.makeText(context, "请开启GPS导航...", Toast.LENGTH_SHORT).show();
|
||||
// 返回开启GPS导航设置界面
|
||||
Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
|
||||
context.startActivityForResult(intent, 0);
|
||||
return;
|
||||
}
|
||||
// 为获取地理位置信息时设置查询条件
|
||||
String bestProvider = mLocationManager.getBestProvider(getCriteria(), true);
|
||||
// 获取位置信息
|
||||
// 如果不设置查询要求,getLastKnownLocation方法传人的参数为LocationManager.GPS_PROVIDER
|
||||
assert bestProvider != null;
|
||||
// getLocationData(location);
|
||||
mLocation = mLocationManager.getLastKnownLocation(bestProvider);
|
||||
// 监听状态
|
||||
mLocationManager.addGpsStatusListener(listener);
|
||||
// 绑定监听,有4个参数
|
||||
// 参数1,设备:有GPS_PROVIDER和NETWORK_PROVIDER两种
|
||||
// 参数2,位置信息更新周期,单位毫秒
|
||||
// 参数3,位置变化最小距离:当位置距离变化超过此值时,将更新位置信息
|
||||
// 参数4,监听
|
||||
// 备注:参数2和3,如果参数3不为0,则以参数3为准;参数3为0,则通过时间来定时更新;两者为0,则随时刷新
|
||||
// 1秒更新一次,或最小位移变化超过1米更新一次;
|
||||
// 注意:此处更新准确度非常低,推荐在service里面启动一个Thread,在run中sleep(10000);然后执行handler.sendMessage(),更新位置
|
||||
mLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 1, locationListener);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回查询条件
|
||||
*/
|
||||
private static Criteria getCriteria() {
|
||||
Criteria criteria = new Criteria();
|
||||
// 设置定位精确度 Criteria.ACCURACY_COARSE比较粗略,Criteria.ACCURACY_FINE则比较精细
|
||||
criteria.setAccuracy(Criteria.ACCURACY_FINE);
|
||||
// 设置是否要求速度
|
||||
criteria.setSpeedRequired(false);
|
||||
// 设置是否允许运营商收费
|
||||
criteria.setCostAllowed(false);
|
||||
// 设置是否需要方位信息
|
||||
criteria.setBearingRequired(false);
|
||||
// 设置是否需要海拔信息
|
||||
criteria.setAltitudeRequired(false);
|
||||
// 设置对电源的需求
|
||||
criteria.setPowerRequirement(Criteria.POWER_LOW);
|
||||
return criteria;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return Location--->getLongitude()获取经度/getLatitude()获取纬度
|
||||
*/
|
||||
public static Location getLocation() {
|
||||
if (mLocation == null) {
|
||||
Log.e("GPSUtils", "setLocationData: 获取当前位置信息为空");
|
||||
return null;
|
||||
}
|
||||
return mLocation;
|
||||
}
|
||||
|
||||
public static String getLocalCity() {
|
||||
if (mLocation == null) {
|
||||
Log.e("GPSUtils", "getLocalCity: 获取城市信息为空");
|
||||
return "";
|
||||
}
|
||||
List<Address> result = getAddress(mLocation);
|
||||
|
||||
String city = "";
|
||||
if (result != null && result.size() > 0) {
|
||||
city = result.get(0).getLocality();//获取城市
|
||||
}
|
||||
return city;
|
||||
}
|
||||
|
||||
public static String getAddressStr() {
|
||||
if (mLocation == null) {
|
||||
Log.e("GPSUtils", "getAddressStr: 获取详细地址信息为空");
|
||||
return "";
|
||||
}
|
||||
List<Address> result = getAddress(mLocation);
|
||||
|
||||
String address = "";
|
||||
if (result != null && result.size() > 0) {
|
||||
address = result.get(0).getAddressLine(0);//获取详细地址
|
||||
}
|
||||
return address;
|
||||
}
|
||||
|
||||
// 位置监听
|
||||
private LocationListener locationListener = new LocationListener() {
|
||||
|
||||
//位置信息变化时触发
|
||||
public void onLocationChanged(Location location) {
|
||||
mLocation = location;
|
||||
Log.i(TAG, "时间:" + location.getTime());
|
||||
Log.i(TAG, "经度:" + location.getLongitude());
|
||||
Log.i(TAG, "纬度:" + location.getLatitude());
|
||||
Log.i(TAG, "海拔:" + location.getAltitude());
|
||||
}
|
||||
|
||||
//GPS状态变化时触发
|
||||
public void onStatusChanged(String provider, int status, Bundle extras) {
|
||||
switch (status) {
|
||||
// GPS状态为可见时
|
||||
case LocationProvider.AVAILABLE:
|
||||
Log.i(TAG, "当前GPS状态为可见状态");
|
||||
break;
|
||||
// GPS状态为服务区外时
|
||||
case LocationProvider.OUT_OF_SERVICE:
|
||||
Log.i(TAG, "当前GPS状态为服务区外状态");
|
||||
break;
|
||||
// GPS状态为暂停服务时
|
||||
case LocationProvider.TEMPORARILY_UNAVAILABLE:
|
||||
Log.i(TAG, "当前GPS状态为暂停服务状态");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//GPS开启时触发
|
||||
public void onProviderEnabled(String provider) {
|
||||
mLocation = mLocationManager.getLastKnownLocation(provider);
|
||||
}
|
||||
|
||||
//GPS禁用时触发
|
||||
public void onProviderDisabled(String provider) {
|
||||
mLocation = null;
|
||||
}
|
||||
};
|
||||
|
||||
// 获取地址信息
|
||||
private static List<Address> getAddress(Location location) {
|
||||
List<Address> result = null;
|
||||
try {
|
||||
if (location != null) {
|
||||
Geocoder gc = new Geocoder(mContext, Locale.getDefault());
|
||||
result = gc.getFromLocation(location.getLatitude(),
|
||||
location.getLongitude(), 1);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// 状态监听
|
||||
GpsStatus.Listener listener = new GpsStatus.Listener() {
|
||||
public void onGpsStatusChanged(int event) {
|
||||
switch (event) {
|
||||
// 第一次定位
|
||||
case GpsStatus.GPS_EVENT_FIRST_FIX:
|
||||
Log.i(TAG, "第一次定位");
|
||||
break;
|
||||
// 卫星状态改变
|
||||
case GpsStatus.GPS_EVENT_SATELLITE_STATUS:
|
||||
Log.i(TAG, "卫星状态改变");
|
||||
GpsStatus gpsStatus = mLocationManager.getGpsStatus(null);
|
||||
// 获取卫星颗数的默认最大值
|
||||
assert gpsStatus != null;
|
||||
int maxSatellites = gpsStatus.getMaxSatellites();
|
||||
// 创建一个迭代器保存所有卫星
|
||||
Iterator<GpsSatellite> inters = gpsStatus.getSatellites().iterator();
|
||||
int count = 0;
|
||||
while (inters.hasNext() && count <= maxSatellites) {
|
||||
GpsSatellite s = inters.next();
|
||||
count++;
|
||||
}
|
||||
if (onClickGPSStatus != null) {
|
||||
onClickGPSStatus.onGpsCount(count);
|
||||
}
|
||||
break;
|
||||
//定位启动
|
||||
case GpsStatus.GPS_EVENT_STARTED:
|
||||
Log.i(TAG, "定位启动");
|
||||
break;
|
||||
//定位结束
|
||||
case GpsStatus.GPS_EVENT_STOPPED:
|
||||
Log.i(TAG, "定位结束");
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public void Remove() {
|
||||
mLocationManager.removeUpdates(locationListener);
|
||||
mLocationManager.removeGpsStatusListener(listener);
|
||||
}
|
||||
|
||||
public OnClickGPSStatus onClickGPSStatus;
|
||||
|
||||
public void setOnClickGPSStatus(OnClickGPSStatus onClickGPSStatus) {
|
||||
this.onClickGPSStatus = onClickGPSStatus;
|
||||
}
|
||||
|
||||
public interface OnClickGPSStatus {
|
||||
void onGpsCount(int count);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -44,15 +44,12 @@ public class GeometryTools {
|
||||
|
||||
/**
|
||||
* 返回点几何
|
||||
* @param gp
|
||||
* @return Geometry
|
||||
*/
|
||||
public static Geometry createGeometry(LatLng gp) {
|
||||
if (gp != null) {
|
||||
Coordinate coordinate = new Coordinate(gp.getLongitude(), gp.getLatitude());
|
||||
GeometryFactory factory = new GeometryFactory();
|
||||
Geometry geo = factory.createPoint(coordinate);
|
||||
return geo;
|
||||
return factory.createPoint(coordinate);
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -61,8 +58,6 @@ public class GeometryTools {
|
||||
|
||||
/**
|
||||
* 返回点几何
|
||||
* @param formatDouble5
|
||||
* @return Geometry
|
||||
*/
|
||||
public static Geometry createGeometry(LatLng gp, boolean formatDouble5) {
|
||||
if (gp != null) {
|
||||
@@ -73,8 +68,7 @@ public class GeometryTools {
|
||||
coordinate = new Coordinate(gp.getLongitude(), gp.getLatitude());
|
||||
}
|
||||
GeometryFactory factory = new GeometryFactory();
|
||||
Geometry geo = factory.createPoint(coordinate);
|
||||
return geo;
|
||||
return factory.createPoint(coordinate);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -267,14 +261,11 @@ public class GeometryTools {
|
||||
|
||||
/**
|
||||
* 创建点
|
||||
*
|
||||
* @param coord
|
||||
* @return Point
|
||||
*/
|
||||
public com.vividsolutions.jts.geom.Point createPoint(Coordinate coord) {
|
||||
public com.vividsolutions.jts.geom.Point createPoint(Coordinate chord) {
|
||||
com.vividsolutions.jts.geom.Point point = null;
|
||||
GeometryFactory factory = new GeometryFactory();
|
||||
point = factory.createPoint(coord);
|
||||
point = factory.createPoint(chord);
|
||||
return point;
|
||||
}
|
||||
|
||||
@@ -292,32 +283,29 @@ public class GeometryTools {
|
||||
|
||||
WKTReader reader = new WKTReader();
|
||||
|
||||
Geometry geometrys;
|
||||
Geometry geometers;
|
||||
|
||||
try {
|
||||
|
||||
geometrys = reader.read(geometry);
|
||||
geometers = reader.read(geometry);
|
||||
|
||||
if (geometrys != null) {
|
||||
if (geometers != null) {
|
||||
|
||||
com.vividsolutions.jts.geom.Point point = geometrys
|
||||
com.vividsolutions.jts.geom.Point point = geometers
|
||||
.getInteriorPoint();
|
||||
|
||||
LatLng geoInteriorPoint = new LatLng(point.getY(), point.getX());
|
||||
|
||||
if (geometrys.getGeometryType().equalsIgnoreCase("Point")) {
|
||||
if (geometers.getGeometryType().equalsIgnoreCase("Point")) {
|
||||
|
||||
Coordinate coordinate = geometrys.getCoordinate();
|
||||
Coordinate coordinate = geometers.getCoordinate();
|
||||
|
||||
LatLng geo = new LatLng(coordinate.y, coordinate.x);
|
||||
return new LatLng(coordinate.y, coordinate.x);
|
||||
|
||||
return geo;
|
||||
|
||||
} else if (geometrys.getGeometryType().equalsIgnoreCase("LineString") || geometrys.getGeometryType().equalsIgnoreCase("MultiLineString")) {
|
||||
Coordinate[] coordinates = geometrys.getCoordinates();
|
||||
} else if (geometers.getGeometryType().equalsIgnoreCase("LineString") || geometers.getGeometryType().equalsIgnoreCase("MultiLineString")) {
|
||||
Coordinate[] coordinates = geometers.getCoordinates();
|
||||
if (coordinates != null && coordinates.length > 0) {
|
||||
LatLng geo = new LatLng(coordinates[0].y, coordinates[0].x);
|
||||
return geo;
|
||||
return new LatLng(coordinates[0].y, coordinates[0].x);
|
||||
} else {
|
||||
return geoInteriorPoint;
|
||||
}
|
||||
@@ -367,8 +355,7 @@ public class GeometryTools {
|
||||
double y1 = points.get(0).getLatitude();
|
||||
double x2 = points.get(1).getLongitude();
|
||||
double y2 = points.get(1).getLatitude();
|
||||
LatLng newPoint = new LatLng((y1 + y2) / 2, (x1 + x2) / 2);
|
||||
return newPoint;
|
||||
return new LatLng((y1 + y2) / 2, (x1 + x2) / 2);
|
||||
} else {
|
||||
double total = 0;
|
||||
ArrayList<Double> dList = new ArrayList<Double>();
|
||||
@@ -609,9 +596,7 @@ public class GeometryTools {
|
||||
|
||||
if (coors != null && coors.length > 1) {
|
||||
GeometryFactory factory = new GeometryFactory();
|
||||
LineString geo = factory.createLineString(coors);
|
||||
if (geo != null)
|
||||
return geo;
|
||||
return factory.createLineString(coors);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -636,9 +621,9 @@ public class GeometryTools {
|
||||
|
||||
public static String getPolygonString(List<LatLng> list) {
|
||||
if (list != null && list.size() > 2) {
|
||||
LatLng frist = list.get(0);
|
||||
LatLng first = list.get(0);
|
||||
LatLng last = list.get(list.size() - 1);
|
||||
if (frist.getLongitude() != last.getLongitude() || frist.getLatitude() != last.getLatitude()) {
|
||||
if (first.getLongitude() != last.getLongitude() || first.getLatitude() != last.getLatitude()) {
|
||||
return null;
|
||||
}
|
||||
Coordinate[] coors = new Coordinate[list.size()];
|
||||
@@ -659,7 +644,7 @@ public class GeometryTools {
|
||||
|
||||
public static String getMultiLineString(List<List<LatLng>> list) {
|
||||
if (list != null && !list.isEmpty()) {
|
||||
StringBuffer result = new StringBuffer();
|
||||
StringBuilder result = new StringBuilder();
|
||||
result.append("MULTILINESTRING(");
|
||||
for (int i = 0; i < list.size(); ++i) {
|
||||
List<LatLng> pointList = list.get(i);
|
||||
@@ -722,7 +707,7 @@ public class GeometryTools {
|
||||
multiLintString = multiLintString.substring(endIndex);
|
||||
}
|
||||
}
|
||||
if (resultList != null && !resultList.isEmpty()) {
|
||||
if (!resultList.isEmpty()) {
|
||||
return resultList;
|
||||
}
|
||||
}
|
||||
@@ -829,13 +814,13 @@ public class GeometryTools {
|
||||
Geometry pGeo = createGeometry(point);
|
||||
|
||||
if (lineGeo != null && lineGeo.getGeometryType().equals("LineString") && pGeo != null && pGeo.getGeometryType().equals("Point")) {
|
||||
Coordinate[] coords = lineGeo.getCoordinates();
|
||||
if (coords.length > 0) {
|
||||
Coordinate[] chords = lineGeo.getCoordinates();
|
||||
if (chords.length > 0) {
|
||||
|
||||
if (coords[coords.length - 1].x == pGeo.getCoordinate().x && coords[coords.length - 1].y == pGeo.getCoordinate().y)
|
||||
if (chords[chords.length - 1].x == pGeo.getCoordinate().x && chords[chords.length - 1].y == pGeo.getCoordinate().y)
|
||||
return true;
|
||||
|
||||
if (coords[coords.length - 1].x == pGeo.getCoordinate().x && coords[coords.length - 1].y == pGeo.getCoordinate().y)
|
||||
if (chords[chords.length - 1].x == pGeo.getCoordinate().x && chords[chords.length - 1].y == pGeo.getCoordinate().y)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,14 +7,11 @@ import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
/**
|
||||
/*
|
||||
* <读取Json文件的工具类>
|
||||
|
||||
*/
|
||||
|
||||
public class GetJsonDataUtil {
|
||||
|
||||
|
||||
public String getJson(Context context, String fileName) {
|
||||
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
|
||||
@@ -4,18 +4,6 @@ import java.io.UnsupportedEncodingException;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
/*******************************************************************************
|
||||
* 文件名: Md5Util.java <br>
|
||||
* 版本: 1.0<br>
|
||||
* 描述: Md5Util.java <br>
|
||||
* 版权所有: <br>
|
||||
* //////////////////////////////////////////////////////// <br>
|
||||
* 创建者: <br>
|
||||
* 创建日期: <br>
|
||||
* 修改者: <br>
|
||||
* 修改日期: <br>
|
||||
* 修改说明: <br>
|
||||
******************************************************************************/
|
||||
public class Md5Util {
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.navinfo.outdoor.util;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
|
||||
public class PictureName {
|
||||
public static String pictureDay() {
|
||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
String format = formatter.format(calendar.getTime());
|
||||
return format;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -33,7 +33,7 @@ import java.util.Objects;
|
||||
|
||||
import okhttp3.Response;
|
||||
|
||||
/**
|
||||
/*
|
||||
* Poi数据保存公共类
|
||||
*/
|
||||
public class PoiSaveUtils {
|
||||
@@ -104,37 +104,13 @@ public class PoiSaveUtils {
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 保存数据到本地,保存后taskStatus为2
|
||||
// * */
|
||||
// public void savePoiLocal(PoiEntity poiEntity) {
|
||||
// if (poiEntity!=null) {
|
||||
// XXPermissions.with(mContext)
|
||||
// //读写权限
|
||||
// .permission(Permission.MANAGE_EXTERNAL_STORAGE)
|
||||
// .request(new OnPermissionCallback() {
|
||||
// @Override
|
||||
// public void onGranted(List<String> permissions, boolean all) {
|
||||
// poiEntity.setTaskStatus(2);
|
||||
// InsertAndUpdateUtils.getInstance().insertOrUpdate(mContext, poiEntity);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onDenied(List<String> permissions, boolean never) {
|
||||
//
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
/*
|
||||
* 保存数据到服务
|
||||
*/
|
||||
public int savePoiNet(PoiEntity poiEntity) {
|
||||
if (poiEntity.getTaskStatus() >= 3) {
|
||||
if (poiEntity.getTaskStatus() >= 3 && poiEntity.getTaskStatus() != 100) {
|
||||
return 200;
|
||||
}
|
||||
String url = null;
|
||||
@@ -210,33 +186,11 @@ public class PoiSaveUtils {
|
||||
return poiSaveBean.getCode();
|
||||
}
|
||||
InsertAndUpdateUtils.getInstance().insertOrUpdate(mContext, poiEntity);
|
||||
Log.d("TAGss", "savePoiNet: 保存成功");
|
||||
Log.d("TAGSS", "savePoiNet: 保存成功");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return 200;
|
||||
// OkGoBuilder.getInstance()
|
||||
// .Builder(mContext)
|
||||
// .url(HttpInterface.SUBMIT_POI_TASK)
|
||||
// .method(OkGoBuilder.GET)
|
||||
// .cls(PoiSaveBean.class)
|
||||
// .params(httpParams)
|
||||
// .callback(new Callback<PoiSaveBean>() {
|
||||
// @Override
|
||||
// public void onSuccess(PoiSaveBean poiSaveBean, int id) {
|
||||
// Integer body = poiSaveBean.getBody();
|
||||
// poiEntity.setBodyId(body);
|
||||
// poiEntity.setTaskStatus(3);
|
||||
// InsertAndUpdateUtils.getInstance().insertOrUpdate(mContext, poiEntity);
|
||||
// Toast.makeText(mContext, "保存成功", Toast.LENGTH_SHORT).show();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onError(Throwable e, int id) {
|
||||
// Toast.makeText(mContext, e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
// Log.d("TAG", "onError: " + e.getMessage());
|
||||
// }
|
||||
// }).build();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -244,10 +198,12 @@ public class PoiSaveUtils {
|
||||
*/
|
||||
public void uploadPoiNet(PoiEntity poiEntity) {
|
||||
if (poiEntity == null) {
|
||||
bInt++;
|
||||
return;
|
||||
}
|
||||
int bodyId = poiEntity.getBodyId();
|
||||
if (bodyId == 0) {
|
||||
bInt++;
|
||||
return;
|
||||
}
|
||||
ArrayList<File> photoFile = new ArrayList<>();
|
||||
@@ -271,6 +227,9 @@ public class PoiSaveUtils {
|
||||
File fileZip = new File(Constant.PICTURE_FOLDER, "files" + ".zip");
|
||||
ZipUtil.zipFiles(videoFileList, fileZip, null);
|
||||
photoFile.add(fileZip);
|
||||
} else {
|
||||
bInt++;
|
||||
return;
|
||||
}
|
||||
if (photoFile.size() > 0) {
|
||||
long zipTrueSize = ZipUtils.getZipTrueSize(photoFile.get(0).getAbsolutePath());
|
||||
@@ -281,9 +240,7 @@ public class PoiSaveUtils {
|
||||
photoFile.get(i).delete();
|
||||
}
|
||||
bInt++;
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
} else if (poiEntity.getType() == 4) {
|
||||
List<File> videoFileList = AWMp4ParserHelper.getInstance().getFileListByUUID(poiEntity.getId());
|
||||
@@ -291,12 +248,17 @@ public class PoiSaveUtils {
|
||||
File fileZip = new File(Constant.PICTURE_FOLDER, "files" + ".zip");
|
||||
ZipUtil.zipFiles(videoFileList, fileZip, null);
|
||||
photoFile.add(fileZip);
|
||||
} else {
|
||||
Log.d("TAGSS", "videoFileList: 失败" + bInt);
|
||||
bInt++;
|
||||
return;
|
||||
}
|
||||
if (photoFile.size() > 0) {
|
||||
long zipTrueSize = ZipUtils.getZipTrueSize(photoFile.get(0).getAbsolutePath());
|
||||
if (zipTrueSize > 0) {
|
||||
initList(HttpInterface.ROAD_TASK_UPLOAD_PIC, photoFile, poiEntity);
|
||||
} else {
|
||||
Log.d("TAGSS", "photoFile: 失败" + bInt);
|
||||
for (int i = 0; i < photoFile.size(); i++) {
|
||||
photoFile.get(i).delete();
|
||||
}
|
||||
@@ -307,27 +269,6 @@ public class PoiSaveUtils {
|
||||
} else if (poiEntity.getType() == 5) {
|
||||
initList(HttpInterface.OTHER_TASK_UPLOAD_PIC, photoFile, poiEntity);
|
||||
}
|
||||
/* OkGo
|
||||
// 请求方式和请求url
|
||||
.<OtherUploadPicBean>post(HttpInterface.POI_TASK_UPLOAD_PIC)
|
||||
// 请求的 tag, 主要用于取消对应的请求
|
||||
.params("auditId", bodyId)
|
||||
.addFileParams("file", poiPicList)
|
||||
.tag(this)
|
||||
.execute(new DialogCallback<OtherUploadPicBean>(OtherUploadPicBean.class) {
|
||||
@Override
|
||||
public void onSuccess(Response<OtherUploadPicBean> otherUploadPicBeanResponse) {
|
||||
Toast.makeText(mContext, "上传成功", Toast.LENGTH_SHORT).show();
|
||||
PoiDatabase.getInstance(mContext).getPoiDao().deletePoiEntity(poiEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Response<OtherUploadPicBean> response) {
|
||||
super.onError(response);
|
||||
Toast.makeText(mContext, response.message() + "", Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onError: " + response.message() + "");
|
||||
}
|
||||
});*/
|
||||
}
|
||||
|
||||
private void initList(String url, List<File> list, PoiEntity poiEntity) {
|
||||
@@ -343,31 +284,35 @@ public class PoiSaveUtils {
|
||||
.fileList(list)
|
||||
.postFileSynchronization();
|
||||
if (execute == null) {
|
||||
Log.d("TAGSS", "execute: 失败" + bInt);
|
||||
bInt++;
|
||||
return;
|
||||
}
|
||||
if (execute.code() != 200) {
|
||||
Log.d("TAGSS", "code: 失败" + bInt);
|
||||
bInt++;
|
||||
return;
|
||||
}
|
||||
String bodyStr = execute.body().string();
|
||||
if (bodyStr==null){
|
||||
if (bodyStr == null) {
|
||||
Log.d("TAGSS", "bodyStr: 失败" + bInt);
|
||||
bInt++;
|
||||
return;
|
||||
}
|
||||
OtherUploadPicBean otherUploadPicBean = new Gson().fromJson(bodyStr, OtherUploadPicBean.class);
|
||||
if (otherUploadPicBean.getCode() == 200) {
|
||||
poiEntity.setChecked(false);
|
||||
poiEntity.setTaskStatus(100);
|
||||
PoiDatabase.getInstance(mContext).getPoiDao().updatePoiEntity(poiEntity);
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
list.get(i).delete();
|
||||
}
|
||||
PoiEntityDeleteUtil.getInstance().deleteUtil(mContext,poiEntity);
|
||||
Log.d("TAGss", "uploadPoiNet: 成功" + anInt);
|
||||
PoiEntityDeleteUtil.getInstance().deleteUtil(mContext, poiEntity);
|
||||
Log.d("TAGSS", "uploadPoiNet: 成功" + anInt);
|
||||
anInt++;
|
||||
return;
|
||||
} else {
|
||||
Log.d("TAGss", "uploadPoiNet: 失败" + bInt);
|
||||
Log.d("TAGSS", "uploadPoiNet: 失败" + bInt);
|
||||
bInt++;
|
||||
return;
|
||||
}
|
||||
@@ -383,13 +328,11 @@ public class PoiSaveUtils {
|
||||
boolean result = true;
|
||||
if (chargingStationPoiEntity != null) {
|
||||
List<ChargingPileEntity> chargingPileEntityList = PoiDatabase.getInstance(mContext).getChargingPileDao().getChargingPileByStationId(chargingStationPoiEntity.getId());
|
||||
PoiEntity poiEntity = PoiDatabase.getInstance(mContext).getPoiDao().getPoiEntity(chargingStationPoiEntity.getId());
|
||||
|
||||
if (chargingPileEntityList != null && !chargingPileEntityList.isEmpty()) {
|
||||
// 依次上传充电桩数据,如果有一条数据未上传成功,则返回false
|
||||
for (ChargingPileEntity pileEntity : chargingPileEntityList) {
|
||||
if (pileEntity.getBodyId() == 0) {
|
||||
int saveResult = saveChargingPile2NetWork(pileEntity, poiEntity.getBodyId());
|
||||
int saveResult = saveChargingPile2NetWork(pileEntity, chargingStationPoiEntity.getBodyId());
|
||||
if (saveResult == 200) {
|
||||
result = result & true;
|
||||
} else {
|
||||
@@ -399,7 +342,7 @@ public class PoiSaveUtils {
|
||||
}
|
||||
}
|
||||
}
|
||||
Log.d("TAGss", "saveChargingPileByChargingStation" + result);
|
||||
Log.d("TAGSS", "saveChargingPileByChargingStation" + result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -443,10 +386,10 @@ public class PoiSaveUtils {
|
||||
if (chargingPileSaveBean.getCode() != 200) {
|
||||
return chargingPileSaveBean.getCode();
|
||||
}
|
||||
Log.d("TAGss", "saveChargingPile2NetWork" + 200);
|
||||
Log.d("TAGSS", "saveChargingPile2NetWork" + 200);
|
||||
chargingPileEntity.setBodyId(chargingPileSaveBean.getBody());
|
||||
InsertAndUpdateUtils.getInstance().insertOrUpdateChargingPile(mContext, chargingPileEntity); // 更新当前充电桩的bodyId
|
||||
}else {
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
@@ -476,7 +419,7 @@ public class PoiSaveUtils {
|
||||
}
|
||||
}
|
||||
}
|
||||
Log.d("TAGss", "saveChargingPileUploadChargingStation" + result);
|
||||
Log.d("TAGSS", "saveChargingPileUploadChargingStation" + result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -514,55 +457,24 @@ public class PoiSaveUtils {
|
||||
if (execute.code() != 200) {
|
||||
return execute.code();
|
||||
}
|
||||
assert execute.body() != null;
|
||||
String pileUpLoadResultStr = execute.body().string();
|
||||
if (pileUpLoadResultStr != null) {
|
||||
Gson gson = new Gson();
|
||||
PoiUploadBean uploadBeanResult = gson.fromJson(pileUpLoadResultStr, PoiUploadBean.class);
|
||||
if (uploadBeanResult.getCode() == 200) {
|
||||
//PoiDatabase.getInstance(mContext).getChargingPileDao().deleteChargingPileEntity(chargingPileEntity);
|
||||
PoiDatabase.getInstance(mContext).getChargingPileDao().deleteChargingPileEntity(chargingPileEntity);
|
||||
for (int i = 0; i < chargingPileFileList.size(); i++) {
|
||||
chargingPileFileList.get(i).delete();
|
||||
}
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return 200;
|
||||
|
||||
// OkGo
|
||||
// // 请求方式和请求url
|
||||
// .<PoiUploadBean>post(HttpInterface.CS_TASK_UP_LOAD_PIC)
|
||||
// // 请求的 tag, 主要用于取消对应的请求
|
||||
// .params("auditId", chargingPileEntity.getBodyId())
|
||||
// .addFileParams("file", chargingPileFileList)
|
||||
// .tag(this)
|
||||
// .execute(new DialogCallback<PoiUploadBean>(PoiUploadBean.class) {
|
||||
// @Override
|
||||
// public void onSuccess(Response<PoiUploadBean> poiUploadBeanResponse) {
|
||||
// dismissLoadingDialog();
|
||||
// .makeText(getActivity(), "上传成功", Toast.LENGTH_SHORT).show();
|
||||
// isChargingPoleUploaded = true;
|
||||
// if (isChargeStationUploaded && isChargingPoleUploaded) {
|
||||
// getActivity().runOnUiThread(new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// getActivity().onBackPressed();//回退
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onError(Response<PoiUploadBean> poiUploadBeanResponse) {
|
||||
// super.onError(poiUploadBeanResponse);
|
||||
// dismissLoadingDialog();
|
||||
// Toast.makeText(getActivity(), poiUploadBeanResponse.code() + "", Toast.LENGTH_SHORT).show();
|
||||
// Log.d("TAG", "onError: " + poiUploadBeanResponse.code() + "");
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ public class PreserveUtils {
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* road
|
||||
* @param mContext
|
||||
*/
|
||||
@@ -64,7 +64,7 @@ public class PreserveUtils {
|
||||
public void run() {
|
||||
Message obtain1 = Message.obtain();
|
||||
obtain1.what = Constant.NEST_WORD_REGISTER;
|
||||
obtain1.obj = "道路:" + poiEntity.getName() + " 保存成功";
|
||||
obtain1.obj = "道路:" + poiEntity.getName() + " 保存至服务成功";
|
||||
EventBus.getDefault().post(obtain1);
|
||||
}
|
||||
});
|
||||
@@ -73,7 +73,7 @@ public class PreserveUtils {
|
||||
} else {
|
||||
Message obtain1 = Message.obtain();
|
||||
obtain1.what = Constant.NEST_WORD_REGISTER;
|
||||
obtain1.obj = "道路:" + poiEntity.getName() + " 保存失败";
|
||||
obtain1.obj = "道路:" + poiEntity.getName() + " 保存至服务失败";
|
||||
EventBus.getDefault().post(obtain1);
|
||||
}
|
||||
} else if (response.getCode() == 230) {
|
||||
@@ -81,7 +81,7 @@ public class PreserveUtils {
|
||||
} else {
|
||||
Message obtain1 = Message.obtain();
|
||||
obtain1.what = Constant.NEST_WORD_REGISTER;
|
||||
obtain1.obj = "道路:" + poiEntity.getName() + "保存失败";
|
||||
obtain1.obj = "道路:" + poiEntity.getName() + "保存至服务失败";
|
||||
EventBus.getDefault().post(obtain1);
|
||||
}
|
||||
}
|
||||
@@ -90,7 +90,7 @@ public class PreserveUtils {
|
||||
public void onError(Throwable e, int id) {
|
||||
Message obtain1 = Message.obtain();
|
||||
obtain1.what = Constant.NEST_WORD_REGISTER;
|
||||
obtain1.obj = "道路:" + poiEntity.getName() + " 保存失败";
|
||||
obtain1.obj = "道路:" + poiEntity.getName() + " 保存至服务失败";
|
||||
EventBus.getDefault().post(obtain1);
|
||||
}
|
||||
};
|
||||
@@ -118,7 +118,7 @@ public class PreserveUtils {
|
||||
public void run() {
|
||||
Message obtain1 = Message.obtain();
|
||||
obtain1.what = Constant.NEST_WORD_REGISTER;
|
||||
obtain1.obj = "Poi:" + poiEntity.getName() + " 保存成功";
|
||||
obtain1.obj = "Poi:" + poiEntity.getName() + " 保存至服务成功";
|
||||
EventBus.getDefault().post(obtain1);
|
||||
}
|
||||
});
|
||||
@@ -127,7 +127,7 @@ public class PreserveUtils {
|
||||
} else {
|
||||
Message obtain1 = Message.obtain();
|
||||
obtain1.what = Constant.NEST_WORD_REGISTER;
|
||||
obtain1.obj = "Poi:" + poiEntity.getName() + " 保存失败";
|
||||
obtain1.obj = "Poi:" + poiEntity.getName() + " 保存至服务失败";
|
||||
EventBus.getDefault().post(obtain1);
|
||||
}
|
||||
} else if (response.getCode() == 230) {
|
||||
@@ -135,7 +135,7 @@ public class PreserveUtils {
|
||||
} else {
|
||||
Message obtain1 = Message.obtain();
|
||||
obtain1.what = Constant.NEST_WORD_REGISTER;
|
||||
obtain1.obj = "Poi:" + poiEntity.getName() + "保存失败";
|
||||
obtain1.obj = "Poi:" + poiEntity.getName() + "保存至服务失败";
|
||||
EventBus.getDefault().post(obtain1);
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ public class PreserveUtils {
|
||||
public void onError(Throwable e, int id) {
|
||||
Message obtain1 = Message.obtain();
|
||||
obtain1.what = Constant.NEST_WORD_REGISTER;
|
||||
obtain1.obj = "Poi:" + poiEntity.getName() + " 保存失败";
|
||||
obtain1.obj = "Poi:" + poiEntity.getName() + " 保存至服务失败";
|
||||
EventBus.getDefault().post(obtain1);
|
||||
}
|
||||
};
|
||||
@@ -153,9 +153,7 @@ public class PreserveUtils {
|
||||
|
||||
/**
|
||||
* PoiVideo
|
||||
*
|
||||
* @param mContext
|
||||
* @return
|
||||
*/
|
||||
public Callback getPoiVideoPreserveCallback(Activity mContext, PoiEntity poiEntity) {
|
||||
return new Callback<PoiVideoBean>() {
|
||||
@@ -175,7 +173,7 @@ public class PreserveUtils {
|
||||
public void run() {
|
||||
Message obtain1 = Message.obtain();
|
||||
obtain1.what = Constant.NEST_WORD_REGISTER;
|
||||
obtain1.obj = "Poi录像:" + poiEntity.getName() + " 保存成功";
|
||||
obtain1.obj = "Poi录像:" + poiEntity.getName() + " 保存至服务成功";
|
||||
EventBus.getDefault().post(obtain1);
|
||||
}
|
||||
});
|
||||
@@ -184,7 +182,7 @@ public class PreserveUtils {
|
||||
} else {
|
||||
Message obtain1 = Message.obtain();
|
||||
obtain1.what = Constant.NEST_WORD_REGISTER;
|
||||
obtain1.obj = "Poi录像:" + poiEntity.getName() + " 保存失败";
|
||||
obtain1.obj = "Poi录像:" + poiEntity.getName() + " 保存至服务失败";
|
||||
EventBus.getDefault().post(obtain1);
|
||||
}
|
||||
} else if (response.getCode() == 230) {
|
||||
@@ -192,7 +190,7 @@ public class PreserveUtils {
|
||||
} else {
|
||||
Message obtain1 = Message.obtain();
|
||||
obtain1.what = Constant.NEST_WORD_REGISTER;
|
||||
obtain1.obj = "Poi录像:" + poiEntity.getName() + "保存失败";
|
||||
obtain1.obj = "Poi录像:" + poiEntity.getName() + "保存至服务失败";
|
||||
EventBus.getDefault().post(obtain1);
|
||||
}
|
||||
|
||||
@@ -202,16 +200,15 @@ public class PreserveUtils {
|
||||
public void onError(Throwable e, int id) {
|
||||
Message obtain1 = Message.obtain();
|
||||
obtain1.what = Constant.NEST_WORD_REGISTER;
|
||||
obtain1.obj = "Poi录像:" + poiEntity.getName() + " 保存失败";
|
||||
obtain1.obj = "Poi录像:" + poiEntity.getName() + " 保存至服务失败";
|
||||
EventBus.getDefault().post(obtain1);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* other
|
||||
* @param mContext
|
||||
* @return
|
||||
*/
|
||||
public Callback getOtherPreserveCallback(Activity mContext, PoiEntity poiEntity) {
|
||||
return new Callback<PoiSaveBean>() {
|
||||
@@ -231,7 +228,7 @@ public class PreserveUtils {
|
||||
public void run() {
|
||||
Message obtain1 = Message.obtain();
|
||||
obtain1.what = Constant.NEST_WORD_REGISTER;
|
||||
obtain1.obj = "其他:" + poiEntity.getName() + " 保存成功";
|
||||
obtain1.obj = "其他:" + poiEntity.getName() + " 保存至服务成功";
|
||||
EventBus.getDefault().post(obtain1);
|
||||
}
|
||||
});
|
||||
@@ -240,7 +237,7 @@ public class PreserveUtils {
|
||||
} else {
|
||||
Message obtain1 = Message.obtain();
|
||||
obtain1.what = Constant.NEST_WORD_REGISTER;
|
||||
obtain1.obj = "其他:" + poiEntity.getName() + " 保存失败";
|
||||
obtain1.obj = "其他:" + poiEntity.getName() + " 保存至服务失败";
|
||||
EventBus.getDefault().post(obtain1);
|
||||
}
|
||||
} else if (response.getCode() == 230) {
|
||||
@@ -248,7 +245,7 @@ public class PreserveUtils {
|
||||
} else {
|
||||
Message obtain1 = Message.obtain();
|
||||
obtain1.what = Constant.NEST_WORD_REGISTER;
|
||||
obtain1.obj = "其他:" + poiEntity.getName() + "保存失败";
|
||||
obtain1.obj = "其他:" + poiEntity.getName() + "保存至服务失败";
|
||||
EventBus.getDefault().post(obtain1);
|
||||
}
|
||||
|
||||
@@ -258,7 +255,7 @@ public class PreserveUtils {
|
||||
public void onError(Throwable e, int id) {
|
||||
Message obtain1 = Message.obtain();
|
||||
obtain1.what = Constant.NEST_WORD_REGISTER;
|
||||
obtain1.obj = "其他:" + poiEntity.getName() + " 保存失败";
|
||||
obtain1.obj = "其他:" + poiEntity.getName() + " 保存至服务失败";
|
||||
EventBus.getDefault().post(obtain1);
|
||||
}
|
||||
};
|
||||
@@ -288,7 +285,7 @@ public class PreserveUtils {
|
||||
public void run() {
|
||||
Message obtain1 = Message.obtain();
|
||||
obtain1.what = Constant.NEST_WORD_REGISTER;
|
||||
obtain1.obj = "充电站:" + poiEntity.getName() + " 保存成功";
|
||||
obtain1.obj = "充电站:" + poiEntity.getName() + " 保存至服务成功";
|
||||
EventBus.getDefault().post(obtain1);
|
||||
}
|
||||
});
|
||||
@@ -297,7 +294,7 @@ public class PreserveUtils {
|
||||
} else {
|
||||
Message obtain1 = Message.obtain();
|
||||
obtain1.what = Constant.NEST_WORD_REGISTER;
|
||||
obtain1.obj = "充电站:" + poiEntity.getName() + " 保存失败";
|
||||
obtain1.obj = "充电站:" + poiEntity.getName() + " 保存至服务失败";
|
||||
EventBus.getDefault().post(obtain1);
|
||||
}
|
||||
} else if (chargingStationBean.getCode() == 230) {
|
||||
@@ -305,7 +302,7 @@ public class PreserveUtils {
|
||||
} else {
|
||||
Message obtain1 = Message.obtain();
|
||||
obtain1.what = Constant.NEST_WORD_REGISTER;
|
||||
obtain1.obj = "充电站:" + poiEntity.getName() + " 保存失败";
|
||||
obtain1.obj = "充电站:" + poiEntity.getName() + " 保存至服务失败";
|
||||
EventBus.getDefault().post(obtain1);
|
||||
}
|
||||
}
|
||||
@@ -314,7 +311,7 @@ public class PreserveUtils {
|
||||
public void onError(Throwable e, int id) {
|
||||
Message obtain1 = Message.obtain();
|
||||
obtain1.what = Constant.NEST_WORD_REGISTER;
|
||||
obtain1.obj = "充电站:" + poiEntity.getName() + " 保存失败";
|
||||
obtain1.obj = "充电站:" + poiEntity.getName() + " 保存至服务失败";
|
||||
EventBus.getDefault().post(obtain1);
|
||||
Log.d("TAG", "onError: " + e.getMessage() + "");
|
||||
}
|
||||
@@ -327,11 +324,10 @@ public class PreserveUtils {
|
||||
private void saveChargingPileByChargingStation(Activity mContext,PoiEntity chargingStationPoiEntity) {
|
||||
if (chargingStationPoiEntity != null) {
|
||||
List<ChargingPileEntity> chargingPileEntityList = PoiDatabase.getInstance(mContext).getChargingPileDao().getChargingPileByStationId(chargingStationPoiEntity.getId());
|
||||
PoiEntity poiEntity = PoiDatabase.getInstance(mContext).getPoiDao().getPoiEntity(chargingStationPoiEntity.getId());
|
||||
if (chargingPileEntityList != null && !chargingPileEntityList.isEmpty()) {
|
||||
for (ChargingPileEntity pileEntity : chargingPileEntityList) {
|
||||
if (pileEntity.getBodyId() == 0) {
|
||||
saveChargingPileByWork(mContext,pileEntity, poiEntity.getBodyId());
|
||||
saveChargingPileByWork(mContext,pileEntity, chargingStationPoiEntity.getBodyId());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -369,16 +365,14 @@ public class PreserveUtils {
|
||||
ChargingPileSaveBean chargingPileSaveBean = gson.fromJson(responseBodyStr, ChargingPileSaveBean.class);
|
||||
if (chargingPileSaveBean.getCode() != 200) {
|
||||
return;
|
||||
}else {
|
||||
chargingPileEntity.setBodyId(chargingPileSaveBean.getBody());
|
||||
InsertAndUpdateUtils.getInstance().insertOrUpdateChargingPile(mContext, chargingPileEntity); // 更新当前充电桩的bodyId
|
||||
Log.d("TAGSS", "saveChargingPileByWork: "+chargingPileEntity.getName()+"保存成功");
|
||||
}
|
||||
chargingPileEntity.setBodyId(chargingPileSaveBean.getBody());
|
||||
InsertAndUpdateUtils.getInstance().insertOrUpdateChargingPile(mContext, chargingPileEntity); // 更新当前充电桩的bodyId
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.navinfo.outdoor.util;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
|
||||
public class SearchUpdateTxt {
|
||||
public static void initTxt(String path,String indexer){
|
||||
File file = new File(path);
|
||||
try {
|
||||
BufferedReader br = new BufferedReader(new FileReader(file));//读文件
|
||||
StringBuffer bf = new StringBuffer();
|
||||
String rl=null;//临时的每行数据
|
||||
while ((rl=br.readLine())!=null){
|
||||
String[] split = rl.split(",");
|
||||
if (split[1].equals(indexer)){
|
||||
bf.append("");
|
||||
}else {
|
||||
bf.append(rl+"\r\n");
|
||||
}
|
||||
}
|
||||
br.close();
|
||||
BufferedWriter out = new BufferedWriter(new FileWriter(file));
|
||||
out.write(bf.toString());
|
||||
out.flush();
|
||||
out.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,141 +0,0 @@
|
||||
package com.navinfo.outdoor.util;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.speech.tts.TextToSpeech;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.kongzue.dialog.util.DialogSettings;
|
||||
import com.kongzue.dialog.v3.MessageDialog;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
|
||||
//语音类
|
||||
public class SpeakMode extends Activity implements TextToSpeech.OnInitListener{
|
||||
private Activity mActivity;
|
||||
private TextToSpeech mTextToSpeech;//TTS对象
|
||||
private int status;
|
||||
private int MY_DATA_CHECK_CODE = 0;
|
||||
|
||||
private Handler mHandler = new Handler() {
|
||||
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
switch (msg.what) {
|
||||
case 0x11:
|
||||
try {
|
||||
HashMap<String, String> params = new HashMap<String, String>();
|
||||
|
||||
params.put(TextToSpeech.Engine.KEY_PARAM_STREAM, "STREAM_NOTIFICATION");//设置播放类型(音频流类型)
|
||||
|
||||
mTextToSpeech.speak(msg.obj + "", TextToSpeech.QUEUE_ADD, params);//将这个发音任务添加当前任务之后
|
||||
|
||||
//BaseToast.makeText(mActivity,msg.obj+"",Toast.LENGTH_LONG).show();
|
||||
|
||||
mTextToSpeech.playSilence(100, TextToSpeech.QUEUE_ADD, params);//间隔多长时间
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public SpeakMode(Activity activity) {
|
||||
|
||||
mActivity = activity;
|
||||
|
||||
if (mActivity != null && !mActivity.isFinishing())
|
||||
this.mTextToSpeech = new TextToSpeech(this.mActivity, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
Intent checkIntent = new Intent();
|
||||
checkIntent.setAction(TextToSpeech.Engine.ACTION_CHECK_TTS_DATA);
|
||||
startActivityForResult(checkIntent, MY_DATA_CHECK_CODE);
|
||||
}
|
||||
|
||||
public void setData(String json) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInit(int status) {
|
||||
this.status = status;
|
||||
if (this.mTextToSpeech != null) {
|
||||
int result = this.mTextToSpeech.setLanguage(Locale.CHINESE);
|
||||
if (result == TextToSpeech.LANG_MISSING_DATA
|
||||
|| result == TextToSpeech.LANG_NOT_SUPPORTED) {
|
||||
if (mActivity != null && !mActivity.isFinishing()) {
|
||||
DialogSettings.style = DialogSettings.STYLE.STYLE_IOS;
|
||||
MessageDialog.show((AppCompatActivity) mActivity, "提示", "设备不支持语音播报。", "确定");
|
||||
}
|
||||
}
|
||||
}
|
||||
Log.i("TextToSpeechDemo", String.valueOf(status));
|
||||
}
|
||||
|
||||
//读语音处理
|
||||
public void speakText(final String message) {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
if (mTextToSpeech != null) {
|
||||
Set<Locale> availableLanguages = mTextToSpeech.getAvailableLanguages();
|
||||
List<TextToSpeech.EngineInfo> engines = mTextToSpeech.getEngines();
|
||||
|
||||
int result = mTextToSpeech.setLanguage(Locale.CHINESE);
|
||||
|
||||
if (result == TextToSpeech.LANG_MISSING_DATA
|
||||
|| result == TextToSpeech.LANG_NOT_SUPPORTED) {
|
||||
|
||||
} else {
|
||||
if (mTextToSpeech != null && mTextToSpeech.isSpeaking()) {
|
||||
while (mTextToSpeech.isSpeaking()) {
|
||||
try {
|
||||
Thread.sleep(100);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Message msg = new Message();
|
||||
msg.what = 0x11;
|
||||
msg.obj = message;
|
||||
mHandler.sendMessage(msg);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
|
||||
}
|
||||
|
||||
public void stopSpeek() {
|
||||
try {
|
||||
|
||||
if (this.mTextToSpeech != null && this.mTextToSpeech.isSpeaking()) {
|
||||
this.mTextToSpeech.stop();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,12 +2,20 @@ package com.navinfo.outdoor.util;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Message;
|
||||
import android.text.format.Formatter;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.lzy.okgo.model.HttpParams;
|
||||
import com.lzy.okgo.model.Progress;
|
||||
import com.navinfo.outdoor.api.Constant;
|
||||
import com.navinfo.outdoor.bean.OtherUploadPicBean;
|
||||
import com.navinfo.outdoor.bean.PoiUploadBean;
|
||||
import com.navinfo.outdoor.http.Callback;
|
||||
import com.navinfo.outdoor.http.HttpInterface;
|
||||
import com.navinfo.outdoor.http.OkGoBuilder;
|
||||
import com.navinfo.outdoor.http.UploadCallBack;
|
||||
import com.navinfo.outdoor.room.ChargingPileEntity;
|
||||
import com.navinfo.outdoor.room.PoiDao;
|
||||
import com.navinfo.outdoor.room.PoiDatabase;
|
||||
@@ -16,10 +24,13 @@ import com.navinfo.outdoor.room.PoiEntity;
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import okhttp3.Response;
|
||||
|
||||
public class UploadUtils {
|
||||
private static UploadUtils instance;
|
||||
|
||||
@@ -37,14 +48,15 @@ public class UploadUtils {
|
||||
* @param showPoiEntity
|
||||
* @param fileZip
|
||||
*/
|
||||
public Callback getRoadUploadCallback(Activity mContext, PoiEntity showPoiEntity, File fileZip) {
|
||||
return new Callback<OtherUploadPicBean>() {
|
||||
public UploadCallBack getRoadUploadCallback(Activity mContext, PoiEntity showPoiEntity, File fileZip) {
|
||||
return new UploadCallBack<OtherUploadPicBean>() {
|
||||
@Override
|
||||
public void onSuccess(OtherUploadPicBean response, int id) {
|
||||
if (response.getCode() == 200) {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
showPoiEntity.setChecked(false);
|
||||
showPoiEntity.setTaskStatus(100);
|
||||
PoiDatabase.getInstance(mContext).getPoiDao().updatePoiEntity(showPoiEntity);
|
||||
if (showPoiEntity.getId()!=null){
|
||||
@@ -77,6 +89,16 @@ public class UploadUtils {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadProgress(Progress progress) {
|
||||
Log.d("TAG", "uploadProgress: "+progress);
|
||||
String downloadLength = Formatter.formatFileSize(mContext, progress.currentSize);
|
||||
String totalLength = Formatter.formatFileSize(mContext, progress.totalSize);
|
||||
Log.d("TAG", "uploadProgress: "+downloadLength+"/"+totalLength);
|
||||
String speed = Formatter.formatFileSize(mContext, progress.speed);
|
||||
Log.d("TAG", "uploadProgress: "+String.format("%s/s", speed));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e, int id) {
|
||||
Message obtain1 = Message.obtain();
|
||||
@@ -96,14 +118,15 @@ public class UploadUtils {
|
||||
* @param poiPicList
|
||||
* @return
|
||||
*/
|
||||
public Callback getPoiUploadCallback(Activity mContext, PoiEntity showPoiEntity, ArrayList<File> poiPicList) {
|
||||
return new Callback<OtherUploadPicBean>() {
|
||||
public UploadCallBack getPoiUploadCallback(Activity mContext, PoiEntity showPoiEntity, ArrayList<File> poiPicList) {
|
||||
return new UploadCallBack<OtherUploadPicBean>() {
|
||||
@Override
|
||||
public void onSuccess(OtherUploadPicBean response, int id) {
|
||||
if (response.getCode() == 200) {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
showPoiEntity.setChecked(false);
|
||||
showPoiEntity.setTaskStatus(100);
|
||||
PoiDatabase.getInstance(mContext).getPoiDao().updatePoiEntity(showPoiEntity);
|
||||
for (int i = 0; i < poiPicList.size(); i++) {
|
||||
@@ -131,6 +154,16 @@ public class UploadUtils {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadProgress(Progress progress) {
|
||||
Log.d("TAG", "uploadProgress: "+progress);
|
||||
String downloadLength = Formatter.formatFileSize(mContext, progress.currentSize);
|
||||
String totalLength = Formatter.formatFileSize(mContext, progress.totalSize);
|
||||
Log.d("TAG", "uploadProgress: "+downloadLength+"/"+totalLength);
|
||||
String speed = Formatter.formatFileSize(mContext, progress.speed);
|
||||
Log.d("TAG", "uploadProgress: "+String.format("%s/s", speed));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e, int id) {
|
||||
Message obtain1 = Message.obtain();
|
||||
@@ -149,14 +182,15 @@ public class UploadUtils {
|
||||
* @param fileZip
|
||||
* @return
|
||||
*/
|
||||
public Callback getPoiVideoUploadCallback(Activity mContext, PoiEntity showPoiEntity, File fileZip) {
|
||||
return new Callback<OtherUploadPicBean>() {
|
||||
public UploadCallBack getPoiVideoUploadCallback(Activity mContext, PoiEntity showPoiEntity, File fileZip) {
|
||||
return new UploadCallBack<OtherUploadPicBean>() {
|
||||
@Override
|
||||
public void onSuccess(OtherUploadPicBean response, int id) {
|
||||
if (response.getCode() == 200) {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
showPoiEntity.setChecked(false);
|
||||
showPoiEntity.setTaskStatus(100);
|
||||
PoiDatabase.getInstance(mContext).getPoiDao().updatePoiEntity(showPoiEntity);
|
||||
if (showPoiEntity.getId() != null) {
|
||||
@@ -189,6 +223,16 @@ public class UploadUtils {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadProgress(Progress progress) {
|
||||
Log.d("TAG", "uploadProgress: "+progress);
|
||||
String downloadLength = Formatter.formatFileSize(mContext, progress.currentSize);
|
||||
String totalLength = Formatter.formatFileSize(mContext, progress.totalSize);
|
||||
Log.d("TAG", "uploadProgress: "+downloadLength+"/"+totalLength);
|
||||
String speed = Formatter.formatFileSize(mContext, progress.speed);
|
||||
Log.d("TAG", "uploadProgress: "+String.format("%s/s", speed));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e, int id) {
|
||||
Message obtain1 = Message.obtain();
|
||||
@@ -208,14 +252,15 @@ public class UploadUtils {
|
||||
* @param otherUploadList
|
||||
* @return
|
||||
*/
|
||||
public Callback getOtherUploadCallback(Activity mContext, PoiEntity showPoiEntity, List<File> otherUploadList) {
|
||||
return new Callback<PoiUploadBean>() {
|
||||
public UploadCallBack getOtherUploadCallback(Activity mContext, PoiEntity showPoiEntity, List<File> otherUploadList) {
|
||||
return new UploadCallBack<PoiUploadBean>() {
|
||||
@Override
|
||||
public void onSuccess(PoiUploadBean response, int id) {
|
||||
if (response.getCode() == 200) {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
showPoiEntity.setChecked(false);
|
||||
showPoiEntity.setTaskStatus(100);
|
||||
PoiDatabase.getInstance(mContext).getPoiDao().updatePoiEntity(showPoiEntity);
|
||||
for (int i = 0; i < otherUploadList.size(); i++) {
|
||||
@@ -243,6 +288,16 @@ public class UploadUtils {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadProgress(Progress progress) {
|
||||
Log.d("TAG", "uploadProgress: "+progress);
|
||||
String downloadLength = Formatter.formatFileSize(mContext, progress.currentSize);
|
||||
String totalLength = Formatter.formatFileSize(mContext, progress.totalSize);
|
||||
Log.d("TAG", "uploadProgress: "+downloadLength+"/"+totalLength);
|
||||
String speed = Formatter.formatFileSize(mContext, progress.speed);
|
||||
Log.d("TAG", "uploadProgress: "+String.format("%s/s", speed));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e, int id) {
|
||||
Message obtain1 = Message.obtain();
|
||||
@@ -262,19 +317,23 @@ public class UploadUtils {
|
||||
* @param chargingStationList
|
||||
* @return
|
||||
*/
|
||||
public Callback getChargingUploadCallback(Activity mContext, PoiEntity showPoiEntity, ArrayList<File> chargingStationList) {
|
||||
return new Callback<PoiUploadBean>() {
|
||||
public UploadCallBack getChargingUploadCallback(Activity mContext, PoiEntity showPoiEntity, ArrayList<File> chargingStationList) {
|
||||
return new UploadCallBack<PoiUploadBean>() {
|
||||
@Override
|
||||
public void onSuccess(PoiUploadBean response, int id) {
|
||||
if (response.getCode() == 200) {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
showPoiEntity.setChecked(false);
|
||||
showPoiEntity.setTaskStatus(100);
|
||||
PoiDatabase.getInstance(mContext).getPoiDao().updatePoiEntity(showPoiEntity);
|
||||
for (int i = 0; i < chargingStationList.size(); i++) {
|
||||
chargingStationList.get(i).delete();
|
||||
}
|
||||
/*
|
||||
saveChargingPileUploadChargingStation(mContext,showPoiEntity);
|
||||
*/
|
||||
mContext.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -296,6 +355,16 @@ public class UploadUtils {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadProgress(Progress progress) {
|
||||
Log.d("TAG", "uploadProgress: "+progress);
|
||||
String downloadLength = Formatter.formatFileSize(mContext, progress.currentSize);
|
||||
String totalLength = Formatter.formatFileSize(mContext, progress.totalSize);
|
||||
Log.d("TAG", "uploadProgress: "+downloadLength+"/"+totalLength);
|
||||
String speed = Formatter.formatFileSize(mContext, progress.speed);
|
||||
Log.d("TAG", "uploadProgress: "+String.format("%s/s", speed));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e, int id) {
|
||||
Message obtain1 = Message.obtain();
|
||||
@@ -306,5 +375,60 @@ public class UploadUtils {
|
||||
}
|
||||
};
|
||||
}
|
||||
/*
|
||||
* 根据充电站数据检查充电桩数据,如果没有网络保存,则批量网络上传
|
||||
*/
|
||||
private void saveChargingPileUploadChargingStation(Activity mContent,PoiEntity chargingStationPoiEntity) {
|
||||
if (chargingStationPoiEntity != null) {
|
||||
// 首先批量上传充电桩数据
|
||||
List<ChargingPileEntity> chargingPileEntityList = PoiDatabase.getInstance(mContent).getChargingPileDao().getChargingPileByStationId(chargingStationPoiEntity.getId());
|
||||
if (chargingPileEntityList != null && !chargingPileEntityList.isEmpty()) {
|
||||
for (ChargingPileEntity chargingPileEntity : chargingPileEntityList) {
|
||||
if (chargingPileEntity.getBodyId() != 0) {
|
||||
chargingPileUploadNetWork(mContent,chargingPileEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 上传充电桩数据
|
||||
*/
|
||||
private void chargingPileUploadNetWork(Activity mContent, ChargingPileEntity chargingPileEntity) {
|
||||
List<File> chargingPileFileList = new ArrayList<>();
|
||||
if (chargingPileEntity.getPhotos() != null && !chargingPileEntity.getPhotos().isEmpty()) {
|
||||
for (String photoPath : chargingPileEntity.getPhotos()) {
|
||||
chargingPileFileList.add(new File(photoPath));
|
||||
}
|
||||
}
|
||||
try {
|
||||
HttpParams httpParams = new HttpParams();
|
||||
httpParams.put("auditId", chargingPileEntity.getBodyId());
|
||||
Response execute = OkGoBuilder.getInstance()
|
||||
.time(0)
|
||||
.url(HttpInterface.CS_TASK_UP_LOAD_PIC)
|
||||
.params(httpParams)
|
||||
.token(Constant.ACCESS_TOKEN)
|
||||
.fileList(chargingPileFileList)
|
||||
.postFileSynchronization();
|
||||
if (execute != null) {
|
||||
assert execute.body() != null;
|
||||
String pileUpLoadResultStr = execute.body().string();
|
||||
PoiUploadBean uploadBeanResult = new Gson().fromJson(pileUpLoadResultStr, PoiUploadBean.class);
|
||||
if (uploadBeanResult != null) {
|
||||
if (uploadBeanResult.getCode() == 200) {
|
||||
PoiDatabase.getInstance(mContent).getChargingPileDao().deleteChargingPileEntity(chargingPileEntity);
|
||||
for (int i = 0; i < chargingPileFileList.size(); i++) {
|
||||
chargingPileFileList.get(i).delete();
|
||||
}
|
||||
Log.d("TAGSS", "chargingPileUploadNetWork: 充电桩" + chargingPileEntity.getName() + "上传成功");
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
package com.navinfo.outdoor.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.wanghong.webpnative.WebPNative;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import static com.lzy.okgo.utils.HttpUtils.runOnUiThread;
|
||||
|
||||
public class WebpUtil {
|
||||
|
||||
public static void performEncodeImage(Context context, File imgFile, float quFloat) {
|
||||
if (imgFile.exists()) {
|
||||
WebPNative webPNative = new WebPNative();
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Bitmap bitmap = BitmapFactory.decodeFile(imgFile.getAbsolutePath());
|
||||
String[] split = imgFile.getName().split(".jpg");
|
||||
String output = imgFile.getParent() + File.separator + split[0] + ".webp";
|
||||
webPNative.encodeRGBA(bitmap, output, quFloat);
|
||||
imgFile.delete();
|
||||
/*long start = System.currentTimeMillis();
|
||||
long useTime = System.currentTimeMillis() - start;
|
||||
Log.e("WebpUtil:", String.valueOf(useTime));
|
||||
File file = new File(output.substring(0, output.length() - 5) + ".webp");
|
||||
new File(output).renameTo(file);*/
|
||||
if (!bitmap.isRecycled()) {
|
||||
bitmap.recycle();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.d("output:", e.toString());
|
||||
Toast.makeText(context, "文件转换失败", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
} else {
|
||||
Toast.makeText(context, "源文件不存在", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,7 @@ import java.util.zip.ZipOutputStream;
|
||||
*
|
||||
* @author once
|
||||
*/
|
||||
public class ZipUtils{
|
||||
public class ZipUtils {
|
||||
private static final int BUFF_SIZE = 1024 * 1024; // 1M Byte
|
||||
private static boolean stopZipFlag;
|
||||
|
||||
@@ -29,16 +29,16 @@ public class ZipUtils{
|
||||
* 批量压缩文件(夹)
|
||||
*
|
||||
* @param resFileList 要压缩的文件(夹)列表
|
||||
* @param zipFile 生成的压缩文件
|
||||
* @param zipFile 生成的压缩文件
|
||||
*/
|
||||
public static void zipFiles(Collection<File> resFileList, File zipFile) {
|
||||
public static void zipFiles(Collection<File> resFileList, File zipFile) {
|
||||
|
||||
ZipOutputStream zipout = null;
|
||||
try {
|
||||
zipout = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(
|
||||
zipFile), BUFF_SIZE));
|
||||
for (File resFile : resFileList) {
|
||||
if(stopZipFlag){
|
||||
if (stopZipFlag) {
|
||||
break;
|
||||
}
|
||||
zipFile(resFile, zipout, "");
|
||||
@@ -53,11 +53,10 @@ public class ZipUtils{
|
||||
* 批量压缩文件(夹)
|
||||
*
|
||||
* @param resFileList 要压缩的文件(夹)列表
|
||||
* @param zipFile 生成的压缩文件
|
||||
* @param comment 压缩文件的注释
|
||||
* @param zipFile 生成的压缩文件
|
||||
* @param comment 压缩文件的注释
|
||||
*/
|
||||
public static void zipFiles(Collection<File> resFileList, File zipFile, String comment)
|
||||
{
|
||||
public static void zipFiles(Collection<File> resFileList, File zipFile, String comment) {
|
||||
ZipOutputStream zipout = null;
|
||||
try {
|
||||
zipout = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(zipFile), BUFF_SIZE));
|
||||
@@ -74,7 +73,7 @@ public class ZipUtils{
|
||||
/**
|
||||
* 解压缩一个文件
|
||||
*
|
||||
* @param zipFile 压缩文件
|
||||
* @param zipFile 压缩文件
|
||||
* @param folderPath 解压缩的目标目录
|
||||
*/
|
||||
public static void upZipFile(File zipFile, String folderPath) {
|
||||
@@ -85,8 +84,8 @@ public class ZipUtils{
|
||||
ZipFile zf = null;
|
||||
try {
|
||||
zf = new ZipFile(zipFile);
|
||||
for (Enumeration<?> entries = zf.entries(); entries.hasMoreElements();) {
|
||||
ZipEntry entry = ((ZipEntry)entries.nextElement());
|
||||
for (Enumeration<?> entries = zf.entries(); entries.hasMoreElements(); ) {
|
||||
ZipEntry entry = ((ZipEntry) entries.nextElement());
|
||||
InputStream in = zf.getInputStream(entry);
|
||||
String str = folderPath + File.separator + entry.getName();
|
||||
str = new String(str.getBytes("8859_1"), "GB2312");
|
||||
@@ -116,10 +115,10 @@ public class ZipUtils{
|
||||
/**
|
||||
* 解压文件名包含传入文字的文件
|
||||
*
|
||||
* @param zipFile 压缩文件
|
||||
* @param folderPath 目标文件夹
|
||||
* @param zipFile 压缩文件
|
||||
* @param folderPath 目标文件夹
|
||||
* @param nameContains 传入的文件匹配名
|
||||
* @return 返回的集合
|
||||
* @return 返回的集合
|
||||
*/
|
||||
public static ArrayList<File> upZipSelectedFile(File zipFile, String folderPath,
|
||||
String nameContains) {
|
||||
@@ -134,8 +133,8 @@ public class ZipUtils{
|
||||
ZipFile zf = null;
|
||||
try {
|
||||
zf = new ZipFile(zipFile);
|
||||
for (Enumeration<?> entries = zf.entries(); entries.hasMoreElements();) {
|
||||
ZipEntry entry = ((ZipEntry)entries.nextElement());
|
||||
for (Enumeration<?> entries = zf.entries(); entries.hasMoreElements(); ) {
|
||||
ZipEntry entry = ((ZipEntry) entries.nextElement());
|
||||
if (entry.getName().contains(nameContains)) {
|
||||
InputStream in = zf.getInputStream(entry);
|
||||
String str = folderPath + File.separator + entry.getName();
|
||||
@@ -181,7 +180,7 @@ public class ZipUtils{
|
||||
try {
|
||||
entries = getEntriesEnumeration(zipFile);
|
||||
while (entries.hasMoreElements()) {
|
||||
ZipEntry entry = ((ZipEntry)entries.nextElement());
|
||||
ZipEntry entry = ((ZipEntry) entries.nextElement());
|
||||
entryNames.add(new String(getEntryName(entry).getBytes("GB2312"), "8859_1"));
|
||||
}
|
||||
return entryNames;
|
||||
@@ -214,7 +213,7 @@ public class ZipUtils{
|
||||
* @param entry 压缩文件对象
|
||||
* @return 压缩文件对象的注释
|
||||
*/
|
||||
public static String getEntryComment(ZipEntry entry) {
|
||||
public static String getEntryComment(ZipEntry entry) {
|
||||
try {
|
||||
return new String(entry.getComment().getBytes("GB2312"), "8859_1");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
@@ -229,7 +228,7 @@ public class ZipUtils{
|
||||
* @param entry 压缩文件对象
|
||||
* @return 压缩文件对象的名称
|
||||
*/
|
||||
public static String getEntryName(ZipEntry entry) {
|
||||
public static String getEntryName(ZipEntry entry) {
|
||||
try {
|
||||
return new String(entry.getName().getBytes("GB2312"), "8859_1");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
@@ -241,8 +240,8 @@ public class ZipUtils{
|
||||
/**
|
||||
* 压缩文件
|
||||
*
|
||||
* @param resFile 需要压缩的文件(夹)
|
||||
* @param zipout 压缩的目的文件
|
||||
* @param resFile 需要压缩的文件(夹)
|
||||
* @param zipout 压缩的目的文件
|
||||
* @param rootpath 压缩的文件路径
|
||||
*/
|
||||
private static void zipFile(File resFile, ZipOutputStream zipout, String rootpath) {
|
||||
@@ -252,17 +251,17 @@ public class ZipUtils{
|
||||
rootpath = new String(rootpath.getBytes("8859_1"), "GB2312");
|
||||
if (resFile.isDirectory()) {
|
||||
File[] fileList = resFile.listFiles();
|
||||
int length=fileList.length;
|
||||
int length = fileList.length;
|
||||
// Log.e("zipprogress", (int)((1 / (float) (length+1))*100)+"%");
|
||||
//zipListener.zipProgress((int)((1 / (float) (length+1))*100));
|
||||
for (int i=0;i<length;i++) {
|
||||
if(stopZipFlag){
|
||||
for (int i = 0; i < length; i++) {
|
||||
if (stopZipFlag) {
|
||||
break;
|
||||
}
|
||||
File file=fileList[i];
|
||||
File file = fileList[i];
|
||||
zipFile(file, zipout, rootpath);
|
||||
// Log.e("zipprogress", (int)(((i+2) / (float) (length+1))*100)+"%");
|
||||
/// zipListener.zipProgress((int)(((i+2) / (float) (length+1))*100));
|
||||
/// zipListener.zipProgress((int)(((i+2) / (float) (length+1))*100));
|
||||
}
|
||||
} else {
|
||||
byte buffer[] = new byte[BUFF_SIZE];
|
||||
@@ -271,7 +270,7 @@ public class ZipUtils{
|
||||
zipout.putNextEntry(new ZipEntry(rootpath));
|
||||
int realLength;
|
||||
while ((realLength = in.read(buffer)) != -1) {
|
||||
if(stopZipFlag){
|
||||
if (stopZipFlag) {
|
||||
break;
|
||||
}
|
||||
zipout.write(buffer, 0, realLength);
|
||||
@@ -280,7 +279,7 @@ public class ZipUtils{
|
||||
zipout.flush();
|
||||
zipout.closeEntry();
|
||||
}
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -301,7 +300,7 @@ public class ZipUtils{
|
||||
return size;
|
||||
}
|
||||
|
||||
public interface ZipListener{
|
||||
public interface ZipListener {
|
||||
void zipProgress(int zipProgress);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/poiVideo_audit_process_audit_not_through"
|
||||
android:id="@+id/poiVideo_audit_not_through"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="0"
|
||||
|
||||
@@ -68,6 +68,16 @@
|
||||
android:layout_margin="20dp"
|
||||
android:text="筛选结果"
|
||||
android:textSize="20sp" />
|
||||
<TextView
|
||||
android:id="@+id/tv_number"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:text="全选"
|
||||
android:textSize="17sp"
|
||||
/>
|
||||
|
||||
</RelativeLayout>
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
|
||||
@@ -52,6 +52,29 @@
|
||||
app:layout_constraintRight_toRightOf="@+id/iv_message"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_GPS"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:visibility="gone"
|
||||
android:textColor="#F44336"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/iv_message"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/iv_message" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_tencent_GPS"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:textColor="#F44336"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/iv_message"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/iv_message" />
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/frame_layout"
|
||||
android:layout_width="match_parent"
|
||||
@@ -158,7 +181,5 @@
|
||||
android:layout_height="wrap_content">
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
</com.sothree.slidinguppanel.SlidingUpPanelLayout>
|
||||
Reference in New Issue
Block a user