图片存储问题,marker渲染
This commit is contained in:
parent
5ad871a254
commit
c65a11659d
@ -3,7 +3,7 @@ apply plugin: 'com.android.application'
|
|||||||
android {
|
android {
|
||||||
compileSdkVersion 29
|
compileSdkVersion 29
|
||||||
buildToolsVersion '29.0.2'
|
buildToolsVersion '29.0.2'
|
||||||
ndkVersion '23.0.7123448'
|
// ndkVersion '23.0.7123448'
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "com.navinfo.outdoor"
|
applicationId "com.navinfo.outdoor"
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
package com.navinfo.outdoor.activity;
|
package com.navinfo.outdoor.activity;
|
||||||
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import com.navinfo.outdoor.R;
|
import com.navinfo.outdoor.R;
|
||||||
import com.navinfo.outdoor.base.BaseActivity;
|
import com.navinfo.outdoor.base.BaseActivity;
|
||||||
import com.navinfo.outdoor.fragment.AboutFragment;
|
import com.navinfo.outdoor.fragment.AboutFragment;
|
||||||
|
@ -73,7 +73,6 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
|||||||
private Button btnSaveLocal;
|
private Button btnSaveLocal;
|
||||||
private PoiDatabase poiDatabase;
|
private PoiDatabase poiDatabase;
|
||||||
private String inode;
|
private String inode;
|
||||||
private List<String> photoBean;
|
|
||||||
private CheckBox checkBoxLife, checkBoxRight;
|
private CheckBox checkBoxLife, checkBoxRight;
|
||||||
private Spinner spinnerType, spinnerScutcheon, spinnerStake;
|
private Spinner spinnerType, spinnerScutcheon, spinnerStake;
|
||||||
String[] type = new String[]{"地上五层", "地上四层", "地上三层", "地上二层", "地上一层", "地下一层", "地下二层", "地下三层", "地下四层", "地下五层"};
|
String[] type = new String[]{"地上五层", "地上四层", "地上三层", "地上二层", "地上一层", "地下一层", "地下二层", "地下三层", "地下四层", "地下五层"};
|
||||||
@ -390,61 +389,111 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
|||||||
}
|
}
|
||||||
int sign_exist = chargingPileEntity.getSign_exist();
|
int sign_exist = chargingPileEntity.getSign_exist();
|
||||||
spinnerScutcheon.setSelection(sign_exist, true);
|
spinnerScutcheon.setSelection(sign_exist, true);
|
||||||
|
if (sign_exist == 0) {
|
||||||
|
rlFacility.setBackgroundColor(Color.parseColor("#EFEDED"));
|
||||||
|
rlScutcheon.setVisibility(View.GONE);
|
||||||
|
rlDevice.setVisibility(View.GONE);
|
||||||
|
} else if (sign_exist == 1) {
|
||||||
|
rlFacility.setBackgroundColor(Color.parseColor("#03A9F4"));
|
||||||
|
rlScutcheon.setVisibility(View.VISIBLE);
|
||||||
|
rlDevice.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
int cp_availableState = chargingPileEntity.getCp_availableState();
|
int cp_availableState = chargingPileEntity.getCp_availableState();
|
||||||
spinnerStake.setSelection(cp_availableState, true);
|
spinnerStake.setSelection(cp_availableState, true);
|
||||||
int cp_floor = chargingPileEntity.getCp_floor();
|
int cp_floor = chargingPileEntity.getCp_floor();
|
||||||
spinnerType.setSelection(cp_floor, true);
|
spinnerType.setSelection(cp_floor, true);
|
||||||
|
|
||||||
if (chargingPileEntity.getPhotos() != null) {
|
if (chargingPileEntity.getPhotos() != null) {
|
||||||
photoBean.clear();
|
ArrayList<String> cList = new ArrayList<>();
|
||||||
|
ArrayList<String> dList = new ArrayList<>();
|
||||||
|
ArrayList<String> eList = new ArrayList<>();
|
||||||
for (int i = 0; i < chargingPileEntity.getPhotos().size(); i++) {
|
for (int i = 0; i < chargingPileEntity.getPhotos().size(); i++) {
|
||||||
String photo = chargingPileEntity.getPhotos().get(i);
|
String photo = chargingPileEntity.getPhotos().get(i);
|
||||||
String[] split = photo.split("/");
|
String[] split = photo.split("/");
|
||||||
char charAt = split[6].charAt(0);
|
if (split[split.length - 1].startsWith("a")) {
|
||||||
if (charAt == 'a') {
|
|
||||||
Glide.with(getActivity()).load(photo).into(ivPanorama);
|
Glide.with(getActivity()).load(photo).into(ivPanorama);
|
||||||
photoBean.add(photo);
|
ivPanorama.setTag(photo);
|
||||||
} else if (charAt == 'b') {
|
} else if (split[split.length - 1].startsWith("b")) {
|
||||||
Glide.with(getActivity()).load(photo).into(ivCoding);
|
Glide.with(getActivity()).load(photo).into(ivCoding);
|
||||||
photoBean.add(photo);
|
ivCoding.setTag(photo);
|
||||||
} else if (charAt == 'c') {
|
} else if (split[split.length - 1].startsWith("c")) {
|
||||||
char charAtc = split[6].charAt(1);
|
cList.add(photo);
|
||||||
if (charAtc == '1') {
|
} else if (split[split.length - 1].startsWith("d")) {
|
||||||
Glide.with(getActivity()).load(photo).into(ivEquipment);
|
dList.add(photo);
|
||||||
photoBean.add(photo);
|
} else if (split[split.length - 1].startsWith("e")) {
|
||||||
} else if (charAtc == '2') {
|
eList.add(photo);
|
||||||
Glide.with(getActivity()).load(photo).into(ivFacility);
|
|
||||||
photoBean.add(photo);
|
|
||||||
} else if (charAtc == '3') {
|
|
||||||
Glide.with(getActivity()).load(photo).into(ivScutcheon);
|
|
||||||
photoBean.add(photo);
|
|
||||||
} else if (charAtc == '4') {
|
|
||||||
Glide.with(getActivity()).load(photo).into(ivDevice);
|
|
||||||
photoBean.add(photo);
|
|
||||||
}
|
|
||||||
} else if (charAt == 'd') {
|
|
||||||
char charAtd = split[6].charAt(1);
|
|
||||||
if (charAtd == '1') {
|
|
||||||
Glide.with(getActivity()).load(photo).into(ivUsable);
|
|
||||||
photoBean.add(photo);
|
|
||||||
} else if (charAtd == '2') {
|
|
||||||
Glide.with(getActivity()).load(photo).into(ivAvailable);
|
|
||||||
photoBean.add(photo);
|
|
||||||
}
|
|
||||||
} else if (charAt == 'e') {
|
|
||||||
char charAte =split[6].charAt(1);
|
|
||||||
if (charAte == '1') {
|
|
||||||
Glide.with(getActivity()).load(photo).into(ivParking);
|
|
||||||
photoBean.add(photo);
|
|
||||||
} else if (charAte == '2') {
|
|
||||||
Glide.with(getActivity()).load(photo).into(ivNumber);
|
|
||||||
photoBean.add(photo);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
setCList(cList);
|
||||||
|
setDList(dList);
|
||||||
|
setEList(eList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setCList(ArrayList<String> list) {
|
||||||
|
switch (list.size()) {
|
||||||
|
case 1:
|
||||||
|
Glide.with(getActivity()).load(list.get(0)).into(ivEquipment);
|
||||||
|
ivEquipment.setTag(list.get(0));
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
Glide.with(getActivity()).load(list.get(0)).into(ivEquipment);
|
||||||
|
ivEquipment.setTag(list.get(0));
|
||||||
|
Glide.with(getActivity()).load(list.get(1)).into(ivFacility);
|
||||||
|
ivFacility.setTag(list.get(1));
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
Glide.with(getActivity()).load(list.get(0)).into(ivEquipment);
|
||||||
|
ivEquipment.setTag(list.get(0));
|
||||||
|
Glide.with(getActivity()).load(list.get(1)).into(ivFacility);
|
||||||
|
ivFacility.setTag(list.get(1));
|
||||||
|
Glide.with(getActivity()).load(list.get(2)).into(ivScutcheon);
|
||||||
|
ivScutcheon.setTag(list.get(2));
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
Glide.with(getActivity()).load(list.get(0)).into(ivEquipment);
|
||||||
|
ivEquipment.setTag(list.get(0));
|
||||||
|
Glide.with(getActivity()).load(list.get(1)).into(ivFacility);
|
||||||
|
ivFacility.setTag(list.get(1));
|
||||||
|
Glide.with(getActivity()).load(list.get(2)).into(ivScutcheon);
|
||||||
|
ivScutcheon.setTag(list.get(2));
|
||||||
|
Glide.with(getActivity()).load(list.get(3)).into(ivDevice);
|
||||||
|
ivDevice.setTag(list.get(3));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDList(ArrayList<String> list) {
|
||||||
|
switch (list.size()) {
|
||||||
|
case 1:
|
||||||
|
Glide.with(getActivity()).load(list.get(0)).into(ivUsable);
|
||||||
|
ivUsable.setTag(list.get(0));
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
Glide.with(getActivity()).load(list.get(0)).into(ivUsable);
|
||||||
|
ivUsable.setTag(list.get(0));
|
||||||
|
Glide.with(getActivity()).load(list.get(1)).into(ivAvailable);
|
||||||
|
ivAvailable.setTag(list.get(1));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEList(ArrayList<String> list) {
|
||||||
|
switch (list.size()) {
|
||||||
|
case 1:
|
||||||
|
Glide.with(getActivity()).load(list.get(0)).into(ivParking);
|
||||||
|
ivParking.setTag(list.get(0));
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
Glide.with(getActivity()).load(list.get(0)).into(ivParking);
|
||||||
|
ivParking.setTag(list.get(0));
|
||||||
|
Glide.with(getActivity()).load(list.get(1)).into(ivNumber);
|
||||||
|
ivNumber.setTag(list.get(1));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//禁用所有可操作性控件
|
//禁用所有可操作性控件
|
||||||
private void disables() {
|
private void disables() {
|
||||||
@ -457,9 +506,6 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
|||||||
@Override
|
@Override
|
||||||
protected void initData() {
|
protected void initData() {
|
||||||
super.initData();
|
super.initData();
|
||||||
//存储图片地址
|
|
||||||
photoBean = new ArrayList<>();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -484,6 +530,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
|||||||
if (all) {
|
if (all) {
|
||||||
//保存数据库:
|
//保存数据库:
|
||||||
ChargingPileEntity chargingPileEntity = new ChargingPileEntity();
|
ChargingPileEntity chargingPileEntity = new ChargingPileEntity();
|
||||||
|
ArrayList<String> photoBean = new ArrayList<>();
|
||||||
if (inode == null || inode.equals("")) {
|
if (inode == null || inode.equals("")) {
|
||||||
Toast.makeText(getActivity(), "请确定点位", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), "请确定点位", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
@ -500,12 +547,84 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
|||||||
if (cp_floor != 0) {
|
if (cp_floor != 0) {
|
||||||
chargingPileEntity.setCp_floor(cp_floor);
|
chargingPileEntity.setCp_floor(cp_floor);
|
||||||
}
|
}
|
||||||
if (photoBean.size() < 4) {
|
String tagPanorama = (String) ivPanorama.getTag();
|
||||||
Toast.makeText(getActivity(), "请拍照", Toast.LENGTH_SHORT).show();
|
if (tagPanorama == null || tagPanorama.equals("")) {
|
||||||
|
Toast.makeText(getActivity(), "请拍照 全景图", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
chargingPileEntity.setPhotos(photoBean);
|
photoBean.add(tagPanorama);
|
||||||
}
|
}
|
||||||
|
String tagCoding = (String) ivCoding.getTag();
|
||||||
|
if (tagCoding == null || tagCoding.equals("")) {
|
||||||
|
Toast.makeText(getActivity(), "请拍照 充电桩编码", Toast.LENGTH_SHORT).show();
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
photoBean.add(tagCoding);
|
||||||
|
}
|
||||||
|
String tagEquipment = (String) ivEquipment.getTag();
|
||||||
|
if (tagEquipment == null || tagEquipment.equals("")) {
|
||||||
|
Toast.makeText(getActivity(), "请拍照 设备编码", Toast.LENGTH_SHORT).show();
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
photoBean.add(tagEquipment);
|
||||||
|
}
|
||||||
|
String tagFacility = (String) ivFacility.getTag();
|
||||||
|
if (sign_exist != 0) {
|
||||||
|
if (tagFacility == null || tagFacility.equals("")) {
|
||||||
|
Toast.makeText(getActivity(), "请拍照 设备编码", Toast.LENGTH_SHORT).show();
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
photoBean.add(tagFacility);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (tagFacility != null || !tagFacility.equals("")) {
|
||||||
|
photoBean.add(tagFacility);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String tagScutcheon = (String) ivScutcheon.getTag();
|
||||||
|
if (sign_exist == 1) {
|
||||||
|
if (tagScutcheon == null || tagScutcheon.equals("")) {
|
||||||
|
Toast.makeText(getActivity(), "请拍照 设备编码", Toast.LENGTH_SHORT).show();
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
photoBean.add(tagScutcheon);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String tagDevice = (String) ivDevice.getTag();
|
||||||
|
if (sign_exist == 1) {
|
||||||
|
if (tagDevice == null || tagDevice.equals("")) {
|
||||||
|
Toast.makeText(getActivity(), "请拍照 设备编码", Toast.LENGTH_SHORT).show();
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
photoBean.add(tagDevice);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String tagUsable = (String) ivUsable.getTag();
|
||||||
|
if (tagUsable == null || tagUsable.equals("")) {
|
||||||
|
Toast.makeText(getActivity(), "请拍照 可用状态", Toast.LENGTH_SHORT).show();
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
photoBean.add(tagUsable);
|
||||||
|
}
|
||||||
|
String tagAvailable = (String) ivAvailable.getTag();
|
||||||
|
if (tagAvailable != null || !tagAvailable.equals("")) {
|
||||||
|
photoBean.add(tagAvailable);
|
||||||
|
}
|
||||||
|
String tagParking = (String) ivParking.getTag();
|
||||||
|
if (tagParking == null || tagParking.equals("")) {
|
||||||
|
Toast.makeText(getActivity(), "请拍照 停车位编号", Toast.LENGTH_SHORT).show();
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
photoBean.add(tagPanorama);
|
||||||
|
}
|
||||||
|
String tagNumber = (String) ivNumber.getTag();
|
||||||
|
if (tagNumber != null || !tagNumber.equals("")) {
|
||||||
|
photoBean.add(tagNumber);
|
||||||
|
}
|
||||||
|
chargingPileEntity.setPhotos(photoBean);
|
||||||
chargingPileEntity.setSign_exist(sign_exist);
|
chargingPileEntity.setSign_exist(sign_exist);
|
||||||
chargingPileEntity.setCp_availableState(cp_availableState);
|
chargingPileEntity.setCp_availableState(cp_availableState);
|
||||||
String describe = editDescribe.getText().toString().trim();
|
String describe = editDescribe.getText().toString().trim();
|
||||||
@ -612,6 +731,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
|||||||
SharedPreferences.Editor edit = poi.edit();
|
SharedPreferences.Editor edit = poi.edit();
|
||||||
//根据要保存的数据的类型,调用对应的put方法,
|
//根据要保存的数据的类型,调用对应的put方法,
|
||||||
ChargingPileEntity chargingPileEntity = new ChargingPileEntity();
|
ChargingPileEntity chargingPileEntity = new ChargingPileEntity();
|
||||||
|
ArrayList<String> photo = new ArrayList<>();
|
||||||
if (inode != null) {
|
if (inode != null) {
|
||||||
chargingPileEntity.setP(inode);
|
chargingPileEntity.setP(inode);
|
||||||
}
|
}
|
||||||
@ -622,9 +742,47 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
|||||||
if (cp_floor != 0) {
|
if (cp_floor != 0) {
|
||||||
chargingPileEntity.setCp_floor(cp_floor);
|
chargingPileEntity.setCp_floor(cp_floor);
|
||||||
}
|
}
|
||||||
if (photoBean.size() > 0) {
|
String tagPanorama = (String) ivPanorama.getTag();
|
||||||
chargingPileEntity.setPhotos(photoBean);
|
if (tagPanorama != null) {
|
||||||
|
photo.add(tagPanorama);
|
||||||
}
|
}
|
||||||
|
String tagCoding = (String) ivCoding.getTag();
|
||||||
|
if (tagCoding != null) {
|
||||||
|
photo.add(tagCoding);
|
||||||
|
}
|
||||||
|
String tagEquipment = (String) ivEquipment.getTag();
|
||||||
|
if (tagEquipment != null) {
|
||||||
|
photo.add(tagEquipment);
|
||||||
|
}
|
||||||
|
String tagFacility = (String) ivFacility.getTag();
|
||||||
|
if (tagFacility != null) {
|
||||||
|
photo.add(tagFacility);
|
||||||
|
}
|
||||||
|
String tagScutcheon = (String) ivScutcheon.getTag();
|
||||||
|
if (tagScutcheon != null) {
|
||||||
|
photo.add(tagScutcheon);
|
||||||
|
}
|
||||||
|
String tagDevice = (String) ivDevice.getTag();
|
||||||
|
if (tagDevice != null) {
|
||||||
|
photo.add(tagDevice);
|
||||||
|
}
|
||||||
|
String tagUsable = (String) ivUsable.getTag();
|
||||||
|
if (tagUsable != null ) {
|
||||||
|
photo.add(tagUsable);
|
||||||
|
}
|
||||||
|
String tagAvailable = (String) ivAvailable.getTag();
|
||||||
|
if (tagAvailable != null) {
|
||||||
|
photo.add(tagAvailable);
|
||||||
|
}
|
||||||
|
String tagParking = (String) ivParking.getTag();
|
||||||
|
if (tagParking != null) {
|
||||||
|
photo.add(tagPanorama);
|
||||||
|
}
|
||||||
|
String tagNumber = (String) ivNumber.getTag();
|
||||||
|
if (tagNumber != null) {
|
||||||
|
photo.add(tagNumber);
|
||||||
|
}
|
||||||
|
chargingPileEntity.setPhotos(photo);
|
||||||
chargingPileEntity.setSign_exist(sign_exist);
|
chargingPileEntity.setSign_exist(sign_exist);
|
||||||
chargingPileEntity.setCp_availableState(cp_availableState);
|
chargingPileEntity.setCp_availableState(cp_availableState);
|
||||||
String describe = editDescribe.getText().toString().trim();
|
String describe = editDescribe.getText().toString().trim();
|
||||||
@ -662,7 +820,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "a");
|
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "a");
|
||||||
photoBean.add(takePhotoPath);
|
ivPanorama.setTag(takePhotoPath);
|
||||||
ivPanorama.setImageBitmap(bitmap);//显示图像
|
ivPanorama.setImageBitmap(bitmap);//显示图像
|
||||||
}
|
}
|
||||||
} else if (requestCode == 102 && resultCode == RESULT_OK) {
|
} else if (requestCode == 102 && resultCode == RESULT_OK) {
|
||||||
@ -682,7 +840,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "b");
|
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "b");
|
||||||
photoBean.add(takePhotoPath);
|
ivCoding.setTag(takePhotoPath);
|
||||||
ivCoding.setImageBitmap(bitmap);//显示图像
|
ivCoding.setImageBitmap(bitmap);//显示图像
|
||||||
}
|
}
|
||||||
} else if (requestCode == 103 && resultCode == RESULT_OK) {
|
} else if (requestCode == 103 && resultCode == RESULT_OK) {
|
||||||
@ -701,9 +859,9 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "c1");
|
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "c");
|
||||||
photoBean.add(takePhotoPath);
|
|
||||||
ivEquipment.setImageBitmap(bitmap);//显示图像
|
ivEquipment.setImageBitmap(bitmap);//显示图像
|
||||||
|
ivEquipment.setTag(takePhotoPath);
|
||||||
}
|
}
|
||||||
} else if (requestCode == 104 && resultCode == RESULT_OK) {
|
} else if (requestCode == 104 && resultCode == RESULT_OK) {
|
||||||
Bundle extras = data.getExtras();//从Intent中获取附加值
|
Bundle extras = data.getExtras();//从Intent中获取附加值
|
||||||
@ -721,8 +879,8 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "c2");
|
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "c");
|
||||||
photoBean.add(takePhotoPath);
|
ivFacility.setTag(takePhotoPath);
|
||||||
ivFacility.setImageBitmap(bitmap);//显示图像
|
ivFacility.setImageBitmap(bitmap);//显示图像
|
||||||
}
|
}
|
||||||
} else if (requestCode == 105 && resultCode == RESULT_OK) {
|
} else if (requestCode == 105 && resultCode == RESULT_OK) {
|
||||||
@ -741,8 +899,8 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "c3");
|
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "c");
|
||||||
photoBean.add(takePhotoPath);
|
ivScutcheon.setTag(takePhotoPath);
|
||||||
ivScutcheon.setImageBitmap(bitmap);//显示图像
|
ivScutcheon.setImageBitmap(bitmap);//显示图像
|
||||||
}
|
}
|
||||||
} else if (requestCode == 106 && resultCode == RESULT_OK) {
|
} else if (requestCode == 106 && resultCode == RESULT_OK) {
|
||||||
@ -761,8 +919,8 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "c4");
|
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "c");
|
||||||
photoBean.add(takePhotoPath);
|
ivDevice.setTag(takePhotoPath);
|
||||||
ivDevice.setImageBitmap(bitmap);//显示图像
|
ivDevice.setImageBitmap(bitmap);//显示图像
|
||||||
}
|
}
|
||||||
} else if (requestCode == 107 && resultCode == RESULT_OK) {
|
} else if (requestCode == 107 && resultCode == RESULT_OK) {
|
||||||
@ -781,8 +939,8 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "d1");
|
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "d");
|
||||||
photoBean.add(takePhotoPath);
|
ivUsable.setTag(takePhotoPath);
|
||||||
ivUsable.setImageBitmap(bitmap);//显示图像
|
ivUsable.setImageBitmap(bitmap);//显示图像
|
||||||
}
|
}
|
||||||
} else if (requestCode == 108 && resultCode == RESULT_OK) {
|
} else if (requestCode == 108 && resultCode == RESULT_OK) {
|
||||||
@ -801,8 +959,8 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "d2");
|
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "d");
|
||||||
photoBean.add(takePhotoPath);
|
ivAvailable.setTag(takePhotoPath);
|
||||||
ivAvailable.setImageBitmap(bitmap);//显示图像
|
ivAvailable.setImageBitmap(bitmap);//显示图像
|
||||||
}
|
}
|
||||||
} else if (requestCode == 109 && resultCode == RESULT_OK) {
|
} else if (requestCode == 109 && resultCode == RESULT_OK) {
|
||||||
@ -821,9 +979,9 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "e1");
|
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "e");
|
||||||
photoBean.add(takePhotoPath);
|
|
||||||
ivParking.setImageBitmap(bitmap);//显示图像
|
ivParking.setImageBitmap(bitmap);//显示图像
|
||||||
|
ivParking.setTag(takePhotoPath);
|
||||||
}
|
}
|
||||||
} else if (requestCode == 110 && resultCode == RESULT_OK) {
|
} else if (requestCode == 110 && resultCode == RESULT_OK) {
|
||||||
Bundle extras = data.getExtras();//从Intent中获取附加值
|
Bundle extras = data.getExtras();//从Intent中获取附加值
|
||||||
@ -841,10 +999,9 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "e2");
|
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "e");
|
||||||
photoBean.add(takePhotoPath);
|
|
||||||
|
|
||||||
ivNumber.setImageBitmap(bitmap);//显示图像
|
ivNumber.setImageBitmap(bitmap);//显示图像
|
||||||
|
ivNumber.setTag(takePhotoPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,6 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
private PoiDatabase poiDatabase;
|
private PoiDatabase poiDatabase;
|
||||||
private PoiDao poiDao;
|
private PoiDao poiDao;
|
||||||
private String inode;
|
private String inode;
|
||||||
private List<Info> photoBean;
|
|
||||||
private CheckBox checkBoxLife;
|
private CheckBox checkBoxLife;
|
||||||
private CheckBox checkBoxRight;
|
private CheckBox checkBoxRight;
|
||||||
private String phone;
|
private String phone;
|
||||||
@ -97,7 +96,6 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
private ChargingPileAdapter chargingPileAdapter;
|
private ChargingPileAdapter chargingPileAdapter;
|
||||||
private int station_type = 0;
|
private int station_type = 0;
|
||||||
private boolean aBoolean = false;
|
private boolean aBoolean = false;
|
||||||
private PoiEntity poiEntity;
|
|
||||||
private PoiEntity showPoiEntity;
|
private PoiEntity showPoiEntity;
|
||||||
private ChargingPileDao chargingPileDao;
|
private ChargingPileDao chargingPileDao;
|
||||||
|
|
||||||
@ -305,6 +303,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
//disables();
|
//disables();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initShowPoi() {
|
private void initShowPoi() {
|
||||||
// 添加信息:
|
// 添加信息:
|
||||||
showPoiEntity = (PoiEntity) getArguments().getSerializable("poiEntity");
|
showPoiEntity = (PoiEntity) getArguments().getSerializable("poiEntity");
|
||||||
@ -333,27 +332,24 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (showPoiEntity.getPhotoInfo() != null) {
|
if (showPoiEntity.getPhotoInfo() != null) {
|
||||||
photoBean.clear();
|
|
||||||
for (int i = 0; i < showPoiEntity.getPhotoInfo().size(); i++) {
|
for (int i = 0; i < showPoiEntity.getPhotoInfo().size(); i++) {
|
||||||
String photo =showPoiEntity.getPhotoInfo().get(i).getPhoto();
|
String photo = showPoiEntity.getPhotoInfo().get(i).getPhoto();
|
||||||
String[] split = photo.split("/");
|
String[] split = photo.split("/");
|
||||||
char charAt = split[6].charAt(0);
|
if (split[split.length - 1].startsWith("a")) {
|
||||||
if (charAt=='a'){
|
|
||||||
Glide.with(getActivity()).load(photo).into(ivPanorama);
|
Glide.with(getActivity()).load(photo).into(ivPanorama);
|
||||||
photoBean.add(new Info(photo));
|
ivPanorama.setTag(photo);
|
||||||
}else if (charAt=='b'){
|
} else if (split[split.length - 1].startsWith("b")) {
|
||||||
Glide.with(getActivity()).load(photo).into(ivName);
|
Glide.with(getActivity()).load(photo).into(ivName);
|
||||||
photoBean.add(new Info(photo));
|
ivName.setTag(photo);
|
||||||
}else if (charAt=='c'){
|
} else if (split[split.length - 1].startsWith("c")) {
|
||||||
Glide.with(getActivity()).load(photo).into(ivInternal);
|
Glide.with(getActivity()).load(photo).into(ivInternal);
|
||||||
photoBean.add(new Info(photo));
|
ivInternal.setTag(photo);
|
||||||
}else if (charAt=='d'){
|
} else if (split[split.length - 1].startsWith("d")) {
|
||||||
Glide.with(getActivity()).load(photo).into(ivElse);
|
Glide.with(getActivity()).load(photo).into(ivElse);
|
||||||
photoBean.add(new Info(photo));
|
ivElse.setTag(photo);
|
||||||
|
} else if (split[split.length - 1].startsWith("e")) {
|
||||||
}else if (charAt=='e'){
|
|
||||||
Glide.with(getActivity()).load(photo).into(ivScutcheon);
|
Glide.with(getActivity()).load(photo).into(ivScutcheon);
|
||||||
photoBean.add(new Info(photo));
|
ivScutcheon.setTag(photo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -379,7 +375,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
ChargingPileEntity chargingPileEntity = (ChargingPileEntity) getArguments().getSerializable("chargingPileEntity");
|
ChargingPileEntity chargingPileEntity = (ChargingPileEntity) getArguments().getSerializable("chargingPileEntity");
|
||||||
if (chargingPileEntity!=null){
|
if (chargingPileEntity != null) {
|
||||||
Message obtains = Message.obtain();
|
Message obtains = Message.obtain();
|
||||||
obtains.what = Constant.CHARGING_STATION_PILE;
|
obtains.what = Constant.CHARGING_STATION_PILE;
|
||||||
obtains.obj = chargingPileEntity;
|
obtains.obj = chargingPileEntity;
|
||||||
@ -410,9 +406,6 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
poiBeans = new ArrayList<>();
|
poiBeans = new ArrayList<>();
|
||||||
//存储手机号
|
//存储手机号
|
||||||
phoneData = new ArrayList<>();
|
phoneData = new ArrayList<>();
|
||||||
//存储图片地址
|
|
||||||
photoBean = new ArrayList<>();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -442,7 +435,8 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
public void onGranted(List<String> permissions, boolean all) {
|
public void onGranted(List<String> permissions, boolean all) {
|
||||||
if (all) {
|
if (all) {
|
||||||
//保存数据库:
|
//保存数据库:
|
||||||
poiEntity = new PoiEntity();
|
PoiEntity poiEntity = new PoiEntity();
|
||||||
|
List<Info> infoPhoto = new ArrayList<>();
|
||||||
String name = editNameContent.getText().toString().trim();//名称
|
String name = editNameContent.getText().toString().trim();//名称
|
||||||
if (name == null || name.equals("")) {
|
if (name == null || name.equals("")) {
|
||||||
Toast.makeText(getActivity(), "请输入充电站 名称", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), "请输入充电站 名称", Toast.LENGTH_SHORT).show();
|
||||||
@ -478,12 +472,44 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
} else {
|
} else {
|
||||||
poiEntity.setTelPhone(phoneData.get(0));
|
poiEntity.setTelPhone(phoneData.get(0));
|
||||||
}
|
}
|
||||||
if (photoBean.size() != 6) {
|
|
||||||
Toast.makeText(getActivity(), "请拍照", Toast.LENGTH_SHORT).show();
|
String tagPanorama = (String) ivPanorama.getTag();
|
||||||
|
if (tagPanorama == null || tagPanorama.equals("")) {
|
||||||
|
Toast.makeText(getActivity(), "请拍照 全景图", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
poiEntity.setPhotoInfo(photoBean);
|
infoPhoto.add(new Info(tagPanorama));
|
||||||
}
|
}
|
||||||
|
String tagName = (String) ivName.getTag();
|
||||||
|
if (tagName == null || tagName.equals("")) {
|
||||||
|
Toast.makeText(getActivity(), "请拍照 充电桩编码", Toast.LENGTH_SHORT).show();
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
infoPhoto.add(new Info(tagName));
|
||||||
|
}
|
||||||
|
String tagInternal = (String) ivInternal.getTag();
|
||||||
|
if (tagInternal == null || tagInternal.equals("")) {
|
||||||
|
Toast.makeText(getActivity(), "请拍照 设备编码", Toast.LENGTH_SHORT).show();
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
infoPhoto.add(new Info(tagInternal));
|
||||||
|
}
|
||||||
|
String tagElse = (String) ivElse.getTag();
|
||||||
|
if (tagElse == null || tagElse.equals("")) {
|
||||||
|
Toast.makeText(getActivity(), "请拍照 设备编码", Toast.LENGTH_SHORT).show();
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
infoPhoto.add(new Info(tagElse));
|
||||||
|
}
|
||||||
|
String tagScutcheon = (String) ivScutcheon.getTag();
|
||||||
|
if (tagScutcheon == null || tagScutcheon.equals("")) {
|
||||||
|
Toast.makeText(getActivity(), "请拍照 设备编码", Toast.LENGTH_SHORT).show();
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
infoPhoto.add(new Info(tagScutcheon));
|
||||||
|
}
|
||||||
|
|
||||||
|
poiEntity.setPhotoInfo(infoPhoto);
|
||||||
poiEntity.setStation_type(station_type);
|
poiEntity.setStation_type(station_type);
|
||||||
if (!aBoolean) {
|
if (!aBoolean) {
|
||||||
Toast.makeText(getActivity(), "请添加桩", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), "请添加桩", Toast.LENGTH_SHORT).show();
|
||||||
@ -569,7 +595,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
/**
|
/**
|
||||||
* 防止当页面崩溃后出现数据丢失
|
* 防止当页面崩溃后出现数据丢失
|
||||||
*/
|
*/
|
||||||
public void initStationSharePre(){
|
public void initStationSharePre() {
|
||||||
//获取SharedPreferences对象,方法中两个参数的意思为:第一个name
|
//获取SharedPreferences对象,方法中两个参数的意思为:第一个name
|
||||||
//表示文件名,系统将会在/dada/dada/包名/shared_prefs目录下生成
|
//表示文件名,系统将会在/dada/dada/包名/shared_prefs目录下生成
|
||||||
//一个以该参数命名的.xml文件。第二个mode表示创建的模式,通过查看
|
//一个以该参数命名的.xml文件。第二个mode表示创建的模式,通过查看
|
||||||
@ -579,7 +605,8 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
SharedPreferences.Editor edit = poi.edit();
|
SharedPreferences.Editor edit = poi.edit();
|
||||||
//根据要保存的数据的类型,调用对应的put方法,
|
//根据要保存的数据的类型,调用对应的put方法,
|
||||||
|
|
||||||
poiEntity = new PoiEntity();
|
PoiEntity poiEntity = new PoiEntity();
|
||||||
|
List<Info> infoPhoto = new ArrayList<>();
|
||||||
String name = editNameContent.getText().toString().trim();//名称
|
String name = editNameContent.getText().toString().trim();//名称
|
||||||
if (name != null || !name.equals("")) {
|
if (name != null || !name.equals("")) {
|
||||||
poiEntity.setName(name);
|
poiEntity.setName(name);
|
||||||
@ -588,7 +615,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
if (site != null || !site.equals("")) {
|
if (site != null || !site.equals("")) {
|
||||||
poiEntity.setAddress(site);
|
poiEntity.setAddress(site);
|
||||||
}
|
}
|
||||||
if (inode != null ) {
|
if (inode != null) {
|
||||||
String[] split = inode.split(",");
|
String[] split = inode.split(",");
|
||||||
poiEntity.setX(split[0]);
|
poiEntity.setX(split[0]);
|
||||||
poiEntity.setY(split[1]);
|
poiEntity.setY(split[1]);
|
||||||
@ -600,9 +627,27 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
if (phoneData.size() > 0) {
|
if (phoneData.size() > 0) {
|
||||||
poiEntity.setTelPhone(phoneData.get(0));
|
poiEntity.setTelPhone(phoneData.get(0));
|
||||||
}
|
}
|
||||||
if (photoBean.size() > 0) {
|
String tagPanorama = (String) ivPanorama.getTag();
|
||||||
poiEntity.setPhotoInfo(photoBean);
|
if (tagPanorama != null) {
|
||||||
|
infoPhoto.add(new Info(tagPanorama));
|
||||||
}
|
}
|
||||||
|
String tagName = (String) ivName.getTag();
|
||||||
|
if (tagName != null) {
|
||||||
|
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 tagScutcheon = (String) ivScutcheon.getTag();
|
||||||
|
if (tagScutcheon != null ) {
|
||||||
|
infoPhoto.add(new Info(tagScutcheon));
|
||||||
|
}
|
||||||
|
poiEntity.setPhotoInfo(infoPhoto);
|
||||||
poiEntity.setStation_type(station_type);
|
poiEntity.setStation_type(station_type);
|
||||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
Calendar calendar = Calendar.getInstance();
|
Calendar calendar = Calendar.getInstance();
|
||||||
@ -617,7 +662,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
edit.putString("poiEntity", newPoiEntity);
|
edit.putString("poiEntity", newPoiEntity);
|
||||||
//提交新值。必须执行,否则前面的操作都无效。
|
//提交新值。必须执行,否则前面的操作都无效。
|
||||||
edit.commit();
|
edit.commit();
|
||||||
Log.d("TAG", "initPoiSharePre: "+newPoiEntity);
|
Log.d("TAG", "initPoiSharePre: " + newPoiEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -639,8 +684,8 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data,"a");
|
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "a");
|
||||||
photoBean.add(new Info(takePhotoPath));
|
ivPanorama.setTag(takePhotoPath);
|
||||||
ivPanorama.setImageBitmap(bitmap);//显示图像
|
ivPanorama.setImageBitmap(bitmap);//显示图像
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -660,8 +705,8 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data,"b");
|
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "b");
|
||||||
photoBean.add(new Info(takePhotoPath));
|
ivName.setTag(takePhotoPath);
|
||||||
ivName.setImageBitmap(bitmap);//显示图像
|
ivName.setImageBitmap(bitmap);//显示图像
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -681,8 +726,8 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data,"c");
|
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "c");
|
||||||
photoBean.add(new Info(takePhotoPath));
|
ivInternal.setTag(takePhotoPath);
|
||||||
ivInternal.setImageBitmap(bitmap);//显示图像
|
ivInternal.setImageBitmap(bitmap);//显示图像
|
||||||
}
|
}
|
||||||
} else if (requestCode == 104 && resultCode == RESULT_OK) {
|
} else if (requestCode == 104 && resultCode == RESULT_OK) {
|
||||||
@ -701,8 +746,8 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data,"d");
|
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "d");
|
||||||
photoBean.add(new Info(takePhotoPath));
|
ivElse.setTag(takePhotoPath);
|
||||||
ivElse.setImageBitmap(bitmap);//显示图像
|
ivElse.setImageBitmap(bitmap);//显示图像
|
||||||
}
|
}
|
||||||
} else if (requestCode == 105 && resultCode == RESULT_OK) {
|
} else if (requestCode == 105 && resultCode == RESULT_OK) {
|
||||||
@ -721,8 +766,8 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data,"e");
|
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "e");
|
||||||
photoBean.add(new Info(takePhotoPath));
|
ivScutcheon.setTag(takePhotoPath);
|
||||||
ivScutcheon.setImageBitmap(bitmap);//显示图像
|
ivScutcheon.setImageBitmap(bitmap);//显示图像
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,20 +62,17 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
|||||||
|
|
||||||
|
|
||||||
private Spinner spinnerOther;
|
private Spinner spinnerOther;
|
||||||
String[] others = new String[]{"下拉选择", "门牌","道路施工","标牌采集","公交","其他"};
|
String[] others = new String[]{"下拉选择", "门牌", "道路施工", "标牌采集", "公交", "其他"};
|
||||||
private String inode;
|
private String inode;
|
||||||
private EditText editTaskName,editOtherDescribe;
|
private EditText editTaskName, editOtherDescribe;
|
||||||
private RelativeLayout rlPicture;
|
private RelativeLayout rlPicture;
|
||||||
private ImageView ivPicture;
|
private ImageView ivPicture;
|
||||||
private RelativeLayout rlPictures;
|
private RelativeLayout rlPictures;
|
||||||
private ImageView ivPictures;
|
private ImageView ivPictures;
|
||||||
private Button btnOtherLocal;
|
private Button btnOtherLocal;
|
||||||
private Button btnOtherUploading;
|
private Button btnOtherUploading;
|
||||||
private List<Info> photoBean;
|
|
||||||
private PoiDatabase poiDatabase;
|
private PoiDatabase poiDatabase;
|
||||||
private PoiDao poiDao;
|
private PoiDao poiDao;
|
||||||
private boolean aBoolean=false;
|
|
||||||
private boolean bBoolean=false;
|
|
||||||
private PoiEntity showPoiEntity;
|
private PoiEntity showPoiEntity;
|
||||||
|
|
||||||
public static OtherFragment newInstance(Bundle bundle) {
|
public static OtherFragment newInstance(Bundle bundle) {
|
||||||
@ -88,6 +85,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
|||||||
protected int getLayout() {
|
protected int getLayout() {
|
||||||
return R.layout.fragment_other;
|
return R.layout.fragment_other;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStart() {
|
public void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
@ -96,6 +94,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
@ -108,26 +107,27 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
Bundle arguments = getArguments();
|
Bundle arguments = getArguments();
|
||||||
if (arguments!=null) {
|
if (arguments != null) {
|
||||||
isSliding= arguments.getBoolean("isSliding",true);
|
isSliding = arguments.getBoolean("isSliding", true);
|
||||||
Log.d("TAG", "onCreatessss: "+isSliding);
|
Log.d("TAG", "onCreatessss: " + isSliding);
|
||||||
}
|
}
|
||||||
if (isSliding) {
|
if (isSliding) {
|
||||||
// 监听到返回按钮点击事件
|
// 监听到返回按钮点击事件
|
||||||
Message obtain = Message.obtain();
|
Message obtain = Message.obtain();
|
||||||
obtain.what= Constant.TREASURE_FRAGMENT;
|
obtain.what = Constant.TREASURE_FRAGMENT;
|
||||||
obtain.obj=isSliding;
|
obtain.obj = isSliding;
|
||||||
EventBus.getDefault().post(obtain);
|
EventBus.getDefault().post(obtain);
|
||||||
|
|
||||||
Message mainButtonVisiableMsg = Message.obtain();
|
Message mainButtonVisiableMsg = Message.obtain();
|
||||||
mainButtonVisiableMsg.what= Constant.MAIN_BUTTON_VISIABLE;
|
mainButtonVisiableMsg.what = Constant.MAIN_BUTTON_VISIABLE;
|
||||||
mainButtonVisiableMsg.obj= View.VISIBLE;
|
mainButtonVisiableMsg.obj = View.VISIBLE;
|
||||||
EventBus.getDefault().post(mainButtonVisiableMsg);
|
EventBus.getDefault().post(mainButtonVisiableMsg);
|
||||||
}
|
}
|
||||||
onBackPressed();
|
onBackPressed();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initView() {
|
protected void initView() {
|
||||||
super.initView();
|
super.initView();
|
||||||
@ -161,8 +161,11 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNothingSelected(AdapterView<?> parent) {}
|
public void onNothingSelected(AdapterView<?> parent) {
|
||||||
|
|
||||||
|
}
|
||||||
});
|
});
|
||||||
CheckBox checkPot = findViewById(R.id.check_pot);
|
CheckBox checkPot = findViewById(R.id.check_pot);
|
||||||
checkPot.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
checkPot.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
@ -190,6 +193,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
|||||||
initShowPoi();
|
initShowPoi();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onEvent(Message data) {
|
public void onEvent(Message data) {
|
||||||
if (data.what == Constant.OTHER_WORD) {
|
if (data.what == Constant.OTHER_WORD) {
|
||||||
@ -197,12 +201,10 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
|||||||
Toast.makeText(getContext(), inode, Toast.LENGTH_SHORT).show();
|
Toast.makeText(getContext(), inode, Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initData() {
|
protected void initData() {
|
||||||
super.initData();
|
super.initData();
|
||||||
//存储图片地址
|
|
||||||
photoBean = new ArrayList<>();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initShowPoi() {
|
private void initShowPoi() {
|
||||||
@ -211,32 +213,25 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
|||||||
if (showPoiEntity != null) {
|
if (showPoiEntity != null) {
|
||||||
String name = showPoiEntity.getName();//名称
|
String name = showPoiEntity.getName();//名称
|
||||||
if (name != null || !name.equals("")) {
|
if (name != null || !name.equals("")) {
|
||||||
editTaskName.setText(name + "");
|
editTaskName.setText(name + ""); }
|
||||||
}
|
|
||||||
String x = showPoiEntity.getX();
|
String x = showPoiEntity.getX();
|
||||||
String y = showPoiEntity.getY();
|
String y = showPoiEntity.getY();
|
||||||
if (x != null && y != null) {
|
if (x != null && y != null) {
|
||||||
inode = x + "," + y;
|
inode = x + "," + y; }
|
||||||
}
|
|
||||||
String describe = showPoiEntity.getDescribe();//任务描述
|
String describe = showPoiEntity.getDescribe();//任务描述
|
||||||
if (describe != null || !describe.equals("")) {
|
if (describe != null || !describe.equals("")) {
|
||||||
editOtherDescribe.setText(describe);
|
editOtherDescribe.setText(describe); }
|
||||||
}
|
|
||||||
if (showPoiEntity.getPhotoInfo() != null) {
|
if (showPoiEntity.getPhotoInfo() != null) {
|
||||||
photoBean.clear();
|
for (int i = 0; i < showPoiEntity.getPhotoInfo().size(); i++) {
|
||||||
for (int i = 0; i < showPoiEntity.getPhotoInfo().size(); i++) {
|
String photo = showPoiEntity.getPhotoInfo().get(i).getPhoto();
|
||||||
String photo =showPoiEntity.getPhotoInfo().get(i).getPhoto();
|
String[] split = photo.split("/");
|
||||||
String[] split = photo.split("/");
|
if (split[split.length - 1].startsWith("a")) {
|
||||||
char charAt = split[6].charAt(0);
|
Glide.with(getActivity()).load(photo).into(ivPicture);
|
||||||
if (charAt=='a'){
|
ivPicture.setTag(photo);
|
||||||
Glide.with(getActivity()).load(photo).into(ivPicture);
|
} else if (split[split.length - 1].startsWith("b")) {
|
||||||
photoBean.add(new Info(photo));
|
Glide.with(getActivity()).load(photo).into(ivPictures);
|
||||||
aBoolean=true;
|
ivPictures.setTag(photo);
|
||||||
}else if (charAt=='b'){
|
}
|
||||||
Glide.with(getActivity()).load(photo).into(ivPictures);
|
|
||||||
photoBean.add(new Info(photo));
|
|
||||||
bBoolean =true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -265,6 +260,8 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
|||||||
if (all) {
|
if (all) {
|
||||||
//保存数据库:
|
//保存数据库:
|
||||||
PoiEntity poiEntity = new PoiEntity();
|
PoiEntity poiEntity = new PoiEntity();
|
||||||
|
List<Info> infoList = new ArrayList<>();
|
||||||
|
|
||||||
String name = editTaskName.getText().toString().trim();//名称
|
String name = editTaskName.getText().toString().trim();//名称
|
||||||
if (name == null || name.equals("")) {
|
if (name == null || name.equals("")) {
|
||||||
Toast.makeText(getActivity(), "请输入poi 名称", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), "请输入poi 名称", Toast.LENGTH_SHORT).show();
|
||||||
@ -288,20 +285,21 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
|||||||
} else {
|
} else {
|
||||||
poiEntity.setDescribe(describe);
|
poiEntity.setDescribe(describe);
|
||||||
}
|
}
|
||||||
if (photoBean.size() < 0) {
|
String tagPicture = (String) ivPicture.getTag();
|
||||||
Toast.makeText(getActivity(), "请拍照", Toast.LENGTH_SHORT).show();
|
if (tagPicture == null || tagPicture.equals("")) {
|
||||||
|
Toast.makeText(getActivity(), "请 拍照", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
poiEntity.setPhotoInfo(photoBean);
|
infoList.add(new Info(tagPicture));
|
||||||
}
|
}
|
||||||
if (!aBoolean) {
|
String tagPictures = (String) ivPictures.getTag();
|
||||||
Toast.makeText(getActivity(), "请拍照 全景图", Toast.LENGTH_SHORT).show();
|
if (tagPictures == null || tagPictures.equals("")) {
|
||||||
return;
|
Toast.makeText(getActivity(), "请 拍照", Toast.LENGTH_SHORT).show();
|
||||||
}
|
|
||||||
if (!bBoolean) {
|
|
||||||
Toast.makeText(getActivity(), "请拍照 名称", Toast.LENGTH_SHORT).show();
|
|
||||||
return;
|
return;
|
||||||
|
} else {
|
||||||
|
infoList.add(new Info(tagPictures));
|
||||||
}
|
}
|
||||||
|
poiEntity.setPhotoInfo(infoList);
|
||||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
Calendar calendar = Calendar.getInstance();
|
Calendar calendar = Calendar.getInstance();
|
||||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||||
@ -337,10 +335,11 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 防止当页面崩溃后出现数据丢失
|
* 防止当页面崩溃后出现数据丢失
|
||||||
*/
|
*/
|
||||||
public void initOtherSharePre(){
|
public void initOtherSharePre() {
|
||||||
//获取SharedPreferences对象,方法中两个参数的意思为:第一个name
|
//获取SharedPreferences对象,方法中两个参数的意思为:第一个name
|
||||||
//表示文件名,系统将会在/dada/dada/包名/shared_prefs目录下生成
|
//表示文件名,系统将会在/dada/dada/包名/shared_prefs目录下生成
|
||||||
//一个以该参数命名的.xml文件。第二个mode表示创建的模式,通过查看
|
//一个以该参数命名的.xml文件。第二个mode表示创建的模式,通过查看
|
||||||
@ -350,6 +349,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
|||||||
SharedPreferences.Editor edit = poi.edit();
|
SharedPreferences.Editor edit = poi.edit();
|
||||||
//根据要保存的数据的类型,调用对应的put方法,
|
//根据要保存的数据的类型,调用对应的put方法,
|
||||||
PoiEntity poiEntity = new PoiEntity();
|
PoiEntity poiEntity = new PoiEntity();
|
||||||
|
ArrayList<Info> arrayList = new ArrayList<>();
|
||||||
String name = editTaskName.getText().toString().trim();//名称
|
String name = editTaskName.getText().toString().trim();//名称
|
||||||
if (name != null || !name.equals("")) {
|
if (name != null || !name.equals("")) {
|
||||||
poiEntity.setName(name);
|
poiEntity.setName(name);
|
||||||
@ -364,9 +364,15 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
|||||||
if (describe != null || !describe.equals("")) {
|
if (describe != null || !describe.equals("")) {
|
||||||
poiEntity.setDescribe(describe);
|
poiEntity.setDescribe(describe);
|
||||||
}
|
}
|
||||||
if (photoBean.size() >0) {
|
String tagPicture = (String) ivPicture.getTag();
|
||||||
poiEntity.setPhotoInfo(photoBean);
|
if (tagPicture != null) {
|
||||||
|
arrayList.add(new Info(tagPicture));
|
||||||
}
|
}
|
||||||
|
String tagPictures = (String) ivPictures.getTag();
|
||||||
|
if (tagPictures!= null) {
|
||||||
|
arrayList.add(new Info(tagPictures));
|
||||||
|
}
|
||||||
|
poiEntity.setPhotoInfo(arrayList);
|
||||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
Calendar calendar = Calendar.getInstance();
|
Calendar calendar = Calendar.getInstance();
|
||||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||||
@ -379,7 +385,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
|||||||
edit.putString("poiEntity", newPoiEntity);
|
edit.putString("poiEntity", newPoiEntity);
|
||||||
//提交新值。必须执行,否则前面的操作都无效。
|
//提交新值。必须执行,否则前面的操作都无效。
|
||||||
edit.commit();
|
edit.commit();
|
||||||
Log.d("TAG", "initPoiSharePre: "+newPoiEntity);
|
Log.d("TAG", "initPoiSharePre: " + newPoiEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -401,12 +407,10 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data,"a");//照片路径
|
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "a");//照片路径
|
||||||
photoBean.add(new Info(takePhotoPath));
|
ivPicture.setTag(takePhotoPath);
|
||||||
ivPicture.setImageBitmap(bitmap);//显示图像
|
ivPicture.setImageBitmap(bitmap);//显示图像
|
||||||
String[] split = takePhotoPath.split("/");
|
|
||||||
Log.d("TAG", "onActivityResult: "+takePhotoPath+" "+split[0]+" "+split[1]+" "+split[2]+" "+split[3]+" "+split[4]+" "+split[6]);
|
|
||||||
aBoolean=true;
|
|
||||||
}
|
}
|
||||||
} else if (requestCode == 102 && resultCode == RESULT_OK) {
|
} else if (requestCode == 102 && resultCode == RESULT_OK) {
|
||||||
Bundle extras = data.getExtras();//从Intent中获取附加值
|
Bundle extras = data.getExtras();//从Intent中获取附加值
|
||||||
@ -424,10 +428,9 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data,"b");//照片路径
|
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "b");//照片路径
|
||||||
photoBean.add(new Info(takePhotoPath));
|
ivPictures.setTag(takePhotoPath);
|
||||||
ivPictures.setImageBitmap(bitmap);//显示图像
|
ivPictures.setImageBitmap(bitmap);//显示图像
|
||||||
bBoolean=true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -79,9 +79,6 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
private PoiDatabase poiDatabase;
|
private PoiDatabase poiDatabase;
|
||||||
private PoiDao poiDao;
|
private PoiDao poiDao;
|
||||||
private String inode;
|
private String inode;
|
||||||
private List<Info> photoBean;
|
|
||||||
private boolean aBoolean = false;
|
|
||||||
private boolean bBoolean = false;
|
|
||||||
private CheckBox checkBoxLife;
|
private CheckBox checkBoxLife;
|
||||||
private CheckBox checkBoxRight;
|
private CheckBox checkBoxRight;
|
||||||
private PoiEntity showPoiEntity;
|
private PoiEntity showPoiEntity;
|
||||||
@ -248,27 +245,24 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
poiBeans.add(new PoiBean("电话*", telPhone, R.drawable.icon_add_bg));
|
poiBeans.add(new PoiBean("电话*", telPhone, R.drawable.icon_add_bg));
|
||||||
}
|
}
|
||||||
if (showPoiEntity.getPhotoInfo() != null) {
|
if (showPoiEntity.getPhotoInfo() != null) {
|
||||||
photoBean.clear();
|
|
||||||
for (int i = 0; i < showPoiEntity.getPhotoInfo().size(); i++) {
|
for (int i = 0; i < showPoiEntity.getPhotoInfo().size(); i++) {
|
||||||
String photo =showPoiEntity.getPhotoInfo().get(i).getPhoto();
|
String photo =showPoiEntity.getPhotoInfo().get(i).getPhoto();
|
||||||
String[] split = photo.split("/");
|
String[] split = photo.split("/");
|
||||||
char charAt = split[6].charAt(0);
|
if (split[split.length - 1].startsWith("a")){
|
||||||
if (charAt=='a'){
|
|
||||||
Glide.with(getActivity()).load(photo).into(ivPanorama);
|
Glide.with(getActivity()).load(photo).into(ivPanorama);
|
||||||
photoBean.add(new Info(photo));
|
ivPanorama.setTag(photo);
|
||||||
}else if (charAt=='b'){
|
}else if (split[split.length - 1].startsWith("b")){
|
||||||
Glide.with(getActivity()).load(photo).into(ivName);
|
Glide.with(getActivity()).load(photo).into(ivName);
|
||||||
photoBean.add(new Info(photo));
|
ivName.setTag(photo);
|
||||||
}else if (charAt=='c'){
|
}else if (split[split.length - 1].startsWith("c")){
|
||||||
Glide.with(getActivity()).load(photo).into(ivInternal);
|
Glide.with(getActivity()).load(photo).into(ivInternal);
|
||||||
photoBean.add(new Info(photo));
|
ivInternal.setTag(photo);
|
||||||
}else if (charAt=='d'){
|
}else if (split[split.length - 1].startsWith("d")){
|
||||||
Glide.with(getActivity()).load(photo).into(ivCard);
|
Glide.with(getActivity()).load(photo).into(ivCard);
|
||||||
photoBean.add(new Info(photo));
|
ivCard.setTag(photo);
|
||||||
|
}else if (split[split.length - 1].startsWith("e")){
|
||||||
}else if (charAt=='e'){
|
|
||||||
Glide.with(getActivity()).load(photo).into(ivElse);
|
Glide.with(getActivity()).load(photo).into(ivElse);
|
||||||
photoBean.add(new Info(photo));
|
ivElse.setTag(photo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -299,8 +293,6 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
poiBeans = new ArrayList<>();
|
poiBeans = new ArrayList<>();
|
||||||
//存储手机号
|
//存储手机号
|
||||||
phoneData = new ArrayList<>();
|
phoneData = new ArrayList<>();
|
||||||
//存储图片地址
|
|
||||||
photoBean = new ArrayList<>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -325,6 +317,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
if (all) {
|
if (all) {
|
||||||
//保存数据库:
|
//保存数据库:
|
||||||
PoiEntity poiEntity = new PoiEntity();
|
PoiEntity poiEntity = new PoiEntity();
|
||||||
|
ArrayList<Info> infoPhoto = new ArrayList<>();
|
||||||
String name = editNameContent.getText().toString().trim();//名称
|
String name = editNameContent.getText().toString().trim();//名称
|
||||||
if (name == null || name.equals("")) {
|
if (name == null || name.equals("")) {
|
||||||
Toast.makeText(getActivity(), "请输入poi 名称", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), "请输入poi 名称", Toast.LENGTH_SHORT).show();
|
||||||
@ -360,20 +353,33 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
} else {
|
} else {
|
||||||
poiEntity.setTelPhone(phoneData.get(0));
|
poiEntity.setTelPhone(phoneData.get(0));
|
||||||
}
|
}
|
||||||
if (photoBean.size() < 0) {
|
String tagPanorama = (String) ivPanorama.getTag();
|
||||||
Toast.makeText(getActivity(), "请拍照", Toast.LENGTH_SHORT).show();
|
if (tagPanorama == null || tagPanorama.equals("")) {
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
poiEntity.setPhotoInfo(photoBean);
|
|
||||||
}
|
|
||||||
if (!aBoolean) {
|
|
||||||
Toast.makeText(getActivity(), "请拍照 全景图", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), "请拍照 全景图", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
|
} else {
|
||||||
|
infoPhoto.add(new Info(tagPanorama));
|
||||||
}
|
}
|
||||||
if (!bBoolean) {
|
String tagName = (String) ivName.getTag();
|
||||||
Toast.makeText(getActivity(), "请拍照 名称", Toast.LENGTH_SHORT).show();
|
if (tagName == null || tagName.equals("")) {
|
||||||
|
Toast.makeText(getActivity(), "请拍照 充电桩编码", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
|
} else {
|
||||||
|
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");
|
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
Calendar calendar = Calendar.getInstance();
|
Calendar calendar = Calendar.getInstance();
|
||||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||||
@ -457,6 +463,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
//根据要保存的数据的类型,调用对应的put方法,
|
//根据要保存的数据的类型,调用对应的put方法,
|
||||||
|
|
||||||
PoiEntity poiEntity = new PoiEntity();
|
PoiEntity poiEntity = new PoiEntity();
|
||||||
|
ArrayList<Info> infoPhoto = new ArrayList<>();
|
||||||
String name = editNameContent.getText().toString().trim();//名称
|
String name = editNameContent.getText().toString().trim();//名称
|
||||||
if (name != null || !name.equals("")) {
|
if (name != null || !name.equals("")) {
|
||||||
poiEntity.setName(name);
|
poiEntity.setName(name);
|
||||||
@ -477,9 +484,27 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
if (phoneData.size() > 0) {
|
if (phoneData.size() > 0) {
|
||||||
poiEntity.setTelPhone(phoneData.get(0));
|
poiEntity.setTelPhone(phoneData.get(0));
|
||||||
}
|
}
|
||||||
if (photoBean.size() > 0) {
|
String tagPanorama = (String) ivPanorama.getTag();
|
||||||
poiEntity.setPhotoInfo(photoBean);
|
if (tagPanorama!=null) {
|
||||||
|
infoPhoto.add(new Info(tagPanorama));
|
||||||
}
|
}
|
||||||
|
String tagName = (String) ivName.getTag();
|
||||||
|
if (tagName!= null) {
|
||||||
|
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");
|
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
Calendar calendar = Calendar.getInstance();
|
Calendar calendar = Calendar.getInstance();
|
||||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||||
@ -517,9 +542,8 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data,"a");
|
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data,"a");
|
||||||
photoBean.add(new Info(takePhotoPath));
|
ivPanorama.setTag(takePhotoPath);
|
||||||
ivPanorama.setImageBitmap(bitmap);//显示图像
|
ivPanorama.setImageBitmap(bitmap);//显示图像
|
||||||
aBoolean = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (requestCode == 102 && resultCode == RESULT_OK) {
|
} else if (requestCode == 102 && resultCode == RESULT_OK) {
|
||||||
@ -539,9 +563,9 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data,"b");
|
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data,"b");
|
||||||
photoBean.add(new Info(takePhotoPath));
|
ivName.setTag(takePhotoPath);
|
||||||
ivName.setImageBitmap(bitmap);//显示图像
|
ivName.setImageBitmap(bitmap);//显示图像
|
||||||
bBoolean = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (requestCode == 103 && resultCode == RESULT_OK) {
|
} else if (requestCode == 103 && resultCode == RESULT_OK) {
|
||||||
@ -561,7 +585,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data,"c");
|
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data,"c");
|
||||||
photoBean.add(new Info(takePhotoPath));
|
ivInternal.setTag(takePhotoPath);
|
||||||
ivInternal.setImageBitmap(bitmap);//显示图像
|
ivInternal.setImageBitmap(bitmap);//显示图像
|
||||||
}
|
}
|
||||||
} else if (requestCode == 104 && resultCode == RESULT_OK) {
|
} else if (requestCode == 104 && resultCode == RESULT_OK) {
|
||||||
@ -581,7 +605,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data,"d");
|
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data,"d");
|
||||||
photoBean.add(new Info(takePhotoPath));
|
ivCard.setTag(takePhotoPath);
|
||||||
ivCard.setImageBitmap(bitmap);//显示图像
|
ivCard.setImageBitmap(bitmap);//显示图像
|
||||||
}
|
}
|
||||||
} else if (requestCode == 105 && resultCode == RESULT_OK) {
|
} else if (requestCode == 105 && resultCode == RESULT_OK) {
|
||||||
@ -601,7 +625,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data,"e");
|
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data,"e");
|
||||||
photoBean.add(new Info(takePhotoPath));
|
ivElse.setTag(takePhotoPath);
|
||||||
ivElse.setImageBitmap(bitmap);//显示图像
|
ivElse.setImageBitmap(bitmap);//显示图像
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,9 +45,7 @@ public class SetFragment extends BaseFragment implements View.OnClickListener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initData() {
|
protected void initData() {
|
||||||
super.initData();
|
super.initData(); }
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initView() {
|
protected void initView() {
|
||||||
|
@ -40,6 +40,8 @@ import com.navinfo.outdoor.api.Constant;
|
|||||||
import com.navinfo.outdoor.base.BaseDrawerFragment;
|
import com.navinfo.outdoor.base.BaseDrawerFragment;
|
||||||
import com.navinfo.outdoor.base.BaseFragment;
|
import com.navinfo.outdoor.base.BaseFragment;
|
||||||
import com.navinfo.outdoor.room.ChargingPileEntity;
|
import com.navinfo.outdoor.room.ChargingPileEntity;
|
||||||
|
import com.navinfo.outdoor.room.PoiDao;
|
||||||
|
import com.navinfo.outdoor.room.PoiDatabase;
|
||||||
import com.navinfo.outdoor.room.PoiEntity;
|
import com.navinfo.outdoor.room.PoiEntity;
|
||||||
import com.navinfo.outdoor.util.NetWorkUtils;
|
import com.navinfo.outdoor.util.NetWorkUtils;
|
||||||
import com.navinfo.outdoor.util.ToastUtil;
|
import com.navinfo.outdoor.util.ToastUtil;
|
||||||
@ -96,6 +98,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
private GatherGetFragment gatherGetFragment;
|
private GatherGetFragment gatherGetFragment;
|
||||||
private LinearLayout dragView;
|
private LinearLayout dragView;
|
||||||
private ImageView ivMessage;
|
private ImageView ivMessage;
|
||||||
|
private PoiDao poiDao;
|
||||||
|
|
||||||
public static TreasureFragment newInstance(Bundle bundle) {
|
public static TreasureFragment newInstance(Bundle bundle) {
|
||||||
TreasureFragment fragment = new TreasureFragment();
|
TreasureFragment fragment = new TreasureFragment();
|
||||||
@ -115,6 +118,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
EventBus.getDefault().register(this);
|
EventBus.getDefault().register(this);
|
||||||
//fragment 管理器
|
//fragment 管理器
|
||||||
supportFragmentManager = getActivity().getSupportFragmentManager();
|
supportFragmentManager = getActivity().getSupportFragmentManager();
|
||||||
|
PoiDatabase poiDatabase = PoiDatabase.getInstance(getContext());
|
||||||
|
poiDao = poiDatabase.getPoiDao();
|
||||||
sliding_layout = findViewById(R.id.sliding_layout);
|
sliding_layout = findViewById(R.id.sliding_layout);
|
||||||
dragView = findViewById(R.id.dragView);
|
dragView = findViewById(R.id.dragView);
|
||||||
frameLayout = findViewById(R.id.frame_layout);
|
frameLayout = findViewById(R.id.frame_layout);
|
||||||
@ -163,16 +168,35 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
checkNetWork();
|
checkNetWork();
|
||||||
//检查是否有没有填完的页面
|
//检查是否有没有填完的页面
|
||||||
initSharePre();
|
initSharePre();
|
||||||
|
//数据库
|
||||||
|
initThread();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void initThread() {
|
||||||
|
new Thread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
List<PoiEntity> allPoi = poiDao.getAllPoi();
|
||||||
|
getActivity().runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
for (int i = 0; i < allPoi.size(); i++) {
|
||||||
|
LatLng position = new LatLng(Double.valueOf(allPoi.get(i).getX()), Double.valueOf(allPoi.get(i).getY()));
|
||||||
|
tencentMap.addMarker(new MarkerOptions(position));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
}
|
||||||
|
|
||||||
private void initSharePre() {
|
private void initSharePre() {
|
||||||
//根据保存时所用的name属性,获取SharedPreferences对象
|
//根据保存时所用的name属性,获取SharedPreferences对象
|
||||||
SharedPreferences dataFile = getActivity().getSharedPreferences("dataFile", 0);
|
SharedPreferences dataFile = getActivity().getSharedPreferences("dataFile", 0);
|
||||||
//根据数据类型,调用对应的get方法,通过键取得对应的值。
|
//根据数据类型,调用对应的get方法,通过键取得对应的值。
|
||||||
String dataFileString = dataFile.getString("poiEntity", null);
|
String dataFileString = dataFile.getString("poiEntity", null);
|
||||||
String pileFileString = dataFile.getString("chargingPileEntity", null);
|
|
||||||
if (dataFileString!=null){
|
if (dataFileString!=null){
|
||||||
PoiEntity poiEntity = new Gson().fromJson(dataFileString, PoiEntity.class);
|
PoiEntity poiEntity = new Gson().fromJson(dataFileString, PoiEntity.class);
|
||||||
switch (poiEntity.getType()){
|
switch (poiEntity.getType()){
|
||||||
@ -248,6 +272,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
String pileFileString = dataFile.getString("chargingPileEntity", null);
|
||||||
if (pileFileString!=null){
|
if (pileFileString!=null){
|
||||||
ChargingPileEntity chargingPileEntity = new Gson().fromJson(pileFileString, ChargingPileEntity.class);
|
ChargingPileEntity chargingPileEntity = new Gson().fromJson(pileFileString, ChargingPileEntity.class);
|
||||||
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
|
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
|
||||||
@ -349,7 +374,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
if ((boolean) data.obj) {
|
if ((boolean) data.obj) {
|
||||||
dragView.removeAllViews();
|
dragView.removeAllViews();
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (data.what == Constant.GATHER_GET_RETURN) {//item 点击页面的返回事件的处理
|
} else if (data.what == Constant.GATHER_GET_RETURN) {//item 点击页面的返回事件的处理
|
||||||
if ((boolean) data.obj) {
|
if ((boolean) data.obj) {
|
||||||
frameLayout.setVisibility(View.GONE);
|
frameLayout.setVisibility(View.GONE);
|
||||||
@ -369,8 +393,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
ChargingPileFragment chargingPileFragment = ChargingPileFragment.newInstance(bundle);
|
ChargingPileFragment chargingPileFragment = ChargingPileFragment.newInstance(bundle);
|
||||||
showSlidingFragment(chargingPileFragment);
|
showSlidingFragment(chargingPileFragment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user