fix: 批量提交数据增加进度及错误原因展示
This commit is contained in:
parent
96bb6a35e6
commit
2b6163fe45
@ -17,8 +17,8 @@ android {
|
||||
applicationId "com.navinfo.outdoor"
|
||||
minSdkVersion 24
|
||||
targetSdkVersion 30
|
||||
versionCode 46
|
||||
versionName "8.230214"
|
||||
versionCode 47
|
||||
versionName "8.230223"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
ndk {
|
||||
|
@ -8,6 +8,7 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@ -119,20 +120,15 @@ public class StaySubmitAdapter extends RecyclerView.Adapter<StaySubmitAdapter.Vi
|
||||
poiEntity.setChecked(!poiEntity.isChecked());
|
||||
}
|
||||
});
|
||||
if (allRoad.get(position).isChecked()) {
|
||||
if (poiEntity.getWork_type() == 0) {
|
||||
holder.tvText.setText("待提交");
|
||||
} else if (poiEntity.getWork_type() == 1) {
|
||||
holder.tvText.setText("提交中");
|
||||
allRoad.get(position).setChecked(true);
|
||||
}
|
||||
} else {
|
||||
if (poiEntity.getWork_type() == 1) {
|
||||
holder.tvText.setText("提交中");
|
||||
allRoad.get(position).setChecked(true);
|
||||
} else {
|
||||
holder.tvText.setText("待提交");
|
||||
}
|
||||
if (poiEntity.getWork_type() == 0) {
|
||||
holder.tvText.setText("待提交");
|
||||
} else if (poiEntity.getWork_type() == 1) {
|
||||
holder.tvText.setText("提交中");
|
||||
// poiEntity.setChecked(true);
|
||||
} else if (poiEntity.getWork_type() == 2) {
|
||||
holder.tvText.setText("完成");
|
||||
} else if (poiEntity.getWork_type() == -1) {
|
||||
holder.tvText.setText("出错");
|
||||
}
|
||||
holder.itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
@ -142,6 +138,23 @@ public class StaySubmitAdapter extends RecyclerView.Adapter<StaySubmitAdapter.Vi
|
||||
}
|
||||
}
|
||||
});
|
||||
// 显示进度
|
||||
if (poiEntity.getUploadMax()>0&&poiEntity.getUploadProgress()!=poiEntity.getUploadMax()) {
|
||||
holder.layerProgress.setVisibility(View.VISIBLE);
|
||||
holder.pbUpload.setMax(poiEntity.getUploadMax());
|
||||
holder.pbUpload.setProgress(poiEntity.getUploadProgress());
|
||||
holder.tvUploadProgress.setText(poiEntity.getUploadProgress()+"/"+poiEntity.getUploadMax());
|
||||
} else {
|
||||
holder.layerProgress.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
// 显示上传状态
|
||||
if (poiEntity.getUploadResult()!=null&&!poiEntity.getUploadResult().trim().equals("")) {
|
||||
holder.tvUploadResult.setVisibility(View.VISIBLE);
|
||||
holder.tvUploadResult.setText(poiEntity.getUploadResult());
|
||||
holder.layerProgress.setVisibility(View.GONE); // 上传结果存在,不需要显示进度条
|
||||
} else {
|
||||
holder.tvUploadResult.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -152,6 +165,9 @@ public class StaySubmitAdapter extends RecyclerView.Adapter<StaySubmitAdapter.Vi
|
||||
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
private TextView tvName, tvText, tvDay;
|
||||
private CheckBox cbUnSubmit;
|
||||
private ProgressBar pbUpload;
|
||||
private TextView tvUploadProgress, tvUploadResult;
|
||||
private View layerProgress;
|
||||
|
||||
public ViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
@ -159,6 +175,10 @@ public class StaySubmitAdapter extends RecyclerView.Adapter<StaySubmitAdapter.Vi
|
||||
tvText = itemView.findViewById(R.id.tv_text);
|
||||
tvDay = itemView.findViewById(R.id.tv_road_day);
|
||||
cbUnSubmit = itemView.findViewById(R.id.cb_unSubmit);
|
||||
pbUpload = itemView.findViewById(R.id.pb_stay_upload);
|
||||
tvUploadProgress = itemView.findViewById(R.id.tv_pb_stay_upload);
|
||||
layerProgress = itemView.findViewById(R.id.layer_pb);
|
||||
tvUploadResult = itemView.findViewById(R.id.tv_upload_result);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -149,6 +149,7 @@ public class Constant {
|
||||
public static final int EVENT_MESSAGE = 55;//提示消息
|
||||
public static final int CAPACITY_EVALUATION=59;//能力测试的返回
|
||||
public static final int CHARGING_STATION_DISABLE=60;//能力测试的返回
|
||||
public static final int EVENT_WHAT_UPLOAD_PROGRESS=61;// 数据上传的进度progress
|
||||
public static final String INTENT_POI_VIDEO_TYPE = "poi_video_type";
|
||||
public static int NUMBER = 200; //任务个数
|
||||
public static int LIMIT_TYPE = -1; //权限类型,普通任务-0,专属任务-1
|
||||
|
@ -49,6 +49,7 @@ import com.umeng.umcrash.UMCrash;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.DateFormat;
|
||||
@ -57,6 +58,7 @@ import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
/**
|
||||
* 记录-待提交的fragment
|
||||
@ -105,7 +107,7 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
|
||||
btnStaySubmit.setOnClickListener(this);
|
||||
RecyclerView stayXrv = findViewById(R.id.stay_xrv);
|
||||
stayXrv.setLayoutManager(new LinearLayoutManager(getActivity()));
|
||||
stayXrv.addItemDecoration(new DividerItemDecoration(Objects.requireNonNull(getContext()), DividerItemDecoration.VERTICAL));
|
||||
stayXrv.addItemDecoration(new DividerItemDecoration(requireContext(), DividerItemDecoration.VERTICAL));
|
||||
staySubmitAdapter = new StaySubmitAdapter(getContext());
|
||||
stayXrv.setAdapter(staySubmitAdapter);
|
||||
//点击条目跳转
|
||||
@ -153,7 +155,7 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
|
||||
@Override
|
||||
protected void initData() {
|
||||
super.initData();
|
||||
SharedPreferences sharedPreferences = Objects.requireNonNull(getActivity()).getSharedPreferences(Constant.MESSAGE_TYPE, Context.MODE_PRIVATE);
|
||||
SharedPreferences sharedPreferences = requireActivity().getSharedPreferences(Constant.MESSAGE_TYPE, Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor sharedEdit = sharedPreferences.edit();
|
||||
@SuppressLint("SimpleDateFormat")
|
||||
DateFormat formatter = new SimpleDateFormat("yyyyMMdd");
|
||||
@ -177,7 +179,7 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@Subscribe(threadMode = ThreadMode.MAIN_ORDERED)
|
||||
public void onEvent(Message data) {
|
||||
if (data.what == Constant.STAY_SUBMIT_ITEM) {
|
||||
if ((boolean) data.obj) {
|
||||
@ -190,6 +192,14 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (data.what == Constant.EVENT_WHAT_UPLOAD_PROGRESS) {
|
||||
if (data.obj!=null&&staySubmitAdapter!=null&&staySubmitAdapter.getAllRoad()!=null) {
|
||||
for (int i = 0; i < staySubmitAdapter.getAllRoad().size(); i++) {
|
||||
if (data.obj == staySubmitAdapter.getAllRoad().get(i)) {
|
||||
staySubmitAdapter.notifyItemChanged(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -266,7 +276,7 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
|
||||
case R.id.cl_stay_type://1 "POI"2 "充电站"3 "POI录像"4 "道路录像"5 "其他"6 "面状任务"
|
||||
staySubmitBuilder.append(TimestampUtil.time()).append(",").append("点击了待提交的类型 ,");
|
||||
DialogSettings.style = DialogSettings.STYLE.STYLE_IOS;
|
||||
BottomMenu.show((AppCompatActivity) Objects.requireNonNull(getContext()), new String[]{"全部", "poi", "充电站", "poi录像", "道路录像", "其他"}, new OnMenuItemClickListener() {
|
||||
BottomMenu.show((AppCompatActivity) requireActivity(), new String[]{"全部", "poi", "充电站", "poi录像", "道路录像", "其他"}, new OnMenuItemClickListener() {
|
||||
@SuppressLint("SetTextI18n")
|
||||
@Override
|
||||
public void onClick(String text, int index) {
|
||||
@ -298,7 +308,7 @@ public class StaySubmitFragment extends BaseFragment implements View.OnClickList
|
||||
staySubmitBuilder.append(TimestampUtil.time()).append(",").append("点击了删除按钮 ,");
|
||||
if (Constant.isPresent) {
|
||||
DialogSettings.style = DialogSettings.STYLE.STYLE_IOS;
|
||||
MessageDialog.show((AppCompatActivity) Objects.requireNonNull(getContext()), "提示", "是否删除", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
|
||||
MessageDialog.show((AppCompatActivity) requireActivity(), "提示", "是否删除", "确定", "取消").setOkButton(new OnDialogButtonClickListener() {
|
||||
@SuppressLint("SetTextI18n")
|
||||
@Override
|
||||
public boolean onClick(BaseDialog baseDialog, View v) {
|
||||
|
@ -3,6 +3,7 @@ package com.navinfo.outdoor.http;
|
||||
import android.app.Activity;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.elvishew.xlog.XLog;
|
||||
import com.github.lazylibrary.util.DES;
|
||||
import com.github.lazylibrary.util.MD5;
|
||||
import com.google.gson.Gson;
|
||||
@ -292,6 +293,13 @@ public class OkGoBuilder<T> {
|
||||
// 请求的 tag, 主要用于取消对应的请求
|
||||
.params(params)
|
||||
.addFileParams("file", files)
|
||||
.uploadInterceptor(new ProgressRequestBody.UploadInterceptor() {
|
||||
@Override
|
||||
public void uploadProgress(Progress progress) {
|
||||
XLog.d(progress.speed);
|
||||
XLog.d(progress.currentSize);
|
||||
}
|
||||
})
|
||||
.tag(this)
|
||||
.execute();
|
||||
} catch (IOException e) {
|
||||
|
@ -28,7 +28,7 @@ import java.io.File;
|
||||
* 如果需要在主线程调用则使用allowMainThreadQueries进行说明。
|
||||
*/
|
||||
|
||||
@Database(entities = {PoiEntity.class,ChargingPileEntity.class, LocationRecorder.class}, version = 3, exportSchema = false)
|
||||
@Database(entities = {PoiEntity.class,ChargingPileEntity.class, LocationRecorder.class}, version = 5, exportSchema = false)
|
||||
public abstract class PoiDatabase extends RoomDatabase {
|
||||
private static final String DB_NAME = "navinfo.db";
|
||||
private static volatile PoiDatabase instance;
|
||||
@ -52,6 +52,8 @@ public abstract class PoiDatabase extends RoomDatabase {
|
||||
return Room.databaseBuilder(context, PoiDatabase.class, Constant.POI_DAO+"/"+DB_NAME)
|
||||
.addMigrations(migration_1_2)
|
||||
.addMigrations(migration_2_3)
|
||||
.addMigrations(migration_3_4)
|
||||
.addMigrations(migration_4_5)
|
||||
//.fallbackToDestructiveMigration()//数据库更新时删除数据重新创建 改动特别大的时候在用
|
||||
.build();
|
||||
}
|
||||
@ -80,6 +82,25 @@ public abstract class PoiDatabase extends RoomDatabase {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// 增加POI字段
|
||||
private static Migration migration_3_4 = new Migration(3, 4) {
|
||||
@Override
|
||||
public void migrate(@NonNull SupportSQLiteDatabase database) {
|
||||
database.execSQL("ALTER TABLE poi "+" ADD COLUMN uploadProgress INTEGER NOT NULL DEFAULT 0");//添加了一个上传进度
|
||||
database.execSQL("ALTER TABLE poi "+" ADD COLUMN credible INTEGER NOT NULL DEFAULT 0");//添加了一个置信度
|
||||
database.execSQL("ALTER TABLE poi "+" ADD COLUMN drawLine TEXT");//添加了一个用户绘制线型
|
||||
}
|
||||
};
|
||||
|
||||
// 增加POI字段
|
||||
private static Migration migration_4_5 = new Migration(4, 5) {
|
||||
@Override
|
||||
public void migrate(@NonNull SupportSQLiteDatabase database) {
|
||||
database.execSQL("ALTER TABLE poi "+" ADD COLUMN uploadMax INTEGER NOT NULL DEFAULT 0");//添加了一个上传总数
|
||||
database.execSQL("ALTER TABLE poi "+" ADD COLUMN uploadResult TEXT");//添加了一个上传结果
|
||||
}
|
||||
};
|
||||
public abstract PoiDao getPoiDao();//其他信息
|
||||
public abstract ChargingPileDao getChargingPileDao();//充电桩
|
||||
public abstract LocationRecorderDao getRecorderDao();
|
||||
|
@ -48,8 +48,13 @@ public class PoiEntity implements Serializable {
|
||||
private int isLocalData;//是否是本地数据 0,服务 1,本地
|
||||
private int isExclusive;//任务类型 0.普通任务,1.专属任务 2挑战任务, 3奖励任务
|
||||
private int bodyId;//保存本地的bodyId
|
||||
private int work_type;//0,待提交 1,提交中
|
||||
private int work_type;//0,待提交 1,提交中 2,已上传
|
||||
private int record_way; //等同于 canReceived : 1是可领取 0是不可领取
|
||||
private int uploadProgress; // 上传进度
|
||||
private int uploadMax; // 上传数据总量-这里一般使用需要上传的文件数量作为总数,因此上传进度为已上传的文件数
|
||||
private int credible; // 置信度
|
||||
private String drawLine; // 用户绘制的线型
|
||||
private String uploadResult; //上传结果
|
||||
|
||||
public int getRecord_way() {
|
||||
return record_way;
|
||||
@ -280,6 +285,46 @@ public class PoiEntity implements Serializable {
|
||||
this.detail = detail;
|
||||
}
|
||||
|
||||
public int getUploadProgress() {
|
||||
return uploadProgress;
|
||||
}
|
||||
|
||||
public void setUploadProgress(int uploadProgress) {
|
||||
this.uploadProgress = uploadProgress;
|
||||
}
|
||||
|
||||
public int getUploadMax() {
|
||||
return uploadMax;
|
||||
}
|
||||
|
||||
public void setUploadMax(int uploadMax) {
|
||||
this.uploadMax = uploadMax;
|
||||
}
|
||||
|
||||
public int getCredible() {
|
||||
return credible;
|
||||
}
|
||||
|
||||
public void setCredible(int credible) {
|
||||
this.credible = credible;
|
||||
}
|
||||
|
||||
public String getDrawLine() {
|
||||
return drawLine;
|
||||
}
|
||||
|
||||
public void setDrawLine(String drawLine) {
|
||||
this.drawLine = drawLine;
|
||||
}
|
||||
|
||||
public String getUploadResult() {
|
||||
return uploadResult;
|
||||
}
|
||||
|
||||
public void setUploadResult(String uploadResult) {
|
||||
this.uploadResult = uploadResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PoiEntity{" +
|
||||
|
@ -73,7 +73,8 @@ public class DataSaveUtils {
|
||||
public void onError();
|
||||
}
|
||||
|
||||
public Single<List<Map.Entry<Integer, File>>> getUploadSpliteFilesObservble(Activity mContext, PoiEntity poiEntity, List<File> poiPicList) {
|
||||
public Single<PoiEntity> getUploadSpliteFilesObservble(Activity mContext, PoiEntity poiEntity, List<File> poiPicList) {
|
||||
poiEntity.setUploadResult("");
|
||||
int auditId = poiEntity.getBodyId();
|
||||
File zipFile = new File(poiPicList.get(0).getParentFile(), auditId+".zip");
|
||||
return Observable.create(new ObservableOnSubscribe<File>() {
|
||||
@ -96,6 +97,8 @@ public class DataSaveUtils {
|
||||
public Map<Integer, File> apply(File file) throws Exception {
|
||||
// 每次执行上传都会切分数据,因为都会执行第一步,向服务器请求需要上传的分包数据
|
||||
List<File> splitFiles = FileSpliteMergeUtils.splitFile(file, Constant.DEFAULT_CUT_SIZE);
|
||||
poiEntity.setUploadMax(splitFiles.size());
|
||||
sendRefreshItem(poiEntity);
|
||||
List<Long> chunkSizeList = new ArrayList<>();
|
||||
for (File f: splitFiles) {
|
||||
chunkSizeList.add(f.length());
|
||||
@ -108,11 +111,15 @@ public class DataSaveUtils {
|
||||
poiEntity.setTaskStatus(100);
|
||||
PoiDatabase.getInstance(mContext).getPoiDao().updatePoiEntity(poiEntity);
|
||||
ToastUtils.Message(mContext, "数据:"+poiEntity.getName()+"已成功上传!");
|
||||
poiEntity.setUploadProgress(splitFiles.size()); // 上传进度为当前文件个数
|
||||
sendRefreshItem(poiEntity);
|
||||
}
|
||||
if (body==null) {
|
||||
throw new Exception(response.getMessage());
|
||||
}
|
||||
if (body.isEmpty()) {
|
||||
if (body.isEmpty()) { // 服务返回空数据,说明该数据的所有分包数据都上传完成,没有需要上传的分包了
|
||||
poiEntity.setUploadProgress(splitFiles.size()); // 上传进度为当前文件个数
|
||||
sendRefreshItem(poiEntity);
|
||||
return new HashMap<>();
|
||||
}
|
||||
String[] needUploadStrIndex = body.split(",");
|
||||
@ -121,6 +128,8 @@ public class DataSaveUtils {
|
||||
for (int i = 0; i < needUploadStrIndex.length; i++) {
|
||||
needUploadIndex[i] = Integer.parseInt(needUploadStrIndex[i]);
|
||||
}
|
||||
poiEntity.setUploadProgress(splitFiles.size()-needUploadIndex.length); // 上传进度为当前文件个数
|
||||
sendRefreshItem(poiEntity);
|
||||
// 根据返回的index,将需要上传的切分包数据流转到下一个流程
|
||||
Map<Integer, File> needUploadFileMap = new HashMap<>();
|
||||
for (int index: needUploadIndex) {
|
||||
@ -153,8 +162,12 @@ public class DataSaveUtils {
|
||||
// 执行上传流程
|
||||
CommonResponse response = uploadSplitTask(mContext, auditId, fileEntry.getKey(), fileEntry.getValue());
|
||||
if (response.getCode() != 200) {
|
||||
poiEntity.setUploadResult("第"+fileEntry.getKey()+"个分包数据上传失败");
|
||||
sendRefreshItem(poiEntity);
|
||||
throw new Exception(response.getMessage());
|
||||
} else {
|
||||
poiEntity.setUploadProgress(poiEntity.getUploadProgress()+1); // 上传进度为当前文件个数
|
||||
sendRefreshItem(poiEntity);
|
||||
UMLog.mutlInfo(3, "已上传分包"+fileEntry.getKey());
|
||||
// 上传成功,则删除该分包数据
|
||||
if (fileEntry.getValue().exists()) {
|
||||
@ -171,9 +184,11 @@ public class DataSaveUtils {
|
||||
@Override
|
||||
public void accept(List<Map.Entry<Integer, File>> entries) throws Exception {
|
||||
// 最终成功,调用finish接口
|
||||
poiEntity.setUploadResult("附件上传完成");
|
||||
CommonResponse response = uploadTaskFinish(mContext, auditId);
|
||||
if (response.getCode() == 200) { // 更新成功,再次更新本地数据库
|
||||
poiEntity.setTaskStatus(100);
|
||||
poiEntity.setUploadProgress(poiEntity.getUploadMax());
|
||||
PoiDatabase.getInstance(mContext).getPoiDao().updatePoiEntity(poiEntity);
|
||||
// 同时删除关联的照片文件和压缩包文件
|
||||
if (zipFile.exists()) {
|
||||
@ -189,21 +204,27 @@ public class DataSaveUtils {
|
||||
throw new Exception("数据:" + poiEntity.getName() + " 上传失败");
|
||||
}
|
||||
}
|
||||
})
|
||||
.map(new Function<List<Map.Entry<Integer, File>>, PoiEntity>() {
|
||||
@Override
|
||||
public PoiEntity apply(List<Map.Entry<Integer, File>> entries) throws Exception {
|
||||
return poiEntity;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 批量上传文件
|
||||
public void uploadFiles(Activity mContext, PoiEntity poiEntity, List<File> poiPicList, UploadCallback callback) {
|
||||
getUploadSpliteFilesObservble(mContext, poiEntity, poiPicList)
|
||||
getUploadSpliteFilesObservble(mContext ,poiEntity, poiPicList)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SingleObserver<List<Map.Entry<Integer, File>>>() {
|
||||
.subscribe(new SingleObserver<PoiEntity>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
callback.onStart();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<Map.Entry<Integer, File>> entries) {
|
||||
public void onSuccess(PoiEntity poiEntity) {
|
||||
ToastUtils.Message(mContext, "分包数据上传完成!");
|
||||
Message obtain1 = Message.obtain();
|
||||
obtain1.what = Constant.NEST_WORD_SUBMIT;
|
||||
@ -248,6 +269,16 @@ public class DataSaveUtils {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* EventBus通知列表当前的上传进度
|
||||
* */
|
||||
private void sendRefreshItem(PoiEntity poiEntity) {
|
||||
Message msg = Message.obtain();
|
||||
msg.what = Constant.EVENT_WHAT_UPLOAD_PROGRESS;
|
||||
msg.obj = poiEntity;
|
||||
EventBus.getDefault().post(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传分包数据
|
||||
* */
|
||||
|
@ -28,9 +28,11 @@ import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.AbstractMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
@ -75,54 +77,43 @@ public class PoiSaveUtils {
|
||||
public void uploadPoiEntityBatch(List<PoiEntity> poiEntityList) {
|
||||
if (poiEntityList != null&&!poiEntityList.isEmpty()) {
|
||||
// 因为道路任务和POI录像任务需要分包提交,因此和其他要素分开,分别放在两个管道里
|
||||
List<PoiEntity> chargePoiEntityList = new ArrayList<>();/*充电站POI列表*/
|
||||
List<PoiEntity> spliteFilePoiEntityList = new ArrayList<>();/*充电站POI列表*/
|
||||
List<PoiEntity> otherPoiEntityList = new ArrayList<>();/*充电站POI列表*/
|
||||
for (PoiEntity poiEntity: poiEntityList) {
|
||||
List<Map.Entry<Integer, PoiEntity>> chargePoiEntityList = new ArrayList<>();/*充电站POI列表*/
|
||||
List<Map.Entry<Integer, PoiEntity>> spliteFilePoiEntityList = new ArrayList<>();/*充电站POI列表*/
|
||||
List<Map.Entry<Integer, PoiEntity>> otherPoiEntityList = new ArrayList<>();/*充电站POI列表*/
|
||||
for (int i = 0; i < poiEntityList.size(); i++) {
|
||||
PoiEntity poiEntity = poiEntityList.get(i);
|
||||
if (Constant.submitIdSet.contains(poiEntity.getId())) {
|
||||
continue;
|
||||
}
|
||||
Constant.submitIdSet.add(poiEntity.getId()); // 记录全局的正在提交的数据
|
||||
if (poiEntity.getType()==2) {
|
||||
chargePoiEntityList.add(poiEntity);
|
||||
chargePoiEntityList.add(new AbstractMap.SimpleEntry<>(i, poiEntity));
|
||||
} else if (poiEntity.getType() == 3 || poiEntity.getType() == 4) {
|
||||
spliteFilePoiEntityList.add(poiEntity);
|
||||
spliteFilePoiEntityList.add(new AbstractMap.SimpleEntry<>(i, poiEntity));
|
||||
} else {
|
||||
otherPoiEntityList.add(poiEntity);
|
||||
otherPoiEntityList.add(new AbstractMap.SimpleEntry<>(i, poiEntity));
|
||||
}
|
||||
}
|
||||
|
||||
Observable chargePoiObserable = Observable.fromIterable(chargePoiEntityList)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.doOnNext(new Consumer<PoiEntity>() {
|
||||
.doOnNext(new Consumer<Map.Entry<Integer, PoiEntity>>() {
|
||||
@Override
|
||||
public void accept(PoiEntity poiEntity) throws Exception {
|
||||
Constant.submitIdSet.add(poiEntity.getId()); // 记录全局的正在提交的数据
|
||||
public void accept(Map.Entry<Integer, PoiEntity> integerPoiEntityEntry) throws Exception {
|
||||
PoiEntity poiEntity = integerPoiEntityEntry.getValue();
|
||||
if (savePoiNet(poiEntity) == 200&&saveChargingPileByChargingStation(poiEntity)) { // 网络保存成功
|
||||
if (Constant.submitIdSet.contains(poiEntity.getId())) {
|
||||
Constant.submitIdSet.remove(poiEntity.getId());
|
||||
}
|
||||
if (savePoiNet(poiEntity) == 200) { // 网络保存-冗余操作
|
||||
// 开始上传流程
|
||||
if (saveChargingPileUploadChargingStation(poiEntity)) {
|
||||
uploadPoiNet(poiEntity);
|
||||
uploadPoiNet(integerPoiEntityEntry);
|
||||
}else {
|
||||
bInt++;
|
||||
poiEntity.setChecked(false);
|
||||
poiEntity.setWork_type(0);
|
||||
PoiDatabase.getInstance(mContext).getPoiDao().updatePoiEntity(poiEntity);
|
||||
poiEntityUploadFailed(poiEntity, "充电桩数据上传失败!");
|
||||
}
|
||||
}else {
|
||||
bInt++;
|
||||
poiEntity.setChecked(false);
|
||||
poiEntity.setWork_type(0);
|
||||
PoiDatabase.getInstance(mContext).getPoiDao().updatePoiEntity(poiEntity);
|
||||
poiEntityUploadFailed(poiEntity, "网络保存失败");
|
||||
}
|
||||
} else {
|
||||
bInt++;
|
||||
poiEntity.setChecked(false);
|
||||
poiEntity.setWork_type(0);
|
||||
PoiDatabase.getInstance(mContext).getPoiDao().updatePoiEntity(poiEntity);
|
||||
Constant.submitIdSet.remove(poiEntity.getId());
|
||||
poiEntityUploadFailed(poiEntity, "网络保存失败");
|
||||
}
|
||||
}
|
||||
})
|
||||
@ -130,17 +121,15 @@ public class PoiSaveUtils {
|
||||
// 处理普通数据
|
||||
Observable otherObserable = Observable.fromIterable(otherPoiEntityList)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.doOnNext(new Consumer<PoiEntity>() {
|
||||
.doOnNext(new Consumer<Map.Entry<Integer, PoiEntity>>() {
|
||||
@Override
|
||||
public void accept(PoiEntity poiEntity) throws Exception {
|
||||
public void accept(Map.Entry<Integer, PoiEntity> integerPoiEntityEntry) throws Exception {
|
||||
PoiEntity poiEntity = integerPoiEntityEntry.getValue();
|
||||
if (savePoiNet(poiEntity) == 200) { // 网络保存成功
|
||||
//走上传流程:
|
||||
uploadPoiNet(poiEntity);
|
||||
uploadPoiNet(integerPoiEntityEntry);
|
||||
}else {
|
||||
bInt++;
|
||||
poiEntity.setChecked(false);
|
||||
poiEntity.setWork_type(0);
|
||||
PoiDatabase.getInstance(mContext).getPoiDao().updatePoiEntity(poiEntity);
|
||||
poiEntityUploadFailed(poiEntity, "网络保存失败");
|
||||
}
|
||||
}
|
||||
})
|
||||
@ -148,44 +137,43 @@ public class PoiSaveUtils {
|
||||
// 处理需要分包上传数据的POI录像和道路数据
|
||||
Observable spliteFileObserable = Observable.fromIterable(spliteFilePoiEntityList)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.doOnNext(new Consumer<PoiEntity>() {
|
||||
.doOnNext(new Consumer<Map.Entry<Integer, PoiEntity>>() {
|
||||
@Override
|
||||
public void accept(PoiEntity poiEntity) throws Exception {
|
||||
public void accept(Map.Entry<Integer, PoiEntity> integerPoiEntityEntry) throws Exception {
|
||||
PoiEntity poiEntity = integerPoiEntityEntry.getValue();
|
||||
if (savePoiNet(poiEntity) == 200) { // 网络保存成功
|
||||
//走上传流程:
|
||||
if (poiEntity == null) {
|
||||
bInt++;
|
||||
poiEntityUploadFailed(poiEntity, "当前数据为null!");
|
||||
return;
|
||||
}
|
||||
int bodyId = poiEntity.getBodyId();
|
||||
if (bodyId == 0) {
|
||||
bInt++;
|
||||
poiEntityUploadFailed(poiEntity, "bodyId为0");
|
||||
return;
|
||||
}
|
||||
}else {
|
||||
bInt++;
|
||||
poiEntity.setChecked(false);
|
||||
poiEntity.setWork_type(0);
|
||||
PoiDatabase.getInstance(mContext).getPoiDao().updatePoiEntity(poiEntity);
|
||||
poiEntityUploadFailed(poiEntity, "网络保存失败");
|
||||
}
|
||||
}
|
||||
})
|
||||
.concatMap(new Function<PoiEntity, ObservableSource<?>>() {
|
||||
.concatMap(new Function<Map.Entry<Integer, PoiEntity>, ObservableSource<PoiEntity>>() {
|
||||
@Override
|
||||
public ObservableSource<?> apply(PoiEntity poiEntity) throws Exception {
|
||||
public ObservableSource<PoiEntity> apply(Map.Entry<Integer, PoiEntity> integerPoiEntityEntry) throws Exception {
|
||||
PoiEntity poiEntity = integerPoiEntityEntry.getValue();
|
||||
List<File> photoFileList = AWMp4ParserHelper.getInstance().getFileListByUUID(poiEntity.getId());
|
||||
if (photoFileList == null||photoFileList.isEmpty()) {
|
||||
bInt++;
|
||||
poiEntityUploadFailed(poiEntity, "照片数据获取为空!");
|
||||
return Observable.empty();
|
||||
}
|
||||
return DataSaveUtils.getInstance().getUploadSpliteFilesObservble(mContext, poiEntity, photoFileList)
|
||||
.toObservable();
|
||||
}
|
||||
})
|
||||
.doOnNext(new Consumer<Object>() {
|
||||
.doOnNext(new Consumer<PoiEntity>() {
|
||||
@Override
|
||||
public void accept(Object o) throws Exception {
|
||||
anInt++;
|
||||
public void accept(PoiEntity poiEntity) throws Exception {
|
||||
poiEntityUploadSuccess(poiEntity, "上传成功");
|
||||
}
|
||||
})
|
||||
.doOnError(new Consumer<Throwable>() {
|
||||
@ -234,80 +222,31 @@ public class PoiSaveUtils {
|
||||
Constant.isPresent = true;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
// new Thread(new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// anInt = 0;
|
||||
// bInt = 0;
|
||||
// Log.d("PoiSaveUtils", "开始上传");
|
||||
// for (int i = 0; i < poiEntityList.size(); i++) {
|
||||
// PoiEntity poiEntity = poiEntityList.get(i);
|
||||
// Log.d("PoiSaveUtils", "poiEntity.getType():"+poiEntity.getType());
|
||||
// if (Constant.submitIdSet.contains(poiEntity.getId())) {
|
||||
// continue;
|
||||
// }
|
||||
// if (poiEntity.getType() == 2) { // 如果是充电站数据,首先检查子充电桩的状态
|
||||
// Constant.submitIdSet.add(poiEntity.getId()); // 记录全局的正在提交的数据
|
||||
// if (savePoiNet(poiEntity) == 200&&saveChargingPileByChargingStation(poiEntity)) { // 网络保存成功
|
||||
// Constant.submitIdSet.remove(poiEntity.getId());
|
||||
// if (savePoiNet(poiEntity) == 200) { // 网络保存-冗余操作
|
||||
// // 开始上传流程
|
||||
// if (saveChargingPileUploadChargingStation(poiEntity)) {
|
||||
// uploadPoiNet(poiEntity);
|
||||
// }else {
|
||||
// bInt++;
|
||||
// poiEntity.setChecked(false);
|
||||
// poiEntity.setWork_type(0);
|
||||
// PoiDatabase.getInstance(mContext).getPoiDao().updatePoiEntity(poiEntity);
|
||||
// sendUploadMessage(poiEntityList.size(), anInt, bInt);
|
||||
// }
|
||||
// }else {
|
||||
// bInt++;
|
||||
// poiEntity.setChecked(false);
|
||||
// poiEntity.setWork_type(0);
|
||||
// PoiDatabase.getInstance(mContext).getPoiDao().updatePoiEntity(poiEntity);
|
||||
// sendUploadMessage(poiEntityList.size(), anInt, bInt);
|
||||
// }
|
||||
// } else {
|
||||
// bInt++;
|
||||
// poiEntity.setChecked(false);
|
||||
// poiEntity.setWork_type(0);
|
||||
// PoiDatabase.getInstance(mContext).getPoiDao().updatePoiEntity(poiEntity);
|
||||
// Constant.submitIdSet.remove(poiEntity.getId());
|
||||
// sendUploadMessage(poiEntityList.size(), anInt, bInt);
|
||||
// }
|
||||
// } else {//其他类型
|
||||
// if (savePoiNet(poiEntity) == 200) { // 网络保存成功
|
||||
// //走上传流程:
|
||||
// uploadPoiNet(poiEntity);
|
||||
// }else {
|
||||
// bInt++;
|
||||
// poiEntity.setChecked(false);
|
||||
// poiEntity.setWork_type(0);
|
||||
// PoiDatabase.getInstance(mContext).getPoiDao().updatePoiEntity(poiEntity);
|
||||
// sendUploadMessage(poiEntityList.size(), anInt, bInt);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }).start();
|
||||
}
|
||||
}
|
||||
|
||||
private void sendUploadMessage(int count, int success, int fail) {
|
||||
if (success+fail == count) { // 成功和失败的个数与数据总数相同
|
||||
Message obtain = Message.obtain();
|
||||
obtain.what = Constant.STAY_SUBMIT_ITEM;
|
||||
obtain.obj = true;
|
||||
EventBus.getDefault().post(obtain);
|
||||
}
|
||||
Message obtain1 = Message.obtain();
|
||||
obtain1.what = Constant.NEST_WORD_SUBMIT;
|
||||
obtain1.obj = "批量提交数据,共选中"+count+"条数据,成功:" + anInt + "条, 失败:" + bInt+"条";
|
||||
EventBus.getDefault().post(obtain1);
|
||||
/**
|
||||
* 处理poi数据上传失败
|
||||
* */
|
||||
private void poiEntityUploadFailed(PoiEntity poiEntity, String errorInfo) {
|
||||
poiEntity.setUploadResult(errorInfo);
|
||||
bInt++;
|
||||
poiEntity.setWork_type(-1);
|
||||
poiEntity.setUploadProgress(0);
|
||||
PoiDatabase.getInstance(mContext).getPoiDao().updatePoiEntity(poiEntity);
|
||||
Constant.submitIdSet.remove(poiEntity.getId());
|
||||
sendRefreshItem(poiEntity);
|
||||
}
|
||||
/**
|
||||
* 处理poi数据上传成功
|
||||
* */
|
||||
private void poiEntityUploadSuccess(PoiEntity poiEntity, String info) {
|
||||
poiEntity.setUploadResult(info);
|
||||
anInt++;
|
||||
poiEntity.setWork_type(2);
|
||||
PoiDatabase.getInstance(mContext).getPoiDao().updatePoiEntity(poiEntity);
|
||||
Constant.submitIdSet.remove(poiEntity.getId());
|
||||
sendRefreshItem(poiEntity);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -404,14 +343,15 @@ public class PoiSaveUtils {
|
||||
/**
|
||||
* 最终上传POI数据到服务
|
||||
*/
|
||||
public void uploadPoiNet(PoiEntity poiEntity) {
|
||||
public void uploadPoiNet(Map.Entry<Integer, PoiEntity> integerPoiEntityEntry) {
|
||||
PoiEntity poiEntity = integerPoiEntityEntry.getValue();
|
||||
if (poiEntity == null) {
|
||||
bInt++;
|
||||
poiEntityUploadFailed(poiEntity, "poiEntity为null");
|
||||
return;
|
||||
}
|
||||
int bodyId = poiEntity.getBodyId();
|
||||
if (bodyId == 0) {
|
||||
bInt++;
|
||||
poiEntityUploadFailed(poiEntity, "bodyId为0");
|
||||
return;
|
||||
}
|
||||
ArrayList<File> photoFile = new ArrayList<>();
|
||||
@ -424,12 +364,14 @@ public class PoiSaveUtils {
|
||||
}
|
||||
}
|
||||
}
|
||||
poiEntity.setUploadMax(photoFile.size());
|
||||
//1 "POI"2 "充电站"3 "POI录像"4 "道路录像"5 "其他"6 "面状任务"
|
||||
if (poiEntity.getType() == 1) {
|
||||
initList(HttpInterface.POI_TASK_UPLOAD_PIC, photoFile, poiEntity);
|
||||
} else if (poiEntity.getType() == 2) {
|
||||
initList(HttpInterface.C_TASK_UP_LOAD_PIC, photoFile, poiEntity);
|
||||
} else if (poiEntity.getType() == 3) {
|
||||
}
|
||||
else if (poiEntity.getType() == 3) {
|
||||
List<File> videoFileList = AWMp4ParserHelper.getInstance().getFileListByUUID(poiEntity.getId());
|
||||
if (videoFileList != null && !videoFileList.isEmpty()) {
|
||||
boolean existsPic = PoiSaveUtils.getInstance(mContext).checkPicExists(videoFileList);
|
||||
@ -505,31 +447,21 @@ public class PoiSaveUtils {
|
||||
// File fileZip = new File(Constant.PICTURE_FOLDER, "files" + ".zip");
|
||||
// ZipUtil.zipFiles(videoFileList, fileZip, null);
|
||||
// photoFile.add(fileZip);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
Log.d("TAGSS", "videoFileList: 失败" + bInt);
|
||||
bInt++;
|
||||
return;
|
||||
}
|
||||
// if (photoFile.size() > 0) {
|
||||
// long zipTrueSize = ZipUtils.getZipTrueSize(photoFile.get(0).getAbsolutePath());
|
||||
// if (zipTrueSize > 0) {
|
||||
// initList(HttpInterface.ROAD_TASK_UPLOAD_PIC, photoFile, poiEntity);
|
||||
// } else {
|
||||
// Log.d("TAGSS", "photoFile: 失败" + bInt);
|
||||
// for (int i = 0; i < photoFile.size(); i++) {
|
||||
// photoFile.get(i).delete();
|
||||
// }
|
||||
// bInt++;
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
} else if (poiEntity.getType() == 5) {
|
||||
}
|
||||
else if (poiEntity.getType() == 5) {
|
||||
initList(HttpInterface.OTHER_TASK_UPLOAD_PIC, photoFile, poiEntity);
|
||||
}
|
||||
}
|
||||
|
||||
private void initList(String url, List<File> list, PoiEntity poiEntity) {
|
||||
try {
|
||||
poiEntity.setUploadResult("");
|
||||
HttpParams httpParams = new HttpParams();
|
||||
httpParams.put("auditId", poiEntity.getBodyId());
|
||||
Response execute = OkGoBuilder.getInstance()
|
||||
@ -542,56 +474,40 @@ public class PoiSaveUtils {
|
||||
.postFileSynchronization();
|
||||
if (execute == null) {
|
||||
Log.d("TAGSS", "execute: 失败" + bInt);
|
||||
poiEntity.setChecked(false);
|
||||
poiEntity.setWork_type(0);
|
||||
PoiDatabase.getInstance(mContext).getPoiDao().updatePoiEntity(poiEntity);
|
||||
bInt++;
|
||||
poiEntityUploadFailed(poiEntity, "服务返回结果为null");
|
||||
return;
|
||||
}
|
||||
if (execute.code() != 200) {
|
||||
Log.d("TAGSS", "code: 失败" + bInt);
|
||||
poiEntity.setChecked(false);
|
||||
poiEntity.setWork_type(0);
|
||||
PoiDatabase.getInstance(mContext).getPoiDao().updatePoiEntity(poiEntity);
|
||||
bInt++;
|
||||
poiEntityUploadFailed(poiEntity, "服务返回code码不为200"+execute.code());
|
||||
return;
|
||||
}
|
||||
String bodyStr = execute.body().string();
|
||||
if (bodyStr == null) {
|
||||
Log.d("TAGSS", "bodyStr: 失败" + bInt);
|
||||
poiEntity.setChecked(false);
|
||||
poiEntity.setWork_type(0);
|
||||
PoiDatabase.getInstance(mContext).getPoiDao().updatePoiEntity(poiEntity);
|
||||
bInt++;
|
||||
poiEntityUploadFailed(poiEntity, "服务返回body为null");
|
||||
return;
|
||||
}
|
||||
OtherUploadPicBean otherUploadPicBean = new Gson().fromJson(bodyStr, OtherUploadPicBean.class);
|
||||
if (otherUploadPicBean!=null){
|
||||
if (otherUploadPicBean.getCode() == 200) {
|
||||
poiEntity.setChecked(false);
|
||||
poiEntity.setTaskStatus(100);
|
||||
PoiDatabase.getInstance(mContext).getPoiDao().updatePoiEntity(poiEntity);
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
list.get(i).delete();
|
||||
}
|
||||
PoiEntityDeleteUtil.getInstance().deleteUtil(mContext, poiEntity);
|
||||
Log.d("TAGSS", "uploadPoiNet: 成功" + anInt);
|
||||
anInt++;
|
||||
poiEntity.setUploadProgress(poiEntity.getUploadMax());
|
||||
poiEntityUploadSuccess(poiEntity, "");
|
||||
return;
|
||||
} else {
|
||||
poiEntity.setChecked(false);
|
||||
poiEntity.setWork_type(0);
|
||||
PoiDatabase.getInstance(mContext).getPoiDao().updatePoiEntity(poiEntity);
|
||||
poiEntityUploadFailed(poiEntity, "错误:"+otherUploadPicBean.getMessage());
|
||||
Log.d("TAGSS", "uploadPoiNet: 失败" + bInt);
|
||||
bInt++;
|
||||
return;
|
||||
}
|
||||
}else {
|
||||
poiEntity.setChecked(false);
|
||||
poiEntity.setWork_type(0);
|
||||
PoiDatabase.getInstance(mContext).getPoiDao().updatePoiEntity(poiEntity);
|
||||
Log.d("TAGSS", "uploadPoiNet: 失败" + bInt);
|
||||
bInt++;
|
||||
poiEntityUploadFailed(poiEntity, "Json转换失败");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -600,6 +516,16 @@ public class PoiSaveUtils {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* EventBus通知列表当前的上传进度
|
||||
* */
|
||||
private void sendRefreshItem(PoiEntity poiEntity) {
|
||||
Message msg = Message.obtain();
|
||||
msg.what = Constant.EVENT_WHAT_UPLOAD_PROGRESS;
|
||||
msg.obj = poiEntity;
|
||||
EventBus.getDefault().post(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据充电站数据检查充电桩数据,如果没有网络保存,则批量网络保存
|
||||
*/
|
||||
|
26
app/src/main/res/drawable/default_progress.xml
Normal file
26
app/src/main/res/drawable/default_progress.xml
Normal file
@ -0,0 +1,26 @@
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<item android:id="@android:id/background">
|
||||
<shape>
|
||||
<corners android:radius="0.1dip" />
|
||||
<solid android:color="@color/colorGrays"></solid>
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<item android:id="@android:id/secondaryProgress">
|
||||
<clip>
|
||||
<shape>
|
||||
<corners android:radius="0.1dip" />
|
||||
<solid android:color="@color/black"></solid>
|
||||
</shape>
|
||||
</clip>
|
||||
</item>
|
||||
|
||||
<item android:id="@android:id/progress">
|
||||
<clip>
|
||||
<shape>
|
||||
<corners android:radius="0.1dip" />
|
||||
<solid android:color="@color/colorBlue"></solid>
|
||||
</shape>
|
||||
</clip>
|
||||
</item>
|
||||
</layer-list>
|
@ -5,6 +5,7 @@
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/stay_main_info"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="90dp"
|
||||
android:layout_margin="10dp"
|
||||
@ -63,4 +64,42 @@
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/layer_pb"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/default_widget_padding"
|
||||
app:layout_constraintTop_toBottomOf="@id/stay_main_info"
|
||||
app:layout_constraintLeft_toLeftOf="parent">
|
||||
<ProgressBar
|
||||
android:id="@+id/pb_stay_upload"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="2dp"
|
||||
android:layout_gravity="center"
|
||||
android:progressDrawable="@drawable/default_progress"
|
||||
style="@android:style/Widget.ProgressBar.Horizontal"
|
||||
></ProgressBar>
|
||||
<TextView
|
||||
android:id="@+id/tv_pb_stay_upload"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:textSize="8sp"
|
||||
android:background="@color/white80"
|
||||
android:layout_height="wrap_content"></TextView>
|
||||
</FrameLayout>
|
||||
<TextView
|
||||
android:id="@+id/tv_upload_result"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="invisible"
|
||||
android:textSize="12sp"
|
||||
android:maxLength="20"
|
||||
android:ellipsize="middle"
|
||||
android:lines="1"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/colorRed"
|
||||
android:paddingHorizontal="@dimen/default_widget_padding"
|
||||
app:layout_constraintTop_toBottomOf="@id/layer_pb"
|
||||
app:layout_constraintRight_toRightOf="parent"></TextView>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
Loading…
x
Reference in New Issue
Block a user