解决经纬度加密,解决录像轨迹,闪退问题,修改存储的数据

This commit is contained in:
wds 2021-08-06 19:36:23 +08:00
parent a8d78281ed
commit 3bcacb3c82
17 changed files with 1480 additions and 1372 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

@ -12,6 +12,7 @@ import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.location.Location;
import android.media.MediaMetadataRetriever;
import android.os.Bundle;
import android.os.Looper;
import android.os.Message;
import android.os.SystemClock;
@ -59,10 +60,13 @@ import com.tencent.tencentmap.mapsdk.maps.CameraUpdateFactory;
import com.tencent.tencentmap.mapsdk.maps.TencentMap;
import com.tencent.tencentmap.mapsdk.maps.TextureMapView;
import com.tencent.tencentmap.mapsdk.maps.UiSettings;
import com.tencent.tencentmap.mapsdk.maps.interfaces.Removable;
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptor;
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptorFactory;
import com.tencent.tencentmap.mapsdk.maps.model.CameraPosition;
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
import com.tencent.tencentmap.mapsdk.maps.model.Marker;
import com.tencent.tencentmap.mapsdk.maps.model.MarkerOptions;
import com.tencent.tencentmap.mapsdk.maps.model.MyLocationStyle;
@ -111,6 +115,8 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
private TextView videoChronometer;
private long recordingTime = 0;// 记录下来的总时间
private int oratation = -1; // 是否强制横屏拍摄默认不强制,0-强制横屏 其他-任意
private List<Removable> removables;
private String uuId;
@Override
protected int getLayout() {
@ -126,6 +132,7 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
if (getIntent()!=null) {
finalVideoPath = getIntent().getStringExtra(Constant.INTENT_VIDEO_PATH);
uuId = getIntent().getStringExtra("uuId");
oratation = getIntent().getIntExtra(Constant.INTENT_VIDEO_ORATATION, -1);
}
videoChronometer = findViewById(R.id.video_chronometer);
@ -133,8 +140,10 @@ 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);
@ -218,7 +227,22 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
// Log.e("PictureActivity", frame.getTime()+"");
// }
// });
removables = new ArrayList<>();//存储轨迹的marker
if (uuId!=null){
List<File> videoFileListByUUID = AWMp4ParserHelper.getInstance().getVideoFileListByUUID(uuId);
if (videoFileListByUUID!=null){
List<LatLng> lineStringByVideoFileList = AWMp4ParserHelper.getInstance().getLineStringByVideoFileList(videoFileListByUUID);
for (int i = 0; i < lineStringByVideoFileList.size(); i++) {
LatLng latLng = lineStringByVideoFileList.get(i);
if (latLng!=null){
Marker marker = tencentMap.addMarker(new MarkerOptions(latLng).alpha(0.9f)
.flat(true)
.clockwise(false));
removables.add(marker);
}
}
}
}
//相机预览监听
camera.addCameraListener(new CameraListener() {
@Override
@ -407,7 +431,6 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
Toast.makeText(this, "本段视频没有计时!", Toast.LENGTH_SHORT).show();
}
if (camera.isTakingVideo()) {
showLoadingDialog();
isFinishActivity = true;
camera.stopVideo();
} else {
@ -538,6 +561,10 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
super.onDestroy();
stopTakenVideo();
camera.destroy();
for (int i = 0; i < removables.size(); i++) {
removables.get(i).remove();
}
removables.clear();
timer.cancel();
if (EventBus.getDefault().isRegistered(this)) {
EventBus.getDefault().unregister(this);
@ -560,6 +587,14 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
break;
}
}
@Override
public void onSaveInstanceState(@NonNull Bundle outState) {
super.onSaveInstanceState(outState);
Message obtain = Message.obtain();
obtain.what = Constant.PICTURE_VIDEO_WORD;
obtain.obj = true;
EventBus.getDefault().post(obtain);
}
/**
* 记录视频拍摄的时间及经纬度
@ -591,6 +626,11 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
sb.append(",");
sb.append(Constant.currentLocation.getLongitude());
sb.append(",");
LatLng latLng = new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude());
Marker marker = tencentMap.addMarker(new MarkerOptions(latLng).alpha(0.9f)
.flat(true)
.clockwise(false));
removables.add(marker);
if (Constant.currentLocation.getBearing()!=0) {
sb.append(Constant.currentLocation.getBearing());
} else {

View File

@ -86,6 +86,8 @@ public class Constant {
public static final int EVENT_STAY_REFRESH = 44; // 刷新记录页面
public static final int EVENT_WORK_HOME = 45; //切换到寻宝
public static final int PICTURE_VIDEO_WORD = 48; //视频页面崩溃后发给poi录像和道路
public static int NUMBER = 200; //任务个数
public static int LIMIT_TTPE = -1; //权限类型普通任务-0专属任务-1
public static int TASK_TYPE = -1; // 任务类型

View File

@ -15,6 +15,7 @@ import androidx.annotation.Nullable;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.api.Constant;
import com.navinfo.outdoor.room.ChargingPileEntity;
import com.navinfo.outdoor.room.PoiEntity;
import com.navinfo.outdoor.util.FragmentBackHandler;
import com.navinfo.outdoor.util.GPSUtils;
@ -117,11 +118,12 @@ public abstract class BaseDrawerFragment extends BaseFragment {
return findViewById(R.id.scroller_view);
}
protected abstract PoiEntity initPoiEntityByUI();
protected abstract PoiEntity initPoiEntityByUI( PoiEntity entity);
protected abstract PoiCheckResult checkPoiEntity(PoiEntity entity);
protected abstract ChargingPileEntity initChargingPileEntityByUI( ChargingPileEntity entity);
protected abstract PoiCheckResult checkChargingPileEntity(ChargingPileEntity entity);
public class PoiCheckResult {
private int code; // 0 检查成功
private int code; // 0 检查成功,1失败
private String msg;
public int getCode() {

View File

@ -83,6 +83,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
private ArrayAdapter<String> adapterType, adapterScutcheon, adapterStake;
private RelativeLayout rlPanorama, rlCoding, rlEquipment, rlFacility, rlUsable, rlAvailable, rlParking, rlNumber, rlScutcheon, rlDevice;
private ImageView ivPanorama, ivCoding, ivEquipment, ivFacility, ivUsable, ivAvailable, ivParking, ivNumber, ivScutcheon, ivDevice;
private TextView tvPanorama, tvCoding, tvEquipment, tvFacility, tvUsable, tvAvailable, tvParking, tvNumber, tvScutcheon, tvDevice;
private ChargingPileDao chargingPileDao;
private int cp_floor = 1;
private int sign_exist = 0;
@ -367,33 +368,43 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
rlPanorama = findViewById(R.id.rl_panorama);
rlPanorama.setOnClickListener(this::onClick);
ivPanorama = findViewById(R.id.iv_panorama);
tvPanorama = findViewById(R.id.tv_panorama);
rlCoding = findViewById(R.id.rl_coding);
rlCoding.setOnClickListener(this::onClick);
ivCoding = findViewById(R.id.iv_coding);
tvCoding = findViewById(R.id.tv_coding);
rlEquipment = findViewById(R.id.rl_equipment);
rlEquipment.setOnClickListener(this::onClick);
ivEquipment = findViewById(R.id.iv_equipment);
tvEquipment = findViewById(R.id.tv_equipment);
rlFacility = findViewById(R.id.rl_facility);
rlFacility.setOnClickListener(this::onClick);
ivFacility = findViewById(R.id.iv_facility);
tvFacility = findViewById(R.id.tv_facility);
rlUsable = findViewById(R.id.rl_usable);
rlUsable.setOnClickListener(this::onClick);
ivUsable = findViewById(R.id.iv_usable);
tvUsable = findViewById(R.id.tv_usable);
rlAvailable = findViewById(R.id.rl_available);
rlAvailable.setOnClickListener(this::onClick);
ivAvailable = findViewById(R.id.iv_available);
tvAvailable = findViewById(R.id.tv_available);
rlParking = findViewById(R.id.rl_parking);
rlParking.setOnClickListener(this::onClick);
ivParking = findViewById(R.id.iv_parking);
tvParking = findViewById(R.id.tv_parking);
rlNumber = findViewById(R.id.rl_number);
rlNumber.setOnClickListener(this::onClick);
ivNumber = findViewById(R.id.iv_number);
tvNumber = findViewById(R.id.tv_number);
rlScutcheon = findViewById(R.id.rl_scutcheon);
rlScutcheon.setOnClickListener(this::onClick);
ivScutcheon = findViewById(R.id.iv_scutcheon);
tvScutcheon = findViewById(R.id.tv_scutcheon);
rlDevice = findViewById(R.id.rl_device);
rlDevice.setOnClickListener(this::onClick);
ivDevice = findViewById(R.id.iv_device);
tvDevice = findViewById(R.id.tv_device);
editDescribe = findViewById(R.id.edit_describe);
btnSaveLocal = findViewById(R.id.btn_save_local);
btnSaveLocal.setOnClickListener(this::onClick);
@ -564,9 +575,13 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
if (name != null) {
tvNameContent.setText(name + "");
}
String p = chargingPileEntity.getP();
if (p != null) {
latLng = GeometryTools.createLatLng(p);
// 解密geo
String decodeGeometry = Geohash.getInstance().decode(p);
latLng = GeometryTools.createLatLng(decodeGeometry);
}
String memo = chargingPileEntity.getMemo();
if (memo != null && !memo.equals("")) {
@ -601,8 +616,10 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
String[] split = photo.split("/");
if (split[split.length - 1].startsWith("a")) {
Glide.with(getActivity()).load(photo).into(ivPanorama);
tvPanorama.setTag(photo);
} else if (split[split.length - 1].startsWith("b")) {
Glide.with(getActivity()).load(photo).into(ivCoding);
tvCoding.setTag(photo);
} else if (split[split.length - 1].startsWith("c")) {
cList.add(photo);
} else if (split[split.length - 1].startsWith("d")) {
@ -622,21 +639,31 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
switch (list.size()) {
case 1:
Glide.with(getActivity()).load(list.get(0)).into(ivEquipment);
tvEquipment.setTag(list.get(0));
break;
case 2:
Glide.with(getActivity()).load(list.get(0)).into(ivEquipment);
tvEquipment.setTag(list.get(0));
Glide.with(getActivity()).load(list.get(1)).into(ivFacility);
tvFacility.setTag(list.get(1));
break;
case 3:
Glide.with(getActivity()).load(list.get(0)).into(ivEquipment);
tvEquipment.setTag(list.get(0));
Glide.with(getActivity()).load(list.get(1)).into(ivFacility);
tvFacility.setTag(list.get(1));
Glide.with(getActivity()).load(list.get(2)).into(ivScutcheon);
tvScutcheon.setTag(list.get(2));
break;
case 4:
Glide.with(getActivity()).load(list.get(0)).into(ivEquipment);
tvEquipment.setTag(list.get(0));
Glide.with(getActivity()).load(list.get(1)).into(ivFacility);
tvFacility.setTag(list.get(1));
Glide.with(getActivity()).load(list.get(2)).into(ivScutcheon);
tvScutcheon.setTag(list.get(2));
Glide.with(getActivity()).load(list.get(3)).into(ivDevice);
tvDevice.setTag(list.get(3));
break;
}
}
@ -645,10 +672,13 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
switch (list.size()) {
case 1:
Glide.with(getActivity()).load(list.get(0)).into(ivUsable);
tvUsable.setTag(list.get(0));
break;
case 2:
Glide.with(getActivity()).load(list.get(0)).into(ivUsable);
tvUsable.setTag(list.get(0));
Glide.with(getActivity()).load(list.get(1)).into(ivAvailable);
tvAvailable.setTag(list.get(1));
break;
}
}
@ -657,10 +687,13 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
switch (list.size()) {
case 1:
Glide.with(getActivity()).load(list.get(0)).into(ivParking);
tvParking.setTag(list.get(0));
break;
case 2:
Glide.with(getActivity()).load(list.get(0)).into(ivParking);
tvParking.setTag(list.get(0));
Glide.with(getActivity()).load(list.get(1)).into(ivNumber);
tvNumber.setTag(list.get(1));
break;
}
}
@ -715,138 +748,12 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
public void onGranted(List<String> permissions, boolean all) {
if (all) {
//保存数据库
ChargingPileEntity chargingPileEntity = new ChargingPileEntity();
ArrayList<String> photoBean = new ArrayList<>();
if (latLng == null || latLng.equals("")) {
Toast.makeText(getActivity(), "请确定点位", Toast.LENGTH_SHORT).show();
return;
} else {
String encode = Geohash.getInstance().encode(latLng.latitude, latLng.longitude);
chargingPileEntity.setP(encode);
// poiEntity.setX(String.valueOf(latLng.longitude));
// poiEntity.setY(String.valueOf(latLng.latitude));
}
String name = tvNameContent.getText().toString().trim();//名称
if (name == null || name.equals("")) {
Toast.makeText(getActivity(), "请输入 名称", Toast.LENGTH_SHORT).show();
return;
} else {
chargingPileEntity.setName(name);
}
String tagPanorama = (String) ivPanorama.getTag();
if (tagPanorama == null) {
Toast.makeText(getActivity(), "请拍照 全景图", Toast.LENGTH_SHORT).show();
return;
} else {
photoBean.add(tagPanorama);
}
String tagCoding = (String) ivCoding.getTag();
if (tagCoding == null) {
Toast.makeText(getActivity(), "请拍照 充电桩编码", Toast.LENGTH_SHORT).show();
return;
} else {
photoBean.add(tagCoding);
}
String tagEquipment = (String) ivEquipment.getTag();
if (tagEquipment == null) {
Toast.makeText(getActivity(), "请拍照 设备标牌", Toast.LENGTH_SHORT).show();
return;
} else {
photoBean.add(tagEquipment);
}
String tagFacility = (String) ivFacility.getTag();
if (sign_exist != 0) {
if (tagFacility == null) {
Toast.makeText(getActivity(), "请拍照 设备标牌", Toast.LENGTH_SHORT).show();
return;
} else {
photoBean.add(tagFacility);
}
} else {
if (tagFacility != null) {
photoBean.add(tagFacility);
}
}
String tagScutcheon = (String) ivScutcheon.getTag();
if (sign_exist == 1) {
if (tagScutcheon == null) {
Toast.makeText(getActivity(), "请拍照 设备编码", Toast.LENGTH_SHORT).show();
return;
} else {
photoBean.add(tagScutcheon);
}
}
String tagDevice = (String) ivDevice.getTag();
if (sign_exist == 1) {
if (tagDevice == null) {
Toast.makeText(getActivity(), "请拍照 设备标牌", Toast.LENGTH_SHORT).show();
return;
} else {
photoBean.add(tagDevice);
}
}
String tagUsable = (String) ivUsable.getTag();
if (tagUsable == null) {
Toast.makeText(getActivity(), "请拍照 可用状态", Toast.LENGTH_SHORT).show();
return;
} else {
photoBean.add(tagUsable);
}
String tagAvailable = (String) ivAvailable.getTag();
if (tagAvailable != null) {
photoBean.add(tagAvailable);
}
String tagParking = (String) ivParking.getTag();
if (tagParking == null) {
Toast.makeText(getActivity(), "请拍照 停车位编号", Toast.LENGTH_SHORT).show();
return;
} else {
photoBean.add(tagPanorama);
}
String tagNumber = (String) ivNumber.getTag();
if (tagNumber != null) {
photoBean.add(tagNumber);
}
chargingPileEntity.setPhotos(photoBean);
if ("".equals(buffer1) && "".equals(buffer2) && "".equals(buffer3) && "".equals(buffer4) && "".equals(buffer5)) {
Toast.makeText(getActivity(), "开放状态未勾选", Toast.LENGTH_SHORT).show();
ChargingPileEntity chargingPileEntity = initChargingPileEntityByUI(new ChargingPileEntity());
PoiCheckResult poiCheckResult = checkChargingPileEntity(chargingPileEntity);
if (poiCheckResult.getCode() == 1) {
Toast.makeText(getActivity(), poiCheckResult.getMsg()+"", Toast.LENGTH_SHORT).show();
return;
}
if (buffer1 != null && !buffer1.equals("") && buffer1.length() > 0) {
openType.delete(0, openType.length());
openType.append(buffer1);
String charAt = openType.deleteCharAt(openType.length() - 1).toString();
chargingPileEntity.setCp_openType(charAt);
} else {
openType.delete(0, openType.length());
openType.append(buffer2);
openType.append(buffer3);
openType.append(buffer4);
openType.append(buffer5);
String charAt = openType.deleteCharAt(openType.length() - 1).toString();
chargingPileEntity.setCp_openType(charAt);
}
if (cp_floor != 0) {
chargingPileEntity.setCp_floor(cp_floor);
}
chargingPileEntity.setSign_exist(sign_exist);
chargingPileEntity.setCp_availableState(cp_availableState);
String describe = editDescribe.getText().toString().trim();
if (describe != null && !describe.equals("")) {
chargingPileEntity.setMemo(describe);
}
if (pid == null) {
Toast.makeText(getActivity(), "没有对应的充电站Id", Toast.LENGTH_SHORT).show();
} else {
chargingPileEntity.setFid(pid);
}
chargingPileEntity.setTaskStatus(2); // 设置当前充电桩任务状态为本地保存但未上传
new Thread(new Runnable() {
@Override
public void run() {
@ -985,49 +892,6 @@ 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
@ -1048,10 +912,250 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
//获取Editor对象
SharedPreferences.Editor edit = poi.edit();
//根据要保存的数据的类型调用对应的put方法,
ChargingPileEntity chargingPileEntity = new ChargingPileEntity();
ChargingPileEntity chargingPileEntity = initChargingPileEntityByUI(new ChargingPileEntity());
String newChargingPileEntity = new Gson().toJson(chargingPileEntity);
//以键值对的形式添加新值
edit.putString("chargingPileEntity", newChargingPileEntity);
if (station != null) {
edit.putString("poiEntity", station);
}
//提交新值必须执行否则前面的操作都无效
edit.commit();
Log.d("TAG", "initPileSharePre: " + newChargingPileEntity);
}
@Override
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 101 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
takePhotoPath1 = PhotoPathUtil.getTakePhotoPath(data, "a", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
tvPanorama.setTag(takePhotoPath1);
ivPanorama.setImageBitmap(bitmap);//显示图像
/* 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 intent = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intent, 101);
return false;
}
});
} else {
}*/
} else if (requestCode == 102 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
takePhotoPath2 = PhotoPathUtil.getTakePhotoPath(data, "b", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
tvCoding.setTag(takePhotoPath2);
ivCoding.setImageBitmap(bitmap);//显示图像
/* 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 intent = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intent, 102);
return false;
}
});
} else {
}*/
} else if (requestCode == 103 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
takePhotoPath3 = PhotoPathUtil.getTakePhotoPath(data, "c", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
ivEquipment.setImageBitmap(bitmap);//显示图像
tvEquipment.setTag(takePhotoPath3);
/* 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 intent = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intent, 103);
return false;
}
});
} else {
}*/
} else if (requestCode == 104 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
takePhotoPath4 = PhotoPathUtil.getTakePhotoPath(data, "c", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
tvFacility.setTag(takePhotoPath4);
ivFacility.setImageBitmap(bitmap);//显示图像
/* 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 intent = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intent, 104);
return false;
}
});
} else {
}*/
} else if (requestCode == 105 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
takePhotoPath5 = PhotoPathUtil.getTakePhotoPath(data, "c", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
tvScutcheon.setTag(takePhotoPath5);
ivScutcheon.setImageBitmap(bitmap);//显示图像
/* 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 intent = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intent, 105);
return false;
}
});
} else {
}*/
} else if (requestCode == 106 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
takePhotoPath6 = PhotoPathUtil.getTakePhotoPath(data, "c", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
tvDevice.setTag(takePhotoPath6);
ivDevice.setImageBitmap(bitmap);//显示图像
/* 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 intent = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intent, 106);
return false;
}
});
} else {
}*/
} else if (requestCode == 107 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
takePhotoPath7 = PhotoPathUtil.getTakePhotoPath(data, "d", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
tvUsable.setTag(takePhotoPath7);
ivUsable.setImageBitmap(bitmap);//显示图像
/* 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 intent = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intent, 107);
return false;
}
});
} else {
}*/
} else if (requestCode == 108 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
takePhotoPath8 = PhotoPathUtil.getTakePhotoPath(data, "d", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
tvAvailable.setTag(takePhotoPath8);
ivAvailable.setImageBitmap(bitmap);//显示图像
/* 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 intent = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intent, 108);
return false;
}
});
} else {
}*/
} else if (requestCode == 109 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
takePhotoPath9 = PhotoPathUtil.getTakePhotoPath(data, "e", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
ivParking.setImageBitmap(bitmap);//显示图像
tvParking.setTag(takePhotoPath9);
/* 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 intent = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intent, 109);
return false;
}
});
} else {
}*/
} else if (requestCode == 110 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
takePhotoPath10 = PhotoPathUtil.getTakePhotoPath(data, "e", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
ivNumber.setImageBitmap(bitmap);//显示图像
tvNumber.setTag(takePhotoPath10);
/* 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 intent = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intent, 110);
return false;
}
});
} else {
}*/
}
}
@Override
public void onDestroy() {
if (EventBus.getDefault().isRegistered(this))//加上判断
EventBus.getDefault().unregister(this);
super.onDestroy();
}
@Override
protected ChargingPileEntity initChargingPileEntityByUI(ChargingPileEntity chargingPileEntity) {
ArrayList<String> photo = new ArrayList<>();
if (latLng != null) {
chargingPileEntity.setP(latLng.latitude + "," + latLng.longitude);
String encode = Geohash.getInstance().encode(latLng.latitude, latLng.longitude);
chargingPileEntity.setP(encode);
}
String name = tvNameContent.getText().toString().trim();//名称
if (name != null && !name.equals("")) {
@ -1060,43 +1164,43 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
if (cp_floor != 0) {
chargingPileEntity.setCp_floor(cp_floor);
}
String tagPanorama = (String) ivPanorama.getTag();
String tagPanorama = (String) tvPanorama.getTag();
if (tagPanorama != null && !tagPanorama.equals("")) {
photo.add(tagPanorama);
}
String tagCoding = (String) ivCoding.getTag();
String tagCoding = (String) tvCoding.getTag();
if (tagCoding != null && !tagCoding.equals("")) {
photo.add(tagCoding);
}
String tagEquipment = (String) ivEquipment.getTag();
String tagEquipment = (String) tvEquipment.getTag();
if (tagEquipment != null && !tagEquipment.equals("")) {
photo.add(tagEquipment);
}
String tagFacility = (String) ivFacility.getTag();
String tagFacility = (String) tvFacility.getTag();
if (tagFacility != null && !tagFacility.equals("")) {
photo.add(tagFacility);
}
String tagScutcheon = (String) ivScutcheon.getTag();
String tagScutcheon = (String) tvScutcheon.getTag();
if (tagScutcheon != null && !tagScutcheon.equals("")) {
photo.add(tagScutcheon);
}
String tagDevice = (String) ivDevice.getTag();
String tagDevice = (String) tvDevice.getTag();
if (tagDevice != null && !tagDevice.equals("")) {
photo.add(tagDevice);
}
String tagUsable = (String) ivUsable.getTag();
String tagUsable = (String) tvUsable.getTag();
if (tagUsable != null && !tagUsable.equals("")) {
photo.add(tagUsable);
}
String tagAvailable = (String) ivAvailable.getTag();
String tagAvailable = (String) tvAvailable.getTag();
if (tagAvailable != null && !tagAvailable.equals("")) {
photo.add(tagAvailable);
}
String tagParking = (String) ivParking.getTag();
String tagParking = (String) tvParking.getTag();
if (tagParking != null && !tagParking.equals("")) {
photo.add(tagPanorama);
}
String tagNumber = (String) ivNumber.getTag();
String tagNumber = (String) tvNumber.getTag();
if (tagNumber != null && !tagNumber.equals("")) {
photo.add(tagNumber);
}
@ -1125,243 +1229,76 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
chargingPileEntity.setCp_openType("");
}
}
String newChargingPileEntity = new Gson().toJson(chargingPileEntity);
//以键值对的形式添加新值
edit.putString("chargingPileEntity", newChargingPileEntity);
if (station != null) {
edit.putString("poiEntity", station);
return chargingPileEntity;
}
@Override
protected PoiCheckResult checkChargingPileEntity(ChargingPileEntity entity) {
PoiCheckResult poiCheckResult = new PoiCheckResult();
if (entity.getP()==null){
poiCheckResult.setCode(1);
poiCheckResult.setMsg("请确定点位");
return poiCheckResult;
}
//提交新值必须执行否则前面的操作都无效
edit.commit();
Log.d("TAG", "initPileSharePre: " + newChargingPileEntity);
}
@Override
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 101 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
takePhotoPath1 = PhotoPathUtil.getTakePhotoPath(data, "a", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
ivPanorama.setTag(takePhotoPath1);
ivPanorama.setImageBitmap(bitmap);//显示图像
/* 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 intent = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intent, 101);
return false;
}
});
} else {
}*/
} else if (requestCode == 102 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
takePhotoPath2 = PhotoPathUtil.getTakePhotoPath(data, "b", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
ivCoding.setTag(takePhotoPath2);
ivCoding.setImageBitmap(bitmap);//显示图像
/* 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 intent = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intent, 102);
return false;
}
});
} else {
}*/
} else if (requestCode == 103 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
takePhotoPath3 = PhotoPathUtil.getTakePhotoPath(data, "c", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
ivEquipment.setImageBitmap(bitmap);//显示图像
ivEquipment.setTag(takePhotoPath3);
/* 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 intent = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intent, 103);
return false;
}
});
} else {
}*/
} else if (requestCode == 104 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
takePhotoPath4 = PhotoPathUtil.getTakePhotoPath(data, "c", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
ivFacility.setTag(takePhotoPath4);
ivFacility.setImageBitmap(bitmap);//显示图像
/* 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 intent = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intent, 104);
return false;
}
});
} else {
}*/
} else if (requestCode == 105 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
takePhotoPath5 = PhotoPathUtil.getTakePhotoPath(data, "c", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
ivScutcheon.setTag(takePhotoPath5);
ivScutcheon.setImageBitmap(bitmap);//显示图像
/* 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 intent = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intent, 105);
return false;
}
});
} else {
}*/
} else if (requestCode == 106 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
takePhotoPath6 = PhotoPathUtil.getTakePhotoPath(data, "c", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
ivDevice.setTag(takePhotoPath6);
ivDevice.setImageBitmap(bitmap);//显示图像
/* 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 intent = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intent, 106);
return false;
}
});
} else {
}*/
} else if (requestCode == 107 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
takePhotoPath7 = PhotoPathUtil.getTakePhotoPath(data, "d", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
ivUsable.setTag(takePhotoPath7);
ivUsable.setImageBitmap(bitmap);//显示图像
/* 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 intent = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intent, 107);
return false;
}
});
} else {
}*/
} else if (requestCode == 108 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
takePhotoPath8 = PhotoPathUtil.getTakePhotoPath(data, "d", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
ivAvailable.setTag(takePhotoPath8);
ivAvailable.setImageBitmap(bitmap);//显示图像
/* 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 intent = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intent, 108);
return false;
}
});
} else {
}*/
} else if (requestCode == 109 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
takePhotoPath9 = PhotoPathUtil.getTakePhotoPath(data, "e", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
ivParking.setImageBitmap(bitmap);//显示图像
ivParking.setTag(takePhotoPath9);
/* 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 intent = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intent, 109);
return false;
}
});
} else {
}*/
} else if (requestCode == 110 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
takePhotoPath10 = PhotoPathUtil.getTakePhotoPath(data, "e", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
ivNumber.setImageBitmap(bitmap);//显示图像
ivNumber.setTag(takePhotoPath10);
/* 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 intent = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intent, 110);
return false;
}
});
} else {
}*/
if (entity.getName()==null){
poiCheckResult.setCode(1);
poiCheckResult.setMsg("请输入 名称");
return poiCheckResult;
}
}
@Override
public void onDestroy() {
if (EventBus.getDefault().isRegistered(this))//加上判断
EventBus.getDefault().unregister(this);
super.onDestroy();
if (entity.getCp_openType()==null){
poiCheckResult.setCode(1);
poiCheckResult.setMsg("开放状态未勾选");
return poiCheckResult;
}
if (tvPanorama.getTag()==null){
poiCheckResult.setCode(1);
poiCheckResult.setMsg("请拍照 全景图");
return poiCheckResult;
}
if (tvCoding.getTag()==null){
poiCheckResult.setCode(1);
poiCheckResult.setMsg("请拍照 充电桩编码");
return poiCheckResult;
}
if (tvEquipment.getTag()==null){
poiCheckResult.setCode(1);
poiCheckResult.setMsg("请拍照 设备标牌");
return poiCheckResult;
}
if (sign_exist!=0){
if ( tvFacility.getTag()==null){
poiCheckResult.setCode(1);
poiCheckResult.setMsg("请拍照 设备标牌");
return poiCheckResult;
}
}
if (sign_exist==1){
if (tvScutcheon.getTag() == null) {
poiCheckResult.setCode(1);
poiCheckResult.setMsg("请拍照 设备标牌");
return poiCheckResult;
}
if (tvDevice.getTag() == null) {
poiCheckResult.setCode(1);
poiCheckResult.setMsg("请拍照 设备标牌");
return poiCheckResult;
}
}
if ( tvUsable.getTag() == null) {
poiCheckResult.setCode(1);
poiCheckResult.setMsg("请拍照 可用状态");
return poiCheckResult;
}
if ( tvParking.getTag() == null) {
poiCheckResult.setCode(1);
poiCheckResult.setMsg("请拍照 停车位编号");
return poiCheckResult;
}
return poiCheckResult;
}
@Override
protected PoiEntity initPoiEntityByUI() {
protected PoiEntity initPoiEntityByUI(PoiEntity entity) {
return null;
}
@ -1369,6 +1306,4 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
protected PoiCheckResult checkPoiEntity(PoiEntity entity) {
return null;
}
}

View File

@ -466,7 +466,16 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
editDescribe.setText(describe);
}
int station_type = showPoiEntity.getStation_type();
spinnerType.setSelection(station_type, true);
if (station_type==1){
spinnerType.setSelection(0, true);
}else if (station_type==2){
spinnerType.setSelection(1, true);
}else if (station_type==3){
spinnerType.setSelection(2, true);
}else if (station_type==4){
spinnerType.setSelection(3, true);
}
String telPhone = showPoiEntity.getTelPhone();
if (telPhone != null && !telPhone.equals("")) {
String[] phones = telPhone.split("\\|");
@ -884,85 +893,12 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
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();
PoiEntity poiEntity = initPoiEntityByUI(showPoiEntity);
PoiCheckResult poiCheckResult = checkPoiEntity(poiEntity);
if (poiCheckResult.getCode() == 1) {
Toast.makeText(getActivity(), poiCheckResult.getMsg()+"", 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.setMemo(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));
}
if (existence == 0) {
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() {
@ -1138,60 +1074,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
}
private String initShowStation() {
PoiEntity poiEntity = showPoiEntity;
List<Info> infoPhoto = new ArrayList<>();
String name = editNameContent.getText().toString().trim();//名称
if (name != null && !name.equals("")) {
poiEntity.setName(name);
}
String site = editSiteContent.getText().toString().trim();
if (site != null && !site.equals("")) {
poiEntity.setAddress(site);
}
if (latLng != null) {
poiEntity.setX(String.valueOf(latLng.longitude));
poiEntity.setY(String.valueOf(latLng.latitude));
}
String describe = editDescribe.getText().toString().trim();
if (describe != null && !describe.equals("")) {
poiEntity.setMemo(describe);
}
boolean phoneBean = contactView.getPhoneBean();
if (phoneBean) {
String list = contactView.getList();
poiEntity.setTelPhone(list);
}
String tagPanorama = (String) ivPanorama.getTag();
if (tagPanorama != null && !tagPanorama.equals("")) {
infoPhoto.add(new Info(tagPanorama));
}
String tagName = (String) ivName.getTag();
if (tagName != null && !tagName.equals("")) {
infoPhoto.add(new Info(tagName));
}
String tagInternal = (String) ivInternal.getTag();
if (tagInternal != null && !tagInternal.equals("")) {
infoPhoto.add(new Info(tagInternal));
}
String tagElse = (String) ivElse.getTag();
if (tagElse != null && !tagElse.equals("")) {
infoPhoto.add(new Info(tagElse));
}
String tagScutcheon = (String) ivScutcheon.getTag();
if (tagScutcheon != null && !tagScutcheon.equals("")) {
infoPhoto.add(new Info(tagScutcheon));
}
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.setExistence(existence);
poiEntity.setType(2);
poiEntity.setTaskStatus(2);
poiEntity.setIsLocalData(1);
PoiEntity poiEntity = initPoiEntityByUI(showPoiEntity);
String newPoiEntity = new Gson().toJson(poiEntity);
return newPoiEntity;
}
@ -1215,61 +1098,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
//获取Editor对象
SharedPreferences.Editor edit = poi.edit();
//根据要保存的数据的类型调用对应的put方法,
PoiEntity poiEntity = showPoiEntity;
List<Info> infoPhoto = new ArrayList<>();
String name = editNameContent.getText().toString().trim();//名称
if (name != null && !name.equals("")) {
poiEntity.setName(name);
}
String site = editSiteContent.getText().toString().trim();
if (site != null && !site.equals("")) {
poiEntity.setAddress(site);
}
if (latLng != null) {
poiEntity.setX(String.valueOf(latLng.longitude));
poiEntity.setY(String.valueOf(latLng.latitude));
}
String describe = editDescribe.getText().toString().trim();
if (describe != null && !describe.equals("")) {
poiEntity.setMemo(describe);
}
boolean phoneBean = contactView.getPhoneBean();
if (phoneBean) {
String list = contactView.getList();
poiEntity.setTelPhone(list);
}
String tagPanorama = (String) ivPanorama.getTag();
if (tagPanorama != null && !tagPanorama.equals("")) {
infoPhoto.add(new Info(tagPanorama));
}
String tagName = (String) ivName.getTag();
if (tagName != null && !tagName.equals("")) {
infoPhoto.add(new Info(tagName));
}
String tagInternal = (String) ivInternal.getTag();
if (tagInternal != null && !tagInternal.equals("")) {
infoPhoto.add(new Info(tagInternal));
}
String tagElse = (String) ivElse.getTag();
if (tagElse != null && !tagElse.equals("")) {
infoPhoto.add(new Info(tagElse));
}
String tagScutcheon = (String) ivScutcheon.getTag();
if (tagScutcheon != null && !tagScutcheon.equals("")) {
infoPhoto.add(new Info(tagScutcheon));
}
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.setExistence(existence);
poiEntity.setType(2);
poiEntity.setTaskStatus(2);
poiEntity.setIsLocalData(1);
PoiEntity poiEntity = initPoiEntityByUI(showPoiEntity);
String newPoiEntity = new Gson().toJson(poiEntity);
//以键值对的形式添加新值
edit.putString("poiEntity", newPoiEntity);
@ -1470,12 +1299,120 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
}
@Override
protected PoiEntity initPoiEntityByUI() {
return null;
protected PoiEntity initPoiEntityByUI(PoiEntity poiEntity) {
List<Info> infoPhoto = new ArrayList<>();
String name = editNameContent.getText().toString().trim();//名称
if (name != null && !name.equals("")) {
poiEntity.setName(name);
}
String site = editSiteContent.getText().toString().trim();
if (site != null && !site.equals("")) {
poiEntity.setAddress(site);
}
if (latLng != null) {
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.setMemo(describe);
}
boolean phoneBean = contactView.getPhoneBean();
if (phoneBean) {
String list = contactView.getList();
poiEntity.setTelPhone(list);
}
String tagPanorama = (String) ivPanorama.getTag();
if (tagPanorama != null && !tagPanorama.equals("")) {
infoPhoto.add(new Info(tagPanorama));
}
String tagName = (String) ivName.getTag();
if (tagName != null && !tagName.equals("")) {
infoPhoto.add(new Info(tagName));
}
String tagInternal = (String) ivInternal.getTag();
if (tagInternal != null && !tagInternal.equals("")) {
infoPhoto.add(new Info(tagInternal));
}
String tagElse = (String) ivElse.getTag();
if (tagElse != null && !tagElse.equals("")) {
infoPhoto.add(new Info(tagElse));
}
String tagScutcheon = (String) ivScutcheon.getTag();
if (tagScutcheon != null && !tagScutcheon.equals("")) {
infoPhoto.add(new Info(tagScutcheon));
}
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.setExistence(existence);
poiEntity.setType(2);
poiEntity.setTaskStatus(2);
poiEntity.setIsLocalData(1);
return poiEntity;
}
@Override
protected PoiCheckResult checkPoiEntity(PoiEntity entity) {
PoiCheckResult poiCheckResult = new PoiCheckResult();
if (entity.getName()==null){
poiCheckResult.setCode(1);
poiCheckResult.setMsg("请输入 名称");
return poiCheckResult;
}
if (ivPanorama.getTag()==null){
poiCheckResult.setCode(1);
poiCheckResult.setMsg("请拍照 全景图");
return poiCheckResult;
}
if (ivName.getTag()==null){
poiCheckResult.setCode(1);
poiCheckResult.setMsg("请拍照 名称照片");
return poiCheckResult;
}
if (entity.getExistence()==0){
if (ivInternal.getTag()==null){
poiCheckResult.setCode(1);
poiCheckResult.setMsg("请拍照 服务说明");
return poiCheckResult;
}
if (ivElse.getTag()==null){
poiCheckResult.setCode(1);
poiCheckResult.setMsg("请拍照 充电站指引牌");
return poiCheckResult;
}
if (ivScutcheon.getTag()==null){
poiCheckResult.setCode(1);
poiCheckResult.setMsg("请拍照 收费标牌");
return poiCheckResult;
}
}
if (entity.getX()==null&&entity.getY()==null){
poiCheckResult.setCode(1);
poiCheckResult.setMsg("请确定 点位");
return poiCheckResult;
}
if (entity.getTelPhone()==null){
poiCheckResult.setCode(1);
poiCheckResult.setMsg("请输入 手机号");
return poiCheckResult;
}
return poiCheckResult;
}
@Override
protected ChargingPileEntity initChargingPileEntityByUI(ChargingPileEntity entity) {
return null;
}
@Override
protected PoiCheckResult checkChargingPileEntity(ChargingPileEntity entity) {
return null;
}
}

View File

@ -23,6 +23,7 @@ import com.navinfo.outdoor.adapter.FilterAdapter;
import com.navinfo.outdoor.api.Constant;
import com.navinfo.outdoor.base.BaseDrawerFragment;
import com.navinfo.outdoor.bean.JobSearchBean;
import com.navinfo.outdoor.room.ChargingPileEntity;
import com.navinfo.outdoor.room.PoiDao;
import com.navinfo.outdoor.room.PoiDatabase;
import com.navinfo.outdoor.room.PoiEntity;
@ -469,13 +470,22 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
}
@Override
protected PoiEntity initPoiEntityByUI() {
protected PoiEntity initPoiEntityByUI(PoiEntity entity) {
return null;
}
@Override
protected PoiCheckResult checkPoiEntity(PoiEntity entity) {
return null;
}
@Override
protected ChargingPileEntity initChargingPileEntityByUI(ChargingPileEntity entity) {
return null;
}
@Override
protected PoiCheckResult checkChargingPileEntity(ChargingPileEntity entity) {
return null;
}
}

View File

@ -27,6 +27,7 @@ import com.navinfo.outdoor.room.InsertAndUpdateUtils;
import com.navinfo.outdoor.room.PoiDao;
import com.navinfo.outdoor.room.PoiDatabase;
import com.navinfo.outdoor.room.PoiEntity;
import com.navinfo.outdoor.util.Geohash;
import com.navinfo.outdoor.util.GeometryTools;
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptor;
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptorFactory;
@ -314,7 +315,9 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
chargingStationEntity.setType(Integer.valueOf(stationBean.getType()));
chargingStationEntity.setTaskStatus(statusId);
chargingStationEntity.setIsLocalData(1);
String geo = stationBean.getGeo();
String encodeStr = stationBean.getGeo();
String geo = Geohash.getInstance().decode(encodeStr);
chargingStationEntity.setGeoWkt(geo);
Geometry geometry = GeometryTools.createGeometry(geo);
if (geometry.getGeometryType().equals("Point")) {//
@ -417,7 +420,8 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
polygonEntity.setTaskId(listBean.getId());
polygonEntity.setName(listBean.getName());
polygonEntity.setType(Integer.valueOf(listBean.getType()));
String geo = listBean.getGeo();
String encodeStr = listBean.getGeo();
String geo = Geohash.getInstance().decode(encodeStr);
polygonEntity.setGeoWkt(geo);
Geometry geometry = GeometryTools.createGeometry(geo);
if (geometry.getGeometryType().equals("Point")) {//
@ -630,7 +634,8 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
poiListEntity.setIsExclusive(listBean.getIsExclusive());
poiListEntity.setTaskStatus(statusId);
poiListEntity.setIsLocalData(1);
String geo = listBean.getGeo();
String encodeStr = listBean.getGeo();
String geo = Geohash.getInstance().decode(encodeStr);
poiListEntity.setGeoWkt(geo);
Geometry geometry = GeometryTools.createGeometry(geo);
if (geometry.getGeometryType().equals("Point")) {//
@ -742,7 +747,8 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
poiListEntity.setIsExclusive(listBean.getIsExclusive());
poiListEntity.setTaskStatus(statusId);
poiListEntity.setIsLocalData(1);
String geo = listBean.getGeo();
String encodeStr = listBean.getGeo();
String geo = Geohash.getInstance().decode(encodeStr);
poiListEntity.setGeoWkt(geo);
Geometry geometry = GeometryTools.createGeometry(geo);
if (geometry.getGeometryType().equals("Point")) {//

View File

@ -18,6 +18,7 @@ import android.widget.EditText;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.Nullable;
@ -46,6 +47,7 @@ import com.navinfo.outdoor.http.Callback;
import com.navinfo.outdoor.http.DialogCallback;
import com.navinfo.outdoor.http.HttpInterface;
import com.navinfo.outdoor.http.OkGoBuilder;
import com.navinfo.outdoor.room.ChargingPileEntity;
import com.navinfo.outdoor.room.InsertAndUpdateUtils;
import com.navinfo.outdoor.room.PoiDao;
import com.navinfo.outdoor.room.PoiDatabase;
@ -77,8 +79,10 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
private EditText editTaskName, editOtherDescribe;
private RelativeLayout rlPicture;
private ImageView ivPicture;
private TextView tvPicture;
private RelativeLayout rlPictures;
private ImageView ivPictures;
private TextView tvPictures;
private Button btnOtherLocal;
private Button btnOtherUploading;
private PoiDatabase poiDatabase;
@ -196,6 +200,8 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
rlPicture = findViewById(R.id.rl_picture);
rlPicture.setOnClickListener(this::onClick);
ivPicture = findViewById(R.id.iv_picture);
tvPicture = findViewById(R.id.tv_picture);
tvPictures = findViewById(R.id.tv_pictures);
rlPictures = findViewById(R.id.rl_pictures);
rlPictures.setOnClickListener(this::onClick);
ivPictures = findViewById(R.id.iv_pictures);
@ -294,17 +300,16 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
}else if (station_type==7){
spinnerOther.setSelection(2, true);
}
if (showPoiEntity.getPhotoInfo() != null) {
for (int i = 0; i < showPoiEntity.getPhotoInfo().size(); i++) {
String photo = showPoiEntity.getPhotoInfo().get(i).getPhoto();
String[] split = photo.split("/");
if (split[split.length - 1].startsWith("a")) {
Glide.with(getActivity()).load(photo).into(ivPicture);
ivPicture.setTag(photo);
tvPicture.setTag(photo);
} else if (split[split.length - 1].startsWith("b")) {
Glide.with(getActivity()).load(photo).into(ivPictures);
ivPictures.setTag(photo);
tvPictures.setTag(photo);
}
}
}
@ -349,7 +354,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
} else {
otherUploadList.add(new File(tagPicture));
}
String tagPictures = (String) ivPictures.getTag();
String tagPictures = (String) tvPictures.getTag();
if (tagPictures == null) {
Toast.makeText(getActivity(), "请拍照", Toast.LENGTH_SHORT).show();
return;
@ -385,53 +390,12 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
public void onGranted(List<String> permissions, boolean all) {
if (all) {
//保存数据库
PoiEntity poiEntity = showPoiEntity;
List<Info> infoList = new ArrayList<>();
String name = editTaskName.getText().toString().trim();//名称
if (name == null || name.equals("")) {
Toast.makeText(getActivity(), "请输入poi 名称", Toast.LENGTH_SHORT).show();
PoiEntity poiEntity = initPoiEntityByUI(showPoiEntity);
PoiCheckResult poiCheckResult = checkPoiEntity(poiEntity);
if (poiCheckResult.getCode() == 1) {
Toast.makeText(getActivity(), poiCheckResult.getMsg()+"", Toast.LENGTH_SHORT).show();
return;
} else {
poiEntity.setName(name);
}
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 = editOtherDescribe.getText().toString().trim();
if (describe != null&&!describe.equals("")) {
poiEntity.setMemo(describe);
}
String tagPicture = (String) ivPicture.getTag();
if (tagPicture == null) {
Toast.makeText(getActivity(), "请 拍照", Toast.LENGTH_SHORT).show();
return;
} else {
infoList.add(new Info(tagPicture));
}
String tagPictures = (String) ivPictures.getTag();
if (tagPictures == null) {
Toast.makeText(getActivity(), "请 拍照", Toast.LENGTH_SHORT).show();
return;
} else {
infoList.add(new Info(tagPictures));
}
poiEntity.setStation_type(station_type);
poiEntity.setPhotoInfo(infoList);
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(5);
poiEntity.setTaskStatus(2);
poiEntity.setIsLocalData(1);
new Thread(new Runnable() {
@Override
public void run() {
@ -582,39 +546,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
//获取Editor对象
SharedPreferences.Editor edit = poi.edit();
//根据要保存的数据的类型调用对应的put方法,
PoiEntity poiEntity = showPoiEntity;
ArrayList<Info> arrayList = new ArrayList<>();
String name = editTaskName.getText().toString().trim();//名称
if (name != null && !name.equals("")) {
poiEntity.setName(name);
}
if (latLng != null) {
poiEntity.setX(String.valueOf(latLng.longitude));
poiEntity.setY(String.valueOf(latLng.latitude));
}
String describe = editOtherDescribe.getText().toString().trim();
if (describe != null && !describe.equals("")) {
poiEntity.setMemo(describe);
}
String tagPicture = (String) ivPicture.getTag();
if (tagPicture != null && !tagPicture.equals("")) {
arrayList.add(new Info(tagPicture));
}
String tagPictures = (String) ivPictures.getTag();
if (tagPictures != null && !tagPictures.equals("")) {
arrayList.add(new Info(tagPictures));
}
poiEntity.setPhotoInfo(arrayList);
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(5);
poiEntity.setTaskStatus(2);
poiEntity.setIsLocalData(1);
PoiEntity poiEntity = initPoiEntityByUI(showPoiEntity);
String newPoiEntity = new Gson().toJson(poiEntity);
//以键值对的形式添加新值
edit.putString("poiEntity", newPoiEntity);
@ -631,46 +563,15 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
//照片路径
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "a", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
ivPicture.setTag(takePhotoPath);
tvPicture.setTag(takePhotoPath);
ivPicture.setImageBitmap(bitmap);//显示图像
/* 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 intent = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intent, 101);
return false;
}
});
} else {
}*/
} else if (requestCode == 102 && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();//从Intent中获取附加值
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
//照片路径
String takePhotoPath2 = PhotoPathUtil.getTakePhotoPath(data, "b", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
ivPictures.setTag(takePhotoPath2);
tvPictures.setTag(takePhotoPath2);
ivPictures.setImageBitmap(bitmap);//显示图像
/*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 intent = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intent, 102);
return false;
}
});
} else {
}*/
}
}
@ -693,12 +594,76 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
}
@Override
protected PoiEntity initPoiEntityByUI() {
return null;
protected PoiEntity initPoiEntityByUI(PoiEntity poiEntity) {
ArrayList<Info> arrayList = new ArrayList<>();
String name = editTaskName.getText().toString().trim();//名称
if (name != null && !name.equals("")) {
poiEntity.setName(name);
}
if (latLng != null) {
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 = editOtherDescribe.getText().toString().trim();
if (describe != null && !describe.equals("")) {
poiEntity.setMemo(describe);
}
String tagPicture = (String) tvPicture.getTag();
if (tagPicture != null && !tagPicture.equals("")) {
arrayList.add(new Info(tagPicture));
}
String tagPictures = (String) tvPictures.getTag();
if (tagPictures != null && !tagPictures.equals("")) {
arrayList.add(new Info(tagPictures));
}
poiEntity.setPhotoInfo(arrayList);
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(5);
poiEntity.setTaskStatus(2);
poiEntity.setIsLocalData(1);
return poiEntity;
}
@Override
protected PoiCheckResult checkPoiEntity(PoiEntity entity) {
PoiCheckResult poiCheckResult = new PoiCheckResult();
if (entity.getName()==null){
poiCheckResult.setCode(1);
poiCheckResult.setMsg("请输入 名称");
return poiCheckResult;
}
if (tvPicture.getTag()==null){
poiCheckResult.setCode(1);
poiCheckResult.setMsg("请 拍照");
return poiCheckResult;
}
if ( tvPictures.getTag()==null){
poiCheckResult.setCode(1);
poiCheckResult.setMsg("请 拍照");
return poiCheckResult;
}
if (entity.getX()==null&&entity.getY()==null){
poiCheckResult.setCode(1);
poiCheckResult.setMsg("请确定点位");
return poiCheckResult;
}
return poiCheckResult;
}
@Override
protected ChargingPileEntity initChargingPileEntityByUI(ChargingPileEntity entity) {
return null;
}
@Override
protected PoiCheckResult checkChargingPileEntity(ChargingPileEntity entity) {
return null;
}

View File

@ -51,6 +51,7 @@ import com.navinfo.outdoor.http.Callback;
import com.navinfo.outdoor.http.DialogCallback;
import com.navinfo.outdoor.http.HttpInterface;
import com.navinfo.outdoor.http.OkGoBuilder;
import com.navinfo.outdoor.room.ChargingPileEntity;
import com.navinfo.outdoor.room.InsertAndUpdateUtils;
import com.navinfo.outdoor.room.PoiDao;
import com.navinfo.outdoor.room.PoiDatabase;
@ -635,75 +636,12 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
public void onGranted(List<String> permissions, boolean all) {
if (all) {
//保存数据库
PoiEntity poiEntity = showPoiEntity;
ArrayList<Info> infoPhoto = new ArrayList<>();
String name = editNameContent.getText().toString().trim();//名称
if (name == null || name.equals("")) {
Toast.makeText(getActivity(), "请输入poi 名称", Toast.LENGTH_SHORT).show();
PoiEntity poiEntity = initPoiEntityByUI(showPoiEntity);
PoiCheckResult poiCheckResult = checkPoiEntity(poiEntity);
if (poiCheckResult.getCode() == 1) {
Toast.makeText(getActivity(), poiCheckResult.getMsg()+"", 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.setMemo(describe);
}
boolean phoneBean = contactView.getPhoneBean();
if (phoneBean) {
String list = contactView.getList();
poiEntity.setTelPhone(list);
}
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) {
infoPhoto.add(new Info(tagInternal));
}
String tagElse = (String) ivElse.getTag();
if (tagElse != null) {
infoPhoto.add(new Info(tagElse));
}
String tagCard = (String) ivCard.getTag();
if (tagCard != null) {
infoPhoto.add(new Info(tagCard));
}
poiEntity.setPhotoInfo(infoPhoto);
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.setExistence(existence);
poiEntity.setType(1);
poiEntity.setTaskStatus(2);
poiEntity.setIsLocalData(1);
new Thread(new Runnable() {
@Override
public void run() {
@ -854,64 +792,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
//获取Editor对象
SharedPreferences.Editor edit = poi.edit();
//根据要保存的数据的类型调用对应的put方法,
PoiEntity poiEntity = showPoiEntity;
ArrayList<Info> infoPhoto = new ArrayList<>();
String name = editNameContent.getText().toString().trim();//名称
if (name != null && !name.equals("")) {
poiEntity.setName(name);
}
String site = editSiteContent.getText().toString().trim();
if (site != null && !site.equals("")) {
poiEntity.setAddress(site);
}
if (latLng != null) {
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.setMemo(describe);
}
boolean phoneBean = contactView.getPhoneBean();
if (phoneBean) {
String list = contactView.getList();
poiEntity.setTelPhone(list);
} else {
Toast.makeText(getActivity(), "请输入手机号", Toast.LENGTH_SHORT).show();
return;
}
String tagPanorama = (String) ivPanorama.getTag();
if (tagPanorama != null && !tagPanorama.equals("")) {
infoPhoto.add(new Info(tagPanorama));
}
String tagName = (String) ivName.getTag();
if (tagName != null && !tagName.equals("")) {
infoPhoto.add(new Info(tagName));
}
String tagInternal = (String) ivInternal.getTag();
if (tagInternal != null && !tagInternal.equals("")) {
infoPhoto.add(new Info(tagInternal));
}
String tagElse = (String) ivElse.getTag();
if (tagElse != null && !tagElse.equals("")) {
infoPhoto.add(new Info(tagElse));
}
String tagCard = (String) ivCard.getTag();
if (tagCard != null && !tagCard.equals("")) {
infoPhoto.add(new Info(tagCard));
}
poiEntity.setPhotoInfo(infoPhoto);
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.setExistence(existence);
poiEntity.setType(1);
poiEntity.setTaskStatus(2);
poiEntity.setIsLocalData(1);
PoiEntity poiEntity = initPoiEntityByUI(showPoiEntity);
String newPoiEntity = new Gson().toJson(poiEntity);
//以键值对的形式添加新值
edit.putString("poiEntity", newPoiEntity);
@ -1058,12 +939,102 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
}
@Override
protected PoiEntity initPoiEntityByUI() {
return null;
protected PoiEntity initPoiEntityByUI(PoiEntity poiEntity) {
ArrayList<Info> infoPhoto = new ArrayList<>();
String name = editNameContent.getText().toString().trim();//名称
if (name != null && !name.equals("")) {
poiEntity.setName(name);
}
String site = editSiteContent.getText().toString().trim();
if (site != null && !site.equals("")) {
poiEntity.setAddress(site);
}
if (latLng != null) {
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.setMemo(describe);
}
boolean phoneBean = contactView.getPhoneBean();
if (phoneBean) {
String list = contactView.getList();
poiEntity.setTelPhone(list);
}
String tagPanorama = (String) ivPanorama.getTag();
if (tagPanorama != null && !tagPanorama.equals("")) {
infoPhoto.add(new Info(tagPanorama));
}
String tagName = (String) ivName.getTag();
if (tagName != null && !tagName.equals("")) {
infoPhoto.add(new Info(tagName));
}
String tagInternal = (String) ivInternal.getTag();
if (tagInternal != null && !tagInternal.equals("")) {
infoPhoto.add(new Info(tagInternal));
}
String tagElse = (String) ivElse.getTag();
if (tagElse != null && !tagElse.equals("")) {
infoPhoto.add(new Info(tagElse));
}
String tagCard = (String) ivCard.getTag();
if (tagCard != null && !tagCard.equals("")) {
infoPhoto.add(new Info(tagCard));
}
poiEntity.setPhotoInfo(infoPhoto);
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.setExistence(existence);
poiEntity.setType(1);
poiEntity.setTaskStatus(2);
poiEntity.setIsLocalData(1);
return poiEntity;
}
@Override
protected PoiCheckResult checkPoiEntity(PoiEntity entity) {
PoiCheckResult poiCheckResult = new PoiCheckResult();
if (entity.getName()==null){
poiCheckResult.setCode(1);
poiCheckResult.setMsg("请输入 名称");
return poiCheckResult;
}
if (ivPanorama.getTag()==null){
poiCheckResult.setCode(1);
poiCheckResult.setMsg("请 拍照");
return poiCheckResult;
}
if (ivName.getTag()==null){
poiCheckResult.setCode(1);
poiCheckResult.setMsg("请 拍照");
return poiCheckResult;
}
if (entity.getX()==null&&entity.getY()==null){
poiCheckResult.setCode(1);
poiCheckResult.setMsg("请确定 点位");
return poiCheckResult;
}
if (entity.getTelPhone()==null){
poiCheckResult.setCode(1);
poiCheckResult.setMsg("请输入 手机号");
return poiCheckResult;
}
return poiCheckResult;
}
@Override
protected ChargingPileEntity initChargingPileEntityByUI(ChargingPileEntity entity) {
return null;
}
@Override
protected PoiCheckResult checkChargingPileEntity(ChargingPileEntity entity) {
return null;
}

View File

@ -54,6 +54,7 @@ import com.navinfo.outdoor.http.Callback;
import com.navinfo.outdoor.http.DialogCallback;
import com.navinfo.outdoor.http.HttpInterface;
import com.navinfo.outdoor.http.OkGoBuilder;
import com.navinfo.outdoor.room.ChargingPileEntity;
import com.navinfo.outdoor.room.InsertAndUpdateUtils;
import com.navinfo.outdoor.room.PoiDao;
import com.navinfo.outdoor.room.PoiDatabase;
@ -63,6 +64,7 @@ import com.navinfo.outdoor.util.GeometryTools;
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import java.io.File;
import java.text.DateFormat;
@ -104,7 +106,14 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
protected int getLayout() {
return R.layout.poi_video_fragment;
}
@Override
public void onStart() {
super.onStart();
if (!EventBus.getDefault().isRegistered(this)) {//加上判断
EventBus.getDefault().register(this);
}
}
@Override
public void onResume() {
super.onResume();
@ -168,6 +177,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
File finalFile = AWMp4ParserHelper.getInstance().obtainMp4FilePath(new File(Constant.PICTURE_FOLDER, showPoiEntity.getId()).getAbsolutePath());
Intent intent = new Intent(getContext(), PictureActivity.class);
intent.putExtra("uuId", showPoiEntity.getId());
intent.putExtra(Constant.INTENT_VIDEO_PATH, finalFile.getAbsolutePath());
startActivityForResult(intent, 0x101);
}
@ -234,11 +244,14 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
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;
if (videoFile.getPath().contains("0.mp4")&&!videoFile.getPath().contains("0.mp4.txt")){
if (videoFile.exists() && !isImageLoad) {
// 使用glide加载视频的第一帧
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivPoiVideoPicture, 500);
isImageLoad = true;
}
}
}
}
fmPoiVideoPic.setTag(videoFileList);
@ -263,29 +276,17 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
rbBicycle.setEnabled(false);
}
/**
* 获取本地视频的第一帧
*
* @param localPath
* @return
*/
public Bitmap getLocalVideoBitmap(String localPath) {
Bitmap bitmap = null;
MediaMetadataRetriever retriever = new MediaMetadataRetriever();
try {
//根据文件路径获取缩略图
retriever.setDataSource(localPath);
//获得第一帧图片
bitmap = retriever.getFrameAtTime();
} catch (IllegalArgumentException e) {
e.printStackTrace();
} finally {
retriever.release();
@Subscribe
public void onEvent(Message data) {
if (data.what == Constant.PICTURE_VIDEO_WORD) {
if ((boolean)data.obj){
initPoiVideoSharePre();
}
}
return bitmap;
}
@Override
public void onClick(View v) {
switch (v.getId()) {
@ -296,29 +297,23 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
// 根据用户点击的时间为视频名称赋值
// DateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
// String videoFormatName = formatter.format(new Date());
Intent intent = new Intent(getContext(), PictureActivity.class);
File finalFile = AWMp4ParserHelper.getInstance().obtainMp4FilePath(new File(Constant.PICTURE_FOLDER, showPoiEntity.getId()).getAbsolutePath());
intent.putExtra(Constant.INTENT_VIDEO_PATH, finalFile.getAbsolutePath());
intent.putExtra("uuId", showPoiEntity.getId());
startActivityForResult(intent, 0x101);
break;
case R.id.btn_poi_video_upload:
showFileLoadingDialog();
setLoadingDialogText("压缩中...");
ArrayList<File> fileList = new ArrayList<>();
if (fmPoiVideoPic.getTag() != null) {
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(fileList, fileZip, null);
ZipUtil.zipFiles(videoFileList, fileZip, null);
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
if (poiDaoPoiEntity == null || poiDaoPoiEntity.getTaskStatus() == 1 || poiDaoPoiEntity.getTaskStatus() == 2 || poiDaoPoiEntity.getTaskStatus() == 0) {
getActivity().runOnUiThread(new Runnable() {
@ -356,71 +351,15 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
@Override
public void onGranted(List<String> permissions, boolean all) {
if (all) {
PoiEntity poiEntity = showPoiEntity;
String roadName = etRoadName.getText().toString().trim();
if (roadName != null && !roadName.equals("")) {
poiEntity.setName(roadName + "");
} else {
DateFormat formatters = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss");
Calendar calendars = Calendar.getInstance();
calendars.setTimeInMillis(System.currentTimeMillis());
String formats = formatters.format(calendars.getTime());
String city = Constant.currentLocation.getCity();//返回当前位置的城市.
String district = Constant.currentLocation.getDistrict();//返回当前位置的区县.
StringBuilder sb = new StringBuilder("poi录像上报");
if (city != null && !"".equals(city)) {
sb.append("-");
sb.append(city);
}
if (district != null && !"".equals(district)) {
sb.append(district);
}
sb.append("-").append(formats);
poiEntity.setName(sb.toString());
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
etRoadName.setText(sb);
etRoadName.setEnabled(false);
}
});
}
String desc = etDesc.getText().toString().trim();
if (desc != null && !desc.equals("")) {
poiEntity.setMemo(desc);
}
if (showPoiEntity != null) {
if (showPoiEntity.getTaskId() != 0) {
poiEntity.setTaskId(showPoiEntity.getTaskId());
}
}
if (fmPoiVideoPic.getTag() == null || ((List<File>) fmPoiVideoPic.getTag()).isEmpty()) {
Toast.makeText(getActivity(), "请录像", Toast.LENGTH_SHORT).show();
PoiEntity poiEntity = initPoiEntityByUI(showPoiEntity);
PoiCheckResult poiCheckResult = checkPoiEntity(poiEntity);
if (poiCheckResult.getCode() == 1) {
Toast.makeText(getActivity(), poiCheckResult.getMsg()+"", Toast.LENGTH_SHORT).show();
return;
} else {
String lineString = GeometryTools.getLineString(getLineString());
String filePathString = getPhotoStrFromTag();
Log.d("TAG", "onGranted: " + lineString);
poiEntity.setPhoto(filePathString);
if (lineString != null) {
poiEntity.setGeoWkt(lineString);
}
}
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(3);
poiEntity.setTaskStatus(2);
poiEntity.setIsLocalData(1);
new Thread(new Runnable() {
@Override
public void run() {
//
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
getActivity().runOnUiThread(new Runnable() {
@Override
@ -447,44 +386,7 @@ 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) {
@ -606,11 +508,8 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
File videoFile = new File(videoPath);
if (videoFile.exists()) {
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivPoiVideoPicture, 500);
if (fmPoiVideoPic.getTag() == null) {
fmPoiVideoPic.setTag(new ArrayList<>());
}
List<File> fileList = (List<File>) fmPoiVideoPic.getTag();
fileList.add(videoFile);
List<File> videoFileListByUUID = AWMp4ParserHelper.getInstance().getVideoFileListByUUID(showPoiEntity.getId());
fmPoiVideoPic.setTag(videoFileListByUUID);
}
}
}
@ -634,34 +533,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
//获取Editor对象
SharedPreferences.Editor edit = poi.edit();
//根据要保存的数据的类型调用对应的put方法,
PoiEntity poiEntity = new PoiEntity();
poiEntity.setId(showPoiEntity.getId());
String roadName = etRoadName.getText().toString().trim();
if (roadName != null && !roadName.equals("")) {
poiEntity.setName(roadName);
}
int pictureType = getPictureType();
if (pictureType != -1) {
poiEntity.setWork_type(pictureType);
}
String desc = etDesc.getText().toString().trim();
if (desc != null && !desc.equals("")) {
poiEntity.setMemo(desc);
}
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(3);
poiEntity.setTaskStatus(2);
poiEntity.setIsLocalData(1);
poiEntity.setX(showPoiEntity.getX());
poiEntity.setY(showPoiEntity.getY());
List<File> videoFileListByUUID = AWMp4ParserHelper.getInstance().getVideoFileListByUUID(showPoiEntity.getId());
String photoStr = AWMp4ParserHelper.getInstance().getVideoFileListStr(videoFileListByUUID);
poiEntity.setPhoto(photoStr);
PoiEntity poiEntity = initPoiEntityByUI(showPoiEntity);
String newPoiEntity = new Gson().toJson(poiEntity);
//以键值对的形式添加新值
edit.putString("poiEntity", newPoiEntity);
@ -717,19 +589,87 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
}
@Override
protected PoiEntity initPoiEntityByUI() {
return showPoiEntity;
protected PoiEntity initPoiEntityByUI(PoiEntity poiEntity) {
String roadName = etRoadName.getText().toString().trim();
if (roadName != null && !roadName.equals("")) {
poiEntity.setName(roadName + "");
} else {
DateFormat formatters = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss");
Calendar calendars = Calendar.getInstance();
calendars.setTimeInMillis(System.currentTimeMillis());
String formats = formatters.format(calendars.getTime());
String city = Constant.currentLocation.getCity();//返回当前位置的城市.
String district = Constant.currentLocation.getDistrict();//返回当前位置的区县.
StringBuilder sb = new StringBuilder("poi录像上报");
if (city != null && !"".equals(city)) {
sb.append("-");
sb.append(city);
}
if (district != null && !"".equals(district)) {
sb.append(district);
}
sb.append("-").append(formats);
poiEntity.setName(sb.toString());
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
etRoadName.setText(sb);
etRoadName.setEnabled(false);
}
});
}
int pictureType = getPictureType();
if (pictureType != -1) {
poiEntity.setWork_type(pictureType);
}
String desc = etDesc.getText().toString().trim();
if (desc != null && !desc.equals("")) {
poiEntity.setDescribe(desc);
}
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(3);
poiEntity.setTaskStatus(2);
poiEntity.setIsLocalData(1);
if (fmPoiVideoPic.getTag() != null &&!((List<File>) fmPoiVideoPic.getTag()).isEmpty()) {
List<LatLng> lineStringByVideoFileList = AWMp4ParserHelper.getInstance().getLineStringByVideoFileList((List<File>) fmPoiVideoPic.getTag());
String lineString = GeometryTools.getLineString(lineStringByVideoFileList);
Log.d("TAG", "onGranted: " + lineString);
String photoStr = AWMp4ParserHelper.getInstance().getVideoFileListStr((List<File>) fmPoiVideoPic.getTag());
poiEntity.setPhoto(photoStr);
if (lineString != null) {
poiEntity.setGeoWkt(lineString);
}
}
return poiEntity;
}
@Override
protected PoiCheckResult checkPoiEntity(PoiEntity entity) {
PoiCheckResult poiCheckResult = new PoiCheckResult();
if (entity.getName() == null) {
poiCheckResult.setCode(-1);
poiCheckResult.setMsg("name不能为空");
if (entity.getPhoto()==null){
poiCheckResult.setCode(1);
poiCheckResult.setMsg("请录像");
return poiCheckResult;
}
if (entity.getWork_type()==-1){
poiCheckResult.setCode(1);
poiCheckResult.setMsg("请选择录像方式");
return poiCheckResult;
}
return poiCheckResult;
}
@Override
protected ChargingPileEntity initChargingPileEntityByUI(ChargingPileEntity entity) {
return null;
}
@Override
protected PoiCheckResult checkChargingPileEntity(ChargingPileEntity entity) {
return null;
}
}

View File

@ -53,6 +53,7 @@ import com.navinfo.outdoor.http.Callback;
import com.navinfo.outdoor.http.DialogCallback;
import com.navinfo.outdoor.http.HttpInterface;
import com.navinfo.outdoor.http.OkGoBuilder;
import com.navinfo.outdoor.room.ChargingPileEntity;
import com.navinfo.outdoor.room.InsertAndUpdateUtils;
import com.navinfo.outdoor.room.PoiDao;
import com.navinfo.outdoor.room.PoiDatabase;
@ -62,6 +63,7 @@ import com.navinfo.outdoor.util.GeometryTools;
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.json.JSONException;
import java.io.File;
@ -106,6 +108,14 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
return R.layout.fragment_road;
}
@Override
public void onStart() {
super.onStart();
if (!EventBus.getDefault().isRegistered(this)) {//加上判断
EventBus.getDefault().register(this);
}
}
@Override
public void onResume() {
super.onResume();
@ -160,6 +170,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
rgType = (RadioGroup) findViewById(R.id.rg_type);
roadUpload = findViewById(R.id.road_upload);
roadUpload.setOnClickListener(this::onClick);
showPictureType(1);
fmRoadPic.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@ -172,6 +183,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
Intent intent = new Intent(getContext(), PictureActivity.class);
intent.putExtra(Constant.INTENT_VIDEO_PATH, finalFile.getAbsolutePath());
intent.putExtra(Constant.INTENT_VIDEO_ORATATION, 0);
intent.putExtra("uuId", showPoiEntity.getId());
startActivityForResult(intent, 0x101);
}
});
@ -239,10 +251,12 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
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(), ivRoadPicture, 500);
isImageLoad = true;
if (videoFile.getPath().contains("0.mp4")&&!videoFile.getPath().contains("0.mp4.txt")){
if (videoFile.exists() && !isImageLoad) {
// 使用glide加载视频的第一帧
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivRoadPicture, 500);
isImageLoad = true;
}
}
}
}
@ -271,32 +285,13 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
rbWalking.setEnabled(false);
}
@Override
protected void initData() {
super.initData();
// infos = new ArrayList<>();
}
/**
* 获取本地视频的第一帧
*
* @param localPath
* @return
*/
public Bitmap getLocalVideoBitmap(String localPath) {
Bitmap bitmap = null;
MediaMetadataRetriever retriever = new MediaMetadataRetriever();
try {
//根据文件路径获取缩略图
retriever.setDataSource(localPath);
//获得第一帧图片
bitmap = retriever.getFrameAtTime();
} catch (IllegalArgumentException e) {
e.printStackTrace();
} finally {
retriever.release();
@Subscribe
public void onEvent(Message data) {
if (data.what == Constant.PICTURE_VIDEO_WORD) {
if ((boolean)data.obj){
initRoadSharePre();
}
}
return bitmap;
}
@Override
@ -314,25 +309,19 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
File finalFile = AWMp4ParserHelper.getInstance().obtainMp4FilePath(new File(Constant.PICTURE_FOLDER, showPoiEntity.getId()).getAbsolutePath());
intent.putExtra(Constant.INTENT_VIDEO_PATH, finalFile.getAbsolutePath());
intent.putExtra(Constant.INTENT_VIDEO_ORATATION, 0);
intent.putExtra("uuId", showPoiEntity.getId());
startActivityForResult(intent, 0x101);
break;
case R.id.road_upload:
showFileLoadingDialog();
setLoadingDialogText("压缩中...");
ArrayList<File> fileList = new ArrayList<>();
if (fmRoadPic.getTag() != null) {
List<File> videoFileList = (List<File>) fmRoadPic.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(fileList, fileZip, null);
ZipUtil.zipFiles(videoFileList, fileZip, null);
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
if (poiDaoPoiEntity == null || poiDaoPoiEntity.getTaskStatus() == 1 || poiDaoPoiEntity.getTaskStatus() == 2 || poiDaoPoiEntity.getTaskStatus() == 0) {
dismissLoadingDialog();
@ -366,72 +355,12 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
@Override
public void onGranted(List<String> permissions, boolean all) {
if (all) {
PoiEntity poiEntity = showPoiEntity;
String roadName = etRoadName.getText().toString().trim();
if (roadName != null && !roadName.equals("")) {
poiEntity.setName(roadName);
} else {
DateFormat formatters = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss");
Calendar calendars = Calendar.getInstance();
calendars.setTimeInMillis(System.currentTimeMillis());
String formats = formatters.format(calendars.getTime());
String city = Constant.currentLocation.getCity();//返回当前位置的城市.
String district = Constant.currentLocation.getDistrict();//返回当前位置的区县.
StringBuffer sb = new StringBuffer("道路录像上报");
if (city != null && !"".equals(city)) {
sb.append("-");
sb.append(city);
}
if (district != null && !"".equals(district)) {
sb.append(district);
}
sb.append("-").append(formats);
poiEntity.setName(sb.toString());
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
etRoadName.setText(sb);
etRoadName.setEnabled(false);
}
});
}
String desc = etDesc.getText().toString().trim();
if (desc != null && !desc.equals("")) {
poiEntity.setDescribe(desc);
}
if (showPoiEntity != null) {
if (showPoiEntity.getTaskId() != 0) {
poiEntity.setTaskId(showPoiEntity.getTaskId());
}
}
if (fmRoadPic.getTag() == null||((List<File>) fmRoadPic.getTag()).isEmpty()) {
Toast.makeText(getActivity(), "请录像", Toast.LENGTH_SHORT).show();
PoiEntity poiEntity = initPoiEntityByUI(showPoiEntity);
PoiCheckResult poiCheckResult = checkPoiEntity(poiEntity);
if (poiCheckResult.getCode() == 1) {
Toast.makeText(getActivity(), poiCheckResult.getMsg()+"", Toast.LENGTH_SHORT).show();
return;
} else {
String lineString = GeometryTools.getLineString(AWMp4ParserHelper.getInstance().getLineStringByVideoFileList((List<File>) fmRoadPic.getTag()));
String filePathString = getPhotoStrFromTag();
Log.d("TAG", "onGranted: " + lineString);
poiEntity.setPhoto(filePathString);
if (lineString!=null) {
poiEntity.setGeoWkt(lineString);
}
}
int pictureType = getPictureType();
if (pictureType == -1) {
Toast.makeText(getContext(), "请选择拍照方式", Toast.LENGTH_SHORT).show();
return;
}else {
poiEntity.setWork_type(pictureType);
}
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(4);
poiEntity.setTaskStatus(2);
poiEntity.setIsLocalData(1);
new Thread(new Runnable() {
@Override
public void run() {
@ -462,19 +391,6 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
});
}
private String getPhotoStrFromTag() {
List<File> videoFileList = (List<File>) fmRoadPic.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();
}
@ -619,12 +535,11 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
});
return;
}else {
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivRoadPicture, 500);
if (fmRoadPic.getTag() == null) {
fmRoadPic.setTag(new ArrayList<>());
if (videoFile.exists()) {
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivRoadPicture, 500);
List<File> videoFileListByUUID = AWMp4ParserHelper.getInstance().getVideoFileListByUUID(showPoiEntity.getId());
fmRoadPic.setTag(videoFileListByUUID);
}
List<File> fileList = (List<File>) fmRoadPic.getTag();
fileList.add(videoFile);
}
}
@ -633,19 +548,6 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
}
}
private List<File> getAllCurrentPoiVideoFile(String uuid) {
List<File> fileList = new ArrayList<>();
if (StringUtils.isEmpty(uuid)) {
return fileList;
}
File folder = new File(Constant.PICTURE_FOLDER);
if (folder.exists()) {
for (File videoFile: folder.listFiles()) {
}
}
return fileList;
}
@Override
public void onSaveInstanceState(@NonNull Bundle outState) {
@ -665,39 +567,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
//获取Editor对象
SharedPreferences.Editor edit = poi.edit();
//根据要保存的数据的类型调用对应的put方法,
PoiEntity poiEntity = new PoiEntity();
poiEntity.setId(showPoiEntity.getId());
String roadName = etRoadName.getText().toString().trim();
if (roadName != null && !roadName.equals("")) {
poiEntity.setName(roadName);
}
int pictureType = getPictureType();
if (pictureType != -1) {
poiEntity.setWork_type(pictureType);
}
String desc = etDesc.getText().toString().trim();
if (desc != null && !desc.equals("")) {
poiEntity.setDescribe(desc);
}
if (showPoiEntity != null) {
if (showPoiEntity.getTaskId() != 0) {
poiEntity.setTaskId(showPoiEntity.getTaskId());
}
}
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(4);
poiEntity.setTaskStatus(2);
poiEntity.setIsLocalData(1);
poiEntity.setX(showPoiEntity.getX());
poiEntity.setY(showPoiEntity.getY());
List<File> videoFileListByUUID = AWMp4ParserHelper.getInstance().getVideoFileListByUUID(showPoiEntity.getId());
String photoStr = AWMp4ParserHelper.getInstance().getVideoFileListStr(videoFileListByUUID);
poiEntity.setPhoto(photoStr);
PoiEntity poiEntity = initPoiEntityByUI(showPoiEntity);
String newPoiEntity = new Gson().toJson(poiEntity);
//以键值对的形式添加新值
edit.putString("poiEntity", newPoiEntity);
@ -752,12 +622,88 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
}
@Override
protected PoiEntity initPoiEntityByUI() {
return null;
protected PoiEntity initPoiEntityByUI(PoiEntity poiEntity) {
String roadName = etRoadName.getText().toString().trim();
if (roadName != null && !roadName.equals("")) {
poiEntity.setName(roadName);
} else {
DateFormat formatters = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss");
Calendar calendars = Calendar.getInstance();
calendars.setTimeInMillis(System.currentTimeMillis());
String formats = formatters.format(calendars.getTime());
String city = Constant.currentLocation.getCity();//返回当前位置的城市.
String district = Constant.currentLocation.getDistrict();//返回当前位置的区县.
StringBuffer sb = new StringBuffer("道路录像上报");
if (city != null && !"".equals(city)) {
sb.append("-");
sb.append(city);
}
if (district != null && !"".equals(district)) {
sb.append(district);
}
sb.append("-").append(formats);
poiEntity.setName(sb.toString());
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
etRoadName.setText(sb);
etRoadName.setEnabled(false);
}
});
}
int pictureType = getPictureType();
if (pictureType != -1) {
poiEntity.setWork_type(pictureType);
}
String desc = etDesc.getText().toString().trim();
if (desc != null && !desc.equals("")) {
poiEntity.setDescribe(desc);
}
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(4);
poiEntity.setTaskStatus(2);
poiEntity.setIsLocalData(1);
if (fmRoadPic.getTag() != null &&!((List<File>) fmRoadPic.getTag()).isEmpty()) {
List<LatLng> lineStringByVideoFileList = AWMp4ParserHelper.getInstance().getLineStringByVideoFileList((List<File>) fmRoadPic.getTag());
String lineString = GeometryTools.getLineString(lineStringByVideoFileList);
Log.d("TAG", "onGranted: " + lineString);
String photoStr = AWMp4ParserHelper.getInstance().getVideoFileListStr((List<File>) fmRoadPic.getTag());
poiEntity.setPhoto(photoStr);
if (lineString != null) {
poiEntity.setGeoWkt(lineString);
}
}
return poiEntity;
}
@Override
protected PoiCheckResult checkPoiEntity(PoiEntity entity) {
PoiCheckResult poiCheckResult = new PoiCheckResult();
if (entity.getPhoto()==null){
poiCheckResult.setCode(1);
poiCheckResult.setMsg("请录像");
return poiCheckResult;
}
if (entity.getWork_type()==-1){
poiCheckResult.setCode(1);
poiCheckResult.setMsg("请选择录像方式");
return poiCheckResult;
}
return poiCheckResult;
}
@Override
protected ChargingPileEntity initChargingPileEntityByUI(ChargingPileEntity entity) {
return null;
}
@Override
protected PoiCheckResult checkChargingPileEntity(ChargingPileEntity entity) {
return null;
}
}

View File

@ -371,125 +371,132 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
}
removables.clear();
JobSearchBean body = response.body();
List<JobSearchBean.BodyBean.ListBean> list = response.body().getBody().getList();
for (int i = 0; i < list.size(); i++) {
JobSearchBean.BodyBean.ListBean listBean = list.get(i);
String geo = list.get(i).getGeo();
Log.d("TAG", "onSuccess: " + geo);
Geometry geometry = GeometryTools.createGeometry(geo);
LatLng latLng = null;
if (geometry.getGeometryType().equals("Point")) {//
latLng = GeometryTools.createLatLng(geo);
} else if (geometry.getGeometryType().equals("LineString")) {//线
List<LatLng> latLineString = GeometryTools.getLatLngs(geo);
// 构造 PolylineOpitons
PolylineOptions polylineOptions = new PolylineOptions()
.addAll(latLineString)
// 折线设置圆形线头
.lineCap(true)
// 折线的颜色为绿色
.color(0xff00ff00)
// 折线宽度为5像素
.width(5)
// 还可以添加描边颜色
.borderColor(0xffff0000)
// 描边颜色的宽度线宽还是 25 像素不过填充的部分宽度为 `width` - 2 * `borderWidth`
.borderWidth(1);
// 绘制折线
Polyline polyline = tencentMap.addPolyline(polylineOptions);
polyline.setZIndex(3);
removables.add(polyline);
if (latLineString != null && latLineString.size() > 0) {
latLng = latLineString.get(0);
}
} else if (geometry.getGeometryType().equals("Polygon")) {//
List<LatLng> latPolygon = GeometryTools.getLatLngs(geo);
Polygon polygon = tencentMap.addPolygon(new PolygonOptions().
//连接封闭图形的点
addAll(latPolygon).
//填充颜色为红色
fillColor(Color.parseColor("#97E0E7EC")).
//边线颜色为黑色
strokeColor(0xff000000).
//边线宽度15像素
strokeWidth(5));
polygon.setZIndex(1);
removables.add(polygon);
com.vividsolutions.jts.geom.Point centroid = geometry.getCentroid();
double x = centroid.getX();
double y = centroid.getY();
if (centroid != null) {
latLng = new LatLng();
latLng.setLatitude(y);
latLng.setLongitude(x);
}
if (body!=null&&body.getBody()!=null){
List<JobSearchBean.BodyBean.ListBean> list = response.body().getBody().getList();
for (int i = 0; i < list.size(); i++) {
JobSearchBean.BodyBean.ListBean listBean = list.get(i);
String encodeStr = list.get(i).getGeo();
// 解密geo
String geo = Geohash.getInstance().decode(encodeStr);
listBean.setGeo(geo);
Log.d("TAG", "onSuccess: " + geo);
Geometry geometry = GeometryTools.createGeometry(geo);
LatLng latLng = null;
if (geometry.getGeometryType().equals("Point")) {//
latLng = GeometryTools.createLatLng(geo);
} else if (geometry.getGeometryType().equals("LineString")) {//线
List<LatLng> latLineString = GeometryTools.getLatLngs(geo);
// 构造 PolylineOpitons
PolylineOptions polylineOptions = new PolylineOptions()
.addAll(latLineString)
// 折线设置圆形线头
.lineCap(true)
// 折线的颜色为绿色
.color(0xff00ff00)
// 折线宽度为5像素
.width(5)
// 还可以添加描边颜色
.borderColor(0xffff0000)
// 描边颜色的宽度线宽还是 25 像素不过填充的部分宽度为 `width` - 2 * `borderWidth`
.borderWidth(1);
// 绘制折线
Polyline polyline = tencentMap.addPolyline(polylineOptions);
polyline.setZIndex(3);
removables.add(polyline);
if (latLineString != null && latLineString.size() > 0) {
latLng = latLineString.get(0);
}
} else if (geometry.getGeometryType().equals("Polygon")) {//
List<LatLng> latPolygon = GeometryTools.getLatLngs(geo);
Polygon polygon = tencentMap.addPolygon(new PolygonOptions().
//连接封闭图形的点
addAll(latPolygon).
//填充颜色为红色
fillColor(Color.parseColor("#97E0E7EC")).
//边线颜色为黑色
strokeColor(0xff000000).
//边线宽度15像素
strokeWidth(5));
polygon.setZIndex(1);
removables.add(polygon);
com.vividsolutions.jts.geom.Point centroid = geometry.getCentroid();
double x = centroid.getX();
double y = centroid.getY();
if (centroid != null) {
latLng = new LatLng();
latLng.setLatitude(y);
latLng.setLongitude(x);
}
/* if (latPolygon != null && latPolygon.size() > 0) {
latLng = latPolygon.get(0);
}*/
}
switch (Integer.valueOf(list.get(i).getType())) {
case 1://poi
BitmapDescriptor poiDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_bg1);
Marker poiMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiDescriptor).alpha(0.9f)
.flat(true)
.clockwise(false));
poiMarker.setZIndex(2);
poiMarker.setTag(listBean);
removables.add(poiMarker);
poiMarker.setClickable(true);
break;
case 2://充电站
BitmapDescriptor chargeDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_charge_bg1);
Marker stationMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(chargeDescriptor).alpha(0.9f)
.flat(true)
.clockwise(false));
stationMarker.setTag(listBean);
removables.add(stationMarker);
stationMarker.setClickable(true);
stationMarker.setZIndex(2);
break;
case 3://poi录像
BitmapDescriptor poiVideoDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_video_bg1);
Marker poiVideoMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiVideoDescriptor).alpha(0.9f)
.flat(true)
.clockwise(false));
poiVideoMarker.setTag(listBean);
removables.add(poiVideoMarker);
poiVideoMarker.setClickable(true);
poiVideoMarker.setZIndex(2);
break;
case 4://道路录像
BitmapDescriptor roadDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_road_bg);
Marker roadMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(roadDescriptor).alpha(0.9f)
.flat(true)
.clockwise(false));
roadMarker.setTag(listBean);
removables.add(roadMarker);
roadMarker.setClickable(true);
roadMarker.setZIndex(2);
break;
case 5://其他
BitmapDescriptor otherDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other_bg1);
Marker otherMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(otherDescriptor).alpha(0.9f)
.flat(true)
.clockwise(false));
otherMarker.setTag(listBean);
removables.add(otherMarker);
otherMarker.setClickable(true);
otherMarker.setZIndex(2);
break;
case 6://面状任务
BitmapDescriptor Descriptor = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_bg);
Marker planarMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(Descriptor).alpha(0.9f)
.flat(true)
.clockwise(false));
Log.d("面状任务", "onSuccess: " + planarMarker);
planarMarker.setTag(listBean);
removables.add(planarMarker);
planarMarker.setClickable(true);
planarMarker.setZIndex(2);
break;
}
}
switch (Integer.valueOf(list.get(i).getType())) {
case 1://poi
BitmapDescriptor poiDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_bg1);
Marker poiMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiDescriptor).alpha(0.9f)
.flat(true)
.clockwise(false));
poiMarker.setZIndex(2);
poiMarker.setTag(listBean);
removables.add(poiMarker);
poiMarker.setClickable(true);
break;
case 2://充电站
BitmapDescriptor chargeDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_charge_bg1);
Marker stationMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(chargeDescriptor).alpha(0.9f)
.flat(true)
.clockwise(false));
stationMarker.setTag(listBean);
removables.add(stationMarker);
stationMarker.setClickable(true);
stationMarker.setZIndex(2);
break;
case 3://poi录像
BitmapDescriptor poiVideoDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_video_bg1);
Marker poiVideoMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(poiVideoDescriptor).alpha(0.9f)
.flat(true)
.clockwise(false));
poiVideoMarker.setTag(listBean);
removables.add(poiVideoMarker);
poiVideoMarker.setClickable(true);
poiVideoMarker.setZIndex(2);
break;
case 4://道路录像
BitmapDescriptor roadDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_road_bg);
Marker roadMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(roadDescriptor).alpha(0.9f)
.flat(true)
.clockwise(false));
roadMarker.setTag(listBean);
removables.add(roadMarker);
roadMarker.setClickable(true);
roadMarker.setZIndex(2);
break;
case 5://其他
BitmapDescriptor otherDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other_bg1);
Marker otherMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(otherDescriptor).alpha(0.9f)
.flat(true)
.clockwise(false));
otherMarker.setTag(listBean);
removables.add(otherMarker);
otherMarker.setClickable(true);
otherMarker.setZIndex(2);
break;
case 6://面状任务
BitmapDescriptor Descriptor = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_bg);
Marker planarMarker = tencentMap.addMarker(new MarkerOptions(latLng).icon(Descriptor).alpha(0.9f)
.flat(true)
.clockwise(false));
Log.d("面状任务", "onSuccess: " + planarMarker);
planarMarker.setTag(listBean);
removables.add(planarMarker);
planarMarker.setClickable(true);
planarMarker.setZIndex(2);
break;
}
} else {
Toast.makeText(getActivity(), "请求数据为空", Toast.LENGTH_SHORT).show();
}
Message obtain = Message.obtain();
obtain.what = Constant.JOB_SEARCH_WORD;

View File

@ -0,0 +1,300 @@
package com.navinfo.outdoor.util;
import javax.crypto.*;
import javax.crypto.spec.DESKeySpec;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.io.*;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
public class Base64 {
static final char[] alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
.toCharArray();
public static char[] encode(byte[] content) {
CharArrayWriter cw = new CharArrayWriter(4 * content.length / 3);
int idx = 0;
int x = 0;
for (int i = 0; i < content.length; ++i) {
if (idx == 0)
x = (content[i] & 0xFF) << 16;
else if (idx == 1)
x |= (content[i] & 0xFF) << 8;
else {
x |= content[i] & 0xFF;
}
if (++idx == 3) {
cw.write(alphabet[(x >> 18)]);
cw.write(alphabet[(x >> 12 & 0x3F)]);
cw.write(alphabet[(x >> 6 & 0x3F)]);
cw.write(alphabet[(x & 0x3F)]);
idx = 0;
}
}
if (idx == 1) {
cw.write(alphabet[(x >> 18)]);
cw.write(alphabet[(x >> 12 & 0x3F)]);
cw.write(61);
cw.write(61);
}
if (idx == 2) {
cw.write(alphabet[(x >> 18)]);
cw.write(alphabet[(x >> 12 & 0x3F)]);
cw.write(alphabet[(x >> 6 & 0x3F)]);
cw.write(61);
}
return cw.toCharArray();
}
public static byte[] decode(char[] message) throws IOException {
byte[] buff = new byte[4];
byte[] dest = new byte[message.length];
int bpos = 0;
int destpos = 0;
for (int i = 0; i < message.length; ++i) {
int c = message[i];
if ((c != 10) && (c != 13) && (c != 32)) {
if (c == 9)
continue;
if ((c >= 65) && (c <= 90)) {
buff[(bpos++)] = (byte) (c - 65);
} else if ((c >= 97) && (c <= 122)) {
buff[(bpos++)] = (byte) (c - 97 + 26);
} else if ((c >= 48) && (c <= 57)) {
buff[(bpos++)] = (byte) (c - 48 + 52);
} else if (c == 43) {
buff[(bpos++)] = 62;
} else if (c == 47) {
buff[(bpos++)] = 63;
} else if (c == 61) {
buff[(bpos++)] = 64;
} else {
throw new IOException("Illegal char in base64 code.");
}
if (bpos == 4) {
bpos = 0;
if (buff[0] == 64)
break;
if (buff[1] == 64)
throw new IOException("Unexpected '=' in base64 code.");
int v;
if (buff[2] == 64) {
v = (buff[0] & 0x3F) << 6 | buff[1] & 0x3F;
dest[(destpos++)] = (byte) (v >> 4);
break;
}
if (buff[3] == 64) {
v = (buff[0] & 0x3F) << 12 | (buff[1] & 0x3F) << 6
| buff[2] & 0x3F;
dest[(destpos++)] = (byte) (v >> 10);
dest[(destpos++)] = (byte) (v >> 2);
break;
}
v = (buff[0] & 0x3F) << 18 | (buff[1] & 0x3F) << 12
| (buff[2] & 0x3F) << 6 | buff[3] & 0x3F;
dest[(destpos++)] = (byte) (v >> 16);
dest[(destpos++)] = (byte) (v >> 8);
dest[(destpos++)] = (byte) v;
}
}
}
byte[] res = new byte[destpos];
System.arraycopy(dest, 0, res, 0, destpos);
return res;
}
//-----------------------------------------------------
private static String keyValue = "20140107";
private static String keyVector = "20144295";
private static final char[] legalChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".toCharArray();
/**
* data[]进行编码
*
* @param data
* @return
*/
private static String encode_(byte[] data) {
int start = 0;
int len = data.length;
StringBuffer buf = new StringBuffer(data.length * 3 / 2);
int end = len - 3;
int i = start;
int n = 0;
while (i <= end) {
int d = ((((int) data[i]) & 0x0ff) << 16) | ((((int) data[i + 1]) & 0x0ff) << 8) | (((int) data[i + 2]) & 0x0ff);
buf.append(legalChars[(d >> 18) & 63]);
buf.append(legalChars[(d >> 12) & 63]);
buf.append(legalChars[(d >> 6) & 63]);
buf.append(legalChars[d & 63]);
i += 3;
if (n++ >= 14) {
n = 0;
buf.append(" ");
}
}
if (i == start + len - 2) {
int d = ((((int) data[i]) & 0x0ff) << 16) | ((((int) data[i + 1]) & 255) << 8);
buf.append(legalChars[(d >> 18) & 63]);
buf.append(legalChars[(d >> 12) & 63]);
buf.append(legalChars[(d >> 6) & 63]);
buf.append("=");
} else if (i == start + len - 1) {
int d = (((int) data[i]) & 0x0ff) << 16;
buf.append(legalChars[(d >> 18) & 63]);
buf.append(legalChars[(d >> 12) & 63]);
buf.append("==");
}
return buf.toString();
}
private static byte[] decode_(String s) {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
try {
decode(s, bos);
} catch (IOException e) {
throw new RuntimeException();
}
byte[] decodedBytes = bos.toByteArray();
try {
bos.close();
bos = null;
} catch (IOException ex) {
System.err.println("Error while decoding BASE64: " + ex.toString());
}
return decodedBytes;
}
private static void decode(String s, OutputStream os) throws IOException {
int i = 0;
int len = s.length();
while (true) {
while (i < len && s.charAt(i) <= ' ')
i++;
if (i == len)
break;
int tri = (decode(s.charAt(i)) << 18)
+ (decode(s.charAt(i + 1)) << 12)
+ (decode(s.charAt(i + 2)) << 6)
+ (decode(s.charAt(i + 3)));
os.write((tri >> 16) & 255);
if (s.charAt(i + 2) == '=')
break;
os.write((tri >> 8) & 255);
if (s.charAt(i + 3) == '=')
break;
os.write(tri & 255);
i += 4;
}
}
private static int decode(char c) {
if (c >= 'A' && c <= 'Z') {
return ((int) c) - 65;
} else if (c >= 'a' && c <= 'z') {
return ((int) c) - 97 + 26;
} else if (c >= '0' && c <= '9') {
return ((int) c) - 48 + 26 + 26;
} else {
switch (c) {
case '+':
return 62;
case '/':
return 63;
case '=':
return 0;
default:
throw new RuntimeException("unexpected code: " + c);
}
}
}
/**
* 加密
*
* @param message 待加密的的文本信息
* @return 返回加密结果
*/
public static String desEncrypt(String message) throws Exception {
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
SecretKey secretKey = keyFactory.generateSecret(new DESKeySpec(keyValue.getBytes("UTF-8")));
IvParameterSpec iv = new IvParameterSpec(keyVector.getBytes("UTF-8"));
Cipher cipher = Cipher.getInstance("DES/CBC/PKCS5Padding");
cipher.init(Cipher.ENCRYPT_MODE, secretKey, iv);
return encode_(cipher.doFinal(message.getBytes("UTF-8")));
}
// public static String desEncrypt1(String message) throws Exception {
//// SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
//// SecretKey secretKey = keyFactory.generateSecret(new DESKeySpec(keyValue.getBytes("UTF-8")));
// SecretKeySpec secretKey = new SecretKeySpec(keyValue.getBytes(), "DES");
// IvParameterSpec iv = new IvParameterSpec(keyVector.getBytes("UTF-8"));
// Cipher cipher = Cipher.getInstance("DES/CBC/PKCS5Padding");
// cipher.init(Cipher.ENCRYPT_MODE, secretKey, iv);
// return encode_(cipher.doFinal(message.getBytes("UTF-8")));
// }
/**
* 解密
*
* @param message 带解密文本信息
* @return 返回解密结果
* @throws UnsupportedEncodingException
* @throws NoSuchPaddingException
* @throws NoSuchAlgorithmException
* @throws InvalidAlgorithmParameterException
* @throws InvalidKeyException
* @throws BadPaddingException
* @throws IllegalBlockSizeException
*/
public static String desDecrypt(String message) throws UnsupportedEncodingException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException {
byte[] byteMi = Base64.decode_(message);
SecretKeySpec key = new SecretKeySpec(keyValue.getBytes(), "DES");
IvParameterSpec iv = new IvParameterSpec(keyVector.getBytes("UTF-8"));
Cipher cipher = Cipher.getInstance("DES/CBC/PKCS5Padding");
cipher.init(Cipher.DECRYPT_MODE, key, iv);
return new String(cipher.doFinal(byteMi),"UTF-8");
}
public static void main(String[] args) throws Exception {
System.out.println(desDecrypt("eLWAo/Fv9CGJmywsP+j+m0s++56MUl6xCb3lykLFsfi7m4YHfxjjcyxJ8vH+ReTv"));
// System.out.println(desEncrypt("1626945974657e10adc3949ba59abbe56e057f20f883e"));
}
}

View File

@ -1,8 +1,19 @@
package com.navinfo.outdoor.util;
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
import com.vividsolutions.jts.geom.Geometry;
import java.io.UnsupportedEncodingException;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.util.BitSet;
import java.util.HashMap;
import javax.crypto.BadPaddingException;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
public class Geohash {
private Geohash(){}
@ -33,61 +44,79 @@ public class Geohash {
lookup.put(c, i++);
}
public static void main(String[] args) {
String s = "1rn7exd5uhxy";
System.out.println(s);
System.out.println(new Geohash().decode(s)[0]);
System.out.println(new Geohash().decode(s)[1]);
System.out.println(new Geohash().encode(40.073556024581194, 116.24643344432116));
}
// public static void main(String[] args) {
// String s = "1rn7exd5uhxy";
// System.out.println(s);
// System.out.println(new Geohash().decode(s)[0]);
// System.out.println(new Geohash().decode(s)[1]);
// System.out.println(new Geohash().encode(40.073556024581194, 116.24643344432116));
// }
//数据解密
/**
* @param geohash 需要被解密的字符串
* @return double[] 经纬度double数组纬度(latitude)在前,经度在后(longitude)
* */
public double[] decode(String geohash) {
public String decode(String geohash) {
// try {
// StringBuilder buffer = new StringBuilder();
// for (char c : geohash.toCharArray()) {
//
// int i = lookup.get(c) + 32;
// buffer.append(Integer.toString(i, 2).substring(1));
// }
//
// long a = Long.parseLong(buffer.toString(), 2);
// buffer.setLength(0);
// buffer.append(Long.toBinaryString(a));
//
// BitSet lonset = new BitSet();
// BitSet latset = new BitSet();
//
// // even bits
// int j = 0;
// for (int i = 0; i < numbits * 2; i += 2) {
// boolean isSet = false;
// if (i < buffer.length())
// isSet = buffer.charAt(i) == '1';
// lonset.set(j++, isSet);
// }
//
// // odd bits
// j = 0;
// for (int i = 1; i < numbits * 2; i += 2) {
// boolean isSet = false;
// if (i < buffer.length())
// isSet = buffer.charAt(i) == '1';
// latset.set(j++, isSet);
// }
//
// double lon = decode(lonset, -180, 180);
// double lat = decode(latset, -90, 90);
//
// return new double[] { lat, lon };
// } catch (RuntimeException re) {
// re.printStackTrace();
// return null;
// }
try {
StringBuilder buffer = new StringBuilder();
for (char c : geohash.toCharArray()) {
int i = lookup.get(c) + 32;
buffer.append(Integer.toString(i, 2).substring(1));
}
long a = Long.parseLong(buffer.toString(), 2);
buffer.setLength(0);
buffer.append(Long.toBinaryString(a));
BitSet lonset = new BitSet();
BitSet latset = new BitSet();
// even bits
int j = 0;
for (int i = 0; i < numbits * 2; i += 2) {
boolean isSet = false;
if (i < buffer.length())
isSet = buffer.charAt(i) == '1';
lonset.set(j++, isSet);
}
// odd bits
j = 0;
for (int i = 1; i < numbits * 2; i += 2) {
boolean isSet = false;
if (i < buffer.length())
isSet = buffer.charAt(i) == '1';
latset.set(j++, isSet);
}
double lon = decode(lonset, -180, 180);
double lat = decode(latset, -90, 90);
return new double[] { lat, lon };
} catch (RuntimeException re) {
re.printStackTrace();
return null;
return Base64.desDecrypt(geohash);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (NoSuchPaddingException e) {
e.printStackTrace();
} catch (InvalidKeyException e) {
e.printStackTrace();
} catch (InvalidAlgorithmParameterException e) {
e.printStackTrace();
} catch (IllegalBlockSizeException e) {
e.printStackTrace();
} catch (BadPaddingException e) {
e.printStackTrace();
}
return null;
}
private double decode(BitSet bs, double floor, double ceiling) {
@ -107,14 +136,20 @@ public class Geohash {
* @param lat,lon 需要被加密的double
* */
public String encode(double lat, double lon) {
BitSet latbits = getBits(lat, -90, 90);
BitSet lonbits = getBits(lon, -180, 180);
StringBuilder buffer = new StringBuilder();
for (int i = 0; i < numbits; i++) {
buffer.append((lonbits.get(i)) ? '1' : '0');
buffer.append((latbits.get(i)) ? '1' : '0');
// BitSet latbits = getBits(lat, -90, 90);
// BitSet lonbits = getBits(lon, -180, 180);
// StringBuilder buffer = new StringBuilder();
// for (int i = 0; i < numbits; i++) {
// buffer.append((lonbits.get(i)) ? '1' : '0');
// buffer.append((latbits.get(i)) ? '1' : '0');
// }
Geometry geometry = GeometryTools.createGeometry(new LatLng(lat, lon));
try {
return Base64.desEncrypt(geometry.toString());
} catch (Exception e) {
e.printStackTrace();
}
return base32(Long.parseLong(buffer.toString(), 2));
return null;
}
private BitSet getBits(double lat, double floor, double ceiling) {

View File

@ -333,6 +333,7 @@
android:layout_height="20dp"
/>
<TextView
android:id="@+id/tv_panorama"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
@ -368,6 +369,7 @@
android:layout_height="20dp"
/>
<TextView
android:id="@+id/tv_coding"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
@ -395,7 +397,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<TextView
android:id="@+id/tv_scutcheon"
android:id="@+id/tv_scutcheon1"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:text="设备标牌"
@ -413,10 +415,10 @@
android:layout_height="40dp"
android:layout_centerVertical="true"
android:layout_marginLeft="18dp"
android:layout_toRightOf="@id/tv_scutcheon"
android:layout_toRightOf="@id/tv_scutcheon1"
android:background="@color/white"
android:layout_marginRight="10dp"
android:layout_toEndOf="@id/tv_scutcheon"
android:layout_toEndOf="@id/tv_scutcheon1"
android:textSize="15sp"
android:textColor="#333" />
<ImageView
@ -449,6 +451,7 @@
android:layout_height="20dp"
/>
<TextView
android:id="@+id/tv_equipment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
@ -484,6 +487,7 @@
android:layout_height="20dp"
/>
<TextView
android:id="@+id/tv_facility"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
@ -521,6 +525,7 @@
android:layout_height="20dp"
/>
<TextView
android:id="@+id/tv_scutcheon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
@ -558,6 +563,7 @@
android:layout_height="20dp"
/>
<TextView
android:id="@+id/tv_device"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
@ -637,6 +643,7 @@
android:layout_height="20dp"
/>
<TextView
android:id="@+id/tv_usable"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
@ -668,6 +675,7 @@
android:layout_height="20dp"
/>
<TextView
android:id="@+id/tv_available"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
@ -700,6 +708,7 @@
android:layout_height="20dp"
/>
<TextView
android:id="@+id/tv_parking"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
@ -736,6 +745,7 @@
android:layout_height="20dp"
/>
<TextView
android:id="@+id/tv_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"

View File

@ -198,6 +198,7 @@
android:background="@drawable/plus" />
<TextView
android:id="@+id/tv_picture"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/image_picture"
@ -232,6 +233,7 @@
android:background="@drawable/plus" />
<TextView
android:id="@+id/tv_pictures"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/image_pictures"