图片命名规则,数据临时保存
This commit is contained in:
parent
af5d7da58c
commit
4653d7a501
@ -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"
|
||||||
|
@ -55,6 +55,7 @@ public class Constant {
|
|||||||
public static final int CHARGING_PILE_STATION = 22;//将充电桩的数据回传给充电站
|
public static final int CHARGING_PILE_STATION = 22;//将充电桩的数据回传给充电站
|
||||||
public static final int MAIN_OTHER = 23;//其他的Fragment 对地图页面marker 的一个展示
|
public static final int MAIN_OTHER = 23;//其他的Fragment 对地图页面marker 的一个展示
|
||||||
public static final int OTHER_WORD = 25;//地图页面marker 的经纬都回传
|
public static final int OTHER_WORD = 25;//地图页面marker 的经纬都回传
|
||||||
|
public static final int CHARGING_STATION_PILE = 26;//跳转到充电桩 传给数据
|
||||||
/**
|
/**
|
||||||
* 用户当前位置
|
* 用户当前位置
|
||||||
*/
|
*/
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.navinfo.outdoor.base;
|
package com.navinfo.outdoor.base;
|
||||||
|
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@ -68,7 +69,24 @@ public abstract class BaseDrawerFragment extends BaseFragment {
|
|||||||
mainButtonVisiableMsg.obj= View.VISIBLE;
|
mainButtonVisiableMsg.obj= View.VISIBLE;
|
||||||
EventBus.getDefault().post(mainButtonVisiableMsg);
|
EventBus.getDefault().post(mainButtonVisiableMsg);
|
||||||
}
|
}
|
||||||
|
initRemovePoiSharePre();
|
||||||
}
|
}
|
||||||
|
public void initRemovePoiSharePre() {
|
||||||
|
//获取SharedPreferences对象,方法中两个参数的意思为:第一个name
|
||||||
|
//表示文件名,系统将会在/dada/dada/包名/shared_prefs目录下生成
|
||||||
|
//一个以该参数命名的.xml文件。第二个mode表示创建的模式,通过查看
|
||||||
|
//方法注释得知,建议以0或者MODE_PRIVATE为默认值。
|
||||||
|
SharedPreferences poi = getActivity().getSharedPreferences("dataFile", 0);
|
||||||
|
//获取Editor对象
|
||||||
|
SharedPreferences.Editor edit = poi.edit();
|
||||||
|
//根据要保存的数据的类型,调用对应的put方法,
|
||||||
|
//以键值对的形式添加新值。
|
||||||
|
edit.putString("poiEntity", null);
|
||||||
|
edit.putString("chargingPileEntity", null);
|
||||||
|
//提交新值。必须执行,否则前面的操作都无效。
|
||||||
|
edit.commit();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public View getScrollerView() {
|
public View getScrollerView() {
|
||||||
return findViewById(R.id.scroller_view);
|
return findViewById(R.id.scroller_view);
|
||||||
|
@ -13,6 +13,10 @@ public class Info {
|
|||||||
private String y;
|
private String y;
|
||||||
private String t;
|
private String t;
|
||||||
|
|
||||||
|
public Info(String photo) {
|
||||||
|
this.photo = photo;
|
||||||
|
}
|
||||||
|
|
||||||
public String getPhoto() {
|
public String getPhoto() {
|
||||||
return photo;
|
return photo;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.navinfo.outdoor.fragment;
|
package com.navinfo.outdoor.fragment;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -23,12 +24,15 @@ import android.widget.Spinner;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
import androidx.recyclerview.widget.DividerItemDecoration;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.bumptech.glide.Glide;
|
||||||
|
import com.google.gson.Gson;
|
||||||
import com.hjq.permissions.OnPermissionCallback;
|
import com.hjq.permissions.OnPermissionCallback;
|
||||||
import com.hjq.permissions.Permission;
|
import com.hjq.permissions.Permission;
|
||||||
import com.hjq.permissions.XXPermissions;
|
import com.hjq.permissions.XXPermissions;
|
||||||
@ -159,7 +163,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
|||||||
checkButton1.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
checkButton1.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
if (isChecked){
|
if (isChecked) {
|
||||||
Toast.makeText(getContext(), "1", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getContext(), "1", Toast.LENGTH_SHORT).show();
|
||||||
checkButton2.setChecked(false);
|
checkButton2.setChecked(false);
|
||||||
checkButton3.setChecked(false);
|
checkButton3.setChecked(false);
|
||||||
@ -173,7 +177,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
|||||||
checkButton2.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
checkButton2.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
if (isChecked){
|
if (isChecked) {
|
||||||
Toast.makeText(getContext(), "2", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getContext(), "2", Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -182,7 +186,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
|||||||
checkButton3.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
checkButton3.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
if (isChecked){
|
if (isChecked) {
|
||||||
Toast.makeText(getContext(), "3", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getContext(), "3", Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -191,7 +195,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
|||||||
checkButton4.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
checkButton4.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
if (isChecked){
|
if (isChecked) {
|
||||||
Toast.makeText(getContext(), "4", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getContext(), "4", Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -200,7 +204,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
|||||||
checkButton5.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
checkButton5.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
if (isChecked){
|
if (isChecked) {
|
||||||
Toast.makeText(getContext(), "5", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getContext(), "5", Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -209,7 +213,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
|||||||
checkButton6.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
checkButton6.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
if (isChecked){
|
if (isChecked) {
|
||||||
Toast.makeText(getContext(), "6", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getContext(), "6", Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -357,11 +361,91 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
|||||||
editDescribe = findViewById(R.id.edit_describe);
|
editDescribe = findViewById(R.id.edit_describe);
|
||||||
btnSaveLocal = findViewById(R.id.btn_save_local);
|
btnSaveLocal = findViewById(R.id.btn_save_local);
|
||||||
btnSaveLocal.setOnClickListener(this::onClick);
|
btnSaveLocal.setOnClickListener(this::onClick);
|
||||||
pid = getArguments().getInt("pid",0);
|
|
||||||
|
|
||||||
|
//展示数据
|
||||||
|
initShowPileSharePre();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void initShowPileSharePre() {
|
||||||
|
// 添加信息:
|
||||||
|
pid = getArguments().getInt("pid", 0);
|
||||||
|
ChargingPileEntity chargingPileEntity = (ChargingPileEntity) getArguments().getSerializable("chargingPileEntity");
|
||||||
|
if (chargingPileEntity != null) {
|
||||||
|
String name = chargingPileEntity.getName();//名称
|
||||||
|
if (name != null || !name.equals("")) {
|
||||||
|
editNameContent.setText(name + "");
|
||||||
|
}
|
||||||
|
String p = chargingPileEntity.getP();
|
||||||
|
if (p != null || !p.equals("")) {
|
||||||
|
inode = p;
|
||||||
|
}
|
||||||
|
String memo = chargingPileEntity.getMemo();
|
||||||
|
if (memo != null || !memo.equals("")) {
|
||||||
|
editDescribe.setText(memo);
|
||||||
|
}
|
||||||
|
int fid = chargingPileEntity.getFid();
|
||||||
|
if (fid != 0) {
|
||||||
|
pid = fid;
|
||||||
|
}
|
||||||
|
int sign_exist = chargingPileEntity.getSign_exist();
|
||||||
|
spinnerScutcheon.setSelection(sign_exist, true);
|
||||||
|
int cp_availableState = chargingPileEntity.getCp_availableState();
|
||||||
|
spinnerStake.setSelection(cp_availableState, true);
|
||||||
|
int cp_floor = chargingPileEntity.getCp_floor();
|
||||||
|
spinnerType.setSelection(cp_floor, true);
|
||||||
|
if (chargingPileEntity.getPhotos() != null) {
|
||||||
|
photoBean.clear();
|
||||||
|
for (int i = 0; i < chargingPileEntity.getPhotos().size(); i++) {
|
||||||
|
String photo = chargingPileEntity.getPhotos().get(i);
|
||||||
|
String[] split = photo.split("/");
|
||||||
|
char charAt = split[6].charAt(0);
|
||||||
|
if (charAt == 'a') {
|
||||||
|
Glide.with(getActivity()).load(photo).into(ivPanorama);
|
||||||
|
photoBean.add(photo);
|
||||||
|
} else if (charAt == 'b') {
|
||||||
|
Glide.with(getActivity()).load(photo).into(ivCoding);
|
||||||
|
photoBean.add(photo);
|
||||||
|
} else if (charAt == 'c') {
|
||||||
|
char charAtc = split[6].charAt(1);
|
||||||
|
if (charAtc == '1') {
|
||||||
|
Glide.with(getActivity()).load(photo).into(ivEquipment);
|
||||||
|
photoBean.add(photo);
|
||||||
|
} else if (charAtc == '2') {
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//禁用所有可操作性控件
|
//禁用所有可操作性控件
|
||||||
private void disables() {
|
private void disables() {
|
||||||
checkBoxLife.setEnabled(false);
|
checkBoxLife.setEnabled(false);
|
||||||
@ -433,7 +517,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
|||||||
}
|
}
|
||||||
if (pid == 0) {
|
if (pid == 0) {
|
||||||
Toast.makeText(getActivity(), "没有关联充电站", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), "没有关联充电站", Toast.LENGTH_SHORT).show();
|
||||||
}else {
|
} else {
|
||||||
chargingPileEntity.setFid(pid);
|
chargingPileEntity.setFid(pid);
|
||||||
}
|
}
|
||||||
new Thread(new Runnable() {
|
new Thread(new Runnable() {
|
||||||
@ -446,11 +530,6 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
|||||||
obtain.what = Constant.CHARGING_PILE_STATION;
|
obtain.what = Constant.CHARGING_PILE_STATION;
|
||||||
obtain.obj = chargingPileEntity;
|
obtain.obj = chargingPileEntity;
|
||||||
EventBus.getDefault().post(obtain);
|
EventBus.getDefault().post(obtain);
|
||||||
|
|
||||||
Message obtains = Message.obtain();
|
|
||||||
obtains.what = Constant.TREASURE_FRAGMENT;
|
|
||||||
obtains.obj = false;
|
|
||||||
EventBus.getDefault().post(obtains);
|
|
||||||
onBackPressed();
|
onBackPressed();
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(getActivity(), "没有申请权限,请手动申请", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), "没有申请权限,请手动申请", Toast.LENGTH_SHORT).show();
|
||||||
@ -470,14 +549,17 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
|||||||
case R.id.rl_panorama:
|
case R.id.rl_panorama:
|
||||||
Intent intentPanorama = new Intent("android.media.action.IMAGE_CAPTURE");
|
Intent intentPanorama = new Intent("android.media.action.IMAGE_CAPTURE");
|
||||||
startActivityForResult(intentPanorama, 101);
|
startActivityForResult(intentPanorama, 101);
|
||||||
|
initPileSharePre();
|
||||||
break;
|
break;
|
||||||
case R.id.rl_coding:
|
case R.id.rl_coding:
|
||||||
Intent intentCoding = new Intent("android.media.action.IMAGE_CAPTURE");
|
Intent intentCoding = new Intent("android.media.action.IMAGE_CAPTURE");
|
||||||
startActivityForResult(intentCoding, 102);
|
startActivityForResult(intentCoding, 102);
|
||||||
|
initPileSharePre();
|
||||||
break;
|
break;
|
||||||
case R.id.rl_equipment:
|
case R.id.rl_equipment:
|
||||||
Intent intentEquipment = new Intent("android.media.action.IMAGE_CAPTURE");
|
Intent intentEquipment = new Intent("android.media.action.IMAGE_CAPTURE");
|
||||||
startActivityForResult(intentEquipment, 103);
|
startActivityForResult(intentEquipment, 103);
|
||||||
|
initPileSharePre();
|
||||||
break;
|
break;
|
||||||
case R.id.rl_facility:
|
case R.id.rl_facility:
|
||||||
Intent intentFacility = new Intent("android.media.action.IMAGE_CAPTURE");
|
Intent intentFacility = new Intent("android.media.action.IMAGE_CAPTURE");
|
||||||
@ -511,6 +593,54 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSaveInstanceState(@NonNull Bundle outState) {
|
||||||
|
super.onSaveInstanceState(outState);
|
||||||
|
initPileSharePre();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 防止当页面崩溃后出现数据丢失
|
||||||
|
*/
|
||||||
|
public void initPileSharePre() {
|
||||||
|
//获取SharedPreferences对象,方法中两个参数的意思为:第一个name
|
||||||
|
//表示文件名,系统将会在/dada/dada/包名/shared_prefs目录下生成
|
||||||
|
//一个以该参数命名的.xml文件。第二个mode表示创建的模式,通过查看
|
||||||
|
//方法注释得知,建议以0或者MODE_PRIVATE为默认值。
|
||||||
|
SharedPreferences poi = getActivity().getSharedPreferences("dataFile", 0);
|
||||||
|
//获取Editor对象
|
||||||
|
SharedPreferences.Editor edit = poi.edit();
|
||||||
|
//根据要保存的数据的类型,调用对应的put方法,
|
||||||
|
ChargingPileEntity chargingPileEntity = new ChargingPileEntity();
|
||||||
|
if (inode != null) {
|
||||||
|
chargingPileEntity.setP(inode);
|
||||||
|
}
|
||||||
|
String name = editNameContent.getText().toString().trim();//名称
|
||||||
|
if (name != null || !name.equals("")) {
|
||||||
|
chargingPileEntity.setName(name);
|
||||||
|
}
|
||||||
|
if (cp_floor != 0) {
|
||||||
|
chargingPileEntity.setCp_floor(cp_floor);
|
||||||
|
}
|
||||||
|
if (photoBean.size() > 0) {
|
||||||
|
chargingPileEntity.setPhotos(photoBean);
|
||||||
|
}
|
||||||
|
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 != 0) {
|
||||||
|
chargingPileEntity.setFid(pid);
|
||||||
|
}
|
||||||
|
String newChargingPileEntity = new Gson().toJson(chargingPileEntity);
|
||||||
|
//以键值对的形式添加新值。
|
||||||
|
edit.putString("chargingPileEntity", newChargingPileEntity);
|
||||||
|
//提交新值。必须执行,否则前面的操作都无效。
|
||||||
|
edit.commit();
|
||||||
|
Log.d("TAG", "initPileSharePre: " + newChargingPileEntity);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||||
@ -531,7 +661,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data);
|
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "a");
|
||||||
photoBean.add(takePhotoPath);
|
photoBean.add(takePhotoPath);
|
||||||
ivPanorama.setImageBitmap(bitmap);//显示图像
|
ivPanorama.setImageBitmap(bitmap);//显示图像
|
||||||
}
|
}
|
||||||
@ -551,7 +681,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data);
|
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "b");
|
||||||
photoBean.add(takePhotoPath);
|
photoBean.add(takePhotoPath);
|
||||||
ivCoding.setImageBitmap(bitmap);//显示图像
|
ivCoding.setImageBitmap(bitmap);//显示图像
|
||||||
}
|
}
|
||||||
@ -571,7 +701,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data);
|
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "c1");
|
||||||
photoBean.add(takePhotoPath);
|
photoBean.add(takePhotoPath);
|
||||||
ivEquipment.setImageBitmap(bitmap);//显示图像
|
ivEquipment.setImageBitmap(bitmap);//显示图像
|
||||||
}
|
}
|
||||||
@ -591,7 +721,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data);
|
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "c2");
|
||||||
photoBean.add(takePhotoPath);
|
photoBean.add(takePhotoPath);
|
||||||
ivFacility.setImageBitmap(bitmap);//显示图像
|
ivFacility.setImageBitmap(bitmap);//显示图像
|
||||||
}
|
}
|
||||||
@ -611,7 +741,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data);
|
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "c3");
|
||||||
photoBean.add(takePhotoPath);
|
photoBean.add(takePhotoPath);
|
||||||
ivScutcheon.setImageBitmap(bitmap);//显示图像
|
ivScutcheon.setImageBitmap(bitmap);//显示图像
|
||||||
}
|
}
|
||||||
@ -631,7 +761,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data);
|
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "c4");
|
||||||
photoBean.add(takePhotoPath);
|
photoBean.add(takePhotoPath);
|
||||||
ivDevice.setImageBitmap(bitmap);//显示图像
|
ivDevice.setImageBitmap(bitmap);//显示图像
|
||||||
}
|
}
|
||||||
@ -651,7 +781,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data);
|
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "d1");
|
||||||
photoBean.add(takePhotoPath);
|
photoBean.add(takePhotoPath);
|
||||||
ivUsable.setImageBitmap(bitmap);//显示图像
|
ivUsable.setImageBitmap(bitmap);//显示图像
|
||||||
}
|
}
|
||||||
@ -671,7 +801,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data);
|
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "d2");
|
||||||
photoBean.add(takePhotoPath);
|
photoBean.add(takePhotoPath);
|
||||||
ivAvailable.setImageBitmap(bitmap);//显示图像
|
ivAvailable.setImageBitmap(bitmap);//显示图像
|
||||||
}
|
}
|
||||||
@ -691,7 +821,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data);
|
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "e1");
|
||||||
photoBean.add(takePhotoPath);
|
photoBean.add(takePhotoPath);
|
||||||
ivParking.setImageBitmap(bitmap);//显示图像
|
ivParking.setImageBitmap(bitmap);//显示图像
|
||||||
}
|
}
|
||||||
@ -711,8 +841,9 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data);
|
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "e2");
|
||||||
photoBean.add(takePhotoPath);
|
photoBean.add(takePhotoPath);
|
||||||
|
|
||||||
ivNumber.setImageBitmap(bitmap);//显示图像
|
ivNumber.setImageBitmap(bitmap);//显示图像
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.navinfo.outdoor.fragment;
|
package com.navinfo.outdoor.fragment;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
@ -20,6 +21,7 @@ import android.widget.Spinner;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
import androidx.recyclerview.widget.DividerItemDecoration;
|
||||||
@ -28,6 +30,7 @@ import androidx.recyclerview.widget.LinearLayoutManager;
|
|||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.bumptech.glide.Glide;
|
import com.bumptech.glide.Glide;
|
||||||
|
import com.google.gson.Gson;
|
||||||
import com.hjq.permissions.OnPermissionCallback;
|
import com.hjq.permissions.OnPermissionCallback;
|
||||||
import com.hjq.permissions.Permission;
|
import com.hjq.permissions.Permission;
|
||||||
import com.hjq.permissions.XXPermissions;
|
import com.hjq.permissions.XXPermissions;
|
||||||
@ -53,6 +56,7 @@ import com.sothree.slidinguppanel.SlidingUpPanelLayout;
|
|||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
import org.greenrobot.eventbus.Subscribe;
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -68,8 +72,8 @@ import static android.app.Activity.RESULT_OK;
|
|||||||
public class ChargingStationFragment extends BaseDrawerFragment implements View.OnClickListener {
|
public class ChargingStationFragment extends BaseDrawerFragment implements View.OnClickListener {
|
||||||
|
|
||||||
private EditText editDescribe;
|
private EditText editDescribe;
|
||||||
private RelativeLayout rlPanorama, rlName, rlInternalPhotos, rlCard, rlElse, rlScutcheon;
|
private RelativeLayout rlPanorama, rlName, rlInternalPhotos, rlElse, rlScutcheon;
|
||||||
private ImageView ivPanorama, ivName, ivInternal, ivCard, ivElse, ivScutcheon;
|
private ImageView ivPanorama, ivName, ivInternal, ivElse, ivScutcheon;
|
||||||
private TextView tvExamine;
|
private TextView tvExamine;
|
||||||
private EditText editNameContent, editSiteContent;
|
private EditText editNameContent, editSiteContent;
|
||||||
private RecyclerView recyclerPhone;
|
private RecyclerView recyclerPhone;
|
||||||
@ -246,7 +250,6 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
ivPanorama = findViewById(R.id.iv_panorama);
|
ivPanorama = findViewById(R.id.iv_panorama);
|
||||||
ivName = findViewById(R.id.iv_name);
|
ivName = findViewById(R.id.iv_name);
|
||||||
ivInternal = findViewById(R.id.iv_internal);
|
ivInternal = findViewById(R.id.iv_internal);
|
||||||
ivCard = findViewById(R.id.iv_card);
|
|
||||||
ivElse = findViewById(R.id.iv_else);
|
ivElse = findViewById(R.id.iv_else);
|
||||||
ivScutcheon = findViewById(R.id.iv_scutcheon);
|
ivScutcheon = findViewById(R.id.iv_scutcheon);
|
||||||
rlPanorama = findViewById(R.id.rl_panorama);
|
rlPanorama = findViewById(R.id.rl_panorama);
|
||||||
@ -255,8 +258,6 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
rlName.setOnClickListener(this::onClick);
|
rlName.setOnClickListener(this::onClick);
|
||||||
rlInternalPhotos = findViewById(R.id.rl_internal_photos);
|
rlInternalPhotos = findViewById(R.id.rl_internal_photos);
|
||||||
rlInternalPhotos.setOnClickListener(this::onClick);
|
rlInternalPhotos.setOnClickListener(this::onClick);
|
||||||
rlCard = findViewById(R.id.rl_card);
|
|
||||||
rlCard.setOnClickListener(this::onClick);
|
|
||||||
rlElse = findViewById(R.id.rl_else);
|
rlElse = findViewById(R.id.rl_else);
|
||||||
rlElse.setOnClickListener(this::onClick);
|
rlElse.setOnClickListener(this::onClick);
|
||||||
rlScutcheon = findViewById(R.id.rl_scutcheon);
|
rlScutcheon = findViewById(R.id.rl_scutcheon);
|
||||||
@ -298,16 +299,64 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
recyclerStation.setLayoutManager(new GridLayoutManager(getContext(), 3));
|
recyclerStation.setLayoutManager(new GridLayoutManager(getContext(), 3));
|
||||||
chargingPileAdapter = new ChargingPileAdapter(getContext());
|
chargingPileAdapter = new ChargingPileAdapter(getContext());
|
||||||
recyclerStation.setAdapter(chargingPileAdapter);
|
recyclerStation.setAdapter(chargingPileAdapter);
|
||||||
|
//数据展示
|
||||||
|
initShowPoi();
|
||||||
|
//禁用所有可操作控件
|
||||||
|
//disables();
|
||||||
|
|
||||||
|
}
|
||||||
showPoiEntity = (PoiEntity) getArguments().getSerializable("PoiEntity");
|
private void initShowPoi() {
|
||||||
|
// 添加信息:
|
||||||
|
showPoiEntity = (PoiEntity) getArguments().getSerializable("poiEntity");
|
||||||
if (showPoiEntity != null) {
|
if (showPoiEntity != null) {
|
||||||
editNameContent.setText(showPoiEntity.getName());
|
String name = showPoiEntity.getName();//名称
|
||||||
editDescribe.setText(showPoiEntity.getDescribe());
|
if (name != null || !name.equals("")) {
|
||||||
editSiteContent.setText(showPoiEntity.getAddress());
|
editNameContent.setText(name + "");
|
||||||
|
}
|
||||||
|
String address = showPoiEntity.getAddress();//地址
|
||||||
|
if (address != null || !address.equals("")) {
|
||||||
|
editSiteContent.setText(address);
|
||||||
|
}
|
||||||
String x = showPoiEntity.getX();
|
String x = showPoiEntity.getX();
|
||||||
String y = showPoiEntity.getY();
|
String y = showPoiEntity.getY();
|
||||||
int id = showPoiEntity.getId();
|
if (x != null && y != null) {
|
||||||
|
inode = x + "," + y;
|
||||||
|
}
|
||||||
|
String describe = showPoiEntity.getDescribe();//任务描述
|
||||||
|
if (describe != null || !describe.equals("")) {
|
||||||
|
editDescribe.setText(describe);
|
||||||
|
}
|
||||||
|
String telPhone = showPoiEntity.getTelPhone();
|
||||||
|
if (telPhone != null) {
|
||||||
|
phoneData.add(showPoiEntity.getTelPhone());
|
||||||
|
poiBeans.add(new PoiBean("电话*", telPhone, R.drawable.icon_add_bg));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (showPoiEntity.getPhotoInfo() != null) {
|
||||||
|
photoBean.clear();
|
||||||
|
for (int i = 0; i < showPoiEntity.getPhotoInfo().size(); i++) {
|
||||||
|
String photo =showPoiEntity.getPhotoInfo().get(i).getPhoto();
|
||||||
|
String[] split = photo.split("/");
|
||||||
|
char charAt = split[6].charAt(0);
|
||||||
|
if (charAt=='a'){
|
||||||
|
Glide.with(getActivity()).load(photo).into(ivPanorama);
|
||||||
|
photoBean.add(new Info(photo));
|
||||||
|
}else if (charAt=='b'){
|
||||||
|
Glide.with(getActivity()).load(photo).into(ivName);
|
||||||
|
photoBean.add(new Info(photo));
|
||||||
|
}else if (charAt=='c'){
|
||||||
|
Glide.with(getActivity()).load(photo).into(ivInternal);
|
||||||
|
photoBean.add(new Info(photo));
|
||||||
|
}else if (charAt=='d'){
|
||||||
|
Glide.with(getActivity()).load(photo).into(ivElse);
|
||||||
|
photoBean.add(new Info(photo));
|
||||||
|
|
||||||
|
}else if (charAt=='e'){
|
||||||
|
Glide.with(getActivity()).load(photo).into(ivScutcheon);
|
||||||
|
photoBean.add(new Info(photo));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
ArrayList<ChargingPileEntity> chargingPileEntities = new ArrayList<>();
|
ArrayList<ChargingPileEntity> chargingPileEntities = new ArrayList<>();
|
||||||
new Thread(new Runnable() {
|
new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
@ -329,12 +378,16 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
|
ChargingPileEntity chargingPileEntity = (ChargingPileEntity) getArguments().getSerializable("chargingPileEntity");
|
||||||
//禁用所有可操作控件
|
if (chargingPileEntity!=null){
|
||||||
//disables();
|
Message obtains = Message.obtain();
|
||||||
|
obtains.what = Constant.CHARGING_STATION_PILE;
|
||||||
|
obtains.obj = chargingPileEntity;
|
||||||
|
EventBus.getDefault().post(obtains);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//禁用所有可操作性控件
|
//禁用所有可操作性控件
|
||||||
private void disables() {
|
private void disables() {
|
||||||
checkBoxLife.setEnabled(false);
|
checkBoxLife.setEnabled(false);
|
||||||
@ -345,7 +398,6 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
ivPanorama.setEnabled(false);
|
ivPanorama.setEnabled(false);
|
||||||
ivName.setEnabled(false);
|
ivName.setEnabled(false);
|
||||||
ivInternal.setEnabled(false);
|
ivInternal.setEnabled(false);
|
||||||
ivCard.setEnabled(false);
|
|
||||||
ivElse.setEnabled(false);
|
ivElse.setEnabled(false);
|
||||||
editDescribe.setEnabled(false);
|
editDescribe.setEnabled(false);
|
||||||
btnSaveLocal.setEnabled(false);
|
btnSaveLocal.setEnabled(false);
|
||||||
@ -453,10 +505,6 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
poiDao.insertPoiEntity(poiEntity);
|
poiDao.insertPoiEntity(poiEntity);
|
||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
Message obtains = Message.obtain();
|
|
||||||
obtains.what = Constant.TREASURE_FRAGMENT;
|
|
||||||
obtains.obj = false;
|
|
||||||
EventBus.getDefault().post(obtains);
|
|
||||||
onBackPressed();
|
onBackPressed();
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(getActivity(), "没有申请权限,请手动申请", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), "没有申请权限,请手动申请", Toast.LENGTH_SHORT).show();
|
||||||
@ -495,17 +543,13 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
Intent intentInternal = new Intent("android.media.action.IMAGE_CAPTURE");
|
Intent intentInternal = new Intent("android.media.action.IMAGE_CAPTURE");
|
||||||
startActivityForResult(intentInternal, 103);
|
startActivityForResult(intentInternal, 103);
|
||||||
break;
|
break;
|
||||||
case R.id.rl_card:
|
|
||||||
Intent intentCard = new Intent("android.media.action.IMAGE_CAPTURE");
|
|
||||||
startActivityForResult(intentCard, 104);
|
|
||||||
break;
|
|
||||||
case R.id.rl_else:
|
case R.id.rl_else:
|
||||||
Intent intentElse = new Intent("android.media.action.IMAGE_CAPTURE");
|
Intent intentElse = new Intent("android.media.action.IMAGE_CAPTURE");
|
||||||
startActivityForResult(intentElse, 105);
|
startActivityForResult(intentElse, 104);
|
||||||
break;
|
break;
|
||||||
case R.id.rl_scutcheon:
|
case R.id.rl_scutcheon:
|
||||||
Intent intentScutcheon = new Intent("android.media.action.IMAGE_CAPTURE");
|
Intent intentScutcheon = new Intent("android.media.action.IMAGE_CAPTURE");
|
||||||
startActivityForResult(intentScutcheon, 106);
|
startActivityForResult(intentScutcheon, 105);
|
||||||
break;
|
break;
|
||||||
case R.id.linear_charging_pile:
|
case R.id.linear_charging_pile:
|
||||||
Message obtains = Message.obtain();
|
Message obtains = Message.obtain();
|
||||||
@ -516,6 +560,65 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSaveInstanceState(@NonNull Bundle outState) {
|
||||||
|
super.onSaveInstanceState(outState);
|
||||||
|
initStationSharePre();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 防止当页面崩溃后出现数据丢失
|
||||||
|
*/
|
||||||
|
public void initStationSharePre(){
|
||||||
|
//获取SharedPreferences对象,方法中两个参数的意思为:第一个name
|
||||||
|
//表示文件名,系统将会在/dada/dada/包名/shared_prefs目录下生成
|
||||||
|
//一个以该参数命名的.xml文件。第二个mode表示创建的模式,通过查看
|
||||||
|
//方法注释得知,建议以0或者MODE_PRIVATE为默认值。
|
||||||
|
SharedPreferences poi = getActivity().getSharedPreferences("dataFile", 0);
|
||||||
|
//获取Editor对象
|
||||||
|
SharedPreferences.Editor edit = poi.edit();
|
||||||
|
//根据要保存的数据的类型,调用对应的put方法,
|
||||||
|
|
||||||
|
poiEntity = new PoiEntity();
|
||||||
|
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 (inode != null ) {
|
||||||
|
String[] split = inode.split(",");
|
||||||
|
poiEntity.setX(split[0]);
|
||||||
|
poiEntity.setY(split[1]);
|
||||||
|
}
|
||||||
|
String describe = editDescribe.getText().toString().trim();
|
||||||
|
if (describe != null || !describe.equals("")) {
|
||||||
|
poiEntity.setDescribe(describe);
|
||||||
|
}
|
||||||
|
if (phoneData.size() > 0) {
|
||||||
|
poiEntity.setTelPhone(phoneData.get(0));
|
||||||
|
}
|
||||||
|
if (photoBean.size() > 0) {
|
||||||
|
poiEntity.setPhotoInfo(photoBean);
|
||||||
|
}
|
||||||
|
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(0);
|
||||||
|
poiEntity.setTaskId(101);
|
||||||
|
String newPoiEntity = new Gson().toJson(poiEntity);
|
||||||
|
//以键值对的形式添加新值。
|
||||||
|
edit.putString("poiEntity", newPoiEntity);
|
||||||
|
//提交新值。必须执行,否则前面的操作都无效。
|
||||||
|
edit.commit();
|
||||||
|
Log.d("TAG", "initPoiSharePre: "+newPoiEntity);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||||
@ -536,10 +639,8 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data);
|
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data,"a");
|
||||||
Info info = new Info();
|
photoBean.add(new Info(takePhotoPath));
|
||||||
info.setPhoto(takePhotoPath);
|
|
||||||
photoBean.add(info);
|
|
||||||
ivPanorama.setImageBitmap(bitmap);//显示图像
|
ivPanorama.setImageBitmap(bitmap);//显示图像
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -559,10 +660,8 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data);
|
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data,"b");
|
||||||
Info info = new Info();
|
photoBean.add(new Info(takePhotoPath));
|
||||||
info.setPhoto(takePhotoPath);
|
|
||||||
photoBean.add(info);
|
|
||||||
ivName.setImageBitmap(bitmap);//显示图像
|
ivName.setImageBitmap(bitmap);//显示图像
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -582,10 +681,8 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data);
|
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data,"c");
|
||||||
Info info = new Info();
|
photoBean.add(new Info(takePhotoPath));
|
||||||
info.setPhoto(takePhotoPath);
|
|
||||||
photoBean.add(info);
|
|
||||||
ivInternal.setImageBitmap(bitmap);//显示图像
|
ivInternal.setImageBitmap(bitmap);//显示图像
|
||||||
}
|
}
|
||||||
} else if (requestCode == 104 && resultCode == RESULT_OK) {
|
} else if (requestCode == 104 && resultCode == RESULT_OK) {
|
||||||
@ -604,11 +701,9 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data);
|
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data,"d");
|
||||||
Info info = new Info();
|
photoBean.add(new Info(takePhotoPath));
|
||||||
info.setPhoto(takePhotoPath);
|
ivElse.setImageBitmap(bitmap);//显示图像
|
||||||
photoBean.add(info);
|
|
||||||
ivCard.setImageBitmap(bitmap);//显示图像
|
|
||||||
}
|
}
|
||||||
} else if (requestCode == 105 && resultCode == RESULT_OK) {
|
} else if (requestCode == 105 && resultCode == RESULT_OK) {
|
||||||
Bundle extras = data.getExtras();//从Intent中获取附加值
|
Bundle extras = data.getExtras();//从Intent中获取附加值
|
||||||
@ -626,35 +721,11 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data);
|
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data,"e");
|
||||||
Info info = new Info();
|
photoBean.add(new Info(takePhotoPath));
|
||||||
info.setPhoto(takePhotoPath);
|
|
||||||
photoBean.add(info);
|
|
||||||
ivElse.setImageBitmap(bitmap);//显示图像
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (requestCode == 106 && resultCode == RESULT_OK) {
|
|
||||||
Bundle extras = data.getExtras();//从Intent中获取附加值
|
|
||||||
Bitmap bitmap = (Bitmap) extras.get("data");//从附加值中获取返回的图像
|
|
||||||
int height = bitmap.getHeight();
|
|
||||||
int width = bitmap.getWidth();
|
|
||||||
if (height > width) {
|
|
||||||
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
|
|
||||||
MessageDialog.show((AppCompatActivity) getContext(), "提示", "请重新拍照,要求横屏拍照", "确定").setOkButton(new OnDialogButtonClickListener() {
|
|
||||||
@Override
|
|
||||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
|
||||||
Intent intentPanorama = new Intent("android.media.action.IMAGE_CAPTURE");
|
|
||||||
startActivityForResult(intentPanorama, 106);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data);
|
|
||||||
Info info = new Info();
|
|
||||||
info.setPhoto(takePhotoPath);
|
|
||||||
photoBean.add(info);
|
|
||||||
ivScutcheon.setImageBitmap(bitmap);//显示图像
|
ivScutcheon.setImageBitmap(bitmap);//显示图像
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
|||||||
Bundle arguments = getArguments();
|
Bundle arguments = getArguments();
|
||||||
|
|
||||||
if (arguments!=null) {
|
if (arguments!=null) {
|
||||||
poiEntity = (PoiEntity) arguments.getSerializable("PoiEntity");
|
poiEntity = (PoiEntity) arguments.getSerializable("poiEntity");
|
||||||
tvTitle.setText(poiEntity.getName());
|
tvTitle.setText(poiEntity.getName());
|
||||||
tvMoney.setText("3.5元");
|
tvMoney.setText("3.5元");
|
||||||
tvTime.setText("到期时间:" + poiEntity.getCreateTime());
|
tvTime.setText("到期时间:" + poiEntity.getCreateTime());
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.navinfo.outdoor.fragment;
|
package com.navinfo.outdoor.fragment;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
@ -25,6 +26,7 @@ import androidx.appcompat.app.AppCompatActivity;
|
|||||||
import androidx.slidingpanelayout.widget.SlidingPaneLayout;
|
import androidx.slidingpanelayout.widget.SlidingPaneLayout;
|
||||||
|
|
||||||
import com.bumptech.glide.Glide;
|
import com.bumptech.glide.Glide;
|
||||||
|
import com.google.gson.Gson;
|
||||||
import com.hjq.permissions.OnPermissionCallback;
|
import com.hjq.permissions.OnPermissionCallback;
|
||||||
import com.hjq.permissions.Permission;
|
import com.hjq.permissions.Permission;
|
||||||
import com.hjq.permissions.XXPermissions;
|
import com.hjq.permissions.XXPermissions;
|
||||||
@ -36,6 +38,7 @@ import com.navinfo.outdoor.R;
|
|||||||
import com.navinfo.outdoor.api.Constant;
|
import com.navinfo.outdoor.api.Constant;
|
||||||
import com.navinfo.outdoor.base.BaseDrawerFragment;
|
import com.navinfo.outdoor.base.BaseDrawerFragment;
|
||||||
import com.navinfo.outdoor.bean.Info;
|
import com.navinfo.outdoor.bean.Info;
|
||||||
|
import com.navinfo.outdoor.bean.PoiBean;
|
||||||
import com.navinfo.outdoor.room.PoiDao;
|
import com.navinfo.outdoor.room.PoiDao;
|
||||||
import com.navinfo.outdoor.room.PoiDatabase;
|
import com.navinfo.outdoor.room.PoiDatabase;
|
||||||
import com.navinfo.outdoor.room.PoiEntity;
|
import com.navinfo.outdoor.room.PoiEntity;
|
||||||
@ -128,20 +131,6 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
|||||||
@Override
|
@Override
|
||||||
protected void initView() {
|
protected void initView() {
|
||||||
super.initView();
|
super.initView();
|
||||||
//存储图片地址
|
|
||||||
photoBean = new ArrayList<>();
|
|
||||||
|
|
||||||
}
|
|
||||||
@Subscribe
|
|
||||||
public void onEvent(Message data) {
|
|
||||||
if (data.what == Constant.OTHER_WORD) {
|
|
||||||
inode = data.obj.toString();
|
|
||||||
Toast.makeText(getContext(), inode, Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
protected void initData() {
|
|
||||||
super.initData();
|
|
||||||
poiDatabase = PoiDatabase.getInstance(getContext());
|
poiDatabase = PoiDatabase.getInstance(getContext());
|
||||||
poiDao = poiDatabase.getPoiDao();
|
poiDao = poiDatabase.getPoiDao();
|
||||||
spinnerOther = findViewById(R.id.spinner_other);
|
spinnerOther = findViewById(R.id.spinner_other);
|
||||||
@ -189,7 +178,6 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
|||||||
rlPicture = findViewById(R.id.rl_picture);
|
rlPicture = findViewById(R.id.rl_picture);
|
||||||
rlPicture.setOnClickListener(this::onClick);
|
rlPicture.setOnClickListener(this::onClick);
|
||||||
ivPicture = findViewById(R.id.iv_picture);
|
ivPicture = findViewById(R.id.iv_picture);
|
||||||
|
|
||||||
rlPictures = findViewById(R.id.rl_pictures);
|
rlPictures = findViewById(R.id.rl_pictures);
|
||||||
rlPictures.setOnClickListener(this::onClick);
|
rlPictures.setOnClickListener(this::onClick);
|
||||||
ivPictures = findViewById(R.id.iv_pictures);
|
ivPictures = findViewById(R.id.iv_pictures);
|
||||||
@ -198,20 +186,58 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
|||||||
btnOtherLocal.setOnClickListener(this::onClick);
|
btnOtherLocal.setOnClickListener(this::onClick);
|
||||||
btnOtherUploading = findViewById(R.id.btn_other_uploading);
|
btnOtherUploading = findViewById(R.id.btn_other_uploading);
|
||||||
btnOtherUploading.setOnClickListener(this::onClick);
|
btnOtherUploading.setOnClickListener(this::onClick);
|
||||||
|
//数据展示
|
||||||
|
initShowPoi();
|
||||||
|
|
||||||
showPoiEntity = (PoiEntity) getArguments().getSerializable("PoiEntity");
|
}
|
||||||
|
@Subscribe
|
||||||
|
public void onEvent(Message data) {
|
||||||
|
if (data.what == Constant.OTHER_WORD) {
|
||||||
|
inode = data.obj.toString();
|
||||||
|
Toast.makeText(getContext(), inode, Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
protected void initData() {
|
||||||
|
super.initData();
|
||||||
|
//存储图片地址
|
||||||
|
photoBean = new ArrayList<>();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initShowPoi() {
|
||||||
|
// 添加信息:
|
||||||
|
showPoiEntity = (PoiEntity) getArguments().getSerializable("poiEntity");
|
||||||
if (showPoiEntity != null) {
|
if (showPoiEntity != null) {
|
||||||
editTaskName.setText(showPoiEntity.getName());
|
String name = showPoiEntity.getName();//名称
|
||||||
inode = showPoiEntity.getX() + "," + showPoiEntity.getY();
|
if (name != null || !name.equals("")) {
|
||||||
editOtherDescribe.setText(showPoiEntity.getDescribe());
|
editTaskName.setText(name + "");
|
||||||
|
}
|
||||||
|
String x = showPoiEntity.getX();
|
||||||
|
String y = showPoiEntity.getY();
|
||||||
|
if (x != null && y != null) {
|
||||||
|
inode = x + "," + y;
|
||||||
|
}
|
||||||
|
String describe = showPoiEntity.getDescribe();//任务描述
|
||||||
|
if (describe != null || !describe.equals("")) {
|
||||||
|
editOtherDescribe.setText(describe);
|
||||||
|
}
|
||||||
if (showPoiEntity.getPhotoInfo() != null) {
|
if (showPoiEntity.getPhotoInfo() != null) {
|
||||||
if (showPoiEntity.getPhotoInfo().get(0).getPhoto() != null) {
|
photoBean.clear();
|
||||||
Glide.with(getActivity()).load(showPoiEntity.getPhotoInfo().get(0).getPhoto()).into(ivPicture);
|
for (int i = 0; i < showPoiEntity.getPhotoInfo().size(); i++) {
|
||||||
|
String photo =showPoiEntity.getPhotoInfo().get(i).getPhoto();
|
||||||
|
String[] split = photo.split("/");
|
||||||
|
char charAt = split[6].charAt(0);
|
||||||
|
if (charAt=='a'){
|
||||||
|
Glide.with(getActivity()).load(photo).into(ivPicture);
|
||||||
|
photoBean.add(new Info(photo));
|
||||||
|
aBoolean=true;
|
||||||
|
}else if (charAt=='b'){
|
||||||
|
Glide.with(getActivity()).load(photo).into(ivPictures);
|
||||||
|
photoBean.add(new Info(photo));
|
||||||
|
bBoolean =true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (showPoiEntity.getPhotoInfo().get(1).getPhoto() != null) {
|
|
||||||
Glide.with(getActivity()).load(showPoiEntity.getPhotoInfo().get(1).getPhoto()).into(ivPictures);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -222,10 +248,12 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
|||||||
case R.id.rl_picture:
|
case R.id.rl_picture:
|
||||||
Intent intentPicture = new Intent("android.media.action.IMAGE_CAPTURE");
|
Intent intentPicture = new Intent("android.media.action.IMAGE_CAPTURE");
|
||||||
startActivityForResult(intentPicture, 101);
|
startActivityForResult(intentPicture, 101);
|
||||||
|
initOtherSharePre();
|
||||||
break;
|
break;
|
||||||
case R.id.rl_pictures:
|
case R.id.rl_pictures:
|
||||||
Intent intentPictures = new Intent("android.media.action.IMAGE_CAPTURE");
|
Intent intentPictures = new Intent("android.media.action.IMAGE_CAPTURE");
|
||||||
startActivityForResult(intentPictures, 102);
|
startActivityForResult(intentPictures, 102);
|
||||||
|
initOtherSharePre();
|
||||||
break;
|
break;
|
||||||
case R.id.btn_other_local:
|
case R.id.btn_other_local:
|
||||||
XXPermissions.with(this)
|
XXPermissions.with(this)
|
||||||
@ -288,10 +316,6 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
|||||||
|
|
||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
Message obtains = Message.obtain();
|
|
||||||
obtains.what = Constant.TREASURE_FRAGMENT;
|
|
||||||
obtains.obj = false;
|
|
||||||
EventBus.getDefault().post(obtains);
|
|
||||||
onBackPressed();
|
onBackPressed();
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(getActivity(), "没有申请权限,请手动申请", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), "没有申请权限,请手动申请", Toast.LENGTH_SHORT).show();
|
||||||
@ -313,6 +337,50 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 防止当页面崩溃后出现数据丢失
|
||||||
|
*/
|
||||||
|
public void initOtherSharePre(){
|
||||||
|
//获取SharedPreferences对象,方法中两个参数的意思为:第一个name
|
||||||
|
//表示文件名,系统将会在/dada/dada/包名/shared_prefs目录下生成
|
||||||
|
//一个以该参数命名的.xml文件。第二个mode表示创建的模式,通过查看
|
||||||
|
//方法注释得知,建议以0或者MODE_PRIVATE为默认值。
|
||||||
|
SharedPreferences poi = getActivity().getSharedPreferences("dataFile", 0);
|
||||||
|
//获取Editor对象
|
||||||
|
SharedPreferences.Editor edit = poi.edit();
|
||||||
|
//根据要保存的数据的类型,调用对应的put方法,
|
||||||
|
PoiEntity poiEntity = new PoiEntity();
|
||||||
|
String name = editTaskName.getText().toString().trim();//名称
|
||||||
|
if (name != null || !name.equals("")) {
|
||||||
|
poiEntity.setName(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (inode != null) {
|
||||||
|
String[] split = inode.split(",");
|
||||||
|
poiEntity.setX(split[0]);
|
||||||
|
poiEntity.setY(split[1]);
|
||||||
|
}
|
||||||
|
String describe = editOtherDescribe.getText().toString().trim();
|
||||||
|
if (describe != null || !describe.equals("")) {
|
||||||
|
poiEntity.setDescribe(describe);
|
||||||
|
}
|
||||||
|
if (photoBean.size() >0) {
|
||||||
|
poiEntity.setPhotoInfo(photoBean);
|
||||||
|
}
|
||||||
|
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(0);
|
||||||
|
String newPoiEntity = new Gson().toJson(poiEntity);
|
||||||
|
//以键值对的形式添加新值。
|
||||||
|
edit.putString("poiEntity", newPoiEntity);
|
||||||
|
//提交新值。必须执行,否则前面的操作都无效。
|
||||||
|
edit.commit();
|
||||||
|
Log.d("TAG", "initPoiSharePre: "+newPoiEntity);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||||
@ -333,11 +401,11 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data);//照片路径
|
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data,"a");//照片路径
|
||||||
Info info = new Info();
|
photoBean.add(new Info(takePhotoPath));
|
||||||
info.setPhoto(takePhotoPath);
|
|
||||||
photoBean.add(info);
|
|
||||||
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;
|
aBoolean=true;
|
||||||
}
|
}
|
||||||
} else if (requestCode == 102 && resultCode == RESULT_OK) {
|
} else if (requestCode == 102 && resultCode == RESULT_OK) {
|
||||||
@ -356,16 +424,15 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data);//照片路径
|
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data,"b");//照片路径
|
||||||
Info info = new Info();
|
photoBean.add(new Info(takePhotoPath));
|
||||||
info.setPhoto(takePhotoPath);
|
|
||||||
photoBean.add(info);
|
|
||||||
ivPictures.setImageBitmap(bitmap);//显示图像
|
ivPictures.setImageBitmap(bitmap);//显示图像
|
||||||
bBoolean=true;
|
bBoolean=true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
if (EventBus.getDefault().isRegistered(this))//加上判断
|
if (EventBus.getDefault().isRegistered(this))//加上判断
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.navinfo.outdoor.fragment;
|
package com.navinfo.outdoor.fragment;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
@ -16,6 +17,7 @@ import android.widget.RelativeLayout;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
import androidx.recyclerview.widget.DividerItemDecoration;
|
||||||
@ -23,6 +25,8 @@ import androidx.recyclerview.widget.LinearLayoutManager;
|
|||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.bumptech.glide.Glide;
|
import com.bumptech.glide.Glide;
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
import com.hjq.permissions.OnPermissionCallback;
|
import com.hjq.permissions.OnPermissionCallback;
|
||||||
import com.hjq.permissions.Permission;
|
import com.hjq.permissions.Permission;
|
||||||
import com.hjq.permissions.XXPermissions;
|
import com.hjq.permissions.XXPermissions;
|
||||||
@ -45,6 +49,7 @@ import com.navinfo.outdoor.util.PhotoPathUtil;
|
|||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
import org.greenrobot.eventbus.Subscribe;
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
@ -69,7 +74,6 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
private PoiRecycleAdapter poiRecycleAdapter;
|
private PoiRecycleAdapter poiRecycleAdapter;
|
||||||
private ArrayList<String> phoneData;
|
private ArrayList<String> phoneData;
|
||||||
private ArrayList<PoiBean> poiBeans;
|
private ArrayList<PoiBean> poiBeans;
|
||||||
private int aInts;
|
|
||||||
private Button btnSaveLocal;
|
private Button btnSaveLocal;
|
||||||
private Button btnUploading;
|
private Button btnUploading;
|
||||||
private PoiDatabase poiDatabase;
|
private PoiDatabase poiDatabase;
|
||||||
@ -80,7 +84,6 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
private boolean bBoolean = false;
|
private boolean bBoolean = false;
|
||||||
private CheckBox checkBoxLife;
|
private CheckBox checkBoxLife;
|
||||||
private CheckBox checkBoxRight;
|
private CheckBox checkBoxRight;
|
||||||
private String phone;
|
|
||||||
private PoiEntity showPoiEntity;
|
private PoiEntity showPoiEntity;
|
||||||
|
|
||||||
public static PoiFragment newInstance(Bundle bundle) {
|
public static PoiFragment newInstance(Bundle bundle) {
|
||||||
@ -115,20 +118,20 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
@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();
|
||||||
@ -175,33 +178,12 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
rlInternalPhotos.setOnClickListener(this::onClick);
|
rlInternalPhotos.setOnClickListener(this::onClick);
|
||||||
rlCard = findViewById(R.id.rl_card);
|
rlCard = findViewById(R.id.rl_card);
|
||||||
rlCard.setOnClickListener(this::onClick);
|
rlCard.setOnClickListener(this::onClick);
|
||||||
|
|
||||||
rlElse = findViewById(R.id.rl_else);
|
rlElse = findViewById(R.id.rl_else);
|
||||||
rlElse.setOnClickListener(this::onClick);
|
rlElse.setOnClickListener(this::onClick);
|
||||||
recyclerPhone = findViewById(R.id.recycler_phone);
|
recyclerPhone = findViewById(R.id.recycler_phone);
|
||||||
|
|
||||||
// 添加信息:
|
|
||||||
showPoiEntity = (PoiEntity) getArguments().getSerializable("PoiEntity");
|
|
||||||
if (showPoiEntity != null) {
|
|
||||||
editNameContent.setText(showPoiEntity.getName());
|
|
||||||
inode = showPoiEntity.getX() + "," + showPoiEntity.getY();
|
|
||||||
editSiteContent.setText(showPoiEntity.getAddress());
|
|
||||||
editDescribe.setText(showPoiEntity.getDescribe());
|
|
||||||
phoneData.add(showPoiEntity.getTelPhone());
|
|
||||||
phone = showPoiEntity.getTelPhone();
|
|
||||||
if (showPoiEntity.getPhotoInfo() != null) {
|
|
||||||
if (showPoiEntity.getPhotoInfo().get(0).getPhoto() != null) {
|
|
||||||
Glide.with(getActivity()).load(showPoiEntity.getPhotoInfo().get(0).getPhoto()).into(ivPanorama);
|
|
||||||
}
|
|
||||||
if (showPoiEntity.getPhotoInfo().get(1).getPhoto() != null) {
|
|
||||||
Glide.with(getActivity()).load(showPoiEntity.getPhotoInfo().get(1).getPhoto()).into(ivName);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
recyclerPhone.setLayoutManager(new LinearLayoutManager(getContext()));
|
recyclerPhone.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||||
recyclerPhone.addItemDecoration(new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL));
|
recyclerPhone.addItemDecoration(new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL));
|
||||||
poiBeans.add(new PoiBean("电话*", phone, R.drawable.icon_add_bg));
|
|
||||||
poiRecycleAdapter = new PoiRecycleAdapter(getContext(), poiBeans);
|
poiRecycleAdapter = new PoiRecycleAdapter(getContext(), poiBeans);
|
||||||
recyclerPhone.setAdapter(poiRecycleAdapter);
|
recyclerPhone.setAdapter(poiRecycleAdapter);
|
||||||
poiRecycleAdapter.setInitPoiClick(new PoiRecycleAdapter.initPoiClick() {
|
poiRecycleAdapter.setInitPoiClick(new PoiRecycleAdapter.initPoiClick() {
|
||||||
@ -231,12 +213,69 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
//数据展示
|
||||||
|
initShowPoi();
|
||||||
//禁用所有可操作控件
|
//禁用所有可操作控件
|
||||||
//disables();
|
//disables();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void initShowPoi() {
|
||||||
|
// 添加信息:
|
||||||
|
showPoiEntity = (PoiEntity) getArguments().getSerializable("poiEntity");
|
||||||
|
if (showPoiEntity != null) {
|
||||||
|
String name = showPoiEntity.getName();//名称
|
||||||
|
if (name != null || !name.equals("")) {
|
||||||
|
editNameContent.setText(name + "");
|
||||||
|
}
|
||||||
|
String address = showPoiEntity.getAddress();//地址
|
||||||
|
if (address != null || !address.equals("")) {
|
||||||
|
editSiteContent.setText(address);
|
||||||
|
}
|
||||||
|
String x = showPoiEntity.getX();
|
||||||
|
String y = showPoiEntity.getY();
|
||||||
|
if (x != null && y != null) {
|
||||||
|
inode = x + "," + y;
|
||||||
|
}
|
||||||
|
String describe = showPoiEntity.getDescribe();//任务描述
|
||||||
|
if (describe != null || !describe.equals("")) {
|
||||||
|
editDescribe.setText(describe);
|
||||||
|
}
|
||||||
|
String telPhone = showPoiEntity.getTelPhone();
|
||||||
|
if (telPhone != null) {
|
||||||
|
phoneData.add(showPoiEntity.getTelPhone());
|
||||||
|
poiBeans.add(new PoiBean("电话*", telPhone, R.drawable.icon_add_bg));
|
||||||
|
}
|
||||||
|
if (showPoiEntity.getPhotoInfo() != null) {
|
||||||
|
photoBean.clear();
|
||||||
|
for (int i = 0; i < showPoiEntity.getPhotoInfo().size(); i++) {
|
||||||
|
String photo =showPoiEntity.getPhotoInfo().get(i).getPhoto();
|
||||||
|
String[] split = photo.split("/");
|
||||||
|
char charAt = split[6].charAt(0);
|
||||||
|
if (charAt=='a'){
|
||||||
|
Glide.with(getActivity()).load(photo).into(ivPanorama);
|
||||||
|
photoBean.add(new Info(photo));
|
||||||
|
}else if (charAt=='b'){
|
||||||
|
Glide.with(getActivity()).load(photo).into(ivName);
|
||||||
|
photoBean.add(new Info(photo));
|
||||||
|
}else if (charAt=='c'){
|
||||||
|
Glide.with(getActivity()).load(photo).into(ivInternal);
|
||||||
|
photoBean.add(new Info(photo));
|
||||||
|
}else if (charAt=='d'){
|
||||||
|
Glide.with(getActivity()).load(photo).into(ivCard);
|
||||||
|
photoBean.add(new Info(photo));
|
||||||
|
|
||||||
|
}else if (charAt=='e'){
|
||||||
|
Glide.with(getActivity()).load(photo).into(ivElse);
|
||||||
|
photoBean.add(new Info(photo));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//禁用所有可操作性控件
|
//禁用所有可操作性控件
|
||||||
private void disables() {
|
private void disables() {
|
||||||
checkBoxLife.setEnabled(false);
|
checkBoxLife.setEnabled(false);
|
||||||
@ -353,10 +392,6 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
|
|
||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
Message obtains = Message.obtain();
|
|
||||||
obtains.what = Constant.TREASURE_FRAGMENT;
|
|
||||||
obtains.obj = false;
|
|
||||||
EventBus.getDefault().post(obtains);
|
|
||||||
onBackPressed();
|
onBackPressed();
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(getActivity(), "没有申请权限,请手动申请", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), "没有申请权限,请手动申请", Toast.LENGTH_SHORT).show();
|
||||||
@ -383,7 +418,6 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
case R.id.tv_examine:
|
case R.id.tv_examine:
|
||||||
Toast.makeText(getContext(), editNameContent.getText().toString(), Toast.LENGTH_SHORT).show();
|
Toast.makeText(getContext(), editNameContent.getText().toString(), Toast.LENGTH_SHORT).show();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case R.id.rl_panorama:
|
case R.id.rl_panorama:
|
||||||
Intent intentPanorama = new Intent("android.media.action.IMAGE_CAPTURE");
|
Intent intentPanorama = new Intent("android.media.action.IMAGE_CAPTURE");
|
||||||
startActivityForResult(intentPanorama, 101);
|
startActivityForResult(intentPanorama, 101);
|
||||||
@ -403,11 +437,65 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
case R.id.rl_else:
|
case R.id.rl_else:
|
||||||
Intent intentElse = new Intent("android.media.action.IMAGE_CAPTURE");
|
Intent intentElse = new Intent("android.media.action.IMAGE_CAPTURE");
|
||||||
startActivityForResult(intentElse, 105);
|
startActivityForResult(intentElse, 105);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 防止当页面崩溃后出现数据丢失
|
||||||
|
*/
|
||||||
|
public void initPoiSharePre() {
|
||||||
|
//获取SharedPreferences对象,方法中两个参数的意思为:第一个name
|
||||||
|
//表示文件名,系统将会在/dada/dada/包名/shared_prefs目录下生成
|
||||||
|
//一个以该参数命名的.xml文件。第二个mode表示创建的模式,通过查看
|
||||||
|
//方法注释得知,建议以0或者MODE_PRIVATE为默认值。
|
||||||
|
SharedPreferences poi = getActivity().getSharedPreferences("dataFile", 0);
|
||||||
|
//获取Editor对象
|
||||||
|
SharedPreferences.Editor edit = poi.edit();
|
||||||
|
//根据要保存的数据的类型,调用对应的put方法,
|
||||||
|
|
||||||
|
PoiEntity poiEntity = new PoiEntity();
|
||||||
|
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 (inode!=null) {
|
||||||
|
String[] split = inode.split(",");
|
||||||
|
poiEntity.setX(split[0]);
|
||||||
|
poiEntity.setY(split[1]);
|
||||||
|
}
|
||||||
|
String describe = editDescribe.getText().toString().trim();
|
||||||
|
if (describe!= null || !describe.equals("")) {
|
||||||
|
poiEntity.setDescribe(describe);
|
||||||
|
}
|
||||||
|
if (phoneData.size() > 0) {
|
||||||
|
poiEntity.setTelPhone(phoneData.get(0));
|
||||||
|
}
|
||||||
|
if (photoBean.size() > 0) {
|
||||||
|
poiEntity.setPhotoInfo(photoBean);
|
||||||
|
}
|
||||||
|
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(0);
|
||||||
|
poiEntity.setTaskStatus(0);
|
||||||
|
String newPoiEntity = new Gson().toJson(poiEntity);
|
||||||
|
//以键值对的形式添加新值。
|
||||||
|
edit.putString("poiEntity", newPoiEntity);
|
||||||
|
//提交新值。必须执行,否则前面的操作都无效。
|
||||||
|
edit.commit();
|
||||||
|
Log.d("TAG", "initPoiSharePre: " + newPoiEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||||
@ -428,10 +516,8 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data);
|
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data,"a");
|
||||||
Info info = new Info();
|
photoBean.add(new Info(takePhotoPath));
|
||||||
info.setPhoto(takePhotoPath);
|
|
||||||
photoBean.add(info);
|
|
||||||
ivPanorama.setImageBitmap(bitmap);//显示图像
|
ivPanorama.setImageBitmap(bitmap);//显示图像
|
||||||
aBoolean = true;
|
aBoolean = true;
|
||||||
}
|
}
|
||||||
@ -452,10 +538,8 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data);
|
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data,"b");
|
||||||
Info info = new Info();
|
photoBean.add(new Info(takePhotoPath));
|
||||||
info.setPhoto(takePhotoPath);
|
|
||||||
photoBean.add(info);
|
|
||||||
ivName.setImageBitmap(bitmap);//显示图像
|
ivName.setImageBitmap(bitmap);//显示图像
|
||||||
bBoolean = true;
|
bBoolean = true;
|
||||||
}
|
}
|
||||||
@ -476,10 +560,8 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data);
|
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data,"c");
|
||||||
Info info = new Info();
|
photoBean.add(new Info(takePhotoPath));
|
||||||
info.setPhoto(takePhotoPath);
|
|
||||||
photoBean.add(info);
|
|
||||||
ivInternal.setImageBitmap(bitmap);//显示图像
|
ivInternal.setImageBitmap(bitmap);//显示图像
|
||||||
}
|
}
|
||||||
} else if (requestCode == 104 && resultCode == RESULT_OK) {
|
} else if (requestCode == 104 && resultCode == RESULT_OK) {
|
||||||
@ -498,10 +580,8 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data);
|
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data,"d");
|
||||||
Info info = new Info();
|
photoBean.add(new Info(takePhotoPath));
|
||||||
info.setPhoto(takePhotoPath);
|
|
||||||
photoBean.add(info);
|
|
||||||
ivCard.setImageBitmap(bitmap);//显示图像
|
ivCard.setImageBitmap(bitmap);//显示图像
|
||||||
}
|
}
|
||||||
} else if (requestCode == 105 && resultCode == RESULT_OK) {
|
} else if (requestCode == 105 && resultCode == RESULT_OK) {
|
||||||
@ -520,16 +600,20 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data);
|
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data,"e");
|
||||||
Info info = new Info();
|
photoBean.add(new Info(takePhotoPath));
|
||||||
info.setPhoto(takePhotoPath);
|
|
||||||
photoBean.add(info);
|
|
||||||
ivElse.setImageBitmap(bitmap);//显示图像
|
ivElse.setImageBitmap(bitmap);//显示图像
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSaveInstanceState(@NonNull Bundle outState) {
|
||||||
|
super.onSaveInstanceState(outState);
|
||||||
|
initPoiSharePre();
|
||||||
|
Log.d("TAG", "onSaveInstanceState: ");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.navinfo.outdoor.fragment;
|
package com.navinfo.outdoor.fragment;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.media.MediaMetadataRetriever;
|
import android.media.MediaMetadataRetriever;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -16,6 +17,8 @@ import android.widget.RadioGroup;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.hjq.permissions.OnPermissionCallback;
|
import com.hjq.permissions.OnPermissionCallback;
|
||||||
import com.hjq.permissions.Permission;
|
import com.hjq.permissions.Permission;
|
||||||
@ -53,6 +56,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
|||||||
private RadioGroup rgType;
|
private RadioGroup rgType;
|
||||||
private PoiDatabase poiDatabase;
|
private PoiDatabase poiDatabase;
|
||||||
private PoiDao poiDao;
|
private PoiDao poiDao;
|
||||||
|
private PoiEntity showPoiEntity;
|
||||||
|
|
||||||
public static PoiVideoFragment newInstance(Bundle bundle) {
|
public static PoiVideoFragment newInstance(Bundle bundle) {
|
||||||
PoiVideoFragment fragment = new PoiVideoFragment();
|
PoiVideoFragment fragment = new PoiVideoFragment();
|
||||||
@ -119,12 +123,32 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
|||||||
btnRoadSave = (Button) findViewById(R.id.btn_road_save);
|
btnRoadSave = (Button) findViewById(R.id.btn_road_save);
|
||||||
btnRoadSave.setOnClickListener(this::onClick);
|
btnRoadSave.setOnClickListener(this::onClick);
|
||||||
rgType = (RadioGroup) findViewById(R.id.rg_type);
|
rgType = (RadioGroup) findViewById(R.id.rg_type);
|
||||||
|
//添加数据
|
||||||
|
initShowPoi();
|
||||||
//禁用可操作性控件
|
//禁用可操作性控件
|
||||||
// disables();
|
// disables();
|
||||||
//获取
|
//获取
|
||||||
}
|
}
|
||||||
|
private void initShowPoi() {
|
||||||
|
// 添加信息:
|
||||||
|
showPoiEntity = (PoiEntity) getArguments().getSerializable("poiEntity");
|
||||||
|
if (showPoiEntity != null) {
|
||||||
|
String name = showPoiEntity.getName();//名称
|
||||||
|
if (name != null || !name.equals("")) {
|
||||||
|
etRoadName.setText(name + "");
|
||||||
|
}
|
||||||
|
String extend = showPoiEntity.getExtend();
|
||||||
|
if (extend!=null||!extend.equals("")){
|
||||||
|
RoadExtend roadExtend = new Gson().fromJson(extend, RoadExtend.class);
|
||||||
|
int type= roadExtend.getType();
|
||||||
|
showPictureType(type);
|
||||||
|
}
|
||||||
|
String describe = showPoiEntity.getDescribe();//任务描述
|
||||||
|
if (describe != null || !describe.equals("")) {
|
||||||
|
etDesc.setText(describe);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
private void disables() {
|
private void disables() {
|
||||||
etRoadName.setEnabled(false);
|
etRoadName.setEnabled(false);
|
||||||
rgType.setEnabled(false);
|
rgType.setEnabled(false);
|
||||||
@ -204,9 +228,13 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
|||||||
new Thread(new Runnable() {
|
new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
if (showPoiEntity != null) {
|
||||||
|
poiDao.updatePoiEntity(poiEntity);
|
||||||
|
}
|
||||||
poiDao.insertPoiEntity(poiEntity);
|
poiDao.insertPoiEntity(poiEntity);
|
||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
|
onBackPressed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,6 +257,57 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSaveInstanceState(@NonNull Bundle outState) {
|
||||||
|
super.onSaveInstanceState(outState);
|
||||||
|
initPoiVideoSharePre();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*防止程序崩溃后数据丢失
|
||||||
|
*/
|
||||||
|
public void initPoiVideoSharePre(){
|
||||||
|
//获取SharedPreferences对象,方法中两个参数的意思为:第一个name
|
||||||
|
//表示文件名,系统将会在/dada/dada/包名/shared_prefs目录下生成
|
||||||
|
//一个以该参数命名的.xml文件。第二个mode表示创建的模式,通过查看
|
||||||
|
//方法注释得知,建议以0或者MODE_PRIVATE为默认值。
|
||||||
|
SharedPreferences poi = getActivity().getSharedPreferences("dataFile", 0);
|
||||||
|
//获取Editor对象
|
||||||
|
SharedPreferences.Editor edit = poi.edit();
|
||||||
|
//根据要保存的数据的类型,调用对应的put方法,
|
||||||
|
|
||||||
|
PoiEntity poiEntity = new PoiEntity();
|
||||||
|
String roadName = etRoadName.getText().toString().trim();
|
||||||
|
if (roadName != null || !roadName.equals("")) {
|
||||||
|
poiEntity.setName(roadName);
|
||||||
|
}
|
||||||
|
RoadExtend roadExtend = new RoadExtend();
|
||||||
|
int type = getPictureType();
|
||||||
|
if (type != -1) {
|
||||||
|
roadExtend.setType(type);
|
||||||
|
Gson gson = new Gson();
|
||||||
|
String roadExtendJson = gson.toJson(roadExtend);
|
||||||
|
poiEntity.setExtend(roadExtendJson);
|
||||||
|
}
|
||||||
|
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);
|
||||||
|
String newPoiEntity = new Gson().toJson(poiEntity);
|
||||||
|
//以键值对的形式添加新值。
|
||||||
|
edit.putString("poiEntity", newPoiEntity);
|
||||||
|
//提交新值。必须执行,否则前面的操作都无效。
|
||||||
|
edit.commit();
|
||||||
|
Log.d("TAG", "initRoadSharePre: "+newPoiEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//获取拍照类型
|
//获取拍照类型
|
||||||
private int getPictureType() {
|
private int getPictureType() {
|
||||||
if (rbCar != null && rbCar.isChecked()) {
|
if (rbCar != null && rbCar.isChecked()) {
|
||||||
@ -242,4 +321,20 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
|||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
private void showPictureType(int type){
|
||||||
|
switch (type){
|
||||||
|
case 0:
|
||||||
|
rbCar.setChecked(true);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
rbBicycle.setChecked(true);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
rbWalking.setChecked(true);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
rbManual.setChecked(true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,6 +1,7 @@
|
|||||||
package com.navinfo.outdoor.fragment;
|
package com.navinfo.outdoor.fragment;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.media.MediaMetadataRetriever;
|
import android.media.MediaMetadataRetriever;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -16,6 +17,9 @@ import android.widget.RadioGroup;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import com.bumptech.glide.Glide;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.hjq.permissions.OnPermissionCallback;
|
import com.hjq.permissions.OnPermissionCallback;
|
||||||
import com.hjq.permissions.Permission;
|
import com.hjq.permissions.Permission;
|
||||||
@ -24,6 +28,7 @@ import com.navinfo.outdoor.R;
|
|||||||
import com.navinfo.outdoor.activity.PictureActivity;
|
import com.navinfo.outdoor.activity.PictureActivity;
|
||||||
import com.navinfo.outdoor.api.Constant;
|
import com.navinfo.outdoor.api.Constant;
|
||||||
import com.navinfo.outdoor.base.BaseDrawerFragment;
|
import com.navinfo.outdoor.base.BaseDrawerFragment;
|
||||||
|
import com.navinfo.outdoor.bean.PoiBean;
|
||||||
import com.navinfo.outdoor.bean.RoadExtend;
|
import com.navinfo.outdoor.bean.RoadExtend;
|
||||||
import com.navinfo.outdoor.room.PoiDao;
|
import com.navinfo.outdoor.room.PoiDao;
|
||||||
import com.navinfo.outdoor.room.PoiDatabase;
|
import com.navinfo.outdoor.room.PoiDatabase;
|
||||||
@ -120,12 +125,32 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
|||||||
btnRoadSave = (Button) findViewById(R.id.btn_road_save);
|
btnRoadSave = (Button) findViewById(R.id.btn_road_save);
|
||||||
btnRoadSave.setOnClickListener(this::onClick);
|
btnRoadSave.setOnClickListener(this::onClick);
|
||||||
rgType = (RadioGroup) findViewById(R.id.rg_type);
|
rgType = (RadioGroup) findViewById(R.id.rg_type);
|
||||||
|
//数据展示
|
||||||
|
initShowPoi();
|
||||||
//禁用可操作性控件
|
//禁用可操作性控件
|
||||||
// disables();
|
// disables();
|
||||||
//获取
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
private void initShowPoi() {
|
||||||
|
// 添加信息:
|
||||||
|
showPoiEntity = (PoiEntity) getArguments().getSerializable("poiEntity");
|
||||||
|
if (showPoiEntity != null) {
|
||||||
|
String name = showPoiEntity.getName();//名称
|
||||||
|
if (name != null || !name.equals("")) {
|
||||||
|
etRoadName.setText(name + "");
|
||||||
|
}
|
||||||
|
String extend = showPoiEntity.getExtend();
|
||||||
|
if (extend!=null||!extend.equals("")){
|
||||||
|
RoadExtend roadExtend = new Gson().fromJson(extend, RoadExtend.class);
|
||||||
|
int type= roadExtend.getType();
|
||||||
|
showPictureType(type);
|
||||||
|
}
|
||||||
|
String describe = showPoiEntity.getDescribe();//任务描述
|
||||||
|
if (describe != null || !describe.equals("")) {
|
||||||
|
etDesc.setText(describe);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void disables() {
|
private void disables() {
|
||||||
etRoadName.setEnabled(false);
|
etRoadName.setEnabled(false);
|
||||||
@ -237,6 +262,56 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSaveInstanceState(@NonNull Bundle outState) {
|
||||||
|
super.onSaveInstanceState(outState);
|
||||||
|
initRoadSharePre();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*防止程序崩溃后数据丢失
|
||||||
|
*/
|
||||||
|
public void initRoadSharePre(){
|
||||||
|
//获取SharedPreferences对象,方法中两个参数的意思为:第一个name
|
||||||
|
//表示文件名,系统将会在/dada/dada/包名/shared_prefs目录下生成
|
||||||
|
//一个以该参数命名的.xml文件。第二个mode表示创建的模式,通过查看
|
||||||
|
//方法注释得知,建议以0或者MODE_PRIVATE为默认值。
|
||||||
|
SharedPreferences poi = getActivity().getSharedPreferences("dataFile", 0);
|
||||||
|
//获取Editor对象
|
||||||
|
SharedPreferences.Editor edit = poi.edit();
|
||||||
|
//根据要保存的数据的类型,调用对应的put方法,
|
||||||
|
|
||||||
|
PoiEntity poiEntity = new PoiEntity();
|
||||||
|
String roadName = etRoadName.getText().toString().trim();
|
||||||
|
if (roadName != null || !roadName.equals("")) {
|
||||||
|
poiEntity.setName(roadName);
|
||||||
|
}
|
||||||
|
RoadExtend roadExtend = new RoadExtend();
|
||||||
|
int type = getPictureType();
|
||||||
|
if (type != -1) {
|
||||||
|
roadExtend.setType(type);
|
||||||
|
Gson gson = new Gson();
|
||||||
|
String roadExtendJson = gson.toJson(roadExtend);
|
||||||
|
poiEntity.setExtend(roadExtendJson);
|
||||||
|
}
|
||||||
|
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(1);
|
||||||
|
String newPoiEntity = new Gson().toJson(poiEntity);
|
||||||
|
//以键值对的形式添加新值。
|
||||||
|
edit.putString("poiEntity", newPoiEntity);
|
||||||
|
//提交新值。必须执行,否则前面的操作都无效。
|
||||||
|
edit.commit();
|
||||||
|
Log.d("TAG", "initRoadSharePre: "+newPoiEntity);
|
||||||
|
}
|
||||||
|
|
||||||
//获取拍照类型
|
//获取拍照类型
|
||||||
private int getPictureType() {
|
private int getPictureType() {
|
||||||
if (rbCar != null && rbCar.isChecked()) {
|
if (rbCar != null && rbCar.isChecked()) {
|
||||||
@ -250,4 +325,20 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
|||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
private void showPictureType(int type){
|
||||||
|
switch (type){
|
||||||
|
case 0:
|
||||||
|
rbCar.setChecked(true);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
rbBicycle.setChecked(true);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
rbWalking.setChecked(true);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
rbManual.setChecked(true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,6 +1,7 @@
|
|||||||
package com.navinfo.outdoor.fragment;
|
package com.navinfo.outdoor.fragment;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.BitmapFactory;
|
import android.graphics.BitmapFactory;
|
||||||
import android.graphics.Matrix;
|
import android.graphics.Matrix;
|
||||||
@ -38,6 +39,7 @@ import com.navinfo.outdoor.activity.FragmentManagement;
|
|||||||
import com.navinfo.outdoor.api.Constant;
|
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.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;
|
||||||
@ -159,9 +161,125 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
uiSettings.setLogoScale(0.7f);
|
uiSettings.setLogoScale(0.7f);
|
||||||
//开启定位权限
|
//开启定位权限
|
||||||
checkNetWork();
|
checkNetWork();
|
||||||
|
//检查是否有没有填完的页面
|
||||||
|
initSharePre();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void initSharePre() {
|
||||||
|
//根据保存时所用的name属性,获取SharedPreferences对象
|
||||||
|
SharedPreferences dataFile = getActivity().getSharedPreferences("dataFile", 0);
|
||||||
|
//根据数据类型,调用对应的get方法,通过键取得对应的值。
|
||||||
|
String dataFileString = dataFile.getString("poiEntity", null);
|
||||||
|
String pileFileString = dataFile.getString("chargingPileEntity", null);
|
||||||
|
if (dataFileString!=null){
|
||||||
|
PoiEntity poiEntity = new Gson().fromJson(dataFileString, PoiEntity.class);
|
||||||
|
switch (poiEntity.getType()){
|
||||||
|
case 0:
|
||||||
|
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
|
||||||
|
MessageDialog.show((AppCompatActivity) getContext(), "提示", "你poi页面还有未提交完的数据", "确定").setOkButton(new OnDialogButtonClickListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||||
|
Bundle bundle = new Bundle();
|
||||||
|
bundle.putSerializable("poiEntity", poiEntity);
|
||||||
|
PoiFragment poiFragment = PoiFragment.newInstance(bundle);
|
||||||
|
showSlidingFragment(poiFragment);
|
||||||
|
initRemovePoiSharePre();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
|
||||||
|
MessageDialog.show((AppCompatActivity) getContext(), "提示", "你道路页面还有未提交完的数据", "确定").setOkButton(new OnDialogButtonClickListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||||
|
Bundle bundle = new Bundle();
|
||||||
|
bundle.putSerializable("poiEntity",poiEntity);
|
||||||
|
RoadFragment roadFragment = RoadFragment.newInstance(bundle);
|
||||||
|
showSlidingFragment(roadFragment);
|
||||||
|
initRemovePoiSharePre();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
|
||||||
|
MessageDialog.show((AppCompatActivity) getContext(), "提示", "你充电站页面还有未提交完的数据", "确定").setOkButton(new OnDialogButtonClickListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||||
|
Bundle bundle = new Bundle();
|
||||||
|
bundle.putSerializable("poiEntity",poiEntity);
|
||||||
|
ChargingStationFragment chargingStationFragment = ChargingStationFragment.newInstance(bundle);
|
||||||
|
showSlidingFragment(chargingStationFragment);
|
||||||
|
initRemovePoiSharePre();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
|
||||||
|
MessageDialog.show((AppCompatActivity) getContext(), "提示", "你其他页面还有未提交完的数据", "确定").setOkButton(new OnDialogButtonClickListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||||
|
Bundle bundle = new Bundle();
|
||||||
|
bundle.putSerializable("poiEntity",poiEntity);
|
||||||
|
OtherFragment otherFragment = OtherFragment.newInstance(bundle);
|
||||||
|
showSlidingFragment(otherFragment);
|
||||||
|
initRemovePoiSharePre();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
|
||||||
|
MessageDialog.show((AppCompatActivity) getContext(), "提示", "你poi录像页面还有未提交完的数据", "确定").setOkButton(new OnDialogButtonClickListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||||
|
Bundle bundle = new Bundle();
|
||||||
|
bundle.putSerializable("poiEntity",poiEntity);
|
||||||
|
PoiVideoFragment poiVideoFragment = PoiVideoFragment.newInstance(bundle);
|
||||||
|
showSlidingFragment(poiVideoFragment);
|
||||||
|
initRemovePoiSharePre();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (pileFileString!=null){
|
||||||
|
ChargingPileEntity chargingPileEntity = new Gson().fromJson(pileFileString, ChargingPileEntity.class);
|
||||||
|
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
|
||||||
|
MessageDialog.show((AppCompatActivity) getContext(), "提示", "你充电桩页面还有未提交完的数据", "确定").setOkButton(new OnDialogButtonClickListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||||
|
Bundle bundle = new Bundle();
|
||||||
|
bundle.putSerializable("chargingPileEntity",chargingPileEntity);
|
||||||
|
ChargingStationFragment chargingStationFragment = ChargingStationFragment.newInstance(bundle);
|
||||||
|
showSlidingFragment(chargingStationFragment);
|
||||||
|
initRemovePoiSharePre();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void initRemovePoiSharePre() {
|
||||||
|
//获取SharedPreferences对象,方法中两个参数的意思为:第一个name
|
||||||
|
//表示文件名,系统将会在/dada/dada/包名/shared_prefs目录下生成
|
||||||
|
//一个以该参数命名的.xml文件。第二个mode表示创建的模式,通过查看
|
||||||
|
//方法注释得知,建议以0或者MODE_PRIVATE为默认值。
|
||||||
|
SharedPreferences poi = getActivity().getSharedPreferences("dataFile", 0);
|
||||||
|
//获取Editor对象
|
||||||
|
SharedPreferences.Editor edit = poi.edit();
|
||||||
|
//根据要保存的数据的类型,调用对应的put方法,
|
||||||
|
//以键值对的形式添加新值。
|
||||||
|
edit.putString("poiEntity", null);
|
||||||
|
edit.putString("chargingPileEntity", null);
|
||||||
|
//提交新值。必须执行,否则前面的操作都无效。
|
||||||
|
edit.commit();
|
||||||
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onEvent(Message data) {
|
public void onEvent(Message data) {
|
||||||
if (data.what == Constant.FILTER_LIST_ITEM) { // 点击筛选的item
|
if (data.what == Constant.FILTER_LIST_ITEM) { // 点击筛选的item
|
||||||
@ -173,7 +291,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
frameLayout.setVisibility(View.VISIBLE);
|
frameLayout.setVisibility(View.VISIBLE);
|
||||||
fragmentTransaction = supportFragmentManager.beginTransaction();
|
fragmentTransaction = supportFragmentManager.beginTransaction();
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putSerializable("PoiEntity", poiEntity);
|
bundle.putSerializable("poiEntity", poiEntity);
|
||||||
gatherGetFragment = GatherGetFragment.newInstance(bundle);
|
gatherGetFragment = GatherGetFragment.newInstance(bundle);
|
||||||
fragmentTransaction.replace(R.id.frame_layout, gatherGetFragment);
|
fragmentTransaction.replace(R.id.frame_layout, gatherGetFragment);
|
||||||
fragmentTransaction.commit();
|
fragmentTransaction.commit();
|
||||||
@ -181,7 +299,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
PoiEntity poiEntity = (PoiEntity) data.obj;
|
PoiEntity poiEntity = (PoiEntity) data.obj;
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putBoolean("isSliding", false); // 通知抽屉不收回
|
bundle.putBoolean("isSliding", false); // 通知抽屉不收回
|
||||||
bundle.putSerializable("PoiEntity", poiEntity);
|
bundle.putSerializable("poiEntity", poiEntity);
|
||||||
frameLayout.setVisibility(View.GONE);
|
frameLayout.setVisibility(View.GONE);
|
||||||
fragmentTransaction.remove(gatherGetFragment);
|
fragmentTransaction.remove(gatherGetFragment);
|
||||||
switch (poiEntity.getType()) {
|
switch (poiEntity.getType()) {
|
||||||
@ -244,6 +362,12 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
bundle.putInt("pid", (Integer) data.obj);
|
bundle.putInt("pid", (Integer) data.obj);
|
||||||
ChargingPileFragment chargingPileFragment = ChargingPileFragment.newInstance(bundle);
|
ChargingPileFragment chargingPileFragment = ChargingPileFragment.newInstance(bundle);
|
||||||
showSlidingFragment(chargingPileFragment);
|
showSlidingFragment(chargingPileFragment);
|
||||||
|
} else if (data.what == Constant.CHARGING_STATION_PILE) {//充电站的充电桩
|
||||||
|
Bundle bundle = new Bundle();
|
||||||
|
bundle.putBoolean("isSliding", false); // 通知抽屉不收回
|
||||||
|
bundle.putSerializable("chargingPileEntity",(ChargingPileEntity) data.obj);
|
||||||
|
ChargingPileFragment chargingPileFragment = ChargingPileFragment.newInstance(bundle);
|
||||||
|
showSlidingFragment(chargingPileFragment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -168,13 +168,13 @@ public class UserAttestationFragment extends BaseFragment implements View.OnClic
|
|||||||
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||||
super.onActivityResult(requestCode, resultCode, data);
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
if (requestCode == 100 && resultCode == RESULT_OK) {
|
if (requestCode == 100 && resultCode == RESULT_OK) {
|
||||||
takePhotoPath1 = PhotoPathUtil.getTakePhotoPath(data);
|
takePhotoPath1 = PhotoPathUtil.getTakePhotoPath(data,"a");
|
||||||
Bundle extras = data.getExtras();//从Intent中获取附加值
|
Bundle extras = data.getExtras();//从Intent中获取附加值
|
||||||
//从附加值中获取返回的图像
|
//从附加值中获取返回的图像
|
||||||
Bitmap bitmap = (Bitmap) extras.get("data");
|
Bitmap bitmap = (Bitmap) extras.get("data");
|
||||||
ivAttestation1.setImageBitmap(bitmap);//显示图像
|
ivAttestation1.setImageBitmap(bitmap);//显示图像
|
||||||
} else if (requestCode == 200 && resultCode == RESULT_OK) {
|
} else if (requestCode == 200 && resultCode == RESULT_OK) {
|
||||||
takePhotoPath2 = PhotoPathUtil.getTakePhotoPath(data);
|
takePhotoPath2 = PhotoPathUtil.getTakePhotoPath(data,"b");
|
||||||
Bundle extras = data.getExtras();//从Intent中获取附加值
|
Bundle extras = data.getExtras();//从Intent中获取附加值
|
||||||
//从附加值中获取返回的图像
|
//从附加值中获取返回的图像
|
||||||
Bitmap bitmap = (Bitmap) extras.get("data");
|
Bitmap bitmap = (Bitmap) extras.get("data");
|
||||||
|
@ -9,6 +9,7 @@ import com.navinfo.outdoor.bean.Info;
|
|||||||
import com.navinfo.outdoor.util.PhotoInfoConverter;
|
import com.navinfo.outdoor.util.PhotoInfoConverter;
|
||||||
import com.navinfo.outdoor.util.StringTypeConverter;
|
import com.navinfo.outdoor.util.StringTypeConverter;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static androidx.room.ForeignKey.CASCADE;
|
import static androidx.room.ForeignKey.CASCADE;
|
||||||
@ -19,7 +20,7 @@ import static androidx.room.ForeignKey.CASCADE;
|
|||||||
* 注解中包含Delete = CASCADE, 你可以告诉SQLite,如果相应的PoiEntity实例被删除,那么删除这个PoiEntity下的所有ChargingPileEntity。
|
* 注解中包含Delete = CASCADE, 你可以告诉SQLite,如果相应的PoiEntity实例被删除,那么删除这个PoiEntity下的所有ChargingPileEntity。
|
||||||
*/
|
*/
|
||||||
@Entity(tableName = "pile")
|
@Entity(tableName = "pile")
|
||||||
public class ChargingPileEntity {
|
public class ChargingPileEntity implements Serializable {
|
||||||
@PrimaryKey(autoGenerate = true) // 设置主键,并且自动生长
|
@PrimaryKey(autoGenerate = true) // 设置主键,并且自动生长
|
||||||
private int pileId;
|
private int pileId;
|
||||||
private String name;//名称
|
private String name;//名称
|
||||||
|
@ -55,7 +55,7 @@ public class PoiEntity implements Serializable {
|
|||||||
private String y;//纬度
|
private String y;//纬度
|
||||||
private String detail;//深度信息
|
private String detail;//深度信息
|
||||||
private int taskStatus;//任务状态 0.待提交,1.已提交,2 已领取
|
private int taskStatus;//任务状态 0.待提交,1.已提交,2 已领取
|
||||||
private int type;//0.poi,1.道路,2.充电站,3.其他
|
private int type;//0.poi,1.道路,2.充电站,3.其他 ,4,poi录像
|
||||||
private int station_type;//0.全部,1.poi,2.道路,3.充电站,4.其他
|
private int station_type;//0.全部,1.poi,2.道路,3.充电站,4.其他
|
||||||
|
|
||||||
public int getStation_type() {
|
public int getStation_type() {
|
||||||
|
@ -21,7 +21,7 @@ import java.util.Date;
|
|||||||
*/
|
*/
|
||||||
public class PhotoPathUtil {
|
public class PhotoPathUtil {
|
||||||
|
|
||||||
public static String getTakePhotoPath(Intent data) {
|
public static String getTakePhotoPath(Intent data,String d) {
|
||||||
Bitmap photo = null;
|
Bitmap photo = null;
|
||||||
Uri uri = data.getData();
|
Uri uri = data.getData();
|
||||||
if (uri != null) {
|
if (uri != null) {
|
||||||
@ -43,7 +43,7 @@ public class PhotoPathUtil {
|
|||||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||||
String format = formatter.format(calendar.getTime());
|
String format = formatter.format(calendar.getTime());
|
||||||
//文件
|
//文件
|
||||||
File file = new File(Constant.PICTURE_FOLDER, format + ".jpg");
|
File file = new File(Constant.PICTURE_FOLDER, d+format + ".jpg");
|
||||||
/***打开文件输出流*/
|
/***打开文件输出流*/
|
||||||
fileOutputStream = new FileOutputStream(file);
|
fileOutputStream = new FileOutputStream(file);
|
||||||
// 生成图片文件
|
// 生成图片文件
|
||||||
|
@ -352,40 +352,6 @@
|
|||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
>
|
>
|
||||||
<RelativeLayout
|
|
||||||
android:id="@+id/rl_card"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:background="#03A9F4"
|
|
||||||
android:layout_marginRight="5dp"
|
|
||||||
android:layout_marginBottom="10dp">
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/image_card"
|
|
||||||
android:layout_centerHorizontal="true"
|
|
||||||
android:layout_width="20dp"
|
|
||||||
android:layout_marginTop="20dp"
|
|
||||||
android:background="@drawable/explain1"
|
|
||||||
android:layout_height="20dp"
|
|
||||||
/>
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_centerHorizontal="true"
|
|
||||||
android:text="服务说明"
|
|
||||||
android:textSize="8sp"
|
|
||||||
android:layout_margin="5dp"
|
|
||||||
android:textColor="@color/pickerview_wheelview_textcolor_divider"
|
|
||||||
android:layout_below="@id/image_card"
|
|
||||||
/>
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/iv_card"
|
|
||||||
android:layout_centerInParent="true"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
/>
|
|
||||||
</RelativeLayout>
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/rl_else"
|
android:id="@+id/rl_else"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
@ -454,6 +420,15 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
/>
|
/>
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_marginRight="5dp"
|
||||||
|
android:layout_marginBottom="10dp">
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
@ -18,8 +18,6 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:gravity="center">
|
android:gravity="center">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<com.tencent.tencentmap.mapsdk.maps.MapView
|
<com.tencent.tencentmap.mapsdk.maps.MapView
|
||||||
android:id="@+id/treasure_map"
|
android:id="@+id/treasure_map"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user