修改bug

This commit is contained in:
wangdongsheng 2021-11-16 09:47:43 +08:00
parent a432e51e75
commit 48ed8dd67a
7 changed files with 109 additions and 32 deletions

View File

@ -9,8 +9,8 @@ android {
applicationId "com.navinfo.outdoor"
minSdkVersion 22
targetSdkVersion 30
versionCode 6
versionName "6.1112"
versionCode 7
versionName "6.1113"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
lintOptions {

View File

@ -37,11 +37,11 @@ import java.util.Objects;
/**
* 首页
*/
public class HomeActivity extends BaseActivity{
public class HomeActivity extends BaseActivity {
private TabLayout mTab;
private final String[] names = {"寻宝", "记录", "发现", "我的"};
private final int[] pic = {R.drawable.selector_map,R.drawable.selector_task,R.drawable.selector_article,R.drawable.selector_mine};
private boolean isBack=false;
private final int[] pic = {R.drawable.selector_map, R.drawable.selector_task, R.drawable.selector_article, R.drawable.selector_mine};
private boolean isBack = false;
private Handler handler = new Handler(new Handler.Callback() {
@Override
public boolean handleMessage(@NonNull Message msg) {
@ -56,6 +56,7 @@ public class HomeActivity extends BaseActivity{
protected int getLayout() {
return R.layout.activity_home;
}
@Override
public void onStart() {
super.onStart();
@ -63,6 +64,7 @@ public class HomeActivity extends BaseActivity{
EventBus.getDefault().register(this);
}
}
@Override
protected void initView() {
super.initView();
@ -71,7 +73,7 @@ public class HomeActivity extends BaseActivity{
.statusBarDarkFont(true, 0.2f)
//原理如果当前设备支持状态栏字体变色会设置状态栏字体为黑色如果当前设备不支持状态栏字体变色会使当前状态栏加上透明度否则不执行透明度
.init();
mTab=findViewById(R.id.tab_layout);
mTab = findViewById(R.id.tab_layout);
NoSlideViewPager mViewPager = findViewById(R.id.no_slide_view_pager);
ArrayList<Fragment> fragments = new ArrayList<>();
fragments.add(new TreasureFragment());
@ -86,6 +88,7 @@ public class HomeActivity extends BaseActivity{
public Fragment getItem(int i) {
return fragments.get(i);
}
@Override
public int getCount() {
return fragments.size();
@ -103,13 +106,13 @@ public class HomeActivity extends BaseActivity{
//禁止table layout效果
@Override
public void onTabSelected(TabLayout.Tab tab) {
if (tab.getPosition()==0){
if (tab.getPosition() == 0) {
Message obtain = Message.obtain();
obtain.what = Constant.JOB_WORD_MONITOR;
obtain.obj = true;
EventBus.getDefault().post(obtain);
}else if (tab.getPosition()==1){
} else if (tab.getPosition() == 1) {
Message obtain = Message.obtain();
obtain.what = Constant.STAY_SUBMIT_ITEM;
obtain.obj = true;
@ -120,7 +123,7 @@ public class HomeActivity extends BaseActivity{
obtain1.obj = true;
EventBus.getDefault().post(obtain1);
} else if (tab.getPosition()==3){
} else if (tab.getPosition() == 3) {
Message obtain = Message.obtain();
obtain.what = Constant.HOME_MINE;
obtain.obj = true;
@ -128,36 +131,44 @@ public class HomeActivity extends BaseActivity{
}
}
//点击table layout效果
@Override
public void onTabUnselected(TabLayout.Tab tab) {
}
@Override
public void onTabReselected(TabLayout.Tab tab) {
}
});
}
@Subscribe
public void onEvent(Message data) {
if (data.what == Constant.EVENT_WORK_HOME) {
if ((boolean) data.obj) {
Objects.requireNonNull(mTab.getTabAt(0)).select();
}
}else if (data.what==Constant.NEST_WORD_SUBMIT){
} else if (data.what == Constant.NEST_WORD_SUBMIT) {
String dataString = (String) data.obj;
if (!dataString.equals("")) {
Constant.isPresent=true;
Constant.isPresent = true;
DialogSettings.style = DialogSettings.STYLE.STYLE_IOS;
MessageDialog.show(this, "提示", dataString, "确定");
}
}else if (data.what==Constant.NEST_WORD_REGISTER){
} else if (data.what == Constant.NEST_WORD_REGISTER) {
String dataString = (String) data.obj;
if (!dataString.equals("")) {
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();
}
}
}
@ -173,6 +184,7 @@ public class HomeActivity extends BaseActivity{
}
}
}
@Override
protected void onDestroy() {
if (EventBus.getDefault().isRegistered(this))//加上判断

View File

@ -588,12 +588,14 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
protected void onResume() {
super.onResume();
camera.open();
tvMapView.onResume();
}
@Override
protected void onRestart() {
super.onRestart();
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
tvMapView.onRestart();
if (radioPicture != 1) {
capturePicture.setChecked(false);
capturePicture.setText("继续采集");
@ -613,6 +615,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
protected void onPause() {
super.onPause();
picturesBuilder.append("onPause ,");
tvMapView.onPause();
camera.close();
stopTimer();
}
@ -621,12 +624,14 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
protected void onStop() {
super.onStop();
picturesBuilder.append("onStop ,");
tvMapView.onStop();
}
@Override
protected void onDestroy() {
super.onDestroy();
camera.destroy();
tvMapView.onDestroy();
systemTTS.stopSpeak();
stopTimer();
if (polyline != null) {

View File

@ -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;//提示消息
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.12";//版本日期
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);

View File

@ -41,6 +41,7 @@ import com.navinfo.outdoor.room.PoiDatabase;
import com.navinfo.outdoor.room.PoiEntity;
import com.navinfo.outdoor.util.FlushTokenUtil;
import com.navinfo.outdoor.util.PoiSaveUtils;
import com.umeng.umcrash.UMCrash;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
@ -358,9 +359,9 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
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")) {
Toast.makeText(getActivity(), "请求超时", Toast.LENGTH_SHORT).show();
}else {
} else {
Toast.makeText(getActivity(), message, Toast.LENGTH_SHORT).show();
}
}
@ -389,25 +390,32 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
new Thread(new Runnable() {
@Override
public void run() {
List<PoiEntity> roadAll = roadDao.getAllPoiByRecoded();
if (getActivity() != null) {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
roadEntities.clear();
roadEntities.addAll(roadAll);
staySubmitAdapter.setAllRoad(roadEntities);
staySubmitAdapter.notifyDataSetChanged();
try {
List<PoiEntity> roadAll = roadDao.getAllPoiByRecoded();
if (getActivity() != null) {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
roadEntities.clear();
roadEntities.addAll(roadAll);
staySubmitAdapter.setAllRoad(roadEntities);
staySubmitAdapter.notifyDataSetChanged();
/*for (int i = 0; i < roadAll.size(); i++) {
if (roadAll.get(i).getType()!=6){
roadEntities.add(roadAll.get(i));
}
}*/
}
});
}
});
}
} catch (Exception e) {
UMCrash.generateCustomLog(e, "自定义");
}
}
}).start();
} else {
Toast.makeText(getActivity(), "无法读取数据库,请尝试重启程序!", Toast.LENGTH_SHORT).show();
UMCrash.generateCustomLog("无法读取数据库", "自定义");
}
}

View File

@ -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,12 +22,14 @@ public class PoiEntityDeleteUtil {
}
public void deleteUtil(Context context, PoiEntity poiEntity) {
switch (poiEntity.getType()){
switch (poiEntity.getType()) {
case 1:
case 2:
case 5:
initDelete(poiEntity);
break;
case 2:
initPileDelete(context,poiEntity);
break;
case 3:
case 4:
initPicture(poiEntity);
@ -32,6 +37,33 @@ public class PoiEntityDeleteUtil {
}
}
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(PoiEntity poiEntity) {
List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(poiEntity.getId());
@ -44,8 +76,8 @@ public class PoiEntityDeleteUtil {
private void initDelete(PoiEntity poiEntity) {
if (poiEntity!=null){
if (poiEntity.getPhotoInfo()!=null){
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();

View File

@ -23,9 +23,7 @@ public class TalentLocationUtils implements TencentLocationListener{
private TencentLocationRequest locationRequest;
private List<LocationSource.OnLocationChangedListener> locationChangedListenerList;
private boolean isLocationStart; // 标识是否已经启动定位
private static TalentLocationUtils instance;
public static TalentLocationUtils getInstance(Context mContext) {
if (instance == null) {
instance = new TalentLocationUtils(mContext);
@ -114,6 +112,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);
}
}