充电站和充电桩 的存储逻辑
This commit is contained in:
parent
d3c725ac57
commit
286b9dfc89
@ -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"
|
||||||
|
@ -18,6 +18,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||||||
import com.navinfo.outdoor.R;
|
import com.navinfo.outdoor.R;
|
||||||
import com.navinfo.outdoor.bean.PoiBean;
|
import com.navinfo.outdoor.bean.PoiBean;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -25,11 +26,15 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public class PoiRecycleAdapter extends RecyclerView.Adapter<PoiRecycleAdapter.MyViewHolder> {
|
public class PoiRecycleAdapter extends RecyclerView.Adapter<PoiRecycleAdapter.MyViewHolder> {
|
||||||
private Context context;
|
private Context context;
|
||||||
private List<PoiBean> list;
|
private List<PoiBean> list=new ArrayList<>();
|
||||||
|
|
||||||
public PoiRecycleAdapter(Context context, List<PoiBean> list) {
|
public PoiRecycleAdapter(Context context) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.list = list;
|
}
|
||||||
|
|
||||||
|
public void setList(List<PoiBean> list) {
|
||||||
|
this.list.addAll(list);
|
||||||
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -33,6 +33,8 @@ public class Constant {
|
|||||||
//筛选
|
//筛选
|
||||||
public static final int FILTER_CODE = 0x200;
|
public static final int FILTER_CODE = 0x200;
|
||||||
|
|
||||||
|
public static final String DATA_FILE = "dataFile";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//message word 值
|
//message word 值
|
||||||
@ -42,6 +44,7 @@ public class Constant {
|
|||||||
public static final int FILTER_LIST = 4;//筛选列表所有数据地图显示
|
public static final int FILTER_LIST = 4;//筛选列表所有数据地图显示
|
||||||
public static final int FILTER_LIST_ITEM = 5;//点击筛选的item
|
public static final int FILTER_LIST_ITEM = 5;//点击筛选的item
|
||||||
public static final int GATHER_GET = 6;//点击开始采集
|
public static final int GATHER_GET = 6;//点击开始采集
|
||||||
|
public static final int GATHER_IS_SLIDING_GET =2;//通知抽屉不收回
|
||||||
public static final int TREASURE_GATHER_GET_WORD = 7;//领取采集页面其他marker 的回传
|
public static final int TREASURE_GATHER_GET_WORD = 7;//领取采集页面其他marker 的回传
|
||||||
public static final int MAIN_BUTTON_VISIABLE = 8; // 控制主界面各个按钮显隐状态的what值
|
public static final int MAIN_BUTTON_VISIABLE = 8; // 控制主界面各个按钮显隐状态的what值
|
||||||
public static final int MAIN_HEADER = 9; // 控制主界面各个header
|
public static final int MAIN_HEADER = 9; // 控制主界面各个header
|
||||||
|
@ -76,7 +76,7 @@ public abstract class BaseDrawerFragment extends BaseFragment {
|
|||||||
//表示文件名,系统将会在/dada/dada/包名/shared_prefs目录下生成
|
//表示文件名,系统将会在/dada/dada/包名/shared_prefs目录下生成
|
||||||
//一个以该参数命名的.xml文件。第二个mode表示创建的模式,通过查看
|
//一个以该参数命名的.xml文件。第二个mode表示创建的模式,通过查看
|
||||||
//方法注释得知,建议以0或者MODE_PRIVATE为默认值。
|
//方法注释得知,建议以0或者MODE_PRIVATE为默认值。
|
||||||
SharedPreferences poi = getActivity().getSharedPreferences("dataFile", 0);
|
SharedPreferences poi = getActivity().getSharedPreferences(Constant.DATA_FILE, 0);
|
||||||
//获取Editor对象
|
//获取Editor对象
|
||||||
SharedPreferences.Editor edit = poi.edit();
|
SharedPreferences.Editor edit = poi.edit();
|
||||||
//根据要保存的数据的类型,调用对应的put方法,
|
//根据要保存的数据的类型,调用对应的put方法,
|
||||||
|
@ -87,6 +87,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
|||||||
private int cp_availableState = 0;
|
private int cp_availableState = 0;
|
||||||
private CheckBox checkButton1, checkButton2, checkButton3, checkButton4, checkButton5, checkButton6;
|
private CheckBox checkButton1, checkButton2, checkButton3, checkButton4, checkButton5, checkButton6;
|
||||||
private int pid;
|
private int pid;
|
||||||
|
private String station;
|
||||||
|
|
||||||
public static ChargingPileFragment newInstance(Bundle bundle) {
|
public static ChargingPileFragment newInstance(Bundle bundle) {
|
||||||
ChargingPileFragment fragment = new ChargingPileFragment();
|
ChargingPileFragment fragment = new ChargingPileFragment();
|
||||||
@ -356,31 +357,34 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
|||||||
rlDevice = findViewById(R.id.rl_device);
|
rlDevice = findViewById(R.id.rl_device);
|
||||||
rlDevice.setOnClickListener(this::onClick);
|
rlDevice.setOnClickListener(this::onClick);
|
||||||
ivDevice = findViewById(R.id.iv_device);
|
ivDevice = findViewById(R.id.iv_device);
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
//展示数据
|
//展示数据
|
||||||
initShowPileSharePre();
|
initShowPileSharePre();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initShowPileSharePre() {
|
private void initShowPileSharePre() {
|
||||||
|
station = getArguments().getString("station");
|
||||||
|
if (station!=null){
|
||||||
|
PoiEntity poiEntity = new Gson().fromJson(station, PoiEntity.class);
|
||||||
|
pid = poiEntity.getId();
|
||||||
|
}
|
||||||
// 添加信息:
|
// 添加信息:
|
||||||
pid = getArguments().getInt("pid", 0);
|
|
||||||
ChargingPileEntity chargingPileEntity = (ChargingPileEntity) getArguments().getSerializable("chargingPileEntity");
|
ChargingPileEntity chargingPileEntity = (ChargingPileEntity) getArguments().getSerializable("chargingPileEntity");
|
||||||
if (chargingPileEntity != null) {
|
if (chargingPileEntity != null) {
|
||||||
String name = chargingPileEntity.getName();//名称
|
String name = chargingPileEntity.getName();//名称
|
||||||
if (name != null || !name.equals("")) {
|
if (name != null) {
|
||||||
editNameContent.setText(name + "");
|
editNameContent.setText(name + "");
|
||||||
}
|
}
|
||||||
String p = chargingPileEntity.getP();
|
String p = chargingPileEntity.getP();
|
||||||
if (p != null || !p.equals("")) {
|
if (p != null) {
|
||||||
inode = p;
|
inode = p;
|
||||||
}
|
}
|
||||||
String memo = chargingPileEntity.getMemo();
|
String memo = chargingPileEntity.getMemo();
|
||||||
if (memo != null || !memo.equals("")) {
|
if (memo != null) {
|
||||||
editDescribe.setText(memo);
|
editDescribe.setText(memo);
|
||||||
}
|
}
|
||||||
int fid = chargingPileEntity.getFid();
|
int fid = chargingPileEntity.getFid();
|
||||||
@ -548,21 +552,21 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
|||||||
chargingPileEntity.setCp_floor(cp_floor);
|
chargingPileEntity.setCp_floor(cp_floor);
|
||||||
}
|
}
|
||||||
String tagPanorama = (String) ivPanorama.getTag();
|
String tagPanorama = (String) ivPanorama.getTag();
|
||||||
if (tagPanorama == null || tagPanorama.equals("")) {
|
if (tagPanorama == null) {
|
||||||
Toast.makeText(getActivity(), "请拍照 全景图", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), "请拍照 全景图", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
photoBean.add(tagPanorama);
|
photoBean.add(tagPanorama);
|
||||||
}
|
}
|
||||||
String tagCoding = (String) ivCoding.getTag();
|
String tagCoding = (String) ivCoding.getTag();
|
||||||
if (tagCoding == null || tagCoding.equals("")) {
|
if (tagCoding == null) {
|
||||||
Toast.makeText(getActivity(), "请拍照 充电桩编码", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), "请拍照 充电桩编码", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
photoBean.add(tagCoding);
|
photoBean.add(tagCoding);
|
||||||
}
|
}
|
||||||
String tagEquipment = (String) ivEquipment.getTag();
|
String tagEquipment = (String) ivEquipment.getTag();
|
||||||
if (tagEquipment == null || tagEquipment.equals("")) {
|
if (tagEquipment == null ) {
|
||||||
Toast.makeText(getActivity(), "请拍照 设备编码", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), "请拍照 设备编码", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
@ -570,21 +574,21 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
|||||||
}
|
}
|
||||||
String tagFacility = (String) ivFacility.getTag();
|
String tagFacility = (String) ivFacility.getTag();
|
||||||
if (sign_exist != 0) {
|
if (sign_exist != 0) {
|
||||||
if (tagFacility == null || tagFacility.equals("")) {
|
if (tagFacility == null) {
|
||||||
Toast.makeText(getActivity(), "请拍照 设备编码", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), "请拍照 设备编码", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
photoBean.add(tagFacility);
|
photoBean.add(tagFacility);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (tagFacility != null || !tagFacility.equals("")) {
|
if (tagFacility != null ) {
|
||||||
photoBean.add(tagFacility);
|
photoBean.add(tagFacility);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String tagScutcheon = (String) ivScutcheon.getTag();
|
String tagScutcheon = (String) ivScutcheon.getTag();
|
||||||
if (sign_exist == 1) {
|
if (sign_exist == 1) {
|
||||||
if (tagScutcheon == null || tagScutcheon.equals("")) {
|
if (tagScutcheon == null ) {
|
||||||
Toast.makeText(getActivity(), "请拍照 设备编码", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), "请拍照 设备编码", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
@ -594,7 +598,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
|||||||
|
|
||||||
String tagDevice = (String) ivDevice.getTag();
|
String tagDevice = (String) ivDevice.getTag();
|
||||||
if (sign_exist == 1) {
|
if (sign_exist == 1) {
|
||||||
if (tagDevice == null || tagDevice.equals("")) {
|
if (tagDevice == null) {
|
||||||
Toast.makeText(getActivity(), "请拍照 设备编码", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), "请拍照 设备编码", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
@ -603,25 +607,25 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
|||||||
}
|
}
|
||||||
|
|
||||||
String tagUsable = (String) ivUsable.getTag();
|
String tagUsable = (String) ivUsable.getTag();
|
||||||
if (tagUsable == null || tagUsable.equals("")) {
|
if (tagUsable == null) {
|
||||||
Toast.makeText(getActivity(), "请拍照 可用状态", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), "请拍照 可用状态", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
photoBean.add(tagUsable);
|
photoBean.add(tagUsable);
|
||||||
}
|
}
|
||||||
String tagAvailable = (String) ivAvailable.getTag();
|
String tagAvailable = (String) ivAvailable.getTag();
|
||||||
if (tagAvailable != null || !tagAvailable.equals("")) {
|
if (tagAvailable != null) {
|
||||||
photoBean.add(tagAvailable);
|
photoBean.add(tagAvailable);
|
||||||
}
|
}
|
||||||
String tagParking = (String) ivParking.getTag();
|
String tagParking = (String) ivParking.getTag();
|
||||||
if (tagParking == null || tagParking.equals("")) {
|
if (tagParking == null ) {
|
||||||
Toast.makeText(getActivity(), "请拍照 停车位编号", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), "请拍照 停车位编号", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
photoBean.add(tagPanorama);
|
photoBean.add(tagPanorama);
|
||||||
}
|
}
|
||||||
String tagNumber = (String) ivNumber.getTag();
|
String tagNumber = (String) ivNumber.getTag();
|
||||||
if (tagNumber != null || !tagNumber.equals("")) {
|
if (tagNumber != null ) {
|
||||||
photoBean.add(tagNumber);
|
photoBean.add(tagNumber);
|
||||||
}
|
}
|
||||||
chargingPileEntity.setPhotos(photoBean);
|
chargingPileEntity.setPhotos(photoBean);
|
||||||
@ -726,7 +730,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
|||||||
//表示文件名,系统将会在/dada/dada/包名/shared_prefs目录下生成
|
//表示文件名,系统将会在/dada/dada/包名/shared_prefs目录下生成
|
||||||
//一个以该参数命名的.xml文件。第二个mode表示创建的模式,通过查看
|
//一个以该参数命名的.xml文件。第二个mode表示创建的模式,通过查看
|
||||||
//方法注释得知,建议以0或者MODE_PRIVATE为默认值。
|
//方法注释得知,建议以0或者MODE_PRIVATE为默认值。
|
||||||
SharedPreferences poi = getActivity().getSharedPreferences("dataFile", 0);
|
SharedPreferences poi = getActivity().getSharedPreferences(Constant.DATA_FILE, 0);
|
||||||
//获取Editor对象
|
//获取Editor对象
|
||||||
SharedPreferences.Editor edit = poi.edit();
|
SharedPreferences.Editor edit = poi.edit();
|
||||||
//根据要保存的数据的类型,调用对应的put方法,
|
//根据要保存的数据的类型,调用对应的put方法,
|
||||||
@ -736,7 +740,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
|||||||
chargingPileEntity.setP(inode);
|
chargingPileEntity.setP(inode);
|
||||||
}
|
}
|
||||||
String name = editNameContent.getText().toString().trim();//名称
|
String name = editNameContent.getText().toString().trim();//名称
|
||||||
if (name != null || !name.equals("")) {
|
if (name != null ||!name.equals("")) {
|
||||||
chargingPileEntity.setName(name);
|
chargingPileEntity.setName(name);
|
||||||
}
|
}
|
||||||
if (cp_floor != 0) {
|
if (cp_floor != 0) {
|
||||||
@ -795,6 +799,9 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
|||||||
String newChargingPileEntity = new Gson().toJson(chargingPileEntity);
|
String newChargingPileEntity = new Gson().toJson(chargingPileEntity);
|
||||||
//以键值对的形式添加新值。
|
//以键值对的形式添加新值。
|
||||||
edit.putString("chargingPileEntity", newChargingPileEntity);
|
edit.putString("chargingPileEntity", newChargingPileEntity);
|
||||||
|
if (station!=null){
|
||||||
|
edit.putString("poiEntity", station);
|
||||||
|
}
|
||||||
//提交新值。必须执行,否则前面的操作都无效。
|
//提交新值。必须执行,否则前面的操作都无效。
|
||||||
edit.commit();
|
edit.commit();
|
||||||
Log.d("TAG", "initPileSharePre: " + newChargingPileEntity);
|
Log.d("TAG", "initPileSharePre: " + newChargingPileEntity);
|
||||||
|
@ -87,7 +87,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
private String inode;
|
private String inode;
|
||||||
private CheckBox checkBoxLife;
|
private CheckBox checkBoxLife;
|
||||||
private CheckBox checkBoxRight;
|
private CheckBox checkBoxRight;
|
||||||
private String phone;
|
private String phone=null;
|
||||||
private Spinner spinnerType;
|
private Spinner spinnerType;
|
||||||
String[] ctype = new String[]{"全部", "poi", "道路", "充电站", "其他"};
|
String[] ctype = new String[]{"全部", "poi", "道路", "充电站", "其他"};
|
||||||
private ArrayAdapter<String> adapter;
|
private ArrayAdapter<String> adapter;
|
||||||
@ -228,10 +228,8 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNothingSelected(AdapterView<?> parent) {
|
public void onNothingSelected(AdapterView<?> parent) {}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
//添加桩
|
//添加桩
|
||||||
linearChargingPile = findViewById(R.id.linear_charging_pile);
|
linearChargingPile = findViewById(R.id.linear_charging_pile);
|
||||||
@ -263,8 +261,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
recyclerPhone = findViewById(R.id.recycler_phone);
|
recyclerPhone = findViewById(R.id.recycler_phone);
|
||||||
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());
|
||||||
poiRecycleAdapter = new PoiRecycleAdapter(getContext(), poiBeans);
|
|
||||||
recyclerPhone.setAdapter(poiRecycleAdapter);
|
recyclerPhone.setAdapter(poiRecycleAdapter);
|
||||||
poiRecycleAdapter.setInitPoiClick(new PoiRecycleAdapter.initPoiClick() {
|
poiRecycleAdapter.setInitPoiClick(new PoiRecycleAdapter.initPoiClick() {
|
||||||
@Override
|
@Override
|
||||||
@ -309,11 +306,11 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
showPoiEntity = (PoiEntity) getArguments().getSerializable("poiEntity");
|
showPoiEntity = (PoiEntity) getArguments().getSerializable("poiEntity");
|
||||||
if (showPoiEntity != null) {
|
if (showPoiEntity != null) {
|
||||||
String name = showPoiEntity.getName();//名称
|
String name = showPoiEntity.getName();//名称
|
||||||
if (name != null || !name.equals("")) {
|
if (name != null) {
|
||||||
editNameContent.setText(name + "");
|
editNameContent.setText(name + "");
|
||||||
}
|
}
|
||||||
String address = showPoiEntity.getAddress();//地址
|
String address = showPoiEntity.getAddress();//地址
|
||||||
if (address != null || !address.equals("")) {
|
if (address != null) {
|
||||||
editSiteContent.setText(address);
|
editSiteContent.setText(address);
|
||||||
}
|
}
|
||||||
String x = showPoiEntity.getX();
|
String x = showPoiEntity.getX();
|
||||||
@ -322,15 +319,15 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
inode = x + "," + y;
|
inode = x + "," + y;
|
||||||
}
|
}
|
||||||
String describe = showPoiEntity.getDescribe();//任务描述
|
String describe = showPoiEntity.getDescribe();//任务描述
|
||||||
if (describe != null || !describe.equals("")) {
|
if (describe != null) {
|
||||||
editDescribe.setText(describe);
|
editDescribe.setText(describe);
|
||||||
}
|
}
|
||||||
String telPhone = showPoiEntity.getTelPhone();
|
String telPhone = showPoiEntity.getTelPhone();
|
||||||
if (telPhone != null) {
|
if (telPhone != null) {
|
||||||
phoneData.add(showPoiEntity.getTelPhone());
|
phoneData.add(showPoiEntity.getTelPhone());
|
||||||
poiBeans.add(new PoiBean("电话*", telPhone, R.drawable.icon_add_bg));
|
poiBeans.add(new PoiBean("电话*", telPhone, R.drawable.icon_add_bg));
|
||||||
|
poiRecycleAdapter.setList(poiBeans);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (showPoiEntity.getPhotoInfo() != null) {
|
if (showPoiEntity.getPhotoInfo() != null) {
|
||||||
for (int i = 0; i < showPoiEntity.getPhotoInfo().size(); i++) {
|
for (int i = 0; i < showPoiEntity.getPhotoInfo().size(); i++) {
|
||||||
String photo = showPoiEntity.getPhotoInfo().get(i).getPhoto();
|
String photo = showPoiEntity.getPhotoInfo().get(i).getPhoto();
|
||||||
@ -373,17 +370,46 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
|
|
||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
|
} else {
|
||||||
|
poiBeans.add(new PoiBean("电话*", phone, R.drawable.icon_add_bg));
|
||||||
|
poiRecycleAdapter.setList(poiBeans);
|
||||||
}
|
}
|
||||||
ChargingPileEntity chargingPileEntity = (ChargingPileEntity) getArguments().getSerializable("chargingPileEntity");
|
initPile();
|
||||||
if (chargingPileEntity != null) {
|
}
|
||||||
|
|
||||||
|
private void initPile() {
|
||||||
|
//根据保存时所用的name属性,获取SharedPreferences对象
|
||||||
|
SharedPreferences dataFile = getActivity().getSharedPreferences(Constant.DATA_FILE, 0);
|
||||||
|
String pileFileString = dataFile.getString("chargingPileEntity", null);
|
||||||
|
if (pileFileString!=null){
|
||||||
|
ChargingPileEntity chargingPileEntity = new Gson().fromJson(pileFileString, ChargingPileEntity.class);
|
||||||
Message obtains = Message.obtain();
|
Message obtains = Message.obtain();
|
||||||
obtains.what = Constant.CHARGING_STATION_PILE;
|
obtains.what = Constant.CHARGING_STATION_PILE;
|
||||||
obtains.obj = chargingPileEntity;
|
obtains.obj = chargingPileEntity;
|
||||||
EventBus.getDefault().post(obtains);
|
EventBus.getDefault().post(obtains);
|
||||||
|
initRemovePileSharePre();
|
||||||
|
|
||||||
|
String showStation = initShowStation();
|
||||||
|
Message obtain = Message.obtain();
|
||||||
|
obtain.what = Constant.CHARGING_STATION;
|
||||||
|
obtain.obj = showStation;
|
||||||
|
EventBus.getDefault().post(obtain);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void initRemovePileSharePre() {
|
||||||
|
//获取SharedPreferences对象,方法中两个参数的意思为:第一个name
|
||||||
|
//表示文件名,系统将会在/dada/dada/包名/shared_prefs目录下生成
|
||||||
|
//一个以该参数命名的.xml文件。第二个mode表示创建的模式,通过查看
|
||||||
|
//方法注释得知,建议以0或者MODE_PRIVATE为默认值。
|
||||||
|
SharedPreferences poi = getActivity().getSharedPreferences(Constant.DATA_FILE, 0);
|
||||||
|
//获取Editor对象
|
||||||
|
SharedPreferences.Editor edit = poi.edit();
|
||||||
|
//根据要保存的数据的类型,调用对应的put方法,以键值对的形式添加新值。
|
||||||
|
edit.putString("chargingPileEntity", null);
|
||||||
|
//提交新值。必须执行,否则前面的操作都无效。
|
||||||
|
edit.commit();
|
||||||
|
}
|
||||||
//禁用所有可操作性控件
|
//禁用所有可操作性控件
|
||||||
private void disables() {
|
private void disables() {
|
||||||
checkBoxLife.setEnabled(false);
|
checkBoxLife.setEnabled(false);
|
||||||
@ -474,35 +500,35 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
}
|
}
|
||||||
|
|
||||||
String tagPanorama = (String) ivPanorama.getTag();
|
String tagPanorama = (String) ivPanorama.getTag();
|
||||||
if (tagPanorama == null || tagPanorama.equals("")) {
|
if (tagPanorama == null) {
|
||||||
Toast.makeText(getActivity(), "请拍照 全景图", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), "请拍照 全景图", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
infoPhoto.add(new Info(tagPanorama));
|
infoPhoto.add(new Info(tagPanorama));
|
||||||
}
|
}
|
||||||
String tagName = (String) ivName.getTag();
|
String tagName = (String) ivName.getTag();
|
||||||
if (tagName == null || tagName.equals("")) {
|
if (tagName == null) {
|
||||||
Toast.makeText(getActivity(), "请拍照 充电桩编码", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), "请拍照 充电桩编码", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
infoPhoto.add(new Info(tagName));
|
infoPhoto.add(new Info(tagName));
|
||||||
}
|
}
|
||||||
String tagInternal = (String) ivInternal.getTag();
|
String tagInternal = (String) ivInternal.getTag();
|
||||||
if (tagInternal == null || tagInternal.equals("")) {
|
if (tagInternal == null) {
|
||||||
Toast.makeText(getActivity(), "请拍照 设备编码", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), "请拍照 设备编码", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
infoPhoto.add(new Info(tagInternal));
|
infoPhoto.add(new Info(tagInternal));
|
||||||
}
|
}
|
||||||
String tagElse = (String) ivElse.getTag();
|
String tagElse = (String) ivElse.getTag();
|
||||||
if (tagElse == null || tagElse.equals("")) {
|
if (tagElse == null ) {
|
||||||
Toast.makeText(getActivity(), "请拍照 设备编码", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), "请拍照 设备编码", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
infoPhoto.add(new Info(tagElse));
|
infoPhoto.add(new Info(tagElse));
|
||||||
}
|
}
|
||||||
String tagScutcheon = (String) ivScutcheon.getTag();
|
String tagScutcheon = (String) ivScutcheon.getTag();
|
||||||
if (tagScutcheon == null || tagScutcheon.equals("")) {
|
if (tagScutcheon == null) {
|
||||||
Toast.makeText(getActivity(), "请拍照 设备编码", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), "请拍照 设备编码", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
@ -524,10 +550,16 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
poiEntity.setCreateTime(format);
|
poiEntity.setCreateTime(format);
|
||||||
poiEntity.setType(2);
|
poiEntity.setType(2);
|
||||||
poiEntity.setTaskStatus(0);
|
poiEntity.setTaskStatus(0);
|
||||||
poiEntity.setTaskId(101);
|
|
||||||
new Thread(new Runnable() {
|
new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
List<PoiEntity> allPoi = poiDao.getAllPoi();
|
||||||
|
getActivity().runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
poiEntity.setTaskId(allPoi.size()+1);
|
||||||
|
}
|
||||||
|
});
|
||||||
poiDao.insertPoiEntity(poiEntity);
|
poiDao.insertPoiEntity(poiEntity);
|
||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
@ -578,14 +610,83 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
startActivityForResult(intentScutcheon, 105);
|
startActivityForResult(intentScutcheon, 105);
|
||||||
break;
|
break;
|
||||||
case R.id.linear_charging_pile:
|
case R.id.linear_charging_pile:
|
||||||
|
String showStation = initShowStation();
|
||||||
Message obtains = Message.obtain();
|
Message obtains = Message.obtain();
|
||||||
obtains.what = Constant.CHARGING_STATION;
|
obtains.what = Constant.CHARGING_STATION;
|
||||||
obtains.obj = 101;
|
obtains.obj = showStation;
|
||||||
EventBus.getDefault().post(obtains);
|
EventBus.getDefault().post(obtains);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String initShowStation() {
|
||||||
|
PoiEntity poiEntity = new PoiEntity();
|
||||||
|
List<Info> infoPhoto = new ArrayList<>();
|
||||||
|
String name = editNameContent.getText().toString().trim();//名称
|
||||||
|
if (name != null || !name.equals("")) {
|
||||||
|
poiEntity.setName(name);
|
||||||
|
}
|
||||||
|
String site = editSiteContent.getText().toString().trim();
|
||||||
|
if (site != null || !site.equals("")) {
|
||||||
|
poiEntity.setAddress(site);
|
||||||
|
}
|
||||||
|
if (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));
|
||||||
|
}
|
||||||
|
String tagPanorama = (String) ivPanorama.getTag();
|
||||||
|
if (tagPanorama != null) {
|
||||||
|
infoPhoto.add(new Info(tagPanorama));
|
||||||
|
}
|
||||||
|
String tagName = (String) ivName.getTag();
|
||||||
|
if (tagName != null) {
|
||||||
|
infoPhoto.add(new Info(tagName));
|
||||||
|
}
|
||||||
|
String tagInternal = (String) ivInternal.getTag();
|
||||||
|
if (tagInternal != null) {
|
||||||
|
infoPhoto.add(new Info(tagInternal));
|
||||||
|
}
|
||||||
|
String tagElse = (String) ivElse.getTag();
|
||||||
|
if (tagElse != null) {
|
||||||
|
infoPhoto.add(new Info(tagElse));
|
||||||
|
}
|
||||||
|
String tagScutcheon = (String) ivScutcheon.getTag();
|
||||||
|
if (tagScutcheon != null ) {
|
||||||
|
infoPhoto.add(new Info(tagScutcheon));
|
||||||
|
}
|
||||||
|
poiEntity.setPhotoInfo(infoPhoto);
|
||||||
|
poiEntity.setStation_type(station_type);
|
||||||
|
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);
|
||||||
|
new Thread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
List<PoiEntity> allPoi = poiDao.getAllPoi();
|
||||||
|
getActivity().runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
poiEntity.setTaskId(allPoi.size()+1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
String newPoiEntity = new Gson().toJson(poiEntity);
|
||||||
|
return newPoiEntity;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSaveInstanceState(@NonNull Bundle outState) {
|
public void onSaveInstanceState(@NonNull Bundle outState) {
|
||||||
super.onSaveInstanceState(outState);
|
super.onSaveInstanceState(outState);
|
||||||
@ -600,7 +701,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
//表示文件名,系统将会在/dada/dada/包名/shared_prefs目录下生成
|
//表示文件名,系统将会在/dada/dada/包名/shared_prefs目录下生成
|
||||||
//一个以该参数命名的.xml文件。第二个mode表示创建的模式,通过查看
|
//一个以该参数命名的.xml文件。第二个mode表示创建的模式,通过查看
|
||||||
//方法注释得知,建议以0或者MODE_PRIVATE为默认值。
|
//方法注释得知,建议以0或者MODE_PRIVATE为默认值。
|
||||||
SharedPreferences poi = getActivity().getSharedPreferences("dataFile", 0);
|
SharedPreferences poi = getActivity().getSharedPreferences(Constant.DATA_FILE, 0);
|
||||||
//获取Editor对象
|
//获取Editor对象
|
||||||
SharedPreferences.Editor edit = poi.edit();
|
SharedPreferences.Editor edit = poi.edit();
|
||||||
//根据要保存的数据的类型,调用对应的put方法,
|
//根据要保存的数据的类型,调用对应的put方法,
|
||||||
@ -656,7 +757,18 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
poiEntity.setCreateTime(format);
|
poiEntity.setCreateTime(format);
|
||||||
poiEntity.setType(2);
|
poiEntity.setType(2);
|
||||||
poiEntity.setTaskStatus(0);
|
poiEntity.setTaskStatus(0);
|
||||||
poiEntity.setTaskId(101);
|
new Thread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
List<PoiEntity> allPoi = poiDao.getAllPoi();
|
||||||
|
getActivity().runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
poiEntity.setTaskId(allPoi.size()+1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
String newPoiEntity = new Gson().toJson(poiEntity);
|
String newPoiEntity = new Gson().toJson(poiEntity);
|
||||||
//以键值对的形式添加新值。
|
//以键值对的形式添加新值。
|
||||||
edit.putString("poiEntity", newPoiEntity);
|
edit.putString("poiEntity", newPoiEntity);
|
||||||
|
@ -10,6 +10,7 @@ import android.widget.Toast;
|
|||||||
|
|
||||||
import com.navinfo.outdoor.R;
|
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.BaseFragment;
|
import com.navinfo.outdoor.base.BaseFragment;
|
||||||
import com.navinfo.outdoor.room.PoiEntity;
|
import com.navinfo.outdoor.room.PoiEntity;
|
||||||
|
|
||||||
@ -46,6 +47,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
|||||||
}
|
}
|
||||||
//主界面获取焦点
|
//主界面获取焦点
|
||||||
private void getFocus() {
|
private void getFocus() {
|
||||||
|
boolean aBoolean = getArguments().getBoolean("boolean", true);
|
||||||
getView().setFocusableInTouchMode(true);
|
getView().setFocusableInTouchMode(true);
|
||||||
getView().requestFocus();
|
getView().requestFocus();
|
||||||
getView().setOnKeyListener(new View.OnKeyListener() {
|
getView().setOnKeyListener(new View.OnKeyListener() {
|
||||||
@ -54,7 +56,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
|
|||||||
if (event.getAction() == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) {
|
if (event.getAction() == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) {
|
||||||
Message obtain = Message.obtain();
|
Message obtain = Message.obtain();
|
||||||
obtain.what = Constant.GATHER_GET_RETURN;
|
obtain.what = Constant.GATHER_GET_RETURN;
|
||||||
obtain.obj = true;
|
obtain.obj = aBoolean;
|
||||||
EventBus.getDefault().post(obtain);
|
EventBus.getDefault().post(obtain);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
|||||||
|
|
||||||
|
|
||||||
private Spinner spinnerOther;
|
private Spinner spinnerOther;
|
||||||
String[] others = new String[]{"下拉选择", "门牌", "道路施工", "标牌采集", "公交", "其他"};
|
String[] others = new String[]{ "门牌", "道路施工", "标牌采集", "公交", "其他"};
|
||||||
private String inode;
|
private String inode;
|
||||||
private EditText editTaskName, editOtherDescribe;
|
private EditText editTaskName, editOtherDescribe;
|
||||||
private RelativeLayout rlPicture;
|
private RelativeLayout rlPicture;
|
||||||
@ -156,9 +156,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
|||||||
case 4:
|
case 4:
|
||||||
Toast.makeText(getActivity(), others[4], Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), others[4], Toast.LENGTH_SHORT).show();
|
||||||
break;
|
break;
|
||||||
case 5:
|
|
||||||
Toast.makeText(getActivity(), others[5], Toast.LENGTH_SHORT).show();
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -212,14 +210,14 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
|||||||
showPoiEntity = (PoiEntity) getArguments().getSerializable("poiEntity");
|
showPoiEntity = (PoiEntity) getArguments().getSerializable("poiEntity");
|
||||||
if (showPoiEntity != null) {
|
if (showPoiEntity != null) {
|
||||||
String name = showPoiEntity.getName();//名称
|
String name = showPoiEntity.getName();//名称
|
||||||
if (name != null || !name.equals("")) {
|
if (name != null ) {
|
||||||
editTaskName.setText(name + ""); }
|
editTaskName.setText(name + ""); }
|
||||||
String x = showPoiEntity.getX();
|
String x = showPoiEntity.getX();
|
||||||
String y = showPoiEntity.getY();
|
String y = showPoiEntity.getY();
|
||||||
if (x != null && y != null) {
|
if (x != null && y != null) {
|
||||||
inode = x + "," + y; }
|
inode = x + "," + y; }
|
||||||
String describe = showPoiEntity.getDescribe();//任务描述
|
String describe = showPoiEntity.getDescribe();//任务描述
|
||||||
if (describe != null || !describe.equals("")) {
|
if (describe != null) {
|
||||||
editOtherDescribe.setText(describe); }
|
editOtherDescribe.setText(describe); }
|
||||||
if (showPoiEntity.getPhotoInfo() != null) {
|
if (showPoiEntity.getPhotoInfo() != null) {
|
||||||
for (int i = 0; i < showPoiEntity.getPhotoInfo().size(); i++) {
|
for (int i = 0; i < showPoiEntity.getPhotoInfo().size(); i++) {
|
||||||
@ -286,14 +284,14 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
|||||||
poiEntity.setDescribe(describe);
|
poiEntity.setDescribe(describe);
|
||||||
}
|
}
|
||||||
String tagPicture = (String) ivPicture.getTag();
|
String tagPicture = (String) ivPicture.getTag();
|
||||||
if (tagPicture == null || tagPicture.equals("")) {
|
if (tagPicture == null) {
|
||||||
Toast.makeText(getActivity(), "请 拍照", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), "请 拍照", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
infoList.add(new Info(tagPicture));
|
infoList.add(new Info(tagPicture));
|
||||||
}
|
}
|
||||||
String tagPictures = (String) ivPictures.getTag();
|
String tagPictures = (String) ivPictures.getTag();
|
||||||
if (tagPictures == null || tagPictures.equals("")) {
|
if (tagPictures == null ) {
|
||||||
Toast.makeText(getActivity(), "请 拍照", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), "请 拍照", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
@ -344,7 +342,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
|||||||
//表示文件名,系统将会在/dada/dada/包名/shared_prefs目录下生成
|
//表示文件名,系统将会在/dada/dada/包名/shared_prefs目录下生成
|
||||||
//一个以该参数命名的.xml文件。第二个mode表示创建的模式,通过查看
|
//一个以该参数命名的.xml文件。第二个mode表示创建的模式,通过查看
|
||||||
//方法注释得知,建议以0或者MODE_PRIVATE为默认值。
|
//方法注释得知,建议以0或者MODE_PRIVATE为默认值。
|
||||||
SharedPreferences poi = getActivity().getSharedPreferences("dataFile", 0);
|
SharedPreferences poi = getActivity().getSharedPreferences(Constant.DATA_FILE, 0);
|
||||||
//获取Editor对象
|
//获取Editor对象
|
||||||
SharedPreferences.Editor edit = poi.edit();
|
SharedPreferences.Editor edit = poi.edit();
|
||||||
//根据要保存的数据的类型,调用对应的put方法,
|
//根据要保存的数据的类型,调用对应的put方法,
|
||||||
|
@ -180,8 +180,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
recyclerPhone = findViewById(R.id.recycler_phone);
|
recyclerPhone = findViewById(R.id.recycler_phone);
|
||||||
recyclerPhone.setLayoutManager(new LinearLayoutManager(getContext()));
|
recyclerPhone.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||||
recyclerPhone.addItemDecoration(new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL));
|
recyclerPhone.addItemDecoration(new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL));
|
||||||
|
poiRecycleAdapter = new PoiRecycleAdapter(getContext());
|
||||||
poiRecycleAdapter = new PoiRecycleAdapter(getContext(), poiBeans);
|
|
||||||
recyclerPhone.setAdapter(poiRecycleAdapter);
|
recyclerPhone.setAdapter(poiRecycleAdapter);
|
||||||
poiRecycleAdapter.setInitPoiClick(new PoiRecycleAdapter.initPoiClick() {
|
poiRecycleAdapter.setInitPoiClick(new PoiRecycleAdapter.initPoiClick() {
|
||||||
@Override
|
@Override
|
||||||
@ -223,11 +222,11 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
showPoiEntity = (PoiEntity) getArguments().getSerializable("poiEntity");
|
showPoiEntity = (PoiEntity) getArguments().getSerializable("poiEntity");
|
||||||
if (showPoiEntity != null) {
|
if (showPoiEntity != null) {
|
||||||
String name = showPoiEntity.getName();//名称
|
String name = showPoiEntity.getName();//名称
|
||||||
if (name != null || !name.equals("")) {
|
if (name != null) {
|
||||||
editNameContent.setText(name + "");
|
editNameContent.setText(name + "");
|
||||||
}
|
}
|
||||||
String address = showPoiEntity.getAddress();//地址
|
String address = showPoiEntity.getAddress();//地址
|
||||||
if (address != null || !address.equals("")) {
|
if (address != null) {
|
||||||
editSiteContent.setText(address);
|
editSiteContent.setText(address);
|
||||||
}
|
}
|
||||||
String x = showPoiEntity.getX();
|
String x = showPoiEntity.getX();
|
||||||
@ -236,13 +235,15 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
inode = x + "," + y;
|
inode = x + "," + y;
|
||||||
}
|
}
|
||||||
String describe = showPoiEntity.getDescribe();//任务描述
|
String describe = showPoiEntity.getDescribe();//任务描述
|
||||||
if (describe != null || !describe.equals("")) {
|
if (describe != null) {
|
||||||
editDescribe.setText(describe);
|
editDescribe.setText(describe);
|
||||||
}
|
}
|
||||||
String telPhone = showPoiEntity.getTelPhone();
|
String telPhone = showPoiEntity.getTelPhone();
|
||||||
if (telPhone != null) {
|
if (telPhone != null) {
|
||||||
phoneData.add(showPoiEntity.getTelPhone());
|
phoneData.add(showPoiEntity.getTelPhone());
|
||||||
poiBeans.add(new PoiBean("电话*", telPhone, R.drawable.icon_add_bg));
|
poiBeans.add(new PoiBean("电话*", telPhone, R.drawable.icon_add_bg));
|
||||||
|
poiRecycleAdapter.setList(poiBeans);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (showPoiEntity.getPhotoInfo() != null) {
|
if (showPoiEntity.getPhotoInfo() != null) {
|
||||||
for (int i = 0; i < showPoiEntity.getPhotoInfo().size(); i++) {
|
for (int i = 0; i < showPoiEntity.getPhotoInfo().size(); i++) {
|
||||||
@ -266,6 +267,9 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}else {
|
||||||
|
poiBeans.add(new PoiBean("电话*", "", R.drawable.icon_add_bg));
|
||||||
|
poiRecycleAdapter.setList(poiBeans);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -354,29 +358,29 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
poiEntity.setTelPhone(phoneData.get(0));
|
poiEntity.setTelPhone(phoneData.get(0));
|
||||||
}
|
}
|
||||||
String tagPanorama = (String) ivPanorama.getTag();
|
String tagPanorama = (String) ivPanorama.getTag();
|
||||||
if (tagPanorama == null || tagPanorama.equals("")) {
|
if (tagPanorama == null) {
|
||||||
Toast.makeText(getActivity(), "请拍照 全景图", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), "请拍照 全景图", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
infoPhoto.add(new Info(tagPanorama));
|
infoPhoto.add(new Info(tagPanorama));
|
||||||
}
|
}
|
||||||
String tagName = (String) ivName.getTag();
|
String tagName = (String) ivName.getTag();
|
||||||
if (tagName == null || tagName.equals("")) {
|
if (tagName == null) {
|
||||||
Toast.makeText(getActivity(), "请拍照 充电桩编码", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), "请拍照 充电桩编码", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
infoPhoto.add(new Info(tagName));
|
infoPhoto.add(new Info(tagName));
|
||||||
}
|
}
|
||||||
String tagInternal = (String) ivInternal.getTag();
|
String tagInternal = (String) ivInternal.getTag();
|
||||||
if (tagInternal != null || !tagInternal.equals("")) {
|
if (tagInternal != null) {
|
||||||
infoPhoto.add(new Info(tagInternal));
|
infoPhoto.add(new Info(tagInternal));
|
||||||
}
|
}
|
||||||
String tagElse = (String) ivElse.getTag();
|
String tagElse = (String) ivElse.getTag();
|
||||||
if (tagElse != null ||! tagElse.equals("")) {
|
if (tagElse != null) {
|
||||||
infoPhoto.add(new Info(tagElse));
|
infoPhoto.add(new Info(tagElse));
|
||||||
}
|
}
|
||||||
String tagCard = (String) ivCard.getTag();
|
String tagCard = (String) ivCard.getTag();
|
||||||
if (tagCard != null || !tagCard.equals("")) {
|
if (tagCard != null) {
|
||||||
infoPhoto.add(new Info(tagCard));
|
infoPhoto.add(new Info(tagCard));
|
||||||
}
|
}
|
||||||
poiEntity.setPhotoInfo(infoPhoto);
|
poiEntity.setPhotoInfo(infoPhoto);
|
||||||
@ -457,7 +461,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
//表示文件名,系统将会在/dada/dada/包名/shared_prefs目录下生成
|
//表示文件名,系统将会在/dada/dada/包名/shared_prefs目录下生成
|
||||||
//一个以该参数命名的.xml文件。第二个mode表示创建的模式,通过查看
|
//一个以该参数命名的.xml文件。第二个mode表示创建的模式,通过查看
|
||||||
//方法注释得知,建议以0或者MODE_PRIVATE为默认值。
|
//方法注释得知,建议以0或者MODE_PRIVATE为默认值。
|
||||||
SharedPreferences poi = getActivity().getSharedPreferences("dataFile", 0);
|
SharedPreferences poi = getActivity().getSharedPreferences(Constant.DATA_FILE, 0);
|
||||||
//获取Editor对象
|
//获取Editor对象
|
||||||
SharedPreferences.Editor edit = poi.edit();
|
SharedPreferences.Editor edit = poi.edit();
|
||||||
//根据要保存的数据的类型,调用对应的put方法,
|
//根据要保存的数据的类型,调用对应的put方法,
|
||||||
|
@ -271,7 +271,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
|||||||
//表示文件名,系统将会在/dada/dada/包名/shared_prefs目录下生成
|
//表示文件名,系统将会在/dada/dada/包名/shared_prefs目录下生成
|
||||||
//一个以该参数命名的.xml文件。第二个mode表示创建的模式,通过查看
|
//一个以该参数命名的.xml文件。第二个mode表示创建的模式,通过查看
|
||||||
//方法注释得知,建议以0或者MODE_PRIVATE为默认值。
|
//方法注释得知,建议以0或者MODE_PRIVATE为默认值。
|
||||||
SharedPreferences poi = getActivity().getSharedPreferences("dataFile", 0);
|
SharedPreferences poi = getActivity().getSharedPreferences(Constant.DATA_FILE, 0);
|
||||||
//获取Editor对象
|
//获取Editor对象
|
||||||
SharedPreferences.Editor edit = poi.edit();
|
SharedPreferences.Editor edit = poi.edit();
|
||||||
//根据要保存的数据的类型,调用对应的put方法,
|
//根据要保存的数据的类型,调用对应的put方法,
|
||||||
|
@ -35,6 +35,9 @@ import com.navinfo.outdoor.room.PoiDatabase;
|
|||||||
import com.navinfo.outdoor.room.PoiEntity;
|
import com.navinfo.outdoor.room.PoiEntity;
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
|
import org.json.JSONArray;
|
||||||
|
import org.json.JSONException;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
@ -152,7 +155,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void disables() {
|
private void disables() throws JSONException {
|
||||||
etRoadName.setEnabled(false);
|
etRoadName.setEnabled(false);
|
||||||
rgType.setEnabled(false);
|
rgType.setEnabled(false);
|
||||||
ivRoadPicture.setEnabled(false);
|
ivRoadPicture.setEnabled(false);
|
||||||
@ -276,7 +279,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
|||||||
//表示文件名,系统将会在/dada/dada/包名/shared_prefs目录下生成
|
//表示文件名,系统将会在/dada/dada/包名/shared_prefs目录下生成
|
||||||
//一个以该参数命名的.xml文件。第二个mode表示创建的模式,通过查看
|
//一个以该参数命名的.xml文件。第二个mode表示创建的模式,通过查看
|
||||||
//方法注释得知,建议以0或者MODE_PRIVATE为默认值。
|
//方法注释得知,建议以0或者MODE_PRIVATE为默认值。
|
||||||
SharedPreferences poi = getActivity().getSharedPreferences("dataFile", 0);
|
SharedPreferences poi = getActivity().getSharedPreferences(Constant.DATA_FILE, 0);
|
||||||
//获取Editor对象
|
//获取Editor对象
|
||||||
SharedPreferences.Editor edit = poi.edit();
|
SharedPreferences.Editor edit = poi.edit();
|
||||||
//根据要保存的数据的类型,调用对应的put方法,
|
//根据要保存的数据的类型,调用对应的put方法,
|
||||||
|
@ -99,6 +99,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
private LinearLayout dragView;
|
private LinearLayout dragView;
|
||||||
private ImageView ivMessage;
|
private ImageView ivMessage;
|
||||||
private PoiDao poiDao;
|
private PoiDao poiDao;
|
||||||
|
private ChargingPileEntity chargingPileEntity;
|
||||||
|
|
||||||
public static TreasureFragment newInstance(Bundle bundle) {
|
public static TreasureFragment newInstance(Bundle bundle) {
|
||||||
TreasureFragment fragment = new TreasureFragment();
|
TreasureFragment fragment = new TreasureFragment();
|
||||||
@ -183,7 +184,28 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
public void run() {
|
public void run() {
|
||||||
for (int i = 0; i < allPoi.size(); i++) {
|
for (int i = 0; i < allPoi.size(); i++) {
|
||||||
LatLng position = new LatLng(Double.valueOf(allPoi.get(i).getX()), Double.valueOf(allPoi.get(i).getY()));
|
LatLng position = new LatLng(Double.valueOf(allPoi.get(i).getX()), Double.valueOf(allPoi.get(i).getY()));
|
||||||
tencentMap.addMarker(new MarkerOptions(position));
|
Marker marker = tencentMap.addMarker(new MarkerOptions(position));
|
||||||
|
marker.setClickable(true);
|
||||||
|
PoiEntity poiEntity = allPoi.get(i);
|
||||||
|
tencentMap.setOnMarkerClickListener(new TencentMap.OnMarkerClickListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onMarkerClick(Marker marker) {
|
||||||
|
sliding_layout.setPanelHeight(0);
|
||||||
|
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN);
|
||||||
|
frameLayout.setVisibility(View.VISIBLE);
|
||||||
|
setMainButtonVisiable(View.GONE);
|
||||||
|
fragmentTransaction = supportFragmentManager.beginTransaction();
|
||||||
|
Bundle bundle = new Bundle();
|
||||||
|
bundle.putSerializable("poiEntity",poiEntity);
|
||||||
|
bundle.putBoolean("boolean",false);
|
||||||
|
gatherGetFragment = GatherGetFragment.newInstance(bundle);
|
||||||
|
fragmentTransaction.replace(R.id.frame_layout, gatherGetFragment);
|
||||||
|
fragmentTransaction.commit();
|
||||||
|
Toast.makeText(getActivity(), marker.getId()+"", Toast.LENGTH_SHORT).show();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -193,10 +215,9 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
|
|
||||||
private void initSharePre() {
|
private void initSharePre() {
|
||||||
//根据保存时所用的name属性,获取SharedPreferences对象
|
//根据保存时所用的name属性,获取SharedPreferences对象
|
||||||
SharedPreferences dataFile = getActivity().getSharedPreferences("dataFile", 0);
|
SharedPreferences dataFile = getActivity().getSharedPreferences(Constant.DATA_FILE, 0);
|
||||||
//根据数据类型,调用对应的get方法,通过键取得对应的值。
|
//根据数据类型,调用对应的get方法,通过键取得对应的值。
|
||||||
String dataFileString = dataFile.getString("poiEntity", null);
|
String dataFileString = dataFile.getString("poiEntity", null);
|
||||||
|
|
||||||
if (dataFileString!=null){
|
if (dataFileString!=null){
|
||||||
PoiEntity poiEntity = new Gson().fromJson(dataFileString, PoiEntity.class);
|
PoiEntity poiEntity = new Gson().fromJson(dataFileString, PoiEntity.class);
|
||||||
switch (poiEntity.getType()){
|
switch (poiEntity.getType()){
|
||||||
@ -272,35 +293,18 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String pileFileString = dataFile.getString("chargingPileEntity", null);
|
|
||||||
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() {
|
public void initRemovePoiSharePre() {
|
||||||
//获取SharedPreferences对象,方法中两个参数的意思为:第一个name
|
//获取SharedPreferences对象,方法中两个参数的意思为:第一个name
|
||||||
//表示文件名,系统将会在/dada/dada/包名/shared_prefs目录下生成
|
//表示文件名,系统将会在/dada/dada/包名/shared_prefs目录下生成
|
||||||
//一个以该参数命名的.xml文件。第二个mode表示创建的模式,通过查看
|
//一个以该参数命名的.xml文件。第二个mode表示创建的模式,通过查看
|
||||||
//方法注释得知,建议以0或者MODE_PRIVATE为默认值。
|
//方法注释得知,建议以0或者MODE_PRIVATE为默认值。
|
||||||
SharedPreferences poi = getActivity().getSharedPreferences("dataFile", 0);
|
SharedPreferences poi = getActivity().getSharedPreferences(Constant.DATA_FILE, 0);
|
||||||
//获取Editor对象
|
//获取Editor对象
|
||||||
SharedPreferences.Editor edit = poi.edit();
|
SharedPreferences.Editor edit = poi.edit();
|
||||||
//根据要保存的数据的类型,调用对应的put方法,
|
//根据要保存的数据的类型,调用对应的put方法,
|
||||||
//以键值对的形式添加新值。
|
//以键值对的形式添加新值。
|
||||||
edit.putString("poiEntity", null);
|
edit.putString("poiEntity", null);
|
||||||
edit.putString("chargingPileEntity", null);
|
|
||||||
//提交新值。必须执行,否则前面的操作都无效。
|
//提交新值。必须执行,否则前面的操作都无效。
|
||||||
edit.commit();
|
edit.commit();
|
||||||
}
|
}
|
||||||
@ -379,19 +383,20 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
frameLayout.setVisibility(View.GONE);
|
frameLayout.setVisibility(View.GONE);
|
||||||
sliding_layout.setPanelHeight(1000);
|
sliding_layout.setPanelHeight(1000);
|
||||||
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
|
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
|
||||||
|
}else {
|
||||||
|
setMainButtonVisiable(View.VISIBLE);
|
||||||
}
|
}
|
||||||
} else if (data.what == Constant.CHARGING_STATION) {//充电站的充电桩
|
} else if (data.what == Constant.CHARGING_STATION) {//充电站的充电桩
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putBoolean("isSliding", false); // 通知抽屉不收回
|
bundle.putBoolean("isSliding", false); // 通知抽屉不收回
|
||||||
bundle.putInt("pid", (Integer) data.obj);
|
bundle.putString("station", (String) data.obj);
|
||||||
|
if (chargingPileEntity!=null){
|
||||||
|
bundle.putSerializable("chargingPileEntity",chargingPileEntity);
|
||||||
|
}
|
||||||
ChargingPileFragment chargingPileFragment = ChargingPileFragment.newInstance(bundle);
|
ChargingPileFragment chargingPileFragment = ChargingPileFragment.newInstance(bundle);
|
||||||
showSlidingFragment(chargingPileFragment);
|
showSlidingFragment(chargingPileFragment);
|
||||||
} else if (data.what == Constant.CHARGING_STATION_PILE) {//充电站的充电桩
|
} else if (data.what == Constant.CHARGING_STATION_PILE) {//充电站的充电桩
|
||||||
Bundle bundle = new Bundle();
|
chargingPileEntity = (ChargingPileEntity) data.obj;
|
||||||
bundle.putBoolean("isSliding", false); // 通知抽屉不收回
|
|
||||||
bundle.putSerializable("chargingPileEntity",(ChargingPileEntity) data.obj);
|
|
||||||
ChargingPileFragment chargingPileFragment = ChargingPileFragment.newInstance(bundle);
|
|
||||||
showSlidingFragment(chargingPileFragment);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -650,6 +655,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
fragmentTransaction.hide(filterFragment);
|
fragmentTransaction.hide(filterFragment);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(fragment instanceof ChargingStationFragment)) {
|
if (!(fragment instanceof ChargingStationFragment)) {
|
||||||
ChargingStationFragment chargingStationFragment = (ChargingStationFragment) supportFragmentManager.findFragmentByTag(ChargingStationFragment.class.getName());
|
ChargingStationFragment chargingStationFragment = (ChargingStationFragment) supportFragmentManager.findFragmentByTag(ChargingStationFragment.class.getName());
|
||||||
if (chargingStationFragment != null) {
|
if (chargingStationFragment != null) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user