电话逻辑,充电桩接口,修改一部分bug
This commit is contained in:
parent
139865fdd9
commit
cbd0a10313
@ -3,21 +3,18 @@ package com.navinfo.outdoor.adapter;
|
||||
import android.content.Context;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowInsets;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.navinfo.outdoor.R;
|
||||
import com.navinfo.outdoor.bean.PoiBean;
|
||||
import com.navinfo.outdoor.bean.PhoneBean;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -27,19 +24,19 @@ import java.util.List;
|
||||
*/
|
||||
public class PoiRecycleAdapter extends RecyclerView.Adapter<PoiRecycleAdapter.MyViewHolder> {
|
||||
private Context context;
|
||||
private List<PoiBean> list=new ArrayList<>();
|
||||
private List<PhoneBean> list=new ArrayList<>();
|
||||
|
||||
public PoiRecycleAdapter(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public void setList(List<PoiBean> list) {
|
||||
public void setList(List<PhoneBean> list) {
|
||||
this.list.addAll(list);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
public boolean getPhoneBean(){
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
PoiBean poiBean = list.get(i);
|
||||
PhoneBean poiBean = list.get(i);
|
||||
if (poiBean.getPhone()==null){
|
||||
return false;
|
||||
}
|
||||
@ -51,7 +48,7 @@ public class PoiRecycleAdapter extends RecyclerView.Adapter<PoiRecycleAdapter.My
|
||||
public String getList() {
|
||||
String a="";
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
PoiBean poiBean = list.get(i);
|
||||
PhoneBean poiBean = list.get(i);
|
||||
if (list.size()==1){
|
||||
if(poiBean.getPhone().indexOf('1')==0){
|
||||
a=poiBean.getPhone();
|
||||
@ -88,9 +85,9 @@ public class PoiRecycleAdapter extends RecyclerView.Adapter<PoiRecycleAdapter.My
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(MyViewHolder holder, final int position) {
|
||||
PoiBean poiBean = list.get(position);
|
||||
if(poiBean.getPhone().indexOf('1')==0){
|
||||
public void onBindViewHolder(final MyViewHolder holder, final int position) {
|
||||
PhoneBean poiBean = list.get(position);
|
||||
if(poiBean.getPhone().startsWith("1")){
|
||||
holder.llPoi.setVisibility(View.GONE);
|
||||
}else {
|
||||
holder.llPoi.setVisibility(View.VISIBLE);
|
||||
@ -103,7 +100,7 @@ public class PoiRecycleAdapter extends RecyclerView.Adapter<PoiRecycleAdapter.My
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (position == 0) {
|
||||
addData(new PoiBean("", "","", R.drawable.icon_del_bg));
|
||||
addData(new PhoneBean("", "","", R.drawable.icon_del_bg));
|
||||
} else {
|
||||
removeData(position);
|
||||
}
|
||||
@ -122,7 +119,7 @@ public class PoiRecycleAdapter extends RecyclerView.Adapter<PoiRecycleAdapter.My
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
String area = holder.editAreaCode.getText().toString().trim();
|
||||
String area = s.toString().trim();
|
||||
poiBean.setArea(area);
|
||||
}
|
||||
});
|
||||
@ -148,7 +145,7 @@ public class PoiRecycleAdapter extends RecyclerView.Adapter<PoiRecycleAdapter.My
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
String str = holder.editPhoneNumber.getText().toString().trim();
|
||||
String str = s.toString().trim();
|
||||
poiBean.setPhone(str);
|
||||
}
|
||||
});
|
||||
@ -161,7 +158,7 @@ public class PoiRecycleAdapter extends RecyclerView.Adapter<PoiRecycleAdapter.My
|
||||
}
|
||||
|
||||
// 添加数据
|
||||
public void addData(PoiBean poiBean) {
|
||||
public void addData(PhoneBean poiBean) {
|
||||
//在list中添加数据,并通知条目加入一条
|
||||
list.add(poiBean);
|
||||
//添加动画
|
||||
|
@ -84,6 +84,7 @@ public class Constant {
|
||||
public static int LIMIT_TTPE = -1; //权限类型,普通任务-0,专属任务-1
|
||||
public static int TASK_TYPE = -1; // 任务类型
|
||||
public static int TASK_STASTUS = -1; // 任务状态
|
||||
public static String CODE =""; //区号
|
||||
/**
|
||||
* 用户当前位置
|
||||
*/
|
||||
|
@ -1,12 +1,12 @@
|
||||
package com.navinfo.outdoor.bean;
|
||||
|
||||
public class PoiBean {
|
||||
public class PhoneBean {
|
||||
String name;
|
||||
String phone;
|
||||
String area;
|
||||
int image;
|
||||
|
||||
public PoiBean(String name, String phone, String area, int image) {
|
||||
public PhoneBean(String name, String phone, String area, int image) {
|
||||
this.name = name;
|
||||
this.phone = phone;
|
||||
this.area = area;
|
@ -82,7 +82,9 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
private int cp_floor = 1;
|
||||
private int sign_exist = 0;
|
||||
private int cp_availableState = 0;
|
||||
private CheckBox checkButton1, checkButton2, checkButton3, checkButton4, checkButton5, checkButton6;
|
||||
private String buffer1="",buffer2="",buffer3="",buffer4="",buffer5="";
|
||||
private StringBuffer openType = new StringBuffer();
|
||||
private CheckBox checkButton1, checkButton2, checkButton3, checkButton4, checkButton5;
|
||||
private long pid;
|
||||
private String station;
|
||||
private LatLng latLng;
|
||||
@ -162,11 +164,15 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
if (isChecked){
|
||||
checkBoxLife.setText("保存");
|
||||
checkBoxLife.setTextColor(Color.WHITE);
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.MAIN_CHARGING_PILE;
|
||||
obtain.obj = poiLatLng;
|
||||
EventBus.getDefault().post(obtain);
|
||||
}else {
|
||||
checkBoxLife.setText("编辑");
|
||||
checkBoxLife.setTextColor(Color.BLACK);
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.MAIN_CHARGING_CHECKED_PILE;
|
||||
obtain.obj = true;
|
||||
@ -181,13 +187,15 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
if (isChecked) {
|
||||
|
||||
Toast.makeText(getContext(), "1", Toast.LENGTH_SHORT).show();
|
||||
buffer1="1,";
|
||||
buffer2="";
|
||||
buffer3="";
|
||||
buffer4="";
|
||||
buffer5="";
|
||||
checkButton2.setChecked(false);
|
||||
checkButton3.setChecked(false);
|
||||
checkButton4.setChecked(false);
|
||||
checkButton5.setChecked(false);
|
||||
checkButton6.setChecked(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -196,7 +204,9 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
if (isChecked) {
|
||||
Toast.makeText(getContext(), "2", Toast.LENGTH_SHORT).show();
|
||||
buffer2="2,";
|
||||
}else {
|
||||
buffer2="";
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -205,7 +215,9 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
if (isChecked) {
|
||||
Toast.makeText(getContext(), "3", Toast.LENGTH_SHORT).show();
|
||||
buffer3="3,";
|
||||
}else {
|
||||
buffer3="";
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -214,7 +226,9 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
if (isChecked) {
|
||||
Toast.makeText(getContext(), "4", Toast.LENGTH_SHORT).show();
|
||||
buffer4="4,";
|
||||
}else {
|
||||
buffer4="";
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -223,7 +237,9 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
if (isChecked) {
|
||||
Toast.makeText(getContext(), "5", Toast.LENGTH_SHORT).show();
|
||||
buffer5="5,";
|
||||
}else {
|
||||
buffer5="";
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -396,6 +412,11 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
if (name != null) {
|
||||
editNameContent.setText(name + "");
|
||||
}
|
||||
if (editNameContent.getText().toString()!=null&&!editNameContent.getText().toString().trim().equals("")){
|
||||
editNameContent.setEnabled(false);
|
||||
}else {
|
||||
editNameContent.setEnabled(true);
|
||||
}
|
||||
String p = chargingPileEntity.getP();
|
||||
if (p != null) {
|
||||
latLng = GeometryTools.createLatLng(p);
|
||||
@ -507,7 +528,6 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
checkButton3.setEnabled(false);//开放状态3
|
||||
checkButton4.setEnabled(false);//开放状态4
|
||||
checkButton5.setEnabled(false);//开放状态5
|
||||
checkButton6.setEnabled(false);//开放状态6
|
||||
spinnerType.setEnabled(false);//充电地面层
|
||||
rlPanorama.setEnabled(false);//全景照片
|
||||
rlCoding.setEnabled(false);//充电桩编码
|
||||
@ -564,9 +584,6 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
} else {
|
||||
chargingPileEntity.setName(name);
|
||||
}
|
||||
if (cp_floor != 0) {
|
||||
chargingPileEntity.setCp_floor(cp_floor);
|
||||
}
|
||||
String tagPanorama = (String) ivPanorama.getTag();
|
||||
if (tagPanorama == null) {
|
||||
Toast.makeText(getActivity(), "请拍照 全景图", Toast.LENGTH_SHORT).show();
|
||||
@ -645,13 +662,28 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
photoBean.add(tagNumber);
|
||||
}
|
||||
chargingPileEntity.setPhotos(photoBean);
|
||||
if (buffer1!=null&&!buffer1.equals("")){
|
||||
openType.delete(0,openType.length());
|
||||
openType.append(buffer1);
|
||||
String charAt = openType.deleteCharAt(openType.length() - 1).toString();
|
||||
chargingPileEntity.setCp_openType(charAt);
|
||||
}else {
|
||||
openType.delete(0,openType.length());
|
||||
openType.append(buffer2);
|
||||
openType.append(buffer3);
|
||||
openType.append(buffer4);
|
||||
openType.append(buffer5);
|
||||
String charAt = openType.deleteCharAt(openType.length() - 1).toString();
|
||||
chargingPileEntity.setCp_openType(charAt);
|
||||
}
|
||||
|
||||
if (cp_floor != 0) {
|
||||
chargingPileEntity.setCp_floor(cp_floor);
|
||||
}
|
||||
chargingPileEntity.setSign_exist(sign_exist);
|
||||
chargingPileEntity.setCp_availableState(cp_availableState);
|
||||
String describe = editDescribe.getText().toString().trim();
|
||||
if (describe == null || describe.equals("")) {
|
||||
Toast.makeText(getActivity(), "请输入任务描述", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
if (describe != null && !describe.equals("")) {
|
||||
chargingPileEntity.setMemo(describe);
|
||||
}
|
||||
if (pid == 0) {
|
||||
@ -670,7 +702,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
obtain.obj = chargingPileEntity;
|
||||
EventBus.getDefault().post(obtain);
|
||||
chargingPileByWork(chargingPileEntity);
|
||||
//onBackPressed();
|
||||
|
||||
} else {
|
||||
Toast.makeText(getActivity(), "没有申请权限,请手动申请", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
@ -760,6 +792,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
dismissLoadingDialog();
|
||||
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onSuccess: " + chargingPileSaveBean.getBody());
|
||||
getActivity().onBackPressed();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -771,6 +804,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
}).build();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
@ -851,6 +885,17 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
if (pid != 0) {
|
||||
chargingPileEntity.setFid(pid);
|
||||
}
|
||||
if (buffer1!=null&&!buffer1.equals("")){
|
||||
chargingPileEntity.setCp_openType(buffer1);
|
||||
}else {
|
||||
openType.reverse();
|
||||
openType.append(buffer2);
|
||||
openType.append(buffer3);
|
||||
openType.append(buffer4);
|
||||
openType.append(buffer5);
|
||||
String charAt = openType.deleteCharAt(openType.length() - 1).toString();
|
||||
chargingPileEntity.setCp_openType(charAt);
|
||||
}
|
||||
String newChargingPileEntity = new Gson().toJson(chargingPileEntity);
|
||||
//以键值对的形式添加新值。
|
||||
edit.putString("chargingPileEntity", newChargingPileEntity);
|
||||
@ -881,7 +926,6 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
}
|
||||
});
|
||||
} else {
|
||||
//int angle1 = PictureUtil.readPictureDegree(takePhotoPath1);
|
||||
takePhotoPath1 = PhotoPathUtil.getTakePhotoPath(data, "a",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
|
||||
ivPanorama.setTag(takePhotoPath1);
|
||||
ivPanorama.setImageBitmap(bitmap);//显示图像
|
||||
@ -902,7 +946,6 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
}
|
||||
});
|
||||
} else {
|
||||
//int angle2 = PictureUtil.readPictureDegree(takePhotoPath2);
|
||||
takePhotoPath2 = PhotoPathUtil.getTakePhotoPath(data, "b",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
|
||||
ivCoding.setTag(takePhotoPath2);
|
||||
ivCoding.setImageBitmap(bitmap);//显示图像
|
||||
@ -923,7 +966,6 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
}
|
||||
});
|
||||
} else {
|
||||
int angle3 = PictureUtil.readPictureDegree(takePhotoPath3);
|
||||
takePhotoPath3 = PhotoPathUtil.getTakePhotoPath(data, "c",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
|
||||
ivEquipment.setImageBitmap(bitmap);//显示图像
|
||||
ivEquipment.setTag(takePhotoPath3);
|
||||
@ -944,7 +986,6 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
}
|
||||
});
|
||||
} else {
|
||||
int angle4 = PictureUtil.readPictureDegree(takePhotoPath4);
|
||||
takePhotoPath4 = PhotoPathUtil.getTakePhotoPath(data, "c",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
|
||||
ivFacility.setTag(takePhotoPath4);
|
||||
ivFacility.setImageBitmap(bitmap);//显示图像
|
||||
@ -965,7 +1006,6 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
}
|
||||
});
|
||||
} else {
|
||||
int angle5 = PictureUtil.readPictureDegree(takePhotoPath5);
|
||||
takePhotoPath5 = PhotoPathUtil.getTakePhotoPath(data, "c",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
|
||||
ivScutcheon.setTag(takePhotoPath5);
|
||||
ivScutcheon.setImageBitmap(bitmap);//显示图像
|
||||
@ -986,7 +1026,6 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
}
|
||||
});
|
||||
} else {
|
||||
int angle6 = PictureUtil.readPictureDegree(takePhotoPath6);
|
||||
takePhotoPath6 = PhotoPathUtil.getTakePhotoPath(data, "c",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
|
||||
ivDevice.setTag(takePhotoPath6);
|
||||
ivDevice.setImageBitmap(bitmap);//显示图像
|
||||
@ -1007,7 +1046,6 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
}
|
||||
});
|
||||
} else {
|
||||
int angle7 = PictureUtil.readPictureDegree(takePhotoPath7);
|
||||
takePhotoPath7 = PhotoPathUtil.getTakePhotoPath(data, "d",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
|
||||
ivUsable.setTag(takePhotoPath7);
|
||||
ivUsable.setImageBitmap(bitmap);//显示图像
|
||||
@ -1028,7 +1066,6 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
}
|
||||
});
|
||||
} else {
|
||||
int angle8 = PictureUtil.readPictureDegree(takePhotoPath8);
|
||||
takePhotoPath8 = PhotoPathUtil.getTakePhotoPath(data, "d",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
|
||||
ivAvailable.setTag(takePhotoPath8);
|
||||
ivAvailable.setImageBitmap(bitmap);//显示图像
|
||||
@ -1049,7 +1086,6 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
}
|
||||
});
|
||||
} else {
|
||||
int angle9 = PictureUtil.readPictureDegree(takePhotoPath9);
|
||||
takePhotoPath9 = PhotoPathUtil.getTakePhotoPath(data, "e",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
|
||||
ivParking.setImageBitmap(bitmap);//显示图像
|
||||
ivParking.setTag(takePhotoPath9);
|
||||
@ -1070,7 +1106,6 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
}
|
||||
});
|
||||
} else {
|
||||
int angle10 = PictureUtil.readPictureDegree(takePhotoPath10);
|
||||
takePhotoPath10 = PhotoPathUtil.getTakePhotoPath(data, "e",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
|
||||
ivNumber.setImageBitmap(bitmap);//显示图像
|
||||
ivNumber.setTag(takePhotoPath10);
|
||||
|
@ -3,6 +3,7 @@ package com.navinfo.outdoor.fragment;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.os.Message;
|
||||
import android.util.Log;
|
||||
@ -24,9 +25,7 @@ import android.widget.Toast;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
@ -42,12 +41,11 @@ import com.kongzue.dialog.v3.MessageDialog;
|
||||
import com.lzy.okgo.model.HttpParams;
|
||||
import com.navinfo.outdoor.R;
|
||||
import com.navinfo.outdoor.adapter.ChargingPileAdapter;
|
||||
import com.navinfo.outdoor.adapter.PoiRecycleAdapter;
|
||||
import com.navinfo.outdoor.api.Constant;
|
||||
import com.navinfo.outdoor.base.BaseDrawerFragment;
|
||||
import com.navinfo.outdoor.bean.ChargingStationBean;
|
||||
import com.navinfo.outdoor.bean.Info;
|
||||
import com.navinfo.outdoor.bean.PoiBean;
|
||||
import com.navinfo.outdoor.bean.PhoneBean;
|
||||
import com.navinfo.outdoor.http.Callback;
|
||||
import com.navinfo.outdoor.http.HttpInterface;
|
||||
import com.navinfo.outdoor.http.OkGoBuilder;
|
||||
@ -57,6 +55,7 @@ import com.navinfo.outdoor.room.InsertAndUpdateUtils;
|
||||
import com.navinfo.outdoor.room.PoiDao;
|
||||
import com.navinfo.outdoor.room.PoiDatabase;
|
||||
import com.navinfo.outdoor.room.PoiEntity;
|
||||
import com.navinfo.outdoor.ui.view.ContactView;
|
||||
import com.navinfo.outdoor.util.Geohash;
|
||||
import com.navinfo.outdoor.util.PhotoPathUtil;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
||||
@ -84,9 +83,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
private ImageView ivPanorama, ivName, ivInternal, ivElse, ivScutcheon;
|
||||
private TextView tvExamine;
|
||||
private EditText editNameContent, editSiteContent;
|
||||
private RecyclerView recyclerPhone;
|
||||
private PoiRecycleAdapter poiRecycleAdapter;
|
||||
private ArrayList<PoiBean> poiBeans;
|
||||
private ArrayList<PhoneBean> poiBeans;
|
||||
private Button btnSaveLocal;
|
||||
private Button btnUploading;
|
||||
private PoiDatabase poiDatabase;
|
||||
@ -96,6 +93,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
private Spinner spinnerType;
|
||||
String[] ctype = new String[]{"充电站", "充换电站", "充电桩组", "换电站"};//1."充电站"2 "充换电站"3 "充电桩组"4 "换电站"5 ,
|
||||
String[] spinner = new String[]{"存在", "不存在", "无法验证"};
|
||||
private int existence=0;
|
||||
private ArrayAdapter<String> adapter;
|
||||
private LinearLayout linearChargingPile;
|
||||
private RecyclerView recyclerStation;
|
||||
@ -107,6 +105,8 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
private RelativeLayout linearExist;
|
||||
private Spinner spinnerExist;
|
||||
private Integer body;
|
||||
private LinearLayout linearContact;
|
||||
private ContactView contactView;
|
||||
|
||||
public static ChargingStationFragment newInstance(Bundle bundle) {
|
||||
ChargingStationFragment fragment = new ChargingStationFragment();
|
||||
@ -179,6 +179,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
}
|
||||
if (isSliding) {
|
||||
// 监听到返回按钮点击事件
|
||||
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.TREASURE_FRAGMENT;
|
||||
obtain.obj = isSliding;
|
||||
@ -206,11 +207,15 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
if (isChecked) {
|
||||
checkBoxLife.setText("保存");
|
||||
checkBoxLife.setTextColor(Color.WHITE);
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.MAIN_CHARGING_STATION;
|
||||
obtain.obj = latLng;
|
||||
EventBus.getDefault().post(obtain);
|
||||
} else {
|
||||
checkBoxLife.setText("编辑");
|
||||
checkBoxLife.setTextColor(Color.BLACK);
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.MAIN_CHARGING_CHECKED_STATION;
|
||||
obtain.obj = true;
|
||||
@ -258,10 +263,13 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
switch (position) {
|
||||
case 0:
|
||||
existence=0;
|
||||
break;
|
||||
case 1:
|
||||
existence=1;
|
||||
break;
|
||||
case 2:
|
||||
existence=2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -284,6 +292,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
editDescribe = findViewById(R.id.edit_describe);
|
||||
ivPanorama = findViewById(R.id.iv_panorama);
|
||||
ivName = findViewById(R.id.iv_name);
|
||||
linearContact = findViewById(R.id.linear_contact);
|
||||
ivInternal = findViewById(R.id.iv_internal);
|
||||
ivElse = findViewById(R.id.iv_else);
|
||||
ivScutcheon = findViewById(R.id.iv_scutcheon);
|
||||
@ -297,11 +306,12 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
rlElse.setOnClickListener(this::onClick);
|
||||
rlScutcheon = findViewById(R.id.rl_scutcheon);
|
||||
rlScutcheon.setOnClickListener(this::onClick);
|
||||
recyclerPhone = findViewById(R.id.recycler_phone);
|
||||
|
||||
/* recyclerPhone = findViewById(R.id.recycler_phone);
|
||||
recyclerPhone.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
recyclerPhone.addItemDecoration(new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL));
|
||||
poiRecycleAdapter = new PoiRecycleAdapter(getContext());
|
||||
recyclerPhone.setAdapter(poiRecycleAdapter);
|
||||
recyclerPhone.setAdapter(poiRecycleAdapter);*/
|
||||
recyclerStation = findViewById(R.id.recycler_station);
|
||||
recyclerStation.setLayoutManager(new GridLayoutManager(getContext(), 3));
|
||||
chargingPileAdapter = new ChargingPileAdapter(getContext());
|
||||
@ -340,6 +350,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
latLng.setLatitude(Double.parseDouble(y));
|
||||
latLng.setLongitude(Double.parseDouble(x));
|
||||
}
|
||||
initPhone();
|
||||
String describe = showPoiEntity.getDescribe();//任务描述
|
||||
if (describe != null && !describe.equals("")) {
|
||||
editDescribe.setText(describe);
|
||||
@ -354,9 +365,9 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
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));
|
||||
poiBeans.add(new PhoneBean("电话*", phones[i], "", R.drawable.icon_add_bg));
|
||||
} else {
|
||||
poiBeans.add(new PoiBean("电话*", split[1], split[0], R.drawable.icon_add_bg));
|
||||
poiBeans.add(new PhoneBean("电话*", split[1], split[0], R.drawable.icon_add_bg));
|
||||
}
|
||||
|
||||
}
|
||||
@ -364,22 +375,29 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
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));
|
||||
poiBeans.add(new PhoneBean("", phones[i], "", R.drawable.icon_del_bg));
|
||||
} else {
|
||||
poiBeans.add(new PoiBean("", split[1], split[0], R.drawable.icon_del_bg));
|
||||
poiBeans.add(new PhoneBean("", split[1], split[0], R.drawable.icon_del_bg));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
poiBeans.add(new PoiBean("电话*", "", "", R.drawable.icon_add_bg));
|
||||
if (Constant.CODE==null||Constant.CODE.equals("")){
|
||||
poiBeans.add(new PhoneBean("电话*", "", "", R.drawable.icon_add_bg));
|
||||
}else {
|
||||
poiBeans.add(new PhoneBean("电话*", "", Constant.CODE, R.drawable.icon_add_bg));
|
||||
}
|
||||
|
||||
}
|
||||
body = showPoiEntity.getBodyId();
|
||||
poiRecycleAdapter.setList(poiBeans);
|
||||
body=showPoiEntity.getBodyId();
|
||||
contactView = new ContactView(getActivity(), linearContact, poiBeans);
|
||||
contactView.resetView();
|
||||
//poiRecycleAdapter.setList(poiBeans);
|
||||
if (showPoiEntity.getName() != null) {
|
||||
linearExist.setVisibility(View.VISIBLE);
|
||||
|
||||
spinnerExist.setSelection(showPoiEntity.getExistence(), true);
|
||||
}
|
||||
if (showPoiEntity.getPhotoInfo() != null) {
|
||||
for (int i = 0; i < showPoiEntity.getPhotoInfo().size(); i++) {
|
||||
@ -447,7 +465,39 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
EventBus.getDefault().post(obtain);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 得到电话区号,电话位数
|
||||
*/
|
||||
private void initPhone() {
|
||||
String encode = Geohash.getInstance().encode(latLng.latitude, latLng.longitude);
|
||||
if (encode == null) {
|
||||
Toast.makeText(getActivity(), "没有确定经纬度", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
showLoadingDialog();
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(HttpInterface.GET_PHONES)
|
||||
.method(OkGoBuilder.GET)
|
||||
.params(new HttpParams("geo",encode))
|
||||
.cls(GetPhoneBean.class)
|
||||
.callback(new Callback<GetPhoneBean>() {
|
||||
@Override
|
||||
public void onSuccess(GetPhoneBean getPhoneBean, int id) {
|
||||
dismissLoadingDialog();
|
||||
if (getPhoneBean.getCode()==200){
|
||||
String code = getPhoneBean.getBody().getCode();
|
||||
Constant.CODE=code;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e, int id) {
|
||||
dismissLoadingDialog();
|
||||
Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}).build();
|
||||
}
|
||||
public void initRemovePileSharePre() {
|
||||
//获取SharedPreferences对象,方法中两个参数的意思为:第一个name
|
||||
//表示文件名,系统将会在/dada/dada/包名/shared_prefs目录下生成
|
||||
@ -469,7 +519,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
editNameContent.setEnabled(false);
|
||||
tvExamine.setEnabled(false);
|
||||
editSiteContent.setEnabled(false);
|
||||
recyclerPhone.setEnabled(false);
|
||||
linearContact.setEnabled(false);
|
||||
ivPanorama.setEnabled(false);
|
||||
ivName.setEnabled(false);
|
||||
ivInternal.setEnabled(false);
|
||||
@ -521,10 +571,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
poiEntity.setName(name);
|
||||
}
|
||||
String site = editSiteContent.getText().toString().trim();
|
||||
if (site == null || site.equals("")) {
|
||||
Toast.makeText(getActivity(), "请输入充电站 地址", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
if (site != null && !site.equals("")) {
|
||||
poiEntity.setAddress(site);
|
||||
}
|
||||
if (latLng == null) {
|
||||
@ -537,19 +584,13 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
poiEntity.setY(String.valueOf(latLng.latitude));
|
||||
}
|
||||
String describe = editDescribe.getText().toString().trim();
|
||||
if (describe == null || describe.equals("")) {
|
||||
Toast.makeText(getActivity(), "请输入任务描述", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
if (describe != null && !describe.equals("")) {
|
||||
poiEntity.setDescribe(describe);
|
||||
}
|
||||
boolean phoneBean = poiRecycleAdapter.getPhoneBean();
|
||||
boolean phoneBean = contactView.getPhoneBean();
|
||||
if (phoneBean){
|
||||
String list = poiRecycleAdapter.getList();
|
||||
String list = contactView.getList();
|
||||
poiEntity.setTelPhone(list);
|
||||
}else {
|
||||
Toast.makeText(getActivity(), "请输入手机号", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
String tagPanorama = (String) ivPanorama.getTag();
|
||||
if (tagPanorama == null) {
|
||||
@ -586,7 +627,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
} else {
|
||||
infoPhoto.add(new Info(tagScutcheon));
|
||||
}
|
||||
|
||||
poiEntity.setExistence(existence);
|
||||
poiEntity.setPhotoInfo(infoPhoto);
|
||||
poiEntity.setStation_type(station_type);
|
||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
@ -776,9 +817,9 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
if (describe != null && !describe.equals("")) {
|
||||
poiEntity.setDescribe(describe);
|
||||
}
|
||||
boolean phoneBean = poiRecycleAdapter.getPhoneBean();
|
||||
boolean phoneBean = contactView.getPhoneBean();
|
||||
if (phoneBean){
|
||||
String list = poiRecycleAdapter.getList();
|
||||
String list = contactView.getList();
|
||||
poiEntity.setTelPhone(list);
|
||||
}
|
||||
String tagPanorama = (String) ivPanorama.getTag();
|
||||
@ -808,6 +849,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
String format = formatter.format(calendar.getTime());
|
||||
poiEntity.setCreateTime(format);
|
||||
poiEntity.setExistence(existence);
|
||||
poiEntity.setType(2);
|
||||
poiEntity.setTaskStatus(2);
|
||||
poiEntity.setIsLocalData(1);
|
||||
@ -853,9 +895,9 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
if (describe != null && !describe.equals("")) {
|
||||
poiEntity.setDescribe(describe);
|
||||
}
|
||||
boolean phoneBean = poiRecycleAdapter.getPhoneBean();
|
||||
boolean phoneBean = contactView.getPhoneBean();
|
||||
if (phoneBean){
|
||||
String list = poiRecycleAdapter.getList();
|
||||
String list = contactView.getList();
|
||||
poiEntity.setTelPhone(list);
|
||||
}
|
||||
String tagPanorama = (String) ivPanorama.getTag();
|
||||
@ -885,6 +927,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
String format = formatter.format(calendar.getTime());
|
||||
poiEntity.setCreateTime(format);
|
||||
poiEntity.setExistence(existence);
|
||||
poiEntity.setType(2);
|
||||
poiEntity.setTaskStatus(2);
|
||||
poiEntity.setIsLocalData(1);
|
||||
|
@ -3,6 +3,7 @@ package com.navinfo.outdoor.fragment;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.os.Message;
|
||||
import android.util.Log;
|
||||
@ -85,9 +86,6 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
private PoiEntity showPoiEntity;
|
||||
private LatLng latLng;
|
||||
private int station_type = 6;
|
||||
String[] spinner = new String[]{"存在", "不存在", "无法验证"};
|
||||
private RelativeLayout linearExist;
|
||||
private Spinner spinnerExist;
|
||||
|
||||
|
||||
private String takePhotoPath;
|
||||
@ -182,11 +180,15 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
if (isChecked) {
|
||||
checkPot.setText("保存");
|
||||
checkPot.setTextColor(Color.WHITE);
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.MAIN_OTHER;
|
||||
obtain.obj = latLng;
|
||||
EventBus.getDefault().post(obtain);
|
||||
} else {
|
||||
checkPot.setText("编辑");
|
||||
checkPot.setTextColor(Color.BLACK);
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.MAIN_CHECKED_OTHER;
|
||||
obtain.obj = true;
|
||||
@ -206,31 +208,6 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
btnOtherLocal.setOnClickListener(this::onClick);
|
||||
btnOtherUploading = findViewById(R.id.btn_other_uploading);
|
||||
btnOtherUploading.setOnClickListener(this::onClick);
|
||||
linearExist = findViewById(R.id.linear_exist);
|
||||
spinnerExist = findViewById(R.id.spinner_exist);
|
||||
ArrayAdapter<String> adapterExist = new ArrayAdapter<>(getContext(), android.R.layout.simple_spinner_item, spinner);
|
||||
adapterExist.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); //设置下拉列表框的下拉选项样式
|
||||
spinnerExist.setAdapter(adapterExist);
|
||||
spinnerExist.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
switch (position) {
|
||||
case 0:
|
||||
|
||||
break;
|
||||
case 1:
|
||||
|
||||
break;
|
||||
case 2:
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parent) {
|
||||
}
|
||||
});
|
||||
//数据展示
|
||||
initShowPoi();
|
||||
|
||||
@ -269,9 +246,6 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
editOtherDescribe.setText(describe);
|
||||
}
|
||||
|
||||
if (showPoiEntity.getName() != null) {
|
||||
linearExist.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
body = showPoiEntity.getBodyId();
|
||||
|
||||
@ -335,10 +309,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
poiEntity.setY(String.valueOf(latLng.latitude));
|
||||
}
|
||||
String describe = editOtherDescribe.getText().toString().trim();
|
||||
if (describe == null || describe.equals("")) {
|
||||
Toast.makeText(getActivity(), "请输入任务描述", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
if (describe != null&&!describe.equals("")) {
|
||||
poiEntity.setDescribe(describe);
|
||||
}
|
||||
String tagPicture = (String) ivPicture.getTag();
|
||||
@ -539,11 +510,6 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
if (tagPictures != null && !tagPictures.equals("")) {
|
||||
arrayList.add(new Info(tagPictures));
|
||||
}
|
||||
if (showPoiEntity != null) {
|
||||
if (showPoiEntity.getTaskId() != 0) {
|
||||
poiEntity.setTaskId(showPoiEntity.getTaskId());
|
||||
}
|
||||
}
|
||||
poiEntity.setPhotoInfo(arrayList);
|
||||
poiEntity.setStation_type(station_type);
|
||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
@ -3,6 +3,7 @@ package com.navinfo.outdoor.fragment;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.os.Message;
|
||||
import android.util.Log;
|
||||
@ -15,6 +16,7 @@ import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
@ -23,12 +25,8 @@ import android.widget.Toast;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.github.lazylibrary.util.DensityUtil;
|
||||
import com.github.lazylibrary.util.StringUtils;
|
||||
import com.google.gson.Gson;
|
||||
import com.hjq.permissions.OnPermissionCallback;
|
||||
@ -42,13 +40,13 @@ import com.lzy.okgo.OkGo;
|
||||
import com.lzy.okgo.model.HttpParams;
|
||||
import com.lzy.okgo.model.Response;
|
||||
import com.navinfo.outdoor.R;
|
||||
import com.navinfo.outdoor.adapter.PoiRecycleAdapter;
|
||||
import com.navinfo.outdoor.api.Constant;
|
||||
import com.navinfo.outdoor.base.BaseDrawerFragment;
|
||||
import com.navinfo.outdoor.bean.Info;
|
||||
import com.navinfo.outdoor.bean.OtherUploadPicBean;
|
||||
import com.navinfo.outdoor.bean.PoiBean;
|
||||
import com.navinfo.outdoor.bean.PhoneBean;
|
||||
import com.navinfo.outdoor.bean.PoiSaveBean;
|
||||
import com.navinfo.outdoor.bean.PoiVideoBean;
|
||||
import com.navinfo.outdoor.http.Callback;
|
||||
import com.navinfo.outdoor.http.DialogCallback;
|
||||
import com.navinfo.outdoor.http.HttpInterface;
|
||||
@ -57,6 +55,7 @@ import com.navinfo.outdoor.room.InsertAndUpdateUtils;
|
||||
import com.navinfo.outdoor.room.PoiDao;
|
||||
import com.navinfo.outdoor.room.PoiDatabase;
|
||||
import com.navinfo.outdoor.room.PoiEntity;
|
||||
import com.navinfo.outdoor.ui.view.ContactView;
|
||||
import com.navinfo.outdoor.util.Geohash;
|
||||
import com.navinfo.outdoor.util.PhotoPathUtil;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
||||
@ -82,9 +81,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
private ImageView ivPanorama, ivName, ivInternal, ivCard, ivElse;
|
||||
private TextView tvExamine;
|
||||
private EditText editNameContent, editSiteContent;
|
||||
private RecyclerView recyclerPhone;
|
||||
private PoiRecycleAdapter poiRecycleAdapter;
|
||||
private ArrayList<PoiBean> poiBeans;
|
||||
private ArrayList<PhoneBean> poiBeans;
|
||||
private Button btnSaveLocal;
|
||||
private Button btnUploading;
|
||||
private PoiDatabase poiDatabase;
|
||||
@ -94,6 +91,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
private PoiEntity showPoiEntity;
|
||||
private LatLng latLng;
|
||||
String[] spinner = new String[]{"存在", "不存在", "无法验证"};
|
||||
private int existence=0;
|
||||
private RelativeLayout linearExist;
|
||||
private Spinner spinnerExist;
|
||||
|
||||
@ -104,6 +102,8 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
private String takePhotoPath3;
|
||||
private String takePhotoPath1;
|
||||
private Integer body;
|
||||
private LinearLayout linearContact;
|
||||
private ContactView contactView;
|
||||
|
||||
public static PoiFragment newInstance(Bundle bundle) {
|
||||
PoiFragment fragment = new PoiFragment();
|
||||
@ -169,11 +169,15 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
if (isChecked) {
|
||||
checkBoxLife.setText("保存");
|
||||
checkBoxLife.setTextColor(Color.WHITE);
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.TREASURE_WORD;
|
||||
obtain.obj = latLng;
|
||||
EventBus.getDefault().post(obtain);
|
||||
} else {
|
||||
checkBoxLife.setText("编辑");
|
||||
checkBoxLife.setTextColor(Color.BLACK);
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.TREASURE_CHECKED_WORD;
|
||||
obtain.obj = true;
|
||||
@ -195,6 +199,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
ivPanorama = findViewById(R.id.iv_panorama);
|
||||
ivName = findViewById(R.id.iv_name);
|
||||
ivInternal = findViewById(R.id.iv_internal);
|
||||
linearContact = findViewById(R.id.linear_contact);
|
||||
ivCard = findViewById(R.id.iv_card);
|
||||
ivElse = findViewById(R.id.iv_else);
|
||||
rlPanorama = findViewById(R.id.rl_panorama);
|
||||
@ -217,10 +222,13 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
switch (position) {
|
||||
case 0:
|
||||
existence=0;
|
||||
break;
|
||||
case 1:
|
||||
existence=1;
|
||||
break;
|
||||
case 2:
|
||||
existence=2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -230,17 +238,16 @@ 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.addItemDecoration(new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL));
|
||||
poiRecycleAdapter = new PoiRecycleAdapter(getContext());
|
||||
recyclerPhone.setAdapter(poiRecycleAdapter);
|
||||
recyclerPhone.setAdapter(poiRecycleAdapter);*/
|
||||
//数据展示
|
||||
initShowPoi();
|
||||
//禁用所有可操作控件
|
||||
//disables();
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void initShowPoi() {
|
||||
@ -261,6 +268,8 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
latLng.setLatitude(Double.parseDouble(y));
|
||||
latLng.setLongitude(Double.parseDouble(x));
|
||||
}
|
||||
initPhone();
|
||||
|
||||
String describe = showPoiEntity.getDescribe();//任务描述
|
||||
if (describe != null && !describe.equals("")) {
|
||||
editDescribe.setText(describe);
|
||||
@ -273,9 +282,9 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
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));
|
||||
poiBeans.add(new PhoneBean("电话*", phones[i], "", R.drawable.icon_add_bg));
|
||||
} else {
|
||||
poiBeans.add(new PoiBean("电话*", split[1], split[0], R.drawable.icon_add_bg));
|
||||
poiBeans.add(new PhoneBean("电话*", split[1], split[0], R.drawable.icon_add_bg));
|
||||
}
|
||||
|
||||
}
|
||||
@ -283,21 +292,29 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
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));
|
||||
poiBeans.add(new PhoneBean("", phones[i], "", R.drawable.icon_del_bg));
|
||||
} else {
|
||||
poiBeans.add(new PoiBean("", split[1], split[0], R.drawable.icon_del_bg));
|
||||
poiBeans.add(new PhoneBean("", split[1], split[0], R.drawable.icon_del_bg));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
poiBeans.add(new PoiBean("电话*", "", "", R.drawable.icon_add_bg));
|
||||
if (Constant.CODE==null||Constant.CODE.equals("")){
|
||||
poiBeans.add(new PhoneBean("电话*", "", "", R.drawable.icon_add_bg));
|
||||
}else {
|
||||
poiBeans.add(new PhoneBean("电话*", "", Constant.CODE, R.drawable.icon_add_bg));
|
||||
}
|
||||
|
||||
}
|
||||
body=showPoiEntity.getBodyId();
|
||||
poiRecycleAdapter.setList(poiBeans);
|
||||
contactView = new ContactView(getActivity(), linearContact, poiBeans);
|
||||
contactView.resetView();
|
||||
//poiRecycleAdapter.setList(poiBeans);
|
||||
if (showPoiEntity.getName()!=null){
|
||||
linearExist.setVisibility(View.VISIBLE);
|
||||
spinnerExist.setSelection(showPoiEntity.getExistence(), true);
|
||||
}
|
||||
if (showPoiEntity.getPhotoInfo() != null) {
|
||||
for (int i = 0; i < showPoiEntity.getPhotoInfo().size(); i++) {
|
||||
@ -323,6 +340,40 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 得到电话区号,电话位数
|
||||
*/
|
||||
private void initPhone() {
|
||||
String encode = Geohash.getInstance().encode(latLng.latitude, latLng.longitude);
|
||||
if (encode == null) {
|
||||
Toast.makeText(getActivity(), "没有确定经纬度", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
showLoadingDialog();
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(HttpInterface.GET_PHONES)
|
||||
.method(OkGoBuilder.GET)
|
||||
.params(new HttpParams("geo",encode))
|
||||
.cls(GetPhoneBean.class)
|
||||
.callback(new Callback<GetPhoneBean>() {
|
||||
@Override
|
||||
public void onSuccess(GetPhoneBean getPhoneBean, int id) {
|
||||
dismissLoadingDialog();
|
||||
if (getPhoneBean.getCode()==200){
|
||||
String code = getPhoneBean.getBody().getCode();
|
||||
Constant.CODE=code;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e, int id) {
|
||||
dismissLoadingDialog();
|
||||
Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}).build();
|
||||
}
|
||||
|
||||
|
||||
//禁用所有可操作性控件
|
||||
private void disables() {
|
||||
@ -330,7 +381,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
editNameContent.setEnabled(false);
|
||||
tvExamine.setEnabled(false);
|
||||
editSiteContent.setEnabled(false);
|
||||
recyclerPhone.setEnabled(false);
|
||||
linearContact.setEnabled(false);
|
||||
ivPanorama.setEnabled(false);
|
||||
ivName.setEnabled(false);
|
||||
ivInternal.setEnabled(false);
|
||||
@ -345,6 +396,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
super.initData();
|
||||
//存储手机号对象
|
||||
poiBeans = new ArrayList<>();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -377,10 +429,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
poiEntity.setName(name);
|
||||
}
|
||||
String site = editSiteContent.getText().toString().trim();
|
||||
if (site == null || site.equals("")) {
|
||||
Toast.makeText(getActivity(), "请输入poi 地址", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
if (site != null && !site.equals("")) {
|
||||
poiEntity.setAddress(site);
|
||||
}
|
||||
if (latLng == null) {
|
||||
@ -393,19 +442,13 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
poiEntity.setY(String.valueOf(latLng.latitude));
|
||||
}
|
||||
String describe = editDescribe.getText().toString().trim();
|
||||
if (describe == null || describe.equals("")) {
|
||||
Toast.makeText(getActivity(), "请输入任务描述", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
if (describe != null&&!describe.equals("")) {
|
||||
poiEntity.setDescribe(describe);
|
||||
}
|
||||
boolean phoneBean = poiRecycleAdapter.getPhoneBean();
|
||||
boolean phoneBean = contactView.getPhoneBean();
|
||||
if (phoneBean){
|
||||
String list = poiRecycleAdapter.getList();
|
||||
String list = contactView.getList();
|
||||
poiEntity.setTelPhone(list);
|
||||
}else {
|
||||
Toast.makeText(getActivity(), "请输入手机号", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
String tagPanorama = (String) ivPanorama.getTag();
|
||||
if (tagPanorama == null) {
|
||||
@ -440,6 +483,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
String format = formatter.format(calendar.getTime());
|
||||
poiEntity.setCreateTime(format);
|
||||
poiEntity.setExistence(existence);
|
||||
poiEntity.setType(1);
|
||||
poiEntity.setTaskStatus(2);
|
||||
poiEntity.setIsLocalData(1);
|
||||
@ -652,9 +696,9 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
if (describe != null && !describe.equals("")) {
|
||||
poiEntity.setDescribe(describe);
|
||||
}
|
||||
boolean phoneBean = poiRecycleAdapter.getPhoneBean();
|
||||
boolean phoneBean = contactView.getPhoneBean();
|
||||
if (phoneBean){
|
||||
String list = poiRecycleAdapter.getList();
|
||||
String list = contactView.getList();
|
||||
poiEntity.setTelPhone(list);
|
||||
}else {
|
||||
Toast.makeText(getActivity(), "请输入手机号", Toast.LENGTH_SHORT).show();
|
||||
@ -680,17 +724,13 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
if (tagCard != null && !tagCard.equals("")) {
|
||||
infoPhoto.add(new Info(tagCard));
|
||||
}
|
||||
if (showPoiEntity != null) {
|
||||
if (showPoiEntity.getTaskId() != 0) {
|
||||
poiEntity.setTaskId(showPoiEntity.getTaskId());
|
||||
}
|
||||
}
|
||||
poiEntity.setPhotoInfo(infoPhoto);
|
||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
String format = formatter.format(calendar.getTime());
|
||||
poiEntity.setCreateTime(format);
|
||||
poiEntity.setExistence(existence);
|
||||
poiEntity.setType(1);
|
||||
poiEntity.setTaskStatus(2);
|
||||
poiEntity.setIsLocalData(1);
|
||||
|
@ -88,9 +88,6 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
private PoiDatabase poiDatabase;
|
||||
private PoiDao poiDao;
|
||||
private PoiEntity showPoiEntity;
|
||||
private RelativeLayout linearExist;
|
||||
private Spinner spinnerExist;
|
||||
String[] spinner = new String[]{"存在", "不存在", "无法验证"};
|
||||
private Integer poiVideoBody;
|
||||
private File videoFile;
|
||||
private Button btnPoiVideoUpload;
|
||||
@ -161,29 +158,6 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
btnPoiVideoUpload = findViewById(R.id.btn_poi_video_upload);
|
||||
btnPoiVideoUpload.setOnClickListener(this::onClick);
|
||||
rgType = (RadioGroup) findViewById(R.id.rg_type);
|
||||
linearExist = findViewById(R.id.linear_exist);
|
||||
spinnerExist = findViewById(R.id.spinner_exist);
|
||||
ArrayAdapter<String> adapterExist = new ArrayAdapter<>(getContext(), android.R.layout.simple_spinner_item, spinner);
|
||||
adapterExist.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); //设置下拉列表框的下拉选项样式
|
||||
spinnerExist.setAdapter(adapterExist);
|
||||
spinnerExist.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
switch (position) {
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
break;
|
||||
case 2:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parent) {
|
||||
}
|
||||
});
|
||||
|
||||
ivPoiVideoPicture.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@ -239,9 +213,6 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
showPictureType(type);
|
||||
}
|
||||
poiVideoBody=showPoiEntity.getBodyId();
|
||||
if (showPoiEntity.getName()!=null){
|
||||
linearExist.setVisibility(View.VISIBLE);
|
||||
}
|
||||
String describe = showPoiEntity.getDescribe();//任务描述
|
||||
if (describe != null && !describe.equals("")) {
|
||||
etDesc.setText(describe);
|
||||
@ -324,9 +295,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
String roadExtendJson = gson.toJson(roadExtend);
|
||||
poiEntity.setExtend(roadExtendJson);
|
||||
String desc = etDesc.getText().toString().trim();
|
||||
if (desc == null || desc.equals("")) {
|
||||
Toast.makeText(getContext(), "请输入你的任务描述", Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
if (desc != null && !desc.equals("")) {
|
||||
poiEntity.setDescribe(desc);
|
||||
}
|
||||
if (showPoiEntity != null) {
|
||||
@ -395,7 +364,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
|
||||
case R.id.tv_pictures:
|
||||
// 根据用户点击的时间为视频名称赋值
|
||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HHmmss");
|
||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
String videoFormatName = formatter.format(new Date());
|
||||
Intent intent = new Intent(getContext(), PictureActivity.class);
|
||||
intent.putExtra(Constant.INTENT_VIDEO_PATH, Constant.PICTURE_FOLDER + "/" + videoFormatName + ".mp4");
|
||||
@ -571,11 +540,6 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
if (desc != null && !desc.equals("")) {
|
||||
poiEntity.setDescribe(desc);
|
||||
}
|
||||
if (showPoiEntity != null) {
|
||||
if (showPoiEntity.getTaskId() != 0) {
|
||||
poiEntity.setTaskId(showPoiEntity.getTaskId());
|
||||
}
|
||||
}
|
||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
|
@ -25,7 +25,6 @@ import android.widget.Toast;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.github.lazylibrary.util.FileUtils;
|
||||
import com.github.lazylibrary.util.ZipUtil;
|
||||
import com.google.gson.Gson;
|
||||
@ -37,11 +36,9 @@ import com.lzy.okgo.model.HttpParams;
|
||||
import com.lzy.okgo.model.Response;
|
||||
import com.navinfo.outdoor.R;
|
||||
import com.navinfo.outdoor.activity.PictureActivity;
|
||||
import com.navinfo.outdoor.activity.PicturesActivity;
|
||||
import com.navinfo.outdoor.api.Constant;
|
||||
import com.navinfo.outdoor.base.BaseDrawerFragment;
|
||||
import com.navinfo.outdoor.bean.OtherUploadPicBean;
|
||||
import com.navinfo.outdoor.bean.PoiBean;
|
||||
import com.navinfo.outdoor.bean.PoiVideoBean;
|
||||
import com.navinfo.outdoor.bean.RoadExtend;
|
||||
import com.navinfo.outdoor.http.Callback;
|
||||
@ -57,9 +54,7 @@ import com.navinfo.outdoor.util.GeometryTools;
|
||||
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.DateFormat;
|
||||
@ -91,10 +86,12 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
private ImageView ivRoadFinal;
|
||||
private RelativeLayout linearExist;
|
||||
String[] spinner = new String[]{"存在", "不存在", "无法验证"};
|
||||
private int existence=0;
|
||||
private Integer body;
|
||||
private Button roadUpload;
|
||||
private File videoFile;
|
||||
private String videoPath;
|
||||
private Spinner spinnerExist;
|
||||
|
||||
public static RoadFragment newInstance(Bundle bundle) {
|
||||
RoadFragment fragment = new RoadFragment();
|
||||
@ -162,7 +159,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
linearExist = findViewById(R.id.linear_exist);
|
||||
roadUpload = findViewById(R.id.road_upload);
|
||||
roadUpload.setOnClickListener(this::onClick);
|
||||
Spinner spinnerExist = findViewById(R.id.spinner_exist);
|
||||
spinnerExist = findViewById(R.id.spinner_exist);
|
||||
ArrayAdapter<String> adapterExist = new ArrayAdapter<>(getContext(), android.R.layout.simple_spinner_item, spinner);
|
||||
adapterExist.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); //设置下拉列表框的下拉选项样式
|
||||
spinnerExist.setAdapter(adapterExist);
|
||||
@ -171,10 +168,13 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
switch (position) {
|
||||
case 0:
|
||||
existence=0;
|
||||
break;
|
||||
case 1:
|
||||
existence=1;
|
||||
break;
|
||||
case 2:
|
||||
existence=2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -220,6 +220,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
}
|
||||
if (showPoiEntity.getName() != null) {
|
||||
linearExist.setVisibility(View.VISIBLE);
|
||||
spinnerExist.setSelection(showPoiEntity.getExistence(), true);
|
||||
}
|
||||
String describe = showPoiEntity.getDescribe();//任务描述
|
||||
if (describe != null && !describe.equals("")) {
|
||||
@ -305,9 +306,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
String roadExtendJson = gson.toJson(roadExtend);
|
||||
poiEntity.setExtend(roadExtendJson);
|
||||
String desc = etDesc.getText().toString().trim();
|
||||
if (desc == null || desc.equals("")) {
|
||||
Toast.makeText(getContext(), "请输入你的任务描述", Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
if (desc != null&& !desc.equals("")) {
|
||||
poiEntity.setDescribe(desc);
|
||||
}
|
||||
if (showPoiEntity != null) {
|
||||
@ -342,6 +341,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
String format = formatter.format(calendar.getTime());
|
||||
poiEntity.setCreateTime(format);
|
||||
poiEntity.setExistence(existence);
|
||||
poiEntity.setType(4);
|
||||
poiEntity.setTaskStatus(2);
|
||||
poiEntity.setIsLocalData(1);
|
||||
@ -471,6 +471,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
public void onSuccess(PoiVideoBean poiVideoBean, int id) {
|
||||
dismissLoadingDialog();
|
||||
body = poiVideoBean.getBody();
|
||||
body = poiVideoBean.getBody();
|
||||
poiEntity.setBodyId(body);
|
||||
poiEntity.setTaskStatus(3);
|
||||
new Thread(new Runnable() {
|
||||
@ -513,7 +514,6 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
@ -560,6 +560,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
String format = formatter.format(calendar.getTime());
|
||||
poiEntity.setCreateTime(format);
|
||||
poiEntity.setExistence(existence);
|
||||
poiEntity.setType(4);
|
||||
poiEntity.setTaskStatus(2);
|
||||
poiEntity.setIsLocalData(1);
|
||||
|
@ -780,7 +780,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
initCheckedMarker(Constant.CHARGING_STATION_WORD);
|
||||
}
|
||||
} else if (data.what == Constant.MAIN_CHARGING_PILE) {//充电桩采集-移动位置
|
||||
initPileMarker((LatLng) data.obj);
|
||||
BitmapDescriptor pileDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_pile_have_bg);
|
||||
initPileMarker((LatLng) data.obj,pileDescriptor);
|
||||
} else if (data.what == Constant.MAIN_CHARGING_CHECKED_PILE) {//充电桩采集-确定位置
|
||||
if ((boolean) data.obj) {
|
||||
initCheckedMarker(Constant.CHARGING_PILE_WORD);
|
||||
@ -904,7 +905,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
|
||||
}
|
||||
|
||||
private void initPileMarker(LatLng latLng) {
|
||||
private void initPileMarker(LatLng latLng,BitmapDescriptor bitmapDescriptor) {
|
||||
CameraUpdate cameraSigma = CameraUpdateFactory.newCameraPosition(new CameraPosition(
|
||||
latLng, //中心点坐标,地图目标经纬度
|
||||
tencentMap.getCameraPosition().zoom, //目标缩放级别
|
||||
@ -916,7 +917,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
screenPosition = tencentMap.getProjection().toScreenLocation(latLng);
|
||||
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
|
||||
//创建Marker对象之前,设置属性
|
||||
markerPoi = tencentMap.addMarker(new MarkerOptions(latLng));
|
||||
markerPoi = tencentMap.addMarker(new MarkerOptions(latLng).icon(bitmapDescriptor));
|
||||
markerPoi.setFixingPoint(screenPosition.x, screenPosition.y);
|
||||
}
|
||||
|
||||
|
@ -68,10 +68,8 @@ public class HttpInterface {
|
||||
public static final String POI_VIDEO_UPLOAD_PIC = IPm6+"poivideotask/1/uploadpic";//poi录像-上传
|
||||
//http://172.23.139.4:8003/m4/task/1/getPhone?geo=1rn7exd5uhxy
|
||||
public static final String GET_PHONE = IPm6 + "m4/task/1/getPhone"; //任务搜索
|
||||
|
||||
// http://172.23.139.4:8003/m4/task/1/getPhone?geo=1rn7exd5uhxy
|
||||
// public static final String GET_PHONES = IPm6+"m4/task/1/getPhone";//电话区号和电话位数
|
||||
|
||||
//http://172.23.139.4:8003/m4/task/1/getPhone?geo=1rn7exd5uhxy
|
||||
public static final String GET_PHONES = IPm6+"m4/task/1/getPhone";//电话区号和电话位数
|
||||
|
||||
/**
|
||||
* 面状任务
|
||||
|
@ -28,18 +28,18 @@ public class ChargingPileEntity implements Serializable {
|
||||
private int exist;//是否存在 0不存在1存在
|
||||
private int cp_floor;//充电桩地面层 地面层是1 ,地上二层为2,向上依次加1,地下一层为-1,向下依次减1.默认为1
|
||||
private int sign_exist;//设备标牌是否存在 0不存在1存在
|
||||
private int cp_availableState;//可用状态 0(可以使用(有电),默认),1(不可使用(没电)),2(维修中),3(建设中)4(规划中)
|
||||
private int cp_openType;// 1.对所有车辆开放 2.对环卫车开放 3.对公交和开放 4.对出租车开放 5.对特种兵车辆开放
|
||||
private int cp_availableState;//可以状态 0(可以使用(有电),默认),1(不可使用(没电)),2(维修中),3(建设中)4(规划中)
|
||||
private String cp_openType;// 1.对所有车辆开放 2.对环卫车开放 3.对公交和开放 4.对出租车开放 5.对特种兵车辆开放
|
||||
private String memo;//备注 默认为空
|
||||
@TypeConverters(StringTypeConverter.class)
|
||||
private List<String> photos;//照片组
|
||||
private long fid;//对应充电站id
|
||||
|
||||
public int getCp_openType() {
|
||||
public String getCp_openType() {
|
||||
return cp_openType;
|
||||
}
|
||||
|
||||
public void setCp_openType(int cp_openType) {
|
||||
public void setCp_openType(String cp_openType) {
|
||||
this.cp_openType = cp_openType;
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ public class PoiEntity implements Serializable {
|
||||
//ROOM不支持直接存储集合
|
||||
@TypeConverters(PhotoInfoConverter.class)
|
||||
private List<Info> photoInfo;//照片信息
|
||||
private int existence;//是否存在
|
||||
private int existence;//是否存在 不存在对应 0 存在对应 1
|
||||
private String x;//经度
|
||||
private String y;//纬度
|
||||
private String detail;//深度信息
|
||||
|
245
app/src/main/java/com/navinfo/outdoor/ui/view/ContactView.java
Normal file
245
app/src/main/java/com/navinfo/outdoor/ui/view/ContactView.java
Normal file
@ -0,0 +1,245 @@
|
||||
package com.navinfo.outdoor.ui.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewParent;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.navinfo.outdoor.R;
|
||||
import com.navinfo.outdoor.api.Constant;
|
||||
import com.navinfo.outdoor.bean.PhoneBean;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*手机号数据存储
|
||||
*/
|
||||
public class ContactView {
|
||||
private Context context;
|
||||
private ViewGroup rootView;
|
||||
private List<PhoneBean> poiBeanList;
|
||||
|
||||
public ContactView(Context context, ViewGroup roatView, List<PhoneBean> poiBeans) {
|
||||
this.context = context;
|
||||
this.rootView = roatView;
|
||||
this.poiBeanList = poiBeans;
|
||||
}
|
||||
|
||||
public void resetView() {
|
||||
if (poiBeanList != null && !poiBeanList.isEmpty()) {
|
||||
if (rootView != null) {
|
||||
rootView.removeAllViews();
|
||||
}
|
||||
for (int i = 0; i < poiBeanList.size(); i++) {
|
||||
PhoneBean poiBean = poiBeanList.get(i);
|
||||
View itemView = LayoutInflater.from(context).inflate(R.layout.item_poi, null, false);
|
||||
MyViewHolder holder = new MyViewHolder(itemView);
|
||||
if (poiBean.getPhone().startsWith("1")) {
|
||||
holder.llPoi.setVisibility(View.GONE);
|
||||
} else {
|
||||
holder.llPoi.setVisibility(View.VISIBLE);
|
||||
}
|
||||
holder.editAreaCode.setText(poiBean.getArea());
|
||||
holder.tvPhone.setText(poiBean.getName());
|
||||
holder.image.setImageResource(poiBean.getImage());
|
||||
int finalI = i;
|
||||
holder.image.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (finalI == 0) {
|
||||
View view = addRootView();
|
||||
rootView.addView(view);
|
||||
} else {
|
||||
ViewParent parent = v.getParent();
|
||||
rootView.removeView((View) parent);
|
||||
}
|
||||
// rootView.removeViewAt(i);
|
||||
}
|
||||
});
|
||||
holder.editPhoneNumber.setText(poiBean.getPhone());
|
||||
holder.editPhoneNumber.addTextChangedListener(new TextWatcher() {
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
//正在输入
|
||||
String str = holder.editPhoneNumber.getText().toString().trim();
|
||||
if (str.indexOf('1') == 0) {
|
||||
holder.llPoi.setVisibility(View.GONE);
|
||||
} else {
|
||||
holder.llPoi.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
//输入之前
|
||||
}
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
}
|
||||
});
|
||||
rootView.addView(itemView);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加数据
|
||||
* @return
|
||||
*/
|
||||
public View addRootView() {
|
||||
PhoneBean poiBean=null;
|
||||
if (Constant.CODE==null||Constant.CODE.equals("")){
|
||||
poiBean = new PhoneBean("", "", "", R.drawable.icon_del_bg);
|
||||
}else {
|
||||
poiBean= new PhoneBean("", "", Constant.CODE, R.drawable.icon_del_bg);
|
||||
}
|
||||
View itemView = LayoutInflater.from(context).inflate(R.layout.item_poi, null, false);
|
||||
MyViewHolder holder = new MyViewHolder(itemView);
|
||||
holder.editAreaCode.setText(poiBean.getArea());
|
||||
holder.tvPhone.setText(poiBean.getName());
|
||||
holder.image.setImageResource(poiBean.getImage());
|
||||
holder.image.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
ViewParent parent = v.getParent();
|
||||
rootView.removeView((View) parent);
|
||||
// rootView.removeViewAt(i);
|
||||
}
|
||||
});
|
||||
holder.editPhoneNumber.setText(poiBean.getPhone());
|
||||
holder.editPhoneNumber.addTextChangedListener(new TextWatcher() {
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
//正在输入
|
||||
String str = holder.editPhoneNumber.getText().toString().trim();
|
||||
if (str.indexOf('1') == 0) {
|
||||
holder.llPoi.setVisibility(View.GONE);
|
||||
} else {
|
||||
holder.llPoi.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
//输入之前
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
}
|
||||
});
|
||||
return itemView;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public List<PhoneBean> getPoiBeanListByRootView() {
|
||||
ArrayList<PhoneBean> poiBeans = new ArrayList<>();
|
||||
if (rootView != null) {
|
||||
for (int i = 0; i < rootView.getChildCount(); i++) {
|
||||
View itemView = rootView.getChildAt(i);
|
||||
EditText editAreaCode = itemView.findViewById(R.id.edit_area_code);
|
||||
EditText editPhoneNumber = itemView.findViewById(R.id.edit_phone_number);
|
||||
poiBeans.add(new PhoneBean(null, editPhoneNumber.getText().toString().trim(), editAreaCode.getText().toString().trim(), 0));
|
||||
}
|
||||
}
|
||||
return poiBeans;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检验数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean getPhoneBean() {
|
||||
List<PhoneBean> list = getPoiBeanListByRootView();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
PhoneBean poiBean = list.get(i);
|
||||
if (poiBean.getPhone().indexOf('1') == 0) {
|
||||
if (poiBean.getPhone().length()!=11){
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (poiBean.getArea().length()+poiBean.getPhone().length()==11){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 整理数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getList() {
|
||||
List<PhoneBean> list = getPoiBeanListByRootView();
|
||||
String a = "";
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
PhoneBean 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* ViewHolder的类,用于缓存控件
|
||||
*/
|
||||
class MyViewHolder extends RecyclerView.ViewHolder {
|
||||
TextView tvPhone;
|
||||
EditText editAreaCode, editPhoneNumber;
|
||||
ImageView image;
|
||||
LinearLayout llPoi;
|
||||
|
||||
//因为删除有可能会删除中间条目,然后会造成角标越界,所以必须整体刷新一下!
|
||||
public MyViewHolder(View view) {
|
||||
super(view);
|
||||
tvPhone = view.findViewById(R.id.tv_phone);
|
||||
editAreaCode = view.findViewById(R.id.edit_area_code);
|
||||
llPoi = view.findViewById(R.id.ll_poi);
|
||||
editPhoneNumber = view.findViewById(R.id.edit_phone_number);
|
||||
image = view.findViewById(R.id.image);
|
||||
}
|
||||
}
|
||||
}
|
@ -169,9 +169,17 @@
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler_phone"
|
||||
android:layout_width="match_parent"
|
||||
android:visibility="gone"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerInParent="true"
|
||||
/>
|
||||
<LinearLayout
|
||||
android:id="@+id/linear_contact"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_centerInParent="true"
|
||||
></LinearLayout>
|
||||
</RelativeLayout>
|
||||
<RelativeLayout
|
||||
android:id="@+id/linear_type"
|
||||
|
@ -64,51 +64,6 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/linear_exist"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="20dp"
|
||||
android:background="@drawable/other_text"
|
||||
android:padding="2dp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/linear_phone">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_exist"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="18dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:text="是否存在*"
|
||||
android:textColor="#333" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spinner_exist"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="18dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_toEndOf="@id/tv_exist"
|
||||
android:layout_toRightOf="@id/tv_exist"
|
||||
android:background="@color/white"
|
||||
android:textColor="#333"
|
||||
android:textSize="15sp" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:background="@drawable/ic_baseline_arrow_drop" />
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
|
@ -41,7 +41,7 @@
|
||||
android:background="@color/white"
|
||||
android:digits="1234567890"
|
||||
android:hint="010"
|
||||
android:maxLength="3"
|
||||
android:maxLength="4"
|
||||
android:inputType="phone|number"
|
||||
android:textColor="#333"
|
||||
android:textSize="15sp"
|
||||
@ -54,7 +54,7 @@
|
||||
android:id="@+id/tv_view"
|
||||
android:layout_width="4dp"
|
||||
android:layout_height="18dp"
|
||||
android:text="-"
|
||||
android:text="——"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
@ -171,9 +171,18 @@
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler_phone"
|
||||
android:layout_width="match_parent"
|
||||
android:visibility="gone"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerInParent="true"
|
||||
/>
|
||||
<LinearLayout
|
||||
android:id="@+id/linear_contact"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_centerInParent="true"
|
||||
>
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
<RelativeLayout
|
||||
android:id="@+id/linear_exist"
|
||||
|
Loading…
x
Reference in New Issue
Block a user