Commit 472245d0 authored by hywang's avatar hywang

1.修复图片异常无法上传基础数据bug;

2.修复同步数据bug。
parent f9235109
...@@ -9,8 +9,8 @@ android { ...@@ -9,8 +9,8 @@ android {
applicationId "com.phlx.anchorcollect_p" applicationId "com.phlx.anchorcollect_p"
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 29 targetSdkVersion 29
versionCode 14 versionCode 16
versionName "2.0.8" versionName "2.0.11"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
...@@ -45,6 +45,8 @@ android { ...@@ -45,6 +45,8 @@ android {
abortOnError false abortOnError false
} }
ndkVersion '22.1.7171670'
} }
greendao { greendao {
......
...@@ -49,7 +49,8 @@ public class RetrofitClient { ...@@ -49,7 +49,8 @@ public class RetrofitClient {
private static final int CACHE_TIMEOUT = 10 * 1024 * 1024; private static final int CACHE_TIMEOUT = 10 * 1024 * 1024;
//服务端根路径 //服务端根路径
public static String baseUrl = public static String baseUrl =
"serve.xlglmnmyzspt.org.cn"//正式 // "serve.xlglmnmyzspt.org.cn"//正式old
"serve.xlglzy.org.cn"//正式
// "39.101.170.186"//阿里云测试 // "39.101.170.186"//阿里云测试
// "192.168.8.135"//董 // "192.168.8.135"//董
// "192.168.43.154"//张敏 // "192.168.43.154"//张敏
......
...@@ -129,9 +129,9 @@ public class BasicsCollectFragment extends BaseFragment<FragmentBasicsCollectBin ...@@ -129,9 +129,9 @@ public class BasicsCollectFragment extends BaseFragment<FragmentBasicsCollectBin
if (!hidden) { if (!hidden) {
viewModel.addInventoryListener(); viewModel.addInventoryListener();
initImagePicker(); initImagePicker();
Configs.currentEvent = EventTag.EVENT_WEIGHT_DATA_BASICS;
if (!Configs.currentEvent.equals(EventTag.EVENT_WEIGHT_DATA_BASICS))//防止拍照刷新页面 if (!Configs.currentEvent.equals(EventTag.EVENT_WEIGHT_DATA_BASICS))//防止拍照刷新页面
viewModel.initDataForUnid(Configs.tempUnid); viewModel.initDataForUnid(Configs.tempUnid);
Configs.currentEvent = EventTag.EVENT_WEIGHT_DATA_BASICS;
} else { } else {
viewModel.removeInventoryListener(); viewModel.removeInventoryListener();
// Configs.currentEvent = ""; // Configs.currentEvent = "";
......
...@@ -153,6 +153,7 @@ public class BasicsCollectVM extends BaseViewModel<Repository> implements OnInve ...@@ -153,6 +153,7 @@ public class BasicsCollectVM extends BaseViewModel<Repository> implements OnInve
File externalFileRootDir = getApplication().getExternalFilesDir("/collect/picture/"); File externalFileRootDir = getApplication().getExternalFilesDir("/collect/picture/");
// externalFileRootDir.mkdirs(); // externalFileRootDir.mkdirs();
// Environment.getExternalStorageDirectory().getAbsolutePath()
String savePath = externalFileRootDir.getAbsolutePath();//不分开就少个斜杠 String savePath = externalFileRootDir.getAbsolutePath();//不分开就少个斜杠
markeImgUrl = savePath + "/anchorCiq" + Configs.tempCattleResume.getUnid() + ".jpg"; markeImgUrl = savePath + "/anchorCiq" + Configs.tempCattleResume.getUnid() + ".jpg";
markFile = new File(markeImgUrl); markFile = new File(markeImgUrl);
...@@ -413,7 +414,7 @@ public class BasicsCollectVM extends BaseViewModel<Repository> implements OnInve ...@@ -413,7 +414,7 @@ public class BasicsCollectVM extends BaseViewModel<Repository> implements OnInve
tag.set(Configs.tempTag); tag.set(Configs.tempTag);
rfid.set(Configs.tempRfid); rfid.set(Configs.tempRfid);
remarkParamEntity.setShowName(result.get(0).getRemark()); remarkParamEntity.setShowName(result.get(0).getRemark());
Configs.tempCattleResume.setPhotoPath(markeImgUrl); // Configs.tempCattleResume.setPhotoPath(markeImgUrl);
String[] filedName = EntityUtils.getFiledName(result.get(0)); String[] filedName = EntityUtils.getFiledName(result.get(0));
for (String name : filedName) { for (String name : filedName) {
......
...@@ -221,7 +221,7 @@ public class LoginVM extends BaseViewModel<Repository> { ...@@ -221,7 +221,7 @@ public class LoginVM extends BaseViewModel<Repository> {
ToastUtils.showShort("账号错误"); ToastUtils.showShort("账号错误");
return; return;
} }
if (!model.getUserName().equals(userName.get())) { if (!model.getPassword().equals(password.get())) {
ToastUtils.showShort("密码错误"); ToastUtils.showShort("密码错误");
return; return;
} }
......
...@@ -217,7 +217,8 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -217,7 +217,8 @@ public class SyncVM extends BaseViewModel<Repository> {
if (response.getCode() == 0) { if (response.getCode() == 0) {
//存下最后更新的时间 //存下最后更新的时间
SPUtils.getInstance().put(Configs.SP_CATTLE_RESUME_UPDATE_DATE, dateFormat.format(new Date())); SPUtils.getInstance().put(Configs.SP_CATTLE_RESUME_UPDATE_DATE,
dateFormat.format(new Date()));
cattleresumeDate.set(SPUtils.getInstance().getString(Configs.SP_CATTLE_RESUME_UPDATE_DATE)); cattleresumeDate.set(SPUtils.getInstance().getString(Configs.SP_CATTLE_RESUME_UPDATE_DATE));
if (response.getData() != null && response.getData().size() > 0) { if (response.getData() != null && response.getData().size() > 0) {
...@@ -227,7 +228,8 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -227,7 +228,8 @@ public class SyncVM extends BaseViewModel<Repository> {
// File file = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + // File file = new File(Environment.getExternalStorageDirectory().getAbsolutePath() +
// "/collect/picture/"); // "/collect/picture/");
// String savePath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/collect/picture/"; // String savePath = Environment.getExternalStorageDirectory().getAbsolutePath() +
// "/collect/picture/";
// getExternalFilesDir() 用于获取SDCard/Android/data/你的应用的包名/files/ 目录 // getExternalFilesDir() 用于获取SDCard/Android/data/你的应用的包名/files/ 目录
File externalFileRootDir = getApplication().getExternalFilesDir("/collect/picture/"); File externalFileRootDir = getApplication().getExternalFilesDir("/collect/picture/");
// externalFileRootDir.mkdirs(); // externalFileRootDir.mkdirs();
...@@ -348,13 +350,24 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -348,13 +350,24 @@ public class SyncVM extends BaseViewModel<Repository> {
//保存图片 //保存图片
for (CattleResumeEntity cre : cattleResumeEntities) { for (CattleResumeEntity cre : cattleResumeEntities) {
Log.e("uploadBaseArchives", "cre.getPhotoPath()"+cre.getPhotoPath()); Log.e("uploadBaseArchives", "cre.getPhotoPath()" + cre.getPhotoPath());
if (cre.getPhotoPath() != null && !cre.getPhotoPath().equals("")) { if (cre.getPhotoPath() != null && !cre.getPhotoPath().equals("")) {
cre.setPhoto(BaseImageUtils.bitmapToString(cre.getPhotoPath(), getApplication())); try {
cre.setPhoto(BaseImageUtils.bitmapToString(cre.getPhotoPath(), getApplication()));
} catch (Exception e) {
try {
cre.setPhoto(BaseImageUtils.bitmapToString(
Environment.getExternalStorageDirectory().getAbsolutePath() + "/collect/picture/" +
"/anchorCiq" + cre.getUnid() + ".jpg", getApplication()));
}catch(Exception exception){
}
}
} }
} }
RequestBody body = RequestBody.create(MediaType.parse("application/json"), new Gson().toJson(cattleResumeEntities)); RequestBody body = RequestBody.create(MediaType.parse("application/json"),
new Gson().toJson(cattleResumeEntities));
// KLog.e("label", postParams.toString()); // KLog.e("label", postParams.toString());
addSubscribe(model.uploadCattleList(body) addSubscribe(model.uploadCattleList(body)
...@@ -438,7 +451,8 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -438,7 +451,8 @@ public class SyncVM extends BaseViewModel<Repository> {
if (response.getCode() == 0) { if (response.getCode() == 0) {
//存下最后更新的时间 //存下最后更新的时间
SPUtils.getInstance().put(Configs.SP_PERFORMANCE_UPDATE_DATE, dateFormat.format(new Date())); SPUtils.getInstance().put(Configs.SP_PERFORMANCE_UPDATE_DATE,
dateFormat.format(new Date()));
performanceDate.set(SPUtils.getInstance().getString(Configs.SP_PERFORMANCE_UPDATE_DATE)); performanceDate.set(SPUtils.getInstance().getString(Configs.SP_PERFORMANCE_UPDATE_DATE));
if (response.getData() != null && response.getData().size() > 0) { if (response.getData() != null && response.getData().size() > 0) {
...@@ -556,7 +570,8 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -556,7 +570,8 @@ public class SyncVM extends BaseViewModel<Repository> {
*/ */
private void uploadSignMeasure(List<PerformanceEntity> performanceEntities) { private void uploadSignMeasure(List<PerformanceEntity> performanceEntities) {
RequestBody body = RequestBody.create(MediaType.parse("application/json"), new Gson().toJson(performanceEntities)); RequestBody body = RequestBody.create(MediaType.parse("application/json"),
new Gson().toJson(performanceEntities));
// KLog.e("label", postParams.toString()); // KLog.e("label", postParams.toString());
addSubscribe(model.uploadPerformanceList(body) addSubscribe(model.uploadPerformanceList(body)
...@@ -639,7 +654,8 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -639,7 +654,8 @@ public class SyncVM extends BaseViewModel<Repository> {
if (response.getCode() == 0) { if (response.getCode() == 0) {
//存下最后更新的时间 //存下最后更新的时间
SPUtils.getInstance().put(Configs.SP_BREEDING_RECORD_UPDATE_DATE, dateFormat.format(new Date())); SPUtils.getInstance().put(Configs.SP_BREEDING_RECORD_UPDATE_DATE,
dateFormat.format(new Date()));
cattlematingMasterDate.set(SPUtils.getInstance().getString(Configs.SP_BREEDING_RECORD_UPDATE_DATE)); cattlematingMasterDate.set(SPUtils.getInstance().getString(Configs.SP_BREEDING_RECORD_UPDATE_DATE));
if (response.getData() != null && response.getData().size() > 0) { if (response.getData() != null && response.getData().size() > 0) {
...@@ -755,7 +771,8 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -755,7 +771,8 @@ public class SyncVM extends BaseViewModel<Repository> {
*/ */
private void uploadBreedingRecord(List<BreedingRecordEntity> breedingRecordEntities) { private void uploadBreedingRecord(List<BreedingRecordEntity> breedingRecordEntities) {
RequestBody body = RequestBody.create(MediaType.parse("application/json"), new Gson().toJson(breedingRecordEntities)); RequestBody body = RequestBody.create(MediaType.parse("application/json"),
new Gson().toJson(breedingRecordEntities));
// KLog.e("label", postParams.toString()); // KLog.e("label", postParams.toString());
addSubscribe(model.uploadBreedingRecordList(body) addSubscribe(model.uploadBreedingRecordList(body)
...@@ -836,7 +853,8 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -836,7 +853,8 @@ public class SyncVM extends BaseViewModel<Repository> {
if (response.getCode() == 0) { if (response.getCode() == 0) {
//存下最后更新的时间 //存下最后更新的时间
SPUtils.getInstance().put(Configs.SP_BREEDING_RECORD_DETAIL_UPDATE_DATE, dateFormat.format(new Date())); SPUtils.getInstance().put(Configs.SP_BREEDING_RECORD_DETAIL_UPDATE_DATE,
dateFormat.format(new Date()));
cattlematingDetaillDate.set(SPUtils.getInstance().getString(Configs.SP_BREEDING_RECORD_DETAIL_UPDATE_DATE)); cattlematingDetaillDate.set(SPUtils.getInstance().getString(Configs.SP_BREEDING_RECORD_DETAIL_UPDATE_DATE));
if (response.getData() != null && response.getData().size() > 0) { if (response.getData() != null && response.getData().size() > 0) {
...@@ -952,7 +970,8 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -952,7 +970,8 @@ public class SyncVM extends BaseViewModel<Repository> {
*/ */
private void uploadBreedingRecordDetail(List<BreedingRecordDetailEntity> breedingRecordDetailEntities) { private void uploadBreedingRecordDetail(List<BreedingRecordDetailEntity> breedingRecordDetailEntities) {
RequestBody body = RequestBody.create(MediaType.parse("application/json"), new Gson().toJson(breedingRecordDetailEntities)); RequestBody body = RequestBody.create(MediaType.parse("application/json"),
new Gson().toJson(breedingRecordDetailEntities));
// KLog.e("label", postParams.toString()); // KLog.e("label", postParams.toString());
addSubscribe(model.uploadBreedingRecordDetailList(body) addSubscribe(model.uploadBreedingRecordDetailList(body)
...@@ -1034,7 +1053,8 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -1034,7 +1053,8 @@ public class SyncVM extends BaseViewModel<Repository> {
if (response.getCode() == 0) { if (response.getCode() == 0) {
//存下最后更新的时间 //存下最后更新的时间
SPUtils.getInstance().put(Configs.SP_WEIGHT_MAN_UPDATE_DATE, dateFormat.format(new Date())); SPUtils.getInstance().put(Configs.SP_WEIGHT_MAN_UPDATE_DATE,
dateFormat.format(new Date()));
weightManDate.set(SPUtils.getInstance().getString(Configs.SP_WEIGHT_MAN_UPDATE_DATE)); weightManDate.set(SPUtils.getInstance().getString(Configs.SP_WEIGHT_MAN_UPDATE_DATE));
if (response.getData() != null && response.getData().size() > 0) { if (response.getData() != null && response.getData().size() > 0) {
...@@ -1150,7 +1170,8 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -1150,7 +1170,8 @@ public class SyncVM extends BaseViewModel<Repository> {
*/ */
private void uploadWeightMan(List<WeightManEntity> weightManEntities) { private void uploadWeightMan(List<WeightManEntity> weightManEntities) {
RequestBody body = RequestBody.create(MediaType.parse("application/json"), new Gson().toJson(weightManEntities)); RequestBody body = RequestBody.create(MediaType.parse("application/json"),
new Gson().toJson(weightManEntities));
// KLog.e("label", postParams.toString()); // KLog.e("label", postParams.toString());
addSubscribe(model.uploadWeightManList(body) addSubscribe(model.uploadWeightManList(body)
...@@ -1232,7 +1253,8 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -1232,7 +1253,8 @@ public class SyncVM extends BaseViewModel<Repository> {
if (response.getCode() == 0) { if (response.getCode() == 0) {
//存下最后更新的时间 //存下最后更新的时间
SPUtils.getInstance().put(Configs.SP_MEDICAL_RECORD_UPDATE_DATE, dateFormat.format(new Date())); SPUtils.getInstance().put(Configs.SP_MEDICAL_RECORD_UPDATE_DATE,
dateFormat.format(new Date()));
medicalrecordsDate.set(SPUtils.getInstance().getString(Configs.SP_MEDICAL_RECORD_UPDATE_DATE)); medicalrecordsDate.set(SPUtils.getInstance().getString(Configs.SP_MEDICAL_RECORD_UPDATE_DATE));
if (response.getData() != null && response.getData().size() > 0) { if (response.getData() != null && response.getData().size() > 0) {
...@@ -1348,7 +1370,8 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -1348,7 +1370,8 @@ public class SyncVM extends BaseViewModel<Repository> {
*/ */
private void uploadMedicalRecord(List<MedicalRecordEntity> medicalRecordEntities) { private void uploadMedicalRecord(List<MedicalRecordEntity> medicalRecordEntities) {
RequestBody body = RequestBody.create(MediaType.parse("application/json"), new Gson().toJson(medicalRecordEntities)); RequestBody body = RequestBody.create(MediaType.parse("application/json"),
new Gson().toJson(medicalRecordEntities));
// KLog.e("label", postParams.toString()); // KLog.e("label", postParams.toString());
addSubscribe(model.uploadMedicalRecordList(body) addSubscribe(model.uploadMedicalRecordList(body)
...@@ -1431,7 +1454,8 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -1431,7 +1454,8 @@ public class SyncVM extends BaseViewModel<Repository> {
if (response.getCode() == 0) { if (response.getCode() == 0) {
//存下最后更新的时间 //存下最后更新的时间
SPUtils.getInstance().put(Configs.SP_IMMUNE_BATCH_UPDATE_DATE, dateFormat.format(new Date())); SPUtils.getInstance().put(Configs.SP_IMMUNE_BATCH_UPDATE_DATE,
dateFormat.format(new Date()));
immunebatchDate.set(SPUtils.getInstance().getString(Configs.SP_IMMUNE_BATCH_UPDATE_DATE)); immunebatchDate.set(SPUtils.getInstance().getString(Configs.SP_IMMUNE_BATCH_UPDATE_DATE));
if (response.getData() != null && response.getData().size() > 0) { if (response.getData() != null && response.getData().size() > 0) {
...@@ -1549,7 +1573,8 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -1549,7 +1573,8 @@ public class SyncVM extends BaseViewModel<Repository> {
*/ */
private void uploadImmuneBatch(List<ImmuneBatchEntity> immuneBatchEntities) { private void uploadImmuneBatch(List<ImmuneBatchEntity> immuneBatchEntities) {
RequestBody body = RequestBody.create(MediaType.parse("application/json"), new Gson().toJson(immuneBatchEntities)); RequestBody body = RequestBody.create(MediaType.parse("application/json"),
new Gson().toJson(immuneBatchEntities));
// KLog.e("label", postParams.toString()); // KLog.e("label", postParams.toString());
addSubscribe(model.uploadImmuneBatchList(body) addSubscribe(model.uploadImmuneBatchList(body)
...@@ -1632,7 +1657,8 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -1632,7 +1657,8 @@ public class SyncVM extends BaseViewModel<Repository> {
if (response.getCode() == 0) { if (response.getCode() == 0) {
//存下最后更新的时间 //存下最后更新的时间
SPUtils.getInstance().put(Configs.SP_IMMUNE_BATCH_DETAIL_UPDATE_DATE, dateFormat.format(new Date())); SPUtils.getInstance().put(Configs.SP_IMMUNE_BATCH_DETAIL_UPDATE_DATE,
dateFormat.format(new Date()));
immunebatchDetailDate.set(SPUtils.getInstance().getString(Configs.SP_IMMUNE_BATCH_DETAIL_UPDATE_DATE)); immunebatchDetailDate.set(SPUtils.getInstance().getString(Configs.SP_IMMUNE_BATCH_DETAIL_UPDATE_DATE));
if (response.getData() != null && response.getData().size() > 0) { if (response.getData() != null && response.getData().size() > 0) {
...@@ -1748,7 +1774,8 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -1748,7 +1774,8 @@ public class SyncVM extends BaseViewModel<Repository> {
*/ */
private void uploadImmuneBatchDetail(List<ImmuneBatchDetailEntity> immuneBatchEntities) { private void uploadImmuneBatchDetail(List<ImmuneBatchDetailEntity> immuneBatchEntities) {
RequestBody body = RequestBody.create(MediaType.parse("application/json"), new Gson().toJson(immuneBatchEntities)); RequestBody body = RequestBody.create(MediaType.parse("application/json"),
new Gson().toJson(immuneBatchEntities));
// KLog.e("label", postParams.toString()); // KLog.e("label", postParams.toString());
addSubscribe(model.uploadImmuneBatchDetailList(body) addSubscribe(model.uploadImmuneBatchDetailList(body)
...@@ -2165,7 +2192,8 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -2165,7 +2192,8 @@ public class SyncVM extends BaseViewModel<Repository> {
errorEntity.setCreateBy(SPUtils.getInstance().getString(Configs.SP_LOGIN_NAME)); errorEntity.setCreateBy(SPUtils.getInstance().getString(Configs.SP_LOGIN_NAME));
errorEntity.setCreateTime(dateFormat.format(new Date())); errorEntity.setCreateTime(dateFormat.format(new Date()));
RequestBody body = RequestBody.create(MediaType.parse("application/json"), new Gson().toJson(errorEntity)); RequestBody body = RequestBody.create(MediaType.parse("application/json"),
new Gson().toJson(errorEntity));
addSubscribe(model.uploadErrorData(body) addSubscribe(model.uploadErrorData(body)
.compose(RxUtils.bindToLifecycle(getLifecycleProvider())) .compose(RxUtils.bindToLifecycle(getLifecycleProvider()))
...@@ -2235,7 +2263,8 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -2235,7 +2263,8 @@ public class SyncVM extends BaseViewModel<Repository> {
errorEntity.setCreateBy(SPUtils.getInstance().getString(Configs.SP_LOGIN_NAME)); errorEntity.setCreateBy(SPUtils.getInstance().getString(Configs.SP_LOGIN_NAME));
errorEntity.setCreateTime(dateFormat.format(new Date())); errorEntity.setCreateTime(dateFormat.format(new Date()));
RequestBody body = RequestBody.create(MediaType.parse("application/json"), new Gson().toJson(errorEntity)); RequestBody body = RequestBody.create(MediaType.parse("application/json"),
new Gson().toJson(errorEntity));
addSubscribe(model.uploadErrorData(body) addSubscribe(model.uploadErrorData(body)
.compose(RxUtils.bindToLifecycle(getLifecycleProvider())) .compose(RxUtils.bindToLifecycle(getLifecycleProvider()))
...@@ -2306,7 +2335,8 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -2306,7 +2335,8 @@ public class SyncVM extends BaseViewModel<Repository> {
errorEntity.setCreateBy(SPUtils.getInstance().getString(Configs.SP_LOGIN_NAME)); errorEntity.setCreateBy(SPUtils.getInstance().getString(Configs.SP_LOGIN_NAME));
errorEntity.setCreateTime(dateFormat.format(new Date())); errorEntity.setCreateTime(dateFormat.format(new Date()));
RequestBody body = RequestBody.create(MediaType.parse("application/json"), new Gson().toJson(errorEntity)); RequestBody body = RequestBody.create(MediaType.parse("application/json"),
new Gson().toJson(errorEntity));
addSubscribe(model.uploadErrorData(body) addSubscribe(model.uploadErrorData(body)
.compose(RxUtils.bindToLifecycle(getLifecycleProvider())) .compose(RxUtils.bindToLifecycle(getLifecycleProvider()))
...@@ -2376,7 +2406,8 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -2376,7 +2406,8 @@ public class SyncVM extends BaseViewModel<Repository> {
errorEntity.setCreateBy(SPUtils.getInstance().getString(Configs.SP_LOGIN_NAME)); errorEntity.setCreateBy(SPUtils.getInstance().getString(Configs.SP_LOGIN_NAME));
errorEntity.setCreateTime(dateFormat.format(new Date())); errorEntity.setCreateTime(dateFormat.format(new Date()));
RequestBody body = RequestBody.create(MediaType.parse("application/json"), new Gson().toJson(errorEntity)); RequestBody body = RequestBody.create(MediaType.parse("application/json"),
new Gson().toJson(errorEntity));
addSubscribe(model.uploadErrorData(body) addSubscribe(model.uploadErrorData(body)
.compose(RxUtils.bindToLifecycle(getLifecycleProvider())) .compose(RxUtils.bindToLifecycle(getLifecycleProvider()))
...@@ -2448,7 +2479,8 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -2448,7 +2479,8 @@ public class SyncVM extends BaseViewModel<Repository> {
errorEntity.setCreateBy(SPUtils.getInstance().getString(Configs.SP_LOGIN_NAME)); errorEntity.setCreateBy(SPUtils.getInstance().getString(Configs.SP_LOGIN_NAME));
errorEntity.setCreateTime(dateFormat.format(new Date())); errorEntity.setCreateTime(dateFormat.format(new Date()));
RequestBody body = RequestBody.create(MediaType.parse("application/json"), new Gson().toJson(errorEntity)); RequestBody body = RequestBody.create(MediaType.parse("application/json"),
new Gson().toJson(errorEntity));
addSubscribe(model.uploadErrorData(body) addSubscribe(model.uploadErrorData(body)
.compose(RxUtils.bindToLifecycle(getLifecycleProvider())) .compose(RxUtils.bindToLifecycle(getLifecycleProvider()))
...@@ -2521,7 +2553,8 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -2521,7 +2553,8 @@ public class SyncVM extends BaseViewModel<Repository> {
errorEntity.setCreateBy(SPUtils.getInstance().getString(Configs.SP_LOGIN_NAME)); errorEntity.setCreateBy(SPUtils.getInstance().getString(Configs.SP_LOGIN_NAME));
errorEntity.setCreateTime(dateFormat.format(new Date())); errorEntity.setCreateTime(dateFormat.format(new Date()));
RequestBody body = RequestBody.create(MediaType.parse("application/json"), new Gson().toJson(errorEntity)); RequestBody body = RequestBody.create(MediaType.parse("application/json"),
new Gson().toJson(errorEntity));
addSubscribe(model.uploadErrorData(body) addSubscribe(model.uploadErrorData(body)
.compose(RxUtils.bindToLifecycle(getLifecycleProvider())) .compose(RxUtils.bindToLifecycle(getLifecycleProvider()))
...@@ -2593,7 +2626,8 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -2593,7 +2626,8 @@ public class SyncVM extends BaseViewModel<Repository> {
errorEntity.setCreateBy(SPUtils.getInstance().getString(Configs.SP_LOGIN_NAME)); errorEntity.setCreateBy(SPUtils.getInstance().getString(Configs.SP_LOGIN_NAME));
errorEntity.setCreateTime(dateFormat.format(new Date())); errorEntity.setCreateTime(dateFormat.format(new Date()));
RequestBody body = RequestBody.create(MediaType.parse("application/json"), new Gson().toJson(errorEntity)); RequestBody body = RequestBody.create(MediaType.parse("application/json"),
new Gson().toJson(errorEntity));
addSubscribe(model.uploadErrorData(body) addSubscribe(model.uploadErrorData(body)
.compose(RxUtils.bindToLifecycle(getLifecycleProvider())) .compose(RxUtils.bindToLifecycle(getLifecycleProvider()))
...@@ -2665,7 +2699,8 @@ public class SyncVM extends BaseViewModel<Repository> { ...@@ -2665,7 +2699,8 @@ public class SyncVM extends BaseViewModel<Repository> {
errorEntity.setCreateBy(SPUtils.getInstance().getString(Configs.SP_LOGIN_NAME)); errorEntity.setCreateBy(SPUtils.getInstance().getString(Configs.SP_LOGIN_NAME));
errorEntity.setCreateTime(dateFormat.format(new Date())); errorEntity.setCreateTime(dateFormat.format(new Date()));
RequestBody body = RequestBody.create(MediaType.parse("application/json"), new Gson().toJson(errorEntity)); RequestBody body = RequestBody.create(MediaType.parse("application/json"),
new Gson().toJson(errorEntity));
addSubscribe(model.uploadErrorData(body) addSubscribe(model.uploadErrorData(body)
.compose(RxUtils.bindToLifecycle(getLifecycleProvider())) .compose(RxUtils.bindToLifecycle(getLifecycleProvider()))
......
<layout xmlns:android="http://schemas.android.com/apk/res/android" <layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/tools"
xmlns:binding="http://schemas.android.com/apk/res-auto" xmlns:binding="http://schemas.android.com/apk/res-auto">
app:ignore="NamespaceTypo">
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -35,6 +34,7 @@ ...@@ -35,6 +34,7 @@
<TextView <TextView
android:id="@+id/tv_rfid_text" android:id="@+id/tv_rfid_text"
onClickCommand="@{viewModel.onWeightChangedClick}"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="@dimen/dp_45" android:layout_height="@dimen/dp_45"
android:layout_marginRight="@dimen/dp_10" android:layout_marginRight="@dimen/dp_10"
...@@ -45,9 +45,7 @@ ...@@ -45,9 +45,7 @@
android:textColor="@color/black" android:textColor="@color/black"
binding:layout_constraintLeft_toLeftOf="parent" binding:layout_constraintLeft_toLeftOf="parent"
binding:layout_constraintRight_toLeftOf="@+id/iv_sync" binding:layout_constraintRight_toLeftOf="@+id/iv_sync"
binding:layout_constraintTop_toTopOf="parent" binding:layout_constraintTop_toTopOf="parent" />
onClickCommand="@{viewModel.onWeightChangedClick}"
/>
<androidx.appcompat.widget.LinearLayoutCompat <androidx.appcompat.widget.LinearLayoutCompat
android:id="@+id/ll_tag" android:id="@+id/ll_tag"
...@@ -69,7 +67,7 @@ ...@@ -69,7 +67,7 @@
android:text="可视耳标" android:text="可视耳标"
android:textColor="@color/colorPrimary" android:textColor="@color/colorPrimary"
android:textSize="@dimen/sp_16" android:textSize="@dimen/sp_16"
binding:onClickCommand="@{viewModel.onTagInputClick}"/> binding:onClickCommand="@{viewModel.onTagInputClick}" />
<androidx.appcompat.widget.AppCompatTextView <androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -81,19 +79,19 @@ ...@@ -81,19 +79,19 @@
android:textSize="@dimen/sp_18" android:textSize="@dimen/sp_18"
binding:onClickCommand="@{viewModel.onTagInputClick}" /> binding:onClickCommand="@{viewModel.onTagInputClick}" />
<!-- <androidx.appcompat.widget.AppCompatTextView--> <!-- <androidx.appcompat.widget.AppCompatTextView-->
<!-- android:layout_width="match_parent"--> <!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"--> <!-- android:layout_height="wrap_content"-->
<!-- android:text="换绑标签"--> <!-- android:text="换绑标签"-->
<!-- android:layout_marginLeft="10dp"--> <!-- android:layout_marginLeft="10dp"-->
<!-- android:layout_marginRight="10dp"--> <!-- android:layout_marginRight="10dp"-->
<!-- android:layout_marginTop="10dp"--> <!-- android:layout_marginTop="10dp"-->
<!-- android:paddingBottom="5dp"--> <!-- android:paddingBottom="5dp"-->
<!-- android:paddingTop="5dp"--> <!-- android:paddingTop="5dp"-->
<!-- android:textColor="@color/white"--> <!-- android:textColor="@color/white"-->
<!-- android:background="@drawable/bg_button_orange_gradient"--> <!-- android:background="@drawable/bg_button_orange_gradient"-->
<!-- android:gravity="center"--> <!-- android:gravity="center"-->
<!-- binding:onClickCommand="@{viewModel.onLabelChangeClick}"/>--> <!-- binding:onClickCommand="@{viewModel.onLabelChangeClick}"/>-->
</androidx.appcompat.widget.LinearLayoutCompat> </androidx.appcompat.widget.LinearLayoutCompat>
<androidx.appcompat.widget.LinearLayoutCompat <androidx.appcompat.widget.LinearLayoutCompat
...@@ -150,8 +148,8 @@ ...@@ -150,8 +148,8 @@
android:id="@+id/card_99" android:id="@+id/card_99"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="37dp" android:layout_height="37dp"
android:layout_weight="1"
android:layout_marginLeft="5dp" android:layout_marginLeft="5dp"
android:layout_weight="1"
android:background="@drawable/bg_radius_white_5" android:background="@drawable/bg_radius_white_5"
android:onClick="@{() ->viewModel.click(99)}" android:onClick="@{() ->viewModel.click(99)}"
android:orientation="vertical" android:orientation="vertical"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment