修改poi录像、充电站的上传接口、修改部分bug

This commit is contained in:
md 2021-07-19 18:40:36 +08:00
parent e9b39a9d5a
commit 83a2430076
45 changed files with 692 additions and 477 deletions

View File

@ -3,7 +3,7 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion '29.0.2'
// ndkVersion '23.0.7123448'
ndkVersion '23.0.7123448'
defaultConfig {
applicationId "com.navinfo.outdoor"

View File

@ -3,6 +3,7 @@ package com.navinfo.outdoor.activity;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.ConstraintLayout;
import android.content.Intent;
import android.content.pm.ActivityInfo;
@ -21,6 +22,7 @@ import android.view.ViewGroup;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.Toast;
@ -100,7 +102,9 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
private Timer timer;
private CsvTimerTask timerTask; // 执行定时写入csv文件的task
private DateFormat formatter;
private final long period = 2; // 记录csv文件的间隔时间单位为秒
private final long period = 1; // 记录csv文件的间隔时间单位为秒
private ViewGroup layerChange; // 切换地图和相机的父控件
private boolean isFinishActivity = false; // 是否需要关闭当前activity
@Override
protected int getLayout() {
@ -121,6 +125,8 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
finalVideoPath = Constant.PICTURE_FOLDER+"/final.mp4";
}
layerChange = findViewById(R.id.layer_change);
timer = new Timer();
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
@ -142,28 +148,11 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) { // 开始采集设置按钮文字内容为结束采集
captureVideo.setText("暂停采集");
stopVideo.setEnabled(false);// 开始采集视频后禁用停止采集的按钮必须暂停采集后才可点击停止采集
// stopVideo.setEnabled(false);// 开始采集视频后禁用停止采集的按钮必须暂停采集后才可点击停止采集
startTakenVideo(); // 开始采集视频
/**
* 获取当前视频的时间记录csv文件时使用
* */
long currentTime = AWMp4ParserHelper.getInstance().getVedioTotalTime(new File(finalVideoPath));
timerTask = new CsvTimerTask(new File(finalVideoPath+".txt"));
timerTask.setCurrentVideoTime(currentTime/1000);
// 开始采集每隔2秒实时记录位置信息视频时间以及设备时间
timer.schedule(timerTask, 0, period*1000);
} else {
if (timerTask!=null){
timerTask.cancel();
stopVideo.setEnabled(true);
captureVideo.setText("开始采集");
stopTakenVideo();
}else {
Toast.makeText(PictureActivity.this, "请先拍照", Toast.LENGTH_SHORT).show();
}
stopTakenVideo();
captureVideo.setText("开始采集");
}
}
});
@ -176,6 +165,7 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
// camera.setVideoBitRate(5);
camera.setPreviewFrameRate(5); // 设置预览视频的帧率
// 设置视频可用的宽高size
SizeSelector width = SizeSelectors.maxWidth(1920);
SizeSelector height = SizeSelectors.maxHeight(1440);
@ -195,7 +185,7 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
SizeSelectors.biggest() // If none is found, take the biggest
);
camera.setVideoSize(result);
camera.setVideoBitRate(800*1024);
camera.setVideoBitRate(1920*1440);
// camera.setAudioBitRate();
//获取地图
@ -244,32 +234,45 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
super.onVideoTaken(result);
Toast.makeText(PictureActivity.this, "暂停摄像", Toast.LENGTH_SHORT).show();
showLoadingDialog();
if (result!=null) {
File currentFile = result.getFile();
if (finalVideoPath!=null) { // 有指定的视频文件名称合并文件
if (new File(finalVideoPath).exists()) {
List<String> spliteFileList = new ArrayList<>();
spliteFileList.add(finalVideoPath);
spliteFileList.add(currentFile.getAbsolutePath());
try {
AWMp4ParserHelper.getInstance().mergeVideos(spliteFileList, tmpFile.getAbsolutePath());
if (tmpFile.exists()) {
File finalVideoFile = new File(finalVideoPath);
finalVideoFile.delete();
currentFile.delete();
tmpFile.renameTo(finalVideoFile);
new Thread(new Runnable() {
@Override
public void run() {
if (result!=null) {
File currentFile = result.getFile();
if (finalVideoPath!=null) { // 有指定的视频文件名称合并文件
if (new File(finalVideoPath).exists()) {
List<String> spliteFileList = new ArrayList<>();
spliteFileList.add(finalVideoPath);
spliteFileList.add(currentFile.getAbsolutePath());
try {
AWMp4ParserHelper.getInstance().mergeVideos(spliteFileList, tmpFile.getAbsolutePath());
if (tmpFile.exists()) {
File finalVideoFile = new File(finalVideoPath);
finalVideoFile.delete();
currentFile.delete();
tmpFile.renameTo(finalVideoFile);
} else {
Toast.makeText(PictureActivity.this, "视频合并失败!", Toast.LENGTH_SHORT).show();
}
} catch (Exception e) {
Log.e("PictureActivity", e.getMessage());
}
} else {
Toast.makeText(PictureActivity.this, "视频合并失败!", Toast.LENGTH_SHORT).show();
currentFile.renameTo(new File(finalVideoPath));
}
} catch (Exception e) {
Log.e("PictureActivity", e.getMessage());
}
} else {
currentFile.renameTo(new File(finalVideoPath));
}
runOnUiThread(new Runnable() {
@Override
public void run() {
dismissLoadingDialog();
if (isFinishActivity) {
PictureActivity.this.finish();
}
}
});
}
}
dismissLoadingDialog();
}).start();
}
@Override
@ -278,7 +281,43 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
Toast.makeText(PictureActivity.this, exception.toString(), Toast.LENGTH_SHORT).show();
}
@Override
public void onVideoRecordingStart() {
super.onVideoRecordingStart();
/**
* 获取当前视频的时间记录csv文件时使用
* */
long currentTime = AWMp4ParserHelper.getInstance().getVedioTotalTime(new File(finalVideoPath));
timerTask = new CsvTimerTask(new File(finalVideoPath+".txt"));
// 开始采集每隔2秒实时记录位置信息视频时间以及设备时间
if (currentTime == 0) {
timer.schedule(timerTask, 0, period*1000);
} else {
timerTask.setCurrentVideoTime(currentTime/1000+1);
timer.schedule(timerTask, 1, period*1000);
}
}
@Override
public void onVideoRecordingEnd() {
super.onVideoRecordingEnd();
if (timerTask!=null){
timerTask.cancel();
}else {
Toast.makeText(PictureActivity.this, "请先拍照", Toast.LENGTH_SHORT).show();
}
}
});
// 修改相机的宽高为屏幕宽高的1/3
DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
FrameLayout.LayoutParams layoutParamsMap = (FrameLayout.LayoutParams) ivMap.getLayoutParams();//相机的宽高
layoutParamsMap.height = dm.widthPixels/3;
layoutParamsMap.width = dm.heightPixels/3;
ivMap.setLayoutParams(layoutParamsMap);
}
@ -318,23 +357,26 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
// startTakenVideo(); // 开始拍摄视频
// break;
case R.id.btn_stop_video:
if (camera.isTakingVideo()) {
camera.stopVideo();
}
if (timerTask!=null){
timerTask.cancel();
Intent intent = new Intent();
intent.putExtra(Constant.INTENT_VIDEO_PATH, finalVideoPath);
setResult(0x101, intent);
this.finish();
}else {
Toast.makeText(this, "请先录视频", Toast.LENGTH_SHORT).show();
Toast.makeText(this, "本段视频没有计时!", Toast.LENGTH_SHORT).show();
}
if (camera.isTakingVideo()) {
isFinishActivity = true;
camera.stopVideo();
} else {
finish();
}
break;
}
}
private void startTakenVideo() {
if (camera.isTakingVideo()) {
Toast.makeText(this, "已经在拍摄中...", Toast.LENGTH_SHORT).show();
@ -402,32 +444,38 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
public void btnSwich() {
// DisplayMetrics dm = new DisplayMetrics();
// getWindowManager().getDefaultDisplay().getMetrics(dm);
// System.out.println("width-display :" + dm.widthPixels);
// System.out.println("heigth-display :" + dm.heightPixels);
// ViewGroup.LayoutParams layoutParams = ivMap.getLayoutParams();//地图的宽高
// int height = layoutParams.height;
// int width = layoutParams.width;
// ViewGroup.LayoutParams layoutParams1 = camera.getLayoutParams();//相机的宽高
// int height1 = layoutParams1.height;
// int width1 = layoutParams1.width;
// if (width > width1) {
// ivPic.setVisibility(View.GONE);
// layoutParams1.width = dm.widthPixels;
// layoutParams1.height = dm.heightPixels;
// layoutParams.height = height1;
// layoutParams.width = width1;
// camera.setLayoutParams(layoutParams1);
// ivMap.setLayoutParams(layoutParams);
// } else {
// layoutParams.height = dm.heightPixels;
// layoutParams.width = dm.widthPixels;
// layoutParams1.height = height;
// layoutParams1.width = width;
// camera.setLayoutParams(layoutParams);
// ivMap.setLayoutParams(layoutParams1);
// }
DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
System.out.println("width-display :" + dm.widthPixels);
System.out.println("heigth-display :" + dm.heightPixels);
FrameLayout.LayoutParams layoutParamsMap = (FrameLayout.LayoutParams) ivMap.getLayoutParams();//地图的宽高
int heightMap = ivMap.getMeasuredHeight();
int widthMap = ivMap.getMeasuredWidth();
FrameLayout.LayoutParams layoutParamsCamera = (FrameLayout.LayoutParams) camera.getLayoutParams();//相机的宽高
int heightCamera = camera.getMeasuredHeight();
int widthCamera = camera.getMeasuredWidth();
layerChange.removeAllViews();
if (widthMap > widthCamera) {
ivPic.setVisibility(View.GONE);
layoutParamsCamera.width = dm.widthPixels;
layoutParamsCamera.height = dm.heightPixels;
layoutParamsMap.height = heightCamera;
layoutParamsMap.width = widthCamera;
camera.setLayoutParams(layoutParamsCamera);
ivMap.setLayoutParams(layoutParamsMap);
layerChange.addView(camera);
layerChange.addView(ivMap);
} else {
layoutParamsMap.height = dm.heightPixels;
layoutParamsMap.width = dm.widthPixels;
layoutParamsCamera.height = heightMap;
layoutParamsCamera.width = widthMap;
camera.setLayoutParams(layoutParamsCamera);
ivMap.setLayoutParams(layoutParamsMap);
layerChange.addView(ivMap);
layerChange.addView(camera);
}
}
@Override
protected void onResume() {

View File

@ -11,19 +11,20 @@ import androidx.recyclerview.widget.RecyclerView;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.bean.TaskExplainInfo;
import com.navinfo.outdoor.bean.TaskPrefectureBean;
import java.util.ArrayList;
import java.util.List;
public class IssueProblemAdapter extends RecyclerView.Adapter<IssueProblemAdapter.ViewHolder> {
private List<TaskExplainInfo.BodyBean.DataBean> issueList = new ArrayList<>();
private List<TaskPrefectureBean.BodyBean.ListBean> issueList = new ArrayList<>();
private Context context;
public IssueProblemAdapter(Context context) {
this.context = context;
}
public void setExplainList(List<TaskExplainInfo.BodyBean.DataBean> explainList) {
public void setExplainList(List<TaskPrefectureBean.BodyBean.ListBean> explainList) {
this.issueList.addAll(explainList);
notifyDataSetChanged();
}

View File

@ -78,6 +78,8 @@ public class Constant {
public static final int HOME_TREASURE = 33;//点击寻宝实时监听刷新
public static final int JOB_WORD_MONITOR=34;//筛选条件的刷新
public static final int EVENT_WHAT_LOCATION_CHANGE = 35; // 定位位置更新的Event的What值
public static final int CHARGING_PILE_BODY=36;//充电装的body
public static final int CHARGING_PILE_PHONE = 37;//充电桩的照片
public static String USER_ATTESTATION_NAME; //实名认证姓名 银行卡
public static int NUMBER = 200; //任务个数

View File

@ -30,9 +30,10 @@ public abstract class BaseDrawerFragment extends BaseFragment {
//1为是0为否-1为无法判断
if (mockGps == 1) {
onBackPressed();
} else {
new GPSUtils(getActivity());
}
// else {
// new GPSUtils(getActivity());
// }
}

View File

@ -57,6 +57,7 @@ import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -103,6 +104,8 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
private int taskId;
private Integer chargingPileBody;
private ArrayList<File> phoneLists;
public static ChargingPileFragment newInstance(Bundle bundle) {
ChargingPileFragment fragment = new ChargingPileFragment();
fragment.setArguments(bundle);
@ -566,7 +569,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
if (all) {
//保存数据库
ChargingPileEntity chargingPileEntity = new ChargingPileEntity();
ArrayList<String> photoBean = new ArrayList<>();
ArrayList<String> photoBean; photoBean = new ArrayList<>();
if (latLng == null || latLng.equals("")) {
Toast.makeText(getActivity(), "请确定点位", Toast.LENGTH_SHORT).show();
return;
@ -788,10 +791,20 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
public void onSuccess(ChargingPileSaveBean chargingPileSaveBean, int id) {
dismissLoadingDialog();
chargingPileBody = chargingPileSaveBean.getBody();
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
Log.d("TAG", "onSuccess: " + chargingPileSaveBean.getBody());
phoneList();
Message obtain = Message.obtain();
obtain.what = Constant.CHARGING_PILE_BODY;
obtain.obj = chargingPileBody;
EventBus.getDefault().post(obtain);
Message obtain1 = Message.obtain();
obtain1.what = Constant.CHARGING_PILE_PHONE;
obtain1.obj = phoneLists;
EventBus.getDefault().post(obtain1);
getActivity().onBackPressed();
}
@Override
@ -803,6 +816,50 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
}).build();
}
private void phoneList() {
phoneLists = new ArrayList<>();
String ivPanoramaTag = (String) ivPanorama.getTag();
if (ivPanoramaTag!=null){
phoneLists.add(new File(ivPanoramaTag));
}
String ivCodingTag = (String) ivCoding.getTag();
if (ivCodingTag!=null){
phoneLists.add(new File(ivCodingTag));
}
String ivEquipmentTag = (String) ivEquipment.getTag();
if (ivEquipmentTag!=null){
phoneLists.add(new File(ivEquipmentTag));
}
String ivFacilityTag = (String) ivFacility.getTag();
if (ivFacilityTag!=null){
phoneLists.add(new File(ivFacilityTag));
}
String ivUsableTag = (String) ivUsable.getTag();
if (ivUsableTag!=null){
phoneLists.add(new File(ivUsableTag));
}
String ivAvailableTag = (String) ivAvailable.getTag();
if (ivAvailableTag!=null){
phoneLists.add(new File(ivAvailableTag));
}
String ivParkingTag = (String) ivParking.getTag();
if (ivParkingTag!=null){
phoneLists.add(new File(ivParkingTag));
}
String ivNumberTag = (String) ivNumber.getTag();
if (ivNumberTag!=null){
phoneLists.add(new File(ivNumberTag));
}
String ivDeviceTag = (String) ivDevice.getTag();
if (ivDeviceTag!=null){
phoneLists.add(new File(ivDeviceTag));
}
String ivScutcheonTag = (String) ivScutcheon.getTag();
if (ivScutcheonTag!=null){
phoneLists.add(new File(ivScutcheonTag));
}
}
@Override
public void onSaveInstanceState(@NonNull Bundle outState) {

View File

@ -111,6 +111,9 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
private Integer body;
private LinearLayout linearContact;
private ContactView contactView;
private Integer chargingPileBody;
private ArrayList<File> chargingStationList;
private ArrayList<File> phoneList;
public static ChargingStationFragment newInstance(Bundle bundle) {
ChargingStationFragment fragment = new ChargingStationFragment();
@ -551,6 +554,10 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
ArrayList<ChargingPileEntity> chargingPileEntities = new ArrayList<>();
chargingPileEntities.add(chargingPileEntity);
chargingPileAdapter.setChargingPileEntities(chargingPileEntities);
}else if (data.what == Constant.CHARGING_PILE_BODY){
chargingPileBody = (Integer) data.obj;
}else if (data.what == Constant.CHARGING_PILE_PHONE){
phoneList = (ArrayList<File>) data.obj;
}
}
@ -558,127 +565,14 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
public void onClick(View v) {
switch (v.getId()) {
case R.id.btn_save_local:
XXPermissions.with(this)
//读写权限
.permission(Permission.MANAGE_EXTERNAL_STORAGE)
.request(new OnPermissionCallback() {
@Override
public void onGranted(List<String> permissions, boolean all) {
if (all) {
//保存数据库
PoiEntity poiEntity = showPoiEntity;
List<Info> infoPhoto = new ArrayList<>();
String name = editNameContent.getText().toString().trim();//名称
if (name == null || name.equals("")) {
Toast.makeText(getActivity(), "请输入充电站 名称", Toast.LENGTH_SHORT).show();
return;
} else {
poiEntity.setName(name);
}
String site = editSiteContent.getText().toString().trim();
if (site != null && !site.equals("")) {
poiEntity.setAddress(site);
}
if (latLng == null) {
Toast.makeText(getActivity(), "请确定点位", Toast.LENGTH_SHORT).show();
return;
} else {
String encode = Geohash.getInstance().encode(latLng.latitude, latLng.longitude);
poiEntity.setGeoWkt(encode);
poiEntity.setX(String.valueOf(latLng.longitude));
poiEntity.setY(String.valueOf(latLng.latitude));
}
String describe = editDescribe.getText().toString().trim();
if (describe != null && !describe.equals("")) {
poiEntity.setDescribe(describe);
}
boolean phoneBean = contactView.getPhoneBean();
if (phoneBean){
String list = contactView.getList();
poiEntity.setTelPhone(list);
}
String tagPanorama = (String) ivPanorama.getTag();
if (tagPanorama == null) {
Toast.makeText(getActivity(), "请拍照 全景图", Toast.LENGTH_SHORT).show();
return;
} else {
infoPhoto.add(new Info(tagPanorama));
}
String tagName = (String) ivName.getTag();
if (tagName == null) {
Toast.makeText(getActivity(), "请拍照 充电桩编码", Toast.LENGTH_SHORT).show();
return;
} else {
infoPhoto.add(new Info(tagName));
}
String tagInternal = (String) ivInternal.getTag();
if (tagInternal == null) {
Toast.makeText(getActivity(), "请拍照 设备编码", Toast.LENGTH_SHORT).show();
return;
} else {
infoPhoto.add(new Info(tagInternal));
}
String tagElse = (String) ivElse.getTag();
if (tagElse == null) {
Toast.makeText(getActivity(), "请拍照 设备编码", Toast.LENGTH_SHORT).show();
return;
} else {
infoPhoto.add(new Info(tagElse));
}
String tagScutcheon = (String) ivScutcheon.getTag();
if (tagScutcheon == null) {
Toast.makeText(getActivity(), "请拍照 设备编码", Toast.LENGTH_SHORT).show();
return;
} else {
infoPhoto.add(new Info(tagScutcheon));
}
poiEntity.setExistence(existence);
poiEntity.setPhotoInfo(infoPhoto);
poiEntity.setStation_type(station_type);
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(System.currentTimeMillis());
String format = formatter.format(calendar.getTime());
poiEntity.setCreateTime(format);
poiEntity.setType(2);
poiEntity.setTaskStatus(2);
poiEntity.setIsLocalData(1);
new Thread(new Runnable() {
@Override
public void run() {
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
chargingStationSaveByWork(poiEntity);
}
});
}
}).start();
// onBackPressed();
} else {
Toast.makeText(getActivity(), "没有申请权限,请手动申请", Toast.LENGTH_SHORT).show();
}
}
@Override
public void onDenied(List<String> permissions, boolean never) {
if (never) {
Toast.makeText(getActivity(), "被永久拒绝授权,请手动授予权限", Toast.LENGTH_SHORT).show();
// 如果是被永久拒绝就跳转到应用权限系统设置页面
XXPermissions.startPermissionActivity(getActivity(), permissions);
}
}
});
initRoadSaveLocal(false);
break;
case R.id.btn_uploading:
Message obtain = Message.obtain();
obtain.what = Constant.TREASURE_FRAGMENT;
obtain.obj = false;
EventBus.getDefault().post(obtain);
ArrayList<File> chargingStationList = new ArrayList<>();
chargingStationList = new ArrayList<>();
String tagPanorama = (String) ivPanorama.getTag();
if (tagPanorama != null) {
chargingStationList.add(new File(tagPanorama));
@ -701,8 +595,10 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
chargingStationList.add(new File(tagScutcheon));
}
if (body != null) {
if (body != null&& chargingPileBody!=null) {
stationUploadByNetWork(body, chargingStationList);
chargingPileUploadNetWork(body,phoneList);
} else {
new Thread(new Runnable() {
@Override
@ -712,6 +608,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
@Override
public void run() {
stationUploadByNetWork(poiDaoPoiEntity.getBodyId(), chargingStationList);
chargingPileUploadNetWork(poiDaoPoiEntity.getBodyId(),phoneList);
}
});
}
@ -751,6 +648,166 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
}
}
private void chargingPileUploadNetWork(int chargingPileBody, ArrayList<File> phoneList) {
if (chargingPileBody == 0) {
Toast.makeText(getActivity(), "没有保存本地", Toast.LENGTH_SHORT).show();
Log.e("TAG", "poiUploadByNetWork: " + body + phoneList);
return;
}
OkGo
// 请求方式和请求url
.<PoiUploadBean>post(HttpInterface.CS_TASK_UP_LOAD_PIC)
// 请求的 tag, 主要用于取消对应的请求
.params("auditId", chargingPileBody)
.addFileParams("file", phoneList)
.tag(this)
.execute(new DialogCallback<PoiUploadBean>(PoiUploadBean.class) {
@Override
public void onSuccess(Response<PoiUploadBean> poiUploadBeanResponse) {
dismissLoadingDialog();
Toast.makeText(getActivity(), "上传成功", Toast.LENGTH_SHORT).show();
// new Thread(new Runnable() {
// @Override
// public void run() {
// poiDao.getPoiEntity()
// ChargingPileDao poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
// poiDao.deletePoiEntity(poiDaoPoiEntity);
// getActivity().runOnUiThread(new Runnable() {
// @Override
// public void run() {
// getActivity().onBackPressed();//回退
// }
// });
// }
// }).start();
}
@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() + "");
}
});
}
private void initRoadSaveLocal(boolean isLocal) {
XXPermissions.with(this)
//读写权限
.permission(Permission.MANAGE_EXTERNAL_STORAGE)
.request(new OnPermissionCallback() {
@Override
public void onGranted(List<String> permissions, boolean all) {
if (all) {
//保存数据库
PoiEntity poiEntity = showPoiEntity;
List<Info> infoPhoto = new ArrayList<>();
String name = editNameContent.getText().toString().trim();//名称
if (name == null || name.equals("")) {
Toast.makeText(getActivity(), "请输入充电站 名称", Toast.LENGTH_SHORT).show();
return;
} else {
poiEntity.setName(name);
}
String site = editSiteContent.getText().toString().trim();
if (site != null && !site.equals("")) {
poiEntity.setAddress(site);
}
if (latLng == null) {
Toast.makeText(getActivity(), "请确定点位", Toast.LENGTH_SHORT).show();
return;
} else {
String encode = Geohash.getInstance().encode(latLng.latitude, latLng.longitude);
poiEntity.setGeoWkt(encode);
poiEntity.setX(String.valueOf(latLng.longitude));
poiEntity.setY(String.valueOf(latLng.latitude));
}
String describe = editDescribe.getText().toString().trim();
if (describe != null && !describe.equals("")) {
poiEntity.setDescribe(describe);
}
boolean phoneBean = contactView.getPhoneBean();
if (phoneBean){
String list = contactView.getList();
poiEntity.setTelPhone(list);
}
String tagPanorama = (String) ivPanorama.getTag();
if (tagPanorama == null) {
Toast.makeText(getActivity(), "请拍照 全景图", Toast.LENGTH_SHORT).show();
return;
} else {
infoPhoto.add(new Info(tagPanorama));
}
String tagName = (String) ivName.getTag();
if (tagName == null) {
Toast.makeText(getActivity(), "请拍照 充电桩编码", Toast.LENGTH_SHORT).show();
return;
} else {
infoPhoto.add(new Info(tagName));
}
String tagInternal = (String) ivInternal.getTag();
if (tagInternal == null) {
Toast.makeText(getActivity(), "请拍照 设备编码", Toast.LENGTH_SHORT).show();
return;
} else {
infoPhoto.add(new Info(tagInternal));
}
String tagElse = (String) ivElse.getTag();
if (tagElse == null) {
Toast.makeText(getActivity(), "请拍照 设备编码", Toast.LENGTH_SHORT).show();
return;
} else {
infoPhoto.add(new Info(tagElse));
}
String tagScutcheon = (String) ivScutcheon.getTag();
if (tagScutcheon == null) {
Toast.makeText(getActivity(), "请拍照 设备编码", Toast.LENGTH_SHORT).show();
return;
} else {
infoPhoto.add(new Info(tagScutcheon));
}
poiEntity.setExistence(existence);
poiEntity.setPhotoInfo(infoPhoto);
poiEntity.setStation_type(station_type);
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(System.currentTimeMillis());
String format = formatter.format(calendar.getTime());
poiEntity.setCreateTime(format);
poiEntity.setType(2);
poiEntity.setTaskStatus(2);
poiEntity.setIsLocalData(1);
new Thread(new Runnable() {
@Override
public void run() {
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
chargingStationSaveByWork(poiEntity,isLocal);
}
});
}
}).start();
// onBackPressed();
} else {
Toast.makeText(getActivity(), "没有申请权限,请手动申请", Toast.LENGTH_SHORT).show();
}
}
@Override
public void onDenied(List<String> permissions, boolean never) {
if (never) {
Toast.makeText(getActivity(), "被永久拒绝授权,请手动授予权限", Toast.LENGTH_SHORT).show();
// 如果是被永久拒绝就跳转到应用权限系统设置页面
XXPermissions.startPermissionActivity(getActivity(), permissions);
}
}
});
}
private void stationUploadByNetWork(int body, ArrayList<File> chargingStationList) {
if (body == 0) {
Toast.makeText(getActivity(), "没有保存本地", Toast.LENGTH_SHORT).show();
@ -789,8 +846,9 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
});
}
private void chargingStationSaveByWork(PoiEntity poiEntity) {
private void chargingStationSaveByWork(PoiEntity poiEntity, boolean isLocal) {
showLoadingDialog();
HttpParams httpParams = new HttpParams();
httpParams.put("taskId", poiEntity.getTaskId());
httpParams.put("sptype", poiEntity.getStation_type());
@ -819,7 +877,11 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
if (isLocal){
stationUploadByNetWork(body,chargingStationList);
}else {
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
}
Log.d("TAG", "onSuccess: " + chargingStationBean.getBody());
}
});

View File

@ -13,11 +13,13 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import com.jcodecraeer.xrecyclerview.ProgressStyle;
import com.jcodecraeer.xrecyclerview.XRecyclerView;
import com.lzy.okgo.model.HttpParams;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.activity.FragmentManagement;
import com.navinfo.outdoor.adapter.IssueProblemAdapter;
import com.navinfo.outdoor.base.BaseFragment;
import com.navinfo.outdoor.bean.TaskExplainInfo;
import com.navinfo.outdoor.bean.TaskPrefectureBean;
import com.navinfo.outdoor.http.Callback;
import com.navinfo.outdoor.http.HttpInterface;
import com.navinfo.outdoor.http.OkGoBuilder;
@ -36,7 +38,6 @@ public class IssueFragment extends BaseFragment implements View.OnClickListener
private ImageView ivIssueFinish;
private XRecyclerView mainIssueRecycler;
private IssueProblemAdapter issueProblemAdapter;
private ArrayList<TaskExplainInfo.BodyBean.DataBean> issueList;
public static IssueFragment newInstance(Bundle bundle) {
IssueFragment fragment = new IssueFragment();
@ -51,28 +52,33 @@ public class IssueFragment extends BaseFragment implements View.OnClickListener
@Override
protected void initData() {
super.initData();
issueList = new ArrayList<>();
initNetWork(true);
}
private void initNetWork(boolean b) {
showLoadingDialog();
HttpParams httpParams = new HttpParams();
httpParams.put("fid", "1");
httpParams.put("pageNum", "1");
httpParams.put("pageSize", "10");
OkGoBuilder.getInstance()
.Builder(getActivity())
.url(HttpInterface.listTaskExplain)
.method(OkGoBuilder.GET)
.cls(TaskExplainInfo.class)
.callback(new Callback<TaskExplainInfo>() {
.cls(TaskPrefectureBean.class)
.params(httpParams)
.callback(new Callback<TaskPrefectureBean>() {
@Override
public void onSuccess(TaskExplainInfo taskExplainInfo, int id) {
public void onSuccess(TaskPrefectureBean response, int id) {
dismissLoadingDialog();
issueProblemAdapter.setExplainList(taskExplainInfo.getBody().getData());
Log.d("TAG", "onSuccess: " + taskExplainInfo.getMsg() + "");
issueProblemAdapter.setExplainList(response.getBody().getList());
Log.d("TAG", "onSuccess: " + response.getMessage() + "");
}
@Override
public void onError(Throwable e, int id) {
dismissLoadingDialog();
// Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show();
Log.d("TAG", "onError: " + e.getMessage());
}
}).build();

View File

@ -62,7 +62,7 @@ public class MineFragment extends BaseFragment implements View.OnClickListener {
protected void initView() {
super.initView();
imageHeard = findViewById(R.id.image_heard);
Glide.with(getActivity()).load(R.drawable.icon_capacity_evaluation).apply(RequestOptions.bitmapTransform(new CircleCrop())).into(imageHeard);
Glide.with(getActivity()).load(R.drawable.mine_harder).apply(RequestOptions.bitmapTransform(new CircleCrop())).into(imageHeard);
imageHeard.setOnClickListener(this::onClick);
tvName = findViewById(R.id.tv_name);
tvName.setOnClickListener(this::onClick);

View File

@ -597,7 +597,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
@Override
public void run() {
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
if (poiDaoPoiEntity.getName() == null) {
if (poiDaoPoiEntity!=null&&poiDaoPoiEntity.getName() == null) {
poiDao.deletePoiEntity(poiDaoPoiEntity);
}
}

View File

@ -879,7 +879,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
@Override
public void run() {
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
if (poiDaoPoiEntity.getName() == null) {
if (poiDaoPoiEntity!=null&&poiDaoPoiEntity.getName() == null) {
poiDao.deletePoiEntity(poiDaoPoiEntity);
}
}

View File

@ -76,7 +76,7 @@ import java.util.List;
public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClickListener {
private TextView tvPictures;
private EditText etRoadName;
private TextView etRoadName;
private ImageView ivPoiVideoPicture;
private RadioButton rbCar;
private RadioButton rbBicycle;
@ -145,7 +145,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
poiDao = poiDatabase.getPoiDao();
tvPictures = (TextView) findViewById(R.id.tv_pictures);
tvPictures.setOnClickListener(this::onClick);
etRoadName = (EditText) findViewById(R.id.et_poi_video_name);
etRoadName = (TextView) findViewById(R.id.et_poi_video_name);
ivPoiVideoPicture = (ImageView) findViewById(R.id.iv_poi_video_picture);
rbCar = (RadioButton) findViewById(R.id.rb_car);
rbBicycle = (RadioButton) findViewById(R.id.rb_bicycle);
@ -615,7 +615,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
@Override
public void run() {
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
if (poiDaoPoiEntity.getName() == null) {
if (poiDaoPoiEntity!=null&&poiDaoPoiEntity.getName() == null) {
poiDao.deletePoiEntity(poiDaoPoiEntity);
}
}

View File

@ -594,7 +594,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
@Override
public void run() {
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
if (poiDaoPoiEntity.getName() == null) {
if (poiDaoPoiEntity!=null&&poiDaoPoiEntity.getName() == null) {
poiDao.deletePoiEntity(poiDaoPoiEntity);
}
}

View File

@ -118,6 +118,7 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
roadEntities.clear();
roadEntities.addAll(roadAll);
staySubmitAdapter.setAllRoad(roadEntities);
staySubmitAdapter.notifyDataSetChanged();
}
});
}

View File

@ -144,6 +144,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
ivMessage.setOnClickListener(this::onClick);
treasureMap = (MapView) findViewById(R.id.treasure_map);
tencentMap = treasureMap.getMap();
cbMapType = (CheckBox) findViewById(R.id.cb_map_type);
cbFootType = (CheckBox) findViewById(R.id.cb_foot_type);
// sliding_layout.setScrollableViewHelper(new NestedScrollableViewHelper());
@ -1028,15 +1029,21 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
}
break;
case R.id.iv_submit://弹窗
//分享
CharSequence title = "请选择上报类型";
DialogSettings.style = DialogSettings.STYLE.STYLE_MIUI;
List<ShareDialog.Item> itemList = new ArrayList<>();
itemList.add(new ShareDialog.Item(getContext(), R.drawable.push_poi, "POI"));
itemList.add(new ShareDialog.Item(getContext(), R.drawable.push_poi, "POI录像"));
itemList.add(new ShareDialog.Item(getContext(), R.drawable.poi_video, "POI录像"));
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, "其他"));
if (!ivSubmit.isClickable()){
ivMessage.setVisibility(View.VISIBLE);
}else {
ivMessage.setVisibility(View.GONE);
}
Bundle bundle = new Bundle();
PoiEntity poiEntity = new PoiEntity();
LatLng mapCenterPoint = getMapCenterPoint();

View File

@ -132,7 +132,6 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
Toast.makeText(getContext(), "身份证错误,请重新输入", Toast.LENGTH_SHORT).show();
return;
}
nameAuthentication();
break;
}

View File

@ -25,203 +25,203 @@ 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;
//
// 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;
// }
// }
// };
}

View File

@ -45,7 +45,7 @@ public class TecentLocationUtils implements TencentLocationListener{
locationManager.setCoordinateType(TencentLocationManager.COORDINATE_TYPE_GCJ02);
//创建定位请求
locationRequest = TencentLocationRequest.create();
locationRequest.setInterval(2000); // 每2秒返回一次地址数据
locationRequest.setInterval(1000); // 每1秒返回一次地址数据
}
public void startLocation(Context mContext) { // 启动定位服务

View File

@ -7,7 +7,7 @@ import org.json.JSONObject;
public class Whetherisempty {
public static String getClfz(String s) throws JSONException {
JSONObject jsonObject = new JSONObject(s);
if (String.valueOf(jsonObject.get("body")).equals("[]") || String.valueOf(jsonObject.get("body")).equals("")) {
if (!jsonObject.has("body") || String.valueOf(jsonObject.get("body")).equals("[]") || String.valueOf(jsonObject.get("body")).equals("")) {
jsonObject.put("body", null);
return jsonObject.toString();
} else {

View File

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#F6F4F4"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M15.5,14h-0.79l-0.28,-0.27C15.41,12.59 16,11.11 16,9.5 16,5.91 13.09,3 9.5,3S3,5.91 3,9.5 5.91,16 9.5,16c1.61,0 3.09,-0.59 4.23,-1.57l0.27,0.28v0.79l5,4.99L20.49,19l-4.99,-5zM9.5,14C7.01,14 5,11.99 5,9.5S7.01,5 9.5,5 14,7.01 14,9.5 11.99,14 9.5,14z"/>
</vector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 391 B

After

Width:  |  Height:  |  Size: 558 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/colorTransparent" />
<solid android:color="@color/white" />
<corners android:radius="50dp" />
</shape>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

View File

@ -2,6 +2,7 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:background="#ECECEC"
android:layout_height="match_parent">
<LinearLayout
@ -46,6 +47,7 @@
android:layout_height="wrap_content"
android:background="@color/white"
android:orientation="vertical"
android:padding="15dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/view1">
@ -86,10 +88,9 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_height="wrap_content"
android:background="@color/white"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/view2">
@ -121,6 +122,8 @@
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:background="#F1F0F0" />
<RelativeLayout
@ -150,6 +153,8 @@
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:background="#F1F0F0" />
<RelativeLayout
@ -175,11 +180,6 @@
android:gravity="center"
android:textSize="16sp" />
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#F1F0F0" />
</LinearLayout>

View File

@ -86,12 +86,12 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/login_paw" />
<ImageView
<CheckBox
android:id="@+id/iv_login_check"
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="@drawable/select_check"
android:buttonTint="@color/white"
app:layout_constraintLeft_toLeftOf="@id/et_login_paw"
app:layout_constraintTop_toBottomOf="@id/et_login_paw" />
@ -132,9 +132,11 @@
style="@style/login_style"
android:layout_width="300dp"
android:layout_height="50dp"
android:layout_marginTop="30dp"
android:layout_marginBottom="261dp"
android:gravity="center"
android:text="登录"
android:layout_marginTop="30dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/et_login_paw"
app:layout_constraintStart_toStartOf="@+id/et_login_paw"
app:layout_constraintTop_toBottomOf="@+id/textView" />

View File

@ -5,25 +5,30 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FF444444">
<com.otaliastudios.cameraview.CameraView
android:id="@+id/camera"
<FrameLayout
android:id="@+id/layer_change"
android:layout_width="match_parent"
android:layout_height="0dp"
android:keepScreenOn="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent" />
android:layout_height="match_parent">
<com.otaliastudios.cameraview.CameraView
android:id="@+id/camera"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:keepScreenOn="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.tencent.tencentmap.mapsdk.maps.TextureMapView
android:id="@+id/iv_map"
android:layout_width="200dp"
android:layout_height="100dp"
app:layout_constraintHeight_default="percent"
app:layout_constraintHeight_percent="0.4"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintWidth_default="percent"
app:layout_constraintWidth_percent="0.4" />
</FrameLayout>
<com.tencent.tencentmap.mapsdk.maps.TextureMapView
android:id="@+id/iv_map"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintHeight_default="percent"
app:layout_constraintHeight_percent="0.4"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintWidth_default="percent"
app:layout_constraintWidth_percent="0.4" />
<Button
android:id="@+id/btn_switch"

View File

@ -9,7 +9,7 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_stay_type"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_height="80dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
@ -63,7 +63,7 @@
android:id="@+id/tv_stay_result"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:layout_margin="15dp"
android:text="筛选结果"
android:textSize="25sp"
android:textStyle="bold" />

View File

@ -47,10 +47,19 @@
android:layout_height="40dp"
android:layout_margin="5dp"
android:layout_weight="1"
android:background="#fff" />
android:background="#fff" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ic_baseline_search"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"/>
</LinearLayout>
<Button
android:layout_width="wrap_content"
android:layout_width="60dp"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="#FF5722"

View File

@ -23,7 +23,7 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/constraintLayout"
android:layout_width="match_parent"
android:layout_height="140dp"
android:layout_height="145dp"
android:background="@mipmap/bg"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
@ -58,7 +58,7 @@
android:layout_height="30dp"
android:layout_marginRight="15dp"
android:layout_marginTop="10dp"
android:background="@drawable/icon_event_prefecture"
android:background="@drawable/shares"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
@ -67,7 +67,7 @@
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginTop="15dp"
android:background="@drawable/icon_capacity_evaluation"
android:background="@drawable/sign"
app:layout_constraintBottom_toBottomOf="@+id/image_heard"
app:layout_constraintEnd_toEndOf="@+id/image_share"
app:layout_constraintTop_toBottomOf="@+id/image_share" />
@ -127,9 +127,9 @@
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginLeft="35dp"
android:layout_marginTop="60dp"
android:layout_marginRight="35dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="50dp"
android:layout_marginRight="25dp"
android:layout_marginBottom="20dp"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
@ -141,7 +141,7 @@
android:id="@+id/rl_grade"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="18dp"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:layout_weight="1"
android:background="?android:attr/selectableItemBackground">
@ -150,6 +150,7 @@
style="@style/main_text_style"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="我的等级" />
<TextView

View File

@ -47,9 +47,10 @@
android:textColor="@color/black"
android:textSize="15sp" />
<EditText
<TextView
android:id="@+id/et_poi_video_name"
android:layout_width="200dp"
android:textSize="14sp"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:background="@null" />

View File

@ -35,11 +35,11 @@
</com.tencent.tencentmap.mapsdk.maps.MapView>
<ImageView
android:id="@+id/iv_message"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_marginTop="60dp"
android:layout_marginLeft="20dp"
android:background="@drawable/ic_baseline_add_alert"
android:background="@drawable/iv_message"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent">
</ImageView>

View File

@ -192,7 +192,7 @@
android:id="@+id/checkBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:layout_marginTop="15dp"
android:text="银行卡"
app:layout_constraintStart_toStartOf="@+id/relativeLayout2"
app:layout_constraintTop_toBottomOf="@+id/relativeLayout2" />
@ -224,9 +224,9 @@
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="20dp"
android:layout_marginRight="20dp"
android:layout_marginRight="10dp"
android:background="#fff"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
@ -236,7 +236,8 @@
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_height="65dp"
android:padding="5dp"
android:gravity="center_vertical">
<ImageView
@ -275,7 +276,8 @@
android:background="#F1F0F0" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_height="65dp"
android:padding="5dp"
android:gravity="center_vertical">
<ImageView
@ -313,7 +315,8 @@
android:background="#F1F0F0" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_height="65dp"
android:padding="5dp"
android:gravity="center_vertical">
<ImageView
android:id="@+id/image_way"
@ -350,7 +353,8 @@
android:background="#F1F0F0" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_height="65dp"
android:padding="5dp"
android:gravity="center_vertical">
<ImageView
android:id="@+id/image_way_report"
@ -387,7 +391,8 @@
android:background="#F1F0F0" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_height="65dp"
android:padding="5dp"
android:gravity="center_vertical">
<ImageView
android:id="@+id/image_charging"
@ -424,7 +429,8 @@
android:background="#F1F0F0" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_height="65dp"
android:padding="5dp"
android:gravity="center_vertical">
<ImageView
android:id="@+id/image_charge_report"
@ -461,12 +467,13 @@
android:background="#F1F0F0" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_height="65dp"
android:padding="5dp"
android:gravity="center_vertical">
<ImageView
android:id="@+id/image_other"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="40dp"
android:layout_height="45dp"
android:layout_centerVertical="true"
android:layout_margin="2dp"
android:background="@drawable/push_qingbao" />
@ -498,12 +505,13 @@
android:background="#F1F0F0" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_height="65dp"
android:padding="5dp"
android:gravity="center_vertical">
<ImageView
android:id="@+id/image_other_report"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="40dp"
android:layout_height="45dp"
android:layout_centerVertical="true"
android:layout_margin="2dp"
android:background="@drawable/push_qingbao" />

Binary file not shown.

Before

Width:  |  Height:  |  Size: 600 B

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 425 B

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 316 B

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 271 B

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 426 B

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 269 B

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 282 B

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 320 B

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

@ -97,7 +97,7 @@
<style name="login_style">
<item name="android:textSize">18sp</item>
<item name="android:background">@drawable/login_ripple</item>
<item name="android:textColor">@color/colorPrimaryDark</item>
<item name="android:textColor">@color/colorBlue</item>
</style>
<!--'注册'hint设置-->
<style name="register_hint_style">