用户直接进入,不用点击点登录界面,jpg 转成webp 图片格式的转换

This commit is contained in:
wangdongsheng 2021-10-22 10:20:09 +08:00
parent 3ede202a30
commit ed379a7dc4
34 changed files with 1026 additions and 445 deletions

View File

@ -139,5 +139,7 @@ dependencies {
implementation 'cn.jzvd:jiaozivideoplayer:7.4.2'
// https://github.com/Hu12037102/ImageCompress
implementation 'com.github.Hu12037102:ImageCompress:2.3.0'
//webp
implementation 'com.wanghong.webpnative:webpnative:0.1.0'
}

View File

@ -1,6 +1,9 @@
package com.navinfo.outdoor.activity;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
@ -9,6 +12,8 @@ import android.view.View;
import android.widget.FrameLayout;
import android.widget.Toast;
import androidx.annotation.NonNull;
import com.github.lazylibrary.util.FileUtils;
import com.lzy.okgo.model.HttpParams;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.api.Constant;
@ -18,6 +23,11 @@ import com.navinfo.outdoor.http.Callback;
import com.navinfo.outdoor.http.HttpInterface;
import com.navinfo.outdoor.http.OkGoBuilder;
import java.io.File;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* 引导页
*/
@ -79,6 +89,9 @@ public class GuidanceActivity extends BaseActivity {
return false;
}
});
private File logFile;
private StringBuilder guidanceBuilder;
@Override
protected int getLayout() {
return R.layout.activity_guidance;
@ -88,6 +101,29 @@ public class GuidanceActivity extends BaseActivity {
protected void initView() {
super.initView();
frameLayout = findViewById(R.id.layout_frame);
SharedPreferences sharedPreferences = this.getSharedPreferences(Constant.MESSAGE_TYPE, Context.MODE_PRIVATE);
SharedPreferences.Editor sharedEdit = sharedPreferences.edit();
@SuppressLint("SimpleDateFormat")
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);
sharedEdit.apply();
logFile = new File(Constant.LOG_FOLDER + "/" + newFormat + ".txt");
} else {
if (pictures_time.equals(newFormat)) {
logFile = new File(Constant.LOG_FOLDER + "/" + pictures_time + ".txt");
} else {
logFile = new File(Constant.LOG_FOLDER + "/" + newFormat + ".txt");
}
}
guidanceBuilder = new StringBuilder();
guidanceBuilder.append("GuidanceActivity-onCreate-initData ,");
if (Constant.USHERED != null) {
guidanceBuilder.append("userId:").append(Constant.USHERED).append(",");
}
}
@Override
@ -109,16 +145,19 @@ public class GuidanceActivity extends BaseActivity {
loginTaskItem.findViewById(R.id.btn_login).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
v.setEnabled(false);
guidanceBuilder.append("点击了请查看APP使用说明 ,");
Message message = new Message();
message.what = 0x101;
handler.sendMessageDelayed(message, 1000);
v.setEnabled(false);
}
});
taskItem.findViewById(R.id.btn_next_step).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
v.setEnabled(false);
guidanceBuilder.append("点击了下一步 ,");
Message message = new Message();
message.what = 0x102;
handler.sendMessageDelayed(message, 500);
@ -128,6 +167,7 @@ public class GuidanceActivity extends BaseActivity {
@Override
public void onClick(View v) {
v.setEnabled(false);
guidanceBuilder.append("点击了下一步 ,");
Message message = new Message();
message.what = 0x103;
handler.sendMessageDelayed(message, 500);
@ -137,6 +177,7 @@ public class GuidanceActivity extends BaseActivity {
@Override
public void onClick(View v) {
v.setEnabled(false);
guidanceBuilder.append("点击了下一步 ,");
Message message = new Message();
message.what = 0x104;
handler.sendMessageDelayed(message, 500);
@ -146,6 +187,7 @@ public class GuidanceActivity extends BaseActivity {
@Override
public void onClick(View v) {
v.setEnabled(false);
guidanceBuilder.append("点击了下一步 ,");
Message message = new Message();
message.what = 0x105;
handler.sendMessageDelayed(message, 500);
@ -155,6 +197,7 @@ public class GuidanceActivity extends BaseActivity {
@Override
public void onClick(View v) {
v.setEnabled(false);
guidanceBuilder.append("点击了下一步 ,");
Message message = new Message();
message.what = 0x106;
handler.sendMessageDelayed(message, 500);
@ -164,6 +207,7 @@ public class GuidanceActivity extends BaseActivity {
@Override
public void onClick(View v) {
v.setEnabled(false);
guidanceBuilder.append("点击了下一步 ,");
Message message = new Message();
message.what = 0x107;
handler.sendMessageDelayed(message, 500);
@ -173,6 +217,7 @@ public class GuidanceActivity extends BaseActivity {
@Override
public void onClick(View v) {
v.setEnabled(false);
guidanceBuilder.append("点击了下一步 ,");
Message message = new Message();
message.what = 0x108;
handler.sendMessageDelayed(message, 500);
@ -182,6 +227,7 @@ public class GuidanceActivity extends BaseActivity {
@Override
public void onClick(View v) {
v.setEnabled(false);
guidanceBuilder.append("点击了下一步 ,");
Message message = new Message();
message.what = 0x109;
handler.sendMessageDelayed(message, 500);
@ -191,16 +237,17 @@ public class GuidanceActivity extends BaseActivity {
@Override
public void onClick(View v) {
v.setEnabled(false);
guidanceBuilder.append("点击了下一步 ,");
Message message = new Message();
message.what = 0x110;
handler.sendMessageDelayed(message, 500);
}
});
dataItem.findViewById(R.id.btn_next_step).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
v.setEnabled(false);
guidanceBuilder.append("点击了下一步 ,");
Message message = new Message();
message.what = 0x111;
handler.sendMessageDelayed(message, 500);
@ -209,6 +256,8 @@ public class GuidanceActivity extends BaseActivity {
withdrawItem.findViewById(R.id.btn_to_learn).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
v.setEnabled(false);
guidanceBuilder.append("点击了学会了,");
Message message = new Message();
message.what = 0x112;
handler.sendMessageDelayed(message, 500);
@ -231,13 +280,11 @@ public class GuidanceActivity extends BaseActivity {
public void onSuccess(BaseBean<Integer> response, int id) {
dismissLoadingDialog();
if (response.getCode() == 200) {
startActivity(new Intent(GuidanceActivity.this, HomeActivity.class));
GuidanceActivity.this.finish();
Toast.makeText(GuidanceActivity.this, "可以在发现版块的任务说明中,进行再次学习哦", Toast.LENGTH_LONG).show();
Intent intent = new Intent(GuidanceActivity.this, HomeActivity.class);
startActivity(intent);
finish();
}
}
@Override
public void onError(Throwable e, int id) {
dismissLoadingDialog();
@ -247,9 +294,24 @@ public class GuidanceActivity extends BaseActivity {
});
}
@Override
protected void onPause() {
super.onPause();
guidanceBuilder.append("onPause");
}
@Override
protected void onStop() {
super.onStop();
guidanceBuilder.append("onStop");
}
@Override
protected void onDestroy() {
super.onDestroy();
frameLayout.removeAllViews();
guidanceBuilder.append("onDestroy");
guidanceBuilder.append("\r\n");
FileUtils.writeFile(logFile.getAbsolutePath(), guidanceBuilder.toString(), true);
}
}

View File

@ -163,6 +163,7 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
Message message = new Message();
message.what = 0x103;
handler.sendMessageDelayed(message, 500);
String name = etLoginName.getText().toString().trim();
if (name.equals("")) {
Toast.makeText(this, "请输入账号", Toast.LENGTH_SHORT).show();

View File

@ -1,5 +1,6 @@
package com.navinfo.outdoor.activity;
import android.annotation.SuppressLint;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
@ -31,10 +32,14 @@ import com.navinfo.outdoor.api.Constant;
import com.navinfo.outdoor.base.BaseActivity;
import com.kongzue.dialog.util.DialogSettings;
import com.navinfo.outdoor.bean.ApkVersionBean;
import com.navinfo.outdoor.bean.LoginOauthTokenBean;
import com.navinfo.outdoor.bean.UserDetailBean;
import com.navinfo.outdoor.http.Callback;
import com.navinfo.outdoor.http.HttpInterface;
import com.navinfo.outdoor.http.OkGoBuilder;
import com.navinfo.outdoor.util.APKVersionCodeUtils;
import com.navinfo.outdoor.util.Base64;
import com.navinfo.outdoor.util.Md5Util;
import java.io.File;
@ -77,7 +82,7 @@ public class MainActivity extends BaseActivity {
});
private ProgressDialog pBar;
private int progress;
private String user_id;
private SharedPreferences.Editor navInfoEditor;
@Override
@ -122,7 +127,7 @@ public class MainActivity extends BaseActivity {
@Override
public void onGranted(List<String> permissions, boolean all) {
if (all) {
if (user_id!=null){
if (Constant.USHERED!=null){
initCheckVersion();
}else {
initTime();
@ -232,16 +237,139 @@ public class MainActivity extends BaseActivity {
}
public void initTime() {
if (Constant.ACCESS_TOKEN==null){
Intent intent = new Intent(MainActivity.this, LoginActivity.class);
startActivity(intent);
finish();
}else {
initGetUserInfo();
}
/*
new CountDownTimer(3000, 1000) {
@Override
public void onTick(long l) {}
@Override
public void onFinish() {
Intent intent = new Intent(MainActivity.this, LoginActivity.class);
}
}.start();
*/
}
private void initGetUserInfo() {
OkGoBuilder.getInstance().Builder(this)
.url(HttpInterface.USER_DETAIL_BY_USER_ID)
.token(Constant.ACCESS_TOKEN)
.params(new HttpParams())
.cls(UserDetailBean.class)
.getRequest(new Callback<UserDetailBean>() {
@Override
public void onSuccess(UserDetailBean response, int id) {
dismissLoadingDialog();
if (response.getCode() == 200) {
UserDetailBean.BodyBean body = response.getBody();
if (body != null) {
navInfoEditor.putString("username", body.getUsername());
Constant.USER_NAME = body.getUsername();
navInfoEditor.putString("mobile", body.getMobile());
Constant.MOBILE = body.getMobile();
navInfoEditor.putInt("sex", body.getSex());//0: 1
Constant.SEX = body.getSex();
navInfoEditor.putString("qq", body.getQq());
Constant.QQ = body.getQq();
navInfoEditor.putString("wechat", body.getWechat());
Constant.WCHAR = body.getWechat();
navInfoEditor.putInt("level", body.getLevel());
Constant.LEVEL = body.getLevel();
UserDetailBean.BodyBean.UserBankcardBean userBankcard = body.getUserBankcard();
if (userBankcard != null) {//存储银行卡信息
navInfoEditor.putString("bankAccount", userBankcard.getBankAccount());//银行卡编号
Constant.BACKGROUND = userBankcard.getBankAccount();
navInfoEditor.putString("idNumber", userBankcard.getIdNumber());//银行卡账号
Constant.ID_NUMBER = userBankcard.getIdNumber();
navInfoEditor.putString("bankName", userBankcard.getBankName());//銀行姓名
Constant.BACKGROUND_NAME = userBankcard.getBankName();
}
UserDetailBean.BodyBean.UserAuthBean userAuth = body.getUserAuth();
if (userAuth != null) {//存储身份证信息
navInfoEditor.putString("name", userAuth.getName());//身份证姓名
Constant.NAME = userAuth.getName();
navInfoEditor.putString("idnum", userAuth.getIdnum());//身份证号码
Constant.ID_NUM = userAuth.getIdnum();
navInfoEditor.putInt("auditstatus", userAuth.getAuditstatus());//审核状态
Constant.AUDIOTAPES = userAuth.getAuditstatus();
navInfoEditor.putString("auditmsg", userAuth.getAuditmsg());//审核信息
Constant.AUDITING = userAuth.getAuditmsg();
}
navInfoEditor.commit();
int needGuide = body.getNeedGuide();//0不需要 1需要
if (needGuide == 1) {
Intent intent = new Intent(MainActivity.this, GuidanceActivity.class);
startActivity(intent);
} else {
Intent intent = new Intent(MainActivity.this, HomeActivity.class);
startActivity(intent);
finish();
}
}.start();
}
} else {
initLogIn();
}
}
@Override
public void onError(Throwable e, int id) {
dismissLoadingDialog();
Toast.makeText(MainActivity.this, e.getMessage(), Toast.LENGTH_SHORT).show();
}
});
}
private void initLogIn() {
try {
HttpParams httpParams = new HttpParams();
long time = System.currentTimeMillis();
httpParams.put("grant_type", "refresh_token");
httpParams.put("datetime", time);
httpParams.put("refresh_token", Constant.REFRESH_TOKEN);
showLoadingDialog();
OkGoBuilder.getInstance()
.Builder(this)
.url(HttpInterface.USER_LOGIN_OAUTH_TOKEN)
.cls(LoginOauthTokenBean.class)
.params(httpParams)
.postRequest(new Callback<LoginOauthTokenBean>() {
@Override
public void onSuccess(LoginOauthTokenBean response, int id) {
dismissLoadingDialog();
if (response.getCode() == 200) {
LoginOauthTokenBean.BodyBean body = response.getBody();
if (body.getUserId() != null && !body.getUserId().equals("")) {
Constant.initRootFolder(body.getUserId());
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();
Constant.REFRESH_TOKEN = body.getRefresh_token();
Constant.USHERED = body.getUserId();
initGetUserInfo();//获取用户信息
} else {
Intent intent = new Intent( MainActivity.this, LoginActivity.class);
startActivity(intent);
finish();
}
}
@Override
public void onError(Throwable e, int id) {
dismissLoadingDialog();
Toast.makeText(MainActivity.this, e.getMessage() + "", Toast.LENGTH_SHORT).show();
}
});
} catch (Exception e) {
e.printStackTrace();
}
}
/**
@ -292,7 +420,6 @@ public class MainActivity extends BaseActivity {
}
if (fileOutputStream != null) {
fileOutputStream.flush();
fileOutputStream.close();
}
handler.sendEmptyMessage(0);//apk下载完成使用Handler()通知安装apk
}
@ -304,13 +431,20 @@ public class MainActivity extends BaseActivity {
}.start();
}
@SuppressLint("CommitPrefEdits")
@Override
protected void initView() {
super.initView();
SharedPreferences navInfo = getSharedPreferences(Constant.SHARED_PREFERENCES, Context.MODE_PRIVATE);
user_id = navInfo.getString("user_id", null);
Constant.ACCESS_TOKEN= navInfo.getString("access_token", null);;
HttpInterface.initAppPath(user_id);
navInfoEditor = navInfo.edit();
Constant.USHERED = navInfo.getString("user_id", null);
Constant.REFRESH_TOKEN = navInfo.getString("refresh_token", null);
Constant.ACCESS_TOKEN= navInfo.getString("access_token", null);
if (Constant.USHERED!=null){
HttpInterface.initAppPath(Constant.USHERED);
Constant.initRootFolder(Constant.USHERED);
HttpInterface.initHttpInter(Constant.USHERED);
}
initPermission();
}
}

View File

@ -60,6 +60,7 @@ 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;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
@ -159,19 +160,48 @@ public class PhotographActivity extends BaseActivity implements View.OnClickList
}
}
File file = new File(photo_path);
/* File destFolder = new File(file.getParentFile().getAbsolutePath()+"aaa");
/*File destFolder = new File(file.getParentFile().getAbsolutePath()+"aaa");
if (!destFolder.exists()) {
destFolder.mkdirs();
}*/
result.toFile(file, new FileCallback() {
@Override
public void onFileReady(@Nullable File file) {
assert file != null && file.exists();
if (file.exists()) {
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() {
@Override
public void run() {
Intent intent = new Intent();
intent.putExtra("file", file.getPath());
intent.putExtra("file", file.getAbsolutePath());
setResult(0x104, intent);
SystemTTS.getInstance(PhotographActivity.this).stopSpeak();
PhotographActivity.this.finish();
}
});
/* long start = System.currentTimeMillis();
long useTime = System.currentTimeMillis() - start;
Log.e("WebpUtil:", String.valueOf(useTime));
File file = new File(output.substring(0, output.length() - 5) + ".webp");
new File(output).renameTo(file);*/
if (!bitmap.isRecycled()) {
bitmap.recycle();
}
} catch (Exception e) {
Log.d("output:", e.toString());
Toast.makeText(PhotographActivity.this, "文件转换失败", Toast.LENGTH_SHORT).show();
}
}
}).start();
} else {
Toast.makeText(PhotographActivity.this, "源文件不存在", Toast.LENGTH_SHORT).show();
}
/* CompressImageTask.get().compressImage(ImageConfig.getDefaultConfig(file.getAbsolutePath(), file.getAbsolutePath()), new AsyncImageTask.OnImageResult(){
@Override
public void startCompress() {

View File

@ -1,9 +1,7 @@
package com.navinfo.outdoor.activity;
package com.navinfo.outdoor.activity;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.content.pm.ActivityInfo;
@ -17,7 +15,6 @@ 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;
@ -26,12 +23,10 @@ import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
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.Geohash;
@ -40,14 +35,12 @@ import com.navinfo.outdoor.util.MyTecentLocationSource;
import com.otaliastudios.cameraview.CameraException;
import com.otaliastudios.cameraview.CameraListener;
import com.otaliastudios.cameraview.CameraLogger;
import com.otaliastudios.cameraview.CameraOptions;
import com.otaliastudios.cameraview.CameraView;
import com.otaliastudios.cameraview.FileCallback;
import com.otaliastudios.cameraview.PictureResult;
import com.otaliastudios.cameraview.VideoResult;
import com.otaliastudios.cameraview.controls.Mode;
import com.otaliastudios.cameraview.size.Size;
import com.tencent.map.geolocation.TencentLocation;
import com.tencent.tencentmap.mapsdk.maps.CameraUpdate;
@ -66,13 +59,10 @@ 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 org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import org.jetbrains.annotations.NotNull;
import java.io.File;
import java.io.FileDescriptor;
import java.io.FileOutputStream;
@ -87,11 +77,9 @@ import java.util.List;
import java.util.Objects;
import java.util.Timer;
import java.util.TimerTask;
import static com.tencent.tencentmap.mapsdk.maps.model.MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE;
import static com.tencent.tencentmap.mapsdk.maps.model.MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER;
public class PictureActivity extends BaseActivity implements View.OnClickListener {
private static final CameraLogger LOG = CameraLogger.create("Picture");
private CameraView camera;
@ -102,7 +90,7 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
private CheckBox captureVideo; // 拍摄视频
private Button btnVideo;
private String finalVideoPath; // 摄像后最终保存的文件名
// private File tmpFile; // 合并文件的临时文件路径
//private File tmpFile; // 合并文件的临时文件路径
private Timer timer;
private CsvTimerTask timerTask; // 执行定时写入csv文件的task
private DateFormat formatter;
@ -192,7 +180,6 @@ public class PictureActivity extends BaseActivity implements View.OnClickListene
return;
}
}
captureVideo.setText("暂停采集");
// stopVideo.setEnabled(false);// 开始采集视频后禁用停止采集的按钮必须暂停采集后才可点击停止采集
startTakenVideo(); // 开始采集视频

View File

@ -65,6 +65,7 @@ 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;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
@ -265,11 +266,21 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
result.toFile(file, new FileCallback() {
@Override
public void onFileReady(@Nullable File file) {
assert file != null;
if (file.exists()) {
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() {
@Override
public void run() {
if (file.exists()) {
initMarker();
videoIndex = Integer.parseInt(file.getName().replace(".jpg", ""));
finalVideoPath = Objects.requireNonNull(file.getParentFile()).getAbsolutePath() + "/" + (videoIndex + 1) + ".jpg";
videoIndex = Integer.parseInt(file.getName().replace(".webp", ""));
finalVideoPath = Objects.requireNonNull(file.getParentFile()).getAbsolutePath() + "/" + (videoIndex + 1) + ".webp";
Toast.makeText(PicturesActivity.this, "保存成功:" + (videoIndex + 1), Toast.LENGTH_SHORT).show();
}
if (poi_video_type == 2) {
@ -279,6 +290,25 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
}
}
});
/* long start = System.currentTimeMillis();
long useTime = System.currentTimeMillis() - start;
Log.e("WebpUtil:", String.valueOf(useTime));
File file = new File(output.substring(0, output.length() - 5) + ".webp");
new File(output).renameTo(file);*/
if (!bitmap.isRecycled()) {
bitmap.recycle();
}
} catch (Exception e) {
Log.d("output:", e.toString());
Toast.makeText(PicturesActivity.this, "文件转换失败", Toast.LENGTH_SHORT).show();
}
}
}).start();
} else {
Toast.makeText(PicturesActivity.this, "源文件不存在", Toast.LENGTH_SHORT).show();
}
}
});
}
});
DisplayMetrics dm = new DisplayMetrics();
@ -308,10 +338,8 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
bitmapLine = BitmapDescriptorFactory.fromResource(R.drawable.road_arrows);
}
List<LatLng> latLineString = GeometryTools.getLatLags(geo);
// 构造 PolylineOnions
PolylineOptions polylineOptions
= new PolylineOptions().addAll(latLineString)
PolylineOptions polylineOptions = new PolylineOptions().addAll(latLineString)
// 折线设置圆形线头
.lineCap(true)
// 折线的颜色为绿色
@ -366,7 +394,7 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen
}
picturesBuilder.append("onClick 点击了结束采集 ,");
Intent intent = new Intent();
finalVideoPath = Objects.requireNonNull(paperFile.getParentFile()).getAbsolutePath() + "/" + videoIndex + ".jpg";
finalVideoPath = Objects.requireNonNull(paperFile.getParentFile()).getAbsolutePath() + "/" + videoIndex + ".webp";
intent.putExtra(Constant.INTENT_PICTURES_PATH, finalVideoPath);
intent.putExtra("type", poi_video_type);
setResult(0x111, intent);

View File

@ -284,7 +284,6 @@ public class TestActivity extends BaseActivity {
planarMarker.setClickable(true);
onMarker(geo, planarMarker);
break;
}
}
}
@ -343,7 +342,6 @@ public class TestActivity extends BaseActivity {
setLocMarkerStyle(LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER);
// initCluster();
initNewMarker();
}
private void initNewMarker() {

View File

@ -18,6 +18,7 @@ import android.widget.Toast;
import com.bigkoo.pickerview.builder.OptionsPickerBuilder;
import com.bigkoo.pickerview.listener.OnOptionsSelectListener;
import com.bigkoo.pickerview.view.OptionsPickerView;
import com.github.lazylibrary.util.FileUtils;
import com.google.gson.Gson;
import com.kongzue.dialog.interfaces.OnDialogButtonClickListener;
import com.kongzue.dialog.util.BaseDialog;
@ -321,7 +322,8 @@ public class UserActivity extends BaseActivity implements View.OnClickListener {
pvOptions.show();
}
private void initJsonData() {//解析数据 省市区三级联动
private void initJsonData() {
//解析数据 省市区三级联动
/* 注意assets 目录下的Json文件仅供参考实际使用可自行替换文件
* 关键逻辑在于循环体
*/
@ -342,8 +344,7 @@ public class UserActivity extends BaseActivity implements View.OnClickListener {
ArrayList<CityBean> AreaList = new ArrayList<>();//该城市的所有地区列表
ArrayList<String> City_AreaList = new ArrayList<>();//该城市的所有地区列表
//如果无地区数据建议添加空字符串防止数据为null 导致三个选项长度不匹配造成崩溃
if (jsonBean.get(i).getCitys().get(c).getCounties() == null
|| jsonBean.get(i).getCitys().get(c).getCounties().size() == 0) {
if (jsonBean.get(i).getCitys().get(c).getCounties() == null || jsonBean.get(i).getCitys().get(c).getCounties().size() == 0) {
AreaList.add(new CityBean("", ""));
City_AreaList.add("");
} else {
@ -355,17 +356,16 @@ public class UserActivity extends BaseActivity implements View.OnClickListener {
Province_AreaList.add(City_AreaList);//添加该省所有地区数据
city_AreaList.add(AreaList);//添加该省所有地区数据的bean
}
/*添加城市数据
*/
/*添加城市数据*/
options2Items.add(CityList);
/* 添加地区数据
*/
/*添加地区数据*/
options3Items.add(Province_AreaList);
cityItems.add(city_AreaList);
}
}
public ArrayList<JsonBean> parseData(String result) {//GOON 解析
public ArrayList<JsonBean> parseData(String result) {
//GOON 解析
ArrayList<JsonBean> detail = new ArrayList<>();
try {
JSONArray data = new JSONArray(result);
@ -395,6 +395,8 @@ public class UserActivity extends BaseActivity implements View.OnClickListener {
@Override
protected void onDestroy() {
super.onDestroy();
userBuilder.append("onDestroy ,");
userBuilder.append("onDestroy ");
userBuilder.append("\r\n");
FileUtils.writeFile(logFile.getAbsolutePath(), userBuilder.toString(), true);
}
}

View File

@ -93,8 +93,6 @@ public class PhotoAdapter extends RecyclerView.Adapter<PhotoAdapter.ViewHolder>
}
}
});
}
@Override

View File

@ -17,11 +17,9 @@ import java.io.File;
* 常量
*/
public class Constant {
/*当前网络不可用
*/
/*当前网络不可用*/
public static final CharSequence NETWORK_UNAVAILABLE = "当前网络不可用,请检查网络设置";
/*位置权限
*/
/*位置权限*/
public static final String SET_LOCATION_PERMISSION = "请在“设置”中给予“TengXunMap”位置权限,否则当前功能将不可使用";
public static final String SET_LOCATION = "请在“设置”中给予权限否则当前功能将不可使用";
public static final String GET_ERR_MESSAGE1 = "设备缺少使用腾讯定位服务需要的基本条件";
@ -29,7 +27,7 @@ public class Constant {
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;
public static String VIDEOS_;
public static String POI_DAO;
@ -65,11 +63,11 @@ public class Constant {
//筛选
public static final int FILTER_CODE = 0x200;
/*
* 存储用户信息
* access_token 后续需求需要用到的key 过期时间8小时
* refresh_token 刷新token用 过期时间1个月
* userId 用户id
* username 用户编号
存储用户信息
access_token 后续需求需要用到的key 过期时间8小时
refresh_token 刷新token用 过期时间1个月
userId 用户id
username 用户编号
*/
public static String ACCESS_TOKEN = null;
public static String REFRESH_TOKEN = null;
@ -141,12 +139,11 @@ public class Constant {
public static int TASK_TYPE = -1; // 任务类型
public static int TASK_STARTUP = -1; // 任务状态
public static String CODE = ""; //区号
/**
* 用户当前位置
*/
/*用户当前位置*/
public static TencentLocation currentLocation;
public static LatLng markerLacing;
//marker 图标
//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);
public static final BitmapDescriptor MARKER_CHARGE_PILE_SHOW=BitmapDescriptorFactory.fromResource(R.drawable.marker_charge_pile_show);
@ -154,15 +151,13 @@ public class Constant {
public static final BitmapDescriptor MARKER_ROOD_SHOW = BitmapDescriptorFactory.fromResource(R.drawable.marker_road_show);
public static final BitmapDescriptor MARKER_OTHER_SHOW= BitmapDescriptorFactory.fromResource(R.drawable.marker_other_show);
public static final BitmapDescriptor MARKER_FACET_SHOW= BitmapDescriptorFactory.fromResource(R.drawable.marker_facet_show);
public static final BitmapDescriptor MARKER_POI = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi);
public static final BitmapDescriptor MARKER_CHARGE = BitmapDescriptorFactory.fromResource(R.drawable.marker_charge);
public static final BitmapDescriptor MARKER_CHARGE_PILE=BitmapDescriptorFactory.fromResource(R.drawable.marker_charge_pile);
public static final BitmapDescriptor MARKER_POI_VIDEO = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_video);
public static final BitmapDescriptor MARKER_ROOD = BitmapDescriptorFactory.fromResource(R.drawable.marker_road);
public static final BitmapDescriptor MARKER_OTHER= BitmapDescriptorFactory.fromResource(R.drawable.marker_other);
public static final BitmapDescriptor MARKER_FACET= BitmapDescriptorFactory.fromResource(R.drawable.marker_facet);
public static final BitmapDescriptor GRAY_POI = BitmapDescriptorFactory.fromResource(R.drawable.graypoi);
public static final BitmapDescriptor GRAY_CHARGE = BitmapDescriptorFactory.fromResource(R.drawable.graycharge);
public static final BitmapDescriptor GRAY_CHARGE_PILE=BitmapDescriptorFactory.fromResource(R.drawable.graychargepile);
@ -170,9 +165,7 @@ public class Constant {
public static final BitmapDescriptor GRAY_ROOD = BitmapDescriptorFactory.fromResource(R.drawable.grayroad);
public static final BitmapDescriptor GRAY_OTHER= BitmapDescriptorFactory.fromResource(R.drawable.grayother);
public static final BitmapDescriptor GRAY_FACET= BitmapDescriptorFactory.fromResource(R.drawable.grayfacet);
public static final BitmapDescriptor ICON_OPERATION=BitmapDescriptorFactory.fromResource(R.mipmap.icon_operation);
public static JobSearchBean jobSearchBean;//
public static MapView treasureMap;
public static final String INTENT_VIDEO_PATH = "INTENT_VIDEO_PATH"; // 拍照界面指定的视频文件保存位置
@ -183,7 +176,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 = "10.18";//版本日期
public static final String NAVIN_FO = "10.22";//版本日期
/*
*联系我们的QQ群名称和QQ群号
*/

View File

@ -1,6 +1,9 @@
package com.navinfo.outdoor.fragment;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
@ -10,6 +13,7 @@ import android.widget.Toast;
import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager;
import com.github.lazylibrary.util.FileUtils;
import com.lzy.okgo.model.HttpParams;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.activity.FragmentManagement;
@ -28,7 +32,11 @@ import com.umeng.umcrash.UMCrash;
import org.json.JSONObject;
import java.io.File;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
@ -40,6 +48,8 @@ public class CapacityEvaluationFragment extends BaseFragment implements View.OnC
private CapacityEvaluationAdapter capacityEvaluationAdapter;
private int capacityPage = 1;
private List<TaskPrefectureBean.BodyBean.ListBean> capacityList ;
private File logFile;
private StringBuilder capacityEvaluationBuilder;
public static CapacityEvaluationFragment newInstance(Bundle bundle) {
CapacityEvaluationFragment fragment = new CapacityEvaluationFragment();
@ -81,6 +91,7 @@ public class CapacityEvaluationFragment extends BaseFragment implements View.OnC
capacityEvaluationAdapter.setOnCapacityClick(new CapacityEvaluationAdapter.OnCapacityClick() {
@Override
public void onClick(int id) {
capacityEvaluationBuilder.append("点击了item ,");
Intent capacityEvaWeb = new Intent(getActivity(), FragmentManagement.class);
capacityEvaWeb.putExtra("tag", 14);
capacityEvaWeb.putExtra("id",id+"");
@ -94,6 +105,29 @@ public class CapacityEvaluationFragment extends BaseFragment implements View.OnC
super.initData();
capacityList=new ArrayList<>();
initNewWork(true);
SharedPreferences sharedPreferences = Objects.requireNonNull(getActivity()).getSharedPreferences(Constant.MESSAGE_TYPE, Context.MODE_PRIVATE);
SharedPreferences.Editor sharedEdit = sharedPreferences.edit();
@SuppressLint("SimpleDateFormat")
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);
sharedEdit.apply();
logFile = new File(Constant.LOG_FOLDER + "/" + newFormat + ".txt");
} else {
if (pictures_time.equals(newFormat)) {
logFile = new File(Constant.LOG_FOLDER + "/" + pictures_time + ".txt");
} else {
logFile = new File(Constant.LOG_FOLDER + "/" + newFormat + ".txt");
}
}
capacityEvaluationBuilder = new StringBuilder();
capacityEvaluationBuilder.append("CapacityEvaluationFragment-onCreate-initData ,");
if (Constant.USHERED != null) {
capacityEvaluationBuilder.append("userId:").append(Constant.USHERED).append(",");
}
}
private void initNewWork(boolean aNet) {
@ -125,10 +159,8 @@ public class CapacityEvaluationFragment extends BaseFragment implements View.OnC
dismissLoadingDialog();
Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show();
Log.d("TAG", "onError: " + e.getMessage());
/**
* 友盟+
* 返回自定义报错信息
*/
/* 友盟+
* 返回自定义报错信息*/
UMCrash.generateCustomLog("网络请求报错-位置CapacityEvaluationFragment" + e.getMessage(), "UmengException");
}
});
@ -166,6 +198,27 @@ public class CapacityEvaluationFragment extends BaseFragment implements View.OnC
public void onClick(View v) {
if (v.getId() == R.id.iv_evaluation_task_finish) {
Objects.requireNonNull(getActivity()).finish();
capacityEvaluationBuilder.append("点击了返回的按钮 ,");
}
}
@Override
public void onPause() {
super.onPause();
capacityEvaluationBuilder.append("onPause ,");
}
@Override
public void onStop() {
super.onStop();
capacityEvaluationBuilder.append("onStop ,");
}
@Override
public void onDestroy() {
super.onDestroy();
capacityEvaluationBuilder.append("onDestroy ");
capacityEvaluationBuilder.append("\r\n");
FileUtils.writeFile(logFile.getAbsolutePath(), capacityEvaluationBuilder.toString(), true);
}
}

View File

@ -1,5 +1,8 @@
package com.navinfo.outdoor.fragment;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
@ -11,6 +14,7 @@ import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.github.lazylibrary.util.FileUtils;
import com.google.gson.Gson;
import com.kongzue.dialog.util.DialogSettings;
import com.lzy.okgo.OkGo;
@ -34,7 +38,11 @@ import com.kongzue.dialog.v3.MessageDialog;
import org.json.JSONException;
import java.io.File;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -51,7 +59,8 @@ public class CapacityMeasurementFragment extends BaseFragment implements View.On
private ArrayList<ExamBean> examBeans;
private String examId;
private Gson gson;
private Button btn;
private File logFile;
private StringBuilder capacityMeasureBuilder;
public static CapacityMeasurementFragment newInstance(Bundle bundle) {
@ -74,7 +83,7 @@ public class CapacityMeasurementFragment extends BaseFragment implements View.On
capacityMeasurementRel.setLayoutManager(new LinearLayoutManager(getActivity()));
capacityMeasureAdapter = new CapacityMeasureAdapter(getActivity());
capacityMeasurementRel.setAdapter(capacityMeasureAdapter);
btn = findViewById(R.id.btn);
Button btn = findViewById(R.id.btn);
btn.setOnClickListener(this);
gson = new Gson();
}
@ -85,6 +94,29 @@ public class CapacityMeasurementFragment extends BaseFragment implements View.On
baleen = new ArrayList<>();
examBeans = new ArrayList<>();
initNetWorks();
SharedPreferences sharedPreferences = Objects.requireNonNull(getActivity()).getSharedPreferences(Constant.MESSAGE_TYPE, Context.MODE_PRIVATE);
SharedPreferences.Editor sharedEdit = sharedPreferences.edit();
@SuppressLint("SimpleDateFormat")
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);
sharedEdit.apply();
logFile = new File(Constant.LOG_FOLDER + "/" + newFormat + ".txt");
} else {
if (pictures_time.equals(newFormat)) {
logFile = new File(Constant.LOG_FOLDER + "/" + pictures_time + ".txt");
} else {
logFile = new File(Constant.LOG_FOLDER + "/" + newFormat + ".txt");
}
}
capacityMeasureBuilder = new StringBuilder();
capacityMeasureBuilder.append("CapacityMeasurementFragment-onCreate-initData ,");
if (Constant.USHERED != null) {
capacityMeasureBuilder.append("userId:").append(Constant.USHERED).append(",");
}
}
private void initNetWorks() {
@ -137,9 +169,11 @@ public class CapacityMeasurementFragment extends BaseFragment implements View.On
public void onClick(View v) {
switch (v.getId()) {
case R.id.iv_measurement_finish:
capacityMeasureBuilder.append("点击了返回的按钮 ,");
Objects.requireNonNull(getActivity()).finish();
break;
case R.id.btn:
capacityMeasureBuilder.append("点击了提交的的按钮 ,");
if (baleen.size() != 0) {
Map<String, String> checkedMap = capacityMeasureAdapter.getCheckedMap();
for (int i = 0; i < baleen.size(); i++) {
@ -217,4 +251,24 @@ public class CapacityMeasurementFragment extends BaseFragment implements View.On
}
});
}
@Override
public void onPause() {
super.onPause();
capacityMeasureBuilder.append("onPause ,");
}
@Override
public void onStop() {
super.onStop();
capacityMeasureBuilder.append("onStop ,");
}
@Override
public void onDestroy() {
super.onDestroy();
capacityMeasureBuilder.append("onDestroy");
capacityMeasureBuilder.append("\r\n");
FileUtils.writeFile(logFile.getAbsolutePath(), capacityMeasureBuilder.toString(), true);
}
}

View File

@ -209,7 +209,9 @@ public class ChargingPileFragment extends BaseDrawerFragment implements View.OnC
markerPile.setIcon(pileDescriptor);
checkBoxLife.setText("编辑");
checkBoxLife.setTextColor(Color.BLACK);
if (screenPilePositions.x!=0||screenPilePositions.y!=0){
latLng = tencentMap.getProjection().fromScreenLocation(screenPilePositions);
}
markerPile.setPosition(latLng);
markerPile.setFixingPointEnable(false);
checkBoxLife.setChecked(false);

View File

@ -302,7 +302,9 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
markerStation.setIcon(stationDescriptor);
checkBoxLife.setText("编辑");
checkBoxLife.setTextColor(Color.BLACK);
if (screenStationPositions.x!=0||screenStationPositions.y!=0){
latLng = tencentMap.getProjection().fromScreenLocation(screenStationPositions);
}
markerStation.setPosition(latLng);
markerStation.setFixingPointEnable(false);
checkBoxLife.setChecked(false);
@ -1116,7 +1118,7 @@ public class ChargingStationFragment extends BaseDrawerFragment implements View.
}
}
}
Objects.requireNonNull(getActivity()).runOnUiThread(new Runnable() {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
HttpParams httpParams = new HttpParams();

View File

@ -1,6 +1,9 @@
package com.navinfo.outdoor.fragment;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
@ -10,6 +13,7 @@ import android.widget.Toast;
import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager;
import com.github.lazylibrary.util.FileUtils;
import com.lzy.okgo.model.HttpParams;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.activity.WebActivity;
@ -27,7 +31,11 @@ import com.jcodecraeer.xrecyclerview.XRecyclerView;
import org.json.JSONObject;
import java.io.File;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Objects;
@ -41,6 +49,8 @@ public class EventPrefectureFragment extends BaseFragment implements View.OnClic
private List<TaskPrefectureBean.BodyBean.ListBean> taskExplainBean;
private EventPrefectureAdapter eventPrefectureAdapter;
private int eventPage = 1;
private File logFile;
private StringBuilder eventPrefectureBuilder;
public static EventPrefectureFragment newInstance(Bundle bundle) {
EventPrefectureFragment fragment = new EventPrefectureFragment();
@ -58,6 +68,28 @@ public class EventPrefectureFragment extends BaseFragment implements View.OnClic
super.initData();
taskExplainBean = new ArrayList<>();
initNetwork(true);
SharedPreferences sharedPreferences = Objects.requireNonNull(getActivity()).getSharedPreferences(Constant.MESSAGE_TYPE, Context.MODE_PRIVATE);
SharedPreferences.Editor sharedEdit = sharedPreferences.edit();
@SuppressLint("SimpleDateFormat")
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);
sharedEdit.apply();
logFile = new File(Constant.LOG_FOLDER + "/" + newFormat + ".txt");
} else {
if (pictures_time.equals(newFormat)) {
logFile = new File(Constant.LOG_FOLDER + "/" + pictures_time + ".txt");
} else {
logFile = new File(Constant.LOG_FOLDER + "/" + newFormat + ".txt");
}
}
eventPrefectureBuilder = new StringBuilder();
eventPrefectureBuilder.append("EventPrefectureFragment-onCreate-initData ,");
if (Constant.USHERED != null) {
eventPrefectureBuilder.append("userId:").append(Constant.USHERED).append(",");
}
}
private void initNetwork(boolean aNet) {
@ -137,6 +169,7 @@ public class EventPrefectureFragment extends BaseFragment implements View.OnClic
// eventRecycler.setLoadingMoreEnabled(false);
eventPrefectureAdapter = new EventPrefectureAdapter(taskExplainBean,getActivity());
eventRecycler.setAdapter(eventPrefectureAdapter);
eventRecycler.setLoadingListener(new XRecyclerView.LoadingListener() {
@Override
public void onRefresh() {
@ -149,9 +182,11 @@ public class EventPrefectureFragment extends BaseFragment implements View.OnClic
initNetwork(false);
}
});
eventPrefectureAdapter.setClickItem(new EventPrefectureAdapter.clickItem() {
@Override
public void item(int aInt) {
eventPrefectureBuilder.append("点击了item ,");
HashMap<String, String> paramMap = new HashMap<>();
paramMap.put("id",aInt+"");
intint2WebActivity(HttpInterface.MSG_CONTENT, paramMap);
@ -163,6 +198,27 @@ public class EventPrefectureFragment extends BaseFragment implements View.OnClic
public void onClick(View v) {
if (v.getId() == R.id.iv_event_task) {
Objects.requireNonNull(getActivity()).finish();
eventPrefectureBuilder.append("点击了返回的按钮 ,");
}
}
@Override
public void onPause() {
super.onPause();
eventPrefectureBuilder.append("onPause ,");
}
@Override
public void onStop() {
super.onStop();
eventPrefectureBuilder.append("onStop ,");
}
@Override
public void onDestroy() {
super.onDestroy();
eventPrefectureBuilder.append("onDestroy ,");
eventPrefectureBuilder.append("\r\n");
FileUtils.writeFile(logFile.getAbsolutePath(), eventPrefectureBuilder.toString(), true);
}
}

View File

@ -193,7 +193,6 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
/**
* 保存小数点后两位
* @param value
* @return
*/
public static String format2(double value) {
DecimalFormat df = new DecimalFormat("0.00");
@ -282,9 +281,8 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
LatLng endLatLng = new LatLng(Double.parseDouble(poiEntity.getY()), Double.parseDouble(poiEntity.getX()));
double geometry = GeometryTools.distanceToDouble(startLatLng, endLatLng);
if (geometry > 5000) {
initGather();
Toast.makeText(getActivity(), "作业不在领取范围内,无法领取", Toast.LENGTH_SHORT).show();
// return;
return;
}else {
if (geometry>50){
// Voice.sprat("注意在附近50米范围内进行采集",0);
@ -572,10 +570,9 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
Log.d("TAG", "onError: " + e.getMessage());
}
});
}
/**
/*
* @param url
* 所以类型的结束领取
*/
@ -629,7 +626,6 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
public void onError(Throwable e, int id) {
dismissLoadingDialog();
Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_SHORT).show();
Log.d("TAG", "onError: " + e.getMessage());
}
});
}
@ -849,8 +845,6 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
});
}
private void senMessageMarker(int type, String y, String x) {
Message markerMsg = Message.obtain();
markerMsg.what = Constant.EVENT_WHAT_CURRENT_MARKER;
@ -861,7 +855,8 @@ 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();
@ -958,7 +953,6 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
} else {
Toast.makeText(getActivity(), "" + response.getMessage(), Toast.LENGTH_SHORT).show();
}
}
@Override
@ -993,4 +987,5 @@ public class GatherGetFragment extends BaseFragment implements View.OnClickListe
gatherGetBuilder.append("\r\n");
FileUtils.writeFile(logFile.getAbsolutePath(), gatherGetBuilder.toString(), true);
}
}

View File

@ -109,7 +109,7 @@ public class HasSubmitFragment extends BaseFragment implements View.OnClickListe
HttpParams httpParams = new HttpParams();
httpParams.put("type", "5");
httpParams.put("pageSize", "10");
httpParams.put("pageNum", hasPage);
httpParams.put("pageNum", hasPage+"");
OkGoBuilder.getInstance()
.Builder(getActivity())
.url(HttpInterface.GET_COMMIT_LIST)
@ -147,7 +147,7 @@ public class HasSubmitFragment extends BaseFragment implements View.OnClickListe
HttpParams httpParams = new HttpParams();
httpParams.put("type", "2");
httpParams.put("pageSize", "10");
httpParams.put("pageNum", hasPage);
httpParams.put("pageNum", hasPage+"");
OkGoBuilder.getInstance()
.Builder(getActivity())
.url(HttpInterface.GET_COMMIT_LIST)
@ -185,7 +185,7 @@ public class HasSubmitFragment extends BaseFragment implements View.OnClickListe
HttpParams httpParams = new HttpParams();
httpParams.put("type", "4");
httpParams.put("pageSize", "10");
httpParams.put("pageNum", hasPage);
httpParams.put("pageNum", hasPage+"");
OkGoBuilder.getInstance()
.Builder(getActivity())
.url(HttpInterface.GET_COMMIT_LIST)
@ -223,7 +223,7 @@ public class HasSubmitFragment extends BaseFragment implements View.OnClickListe
HttpParams httpParams = new HttpParams();
httpParams.put("type", "3");
httpParams.put("pageSize", "10");
httpParams.put("pageNum", hasPage);
httpParams.put("pageNum", hasPage+"");
OkGoBuilder.getInstance()
.Builder(getActivity())
.url(HttpInterface.GET_COMMIT_LIST)
@ -261,7 +261,7 @@ public class HasSubmitFragment extends BaseFragment implements View.OnClickListe
HttpParams httpParams = new HttpParams();
httpParams.put("type", "1");
httpParams.put("pageSize", "10");
httpParams.put("pageNum", hasPage);
httpParams.put("pageNum", hasPage+"");
OkGoBuilder.getInstance()
.Builder(getActivity())
.url(HttpInterface.GET_COMMIT_LIST)

View File

@ -85,8 +85,6 @@ import java.util.Objects;
* 寻宝-上报-其他的fragment
*/
public class OtherFragment extends BaseDrawerFragment implements View.OnClickListener {
private Spinner spinnerOther;
String[] others = new String[]{"门牌", "公交", "情报"};// //门牌:7 公交:8 情报:9 现在其他任务类型里就这三种
String[] spinner = new String[]{"存在", "不存在", "无法验证"};
@ -648,7 +646,7 @@ public class OtherFragment extends BaseDrawerFragment implements View.OnClickLis
initOtherSharePre();
}
/**
/*
* 防止当页面崩溃后出现数据丢失
*/
public void initOtherSharePre() {

View File

@ -32,8 +32,6 @@ import java.util.Objects;
* 图片-fragment
*/
public class PhotoFragment extends BaseFragment implements View.OnClickListener {
private ArrayList<FileBean> fileBeans;
private ArrayList<FileBean> deleteFiles;
private PhotoAdapter photoAdapter;
@ -94,7 +92,7 @@ public class PhotoFragment extends BaseFragment implements View.OnClickListener
if (fileListByUUID.size()>=2){
File parentFile = fileListByUUID.get(0).getParentFile();
for (int i = 0; i < fileListByUUID.size()-1; i++) {
File file = new File(parentFile+"/" + i + ".jpg");
File file = new File(parentFile+"/" + i + ".webp");
fileBeans.add(new FileBean(file, false));
}
}

View File

@ -194,7 +194,6 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
checkBoxLife.setTextColor(Color.WHITE);
checkBoxLife.setChecked(true);
}
@Override
public void onCancel() {
BitmapDescriptor poiDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.marker_poi_show);
@ -1105,6 +1104,7 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
} else {
Toast.makeText(getActivity(), "" + response.getMessage(), Toast.LENGTH_SHORT).show();
}
}
@Override
@ -1112,7 +1112,9 @@ public class PoiFragment extends BaseDrawerFragment implements View.OnClickListe
dismissLoadingDialog();
Log.d("TAG", "onError: " + e.getMessage());
}
});
}
@Override

View File

@ -92,7 +92,6 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
private File logFile;
private StringBuilder poiVideoBuilder;
public static PoiVideoFragment newInstance(Bundle bundle) {
PoiVideoFragment fragment = new PoiVideoFragment();
fragment.setArguments(bundle);
@ -270,7 +269,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
boolean isImageLoad = false;
List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(showPoiEntity.getId());
for (int i = 0; i < fileListByUUID.size(); i++) {
if (fileListByUUID.get(i).getPath().contains(".jpg") && !fileListByUUID.get(i).getPath().contains("paper.txt")) {
if (fileListByUUID.get(i).getPath().contains(".webp") && !fileListByUUID.get(i).getPath().contains("paper.txt")) {
if (fileListByUUID.get(i).exists() && !isImageLoad) {
// 使用glide加载视频的第一帧
Glide.with(Objects.requireNonNull(getActivity())).load(fileListByUUID.get(i)).into(ivPoiVideoPicture);
@ -316,7 +315,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
boolean isImageLoad = false;
for (int i = 0; i < fileListByUUID.size(); i++) {
File videoFile = fileListByUUID.get(i);
if (videoFile.getPath().contains(".jpg") && !videoFile.getPath().contains("paper.txt")) {
if (videoFile.getPath().contains(".webp") && !videoFile.getPath().contains("paper.txt")) {
if (videoFile.exists() && !isImageLoad) {
// 使用glide加载视频的第一帧
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivPoiVideoPicture, 500);
@ -350,7 +349,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
case R.id.tv_short://手动拍摄
poiVideoBuilder.append("点击了手动拍摄的按钮 ,");
Intent intents = new Intent(getContext(), PicturesActivity.class);
File filePath = AWMp4ParserHelper.getInstance().obtainJPGFilePath(new File(Constant.PICTURE_FOLDER, showPoiEntity.getId()).getAbsolutePath());
File filePath = AWMp4ParserHelper.getInstance().obtainWebpFilePath(new File(Constant.PICTURE_FOLDER, showPoiEntity.getId()).getAbsolutePath());
intents.putExtra(Constant.INTENT_JPG_PATH, filePath.getAbsolutePath());
intents.putExtra("poiEntity", showPoiEntity);
intents.putExtra(Constant.INTENT_VIDEO_OBLATION, 0);
@ -360,7 +359,7 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
case R.id.tv_combo://自动连拍:
poiVideoBuilder.append("点击了自动连拍的按钮 ,");
Intent intent = new Intent(getContext(), PicturesActivity.class);
File fileJpgPath = AWMp4ParserHelper.getInstance().obtainJPGFilePath(new File(Constant.PICTURE_FOLDER, showPoiEntity.getId()).getAbsolutePath());
File fileJpgPath = AWMp4ParserHelper.getInstance().obtainWebpFilePath(new File(Constant.PICTURE_FOLDER, showPoiEntity.getId()).getAbsolutePath());
intent.putExtra(Constant.INTENT_JPG_PATH, fileJpgPath.getAbsolutePath());
intent.putExtra("poiEntity", showPoiEntity);
intent.putExtra(Constant.INTENT_VIDEO_OBLATION, 0);
@ -541,8 +540,8 @@ public class PoiVideoFragment extends BaseDrawerFragment implements View.OnClick
} else if (requestCode == 0x102 && resultCode == 0x111) {
tvCombo.setEnabled(false);
}
if (data != null && data.hasExtra(Constant.INTENT_VIDEO_PATH)) {
String videoPath = data.getStringExtra(Constant.INTENT_VIDEO_PATH);
if (data != null && data.hasExtra(Constant.INTENT_PICTURES_PATH)) {
String videoPath = data.getStringExtra(Constant.INTENT_PICTURES_PATH);
assert videoPath != null;
File videoFile = new File(videoPath);
if (videoFile.exists()) {

View File

@ -294,13 +294,14 @@ public class RegisterFragment extends BaseFragment implements View.OnClickListen
@Override
public void onPause() {
super.onPause();
registerBuilder.append("onPause,");
registerBuilder.append("onPause ,");
}
@Override
public void onStop() {
super.onStop();
registerBuilder.append("onStop,");
registerBuilder.append("onStop ,");
}
@Override

View File

@ -108,7 +108,6 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
if (!EventBus.getDefault().isRegistered(this)) {//加上判断
EventBus.getDefault().register(this);
}
}
@Override
@ -267,7 +266,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
boolean isImageLoad = false;
List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(showPoiEntity.getId());
for (int i = 0; i < fileListByUUID.size(); i++) {
if (fileListByUUID.get(i).getPath().contains(".jpg") && !fileListByUUID.get(i).getPath().contains("paper.txt")) {
if (fileListByUUID.get(i).getPath().contains(".webp") && !fileListByUUID.get(i).getPath().contains("paper.txt")) {
if (fileListByUUID.get(i).exists() && !isImageLoad) {
// 使用glide加载视频的第一帧
Glide.with(Objects.requireNonNull(getActivity())).load(fileListByUUID.get(i)).into(ivRoadPicture);
@ -328,7 +327,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
boolean isImageLoad = false;
for (int i = 0; i < fileListByUUID.size(); i++) {
File videoFile = fileListByUUID.get(i);
if (videoFile.getPath().contains(".jpg") && !videoFile.getPath().contains("paper.txt")) {
if (videoFile.getPath().contains(".webp") && !videoFile.getPath().contains("paper.txt")) {
if (videoFile.exists() && !isImageLoad) {
// 使用glide加载视频的第一帧
AWMp4ParserHelper.getInstance().loadFirstWithGlide(getActivity(), Uri.fromFile(videoFile).toString(), ivRoadPicture, 500);
@ -362,7 +361,7 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
case R.id.tv_pictures:
roadBuilder.append("点击了自动拍照的按钮 ,");
Intent intent = new Intent(getContext(), PicturesActivity.class);
File finalFile = AWMp4ParserHelper.getInstance().obtainJPGFilePath(new File(Constant.PICTURE_FOLDER, showPoiEntity.getId()).getAbsolutePath());
File finalFile = AWMp4ParserHelper.getInstance().obtainWebpFilePath(new File(Constant.PICTURE_FOLDER, showPoiEntity.getId()).getAbsolutePath());
intent.putExtra(Constant.INTENT_JPG_PATH, finalFile.getAbsolutePath());
intent.putExtra(Constant.INTENT_VIDEO_OBLATION, 0);
intent.putExtra(Constant.INTENT_POI_VIDEO_TYPE, 3);
@ -543,9 +542,9 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 0x101) {
if (resultCode == 0x111) {
if (data != null && data.hasExtra(Constant.INTENT_VIDEO_PATH)) {
if (data != null && data.hasExtra(Constant.INTENT_PICTURES_PATH)) {
// 扫描照片目录中当前视频的所有视频文件
String videoPath = data.getStringExtra(Constant.INTENT_VIDEO_PATH);
String videoPath = data.getStringExtra(Constant.INTENT_PICTURES_PATH);
assert videoPath != null;
File videoFile = new File(videoPath);
if (videoFile.exists()) {
@ -762,13 +761,11 @@ public class RoadFragment extends BaseDrawerFragment implements View.OnClickList
@Override
protected ChargingPileEntity initChargingPileEntityByUI(ChargingPileEntity entity) {
return null;
}
@Override
protected PoiCheckResult checkChargingPileEntity(ChargingPileEntity entity) {
return null;
}
}

View File

@ -130,6 +130,7 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
});
if (Constant.currentLocation!=null){
if (Constant.USHERED!=null){
cbSelect.setChecked(false);
refreshData();
}
}
@ -168,6 +169,7 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
cbSelect.setChecked(false);
if (Constant.currentLocation!=null){
if (Constant.USHERED!=null){
cbSelect.setChecked(false);
refreshData();
}
@ -354,7 +356,6 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
}
public void refreshData() {
cbSelect.setChecked(false);
if (roadEntities == null) {
roadEntities = new ArrayList<>();
} else {

View File

@ -1,6 +1,9 @@
package com.navinfo.outdoor.fragment;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
@ -10,6 +13,7 @@ import android.widget.Toast;
import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager;
import com.github.lazylibrary.util.FileUtils;
import com.lzy.okgo.model.HttpParams;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.activity.FragmentManagement;
@ -27,7 +31,11 @@ import com.jcodecraeer.xrecyclerview.XRecyclerView;
import org.json.JSONObject;
import java.io.File;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
@ -40,6 +48,8 @@ public class TaskExplainFragment extends BaseFragment implements View.OnClickLis
private TaskExplainAdapter taskExplainAdapter;
private int taskPage = 1;
private List<TaskPrefectureBean.BodyBean.ListBean> explainList;
private File logFile;
private StringBuilder taskExplainBuilder;
public static TaskExplainFragment newInstance(Bundle bundle) {
@ -88,12 +98,11 @@ public class TaskExplainFragment extends BaseFragment implements View.OnClickLis
taskExplainAdapter.setOnItemClick(new TaskExplainAdapter.OnItemClick() {
@Override
public void onClick(int pos) {
taskExplainBuilder.append("点击了item ,");
Intent itemIntent = new Intent(getActivity(), FragmentManagement.class);
itemIntent.putExtra("tag", 10);
itemIntent.putExtra("id",pos+"");
startActivity(itemIntent);
}
});
}
@ -103,6 +112,28 @@ public class TaskExplainFragment extends BaseFragment implements View.OnClickLis
super.initData();
explainList = new ArrayList<>();
initNetWork(true);
SharedPreferences sharedPreferences = Objects.requireNonNull(getActivity()).getSharedPreferences(Constant.MESSAGE_TYPE, Context.MODE_PRIVATE);
SharedPreferences.Editor sharedEdit = sharedPreferences.edit();
@SuppressLint("SimpleDateFormat")
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);
sharedEdit.apply();
logFile = new File(Constant.LOG_FOLDER + "/" + newFormat + ".txt");
} else {
if (pictures_time.equals(newFormat)) {
logFile = new File(Constant.LOG_FOLDER + "/" + pictures_time + ".txt");
} else {
logFile = new File(Constant.LOG_FOLDER + "/" + newFormat + ".txt");
}
}
taskExplainBuilder = new StringBuilder();
taskExplainBuilder.append("TaskExplainFragment-onCreate-initData ,");
if (Constant.USHERED != null) {
taskExplainBuilder.append("userId:").append(Constant.USHERED).append(",");
}
}
private void initNetWork(boolean aNet) {
@ -171,6 +202,27 @@ public class TaskExplainFragment extends BaseFragment implements View.OnClickLis
public void onClick(View v) {
if (v.getId() == R.id.iv_find_task_explain) {
Objects.requireNonNull(getActivity()).finish();
taskExplainBuilder.append("点击了返回的按钮 ,");
}
}
@Override
public void onPause() {
super.onPause();
taskExplainBuilder.append("onPause ,");
}
@Override
public void onStop() {
super.onStop();
taskExplainBuilder.append("onStop ,");
}
@Override
public void onDestroy() {
super.onDestroy();
taskExplainBuilder.append("onDestroy ");
taskExplainBuilder.append("\r\n");
FileUtils.writeFile(logFile.getAbsolutePath(), taskExplainBuilder.toString(), true);
}
}

View File

@ -1,6 +1,9 @@
package com.navinfo.outdoor.fragment;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
@ -10,6 +13,7 @@ import android.widget.Toast;
import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager;
import com.github.lazylibrary.util.FileUtils;
import com.lzy.okgo.model.HttpParams;
import com.navinfo.outdoor.R;
import com.navinfo.outdoor.activity.WebActivity;
@ -27,7 +31,11 @@ import com.jcodecraeer.xrecyclerview.XRecyclerView;
import org.json.JSONObject;
import java.io.File;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Objects;
@ -41,6 +49,8 @@ public class TaskPrefectureFragment extends BaseFragment implements View.OnClick
private List<TaskPrefectureBean.BodyBean.ListBean> dataBeanList;
private TaskPrefectureAdapter taskPrefectureAdapter;
private int taskPage = 1;
private File logFile;
private StringBuilder taskPrefectureBuilder;
public static TaskPrefectureFragment newInstance(Bundle bundle) {
@ -79,6 +89,7 @@ public class TaskPrefectureFragment extends BaseFragment implements View.OnClick
taskPrefectureAdapter.setClickItem(new TaskPrefectureAdapter.clickItem() {
@Override
public void item(int id) {
taskPrefectureBuilder.append("点击了item ,");
HashMap<String, String> paramMap = new HashMap<>();
paramMap.put("id",id+"");
intint2WebActivity(HttpInterface.MSG_CONTENT, paramMap);
@ -91,6 +102,28 @@ public class TaskPrefectureFragment extends BaseFragment implements View.OnClick
super.initData();
dataBeanList = new ArrayList<>();
initNetwork(true);
SharedPreferences sharedPreferences = Objects.requireNonNull(getActivity()).getSharedPreferences(Constant.MESSAGE_TYPE, Context.MODE_PRIVATE);
SharedPreferences.Editor sharedEdit = sharedPreferences.edit();
@SuppressLint("SimpleDateFormat")
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);
sharedEdit.apply();
logFile = new File(Constant.LOG_FOLDER + "/" + newFormat + ".txt");
} else {
if (pictures_time.equals(newFormat)) {
logFile = new File(Constant.LOG_FOLDER + "/" + pictures_time + ".txt");
} else {
logFile = new File(Constant.LOG_FOLDER + "/" + newFormat + ".txt");
}
}
taskPrefectureBuilder = new StringBuilder();
taskPrefectureBuilder.append("TaskPrefectureFragment-onCreate-initData ,");
if (Constant.USHERED != null) {
taskPrefectureBuilder.append("userId:").append(Constant.USHERED).append(",");
}
}
private void initNetwork(boolean aNet) {
@ -193,6 +226,27 @@ public class TaskPrefectureFragment extends BaseFragment implements View.OnClick
public void onClick(View v) {
if (v.getId() == R.id.iv_find_task) {
Objects.requireNonNull(getActivity()).finish();
taskPrefectureBuilder.append("点击了返回的按钮 ,");
}
}
@Override
public void onPause() {
super.onPause();
taskPrefectureBuilder.append("onPause ,");
}
@Override
public void onStop() {
super.onStop();
taskPrefectureBuilder.append("onStop ,");
}
@Override
public void onDestroy() {
super.onDestroy();
taskPrefectureBuilder.append("onDestroy");
taskPrefectureBuilder.append("\r\n");
FileUtils.writeFile(logFile.getAbsolutePath(), taskPrefectureBuilder.toString(), true);
}
}

View File

@ -259,7 +259,7 @@ public class AWMp4ParserHelper {
/**
* 根据文件夹路径生成最新的视频文件路径
* */
public File obtainJPGFilePath(String folderPath) {
public File obtainWebpFilePath(String folderPath) {
if (folderPath == null) {
return null;
}
@ -270,26 +270,26 @@ public class AWMp4ParserHelper {
File[] fileList = folderFile.listFiles(new FileFilter() {
@Override
public boolean accept(File pathname) {
if (pathname.getName().endsWith(".jpg")){
if (pathname.getName().endsWith(".webp")){
return true;
}
return false;
}
});
if (fileList == null || fileList.length==0) {
return new File(folderPath+"/0.jpg");
return new File(folderPath+"/0.webp");
}
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", ""));
int index = Integer.parseInt(file.getName().replace(".webp", ""));
if (index>=maxIndex) {
maxIndex = index;
}
}
}
return new File(folderPath+"/"+(maxIndex+1)+".jpg");
return new File(folderPath+"/"+(maxIndex+1)+".webp");
}
/**

View File

@ -33,7 +33,7 @@ public class PhotoUtils {
lat= initEncode(latLng);
}
long time = System.currentTimeMillis();
return new File(Constant.PICTURE_FOLDER, d + time + "_p" + lat + "_a" + 0 + ".jpg");
return new File(Constant.PICTURE_FOLDER, d + time + "_p" + lat + "_a" + 0 + ".webp");
}

View File

@ -51,8 +51,7 @@ public class UploadUtils {
new Thread(new Runnable() {
@Override
public void run() {
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
poiDao.deletePoiEntity(poiDaoPoiEntity);
poiDao.deletePoiEntity(showPoiEntity);
if (showPoiEntity.getId()!=null){
List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(showPoiEntity.getId());
for (int i = 0; i < fileListByUUID.size(); i++) {
@ -113,8 +112,7 @@ public class UploadUtils {
new Thread(new Runnable() {
@Override
public void run() {
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
poiDao.deletePoiEntity(poiDaoPoiEntity);
poiDao.deletePoiEntity(showPoiEntity);
for (int i = 0; i < poiPicList.size(); i++) {
poiPicList.get(i).delete();
}
@ -169,8 +167,7 @@ public class UploadUtils {
new Thread(new Runnable() {
@Override
public void run() {
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
poiDao.deletePoiEntity(poiDaoPoiEntity);
poiDao.deletePoiEntity(showPoiEntity);
if (showPoiEntity.getId() != null) {
List<File> fileListByUUID = AWMp4ParserHelper.getInstance().getFileListByUUID(showPoiEntity.getId());
for (int i = 0; i < fileListByUUID.size(); i++) {
@ -231,8 +228,7 @@ public class UploadUtils {
new Thread(new Runnable() {
@Override
public void run() {
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
poiDao.deletePoiEntity(poiDaoPoiEntity);
poiDao.deletePoiEntity(showPoiEntity);
for (int i = 0; i < otherUploadList.size(); i++) {
otherUploadList.get(i).delete();
}
@ -288,8 +284,7 @@ public class UploadUtils {
new Thread(new Runnable() {
@Override
public void run() {
PoiEntity poiDaoPoiEntity = poiDao.getPoiEntity(showPoiEntity.getId());
poiDao.deletePoiEntity(poiDaoPoiEntity);
poiDao.deletePoiEntity(showPoiEntity);
for (int i = 0; i < chargingStationList.size(); i++) {
chargingStationList.get(i).delete();
}

View File

@ -0,0 +1,47 @@
package com.navinfo.outdoor.util;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.util.Log;
import android.widget.Toast;
import com.wanghong.webpnative.WebPNative;
import java.io.File;
import static com.lzy.okgo.utils.HttpUtils.runOnUiThread;
public class WebpUtil {
public static void performEncodeImage(Context context, File imgFile, float quFloat) {
if (imgFile.exists()) {
WebPNative webPNative = new WebPNative();
new Thread(new Runnable() {
@Override
public void run() {
try {
Bitmap bitmap = BitmapFactory.decodeFile(imgFile.getAbsolutePath());
String[] split = imgFile.getName().split(".jpg");
String output = imgFile.getParent() + File.separator + split[0] + ".webp";
webPNative.encodeRGBA(bitmap, output, quFloat);
imgFile.delete();
/*long start = System.currentTimeMillis();
long useTime = System.currentTimeMillis() - start;
Log.e("WebpUtil:", String.valueOf(useTime));
File file = new File(output.substring(0, output.length() - 5) + ".webp");
new File(output).renameTo(file);*/
if (!bitmap.isRecycled()) {
bitmap.recycle();
}
} catch (Exception e) {
Log.d("output:", e.toString());
Toast.makeText(context, "文件转换失败", Toast.LENGTH_SHORT).show();
}
}
}).start();
} else {
Toast.makeText(context, "源文件不存在", Toast.LENGTH_SHORT).show();
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -51,7 +51,7 @@
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_height="42dp"
android:background="@drawable/other_text">
<Spinner

View File

@ -30,7 +30,7 @@
<!--设置系统的取消预览(空白窗口)为true -->
<item name="android:windowDisablePreview">true</item>
<!--设置背景为透明-->
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowIsTranslucent">false</item>
</style>
<style name="AppTheme.NoActionBar">