解决上传中的bug
This commit is contained in:
parent
760e33b9f4
commit
be6f3a1d24
@ -3,7 +3,7 @@ apply plugin: 'com.android.application'
|
||||
android {
|
||||
compileSdkVersion 29
|
||||
buildToolsVersion '29.0.2'
|
||||
ndkVersion '23.0.7123448'
|
||||
// ndkVersion '23.0.7123448'
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.navinfo.outdoor"
|
||||
|
@ -45,6 +45,7 @@ public class Constant {
|
||||
public static String DATA_FILE = "dataFile";
|
||||
//下载文件
|
||||
public static final String NAVINFO_APk = BASE_FOLDER + "/apk/";
|
||||
public static int TelLength=0;
|
||||
|
||||
public static void initRootFolder(String userId) {
|
||||
BASE_FOLDER += "/" + userId;
|
||||
|
@ -38,6 +38,16 @@ public abstract class BaseFragment extends Fragment implements FragmentBackHandl
|
||||
private AlertDialog alertDialog;
|
||||
public View mView;
|
||||
protected FragmentManager supportFragmentManager;
|
||||
private Handler handler = new Handler(new Handler.Callback() {
|
||||
@Override
|
||||
public boolean handleMessage(@NonNull Message msg) {
|
||||
if(msg.what==0x200){
|
||||
View view = (View) msg.obj;
|
||||
view.setEnabled(true);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@Nullable
|
||||
@ -62,12 +72,20 @@ public abstract class BaseFragment extends Fragment implements FragmentBackHandl
|
||||
return false;
|
||||
}
|
||||
|
||||
public void initEvent() {}
|
||||
public void initEvent() {
|
||||
}
|
||||
|
||||
protected <T extends View> T findViewById(@IdRes int id) {
|
||||
return getView().findViewById(id);
|
||||
}
|
||||
|
||||
protected void debounce(View view) {
|
||||
view.setEnabled(false);
|
||||
Message message = new Message();
|
||||
message.obj = view;
|
||||
message.what = 0x200;
|
||||
handler.sendMessageDelayed(message, 500);
|
||||
}
|
||||
|
||||
protected abstract int getLayout();
|
||||
|
||||
@ -92,6 +110,7 @@ public abstract class BaseFragment extends Fragment implements FragmentBackHandl
|
||||
Toast.makeText(getActivity(), "网络不可用", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
public void showFileLoadingDialog() {
|
||||
if (NetWorkUtils.iConnected(getContext())) { // 当前网络可用
|
||||
alertDialog = new AlertDialog.Builder(getActivity()).create();
|
||||
@ -152,11 +171,14 @@ public abstract class BaseFragment extends Fragment implements FragmentBackHandl
|
||||
}
|
||||
}
|
||||
|
||||
protected void initMvp() {}
|
||||
protected void initMvp() {
|
||||
}
|
||||
|
||||
protected void initData() {}
|
||||
protected void initData() {
|
||||
}
|
||||
|
||||
protected void initView() {}
|
||||
protected void initView() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
|
@ -380,7 +380,6 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
initShowPoi();
|
||||
|
||||
onLongDelPic();
|
||||
|
||||
}
|
||||
|
||||
private void onLongDelPic() {
|
||||
@ -653,7 +652,25 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
dismissLoadingDialog();
|
||||
if (getPhoneBean.getCode() == 200) {
|
||||
String code = getPhoneBean.getBody().getCode();
|
||||
Constant.CODE = code;
|
||||
Integer telLength = getPhoneBean.getBody().getTelLength();
|
||||
if (!code.equals(Constant.CODE)){
|
||||
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
|
||||
MessageDialog.show((AppCompatActivity) getContext(), "提示", "此地区区号为"+code+",请手动修改", "确定","取消").setOkButton(new OnDialogButtonClickListener() {
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
Constant.CODE = code;
|
||||
Constant.TelLength=telLength;
|
||||
/* for (int i = 0; i < poiBeans.size(); i++) {
|
||||
poiBeans.get(i).setArea(Constant.CODE);
|
||||
}
|
||||
contactView = new ContactView(getActivity(), linearContact, poiBeans);
|
||||
contactView.resetView();*/
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}else {
|
||||
Toast.makeText(getActivity(), getPhoneBean.getMessage()+"", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
@ -811,8 +828,13 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
|
||||
@Override
|
||||
public void run() {
|
||||
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
|
||||
if (poiDaoPoiEntity == null || poiDaoPoiEntity.getTaskStatus() == 0 || poiDaoPoiEntity.getTaskStatus() == 1 || poiDaoPoiEntity.getTaskStatus() == 2||poiDaoPoiEntity.getTaskStatus()==5) {
|
||||
initRoadSaveLocal(true);
|
||||
if (poiDaoPoiEntity == null || poiDaoPoiEntity.getTaskStatus() == 0 || poiDaoPoiEntity.getTaskStatus() == 1 || poiDaoPoiEntity.getTaskStatus() == 2 || poiDaoPoiEntity.getTaskStatus() == 5) {
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
initRoadSaveLocal(true);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// 首先批量保存充电站对应的充电桩数据
|
||||
saveChargingPileByChargingStation(poiDaoPoiEntity);
|
||||
|
@ -400,7 +400,13 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
public void run() {
|
||||
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
|
||||
if (poiDaoPoiEntity == null || poiDaoPoiEntity.getTaskStatus() == 1 || poiDaoPoiEntity.getTaskStatus() == 2 || poiDaoPoiEntity.getTaskStatus() == 0 || poiDaoPoiEntity.getTaskStatus() == 5) {
|
||||
initPoiSaveLocal(true);
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
initPoiSaveLocal(true);
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
|
@ -377,7 +377,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
}else {
|
||||
Toast.makeText(getActivity(), "请输入名称", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
|
||||
String address = showPoiEntity.getAddress();//地址
|
||||
if (address != null && !address.equals("")) {
|
||||
editSiteContent.setText(address);
|
||||
@ -507,7 +507,23 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
dismissLoadingDialog();
|
||||
if (getPhoneBean.getCode() == 200) {
|
||||
String code = getPhoneBean.getBody().getCode();
|
||||
Constant.CODE = code;
|
||||
Integer telLength = getPhoneBean.getBody().getTelLength();
|
||||
if (!code.equals(Constant.CODE)){
|
||||
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
|
||||
MessageDialog.show((AppCompatActivity) getContext(), "提示", "此地区区号为"+code+",请手动修改", "确定","取消").setOkButton(new OnDialogButtonClickListener() {
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
Constant.CODE = code;
|
||||
Constant.TelLength=telLength;
|
||||
/* for (int i = 0; i < poiBeans.size(); i++) {
|
||||
poiBeans.get(i).setArea(Constant.CODE);
|
||||
}
|
||||
contactView = new ContactView(getActivity(), linearContact, poiBeans);
|
||||
contactView.resetView();*/
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}else {
|
||||
Toast.makeText(getActivity(), getPhoneBean.getMessage()+"", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
@ -567,7 +583,6 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
break;
|
||||
case R.id.btn_uploading:
|
||||
poiPicList = new ArrayList<>();
|
||||
|
||||
String name = editNameContent.getText().toString().trim();//名称
|
||||
if (name == null || name.equals("")) {
|
||||
Toast.makeText(getActivity(), "请输入poi 名称", Toast.LENGTH_SHORT).show();
|
||||
@ -596,22 +611,25 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
if (tagInternal != null) {
|
||||
poiPicList.add(new File(tagInternal));
|
||||
}
|
||||
|
||||
String tagCard = (String) tvCard.getTag();
|
||||
if (tagCard != null) {
|
||||
poiPicList.add(new File(tagCard));
|
||||
}
|
||||
|
||||
String tagElse = (String) tvElse.getTag();
|
||||
if (tagElse != null) {
|
||||
poiPicList.add(new File(tagElse));
|
||||
}
|
||||
String tagCard = (String) tvCard.getTag();
|
||||
if (tagCard != null) {
|
||||
poiPicList.add(new File(tagCard));
|
||||
}
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
|
||||
if (poiDaoPoiEntity == null || poiDaoPoiEntity.getTaskStatus() == 1 || poiDaoPoiEntity.getTaskStatus() == 2 || poiDaoPoiEntity.getTaskStatus() == 0 || poiDaoPoiEntity.getTaskStatus() == 5) {
|
||||
initPoiSaveLocal(true);
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
initPoiSaveLocal(true);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
@ -629,6 +647,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
case R.id.rl_panorama:
|
||||
Intent intentPanorama = new Intent("android.media.action.IMAGE_CAPTURE");
|
||||
file = PhotoUtils.showPhotoFile("a", latLng);
|
||||
;
|
||||
intentPanorama.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file));
|
||||
startActivityForResult(intentPanorama, 101);
|
||||
break;
|
||||
@ -1091,15 +1110,14 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
if (tagInternal != null && !tagInternal.equals("")) {
|
||||
infoPhoto.add(new Info(tagInternal));
|
||||
}
|
||||
String tagCard = (String) tvCard.getTag();
|
||||
if (tagCard != null && !tagCard.equals("")) {
|
||||
infoPhoto.add(new Info(tagCard));
|
||||
}
|
||||
String tagElse = (String) tvElse.getTag();
|
||||
if (tagElse != null && !tagElse.equals("")) {
|
||||
infoPhoto.add(new Info(tagElse));
|
||||
}
|
||||
|
||||
String tagCard = (String) tvCard.getTag();
|
||||
if (tagCard != null && !tagCard.equals("")) {
|
||||
infoPhoto.add(new Info(tagCard));
|
||||
}
|
||||
poiEntity.setPhotoInfo(infoPhoto);
|
||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
|
@ -334,8 +334,14 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
ZipUtil.zipFiles(videoFileList, fileZip, null);//压缩
|
||||
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
|
||||
if (poiDaoPoiEntity == null || poiDaoPoiEntity.getTaskStatus() == 1 || poiDaoPoiEntity.getTaskStatus() == 2 || poiDaoPoiEntity.getTaskStatus() == 0 || poiDaoPoiEntity.getTaskStatus() == 5) {
|
||||
dismissLoadingDialog();
|
||||
initPoiSaveLocal(true);
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
dismissLoadingDialog();
|
||||
initPoiSaveLocal(true);
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
|
@ -12,6 +12,7 @@ import android.graphics.Matrix;
|
||||
import android.graphics.Point;
|
||||
import android.location.Location;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
@ -49,6 +50,7 @@ import com.navinfo.outdoor.activity.FragmentManagement;
|
||||
import com.navinfo.outdoor.api.Constant;
|
||||
import com.navinfo.outdoor.base.BaseDrawerFragment;
|
||||
import com.navinfo.outdoor.base.BaseFragment;
|
||||
import com.navinfo.outdoor.bean.GetPhoneBean;
|
||||
import com.navinfo.outdoor.bean.JobSearchBean;
|
||||
import com.navinfo.outdoor.bean.RoadExtend;
|
||||
import com.navinfo.outdoor.bean.UserBean;
|
||||
@ -141,6 +143,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
private final int MARKER_FACE = 1;
|
||||
private final int MARKER_BIG = 4;
|
||||
|
||||
|
||||
public static TreasureFragment newInstance(Bundle bundle) {
|
||||
TreasureFragment fragment = new TreasureFragment();
|
||||
fragment.setArguments(bundle);
|
||||
@ -231,10 +234,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
showLoadingDialog();
|
||||
//开启定位权限
|
||||
checkNetWork();
|
||||
//上传用户位置金纬度
|
||||
iniUserLocation();
|
||||
//检查是否有没有填完的页面
|
||||
initSharePre();
|
||||
removables = new ArrayList<>();//存储网络数据的marker数据(线,面,点)
|
||||
removablesLocality = new ArrayList<>(); //存储本地的marker数据(线,面,点)
|
||||
removableScreenMarker = new ArrayList<>();//存储点击屏幕上的marker的marker数据(线,面,点)
|
||||
@ -252,8 +251,12 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
tencentMap.animateCamera(cameraSigma, new TencentMap.CancelableCallback() {
|
||||
@Override
|
||||
public void onFinish() {
|
||||
dismissLoadingDialog();
|
||||
refreshFilterData();
|
||||
//上传用户位置金纬度
|
||||
iniUserLocation();
|
||||
initPhone();
|
||||
//检查是否有没有填完的页面
|
||||
initSharePre();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -273,6 +276,41 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
treasureMap.getLayoutParams().height = widtHeight[1];
|
||||
|
||||
}
|
||||
/**
|
||||
* 得到电话区号,电话位数
|
||||
*/
|
||||
private void initPhone() {
|
||||
String encode = Geohash.getInstance().encode(Constant.currentLocation.getLatitude(),Constant.currentLocation.getLongitude());
|
||||
if (encode == null) {
|
||||
Toast.makeText(getActivity(), "没有确定经纬度", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
OkGoBuilder.getInstance()
|
||||
.Builder(getActivity())
|
||||
.url(HttpInterface.GET_PHONES)
|
||||
.params(new HttpParams("geo", encode))
|
||||
.cls(GetPhoneBean.class)
|
||||
.token(Constant.ACCESS_TOKEN)
|
||||
.getRequest(new Callback<GetPhoneBean>() {
|
||||
@Override
|
||||
public void onSuccess(GetPhoneBean getPhoneBean, int id) {
|
||||
if (getPhoneBean.getCode() == 200) {
|
||||
String code = getPhoneBean.getBody().getCode();
|
||||
Integer telLength = getPhoneBean.getBody().getTelLength();
|
||||
Constant.CODE = code;
|
||||
Constant.TelLength=telLength;
|
||||
}else {
|
||||
Toast.makeText(getActivity(), getPhoneBean.getMessage()+"", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e, int id) {
|
||||
Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
dismissDialog();
|
||||
}
|
||||
|
||||
|
||||
private class NestedScrollableViewHelper extends ScrollableViewHelper {
|
||||
@ -315,11 +353,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
.postRequest(new Callback<UserBean>() {
|
||||
@Override
|
||||
public void onSuccess(UserBean response, int id) {
|
||||
dismissLoadingDialog();
|
||||
if (response.getCode() == 200) {
|
||||
Toast.makeText(getActivity(), "成功", Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onSuccess: ssssssssssssssssssssssssss 成功");
|
||||
showLoadingDialog();
|
||||
Toast.makeText(getActivity(), response.getMessage()+"", Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
Toast.makeText(getActivity(), response.getMessage() + "", Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onSuccess: " + response.getCode() + response.getMessage() + "" + response.getBody());
|
||||
@ -328,7 +363,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e, int id) {
|
||||
dismissLoadingDialog();
|
||||
Log.d("TAG", "onSuccess: sss********sssssssssssss 成功" + e.getMessage() + "");
|
||||
}
|
||||
});
|
||||
@ -1388,6 +1422,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
}
|
||||
break;
|
||||
case R.id.iv_submit://弹窗
|
||||
debounce(ivSubmit);
|
||||
if (upload == null) {
|
||||
Toast.makeText(getActivity(), "网络请求失败", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
@ -1470,6 +1505,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
}).setTitle(title);
|
||||
break;
|
||||
case R.id.iv_filter:
|
||||
debounce(ivFilter);
|
||||
FilterFragment filterFragment = FilterFragment.newInstance(new Bundle());
|
||||
showSlidingFragment(filterFragment);
|
||||
refreshFilterData();
|
||||
|
@ -22,7 +22,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*手机号数据存储
|
||||
* 手机号数据存储
|
||||
*/
|
||||
public class ContactView {
|
||||
private Context context;
|
||||
@ -66,10 +66,10 @@ public class ContactView {
|
||||
// rootView.removeViewAt(i);
|
||||
}
|
||||
});
|
||||
if (poiBean.getPhone()==null){
|
||||
if (poiBean.getPhone() == null) {
|
||||
holder.editPhoneNumber.setText("");
|
||||
}else {
|
||||
holder.editPhoneNumber.setText(poiBean.getPhone()+"");
|
||||
} else {
|
||||
holder.editPhoneNumber.setText(poiBean.getPhone() + "");
|
||||
}
|
||||
|
||||
holder.editPhoneNumber.addTextChangedListener(new TextWatcher() {
|
||||
@ -90,6 +90,7 @@ public class ContactView {
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
//输入之前
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
}
|
||||
@ -101,14 +102,15 @@ public class ContactView {
|
||||
|
||||
/**
|
||||
* 添加数据
|
||||
*
|
||||
* @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);
|
||||
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);
|
||||
@ -166,7 +168,9 @@ public class ContactView {
|
||||
if (editAreaCode.isShown()) {
|
||||
areaCode = editAreaCode.getText().toString().trim();
|
||||
}
|
||||
poiBeans.add(new PhoneBean(null, editPhoneNumber.getText().toString().trim(), areaCode, 0));
|
||||
if (!areaCode.equals("")&&!editPhoneNumber.getText().toString().trim().equals("")&&editPhoneNumber.getText().toString().trim()!=null){
|
||||
poiBeans.add(new PhoneBean(null, editPhoneNumber.getText().toString().trim(), areaCode, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
return poiBeans;
|
||||
@ -179,18 +183,26 @@ public class ContactView {
|
||||
*/
|
||||
public boolean getPhoneBean() {
|
||||
List<PhoneBean> list = getPoiBeanListByRootView();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
PhoneBean poiBean = list.get(i);
|
||||
if (poiBean.getPhone().startsWith("1")) {
|
||||
if (poiBean.getPhone().length()!=11){
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (poiBean.getArea().length()+poiBean.getPhone().length()<10 || poiBean.getArea().length()+poiBean.getPhone().length()>12||poiBean.getArea().length()<2){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
PhoneBean poiBean = list.get(i);
|
||||
if (poiBean.getPhone().startsWith("1")) {
|
||||
if (poiBean.getPhone().length() != 11) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (poiBean.getArea().length() < 2) {
|
||||
return false;
|
||||
}
|
||||
if (Constant.TelLength==0 || !Constant.CODE.equals(poiBean.getArea())){ // 没有获取到电话长度
|
||||
if (poiBean.getArea().length() + poiBean.getPhone().length() < 10 || poiBean.getArea().length() + poiBean.getPhone().length() > 12 ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (Constant.CODE.equals(poiBean.getArea())&&poiBean.getArea().length()+poiBean.getPhone().length()!=Constant.TelLength){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -205,18 +217,27 @@ public class ContactView {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
PhoneBean poiBean = list.get(i);
|
||||
if (poiBean.getPhone().startsWith("1")) {
|
||||
if (poiBean.getPhone().length()!=11){
|
||||
return i+1;
|
||||
if (poiBean.getPhone().length() != 11) {
|
||||
return i + 1;
|
||||
}
|
||||
} else {
|
||||
if (poiBean.getArea().length()+poiBean.getPhone().length()<10 || poiBean.getArea().length()+poiBean.getPhone().length()>12||poiBean.getArea().length()<2){
|
||||
return i+1;
|
||||
if (poiBean.getArea().length() < 2) {
|
||||
return i + 1;
|
||||
}
|
||||
if (Constant.TelLength==0 || !Constant.CODE.equals(poiBean.getArea())){ // 没有获取到电话长度
|
||||
if (poiBean.getArea().length() + poiBean.getPhone().length() < 10 || poiBean.getArea().length() + poiBean.getPhone().length() > 12 ) {
|
||||
return i + 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (Constant.CODE.equals(poiBean.getArea())&&poiBean.getArea().length()+poiBean.getPhone().length()!=Constant.TelLength){
|
||||
return i + 1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 整理数据
|
||||
*
|
||||
@ -235,8 +256,8 @@ public class ContactView {
|
||||
phoneSb.append("|");
|
||||
}
|
||||
String result = phoneSb.toString();
|
||||
if (result.length()>0&&result.endsWith("|")) {
|
||||
result = result.substring(0, result.length()-1);
|
||||
if (result.length() > 0 && result.endsWith("|")) {
|
||||
result = result.substring(0, result.length() - 1);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user