diff --git a/app/src/main/java/com/navinfo/outdoor/activity/PicturesActivity.java b/app/src/main/java/com/navinfo/outdoor/activity/PicturesActivity.java index e83617f..26d0b1f 100644 --- a/app/src/main/java/com/navinfo/outdoor/activity/PicturesActivity.java +++ b/app/src/main/java/com/navinfo/outdoor/activity/PicturesActivity.java @@ -36,6 +36,7 @@ import com.kongzue.dialog.util.DialogSettings; import com.kongzue.dialog.v3.MessageDialog; import com.navinfo.outdoor.R; import com.navinfo.outdoor.api.Constant; +import com.navinfo.outdoor.api.UserApplication; import com.navinfo.outdoor.base.BaseActivity; import com.navinfo.outdoor.room.PoiEntity; import com.navinfo.outdoor.util.AWMp4ParserHelper; @@ -104,7 +105,6 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen private boolean isOration = true; private boolean isTerminus = false; private boolean isBack = true; - private boolean isGPS = false; private int type = 0; private int radioPicture = 0; private int videoIndex = -1; @@ -306,77 +306,42 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen } File file = new File(finalVideoPath); initMarkerPaper(); - result.toFile(file, new FileCallback() { + Runnable runnable = new Runnable() { @Override - public void onFileReady(@Nullable File file) { - /*if (file.exists()) { - initMarker(); - videoIndex = Integer.parseInt(file.getName().replace(".jpg", "")); - finalVideoPath = Objects.requireNonNull(file.getParentFile()).getAbsolutePath() + "/" + (videoIndex + 1) + ".jpg"; - runOnUiThread(new Runnable() { - @SuppressLint("SetTextI18n") - @Override - public void run() { - tvTitle.setText("保存成功:" + (videoIndex + 1)); - } - }); - } - if (radioPicture == 1) { - Message message = new Message(); - message.what = 0x103; - handler.sendMessage(message); - }*/ - if (file.exists() && file != null) { - WebPNative webPNative = new WebPNative(); - new Thread(new Runnable() { - @Override - public void run() { - try { - Bitmap bitmap = BitmapFactory.decodeFile(file.getAbsolutePath()); - webPNative.encodeRGBA(bitmap, file.getPath(), 90); - runOnUiThread(new Runnable() { - @SuppressLint("SetTextI18n") - @Override - public void run() { - if (file.exists()) { - initMarker(); - videoIndex = Integer.parseInt(file.getName().replace(".webp", "")); - finalVideoPath = Objects.requireNonNull(file.getParentFile()).getAbsolutePath() + "/" + (videoIndex + 1) + ".webp"; - tvTitle.setText("保存成功:" + (videoIndex + 1)); - } - if (radioPicture == 1) { - Message message = new Message(); - message.what = 0x103; - handler.sendMessage(message); - } + public void run() { + result.toFile(file, new FileCallback() { + @Override + public void onFileReady(@Nullable File file) { + if (file!=null&&file.exists()){ + WebPNative webPNative = new WebPNative(); + Bitmap bitmap = BitmapFactory.decodeFile(file.getAbsolutePath()); + webPNative.encodeRGBA(bitmap, file.getPath(), 90); + runOnUiThread(new Runnable() { + @SuppressLint("SetTextI18n") + @Override + public void run() { + if (file.exists()) { + initMarker(); + videoIndex = Integer.parseInt(file.getName().replace(".webp", "")); + finalVideoPath = Objects.requireNonNull(file.getParentFile()).getAbsolutePath() + "/" + (videoIndex + 1) + ".webp"; + tvTitle.setText("保存成功:" + (videoIndex + 1)); + } + if (radioPicture == 1) { + Message message = new Message(); + message.what = 0x103; + handler.sendMessage(message); } - }); - if (!bitmap.isRecycled()) { - bitmap.recycle(); } - } catch (Exception e) { - Log.d("output:", e.toString()); + }); + if (!bitmap.isRecycled()) { + bitmap.recycle(); } } - }).start(); - } else { - isBack = false; - if (isOration) { - stopTimer(); } - if (radioPicture != 1) { - capturePicture.setText("开始采集"); - } - capturePicture.setChecked(false); - runOnUiThread(new Runnable() { - @Override - public void run() { - Toast.makeText(PicturesActivity.this, "源文件不存在", Toast.LENGTH_SHORT).show(); - } - }); - } + }); } - }); + }; + UserApplication.fixedThreadPool.submit(runnable); } else { isBack = false; if (isOration) { diff --git a/app/src/main/java/com/navinfo/outdoor/adapter/CapacityEvaluationAdapter.java b/app/src/main/java/com/navinfo/outdoor/adapter/CapacityEvaluationAdapter.java index fd752b1..ee18815 100644 --- a/app/src/main/java/com/navinfo/outdoor/adapter/CapacityEvaluationAdapter.java +++ b/app/src/main/java/com/navinfo/outdoor/adapter/CapacityEvaluationAdapter.java @@ -39,19 +39,20 @@ public class CapacityEvaluationAdapter extends RecyclerView.Adapter multiChoice = response.getBody().getMultiChoice(); @@ -164,10 +167,10 @@ public class CapacityMeasurementFragment extends BaseFragment implements View.On if (baleen != null) { if (baleen.size()>0){ capacityMeasureAdapter.setMeasureList(baleen); - }else { + }/*else { btnSubmit.setVisibility(View.GONE); tvCapacity.setVisibility(View.GONE); - } + }*/ } } @@ -220,7 +223,7 @@ public class CapacityMeasurementFragment extends BaseFragment implements View.On } initExamSubmit(); } else { - Toast.makeText(getActivity(), "无数据", Toast.LENGTH_SHORT).show(); + Toast.makeText(getActivity(), "无数据,无法提交", Toast.LENGTH_SHORT).show(); } break; } @@ -256,6 +259,7 @@ public class CapacityMeasurementFragment extends BaseFragment implements View.On MessageDialog.show((AppCompatActivity) Objects.requireNonNull(getActivity()), "提示", message+"", "确定").setOkButton(new OnDialogButtonClickListener() { @Override public boolean onClick(BaseDialog baseDialog, View v) { + return false; } }); diff --git a/app/src/main/java/com/navinfo/outdoor/fragment/GatherGetFragment.java b/app/src/main/java/com/navinfo/outdoor/fragment/GatherGetFragment.java index 6ff1c9e..0e139b3 100644 --- a/app/src/main/java/com/navinfo/outdoor/fragment/GatherGetFragment.java +++ b/app/src/main/java/com/navinfo/outdoor/fragment/GatherGetFragment.java @@ -271,18 +271,6 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe break; case R.id.btn_gather://立即采集 gatherGetBuilder.append(TimestampUtil.time()).append(",").append("点击了立即采集的按钮 ,"); - //如果是领取的任务或者是新得任务就只能在当前用户位置方圆5000以内才可以使用 - if (poiEntity.getType() == 3 || poiEntity.getType() == 4) { - //判断当前的信号强度 - int gpsRssi = Constant.currentLocation.getGPSRssi(); - if (gpsRssi == 0) {//无信号 - Toast.makeText(getActivity(), "无信号,无法作业", Toast.LENGTH_SHORT).show(); - return; - } else if (gpsRssi == 1) {//信号弱 - Toast.makeText(getActivity(), "无信号,无法作业", Toast.LENGTH_SHORT).show(); - return; - } - } if (poiEntity.getTaskStatus() < 2) { double latitude = Constant.currentLocation.getLatitude(); double longitude = Constant.currentLocation.getLongitude(); diff --git a/app/src/main/java/com/navinfo/outdoor/util/PreserveUtils.java b/app/src/main/java/com/navinfo/outdoor/util/PreserveUtils.java index 8db592c..69a5a7b 100644 --- a/app/src/main/java/com/navinfo/outdoor/util/PreserveUtils.java +++ b/app/src/main/java/com/navinfo/outdoor/util/PreserveUtils.java @@ -64,7 +64,7 @@ public class PreserveUtils { public void run() { Message obtain1 = Message.obtain(); obtain1.what = Constant.NEST_WORD_REGISTER; - obtain1.obj = "道路:" + poiEntity.getName() + " 保存至服务成功"; + obtain1.obj = "道路:" + poiEntity.getName() + " 保存本地成功"; EventBus.getDefault().post(obtain1); } }); @@ -73,7 +73,7 @@ public class PreserveUtils { } else { Message obtain1 = Message.obtain(); obtain1.what = Constant.NEST_WORD_REGISTER; - obtain1.obj = "道路:" + poiEntity.getName() + " 保存至服务失败"; + obtain1.obj = "道路:" + poiEntity.getName() + " 保存本地失败"; EventBus.getDefault().post(obtain1); } } else if (response.getCode() == 230) { @@ -81,7 +81,7 @@ public class PreserveUtils { } else { Message obtain1 = Message.obtain(); obtain1.what = Constant.NEST_WORD_REGISTER; - obtain1.obj = "道路:" + poiEntity.getName() + "保存至服务失败"; + obtain1.obj = "道路:" + poiEntity.getName() + "保存本地失败"; EventBus.getDefault().post(obtain1); } } @@ -90,7 +90,7 @@ public class PreserveUtils { public void onError(Throwable e, int id) { Message obtain1 = Message.obtain(); obtain1.what = Constant.NEST_WORD_REGISTER; - obtain1.obj = "道路:" + poiEntity.getName() + " 保存至服务失败"; + obtain1.obj = "道路:" + poiEntity.getName() + " 保存本地失败"; EventBus.getDefault().post(obtain1); } }; @@ -118,7 +118,7 @@ public class PreserveUtils { public void run() { Message obtain1 = Message.obtain(); obtain1.what = Constant.NEST_WORD_REGISTER; - obtain1.obj = "Poi:" + poiEntity.getName() + " 保存至服务成功"; + obtain1.obj = "Poi:" + poiEntity.getName() + " 保存本地成功"; EventBus.getDefault().post(obtain1); } }); @@ -127,7 +127,7 @@ public class PreserveUtils { } else { Message obtain1 = Message.obtain(); obtain1.what = Constant.NEST_WORD_REGISTER; - obtain1.obj = "Poi:" + poiEntity.getName() + " 保存至服务失败"; + obtain1.obj = "Poi:" + poiEntity.getName() + " 保存本地失败"; EventBus.getDefault().post(obtain1); } } else if (response.getCode() == 230) { @@ -135,7 +135,7 @@ public class PreserveUtils { } else { Message obtain1 = Message.obtain(); obtain1.what = Constant.NEST_WORD_REGISTER; - obtain1.obj = "Poi:" + poiEntity.getName() + "保存至服务失败"; + obtain1.obj = "Poi:" + poiEntity.getName() + "保存本地失败"; EventBus.getDefault().post(obtain1); } @@ -145,7 +145,7 @@ public class PreserveUtils { public void onError(Throwable e, int id) { Message obtain1 = Message.obtain(); obtain1.what = Constant.NEST_WORD_REGISTER; - obtain1.obj = "Poi:" + poiEntity.getName() + " 保存至服务失败"; + obtain1.obj = "Poi:" + poiEntity.getName() + " 保存本地失败"; EventBus.getDefault().post(obtain1); } }; @@ -173,7 +173,7 @@ public class PreserveUtils { public void run() { Message obtain1 = Message.obtain(); obtain1.what = Constant.NEST_WORD_REGISTER; - obtain1.obj = "Poi录像:" + poiEntity.getName() + " 保存至服务成功"; + obtain1.obj = "Poi录像:" + poiEntity.getName() + " 保存本地成功"; EventBus.getDefault().post(obtain1); } }); @@ -182,7 +182,7 @@ public class PreserveUtils { } else { Message obtain1 = Message.obtain(); obtain1.what = Constant.NEST_WORD_REGISTER; - obtain1.obj = "Poi录像:" + poiEntity.getName() + " 保存至服务失败"; + obtain1.obj = "Poi录像:" + poiEntity.getName() + " 保存本地失败"; EventBus.getDefault().post(obtain1); } } else if (response.getCode() == 230) { @@ -190,7 +190,7 @@ public class PreserveUtils { } else { Message obtain1 = Message.obtain(); obtain1.what = Constant.NEST_WORD_REGISTER; - obtain1.obj = "Poi录像:" + poiEntity.getName() + "保存至服务失败"; + obtain1.obj = "Poi录像:" + poiEntity.getName() + "保存本地失败"; EventBus.getDefault().post(obtain1); } @@ -200,7 +200,7 @@ public class PreserveUtils { public void onError(Throwable e, int id) { Message obtain1 = Message.obtain(); obtain1.what = Constant.NEST_WORD_REGISTER; - obtain1.obj = "Poi录像:" + poiEntity.getName() + " 保存至服务失败"; + obtain1.obj = "Poi录像:" + poiEntity.getName() + " 保存本地失败"; EventBus.getDefault().post(obtain1); } }; @@ -228,7 +228,7 @@ public class PreserveUtils { public void run() { Message obtain1 = Message.obtain(); obtain1.what = Constant.NEST_WORD_REGISTER; - obtain1.obj = "其他:" + poiEntity.getName() + " 保存至服务成功"; + obtain1.obj = "其他:" + poiEntity.getName() + " 保存本地成功"; EventBus.getDefault().post(obtain1); } }); @@ -237,7 +237,7 @@ public class PreserveUtils { } else { Message obtain1 = Message.obtain(); obtain1.what = Constant.NEST_WORD_REGISTER; - obtain1.obj = "其他:" + poiEntity.getName() + " 保存至服务失败"; + obtain1.obj = "其他:" + poiEntity.getName() + " 保存本地失败"; EventBus.getDefault().post(obtain1); } } else if (response.getCode() == 230) { @@ -245,7 +245,7 @@ public class PreserveUtils { } else { Message obtain1 = Message.obtain(); obtain1.what = Constant.NEST_WORD_REGISTER; - obtain1.obj = "其他:" + poiEntity.getName() + "保存至服务失败"; + obtain1.obj = "其他:" + poiEntity.getName() + "保存本地失败"; EventBus.getDefault().post(obtain1); } @@ -255,7 +255,7 @@ public class PreserveUtils { public void onError(Throwable e, int id) { Message obtain1 = Message.obtain(); obtain1.what = Constant.NEST_WORD_REGISTER; - obtain1.obj = "其他:" + poiEntity.getName() + " 保存至服务失败"; + obtain1.obj = "其他:" + poiEntity.getName() + " 保存本地失败"; EventBus.getDefault().post(obtain1); } }; @@ -285,7 +285,7 @@ public class PreserveUtils { public void run() { Message obtain1 = Message.obtain(); obtain1.what = Constant.NEST_WORD_REGISTER; - obtain1.obj = "充电站:" + poiEntity.getName() + " 保存至服务成功"; + obtain1.obj = "充电站:" + poiEntity.getName() + " 保存本地成功"; EventBus.getDefault().post(obtain1); } }); @@ -294,7 +294,7 @@ public class PreserveUtils { } else { Message obtain1 = Message.obtain(); obtain1.what = Constant.NEST_WORD_REGISTER; - obtain1.obj = "充电站:" + poiEntity.getName() + " 保存至服务失败"; + obtain1.obj = "充电站:" + poiEntity.getName() + " 保存本地失败"; EventBus.getDefault().post(obtain1); } } else if (chargingStationBean.getCode() == 230) { @@ -302,7 +302,7 @@ public class PreserveUtils { } else { Message obtain1 = Message.obtain(); obtain1.what = Constant.NEST_WORD_REGISTER; - obtain1.obj = "充电站:" + poiEntity.getName() + " 保存至服务失败"; + obtain1.obj = "充电站:" + poiEntity.getName() + " 保存本地失败"; EventBus.getDefault().post(obtain1); } } @@ -311,7 +311,7 @@ public class PreserveUtils { public void onError(Throwable e, int id) { Message obtain1 = Message.obtain(); obtain1.what = Constant.NEST_WORD_REGISTER; - obtain1.obj = "充电站:" + poiEntity.getName() + " 保存至服务失败"; + obtain1.obj = "充电站:" + poiEntity.getName() + " 保存本地失败"; EventBus.getDefault().post(obtain1); Log.d("TAG", "onError: " + e.getMessage() + ""); } diff --git a/app/src/main/res/layout/fragment_capacity_eva_web.xml b/app/src/main/res/layout/fragment_capacity_eva_web.xml index bf525ac..1782c3a 100644 --- a/app/src/main/res/layout/fragment_capacity_eva_web.xml +++ b/app/src/main/res/layout/fragment_capacity_eva_web.xml @@ -47,7 +47,7 @@ android:id="@+id/tv_capacity_measurement" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="POI任务测试" + android:text="任务测试" android:textColor="@color/colorGray" android:textSize="30sp" app:layout_constraintEnd_toEndOf="parent"