修改拍照
This commit is contained in:
parent
b2f1b21b09
commit
04c2ecf8e3
@ -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) {
|
||||
|
@ -39,19 +39,20 @@ public class CapacityEvaluationAdapter extends RecyclerView.Adapter<CapacityEval
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
holder.tvCapacity.setText(capacityList.get(position).getTitle());
|
||||
if (capacityList.get(position).getStatus()!=null){
|
||||
holder.tvResults.setText((Integer) capacityList.get(position).getStatus());
|
||||
TaskPrefectureBean.BodyBean.ListBean listBean = capacityList.get(position);
|
||||
holder.tvCapacity.setText(listBean.getTitle()+"");
|
||||
if (listBean.getStatus()!=null){
|
||||
holder.tvResults.setText(listBean.getStatus()+"");
|
||||
}else {
|
||||
holder.tvResults.setText("");
|
||||
}
|
||||
|
||||
Glide.with(context).load(capacityList.get(position).getIconurl()).apply(RequestOptions.bitmapTransform(new CircleCrop())).into(holder.ivCapacity);
|
||||
Glide.with(context).load(listBean.getIconurl()).apply(RequestOptions.bitmapTransform(new CircleCrop())).into(holder.ivCapacity);
|
||||
holder.itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (onCapacityClick != null) {
|
||||
onCapacityClick.onClick(capacityList.get(position).getId());
|
||||
onCapacityClick.onClick(listBean.getId());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -16,6 +16,8 @@ import com.umeng.commonsdk.UMConfigure;
|
||||
import com.umeng.umcrash.UMCrash;
|
||||
import com.umeng.umcrash.UMCrashCallback;
|
||||
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.logging.Level;
|
||||
|
||||
@ -24,6 +26,7 @@ import okhttp3.OkHttpClient;
|
||||
|
||||
public class UserApplication extends Application {
|
||||
public static UserApplication userApplication;
|
||||
public static ExecutorService fixedThreadPool;
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
@ -46,6 +49,7 @@ public class UserApplication extends Application {
|
||||
});
|
||||
initOkGo();
|
||||
TalentLocationUtils.getInstance(this).startLocation(this);
|
||||
fixedThreadPool = Executors.newFixedThreadPool(5);
|
||||
}
|
||||
|
||||
public static UserApplication getUserApplication() {
|
||||
|
@ -144,7 +144,10 @@ public class CapacityMeasurementFragment extends BaseFragment implements View.On
|
||||
@Override
|
||||
public void onSuccess(MeasureBean response, int id) {
|
||||
dismissLoadingDialog();
|
||||
|
||||
String title = response.getBody().getTitle();
|
||||
if (title!=null){
|
||||
tvCapacity.setText(title);
|
||||
}
|
||||
//单选
|
||||
if (response.getBody().getMultiChoice() != null) {
|
||||
List<MeasureBean.BodyBean.MultiChoiceBean> 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;
|
||||
}
|
||||
});
|
||||
|
@ -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();
|
||||
|
@ -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() + "");
|
||||
}
|
||||
|
@ -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"
|
||||
|
Loading…
x
Reference in New Issue
Block a user