修改银行卡添加模糊查询

This commit is contained in:
wangdongsheng 2021-09-22 17:32:34 +08:00
parent 4c84731bee
commit a9295e1c92
34 changed files with 496 additions and 567 deletions

View File

@ -167,7 +167,8 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
httpParams.put("grant_type", "password"); httpParams.put("grant_type", "password");
httpParams.put("datetime", time); httpParams.put("datetime", time);
showLoadingDialog(); showLoadingDialog();
OkGoBuilder.getInstance().Builder(this) OkGoBuilder.getInstance()
.Builder(this)
.url(HttpInterface.USER_LOGIN_OAUTH_TOKEN) .url(HttpInterface.USER_LOGIN_OAUTH_TOKEN)
.cls(LoginOauthTokenBean.class) .cls(LoginOauthTokenBean.class)
.params(httpParams) .params(httpParams)
@ -197,7 +198,6 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
dismissLoadingDialog(); dismissLoadingDialog();
} }
} }
@Override @Override
public void onError(Throwable e, int id) { public void onError(Throwable e, int id) {
dismissLoadingDialog(); dismissLoadingDialog();
@ -207,7 +207,6 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
private void initGetUserInfo() { private void initGetUserInfo() {
@ -271,15 +270,12 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
Toast.makeText(LoginActivity.this, response.getMessage()+"", Toast.LENGTH_SHORT).show(); Toast.makeText(LoginActivity.this, response.getMessage()+"", Toast.LENGTH_SHORT).show();
} }
} }
@Override @Override
public void onError(Throwable e, int id) { public void onError(Throwable e, int id) {
dismissLoadingDialog(); dismissLoadingDialog();
Toast.makeText(LoginActivity.this, e.getMessage(), Toast.LENGTH_SHORT).show(); Toast.makeText(LoginActivity.this, e.getMessage(), Toast.LENGTH_SHORT).show();
} }
}); });
} }

View File

@ -132,7 +132,6 @@ public class MainActivity extends BaseActivity {
initPermission(); initPermission();
} }
} }
@Override @Override
public void onDenied(List<String> permissions, boolean never) { public void onDenied(List<String> permissions, boolean never) {
if (never) { if (never) {
@ -145,7 +144,6 @@ public class MainActivity extends BaseActivity {
return false; return false;
} }
}); });
} }
} }
}); });
@ -210,7 +208,6 @@ public class MainActivity extends BaseActivity {
} }
} }
}); });
builder.setNegativeButton("取消", new DialogInterface.OnClickListener() { builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {

View File

@ -114,7 +114,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
private Timer timer; private Timer timer;
private TimerTask timerTask; private TimerTask timerTask;
private int videoIndex = -1; private int videoIndex = -1;
private int oration; private int oration;
private ImageView ivPicImage; private ImageView ivPicImage;
private SystemTTS systemTTS; private SystemTTS systemTTS;
@ -154,6 +154,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
btnSwitch.setOnClickListener(this); btnSwitch.setOnClickListener(this);
//相机记录器 //相机记录器
CameraLogger.setLogLevel(CameraLogger.LEVEL_VERBOSE); CameraLogger.setLogLevel(CameraLogger.LEVEL_VERBOSE);
ivZoomAdd = findViewById(R.id.iv_zoom_add); ivZoomAdd = findViewById(R.id.iv_zoom_add);
ivZoomAdd.setOnClickListener(this); ivZoomAdd.setOnClickListener(this);
ivZoomDel = findViewById(R.id.iv_zoom_del); ivZoomDel = findViewById(R.id.iv_zoom_del);
@ -175,13 +176,11 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) { if (isChecked) {
if (poi_video_type != 2) { if (poi_video_type != 2) {
capturePicture.setText("暂停采集"); capturePicture.setText("暂停采集"); }
}
startTimer(); startTimer();
} else { } else {
if (poi_video_type != 2) { if (poi_video_type != 2) {
capturePicture.setText("开始采集"); capturePicture.setText("开始采集"); }
}
stopTimer(); stopTimer();
} }
} }
@ -219,7 +218,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
public void onPictureTaken(@NonNull PictureResult result) { public void onPictureTaken(@NonNull PictureResult result) {
super.onPictureTaken(result); super.onPictureTaken(result);
if (oration == 0) { // oblation为0时拍摄视频必须为横屏 if (oration == 0) { // oblation为0时拍摄视频必须为横屏
// 如果当前手机是竖向则不允许拍摄 // 如果当前手机是竖向则不
if (Objects.requireNonNull(camera.getPictureSize()).getWidth() < camera.getPictureSize().getHeight()) { if (Objects.requireNonNull(camera.getPictureSize()).getWidth() < camera.getPictureSize().getHeight()) {
Toast.makeText(PicturesActivity.this, "不允许竖向拍摄...", Toast.LENGTH_SHORT).show(); Toast.makeText(PicturesActivity.this, "不允许竖向拍摄...", Toast.LENGTH_SHORT).show();
stopTimer(); stopTimer();
@ -278,9 +277,10 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
bitmapLine = BitmapDescriptorFactory.fromResource(R.drawable.road_arrows); bitmapLine = BitmapDescriptorFactory.fromResource(R.drawable.road_arrows);
} }
List<LatLng> latLineString = GeometryTools.getLatLags(geo); List<LatLng> latLineString = GeometryTools.getLatLags(geo);
// 构造 PolylineOnions // 构造 PolylineOnions
PolylineOptions polylineOptions = new PolylineOptions() PolylineOptions polylineOptions
.addAll(latLineString) = new PolylineOptions().addAll(latLineString)
// 折线设置圆形线头 // 折线设置圆形线头
.lineCap(true) .lineCap(true)
// 折线的颜色为绿色 // 折线的颜色为绿色
@ -332,18 +332,18 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
break; break;
case R.id.iv_location://定位: case R.id.iv_location://定位:
if (Constant.currentLocation != null) { if (Constant.currentLocation != null) {
CameraUpdate cameraSigma = CameraUpdateFactory.newCameraPosition(new CameraPosition( CameraUpdate cameraSigma = CameraUpdateFactory
new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()), //中心点坐标地图目标经纬度 .newCameraPosition(new CameraPosition(new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()), //中心点坐标地图目标经纬度
tencentMap.getCameraPosition().zoom, //目标缩放级别 tencentMap.getCameraPosition().zoom, //目标缩放级别
0, //目标倾斜角[0.0 ~ 45.0] (垂直地图时为0) 0, //目标倾斜角[0.0 ~ 45.0] (垂直地图时为0)
0)); //目标旋转角 0~360° (正北方为0) 0)); //目标旋转角 0~360° (正北方为0)
tencentMap.animateCamera(cameraSigma); tencentMap.animateCamera(cameraSigma);
} }
break; break;
} }
} }
private Bitmap getBitMap() { private Bitmap getBitMap() {
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.location); Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.location);
int width = bitmap.getWidth(); int width = bitmap.getWidth();
@ -358,13 +358,12 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
return bitmap; return bitmap;
} }
/** /*
* 设置定位图标样式 * 设置定位图标样式
*/ */
private void setLocMarkerStyle(int type) { private void setLocMarkerStyle(int type) {
tencentMap.setLocationSource(new MyTecentLocationSource(this)); tencentMap.setLocationSource(new MyTecentLocationSource(this));
tencentMap.setMyLocationEnabled(true); tencentMap.setMyLocationEnabled(true);
MyLocationStyle locationStyle = new MyLocationStyle(); MyLocationStyle locationStyle = new MyLocationStyle();
//LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER //LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER
locationStyle = locationStyle.myLocationType(type); locationStyle = locationStyle.myLocationType(type);
@ -417,7 +416,6 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
ivZoomDel.setVisibility(View.GONE); ivZoomDel.setVisibility(View.GONE);
ivLocation.setVisibility(View.GONE); ivLocation.setVisibility(View.GONE);
setLocMarkerStyle(LOCATION_TYPE_LOCATION_ROTATE); setLocMarkerStyle(LOCATION_TYPE_LOCATION_ROTATE);
} }
//大图 //大图
@ -452,6 +450,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
obtain.what = Constant.PICTURE_VIDEO_WORD; obtain.what = Constant.PICTURE_VIDEO_WORD;
obtain.obj = true; obtain.obj = true;
EventBus.getDefault().post(obtain); EventBus.getDefault().post(obtain);
} }
@Override @Override
@ -479,7 +478,6 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
} }
} }
@Subscribe(threadMode = ThreadMode.MAIN) @Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMessageMainThread(Message msg) { public void onEventMessageMainThread(Message msg) {
if (msg.what == Constant.EVENT_WHAT_LOCATION_CHANGE) { // 用户位置更新 if (msg.what == Constant.EVENT_WHAT_LOCATION_CHANGE) { // 用户位置更新
@ -549,14 +547,17 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
public void initMarker() { public void initMarker() {
LatLng latLng = new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()); LatLng latLng = new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude());
BitmapDescriptor pileDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.circle); BitmapDescriptor pileDescriptor = BitmapDescriptorFactory
Marker marker = tencentMap.addMarker(new MarkerOptions(latLng).icon(pileDescriptor).alpha(0.9f) .fromResource(R.drawable.circle);
Marker marker = tencentMap
.addMarker(new MarkerOptions(latLng)
.icon(pileDescriptor)
.alpha(0.9f)
.flat(true) .flat(true)
.clockwise(false)); .clockwise(false));
removables.add(marker); removables.add(marker);
} }
private void startTimer() { private void startTimer() {
if (timer == null) { if (timer == null) {
timer = new Timer(); timer = new Timer();
@ -583,14 +584,17 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
} }
private void stopTimer() { private void stopTimer() {
if (timer != null) { if (timer != null) {
timer.cancel(); timer.cancel();
timer = null; timer = null;
} }
if (timerTask != null) { if (timerTask != null) {
timerTask.cancel(); timerTask.cancel();
timerTask = null; timerTask = null;
} }
} }
} }

View File

@ -77,7 +77,7 @@ public class UserActivity extends BaseActivity implements View.OnClickListener {
btnAttestation.setOnClickListener(this); btnAttestation.setOnClickListener(this);
Button btnGathering = findViewById(R.id.btn_gathering); Button btnGathering = findViewById(R.id.btn_gathering);
btnGathering.setOnClickListener(this); btnGathering.setOnClickListener(this);
if (Constant.ID_NUMBER!=null){ if (Constant.ID_NUMBER != null) {
btnGathering.setText("已绑定"); btnGathering.setText("已绑定");
} }
region = findViewById(R.id.region); region = findViewById(R.id.region);
@ -94,24 +94,22 @@ public class UserActivity extends BaseActivity implements View.OnClickListener {
userSave.setOnClickListener(this); userSave.setOnClickListener(this);
Button btnWeChat = findViewById(R.id.btn_weChat_binding); Button btnWeChat = findViewById(R.id.btn_weChat_binding);
btnWeChat.setOnClickListener(this); btnWeChat.setOnClickListener(this);
if (Constant.MOBILE!=null){ if (Constant.MOBILE != null) {
etPhone.setText(Constant.MOBILE); etPhone.setText(Constant.MOBILE);
} }
if (Constant.QQ!=null){ if (Constant.QQ != null) {
etQq.setText(Constant.QQ); etQq.setText(Constant.QQ);
} }
String regions = navInfo.getString("region", null); String regions = navInfo.getString("region", null);
if (regions!=null){ if (regions != null) {
region.setText(regions); region.setText(regions);
} }
if (Constant.AUDIOTAPES ==1){ if (Constant.AUDIOTAPES == 1) {
btnAttestation.setText("已认证"); btnAttestation.setText("已认证");
} }
if (Constant.ID_NUMBER!=null){ if (Constant.ID_NUMBER != null) {
btnGathering.setText("已绑定"); btnGathering.setText("已绑定");
} }
} }
@Override @Override
@ -121,14 +119,14 @@ public class UserActivity extends BaseActivity implements View.OnClickListener {
finish(); finish();
break; break;
case R.id.btn_gathering: case R.id.btn_gathering:
if (Constant.AUDIOTAPES ==-1){ if (Constant.AUDIOTAPES == -1) {
Toast.makeText(this, "请先实名认证", Toast.LENGTH_SHORT).show(); Toast.makeText(this, "请先实名认证", Toast.LENGTH_SHORT).show();
}else if (Constant.AUDIOTAPES ==1){//认证通过 } else if (Constant.AUDIOTAPES == 1) {//认证通过
Intent gatheringIntent = new Intent(this, FragmentManagement.class); Intent gatheringIntent = new Intent(this, FragmentManagement.class);
gatheringIntent.putExtra("tag", 24); gatheringIntent.putExtra("tag", 24);
startActivity(gatheringIntent); startActivity(gatheringIntent);
}else if (Constant.AUDIOTAPES ==0){ } else if (Constant.AUDIOTAPES == 0) {
Toast.makeText(this, Constant.AUDITING +"", Toast.LENGTH_SHORT).show(); Toast.makeText(this, Constant.AUDITING + "", Toast.LENGTH_SHORT).show();
} }
break; break;
case R.id.btn_attestations: case R.id.btn_attestations:
@ -143,54 +141,52 @@ public class UserActivity extends BaseActivity implements View.OnClickListener {
// qq(); // qq();
break; break;
case R.id.edit_mailbox: case R.id.edit_mailbox:
break; break;
case R.id.btn_save: case R.id.btn_save:
if (Constant.ID_NUM==null){ if (Constant.ID_NUM == null) {
Toast.makeText(this, "请先实名认证", Toast.LENGTH_SHORT).show(); Toast.makeText(this, "请先实名认证", Toast.LENGTH_SHORT).show();
return; return;
} }
if (Constant.ID_NUMBER==null){ if (Constant.ID_NUMBER == null) {
Toast.makeText(this, "请先绑定银行卡", Toast.LENGTH_SHORT).show(); Toast.makeText(this, "请先绑定银行卡", Toast.LENGTH_SHORT).show();
} }
String userphone = etPhone.getText().toString().trim(); String userphone = etPhone.getText().toString().trim();
String userqq = etQq.getText().toString().trim(); String userqq = etQq.getText().toString().trim();
String usermailbox = etMailbox.getText().toString().trim(); String usermailbox = etMailbox.getText().toString().trim();
HttpParams httpParams = new HttpParams(); HttpParams httpParams = new HttpParams();
httpParams.put("pid",Constant.USHERED); httpParams.put("pid", Constant.USHERED);
long time = System.currentTimeMillis(); long time = System.currentTimeMillis();
httpParams.put("datetime", time); httpParams.put("datetime", time);
boolean isQQNum_matcher = userqq.matches("[1-9][0-9]{4,14}"); boolean isQQNum_matcher = userqq.matches("[1-9][0-9]{4,14}");
// 邮箱匹配结果 // 邮箱匹配结果
boolean isEmail_matcher = usermailbox.matches( "^[\\w-\\+]+(\\.[\\w]+)*@[\\w-]+(\\.[\\w]+)*(\\.[a-z]{2,})$"); boolean isEmail_matcher = usermailbox.matches("^[\\w-\\+]+(\\.[\\w]+)*@[\\w-]+(\\.[\\w]+)*(\\.[a-z]{2,})$");
//user.length() < 11 && user.length() > 5 //user.length() < 11 && user.length() > 5
if (TextUtils.isEmpty(userphone) || TextUtils.isEmpty(userqq) || TextUtils.isEmpty(usermailbox)|| TextUtils.isEmpty(region_id)) { if (TextUtils.isEmpty(userphone) || TextUtils.isEmpty(userqq) || TextUtils.isEmpty(usermailbox) || TextUtils.isEmpty(region_id)) {
if (region_id == null || region_id.equals("")) { if (region_id == null || region_id.equals("")) {
Toast.makeText(this, "所在地区为空,请重新输入", Toast.LENGTH_SHORT).show(); Toast.makeText(this, "所在地区为空,请重新输入", Toast.LENGTH_SHORT).show();
return; return;
}else { } else {
httpParams.put("regionId",region_id); httpParams.put("regionId", region_id);
} }
if (!RegexUtil.isPhone(userphone)) { if (!RegexUtil.isPhone(userphone)) {
Toast.makeText(this, "手机号输入错误", Toast.LENGTH_SHORT).show(); Toast.makeText(this, "手机号输入错误", Toast.LENGTH_SHORT).show();
return; return;
}else { } else {
httpParams.put("mobile", userphone); httpParams.put("mobile", userphone);
} }
if (!userqq.equals("")) { if (!userqq.equals("")) {
if (!isQQNum_matcher) { if (!isQQNum_matcher) {
Toast.makeText(this, "QQ号输入错误", Toast.LENGTH_SHORT).show(); Toast.makeText(this, "QQ号输入错误", Toast.LENGTH_SHORT).show();
return; return;
}else { } else {
httpParams.put("qq", userqq); httpParams.put("qq", userqq);
} }
} }
if (!usermailbox.equals("")){ if (!usermailbox.equals("")) {
if (!isEmail_matcher) { if (!isEmail_matcher) {
Toast.makeText(this, "邮箱格式错误", Toast.LENGTH_SHORT).show(); Toast.makeText(this, "邮箱格式错误", Toast.LENGTH_SHORT).show();
}else { } else {
httpParams.put("mail", usermailbox); //邮箱 httpParams.put("mail", usermailbox); //邮箱
} }
return; return;
@ -219,20 +215,21 @@ public class UserActivity extends BaseActivity implements View.OnClickListener {
public void onSuccess(UserBean response, int id) { public void onSuccess(UserBean response, int id) {
dismissLoadingDialog(); dismissLoadingDialog();
Log.d("TAG", "onSuccess: " + response.toString()); Log.d("TAG", "onSuccess: " + response.toString());
if (response.getCode()==200) { if (response.getCode() == 200) {
MessageDialog.show(UserActivity.this, "提示","是否保存", "确定", "取消").setOkButton(new OnDialogButtonClickListener() { MessageDialog.show(UserActivity.this, "提示", "是否保存", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
@Override @Override
public boolean onClick(BaseDialog baseDialog, View v) { public boolean onClick(BaseDialog baseDialog, View v) {
navInfoEditor.putString("region",region.getText().toString()); navInfoEditor.putString("region", region.getText().toString());
navInfoEditor.commit(); navInfoEditor.commit();
finish(); finish();
return false; return false;
} }
}); });
} else { } else {
Toast.makeText(UserActivity.this, response.getMessage()+"", Toast.LENGTH_SHORT).show(); Toast.makeText(UserActivity.this, response.getMessage() + "", Toast.LENGTH_SHORT).show();
} }
} }
@Override @Override
public void onError(Throwable e, int id) { public void onError(Throwable e, int id) {
dismissLoadingDialog(); dismissLoadingDialog();
@ -243,11 +240,11 @@ public class UserActivity extends BaseActivity implements View.OnClickListener {
} }
// public static boolean isEmail(String email) { /*public static boolean isEmail(String email) {
// if (null == email || "".equals(email)) return false; if (null == email || "".equals(email)) return false;
// Matcher m = compile.matcher(email); Matcher m = compile.matcher(email);
// return m.matches(); return m.matches();
// } }*/
private void showPickerView() {// 弹出选择器省市区三级联动 private void showPickerView() {// 弹出选择器省市区三级联动
OptionsPickerView pvOptions = new OptionsPickerBuilder(UserActivity.this, new OnOptionsSelectListener() { OptionsPickerView pvOptions = new OptionsPickerBuilder(UserActivity.this, new OnOptionsSelectListener() {
@ -293,18 +290,15 @@ public class UserActivity extends BaseActivity implements View.OnClickListener {
private void initJsonData() {//解析数据 省市区三级联动 private void initJsonData() {//解析数据 省市区三级联动
/** /*
* 注意assets 目录下的Json文件仅供参考实际使用可自行替换文件 * 注意assets 目录下的Json文件仅供参考实际使用可自行替换文件
* 关键逻辑在于循环体 * 关键逻辑在于循环体
* */
* */
String JsonData = new GetJsonDataUtil().getJson(UserActivity.this, "prov_city_county.json");//获取assets目录下的json文件数据 String JsonData = new GetJsonDataUtil().getJson(UserActivity.this, "prov_city_county.json");//获取assets目录下的json文件数据
ArrayList<JsonBean> jsonBean = parseData(JsonData);//用GOON 转成实体
ArrayList<JsonBean> jsonBean = parseData(JsonData);//用Gson 转成实体
/* /*
* 添加省份数据 * 添加省份数据
*
* 注意如果是添加的JavaBean实体则实体类需要实现 IPickerViewData 接口 * 注意如果是添加的JavaBean实体则实体类需要实现 IPickerViewData 接口
* PickerView会通过getPickerViewText方法获取字符串显示出来 * PickerView会通过getPickerViewText方法获取字符串显示出来
*/ */
@ -314,13 +308,11 @@ public class UserActivity extends BaseActivity implements View.OnClickListener {
ArrayList<String> CityList = new ArrayList<>();//该省的城市列表第二级 ArrayList<String> CityList = new ArrayList<>();//该省的城市列表第二级
ArrayList<ArrayList<CityBean>> city_AreaList = new ArrayList<>();//该省的所有地区列表第三级 ArrayList<ArrayList<CityBean>> city_AreaList = new ArrayList<>();//该省的所有地区列表第三级
ArrayList<ArrayList<String>> Province_AreaList = new ArrayList<>();//该省的所有地区列表第三级 ArrayList<ArrayList<String>> Province_AreaList = new ArrayList<>();//该省的所有地区列表第三级
for (int c = 0; c < jsonBean.get(i).getCitys().size(); c++) {//遍历该省份的所有城市 for (int c = 0; c < jsonBean.get(i).getCitys().size(); c++) {//遍历该省份的所有城市
String CityName = jsonBean.get(i).getCitys().get(c).getCity(); String CityName = jsonBean.get(i).getCitys().get(c).getCity();
CityList.add(CityName);//添加城市 CityList.add(CityName);//添加城市
ArrayList<CityBean> AreaList = new ArrayList<>();//该城市的所有地区列表 ArrayList<CityBean> AreaList = new ArrayList<>();//该城市的所有地区列表
ArrayList<String> City_AreaList = new ArrayList<>();//该城市的所有地区列表 ArrayList<String> City_AreaList = new ArrayList<>();//该城市的所有地区列表
//如果无地区数据建议添加空字符串防止数据为null 导致三个选项长度不匹配造成崩溃 //如果无地区数据建议添加空字符串防止数据为null 导致三个选项长度不匹配造成崩溃
if (jsonBean.get(i).getCitys().get(c).getCounties() == null if (jsonBean.get(i).getCitys().get(c).getCounties() == null
|| jsonBean.get(i).getCitys().get(c).getCounties().size() == 0) { || jsonBean.get(i).getCitys().get(c).getCounties().size() == 0) {
@ -331,17 +323,14 @@ public class UserActivity extends BaseActivity implements View.OnClickListener {
AreaList.add(new CityBean(jsonBean.get(i).getCitys().get(c).getCounties().get(j).getName(), jsonBean.get(i).getCitys().get(c).getCounties().get(j).getRegion_id())); AreaList.add(new CityBean(jsonBean.get(i).getCitys().get(c).getCounties().get(j).getName(), jsonBean.get(i).getCitys().get(c).getCounties().get(j).getRegion_id()));
City_AreaList.add(jsonBean.get(i).getCitys().get(c).getCounties().get(j).getName()); City_AreaList.add(jsonBean.get(i).getCitys().get(c).getCounties().get(j).getName());
} }
} }
Province_AreaList.add(City_AreaList);//添加该省所有地区数据 Province_AreaList.add(City_AreaList);//添加该省所有地区数据
city_AreaList.add(AreaList);//添加该省所有地区数据的bean city_AreaList.add(AreaList);//添加该省所有地区数据的bean
} }
/* /*
* 添加城市数据 * 添加城市数据
*/ */
options2Items.add(CityList); options2Items.add(CityList);
/* /*
* 添加地区数据 * 添加地区数据
*/ */

View File

@ -26,6 +26,7 @@ import java.util.Map;
public class WebActivity extends BaseActivity implements View.OnClickListener { public class WebActivity extends BaseActivity implements View.OnClickListener {
private WebView nWebView; private WebView nWebView;
@Override @Override
protected int getLayout() { protected int getLayout() {
return R.layout.activity_web; return R.layout.activity_web;
@ -57,7 +58,8 @@ public class WebActivity extends BaseActivity implements View.OnClickListener {
httpParams.put(entry.getKey(),entry.getValue()); httpParams.put(entry.getKey(),entry.getValue());
} }
} }
OkGoBuilder.getInstance().Builder(this) OkGoBuilder.getInstance()
.Builder(this)
.url(url) .url(url)
.cls(RichTextBean.class) .cls(RichTextBean.class)
.token(Constant.ACCESS_TOKEN) .token(Constant.ACCESS_TOKEN)

View File

@ -14,17 +14,23 @@ import com.navinfo.outdoor.bean.BankPathBean;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List; import java.util.List;
public class BankAdapter extends RecyclerView.Adapter<BankAdapter.ViewHolder> { public class BankAdapter extends RecyclerView.Adapter<BankAdapter.ViewHolder> {
private List<BankPathBean> bankPathBeans ; private List<BankPathBean> bankPathBeans =new ArrayList<>();
private Context context; private Context context;
public BankAdapter(List<BankPathBean> bankPathBeans, Context context) { public BankAdapter(Context context) {
this.bankPathBeans = bankPathBeans;
this.context = context; this.context = context;
} }
public void setBankPathBeans(List<BankPathBean> bankPathBeans) {
this.bankPathBeans.clear();
this.bankPathBeans.addAll(bankPathBeans);
notifyDataSetChanged();
}
@NotNull @NotNull
@Override @Override
public ViewHolder onCreateViewHolder(@NonNull @NotNull ViewGroup parent, int viewType) { public ViewHolder onCreateViewHolder(@NonNull @NotNull ViewGroup parent, int viewType) {
@ -38,7 +44,7 @@ public class BankAdapter extends RecyclerView.Adapter<BankAdapter.ViewHolder> {
holder.itemView.setOnClickListener(new View.OnClickListener() { holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
onBankClick.onClick(position); onBankClick.onClick(bankPathBeans.get(position));
} }
}); });
} }
@ -57,7 +63,7 @@ public class BankAdapter extends RecyclerView.Adapter<BankAdapter.ViewHolder> {
} }
} }
public interface OnBankClick { public interface OnBankClick {
void onClick(int pos); void onClick(BankPathBean bankPathBean);
} }
private OnBankClick onBankClick; private OnBankClick onBankClick;

View File

@ -186,7 +186,7 @@ public class Constant {
public static boolean IS_FILTER_LIST_ITEM = true;//poi页面的查重 public static boolean IS_FILTER_LIST_ITEM = true;//poi页面的查重
public static TencentMap.OnMarkerClickListener markerClickListener=null; public static TencentMap.OnMarkerClickListener markerClickListener=null;
public static final String NAVIN_FO="9.17";//版本 public static final String NAVIN_FO="9.22";//版本
/** /**
* 联系我们的QQ群名称和QQ群号 * 联系我们的QQ群名称和QQ群号

View File

@ -55,7 +55,6 @@ public class CapacityEvaluationFragment extends BaseFragment implements View.OnC
@Override @Override
protected void initView() { protected void initView() {
super.initView(); super.initView();
ImageView ivEvaluationTaskFinish = findViewById(R.id.iv_evaluation_task_finish); ImageView ivEvaluationTaskFinish = findViewById(R.id.iv_evaluation_task_finish);
capacityEvaluationRecycler = findViewById(R.id.capacity_evaluation_recycler); capacityEvaluationRecycler = findViewById(R.id.capacity_evaluation_recycler);
ivEvaluationTaskFinish.setOnClickListener(this); ivEvaluationTaskFinish.setOnClickListener(this);
@ -63,8 +62,8 @@ public class CapacityEvaluationFragment extends BaseFragment implements View.OnC
capacityEvaluationRecycler.setRefreshProgressStyle(ProgressStyle.BallSpinFadeLoader); capacityEvaluationRecycler.setRefreshProgressStyle(ProgressStyle.BallSpinFadeLoader);
capacityEvaluationRecycler.setLoadingMoreProgressStyle(ProgressStyle.BallRotate); capacityEvaluationRecycler.setLoadingMoreProgressStyle(ProgressStyle.BallRotate);
//取消上拉加载刷新功能 //取消上拉加载刷新功能
// capacityEvaluationRecycler.setPullRefreshEnabled(false); //capacityEvaluationRecycler.setPullRefreshEnabled(false);
// capacityEvaluationRecycler.setLoadingMoreEnabled(false); //capacityEvaluationRecycler.setLoadingMoreEnabled(false);
capacityEvaluationAdapter = new CapacityEvaluationAdapter(capacityList,getActivity()); capacityEvaluationAdapter = new CapacityEvaluationAdapter(capacityList,getActivity());
capacityEvaluationRecycler.setAdapter(capacityEvaluationAdapter); capacityEvaluationRecycler.setAdapter(capacityEvaluationAdapter);
capacityEvaluationRecycler.getDefaultFootView().setNoMoreHint("加载成功"); capacityEvaluationRecycler.getDefaultFootView().setNoMoreHint("加载成功");
@ -74,7 +73,6 @@ public class CapacityEvaluationFragment extends BaseFragment implements View.OnC
capacityPage=1; capacityPage=1;
initNewWork(true); initNewWork(true);
} }
@Override @Override
public void onLoadMore() { public void onLoadMore() {
initNewWork(false); initNewWork(false);
@ -116,12 +114,9 @@ public class CapacityEvaluationFragment extends BaseFragment implements View.OnC
dismissLoadingDialog(); dismissLoadingDialog();
if (response.getCode() == 200){ if (response.getCode() == 200){
initTaskPrefectureBean(response,aNet); initTaskPrefectureBean(response,aNet);
}else { }else {
Toast.makeText(getActivity(), response.getMessage(), Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), response.getMessage(), Toast.LENGTH_SHORT).show();
} }
Log.d("TAG", "onSuccess: " + response.getMessage() + "sassafrases"); Log.d("TAG", "onSuccess: " + response.getMessage() + "sassafrases");
} }

View File

@ -12,6 +12,7 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.kongzue.dialog.util.DialogSettings;
import com.lzy.okgo.OkGo; import com.lzy.okgo.OkGo;
import com.lzy.okgo.model.HttpParams; import com.lzy.okgo.model.HttpParams;
import com.lzy.okgo.model.Response; import com.lzy.okgo.model.Response;
@ -52,6 +53,7 @@ public class CapacityMeasurementFragment extends BaseFragment implements View.On
private Gson gson; private Gson gson;
private Button btn; private Button btn;
public static CapacityMeasurementFragment newInstance(Bundle bundle) { public static CapacityMeasurementFragment newInstance(Bundle bundle) {
CapacityMeasurementFragment fragment = new CapacityMeasurementFragment(); CapacityMeasurementFragment fragment = new CapacityMeasurementFragment();
fragment.setArguments(bundle); fragment.setArguments(bundle);
@ -66,8 +68,8 @@ public class CapacityMeasurementFragment extends BaseFragment implements View.On
@Override @Override
protected void initView() { protected void initView() {
super.initView(); super.initView();
ImageView ivMeasurementFinish = (ImageView) findViewById(R.id.iv_measurement_finish); ImageView ivMeasurementFinish = findViewById(R.id.iv_measurement_finish);
RecyclerView capacityMeasurementRel = (RecyclerView) findViewById(R.id.capacity_measurementRel); RecyclerView capacityMeasurementRel = findViewById(R.id.capacity_measurementRel);
ivMeasurementFinish.setOnClickListener(this); ivMeasurementFinish.setOnClickListener(this);
capacityMeasurementRel.setLayoutManager(new LinearLayoutManager(getActivity())); capacityMeasurementRel.setLayoutManager(new LinearLayoutManager(getActivity()));
capacityMeasureAdapter = new CapacityMeasureAdapter(getActivity()); capacityMeasureAdapter = new CapacityMeasureAdapter(getActivity());
@ -100,16 +102,17 @@ public class CapacityMeasurementFragment extends BaseFragment implements View.On
@Override @Override
public void onSuccess(MeasureBean response, int id) { public void onSuccess(MeasureBean response, int id) {
dismissLoadingDialog(); dismissLoadingDialog();
//单选 //单选
List<MeasureBean.BodyBean.MultiChoiceBean> multiChoice = response.getBody().getMultiChoice(); List<MeasureBean.BodyBean.MultiChoiceBean> multiChoice = response.getBody().getMultiChoice();
//多选
List<MeasureBean.BodyBean.SingleChoiceBean> singleChoice1 = response.getBody().getSingleChoice();
if (multiChoice != null) { if (multiChoice != null) {
for (int i = 0; i < multiChoice.size(); i++) { for (int i = 0; i < multiChoice.size(); i++) {
baleen.add(new BolBean(multiChoice.get(i).getId(), multiChoice.get(i).getQuestion(), multiChoice.get(i).getOption(), true)); baleen.add(new BolBean(multiChoice.get(i).getId(), multiChoice.get(i).getQuestion(), multiChoice.get(i).getOption(), true));
examId = multiChoice.get(i).getExamId(); examId = multiChoice.get(i).getExamId();
} }
} }
//多选
List<MeasureBean.BodyBean.SingleChoiceBean> singleChoice1 = response.getBody().getSingleChoice();
if (singleChoice1 != null) { if (singleChoice1 != null) {
for (int i = 0; i < singleChoice1.size(); i++) { for (int i = 0; i < singleChoice1.size(); i++) {
baleen.add(new BolBean(singleChoice1.get(i).getId(), singleChoice1.get(i).getQuestion(), singleChoice1.get(i).getOption(), false)); baleen.add(new BolBean(singleChoice1.get(i).getId(), singleChoice1.get(i).getQuestion(), singleChoice1.get(i).getOption(), false));
@ -138,8 +141,7 @@ public class CapacityMeasurementFragment extends BaseFragment implements View.On
Objects.requireNonNull(getActivity()).finish(); Objects.requireNonNull(getActivity()).finish();
break; break;
case R.id.btn: case R.id.btn:
try { if (baleen.size() != 0) {
if (baleen != null) {
Map<String, String> checkedMap = capacityMeasureAdapter.getCheckedMap(); Map<String, String> checkedMap = capacityMeasureAdapter.getCheckedMap();
for (int i = 0; i < baleen.size(); i++) { for (int i = 0; i < baleen.size(); i++) {
final String id = baleen.get(i).getId(); final String id = baleen.get(i).getId();
@ -166,17 +168,14 @@ public class CapacityMeasurementFragment extends BaseFragment implements View.On
} else { } else {
Toast.makeText(getActivity(), "无数据", Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), "无数据", Toast.LENGTH_SHORT).show();
} }
} catch (JSONException e) {
e.printStackTrace();
}
break; break;
} }
} }
private void initExamSubmit() throws JSONException { private void initExamSubmit() {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("examId", examId); map.put("examId", examId);//试卷ID
map.put("answerList", examBeans); map.put("answerList", examBeans);//答案列表
String json = gson.toJson(map); String json = gson.toJson(map);
examBeans.clear(); examBeans.clear();
showLoadingDialog(); showLoadingDialog();
@ -184,40 +183,29 @@ public class CapacityMeasurementFragment extends BaseFragment implements View.On
.Builder(getActivity()) .Builder(getActivity())
.url(HttpInterface.EXAM_SUBMIT) .url(HttpInterface.EXAM_SUBMIT)
.cls(ExamSubmitBean.class) .cls(ExamSubmitBean.class)
.token(Constant.ACCESS_TOKEN)
.json(json) .json(json)
.params(new HttpParams())
.token(Constant.ACCESS_TOKEN)
.postCapacity(new Callback<ExamSubmitBean>() { .postCapacity(new Callback<ExamSubmitBean>() {
@Override @Override
public void onSuccess(ExamSubmitBean response, int id) { public void onSuccess(ExamSubmitBean response, int id) {
dismissLoadingDialog(); dismissLoadingDialog();
if (response.getCode() == 200) { if (response.getCode() == 200) {
String message = null;
if (response.getBody() == 0) {
message = "不通过";
} else if (response.getBody()==1){
if (response.getCode().equals("0")) { message = "通过";
MessageDialog.show((AppCompatActivity) Objects.requireNonNull(getActivity()), "提示", "不通过", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
return false;
}
});
} else {
MessageDialog.show((AppCompatActivity) Objects.requireNonNull(getActivity()), "提示", "通过", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
return false;
}
});
} }
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
MessageDialog.show((AppCompatActivity) Objects.requireNonNull(getActivity()), "提示", message, "确定").setOkButton(new OnDialogButtonClickListener() {
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
return false;
}
});
} else { } else {
Toast.makeText(getActivity(), response.getMessage(), Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), response.getMessage(), Toast.LENGTH_SHORT).show();
} }
Log.d("TAG", "onSuccess: " + response.toString()); Log.d("TAG", "onSuccess: " + response.toString());
} }

View File

@ -973,56 +973,56 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
} }
} }
// private void chargingPileByWork(ChargingPileEntity chargingPileEntity) { /* private void chargingPileByWork(ChargingPileEntity chargingPileEntity) {
// showLoadingDialog(); showLoadingDialog();
// HttpParams httpParams = new HttpParams(); HttpParams httpParams = new HttpParams();
// httpParams.put("taskId", taskId); httpParams.put("taskId", taskId);
// httpParams.put("name", chargingPileEntity.getName()); httpParams.put("name", chargingPileEntity.getName());
// httpParams.put("existence", chargingPileEntity.getExist()); httpParams.put("existence", chargingPileEntity.getExist());
// httpParams.put("geo", chargingPileEntity.getP()); httpParams.put("geo", chargingPileEntity.getP());
// httpParams.put("memo", chargingPileEntity.getMemo()); httpParams.put("memo", chargingPileEntity.getMemo());
// httpParams.put("ffid", chargingPileEntity.getFid()); httpParams.put("ffid", chargingPileEntity.getFid());
// HashMap<String, Object> hashMap = new HashMap<>(); HashMap<String, Object> hashMap = new HashMap<>();
// hashMap.put("cp_openType",chargingPileEntity.getCp_openType()); hashMap.put("cp_openType",chargingPileEntity.getCp_openType());
// hashMap.put("cp_floor",chargingPileEntity.getCp_floor()); hashMap.put("cp_floor",chargingPileEntity.getCp_floor());
// hashMap.put("cp_availableState",chargingPileEntity.getCp_availableState()); hashMap.put("cp_availableState",chargingPileEntity.getCp_availableState());
// hashMap.put("sign_exist",chargingPileEntity.getSign_exist()); hashMap.put("sign_exist",chargingPileEntity.getSign_exist());
// httpParams.put("detail", String.valueOf(hashMap)); httpParams.put("detail", String.valueOf(hashMap));
// OkGoBuilder.getInstance() OkGoBuilder.getInstance()
// .Builder(getActivity()) .Builder(getActivity())
// .url(HttpInterface.SUBMIT_CSTASK) .url(HttpInterface.SUBMIT_CSTASK)
// .method(OkGoBuilder.GET) .method(OkGoBuilder.GET)
// .cls(ChargingPileSaveBean.class) .cls(ChargingPileSaveBean.class)
// .params(httpParams) .params(httpParams)
// .callback(new Callback<ChargingPileSaveBean>() { .callback(new Callback<ChargingPileSaveBean>() {
// @Override @Override
// public void onSuccess(ChargingPileSaveBean chargingPileSaveBean, int id) { public void onSuccess(ChargingPileSaveBean chargingPileSaveBean, int id) {
// dismissLoadingDialog(); dismissLoadingDialog();
// chargingPileBody = chargingPileSaveBean.getBody(); chargingPileBody = chargingPileSaveBean.getBody();
// Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
// Log.d("TAG", "onSuccess: " + chargingPileSaveBean.getBody()); Log.d("TAG", "onSuccess: " + chargingPileSaveBean.getBody());
// phoneList(); phoneList();
// Message obtain = Message.obtain(); Message obtain = Message.obtain();
// obtain.what = Constant.CHARGING_PILE_BODY; obtain.what = Constant.CHARGING_PILE_BODY;
// obtain.obj = chargingPileBody; obtain.obj = chargingPileBody;
// EventBus.getDefault().post(obtain); EventBus.getDefault().post(obtain);
//
// Message obtain1 = Message.obtain(); Message obtain1 = Message.obtain();
// obtain1.what = Constant.CHARGING_PILE_PHOTO; obtain1.what = Constant.CHARGING_PILE_PHOTO;
// obtain1.obj = phoneLists; obtain1.obj = phoneLists;
// EventBus.getDefault().post(obtain1); EventBus.getDefault().post(obtain1);
// getActivity().onBackPressed(); getActivity().onBackPressed();
//
// } }
//
// @Override @Override
// public void onError(Throwable e, int id) { public void onError(Throwable e, int id) {
// dismissLoadingDialog(); dismissLoadingDialog();
// Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show();
// Log.d("TAG", "onError: " + e.getMessage()); Log.d("TAG", "onError: " + e.getMessage());
// } }
// }).build(); }).build();
// } }*/
@Override @Override

View File

@ -676,8 +676,6 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
} }
}); });
} }
} else {
Toast.makeText(getActivity(), getPhoneBean.getMessage() + "", Toast.LENGTH_SHORT).show();
} }
} }
@Override @Override
@ -689,18 +687,22 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
} }
public void initRemovePileSharePre() { public void initRemovePileSharePre() {
//获取SharedPreferences对象方法中两个参数的意思为第一个name //获取SharedPreferences对象方法中两个参数的意思为第一个name
//表示文件名系统将会在/dada/dada/包名/shared_prefs目录下生成 //表示文件名系统将会在/dada/dada/包名/shared_prefs目录下生成
//一个以该参数命名的.xml文件第二个mode表示创建的模式通过查看 //一个以该参数命名的.xml文件第二个mode表示创建的模式通过查看
//方法注释得知建议以0或者MODE_PRIVATE为默认值 //方法注释得知建议以0或者MODE_PRIVATE为默认值
SharedPreferences poi = Objects.requireNonNull(getActivity()).getSharedPreferences(Constant.DATA_FILE, 0); SharedPreferences poi = Objects.requireNonNull(getActivity()).getSharedPreferences(Constant.DATA_FILE, 0);
//获取Editor对象 //获取Editor对象
SharedPreferences.Editor edit = poi.edit(); SharedPreferences.Editor edit = poi.edit();
//根据要保存的数据的类型调用对应的put方法,以键值对的形式添加新值 //根据要保存的数据的类型调用对应的put方法,以键值对的形式添加新值
edit.putString("chargingPileEntity", null); edit.putString("chargingPileEntity", null);
//提交新值必须执行否则前面的操作都无效 //提交新值必须执行否则前面的操作都无效
edit.apply(); edit.apply();
} }
//禁用所有可操作性控件 //禁用所有可操作性控件
private void disables() { private void disables() {

View File

@ -42,15 +42,12 @@ public class EventPrefectureFragment extends BaseFragment implements View.OnClic
private EventPrefectureAdapter eventPrefectureAdapter; private EventPrefectureAdapter eventPrefectureAdapter;
private int eventPage = 1; private int eventPage = 1;
public static EventPrefectureFragment newInstance(Bundle bundle) { public static EventPrefectureFragment newInstance(Bundle bundle) {
EventPrefectureFragment fragment = new EventPrefectureFragment(); EventPrefectureFragment fragment = new EventPrefectureFragment();
fragment.setArguments(bundle); fragment.setArguments(bundle);
return fragment; return fragment;
} }
@Override @Override
protected int getLayout() { protected int getLayout() {
return R.layout.event_prefecture_fragment; return R.layout.event_prefecture_fragment;
@ -84,10 +81,7 @@ public class EventPrefectureFragment extends BaseFragment implements View.OnClic
}else { }else {
Toast.makeText(getActivity(), taskPrefectureBean.getMessage()+"", Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), taskPrefectureBean.getMessage()+"", Toast.LENGTH_SHORT).show();
} }
Log.d("TAG", "onSuccess: " + taskPrefectureBean.getMessage()); Log.d("TAG", "onSuccess: " + taskPrefectureBean.getMessage());
} }
@Override @Override

View File

@ -79,8 +79,7 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
if (!hidden) { if (!hidden) {
setSlidingUpPanelLayout(Constant.SLIDING_LAYOUT); setSlidingUpPanelLayout(Constant.SLIDING_LAYOUT);
if (slidingPaneLayout != null) { if (slidingPaneLayout != null) {
slidingPaneLayout.setScrollableView(recyclerFilter); slidingPaneLayout.setScrollableView(recyclerFilter); }
}
initHeader(); initHeader();
} }
} }
@ -93,8 +92,7 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
Bundle arguments = getArguments(); Bundle arguments = getArguments();
if (arguments != null) { if (arguments != null) {
isSliding = arguments.getBoolean("isSliding", true); isSliding = arguments.getBoolean("isSliding", true);
Log.d("TAG", "onCaress's: " + isSliding); Log.d("TAG", "onCaress's: " + isSliding); }
}
if (isSliding) { if (isSliding) {
// 监听到返回按钮点击事件 // 监听到返回按钮点击事件
Message obtain = Message.obtain(); Message obtain = Message.obtain();
@ -133,8 +131,7 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
if (allPoi != null) { if (allPoi != null) {
for (int i = 0; i < allPoi.size(); i++) { for (int i = 0; i < allPoi.size(); i++) {
if (allPoi.get(i).getTaskStatus() == 0 || allPoi.get(i).getTaskStatus() == 1) { if (allPoi.get(i).getTaskStatus() == 0 || allPoi.get(i).getTaskStatus() == 1) {
poiEntities.add(allPoi.get(i)); poiEntities.add(allPoi.get(i)); }
}
} }
} }
filterAdapter.setAllPoi(poiEntities); filterAdapter.setAllPoi(poiEntities);
@ -195,12 +192,16 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
ConstraintLayout clPhotograph = findViewById(R.id.cl_photograph); ConstraintLayout clPhotograph = findViewById(R.id.cl_photograph);
clPhotograph.setOnClickListener(this); clPhotograph.setOnClickListener(this);
tvPhotograph = findViewById(R.id.tv_photograph); tvPhotograph = findViewById(R.id.tv_photograph);
if (Constant.LIMIT_TYPE == -1) {//"全部", "普通任务", "专属任务" if (Constant.LIMIT_TYPE == -1) {//"全部", "普通任务", "专属任务","挑战任务","奖励任务"
tvPhotograph.setText("全部"); tvPhotograph.setText("全部");
} else if (Constant.LIMIT_TYPE == 0) { } else if (Constant.LIMIT_TYPE == 0) {
tvPhotograph.setText("普通任务"); tvPhotograph.setText("普通任务");
} else if (Constant.LIMIT_TYPE == 1) { } else if (Constant.LIMIT_TYPE == 1) {
tvPhotograph.setText("专属任务"); tvPhotograph.setText("专属任务");
} else if (Constant.LIMIT_TYPE == 2) {
tvPhotograph.setText("挑战任务");
} else if (Constant.LIMIT_TYPE == 3) {
tvPhotograph.setText("奖励任务");
} }
ConstraintLayout clExclusive = findViewById(R.id.cl_exclusive); ConstraintLayout clExclusive = findViewById(R.id.cl_exclusive);
clExclusive.setOnClickListener(this); clExclusive.setOnClickListener(this);
@ -237,7 +238,6 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
}*/ }*/
Button btnFilter = findViewById(R.id.btn_filter); Button btnFilter = findViewById(R.id.btn_filter);
btnFilter.setOnClickListener(this); btnFilter.setOnClickListener(this);
RelativeLayout rlDraw = findViewById(R.id.rl_draw);
checkOk = findViewById(R.id.check_ok); checkOk = findViewById(R.id.check_ok);
Button btnDraw = findViewById(R.id.btn_draw); Button btnDraw = findViewById(R.id.btn_draw);
btnDraw.setOnClickListener(this); btnDraw.setOnClickListener(this);
@ -263,9 +263,7 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
recyclerFilter.setAdapter(filterAdapter); recyclerFilter.setAdapter(filterAdapter);
recyclerFilter.setScrollAlphaChangeListener(new XRecyclerView.ScrollAlphaChangeListener() { recyclerFilter.setScrollAlphaChangeListener(new XRecyclerView.ScrollAlphaChangeListener() {
@Override @Override
public void onAlphaChange(int alpha) { public void onAlphaChange(int alpha) {}
}
@Override @Override
public int setLimitHeight() { public int setLimitHeight() {
return 0; return 0;
@ -274,13 +272,9 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
recyclerFilter.getDefaultFootView().setNoMoreHint("成功加载完毕"); recyclerFilter.getDefaultFootView().setNoMoreHint("成功加载完毕");
recyclerFilter.setLoadingListener(new XRecyclerView.LoadingListener() { recyclerFilter.setLoadingListener(new XRecyclerView.LoadingListener() {
@Override @Override
public void onRefresh() { public void onRefresh() {}
}
@Override @Override
public void onLoadMore() { public void onLoadMore() {}
}
}); });
checkOk.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { checkOk.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override @Override
@ -293,7 +287,6 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
checkOk.setChecked(false); checkOk.setChecked(false);
Toast.makeText(getActivity(), "您的等级暂不具备此权限哦", Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), "您的等级暂不具备此权限哦", Toast.LENGTH_SHORT).show();
} }
} }
}); });
filterAdapter.setItemCLick(new FilterAdapter.ItemCLick() { filterAdapter.setItemCLick(new FilterAdapter.ItemCLick() {
@ -306,13 +299,13 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
EventBus.getDefault().post(obtains); EventBus.getDefault().post(obtains);
} }
}); });
filterAdapter.setItemOnCLick(new FilterAdapter.ItemOnCLick() { filterAdapter.setItemOnCLick(new FilterAdapter.ItemOnCLick() {
@Override @Override
public void item(PoiEntity poiEntity, boolean isChockBox) { public void item(PoiEntity poiEntity, boolean isChockBox) {
if (isChockBox) { if (isChockBox) {
btnChock.add(poiEntity); btnChock.add(poiEntity);
} else { }
else {
for (int i = 0; i < btnChock.size(); i++) { for (int i = 0; i < btnChock.size(); i++) {
if (poiEntity.getId().equals(btnChock.get(i).getId())) { if (poiEntity.getId().equals(btnChock.get(i).getId())) {
btnChock.remove(poiEntity); btnChock.remove(poiEntity);
@ -343,7 +336,6 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
} else { } else {
Toast.makeText(getActivity(), "您的等级暂不具备此权限哦", Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), "您的等级暂不具备此权限哦", Toast.LENGTH_SHORT).show();
} }
break; break;
case R.id.btn_filter: case R.id.btn_filter:
Message obtain = Message.obtain(); Message obtain = Message.obtain();
@ -380,7 +372,7 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
}); });
break; break;
case R.id.cl_photograph: case R.id.cl_photograph:
BottomMenu.show((AppCompatActivity) Objects.requireNonNull(getContext()), new String[]{"全部", "普通任务", "专属任务"}, new OnMenuItemClickListener() { BottomMenu.show((AppCompatActivity) Objects.requireNonNull(getContext()), new String[]{"全部", "普通任务", "专属任务", "挑战任务", "奖励任务"}, new OnMenuItemClickListener() {
@Override @Override
public void onClick(String text, int index) { public void onClick(String text, int index) {
tvPhotograph.setText(text); tvPhotograph.setText(text);
@ -394,6 +386,12 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
case 2: case 2:
Constant.LIMIT_TYPE = 1; Constant.LIMIT_TYPE = 1;
break; break;
case 3:
Constant.LIMIT_TYPE = 2;
break;
case 4:
Constant.LIMIT_TYPE = 3;
break;
} }
Message obtain = Message.obtain(); Message obtain = Message.obtain();
obtain.what = Constant.JOB_WORD_MONITOR; obtain.what = Constant.JOB_WORD_MONITOR;
@ -477,10 +475,8 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
} }
} }
/** /*
* 批量领取 * 批量领取
*
* @param taskId
*/ */
private void initBatch(String taskId) { private void initBatch(String taskId) {
HttpParams httpParams = new HttpParams(); HttpParams httpParams = new HttpParams();
@ -517,13 +513,10 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
} }
}); });
} }
/** /*
* 通过不同类型的type 进行批量领取 * 通过不同类型的type 进行批量领取
*
* @param
*/ */
private void initType(FilterBatchBean.BodyBean.SuccessBean successBean) { private void initType(FilterBatchBean.BodyBean.SuccessBean successBean) {
switch (successBean.getType()) { switch (successBean.getType()) {
@ -579,7 +572,6 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
InsertAndUpdateUtils.getInstance().insertOrUpdateChargingPile(getActivity(), chargingPileEntityList); InsertAndUpdateUtils.getInstance().insertOrUpdateChargingPile(getActivity(), chargingPileEntityList);
} }
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), chargingStationEntity); InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), chargingStationEntity);
} }
}).start(); }).start();
break; break;

View File

@ -1,5 +1,6 @@
package com.navinfo.outdoor.fragment; package com.navinfo.outdoor.fragment;
import android.annotation.SuppressLint;
import android.os.Bundle; import android.os.Bundle;
import android.os.Message; import android.os.Message;
import android.util.Log; import android.util.Log;
@ -54,8 +55,6 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
private PoiDao poiDao; private PoiDao poiDao;
private ChargingPileDao chargingPileDao; private ChargingPileDao chargingPileDao;
public static GatherGetFragment newInstance(Bundle bundle) { public static GatherGetFragment newInstance(Bundle bundle) {
GatherGetFragment fragment = new GatherGetFragment(); GatherGetFragment fragment = new GatherGetFragment();
fragment.setArguments(bundle); fragment.setArguments(bundle);
@ -75,6 +74,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
getView().setOnKeyListener(new View.OnKeyListener() { getView().setOnKeyListener(new View.OnKeyListener() {
@Override @Override
public boolean onKey(View v, int keyCode, KeyEvent event) { public boolean onKey(View v, int keyCode, KeyEvent event) {
if (event.getAction() == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) { if (event.getAction() == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) {
assert getArguments() != null; assert getArguments() != null;
boolean aBoolean = getArguments().getBoolean("boolean", false); boolean aBoolean = getArguments().getBoolean("boolean", false);
@ -98,6 +98,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
return R.layout.fragment_gather_get; return R.layout.fragment_gather_get;
} }
@SuppressLint("SetTextI18n")
@Override @Override
protected void initView() { protected void initView() {
super.initView(); super.initView();
@ -137,11 +138,9 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
tvTime.setText("到期时间:" + poiEntity.getCreateTime()); tvTime.setText("到期时间:" + poiEntity.getCreateTime());
} }
} }
assert poiEntity != null; assert poiEntity != null;
if (poiEntity.getDist() != null) { if (poiEntity.getDist() != null) {
tvDistance.setText("距离:" + format5(Double.valueOf(poiEntity.getDist()) / 1000) + "km"); tvDistance.setText("距离:" + format5(Double.parseDouble(poiEntity.getDist()) / 1000) + "km");
} }
if (poiEntity.getRecord_way()==0){//不可领取 if (poiEntity.getRecord_way()==0){//不可领取
btnGetTask.setEnabled(false); btnGetTask.setEnabled(false);
@ -196,7 +195,6 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
} }
} }
@Override @Override
public void onClick(View v) { public void onClick(View v) {
switch (v.getId()) { switch (v.getId()) {
@ -223,15 +221,15 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
if (type == 6) {//面状任务的领取类型 if (type == 6) {//面状任务的领取类型
initPolygonTask(HttpInterface.RECEIVED_POLYGON_TASK, poiEntity.getTaskId(), false); initPolygonTask(HttpInterface.RECEIVED_POLYGON_TASK, poiEntity.getTaskId(), false);
} else if (type == 1) {//poi的领取类型 } else if (type == 1) {//poi的领取类型
receivedTaskByNet(HttpInterface.RECEIVED_POI_TASK, poiEntity.getTaskId(), false, poiEntity, 1); receivedTaskByNet(HttpInterface.RECEIVED_POI_TASK, poiEntity.getTaskId(), false, 1);
} else if (type == 2) {//充电站的领取类型 } else if (type == 2) {//充电站的领取类型
chargingTaskByWork(HttpInterface.RECEIVED_CTASK, poiEntity.getTaskId(), false, 1); chargingTaskByWork(HttpInterface.RECEIVED_CTASK, poiEntity.getTaskId(), false, 1);
} else if (type == 3) {//poi录像的领取类型 } else if (type == 3) {//poi录像的领取类型
taskByNet(HttpInterface.RECEIVED_POI_VIDEO_TASK, poiEntity.getTaskId(), false, poiEntity, 1); taskByNet(HttpInterface.RECEIVED_POI_VIDEO_TASK, poiEntity.getTaskId(), false, 1);
} else if (type == 4) {//道路的领取类型 } else if (type == 4) {//道路的领取类型
taskByNet(HttpInterface.RECEIVED_ROAD_TASK, poiEntity.getTaskId(), false, poiEntity, 1); taskByNet(HttpInterface.RECEIVED_ROAD_TASK, poiEntity.getTaskId(), false, 1);
} else if (type == 5) {//其他的领取类型 } else if (type == 5) {//其他的领取类型
receivedTaskByNet(HttpInterface.RECEIVED_OTHER_TASK, poiEntity.getTaskId(), false, poiEntity, 1); receivedTaskByNet(HttpInterface.RECEIVED_OTHER_TASK, poiEntity.getTaskId(), false, 1);
} }
} }
break; break;
@ -249,8 +247,6 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
}else { }else {
if (geometry>50){ if (geometry>50){
// Voice.sprat("注意在附近50米范围内进行采集",0); // Voice.sprat("注意在附近50米范围内进行采集",0);
DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE; DialogSettings.style = DialogSettings.STYLE.STYLE_KONGZUE;
MessageDialog.show((AppCompatActivity) Objects.requireNonNull(getActivity()), "提示", "注意在任务附近50米范围内进行采集", "确定").setOnOkButtonClickListener(new OnDialogButtonClickListener() { MessageDialog.show((AppCompatActivity) Objects.requireNonNull(getActivity()), "提示", "注意在任务附近50米范围内进行采集", "确定").setOnOkButtonClickListener(new OnDialogButtonClickListener() {
@Override @Override
@ -314,19 +310,17 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
} }
} else if (type == 1) {//poi的领取类型 } else if (type == 1) {//poi的领取类型
receivedTaskByNet(HttpInterface.RECEIVED_POI_TASK, poiEntity.getTaskId(), true, poiEntity, 5); receivedTaskByNet(HttpInterface.RECEIVED_POI_TASK, poiEntity.getTaskId(), true, 5);
} else if (type == 2) {//充电站的领取类型 } else if (type == 2) {//充电站的领取类型
chargingTaskByWork(HttpInterface.RECEIVED_CTASK, poiEntity.getTaskId(), true, 5); chargingTaskByWork(HttpInterface.RECEIVED_CTASK, poiEntity.getTaskId(), true, 5);
} else if (type == 3) {//poi录像的领取类型 } else if (type == 3) {//poi录像的领取类型
taskByNet(HttpInterface.RECEIVED_POI_VIDEO_TASK, poiEntity.getTaskId(), true, poiEntity, 5); taskByNet(HttpInterface.RECEIVED_POI_VIDEO_TASK, poiEntity.getTaskId(), true, 5);
} else if (type == 4) {//道路的领取类型 } else if (type == 4) {//道路的领取类型
taskByNet(HttpInterface.RECEIVED_ROAD_TASK, poiEntity.getTaskId(), true, poiEntity, 5); taskByNet(HttpInterface.RECEIVED_ROAD_TASK, poiEntity.getTaskId(), true, 5);
} else if (type == 5) {//其他的领取类型 } else if (type == 5) {//其他的领取类型
receivedTaskByNet(HttpInterface.RECEIVED_OTHER_TASK, poiEntity.getTaskId(), true, poiEntity, 5); receivedTaskByNet(HttpInterface.RECEIVED_OTHER_TASK, poiEntity.getTaskId(), true, 5);
} }
} }
} }
/** /**
@ -366,7 +360,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
}else { }else {
chargingStationEntity.setTelPhone(stationBean.getTelephone()); chargingStationEntity.setTelPhone(stationBean.getTelephone());
} }
chargingStationEntity.setType(Integer.valueOf(stationBean.getType())); chargingStationEntity.setType(stationBean.getType());
chargingStationEntity.setTaskStatus(statusId); chargingStationEntity.setTaskStatus(statusId);
chargingStationEntity.setGeoWkt(stationBean.getGeo()); chargingStationEntity.setGeoWkt(stationBean.getGeo());
String encodeStr = stationBean.getGeo(); String encodeStr = stationBean.getGeo();
@ -386,7 +380,6 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
chargingStationEntity.setY(latLineString.get(0).latitude + ""); chargingStationEntity.setY(latLineString.get(0).latitude + "");
break; break;
} }
//充电桩 //充电桩
List<ReceivedBean.BodyBean.CsTaskListBean> csTaskList = response.getBody().getCsTaskList(); List<ReceivedBean.BodyBean.CsTaskListBean> csTaskList = response.getBody().getCsTaskList();
if (csTaskList != null && !csTaskList.isEmpty()) { if (csTaskList != null && !csTaskList.isEmpty()) {
@ -504,7 +497,6 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
polygonEntity.setTaskStatus(1); polygonEntity.setTaskStatus(1);
} }
new Thread(new Runnable() { new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
@ -538,11 +530,12 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
Log.d("TAG", "onError: " + e.getMessage()); Log.d("TAG", "onError: " + e.getMessage());
} }
}); });
} }
/** /**
* @param url 所以类型的结束领取 * @param url
* @param poiEntity * 所以类型的结束领取
*/ */
private void initEndReceiveTask(String url, int taskId, PoiEntity poiEntity) { private void initEndReceiveTask(String url, int taskId, PoiEntity poiEntity) {
if (taskId == 0) { if (taskId == 0) {
@ -683,7 +676,6 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
poiDao.deleteFormTaskID(taskId); poiDao.deleteFormTaskID(taskId);
} }
}).start(); }).start();
} else { } else {
Toast.makeText(getActivity(), "" + response.getMessage(), Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), "" + response.getMessage(), Toast.LENGTH_SHORT).show();
} }
@ -698,12 +690,10 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
}); });
} }
/** /**
* @param url poi类型对应的url * @param url poi类型对应的url
* @param poiEntity
*/ */
private void receivedTaskByNet(String url, int taskId, boolean isSaver, PoiEntity poiEntity, int statusId) { private void receivedTaskByNet(String url, int taskId, boolean isSaver, int statusId) {
showLoadingDialog(); showLoadingDialog();
OkGoBuilder.getInstance() OkGoBuilder.getInstance()
.Builder(getActivity()) .Builder(getActivity())
@ -825,9 +815,8 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
/** /**
* @param url 不同任务类型对应的url * @param url 不同任务类型对应的url
* @param poiEntity
*/ */
private void taskByNet(String url, int taskId, boolean isSaver, PoiEntity poiEntity, int statusId) { private void taskByNet(String url, int taskId, boolean isSaver, int statusId) {
showLoadingDialog(); showLoadingDialog();
OkGoBuilder.getInstance() OkGoBuilder.getInstance()
.Builder(getActivity()) .Builder(getActivity())

View File

@ -5,9 +5,9 @@ import android.app.Dialog;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.provider.MediaStore; import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log; import android.util.Log;
import android.view.Gravity; import android.view.Gravity;
import android.view.View; import android.view.View;
@ -18,13 +18,11 @@ import android.widget.EditText;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.DividerItemDecoration; import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.github.lazylibrary.util.StringUtils; import com.github.lazylibrary.util.StringUtils;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.kongzue.dialog.interfaces.OnDialogButtonClickListener; import com.kongzue.dialog.interfaces.OnDialogButtonClickListener;
@ -45,28 +43,21 @@ import com.navinfo.outdoor.http.HttpInterface;
import com.navinfo.outdoor.http.OkGoBuilder; import com.navinfo.outdoor.http.OkGoBuilder;
import com.navinfo.outdoor.util.GetJsonDataUtil; import com.navinfo.outdoor.util.GetJsonDataUtil;
import com.navinfo.outdoor.util.PhotoUtils; import com.navinfo.outdoor.util.PhotoUtils;
import org.json.JSONArray; import org.json.JSONArray;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Objects; import java.util.Objects;
import static android.app.Activity.RESULT_OK;
/** /**
* 收款信息 * 收款信息
*/ */
public class GatheringFragment extends BaseFragment implements View.OnClickListener { public class GatheringFragment extends BaseFragment implements View.OnClickListener {
private TextView tvBank; private TextView tvBank;
private EditText etBankNum; private EditText etBankNum;
private ImageView gatheringCamera; private ImageView gatheringCamera;
private ArrayList<BankPathBean> jsonBean; private ArrayList<BankPathBean> jsonBean;
private String value; private String value;
public static GatheringFragment newInstance(Bundle bundle) { public static GatheringFragment newInstance(Bundle bundle) {
GatheringFragment fragment = new GatheringFragment(); GatheringFragment fragment = new GatheringFragment();
fragment.setArguments(bundle); fragment.setArguments(bundle);
@ -92,17 +83,27 @@ public class GatheringFragment extends BaseFragment implements View.OnClickListe
tvBank.setOnClickListener(this); tvBank.setOnClickListener(this);
Button btnBank = findViewById(R.id.btn_bank); Button btnBank = findViewById(R.id.btn_bank);
btnBank.setOnClickListener(this); btnBank.setOnClickListener(this);
TextView tvName = (TextView) findViewById(R.id.tv_name); TextView tvName = findViewById(R.id.tv_name);
etBankNum = (EditText) findViewById(R.id.et_bank_num); etBankNum = findViewById(R.id.et_bank_num);
gatheringCamera = (ImageView) findViewById(R.id.gathering_camera); gatheringCamera = findViewById(R.id.gathering_camera);
gatheringCamera.setOnClickListener(this); gatheringCamera.setOnClickListener(this);
if (Constant.NAME!=null){ if (Constant.NAME != null) {
tvName.setText(Constant.NAME); tvName.setText(Constant.NAME);
} }
if (Constant.ID_NUMBER!=null&&Constant.BACKGROUND_NAME!=null&&Constant.BACKGROUND!=null){ /*
String bankAccount = navInfo.getString("bankAccount", null);
String bank = navInfo.getString("bankName", null);
String idNumber = navInfo.getString("idNumber", null);
if (bankAccount!=null&&!bankAccount.equals("")&&bank!=null&&!bank.equals("")&&idNumber!=null&&!idNumber.equals("")){
etBankNum.setText(idNumber);
tvBank.setText(bank);
value=bankAccount;
btnBank.setText("重新绑定");
}*/
if (Constant.ID_NUMBER != null && Constant.BACKGROUND_NAME != null && Constant.BACKGROUND != null) {
etBankNum.setText(Constant.ID_NUMBER); etBankNum.setText(Constant.ID_NUMBER);
tvBank.setText(Constant.BACKGROUND_NAME); tvBank.setText(Constant.BACKGROUND_NAME);
value=Constant.BACKGROUND; value = Constant.BACKGROUND;
btnBank.setText("重新绑定"); btnBank.setText("重新绑定");
} }
} }
@ -132,17 +133,51 @@ public class GatheringFragment extends BaseFragment implements View.OnClickListe
RecyclerView rlvBank = dialog.findViewById(R.id.rlv_bank); RecyclerView rlvBank = dialog.findViewById(R.id.rlv_bank);
rlvBank.addItemDecoration(new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL)); rlvBank.addItemDecoration(new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL));
rlvBank.setLayoutManager(new LinearLayoutManager(getContext())); rlvBank.setLayoutManager(new LinearLayoutManager(getContext()));
BankAdapter bankAdapter = new BankAdapter(jsonBean, getContext()); BankAdapter bankAdapter = new BankAdapter(getContext());
bankAdapter.setBankPathBeans(jsonBean);
rlvBank.setAdapter(bankAdapter); rlvBank.setAdapter(bankAdapter);
bankAdapter.setOnBankClick(new BankAdapter.OnBankClick() { bankAdapter.setOnBankClick(new BankAdapter.OnBankClick() {
@Override @Override
public void onClick(int pos) { public void onClick(BankPathBean bankPathBean) {
tvBank.setText(jsonBean.get(pos).getLabel()); tvBank.setText(bankPathBean.getLabel());
value = jsonBean.get(pos).getValue(); value = bankPathBean.getValue();
bankAdapter.notifyDataSetChanged();
dialog.dismiss(); dialog.dismiss();
} }
}); });
EditText editText = dialog.findViewById(R.id.editText);
ArrayList<BankPathBean> bankPathBeans = new ArrayList<>();
editText.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
bankAdapter.setBankPathBeans(jsonBean);
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
bankPathBeans.clear();
for (int i = 0; i < jsonBean.size(); i++) {
String label = jsonBean.get(i).getLabel();
if (label.contains(s.toString())){//含有
BankPathBean bankPathBean = jsonBean.get(i);
bankPathBeans.add(bankPathBean);
}
}
bankAdapter.setBankPathBeans(bankPathBeans);
}
@Override
public void afterTextChanged(Editable s) {
bankPathBeans.clear();
for (int i = 0; i < jsonBean.size(); i++) {
String label = jsonBean.get(i).getLabel();
if (label.contains(s.toString())){//含有
BankPathBean bankPathBean = jsonBean.get(i);
bankPathBeans.add(bankPathBean);
}
}
bankAdapter.setBankPathBeans(bankPathBeans);
}
});
Window window = dialog.getWindow(); Window window = dialog.getWindow();
assert window != null; assert window != null;
WindowManager.LayoutParams wlp = window.getAttributes(); WindowManager.LayoutParams wlp = window.getAttributes();
@ -155,7 +190,7 @@ public class GatheringFragment extends BaseFragment implements View.OnClickListe
case R.id.btn_bank: case R.id.btn_bank:
if (etBankNum.getText().toString().equals("")) { if (etBankNum.getText().toString().equals("")) {
Toast.makeText(getActivity(), "银行卡号不能为空", Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), "银行卡号不能为空", Toast.LENGTH_SHORT).show();
Log.e("TAG", "onClick: "+etBankNum ); Log.e("TAG", "onClick: " + etBankNum);
return; return;
} }
gatheringNetWork(); gatheringNetWork();
@ -173,9 +208,9 @@ public class GatheringFragment extends BaseFragment implements View.OnClickListe
private void gatheringNetWork() { private void gatheringNetWork() {
ArrayList<File> gatheringList = new ArrayList<>(); ArrayList<File> gatheringList = new ArrayList<>();
if (gatheringCamera.getTag() == null) { if (gatheringCamera.getTag() == null) {
if (Constant.ID_NUMBER==null){ if (Constant.ID_NUMBER == null) {
Toast.makeText(getActivity(), "请先拍银行卡", Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), "请先拍银行卡", Toast.LENGTH_SHORT).show();
}else { } else {
Toast.makeText(getActivity(), "如果需要重新绑定请先拍照银行卡", Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), "如果需要重新绑定请先拍照银行卡", Toast.LENGTH_SHORT).show();
} }
return; return;
@ -214,18 +249,18 @@ public class GatheringFragment extends BaseFragment implements View.OnClickListe
MessageDialog.show((AppCompatActivity) Objects.requireNonNull(getActivity()), "提示", "绑定成功", "确定", "取消").setOkButton(new OnDialogButtonClickListener() { MessageDialog.show((AppCompatActivity) Objects.requireNonNull(getActivity()), "提示", "绑定成功", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
@Override @Override
public boolean onClick(BaseDialog baseDialog, View v) { public boolean onClick(BaseDialog baseDialog, View v) {
Constant.BACKGROUND =value; Constant.BACKGROUND = value;
Constant.BACKGROUND_NAME=bank; Constant.BACKGROUND_NAME = bank;
Constant.ID_NUMBER = etBankAccount; Constant.ID_NUMBER = etBankAccount;
getActivity().finish(); getActivity().finish();
return false; return false;
} }
}); });
} else { } else {
MessageDialog.show((AppCompatActivity) Objects.requireNonNull(getActivity()), "提示", "绑定失败", "确定","取消").setOkButton(new OnDialogButtonClickListener() { MessageDialog.show((AppCompatActivity) Objects.requireNonNull(getActivity()), "提示", "绑定失败", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
@Override @Override
public boolean onClick(BaseDialog baseDialog, View v) { public boolean onClick(BaseDialog baseDialog, View v) {
Toast.makeText(getActivity(), response.getMessage()+"", Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), response.getMessage() + "", Toast.LENGTH_SHORT).show();
return false; return false;
} }
}); });
@ -235,7 +270,7 @@ public class GatheringFragment extends BaseFragment implements View.OnClickListe
@Override @Override
public void onError(Throwable e, int id) { public void onError(Throwable e, int id) {
dismissLoadingDialog(); dismissLoadingDialog();
Toast.makeText(getActivity(), e.getMessage()+"", Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), e.getMessage() + "", Toast.LENGTH_SHORT).show();
} }
}); });
} }
@ -255,18 +290,18 @@ public class GatheringFragment extends BaseFragment implements View.OnClickListe
gatheringCamera.setTag(absolutePath); gatheringCamera.setTag(absolutePath);
//银行卡识别 //银行卡识别
BankCardBean bankCardBean = new Gson().fromJson(BankCard.bankCard(), BankCardBean.class); BankCardBean bankCardBean = new Gson().fromJson(BankCard.bankCard(), BankCardBean.class);
if (bankCardBean==null){ if (bankCardBean == null) {
Toast.makeText(getContext(), "识别失败,可以重新识别或则进行手动输入", Toast.LENGTH_SHORT).show(); Toast.makeText(getContext(), "识别失败,可以重新识别或则进行手动输入", Toast.LENGTH_SHORT).show();
}else { } else {
if (bankCardBean.getResult()!=null&&bankCardBean.getResult().getBank_card_number()!=null){ if (bankCardBean.getResult() != null && bankCardBean.getResult().getBank_card_number() != null) {
String bank_card_number = bankCardBean.getResult().getBank_card_number(); String bank_card_number = bankCardBean.getResult().getBank_card_number();
if (StringUtils.isEmpty(bank_card_number)) { if (StringUtils.isEmpty(bank_card_number)) {
Toast.makeText(getActivity(), "识别失败,可以重新识别或则进行手动输入", Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), "识别失败,可以重新识别或则进行手动输入", Toast.LENGTH_SHORT).show();
return; return;
} }
etBankNum.setText(bank_card_number); etBankNum.setText(bank_card_number);
String bankName = bankCardBean.getResult().getBank_name(); // String bankName = bankCardBean.getResult().getBank_name();
}else { } else {
Toast.makeText(getActivity(), "识别失败,可以重新识别或则进行手动输入", Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), "识别失败,可以重新识别或则进行手动输入", Toast.LENGTH_SHORT).show();
} }
} }

View File

@ -86,7 +86,6 @@ import java.util.Objects;
* 2021-5-25 * 2021-5-25
*/ */
public class PoiFragment extends BaseDrawerFragment implements View.OnClickListener { public class PoiFragment extends BaseDrawerFragment implements View.OnClickListener {
private EditText editDescribe; private EditText editDescribe;
private RelativeLayout rlPanorama, rlName, rlInternalPhotos, rlCard, rlElse; private RelativeLayout rlPanorama, rlName, rlInternalPhotos, rlCard, rlElse;
private ImageView ivPanorama, ivName, ivInternal, ivCard, ivElse; private ImageView ivPanorama, ivName, ivInternal, ivCard, ivElse;
@ -104,10 +103,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
private RelativeLayout linearExist; private RelativeLayout linearExist;
private Spinner spinnerExist; private Spinner spinnerExist;
String poiAddressName = ""; String poiAddressName = "";
//获取的拍照图片 //获取的拍照图片
private LinearLayout linearContact; private LinearLayout linearContact;
private ContactView contactView; private ContactView contactView;
private ArrayList<File> poiPicList; private ArrayList<File> poiPicList;
@ -543,7 +539,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
public boolean onClick(BaseDialog baseDialog, View v) { public boolean onClick(BaseDialog baseDialog, View v) {
Constant.CODE = code; Constant.CODE = code;
Constant.TelLength = telLength; Constant.TelLength = telLength;
/* for (int i = 0; i < poiBeans.size(); i++) { /* for (int i = 0; i < poiBeans.size(); i++) {
poiBeans.get(i).setArea(Constant.CODE); poiBeans.get(i).setArea(Constant.CODE);
} }
contactView = new ContactView(getActivity(), linearContact, poiBeans); contactView = new ContactView(getActivity(), linearContact, poiBeans);
@ -552,8 +548,6 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
} }
}); });
} }
} else {
Toast.makeText(getActivity(), getPhoneBean.getMessage() + "", Toast.LENGTH_SHORT).show();
} }
} }
@ -816,6 +810,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
HttpParams httpParams = new HttpParams(); HttpParams httpParams = new HttpParams();
httpParams.put("auditId", body); httpParams.put("auditId", body);
OkGoBuilder.getInstance() OkGoBuilder.getInstance()
.Builder(getActivity())
.url(HttpInterface.POI_TASK_UPLOAD_PIC) .url(HttpInterface.POI_TASK_UPLOAD_PIC)
.cls(OtherUploadPicBean.class) .cls(OtherUploadPicBean.class)
.token(Constant.ACCESS_TOKEN) .token(Constant.ACCESS_TOKEN)

View File

@ -74,7 +74,6 @@ import java.util.Objects;
*/ */
public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClickListener { public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClickListener {
private EditText etRoadName; private EditText etRoadName;
private ImageView ivPoiVideoPicture; private ImageView ivPoiVideoPicture;
private EditText etDesc; private EditText etDesc;
@ -184,7 +183,6 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
btnRoadSave.setOnClickListener(this); btnRoadSave.setOnClickListener(this);
Button btnPoiVideoUpload = findViewById(R.id.btn_poi_video_upload); Button btnPoiVideoUpload = findViewById(R.id.btn_poi_video_upload);
btnPoiVideoUpload.setOnClickListener(this); btnPoiVideoUpload.setOnClickListener(this);
//添加数据 //添加数据
initShowPoi(); initShowPoi();
} }
@ -198,7 +196,6 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
if (name != null && !name.equals("")) { if (name != null && !name.equals("")) {
etRoadName.setText(name); etRoadName.setText(name);
} }
String geoWkt = showPoiEntity.getGeoWkt(); String geoWkt = showPoiEntity.getGeoWkt();
if (geoWkt!=null){ if (geoWkt!=null){
String geo = Geohash.getInstance().decode(geoWkt); String geo = Geohash.getInstance().decode(geoWkt);
@ -231,7 +228,6 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
moveLatlng(latLng, null); moveLatlng(latLng, null);
} }
} }
String describe = showPoiEntity.getMemo();//任务描述 String describe = showPoiEntity.getMemo();//任务描述
if (describe != null && !describe.equals("")) { if (describe != null && !describe.equals("")) {
etDesc.setText(describe); etDesc.setText(describe);

View File

@ -26,7 +26,6 @@ import java.util.Objects;
*/ */
public class RecordFragment extends BaseFragment implements View.OnClickListener { public class RecordFragment extends BaseFragment implements View.OnClickListener {
private final String[] names = {"待提交", "已提交"}; private final String[] names = {"待提交", "已提交"};
private StaySubmitFragment staySubmitFragment; // 待提交 private StaySubmitFragment staySubmitFragment; // 待提交
private HasSubmitFragment hasSubmitFragment;// 已提交 private HasSubmitFragment hasSubmitFragment;// 已提交

View File

@ -73,7 +73,6 @@ public class RegisterFragment extends BaseFragment implements View.OnClickListen
btnRegister.setOnClickListener(this); btnRegister.setOnClickListener(this);
} }
@Override @Override
protected void initData() { protected void initData() {
super.initData(); super.initData();

View File

@ -246,7 +246,6 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
} }
fmRoadPic.setTag(fileListByUUID); fmRoadPic.setTag(fileListByUUID);
} }
/* String[] photos = photoList.split(","); /* String[] photos = photoList.split(",");
List<File> videoFileList = new ArrayList<>(); List<File> videoFileList = new ArrayList<>();
boolean isImageLoad = false; boolean isImageLoad = false;
@ -374,7 +373,6 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
} else { } else {
Toast.makeText(getContext(), "有正在提交的数据,等提交成功后,方可操作", Toast.LENGTH_SHORT).show(); Toast.makeText(getContext(), "有正在提交的数据,等提交成功后,方可操作", Toast.LENGTH_SHORT).show();
} }
break; break;
} }
@ -564,7 +562,6 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
Log.d("TAG", "initRoadSharePre: " + newPoiEntity); Log.d("TAG", "initRoadSharePre: " + newPoiEntity);
} }
@Override @Override
public void onDestroyView() { public void onDestroyView() {
super.onDestroyView(); super.onDestroyView();

View File

@ -23,7 +23,6 @@ import java.util.Objects;
public class SetFragment extends BaseFragment implements View.OnClickListener { public class SetFragment extends BaseFragment implements View.OnClickListener {
private SharedPreferences.Editor navInfoEditor; private SharedPreferences.Editor navInfoEditor;
public static SetFragment newInstance(Bundle bundle) { public static SetFragment newInstance(Bundle bundle) {
SetFragment fragment = new SetFragment(); SetFragment fragment = new SetFragment();
fragment.setArguments(bundle); fragment.setArguments(bundle);

View File

@ -84,7 +84,6 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
roadDao = roadDatabase.getPoiDao(); roadDao = roadDatabase.getPoiDao();
ConstraintLayout clStayType = findViewById(R.id.cl_stay_type); ConstraintLayout clStayType = findViewById(R.id.cl_stay_type);
clStayType.setOnClickListener(this); clStayType.setOnClickListener(this);
RecyclerView stayXrv = findViewById(R.id.stay_xrv);
cbSelect = findViewById(R.id.cb_select); cbSelect = findViewById(R.id.cb_select);
cbSelect.setOnClickListener(this); cbSelect.setOnClickListener(this);
TextView tvDelete = findViewById(R.id.tv_delete); TextView tvDelete = findViewById(R.id.tv_delete);
@ -92,6 +91,7 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
tvStayType = findViewById(R.id.tv_stay_type); tvStayType = findViewById(R.id.tv_stay_type);
Button btnStaySubmit = findViewById(R.id.btn_stay_submit); Button btnStaySubmit = findViewById(R.id.btn_stay_submit);
btnStaySubmit.setOnClickListener(this); btnStaySubmit.setOnClickListener(this);
RecyclerView stayXrv = findViewById(R.id.stay_xrv);
stayXrv.setLayoutManager(new LinearLayoutManager(getActivity())); stayXrv.setLayoutManager(new LinearLayoutManager(getActivity()));
stayXrv.addItemDecoration(new DividerItemDecoration(Objects.requireNonNull(getContext()), DividerItemDecoration.VERTICAL)); stayXrv.addItemDecoration(new DividerItemDecoration(Objects.requireNonNull(getContext()), DividerItemDecoration.VERTICAL));
staySubmitAdapter = new StaySubmitAdapter(getContext()); staySubmitAdapter = new StaySubmitAdapter(getContext());
@ -104,12 +104,10 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
subObtain.what = Constant.EVENT_WORK_HOME; subObtain.what = Constant.EVENT_WORK_HOME;
subObtain.obj = true; subObtain.obj = true;
EventBus.getDefault().post(subObtain); EventBus.getDefault().post(subObtain);
Message obtain = Message.obtain(); Message obtain = Message.obtain();
obtain.what = Constant.EVENT_WHAT_COMPLETE_TASK; obtain.what = Constant.EVENT_WHAT_COMPLETE_TASK;
obtain.obj = poiEntity; obtain.obj = poiEntity;
EventBus.getDefault().post(obtain); EventBus.getDefault().post(obtain);
} }
}); });
//全选 //全选
@ -281,12 +279,10 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
Toast.makeText(getActivity(), response.getMessage() + "", Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), response.getMessage() + "", Toast.LENGTH_SHORT).show();
} }
} }
@Override @Override
public void onError(Throwable e, int id) { public void onError(Throwable e, int id) {
dismissLoadingDialog(); dismissLoadingDialog();
Toast.makeText(getActivity(), e.getMessage() + "", Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), e.getMessage() + "", Toast.LENGTH_SHORT).show();
} }
}); });
} }
@ -307,7 +303,6 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
} else { } else {
newEntities.clear(); newEntities.clear();
} }
new Thread(new Runnable() { new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
@ -317,7 +312,6 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
public void run() { public void run() {
roadEntities.clear(); roadEntities.clear();
roadEntities.addAll(roadAll); roadEntities.addAll(roadAll);
// for (int i = 0; i < roadAll.size(); i++) { // for (int i = 0; i < roadAll.size(); i++) {
// if (roadAll.get(i).getType()!=6){ // if (roadAll.get(i).getType()!=6){
// roadEntities.add(roadAll.get(i)); // roadEntities.add(roadAll.get(i));

View File

@ -69,7 +69,6 @@ public class TaskPrefectureFragment extends BaseFragment implements View.OnClick
taskPage=1; taskPage=1;
initNetwork(true); initNetwork(true);
} }
@Override @Override
public void onLoadMore() { public void onLoadMore() {
initNetwork(false); initNetwork(false);
@ -111,11 +110,9 @@ public class TaskPrefectureFragment extends BaseFragment implements View.OnClick
public void onSuccess(TaskPrefectureBean taskPrefectureBean, int id) { public void onSuccess(TaskPrefectureBean taskPrefectureBean, int id) {
dismissLoadingDialog(); dismissLoadingDialog();
initTaskPrefectureBean(taskPrefectureBean,aNet); initTaskPrefectureBean(taskPrefectureBean,aNet);
Log.d("TAG", "onSuccess: " + taskPrefectureBean.getMessage() + ""); Log.d("TAG", "onSuccess: " + taskPrefectureBean.getMessage() + "");
//initTaskSpecification(taskSpecificationBean,start); //initTaskSpecification(taskSpecificationBean,start);
} }
@Override @Override
public void onError(Throwable e, int id) { public void onError(Throwable e, int id) {
dismissLoadingDialog(); dismissLoadingDialog();

View File

@ -183,10 +183,8 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
* 刷新筛选界面数据 * 刷新筛选界面数据
*/ */
private void refreshFilterData() { private void refreshFilterData() {
String dataTime = sharedPreferences.getString("dataTime", null); String dataTime = sharedPreferences.getString("dataTime", null);
int type = sharedPreferences.getInt("type", 0); int type = sharedPreferences.getInt("type", 0);
if (type == 0) {//隐藏 if (type == 0) {//隐藏
ivMassNotification.setVisibility(View.GONE); ivMassNotification.setVisibility(View.GONE);
} else {//显示S } else {//显示S
@ -204,13 +202,9 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
if (result>=0){ if (result>=0){
//进行请求 //进行请求
initMessageNotice(); initMessageNotice();
}else { }else {//无需请求
//无需请求
} }
} }
Message msg = Message.obtain(); Message msg = Message.obtain();
msg.what = Constant.FILTER_DATA_CLEAR; msg.what = Constant.FILTER_DATA_CLEAR;
EventBus.getDefault().post(msg); EventBus.getDefault().post(msg);
@ -222,15 +216,11 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
} else { } else {
Toast.makeText(getActivity(), "未开启定位服务", Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), "未开启定位服务", Toast.LENGTH_SHORT).show();
} }
} }
/*
/**
* 给时间加上几个小时 * 给时间加上几个小时
*
* @param day 当前时间 格式yyyy-MM-dd HH:mm:ss * @param day 当前时间 格式yyyy-MM-dd HH:mm:ss
* @param hour 需要加的时间 * @param hour 需要加的时间
* @return
*/ */
public static String addDateMinot(String day, int hour) { public static String addDateMinot(String day, int hour) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@ -252,7 +242,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
Log.d("TAGss", "addDateMinut: " + format.format(date)); Log.d("TAGss", "addDateMinut: " + format.format(date));
cal = null; cal = null;
return format.format(date); return format.format(date);
} }
private void initMessageNotice() { private void initMessageNotice() {
@ -289,14 +278,12 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
Toast.makeText(getActivity(), messageNoticeBean.getMessage() + "", Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), messageNoticeBean.getMessage() + "", Toast.LENGTH_SHORT).show();
} }
} }
@Override @Override
public void onError(Throwable e, int id) { public void onError(Throwable e, int id) {
dismissLoadingDialog(); dismissLoadingDialog();
Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show();
} }
}); });
} }
@SuppressLint("CommitPrefEdits") @SuppressLint("CommitPrefEdits")
@ -306,14 +293,11 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
EventBus.getDefault().register(this); EventBus.getDefault().register(this);
sharedPreferences = Objects.requireNonNull(getActivity()).getSharedPreferences(Constant.MESSAGE_TYPE, Context.MODE_PRIVATE); sharedPreferences = Objects.requireNonNull(getActivity()).getSharedPreferences(Constant.MESSAGE_TYPE, Context.MODE_PRIVATE);
sharedEdit = sharedPreferences.edit(); sharedEdit = sharedPreferences.edit();
//fragment 管理器 //fragment 管理器
supportFragmentManager = Objects.requireNonNull(getActivity()).getSupportFragmentManager(); supportFragmentManager = Objects.requireNonNull(getActivity()).getSupportFragmentManager();
PoiDatabase poiDatabase = PoiDatabase.getInstance(getContext()); PoiDatabase poiDatabase = PoiDatabase.getInstance(getContext());
poiDao = poiDatabase.getPoiDao(); poiDao = poiDatabase.getPoiDao();
builder = new AlertDialog.Builder(Objects.requireNonNull(getActivity())); builder = new AlertDialog.Builder(Objects.requireNonNull(getActivity()));
sliding_layout = findViewById(R.id.sliding_layout); sliding_layout = findViewById(R.id.sliding_layout);
LinearLayout dragView = findViewById(R.id.dragView); LinearLayout dragView = findViewById(R.id.dragView);
frameLayout = findViewById(R.id.frame_layout); frameLayout = findViewById(R.id.frame_layout);
@ -340,7 +324,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
} else { } else {
tencentMap.setMapType(TencentMap.MAP_TYPE_NORMAL); tencentMap.setMapType(TencentMap.MAP_TYPE_NORMAL);
} }
} }
}); });
//地图放大 //地图放大
@ -393,7 +376,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
//检查是否有没有填完的页面 //检查是否有没有填完的页面
initSharePre(); initSharePre();
} }
@Override @Override
public void onCancel() { public void onCancel() {
} }
@ -410,7 +392,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
treasureMap.getLayoutParams().width = widthHeight[0]; treasureMap.getLayoutParams().width = widthHeight[0];
treasureMap.getLayoutParams().height = widthHeight[1]; treasureMap.getLayoutParams().height = widthHeight[1];
} }
/** /**
* 得到电话区号电话位数 * 得到电话区号电话位数
*/ */
@ -436,7 +417,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
Constant.TelLength = telLength; Constant.TelLength = telLength;
} }
} }
@Override @Override
public void onError(Throwable e, int id) { public void onError(Throwable e, int id) {
Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show();
@ -444,7 +424,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
}); });
} }
private static class NestedScrollableViewHelper extends ScrollableViewHelper { private static class NestedScrollableViewHelper extends ScrollableViewHelper {
public int getScrollableViewScrollPosition(View mScrollableView, boolean isSlidingUp) { public int getScrollableViewScrollPosition(View mScrollableView, boolean isSlidingUp) {
if (mScrollableView instanceof NestedScrollView) { if (mScrollableView instanceof NestedScrollView) {
@ -490,7 +469,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
Log.d("TAG", "onSuccess: " + response.getCode() + response.getMessage() + "" + response.getBody()); Log.d("TAG", "onSuccess: " + response.getCode() + response.getMessage() + "" + response.getBody());
} }
} }
@Override @Override
public void onError(Throwable e, int id) { public void onError(Throwable e, int id) {
Log.d("TAG", "onSuccess:" + e.getMessage() + ""); Log.d("TAG", "onSuccess:" + e.getMessage() + "");
@ -593,7 +571,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
if (latLineString != null && latLineString.size() > 0) { if (latLineString != null && latLineString.size() > 0) {
latLng = latLineString.get(0); latLng = latLineString.get(0);
} }
break; break;
case "Point": // case "Point": //
latLng = GeometryTools.createLatLng(geo); latLng = GeometryTools.createLatLng(geo);
@ -715,7 +692,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
LatLng lng = GeometryTools.createLatLng(key); LatLng lng = GeometryTools.createLatLng(key);
latList.add(lng); latList.add(lng);
} }
Message obtain = Message.obtain(); Message obtain = Message.obtain();
obtain.what = Constant.JOB_SEARCH_WORD; obtain.what = Constant.JOB_SEARCH_WORD;
obtain.obj = response; obtain.obj = response;
@ -723,9 +699,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
} else { } else {
Toast.makeText(getActivity(), response.getMessage(), Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), response.getMessage(), Toast.LENGTH_SHORT).show();
} }
} }
@Override @Override
public void onError(Throwable e, int id) { public void onError(Throwable e, int id) {
dismissLoadingDialog(); dismissLoadingDialog();
@ -775,7 +749,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
bitmapLine = BitmapDescriptorFactory.fromResource(R.drawable.road_arrows); bitmapLine = BitmapDescriptorFactory.fromResource(R.drawable.road_arrows);
} else if (poiEntity.getType() == 4) {//道路录像 } else if (poiEntity.getType() == 4) {//道路录像
bitmapLine = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_arrows); bitmapLine = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_arrows);
} }
List<LatLng> latLineString = GeometryTools.getLatLags(geo); List<LatLng> latLineString = GeometryTools.getLatLags(geo);
// 构造 PolylineOnions // 构造 PolylineOnions
@ -907,7 +880,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
if (poiEntity.getTaskStatus()==1){ if (poiEntity.getTaskStatus()==1){
color= Color.parseColor("#FFE70C"); color= Color.parseColor("#FFE70C");
}else { }else {
color= Color.parseColor("#7fffffff"); color= Color.parseColor("#BDBDBD");
} }
List<LatLng> latLineString = GeometryTools.getLatLags(geo); List<LatLng> latLineString = GeometryTools.getLatLags(geo);
// 构造 PolylineOnions // 构造 PolylineOnions
@ -1342,9 +1315,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
} }
} }
} }
/*
/**
* 控制主界面各个按钮的显示状态 * 控制主界面各个按钮的显示状态
*/ */
private void setMainButtonVisitable(int visitable) { private void setMainButtonVisitable(int visitable) {
@ -1357,9 +1328,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
ivFilter.setVisibility(visitable); ivFilter.setVisibility(visitable);
ivMessage.setVisibility(visitable); ivMessage.setVisibility(visitable);
} }
/*
/**
* 设置定位图标样式 * 设置定位图标样式
*/ */
private void setLocMarkerStyle() { private void setLocMarkerStyle() {
@ -1376,7 +1345,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
tencentMap.setMyLocationStyle(locationStyle); tencentMap.setMyLocationStyle(locationStyle);
} }
/** /*
* 定位的一些初始化设置 * 定位的一些初始化设置
*/ */
private void initLocation() { private void initLocation() {
@ -1649,7 +1618,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
Toast.makeText(getActivity(), "申请权限失败", Toast.LENGTH_SHORT).show(); Toast.makeText(getActivity(), "申请权限失败", Toast.LENGTH_SHORT).show();
} }
} }
@Override @Override
public void onDenied(List<String> permissions, boolean never) { public void onDenied(List<String> permissions, boolean never) {
if (never) { if (never) {
@ -1688,27 +1656,30 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
//多点 //多点
MultiPoint multiPoint = GeometryTools.createMultiPoint(latList); MultiPoint multiPoint = GeometryTools.createMultiPoint(latList);
//拿到覆蓋點 //拿到覆蓋點
Geometry intersection = polygon.intersection(multiPoint); if (multiPoint == null) {
if (intersection == null) {
initEntity(marker, true); initEntity(marker, true);
} else { } else {
if (intersection.getGeometryType().equals("MultiPoint")) { Geometry intersection = polygon.intersection(multiPoint);
List<LatLng> latList = GeometryTools.getLatList(intersection); if (intersection!=null){
for (int i = 0; i < latList.size(); i++) { if (intersection.getGeometryType().equals("MultiPoint")) {
LatLng latL = latList.get(i); List<LatLng> latList = GeometryTools.getLatList(intersection);
Geometry geometry = GeometryTools.createGeometry(latL); for (int i = 0; i < latList.size(); i++) {
Log.d("TAG", "onMarkerClick: " + geometry.toString()); LatLng latL = latList.get(i);
List<Marker> markerList = removableHashMap.get(geometry.toText()); Geometry geometry = GeometryTools.createGeometry(latL);
if (markerList != null) { Log.d("TAG", "onMarkerClick: " + geometry.toString());
for (Marker mar : markerList) { List<Marker> markerList = removableHashMap.get(geometry.toText());
initEntity(mar, false); if (markerList != null) {
for (Marker mar : markerList) {
initEntity(mar, false);
}
} }
} }
customDialog(poiEntityArrayList, marker);
} else {
initEntity(marker, true);
} }
customDialog(poiEntityArrayList, marker);
} else {
initEntity(marker, true);
} }
} }
return false; return false;
} }
@ -1971,7 +1942,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
}); });
} }
@Override @Override
public void onConfigurationChanged(@NonNull Configuration newConfig) { public void onConfigurationChanged(@NonNull Configuration newConfig) {
super.onConfigurationChanged(newConfig); super.onConfigurationChanged(newConfig);

View File

@ -32,7 +32,6 @@ import java.util.Objects;
*/ */
public class VideoFragment extends BaseFragment implements View.OnClickListener { public class VideoFragment extends BaseFragment implements View.OnClickListener {
private ArrayList<FileBean> fileBeans; private ArrayList<FileBean> fileBeans;
private ArrayList<FileBean> deleteFiles; private ArrayList<FileBean> deleteFiles;
private VideoAdapter videoAdapter; private VideoAdapter videoAdapter;

View File

@ -1,5 +1,6 @@
package com.navinfo.outdoor.fragment; package com.navinfo.outdoor.fragment;
import android.annotation.SuppressLint;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; import android.util.Log;
@ -98,16 +99,16 @@ public class WithdrawFragment extends BaseFragment implements View.OnClickListen
}); });
Button btWithdraw = findViewById(R.id.button); Button btWithdraw = findViewById(R.id.button);
btWithdraw.setOnClickListener(this); btWithdraw.setOnClickListener(this);
poiPushMoney = (TextView) findViewById(R.id.poi_push_money); poiPushMoney = findViewById(R.id.poi_push_money);
poiReportMoney = (TextView) findViewById(R.id.poi_report_money); poiReportMoney = findViewById(R.id.poi_report_money);
poiVideoPushMoney = (TextView) findViewById(R.id.poiVideo_push_money); poiVideoPushMoney = findViewById(R.id.poiVideo_push_money);
poiVideoReportMoney = (TextView) findViewById(R.id.poiVideo_report_money); poiVideoReportMoney = findViewById(R.id.poiVideo_report_money);
roadPushMoney = (TextView) findViewById(R.id.road_push_money); roadPushMoney = findViewById(R.id.road_push_money);
roadReportMoney = (TextView) findViewById(R.id.road_report_money); roadReportMoney = findViewById(R.id.road_report_money);
chargingPushMoney = (TextView) findViewById(R.id.charging_push_money); chargingPushMoney = findViewById(R.id.charging_push_money);
chargingReportMoney = (TextView) findViewById(R.id.charging_report_money); chargingReportMoney = findViewById(R.id.charging_report_money);
otherPushMoney = (TextView) findViewById(R.id.other_push_money); otherPushMoney = findViewById(R.id.other_push_money);
otherReportMoney = (TextView) findViewById(R.id.other_report_money); otherReportMoney = findViewById(R.id.other_report_money);
initNetWork(); initNetWork();
} }
@ -120,6 +121,7 @@ public class WithdrawFragment extends BaseFragment implements View.OnClickListen
.token(Constant.ACCESS_TOKEN) .token(Constant.ACCESS_TOKEN)
.params(new HttpParams()) .params(new HttpParams())
.getRequest(new Callback<GetPriceBean>() { .getRequest(new Callback<GetPriceBean>() {
@SuppressLint("SetTextI18n")
@Override @Override
public void onSuccess(GetPriceBean response, int id) { public void onSuccess(GetPriceBean response, int id) {
dismissLoadingDialog(); dismissLoadingDialog();
@ -149,7 +151,7 @@ public class WithdrawFragment extends BaseFragment implements View.OnClickListen
@Override @Override
public void onError(Throwable e, int id) { public void onError(Throwable e, int id) {
dismissLoadingDialog(); dismissLoadingDialog();
// Toast.makeText(getContext(), "获取失败" + e.getMessage(), Toast.LENGTH_SHORT).show(); Toast.makeText(getContext(), "获取失败" + e.getMessage(), Toast.LENGTH_SHORT).show();
Log.d("TAG", "onError: " + e.getMessage()); Log.d("TAG", "onError: " + e.getMessage());
} }
}); });

View File

@ -3,9 +3,9 @@ package com.navinfo.outdoor.http;
import com.navinfo.outdoor.api.Constant; import com.navinfo.outdoor.api.Constant;
public class HttpInterface { public class HttpInterface {
public static final String IP = "http://dtxbmaps.navinfo.com/dtxb/m4";//正式接口 public static final String IP = "http://dtxbmaps.navinfo.com/dtxb/m4";//正式接口T
public static final String DATA_IP = "http://172.23.139.4:9999/m4";//接口 public static final String DATA_IP = "http://172.23.139.4:9999/m4";//接口
public static final String IP_TEXt = "http://dtxbmaps.navinfo.com/dtxb_test/m4";//测试接口 public static final String IP_TEXT = "http://dtxbmaps.navinfo.com/dtxb_test/m4";//测试接口
public static final String TEST_GUIDANCE_IP = "http://172.21.98.90:9999/m4";//引导页完成接口 public static final String TEST_GUIDANCE_IP = "http://172.21.98.90:9999/m4";//引导页完成接口
public static final String APKIP = "http://172.23.139.4:8001/"; public static final String APKIP = "http://172.23.139.4:8001/";
public static final String USER_PATH = "/user/";//我的 public static final String USER_PATH = "/user/";//我的

View File

@ -130,11 +130,14 @@ public class OkGoBuilder<T> {
callback.onError(new Throwable("网络不可用"),2); callback.onError(new Throwable("网络不可用"),2);
return; return;
} }
long time = System.currentTimeMillis();
params.put("datetime", time);
OkGo OkGo
.<T>post(url) .<T>post(url)
.isMultipart(true) .isMultipart(true)
.headers(getHeader()) .headers(getHeader())
.upString(json, MediaType.parse("application/json")) .upString(json, MediaType.parse("application/json"))
.params(params)
.tag(this) .tag(this)
.execute(new DialogCallback<T>(clazz) { .execute(new DialogCallback<T>(clazz) {
@Override @Override
@ -162,8 +165,6 @@ public class OkGoBuilder<T> {
}); });
} }
/** /**
* post异步请求 * post异步请求
*/ */

View File

@ -13,7 +13,18 @@ import com.navinfo.outdoor.api.Constant;
import com.navinfo.outdoor.util.SdkFolderCreate; import com.navinfo.outdoor.util.SdkFolderCreate;
import java.io.File; import java.io.File;
/*
* (1) 使用entities来映射相关的实体类
* (2) version来指明当前数据库的版本号
* (3) 使用了单例模式来返回Database以防止新建过多的实例造成内存的浪费
*4Room.databaseBuilder(context,class,name).build()来创建Database
* 其中第一个参数为上下文
* 第二个参数为当前Database的class字节码文件
* 第三个参数为数据库名称
* 注意事项默认情况下Database是不可以在主线程中进行调用的
* 因为大部分情况操作数据库都还算是比较耗时的动作
* 如果需要在主线程调用则使用allowMainThreadQueries进行说明
*/
@Database(entities = {PoiEntity.class,ChargingPileEntity.class}, version = 2, exportSchema = false) @Database(entities = {PoiEntity.class,ChargingPileEntity.class}, version = 2, exportSchema = false)
public abstract class PoiDatabase extends RoomDatabase { public abstract class PoiDatabase extends RoomDatabase {
private static final String DB_NAME = "navinfo.db"; private static final String DB_NAME = "navinfo.db";

View File

@ -45,8 +45,8 @@ public class PoiEntity implements Serializable {
private int taskStatus;//任务状态 0.未领取 1.已领取5 立即采集2.未保存(保存到本地但未提交成功),3.已保存(保存到本地提交成功)4已上传结束采集 private int taskStatus;//任务状态 0.未领取 1.已领取5 立即采集2.未保存(保存到本地但未提交成功),3.已保存(保存到本地提交成功)4已上传结束采集
private int type;//1 "POI"2 "充电站"3 "POI录像"4 "道路录像"5 "其他"6 "面状任务" private int type;//1 "POI"2 "充电站"3 "POI录像"4 "道路录像"5 "其他"6 "面状任务"
private int station_type;//1."充电站"2 "充换电站"3 "充电桩组"4 "换电站"5 "门牌", "公交:6 情报:7 private int station_type;//1."充电站"2 "充换电站"3 "充电桩组"4 "换电站"5 "门牌", "公交:6 情报:7
private int isLocalData;// private int isLocalData;//是否是本地数据 0,服务 1,本地
private int isExclusive;//任务类型 0.普通任务1.专属任务 private int isExclusive;//任务类型 0.普通任务1.专属任务 2挑战任务, 3奖励任务
private int bodyId;//保存本地的bodyId private int bodyId;//保存本地的bodyId
private int work_type;//0."车行" 1."自行车" 2."步行" private int work_type;//0."车行" 1."自行车" 2."步行"
private int record_way; //等同于 canReceived : 1是可领取 0是不可领取 private int record_way; //等同于 canReceived : 1是可领取 0是不可领取

View File

@ -17,33 +17,35 @@ import javax.crypto.NoSuchPaddingException;
public class Geohash { public class Geohash {
private Geohash(){} private Geohash() {
}
private static class GeorasInstance { private static class GeorasInstance {
private static final Geohash INSTANCE = new Geohash(); private static final Geohash INSTANCE = new Geohash();
} }
public static Geohash getInstance(){ public static Geohash getInstance() {
return GeorasInstance.INSTANCE; return GeorasInstance.INSTANCE;
} }
private static int nubbins = 6 * 5; private static int nubbins = 6 * 5;
/* /*
* final static char[] digits = { '0', '1', '2', '3', '4', '5', '6', '7', * final static char[] digits = { '0', '1', '2', '3', '4', '5', '6', '7',
* '8', '9', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'j', 'k', 'm', 'n', 'p', * '8', '9', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'j', 'k', 'm', 'n', 'p',
* 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' }; * 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' };
*/ */
// 为了加密所以改了base32编码代码表 // 为了加密所以改了base32编码代码表
final static char[] digits = { 'd', 'f', 'g', 'y', 'n', 't', 'u', 'v', 'q', final static char[] digits = {'d', 'f', 'g', 'y', 'n', 't', 'u', 'v', 'q',
'b', '9', 's', 'z', '7', 'i', '2', 'h', '5', '0', 'p', '4', 'm', 'b', '9', 's', 'z', '7', 'i', '2', 'h', '5', '0', 'p', '4', 'm',
'8', 'x', 'c', 'j', '6', 'e', '1', 'r', '3', 'k' }; '8', 'x', 'c', 'j', '6', 'e', '1', 'r', '3', 'k'};
final static HashMap<Character, Integer> lookup = new HashMap<Character, Integer>(); final static HashMap<Character, Integer> lookup = new HashMap<Character, Integer>();
static {
int i = 0; static {
for (char c : digits) int i = 0;
lookup.put(c, i++); for (char c : digits)
} lookup.put(c, i++);
}
// public static void main(String[] args) { // public static void main(String[] args) {
// String s = "1rn7exd5uhxy"; // String s = "1rn7exd5uhxy";
@ -53,12 +55,13 @@ public class Geohash {
// System.out.println(new Geohash().encode(40.073556024581194, 116.24643344432116)); // System.out.println(new Geohash().encode(40.073556024581194, 116.24643344432116));
// } // }
//数据解密 //数据解密
/**
* @param geohash 需要被解密的字符串 /**
* @return double[] 经纬度double数组纬度(latitude)在前,经度在后(longitude) * @param geohash 需要被解密的字符串
* */ * @return double[] 经纬度double数组纬度(latitude)在前,经度在后(longitude)
public String decode(String geohash) { */
public String decode(String geohash) {
// try { // try {
// StringBuilder buffer = new StringBuilder(); // StringBuilder buffer = new StringBuilder();
// for (char c : geohash.toCharArray()) { // for (char c : geohash.toCharArray()) {
@ -100,99 +103,100 @@ public class Geohash {
// re.printStackTrace(); // re.printStackTrace();
// return null; // return null;
// } // }
try { try {
return Base64.desDecrypt(geohash); return Base64.desDecrypt(geohash);
} catch (UnsupportedEncodingException e) { } catch (UnsupportedEncodingException e) {
e.printStackTrace(); e.printStackTrace();
} catch (NoSuchAlgorithmException e) { } catch (NoSuchAlgorithmException e) {
e.printStackTrace(); e.printStackTrace();
} catch (NoSuchPaddingException e) { } catch (NoSuchPaddingException e) {
e.printStackTrace(); e.printStackTrace();
} catch (InvalidKeyException e) { } catch (InvalidKeyException e) {
e.printStackTrace(); e.printStackTrace();
} catch (InvalidAlgorithmParameterException e) { } catch (InvalidAlgorithmParameterException e) {
e.printStackTrace(); e.printStackTrace();
} catch (IllegalBlockSizeException e) { } catch (IllegalBlockSizeException e) {
e.printStackTrace(); e.printStackTrace();
} catch (BadPaddingException e) { } catch (BadPaddingException e) {
e.printStackTrace(); e.printStackTrace();
} }
return null; return null;
} }
private double decode(BitSet bs, double floor, double ceiling) { private double decode(BitSet bs, double floor, double ceiling) {
double mid = 0; double mid = 0;
for (int i = 0; i < bs.length(); i++) { for (int i = 0; i < bs.length(); i++) {
mid = (floor + ceiling) / 2; mid = (floor + ceiling) / 2;
if (bs.get(i)) if (bs.get(i))
floor = mid; floor = mid;
else else
ceiling = mid; ceiling = mid;
} }
return mid; return mid;
} }
//数据加密 //数据加密
/**
* @param lat,lon 需要被加密的double
* */
public String encode(double lat, double lon) {
// BitSet latbits = getBits(lat, -90, 90);
// BitSet lonbits = getBits(lon, -180, 180);
// StringBuilder buffer = new StringBuilder();
// for (int i = 0; i < numbits; i++) {
// buffer.append((lonbits.get(i)) ? '1' : '0');
// buffer.append((latbits.get(i)) ? '1' : '0');
// }
Geometry geometry = GeometryTools.createGeometry(new LatLng(lat, lon));
try {
return Base64.desEncrypt(geometry.toString());
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public String encodeList(List<LatLng> latLngs){
String lineString = GeometryTools.getLineString(latLngs);
try {
return Base64.desEncrypt(lineString);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
private BitSet getBits(double lat, double floor, double ceiling) { /**
BitSet buffer = new BitSet(nubbins); * @param lat,lon 需要被加密的double
for (int i = 0; i < nubbins; i++) { */
double mid = (floor + ceiling) / 2; public String encode(double lat, double lon) {
if (lat >= mid) { /*BitSet latbits = getBits(lat, -90, 90);
buffer.set(i); BitSet lonbits = getBits(lon, -180, 180);
floor = mid; StringBuilder buffer = new StringBuilder();
} else { for (int i = 0; i < numbits; i++) {
ceiling = mid; buffer.append((lonbits.get(i)) ? '1' : '0');
} buffer.append((latbits.get(i)) ? '1' : '0');
} }*/
return buffer; Geometry geometry = GeometryTools.createGeometry(new LatLng(lat, lon));
} try {
return Base64.desEncrypt(geometry.toString());
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public static String base32(long i) { public String encodeList(List<LatLng> latLngs) {
char[] buf = new char[65]; String lineString = GeometryTools.getLineString(latLngs);
int charPos = 64; try {
boolean negative = (i < 0); return Base64.desEncrypt(lineString);
if (!negative) } catch (Exception e) {
i = -i; e.printStackTrace();
while (i <= -32) { }
buf[charPos--] = digits[(int) (-(i % 32))]; return null;
i /= 32; }
}
buf[charPos] = digits[(int) (-i)];
if (negative) private BitSet getBits(double lat, double floor, double ceiling) {
buf[--charPos] = '-'; BitSet buffer = new BitSet(nubbins);
return new String(buf, charPos, (65 - charPos)); for (int i = 0; i < nubbins; i++) {
} double mid = (floor + ceiling) / 2;
if (lat >= mid) {
buffer.set(i);
floor = mid;
} else {
ceiling = mid;
}
}
return buffer;
}
public static String base32(long i) {
char[] buf = new char[65];
int charPos = 64;
boolean negative = (i < 0);
if (!negative)
i = -i;
while (i <= -32) {
buf[charPos--] = digits[(int) (-(i % 32))];
i /= 32;
}
buf[charPos] = digits[(int) (-i)];
if (negative)
buf[--charPos] = '-';
return new String(buf, charPos, (65 - charPos));
}
} }

View File

@ -44,7 +44,6 @@ public class GeometryTools {
/** /**
* 返回点几何 * 返回点几何
*
* @param gp * @param gp
* @return Geometry * @return Geometry
*/ */
@ -62,7 +61,6 @@ public class GeometryTools {
/** /**
* 返回点几何 * 返回点几何
* @param gp
* @param formatDouble5 * @param formatDouble5
* @return Geometry * @return Geometry
*/ */
@ -78,9 +76,7 @@ public class GeometryTools {
Geometry geo = factory.createPoint(coordinate); Geometry geo = factory.createPoint(coordinate);
return geo; return geo;
} }
return null; return null;
} }
public static Geometry createGeometry(double[] coor) { public static Geometry createGeometry(double[] coor) {
@ -90,14 +86,11 @@ public class GeometryTools {
Geometry geo = factory.createPoint(coordinate); Geometry geo = factory.createPoint(coordinate);
return geo; return geo;
} }
return null; return null;
} }
/** /*
* 获取多面 * 获取多面
*
* @param polygons * @param polygons
* @return * @return
*/ */
@ -106,21 +99,16 @@ public class GeometryTools {
return null; return null;
MultiPolygon multiPolygon = null; MultiPolygon multiPolygon = null;
GeometryFactory factory = new GeometryFactory(); GeometryFactory factory = new GeometryFactory();
try { try {
multiPolygon = factory.createMultiPolygon(polygons); multiPolygon = factory.createMultiPolygon(polygons);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
return multiPolygon; return multiPolygon;
} }
/** /*
* 获取多线 * 获取多线
*
* @param lineStrings * @param lineStrings
* @return * @return
*/ */
@ -141,10 +129,10 @@ public class GeometryTools {
return multiLineString; return multiLineString;
} }
/** /*
* 创建集合 * 创建集合
* *
* @param coords [] * @param Coordinate []
* @return Geometry * @return Geometry
*/ */
public MultiPoint createMultiPoint(Coordinate[] coords) { public MultiPoint createMultiPoint(Coordinate[] coords) {
@ -179,27 +167,21 @@ public class GeometryTools {
return null; return null;
MultiPoint createMultiPoint = null; MultiPoint createMultiPoint = null;
GeometryFactory factory = new GeometryFactory(); GeometryFactory factory = new GeometryFactory();
try { try {
Coordinate[] coords = new Coordinate[list.size()]; Coordinate[] coords = new Coordinate[list.size()];
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
coords[i] = new Coordinate(list.get(i).getLongitude(), list.get(i).getLatitude()); coords[i] = new Coordinate(list.get(i).getLongitude(), list.get(i).getLatitude());
} }
createMultiPoint = factory.createMultiPoint(coords); createMultiPoint = factory.createMultiPoint(coords);
} catch (Exception e) { } catch (Exception e) {
e.getLocalizedMessage();
} }
return createMultiPoint; return createMultiPoint;
} }
/** /*
* 返回点几何 * 返回点几何
* *
* @param wkt * @param wkt
@ -211,16 +193,12 @@ public class GeometryTools {
return null; return null;
WKTReader reader = new WKTReader(); WKTReader reader = new WKTReader();
Geometry geometry; Geometry geometry;
try { try {
geometry = reader.read(wkt); geometry = reader.read(wkt);
if (geometry != null) { if (geometry != null) {
return geometry; return geometry;
} }
} catch (Exception e) { } catch (Exception e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
@ -229,10 +207,10 @@ public class GeometryTools {
return null; return null;
} }
/** /*
* 创建多边形几何 * 创建多边形几何
* *
* @param coords [] * @param Coordinate []
* @return Geometry * @return Geometry
*/ */
public static String createPolygon(Coordinate[] coords) { public static String createPolygon(Coordinate[] coords) {
@ -245,9 +223,8 @@ public class GeometryTools {
return gon.toString(); return gon.toString();
} }
/** /*
* 创建多边形几何 * 创建多边形几何
*
* @param LatLngList * @param LatLngList
* @return Polygon * @return Polygon
*/ */
@ -263,25 +240,21 @@ public class GeometryTools {
return null; return null;
} }
/* *//** /*
* 创建线 * 创建线
* * @param coords []
* @param coords
* []
* @return Geometry * @return Geometry
* * */
* *//* /*
public String createLineString(Coordinate[] coords) { public String createLineString(Coordinate[] coords) {
LineString lineString = null; LineString lineString = null;
GeometryFactory factory = new GeometryFactory(); GeometryFactory factory = new GeometryFactory();
lineString = factory.createLineString(coords); lineString = factory.createLineString(coords);
return lineString.toString(); return lineString.toString();
} }*/
*/
/** /*
* 创建线 * 创建线
*
* @param coords [] * @param coords []
* @return Geometry * @return Geometry
*/ */
@ -365,9 +338,8 @@ public class GeometryTools {
return null; return null;
} }
/** /*
* 计算两点距离 * 计算两点距离
*
* @param startLatLng * @param startLatLng
* @param endLatLng * @param endLatLng
* @return double:单位 * @return double:单位
@ -437,8 +409,7 @@ public class GeometryTools {
y = (point2.getLatitude() - point1.getLatitude()) * dx; y = (point2.getLatitude() - point1.getLatitude()) * dx;
y = point2.getLatitude() - y; y = point2.getLatitude() - y;
} }
LatLng LatLng = new LatLng(y, x); return new LatLng(y, x);
return LatLng;
} else { } else {
if (total - a < 4) { if (total - a < 4) {
return points.get(i + 1); return points.get(i + 1);
@ -528,10 +499,9 @@ public class GeometryTools {
return null; return null;
} }
/** /*
* LINESTRING (116.4206899999999933 39.9620999999999995, * LINESTRING (116.4206899999999933 39.9620999999999995,
* 116.4184900000000056 39.9620600000000010) * 116.4184900000000056 39.9620600000000010)
*
* @param str * @param str
* @return * @return
*/ */
@ -543,9 +513,9 @@ public class GeometryTools {
if (geometry != null) { if (geometry != null) {
Coordinate[] coordinates = geometry.getCoordinates(); Coordinate[] coordinates = geometry.getCoordinates();
if (coordinates != null && coordinates.length > 0) { if (coordinates != null && coordinates.length > 0) {
list = new ArrayList<LatLng>(); list = new ArrayList<>();
for (Coordinate coor : coordinates) { for (Coordinate color : coordinates) {
list.add(new LatLng(coor.y, coor.x)); list.add(new LatLng(color.y, color.x));
} }
} }
} }
@ -557,8 +527,8 @@ public class GeometryTools {
Coordinate[] coordinates = geo.getCoordinates(); Coordinate[] coordinates = geo.getCoordinates();
if (coordinates != null && coordinates.length > 0) { if (coordinates != null && coordinates.length > 0) {
list = new ArrayList<LatLng>(); list = new ArrayList<LatLng>();
for (Coordinate coor : coordinates) { for (Coordinate color : coordinates) {
list.add(new LatLng(coor.y, coor.x)); list.add(new LatLng(color.y, color.x));
} }
} }
return list; return list;
@ -579,7 +549,6 @@ public class GeometryTools {
} }
public static String getLineString(List<LatLng> list) { public static String getLineString(List<LatLng> list) {
if (list != null && list.size() > 1) { if (list != null && list.size() > 1) {
int size = list.size(); int size = list.size();
Coordinate[] coors = new Coordinate[size]; Coordinate[] coors = new Coordinate[size];
@ -612,9 +581,8 @@ public class GeometryTools {
return null; return null;
} }
/** /*
* 获取线型 * 获取线型
*
* @param list * @param list
* @return * @return
*/ */
@ -632,9 +600,8 @@ public class GeometryTools {
return null; return null;
} }
/** /*
* 获取线型 * 获取线型
*
* @param coors * @param coors
* @return * @return
*/ */
@ -777,14 +744,13 @@ public class GeometryTools {
return null; return null;
} }
/** /*
* 角度变换 * 角度变换
* *
* @param angle * @param angle
* @return angle; * @return angle;
*/ */
public double angleSwap(double angle) { public double angleSwap(double angle) {
if (angle >= 180) if (angle >= 180)
angle = angle - 180; angle = angle - 180;
else else
@ -793,7 +759,7 @@ public class GeometryTools {
return angle; return angle;
} }
/** /*
* 是否第一个点 * 是否第一个点
* *
* @param lineString * @param lineString
@ -819,7 +785,7 @@ public class GeometryTools {
return false; return false;
} }
/** /*
* 是否最后点 * 是否最后点
* *
* @param lineString * @param lineString

View File

@ -4,12 +4,21 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">
<EditText
android:id="@+id/editText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/rlv_bank" android:id="@+id/rlv_bank"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="30dp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toBottomOf="@+id/editText" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -1,13 +1,15 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content">
xmlns:app="http://schemas.android.com/apk/res-auto">
<TextView <TextView
android:layout_width="match_parent" android:id="@+id/tv_bank"
android:layout_height="50dp" android:layout_width="match_parent"
android:gravity="center_vertical" android:layout_height="50dp"
app:layout_constraintTop_toTopOf="parent" android:layout_marginStart="20dp"
android:layout_marginLeft="20dp" android:gravity="center_vertical"
android:id="@+id/tv_bank"/> app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>