设置删除照片,修改布局,点击卫星定位权限

This commit is contained in:
wangdongsheng 2021-10-22 18:35:49 +08:00
parent ed379a7dc4
commit 480478f08e
17 changed files with 279 additions and 214 deletions

View File

@ -29,6 +29,8 @@
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" /> <!-- 访问手机当前状态, 需要device id用于网络定位 -->
<uses-permission android:name="android.permission.READ_PHONE_STATE" /> <!-- 访问蓝牙状态,需要蓝牙信息用于网络定位 -->
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.ACCESS_MEDIA_LOCATION" />
<uses-permission android:name="android.permission.ACTION_LOCATION_SOURCE_SETTINGS" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> <!-- 支持A-GPS辅助定位 -->
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" /> <!-- 用于 log 日志 -->
<uses-feature

View File

@ -228,6 +228,7 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
} else {
Toast.makeText(LoginActivity.this, response.getMessage(), Toast.LENGTH_SHORT).show();
}
}
@Override

View File

@ -98,6 +98,8 @@ public class MainActivity extends BaseActivity {
DialogSettings.init();//初始化清空 BaseDialog 队列*/
}
private void initPermission() {
XXPermissions.with(this)
// 申请安装包权限
@ -119,6 +121,7 @@ public class MainActivity extends BaseActivity {
.permission(Permission.REQUEST_INSTALL_PACKAGES)
// 位置权限
.permission(Permission.ACCESS_FINE_LOCATION)
.permission(Permission.ACCESS_MEDIA_LOCATION)
//.permission(Permission.ACCESS_BACKGROUND_LOCATION)
.permission(Permission.ACCESS_COARSE_LOCATION)
//读写权限
@ -141,6 +144,7 @@ public class MainActivity extends BaseActivity {
public void onDenied(List<String> permissions, boolean never) {
if (never) {
DialogSettings.style = DialogSettings.STYLE.STYLE_IOS;
DialogSettings.cancelable=false;
MessageDialog.show(MainActivity.this, "提示", permissions.toString() + " 被永久拒绝授权请手动授权,", "确定").setOkButton(new OnDialogButtonClickListener() {
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
@ -346,12 +350,12 @@ public class MainActivity extends BaseActivity {
HttpInterface.initHttpInter(body.getUserId());
}
navInfoEditor.putString("access_token", body.getAccess_token());
navInfoEditor.putString("refresh_token", body.getRefresh_token());
navInfoEditor.putString("user_id", body.getUserId());
navInfoEditor.commit();
Constant.ACCESS_TOKEN = body.getAccess_token();
navInfoEditor.putString("refresh_token", body.getRefresh_token());
Constant.REFRESH_TOKEN = body.getRefresh_token();
navInfoEditor.putString("user_id", body.getUserId());
Constant.USHERED = body.getUserId();
navInfoEditor.commit();
initGetUserInfo();//获取用户信息
} else {
Intent intent = new Intent( MainActivity.this, LoginActivity.class);

View File

@ -15,11 +15,7 @@ import android.os.Message;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.Toast;
@ -30,10 +26,6 @@ import com.github.lazylibrary.util.FileUtils;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.api.Constant;
import com.navinfo.outdoor.base.BaseActivity;
import com.navinfo.outdoor.room.PoiEntity;
import com.navinfo.outdoor.util.AWMp4ParserHelper;
import com.navinfo.outdoor.util.GeometryTools;
import com.navinfo.outdoor.util.MyTecentLocationSource;
import com.navinfo.outdoor.util.SystemTTS;
import com.otaliastudios.cameraview.CameraListener;
import com.otaliastudios.cameraview.CameraLogger;
@ -41,24 +33,6 @@ import com.otaliastudios.cameraview.CameraView;
import com.otaliastudios.cameraview.FileCallback;
import com.otaliastudios.cameraview.PictureResult;
import com.otaliastudios.cameraview.controls.Mode;
import com.otaliastudios.cameraview.size.Size;
import com.otaliastudios.cameraview.size.SizeSelector;
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.TencentMap;
import com.tencent.tencentmap.mapsdk.maps.TextureMapView;
import com.tencent.tencentmap.mapsdk.maps.UiSettings;
import com.tencent.tencentmap.mapsdk.maps.interfaces.Removable;
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptor;
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptorFactory;
import com.tencent.tencentmap.mapsdk.maps.model.CameraPosition;
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
import com.tencent.tencentmap.mapsdk.maps.model.Marker;
import com.tencent.tencentmap.mapsdk.maps.model.MarkerOptions;
import com.tencent.tencentmap.mapsdk.maps.model.MyLocationStyle;
import com.tencent.tencentmap.mapsdk.maps.model.Polyline;
import com.tencent.tencentmap.mapsdk.maps.model.PolylineOptions;
import com.vividsolutions.jts.geom.Geometry;
import com.wanghong.webpnative.WebPNative;
@ -71,14 +45,9 @@ import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.Timer;
import java.util.TimerTask;
import utils.bean.ImageConfig;
import utils.task.AsyncImageTask;
import utils.task.CompressImageTask;
import java.util.Objects;
/**

View File

@ -435,7 +435,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
}
private Bitmap getBitMap() {
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.location);
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.location_north_fill);
int width = bitmap.getWidth();
int height = bitmap.getHeight();
int newWidth = 55;

View File

@ -60,6 +60,7 @@ public class UserActivity extends BaseActivity implements View.OnClickListener {
private SharedPreferences.Editor navInfoEditor;
private File logFile;
private StringBuilder userBuilder;
private String region_text;
@Override
protected int getLayout() {
@ -178,57 +179,7 @@ public class UserActivity extends BaseActivity implements View.OnClickListener {
userBuilder.append("请输入电子邮件 ,");
break;
case R.id.btn_save:
userBuilder.append("点击了保存的按钮 ,");
if (Constant.ID_NUM == null) {
Toast.makeText(this, "请先实名认证", Toast.LENGTH_SHORT).show();
return;
}
if (Constant.ID_NUMBER == null) {
Toast.makeText(this, "请先绑定银行卡", Toast.LENGTH_SHORT).show();
}
String userphone = etPhone.getText().toString().trim();
String userqq = etQq.getText().toString().trim();
String usermailbox = etMailbox.getText().toString().trim();
HttpParams httpParams = new HttpParams();
httpParams.put("pid", Constant.USHERED);
long time = System.currentTimeMillis();
httpParams.put("datetime", time);
boolean isQQNum_matcher = userqq.matches("[1-9][0-9]{4,14}");
// 邮箱匹配结果
boolean isEmail_matcher = usermailbox.matches("^[\\w-\\+]+(\\.[\\w]+)*@[\\w-]+(\\.[\\w]+)*(\\.[a-z]{2,})$");
//user.length() < 11 && user.length() > 5
if (TextUtils.isEmpty(userphone) || TextUtils.isEmpty(userqq) || TextUtils.isEmpty(usermailbox) || TextUtils.isEmpty(region_id)) {
if (region_id == null || region_id.equals("")) {
Toast.makeText(this, "所在地区为空,请重新输入", Toast.LENGTH_SHORT).show();
return;
} else {
httpParams.put("regionId", region_id);
}
if (!RegexUtil.isPhone(userphone)) {
Toast.makeText(this, "手机号输入错误", Toast.LENGTH_SHORT).show();
return;
} else {
httpParams.put("mobile", userphone);
}
if (!userqq.equals("")) {
if (!isQQNum_matcher) {
Toast.makeText(this, "QQ号输入错误", Toast.LENGTH_SHORT).show();
return;
} else {
httpParams.put("qq", userqq);
}
}
if (!usermailbox.equals("")) {
if (!isEmail_matcher) {
Toast.makeText(this, "邮箱格式错误", Toast.LENGTH_SHORT).show();
} else {
httpParams.put("mail", usermailbox); //邮箱
}
return;
}
}
netWork(httpParams);
netWork();
break;
case R.id.btn_weChat_binding:
userBuilder.append("点击了微信 去提交的按钮 ,");
@ -237,7 +188,57 @@ public class UserActivity extends BaseActivity implements View.OnClickListener {
}
}
private void netWork(HttpParams httpParams) {
private void netWork() {
userBuilder.append("点击了保存的按钮 ,");
if (Constant.ID_NUM == null) {
Toast.makeText(this, "请先实名认证", Toast.LENGTH_SHORT).show();
return;
}
if (Constant.ID_NUMBER == null) {
Toast.makeText(this, "请先绑定银行卡", Toast.LENGTH_SHORT).show();
}
String userphone = etPhone.getText().toString().trim();
String userqq = etQq.getText().toString().trim();
String usermailbox = etMailbox.getText().toString().trim();
HttpParams httpParams = new HttpParams();
httpParams.put("pid", Constant.USHERED);
long time = System.currentTimeMillis();
httpParams.put("datetime", time);
boolean isQQNum_matcher = userqq.matches("[1-9][0-9]{4,14}");
// 邮箱匹配结果
boolean isEmail_matcher = usermailbox.matches("^[\\w-\\+]+(\\.[\\w]+)*@[\\w-]+(\\.[\\w]+)*(\\.[a-z]{2,})$");
//user.length() < 11 && user.length() > 5
if (TextUtils.isEmpty(userphone) || TextUtils.isEmpty(userqq) || TextUtils.isEmpty(usermailbox) || TextUtils.isEmpty(region_id)) {
if (region_id == null || region_id.equals("")) {
Toast.makeText(this, "所在地区为空,请重新输入", Toast.LENGTH_SHORT).show();
return;
} else {
httpParams.put("regionId", region_id);
}
if (!RegexUtil.isPhone(userphone)) {
Toast.makeText(this, "手机号输入错误", Toast.LENGTH_SHORT).show();
return;
} else {
httpParams.put("mobile", userphone);
}
if (!userqq.equals("")) {
if (!isQQNum_matcher) {
Toast.makeText(this, "QQ号输入错误", Toast.LENGTH_SHORT).show();
return;
} else {
httpParams.put("qq", userqq);
}
}
if (!usermailbox.equals("")) {
if (!isEmail_matcher) {
Toast.makeText(this, "邮箱格式错误", Toast.LENGTH_SHORT).show();
} else {
httpParams.put("mailbox", usermailbox); //邮箱
}
return;
}
}
showLoadingDialog();
OkGoBuilder.getInstance()
.Builder(this)
@ -254,7 +255,12 @@ public class UserActivity extends BaseActivity implements View.OnClickListener {
MessageDialog.show(UserActivity.this, "提示", "是否保存", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
navInfoEditor.putString("region", region.getText().toString());
navInfoEditor.putString("region", region_text);
navInfoEditor.putString("mobile", userphone);
Constant.MOBILE=userphone;
navInfoEditor.putString("qq", userqq);
Constant.QQ=userqq;
//navInfoEditor.putString("mailbox", usermailbox);
navInfoEditor.commit();
finish();
return false;
@ -299,8 +305,8 @@ public class UserActivity extends BaseActivity implements View.OnClickListener {
options3Items.get(options1).get(options2).get(options3) : "";
region_id = cityItems.get(options1).get(options2).get(options3).getRegion_id();
Toast.makeText(UserActivity.this, region_id, Toast.LENGTH_SHORT).show();
String tx = opt1tx + " " + opt2tx + " " + opt3tx;
region.setText(tx);
region_text = opt1tx + " " + opt2tx + " " + opt3tx;
region.setText(region_text);
}
}).setSubmitText("确定")//确定按钮文字
.setCancelText("取消")//取消按钮文字

View File

@ -481,9 +481,6 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
}
private void onLongDelPic() {
if (ivAvailable.getTag() != null) {
}
rlAvailable.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
@ -492,6 +489,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
ivAvailable.setImageDrawable(null);
ivAvailable.setTag(null);
return false;
}
});
@ -506,6 +504,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
ivUsable.setImageDrawable(null);
ivUsable.setTag(null);
return false;
}
});
@ -520,6 +519,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
ivScutcheon.setImageDrawable(null);
ivScutcheon.setTag(null);
return false;
}
});
@ -534,6 +534,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
ivParking.setImageDrawable(null);
ivParking.setTag(null);
return false;
}
});
@ -548,6 +549,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
ivPanorama.setImageDrawable(null);
ivPanorama.setTag(null);
return false;
}
});
@ -562,6 +564,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
ivNumber.setImageDrawable(null);
ivNumber.setTag(null);
return false;
}
});
@ -576,6 +579,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
ivFacility.setImageDrawable(null);
ivFacility.setTag(null);
return false;
}
});
@ -590,6 +594,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
ivEquipment.setImageDrawable(null);
ivEquipment.setTag(null);
return false;
}
});
@ -604,6 +609,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
ivDevice.setImageDrawable(null);
ivDevice.setTag(null);
return false;
}
});
@ -618,6 +624,7 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
ivCoding.setImageDrawable(null);
ivCoding.setTag(null);
return false;
}
});

View File

@ -390,6 +390,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
ivElse.setImageDrawable(null);
ivElse.setTag(null);
return false;
}
});
@ -404,6 +405,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
ivScutcheon.setImageDrawable(null);
ivScutcheon.setTag(null);
return false;
}
});
@ -418,6 +420,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
ivPanorama.setImageDrawable(null);
ivPanorama.setTag(null);
return false;
}
});
@ -432,6 +435,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
ivName.setImageDrawable(null);
ivName.setTag(null);
return false;
}
});
@ -446,6 +450,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
ivInternal.setImageDrawable(null);
ivInternal.setTag(null);
return false;
}
});

View File

@ -162,13 +162,13 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
if (poiEntity != null) {
tvTitle.setText(poiEntity.getName());
if (poiEntity.getPrecision() == null) {
tvMoney.setText(""+0);
tvMoney.setText("" + 0);
} else {
tvMoney.setText(""+format2(Double.parseDouble(poiEntity.getPrecision())));
tvMoney.setText("" + format2(Double.parseDouble(poiEntity.getPrecision())));
}
if (poiEntity != null) {
if (poiEntity.getDescribe() != null && !"".equals(poiEntity.getDescribe())) {
tvDescribe.setText("任务描述:"+poiEntity.getDescribe());
tvDescribe.setText("任务描述:" + poiEntity.getDescribe());
}
if (poiEntity.getCreateTime() != null && !"".equals(poiEntity.getCreateTime())) {
tvTime.setText("到期时间:" + poiEntity.getCreateTime());
@ -178,9 +178,9 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
if (poiEntity.getDist() != null) {
tvDistance.setText("距离:" + format5(Double.parseDouble(poiEntity.getDist()) / 1000) + "km");
}
if (poiEntity.getRecord_way()==0){//不可领取
if (poiEntity.getRecord_way() == 0) {//不可领取
btnGetTask.setEnabled(false);
}else if (poiEntity.getRecord_way()==1){//可领取
} else if (poiEntity.getRecord_way() == 1) {//可领取
btnGetTask.setEnabled(true);
}
}
@ -192,6 +192,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
/**
* 保存小数点后两位
*
* @param value
*/
public static String format2(double value) {
@ -283,8 +284,8 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
if (geometry > 5000) {
Toast.makeText(getActivity(), "作业不在领取范围内,无法领取", Toast.LENGTH_SHORT).show();
return;
}else {
if (geometry>50){
} else {
if (geometry > 50) {
// Voice.sprat("注意在附近50米范围内进行采集",0);
DialogSettings.style = DialogSettings.STYLE.STYLE_IOS;
MessageDialog.show((AppCompatActivity) Objects.requireNonNull(getActivity()), "提示", "注意在任务附近50米范围内进行采集", "确定").setOnOkButtonClickListener(new OnDialogButtonClickListener() {
@ -295,7 +296,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
return false;
}
});
}else {
} else {
initGather();
}
}
@ -335,19 +336,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
if (taskStatus != 1) {
initPolygonTask(HttpInterface.RECEIVED_POLYGON_TASK, poiEntity.getTaskId(), true);
} else {
new Thread(new Runnable() {
@Override
public void run() {
PoiEntity taskIdPoiEntity = poiDao.getTaskIdPoiEntity(poiEntity.getTaskId());
Objects.requireNonNull(getActivity()).runOnUiThread(new Runnable() {
@Override
public void run() {
initCompleteTask(HttpInterface.SUBMIT_POLYGON_TASK, poiEntity.getTaskId(), true, taskIdPoiEntity);
}
});
}
}).start();
initCompleteTask(HttpInterface.SUBMIT_POLYGON_TASK, poiEntity);
}
} else if (type == 1) {//poi的领取类型
receivedTaskByNet(HttpInterface.RECEIVED_POI_TASK, poiEntity.getTaskId(), true, 5);
@ -365,7 +354,6 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
/**
* @param url 筛选充电站领取任务
* @param
*/
private void chargingTaskByWork(String url, int taskId, boolean isSaver, int statusId) {
showLoadingDialog();
@ -395,9 +383,9 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
chargingStationEntity.setCreateTime(stationBean.getEndDate());
chargingStationEntity.setPrecision(stationBean.getPrice() + "");
chargingStationEntity.setAddress(stationBean.getAddress());
if(stationBean.getTelephone()==null||stationBean.getTelephone().equals("")||stationBean.getTelephone().equals("null")){
if (stationBean.getTelephone() == null || stationBean.getTelephone().equals("") || stationBean.getTelephone().equals("null")) {
chargingStationEntity.setTelPhone(null);
}else {
} else {
chargingStationEntity.setTelPhone(stationBean.getTelephone());
}
chargingStationEntity.setType(stationBean.getType());
@ -434,8 +422,8 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
}
InsertAndUpdateUtils.getInstance().insertOrUpdateChargingPile(getActivity(), chargingPileEntityList);
}
// senMessageMarker(chargingStationEntity.getType(), chargingStationEntity.getY(), chargingStationEntity.getX());
if (statusId==1||statusId==5){
// senMessageMarker(chargingStationEntity.getType(), chargingStationEntity.getY(), chargingStationEntity.getX());
if (statusId == 1 || statusId == 5) {
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), chargingStationEntity);
}
Objects.requireNonNull(getActivity()).runOnUiThread(new Runnable() {
@ -447,7 +435,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
obtain.what = Constant.GATHER_GET_MAP;
obtain.obj = chargingStationEntity;
EventBus.getDefault().post(obtain);
}else {
} else {
Message obtain = Message.obtain();
obtain.what = Constant.JOB_WORD_MONITOR;
obtain.obj = true;
@ -465,7 +453,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
obtain.what = Constant.GATHER_GET_MAP;
obtain.obj = taskIdPoiEntity;
EventBus.getDefault().post(obtain);
}else {
} else {
Message obtain = Message.obtain();
obtain.what = Constant.JOB_WORD_MONITOR;
obtain.obj = true;
@ -481,6 +469,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
Toast.makeText(getActivity(), response.getMessage(), Toast.LENGTH_SHORT).show();
}
}
@Override
public void onError(Throwable e, int id) {
dismissLoadingDialog();
@ -547,8 +536,8 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
initViewByTaskStatus(1);
Toast.makeText(getActivity(), "领取成功", Toast.LENGTH_SHORT).show();
if (aBoolean) {
initCompleteTask(HttpInterface.SUBMIT_POLYGON_TASK, GatherGetFragment.this.poiEntity.getTaskId(), true, polygonEntity);
}else {
initCompleteTask(HttpInterface.SUBMIT_POLYGON_TASK , polygonEntity);
} else {
Message obtains = Message.obtain();
obtains.what = Constant.JOB_WORD_MONITOR;
obtains.obj = true;
@ -600,7 +589,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
@Override
public void run() {
poiDao.deletePoiEntity(poiEntity);
if(poiEntity.getType()==2){
if (poiEntity.getType() == 2) {
chargingPileDao.deleteChargingFidPileEntity(poiEntity.getId());
}
Objects.requireNonNull(getActivity()).runOnUiThread(new Runnable() {
@ -632,16 +621,15 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
/**
* @param url 面妆任务立即采集
* @param b
*/
private void initCompleteTask(String url, int taskId, boolean b, PoiEntity poiEntity) {
if (taskId == 0) {
private void initCompleteTask(String url, PoiEntity poiEntity) {
if (poiEntity.getTaskId() == 0) {
Toast.makeText(getActivity(), "无此任务", Toast.LENGTH_SHORT).show();
return;
}
showLoadingDialog();
HttpParams httpParams = new HttpParams();
httpParams.put("id", taskId);
httpParams.put("id", poiEntity.getTaskId());
OkGoBuilder.getInstance()
.Builder(getActivity())
.url(url)
@ -729,7 +717,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
}
/**
* @param url poi类型对应的url
* @param url poi类型对应的url
*/
private void receivedTaskByNet(String url, int taskId, boolean isSaver, int statusId) {
showLoadingDialog();
@ -760,10 +748,10 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
poiListEntity.setAddress(listBean.getAddress());
poiListEntity.setType(listBean.getType());
poiListEntity.setIsExclusive(listBean.getIsExclusive());
if (listBean.getType()==1){
if(listBean.getTelephone()==null||listBean.getTelephone().equals("")||listBean.getTelephone().equals("null")){
if (listBean.getType() == 1) {
if (listBean.getTelephone() == null || listBean.getTelephone().equals("") || listBean.getTelephone().equals("null")) {
poiListEntity.setTelPhone(null);
}else {
} else {
poiListEntity.setTelPhone(listBean.getTelephone());
}
}
@ -787,8 +775,8 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
poiListEntity.setY(latLineString.get(0).latitude + "");
break;
}
//senMessageMarker(poiEntity.getType(), poiEntity.getY(), poiEntity.getX());
if (statusId==1||statusId==5){
//senMessageMarker(poiEntity.getType(), poiEntity.getY(), poiEntity.getX());
if (statusId == 1 || statusId == 5) {
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiListEntity);
}
Objects.requireNonNull(getActivity()).runOnUiThread(new Runnable() {
@ -800,7 +788,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
obtain.what = Constant.GATHER_GET_MAP;
obtain.obj = poiListEntity;
EventBus.getDefault().post(obtain);
}else {
} else {
Message obtain = Message.obtain();
obtain.what = Constant.JOB_WORD_MONITOR;
obtain.obj = true;
@ -819,7 +807,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
obtain.what = Constant.GATHER_GET_MAP;
obtain.obj = taskIdPoiEntity;
EventBus.getDefault().post(obtain);
}else {
} else {
Message obtain = Message.obtain();
obtain.what = Constant.JOB_WORD_MONITOR;
obtain.obj = true;
@ -855,8 +843,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
}
/**
* @param url
* 不同任务类型对应的url
* @param url 不同任务类型对应的url
*/
private void taskByNet(String url, int taskId, boolean isSaver, int statusId) {
showLoadingDialog();
@ -907,7 +894,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
break;
}
//senMessageMarker(poiEntity.getType(), poiEntity.getY(), poiEntity.getX());
if (statusId==1||statusId==5){
if (statusId == 1 || statusId == 5) {
InsertAndUpdateUtils.getInstance().insertOrUpdate(getContext(), poiListEntity);
}
Objects.requireNonNull(getActivity()).runOnUiThread(new Runnable() {
@ -919,7 +906,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
obtain.what = Constant.GATHER_GET_MAP;
obtain.obj = poiListEntity;
EventBus.getDefault().post(obtain);
}else {
} else {
Message obtain = Message.obtain();
obtain.what = Constant.JOB_WORD_MONITOR;
obtain.obj = true;
@ -937,7 +924,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
obtain.what = Constant.GATHER_GET_MAP;
obtain.obj = taskIdPoiEntity;
EventBus.getDefault().post(obtain);
}else {
} else {
Message obtain = Message.obtain();
obtain.what = Constant.JOB_WORD_MONITOR;
obtain.obj = true;
@ -979,7 +966,7 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
super.onStop();
gatherGetBuilder.append("onStop ,");
}
@Override
public void onDestroy() {
super.onDestroy();

View File

@ -292,6 +292,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
ivPicture.setImageDrawable(null);
ivPicture.setTag(null);
return false;
}
});
@ -307,6 +308,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
ivPictures.setImageDrawable(null);
ivPictures.setTag(null);
return false;
}
});

View File

@ -292,6 +292,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
ivPanorama.setImageDrawable(null);
ivPanorama.setTag(null);
return false;
}
});
@ -306,6 +307,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
ivName.setImageDrawable(null);
ivName.setTag(null);
return false;
}
});
@ -320,6 +322,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
ivElse.setImageDrawable(null);
ivElse.setTag(null);
return false;
}
});
@ -334,6 +337,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
ivInternal.setImageDrawable(null);
ivInternal.setTag(null);
return false;
}
});
@ -349,6 +353,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
ivCard.setImageDrawable(null);
ivCard.setTag(null);
return false;
}
});

View File

@ -12,6 +12,7 @@ import android.graphics.Color;
import android.graphics.Matrix;
import android.os.Bundle;
import android.os.Message;
import android.provider.Settings;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
@ -48,6 +49,7 @@ import com.lzy.okgo.OkGo;
import com.lzy.okgo.model.HttpParams;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.activity.FragmentManagement;
import com.navinfo.outdoor.activity.MainActivity;
import com.navinfo.outdoor.adapter.MarkerAdapter;
import com.navinfo.outdoor.api.Constant;
import com.navinfo.outdoor.base.BaseDrawerFragment;
@ -143,8 +145,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
private final int MARKER_LINE = 2;
private final int MARKER_FACE = 1;
private final int MARKER_BIG = 4;
private boolean isBack = false;
private HashMap<String, List<Marker>> removableHashMap;
private ArrayList<LatLng> latList;
private ArrayList<PoiEntity> poiEntityArrayList;
@ -188,10 +188,10 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
calendar.setTimeInMillis(System.currentTimeMillis());
String presentData = formatter.format(calendar.getTime());//当前时间
int result = presentData.compareTo(newData);
if (result>=0){
if (result >= 0) {
//进行请求
initMessageNotice();
}else {//无需请求
} else {//无需请求
}
}
Message msg = Message.obtain();
@ -199,7 +199,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
EventBus.getDefault().post(msg);
dismissLoadingDialog();
removableHashMap.clear();
if (Constant.USHERED!=null){
if (Constant.USHERED != null) {
initThread(); // 刷新筛选的本地数据
}
if (Constant.currentLocation != null) {
@ -208,6 +208,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
Toast.makeText(getActivity(), "未开启定位服务", Toast.LENGTH_SHORT).show();
}
}
/*
* 给时间加上几个小时
* @param day 当前时间 格式yyyy-MM-dd HH:mm:ss
@ -269,6 +270,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
Toast.makeText(getActivity(), messageNoticeBean.getMessage() + "", Toast.LENGTH_SHORT).show();
}
}
@Override
public void onError(Throwable e, int id) {
dismissLoadingDialog();
@ -332,7 +334,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
uiSettings.setLogoScale(0.7f);
uiSettings.setRotateGesturesEnabled(false);//禁止地图旋转手势.
uiSettings.setTiltGesturesEnabled(false);//禁止倾斜手势.
showLoadingDialog();
//开启定位权限
checkNetWork();
removables = new ArrayList<>();//存储网络数据的marker数据线
@ -345,6 +346,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
tencentMap.addOnMapLoadedCallback(new TencentMap.OnMapLoadedCallback() {
@Override
public void onMapLoaded() {
if (Constant.currentLocation != null) {
// 地图中心点位置设置为当前用户所在位置
CameraUpdate cameraSigma =
@ -356,6 +358,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
tencentMap.animateCamera(cameraSigma, new TencentMap.CancelableCallback() {
@Override
public void onFinish() {
dismissLoadingDialog();
PoiDatabase poiDatabase = PoiDatabase.getInstance(getContext());
poiDao = poiDatabase.getPoiDao();
treasureBuilder.append("onFinish-获取到当前位置,");
@ -366,12 +369,19 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
//检查是否有没有填完的页面
initSharePre();
}
@Override
public void onCancel() {
dismissLoadingDialog();
}
});
} else {
dismissLoadingDialog();
Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
startActivity(intent);
Toast.makeText(getActivity(), "请先开启位置信息,在重新打开程序", Toast.LENGTH_SHORT).show();
getActivity().finish();
}
Constant.markerClickListener = markerClickListener;
tencentMap.setOnMarkerClickListener(Constant.markerClickListener);
@ -382,6 +392,16 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
treasureMap.getLayoutParams().width = widthHeight[0];
treasureMap.getLayoutParams().height = widthHeight[1];
}
/* //监听回传
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode==101){
//开启定位权限
checkNetWork();
}
super.onActivityResult(requestCode, resultCode, data);
}*/
/**
* 得到电话区号电话位数
*/
@ -407,6 +427,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
Constant.TelLength = telLength;
}
}
@Override
public void onError(Throwable e, int id) {
Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show();
@ -439,31 +460,32 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
}
private void iniUserLocation() {
String encode = Geohash.getInstance().encode(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude());
HttpParams httpParams = new HttpParams();
httpParams.put("geom", encode);
long time = System.currentTimeMillis();
httpParams.put("datetime", time);
OkGoBuilder.getInstance().Builder(getActivity())
.url(HttpInterface.USER_LOCATION)
.cls(UserBean.class)
.params(httpParams)
.token(Constant.ACCESS_TOKEN)
.postRequest(new Callback<UserBean>() {
@Override
public void onSuccess(UserBean response, int id) {
if (response.getCode() == 200) {
Toast.makeText(getActivity(), response.getMessage() + "", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(getActivity(), response.getMessage() + "", Toast.LENGTH_SHORT).show();
Log.d("TAG", "onSuccess: " + response.getCode() + response.getMessage() + "" + response.getBody());
}
String encode = Geohash.getInstance().encode(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude());
HttpParams httpParams = new HttpParams();
httpParams.put("geom", encode);
long time = System.currentTimeMillis();
httpParams.put("datetime", time);
OkGoBuilder.getInstance().Builder(getActivity())
.url(HttpInterface.USER_LOCATION)
.cls(UserBean.class)
.params(httpParams)
.token(Constant.ACCESS_TOKEN)
.postRequest(new Callback<UserBean>() {
@Override
public void onSuccess(UserBean response, int id) {
if (response.getCode() == 200) {
Toast.makeText(getActivity(), response.getMessage() + "", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(getActivity(), response.getMessage() + "", Toast.LENGTH_SHORT).show();
Log.d("TAG", "onSuccess: " + response.getCode() + response.getMessage() + "" + response.getBody());
}
@Override
public void onError(Throwable e, int id) {
Log.d("TAG", "onSuccess:" + e.getMessage() + "");
}
});
}
@Override
public void onError(Throwable e, int id) {
Log.d("TAG", "onSuccess:" + e.getMessage() + "");
}
});
}
private void initList(TencentLocation tencentLocation) {
@ -485,7 +507,6 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
String userEncode = Geohash.getInstance().encode(tencentLocation.getLatitude(), tencentLocation.getLongitude());
OkGo.getInstance().cancelTag(this);
Log.d("TAG", "initList: " + Constant.USHERED);
showLoadingDialog();
// 请求方式和请求url
HttpParams httpParams = new HttpParams();
httpParams.put("userGeo", userEncode);
@ -495,6 +516,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
httpParams.put("pageNum", treasurePage);
httpParams.put("type", task_type);
httpParams.put("isExclusive", limit_type);
showLoadingDialog();
OkGoBuilder.getInstance()
.Builder(getActivity())
.url(HttpInterface.TASK_LIST)
@ -556,7 +578,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
.arrowTexture(bitmapLine);
// 绘制折线
Polyline polyline = tencentMap.addPolyline(polylineOptions);
if (polyline!=null){
if (polyline != null) {
polyline.setZIndex(MARKER_LINE);
removables.add(polyline);
if (latLineString != null && latLineString.size() > 0) {
@ -579,7 +601,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
strokeColor(0xff000000).
//边线宽度15像素
strokeWidth(5));
if (polygon!=null){
if (polygon != null) {
polygon.setZIndex(MARKER_FACE);
removables.add(polygon);
com.vividsolutions.jts.geom.Point centroid = geometry.getCentroid();
@ -693,6 +715,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
EventBus.getDefault().post(obtain);
}
}
@Override
public void onError(Throwable e, int id) {
dismissLoadingDialog();
@ -758,7 +781,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
.arrowTexture(bitmapLine);
// 绘制折线
Polyline polyline = tencentMap.addPolyline(polylineOptions);
if (polyline!=null){
if (polyline != null) {
polyline.setZIndex(MARKER_LINE);
removableScreenMarker.add(polyline);
if (latLineString != null && latLineString.size() > 0) {
@ -778,7 +801,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
strokeColor(0xff000000).
//边线宽度15像素
strokeWidth(25));
if (polygon!=null){
if (polygon != null) {
polygon.setZIndex(MARKER_FACE);
removableScreenMarker.add(polygon);
com.vividsolutions.jts.geom.Point centroid = geometry.getCentroid();
@ -837,7 +860,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
int taskStatus = Constant.TASK_STARTUP;
int type = Constant.TASK_TYPE;
int limit = Constant.LIMIT_TYPE;
if (poiDao==null){
if (poiDao == null) {
return;
}
new Thread(new Runnable() {
@ -879,10 +902,10 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
} else if (poiEntity.getType() == 4) {//道路录像
bitmapLine = BitmapDescriptorFactory.fromResource(R.drawable.poi_video_arrows);
}
if (poiEntity.getTaskStatus()==1){
color= Color.parseColor("#FFE70C");
}else {
color= Color.parseColor("#BDBDBD");
if (poiEntity.getTaskStatus() == 1) {
color = Color.parseColor("#FFE70C");
} else {
color = Color.parseColor("#BDBDBD");
}
List<LatLng> latLineString = GeometryTools.getLatLags(geo);
// 构造 PolylineOnions
@ -898,7 +921,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
.arrowTexture(bitmapLine);
// 绘制折线
Polyline polyline = tencentMap.addPolyline(polylineOptions);
if (polyline!=null){
if (polyline != null) {
polyline.setZIndex(MARKER_LINE);
removablesLocality.add(polyline);
if (latLineString != null && latLineString.size() > 0) {
@ -913,7 +936,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
fillColor(Color.parseColor("#97E0E7EC")).//边线颜色为黑色
strokeColor(0xff00ff00).//边线宽度15像素
strokeWidth(5));
if (polygon!=null){
if (polygon != null) {
polygon.setZIndex(MARKER_FACE);
removablesLocality.add(polygon);
Point centroid = geometry.getCentroid();
@ -1077,7 +1100,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
switch (poiEntity.getType()) {
case 1:
DialogSettings.style = DialogSettings.STYLE.STYLE_IOS;
DialogSettings.cancelable=false;
DialogSettings.cancelable = false;
MessageDialog.show((AppCompatActivity) Objects.requireNonNull(getContext()), "提示", "你poi页面还有未提交完的数据之前的成果已保存点击确定可继续作业", "确定").setOkButton(new OnDialogButtonClickListener() {
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
@ -1093,7 +1116,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
break;
case 2:
DialogSettings.style = DialogSettings.STYLE.STYLE_IOS;
DialogSettings.cancelable=false;
DialogSettings.cancelable = false;
MessageDialog.show((AppCompatActivity) Objects.requireNonNull(getContext()), "提示", "你充电站页面还有未提交完的数据", "确定").setOkButton(new OnDialogButtonClickListener() {
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
@ -1109,7 +1132,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
break;
case 3:
DialogSettings.style = DialogSettings.STYLE.STYLE_IOS;
DialogSettings.cancelable=false;
DialogSettings.cancelable = false;
MessageDialog.show((AppCompatActivity) Objects.requireNonNull(getContext()), "提示", "你poi录像页面还有未提交完的数据", "确定").setOkButton(new OnDialogButtonClickListener() {
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
@ -1125,7 +1148,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
break;
case 4:
DialogSettings.style = DialogSettings.STYLE.STYLE_IOS;
DialogSettings.cancelable=false;
DialogSettings.cancelable = false;
MessageDialog.show((AppCompatActivity) Objects.requireNonNull(getContext()), "提示", "你道路页面还有未提交完的数据", "确定").setOkButton(new OnDialogButtonClickListener() {
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
@ -1141,7 +1164,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
break;
case 5:
DialogSettings.style = DialogSettings.STYLE.STYLE_IOS;
DialogSettings.cancelable=false;
DialogSettings.cancelable = false;
MessageDialog.show((AppCompatActivity) Objects.requireNonNull(getContext()), "提示", "你其他页面还有未提交完的数据", "确定").setOkButton(new OnDialogButtonClickListener() {
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
@ -1190,7 +1213,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
if (bigMarker != null) {
bigMarker.setVisible(false);
}
if (gatherMarker!=null){
if (gatherMarker != null) {
gatherMarker.setVisible(false);
}
PoiEntity poiEntity = (PoiEntity) data.obj;
@ -1335,6 +1358,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
}
}
}
/*
* 控制主界面各个按钮的显示状态
*/
@ -1348,6 +1372,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
ivFilter.setVisibility(visitable);
ivMessage.setVisibility(visitable);
}
/*
* 设置定位图标样式
*/
@ -1403,23 +1428,24 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
DateFormat formatter = new SimpleDateFormat("yyyyMMdd");
String newFormat = formatter.format(new Date(System.currentTimeMillis()));
String pictures_time = sharedPreferences.getString("pictures_time", null);
if (pictures_time==null){
sharedEdit.putString("pictures_time",newFormat);
if (pictures_time == null) {
sharedEdit.putString("pictures_time", newFormat);
sharedEdit.apply();
logFile = new File(Constant.LOG_FOLDER + "/" + newFormat + ".txt");
}else {
if (pictures_time.equals(newFormat)){
} else {
if (pictures_time.equals(newFormat)) {
logFile = new File(Constant.LOG_FOLDER + "/" + pictures_time + ".txt");
}else {
} else {
logFile = new File(Constant.LOG_FOLDER + "/" + newFormat + ".txt");
}
}
treasureBuilder = new StringBuilder();
treasureBuilder.append("TreasureFragment-onViewCreated-initData,");
if (Constant.USHERED!=null){
if (Constant.USHERED != null) {
treasureBuilder.append("userId:").append(Constant.USHERED).append(",");
}
}
@Override
public void onStart() {
super.onStart();
@ -1455,7 +1481,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
treasureBuilder.append("onDestroy");
treasureBuilder.append("\r\n");
FileUtils.writeFile(logFile.getAbsolutePath(), treasureBuilder.toString(), true);
if (EventBus.getDefault().isRegistered(this)){
if (EventBus.getDefault().isRegistered(this)) {
EventBus.getDefault().unregister(this);
}
super.onDestroy();
@ -1489,10 +1515,11 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
case R.id.iv_location://定位:
treasureBuilder.append("点击了定位的按钮,");
if (Constant.currentLocation != null) {
CameraPosition cameraPosition = tencentMap.getCameraPosition();
CameraUpdate cameraSigma =
CameraUpdateFactory.newCameraPosition(new CameraPosition(
new LatLng(Constant.currentLocation.getLatitude(), Constant.currentLocation.getLongitude()), //中心点坐标地图目标经纬度
tencentMap.getCameraPosition().zoom, //目标缩放级别
cameraPosition==null?10:cameraPosition.zoom, //目标缩放级别
0, //目标倾斜角[0.0 ~ 45.0] (垂直地图时为0)
0)); //目标旋转角 0~360° (正北方为0)
tencentMap.animateCamera(cameraSigma);
@ -1645,6 +1672,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
* 检查网络状态
*/
private void checkNetWork() {
showLoadingDialog();
if (NetWorkUtils.iConnected(Objects.requireNonNull(getContext()))) { // 当前网络可用
checkMyLocation();
} else { // 当前网络不可用
@ -1653,6 +1681,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
}
}
/**
* 检查所需权限
*/
@ -1665,7 +1694,11 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
// 1.2.1.2 用户没有给予权限 作出相应提示
// 1.2.2 某些5.0权限的手机执行相应操作
XXPermissions.with(this)
// 位置权限
.permission(Permission.ACCESS_COARSE_LOCATION)
.permission(Permission.ACCESS_FINE_LOCATION)
.permission(Permission.ACCESS_MEDIA_LOCATION)
//.permission(Permission.ACCESS_BACKGROUND_LOCATION)
.request(new OnPermissionCallback() {
@Override
public void onGranted(List<String> permissions, boolean all) {
@ -1677,13 +1710,21 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
Toast.makeText(getActivity(), "申请权限失败", Toast.LENGTH_SHORT).show();
}
}
@Override
public void onDenied(List<String> permissions, boolean never) {
dismissLoadingDialog();
if (never) {
dismissLoadingDialog();
Toast.makeText(getActivity(), "被永久拒绝授权,请手动授予定位权限", Toast.LENGTH_SHORT).show();
// 如果是被永久拒绝就跳转到应用权限系统设置页面
XXPermissions.startPermissionActivity(Objects.requireNonNull(getActivity()), permissions);
DialogSettings.style = DialogSettings.STYLE.STYLE_IOS;
DialogSettings.cancelable = false;
MessageDialog.show((AppCompatActivity) Objects.requireNonNull(getContext()), "提示", permissions.toString() + " 被永久拒绝授权,请手动授予定位权限,", "确定").setOkButton(new OnDialogButtonClickListener() {
@Override
public boolean onClick(BaseDialog baseDialog, View v) {
XXPermissions.startPermissionActivity(Objects.requireNonNull(getActivity()), permissions);
getActivity().finish();
return false;
}
});
}
}
});
@ -1720,7 +1761,7 @@ public class TreasureFragment extends BaseFragment implements View.OnClickListen
initEntity(marker, true);
} else {
Geometry intersection = polygon.intersection(multiPoint);
if (intersection!=null){
if (intersection != null) {
if (intersection.getGeometryType().equals("MultiPoint")) {
List<LatLng> latList = GeometryTools.getLatList(intersection);
for (int i = 0; i < latList.size(); i++) {

View File

@ -292,6 +292,40 @@ public class AWMp4ParserHelper {
return new File(folderPath+"/"+(maxIndex+1)+".webp");
}
public File obtainJpgFilePath(String folderPath) {
if (folderPath == null) {
return null;
}
File folderFile = new File(folderPath);
if (!folderFile.exists()) {
folderFile.mkdirs();
}
File[] fileList = folderFile.listFiles(new FileFilter() {
@Override
public boolean accept(File pathname) {
if (pathname.getName().endsWith(".jpg")){
return true;
}
return false;
}
});
if (fileList == null || fileList.length==0) {
return new File(folderPath+"/0.jpg");
}
int maxIndex = 0;
for (int i = 0; i < fileList.length; i++) {
File file = fileList[i];
if (file!=null) {
int index = Integer.parseInt(file.getName().replace(".jpg", ""));
if (index>=maxIndex) {
maxIndex = index;
}
}
}
return new File(folderPath+"/"+(maxIndex+1)+".jpg");
}
/**
* 根据提供的uuid获取指定目录下所有的视频文件
* */
@ -311,7 +345,7 @@ public class AWMp4ParserHelper {
return fileList;
}
public File getFilePath(String uuid){
File folderFile = new File(Constant.PICTURE_FOLDER+"/"+uuid+"/");
File folderFile = new File(Constant.PICTURE_FOLDER+"/"+uuid);
return folderFile;
}

View File

@ -136,7 +136,6 @@
/>
<TextView
android:id="@+id/region"
android:layout_toRightOf="@id/tv_region"
android:layout_width="wrap_content"
style="@style/user_hint_style"
android:layout_centerVertical="true"

View File

@ -469,7 +469,7 @@
android:layout_below="@id/image_else"
android:layout_centerHorizontal="true"
android:layout_margin="5dp"
android:text="充电站指引牌"
android:text="*充电站指引牌"
android:textColor="@color/pickerview_wheelview_textcolor_divider"
android:textSize="12sp" />
@ -506,7 +506,7 @@
android:layout_below="@id/image_scutcheon"
android:layout_centerHorizontal="true"
android:layout_margin="5dp"
android:text="停车收费标牌"
android:text="*停车收费标牌"
android:textColor="@color/pickerview_wheelview_textcolor_divider"
android:textSize="12sp" />

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
android:layout_height="match_parent"
android:orientation="vertical">
@ -72,10 +73,9 @@
android:id="@+id/ll_pictures"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="20dp"
android:orientation="horizontal"
app:layout_constraintLeft_toLeftOf="@id/ll_name"
app:layout_constraintStart_toStartOf="@+id/tv_message"
app:layout_constraintTop_toBottomOf="@id/ll_name">
<TextView

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
android:layout_height="match_parent"
android:orientation="vertical">
@ -79,17 +80,18 @@
android:id="@+id/ll_pictures"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="20dp"
android:orientation="horizontal"
app:layout_constraintLeft_toLeftOf="@id/ll_name"
app:layout_constraintStart_toStartOf="@+id/tv_message"
app:layout_constraintTop_toBottomOf="@id/ll_name">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="02.拍摄"
android:textColor="@color/black"
android:textSize="16sp" />
<TextView
android:id="@+id/tv_short"
style="@style/user_style"
@ -100,6 +102,7 @@
android:text="手动拍摄"
android:textColor="@color/white"
android:textSize="15sp" />
<TextView
android:id="@+id/tv_combo"
style="@style/user_style"