修改剩余bug
This commit is contained in:
parent
15a09d0934
commit
e9b39a9d5a
@ -3,7 +3,7 @@ apply plugin: 'com.android.application'
|
||||
android {
|
||||
compileSdkVersion 29
|
||||
buildToolsVersion '29.0.2'
|
||||
ndkVersion '23.0.7123448'
|
||||
// ndkVersion '23.0.7123448'
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.navinfo.outdoor"
|
||||
|
@ -1,33 +1,48 @@
|
||||
package com.navinfo.outdoor.base;
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
import android.location.Location;
|
||||
import android.os.Bundle;
|
||||
import android.os.Message;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.navinfo.outdoor.R;
|
||||
import com.navinfo.outdoor.api.Constant;
|
||||
import com.navinfo.outdoor.util.FragmentBackHandler;
|
||||
import com.navinfo.outdoor.util.GPSUtils;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
/**
|
||||
* 管理寻宝页面的抽屉中的fragment
|
||||
*/
|
||||
public abstract class BaseDrawerFragment extends BaseFragment {
|
||||
public boolean isSliding=true; // fragment被销毁时,true-抽屉收回,false-抽屉状态不变
|
||||
public abstract class BaseDrawerFragment extends BaseFragment {
|
||||
public boolean isSliding = true; // fragment被销毁时,true-抽屉收回,false-抽屉状态不变
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
super.initData();
|
||||
int mockGps = Constant.currentLocation.isMockGps();
|
||||
//1为是,0为否,-1为无法判断
|
||||
if (mockGps == 1) {
|
||||
onBackPressed();
|
||||
} else {
|
||||
new GPSUtils(getActivity());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initEvent() {
|
||||
super.initEvent();
|
||||
isSliding=true;
|
||||
isSliding = true;
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what= Constant.MAIN_BUTTON_VISIABLE;
|
||||
obtain.obj= View.GONE;
|
||||
obtain.what = Constant.MAIN_BUTTON_VISIABLE;
|
||||
obtain.obj = View.GONE;
|
||||
EventBus.getDefault().post(obtain);
|
||||
|
||||
}
|
||||
@ -45,7 +60,7 @@ public abstract class BaseDrawerFragment extends BaseFragment {
|
||||
if (hidden) {
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.MAIN_REMOVE;
|
||||
obtain.obj =true;
|
||||
obtain.obj = true;
|
||||
EventBus.getDefault().post(obtain);
|
||||
}
|
||||
}
|
||||
@ -54,23 +69,24 @@ public abstract class BaseDrawerFragment extends BaseFragment {
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
Bundle arguments = getArguments();
|
||||
if (arguments!=null) {
|
||||
isSliding= arguments.getBoolean("isSliding",true);
|
||||
Log.d("TAG", "onCreatessss: "+isSliding);
|
||||
if (arguments != null) {
|
||||
isSliding = arguments.getBoolean("isSliding", true);
|
||||
Log.d("TAG", "onCreatessss: " + isSliding);
|
||||
}
|
||||
if (isSliding) {
|
||||
// 监听到返回按钮点击事件
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what= Constant.TREASURE_FRAGMENT;
|
||||
obtain.obj=isSliding;
|
||||
obtain.what = Constant.TREASURE_FRAGMENT;
|
||||
obtain.obj = isSliding;
|
||||
EventBus.getDefault().post(obtain);
|
||||
Message mainButtonVisiableMsg = Message.obtain();
|
||||
mainButtonVisiableMsg.what= Constant.MAIN_BUTTON_VISIABLE;
|
||||
mainButtonVisiableMsg.obj= View.VISIBLE;
|
||||
mainButtonVisiableMsg.what = Constant.MAIN_BUTTON_VISIABLE;
|
||||
mainButtonVisiableMsg.obj = View.VISIBLE;
|
||||
EventBus.getDefault().post(mainButtonVisiableMsg);
|
||||
}
|
||||
initRemovePoiSharePre();
|
||||
}
|
||||
|
||||
public void initRemovePoiSharePre() {
|
||||
//获取SharedPreferences对象,方法中两个参数的意思为:第一个name
|
||||
//表示文件名,系统将会在/dada/dada/包名/shared_prefs目录下生成
|
||||
|
@ -118,7 +118,7 @@ public class JobSearchBean implements Serializable {
|
||||
private int id;
|
||||
private String name;
|
||||
private String address;
|
||||
private int telephone;
|
||||
private String telephone;
|
||||
private String geo;
|
||||
private String price;
|
||||
private String type;
|
||||
@ -148,11 +148,11 @@ public class JobSearchBean implements Serializable {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public int getTelephone() {
|
||||
public String getTelephone() {
|
||||
return telephone;
|
||||
}
|
||||
|
||||
public void setTelephone(int telephone) {
|
||||
public void setTelephone(String telephone) {
|
||||
this.telephone = telephone;
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@ import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@ -67,7 +68,8 @@ import static android.app.Activity.RESULT_OK;
|
||||
* 2021-5-25
|
||||
*/
|
||||
public class ChargingPileFragment extends BaseDrawerFragment implements View.OnClickListener {
|
||||
private EditText editDescribe, editNameContent;
|
||||
private EditText editDescribe;
|
||||
private TextView tvNameContent;
|
||||
private Button btnSaveLocal;
|
||||
private PoiDatabase poiDatabase;
|
||||
private CheckBox checkBoxLife, checkBoxRight;
|
||||
@ -88,7 +90,6 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
private long pid;
|
||||
private String station;
|
||||
private LatLng latLng;
|
||||
private LatLng poiLatLng;
|
||||
private String takePhotoPath1;
|
||||
private String takePhotoPath2;
|
||||
private String takePhotoPath3;
|
||||
@ -169,7 +170,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
checkBoxLife.setTextColor(Color.WHITE);
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.MAIN_CHARGING_PILE;
|
||||
obtain.obj = poiLatLng;
|
||||
obtain.obj = latLng;
|
||||
EventBus.getDefault().post(obtain);
|
||||
}else {
|
||||
checkBoxLife.setText("编辑");
|
||||
@ -182,7 +183,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
}
|
||||
});
|
||||
checkBoxRight.setVisibility(View.GONE);
|
||||
editNameContent = findViewById(R.id.tv_name_content);
|
||||
tvNameContent = findViewById(R.id.tv_name_content);
|
||||
checkButton1 = findViewById(R.id.check_button1);
|
||||
checkButton1.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
@ -400,9 +401,9 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
String x = poiEntity.getX();
|
||||
String y = poiEntity.getY();
|
||||
if (x != null && y != null) {
|
||||
poiLatLng = new LatLng();
|
||||
poiLatLng.setLatitude(Double.parseDouble(y));
|
||||
poiLatLng.setLongitude(Double.parseDouble(x));
|
||||
latLng = new LatLng();
|
||||
latLng.setLatitude(Double.parseDouble(y));
|
||||
latLng.setLongitude(Double.parseDouble(x));
|
||||
}
|
||||
|
||||
}
|
||||
@ -411,12 +412,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
if (chargingPileEntity != null) {
|
||||
String name = chargingPileEntity.getName();//名称
|
||||
if (name != null) {
|
||||
editNameContent.setText(name + "");
|
||||
}
|
||||
if (editNameContent.getText().toString()!=null&&!editNameContent.getText().toString().trim().equals("")){
|
||||
editNameContent.setEnabled(false);
|
||||
}else {
|
||||
editNameContent.setEnabled(true);
|
||||
tvNameContent.setText(name + "");
|
||||
}
|
||||
String p = chargingPileEntity.getP();
|
||||
if (p != null) {
|
||||
@ -523,7 +519,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
//禁用所有可操作性控件
|
||||
private void disables() {
|
||||
checkBoxLife.setEnabled(false);
|
||||
editNameContent.setEnabled(false);
|
||||
tvNameContent.setEnabled(false);
|
||||
checkButton1.setEnabled(false);//开放状态1
|
||||
checkButton2.setEnabled(false);//开放状态2
|
||||
checkButton3.setEnabled(false);//开放状态3
|
||||
@ -578,7 +574,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
String encode = Geohash.getInstance().encode(latLng.latitude,latLng.longitude);
|
||||
chargingPileEntity.setP(encode);
|
||||
}
|
||||
String name = editNameContent.getText().toString().trim();//名称
|
||||
String name = tvNameContent.getText().toString().trim();//名称
|
||||
if (name == null || name.equals("")) {
|
||||
Toast.makeText(getActivity(), "请输入 名称", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
@ -831,7 +827,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
|
||||
if (latLng != null) {
|
||||
chargingPileEntity.setP(latLng.latitude+","+latLng.longitude);
|
||||
}
|
||||
String name = editNameContent.getText().toString().trim();//名称
|
||||
String name = tvNameContent.getText().toString().trim();//名称
|
||||
if (name != null &&!name.equals("")) {
|
||||
chargingPileEntity.setName(name);
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
|
||||
|
||||
@Subscribe
|
||||
public void onEvent(Message data) {
|
||||
if (data.what == Constant.JOB_SEARCH_POI_WORD) {
|
||||
if (data.what == Constant.JOB_SEARCH_POI_WORD) {
|
||||
allPoi = (List<PoiEntity>) data.obj;
|
||||
} else if (data.what == Constant.JOB_SEARCH_WORD) {
|
||||
poiEntities.clear();
|
||||
@ -222,7 +222,7 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
|
||||
clNumber = findViewById(R.id.cl_number);
|
||||
clNumber.setOnClickListener(this::onClick);
|
||||
tvNumber = findViewById(R.id.tv_number);
|
||||
tvNumber.setText(Constant.NUMBER+"");
|
||||
tvNumber.setText(Constant.NUMBER + "");
|
||||
clPhotograph = findViewById(R.id.cl_photograph);
|
||||
clPhotograph.setOnClickListener(this::onClick);
|
||||
tvPhotograph = findViewById(R.id.tv_photograph);
|
||||
@ -286,6 +286,7 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
|
||||
public void onRefresh() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadMore() {
|
||||
|
||||
@ -415,7 +416,7 @@ public class FilterFragment extends BaseDrawerFragment implements View.OnClickLi
|
||||
break;
|
||||
|
||||
case R.id.cl_type://任务状态 0.未领取 1.已领取,2.未保存(保存到本地但未提交成功),3.已保存(保存到本地提交成功),4已上传(结束采集),
|
||||
BottomMenu.show((AppCompatActivity) getContext(), new String[]{"全部", "未领取", "已领取", "未保存","已保存"}, new OnMenuItemClickListener() {
|
||||
BottomMenu.show((AppCompatActivity) getContext(), new String[]{"全部", "未领取", "已领取", "未保存", "已保存"}, new OnMenuItemClickListener() {
|
||||
@Override
|
||||
public void onClick(String text, int index) {
|
||||
tvType.setText(text);
|
||||
|
@ -90,7 +90,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
|
||||
private String takePhotoPath;
|
||||
private String takePhotoPath2;
|
||||
private Integer body;
|
||||
private ArrayList<File> otherUploadList;
|
||||
|
||||
public static OtherFragment newInstance(Bundle bundle) {
|
||||
OtherFragment fragment = new OtherFragment();
|
||||
@ -233,7 +233,6 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
if (name != null && !name.equals("")) {
|
||||
editTaskName.setText(name + "");
|
||||
}
|
||||
body=showPoiEntity.getBodyId();
|
||||
String x = showPoiEntity.getX();
|
||||
String y = showPoiEntity.getY();
|
||||
if (x != null && y != null) {
|
||||
@ -245,10 +244,6 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
if (describe != null && !describe.equals("")) {
|
||||
editOtherDescribe.setText(describe);
|
||||
}
|
||||
|
||||
|
||||
body = showPoiEntity.getBodyId();
|
||||
|
||||
int station_type = showPoiEntity.getStation_type();
|
||||
spinnerOther.setSelection(station_type, true);
|
||||
if (showPoiEntity.getPhotoInfo() != null) {
|
||||
@ -281,94 +276,10 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
initOtherSharePre();
|
||||
break;
|
||||
case R.id.btn_other_local:
|
||||
XXPermissions.with(this)
|
||||
//读写权限
|
||||
.permission(Permission.MANAGE_EXTERNAL_STORAGE)
|
||||
.request(new OnPermissionCallback() {
|
||||
@Override
|
||||
public void onGranted(List<String> permissions, boolean all) {
|
||||
if (all) {
|
||||
//保存数据库:
|
||||
PoiEntity poiEntity = showPoiEntity;
|
||||
List<Info> infoList = new ArrayList<>();
|
||||
String name = editTaskName.getText().toString().trim();//名称
|
||||
if (name == null || name.equals("")) {
|
||||
Toast.makeText(getActivity(), "请输入poi 名称", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
poiEntity.setName(name);
|
||||
}
|
||||
|
||||
if (latLng == null) {
|
||||
Toast.makeText(getActivity(), "请确定点位", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
String encode = Geohash.getInstance().encode(latLng.latitude, latLng.longitude);
|
||||
poiEntity.setGeoWkt(encode);
|
||||
poiEntity.setX(String.valueOf(latLng.longitude));
|
||||
poiEntity.setY(String.valueOf(latLng.latitude));
|
||||
}
|
||||
String describe = editOtherDescribe.getText().toString().trim();
|
||||
if (describe != null&&!describe.equals("")) {
|
||||
poiEntity.setDescribe(describe);
|
||||
}
|
||||
String tagPicture = (String) ivPicture.getTag();
|
||||
if (tagPicture == null) {
|
||||
Toast.makeText(getActivity(), "请 拍照", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
infoList.add(new Info(tagPicture));
|
||||
}
|
||||
String tagPictures = (String) ivPictures.getTag();
|
||||
if (tagPictures == null) {
|
||||
Toast.makeText(getActivity(), "请 拍照", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
infoList.add(new Info(tagPictures));
|
||||
}
|
||||
poiEntity.setStation_type(station_type);
|
||||
poiEntity.setPhotoInfo(infoList);
|
||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
String format = formatter.format(calendar.getTime());
|
||||
poiEntity.setCreateTime(format);
|
||||
poiEntity.setType(5);
|
||||
poiEntity.setTaskStatus(2);
|
||||
poiEntity.setIsLocalData(1);
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
otherSaveByNetWork(poiEntity);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}).start();
|
||||
// onBackPressed();
|
||||
} else {
|
||||
Toast.makeText(getActivity(), "没有申请权限,请手动申请", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDenied(List<String> permissions, boolean never) {
|
||||
if (never) {
|
||||
Toast.makeText(getActivity(), "被永久拒绝授权,请手动授予权限", Toast.LENGTH_SHORT).show();
|
||||
// 如果是被永久拒绝就跳转到应用权限系统设置页面
|
||||
XXPermissions.startPermissionActivity(getActivity(), permissions);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
initPoiSaveLocal(false);
|
||||
break;
|
||||
case R.id.btn_other_uploading:
|
||||
|
||||
ArrayList<File> otherUploadList = new ArrayList<>();
|
||||
otherUploadList = new ArrayList<>();
|
||||
String tagPicture = (String) ivPicture.getTag();
|
||||
if (tagPicture != null) {
|
||||
otherUploadList.add(new File(tagPicture));
|
||||
@ -377,29 +288,114 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
if (tagPictures != null) {
|
||||
otherUploadList.add(new File(tagPictures));
|
||||
}
|
||||
if (body != 0) {
|
||||
otherUploadByNet(body, otherUploadList);
|
||||
} else {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (poiDaoPoiEntity.getTaskStatus()==1||poiDaoPoiEntity.getTaskStatus()==2||poiDaoPoiEntity.getTaskStatus()==0){
|
||||
initPoiSaveLocal(true);
|
||||
}else if (poiDaoPoiEntity.getTaskStatus()==3){
|
||||
otherUploadByNet(poiDaoPoiEntity.getBodyId(), otherUploadList);
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
break;
|
||||
}
|
||||
}
|
||||
public void initPoiSaveLocal(boolean isLocal) {
|
||||
XXPermissions.with(this)
|
||||
//读写权限
|
||||
.permission(Permission.MANAGE_EXTERNAL_STORAGE)
|
||||
.request(new OnPermissionCallback() {
|
||||
@Override
|
||||
public void onGranted(List<String> permissions, boolean all) {
|
||||
if (all) {
|
||||
//保存数据库:
|
||||
PoiEntity poiEntity = showPoiEntity;
|
||||
List<Info> infoList = new ArrayList<>();
|
||||
String name = editTaskName.getText().toString().trim();//名称
|
||||
if (name == null || name.equals("")) {
|
||||
Toast.makeText(getActivity(), "请输入poi 名称", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
poiEntity.setName(name);
|
||||
}
|
||||
|
||||
if (latLng == null) {
|
||||
Toast.makeText(getActivity(), "请确定点位", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
String encode = Geohash.getInstance().encode(latLng.latitude, latLng.longitude);
|
||||
poiEntity.setGeoWkt(encode);
|
||||
poiEntity.setX(String.valueOf(latLng.longitude));
|
||||
poiEntity.setY(String.valueOf(latLng.latitude));
|
||||
}
|
||||
String describe = editOtherDescribe.getText().toString().trim();
|
||||
if (describe != null&&!describe.equals("")) {
|
||||
poiEntity.setDescribe(describe);
|
||||
}
|
||||
String tagPicture = (String) ivPicture.getTag();
|
||||
if (tagPicture == null) {
|
||||
Toast.makeText(getActivity(), "请 拍照", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
infoList.add(new Info(tagPicture));
|
||||
}
|
||||
String tagPictures = (String) ivPictures.getTag();
|
||||
if (tagPictures == null) {
|
||||
Toast.makeText(getActivity(), "请 拍照", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
infoList.add(new Info(tagPictures));
|
||||
}
|
||||
poiEntity.setStation_type(station_type);
|
||||
poiEntity.setPhotoInfo(infoList);
|
||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
String format = formatter.format(calendar.getTime());
|
||||
poiEntity.setCreateTime(format);
|
||||
poiEntity.setType(5);
|
||||
poiEntity.setTaskStatus(2);
|
||||
poiEntity.setIsLocalData(1);
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
otherSaveByNetWork(poiEntity,isLocal);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}).start();
|
||||
// onBackPressed();
|
||||
} else {
|
||||
Toast.makeText(getActivity(), "没有申请权限,请手动申请", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDenied(List<String> permissions, boolean never) {
|
||||
if (never) {
|
||||
Toast.makeText(getActivity(), "被永久拒绝授权,请手动授予权限", Toast.LENGTH_SHORT).show();
|
||||
// 如果是被永久拒绝就跳转到应用权限系统设置页面
|
||||
XXPermissions.startPermissionActivity(getActivity(), permissions);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void otherUploadByNet(int body, List<File> otherUploadList) {
|
||||
if (body == 0) {
|
||||
Toast.makeText(getActivity(), "没有保存本地,请先保存本地", Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(getActivity(), "没有保存本地", Toast.LENGTH_SHORT).show();
|
||||
Log.e("TAG", "poiUploadByNetWork: " + body + otherUploadList);
|
||||
return;
|
||||
}
|
||||
@ -415,14 +411,19 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
public void onSuccess(Response<PoiUploadBean> poiUploadBeanResponse) {
|
||||
dismissLoadingDialog();
|
||||
Toast.makeText(getActivity(), "上传成功", Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onSuccess: " + poiUploadBeanResponse.toString() + "sssssssssssss");
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
poiDao.deletePoiEntity(showPoiEntity);
|
||||
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
|
||||
poiDao.deletePoiEntity(poiDaoPoiEntity);
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
getActivity().onBackPressed();//回退
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -435,7 +436,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
});
|
||||
}
|
||||
|
||||
private void otherSaveByNetWork(PoiEntity poiEntity) {
|
||||
private void otherSaveByNetWork(PoiEntity poiEntity,boolean isLocal) {
|
||||
showLoadingDialog();
|
||||
HttpParams httpParams = new HttpParams();
|
||||
httpParams.put("type", poiEntity.getStation_type());
|
||||
@ -455,7 +456,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
@Override
|
||||
public void onSuccess(PoiSaveBean poiSaveBean, int id) {
|
||||
dismissLoadingDialog();
|
||||
body = poiSaveBean.getBody();
|
||||
Integer body = poiSaveBean.getBody();
|
||||
poiEntity.setBodyId(body);
|
||||
poiEntity.setTaskStatus(3);
|
||||
new Thread(new Runnable() {
|
||||
@ -465,8 +466,11 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onSuccess: " + poiSaveBean.getBody());
|
||||
if (isLocal){
|
||||
otherUploadByNet(body,otherUploadList);
|
||||
}else {
|
||||
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -586,12 +590,18 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
if (EventBus.getDefault().isRegistered(this))//加上判断
|
||||
EventBus.getDefault().unregister(this);
|
||||
super.onDestroy();
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
|
||||
if (poiDaoPoiEntity.getName() == null) {
|
||||
poiDao.deletePoiEntity(poiDaoPoiEntity);
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
}
|
@ -101,9 +101,9 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
private String takePhotoPath4;
|
||||
private String takePhotoPath3;
|
||||
private String takePhotoPath1;
|
||||
private Integer body;
|
||||
private LinearLayout linearContact;
|
||||
private ContactView contactView;
|
||||
private ArrayList<File> poiPicList;
|
||||
|
||||
public static PoiFragment newInstance(Bundle bundle) {
|
||||
PoiFragment fragment = new PoiFragment();
|
||||
@ -168,21 +168,21 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
checkBoxLife.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
if (isChecked) {
|
||||
checkBoxLife.setText("保存");
|
||||
checkBoxLife.setTextColor(Color.WHITE);
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.TREASURE_WORD;
|
||||
obtain.obj = latLng;
|
||||
EventBus.getDefault().post(obtain);
|
||||
} else {
|
||||
checkBoxLife.setText("编辑");
|
||||
checkBoxLife.setTextColor(Color.BLACK);
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.TREASURE_CHECKED_WORD;
|
||||
obtain.obj = true;
|
||||
EventBus.getDefault().post(obtain);
|
||||
}
|
||||
if (isChecked) {
|
||||
checkBoxLife.setText("保存");
|
||||
checkBoxLife.setTextColor(Color.WHITE);
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.TREASURE_WORD;
|
||||
obtain.obj = latLng;
|
||||
EventBus.getDefault().post(obtain);
|
||||
} else {
|
||||
checkBoxLife.setText("编辑");
|
||||
checkBoxLife.setTextColor(Color.BLACK);
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.TREASURE_CHECKED_WORD;
|
||||
obtain.obj = true;
|
||||
EventBus.getDefault().post(obtain);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
@ -282,9 +282,9 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
if (!StringUtils.isEmpty(phones[i])) {
|
||||
String[] split = phones[i].split("-");
|
||||
if (split[0] == phones[i]) {
|
||||
poiBeans.add(new PhoneBean("电话*", phones[i], "", R.drawable.icon_add_bg));
|
||||
poiBeans.add(new PhoneBean("电话*", phones[i]+"", "", R.drawable.icon_add_bg));
|
||||
} else {
|
||||
poiBeans.add(new PhoneBean("电话*", split[1], split[0], R.drawable.icon_add_bg));
|
||||
poiBeans.add(new PhoneBean("电话*", split[1]+"", split[0]+"", R.drawable.icon_add_bg));
|
||||
}
|
||||
|
||||
}
|
||||
@ -292,9 +292,9 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
if (!StringUtils.isEmpty(phones[i])) {
|
||||
String[] split = phones[i].split("-");
|
||||
if (split[0] == phones[i]) {
|
||||
poiBeans.add(new PhoneBean("", phones[i], "", R.drawable.icon_del_bg));
|
||||
poiBeans.add(new PhoneBean("", phones[i]+"", "", R.drawable.icon_del_bg));
|
||||
} else {
|
||||
poiBeans.add(new PhoneBean("", split[1], split[0], R.drawable.icon_del_bg));
|
||||
poiBeans.add(new PhoneBean("", split[1]+"", split[0]+"", R.drawable.icon_del_bg));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -308,7 +308,6 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
}
|
||||
|
||||
}
|
||||
body=showPoiEntity.getBodyId();
|
||||
contactView = new ContactView(getActivity(), linearContact, poiBeans);
|
||||
contactView.resetView();
|
||||
//poiRecycleAdapter.setList(poiBeans);
|
||||
@ -411,117 +410,10 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.btn_save_local:
|
||||
XXPermissions.with(this)
|
||||
//读写权限
|
||||
.permission(Permission.MANAGE_EXTERNAL_STORAGE)
|
||||
.request(new OnPermissionCallback() {
|
||||
@Override
|
||||
public void onGranted(List<String> permissions, boolean all) {
|
||||
if (all) {
|
||||
//保存数据库:
|
||||
PoiEntity poiEntity = showPoiEntity;
|
||||
ArrayList<Info> infoPhoto = new ArrayList<>();
|
||||
String name = editNameContent.getText().toString().trim();//名称
|
||||
if (name == null || name.equals("")) {
|
||||
Toast.makeText(getActivity(), "请输入poi 名称", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
poiEntity.setName(name);
|
||||
}
|
||||
String site = editSiteContent.getText().toString().trim();
|
||||
if (site != null && !site.equals("")) {
|
||||
poiEntity.setAddress(site);
|
||||
}
|
||||
if (latLng == null) {
|
||||
Toast.makeText(getActivity(), "请确定点位", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
String encode = Geohash.getInstance().encode(latLng.latitude, latLng.longitude);
|
||||
poiEntity.setGeoWkt(encode);
|
||||
poiEntity.setX(String.valueOf(latLng.longitude));
|
||||
poiEntity.setY(String.valueOf(latLng.latitude));
|
||||
}
|
||||
String describe = editDescribe.getText().toString().trim();
|
||||
if (describe != null&&!describe.equals("")) {
|
||||
poiEntity.setDescribe(describe);
|
||||
}
|
||||
boolean phoneBean = contactView.getPhoneBean();
|
||||
if (phoneBean){
|
||||
String list = contactView.getList();
|
||||
poiEntity.setTelPhone(list);
|
||||
}
|
||||
String tagPanorama = (String) ivPanorama.getTag();
|
||||
if (tagPanorama == null) {
|
||||
Toast.makeText(getActivity(), "请拍照 全景图", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
infoPhoto.add(new Info(tagPanorama));
|
||||
}
|
||||
String tagName = (String) ivName.getTag();
|
||||
if (tagName == null) {
|
||||
Toast.makeText(getActivity(), "请拍照 充电桩编码", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
infoPhoto.add(new Info(tagName));
|
||||
}
|
||||
|
||||
String tagInternal = (String) ivInternal.getTag();
|
||||
if (tagInternal != null) {
|
||||
infoPhoto.add(new Info(tagInternal));
|
||||
}
|
||||
String tagElse = (String) ivElse.getTag();
|
||||
if (tagElse != null) {
|
||||
infoPhoto.add(new Info(tagElse));
|
||||
}
|
||||
String tagCard = (String) ivCard.getTag();
|
||||
if (tagCard != null) {
|
||||
infoPhoto.add(new Info(tagCard));
|
||||
}
|
||||
poiEntity.setPhotoInfo(infoPhoto);
|
||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
String format = formatter.format(calendar.getTime());
|
||||
poiEntity.setCreateTime(format);
|
||||
poiEntity.setExistence(existence);
|
||||
poiEntity.setType(1);
|
||||
poiEntity.setTaskStatus(2);
|
||||
poiEntity.setIsLocalData(1);
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
poiSaveByNet(poiEntity);
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
// onBackPressed();
|
||||
} else {
|
||||
Toast.makeText(getActivity(), "没有申请权限,请手动申请", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDenied(List<String> permissions, boolean never) {
|
||||
if (never) {
|
||||
Toast.makeText(getActivity(), "被永久拒绝授权,请手动授予权限", Toast.LENGTH_SHORT).show();
|
||||
// 如果是被永久拒绝就跳转到应用权限系统设置页面
|
||||
XXPermissions.startPermissionActivity(getActivity(), permissions);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
initPoiSaveLocal(false);
|
||||
break;
|
||||
case R.id.btn_uploading:
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.TREASURE_FRAGMENT;
|
||||
obtain.obj = false;
|
||||
EventBus.getDefault().post(obtain);
|
||||
ArrayList<File> poiPicList = new ArrayList<>();
|
||||
poiPicList = new ArrayList<>();
|
||||
String tagPanorama = (String) ivPanorama.getTag();
|
||||
if (tagPanorama != null) {
|
||||
poiPicList.add(new File(tagPanorama));
|
||||
@ -543,10 +435,6 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
if (tagCard != null) {
|
||||
poiPicList.add(new File(tagCard));
|
||||
}
|
||||
|
||||
if (body != null) {
|
||||
poiUploadByNetWork(body, poiPicList);
|
||||
} else {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@ -554,12 +442,15 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
poiUploadByNetWork(poiDaoPoiEntity.getBodyId(), poiPicList);
|
||||
if (poiDaoPoiEntity.getTaskStatus()==1||poiDaoPoiEntity.getTaskStatus()==2||poiDaoPoiEntity.getTaskStatus()==0){
|
||||
initPoiSaveLocal(true);
|
||||
}else if (poiDaoPoiEntity.getTaskStatus()==3){
|
||||
poiUploadByNetWork(poiDaoPoiEntity.getBodyId(), poiPicList);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
break;
|
||||
case R.id.tv_examine:
|
||||
Toast.makeText(getContext(), editNameContent.getText().toString(), Toast.LENGTH_SHORT).show();
|
||||
@ -587,6 +478,112 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
}
|
||||
}
|
||||
|
||||
public void initPoiSaveLocal(boolean isLocal) {
|
||||
XXPermissions.with(this)
|
||||
//读写权限
|
||||
.permission(Permission.MANAGE_EXTERNAL_STORAGE)
|
||||
.request(new OnPermissionCallback() {
|
||||
@Override
|
||||
public void onGranted(List<String> permissions, boolean all) {
|
||||
if (all) {
|
||||
//保存数据库:
|
||||
PoiEntity poiEntity = showPoiEntity;
|
||||
ArrayList<Info> infoPhoto = new ArrayList<>();
|
||||
String name = editNameContent.getText().toString().trim();//名称
|
||||
if (name == null || name.equals("")) {
|
||||
Toast.makeText(getActivity(), "请输入poi 名称", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
poiEntity.setName(name);
|
||||
}
|
||||
String site = editSiteContent.getText().toString().trim();
|
||||
if (site != null && !site.equals("")) {
|
||||
poiEntity.setAddress(site);
|
||||
}
|
||||
if (latLng == null) {
|
||||
Toast.makeText(getActivity(), "请确定点位", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
String encode = Geohash.getInstance().encode(latLng.latitude, latLng.longitude);
|
||||
poiEntity.setGeoWkt(encode);
|
||||
poiEntity.setX(String.valueOf(latLng.longitude));
|
||||
poiEntity.setY(String.valueOf(latLng.latitude));
|
||||
}
|
||||
String describe = editDescribe.getText().toString().trim();
|
||||
if (describe != null&&!describe.equals("")) {
|
||||
poiEntity.setDescribe(describe);
|
||||
}
|
||||
boolean phoneBean = contactView.getPhoneBean();
|
||||
if (phoneBean){
|
||||
String list = contactView.getList();
|
||||
poiEntity.setTelPhone(list);
|
||||
}
|
||||
String tagPanorama = (String) ivPanorama.getTag();
|
||||
if (tagPanorama == null) {
|
||||
Toast.makeText(getActivity(), "请拍照 全景图", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
infoPhoto.add(new Info(tagPanorama));
|
||||
}
|
||||
String tagName = (String) ivName.getTag();
|
||||
if (tagName == null) {
|
||||
Toast.makeText(getActivity(), "请拍照 充电桩编码", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
} else {
|
||||
infoPhoto.add(new Info(tagName));
|
||||
}
|
||||
|
||||
String tagInternal = (String) ivInternal.getTag();
|
||||
if (tagInternal != null) {
|
||||
infoPhoto.add(new Info(tagInternal));
|
||||
}
|
||||
String tagElse = (String) ivElse.getTag();
|
||||
if (tagElse != null) {
|
||||
infoPhoto.add(new Info(tagElse));
|
||||
}
|
||||
String tagCard = (String) ivCard.getTag();
|
||||
if (tagCard != null) {
|
||||
infoPhoto.add(new Info(tagCard));
|
||||
}
|
||||
poiEntity.setPhotoInfo(infoPhoto);
|
||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
String format = formatter.format(calendar.getTime());
|
||||
poiEntity.setCreateTime(format);
|
||||
poiEntity.setExistence(existence);
|
||||
poiEntity.setType(1);
|
||||
poiEntity.setTaskStatus(2);
|
||||
poiEntity.setIsLocalData(1);
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
poiSaveByNet(poiEntity,isLocal);
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
// onBackPressed();
|
||||
} else {
|
||||
Toast.makeText(getActivity(), "没有申请权限,请手动申请", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDenied(List<String> permissions, boolean never) {
|
||||
if (never) {
|
||||
Toast.makeText(getActivity(), "被永久拒绝授权,请手动授予权限", Toast.LENGTH_SHORT).show();
|
||||
// 如果是被永久拒绝就跳转到应用权限系统设置页面
|
||||
XXPermissions.startPermissionActivity(getActivity(), permissions);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void poiUploadByNetWork(int body, ArrayList<File> poiPicList) {
|
||||
if (body == 0) {
|
||||
Toast.makeText(getActivity(), "没有保存本地", Toast.LENGTH_SHORT).show();
|
||||
@ -605,11 +602,17 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
public void onSuccess(Response<OtherUploadPicBean> otherUploadPicBeanResponse) {
|
||||
dismissLoadingDialog();
|
||||
Toast.makeText(getActivity(), "上传成功", Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onSuccess: " + otherUploadPicBeanResponse.toString() + "sssssssssssss");
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
poiDao.deletePoiEntity(showPoiEntity);
|
||||
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
|
||||
poiDao.deletePoiEntity(poiDaoPoiEntity);
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
getActivity().onBackPressed();//回退
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
@ -624,7 +627,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
});
|
||||
}
|
||||
|
||||
private void poiSaveByNet(PoiEntity poiEntity) {
|
||||
private void poiSaveByNet(PoiEntity poiEntity,boolean isLocal) {
|
||||
showLoadingDialog();
|
||||
HttpParams httpParams = new HttpParams();
|
||||
httpParams.put("taskId", poiEntity.getTaskId());
|
||||
@ -643,7 +646,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
@Override
|
||||
public void onSuccess(PoiSaveBean poiSaveBean, int id) {
|
||||
dismissLoadingDialog();
|
||||
body = poiSaveBean.getBody();
|
||||
Integer body = poiSaveBean.getBody();
|
||||
poiEntity.setBodyId(body);
|
||||
poiEntity.setTaskStatus(3);
|
||||
new Thread(new Runnable() {
|
||||
@ -653,8 +656,11 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onSuccess: " + poiSaveBean.getBody());
|
||||
if (isLocal){
|
||||
poiUploadByNetWork(body,poiPicList);//上传
|
||||
}else {
|
||||
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -788,6 +794,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// int angle2 = PictureUtil.readPictureDegree(takePhotoPath2);
|
||||
takePhotoPath2 = PhotoPathUtil.getTakePhotoPath(data, "b",Geohash.getInstance().encode(latLng.latitude,latLng.longitude));
|
||||
ivName.setTag(takePhotoPath2);
|
||||
ivName.setImageBitmap(bitmap);//显示图像
|
||||
@ -867,9 +874,16 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
if (EventBus.getDefault().isRegistered(this))//加上判断
|
||||
EventBus.getDefault().unregister(this);
|
||||
super.onDestroy();
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
|
||||
if (poiDaoPoiEntity.getName() == null) {
|
||||
poiDao.deletePoiEntity(poiDaoPoiEntity);
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
|
||||
|
@ -88,7 +88,6 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
private PoiDatabase poiDatabase;
|
||||
private PoiDao poiDao;
|
||||
private PoiEntity showPoiEntity;
|
||||
private Integer poiVideoBody;
|
||||
private File videoFile;
|
||||
private Button btnPoiVideoUpload;
|
||||
private String videoPath;
|
||||
@ -203,9 +202,8 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
showPoiEntity = (PoiEntity) getArguments().getSerializable("poiEntity");
|
||||
if (showPoiEntity != null) {
|
||||
String name = showPoiEntity.getName();//名称
|
||||
|
||||
if (name != null && !name.equals("")) {
|
||||
etRoadName.setText( name+"");
|
||||
etRoadName.setText(name + "");
|
||||
}
|
||||
String extend = showPoiEntity.getExtend();
|
||||
if (extend != null && !extend.equals("")) {
|
||||
@ -213,7 +211,6 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
int type = roadExtend.getType();
|
||||
showPictureType(type);
|
||||
}
|
||||
poiVideoBody=showPoiEntity.getBodyId();
|
||||
String describe = showPoiEntity.getDescribe();//任务描述
|
||||
if (describe != null && !describe.equals("")) {
|
||||
etDesc.setText(describe);
|
||||
@ -271,94 +268,8 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.btn_poi_video_save:
|
||||
XXPermissions.with(getContext())
|
||||
.permission(Permission.MANAGE_EXTERNAL_STORAGE)
|
||||
.request(new OnPermissionCallback() {
|
||||
@Override
|
||||
public void onGranted(List<String> permissions, boolean all) {
|
||||
if (all) {
|
||||
PoiEntity poiEntity = showPoiEntity;
|
||||
String roadName = etRoadName.getText().toString().trim();
|
||||
if (roadName != null || !roadName.equals("")) {
|
||||
poiEntity.setName(roadName+"");
|
||||
}
|
||||
RoadExtend roadExtend = new RoadExtend();
|
||||
int type = getPictureType();
|
||||
if (type == -1) {
|
||||
Toast.makeText(getContext(), "请选择拍照方式", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
roadExtend.setType(type);
|
||||
Gson gson = new Gson();
|
||||
String roadExtendJson = gson.toJson(roadExtend);
|
||||
poiEntity.setExtend(roadExtendJson);
|
||||
String desc = etDesc.getText().toString().trim();
|
||||
if (desc != null && !desc.equals("")) {
|
||||
poiEntity.setDescribe(desc);
|
||||
}
|
||||
if (showPoiEntity != null) {
|
||||
if (showPoiEntity.getTaskId() != 0) {
|
||||
poiEntity.setTaskId(showPoiEntity.getTaskId());
|
||||
}
|
||||
}
|
||||
if (ivPoiVideoPicture.getTag() != null) {
|
||||
File videoFile = (File) ivPoiVideoPicture.getTag();
|
||||
String path = videoFile.getPath()+".txt";
|
||||
poiEntity.setPhoto(videoFile.getAbsolutePath());
|
||||
List<String> strings = FileUtils.readFileToList(path, "utf-8");
|
||||
ArrayList<LatLng> latLngs = new ArrayList<>();
|
||||
for (int i = 0; i < strings.size(); i++) {
|
||||
String[] split = strings.get(i).split(",");
|
||||
LatLng latLng = new LatLng();
|
||||
latLng.setLatitude(Double.valueOf(split[2]));
|
||||
latLng.setLongitude(Double.valueOf(split[3]));
|
||||
latLngs.add(latLng);
|
||||
}
|
||||
if (strings.size()==1){
|
||||
LatLng latLng = latLngs.get(0);
|
||||
latLngs.add(latLng);
|
||||
}
|
||||
String lineString = GeometryTools.getLineString(latLngs);
|
||||
Log.d("TAG", "onGranted: "+lineString);
|
||||
poiEntity.setGeoWkt(lineString);
|
||||
}
|
||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
String format = formatter.format(calendar.getTime());
|
||||
poiEntity.setCreateTime(format);
|
||||
poiEntity.setType(3);
|
||||
poiEntity.setTaskStatus(2);
|
||||
poiEntity.setIsLocalData(1);
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
poiVideoSave(poiEntity);
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
//onBackPressed();
|
||||
}else {
|
||||
Toast.makeText(getActivity(), "没有申请权限,请手动申请", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDenied(List<String> permissions, boolean never) {
|
||||
if (never) {
|
||||
Toast.makeText(getActivity(), "被永久拒绝授权,请手动授予权限", Toast.LENGTH_SHORT).show();
|
||||
// 如果是被永久拒绝就跳转到应用权限系统设置页面
|
||||
XXPermissions.startPermissionActivity(getActivity(), permissions);
|
||||
}
|
||||
}
|
||||
});
|
||||
initPoiSaveLocal(false);
|
||||
break;
|
||||
|
||||
case R.id.tv_pictures:
|
||||
// 根据用户点击的时间为视频名称赋值
|
||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
@ -376,27 +287,125 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
File file = new File(videoFile.getPath()+".txt");
|
||||
videoFileList.add(file);
|
||||
}
|
||||
File fileZip = new File(Constant.PICTURE_FOLDER, "files" + ".zip");
|
||||
fileZip = new File(Constant.PICTURE_FOLDER, "files" + ".zip");
|
||||
ZipUtil.zipFiles(videoFileList, fileZip,null);
|
||||
if (poiVideoBody!=null){
|
||||
poiVideoUpload(poiVideoBody,fileZip);
|
||||
}else {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
PoiEntity poiVideoDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
poiVideoUpload(poiVideoDaoPoiEntity.getBodyId(),fileZip);
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (poiDaoPoiEntity.getTaskStatus()==1||poiDaoPoiEntity.getTaskStatus()==2||poiDaoPoiEntity.getTaskStatus()==0){
|
||||
initPoiSaveLocal(true);
|
||||
}else if (poiDaoPoiEntity.getTaskStatus()==3){
|
||||
poiVideoUpload(poiDaoPoiEntity.getBodyId(), fileZip);
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
break;
|
||||
}
|
||||
}
|
||||
public void initPoiSaveLocal(boolean isLocal) {
|
||||
XXPermissions.with(getContext())
|
||||
.permission(Permission.MANAGE_EXTERNAL_STORAGE)
|
||||
.request(new OnPermissionCallback() {
|
||||
@Override
|
||||
public void onGranted(List<String> permissions, boolean all) {
|
||||
if (all) {
|
||||
PoiEntity poiEntity = showPoiEntity;
|
||||
String roadName = etRoadName.getText().toString().trim();
|
||||
if (roadName != null && !roadName.equals("")) {
|
||||
poiEntity.setName(roadName+"");
|
||||
}else {
|
||||
DateFormat formatters = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss");
|
||||
Calendar calendars = Calendar.getInstance();
|
||||
calendars.setTimeInMillis(System.currentTimeMillis());
|
||||
String formats = formatters.format(calendars.getTime());
|
||||
String city = Constant.currentLocation.getCity();//返回当前位置的城市.
|
||||
String district = Constant.currentLocation.getDistrict();//返回当前位置的区县.
|
||||
poiEntity.setName("poi录像上报-"+city+district+"-"+formats);
|
||||
etRoadName.setText("poi录像上报-"+city+district+"-"+formats);
|
||||
}
|
||||
RoadExtend roadExtend = new RoadExtend();
|
||||
int type = getPictureType();
|
||||
if (type == -1) {
|
||||
Toast.makeText(getContext(), "请选择拍照方式", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
roadExtend.setType(type);
|
||||
Gson gson = new Gson();
|
||||
String roadExtendJson = gson.toJson(roadExtend);
|
||||
poiEntity.setExtend(roadExtendJson);
|
||||
String desc = etDesc.getText().toString().trim();
|
||||
if (desc != null && !desc.equals("")) {
|
||||
poiEntity.setDescribe(desc);
|
||||
}
|
||||
if (showPoiEntity != null) {
|
||||
if (showPoiEntity.getTaskId() != 0) {
|
||||
poiEntity.setTaskId(showPoiEntity.getTaskId());
|
||||
}
|
||||
}
|
||||
if (ivPoiVideoPicture.getTag() != null) {
|
||||
File videoFile = (File) ivPoiVideoPicture.getTag();
|
||||
String path = videoFile.getPath()+".txt";
|
||||
poiEntity.setPhoto(videoFile.getAbsolutePath());
|
||||
List<String> strings = FileUtils.readFileToList(path, "utf-8");
|
||||
ArrayList<LatLng> latLngs = new ArrayList<>();
|
||||
for (int i = 0; i < strings.size(); i++) {
|
||||
String[] split = strings.get(i).split(",");
|
||||
LatLng latLng = new LatLng();
|
||||
latLng.setLatitude(Double.valueOf(split[2]));
|
||||
latLng.setLongitude(Double.valueOf(split[3]));
|
||||
latLngs.add(latLng);
|
||||
}
|
||||
if (strings.size()==1){
|
||||
LatLng latLng = latLngs.get(0);
|
||||
latLngs.add(latLng);
|
||||
}
|
||||
String lineString = GeometryTools.getLineString(latLngs);
|
||||
Log.d("TAG", "onGranted: "+lineString);
|
||||
poiEntity.setGeoWkt(lineString);
|
||||
}
|
||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
String format = formatter.format(calendar.getTime());
|
||||
poiEntity.setCreateTime(format);
|
||||
poiEntity.setType(3);
|
||||
poiEntity.setTaskStatus(2);
|
||||
poiEntity.setIsLocalData(1);
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
//
|
||||
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
poiVideoSave(poiEntity,isLocal);
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
//onBackPressed();
|
||||
}else {
|
||||
Toast.makeText(getActivity(), "没有申请权限,请手动申请", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDenied(List<String> permissions, boolean never) {
|
||||
if (never) {
|
||||
Toast.makeText(getActivity(), "被永久拒绝授权,请手动授予权限", Toast.LENGTH_SHORT).show();
|
||||
// 如果是被永久拒绝就跳转到应用权限系统设置页面
|
||||
XXPermissions.startPermissionActivity(getActivity(), permissions);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -421,13 +430,20 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
public void onSuccess(Response<OtherUploadPicBean> otherUploadPicBeanResponse) {
|
||||
dismissLoadingDialog();
|
||||
Toast.makeText(getActivity(), "上传成功", Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onSuccess: " + otherUploadPicBeanResponse.toString() + "sssssssssssss");
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
poiDao.deletePoiEntity(showPoiEntity);
|
||||
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
|
||||
poiDao.deletePoiEntity(poiDaoPoiEntity);
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
getActivity().onBackPressed();//回退
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -440,7 +456,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
});
|
||||
}
|
||||
|
||||
private void poiVideoSave(PoiEntity poiEntity) {
|
||||
private void poiVideoSave(PoiEntity poiEntity,boolean isLocal) {
|
||||
showLoadingDialog();
|
||||
int pictureType = getPictureType();
|
||||
if (pictureType == -1) {
|
||||
@ -463,7 +479,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
@Override
|
||||
public void onSuccess(PoiVideoBean poiVideoBean, int id) {
|
||||
dismissLoadingDialog();
|
||||
poiVideoBody = poiVideoBean.getBody();
|
||||
Integer poiVideoBody = poiVideoBean.getBody();
|
||||
poiEntity.setBodyId(poiVideoBody);
|
||||
poiEntity.setTaskStatus(3);
|
||||
new Thread(new Runnable() {
|
||||
@ -473,8 +489,11 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onSuccess: " + poiVideoBean.getBody());
|
||||
if (isLocal){
|
||||
poiVideoUpload(poiVideoBody,fileZip);
|
||||
}else {
|
||||
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -589,4 +608,17 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
|
||||
break;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
|
||||
if (poiDaoPoiEntity.getName() == null) {
|
||||
poiDao.deletePoiEntity(poiDaoPoiEntity);
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
}
|
@ -79,19 +79,13 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
private EditText etDesc;
|
||||
private Button btnRoadSave;
|
||||
private RadioGroup rgType;
|
||||
private RoadExtend roadExtend;
|
||||
private PoiDatabase poiDatabase;
|
||||
private PoiDao poiDao;
|
||||
private PoiEntity showPoiEntity;
|
||||
private ImageView ivRoadFinal;
|
||||
private RelativeLayout linearExist;
|
||||
String[] spinner = new String[]{"存在", "不存在", "无法验证"};
|
||||
private int existence=0;
|
||||
private Integer body;
|
||||
private Button roadUpload;
|
||||
private File videoFile;
|
||||
private String videoPath;
|
||||
private Spinner spinnerExist;
|
||||
private File fileZip;
|
||||
|
||||
public static RoadFragment newInstance(Bundle bundle) {
|
||||
RoadFragment fragment = new RoadFragment();
|
||||
@ -156,33 +150,8 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
btnRoadSave = (Button) findViewById(R.id.btn_road_save);
|
||||
btnRoadSave.setOnClickListener(this::onClick);
|
||||
rgType = (RadioGroup) findViewById(R.id.rg_type);
|
||||
linearExist = findViewById(R.id.linear_exist);
|
||||
roadUpload = findViewById(R.id.road_upload);
|
||||
roadUpload.setOnClickListener(this::onClick);
|
||||
spinnerExist = findViewById(R.id.spinner_exist);
|
||||
ArrayAdapter<String> adapterExist = new ArrayAdapter<>(getContext(), android.R.layout.simple_spinner_item, spinner);
|
||||
adapterExist.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); //设置下拉列表框的下拉选项样式
|
||||
spinnerExist.setAdapter(adapterExist);
|
||||
spinnerExist.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
switch (position) {
|
||||
case 0:
|
||||
existence=0;
|
||||
break;
|
||||
case 1:
|
||||
existence=1;
|
||||
break;
|
||||
case 2:
|
||||
existence=2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parent) {
|
||||
}
|
||||
});
|
||||
ivRoadPicture.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@ -211,17 +180,12 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
if (name != null && !name.equals("")) {
|
||||
etRoadName.setText(name + "");
|
||||
}
|
||||
body=showPoiEntity.getBodyId();
|
||||
String extend = showPoiEntity.getExtend();
|
||||
if (extend != null && !extend.equals("")) {
|
||||
RoadExtend roadExtend = new Gson().fromJson(extend, RoadExtend.class);
|
||||
int type = roadExtend.getType();
|
||||
showPictureType(type);
|
||||
}
|
||||
if (showPoiEntity.getName() != null) {
|
||||
linearExist.setVisibility(View.VISIBLE);
|
||||
spinnerExist.setSelection(showPoiEntity.getExistence(), true);
|
||||
}
|
||||
String describe = showPoiEntity.getDescribe();//任务描述
|
||||
if (describe != null && !describe.equals("")) {
|
||||
etDesc.setText(describe);
|
||||
@ -281,96 +245,8 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.btn_road_save:
|
||||
XXPermissions.with(getContext())
|
||||
.permission(Permission.MANAGE_EXTERNAL_STORAGE)
|
||||
.request(new OnPermissionCallback() {
|
||||
@Override
|
||||
public void onGranted(List<String> permissions, boolean all) {
|
||||
if (all) {
|
||||
PoiEntity poiEntity = showPoiEntity;
|
||||
String roadName = etRoadName.getText().toString().trim();
|
||||
if (roadName == null || roadName.equals("")) {
|
||||
|
||||
poiEntity.setName(roadName+"");
|
||||
}
|
||||
RoadExtend roadExtend = new RoadExtend();
|
||||
int type = getPictureType();
|
||||
if (type == -1) {
|
||||
Toast.makeText(getContext(), "请选择拍照方式", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
roadExtend.setType(type);
|
||||
Gson gson = new Gson();
|
||||
String roadExtendJson = gson.toJson(roadExtend);
|
||||
poiEntity.setExtend(roadExtendJson);
|
||||
String desc = etDesc.getText().toString().trim();
|
||||
if (desc != null&& !desc.equals("")) {
|
||||
poiEntity.setDescribe(desc);
|
||||
}
|
||||
if (showPoiEntity != null) {
|
||||
if (showPoiEntity.getTaskId() != 0) {
|
||||
poiEntity.setTaskId(showPoiEntity.getTaskId());
|
||||
}
|
||||
}
|
||||
if (ivRoadPicture.getTag() != null) {
|
||||
File videoFile = (File) ivRoadPicture.getTag();
|
||||
poiEntity.setPhoto(videoFile.getAbsolutePath());
|
||||
String path = videoFile.getPath() + ".txt";
|
||||
poiEntity.setPhoto(videoFile.getAbsolutePath());
|
||||
List<String> strings = FileUtils.readFileToList(path, "utf-8");
|
||||
ArrayList<LatLng> latLngs = new ArrayList<>();
|
||||
for (int i = 0; i < strings.size(); i++) {
|
||||
String[] split = strings.get(i).split(",");
|
||||
LatLng latLng = new LatLng();
|
||||
latLng.setLatitude(Double.valueOf(split[2]));
|
||||
latLng.setLongitude(Double.valueOf(split[3]));
|
||||
latLngs.add(latLng);
|
||||
}
|
||||
if (strings.size() == 1) {
|
||||
LatLng latLng = latLngs.get(0);
|
||||
latLngs.add(latLng);
|
||||
}
|
||||
String lineString = GeometryTools.getLineString(latLngs);
|
||||
Log.d("TAG", "onGranted: " + lineString);
|
||||
poiEntity.setGeoWkt(lineString);
|
||||
}
|
||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
String format = formatter.format(calendar.getTime());
|
||||
poiEntity.setCreateTime(format);
|
||||
poiEntity.setExistence(existence);
|
||||
poiEntity.setType(4);
|
||||
poiEntity.setTaskStatus(2);
|
||||
poiEntity.setIsLocalData(1);
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
poiVideoSave(poiEntity);
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
//onBackPressed();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDenied(List<String> permissions, boolean never) {
|
||||
if (never) {
|
||||
Toast.makeText(getActivity(), "被永久拒绝授权,请手动授予权限", Toast.LENGTH_SHORT).show();
|
||||
// 如果是被永久拒绝就跳转到应用权限系统设置页面
|
||||
XXPermissions.startPermissionActivity(getActivity(), permissions);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
initPoiSaveLocal(false);
|
||||
break;
|
||||
|
||||
case R.id.tv_pictures:
|
||||
// 根据用户点击的时间为视频名称赋值
|
||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
@ -386,29 +262,125 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
File file = new File(videoFile.getPath() + ".txt");
|
||||
videoFileList.add(file);
|
||||
}
|
||||
File fileZip = new File(Constant.PICTURE_FOLDER, "files" + ".zip");
|
||||
fileZip = new File(Constant.PICTURE_FOLDER, "files" + ".zip");
|
||||
ZipUtil.zipFiles(videoFileList, fileZip, null);
|
||||
if (body != null) {
|
||||
poiVideoUpload(body, fileZip);
|
||||
} else {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
PoiEntity poiVideoDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
poiVideoUpload(poiVideoDaoPoiEntity.getBodyId(), fileZip);
|
||||
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (poiDaoPoiEntity.getTaskStatus()==1||poiDaoPoiEntity.getTaskStatus()==2||poiDaoPoiEntity.getTaskStatus()==0){
|
||||
initPoiSaveLocal(true);
|
||||
}else if (poiDaoPoiEntity.getTaskStatus()==3){
|
||||
poiVideoUpload(poiDaoPoiEntity.getBodyId(), fileZip);
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
public void initPoiSaveLocal(boolean isLocal) {
|
||||
XXPermissions.with(getContext())
|
||||
.permission(Permission.MANAGE_EXTERNAL_STORAGE)
|
||||
.request(new OnPermissionCallback() {
|
||||
@Override
|
||||
public void onGranted(List<String> permissions, boolean all) {
|
||||
if (all) {
|
||||
PoiEntity poiEntity = showPoiEntity;
|
||||
String roadName = etRoadName.getText().toString().trim();
|
||||
if (roadName != null && !roadName.equals("")) {
|
||||
poiEntity.setName(roadName);
|
||||
}else {
|
||||
DateFormat formatters = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss");
|
||||
Calendar calendars = Calendar.getInstance();
|
||||
calendars.setTimeInMillis(System.currentTimeMillis());
|
||||
String formats = formatters.format(calendars.getTime());
|
||||
String city = Constant.currentLocation.getCity();//返回当前位置的城市.
|
||||
String district = Constant.currentLocation.getDistrict();//返回当前位置的区县.
|
||||
poiEntity.setName("道路录像上报-"+city+district+"-"+formats);
|
||||
etRoadName.setText("道路录像上报-"+city+district+"-"+formats);
|
||||
}
|
||||
RoadExtend roadExtend = new RoadExtend();
|
||||
int type = getPictureType();
|
||||
if (type == -1) {
|
||||
Toast.makeText(getContext(), "请选择拍照方式", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
roadExtend.setType(type);
|
||||
Gson gson = new Gson();
|
||||
String roadExtendJson = gson.toJson(roadExtend);
|
||||
poiEntity.setExtend(roadExtendJson);
|
||||
String desc = etDesc.getText().toString().trim();
|
||||
if (desc != null&& !desc.equals("")) {
|
||||
poiEntity.setDescribe(desc);
|
||||
}
|
||||
if (showPoiEntity != null) {
|
||||
if (showPoiEntity.getTaskId() != 0) {
|
||||
poiEntity.setTaskId(showPoiEntity.getTaskId());
|
||||
}
|
||||
}
|
||||
if (ivRoadPicture.getTag() != null) {
|
||||
File videoFile = (File) ivRoadPicture.getTag();
|
||||
poiEntity.setPhoto(videoFile.getAbsolutePath());
|
||||
String path = videoFile.getPath() + ".txt";
|
||||
poiEntity.setPhoto(videoFile.getAbsolutePath());
|
||||
List<String> strings = FileUtils.readFileToList(path, "utf-8");
|
||||
ArrayList<LatLng> latLngs = new ArrayList<>();
|
||||
for (int i = 0; i < strings.size(); i++) {
|
||||
String[] split = strings.get(i).split(",");
|
||||
LatLng latLng = new LatLng();
|
||||
latLng.setLatitude(Double.valueOf(split[2]));
|
||||
latLng.setLongitude(Double.valueOf(split[3]));
|
||||
latLngs.add(latLng);
|
||||
}
|
||||
if (strings.size() == 1) {
|
||||
LatLng latLng = latLngs.get(0);
|
||||
latLngs.add(latLng);
|
||||
}
|
||||
String lineString = GeometryTools.getLineString(latLngs);
|
||||
Log.d("TAG", "onGranted: " + lineString);
|
||||
poiEntity.setGeoWkt(lineString);
|
||||
}
|
||||
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
String format = formatter.format(calendar.getTime());
|
||||
poiEntity.setCreateTime(format);
|
||||
poiEntity.setType(4);
|
||||
poiEntity.setTaskStatus(2);
|
||||
poiEntity.setIsLocalData(1);
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
poiVideoSave(poiEntity,isLocal);
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
//onBackPressed();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDenied(List<String> permissions, boolean never) {
|
||||
if (never) {
|
||||
Toast.makeText(getActivity(), "被永久拒绝授权,请手动授予权限", Toast.LENGTH_SHORT).show();
|
||||
// 如果是被永久拒绝就跳转到应用权限系统设置页面
|
||||
XXPermissions.startPermissionActivity(getActivity(), permissions);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
private void poiVideoUpload(int body, File fileZip) {
|
||||
if (body == 0) {
|
||||
@ -431,13 +403,20 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
public void onSuccess(Response<OtherUploadPicBean> otherUploadPicBeanResponse) {
|
||||
dismissLoadingDialog();
|
||||
Toast.makeText(getActivity(), "上传成功", Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onSuccess: " + otherUploadPicBeanResponse.toString() + "sssssssssssss");
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
poiDao.deletePoiEntity(showPoiEntity);
|
||||
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
|
||||
poiDao.deletePoiEntity(poiDaoPoiEntity);
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
getActivity().onBackPressed();//回退
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -450,7 +429,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
});
|
||||
}
|
||||
|
||||
private void poiVideoSave(PoiEntity poiEntity) {
|
||||
private void poiVideoSave(PoiEntity poiEntity,boolean isLocal) {
|
||||
|
||||
showLoadingDialog();
|
||||
int pictureType = getPictureType();
|
||||
@ -473,8 +452,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
@Override
|
||||
public void onSuccess(PoiVideoBean poiVideoBean, int id) {
|
||||
dismissLoadingDialog();
|
||||
body = poiVideoBean.getBody();
|
||||
body = poiVideoBean.getBody();
|
||||
Integer body = poiVideoBean.getBody();
|
||||
poiEntity.setBodyId(body);
|
||||
poiEntity.setTaskStatus(3);
|
||||
new Thread(new Runnable() {
|
||||
@ -484,8 +462,12 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
|
||||
Log.d("TAG", "onSuccess: " + poiVideoBean.getBody());
|
||||
if (isLocal){
|
||||
poiVideoUpload(body,fileZip);
|
||||
}else {
|
||||
Toast.makeText(getActivity(), "保存成功", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -563,7 +545,6 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
String format = formatter.format(calendar.getTime());
|
||||
poiEntity.setCreateTime(format);
|
||||
poiEntity.setExistence(existence);
|
||||
poiEntity.setType(4);
|
||||
poiEntity.setTaskStatus(2);
|
||||
poiEntity.setIsLocalData(1);
|
||||
@ -605,4 +586,18 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
|
||||
if (poiDaoPoiEntity.getName() == null) {
|
||||
poiDao.deletePoiEntity(poiDaoPoiEntity);
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
}
|
@ -128,9 +128,14 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
|
||||
newEntities.clear();
|
||||
for (int i = 0; i < roadEntities.size(); i++) {
|
||||
PoiEntity poiEntity = roadEntities.get(i);
|
||||
if (poiEntity.getType()==type){
|
||||
if (type==0){
|
||||
newEntities.add(poiEntity);
|
||||
}else {
|
||||
if (poiEntity.getType()==type){
|
||||
newEntities.add(poiEntity);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return newEntities;
|
||||
}
|
||||
@ -138,26 +143,38 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.cl_stay_type:
|
||||
BottomMenu.show((AppCompatActivity) getContext(), new String[]{"poi", "道路", "充电站", "其他"}, new OnMenuItemClickListener() {
|
||||
case R.id.cl_stay_type://1 "POI"2 "充电站"3 "POI录像"4 "道路录像"5 "其他"6 "面状任务"
|
||||
BottomMenu.show((AppCompatActivity) getContext(), new String[]{"全部","poi", "充电站", "poi录像", "道路录像","其他","面状任务"}, new OnMenuItemClickListener() {
|
||||
@Override
|
||||
public void onClick(String text, int index) {
|
||||
switch (index){
|
||||
case 0:
|
||||
List<PoiEntity> entities = initRoadWord(0);
|
||||
staySubmitAdapter.setAllRoad(entities);
|
||||
break;
|
||||
case 1:
|
||||
List<PoiEntity> poiEntities = initRoadWord(1);
|
||||
staySubmitAdapter.setAllRoad(poiEntities);
|
||||
break;
|
||||
case 1:
|
||||
List<PoiEntity> poiEntitiesList = initRoadWord(4);
|
||||
staySubmitAdapter.setAllRoad(poiEntitiesList);
|
||||
break;
|
||||
case 2:
|
||||
List<PoiEntity> poiEntities1 = initRoadWord(2);
|
||||
staySubmitAdapter.setAllRoad(poiEntities1);
|
||||
List<PoiEntity> stationEntities= initRoadWord(2);
|
||||
staySubmitAdapter.setAllRoad(stationEntities);
|
||||
break;
|
||||
case 3:
|
||||
List<PoiEntity> poiEntities2 = initRoadWord(5);
|
||||
staySubmitAdapter.setAllRoad(poiEntities2);
|
||||
List<PoiEntity> poiVideoEntities = initRoadWord(3);
|
||||
staySubmitAdapter.setAllRoad(poiVideoEntities);
|
||||
break;
|
||||
case 4:
|
||||
List<PoiEntity> roadEntities = initRoadWord(4);
|
||||
staySubmitAdapter.setAllRoad(roadEntities);
|
||||
break;
|
||||
case 5:
|
||||
List<PoiEntity> otherEntities = initRoadWord(5);
|
||||
staySubmitAdapter.setAllRoad(otherEntities);
|
||||
break;
|
||||
case 6:
|
||||
List<PoiEntity> facetEntities = initRoadWord(6);
|
||||
staySubmitAdapter.setAllRoad(facetEntities);
|
||||
break;
|
||||
}
|
||||
tvStayType.setText(text);
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.navinfo.outdoor.fragment;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Bitmap;
|
||||
@ -10,25 +9,20 @@ import android.graphics.Matrix;
|
||||
import android.graphics.Point;
|
||||
import android.location.Location;
|
||||
import android.os.Bundle;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ScrollView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.widget.NestedScrollView;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
|
||||
import com.github.lazylibrary.util.DensityUtil;
|
||||
import com.github.lazylibrary.util.FileUtils;
|
||||
import com.google.gson.Gson;
|
||||
import com.hjq.permissions.OnPermissionCallback;
|
||||
import com.hjq.permissions.Permission;
|
||||
@ -46,7 +40,6 @@ import com.navinfo.outdoor.api.Constant;
|
||||
import com.navinfo.outdoor.base.BaseDrawerFragment;
|
||||
import com.navinfo.outdoor.base.BaseFragment;
|
||||
import com.navinfo.outdoor.bean.JobSearchBean;
|
||||
import com.navinfo.outdoor.bean.NameAuthenticationBean;
|
||||
import com.navinfo.outdoor.http.DialogCallback;
|
||||
import com.navinfo.outdoor.http.HttpInterface;
|
||||
import com.navinfo.outdoor.room.ChargingPileEntity;
|
||||
@ -64,7 +57,6 @@ import com.tencent.map.geolocation.TencentLocation;
|
||||
import com.tencent.tencentmap.mapsdk.maps.CameraUpdate;
|
||||
import com.tencent.tencentmap.mapsdk.maps.CameraUpdateFactory;
|
||||
import com.tencent.tencentmap.mapsdk.maps.MapView;
|
||||
import com.tencent.tencentmap.mapsdk.maps.Projection;
|
||||
import com.tencent.tencentmap.mapsdk.maps.TencentMap;
|
||||
import com.tencent.tencentmap.mapsdk.maps.UiSettings;
|
||||
import com.tencent.tencentmap.mapsdk.maps.interfaces.Removable;
|
||||
@ -85,12 +77,9 @@ import com.vividsolutions.jts.geom.Geometry;
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import okhttp3.OkHttpClient;
|
||||
|
||||
/**
|
||||
* 寻宝的Fragment
|
||||
* 2021-5-25
|
||||
@ -120,9 +109,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
private String userEncode;
|
||||
private String centerEncode;
|
||||
private List<Removable> removables;
|
||||
private List<PoiEntity> showAllPoi;
|
||||
private List<Removable> removablesLocality;
|
||||
private boolean ischank = true;
|
||||
|
||||
public static TreasureFragment newInstance(Bundle bundle) {
|
||||
TreasureFragment fragment = new TreasureFragment();
|
||||
@ -155,7 +142,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
ivSubmit.setOnClickListener(this::onClick);
|
||||
ivMessage = findViewById(R.id.iv_message);
|
||||
ivMessage.setOnClickListener(this::onClick);
|
||||
ivMessage.setVisibility(View.VISIBLE);
|
||||
treasureMap = (MapView) findViewById(R.id.treasure_map);
|
||||
tencentMap = treasureMap.getMap();
|
||||
cbMapType = (CheckBox) findViewById(R.id.cb_map_type);
|
||||
@ -198,7 +184,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
//数据库
|
||||
initThread();
|
||||
removables = new ArrayList<>();//存储网络数据的marker
|
||||
showAllPoi = new ArrayList<>();//存储本地数据的容器
|
||||
removablesLocality = new ArrayList<>(); //存储本地数据的marker
|
||||
tencentMap.addOnMapLoadedCallback(new TencentMap.OnMapLoadedCallback() {
|
||||
@Override
|
||||
@ -462,12 +447,10 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (int i = 0; i < removables.size(); i++) {
|
||||
removables.get(i).remove();
|
||||
for (int i = 0; i < removablesLocality.size(); i++) {
|
||||
removablesLocality.get(i).remove();
|
||||
}
|
||||
removables.clear();
|
||||
showAllPoi.clear();
|
||||
showAllPoi.addAll(allTaskStatus);
|
||||
removablesLocality.clear();
|
||||
for (int i = 0; i < allTaskStatus.size(); i++) {
|
||||
PoiEntity poiEntity = allTaskStatus.get(i);
|
||||
String geo = allTaskStatus.get(i).getGeoWkt();
|
||||
@ -493,7 +476,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
.borderWidth(1);
|
||||
// 绘制折线
|
||||
Polyline polyline = tencentMap.addPolyline(polylineOptions);
|
||||
removables.add(polyline);
|
||||
removablesLocality.add(polyline);
|
||||
if (latLineString != null && latLineString.size() > 0) {
|
||||
latLng = latLineString.get(0);
|
||||
}
|
||||
@ -508,7 +491,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
strokeColor(0xff00ff00).
|
||||
//边线宽度15像素
|
||||
strokeWidth(5));
|
||||
removables.add(polygon);
|
||||
removablesLocality.add(polygon);
|
||||
if (latPolygon != null && latPolygon.size() > 0) {
|
||||
latLng = latPolygon.get(0);
|
||||
}
|
||||
@ -583,7 +566,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
}
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.JOB_SEARCH_POI_WORD;
|
||||
obtain.obj = showAllPoi;
|
||||
obtain.obj = allTaskStatus;
|
||||
EventBus.getDefault().post(obtain);
|
||||
}
|
||||
});
|
||||
@ -785,8 +768,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
initCheckedMarker(Constant.CHARGING_STATION_WORD);
|
||||
}
|
||||
} else if (data.what == Constant.MAIN_CHARGING_PILE) {//充电桩采集-移动位置
|
||||
BitmapDescriptor pileDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_pile_have_bg);
|
||||
initPileMarker((LatLng) data.obj, pileDescriptor);
|
||||
initPoiMarker((LatLng) data.obj);
|
||||
} else if (data.what == Constant.MAIN_CHARGING_CHECKED_PILE) {//充电桩采集-确定位置
|
||||
if ((boolean) data.obj) {
|
||||
initCheckedMarker(Constant.CHARGING_PILE_WORD);
|
||||
@ -832,6 +814,9 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
if (chargingPileEntity != null) {
|
||||
bundle.putSerializable("chargingPileEntity", chargingPileEntity);
|
||||
}
|
||||
BitmapDescriptor pileDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_pile_bg);
|
||||
LatLng mapCenterPoint = getMapCenterPoint();
|
||||
markerPoi = tencentMap.addMarker(new MarkerOptions(mapCenterPoint).icon(pileDescriptor));
|
||||
ChargingPileFragment chargingPileFragment = ChargingPileFragment.newInstance(bundle);
|
||||
showSlidingFragment(chargingPileFragment);
|
||||
} else if (data.what == Constant.CHARGING_STATION_PILE) {//充电站的充电桩
|
||||
@ -910,29 +895,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
|
||||
}
|
||||
|
||||
private void initPileMarker(LatLng latLng, BitmapDescriptor bitmapDescriptor) {
|
||||
CameraUpdate cameraSigma = CameraUpdateFactory.newCameraPosition(new CameraPosition(
|
||||
latLng, //中心点坐标,地图目标经纬度
|
||||
tencentMap.getCameraPosition().zoom, //目标缩放级别
|
||||
tencentMap.getCameraPosition().tilt, //目标倾斜角[0.0 ~ 45.0] (垂直地图时为0)
|
||||
tencentMap.getCameraPosition().bearing)); //目标旋转角 0~360° (正北方为0)
|
||||
tencentMap.animateCamera(cameraSigma, new TencentMap.CancelableCallback() {
|
||||
@Override
|
||||
public void onFinish() {
|
||||
screenPosition = tencentMap.getProjection().toScreenLocation(latLng);
|
||||
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
|
||||
//创建Marker对象之前,设置属性
|
||||
markerPoi = tencentMap.addMarker(new MarkerOptions(latLng).icon(bitmapDescriptor));
|
||||
markerPoi.setFixingPoint(screenPosition.x, screenPosition.y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initCheckedMarker(int poiWord) {
|
||||
if (screenPosition != null) {
|
||||
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
|
||||
@ -1048,6 +1010,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
break;
|
||||
case R.id.iv_refrish://刷新
|
||||
initList(Constant.currentLocation);
|
||||
initThread();
|
||||
break;
|
||||
case R.id.iv_location://定位:
|
||||
if (Constant.currentLocation != null) {
|
||||
@ -1065,7 +1028,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
}
|
||||
break;
|
||||
case R.id.iv_submit://弹窗
|
||||
ivMessage.setVisibility(View.GONE);
|
||||
//分享
|
||||
CharSequence title = "请选择上报类型";
|
||||
DialogSettings.style = DialogSettings.STYLE.STYLE_MIUI;
|
||||
@ -1085,25 +1047,60 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
public boolean onClick(ShareDialog shareDialog, int index, ShareDialog.Item item) {
|
||||
switch (index) {
|
||||
case 0:
|
||||
bundle.putSerializable("poiEntity", poiEntity);
|
||||
BitmapDescriptor poiDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_have_bg);
|
||||
markerPoi = tencentMap.addMarker(new MarkerOptions(mapCenterPoint).icon(poiDescriptor));
|
||||
PoiFragment poiFragment = PoiFragment.newInstance(bundle);
|
||||
showSlidingFragment(poiFragment);
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
|
||||
bundle.putSerializable("poiEntity", poiEntity);
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
BitmapDescriptor poiDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_bg);
|
||||
markerPoi = tencentMap.addMarker(new MarkerOptions(mapCenterPoint).icon(poiDescriptor));
|
||||
PoiFragment poiFragment = PoiFragment.newInstance(bundle);
|
||||
showSlidingFragment(poiFragment);
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
break;
|
||||
case 1:
|
||||
bundle.putSerializable("poiEntity", poiEntity);
|
||||
BitmapDescriptor poiVideoDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_video_have_bag);
|
||||
markerPoi = tencentMap.addMarker(new MarkerOptions(mapCenterPoint).icon(poiVideoDescriptor));
|
||||
PoiVideoFragment poiVideoFragment = PoiVideoFragment.newInstance(bundle);
|
||||
showSlidingFragment(poiVideoFragment);
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
|
||||
bundle.putSerializable("poiEntity", poiEntity);
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
BitmapDescriptor poiVideoDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_bg);
|
||||
markerPoi = tencentMap.addMarker(new MarkerOptions(mapCenterPoint).icon(poiVideoDescriptor));
|
||||
PoiVideoFragment poiVideoFragment = PoiVideoFragment.newInstance(bundle);
|
||||
showSlidingFragment(poiVideoFragment);
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
|
||||
break;
|
||||
case 2:
|
||||
bundle.putSerializable("poiEntity", poiEntity);
|
||||
BitmapDescriptor roadDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_road_have_bg);
|
||||
markerPoi = tencentMap.addMarker(new MarkerOptions(mapCenterPoint).icon(roadDescriptor));
|
||||
RoadFragment roadFragment = RoadFragment.newInstance(bundle);
|
||||
showSlidingFragment(roadFragment);
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
|
||||
bundle.putSerializable("poiEntity", poiEntity);
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
bundle.putSerializable("poiEntity", poiEntity);
|
||||
BitmapDescriptor roadDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_road_bg);
|
||||
markerPoi = tencentMap.addMarker(new MarkerOptions(mapCenterPoint).icon(roadDescriptor));
|
||||
RoadFragment roadFragment = RoadFragment.newInstance(bundle);
|
||||
showSlidingFragment(roadFragment);
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
break;
|
||||
case 3:
|
||||
new Thread(new Runnable() {
|
||||
@ -1114,7 +1111,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
BitmapDescriptor chargeDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_charge_have_bg);
|
||||
BitmapDescriptor chargeDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_charge_bg);
|
||||
markerPoi = tencentMap.addMarker(new MarkerOptions(mapCenterPoint).icon(chargeDescriptor));
|
||||
ChargingStationFragment chargingStationFragment = ChargingStationFragment.newInstance(bundle);
|
||||
showSlidingFragment(chargingStationFragment);
|
||||
@ -1124,11 +1121,23 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
}).start();
|
||||
break;
|
||||
case 4:
|
||||
bundle.putSerializable("poiEntity", poiEntity);
|
||||
BitmapDescriptor otherDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other_have_bg);
|
||||
markerPoi = tencentMap.addMarker(new MarkerOptions(mapCenterPoint).icon(otherDescriptor));
|
||||
OtherFragment otherFragment = OtherFragment.newInstance(bundle);
|
||||
showSlidingFragment(otherFragment);
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiEntity);
|
||||
bundle.putSerializable("poiEntity", poiEntity);
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
BitmapDescriptor otherDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_other_bg);
|
||||
markerPoi = tencentMap.addMarker(new MarkerOptions(mapCenterPoint).icon(otherDescriptor));
|
||||
OtherFragment otherFragment = OtherFragment.newInstance(bundle);
|
||||
showSlidingFragment(otherFragment);
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
@ -1136,17 +1145,15 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
}).setTitle(title);
|
||||
break;
|
||||
case R.id.iv_filter:
|
||||
initThread();
|
||||
initList(Constant.currentLocation);
|
||||
FilterFragment filterFragment = FilterFragment.newInstance(new Bundle());
|
||||
showSlidingFragment(filterFragment);
|
||||
initThread();
|
||||
initList(Constant.currentLocation);
|
||||
break;
|
||||
case R.id.iv_message:
|
||||
|
||||
Intent messageIntent = new Intent(getContext(), FragmentManagement.class);
|
||||
messageIntent.putExtra("tag", 35);
|
||||
startActivity(messageIntent);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1168,7 +1175,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
|
||||
fragmentTransaction = supportFragmentManager.beginTransaction();
|
||||
int[] deviceInfo = DensityUtil.getDeviceInfo(getActivity());
|
||||
|
||||
sliding_layout.setPanelHeight(deviceInfo[1] / 3);
|
||||
sliding_layout.setPanelHeight(deviceInfo[1] / 2);
|
||||
sliding_layout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
|
||||
fragmentTransaction.add(R.id.scroll_view, fragment, fragment.getClass().getName());
|
||||
if (!(fragment instanceof FilterFragment)) {
|
||||
|
227
app/src/main/java/com/navinfo/outdoor/util/GPSUtils.java
Normal file
227
app/src/main/java/com/navinfo/outdoor/util/GPSUtils.java
Normal file
@ -0,0 +1,227 @@
|
||||
package com.navinfo.outdoor.util;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.location.Address;
|
||||
import android.location.Criteria;
|
||||
import android.location.Geocoder;
|
||||
import android.location.GpsSatellite;
|
||||
import android.location.GpsStatus;
|
||||
import android.location.Location;
|
||||
import android.location.LocationListener;
|
||||
import android.location.LocationManager;
|
||||
import android.location.LocationProvider;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
@SuppressLint("MissingPermission")
|
||||
public class GPSUtils {
|
||||
|
||||
private static LocationManager mLocationManager;
|
||||
|
||||
private static final String TAG = "GPSUtils";
|
||||
|
||||
private static Location mLocation = null;
|
||||
|
||||
private static Activity mContext;
|
||||
|
||||
public GPSUtils(Activity context) {
|
||||
this.mContext = context;
|
||||
mLocationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
|
||||
|
||||
// 判断GPS是否正常启动
|
||||
if (!mLocationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
|
||||
Toast.makeText(context, "请开启GPS导航...", Toast.LENGTH_SHORT).show();
|
||||
// 返回开启GPS导航设置界面
|
||||
Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
|
||||
context.startActivityForResult(intent, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
// 为获取地理位置信息时设置查询条件
|
||||
String bestProvider = mLocationManager.getBestProvider(getCriteria(), true);
|
||||
// 获取位置信息
|
||||
// 如果不设置查询要求,getLastKnownLocation方法传人的参数为LocationManager.GPS_PROVIDER
|
||||
Location location = mLocationManager.getLastKnownLocation(bestProvider);
|
||||
// getLocationData(location);
|
||||
mLocation = location;
|
||||
// 监听状态
|
||||
mLocationManager.addGpsStatusListener(listener);
|
||||
|
||||
// 绑定监听,有4个参数
|
||||
// 参数1,设备:有GPS_PROVIDER和NETWORK_PROVIDER两种
|
||||
// 参数2,位置信息更新周期,单位毫秒
|
||||
// 参数3,位置变化最小距离:当位置距离变化超过此值时,将更新位置信息
|
||||
// 参数4,监听
|
||||
// 备注:参数2和3,如果参数3不为0,则以参数3为准;参数3为0,则通过时间来定时更新;两者为0,则随时刷新
|
||||
|
||||
// 1秒更新一次,或最小位移变化超过1米更新一次;
|
||||
// 注意:此处更新准确度非常低,推荐在service里面启动一个Thread,在run中sleep(10000);然后执行handler.sendMessage(),更新位置
|
||||
mLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 1, locationListener);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回查询条件
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private static Criteria getCriteria() {
|
||||
Criteria criteria = new Criteria();
|
||||
// 设置定位精确度 Criteria.ACCURACY_COARSE比较粗略,Criteria.ACCURACY_FINE则比较精细
|
||||
criteria.setAccuracy(Criteria.ACCURACY_FINE);
|
||||
// 设置是否要求速度
|
||||
criteria.setSpeedRequired(false);
|
||||
// 设置是否允许运营商收费
|
||||
criteria.setCostAllowed(false);
|
||||
// 设置是否需要方位信息
|
||||
criteria.setBearingRequired(false);
|
||||
// 设置是否需要海拔信息
|
||||
criteria.setAltitudeRequired(false);
|
||||
// 设置对电源的需求
|
||||
criteria.setPowerRequirement(Criteria.POWER_LOW);
|
||||
return criteria;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return Location--->getLongitude()获取经度/getLatitude()获取纬度
|
||||
*/
|
||||
public static Location getLocation() {
|
||||
if (mLocation == null) {
|
||||
Log.e("GPSUtils", "setLocationData: 获取当前位置信息为空");
|
||||
return null;
|
||||
}
|
||||
return mLocation;
|
||||
}
|
||||
|
||||
public static String getLocalCity(){
|
||||
if (mLocation==null){
|
||||
Log.e("GPSUtils", "getLocalCity: 获取城市信息为空");
|
||||
return "";
|
||||
}
|
||||
List<Address> result = getAddress(mLocation);
|
||||
|
||||
String city = "";
|
||||
if (result != null && result.size() > 0) {
|
||||
city = result.get(0).getLocality();//获取城市
|
||||
}
|
||||
return city;
|
||||
}
|
||||
|
||||
public static String getAddressStr(){
|
||||
if (mLocation==null){
|
||||
Log.e("GPSUtils", "getAddressStr: 获取详细地址信息为空");
|
||||
return "";
|
||||
}
|
||||
List<Address> result = getAddress(mLocation);
|
||||
|
||||
String address = "";
|
||||
if (result != null && result.size() > 0) {
|
||||
address = result.get(0).getAddressLine(0);//获取详细地址
|
||||
}
|
||||
return address;
|
||||
}
|
||||
|
||||
// 位置监听
|
||||
private static LocationListener locationListener = new LocationListener() {
|
||||
|
||||
//位置信息变化时触发
|
||||
public void onLocationChanged(Location location) {
|
||||
mLocation = location;
|
||||
Log.i(TAG, "时间:" + location.getTime());
|
||||
Log.i(TAG, "经度:" + location.getLongitude());
|
||||
Log.i(TAG, "纬度:" + location.getLatitude());
|
||||
Log.i(TAG, "海拔:" + location.getAltitude());
|
||||
}
|
||||
|
||||
//GPS状态变化时触发
|
||||
public void onStatusChanged(String provider, int status, Bundle extras) {
|
||||
switch (status) {
|
||||
// GPS状态为可见时
|
||||
case LocationProvider.AVAILABLE:
|
||||
Log.i(TAG, "当前GPS状态为可见状态");
|
||||
break;
|
||||
// GPS状态为服务区外时
|
||||
case LocationProvider.OUT_OF_SERVICE:
|
||||
Log.i(TAG, "当前GPS状态为服务区外状态");
|
||||
break;
|
||||
// GPS状态为暂停服务时
|
||||
case LocationProvider.TEMPORARILY_UNAVAILABLE:
|
||||
Log.i(TAG, "当前GPS状态为暂停服务状态");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//GPS开启时触发
|
||||
public void onProviderEnabled(String provider) {
|
||||
Location location = mLocationManager.getLastKnownLocation(provider);
|
||||
mLocation = location;
|
||||
}
|
||||
|
||||
//GPS禁用时触发
|
||||
public void onProviderDisabled(String provider) {
|
||||
mLocation = null;
|
||||
}
|
||||
};
|
||||
|
||||
// 获取地址信息
|
||||
private static List<Address> getAddress(Location location) {
|
||||
List<Address> result = null;
|
||||
try {
|
||||
if (location != null) {
|
||||
Geocoder gc = new Geocoder(mContext, Locale.getDefault());
|
||||
result = gc.getFromLocation(location.getLatitude(),
|
||||
location.getLongitude(), 1);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// 状态监听
|
||||
GpsStatus.Listener listener = new GpsStatus.Listener() {
|
||||
public void onGpsStatusChanged(int event) {
|
||||
switch (event) {
|
||||
// 第一次定位
|
||||
case GpsStatus.GPS_EVENT_FIRST_FIX:
|
||||
Log.i(TAG, "第一次定位");
|
||||
break;
|
||||
// 卫星状态改变
|
||||
case GpsStatus.GPS_EVENT_SATELLITE_STATUS:
|
||||
Log.i(TAG, "卫星状态改变");
|
||||
GpsStatus gpsStatus = mLocationManager.getGpsStatus(null);
|
||||
// 获取卫星颗数的默认最大值
|
||||
int maxSatellites = gpsStatus.getMaxSatellites();
|
||||
// 创建一个迭代器保存所有卫星
|
||||
Iterator<GpsSatellite> iters = gpsStatus.getSatellites()
|
||||
.iterator();
|
||||
int count = 0;
|
||||
while (iters.hasNext() && count <= maxSatellites) {
|
||||
GpsSatellite s = iters.next();
|
||||
count++;
|
||||
}
|
||||
System.out.println("搜索到:" + count + "颗卫星");
|
||||
break;
|
||||
// 定位启动
|
||||
case GpsStatus.GPS_EVENT_STARTED:
|
||||
Log.i(TAG, "定位启动");
|
||||
break;
|
||||
// 定位结束
|
||||
case GpsStatus.GPS_EVENT_STOPPED:
|
||||
Log.i(TAG, "定位结束");
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
@ -96,7 +96,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
|
||||
<EditText
|
||||
<TextView
|
||||
android:id="@+id/tv_name_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -161,51 +161,6 @@
|
||||
app:layout_constraintLeft_toLeftOf="@id/iv_road_picture"
|
||||
app:layout_constraintTop_toBottomOf="@id/iv_road_picture">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/linear_exist"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="10dp"
|
||||
android:background="@drawable/other_text"
|
||||
android:padding="2dp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/linear_phone">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_exist"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="18dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:text="是否存在*"
|
||||
android:textColor="#333" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spinner_exist"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="18dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_toEndOf="@id/tv_exist"
|
||||
android:layout_toRightOf="@id/tv_exist"
|
||||
android:background="@color/white"
|
||||
android:textColor="#333"
|
||||
android:textSize="15sp" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:background="@drawable/ic_baseline_arrow_drop" />
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?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"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
@ -12,8 +11,8 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:text="电话*"
|
||||
android:textColor="#333"
|
||||
@ -23,7 +22,7 @@
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_poi"
|
||||
android:layout_width="140dp"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="visible"
|
||||
@ -33,16 +32,17 @@
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edit_area_code"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="@color/white"
|
||||
android:digits="1234567890"
|
||||
android:gravity="center_vertical"
|
||||
android:hint="010"
|
||||
android:maxLength="4"
|
||||
android:inputType="phone|number"
|
||||
android:maxLength="4"
|
||||
android:textColor="#333"
|
||||
android:textSize="15sp"
|
||||
android:visibility="visible"
|
||||
@ -52,7 +52,7 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_view"
|
||||
android:layout_width="4dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="18dp"
|
||||
android:text="——"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
@ -65,13 +65,14 @@
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edit_phone_number"
|
||||
android:layout_width="130dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:background="@color/white"
|
||||
android:digits="1234567890"
|
||||
android:gravity="center_vertical"
|
||||
android:hint="电话号码"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:inputType="phone|number"
|
||||
android:maxLength="11"
|
||||
android:textColor="#333"
|
||||
@ -82,8 +83,8 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginRight="20dp"
|
||||
android:background="@drawable/icon_add_bg"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
|
Loading…
x
Reference in New Issue
Block a user