Merge branch 'master' of gitee.com:navinfo-out-door/navinfo-out-door-data-collect

This commit is contained in:
XiaoYan 2021-08-05 19:42:14 +08:00
commit a136dc0683
24 changed files with 571 additions and 322 deletions

View File

@ -408,21 +408,26 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
// String formatVideoName = formatter.format(calendar.getTime());
//文件
// String path = finalVideoPath.substring(finalVideoPath.length()-20);
File file = new File(finalVideoPath);
if (file.exists()) {
try {
FileOutputStream fo = new FileOutputStream(file);
FileDescriptor fileDescriptor = fo.getFD();
camera.takeVideo(fileDescriptor);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
if (finalVideoPath!=null){
File file = new File(finalVideoPath);
if (file.exists()) {
try {
FileOutputStream fo = new FileOutputStream(file);
FileDescriptor fileDescriptor = fo.getFD();
camera.takeVideo(fileDescriptor);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
} else {
camera.takeVideo(file);
}
} else {
camera.takeVideo(file);
}else {
Toast.makeText(this, "请录像", Toast.LENGTH_SHORT).show();
}
}
private void stopTakenVideo() {

View File

@ -86,7 +86,6 @@ public class Constant {
public static final int EVENT_STAY_REFRESH = 44; // 刷新记录页面
public static final int EVENT_WORK_HOME = 45; //切换到寻宝
public static final int EVENT_WORK_UNPOLYGON = 46; //面妆任务点立即采集
public static String USER_ATTESTATION_NAME; //实名认证姓名 银行卡
public static int NUMBER = 200; //任务个数
public static int LIMIT_TTPE = -1; //权限类型普通任务-0专属任务-1

View File

@ -79,11 +79,11 @@ public class UserApplication extends Application {
//builder.cookieJar(new CookieJarImpl(new MemoryCookieStore()));
//超时时间设置默认60秒
//全局的读取超时时间
builder.readTimeout(OkGo.DEFAULT_MILLISECONDS, TimeUnit.MILLISECONDS);
builder.readTimeout(0, TimeUnit.MILLISECONDS);
//全局的写入超时时间
builder.writeTimeout(OkGo.DEFAULT_MILLISECONDS, TimeUnit.MILLISECONDS);
builder.writeTimeout(0, TimeUnit.MILLISECONDS);
//全局的连接超时时间
builder.connectTimeout(OkGo.DEFAULT_MILLISECONDS, TimeUnit.MILLISECONDS);
builder.connectTimeout(0, TimeUnit.MILLISECONDS);
OkGo.getInstance().init(this)
.setOkHttpClient(builder.build())
//全局统一缓存模式默认不使用缓存可以不传

View File

@ -21,6 +21,10 @@ import androidx.appcompat.app.AppCompatActivity;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.api.UserApplication;
import com.gyf.immersionbar.ImmersionBar;
import com.navinfo.outdoor.util.NetWorkUtils;
import java.util.Timer;
import java.util.TimerTask;
public abstract class BaseActivity extends AppCompatActivity {
@ -64,19 +68,64 @@ public abstract class BaseActivity extends AppCompatActivity {
protected void initMVP() {
}
public void showLoadingDialog() {
alertDialog = new AlertDialog.Builder(this).create();
alertDialog.getWindow().setBackgroundDrawable(new ColorDrawable());
alertDialog.setCancelable(false);
alertDialog.setOnKeyListener((dialog, keyCode, event) -> {
if (keyCode == KeyEvent.KEYCODE_SEARCH || keyCode == KeyEvent.KEYCODE_BACK)
return true;
return false;
});
//loading样式
View view = LayoutInflater.from(this).inflate(R.layout.loading, null);
alertDialog.setView(view);
alertDialog.setCanceledOnTouchOutside(false);
alertDialog.show();
if (NetWorkUtils.iConnected(this)) { // 当前网络可用
alertDialog = new AlertDialog.Builder(this).create();
alertDialog.getWindow().setBackgroundDrawable(new ColorDrawable());
alertDialog.setCancelable(false);
alertDialog.setOnKeyListener((dialog, keyCode, event) -> {
if (keyCode == KeyEvent.KEYCODE_SEARCH || keyCode == KeyEvent.KEYCODE_BACK)
return true;
return false;
});
//loading样式
View view = LayoutInflater.from(this).inflate(R.layout.loading, null);
alertDialog.setView(view);
alertDialog.setCanceledOnTouchOutside(false);
alertDialog.show();
initTimer();
} else {
Toast.makeText(this, "网络不可用", Toast.LENGTH_SHORT).show();
}
}
public void showFileLoadingDialog() {
if (NetWorkUtils.iConnected(this)) { // 当前网络可用
alertDialog = new AlertDialog.Builder(this).create();
alertDialog.getWindow().setBackgroundDrawable(new ColorDrawable());
alertDialog.setCancelable(false);
alertDialog.setOnKeyListener((dialog, keyCode, event) -> {
if (keyCode == KeyEvent.KEYCODE_SEARCH || keyCode == KeyEvent.KEYCODE_BACK)
return true;
return false;
});
//loading样式
View view = LayoutInflater.from(this).inflate(R.layout.loading, null);
alertDialog.setView(view);
alertDialog.setCanceledOnTouchOutside(false);
alertDialog.show();
} else {
Toast.makeText(this, "网络不可用", Toast.LENGTH_SHORT).show();
}
}
private void initTimer() {
Timer timer = new Timer(true);
TimerTask timerTask = new TimerTask() {
int countTime = 20;
@Override
public void run() {
if (countTime > 0) {
countTime--;
}
if (countTime == 1) {
dismissLoadingDialog();
}
}
};
timer.schedule(timerTask, 1000, 1000);
}
public void setLoadingDialogText(String s) {

View File

@ -87,19 +87,31 @@ public abstract class BaseFragment extends Fragment implements FragmentBackHandl
alertDialog.setView(view);
alertDialog.setCanceledOnTouchOutside(false);
alertDialog.show();
/* final Timer timer = new Timer();
timer.schedule(new TimerTask() {
@Override
public void run() {
alertDialog.dismiss();
timer.cancel();
}
},10000);*/
initTimer();
} else {
Toast.makeText(getActivity(), "网络不可用", Toast.LENGTH_SHORT).show();
}
}
public void showFileLoadingDialog() {
if (NetWorkUtils.iConnected(getContext())) { // 当前网络可用
alertDialog = new AlertDialog.Builder(getActivity()).create();
alertDialog.getWindow().setBackgroundDrawable(new ColorDrawable());
alertDialog.setCancelable(false);
alertDialog.setOnKeyListener((dialog, keyCode, event) -> {
if (keyCode == KeyEvent.KEYCODE_SEARCH || keyCode == KeyEvent.KEYCODE_BACK)
return true;
return false;
});
//loading样式
View view = LayoutInflater.from(getContext()).inflate(R.layout.loading, null);
alertDialog.setView(view);
alertDialog.setCanceledOnTouchOutside(false);
alertDialog.show();
} else {
Toast.makeText(getActivity(), "网络不可用", Toast.LENGTH_SHORT).show();
}
}
private void initTimer() {
Timer timer = new Timer(true);

View File

@ -2,6 +2,7 @@ package com.navinfo.outdoor.bean;
public class GetPriceBean {
private Integer code;
private String message;
private BodyBean body;
@ -38,6 +39,8 @@ public class GetPriceBean {
private Double rewardPrice;
private Double poiPushPrice;
private Double poiNonepushPrice;
private Double poivideoPushPrice;
private Double poivideoNonepushPrice;
private Double roadPushPrice;
private Double roadNonepushPrice;
private Double csPushPrice;
@ -102,6 +105,22 @@ public class GetPriceBean {
this.poiNonepushPrice = poiNonepushPrice;
}
public Double getPoivideoPushPrice() {
return poivideoPushPrice;
}
public void setPoivideoPushPrice(Double poivideoPushPrice) {
this.poivideoPushPrice = poivideoPushPrice;
}
public Double getPoivideoNonepushPrice() {
return poivideoNonepushPrice;
}
public void setPoivideoNonepushPrice(Double poivideoNonepushPrice) {
this.poivideoNonepushPrice = poivideoNonepushPrice;
}
public Double getRoadPushPrice() {
return roadPushPrice;
}

View File

@ -993,7 +993,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
}
private void stationUploadByNetWork(PoiEntity poiEntity, ArrayList<File> chargingStationList) {
showLoadingDialog();
showFileLoadingDialog();
if (poiEntity == null || poiEntity.getBodyId() == 0) {
Toast.makeText(getActivity(), "没有保存本地", Toast.LENGTH_SHORT).show();
Log.e("TAG", "poiUploadByNetWork: " + poiEntity.getBodyId() + chargingStationList);

View File

@ -131,22 +131,6 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
if (poiEntity.getDist() != null) {
tvDistance.setText("距离:" + format5(Double.valueOf(poiEntity.getDist()) / 1000) + "km");
}
if (poiEntity.getTaskStatus() < 2) {
double latitude = Constant.currentLocation.getLatitude();
double longitude = Constant.currentLocation.getLongitude();
LatLng startLatLng = new LatLng(latitude, longitude); //用户当前位置
LatLng endLatLng = new LatLng(Double.valueOf(poiEntity.getY()), Double.valueOf(poiEntity.getX()));
double v = GeometryTools.distanceToDouble(startLatLng, endLatLng);
if (v > 5000) {
Message obtain = Message.obtain();
obtain.what = Constant.EVENT_WORK_UNPOLYGON;
obtain.obj = true;
EventBus.getDefault().post(obtain);
}
}
}
int taskStatus = poiEntity.getTaskStatus();
initViewByTaskStatus(taskStatus);
@ -190,29 +174,22 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
switch (v.getId()) {
case R.id.btn_cancel_get://结束领取
if (poiEntity != null) {
int type = poiEntity.getType();
if (type == 6) {
initUnPolygonTask(HttpInterface.UNRECEIVED_POLYGON_TASK, poiEntity.getTaskId(), poiEntity);
} else {
new Thread(new Runnable() {
@Override
public void run() {
poiDao.deletePoiEntity(poiEntity);
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
btnGetTask.setVisibility(View.VISIBLE);
btnCancelGet.setVisibility(View.GONE);
btnGather.setVisibility(View.VISIBLE);
btnFinishGather.setVisibility(View.GONE);
}
});
}
}).start();
}
initEndReceiveTask(HttpInterface.UN_RECEIVED_TASK, poiEntity.getTaskId(), poiEntity);
}
break;
case R.id.btn_get_task://领取任务
/* if (poiEntity.getTaskStatus() < 2) {
double latitude = Constant.currentLocation.getLatitude();
double longitude = Constant.currentLocation.getLongitude();
LatLng startLatLng = new LatLng(latitude, longitude); //用户当前位置
LatLng endLatLng = new LatLng(Double.valueOf(poiEntity.getY()), Double.valueOf(poiEntity.getX()));
double geometry = GeometryTools.distanceToDouble(startLatLng, endLatLng);
if (geometry > 5000) {
Toast.makeText(getActivity(), "作业不在领取范围内,无法领取", Toast.LENGTH_SHORT).show();
return;
}
}*/
if (poiEntity != null) {
int type = poiEntity.getType();
if (type == 6) {//面状任务的领取类型
@ -231,6 +208,17 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
}
break;
case R.id.btn_gather://立即采集
if (poiEntity.getTaskStatus() < 2) {
double latitude = Constant.currentLocation.getLatitude();
double longitude = Constant.currentLocation.getLongitude();
LatLng startLatLng = new LatLng(latitude, longitude); //用户当前位置
LatLng endLatLng = new LatLng(Double.valueOf(poiEntity.getY()), Double.valueOf(poiEntity.getX()));
double geometry = GeometryTools.distanceToDouble(startLatLng, endLatLng);
if (geometry > 5000) {
Toast.makeText(getActivity(), "作业不在领取范围内,无法领取", Toast.LENGTH_SHORT).show();
return;
}
}
if (poiEntity != null) {
int type = poiEntity.getType();
if (type == 6) {
@ -357,9 +345,10 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
}
InsertAndUpdateUtils.getInstance().insertOrUpdateChargingPile(getActivity(), chargingPileEntityList);
}
//获取当前位置的marker
senMessageMarker(chargingStationEntity.getType(), chargingStationEntity.getY(), chargingStationEntity.getX());
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(),chargingStationEntity);
// senMessageMarker(chargingStationEntity.getType(), chargingStationEntity.getY(), chargingStationEntity.getX());
// InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(),chargingStationEntity);
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
@ -458,10 +447,6 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
if (aBoolean) {
initCompleteTask(HttpInterface.COMPLETE, GatherGetFragment.this.poiEntity.getTaskId(), true, polygonEntity);
}
Message obtain = Message.obtain();
obtain.what = Constant.EVENT_WORK_UNPOLYGON;
obtain.obj = false;
EventBus.getDefault().post(obtain);
}
});
}
@ -480,18 +465,22 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
}
/**
* @param url 面妆任务结束领取
* @param url 所以类型的结束领取
* @param poiEntity
*/
private void initUnPolygonTask(String url, int taskId, PoiEntity poiEntity) {
private void initEndReceiveTask(String url, int taskId, PoiEntity poiEntity) {
if (taskId == 0) {
Toast.makeText(getContext(), "无此任务", Toast.LENGTH_SHORT).show();
return;
}
showLoadingDialog();
HttpParams httpParams = new HttpParams();
httpParams.put("taskIds",taskId);
httpParams.put("auditIds","");
OkGoBuilder.getInstance()
.Builder(getActivity())
.url(url + "/" + taskId)
.url(url)
.params(httpParams)
.method(OkGoBuilder.GET)
.cls(UnPolygonTaskBean.class)
.callback(new Callback<UnPolygonTaskBean>() {
@ -502,15 +491,12 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
new Thread(new Runnable() {
@Override
public void run() {
poiDao.deleteFormTaskID(taskId);
poiDao.deletePoiEntity(poiEntity);
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
Log.d("TAG", "run: "+response.getMessage());
initViewByTaskStatus(0);
Message obtain = Message.obtain();
obtain.what = Constant.EVENT_WORK_UNPOLYGON;
obtain.obj = false;
EventBus.getDefault().post(obtain);
}
});
}
@ -554,16 +540,6 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
@Override
public void run() {
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
initViewByTaskStatus(1);
Message obtain = Message.obtain();
obtain.what = Constant.EVENT_WORK_UNPOLYGON;
obtain.obj = true;
EventBus.getDefault().post(obtain);
}
});
}
}).start();
}
@ -603,16 +579,6 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
@Override
public void run() {
poiDao.deleteFormTaskID(taskId);
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
initViewByTaskStatus(0);
Message obtain = Message.obtain();
obtain.what = Constant.EVENT_WORK_UNPOLYGON;
obtain.obj = true;
EventBus.getDefault().post(obtain);
}
});
}
}).start();

View File

@ -154,13 +154,14 @@ public class GatheringFragment extends BaseFragment implements View.OnClickListe
private void gatheringNetWork() {
showLoadingDialog();
gatheringList = new ArrayList<>();
File gatheringFile = new File(gatheringPath);
if (!gatheringFile.exists()) {
Toast.makeText(getContext(), "身份证照片不能为空", Toast.LENGTH_SHORT).show();
if (ivGathering.getTag()==null){
Toast.makeText(getContext(), "银行卡照片不能为空", Toast.LENGTH_SHORT).show();
return;
}
gatheringList.add(gatheringFile);
gatheringList = new ArrayList<>();
String ivGatheringTag = (String) ivGathering.getTag();
gatheringList.add(new File(ivGatheringTag));
String etBankAccount = etBankNum.getText().toString().trim();
if (etBankAccount == null || etBankAccount.equals("")) {
Toast.makeText(getContext(), "银行卡号不能为空", Toast.LENGTH_SHORT).show();

View File

@ -468,7 +468,8 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
Log.e("TAG", "poiUploadByNetWork: " + body + otherUploadList);
return;
}
showLoadingDialog();
showFileLoadingDialog();
setLoadingDialogText("上传中...");
OkGo
// 请求方式和请求url
.<PoiUploadBean>post(HttpInterface.OTHER_TASK_UPLOAD_PIC)

View File

@ -739,7 +739,8 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
Log.e("TAG", "poiUploadByNetWork: " + body + poiPicList);
return;
}
showLoadingDialog();
showFileLoadingDialog();
setLoadingDialogText("上传中...");
OkGo
// 请求方式和请求url
.<OtherUploadPicBean>post(HttpInterface.POI_TASK_UPLOAD_PIC)

View File

@ -28,6 +28,7 @@ import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import com.github.lazylibrary.util.FileUtils;
import com.github.lazylibrary.util.StringUtils;
import com.github.lazylibrary.util.ZipUtil;
import com.google.gson.Gson;
import com.hjq.permissions.OnPermissionCallback;
@ -82,7 +83,6 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
private RadioButton rbCar;
private RadioButton rbBicycle;
private RadioButton rbWalking;
private RadioButton rbManual;
private EditText etDesc;
private Button btnRoadSave;
private RadioGroup rgType;
@ -151,7 +151,6 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
rbCar = (RadioButton) findViewById(R.id.rb_car);
rbBicycle = (RadioButton) findViewById(R.id.rb_bicycle);
rbWalking = (RadioButton) findViewById(R.id.rb_walking);
rbManual = (RadioButton) findViewById(R.id.rb_manual);
etDesc = (EditText) findViewById(R.id.et_desc);
fmPoiVideoPic = findViewById(R.id.fm_poi_video_picture);
btnRoadSave = (Button) findViewById(R.id.btn_poi_video_save);
@ -162,13 +161,14 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
fmPoiVideoPic.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (v.getTag() == null) {
if (v.getTag() == null || ((List<File>) v.getTag()).size() == 0) {
Toast.makeText(getActivity(), "还没有拍摄视频!", Toast.LENGTH_SHORT).show();
return;
}
File videoFile = (File) v.getTag();
File finalFile = AWMp4ParserHelper.getInstance().obtainMp4FilePath(showPoiEntity.getId(), fmPoiVideoPic.getTag());
Intent intent = new Intent(getContext(), PictureActivity.class);
intent.putExtra(Constant.INTENT_VIDEO_PATH, videoFile.getAbsolutePath());
intent.putExtra(Constant.INTENT_VIDEO_PATH, finalFile.getAbsolutePath());
startActivityForResult(intent, 0x101);
}
});
@ -179,15 +179,26 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
MessageDialog.show((AppCompatActivity) getContext(), "提示", "对否删除", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
File videoFile = (File) fmPoiVideoPic.getTag();
if (videoFile != null) {
videoFile.delete();
//获取文件名
String csvFileName = videoFile.getName() + ".txt";
File cavFile = new File(videoFile.getParent(), csvFileName);
cavFile.delete();
ivPoiVideoPicture.setImageDrawable(null);
List<File> videoFiles = (List<File>) fmPoiVideoPic.getTag();
if (videoFiles!=null){
for (int i = 0; i < videoFiles.size(); i++) {
//获取文件名
String csvFileName = videoFiles.get(i).getName() + ".txt";
File cavFile = new File(videoFiles.get(i).getParent(), csvFileName);
videoFiles.clear();
cavFile.delete();
ivPoiVideoPicture.setImageDrawable(null);
}
}
// File videoFile = (File) fmPoiVideoPic.getTag();
// if (videoFile != null) {
// videoFile.delete();
// //获取文件名
// String csvFileName = videoFile.getName() + ".txt";
// File cavFile = new File(videoFile.getParent(), csvFileName);
// cavFile.delete();
// ivPoiVideoPicture.setImageDrawable(null);
// }
return false;
}
});
@ -210,15 +221,27 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
showPictureType(work_type);
String describe = showPoiEntity.getMemo();//任务描述
if (describe != null && !describe.equals("")) {
etDesc.setText(describe+"");
etDesc.setText(describe + "");
}
String photo = showPoiEntity.getPhoto();
if (photo != null) {
File videoFile = new File(photo);
if (videoFile.exists()) {
// 使用glide加载视频的第一帧
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivPoiVideoPicture, 500);
fmPoiVideoPic.setTag(videoFile);
String photoList = showPoiEntity.getPhoto();
if (!StringUtils.isEmpty(photoList)) {
String[] photos = photoList.split(",");
List<File> videoFileList = new ArrayList<>();
boolean isImageLoad = false;
if (photos != null && photos.length > 0) {
for (int i = 0; i < photos.length; i++) {
String photo = photos[i];
if (!StringUtils.isEmpty(photo)) {
File videoFile = new File(photo);
videoFileList.add(new File(photo));
if (videoFile.exists() && !isImageLoad) {
// 使用glide加载视频的第一帧
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivPoiVideoPicture, 500);
isImageLoad = true;
}
}
}
fmPoiVideoPic.setTag(videoFileList);
}
}
}
@ -237,7 +260,6 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
btnRoadSave.setEnabled(false);
rbCar.setEnabled(false);
rbWalking.setEnabled(false);
rbManual.setEnabled(false);
rbBicycle.setEnabled(false);
}
@ -272,36 +294,40 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
break;
case R.id.tv_pictures:
// 根据用户点击的时间为视频名称赋值
DateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
String videoFormatName = formatter.format(new Date());
Intent intent = new Intent(getContext(), PictureActivity.class);
intent.putExtra(Constant.INTENT_VIDEO_PATH, Constant.PICTURE_FOLDER + "/" + videoFormatName + ".mp4");
startActivityForResult(intent, 0x101);
// DateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
// String videoFormatName = formatter.format(new Date());
Intent intent = new Intent(getContext(), PictureActivity.class);
File finalFile = AWMp4ParserHelper.getInstance().obtainMp4FilePath(showPoiEntity.getId(), fmPoiVideoPic.getTag());
intent.putExtra(Constant.INTENT_VIDEO_PATH, finalFile.getAbsolutePath());
startActivityForResult(intent, 0x101);
break;
case R.id.btn_poi_video_upload:
showLoadingDialog();
ArrayList<File> videoFileList = new ArrayList<>();
showFileLoadingDialog();
setLoadingDialogText("压缩中...");
ArrayList<File> fileList = new ArrayList<>();
if (fmPoiVideoPic.getTag() != null) {
File videoFile = (File) fmPoiVideoPic.getTag();
videoFileList.add(videoFile);
File file = new File(videoFile.getPath()+".txt");
videoFileList.add(file);
List<File> videoFileList = (List<File>) fmPoiVideoPic.getTag();
for (File videoFile : videoFileList) {
fileList.add(videoFile);
File file = new File(videoFile.getPath() + ".txt");
fileList.add(file);
}
fileZip = new File(Constant.PICTURE_FOLDER, "files" + ".zip");
new Thread(new Runnable() {
@Override
public void run() {
ZipUtil.zipFiles(videoFileList, fileZip, null);
ZipUtil.zipFiles(fileList, fileZip, null);
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
if (poiDaoPoiEntity == null || poiDaoPoiEntity.getTaskStatus() == 1 || poiDaoPoiEntity.getTaskStatus() == 2 || poiDaoPoiEntity.getTaskStatus() == 0) {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
dismissLoadingDialog();
initPoiSaveLocal(true);
}
});
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
dismissLoadingDialog();
initPoiSaveLocal(true);
}
});
} else {
getActivity().runOnUiThread(new Runnable() {
@Override
@ -314,7 +340,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
}
}).start();
}else {
} else {
dismissLoadingDialog();
Toast.makeText(getContext(), "请录像", Toast.LENGTH_SHORT).show();
return;
@ -359,13 +385,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
}
});
}
int pictureType = getPictureType();
if (pictureType == -1) {
Toast.makeText(getContext(), "请选择拍照方式", Toast.LENGTH_SHORT).show();
return;
} else {
poiEntity.setWork_type(pictureType);
}
String desc = etDesc.getText().toString().trim();
if (desc != null && !desc.equals("")) {
poiEntity.setMemo(desc);
@ -375,30 +395,17 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
poiEntity.setTaskId(showPoiEntity.getTaskId());
}
}
File videoFile = (File) fmPoiVideoPic.getTag();
if (videoFile == null ) {
if (fmPoiVideoPic.getTag() == null || ((List<File>) fmPoiVideoPic.getTag()).isEmpty()) {
Toast.makeText(getActivity(), "请录像", Toast.LENGTH_SHORT).show();
return;
} else {
String path = videoFile.getPath() + ".txt";
poiEntity.setPhoto(videoFile.getAbsolutePath());
List<String> strings = FileUtils.readFileToList(path, "utf-8");
ArrayList<LatLng> latLngs = new ArrayList<>();
for (int i = 0; i < strings.size(); i++) {
String[] split = strings.get(i).split(",");
LatLng latLng = new LatLng();
latLng.setLatitude(Double.valueOf(split[2]));
latLng.setLongitude(Double.valueOf(split[3]));
latLngs.add(latLng);
}
if (strings.size() == 1) {
LatLng latLng = latLngs.get(0);
latLngs.add(latLng);
}
String lineString = GeometryTools.getLineString(latLngs);
String lineString = GeometryTools.getLineString(getLineString());
String filePathString = getPhotoStrFromTag();
Log.d("TAG", "onGranted: " + lineString);
poiEntity.setGeoWkt(lineString);
poiEntity.setPhoto(filePathString);
if (lineString != null) {
poiEntity.setGeoWkt(lineString);
}
}
@ -440,6 +447,44 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
});
}
private String getPhotoStrFromTag() {
List<File> videoFileList = (List<File>) fmPoiVideoPic.getTag();
StringBuilder filePathStringBuilder = new StringBuilder("");
for (int m = 0; m < videoFileList.size(); m++) {
File videoFile = videoFileList.get(m);
filePathStringBuilder.append(videoFile.getAbsolutePath());
if (m != videoFileList.size() - 1) {
filePathStringBuilder.append(",");
}
}
return filePathStringBuilder.toString();
}
private List<LatLng> getLineString() {
List<File> videoFileList = (List<File>) fmPoiVideoPic.getTag();
List<LatLng> latLngs = new ArrayList<>();
StringBuilder filePathStringBuilder = new StringBuilder("");
for (int m = 0; m < videoFileList.size(); m++) {
File videoFile = videoFileList.get(m);
String path = videoFile.getPath() + ".txt";
List<String> strings = FileUtils.readFileToList(path, "utf-8");
for (int i = 0; i < strings.size(); i++) {
String[] split = strings.get(i).split(",");
LatLng latLng = new LatLng();
latLng.setLatitude(Double.valueOf(split[2]));
latLng.setLongitude(Double.valueOf(split[3]));
latLngs.add(latLng);
}
if (strings.size() == 1) {
LatLng latLng = latLngs.get(0);
latLngs.add(latLng);
}
}
return latLngs;
}
private void poiVideoUpload(int poiVideoBody, File fileZip) {
if (poiVideoBody == 0) {
@ -450,7 +495,8 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
Toast.makeText(getActivity(), "未压缩完成", Toast.LENGTH_SHORT).show();
return;
}
showLoadingDialog();
showFileLoadingDialog();
setLoadingDialogText("上传中...");
OkGo
// 请求方式和请求url
.<OtherUploadPicBean>post(HttpInterface.POI_VIDEO_UPLOAD_PIC)
@ -508,7 +554,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
@Override
public void onSuccess(PoiVideoBean poiVideoBean, int id) {
dismissLoadingDialog();
if (poiVideoBean.getCode()==200){
if (poiVideoBean.getCode() == 200) {
Integer poiVideoBody = poiVideoBean.getBody();
if (poiVideoBody != null && poiVideoBody != 0) {
poiEntity.setBodyId(poiVideoBody);
@ -531,10 +577,10 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
}
}).start();
} else {
Toast.makeText(getActivity(), ""+poiVideoBean.getMessage(), Toast.LENGTH_SHORT).show();
Toast.makeText(getActivity(), "" + poiVideoBean.getMessage(), Toast.LENGTH_SHORT).show();
}
}else {
Toast.makeText(getActivity(), ""+poiVideoBean.getMessage(), Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(getActivity(), "" + poiVideoBean.getMessage(), Toast.LENGTH_SHORT).show();
}
@ -556,11 +602,15 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
if (requestCode == 0x101 && resultCode == 0x101) {
if (data != null && data.hasExtra(Constant.INTENT_VIDEO_PATH)) {
videoPath = data.getStringExtra(Constant.INTENT_VIDEO_PATH);
String videoPath = data.getStringExtra(Constant.INTENT_VIDEO_PATH);
File videoFile = new File(videoPath);
if (videoFile.exists()) {
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivPoiVideoPicture, 500);
fmPoiVideoPic.setTag(videoFile);
if (fmPoiVideoPic.getTag() == null) {
fmPoiVideoPic.setTag(new ArrayList<>());
}
List<File> fileList = (List<File>) fmPoiVideoPic.getTag();
fileList.add(videoFile);
}
}
}
@ -606,6 +656,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
poiEntity.setType(3);
poiEntity.setTaskStatus(2);
poiEntity.setIsLocalData(1);
poiEntity.setPhoto(getPhotoStrFromTag());
String newPoiEntity = new Gson().toJson(poiEntity);
//以键值对的形式添加新值
edit.putString("poiEntity", newPoiEntity);
@ -623,8 +674,6 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
return 1;
} else if (rbWalking != null && rbWalking.isChecked()) {
return 2;
} else if (rbManual != null && rbManual.isChecked()) {
return 3;
}
return -1;
}
@ -640,9 +689,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
case 2:
rbWalking.setChecked(true);
break;
case 3:
rbManual.setChecked(true);
break;
}
}
@ -655,8 +702,8 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
@Override
public void run() {
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
if (poiDaoPoiEntity!=null) {
if (poiDaoPoiEntity.getTaskStatus()==5){
if (poiDaoPoiEntity != null) {
if (poiDaoPoiEntity.getTaskStatus() == 5) {
poiDao.deletePoiEntity(poiDaoPoiEntity);
}
}

View File

@ -25,6 +25,7 @@ import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import com.github.lazylibrary.util.FileUtils;
import com.github.lazylibrary.util.StringUtils;
@ -33,6 +34,10 @@ import com.google.gson.Gson;
import com.hjq.permissions.OnPermissionCallback;
import com.hjq.permissions.Permission;
import com.hjq.permissions.XXPermissions;
import com.kongzue.dialog.interfaces.OnDialogButtonClickListener;
import com.kongzue.dialog.util.BaseDialog;
import com.kongzue.dialog.util.DialogSettings;
import com.kongzue.dialog.v3.MessageDialog;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.model.HttpParams;
import com.lzy.okgo.model.Response;
@ -67,6 +72,8 @@ import java.util.Calendar;
import java.util.Date;
import java.util.List;
import okhttp3.OkHttpClient;
/**
* 寻宝-点击上传弹窗-道路
*/
@ -78,7 +85,6 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
private RadioButton rbCar;
private RadioButton rbBicycle;
private RadioButton rbWalking;
private RadioButton rbManual;
private EditText etDesc;
private Button btnRoadSave;
private RadioGroup rgType;
@ -147,7 +153,6 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
rbCar = (RadioButton) findViewById(R.id.rb_car);
rbBicycle = (RadioButton) findViewById(R.id.rb_bicycle);
rbWalking = (RadioButton) findViewById(R.id.rb_walking);
rbManual = (RadioButton) findViewById(R.id.rb_manual);
etDesc = (EditText) findViewById(R.id.et_desc);
fmRoadPic = findViewById(R.id.fm_road_picture);
btnRoadSave = (Button) findViewById(R.id.btn_road_save);
@ -169,6 +174,38 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
startActivityForResult(intent, 0x101);
}
});
fmRoadPic.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
MessageDialog.show((AppCompatActivity) getContext(), "提示", "对否删除", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
List<File> videoFiles = (List<File>) fmRoadPic.getTag();
if (videoFiles!=null){
for (int i = 0; i < videoFiles.size(); i++) {
String csvFileName = videoFiles.get(i).getName() + ".txt";
File cavFile = new File(videoFiles.get(i).getParent(), csvFileName);
videoFiles.clear();
cavFile.delete();
ivRoadPicture.setImageDrawable(null);
}
}
// File videoFile = (File) fmRoadPic.getTag();
// if (videoFile != null) {
// videoFile.delete();
// //获取文件名
// String csvFileName = videoFile.getName() + ".txt";
// File cavFile = new File(videoFile.getParent(), csvFileName);
// cavFile.delete();
// ivRoadPicture.setImageDrawable(null);
// }
return false;
}
});
return false;
}
});
//数据展示
initShowPoi();
//禁用可操作性控件
@ -230,7 +267,6 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
btnRoadSave.setEnabled(false);
rbCar.setEnabled(false);
rbBicycle.setEnabled(false);
rbManual.setEnabled(false);
rbWalking.setEnabled(false);
}
@ -279,7 +315,8 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
startActivityForResult(intent, 0x101);
break;
case R.id.road_upload:
showLoadingDialog();
showFileLoadingDialog();
setLoadingDialogText("压缩中...");
ArrayList<File> fileList = new ArrayList<>();
if (fmRoadPic.getTag() != null) {
List<File> videoFileList = (List<File>) fmRoadPic.getTag();
@ -311,10 +348,10 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
}
}).start();
}else {
dismissLoadingDialog();
Toast.makeText(getContext(), "请录像", Toast.LENGTH_SHORT).show();
return;
}
break;
}
@ -471,6 +508,8 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
Toast.makeText(getContext(), "未压缩完成", Toast.LENGTH_SHORT).show();
return;
}
showFileLoadingDialog();
setLoadingDialogText("上传中...");
OkGo
// 请求方式和请求url
.<OtherUploadPicBean>post(HttpInterface.ROAD_TASK_UPLOAD_PIC)
@ -583,12 +622,29 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
String videoPath = data.getStringExtra(Constant.INTENT_VIDEO_PATH);
File videoFile = new File(videoPath);
if (videoFile.exists()) {
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivRoadPicture, 500);
if (fmRoadPic.getTag() == null) {
fmRoadPic.setTag(new ArrayList<>());
Bitmap bitmap = AWMp4ParserHelper.getInstance().getLocalVideoBitmap(videoPath);
int height = bitmap.getHeight();
int width = bitmap.getWidth();
if (height>width){
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
MessageDialog.show((AppCompatActivity) getContext(), "提示", "请重新录像,要求横屏录像", "确定").setOkButton(new OnDialogButtonClickListener() {
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
Intent intentPanorama = new Intent(getActivity(),PictureActivity.class);
startActivityForResult(intentPanorama, 0x101);
return false;
}
});
return;
}else {
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivRoadPicture, 500);
if (fmRoadPic.getTag() == null) {
fmRoadPic.setTag(new ArrayList<>());
}
List<File> fileList = (List<File>) fmRoadPic.getTag();
fileList.add(videoFile);
}
List<File> fileList = (List<File>) fmRoadPic.getTag();
fileList.add(videoFile);
}
}
}
@ -654,7 +710,6 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
poiEntity.setType(4);
poiEntity.setTaskStatus(2);
poiEntity.setIsLocalData(1);
poiEntity.setPhoto(getPhotoStrFromTag());
String newPoiEntity = new Gson().toJson(poiEntity);
//以键值对的形式添加新值
edit.putString("poiEntity", newPoiEntity);
@ -671,8 +726,6 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
return 1;
} else if (rbWalking != null && rbWalking.isChecked()) {
return 2;
} else if (rbManual != null && rbManual.isChecked()) {
return 3;
}
return -1;
}
@ -688,9 +741,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
case 2:
rbWalking.setChecked(true);
break;
case 3:
rbManual.setChecked(true);
break;
}
}

View File

@ -23,11 +23,16 @@ import com.kongzue.dialog.util.BaseDialog;
import com.kongzue.dialog.util.DialogSettings;
import com.kongzue.dialog.v3.BottomMenu;
import com.kongzue.dialog.v3.MessageDialog;
import com.lzy.okgo.model.HttpParams;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.activity.FragmentManagement;
import com.navinfo.outdoor.adapter.StaySubmitAdapter;
import com.navinfo.outdoor.api.Constant;
import com.navinfo.outdoor.base.BaseFragment;
import com.navinfo.outdoor.bean.UnPolygonTaskBean;
import com.navinfo.outdoor.http.Callback;
import com.navinfo.outdoor.http.HttpInterface;
import com.navinfo.outdoor.http.OkGoBuilder;
import com.navinfo.outdoor.room.PoiDao;
import com.navinfo.outdoor.room.PoiDatabase;
import com.navinfo.outdoor.room.PoiEntity;
@ -38,6 +43,7 @@ import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/**
@ -197,8 +203,7 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
MessageDialog.show((AppCompatActivity) getContext(), "提示", "是否删除", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
staySubmitAdapter.setAllCheckedDelete();
// refreshData();
initRequest(staySubmitAdapter.getAllRoad());
return false;
}
});
@ -215,7 +220,7 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
}
}
if (poiEntities.size() > 0) {
showLoadingDialog();
showFileLoadingDialog();
PoiSaveUtils.getInstance(getActivity()).uploadPoiEntityBatch(poiEntities);
} else {
Toast.makeText(getContext(), "请选择要删除的条目数据", Toast.LENGTH_SHORT).show();
@ -225,6 +230,72 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
}
}
private void initRequest(List<PoiEntity> allRoad) {
showLoadingDialog();
new Thread(new Runnable() {
@Override
public void run() {
ArrayList<PoiEntity> poiEntities = new ArrayList<>();
synchronized (allRoad) {
Iterator iterator = allRoad.iterator();
while (iterator.hasNext()) {
PoiEntity poiEntity = (PoiEntity) iterator.next();
if (poiEntity.isChecked()) {
poiEntities.add(poiEntity);
}
}
;
}
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
String taskIds = "";
String auditIds = "";
for (int i = 0; i < poiEntities.size(); i++) {
if (poiEntities.get(i).getTaskStatus() == 2) {
taskIds += poiEntities.get(i).getTaskId()+",";
} else if (poiEntities.get(i).getTaskStatus() == 3) {
auditIds += poiEntities.get(i).getBodyId()+",";
}
}
if (taskIds!=null&&!taskIds.equals("")){
taskIds = taskIds.substring(0,taskIds.length() - 1);
}
if (auditIds!=null&&!auditIds.equals("")){
auditIds = auditIds.substring(0,auditIds.length() - 1);
}
HttpParams httpParams = new HttpParams();
httpParams.put("taskIds", taskIds);
httpParams.put("auditIds", auditIds);
OkGoBuilder.getInstance()
.Builder(getActivity())
.url(HttpInterface.UN_RECEIVED_TASK)
.params(httpParams)
.method(OkGoBuilder.GET)
.cls(UnPolygonTaskBean.class)
.callback(new Callback<UnPolygonTaskBean>() {
@Override
public void onSuccess(UnPolygonTaskBean response, int id) {
dismissLoadingDialog();
if (response.getCode()==200){
staySubmitAdapter.setAllCheckedDelete();
}
Toast.makeText(getContext(), response.getMessage() + "", Toast.LENGTH_SHORT).show();
}
@Override
public void onError(Throwable e, int id) {
dismissLoadingDialog();
Toast.makeText(getContext(), e.getMessage() + "", Toast.LENGTH_SHORT).show();
}
}).build();
}
});
}
}).start();
}
public void refreshData() {
if (roadEntities == null) {

View File

@ -145,7 +145,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
bitmapDescriptor3 = BitmapDescriptorFactory.fromResource(R.mipmap.datouzhen);
bitmapDescriptor4 = BitmapDescriptorFactory.fromResource(R.mipmap.datouzhen);
bitmapDescriptor5 = BitmapDescriptorFactory.fromResource(R.mipmap.datouzhen);
EventBus.getDefault().register(this);
//fragment 管理器
supportFragmentManager = getActivity().getSupportFragmentManager();
@ -164,15 +163,13 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
ivMessage.setOnClickListener(this::onClick);
treasureMap = (MapView) findViewById(R.id.treasure_map);
tencentMap = treasureMap.getMap();
// if (getClass().getCanonicalName().equals("PioFragment")){
// ivMessage.setVisibility(View.VISIBLE);
// }else {
// ivMessage.setVisibility(View.GONE);
// }
cbMapType = (CheckBox) findViewById(R.id.cb_map_type);
// sliding_layout.setScrollableViewHelper(new NestedScrollableViewHelper());
// sliding_layout.setScrollableViewHelper(new NestedScrollableViewHelper());
//地图转换
cbMapType.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
@ -217,7 +214,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
@Override
public void onMapLoaded() {
if (Constant.currentLocation != null) {
// 地图中心点位置设置为当前用户所在位置
CameraUpdate cameraSigma =
CameraUpdateFactory.newCameraPosition(new CameraPosition(
@ -232,11 +228,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
// 移动到当前位置后开始请求地图数据
initList(Constant.currentLocation);
}
@Override
public void onCancel() {
}
public void onCancel() {}
});
}else {
dismissLoadingDialog();
@ -255,7 +248,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
if (markerPile != null) {
markerPile.remove();
}
if (bigMarker != null) {
bigMarker.setVisible(false);
}
@ -325,14 +317,12 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
}else {
Toast.makeText(getActivity(), "数据为空", Toast.LENGTH_SHORT).show();
}
}
return false;
}
});
}
});
// 设置地图宽高为屏幕的宽高
int[] widtHeight = DensityUtil.getDeviceInfo(getActivity());
treasureMap.getLayoutParams().width = widtHeight[0];
@ -370,7 +360,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
.params("pageNum", "1")
.params("type", task_type)
.params("isExclusive", limit_type)
// .client(new OkHttpClient())
// .client(new OkHttpClient())
.execute(new DialogCallback<JobSearchBean>(JobSearchBean.class) {
@Override
public void onSuccess(Response<JobSearchBean> response) {
@ -433,7 +423,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
latLng.setLatitude(y);
latLng.setLongitude(x);
}
/* if (latPolygon != null && latPolygon.size() > 0) {
/* if (latPolygon != null && latPolygon.size() > 0) {
latLng = latPolygon.get(0);
}*/
}
@ -506,7 +496,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
obtain.obj = body;
EventBus.getDefault().post(obtain);
}
@Override
public void onError(Response<JobSearchBean> response) {
super.onError(response);
@ -573,9 +562,9 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
latLng.setLatitude(y);
latLng.setLongitude(x);
}
/* if (latPolygon != null && latPolygon.size() > 0) {
latLng = latPolygon.get(0);
}*/
/* if (latPolygon != null && latPolygon.size() > 0) {
latLng = latPolygon.get(0);
}*/
}
BitmapDescriptor descriptor = null;
if (poiEntity.getType()==1){
@ -591,7 +580,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
}else if (poiEntity.getType()==6){
descriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_bag);
}
if (bigMarker == null) {
bigMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(descriptor).alpha(0.9f)
.flat(true)
@ -698,7 +686,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
}else {
poiDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.graypoi);
}
Marker poiMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiDescriptor).alpha(0.9f)
.flat(true)
.clockwise(false));
@ -707,8 +694,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
poiMarker.setTitle(poiEntity.getName() + "");
poiMarker.setTag(poiEntity);
removablesLocality.add(poiMarker);
break;
case 2://充电站
BitmapDescriptor chargeDescriptor = null;
@ -717,7 +702,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
}else {
chargeDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.graycharge);
}
Marker stationMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(chargeDescriptor).alpha(0.9f)
.flat(true)
.clockwise(false));
@ -750,7 +734,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
}else {
roadDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.grayroad);
}
Marker roadMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(roadDescriptor).alpha(0.9f)
.flat(true)
.clockwise(false));
@ -794,7 +777,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
break;
}
}
Message obtain = Message.obtain();
obtain.what = Constant.JOB_SEARCH_POI_WORD;
obtain.obj = allTaskStatus;
@ -877,7 +859,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
}
});
break;
case 5:
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
MessageDialog.show((AppCompatActivity) getContext(), "提示", "你其他页面还有未提交完的数据", "确定").setOkButton(new OnDialogButtonClickListener() {
@ -894,7 +875,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
}
});
break;
}
}
}
@ -1053,7 +1033,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
if (view != null) {
initHeader(view);
}
} else if (data.what == Constant.MAIN_REMOVE) {//// 控制主界面各个header移除
if ((boolean) data.obj) {
dragView.removeAllViews();
@ -1148,22 +1127,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
if (gatherGetFragment != null) {
fragmentTransaction.remove(gatherGetFragment);
}
} else if (data.what == Constant.EVENT_WORK_UNPOLYGON) {//面妆任务点击立即采集或者结束采集需要回到寻宝界面
if ((boolean) data.obj) {
setMainButtonVisiable(View.VISIBLE);
frameLayout.setVisibility(View.GONE);
fragmentTransaction.remove(gatherGetFragment);
if (bigMarker != null) {
bigMarker.setVisible(false);
}
for (int i = 0; i < removablesMarker.size(); i++) {
removablesMarker.get(i).remove();
}
removablesMarker.clear();
Toast.makeText(getActivity(), "不在作业范围", Toast.LENGTH_SHORT).show();
} else {
frameLayout.setVisibility(View.VISIBLE);
}
}
}
@ -1188,7 +1151,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
if (otherFragment != null) {
fragmentTransaction.remove(otherFragment);
}
}
@ -1206,9 +1168,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
ivMessage.setVisibility(visiable);
}
private void initPoiMarker(LatLng latLng) {
LatLng mapCenterPoint = getMapCenterPoint();
CameraUpdate cameraSigma = CameraUpdateFactory.newCameraPosition(new CameraPosition(
@ -1225,15 +1184,10 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
if (markerPoi != null) {
markerPoi.setFixingPoint(screenPosition.x, screenPosition.y);
}
}
@Override
public void onCancel() {
}
public void onCancel() {}
});
}
private void initPileMarker(LatLng latLng) {
@ -1252,15 +1206,10 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
if (markerPile != null) {
markerPile.setFixingPoint(screenPosition.x, screenPosition.y);
}
}
@Override
public void onCancel() {
}
public void onCancel() {}
});
}
private void initCheckedPileMarker(int poiWord) {
@ -1429,7 +1378,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
itemList.add(new ShareDialog.Item(getContext(), R.drawable.push_road, "道路"));
itemList.add(new ShareDialog.Item(getContext(), R.drawable.push_chongdianzhuang, "充电站"));
itemList.add(new ShareDialog.Item(getContext(), R.drawable.push_qingbao, "其他"));
Bundle bundle = new Bundle();
PoiEntity poiEntity = new PoiEntity();
// 上报时以当前用户位置为准
@ -1437,7 +1385,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
ToastUtil.showShort(getContext(), "无法获取当前位置请检查GPS是否打开");
return;
}
// LatLng mapCenterPoint = getMapCenterPoint();
// LatLng mapCenterPoint = getMapCenterPoint();
LatLng newPoiLatLng = new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude());
poiEntity.setX(newPoiLatLng.getLongitude() + "");
poiEntity.setY(newPoiLatLng.getLatitude() + "");
@ -1481,7 +1429,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
initList(Constant.currentLocation);
FilterFragment filterFragment = FilterFragment.newInstance(new Bundle());
showSlidingFragment(filterFragment);
break;
case R.id.iv_message:
Intent messageIntent = new Intent(getContext(), FragmentManagement.class);
@ -1503,7 +1450,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
} else if (type == 5) {
markerPoi = tencentMap.addMarker(new MarkerOptions(latLng).icon(bitmapDescriptor5).zIndex(2));
}
}
/**
@ -1522,7 +1468,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
private void showSlidingFragment(BaseDrawerFragment fragment) {
fragmentTransaction = supportFragmentManager.beginTransaction();
int[] deviceInfo = DensityUtil.getDeviceInfo(getActivity());
sliding_layout.setPanelHeight(deviceInfo[1] / 2);
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
fragmentTransaction.add(R.id.scroll_view, fragment, fragment.getClass().getName());
@ -1532,7 +1477,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
fragmentTransaction.hide(filterFragment);
}
}
if (!(fragment instanceof ChargingStationFragment)) {
ChargingStationFragment chargingStationFragment = (ChargingStationFragment) supportFragmentManager.findFragmentByTag(ChargingStationFragment.class.getName());
if (chargingStationFragment != null) {
@ -1566,7 +1510,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
* 检查网络状态
*/
private void checkNetWork() {
if (NetWorkUtils.iConnected(getContext())) { // 当前网络可用
checkMyLocation();
} else { // 当前网络不可用
@ -1579,7 +1522,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
* 检查所需权限
*/
private void checkMyLocation() {
// 1.判断是否拥有定位的权限
// 1.1 拥有权限进行相应操作
// 1.2 没有权限申请权限
@ -1587,23 +1529,19 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
// 1.2.1.1 用户给予权限进行相应操作
// 1.2.1.2 用户没有给予权限 作出相应提示
// 1.2.2 某些5.0权限的手机执行相应操作
XXPermissions.with(this)
.permission(Permission.ACCESS_COARSE_LOCATION)
.request(new OnPermissionCallback() {
@Override
public void onGranted(List<String> permissions, boolean all) {
if (all) {
//建立定位
initLocation();
} else {
dismissLoadingDialog();
Toast.makeText(getActivity(), "申请权限失败", Toast.LENGTH_SHORT).show();
}
}
@Override
public void onDenied(List<String> permissions, boolean never) {
if (never) {

View File

@ -118,14 +118,6 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
startActivityForResult(ivAttestation3, 300);
break;
case R.id.btn_attestation:
/**
* static boolean ChineseNameTest(String name) {
* if (!name.matches("[\u4e00-\u9fa5]{2,4}")) {
* System.out.println("只能输入2到4个汉字");
* return false;
* }else return true;
* }
*/
if (etAttestationName.getText().toString() == null || etAttestationName.getText().toString().equals("")) {
Toast.makeText(getContext(), "姓名不能为空,请输入姓名", Toast.LENGTH_SHORT).show();
return;
@ -216,6 +208,7 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
Log.d("TAG", "onSuccess: " + response.toString() + "sssssssssssss");
if (response.body().equals("0")) {
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
MessageDialog.show((AppCompatActivity) getActivity(), "提示", "不通过", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
@ -226,6 +219,7 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
}
});
} else {
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
MessageDialog.show((AppCompatActivity) getActivity(), "提示", "通过", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
@Override
public boolean onClick(BaseDialog baseDialog, View v) {

View File

@ -33,6 +33,8 @@ public class WithdrawFragment extends BaseFragment implements View.OnClickListen
private EditText etAllPrice;
private TextView poiPushMoney;
private TextView poiReportMoney;
private TextView poiVideoPushMoney;
private TextView poiVideoReportMoney;
private TextView roadPushMoney;
private TextView roadReportMoney;
private TextView chargingPushMoney;
@ -60,7 +62,7 @@ public class WithdrawFragment extends BaseFragment implements View.OnClickListen
protected void initView() {
super.initView();
tvUnit = findViewById(R.id.tv_unit);//可提现
tvAlready = findViewById(R.id.tv_already);//提现
tvAlready = findViewById(R.id.tv_already);//提现
tvTotal = findViewById(R.id.tv_total);//总资产
tvAll = findViewById(R.id.tv_all);
tvAll.setOnClickListener(this::onClick);
@ -73,6 +75,8 @@ public class WithdrawFragment extends BaseFragment implements View.OnClickListen
btWithdraw.setOnClickListener(this::onClick);
poiPushMoney = (TextView) findViewById(R.id.poi_push_money);
poiReportMoney = (TextView) findViewById(R.id.poi_report_money);
poiVideoPushMoney = (TextView) findViewById(R.id.poiVideo_push_money);
poiVideoReportMoney = (TextView) findViewById(R.id.poiVideo_report_money);
roadPushMoney = (TextView) findViewById(R.id.road_push_money);
roadReportMoney = (TextView) findViewById(R.id.road_report_money);
chargingPushMoney = (TextView) findViewById(R.id.charging_push_money);
@ -103,6 +107,8 @@ public class WithdrawFragment extends BaseFragment implements View.OnClickListen
tvAlready.setText(response.getBody().getHaveExchangePrice() + "");
poiPushMoney.setText(response.getBody().getPoiPushPrice() + "");
poiReportMoney.setText(response.getBody().getPoiNonepushPrice() + "");
poiVideoPushMoney.setText(response.getBody().getPoivideoPushPrice() + "");
poiVideoReportMoney.setText(response.getBody().getPoivideoNonepushPrice() + "");
roadPushMoney.setText(response.getBody().getRoadPushPrice() + "");
roadReportMoney.setText(response.getBody().getRoadNonepushPrice() + "");
chargingPushMoney.setText(response.getBody().getCsPushPrice() + "");
@ -165,7 +171,11 @@ public class WithdrawFragment extends BaseFragment implements View.OnClickListen
@Override
public void onSuccess(UserPriceExchangeBean response, int id) {
dismissLoadingDialog();
Toast.makeText(getContext(), response.getMessage(), Toast.LENGTH_SHORT).show();
Toast.makeText(getContext(), response.getMessage(), Toast.LENGTH_SHORT).show();
etAllPrice.getText().clear();
Log.d("TAG", "onSuccess: " + response.toString() + "tttttttt");
}

View File

@ -92,13 +92,17 @@ public class HttpInterface {
//172.23.139.4:8001/m4/userAuth/add
public static final String USER_AUTH_ADD = IPm7 + "/userAuth/add"; //实名认证
/**
* 面状任务
*/
public static final String RECEIVED_POLYGON_TASK = IPm6 + "polygonTask/1/receivedPolygontask"; //任务领取
public static final String UNRECEIVED_POLYGON_TASK = IPm6 + "polygonTask/1/unReceivedPolygontask";//结束领取
public static final String COMPLETE = IPm6 + "polygonTask/1/complete";//任务采集
public static final String SUBMIT_POLYGON_TASK = IPm6 + "polygonTask/1/submitPolygontask";//结束采集
public static final String IPm8 = "http://172.23.139.4:8003/m4/";
//http://172.23.139.4:8003/m4/task/1/unReceivedTask?taskIds=&auditIds=214,278
public static final String UN_RECEIVED_TASK = IPm8 + "task/1/unReceivedTask";//所以类型的结束领取
}

View File

@ -48,7 +48,7 @@ public class PoiEntity implements Serializable {
private int isLocalData;//是否是本地数据 0,服务 1,本地
private int isExclusive;//任务类型 0.普通任务1.专属任务
private int bodyId;//保存本地的bodyId
private int work_type;//0."车行" 1."自行车" 2."步行" 3."手动"
private int work_type;//0."车行" 1."自行车" 2."步行"
public int getWork_type() {
return work_type;

View File

@ -47,7 +47,7 @@ public class PoiSaveUtils {
private Gson gson;
private static PoiSaveUtils instance;
private int anInt=0;
private int bInt=1;
private int bInt=0;
public static PoiSaveUtils getInstance(Activity mContext) {
if (instance == null) {

View File

@ -115,13 +115,13 @@
android:text="步行"
android:textColor="@color/test_color_selector" />
<RadioButton
android:id="@+id/rb_manual"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="手动"
android:textColor="@color/test_color_selector" />
<!-- <RadioButton-->
<!-- android:id="@+id/rb_manual"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_weight="1"-->
<!-- android:text="手动"-->
<!-- android:textColor="@color/test_color_selector" />-->
</RadioGroup>
</LinearLayout>
@ -139,7 +139,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="03.拍照 "
android:text="03.录像 "
android:textColor="@color/black"
android:textSize="16sp" />
@ -150,7 +150,7 @@
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:gravity="center"
android:text="拍照"
android:text="录像"
android:textColor="@color/white"
android:textSize="15sp" />
</LinearLayout>
@ -190,7 +190,7 @@
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="20dp"
android:text="03.描述"
android:text="04.描述"
android:textColor="@color/black"
android:textSize="16sp" />

View File

@ -17,7 +17,8 @@
<TextView
android:id="@+id/progressBar_tx"
android:layout_width="50dp"
android:layout_width="100dp"
android:gravity="center"
android:layout_height="wrap_content"
android:layout_below="@+id/progressBar1"
android:layout_centerHorizontal="true"

View File

@ -104,13 +104,13 @@
android:layout_weight="1"
android:textColor="@color/test_color_selector"
android:text="步行"/>
<RadioButton
android:id="@+id/rb_manual"
android:layout_width="0dp"
android:layout_weight="1"
android:textColor="@color/test_color_selector"
android:layout_height="wrap_content"
android:text="手动"/>
<!-- <RadioButton-->
<!-- android:id="@+id/rb_manual"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_weight="1"-->
<!-- android:textColor="@color/test_color_selector"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text="手动"/>-->
</RadioGroup>
</LinearLayout>
@ -127,7 +127,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="03.拍照 "
android:text="03.录像 "
android:textColor="@color/black"
android:textSize="16sp" />
@ -138,7 +138,7 @@
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:gravity="center"
android:text="拍照"
android:text="录像"
android:textColor="@color/white"
android:textSize="15sp" />

View File

@ -312,6 +312,86 @@
android:textColor="#333"
android:textSize="18sp" />
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#F1F0F0" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="65dp"
android:padding="5dp"
android:gravity="center_vertical">
<ImageView
android:id="@+id/image_poiVideo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_margin="2dp"
android:background="@drawable/poi_square" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="20dp"
android:layout_toRightOf="@id/image_poiVideo"
android:text="POIVIDEO推送积分"
android:textColor="#333"
android:textSize="18sp" />
<TextView
android:id="@+id/poiVideo_push_money"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:gravity="center_vertical"
android:text="+¥0.0"
android:textColor="#333"
android:textSize="18sp" />
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#F1F0F0" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="65dp"
android:padding="5dp"
android:gravity="center_vertical">
<ImageView
android:id="@+id/image_poiVideo_report"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_margin="2dp"
android:background="@drawable/poi_square" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="20dp"
android:layout_toRightOf="@id/image_poiVideo_report"
android:text="POIVIDEO上报任务积分"
android:textColor="#333"
android:textSize="18sp" />
<TextView
android:id="@+id/poiVideo_report_money"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:gravity="center_vertical"
android:text="+¥0.0"
android:textColor="#333"
android:textSize="18sp" />
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"