修改bug
This commit is contained in:
parent
157b67ecab
commit
6d6382333b
@ -295,7 +295,7 @@ public class GuidanceActivity extends BaseActivity {
|
||||
dismissLoadingDialog();
|
||||
String message = e.getMessage();
|
||||
assert message != null;
|
||||
if (message.equals("timeout")){
|
||||
if (message.equals("timeout")||message.equals("Read time out")){
|
||||
Toast.makeText(GuidanceActivity.this, "请求超时", Toast.LENGTH_SHORT).show();
|
||||
}else {
|
||||
Toast.makeText(GuidanceActivity.this, message, Toast.LENGTH_SHORT).show();
|
||||
|
@ -159,9 +159,15 @@ public class HomeActivity extends BaseActivity{
|
||||
DialogSettings.style = DialogSettings.STYLE.STYLE_IOS;
|
||||
MessageDialog.show(this, "提示", dataString, "确定");
|
||||
}
|
||||
}else if (data.what==Constant.EVENT_MESSAGE){
|
||||
String dataString = (String) data.obj;
|
||||
if (!dataString.equals("")){
|
||||
Toast.makeText(this, dataString, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if (!BackHandlerHelper.handleBackPress(this)) {
|
||||
|
@ -320,7 +320,7 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
|
||||
dismissLoadingDialog();
|
||||
String message = e.getMessage();
|
||||
assert message != null;
|
||||
if (message.equals("timeout") || message.equals("Read time out")) {
|
||||
if (message.equals("timeout") || message.equals("Read time out") || message.equals("read time out")||message.equals("TimeOut")) {
|
||||
Toast.makeText(LoginActivity.this, "请求超时", Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
Toast.makeText(LoginActivity.this, message, Toast.LENGTH_SHORT).show();
|
||||
|
@ -569,6 +569,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
camera.open();
|
||||
ivMap.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -579,6 +580,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
capturePicture.setChecked(false);
|
||||
capturePicture.setText("继续采集");
|
||||
}
|
||||
ivMap.onRestart();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -593,6 +595,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
ivMap.onPause();
|
||||
picturesBuilder.append("onPause ,");
|
||||
camera.close();
|
||||
stopTimer();
|
||||
@ -601,6 +604,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
ivMap.onStop();
|
||||
picturesBuilder.append("onStop ,");
|
||||
}
|
||||
|
||||
@ -608,6 +612,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
camera.destroy();
|
||||
ivMap.onDestroy();
|
||||
systemTTS.stopSpeak();
|
||||
stopTimer();
|
||||
if (polyline != null) {
|
||||
|
@ -64,28 +64,6 @@ public class StaySubmitAdapter extends RecyclerView.Adapter<StaySubmitAdapter.Vi
|
||||
if (poiEntity.isChecked()) {
|
||||
PoiEntityDeleteUtil.getInstance().deleteUtil(context,poiEntity);
|
||||
PoiDatabase.getInstance(context).getPoiDao().deletePoiEntity(poiEntity);
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
List<ChargingPileEntity> chargingPileEntityList = PoiDatabase.getInstance(context).getChargingPileDao().getChargingPileByStationId(poiEntity.getId());
|
||||
if (chargingPileEntityList != null && !chargingPileEntityList.isEmpty()) {
|
||||
for (ChargingPileEntity chargingPileEntity : chargingPileEntityList) {
|
||||
List<File> chargingPileFileList = new ArrayList<>();
|
||||
if (chargingPileEntity.getPhotos() != null && !chargingPileEntity.getPhotos().isEmpty()) {
|
||||
for (String photoPath : chargingPileEntity.getPhotos()) {
|
||||
chargingPileFileList.add(new File(photoPath));
|
||||
}
|
||||
}
|
||||
PoiDatabase.getInstance(context).getChargingPileDao().deleteChargingPileEntity(chargingPileEntity);
|
||||
for (int i = 0; i < chargingPileFileList.size(); i++) {
|
||||
chargingPileFileList.get(i).delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
PoiDatabase.getInstance(context).getChargingPileDao().deleteChargingFidPileEntity(poiEntity.getId());
|
||||
|
||||
}
|
||||
}).start();
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ public class Constant {
|
||||
public static final String GET_ERR_MESSAGE2 = "manifest 中配置的 key 不正确";
|
||||
public static final String GET_ERR_MESSAGE3 = "自动加载libtencentloc.so失败";
|
||||
public static final String ROOT_FOLDER = SdkFolderCreate.getSDPath() + "/navinfoOutDoor";
|
||||
|
||||
public static String BASE_FOLDER = ROOT_FOLDER;
|
||||
//保存图片的目录
|
||||
public static String PICTURE_FOLDER;
|
||||
@ -138,6 +139,7 @@ public class Constant {
|
||||
public static final int NEST_WORD_REGISTER=51;//所有的保存
|
||||
public static final int STAY_SUBMIT_ITEM = 52;//待提交
|
||||
public static final int HAS_SUBMIT_ITEM = 53;//已提交
|
||||
public static final int EVENT_MESSAGE = 55;//toast 提示
|
||||
public static final String INTENT_POI_VIDEO_TYPE = "poi_video_type";
|
||||
public static int NUMBER = 200; //任务个数
|
||||
public static int LIMIT_TYPE = -1; //权限类型,普通任务-0,专属任务-1
|
||||
@ -163,7 +165,7 @@ public class Constant {
|
||||
public static SlidingUpPanelLayout SLIDING_LAYOUT = null;//設置
|
||||
public static boolean IS_FILTER_LIST_ITEM = true;//poi页面的查重
|
||||
public static TencentMap.OnMarkerClickListener markerClickListener = null;
|
||||
public static final String NAVIN_FO = "11.13";//版本日期
|
||||
public static final String NAVIN_FO = "11.15";//版本日期
|
||||
//marker
|
||||
public static final BitmapDescriptor MARKER_POI_SHOW = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_show);
|
||||
public static final BitmapDescriptor MARKER_CHARGE_SHOW = BitmapDescriptorFactory.fromResource(R.drawable.marker_charge_show);
|
||||
|
@ -414,6 +414,8 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}else {
|
||||
Toast.makeText(getActivity(), "无法读取数据库,请尝试重启程序!", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,9 +3,12 @@ package com.navinfo.outdoor.util;
|
||||
import android.content.Context;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.navinfo.outdoor.room.ChargingPileEntity;
|
||||
import com.navinfo.outdoor.room.PoiDatabase;
|
||||
import com.navinfo.outdoor.room.PoiEntity;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class PoiEntityDeleteUtil {
|
||||
@ -19,33 +22,64 @@ public class PoiEntityDeleteUtil {
|
||||
}
|
||||
|
||||
public void deleteUtil(Context context, PoiEntity poiEntity) {
|
||||
switch (poiEntity.getType()){
|
||||
switch (poiEntity.getType()) {
|
||||
case 1:
|
||||
case 2:
|
||||
case 5:
|
||||
initDelete(poiEntity);
|
||||
initDelete(context, poiEntity);
|
||||
break;
|
||||
case 2:
|
||||
initPileDelete(context, poiEntity);
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
initPicture(poiEntity);
|
||||
initPicture(context, poiEntity);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void initPicture(PoiEntity poiEntity) {
|
||||
private void initPileDelete(Context context, PoiEntity poiEntity) {
|
||||
if (poiEntity != null) {
|
||||
if (poiEntity.getPhotoInfo() != null) {
|
||||
for (int i = 0; i < poiEntity.getPhotoInfo().size(); i++) {
|
||||
File file = new File(poiEntity.getPhotoInfo().get(i).getPhoto());
|
||||
file.delete();
|
||||
}
|
||||
}
|
||||
if (poiEntity.getId() != null) {
|
||||
List<ChargingPileEntity> chargingPileEntityList = PoiDatabase.getInstance(context).getChargingPileDao().getChargingPileByStationId(poiEntity.getId());
|
||||
if (chargingPileEntityList != null && !chargingPileEntityList.isEmpty()) {
|
||||
for (ChargingPileEntity chargingPileEntity : chargingPileEntityList) {
|
||||
List<File> chargingPileFileList = new ArrayList<>();
|
||||
if (chargingPileEntity.getPhotos() != null && !chargingPileEntity.getPhotos().isEmpty()) {
|
||||
for (String photoPath : chargingPileEntity.getPhotos()) {
|
||||
chargingPileFileList.add(new File(photoPath));
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < chargingPileFileList.size(); i++) {
|
||||
chargingPileFileList.get(i).delete();
|
||||
}
|
||||
PoiDatabase.getInstance(context).getChargingPileDao().deleteChargingPileEntity(chargingPileEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void initPicture(Context context, PoiEntity poiEntity) {
|
||||
List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(poiEntity.getId());
|
||||
for (int i = 0; i < fileListByUUID.size(); i++) {
|
||||
fileListByUUID.get(i).delete();
|
||||
}
|
||||
File filePath = AWMp4ParserHelper.getInstance().getFilePath(poiEntity.getId());
|
||||
filePath.delete();
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void initDelete(PoiEntity poiEntity) {
|
||||
if (poiEntity!=null){
|
||||
if (poiEntity.getPhotoInfo()!=null){
|
||||
private void initDelete(Context context, PoiEntity poiEntity) {
|
||||
if (poiEntity != null) {
|
||||
if (poiEntity.getPhotoInfo() != null) {
|
||||
for (int i = 0; i < poiEntity.getPhotoInfo().size(); i++) {
|
||||
File file = new File(poiEntity.getPhotoInfo().get(i).getPhoto());
|
||||
file.delete();
|
||||
|
@ -93,7 +93,7 @@ public class TalentLocationUtils implements TencentLocationListener{
|
||||
*/
|
||||
@Override
|
||||
public void onLocationChanged(TencentLocation tencentLocation, int i, String s) {
|
||||
if (i == TencentLocation.ERROR_OK) {
|
||||
if (i == TencentLocation.ERROR_OK) {//定位成功
|
||||
Location location = new Location(tencentLocation.getProvider());
|
||||
// //设置经纬度以及精度
|
||||
location.setLatitude(tencentLocation.getLatitude());
|
||||
@ -114,6 +114,26 @@ public class TalentLocationUtils implements TencentLocationListener{
|
||||
currentLocationMsg.what = Constant.EVENT_WHAT_LOCATION_CHANGE;
|
||||
currentLocationMsg.obj = Constant.currentLocation;
|
||||
EventBus.getDefault().post(currentLocationMsg);
|
||||
}else if (i==TencentLocation.ERROR_NETWORK){//网络问题引起的定位失败
|
||||
Message currentLocationMsg = Message.obtain();
|
||||
currentLocationMsg.what = Constant.EVENT_MESSAGE;
|
||||
currentLocationMsg.obj = "网络问题引起的定位失败";
|
||||
EventBus.getDefault().post(currentLocationMsg);
|
||||
}else if (i==TencentLocation.ERROR_BAD_JSON){//GPS, Wi-Fi 或基站错误引起的定位失败: 1、用户的手机确实采集不到定位凭据,比如偏远地区比如地下车库电梯内等; 2、开关跟权限问题,比如用户关闭了位置信息,关闭了Wi-Fi,未授予app定位权限等。
|
||||
Message currentLocationMsg = Message.obtain();
|
||||
currentLocationMsg.what = Constant.EVENT_MESSAGE;
|
||||
currentLocationMsg.obj = "GPS, Wi-Fi 或基站错误引起的定位失败";
|
||||
EventBus.getDefault().post(currentLocationMsg);
|
||||
}else if (i==TencentLocation.ERROR_WGS84){
|
||||
Message currentLocationMsg = Message.obtain();
|
||||
currentLocationMsg.what = Constant.EVENT_MESSAGE;
|
||||
currentLocationMsg.obj ="无法将WGS84坐标转换成GCJ-02坐标时的定位失败";
|
||||
EventBus.getDefault().post(currentLocationMsg);
|
||||
}else if (i==TencentLocation.ERROR_UNKNOWN){
|
||||
Message currentLocationMsg = Message.obtain();
|
||||
currentLocationMsg.what = Constant.EVENT_MESSAGE;
|
||||
currentLocationMsg.obj ="未知原因引起的定位失败";
|
||||
EventBus.getDefault().post(currentLocationMsg);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user