照片命名规则,充电站和充电桩的关联,充电站的点击事件
This commit is contained in:
parent
71b9b28415
commit
d94f04b27e
@ -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"
|
||||||
|
@ -44,10 +44,12 @@ public class ChargingPileAdapter extends RecyclerView.Adapter<ChargingPileAdapte
|
|||||||
ChargingPileEntity chargingPileEntity = chargingPileEntities.get(position);
|
ChargingPileEntity chargingPileEntity = chargingPileEntities.get(position);
|
||||||
holder.textView.setText(chargingPileEntity.getName());
|
holder.textView.setText(chargingPileEntity.getName());
|
||||||
holder.rlItem.setBackgroundColor(Color.parseColor("#03A9F4"));
|
holder.rlItem.setBackgroundColor(Color.parseColor("#03A9F4"));
|
||||||
holder.itemView.setOnClickListener(new View.OnClickListener() {
|
holder.itemView.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
if (onLickItem!=null){
|
||||||
|
onLickItem.item(chargingPileEntity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -68,4 +70,13 @@ public class ChargingPileAdapter extends RecyclerView.Adapter<ChargingPileAdapte
|
|||||||
textView=itemView.findViewById(R.id.tv_text);
|
textView=itemView.findViewById(R.id.tv_text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
onLickItem onLickItem;
|
||||||
|
|
||||||
|
public void setOnLickItem(ChargingPileAdapter.onLickItem onLickItem) {
|
||||||
|
this.onLickItem = onLickItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface onLickItem{
|
||||||
|
void item( ChargingPileEntity chargingPileEntity );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package com.navinfo.outdoor.adapter;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@ -36,6 +37,47 @@ public class PoiRecycleAdapter extends RecyclerView.Adapter<PoiRecycleAdapter.My
|
|||||||
this.list.addAll(list);
|
this.list.addAll(list);
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
public boolean getPhoneBean(){
|
||||||
|
for (int i = 0; i < list.size(); i++) {
|
||||||
|
PoiBean poiBean = list.get(i);
|
||||||
|
if (poiBean.getPhone()==null){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getList() {
|
||||||
|
String a="";
|
||||||
|
for (int i = 0; i < list.size(); i++) {
|
||||||
|
PoiBean poiBean = list.get(i);
|
||||||
|
if (list.size()==1){
|
||||||
|
if(poiBean.getPhone().indexOf('1')==0){
|
||||||
|
a=poiBean.getPhone();
|
||||||
|
}else {
|
||||||
|
a=poiBean.getArea()+"-"+poiBean.getPhone();
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
if (i==list.size()-1){
|
||||||
|
if(poiBean.getPhone().indexOf('1')==0){
|
||||||
|
a+=poiBean.getPhone();
|
||||||
|
}else {
|
||||||
|
a+=poiBean.getArea()+"-"+poiBean.getPhone();
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if(poiBean.getPhone().indexOf('1')==0){
|
||||||
|
a+=poiBean.getPhone()+"|";
|
||||||
|
}else {
|
||||||
|
a+=poiBean.getArea()+"-"+poiBean.getPhone()+"|";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||||
@ -48,23 +90,44 @@ public class PoiRecycleAdapter extends RecyclerView.Adapter<PoiRecycleAdapter.My
|
|||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(MyViewHolder holder, final int position) {
|
public void onBindViewHolder(MyViewHolder holder, final int position) {
|
||||||
PoiBean poiBean = list.get(position);
|
PoiBean poiBean = list.get(position);
|
||||||
|
if(poiBean.getPhone().indexOf('1')==0){
|
||||||
|
holder.llPoi.setVisibility(View.GONE);
|
||||||
|
}else {
|
||||||
|
holder.llPoi.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
holder.editAreaCode.setText(poiBean.getArea());
|
||||||
holder.tvPhone.setText(poiBean.getName());
|
holder.tvPhone.setText(poiBean.getName());
|
||||||
holder.image.setImageResource(poiBean.getImage());
|
holder.image.setImageResource(poiBean.getImage());
|
||||||
if (poiBean.getPhone()==null||poiBean.equals("")){
|
holder.editPhoneNumber.setText(poiBean.getPhone());
|
||||||
holder.editPhoneNumber.setText(" ");
|
|
||||||
}else {
|
|
||||||
holder.editPhoneNumber.setText(poiBean.getPhone());
|
|
||||||
}
|
|
||||||
holder.image.setOnClickListener(new View.OnClickListener() {
|
holder.image.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (initPoiClick != null) {
|
if (position == 0) {
|
||||||
initPoiClick.item(position);
|
addData(new PoiBean("", "","", R.drawable.icon_del_bg));
|
||||||
|
} else {
|
||||||
|
removeData(position);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
holder.editPhoneNumber.addTextChangedListener(new TextWatcher() {
|
holder.editAreaCode.addTextChangedListener(new TextWatcher() {
|
||||||
|
@Override
|
||||||
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterTextChanged(Editable s) {
|
||||||
|
String area = holder.editAreaCode.getText().toString().trim();
|
||||||
|
poiBean.setArea(area);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
holder.editPhoneNumber.addTextChangedListener(new TextWatcher() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||||
@ -83,13 +146,10 @@ public class PoiRecycleAdapter extends RecyclerView.Adapter<PoiRecycleAdapter.My
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterTextChanged(Editable s) {
|
public void afterTextChanged(Editable s) {
|
||||||
String str = holder.editPhoneNumber.getText().toString().trim();
|
String str = holder.editPhoneNumber.getText().toString().trim();
|
||||||
if (initPoiEditClick!=null){
|
poiBean.setPhone(str);
|
||||||
initPoiEditClick.item(null,str,position);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -102,7 +162,7 @@ public class PoiRecycleAdapter extends RecyclerView.Adapter<PoiRecycleAdapter.My
|
|||||||
|
|
||||||
// 添加数据
|
// 添加数据
|
||||||
public void addData(PoiBean poiBean) {
|
public void addData(PoiBean poiBean) {
|
||||||
// 在list中添加数据,并通知条目加入一条
|
//在list中添加数据,并通知条目加入一条
|
||||||
list.add(poiBean);
|
list.add(poiBean);
|
||||||
//添加动画
|
//添加动画
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
@ -113,7 +173,7 @@ public class PoiRecycleAdapter extends RecyclerView.Adapter<PoiRecycleAdapter.My
|
|||||||
list.remove(position);
|
list.remove(position);
|
||||||
//删除动画
|
//删除动画
|
||||||
notifyItemRemoved(position);
|
notifyItemRemoved(position);
|
||||||
notifyDataSetChanged();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -121,7 +181,7 @@ public class PoiRecycleAdapter extends RecyclerView.Adapter<PoiRecycleAdapter.My
|
|||||||
*/
|
*/
|
||||||
class MyViewHolder extends RecyclerView.ViewHolder {
|
class MyViewHolder extends RecyclerView.ViewHolder {
|
||||||
TextView tvPhone;
|
TextView tvPhone;
|
||||||
EditText editPhone, editPhoneNumber;
|
EditText editAreaCode, editPhoneNumber;
|
||||||
ImageView image;
|
ImageView image;
|
||||||
LinearLayout llPoi;
|
LinearLayout llPoi;
|
||||||
|
|
||||||
@ -129,29 +189,10 @@ public class PoiRecycleAdapter extends RecyclerView.Adapter<PoiRecycleAdapter.My
|
|||||||
public MyViewHolder(View view) {
|
public MyViewHolder(View view) {
|
||||||
super(view);
|
super(view);
|
||||||
tvPhone = view.findViewById(R.id.tv_phone);
|
tvPhone = view.findViewById(R.id.tv_phone);
|
||||||
editPhone = view.findViewById(R.id.edit_phone);
|
editAreaCode = view.findViewById(R.id.edit_area_code);
|
||||||
llPoi = view.findViewById(R.id.ll_poi);
|
llPoi = view.findViewById(R.id.ll_poi);
|
||||||
editPhoneNumber = view.findViewById(R.id.edit_phone_number);
|
editPhoneNumber = view.findViewById(R.id.edit_phone_number);
|
||||||
image = view.findViewById(R.id.image);
|
image = view.findViewById(R.id.image);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
initPoiClick initPoiClick;
|
|
||||||
|
|
||||||
public void setInitPoiClick(PoiRecycleAdapter.initPoiClick initPoiClick) {
|
|
||||||
this.initPoiClick = initPoiClick;
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface initPoiClick {
|
|
||||||
void item(int aInt);
|
|
||||||
}
|
|
||||||
initPoiEditClick initPoiEditClick;
|
|
||||||
|
|
||||||
public void setInitPoiEditClick(PoiRecycleAdapter.initPoiEditClick initPoiEditClick) {
|
|
||||||
this.initPoiEditClick = initPoiEditClick;
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface initPoiEditClick {
|
|
||||||
void item(String area,String data,int aInt);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -62,6 +62,7 @@ public class Constant {
|
|||||||
public static final int MAIN_CHARGING_CHECKED_STATION = 43;//充电站的Fragment 对地图页面marker 的一个展示 确定
|
public static final int MAIN_CHARGING_CHECKED_STATION = 43;//充电站的Fragment 对地图页面marker 的一个展示 确定
|
||||||
public static final int CHARGING_STATION_WORD = 15;//地图页面marker 的经纬都回传
|
public static final int CHARGING_STATION_WORD = 15;//地图页面marker 的经纬都回传
|
||||||
public static final int CHARGING_STATION = 16;//跳转到充电桩
|
public static final int CHARGING_STATION = 16;//跳转到充电桩
|
||||||
|
public static final int CHARGING_STATION_ITEM = 17;//适配器的item跳转到充电桩
|
||||||
public static final int MAIN_CHARGING_PILE = 18;//充电桩的Fragment 对地图页面marker 的一个展示 编辑
|
public static final int MAIN_CHARGING_PILE = 18;//充电桩的Fragment 对地图页面marker 的一个展示 编辑
|
||||||
public static final int MAIN_CHARGING_CHECKED_PILE = 49;//充电桩的Fragment 对地图页面marker 的一个展示 确定
|
public static final int MAIN_CHARGING_CHECKED_PILE = 49;//充电桩的Fragment 对地图页面marker 的一个展示 确定
|
||||||
public static final int CHARGING_PILE_WORD = 20;//地图页面marker 的经纬都回传
|
public static final int CHARGING_PILE_WORD = 20;//地图页面marker 的经纬都回传
|
||||||
|
@ -3,11 +3,13 @@ package com.navinfo.outdoor.bean;
|
|||||||
public class PoiBean {
|
public class PoiBean {
|
||||||
String name;
|
String name;
|
||||||
String phone;
|
String phone;
|
||||||
|
String area;
|
||||||
int image;
|
int image;
|
||||||
|
|
||||||
public PoiBean(String name, String phone, int image) {
|
public PoiBean(String name, String phone, String area, int image) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.phone = phone;
|
this.phone = phone;
|
||||||
|
this.area = area;
|
||||||
this.image = image;
|
this.image = image;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -27,6 +29,14 @@ public class PoiBean {
|
|||||||
this.phone = phone;
|
this.phone = phone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getArea() {
|
||||||
|
return area;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setArea(String area) {
|
||||||
|
this.area = area;
|
||||||
|
}
|
||||||
|
|
||||||
public int getImage() {
|
public int getImage() {
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
@ -437,10 +437,8 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
|||||||
String[] split = photo.split("/");
|
String[] split = photo.split("/");
|
||||||
if (split[split.length - 1].startsWith("a")) {
|
if (split[split.length - 1].startsWith("a")) {
|
||||||
Glide.with(getActivity()).load(photo).into(ivPanorama);
|
Glide.with(getActivity()).load(photo).into(ivPanorama);
|
||||||
ivPanorama.setTag(photo);
|
|
||||||
} else if (split[split.length - 1].startsWith("b")) {
|
} else if (split[split.length - 1].startsWith("b")) {
|
||||||
Glide.with(getActivity()).load(photo).into(ivCoding);
|
Glide.with(getActivity()).load(photo).into(ivCoding);
|
||||||
ivCoding.setTag(photo);
|
|
||||||
} else if (split[split.length - 1].startsWith("c")) {
|
} else if (split[split.length - 1].startsWith("c")) {
|
||||||
cList.add(photo);
|
cList.add(photo);
|
||||||
} else if (split[split.length - 1].startsWith("d")) {
|
} else if (split[split.length - 1].startsWith("d")) {
|
||||||
@ -460,31 +458,21 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
|||||||
switch (list.size()) {
|
switch (list.size()) {
|
||||||
case 1:
|
case 1:
|
||||||
Glide.with(getActivity()).load(list.get(0)).into(ivEquipment);
|
Glide.with(getActivity()).load(list.get(0)).into(ivEquipment);
|
||||||
ivEquipment.setTag(list.get(0));
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
Glide.with(getActivity()).load(list.get(0)).into(ivEquipment);
|
Glide.with(getActivity()).load(list.get(0)).into(ivEquipment);
|
||||||
ivEquipment.setTag(list.get(0));
|
|
||||||
Glide.with(getActivity()).load(list.get(1)).into(ivFacility);
|
Glide.with(getActivity()).load(list.get(1)).into(ivFacility);
|
||||||
ivFacility.setTag(list.get(1));
|
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
Glide.with(getActivity()).load(list.get(0)).into(ivEquipment);
|
Glide.with(getActivity()).load(list.get(0)).into(ivEquipment);
|
||||||
ivEquipment.setTag(list.get(0));
|
|
||||||
Glide.with(getActivity()).load(list.get(1)).into(ivFacility);
|
Glide.with(getActivity()).load(list.get(1)).into(ivFacility);
|
||||||
ivFacility.setTag(list.get(1));
|
|
||||||
Glide.with(getActivity()).load(list.get(2)).into(ivScutcheon);
|
Glide.with(getActivity()).load(list.get(2)).into(ivScutcheon);
|
||||||
ivScutcheon.setTag(list.get(2));
|
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
Glide.with(getActivity()).load(list.get(0)).into(ivEquipment);
|
Glide.with(getActivity()).load(list.get(0)).into(ivEquipment);
|
||||||
ivEquipment.setTag(list.get(0));
|
|
||||||
Glide.with(getActivity()).load(list.get(1)).into(ivFacility);
|
Glide.with(getActivity()).load(list.get(1)).into(ivFacility);
|
||||||
ivFacility.setTag(list.get(1));
|
|
||||||
Glide.with(getActivity()).load(list.get(2)).into(ivScutcheon);
|
Glide.with(getActivity()).load(list.get(2)).into(ivScutcheon);
|
||||||
ivScutcheon.setTag(list.get(2));
|
|
||||||
Glide.with(getActivity()).load(list.get(3)).into(ivDevice);
|
Glide.with(getActivity()).load(list.get(3)).into(ivDevice);
|
||||||
ivDevice.setTag(list.get(3));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -493,13 +481,10 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
|||||||
switch (list.size()) {
|
switch (list.size()) {
|
||||||
case 1:
|
case 1:
|
||||||
Glide.with(getActivity()).load(list.get(0)).into(ivUsable);
|
Glide.with(getActivity()).load(list.get(0)).into(ivUsable);
|
||||||
ivUsable.setTag(list.get(0));
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
Glide.with(getActivity()).load(list.get(0)).into(ivUsable);
|
Glide.with(getActivity()).load(list.get(0)).into(ivUsable);
|
||||||
ivUsable.setTag(list.get(0));
|
|
||||||
Glide.with(getActivity()).load(list.get(1)).into(ivAvailable);
|
Glide.with(getActivity()).load(list.get(1)).into(ivAvailable);
|
||||||
ivAvailable.setTag(list.get(1));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -508,13 +493,10 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
|||||||
switch (list.size()) {
|
switch (list.size()) {
|
||||||
case 1:
|
case 1:
|
||||||
Glide.with(getActivity()).load(list.get(0)).into(ivParking);
|
Glide.with(getActivity()).load(list.get(0)).into(ivParking);
|
||||||
ivParking.setTag(list.get(0));
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
Glide.with(getActivity()).load(list.get(0)).into(ivParking);
|
Glide.with(getActivity()).load(list.get(0)).into(ivParking);
|
||||||
ivParking.setTag(list.get(0));
|
|
||||||
Glide.with(getActivity()).load(list.get(1)).into(ivNumber);
|
Glide.with(getActivity()).load(list.get(1)).into(ivNumber);
|
||||||
ivNumber.setTag(list.get(1));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -677,7 +659,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
|||||||
chargingPileEntity.setMemo(describe);
|
chargingPileEntity.setMemo(describe);
|
||||||
}
|
}
|
||||||
if (pid == 0) {
|
if (pid == 0) {
|
||||||
Toast.makeText(getActivity(), "没有关联充电站", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), "没有tastId", Toast.LENGTH_SHORT).show();
|
||||||
} else {
|
} else {
|
||||||
chargingPileEntity.setFid(pid);
|
chargingPileEntity.setFid(pid);
|
||||||
}
|
}
|
||||||
|
@ -30,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.github.lazylibrary.util.StringUtils;
|
||||||
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;
|
||||||
@ -85,7 +86,6 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
private EditText editNameContent, editSiteContent;
|
private EditText editNameContent, editSiteContent;
|
||||||
private RecyclerView recyclerPhone;
|
private RecyclerView recyclerPhone;
|
||||||
private PoiRecycleAdapter poiRecycleAdapter;
|
private PoiRecycleAdapter poiRecycleAdapter;
|
||||||
private ArrayList<String> phoneData;
|
|
||||||
private ArrayList<PoiBean> poiBeans;
|
private ArrayList<PoiBean> poiBeans;
|
||||||
private Button btnSaveLocal;
|
private Button btnSaveLocal;
|
||||||
private Button btnUploading;
|
private Button btnUploading;
|
||||||
@ -93,9 +93,8 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
private PoiDao poiDao;
|
private PoiDao poiDao;
|
||||||
private CheckBox checkBoxLife;
|
private CheckBox checkBoxLife;
|
||||||
private CheckBox checkBoxRight;
|
private CheckBox checkBoxRight;
|
||||||
private String phone = null;
|
|
||||||
private Spinner spinnerType;
|
private Spinner spinnerType;
|
||||||
String[] ctype = new String[]{ "充电站", "充换电站", "充电桩组", "换电站"};//1."充电站"2 "充换电站"3 "充电桩组"4 "换电站"5 ,
|
String[] ctype = new String[]{"充电站", "充换电站", "充电桩组", "换电站"};//1."充电站"2 "充换电站"3 "充电桩组"4 "换电站"5 ,
|
||||||
String[] spinner = new String[]{"存在", "不存在", "无法验证"};
|
String[] spinner = new String[]{"存在", "不存在", "无法验证"};
|
||||||
private ArrayAdapter<String> adapter;
|
private ArrayAdapter<String> adapter;
|
||||||
private LinearLayout linearChargingPile;
|
private LinearLayout linearChargingPile;
|
||||||
@ -108,11 +107,6 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
private RelativeLayout linearExist;
|
private RelativeLayout linearExist;
|
||||||
private Spinner spinnerExist;
|
private Spinner spinnerExist;
|
||||||
private Integer body;
|
private Integer body;
|
||||||
private String takePhotoPath1;
|
|
||||||
private String takePhotoPath2;
|
|
||||||
private String takePhotoPath3;
|
|
||||||
private String takePhotoPath4;
|
|
||||||
private String takePhotoPath5;
|
|
||||||
|
|
||||||
public static ChargingStationFragment newInstance(Bundle bundle) {
|
public static ChargingStationFragment newInstance(Bundle bundle) {
|
||||||
ChargingStationFragment fragment = new ChargingStationFragment();
|
ChargingStationFragment fragment = new ChargingStationFragment();
|
||||||
@ -308,37 +302,19 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
recyclerPhone.addItemDecoration(new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL));
|
recyclerPhone.addItemDecoration(new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL));
|
||||||
poiRecycleAdapter = new PoiRecycleAdapter(getContext());
|
poiRecycleAdapter = new PoiRecycleAdapter(getContext());
|
||||||
recyclerPhone.setAdapter(poiRecycleAdapter);
|
recyclerPhone.setAdapter(poiRecycleAdapter);
|
||||||
poiRecycleAdapter.setInitPoiClick(new PoiRecycleAdapter.initPoiClick() {
|
|
||||||
@Override
|
|
||||||
public void item(int aInt) {
|
|
||||||
if (aInt == 0) {
|
|
||||||
poiRecycleAdapter.addData(new PoiBean("", null, R.drawable.icon_del_bg));
|
|
||||||
} else {
|
|
||||||
poiRecycleAdapter.removeData(aInt);
|
|
||||||
if (phoneData.size() > 0) {
|
|
||||||
phoneData.remove(aInt);
|
|
||||||
Log.d("TAG", "initView: " + phoneData.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
poiRecycleAdapter.setInitPoiEditClick(new PoiRecycleAdapter.initPoiEditClick() {
|
|
||||||
@Override
|
|
||||||
public void item(String a, String data, int aInt) {
|
|
||||||
if (data.length() == 11) {
|
|
||||||
if (a != null) {
|
|
||||||
phoneData.add(aInt, a + "," + data);
|
|
||||||
} else {
|
|
||||||
phoneData.add(aInt, data);
|
|
||||||
}
|
|
||||||
Log.d("TAG", "initView: " + phoneData.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
recyclerStation = findViewById(R.id.recycler_station);
|
recyclerStation = findViewById(R.id.recycler_station);
|
||||||
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);
|
||||||
|
chargingPileAdapter.setOnLickItem(new ChargingPileAdapter.onLickItem() {
|
||||||
|
@Override
|
||||||
|
public void item(ChargingPileEntity chargingPileEntity) {
|
||||||
|
Message obtains = Message.obtain();
|
||||||
|
obtains.what = Constant.CHARGING_STATION_ITEM;
|
||||||
|
obtains.obj = chargingPileEntity;
|
||||||
|
EventBus.getDefault().post(obtains);
|
||||||
|
}
|
||||||
|
});
|
||||||
//数据展示
|
//数据展示
|
||||||
initShowPoi();
|
initShowPoi();
|
||||||
//禁用所有可操作控件
|
//禁用所有可操作控件
|
||||||
@ -372,14 +348,39 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
spinnerType.setSelection(station_type, true);
|
spinnerType.setSelection(station_type, true);
|
||||||
String telPhone = showPoiEntity.getTelPhone();
|
String telPhone = showPoiEntity.getTelPhone();
|
||||||
if (telPhone != null && !telPhone.equals("")) {
|
if (telPhone != null && !telPhone.equals("")) {
|
||||||
phoneData.add(showPoiEntity.getTelPhone());
|
String[] phones = telPhone.split("\\|");
|
||||||
poiBeans.add(new PoiBean("电话*", telPhone, R.drawable.icon_add_bg));
|
for (int i = 0; i < phones.length; i++) {
|
||||||
|
if (i==0) {
|
||||||
|
if (!StringUtils.isEmpty(phones[i])) {
|
||||||
|
String[] split = phones[i].split("-");
|
||||||
|
if (split[0] == phones[i]) {
|
||||||
|
poiBeans.add(new PoiBean("电话*", phones[i], "", R.drawable.icon_add_bg));
|
||||||
|
} else {
|
||||||
|
poiBeans.add(new PoiBean("电话*", split[1], split[0], R.drawable.icon_add_bg));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!StringUtils.isEmpty(phones[i])) {
|
||||||
|
String[] split = phones[i].split("-");
|
||||||
|
if (split[0] == phones[i]) {
|
||||||
|
poiBeans.add(new PoiBean("", phones[i], "", R.drawable.icon_del_bg));
|
||||||
|
} else {
|
||||||
|
poiBeans.add(new PoiBean("", split[1], split[0], R.drawable.icon_del_bg));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
poiBeans.add(new PoiBean("电话*", " ", R.drawable.icon_add_bg));
|
poiBeans.add(new PoiBean("电话*", "", "", R.drawable.icon_add_bg));
|
||||||
}
|
}
|
||||||
body=showPoiEntity.getBodyId();
|
body = showPoiEntity.getBodyId();
|
||||||
poiRecycleAdapter.setList(poiBeans);
|
poiRecycleAdapter.setList(poiBeans);
|
||||||
linearExist.setVisibility(View.VISIBLE);
|
if (showPoiEntity.getName() != null) {
|
||||||
|
linearExist.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
|
}
|
||||||
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();
|
||||||
@ -423,7 +424,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
|
|
||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
if (showPoiEntity.getId()!=0){
|
if (showPoiEntity.getId() != 0) {
|
||||||
initPile();
|
initPile();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -483,8 +484,6 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
super.initData();
|
super.initData();
|
||||||
//存储对象
|
//存储对象
|
||||||
poiBeans = new ArrayList<>();
|
poiBeans = new ArrayList<>();
|
||||||
//存储手机号
|
|
||||||
phoneData = new ArrayList<>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -497,7 +496,6 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
ArrayList<ChargingPileEntity> chargingPileEntities = new ArrayList<>();
|
ArrayList<ChargingPileEntity> chargingPileEntities = new ArrayList<>();
|
||||||
chargingPileEntities.add(chargingPileEntity);
|
chargingPileEntities.add(chargingPileEntity);
|
||||||
chargingPileAdapter.setChargingPileEntities(chargingPileEntities);
|
chargingPileAdapter.setChargingPileEntities(chargingPileEntities);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -533,7 +531,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
Toast.makeText(getActivity(), "请确定点位", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), "请确定点位", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
String encode = Geohash.getInstance().encode(latLng.latitude,latLng.longitude);
|
String encode = Geohash.getInstance().encode(latLng.latitude, latLng.longitude);
|
||||||
poiEntity.setGeoWkt(encode);
|
poiEntity.setGeoWkt(encode);
|
||||||
poiEntity.setX(String.valueOf(latLng.longitude));
|
poiEntity.setX(String.valueOf(latLng.longitude));
|
||||||
poiEntity.setY(String.valueOf(latLng.latitude));
|
poiEntity.setY(String.valueOf(latLng.latitude));
|
||||||
@ -545,13 +543,14 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
} else {
|
} else {
|
||||||
poiEntity.setDescribe(describe);
|
poiEntity.setDescribe(describe);
|
||||||
}
|
}
|
||||||
if (phoneData.size()<= 0) {
|
boolean phoneBean = poiRecycleAdapter.getPhoneBean();
|
||||||
|
if (phoneBean){
|
||||||
|
String list = poiRecycleAdapter.getList();
|
||||||
|
poiEntity.setTelPhone(list);
|
||||||
|
}else {
|
||||||
Toast.makeText(getActivity(), "请输入手机号", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), "请输入手机号", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
} else {
|
|
||||||
poiEntity.setTelPhone(phoneData.get(0));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String tagPanorama = (String) ivPanorama.getTag();
|
String tagPanorama = (String) ivPanorama.getTag();
|
||||||
if (tagPanorama == null) {
|
if (tagPanorama == null) {
|
||||||
Toast.makeText(getActivity(), "请拍照 全景图", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), "请拍照 全景图", Toast.LENGTH_SHORT).show();
|
||||||
@ -605,7 +604,6 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
getActivity().runOnUiThread(new Runnable() {
|
getActivity().runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
phoneByWork(poiEntity);
|
|
||||||
chargingStationSaveByWork(poiEntity);
|
chargingStationSaveByWork(poiEntity);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -707,46 +705,6 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void phoneByWork(PoiEntity poiEntity) {
|
|
||||||
showLoadingDialog();
|
|
||||||
HttpParams httpParams = new HttpParams();
|
|
||||||
httpParams.put("geo",poiEntity.getGeoWkt());
|
|
||||||
OkGoBuilder.getInstance()
|
|
||||||
.Builder(getActivity())
|
|
||||||
.url(HttpInterface.GET_PHONE)
|
|
||||||
.method(OkGoBuilder.GET)
|
|
||||||
.cls(GetPhoneBean.class)
|
|
||||||
.params(httpParams)
|
|
||||||
.callback(new Callback<GetPhoneBean>() {
|
|
||||||
@Override
|
|
||||||
public void onSuccess(GetPhoneBean getPhoneBean, int id) {
|
|
||||||
dismissLoadingDialog();
|
|
||||||
String code = getPhoneBean.getBody().getCode();
|
|
||||||
new Thread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
|
|
||||||
getActivity().runOnUiThread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
|
|
||||||
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
|
|
||||||
Log.d("TAG", "onSuccess: " + getPhoneBean.getBody());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}).start();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError(Throwable e, int id) {
|
|
||||||
dismissLoadingDialog();
|
|
||||||
Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show();
|
|
||||||
Log.d("TAG", "onError: " + e.getMessage());
|
|
||||||
}
|
|
||||||
}).build();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void stationUploadByNetWork(Integer body, ArrayList<File> chargingStationList) {
|
private void stationUploadByNetWork(Integer body, ArrayList<File> chargingStationList) {
|
||||||
|
|
||||||
|
|
||||||
@ -755,13 +713,13 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
private void chargingStationSaveByWork(PoiEntity poiEntity) {
|
private void chargingStationSaveByWork(PoiEntity poiEntity) {
|
||||||
showLoadingDialog();
|
showLoadingDialog();
|
||||||
HttpParams httpParams = new HttpParams();
|
HttpParams httpParams = new HttpParams();
|
||||||
httpParams.put("id",poiEntity.getTaskId());
|
httpParams.put("id", poiEntity.getTaskId());
|
||||||
httpParams.put("sptype", poiEntity.getStation_type());
|
httpParams.put("sptype", poiEntity.getStation_type());
|
||||||
httpParams.put("name", poiEntity.getName());
|
httpParams.put("name", poiEntity.getName());
|
||||||
httpParams.put("address", poiEntity.getAddress());
|
httpParams.put("address", poiEntity.getAddress());
|
||||||
httpParams.put("telephone", poiEntity.getTelPhone());
|
httpParams.put("telephone", poiEntity.getTelPhone());
|
||||||
httpParams.put("memo", poiEntity.getMemo());
|
httpParams.put("memo", poiEntity.getMemo());
|
||||||
httpParams.put("geo",poiEntity.getGeoWkt());
|
httpParams.put("geo", poiEntity.getGeoWkt());
|
||||||
OkGoBuilder.getInstance()
|
OkGoBuilder.getInstance()
|
||||||
.Builder(getActivity())
|
.Builder(getActivity())
|
||||||
.url(HttpInterface.SUBMIT_CTASK)
|
.url(HttpInterface.SUBMIT_CTASK)
|
||||||
@ -818,8 +776,10 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
if (describe != null && !describe.equals("")) {
|
if (describe != null && !describe.equals("")) {
|
||||||
poiEntity.setDescribe(describe);
|
poiEntity.setDescribe(describe);
|
||||||
}
|
}
|
||||||
if (phoneData.size() > 0) {
|
boolean phoneBean = poiRecycleAdapter.getPhoneBean();
|
||||||
poiEntity.setTelPhone(phoneData.get(0));
|
if (phoneBean){
|
||||||
|
String list = poiRecycleAdapter.getList();
|
||||||
|
poiEntity.setTelPhone(list);
|
||||||
}
|
}
|
||||||
String tagPanorama = (String) ivPanorama.getTag();
|
String tagPanorama = (String) ivPanorama.getTag();
|
||||||
if (tagPanorama != null && !tagPanorama.equals("")) {
|
if (tagPanorama != null && !tagPanorama.equals("")) {
|
||||||
@ -841,11 +801,6 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
if (tagScutcheon != null && !tagScutcheon.equals("")) {
|
if (tagScutcheon != null && !tagScutcheon.equals("")) {
|
||||||
infoPhoto.add(new Info(tagScutcheon));
|
infoPhoto.add(new Info(tagScutcheon));
|
||||||
}
|
}
|
||||||
if (showPoiEntity != null) {
|
|
||||||
if (showPoiEntity.getTaskId() != 0) {
|
|
||||||
poiEntity.setTaskId(showPoiEntity.getTaskId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
poiEntity.setPhotoInfo(infoPhoto);
|
poiEntity.setPhotoInfo(infoPhoto);
|
||||||
poiEntity.setStation_type(station_type);
|
poiEntity.setStation_type(station_type);
|
||||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
@ -898,8 +853,10 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
if (describe != null && !describe.equals("")) {
|
if (describe != null && !describe.equals("")) {
|
||||||
poiEntity.setDescribe(describe);
|
poiEntity.setDescribe(describe);
|
||||||
}
|
}
|
||||||
if (phoneData.size() > 0) {
|
boolean phoneBean = poiRecycleAdapter.getPhoneBean();
|
||||||
poiEntity.setTelPhone(phoneData.get(0));
|
if (phoneBean){
|
||||||
|
String list = poiRecycleAdapter.getList();
|
||||||
|
poiEntity.setTelPhone(list);
|
||||||
}
|
}
|
||||||
String tagPanorama = (String) ivPanorama.getTag();
|
String tagPanorama = (String) ivPanorama.getTag();
|
||||||
if (tagPanorama != null && !tagPanorama.equals("")) {
|
if (tagPanorama != null && !tagPanorama.equals("")) {
|
||||||
@ -921,11 +878,6 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
if (tagScutcheon != null && !tagScutcheon.equals("")) {
|
if (tagScutcheon != null && !tagScutcheon.equals("")) {
|
||||||
infoPhoto.add(new Info(tagScutcheon));
|
infoPhoto.add(new Info(tagScutcheon));
|
||||||
}
|
}
|
||||||
if (showPoiEntity != null) {
|
|
||||||
if (showPoiEntity.getTaskId() != 0) {
|
|
||||||
poiEntity.setTaskId(showPoiEntity.getTaskId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
poiEntity.setPhotoInfo(infoPhoto);
|
poiEntity.setPhotoInfo(infoPhoto);
|
||||||
poiEntity.setStation_type(station_type);
|
poiEntity.setStation_type(station_type);
|
||||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
@ -963,9 +915,8 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
//int angle1 = PictureUtil.readPictureDegree(takePhotoPath1);
|
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "a", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
|
||||||
takePhotoPath1 = PhotoPathUtil.getTakePhotoPath(data, "a",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
|
ivPanorama.setTag(takePhotoPath);
|
||||||
ivPanorama.setTag(takePhotoPath1);
|
|
||||||
ivPanorama.setImageBitmap(bitmap);//显示图像
|
ivPanorama.setImageBitmap(bitmap);//显示图像
|
||||||
}
|
}
|
||||||
} else if (requestCode == 102 && resultCode == RESULT_OK) {
|
} else if (requestCode == 102 && resultCode == RESULT_OK) {
|
||||||
@ -984,9 +935,8 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// int angle2 = PictureUtil.readPictureDegree(takePhotoPath2);
|
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "b", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
|
||||||
takePhotoPath2 = PhotoPathUtil.getTakePhotoPath(data, "b",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
|
ivName.setTag(takePhotoPath);
|
||||||
ivName.setTag(takePhotoPath2);
|
|
||||||
ivName.setImageBitmap(bitmap);//显示图像
|
ivName.setImageBitmap(bitmap);//显示图像
|
||||||
}
|
}
|
||||||
} else if (requestCode == 103 && resultCode == RESULT_OK) {
|
} else if (requestCode == 103 && resultCode == RESULT_OK) {
|
||||||
@ -1005,9 +955,8 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// int angle3 = PictureUtil.readPictureDegree(takePhotoPath3);
|
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "c", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
|
||||||
takePhotoPath3 = PhotoPathUtil.getTakePhotoPath(data, "c",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
|
ivInternal.setTag(takePhotoPath);
|
||||||
ivInternal.setTag(takePhotoPath3);
|
|
||||||
ivInternal.setImageBitmap(bitmap);//显示图像
|
ivInternal.setImageBitmap(bitmap);//显示图像
|
||||||
}
|
}
|
||||||
} else if (requestCode == 104 && resultCode == RESULT_OK) {
|
} else if (requestCode == 104 && resultCode == RESULT_OK) {
|
||||||
@ -1026,9 +975,8 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// int angle4 = PictureUtil.readPictureDegree(takePhotoPath4);
|
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "d", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
|
||||||
takePhotoPath4 = PhotoPathUtil.getTakePhotoPath(data, "d",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
|
ivElse.setTag(takePhotoPath);
|
||||||
ivElse.setTag(takePhotoPath4);
|
|
||||||
ivElse.setImageBitmap(bitmap);//显示图像
|
ivElse.setImageBitmap(bitmap);//显示图像
|
||||||
}
|
}
|
||||||
} else if (requestCode == 105 && resultCode == RESULT_OK) {
|
} else if (requestCode == 105 && resultCode == RESULT_OK) {
|
||||||
@ -1047,9 +995,8 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// int angle5 = PictureUtil.readPictureDegree(takePhotoPath5);
|
String takePhotoPath = PhotoPathUtil.getTakePhotoPath(data, "e", Geohash.getInstance().encode(latLng.latitude, latLng.longitude));
|
||||||
takePhotoPath5 = PhotoPathUtil.getTakePhotoPath(data, "e",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
|
ivScutcheon.setTag(takePhotoPath);
|
||||||
ivScutcheon.setTag(takePhotoPath5);
|
|
||||||
ivScutcheon.setImageBitmap(bitmap);//显示图像
|
ivScutcheon.setImageBitmap(bitmap);//显示图像
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1061,5 +1008,15 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
|||||||
if (EventBus.getDefault().isRegistered(this))//加上判断
|
if (EventBus.getDefault().isRegistered(this))//加上判断
|
||||||
EventBus.getDefault().unregister(this);
|
EventBus.getDefault().unregister(this);
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
|
new Thread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
|
||||||
|
if (poiDaoPoiEntity.getName() == null) {
|
||||||
|
poiDao.deletePoiEntity(poiDaoPoiEntity);
|
||||||
|
chargingPileDao.deleteChargingFidPileEntity(showPoiEntity.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -28,6 +28,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.github.lazylibrary.util.DensityUtil;
|
||||||
|
import com.github.lazylibrary.util.StringUtils;
|
||||||
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;
|
||||||
@ -82,7 +84,6 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
private EditText editNameContent, editSiteContent;
|
private EditText editNameContent, editSiteContent;
|
||||||
private RecyclerView recyclerPhone;
|
private RecyclerView recyclerPhone;
|
||||||
private PoiRecycleAdapter poiRecycleAdapter;
|
private PoiRecycleAdapter poiRecycleAdapter;
|
||||||
private ArrayList<String> phoneData;
|
|
||||||
private ArrayList<PoiBean> poiBeans;
|
private ArrayList<PoiBean> poiBeans;
|
||||||
private Button btnSaveLocal;
|
private Button btnSaveLocal;
|
||||||
private Button btnUploading;
|
private Button btnUploading;
|
||||||
@ -234,33 +235,6 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
recyclerPhone.addItemDecoration(new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL));
|
recyclerPhone.addItemDecoration(new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL));
|
||||||
poiRecycleAdapter = new PoiRecycleAdapter(getContext());
|
poiRecycleAdapter = new PoiRecycleAdapter(getContext());
|
||||||
recyclerPhone.setAdapter(poiRecycleAdapter);
|
recyclerPhone.setAdapter(poiRecycleAdapter);
|
||||||
poiRecycleAdapter.setInitPoiClick(new PoiRecycleAdapter.initPoiClick() {
|
|
||||||
@Override
|
|
||||||
public void item(int aInt) {
|
|
||||||
if (aInt == 0) {
|
|
||||||
poiRecycleAdapter.addData(new PoiBean("", null, R.drawable.icon_del_bg));
|
|
||||||
} else {
|
|
||||||
poiRecycleAdapter.removeData(aInt);
|
|
||||||
if (phoneData.size() > 0) {
|
|
||||||
phoneData.remove(aInt);
|
|
||||||
Log.d("TAG", "initView: " + phoneData.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
poiRecycleAdapter.setInitPoiEditClick(new PoiRecycleAdapter.initPoiEditClick() {
|
|
||||||
@Override
|
|
||||||
public void item(String a, String data, int aInt) {
|
|
||||||
if (data.length() == 11) {
|
|
||||||
if (a != null) {
|
|
||||||
phoneData.add(aInt, a + "," + data);
|
|
||||||
} else {
|
|
||||||
phoneData.add(aInt, data);
|
|
||||||
}
|
|
||||||
Log.d("TAG", "initView: " + phoneData.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
//数据展示
|
//数据展示
|
||||||
initShowPoi();
|
initShowPoi();
|
||||||
//禁用所有可操作控件
|
//禁用所有可操作控件
|
||||||
@ -293,10 +267,32 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
}
|
}
|
||||||
String telPhone = showPoiEntity.getTelPhone();
|
String telPhone = showPoiEntity.getTelPhone();
|
||||||
if (telPhone != null && !telPhone.equals("")) {
|
if (telPhone != null && !telPhone.equals("")) {
|
||||||
phoneData.add(showPoiEntity.getTelPhone());
|
String[] phones = telPhone.split("\\|");
|
||||||
poiBeans.add(new PoiBean("电话*", telPhone, R.drawable.icon_add_bg));
|
for (int i = 0; i < phones.length; i++) {
|
||||||
|
if (i==0) {
|
||||||
|
if (!StringUtils.isEmpty(phones[i])) {
|
||||||
|
String[] split = phones[i].split("-");
|
||||||
|
if (split[0] == phones[i]) {
|
||||||
|
poiBeans.add(new PoiBean("电话*", phones[i], "", R.drawable.icon_add_bg));
|
||||||
|
} else {
|
||||||
|
poiBeans.add(new PoiBean("电话*", split[1], split[0], R.drawable.icon_add_bg));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!StringUtils.isEmpty(phones[i])) {
|
||||||
|
String[] split = phones[i].split("-");
|
||||||
|
if (split[0] == phones[i]) {
|
||||||
|
poiBeans.add(new PoiBean("", phones[i], "", R.drawable.icon_del_bg));
|
||||||
|
} else {
|
||||||
|
poiBeans.add(new PoiBean("", split[1], split[0], R.drawable.icon_del_bg));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
poiBeans.add(new PoiBean("电话*", "", R.drawable.icon_add_bg));
|
poiBeans.add(new PoiBean("电话*", "", "", R.drawable.icon_add_bg));
|
||||||
}
|
}
|
||||||
body=showPoiEntity.getBodyId();
|
body=showPoiEntity.getBodyId();
|
||||||
poiRecycleAdapter.setList(poiBeans);
|
poiRecycleAdapter.setList(poiBeans);
|
||||||
@ -347,10 +343,8 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
@Override
|
@Override
|
||||||
protected void initData() {
|
protected void initData() {
|
||||||
super.initData();
|
super.initData();
|
||||||
//存储对象
|
//存储手机号对象
|
||||||
poiBeans = new ArrayList<>();
|
poiBeans = new ArrayList<>();
|
||||||
//存储手机号
|
|
||||||
phoneData = new ArrayList<>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -405,11 +399,13 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
} else {
|
} else {
|
||||||
poiEntity.setDescribe(describe);
|
poiEntity.setDescribe(describe);
|
||||||
}
|
}
|
||||||
if (phoneData.size() <= 0) {
|
boolean phoneBean = poiRecycleAdapter.getPhoneBean();
|
||||||
|
if (phoneBean){
|
||||||
|
String list = poiRecycleAdapter.getList();
|
||||||
|
poiEntity.setTelPhone(list);
|
||||||
|
}else {
|
||||||
Toast.makeText(getActivity(), "请输入手机号", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), "请输入手机号", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
} else {
|
|
||||||
poiEntity.setTelPhone(phoneData.get(0));
|
|
||||||
}
|
}
|
||||||
String tagPanorama = (String) ivPanorama.getTag();
|
String tagPanorama = (String) ivPanorama.getTag();
|
||||||
if (tagPanorama == null) {
|
if (tagPanorama == null) {
|
||||||
@ -656,8 +652,13 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
|||||||
if (describe != null && !describe.equals("")) {
|
if (describe != null && !describe.equals("")) {
|
||||||
poiEntity.setDescribe(describe);
|
poiEntity.setDescribe(describe);
|
||||||
}
|
}
|
||||||
if (phoneData.size() > 0) {
|
boolean phoneBean = poiRecycleAdapter.getPhoneBean();
|
||||||
poiEntity.setTelPhone(phoneData.get(0));
|
if (phoneBean){
|
||||||
|
String list = poiRecycleAdapter.getList();
|
||||||
|
poiEntity.setTelPhone(list);
|
||||||
|
}else {
|
||||||
|
Toast.makeText(getActivity(), "请输入手机号", Toast.LENGTH_SHORT).show();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
String tagPanorama = (String) ivPanorama.getTag();
|
String tagPanorama = (String) ivPanorama.getTag();
|
||||||
if (tagPanorama != null && !tagPanorama.equals("")) {
|
if (tagPanorama != null && !tagPanorama.equals("")) {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.navinfo.outdoor.fragment;
|
package com.navinfo.outdoor.fragment;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
@ -26,6 +27,7 @@ import androidx.appcompat.app.AppCompatActivity;
|
|||||||
import androidx.core.widget.NestedScrollView;
|
import androidx.core.widget.NestedScrollView;
|
||||||
import androidx.fragment.app.FragmentTransaction;
|
import androidx.fragment.app.FragmentTransaction;
|
||||||
|
|
||||||
|
import com.github.lazylibrary.util.DensityUtil;
|
||||||
import com.github.lazylibrary.util.FileUtils;
|
import com.github.lazylibrary.util.FileUtils;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.hjq.permissions.OnPermissionCallback;
|
import com.hjq.permissions.OnPermissionCallback;
|
||||||
@ -48,6 +50,7 @@ import com.navinfo.outdoor.bean.NameAuthenticationBean;
|
|||||||
import com.navinfo.outdoor.http.DialogCallback;
|
import com.navinfo.outdoor.http.DialogCallback;
|
||||||
import com.navinfo.outdoor.http.HttpInterface;
|
import com.navinfo.outdoor.http.HttpInterface;
|
||||||
import com.navinfo.outdoor.room.ChargingPileEntity;
|
import com.navinfo.outdoor.room.ChargingPileEntity;
|
||||||
|
import com.navinfo.outdoor.room.InsertAndUpdateUtils;
|
||||||
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;
|
||||||
@ -827,6 +830,12 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
showSlidingFragment(chargingPileFragment);
|
showSlidingFragment(chargingPileFragment);
|
||||||
} else if (data.what == Constant.CHARGING_STATION_PILE) {//充电站的充电桩
|
} else if (data.what == Constant.CHARGING_STATION_PILE) {//充电站的充电桩
|
||||||
chargingPileEntity = (ChargingPileEntity) data.obj;
|
chargingPileEntity = (ChargingPileEntity) data.obj;
|
||||||
|
} else if (data.what == Constant.CHARGING_STATION_ITEM) {//充电站的item 跳转到充电桩
|
||||||
|
Bundle bundle = new Bundle();
|
||||||
|
bundle.putBoolean("isSliding", false); // 通知抽屉不收回
|
||||||
|
bundle.putSerializable("chargingPileEntity", (ChargingPileEntity) data.obj);
|
||||||
|
ChargingPileFragment chargingPileFragment = ChargingPileFragment.newInstance(bundle);
|
||||||
|
showSlidingFragment(chargingPileFragment);
|
||||||
} else if (data.what == Constant.HOME_TREASURE) {//寻宝的刷新
|
} else if (data.what == Constant.HOME_TREASURE) {//寻宝的刷新
|
||||||
if ((boolean) data.obj) {
|
if ((boolean) data.obj) {
|
||||||
initList(Constant.currentLocation);
|
initList(Constant.currentLocation);
|
||||||
@ -1064,36 +1073,51 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
LatLng mapCenterPoint = getMapCenterPoint();
|
LatLng mapCenterPoint = getMapCenterPoint();
|
||||||
poiEntity.setX(mapCenterPoint.longitude + "");
|
poiEntity.setX(mapCenterPoint.longitude + "");
|
||||||
poiEntity.setY(mapCenterPoint.latitude + "");
|
poiEntity.setY(mapCenterPoint.latitude + "");
|
||||||
bundle.putSerializable("poiEntity", poiEntity);
|
|
||||||
ShareDialog.show((AppCompatActivity) getActivity(), itemList, new ShareDialog.OnItemClickListener() {
|
ShareDialog.show((AppCompatActivity) getActivity(), itemList, new ShareDialog.OnItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onClick(ShareDialog shareDialog, int index, ShareDialog.Item item) {
|
public boolean onClick(ShareDialog shareDialog, int index, ShareDialog.Item item) {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
|
bundle.putSerializable("poiEntity", poiEntity);
|
||||||
BitmapDescriptor poiDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_have_bg);
|
BitmapDescriptor poiDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_have_bg);
|
||||||
markerPoi = tencentMap.addMarker(new MarkerOptions(mapCenterPoint).icon(poiDescriptor));
|
markerPoi = tencentMap.addMarker(new MarkerOptions(mapCenterPoint).icon(poiDescriptor));
|
||||||
PoiFragment poiFragment = PoiFragment.newInstance(bundle);
|
PoiFragment poiFragment = PoiFragment.newInstance(bundle);
|
||||||
showSlidingFragment(poiFragment);
|
showSlidingFragment(poiFragment);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
|
bundle.putSerializable("poiEntity", poiEntity);
|
||||||
BitmapDescriptor poiVideoDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_have_bg);
|
BitmapDescriptor poiVideoDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_have_bg);
|
||||||
markerPoi = tencentMap.addMarker(new MarkerOptions(mapCenterPoint).icon(poiVideoDescriptor));
|
markerPoi = tencentMap.addMarker(new MarkerOptions(mapCenterPoint).icon(poiVideoDescriptor));
|
||||||
PoiVideoFragment poiVideoFragment = PoiVideoFragment.newInstance(bundle);
|
PoiVideoFragment poiVideoFragment = PoiVideoFragment.newInstance(bundle);
|
||||||
showSlidingFragment(poiVideoFragment);
|
showSlidingFragment(poiVideoFragment);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
|
bundle.putSerializable("poiEntity", poiEntity);
|
||||||
BitmapDescriptor roadDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_road_have_bg);
|
BitmapDescriptor roadDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_road_have_bg);
|
||||||
markerPoi = tencentMap.addMarker(new MarkerOptions(mapCenterPoint).icon(roadDescriptor));
|
markerPoi = tencentMap.addMarker(new MarkerOptions(mapCenterPoint).icon(roadDescriptor));
|
||||||
RoadFragment roadFragment = RoadFragment.newInstance(bundle);
|
RoadFragment roadFragment = RoadFragment.newInstance(bundle);
|
||||||
showSlidingFragment(roadFragment);
|
showSlidingFragment(roadFragment);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
BitmapDescriptor chargeDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_charge_have_bg);
|
new Thread(new Runnable() {
|
||||||
markerPoi = tencentMap.addMarker(new MarkerOptions(mapCenterPoint).icon(chargeDescriptor));
|
@Override
|
||||||
ChargingStationFragment chargingStationFragment = ChargingStationFragment.newInstance(bundle);
|
public void run() {
|
||||||
showSlidingFragment(chargingStationFragment);
|
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
|
||||||
|
bundle.putSerializable("poiEntity", poiEntity);
|
||||||
|
getActivity().runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
BitmapDescriptor chargeDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_charge_have_bg);
|
||||||
|
markerPoi = tencentMap.addMarker(new MarkerOptions(mapCenterPoint).icon(chargeDescriptor));
|
||||||
|
ChargingStationFragment chargingStationFragment = ChargingStationFragment.newInstance(bundle);
|
||||||
|
showSlidingFragment(chargingStationFragment);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
|
bundle.putSerializable("poiEntity", poiEntity);
|
||||||
BitmapDescriptor otherDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other_have_bg);
|
BitmapDescriptor otherDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other_have_bg);
|
||||||
markerPoi = tencentMap.addMarker(new MarkerOptions(mapCenterPoint).icon(otherDescriptor));
|
markerPoi = tencentMap.addMarker(new MarkerOptions(mapCenterPoint).icon(otherDescriptor));
|
||||||
OtherFragment otherFragment = OtherFragment.newInstance(bundle);
|
OtherFragment otherFragment = OtherFragment.newInstance(bundle);
|
||||||
@ -1135,7 +1159,9 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
|||||||
*/
|
*/
|
||||||
private void showSlidingFragment(BaseDrawerFragment fragment) {
|
private void showSlidingFragment(BaseDrawerFragment fragment) {
|
||||||
fragmentTransaction = supportFragmentManager.beginTransaction();
|
fragmentTransaction = supportFragmentManager.beginTransaction();
|
||||||
sliding_layout.setPanelHeight(1000);
|
int[] deviceInfo = DensityUtil.getDeviceInfo(getActivity());
|
||||||
|
|
||||||
|
sliding_layout.setPanelHeight(deviceInfo[1] / 3);
|
||||||
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
|
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
|
||||||
fragmentTransaction.add(R.id.scroll_view, fragment, fragment.getClass().getName());
|
fragmentTransaction.add(R.id.scroll_view, fragment, fragment.getClass().getName());
|
||||||
if (!(fragment instanceof FilterFragment)) {
|
if (!(fragment instanceof FilterFragment)) {
|
||||||
|
@ -41,7 +41,11 @@ public interface ChargingPileDao {
|
|||||||
*/
|
*/
|
||||||
@Delete
|
@Delete
|
||||||
void deleteChargingPileEntity(ChargingPileEntity... chargingPileEntities);
|
void deleteChargingPileEntity(ChargingPileEntity... chargingPileEntities);
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
@Query("DELETE FROM pile where fid=:fid")
|
||||||
|
void deleteChargingFidPileEntity(long fid);
|
||||||
/**
|
/**
|
||||||
*删除
|
*删除
|
||||||
* @param chargingPileEntities
|
* @param chargingPileEntities
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
app:layout_constraintTop_toTopOf="parent">
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/edit_phone"
|
android:id="@+id/edit_area_code"
|
||||||
android:layout_width="100dp"
|
android:layout_width="100dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user