parent
36e72f239c
commit
fb0d12cd49
58 changed files with 7367 additions and 27 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,13 @@ |
|||||||
|
package com.project.survey.ui.instrument.setupstation; |
||||||
|
|
||||||
|
import androidx.recyclerview.widget.RecyclerView; |
||||||
|
|
||||||
|
import com.bingce.activity.AbstractListActivity; |
||||||
|
import com.project.survey.App; |
||||||
|
|
||||||
|
public abstract class BingCeAbstractListActivity<T, VH extends RecyclerView.ViewHolder> extends AbstractListActivity<T, VH> { |
||||||
|
@Override |
||||||
|
protected boolean isLandscape() { |
||||||
|
return ((App) getApplication()).isLandscape(); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,660 @@ |
|||||||
|
package com.project.survey.ui.instrument.setupstation; |
||||||
|
|
||||||
|
import static com.bingce.road.parameter.RoadAttributeControlPointConverter.readControlPoint; |
||||||
|
|
||||||
|
import android.annotation.SuppressLint; |
||||||
|
import android.app.ProgressDialog; |
||||||
|
import android.content.Context; |
||||||
|
import android.content.Intent; |
||||||
|
import android.os.AsyncTask; |
||||||
|
import android.os.Bundle; |
||||||
|
import android.view.KeyEvent; |
||||||
|
import android.view.Menu; |
||||||
|
import android.view.MenuItem; |
||||||
|
import android.view.View; |
||||||
|
import android.view.ViewGroup; |
||||||
|
|
||||||
|
import androidx.activity.result.ActivityResult; |
||||||
|
import androidx.annotation.NonNull; |
||||||
|
import androidx.fragment.app.Fragment; |
||||||
|
import androidx.fragment.app.FragmentActivity; |
||||||
|
import androidx.lifecycle.MutableLiveData; |
||||||
|
import androidx.recyclerview.widget.RecyclerView; |
||||||
|
|
||||||
|
import com.afollestad.materialdialogs.MaterialDialog; |
||||||
|
import com.bingce.data.cache.CachedCurrentProject; |
||||||
|
import com.bingce.data.cache.CachedCurrentRoad; |
||||||
|
import com.bingce.data.database.DBQueryConstant; |
||||||
|
import com.bingce.data.database.KeyValueDb; |
||||||
|
import com.bingce.data.database.PointDb; |
||||||
|
import com.bingce.data.database.RoadDb; |
||||||
|
import com.bingce.data.surveyor.designdata.kv.KeyValueConstants; |
||||||
|
import com.bingce.data.surveyor.designdata.kv.KeyValueRecord; |
||||||
|
import com.bingce.data.surveyor.designdata.road.RoadConstants; |
||||||
|
import com.bingce.data.surveyor.designdata.road.RoadRecord; |
||||||
|
import com.bingce.data.surveyor.surveydata.pointsurvey.PointConstants; |
||||||
|
import com.bingce.data.surveyor.surveydata.pointsurvey.PointRecord; |
||||||
|
import com.bingce.device.ui.dialog.DialogUtil; |
||||||
|
import com.bingce.error.BingCeErrorCode; |
||||||
|
import com.bingce.file.FileOperator; |
||||||
|
import com.bingce.list.SwipeDeleteListLayoutHelper; |
||||||
|
import com.bingce.poi.excel.ExcelExportHelper; |
||||||
|
import com.bingce.road.RoadIntentUtil; |
||||||
|
import com.bingce.utils.ActivityUtils; |
||||||
|
import com.bingce.utils.DateUtils; |
||||||
|
import com.bingce.utils.FileUtil; |
||||||
|
import com.bingce.utils.FragmentUtils; |
||||||
|
import com.bingce.utils.IntentUtil; |
||||||
|
import com.bingce.utils.StringUtil; |
||||||
|
import com.bingce.utils.ThreadPoolUtil; |
||||||
|
import com.bingce.utils.Util; |
||||||
|
import com.project.survey.BuildConfig; |
||||||
|
import com.project.survey.R; |
||||||
|
import com.project.survey.databinding.ActivityPointsBinding; |
||||||
|
import com.project.survey.databinding.RecyclerviewItemControlPointLayoutBinding; |
||||||
|
import com.project.survey.ui.instrument.setupstation.util.ControlPointsClearDialogUtils; |
||||||
|
import com.project.survey.ui.instrument.setupstation.util.ControlPointsDetailDialogUtils; |
||||||
|
import com.project.survey.ui.instrument.setupstation.util.ControlPointsExportDialogUtils; |
||||||
|
import com.project.survey.ui.instrument.setupstation.util.ControlPointsFilterDialogUtils; |
||||||
|
import com.project.survey.ui.instrument.setupstation.util.ControlPointsImportConfigDialogUtils; |
||||||
|
|
||||||
|
import org.polaric.colorful.ColorfulActivity; |
||||||
|
|
||||||
|
import java.io.File; |
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
import blankj.utilcode.util.ToastUtils; |
||||||
|
import cn.liuyanbing.surveyor.model.base.Point; |
||||||
|
import cn.liuyanbing.surveyor.model.base.PointArray; |
||||||
|
import cn.liuyanbing.surveyor.model.base.Road; |
||||||
|
|
||||||
|
/** |
||||||
|
* 控制点 |
||||||
|
*/ |
||||||
|
public class ControlPointsActivity extends ColorfulActivity { |
||||||
|
private String[] mHeaders; |
||||||
|
private ProgressDialog mProgressDialog; |
||||||
|
private final List<List<String>> exportResult = new ArrayList<>(); |
||||||
|
private final ControlPointsFilterDialogUtils controlPointsFilterDialogUtils = new ControlPointsFilterDialogUtils(() -> this); |
||||||
|
private final ControlPointsDetailDialogUtils controlPointsDetailDialogUtils = new ControlPointsDetailDialogUtils(this); |
||||||
|
private final ControlPointsExportDialogUtils controlPointsExportDialogUtils = new ControlPointsExportDialogUtils(this); |
||||||
|
private final ControlPointsClearDialogUtils controlPointsClearDialogUtils = new ControlPointsClearDialogUtils(this); |
||||||
|
private final ControlPointsImportConfigDialogUtils controlPointsImportConfigDialogUtils = new ControlPointsImportConfigDialogUtils(this); |
||||||
|
|
||||||
|
private final SwipeDeleteListLayoutHelper<DATA, VH> listLayoutHelper = new SwipeDeleteListLayoutHelper<DATA, VH>(this) { |
||||||
|
@Override |
||||||
|
protected void onDelete(int index, DATA instance, IOnDeleteListener<DATA> listener) { |
||||||
|
DialogUtil.mNullCancelAlertDialog(ControlPointsActivity.this, null, R.string.confirm_delete, (dialogInterface, i) -> { |
||||||
|
if (StringUtil.isEmpty(instance.roadId)) {//如果是全局控制点
|
||||||
|
ThreadPoolUtil.execute(() -> { |
||||||
|
PointDb.getInstance().delete(instance.pointRecord); |
||||||
|
runOnUiThread(() -> listener.completeDelete(instance)); |
||||||
|
}); |
||||||
|
} else {//如果是线路控制点,则需要修改线路数据
|
||||||
|
ThreadPoolUtil.execute(() -> { |
||||||
|
RoadRecord roadRecord = RoadDb.getInstance() |
||||||
|
.rawQueryData(DBQueryConstant.findById(RoadConstants.DB_NAME, instance.roadId)); |
||||||
|
if (roadRecord == null) { |
||||||
|
BingCeErrorCode.toast(BingCeErrorCode.NO_FOUND_ROAD_BY_ID); |
||||||
|
return; |
||||||
|
} |
||||||
|
Road road = RoadDb.getInstance().roadConverter().convert(roadRecord); |
||||||
|
if (road == null) { |
||||||
|
BingCeErrorCode.toast(BingCeErrorCode.ROAD_RECORD_CONVERT_2_ROAD_FAILURE); |
||||||
|
return; |
||||||
|
} |
||||||
|
if (instance.index >= 0 && instance.index < road.getControlPointList().size()) { |
||||||
|
road.getControlPointList().remove(instance.index); |
||||||
|
RoadDb.getInstance().save(road); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
binding.fabNewPoint.setVisibility(View.VISIBLE); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected VH newItemContentVH(@NonNull ViewGroup parent, int viewType) { |
||||||
|
return new VH(RecyclerviewItemControlPointLayoutBinding.inflate(getLayoutInflater(), parent, false)); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void onItemClicked(int index, DATA data) { |
||||||
|
boolean needReturn = IntentUtil.boolExtra(getIntent(), KEY_IS_RETURN_DATA); |
||||||
|
if (needReturn) { |
||||||
|
Intent intent = new Intent(); |
||||||
|
PointRecord instance = data.pointRecord; |
||||||
|
intent.putExtra(RESULT_ID, instance.id); |
||||||
|
intent.putExtra(RESULT_NAME, instance.name); |
||||||
|
intent.putExtra(RESULT_CODE, instance.code); |
||||||
|
intent.putExtra(RESULT_REMARK, instance.remarks); |
||||||
|
intent.putExtra(RESULT_X, instance.x); |
||||||
|
intent.putExtra(RESULT_Y, instance.y); |
||||||
|
intent.putExtra(RESULT_Z, instance.h); |
||||||
|
setResult(RESULT_OK, intent); |
||||||
|
finish(); |
||||||
|
} else { |
||||||
|
controlPointsDetailDialogUtils.showControlPointDialog( |
||||||
|
data.roadId, data, getString(R.string.edit_control_point)); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void doBindContent(VH vh, DATA data) { |
||||||
|
PointRecord instance = data.pointRecord; |
||||||
|
vh.itemBinding.recyclerviewItemSwipePointTitle1.setText(instance.name); |
||||||
|
vh.itemBinding.recyclerviewItemSwipePointTitle2.setText(instance.code); |
||||||
|
vh.itemBinding.recyclerviewItemSwipePointBody1.setText("X:" + Util.formatDouble2StringDotAuto(instance.x)); |
||||||
|
vh.itemBinding.recyclerviewItemSwipePointBody2.setText("Y:" + Util.formatDouble2StringDotAuto(instance.y)); |
||||||
|
vh.itemBinding.recyclerviewItemSwipePointBody3.setText("Z:" + Util.formatDouble2StringDotAuto(instance.h)); |
||||||
|
vh.itemBinding.recyclerviewItemSwipePointBody4.setText( |
||||||
|
StringUtil.isEmpty(data.roadId) ? DateUtils.toFull(instance.createDate) : data.timeString |
||||||
|
); |
||||||
|
vh.itemBinding.recyclerviewItemSwipePointBody5.setText(instance.remarks); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void onMenuOpen() { |
||||||
|
binding.fabNewPoint.setVisibility(View.GONE); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void onMenuClosed() { |
||||||
|
binding.fabNewPoint.setVisibility(View.VISIBLE); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected RecyclerView recyclerView() { |
||||||
|
return binding.recyclerviewPoints; |
||||||
|
} |
||||||
|
}; |
||||||
|
private final MutableLiveData<List<DATA>> pointRecordsMutableLiveData = new MutableLiveData<>(); |
||||||
|
private ActivityPointsBinding binding; |
||||||
|
|
||||||
|
@SuppressLint("SourceLockedOrientationActivity") |
||||||
|
@Override |
||||||
|
protected void onCreate(Bundle savedInstanceState) { |
||||||
|
super.onCreate(savedInstanceState); |
||||||
|
binding = ActivityPointsBinding.inflate(getLayoutInflater()); |
||||||
|
setContentView(binding.getRoot()); |
||||||
|
setSupportActionBar(binding.toolbar); |
||||||
|
if (getSupportActionBar() != null) { |
||||||
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true); |
||||||
|
} |
||||||
|
|
||||||
|
mHeaders = new String[]{getString(R.string.category), |
||||||
|
getString(R.string.point_name), |
||||||
|
getString(R.string.point_code), |
||||||
|
"X", "Y", "Z", |
||||||
|
getString(R.string.remarks), |
||||||
|
getString(R.string.record_time)}; |
||||||
|
|
||||||
|
//监控数据变化
|
||||||
|
pointRecordsMutableLiveData.observe(this, listLayoutHelper::onDataChanged); |
||||||
|
String roadId = RoadIntentUtil.getRoadIdFromIntent(getIntent()); |
||||||
|
binding.fabNewPoint.setOnClickListener(v -> { |
||||||
|
controlPointsDetailDialogUtils.showControlPointDialog( |
||||||
|
roadId, null, getString(R.string.new_control_point)); |
||||||
|
}); |
||||||
|
|
||||||
|
|
||||||
|
boolean isGlobal = IntentUtil.boolExtra(this, KEY_IS_GLOBAL); |
||||||
|
|
||||||
|
ThreadPoolUtil.execute(() -> { |
||||||
|
if (isGlobal) { |
||||||
|
String projectId = CachedCurrentProject.currentProjectId(); |
||||||
|
runOnUiThread(() -> { |
||||||
|
PointDb.getInstance() |
||||||
|
.rawQueryListLiveData(PointConstants.findControlPointByProject(projectId)) |
||||||
|
.observe(this, pointRecords -> { |
||||||
|
List<DATA> dataList = new ArrayList<>(); |
||||||
|
for (PointRecord record : pointRecords) { |
||||||
|
dataList.add(new DATA(record)); |
||||||
|
} |
||||||
|
pointRecordsMutableLiveData.setValue(dataList); |
||||||
|
}); |
||||||
|
}); |
||||||
|
} else { |
||||||
|
if (!StringUtil.isEmpty(roadId)) {//
|
||||||
|
runOnUiThread(() -> { |
||||||
|
RoadDb.getInstance() |
||||||
|
.rawQueryLiveData(DBQueryConstant.findById(RoadConstants.DB_NAME, roadId)) |
||||||
|
.observe(this, roadRecord -> { |
||||||
|
if (roadRecord == null){ |
||||||
|
return; |
||||||
|
} |
||||||
|
PointArray pointArray = new PointArray(); |
||||||
|
String error = readControlPoint(roadRecord.controlPointJson, roadRecord.name, pointArray); |
||||||
|
if (!StringUtil.isEmpty(error)) { |
||||||
|
ToastUtils.showShort(error); |
||||||
|
return; |
||||||
|
} |
||||||
|
List<DATA> dataList = new ArrayList<>(); |
||||||
|
for (int index = 0; index < pointArray.size(); index++) { |
||||||
|
Point point = pointArray.get(index); |
||||||
|
dataList.add(new DATA(roadId, index, |
||||||
|
new PointRecord(null, null, null, |
||||||
|
-1, |
||||||
|
point.getName(), point.getCode(), point.getRemarks(), |
||||||
|
point.getX(), point.getY(), point.getZ(), |
||||||
|
0, 0, 0, |
||||||
|
PointConstants.POINT_FORMAT_XYZ, null), point.getTime())); |
||||||
|
} |
||||||
|
pointRecordsMutableLiveData.setValue(dataList); |
||||||
|
}); |
||||||
|
}); |
||||||
|
} else { |
||||||
|
//查询当前线路
|
||||||
|
String projectId = CachedCurrentProject.currentProjectId(); |
||||||
|
String currentRoadId = CachedCurrentRoad.currentRoadId(projectId); |
||||||
|
runOnUiThread(() -> { |
||||||
|
RoadDb.getInstance() |
||||||
|
.rawQueryLiveData(DBQueryConstant.findById(RoadConstants.DB_NAME, currentRoadId)) |
||||||
|
.observe(this, roadRecord -> { |
||||||
|
PointArray pointArray = new PointArray(); |
||||||
|
String error = readControlPoint(roadRecord.controlPointJson, roadRecord.name, pointArray); |
||||||
|
if (!StringUtil.isEmpty(error)) { |
||||||
|
ToastUtils.showShort(error); |
||||||
|
return; |
||||||
|
} |
||||||
|
List<DATA> dataList = new ArrayList<>(); |
||||||
|
for (int index = 0; index < pointArray.size(); index++) { |
||||||
|
Point point = pointArray.get(index); |
||||||
|
dataList.add(new DATA(roadId, index, |
||||||
|
new PointRecord(null, null, null, |
||||||
|
-1, |
||||||
|
point.getName(), point.getCode(), point.getRemarks(), |
||||||
|
point.getX(), point.getY(), point.getZ(), |
||||||
|
0, 0, 0, |
||||||
|
PointConstants.POINT_FORMAT_XYZ, null), point.getTime())); |
||||||
|
} |
||||||
|
pointRecordsMutableLiveData.setValue(dataList); |
||||||
|
}); |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
private void updateData(String filterKey) { |
||||||
|
String roadId = RoadIntentUtil.getRoadIdFromIntent(getIntent()); |
||||||
|
boolean isGlobal = IntentUtil.boolExtra(this, KEY_IS_GLOBAL); |
||||||
|
ThreadPoolUtil.execute(() -> { |
||||||
|
if (isGlobal) {//处理全局控制点
|
||||||
|
String projectId = CachedCurrentProject.currentProjectId(); |
||||||
|
List<PointRecord> pointRecords = PointDb.getInstance() |
||||||
|
.rawQueryListData(PointConstants.findGlobalControlByNameLike(projectId, filterKey)); |
||||||
|
List<DATA> dataList = new ArrayList<>(); |
||||||
|
for (PointRecord record : pointRecords) { |
||||||
|
dataList.add(new DATA(record)); |
||||||
|
} |
||||||
|
runOnUiThread(() -> { |
||||||
|
pointRecordsMutableLiveData.setValue(dataList); |
||||||
|
}); |
||||||
|
} else {//处理线路控制点
|
||||||
|
if (!StringUtil.isEmpty(roadId)) {//
|
||||||
|
RoadRecord roadRecord = RoadDb.getInstance() |
||||||
|
.rawQueryData(DBQueryConstant.findById(RoadConstants.DB_NAME, roadId)); |
||||||
|
PointArray pointArray = new PointArray(); |
||||||
|
String error = readControlPoint(roadRecord.controlPointJson, roadRecord.name, pointArray); |
||||||
|
if (!StringUtil.isEmpty(error)) { |
||||||
|
ToastUtils.showShort(error); |
||||||
|
return; |
||||||
|
} |
||||||
|
runOnUiThread(() -> updatePointList(roadId, pointArray, filterKey)); |
||||||
|
} else { |
||||||
|
//查询当前线路
|
||||||
|
String projectId = CachedCurrentProject.currentProjectId(); |
||||||
|
String currentRoadId = CachedCurrentRoad.currentRoadId(projectId); |
||||||
|
RoadRecord roadRecord = RoadDb.getInstance() |
||||||
|
.rawQueryData(DBQueryConstant.findById(RoadConstants.DB_NAME, currentRoadId)); |
||||||
|
PointArray pointArray = new PointArray(); |
||||||
|
String error = readControlPoint(roadRecord.controlPointJson, roadRecord.name, pointArray); |
||||||
|
if (!StringUtil.isEmpty(error)) { |
||||||
|
ToastUtils.showShort(error); |
||||||
|
return; |
||||||
|
} |
||||||
|
runOnUiThread(() -> updatePointList(roadId, pointArray, filterKey)); |
||||||
|
} |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
private void updatePointList(String roadId, PointArray pointArray, String filterKey) { |
||||||
|
List<DATA> dataList = new ArrayList<>(); |
||||||
|
if (pointArray != null) { |
||||||
|
for (int index = 0; index < pointArray.size(); index++) { |
||||||
|
Point point = pointArray.get(index); |
||||||
|
if (StringUtil.isEmpty(filterKey) || point.getName().contains(filterKey)) { |
||||||
|
dataList.add(new DATA(roadId, index, |
||||||
|
new PointRecord(null, null, null, |
||||||
|
-1, |
||||||
|
point.getName(), point.getCode(), point.getRemarks(), |
||||||
|
point.getX(), point.getY(), point.getZ(), |
||||||
|
0, 0, 0, |
||||||
|
PointConstants.POINT_FORMAT_XYZ, null), point.getTime())); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
pointRecordsMutableLiveData.setValue(dataList); |
||||||
|
} |
||||||
|
|
||||||
|
@SuppressLint("StaticFieldLeak") |
||||||
|
private void exportExcelAsync(final String name, final String[] headers) { |
||||||
|
new AsyncTask<Integer, Integer, Boolean>() { |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void onPreExecute() { |
||||||
|
mProgressDialog = new ProgressDialog(ControlPointsActivity.this); |
||||||
|
mProgressDialog.setMessage(getString(R.string.export_points)); |
||||||
|
mProgressDialog.setOnCancelListener(dialog -> cancel(true)); |
||||||
|
mProgressDialog.setCancelable(true); |
||||||
|
mProgressDialog.show(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected Boolean doInBackground(Integer... params) { |
||||||
|
exportResult.clear(); |
||||||
|
|
||||||
|
for (int i = 0; i < listLayoutHelper.itemSize(); i++) { |
||||||
|
DATA data = listLayoutHelper.getItem(i); |
||||||
|
PointRecord point = data.pointRecord; |
||||||
|
|
||||||
|
ArrayList<String> rowResult = new ArrayList<>(); |
||||||
|
|
||||||
|
String type = getString(R.string.control_point); |
||||||
|
|
||||||
|
rowResult.add(type); |
||||||
|
rowResult.add(point.name); |
||||||
|
rowResult.add(point.code); |
||||||
|
rowResult.add(Util.formatDouble2StringDotAuto(point.x)); |
||||||
|
rowResult.add(Util.formatDouble2StringDotAuto(point.y)); |
||||||
|
rowResult.add(Util.formatDouble2StringDotAuto(point.h)); |
||||||
|
rowResult.add(point.remarks); |
||||||
|
rowResult.add(DateUtils.toFull(point.createDate)); |
||||||
|
exportResult.add(rowResult); |
||||||
|
} |
||||||
|
if (!exportResult.isEmpty()) { |
||||||
|
new ExcelExportHelper().exportExcelForBigDataAndSave(headers, exportResult, getString(R.string.point_data), ExcelExportHelper.MORE_SHEET_FLAG, FileUtil.getSDPath() + "/" + getString(R.string.surveyor_exported_file) + "/" + getString(R.string.point_data), name); |
||||||
|
} |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void onPostExecute(Boolean result) { |
||||||
|
super.onPostExecute(result); |
||||||
|
mProgressDialog.dismiss(); |
||||||
|
File file = new File(FileUtil.getSDPath() + "/" + getString(R.string.surveyor_exported_file) + "/" + getString(R.string.point_data) + "/" + name + ".xls"); |
||||||
|
if (file.exists()) { |
||||||
|
FileUtil.scanFile(ControlPointsActivity.this, file); |
||||||
|
showExportOverDialog(file); |
||||||
|
} |
||||||
|
} |
||||||
|
}.execute(); |
||||||
|
} |
||||||
|
|
||||||
|
private void showExportOverDialog(final File file) { |
||||||
|
new MaterialDialog.Builder(this).title(R.string.export_successful) |
||||||
|
.content(R.string.exported_file_save_at_surveyor_exported_files) |
||||||
|
.positiveText(R.string.send_to) |
||||||
|
.negativeText(R.string.open) |
||||||
|
.neutralText(R.string.close) |
||||||
|
.onPositive((dialog, which) -> FileOperator.shareFile(ControlPointsActivity.this, file, BuildConfig.APPLICATION_ID)) |
||||||
|
.onNegative((dialog, which) -> FileUtil.openFile(ControlPointsActivity.this, file)) |
||||||
|
.show(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public boolean onCreateOptionsMenu(Menu menu) { |
||||||
|
super.onCreateOptionsMenu(menu); |
||||||
|
getMenuInflater().inflate(R.menu.menu_activity_points, menu); |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public boolean onOptionsItemSelected(MenuItem item) { |
||||||
|
switch (item.getItemId()) { |
||||||
|
case android.R.id.home: |
||||||
|
finish(); |
||||||
|
break; |
||||||
|
case R.id.menu_point_search: |
||||||
|
controlPointsFilterDialogUtils.showFilterDialog(instance -> { |
||||||
|
updateData(instance); |
||||||
|
binding.tvFilterKey.setVisibility(StringUtil.isEmpty(instance) ? View.GONE : View.VISIBLE); |
||||||
|
binding.tvFilterKey.setText(getString(R.string.filter) + ":[" + instance + "]"); |
||||||
|
}); |
||||||
|
break; |
||||||
|
case R.id.menu_point_import: |
||||||
|
controlPointsImportConfigDialogUtils.showImportConfigDialog(); |
||||||
|
break; |
||||||
|
case R.id.menu_point_export: |
||||||
|
controlPointsExportDialogUtils.showExportDialog(name -> { |
||||||
|
exportExcelAsync(name, mHeaders); |
||||||
|
}); |
||||||
|
break; |
||||||
|
case R.id.menu_point_clear: |
||||||
|
controlPointsClearDialogUtils.showClearDialog(() -> { |
||||||
|
ThreadPoolUtil.execute(() -> { |
||||||
|
boolean isGlobal = IntentUtil.boolExtra(this, KEY_IS_GLOBAL); |
||||||
|
if (isGlobal) {//清空当前项目所有全局控制点
|
||||||
|
KeyValueRecord currentProjectConfig = KeyValueDb.getInstance().findData(KeyValueConstants.KEY_CURRENT_PROJECT_ID); |
||||||
|
if (currentProjectConfig == null) { |
||||||
|
BingCeErrorCode.toast(BingCeErrorCode.NO_CURRENT_PROJECT); |
||||||
|
return; |
||||||
|
} |
||||||
|
PointDb.getInstance().deleteControlPoints(currentProjectConfig.value); |
||||||
|
} else {//尝试清空当前线路所有控制点
|
||||||
|
String roadId = RoadIntentUtil.getRoadIdFromIntent(getIntent()); |
||||||
|
if (!StringUtil.isEmpty(roadId)) { |
||||||
|
ThreadPoolUtil.execute(() -> { |
||||||
|
RoadRecord roadRecord = RoadDb.getInstance() |
||||||
|
.rawQueryData(DBQueryConstant.findById(RoadConstants.DB_NAME, roadId)); |
||||||
|
if (roadRecord == null) { |
||||||
|
BingCeErrorCode.toast(BingCeErrorCode.NO_FOUND_ROAD_BY_ID); |
||||||
|
return; |
||||||
|
} |
||||||
|
Road road = RoadDb.getInstance().roadConverter().convert(roadRecord); |
||||||
|
road.getControlPointList().clear(); |
||||||
|
RoadDb.getInstance().save(road); |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
||||||
|
}); |
||||||
|
ToastUtils.showShort(R.string.clean_over); |
||||||
|
}); |
||||||
|
break; |
||||||
|
} |
||||||
|
return super.onOptionsItemSelected(item); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public boolean onKeyDown(int keyCode, KeyEvent event) { |
||||||
|
switch (keyCode) { |
||||||
|
case KeyEvent.KEYCODE_BACK: |
||||||
|
finish(); |
||||||
|
break; |
||||||
|
} |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) { |
||||||
|
super.onActivityResult(requestCode, resultCode, data); |
||||||
|
boolean isGlobal = IntentUtil.boolExtra(this, KEY_IS_GLOBAL); |
||||||
|
controlPointsImportConfigDialogUtils.onActivityResult(isGlobal, requestCode, resultCode, data); |
||||||
|
} |
||||||
|
|
||||||
|
public static class DATA { |
||||||
|
public final String roadId; |
||||||
|
public final int index; |
||||||
|
public final PointRecord pointRecord; |
||||||
|
public final String timeString; |
||||||
|
|
||||||
|
public DATA(PointRecord pointRecord) { |
||||||
|
this(null, -1, pointRecord, null); |
||||||
|
} |
||||||
|
|
||||||
|
DATA(String roadId, int index, PointRecord pointRecord, String timeString) { |
||||||
|
this.roadId = roadId; |
||||||
|
this.index = index; |
||||||
|
this.pointRecord = pointRecord; |
||||||
|
this.timeString = timeString; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String toString() { |
||||||
|
return "DATA{" + |
||||||
|
"roadId='" + roadId + '\'' + |
||||||
|
", pointRecord=" + pointRecord.toString() + |
||||||
|
", timeString='" + timeString + '\'' + |
||||||
|
'}'; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public boolean equals(Object o) { |
||||||
|
if (o instanceof DATA){ |
||||||
|
DATA pointRecord = (DATA) o; |
||||||
|
return pointRecord.toString().equals(this.toString()); |
||||||
|
} |
||||||
|
return false; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private static class VH extends RecyclerView.ViewHolder { |
||||||
|
private final RecyclerviewItemControlPointLayoutBinding itemBinding; |
||||||
|
|
||||||
|
public VH(@NonNull RecyclerviewItemControlPointLayoutBinding binding) { |
||||||
|
super(binding.getRoot()); |
||||||
|
itemBinding = binding; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private final static String KEY_IS_GLOBAL = "is global";//是否查看全局控制点
|
||||||
|
private final static String KEY_IS_RETURN_DATA = "is return data";//是否返回选择点
|
||||||
|
|
||||||
|
private final static String RESULT_ID = "id"; |
||||||
|
private final static String RESULT_NAME = "name"; |
||||||
|
private final static String RESULT_CODE = "code"; |
||||||
|
private final static String RESULT_REMARK = "remark"; |
||||||
|
private final static String RESULT_X = "X"; |
||||||
|
private final static String RESULT_Y = "Y"; |
||||||
|
private final static String RESULT_Z = "Z"; |
||||||
|
|
||||||
|
public static void pickPoint(FragmentActivity activity, boolean isGlobal, @NonNull IPickCallback callback) { |
||||||
|
Intent intent2 = new Intent(activity, ControlPointsActivity.class); |
||||||
|
intent2.putExtra(KEY_IS_RETURN_DATA, true); |
||||||
|
intent2.putExtra(KEY_IS_GLOBAL, isGlobal); |
||||||
|
if (isGlobal) { |
||||||
|
ActivityUtils.startActivityForResults(activity, intent2, result -> { |
||||||
|
onPicked(result, callback); |
||||||
|
}); |
||||||
|
} else { |
||||||
|
ThreadPoolUtil.execute(() -> { |
||||||
|
String projectId = CachedCurrentProject.currentProjectId(); |
||||||
|
String roadId = CachedCurrentRoad.currentRoadId(projectId); |
||||||
|
RoadIntentUtil.setRoadId(intent2, roadId); |
||||||
|
ThreadPoolUtil.executeInMain(() -> { |
||||||
|
ActivityUtils.startActivityForResults(activity, intent2, result -> { |
||||||
|
onPicked(result, callback); |
||||||
|
}); |
||||||
|
}); |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public static void pickPoint(Fragment fragment, boolean isGlobal, @NonNull IPickCallback callback) { |
||||||
|
Intent intent2 = new Intent(fragment.getContext(), ControlPointsActivity.class); |
||||||
|
intent2.putExtra(KEY_IS_RETURN_DATA, true); |
||||||
|
intent2.putExtra(KEY_IS_GLOBAL, isGlobal); |
||||||
|
if (isGlobal) { |
||||||
|
FragmentUtils.startActivityForResults(fragment, intent2, result -> { |
||||||
|
onPicked(result, callback); |
||||||
|
}); |
||||||
|
} else { |
||||||
|
ThreadPoolUtil.execute(() -> { |
||||||
|
String projectId = CachedCurrentProject.currentProjectId(); |
||||||
|
String roadId = CachedCurrentRoad.currentRoadId(projectId); |
||||||
|
RoadIntentUtil.setRoadId(intent2, roadId); |
||||||
|
ThreadPoolUtil.executeInMain(() -> { |
||||||
|
FragmentUtils.startActivityForResults(fragment, intent2, result -> { |
||||||
|
onPicked(result, callback); |
||||||
|
}); |
||||||
|
}); |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private static void onPicked(ActivityResult result, @NonNull IPickCallback callback) { |
||||||
|
if (result == null || result.getResultCode() != RESULT_OK || result.getData() == null) { |
||||||
|
return; |
||||||
|
} |
||||||
|
Intent intent = result.getData(); |
||||||
|
callback.onPicked( |
||||||
|
intent.getStringExtra(RESULT_NAME), |
||||||
|
intent.getStringExtra(RESULT_CODE), |
||||||
|
intent.getDoubleExtra(RESULT_X, 0), |
||||||
|
intent.getDoubleExtra(RESULT_Y, 0), |
||||||
|
intent.getDoubleExtra(RESULT_Z, 0), |
||||||
|
intent.getStringExtra(RESULT_REMARK)); |
||||||
|
} |
||||||
|
|
||||||
|
public static void pickPoint(FragmentActivity activity, boolean isGlobal, @NonNull IPickCallback2 callback) { |
||||||
|
Intent intent2 = new Intent(activity, ControlPointsActivity.class); |
||||||
|
intent2.putExtra(KEY_IS_RETURN_DATA, true); |
||||||
|
intent2.putExtra(KEY_IS_GLOBAL, isGlobal); |
||||||
|
if (isGlobal) { |
||||||
|
ActivityUtils.startActivityForResults(activity, intent2, result -> { |
||||||
|
onPicked2(result, callback); |
||||||
|
}); |
||||||
|
} else { |
||||||
|
ThreadPoolUtil.execute(() -> { |
||||||
|
String projectId = CachedCurrentProject.currentProjectId(); |
||||||
|
String roadId = CachedCurrentRoad.currentRoadId(projectId); |
||||||
|
RoadIntentUtil.setRoadId(intent2, roadId); |
||||||
|
ThreadPoolUtil.executeInMain(() -> { |
||||||
|
ActivityUtils.startActivityForResults(activity, intent2, result -> { |
||||||
|
onPicked2(result, callback); |
||||||
|
}); |
||||||
|
}); |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private static void onPicked2(ActivityResult result, @NonNull IPickCallback2 callback) { |
||||||
|
if (result == null || result.getResultCode() != RESULT_OK || result.getData() == null) { |
||||||
|
return; |
||||||
|
} |
||||||
|
Intent intent = result.getData(); |
||||||
|
callback.onPicked( |
||||||
|
intent.getStringExtra(RESULT_ID), |
||||||
|
intent.getStringExtra(RESULT_NAME), |
||||||
|
intent.getStringExtra(RESULT_CODE), |
||||||
|
intent.getDoubleExtra(RESULT_X, 0), |
||||||
|
intent.getDoubleExtra(RESULT_Y, 0), |
||||||
|
intent.getDoubleExtra(RESULT_Z, 0), |
||||||
|
intent.getStringExtra(RESULT_REMARK)); |
||||||
|
} |
||||||
|
|
||||||
|
public interface IPickCallback { |
||||||
|
void onPicked(String name, String code, double x, double y, double z, String remarks); |
||||||
|
} |
||||||
|
|
||||||
|
public interface IPickCallback2 { |
||||||
|
void onPicked(String pointId, String name, String code, double x, double y, double z, String remarks); |
||||||
|
} |
||||||
|
|
||||||
|
public static void startRoadControlListActivity(Context context, String roadId) { |
||||||
|
Intent intent = new Intent(context, ControlPointsActivity.class); |
||||||
|
RoadIntentUtil.setRoadId(intent, roadId); |
||||||
|
intent.putExtra(KEY_IS_GLOBAL, false); |
||||||
|
context.startActivity(intent); |
||||||
|
} |
||||||
|
|
||||||
|
public static void startGlobalControlListActivity(Context context) { |
||||||
|
Intent intent = new Intent(context, ControlPointsActivity.class); |
||||||
|
intent.putExtra(KEY_IS_GLOBAL, true); |
||||||
|
context.startActivity(intent); |
||||||
|
} |
||||||
|
} |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,80 @@ |
|||||||
|
package com.project.survey.ui.instrument.setupstation; |
||||||
|
|
||||||
|
import com.afollestad.materialdialogs.MaterialDialog; |
||||||
|
import com.bingce.AppChannel; |
||||||
|
import com.bingce.device.ui.totalstation.AbstractSetupStationKnownBackSightActivity; |
||||||
|
import com.bingce.surveyor.agentweb.AgentWebActivity; |
||||||
|
import com.project.survey.App; |
||||||
|
import com.project.survey.R; |
||||||
|
|
||||||
|
import blankj.utilcode.util.Utils; |
||||||
|
|
||||||
|
public class SetupStationKnownBackSightActivity extends AbstractSetupStationKnownBackSightActivity { |
||||||
|
@Override |
||||||
|
protected void hideSoftKey() { |
||||||
|
BingCeBaseSurveyPresenter.hideSoftKey(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void speak(String string) { |
||||||
|
BingCeBaseSurveyPresenter.speak(string); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void updateLastRTKLocation() { |
||||||
|
BingCeBaseSurveyPresenter.updateLastRTKLocation(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected boolean checkRegister() { |
||||||
|
return BingCeBaseSurveyPresenter.checkRegister(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected int volumeUpAction() { |
||||||
|
return BingCeBaseSurveyPresenter.volumeUpAction(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected int volumeDownAction() { |
||||||
|
return BingCeBaseSurveyPresenter.volumeDownAction(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void selectPoint(boolean station) { |
||||||
|
String[] titles = new String[]{ |
||||||
|
getString(R.string.point_survey_point_library), |
||||||
|
getString(R.string.staking_point_library)}; |
||||||
|
new MaterialDialog.Builder(this) |
||||||
|
.title(R.string.data_source) |
||||||
|
.items(titles) |
||||||
|
.itemsCallback((dialog, itemView, which, text) -> { |
||||||
|
switch (which) { |
||||||
|
case 0: |
||||||
|
CoordinatePointsLibraryActivity.pickPoint(this, (name, code, x, y, z, b, l, h) -> { |
||||||
|
onPicked(station, name, x, y, z); |
||||||
|
}); |
||||||
|
break; |
||||||
|
case 1: |
||||||
|
StakingNewJobActivity.pickPoint(this, (name, x, y, z) -> { |
||||||
|
onPicked(station, name, x, y, z); |
||||||
|
}); |
||||||
|
break; |
||||||
|
} |
||||||
|
}).show(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void openHelpWeb() { |
||||||
|
// Intent intent = new Intent(Utils.getApp(), AgentWebActivity.class);
|
||||||
|
// intent.putExtra("short_url", "android_url_activity_setup_station_known_back_sight_help");
|
||||||
|
// startActivity(intent);
|
||||||
|
AgentWebActivity.navigation2( |
||||||
|
this, "android_url_activity_setup_station_known_back_sight_help"); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected boolean isThemeDark() { |
||||||
|
return ((App) Utils.getApp()).isThemeDark; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,64 @@ |
|||||||
|
package com.project.survey.ui.instrument.setupstation; |
||||||
|
|
||||||
|
import android.content.Intent; |
||||||
|
|
||||||
|
import com.bingce.device.ui.totalstation.AbstractSetupStationResectionActivity; |
||||||
|
import com.bingce.surveyor.agentweb.AgentWebActivity; |
||||||
|
import com.project.survey.App; |
||||||
|
|
||||||
|
import blankj.utilcode.util.Utils; |
||||||
|
|
||||||
|
public class SetupStationResectionActivity extends AbstractSetupStationResectionActivity { |
||||||
|
@Override |
||||||
|
protected void openHelpWeb() { |
||||||
|
// Intent intent = new Intent(Utils.getApp(), AgentWebActivity.class);
|
||||||
|
// intent.putExtra("short_url", "android_url_activity_setup_station_resection_help");
|
||||||
|
// startActivity(intent);
|
||||||
|
AgentWebActivity.navigation2(this, "android_url_activity_setup_station_resection_help"); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected boolean isThemeDark() { |
||||||
|
return ((App) Utils.getApp()).isThemeDark; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void initData() { |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void hideSoftKey() { |
||||||
|
BingCeBaseSurveyPresenter.hideSoftKey(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void speak(String string) { |
||||||
|
BingCeBaseSurveyPresenter.speak(string); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void updateLastRTKLocation() { |
||||||
|
BingCeBaseSurveyPresenter.updateLastRTKLocation(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected boolean checkRegister() { |
||||||
|
return BingCeBaseSurveyPresenter.checkRegister(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected int volumeUpAction() { |
||||||
|
return BingCeBaseSurveyPresenter.volumeUpAction(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected int volumeDownAction() { |
||||||
|
return BingCeBaseSurveyPresenter.volumeDownAction(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void startSetupStationResectionSubActivity() { |
||||||
|
startActivityForResult(new Intent(Utils.getApp(), SetupStationResectionSubActivity.class), 30); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,76 @@ |
|||||||
|
package com.project.survey.ui.instrument.setupstation; |
||||||
|
|
||||||
|
import com.afollestad.materialdialogs.MaterialDialog; |
||||||
|
import com.bingce.device.ui.totalstation.AbstractSetupStationResectionSubActivity; |
||||||
|
import com.project.survey.App; |
||||||
|
import com.project.survey.R; |
||||||
|
|
||||||
|
import blankj.utilcode.util.Utils; |
||||||
|
|
||||||
|
public class SetupStationResectionSubActivity extends AbstractSetupStationResectionSubActivity { |
||||||
|
@Override |
||||||
|
protected void hideSoftKey() { |
||||||
|
BingCeBaseSurveyPresenter.hideSoftKey(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void speak(String string) { |
||||||
|
BingCeBaseSurveyPresenter.speak(string); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void updateLastRTKLocation() { |
||||||
|
BingCeBaseSurveyPresenter.updateLastRTKLocation(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected boolean checkRegister() { |
||||||
|
return BingCeBaseSurveyPresenter.checkRegister(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected int volumeUpAction() { |
||||||
|
return BingCeBaseSurveyPresenter.volumeUpAction(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected int volumeDownAction() { |
||||||
|
return BingCeBaseSurveyPresenter.volumeDownAction(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void selectPoint() { |
||||||
|
new MaterialDialog.Builder(this) |
||||||
|
.title(R.string.data_source) |
||||||
|
.items(new String[]{getString(R.string.road_control_point), getString(R.string.global_control_point), getString(R.string.point_survey_point_library), getString(R.string.staking_point_library)}) |
||||||
|
.itemsCallback((dialog, itemView, which, text) -> { |
||||||
|
switch (which) { |
||||||
|
case 0: |
||||||
|
ControlPointsNewActivity.pickPoint(this, false, (name, code, x, y, z, remarks) -> { |
||||||
|
onPicked(name, x, y, z); |
||||||
|
}); |
||||||
|
break; |
||||||
|
case 1: |
||||||
|
ControlPointsNewActivity.pickPoint(this, true, (name, code, x, y, z, remarks) -> { |
||||||
|
onPicked(name, x, y, z); |
||||||
|
}); |
||||||
|
break; |
||||||
|
case 2: |
||||||
|
CoordinatePointsLibraryActivity.pickPoint(this, (name, code, x, y, z, b, l, h) -> { |
||||||
|
onPicked(name, x, y, z); |
||||||
|
}); |
||||||
|
break; |
||||||
|
case 3: |
||||||
|
StakingNewJobActivity.pickPoint(this, (name, x, y, z) -> { |
||||||
|
onPicked(name, x, y, z); |
||||||
|
}); |
||||||
|
break; |
||||||
|
} |
||||||
|
}).show(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected boolean isThemeDark() { |
||||||
|
return ((App) Utils.getApp()).isThemeDark; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,695 @@ |
|||||||
|
package com.project.survey.ui.instrument.setupstation; |
||||||
|
|
||||||
|
import android.app.Activity; |
||||||
|
import android.content.Context; |
||||||
|
import android.content.DialogInterface; |
||||||
|
import android.content.Intent; |
||||||
|
import android.graphics.Color; |
||||||
|
import android.os.Handler; |
||||||
|
import android.text.Editable; |
||||||
|
import android.text.TextWatcher; |
||||||
|
import android.util.Log; |
||||||
|
import android.view.Gravity; |
||||||
|
import android.view.View; |
||||||
|
import android.widget.TextView; |
||||||
|
|
||||||
|
import androidx.annotation.NonNull; |
||||||
|
import androidx.appcompat.app.AlertDialog; |
||||||
|
import androidx.fragment.app.FragmentActivity; |
||||||
|
import androidx.lifecycle.LiveData; |
||||||
|
import androidx.paging.Pager; |
||||||
|
import androidx.paging.PagingConfig; |
||||||
|
import androidx.paging.PagingData; |
||||||
|
import androidx.paging.PagingLiveData; |
||||||
|
import androidx.paging.PagingSource; |
||||||
|
import androidx.recyclerview.widget.RecyclerView; |
||||||
|
|
||||||
|
import com.afollestad.materialdialogs.DialogAction; |
||||||
|
import com.afollestad.materialdialogs.MaterialDialog; |
||||||
|
import com.afollestad.materialdialogs.internal.MDButton; |
||||||
|
import com.bingce.data.cache.CachedCurrentJob; |
||||||
|
import com.bingce.data.cache.CachedProject; |
||||||
|
import com.bingce.data.database.PointDb; |
||||||
|
import com.bingce.data.surveyor.surveydata.pointsurvey.PointConstants; |
||||||
|
import com.bingce.data.surveyor.surveydata.pointsurvey.PointRecord; |
||||||
|
import com.bingce.surveyor.agentweb.AgentWebActivity; |
||||||
|
import com.bingce.surveyor.util.dialog.CustomDialog; |
||||||
|
import com.bingce.ui.BcDialogExt; |
||||||
|
import com.bingce.utils.ActivityUtils; |
||||||
|
import com.bingce.utils.PointLibraryUtil; |
||||||
|
import com.bingce.utils.SimpleTextWatcher; |
||||||
|
import com.bingce.utils.StringUtil; |
||||||
|
import com.bingce.utils.ThreadPoolUtil; |
||||||
|
import com.bingce.utils.Util; |
||||||
|
import com.bingce.viewmodel.AbstractCoordinatePointsLibraryViewModelKt; |
||||||
|
import com.kongzue.dialogx.interfaces.OnBindView; |
||||||
|
import com.project.survey.App; |
||||||
|
import com.project.survey.R; |
||||||
|
import com.project.survey.databinding.ActivityStakingNewJob2Binding; |
||||||
|
import com.project.survey.dialog.BubblePopWindow; |
||||||
|
import com.project.survey.ui.base.BaseSurveyNewActivity; |
||||||
|
import com.project.survey.ui.instrument.setupstation.adapter.StakingPointLibraryAdapter; |
||||||
|
import com.project.survey.ui.instrument.setupstation.util.StakingPointsLibraryActivitySQLiteUtils; |
||||||
|
import com.project.survey.util.CommonUtils; |
||||||
|
import com.rengwuxian.materialedittext.MaterialEditText; |
||||||
|
|
||||||
|
import java.io.File; |
||||||
|
import java.util.Arrays; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
import blankj.utilcode.util.ConvertUtils; |
||||||
|
import blankj.utilcode.util.ToastUtils; |
||||||
|
import blankj.utilcode.util.Utils; |
||||||
|
import ru.bartwell.exfilepicker.ExFilePicker; |
||||||
|
import ru.bartwell.exfilepicker.data.ExFilePickerResult; |
||||||
|
|
||||||
|
public class StakingNewJobActivity extends BaseSurveyNewActivity { |
||||||
|
private RecyclerView.OnScrollListener leftScrollListener = new RecyclerView.OnScrollListener() { |
||||||
|
@Override |
||||||
|
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { |
||||||
|
if (recyclerView.getScrollState() != RecyclerView.SCROLL_STATE_IDLE) { |
||||||
|
binding.bodyRv.scrollBy(dx, dy); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) { |
||||||
|
super.onScrollStateChanged(recyclerView, newState); |
||||||
|
binding.bodyHsv.setIntercept(newState != RecyclerView.SCROLL_STATE_IDLE); |
||||||
|
} |
||||||
|
}; |
||||||
|
private RecyclerView.OnScrollListener rightScrollListener = new RecyclerView.OnScrollListener() { |
||||||
|
@Override |
||||||
|
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { |
||||||
|
if (!isFinishing() && recyclerView.getScrollState() != RecyclerView.SCROLL_STATE_IDLE) { |
||||||
|
binding.bodyNameRv.scrollBy(dx, dy); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) { |
||||||
|
super.onScrollStateChanged(recyclerView, newState); |
||||||
|
binding.bodyNameRl.setIntercept(newState != RecyclerView.SCROLL_STATE_IDLE); |
||||||
|
} |
||||||
|
}; |
||||||
|
private static final int EX_FILE_PICKER_RESULT_SURVEYOR_EXCEL = 330; |
||||||
|
private static final int EX_FILE_PICKER_RESULT_SURVEYOR_TXT = 331; |
||||||
|
private static final int EX_FILE_PICKER_RESULT_CASS_DAT = 332; |
||||||
|
private ActivityStakingNewJob2Binding binding; |
||||||
|
private final StakingPointLibraryAdapter stakingPointLibraryAdapter = new StakingPointLibraryAdapter(new PointRecordDiffCallback2(), this, false); |
||||||
|
private final StakingPointLibraryAdapter stakingPointNameLibraryAdapter = new StakingPointLibraryAdapter(new PointRecordDiffCallback2(), this, true); |
||||||
|
private AbstractCoordinatePointsLibraryViewModelKt.FilterParameter filterParameter = new AbstractCoordinatePointsLibraryViewModelKt.FilterParameter(); |
||||||
|
private Pager<Integer, PointRecord> pager = new Pager<>( |
||||||
|
new PagingConfig(100), |
||||||
|
this::dataSourse); |
||||||
|
private final FilterHandlerNew filterHandler = new FilterHandlerNew(new FilterHandlerNew.FilterCallBack() { |
||||||
|
@Override |
||||||
|
public void fireByKey(String key) { |
||||||
|
ThreadPoolUtil.execute(() -> { |
||||||
|
String projectId = CachedProject.currentProjectId(); |
||||||
|
jobId = CachedCurrentJob.currentJobId(projectId); |
||||||
|
ThreadPoolUtil.executeInMain(() -> { |
||||||
|
pagingDataLiveData.removeObservers(StakingNewJobActivity.this); |
||||||
|
pagingDataLiveData = PagingLiveData.cachedIn(PagingLiveData.getLiveData(pager), getLifecycle()); |
||||||
|
pagingDataLiveData.observe(StakingNewJobActivity.this, downloadRecordPagingData -> { |
||||||
|
refreshAdapter(downloadRecordPagingData); |
||||||
|
}); |
||||||
|
|
||||||
|
}); |
||||||
|
}); |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
private void refreshAdapter(PagingData<PointRecord> downloadRecordPagingData) { |
||||||
|
stakingPointLibraryAdapter.submitData(getLifecycle(), downloadRecordPagingData); |
||||||
|
stakingPointNameLibraryAdapter.submitData(getLifecycle(), downloadRecordPagingData); |
||||||
|
stakingPointLibraryAdapter.resetConfig(); |
||||||
|
stakingPointNameLibraryAdapter.resetConfig(); |
||||||
|
stakingPointLibraryAdapter.notifyDataSetChanged(); |
||||||
|
stakingPointNameLibraryAdapter.notifyDataSetChanged(); |
||||||
|
new Handler().postDelayed(() -> binding.tvPointNumber.setText(stakingPointLibraryAdapter.getItemCount() + ""), 500); |
||||||
|
} |
||||||
|
|
||||||
|
private final static String KEY_IS_SELECT = "is_selected"; |
||||||
|
private final static String RESULT_POINT_ID = "pointId"; |
||||||
|
private final static String RESULT_INDEX = "index"; |
||||||
|
private final static String RESULT_NAME = "name"; |
||||||
|
private final static String RESULT_X = "x"; |
||||||
|
private final static String RESULT_Y = "y"; |
||||||
|
private final static String RESULT_Z = "z"; |
||||||
|
private String jobId; |
||||||
|
private LiveData<PagingData<PointRecord>> pagingDataLiveData; |
||||||
|
|
||||||
|
public View getContentView() { |
||||||
|
binding = ActivityStakingNewJob2Binding.inflate(getLayoutInflater()); |
||||||
|
return binding.getRoot(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void initView() { |
||||||
|
setTitle(getString(R.string.staking_point_library)); |
||||||
|
|
||||||
|
if (((App) Utils.getApp()).isThemeDark) { |
||||||
|
binding.topLayout.setBackgroundColor(getColor(R.color.theme_dark_black)); |
||||||
|
binding.tvNumber.setTextColor(getColor(R.color.white)); |
||||||
|
} |
||||||
|
|
||||||
|
binding.bodyRv.setAdapter(stakingPointLibraryAdapter); |
||||||
|
binding.bodyNameRv.setAdapter(stakingPointNameLibraryAdapter); |
||||||
|
binding.bodyHsv.setScrollView(binding.headerHsv); |
||||||
|
binding.headerHsv.setScrollView(binding.bodyHsv); |
||||||
|
binding.bodyRv.addOnScrollListener(rightScrollListener); |
||||||
|
binding.bodyNameRv.addOnScrollListener(leftScrollListener); |
||||||
|
binding.bodyRv.addOnItemTouchListener(new SimpleRecyclerViewItemClickListener(binding.bodyRv, (view, position) -> { |
||||||
|
stakingPointLibraryAdapter.setSelItemPos(position); |
||||||
|
stakingPointNameLibraryAdapter.setSelItemPos(position); |
||||||
|
})); |
||||||
|
binding.bodyNameRv.addOnItemTouchListener(new SimpleRecyclerViewItemClickListener(binding.bodyNameRv, (view, position) -> { |
||||||
|
stakingPointLibraryAdapter.setSelItemPos(position); |
||||||
|
stakingPointNameLibraryAdapter.setSelItemPos(position); |
||||||
|
})); |
||||||
|
|
||||||
|
ThreadPoolUtil.execute(() -> { |
||||||
|
String projectId = CachedProject.currentProjectId(); |
||||||
|
jobId = CachedCurrentJob.currentJobId(projectId); |
||||||
|
ThreadPoolUtil.executeInMain(() -> { |
||||||
|
pagingDataLiveData = PagingLiveData.cachedIn(PagingLiveData.getLiveData(pager), getLifecycle()); |
||||||
|
pagingDataLiveData |
||||||
|
.observe(this, downloadRecordPagingData -> { |
||||||
|
refreshAdapter(downloadRecordPagingData); |
||||||
|
}); |
||||||
|
|
||||||
|
}); |
||||||
|
}); |
||||||
|
|
||||||
|
binding.pointsLibraryBtnConfirm.setOnClickListener(v -> { |
||||||
|
int row = stakingPointLibraryAdapter.getSelItemPos(); |
||||||
|
PointRecord record = stakingPointLibraryAdapter.getSelItem(); |
||||||
|
if (record == null) { |
||||||
|
ToastUtils.showShort(R.string.please_select_one_data_item); |
||||||
|
return; |
||||||
|
} |
||||||
|
Intent intent = new Intent(); |
||||||
|
intent.putExtra(RESULT_POINT_ID, record.id); |
||||||
|
intent.putExtra(RESULT_INDEX, row); |
||||||
|
intent.putExtra(RESULT_NAME, record.name); |
||||||
|
intent.putExtra(RESULT_X, record.x); |
||||||
|
intent.putExtra(RESULT_Y, record.y); |
||||||
|
intent.putExtra(RESULT_Z, record.h); |
||||||
|
setResult(RESULT_OK, intent); |
||||||
|
finish(); |
||||||
|
}); |
||||||
|
binding.pointsLibraryBtnNewCreate.setOnClickListener(v -> showPointDialog(null, getString(R.string.new_point))); |
||||||
|
|
||||||
|
boolean isSelect = getIntent().getBooleanExtra(KEY_IS_SELECT, true); |
||||||
|
|
||||||
|
if (isSelect) { |
||||||
|
binding.pointsLibraryBtnConfirm.setVisibility(View.VISIBLE); |
||||||
|
binding.pointsLibraryBtnDelete.setVisibility(View.GONE); |
||||||
|
binding.pointsLibraryBtnMore.setVisibility(View.GONE); |
||||||
|
} else { |
||||||
|
binding.pointsLibraryBtnConfirm.setVisibility(View.GONE); |
||||||
|
binding.pointsLibraryBtnDelete.setVisibility(View.VISIBLE); |
||||||
|
binding.pointsLibraryBtnMore.setVisibility(View.VISIBLE); |
||||||
|
} |
||||||
|
binding.etEnterNameCode.addTextChangedListener(new SimpleTextWatcher() { |
||||||
|
@Override |
||||||
|
public void afterTextChanged(Editable s) { |
||||||
|
filterHandler.onFilterStringChanged(s.toString()); |
||||||
|
} |
||||||
|
}); |
||||||
|
binding.pointsLibraryBtnFilter.setOnClickListener(v -> { |
||||||
|
PointFilterActivity.startFilter(StakingNewJobActivity.this, false, |
||||||
|
filterParameter.getNeedSurvey(), filterParameter.getNeedInput(), filterParameter.getNeedControl(), |
||||||
|
filterParameter.getDateStart(), filterParameter.getDateEnd(), |
||||||
|
filterParameter.getNameKey(), filterParameter.getCodeKey(), filterParameter.getRemarkKey(), |
||||||
|
(needSurvey, needInput, needControl, dateStart, dateEnd, nameKey, codeKey, remarksKey) -> { |
||||||
|
filterParameter.setNeedSurvey(needSurvey); |
||||||
|
filterParameter.setNeedInput(needInput); |
||||||
|
filterParameter.setNeedControl(needControl); |
||||||
|
filterParameter.setDateStart(dateStart); |
||||||
|
filterParameter.setDateEnd(dateEnd); |
||||||
|
filterParameter.setNameKey(nameKey); |
||||||
|
filterParameter.setCodeKey(codeKey); |
||||||
|
filterParameter.setRemarkKey(remarksKey); |
||||||
|
ThreadPoolUtil.execute(() -> { |
||||||
|
String projectId = CachedProject.currentProjectId(); |
||||||
|
jobId = CachedCurrentJob.currentJobId(projectId); |
||||||
|
ThreadPoolUtil.executeInMain(() -> { |
||||||
|
pagingDataLiveData.removeObservers(this); |
||||||
|
pagingDataLiveData = |
||||||
|
PagingLiveData.cachedIn(PagingLiveData.getLiveData(pager), getLifecycle()); |
||||||
|
pagingDataLiveData.observe(this, downloadRecordPagingData -> { |
||||||
|
refreshAdapter(downloadRecordPagingData); |
||||||
|
}); |
||||||
|
}); |
||||||
|
}); |
||||||
|
}); |
||||||
|
}); |
||||||
|
|
||||||
|
binding.pointsLibraryBtnNewCreate.setOnClickListener(v -> { |
||||||
|
showPointDialog(null, getString(R.string.new_point)); |
||||||
|
}); |
||||||
|
|
||||||
|
binding.pointsLibraryBtnDelete.setOnClickListener(v -> { |
||||||
|
int row = stakingPointLibraryAdapter.getSelItemPos(); |
||||||
|
PointRecord record = stakingPointLibraryAdapter.getSelItem(); |
||||||
|
if (record == null) { |
||||||
|
ToastUtils.showShort(R.string.please_select_one_data_item); |
||||||
|
return; |
||||||
|
} |
||||||
|
//删除所选数据
|
||||||
|
if (StringUtil.isEmpty(record.id)) { |
||||||
|
return; |
||||||
|
} |
||||||
|
BcDialogExt.create().showMessage(getString(R.string.warning), getString(R.string.want_to_delete_point_library), getString(R.string.confirm), getString(R.string.cancel), (baseDialog, view) -> { |
||||||
|
//删除数据库中数据
|
||||||
|
ThreadPoolUtil.execute(() -> { |
||||||
|
PointDb.getInstance().deleteById(record.id); |
||||||
|
}); |
||||||
|
setResult(LauncherEvent.launcher_delete_point_lib); |
||||||
|
return false; |
||||||
|
}, (baseDialog, view) -> false); |
||||||
|
}); |
||||||
|
|
||||||
|
binding.pointsLibraryBtnMore.setOnClickListener(v -> { |
||||||
|
com.kongzue.dialogx.dialogs.CustomDialog.show(new OnBindView<com.kongzue.dialogx.dialogs.CustomDialog>(R.layout.layout_menu_more) { |
||||||
|
|
||||||
|
private TextView tvImport; |
||||||
|
private TextView tvExport; |
||||||
|
private TextView tvEdit; |
||||||
|
|
||||||
|
@Override |
||||||
|
public void onBind(final com.kongzue.dialogx.dialogs.CustomDialog dialog, View v) { |
||||||
|
if (((App) Utils.getApp()).isThemeDark) { |
||||||
|
v.setBackground(getDrawable(R.drawable.round_dark)); |
||||||
|
} |
||||||
|
tvImport = v.findViewById(R.id.tv_import); |
||||||
|
tvExport = v.findViewById(R.id.tv_export); |
||||||
|
tvEdit = v.findViewById(R.id.tv_edit); |
||||||
|
tvExport.setVisibility(View.GONE); |
||||||
|
tvImport.setOnClickListener(v12 -> { |
||||||
|
showImportConfigDialog(); |
||||||
|
dialog.dismiss(); |
||||||
|
}); |
||||||
|
tvEdit.setOnClickListener(v1 -> { |
||||||
|
int row = stakingPointLibraryAdapter.getSelItemPos(); |
||||||
|
PointRecord record = stakingPointLibraryAdapter.getSelItem(); |
||||||
|
if (record == null) { |
||||||
|
ToastUtils.showShort(R.string.please_select_one_data_item); |
||||||
|
return; |
||||||
|
} |
||||||
|
showPointDialog(record, getString(R.string.edit_known_point)); |
||||||
|
dialog.dismiss(); |
||||||
|
}); |
||||||
|
} |
||||||
|
}) |
||||||
|
.setCancelable(false) |
||||||
|
.setCancelable(true) |
||||||
|
.setEnterAnimResId(R.anim.anim_dialogx_bottom_enter) |
||||||
|
.setExitAnimResId(R.anim.anim_dialogx_bottom_exit) |
||||||
|
.setAlignBaseViewGravity( |
||||||
|
binding.pointsLibraryBtnMore, |
||||||
|
Gravity.TOP | Gravity.RIGHT |
||||||
|
) |
||||||
|
.setBaseViewMarginLeft(ConvertUtils.dp2px(-126f)) |
||||||
|
.show(); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void initData() { |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
private PagingSource<Integer, PointRecord> dataSourse() { |
||||||
|
return PointDb.getInstance().rawQueryPagingSource(StakingPointsLibraryActivitySQLiteUtils.searchSQLit( |
||||||
|
jobId, |
||||||
|
filterParameter, true, binding.etEnterNameCode.getText().toString().trim() |
||||||
|
)); |
||||||
|
} |
||||||
|
|
||||||
|
private List<PointRecord> getAllPoint() { |
||||||
|
return PointDb.getInstance().rawQueryListData(StakingPointsLibraryActivitySQLiteUtils.searchSQLit( |
||||||
|
jobId, |
||||||
|
filterParameter, true, binding.etEnterNameCode.getText().toString().trim() |
||||||
|
)); |
||||||
|
} |
||||||
|
|
||||||
|
private MaterialEditText met_name, met_code, met_x, met_y, met_z, met_remarks; |
||||||
|
private MDButton mPositiveAction; |
||||||
|
|
||||||
|
public void showPointDialog(final PointRecord pointRecord, String title) { |
||||||
|
MaterialDialog dialog = new MaterialDialog.Builder(this) |
||||||
|
.title(title) |
||||||
|
.customView(R.layout.dialog_new_staking_point, false) |
||||||
|
.onPositive((dialog1, which) -> { |
||||||
|
ThreadPoolUtil.execute(() -> { |
||||||
|
PointRecord record = pointRecord; |
||||||
|
if (record != null) { |
||||||
|
record.name = met_name.getText().toString().trim(); |
||||||
|
record.code = met_code.getText().toString().trim(); |
||||||
|
record.x = "".equals(met_x.getText().toString().trim()) ? 0 : Double.parseDouble(met_x.getText().toString().trim()); |
||||||
|
record.y = "".equals(met_y.getText().toString().trim()) ? 0 : Double.parseDouble(met_y.getText().toString().trim()); |
||||||
|
record.h = "".equals(met_z.getText().toString().trim()) ? 0 : Double.parseDouble(met_z.getText().toString().trim()); |
||||||
|
record.remarks = met_remarks.getText().toString().trim(); |
||||||
|
} else { |
||||||
|
String projectId = CachedProject.currentProjectId(); |
||||||
|
jobId = CachedCurrentJob.currentJobId(projectId); |
||||||
|
record = new PointRecord(projectId, jobId, "", |
||||||
|
PointConstants.POINT_TYPE_KNOWN_POINT, |
||||||
|
met_name.getText().toString().trim(), |
||||||
|
met_code.getText().toString().trim(), |
||||||
|
met_remarks.getText().toString().trim(), |
||||||
|
"".equals(met_x.getText().toString().trim()) ? 0 : Double.parseDouble(met_x.getText().toString().trim()), |
||||||
|
"".equals(met_y.getText().toString().trim()) ? 0 : Double.parseDouble(met_y.getText().toString().trim()), |
||||||
|
"".equals(met_z.getText().toString().trim()) ? 0 : Double.parseDouble(met_z.getText().toString().trim()), |
||||||
|
0, 0, 0, |
||||||
|
PointConstants.POINT_FORMAT_XYZ, null); |
||||||
|
} |
||||||
|
PointDb.getInstance().save(record); |
||||||
|
}); |
||||||
|
CommonUtils.hideSoftInput(); |
||||||
|
}) |
||||||
|
.positiveText(this.getString(R.string.save)) |
||||||
|
.negativeText(this.getString(R.string.cancel)).build(); |
||||||
|
|
||||||
|
met_name = dialog.getCustomView().findViewById(R.id.met_dialog_new_staking_point_name); |
||||||
|
met_code = dialog.getCustomView().findViewById(R.id.met_dialog_new_staking_point_code); |
||||||
|
met_x = dialog.getCustomView().findViewById(R.id.met_dialog_new_staking_point_x); |
||||||
|
met_y = dialog.getCustomView().findViewById(R.id.met_dialog_new_staking_point_y); |
||||||
|
met_z = dialog.getCustomView().findViewById(R.id.met_dialog_new_staking_point_z); |
||||||
|
met_remarks = dialog.getCustomView().findViewById(R.id.met_dialog_new_staking_point_remarks); |
||||||
|
mPositiveAction = dialog.getActionButton(DialogAction.POSITIVE); |
||||||
|
|
||||||
|
initMaterialEditTextColor(); |
||||||
|
|
||||||
|
if (pointRecord != null) { |
||||||
|
met_name.setText(pointRecord.name); |
||||||
|
met_code.setText(pointRecord.code); |
||||||
|
met_x.setText(Util.formatDouble2StringDotAuto(pointRecord.x)); |
||||||
|
met_y.setText(Util.formatDouble2StringDotAuto(pointRecord.y)); |
||||||
|
met_z.setText(Util.formatDouble2StringDotAuto(pointRecord.h)); |
||||||
|
met_remarks.setText(pointRecord.remarks); |
||||||
|
} |
||||||
|
|
||||||
|
TextWatcher watcher = new TextWatcher() { |
||||||
|
@Override |
||||||
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) { |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void onTextChanged(CharSequence s, int start, int before, int count) { |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void afterTextChanged(Editable s) { |
||||||
|
String name_text = met_name.getText().toString().trim(); |
||||||
|
String x_text = met_x.getText().toString().trim(); |
||||||
|
String y_text = met_y.getText().toString().trim(); |
||||||
|
String z_text = met_z.getText().toString().trim(); |
||||||
|
|
||||||
|
if (!"".equals(name_text) |
||||||
|
&& !"-".equals(x_text) |
||||||
|
&& !"-".equals(y_text) |
||||||
|
&& !"-".equals(z_text) |
||||||
|
&& !".".equals(x_text) |
||||||
|
&& !".".equals(y_text) |
||||||
|
&& !".".equals(z_text) |
||||||
|
&& !"-.".equals(x_text) |
||||||
|
&& !"-.".equals(y_text) |
||||||
|
&& !"-.".equals(z_text) |
||||||
|
&& !("".equals(x_text) && "".equals(y_text) && "".equals(z_text))) { |
||||||
|
mPositiveAction.setEnabled(true); |
||||||
|
} else { |
||||||
|
mPositiveAction.setEnabled(false); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
}; |
||||||
|
met_name.addTextChangedListener(watcher); |
||||||
|
met_code.addTextChangedListener(watcher); |
||||||
|
met_x.addTextChangedListener(watcher); |
||||||
|
met_y.addTextChangedListener(watcher); |
||||||
|
met_z.addTextChangedListener(watcher); |
||||||
|
met_remarks.addTextChangedListener(watcher); |
||||||
|
|
||||||
|
dialog.show(); |
||||||
|
mPositiveAction.setEnabled(false); |
||||||
|
} |
||||||
|
|
||||||
|
private void initMaterialEditTextColor() { |
||||||
|
if (((App) Utils.getApp()).isThemeDark) { |
||||||
|
met_name.setMetTextColor(Color.WHITE); |
||||||
|
met_x.setMetTextColor(Color.WHITE); |
||||||
|
met_y.setMetTextColor(Color.WHITE); |
||||||
|
met_z.setMetTextColor(Color.WHITE); |
||||||
|
|
||||||
|
met_name.setPrimaryColor(Color.LTGRAY); |
||||||
|
met_x.setPrimaryColor(Color.LTGRAY); |
||||||
|
met_y.setPrimaryColor(Color.LTGRAY); |
||||||
|
met_z.setPrimaryColor(Color.LTGRAY); |
||||||
|
|
||||||
|
met_name.setFocusFraction(1.0f); |
||||||
|
met_x.setFocusFraction(1.0f); |
||||||
|
met_y.setFocusFraction(1.0f); |
||||||
|
met_z.setFocusFraction(1.0f); |
||||||
|
|
||||||
|
met_name.setMetHintTextColor(Color.GRAY); |
||||||
|
met_x.setMetHintTextColor(Color.GRAY); |
||||||
|
met_y.setMetHintTextColor(Color.GRAY); |
||||||
|
met_z.setMetHintTextColor(Color.GRAY); |
||||||
|
|
||||||
|
met_name.setUnderlineColor(Color.GRAY); |
||||||
|
met_x.setUnderlineColor(Color.GRAY); |
||||||
|
met_y.setUnderlineColor(Color.GRAY); |
||||||
|
met_z.setUnderlineColor(Color.GRAY); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private void showImportConfigDialog() { |
||||||
|
new MaterialDialog.Builder(this) |
||||||
|
.title(R.string.please_choose_import_format) |
||||||
|
.items(new String[]{getString(R.string.excel_xls) |
||||||
|
, getString(R.string.text_txt) |
||||||
|
, getString(R.string.cass_dat_txt)}) |
||||||
|
.itemsCallback(new MaterialDialog.ListCallback() { |
||||||
|
@Override |
||||||
|
public void onSelection(MaterialDialog dialog, View itemView, int which, CharSequence text) { |
||||||
|
String[] filter = null; |
||||||
|
int intentResultNumber = EX_FILE_PICKER_RESULT_SURVEYOR_EXCEL; |
||||||
|
String message = ""; |
||||||
|
switch (which) { |
||||||
|
case 0: |
||||||
|
filter = new String[]{"xls", "xlsx"}; |
||||||
|
intentResultNumber = EX_FILE_PICKER_RESULT_SURVEYOR_EXCEL; |
||||||
|
message = getString(R.string.import_point_excel_guide); |
||||||
|
break; |
||||||
|
case 1: |
||||||
|
filter = new String[]{"txt"}; |
||||||
|
intentResultNumber = EX_FILE_PICKER_RESULT_SURVEYOR_TXT; |
||||||
|
message = getString(R.string.import_point_text_guide); |
||||||
|
break; |
||||||
|
case 2: |
||||||
|
showImportCassXYDialog(); |
||||||
|
return; |
||||||
|
} |
||||||
|
if (filter != null) { |
||||||
|
final int finalIntentResultNumber = intentResultNumber; |
||||||
|
final String[] finalFilter = filter; |
||||||
|
new AlertDialog.Builder(StakingNewJobActivity.this) |
||||||
|
.setTitle(R.string.import_points) |
||||||
|
.setMessage(message) |
||||||
|
.setPositiveButton(R.string.overwrite_import, new DialogInterface.OnClickListener() { |
||||||
|
@Override |
||||||
|
public void onClick(DialogInterface dialog, int which) { |
||||||
|
isOverrideImport = true; |
||||||
|
selectFolder(finalIntentResultNumber, finalFilter); |
||||||
|
} |
||||||
|
}) |
||||||
|
.setNegativeButton(R.string.additional_import, new DialogInterface.OnClickListener() { |
||||||
|
@Override |
||||||
|
public void onClick(DialogInterface dialog, int which) { |
||||||
|
isOverrideImport = false; |
||||||
|
selectFolder(finalIntentResultNumber, finalFilter); |
||||||
|
} |
||||||
|
}) |
||||||
|
.setNeutralButton(R.string.view_sample, new DialogInterface.OnClickListener() { |
||||||
|
@Override |
||||||
|
public void onClick(DialogInterface dialog, int which) { |
||||||
|
// Intent intent = new Intent();
|
||||||
|
// intent.setClass(Utils.getApp(), AgentWebActivity.class);
|
||||||
|
// intent.putExtra("short_url", "android_url_import_point_sample");
|
||||||
|
// startActivity(intent);
|
||||||
|
AgentWebActivity.navigation2( |
||||||
|
StakingNewJobActivity.this, |
||||||
|
"android_url_import_point_sample"); |
||||||
|
} |
||||||
|
}) |
||||||
|
.show(); |
||||||
|
} |
||||||
|
} |
||||||
|
}).show(); |
||||||
|
} |
||||||
|
|
||||||
|
private void selectFolder(final int intentResultNumber, final String[] filter) { |
||||||
|
ExFilePicker exFilePicker = new ExFilePicker(); |
||||||
|
exFilePicker.setLandscape(((App) Utils.getApp()).isLandscape()); |
||||||
|
exFilePicker.setShowOnlyExtensions(filter); |
||||||
|
exFilePicker.start(StakingNewJobActivity.this, intentResultNumber); |
||||||
|
} |
||||||
|
|
||||||
|
private boolean isOverrideImport; |
||||||
|
private boolean cassXY = false;//cass格式按照xy排序,否则yx排序
|
||||||
|
|
||||||
|
@Override |
||||||
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) { |
||||||
|
super.onActivityResult(requestCode, resultCode, data); |
||||||
|
if (resultCode == Activity.RESULT_OK) { |
||||||
|
if (data != null) { |
||||||
|
ExFilePickerResult object = ExFilePickerResult.getFromIntent(data); |
||||||
|
if (object != null && object.getCount() > 0) { |
||||||
|
ThreadPoolUtil.execute(() -> { |
||||||
|
String projectId = CachedProject.currentProjectId(); |
||||||
|
jobId = CachedCurrentJob.currentJobId(projectId); |
||||||
|
try { |
||||||
|
String path = object.getPath() + object.getNames().get(0); |
||||||
|
String result = null; |
||||||
|
switch (requestCode) { |
||||||
|
case EX_FILE_PICKER_RESULT_SURVEYOR_EXCEL: |
||||||
|
result = PointLibraryUtil.importStakingJobPointExcel(new File(path), projectId, jobId, isOverrideImport); |
||||||
|
break; |
||||||
|
case EX_FILE_PICKER_RESULT_SURVEYOR_TXT: |
||||||
|
result = PointLibraryUtil.importStakingJobPointTxt(new File(path), projectId, jobId, isOverrideImport); |
||||||
|
break; |
||||||
|
case EX_FILE_PICKER_RESULT_CASS_DAT: |
||||||
|
result = PointLibraryUtil.importStakingJobPointCassDat(new File(path), projectId, jobId, isOverrideImport, cassXY); |
||||||
|
break; |
||||||
|
} |
||||||
|
if (result != null) ToastUtils.showShort(result); |
||||||
|
} catch (Exception e) { |
||||||
|
Log.e("StakingNewJobActivity", "File select error", e); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private void showImportCassXYDialog() { |
||||||
|
cassXY = false; |
||||||
|
String message; |
||||||
|
if (cassXY) { |
||||||
|
message = getString(R.string.import_point_cass_xy_dat); |
||||||
|
} else { |
||||||
|
message = getString(R.string.import_point_cass_yx_dat); |
||||||
|
} |
||||||
|
new AlertDialog.Builder(StakingNewJobActivity.this) |
||||||
|
.setTitle(R.string.import_points) |
||||||
|
.setMessage(message) |
||||||
|
.setPositiveButton(R.string.overwrite_import, new DialogInterface.OnClickListener() { |
||||||
|
@Override |
||||||
|
public void onClick(DialogInterface dialog, int which) { |
||||||
|
isOverrideImport = true; |
||||||
|
selectFolder(EX_FILE_PICKER_RESULT_CASS_DAT, new String[]{"dat", "txt"}); |
||||||
|
} |
||||||
|
}) |
||||||
|
.setNegativeButton(R.string.additional_import, new DialogInterface.OnClickListener() { |
||||||
|
@Override |
||||||
|
public void onClick(DialogInterface dialog, int which) { |
||||||
|
isOverrideImport = false; |
||||||
|
selectFolder(EX_FILE_PICKER_RESULT_CASS_DAT, new String[]{"dat", "txt"}); |
||||||
|
} |
||||||
|
}) |
||||||
|
.setNeutralButton(R.string.view_sample, (dialog, which) -> AgentWebActivity.navigation2( |
||||||
|
StakingNewJobActivity.this, |
||||||
|
"android_url_import_point_sample")) |
||||||
|
.show(); |
||||||
|
} |
||||||
|
|
||||||
|
protected void onCommonRightClicked(View view) { |
||||||
|
if (stakingPointLibraryAdapter.getItemCount() != 0) { |
||||||
|
new CustomDialog.Builder(this) |
||||||
|
.setContent(getString(R.string.want_to_empty_point_library)) |
||||||
|
.setButtonConfirm(v -> |
||||||
|
ThreadPoolUtil.execute(() -> { |
||||||
|
stakingPointLibraryAdapter.clear(getAllPoint()); |
||||||
|
runOnUiThread(() -> setResult(LauncherEvent.launcher_delete_point_lib)); |
||||||
|
})) |
||||||
|
.create().show(); |
||||||
|
} else { |
||||||
|
ToastUtils.showShort(getString(R.string.no_data_clear)); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public static void start(Context context) { |
||||||
|
Intent intent = new Intent(context, StakingNewJobActivity.class); |
||||||
|
intent.putExtra(KEY_IS_SELECT, false); |
||||||
|
context.startActivity(intent); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public BubblePopWindow newBubblePopWindow(Context context) { |
||||||
|
return new BubblePopWindow(this, Arrays.asList(new BubblePopWindow.CustomMenuItem(R.drawable.icon_function_delete, getString(R.string.clear), () -> { |
||||||
|
if (stakingPointLibraryAdapter.getItemCount() != 0) { |
||||||
|
BcDialogExt.create().showMessageWithTick(getString(R.string.warning), getString(R.string.want_to_empty_point_library), getString(R.string.confirm), getString(R.string.cancel), (baseDialog, view) -> { |
||||||
|
ThreadPoolUtil.execute(() -> { |
||||||
|
stakingPointLibraryAdapter.clear(getAllPoint()); |
||||||
|
runOnUiThread(() -> setResult(LauncherEvent.launcher_delete_point_lib)); |
||||||
|
}); |
||||||
|
return false; |
||||||
|
}, (baseDialog, view) -> false); |
||||||
|
} else { |
||||||
|
ToastUtils.showShort(getString(R.string.no_data_clear)); |
||||||
|
} |
||||||
|
}))); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public boolean isHideHelpDoc() { |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
public static void pickPoint(FragmentActivity context, ICallback callback) { |
||||||
|
pickPoint(context, (pointId, index, name, x, y, z) -> callback.onPicked(name, x, y, z)); |
||||||
|
} |
||||||
|
|
||||||
|
public static void pickPoint(FragmentActivity context, ICallbackWithIndex callback) { |
||||||
|
Intent intent = new Intent(context, StakingNewJobActivity.class); |
||||||
|
intent.putExtra(KEY_IS_SELECT, true); |
||||||
|
ActivityUtils.startActivityForResults(context, intent, result -> { |
||||||
|
if (result.getResultCode() == RESULT_OK && result.getData() != null) { |
||||||
|
String pointId = result.getData().getStringExtra(RESULT_POINT_ID); |
||||||
|
int index = result.getData().getIntExtra(RESULT_INDEX, -1); |
||||||
|
String name = result.getData().getStringExtra(RESULT_NAME); |
||||||
|
double x = result.getData().getDoubleExtra(RESULT_X, 0); |
||||||
|
double y = result.getData().getDoubleExtra(RESULT_Y, 0); |
||||||
|
double z = result.getData().getDoubleExtra(RESULT_Z, 0); |
||||||
|
if (callback != null) { |
||||||
|
callback.onPicked(pointId, index, name, x, y, z); |
||||||
|
} |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
public interface ICallback { |
||||||
|
void onPicked(String name, double x, double y, double z); |
||||||
|
} |
||||||
|
|
||||||
|
public interface ICallbackWithIndex { |
||||||
|
void onPicked(String pointId, int index, String name, double x, double y, double z); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void onDestroy() { |
||||||
|
try { |
||||||
|
binding.bodyNameRv.removeOnScrollListener(leftScrollListener); |
||||||
|
binding.bodyRv.removeOnScrollListener(rightScrollListener); |
||||||
|
leftScrollListener = null; |
||||||
|
rightScrollListener = null; |
||||||
|
} catch (Exception e) { |
||||||
|
e.printStackTrace(); |
||||||
|
} |
||||||
|
super.onDestroy(); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,139 @@ |
|||||||
|
package com.project.survey.ui.instrument.setupstation.adapter |
||||||
|
|
||||||
|
import android.content.Context |
||||||
|
import android.graphics.Color |
||||||
|
import android.os.Bundle |
||||||
|
import android.view.LayoutInflater |
||||||
|
import android.view.View |
||||||
|
import android.view.ViewGroup |
||||||
|
import androidx.paging.PagingDataAdapter |
||||||
|
import androidx.recyclerview.widget.DiffUtil |
||||||
|
import androidx.recyclerview.widget.RecyclerView |
||||||
|
import com.bingce.data.database.PointDb |
||||||
|
import com.bingce.data.surveyor.surveydata.pointsurvey.PointRecord |
||||||
|
import com.bingce.utils.DateUtils |
||||||
|
import com.bingce.utils.Util |
||||||
|
import com.project.survey.databinding.ItemStakingPointLibraryBinding |
||||||
|
import com.project.survey.databinding.ItemStakingPointNameLibraryBinding |
||||||
|
import com.project.survey.ui.instrument.setupstation.ControlPointsActivity |
||||||
|
|
||||||
|
class ControlPointLibraryAdapter(diffCallback: DiffUtil.ItemCallback<ControlPointsActivity.DATA>, val context: Context, private val onlyPointName:Boolean): PagingDataAdapter<ControlPointsActivity.DATA,ControlPointLibraryAdapter.BaseVH>(diffCallback) { |
||||||
|
private var mSelItemPos = -1 |
||||||
|
fun setSelItemPos(pos:Int){ |
||||||
|
mSelItemPos = pos |
||||||
|
notifyDataSetChanged() |
||||||
|
} |
||||||
|
fun getSelItemPos():Int{ |
||||||
|
return mSelItemPos |
||||||
|
} |
||||||
|
fun getSelItem():ControlPointsActivity.DATA?{ |
||||||
|
if (mSelItemPos == -1) return null |
||||||
|
return getItem(mSelItemPos) |
||||||
|
} |
||||||
|
fun resetConfig(){ |
||||||
|
mSelItemPos = -1 |
||||||
|
} |
||||||
|
fun item(index:Int):ControlPointsActivity.DATA?{ |
||||||
|
return getItem(index) |
||||||
|
} |
||||||
|
//clear全局控制点 |
||||||
|
// fun clear(){ |
||||||
|
// ThreadPoolUtil.execute { |
||||||
|
// val list = ArrayList<PointRecord>() |
||||||
|
// (0 until itemCount).forEach { |
||||||
|
// getItem(it)?.let { it1 -> list.add(it1.pointRecord) } |
||||||
|
// } |
||||||
|
// mSelItemPos = -1 |
||||||
|
// PointDb.getInstance().delete(list) |
||||||
|
// } |
||||||
|
// } |
||||||
|
fun clear(pointRecords:List<PointRecord>){ |
||||||
|
mSelItemPos = -1 |
||||||
|
PointDb.getInstance().delete(pointRecords) |
||||||
|
} |
||||||
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BaseVH { |
||||||
|
return if (onlyPointName){ |
||||||
|
VH2(ItemStakingPointNameLibraryBinding.inflate(LayoutInflater.from(context),parent,false)) |
||||||
|
}else { |
||||||
|
VH( |
||||||
|
ItemStakingPointLibraryBinding.inflate( |
||||||
|
LayoutInflater.from(context), |
||||||
|
parent, |
||||||
|
false |
||||||
|
) |
||||||
|
) |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
// override fun getItemCount(): Int { |
||||||
|
// return arrayList.size |
||||||
|
// } |
||||||
|
|
||||||
|
override fun onBindViewHolder(holder: BaseVH, position: Int) { |
||||||
|
getItem(position)?.let { holder.update(it) } |
||||||
|
} |
||||||
|
|
||||||
|
override fun onBindViewHolder(holder: BaseVH, position: Int, payloads: MutableList<Any>) { |
||||||
|
if (payloads.isEmpty()){ |
||||||
|
onBindViewHolder(holder,position) |
||||||
|
}else{ |
||||||
|
val bundle = payloads[0] |
||||||
|
getItem(position)?.let { holder.updatePart(it,bundle as Bundle) } |
||||||
|
} |
||||||
|
} |
||||||
|
inner class VH2(val vb: ItemStakingPointNameLibraryBinding): BaseVH(vb.root) { |
||||||
|
override fun update(data: ControlPointsActivity.DATA) { |
||||||
|
if (data.pointRecord == null) return |
||||||
|
vb.tvName.text = data.pointRecord.name |
||||||
|
if (mSelItemPos == absoluteAdapterPosition){ |
||||||
|
vb.root.setBackgroundColor(Color.rgb(226, 236, 215)) |
||||||
|
}else{ |
||||||
|
vb.root.background = null |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
override fun updatePart(data: ControlPointsActivity.DATA, bundle: Bundle) { |
||||||
|
for (key in bundle.keySet()) { |
||||||
|
val value = bundle.getString(key)?:"" |
||||||
|
when (key) { |
||||||
|
"name"-> vb.tvName.text = value |
||||||
|
else -> {} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
inner class VH(val vb: ItemStakingPointLibraryBinding): BaseVH(vb.root) { |
||||||
|
override fun update(data: ControlPointsActivity.DATA) { |
||||||
|
if (data.pointRecord == null) return |
||||||
|
vb.tvCode.text = data.pointRecord.code |
||||||
|
vb.tvX.text = Util.formatDouble2StringDotAuto(data.pointRecord.x) |
||||||
|
vb.tvY.text = Util.formatDouble2StringDotAuto(data.pointRecord.y) |
||||||
|
vb.tvH.text = Util.formatDouble2StringDotAuto(data.pointRecord.h) |
||||||
|
vb.tvTime.text = DateUtils.toFull(data.pointRecord.createDate) |
||||||
|
vb.tvRemark.text = data.pointRecord.remarks |
||||||
|
if (mSelItemPos == absoluteAdapterPosition){ |
||||||
|
vb.root.setBackgroundColor(Color.rgb(226, 236, 215)) |
||||||
|
}else{ |
||||||
|
vb.root.background = null |
||||||
|
} |
||||||
|
} |
||||||
|
override fun updatePart(data: ControlPointsActivity.DATA, bundle: Bundle) { |
||||||
|
for (key in bundle.keySet()) { |
||||||
|
val value = bundle.getString(key)?:"" |
||||||
|
when (key) { |
||||||
|
"code"-> vb.tvCode.text = value |
||||||
|
"x"->vb.tvX.text = value |
||||||
|
"y"->vb.tvY.text = value |
||||||
|
"h"->vb.tvH.text = value |
||||||
|
"time"->vb.tvTime.text = value |
||||||
|
else -> {} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
abstract class BaseVH(val view: View):RecyclerView.ViewHolder(view){ |
||||||
|
abstract fun update(data:ControlPointsActivity.DATA) |
||||||
|
abstract fun updatePart(data: ControlPointsActivity.DATA, bundle: Bundle) |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,125 @@ |
|||||||
|
package com.project.survey.ui.instrument.setupstation.adapter |
||||||
|
|
||||||
|
import android.content.Context |
||||||
|
import android.graphics.Color |
||||||
|
import android.os.Bundle |
||||||
|
import android.view.LayoutInflater |
||||||
|
import android.view.View |
||||||
|
import android.view.ViewGroup |
||||||
|
import androidx.paging.PagingDataAdapter |
||||||
|
import androidx.recyclerview.widget.DiffUtil |
||||||
|
import androidx.recyclerview.widget.RecyclerView |
||||||
|
import com.bingce.data.database.PointDb |
||||||
|
import com.bingce.data.surveyor.surveydata.pointsurvey.PointRecord |
||||||
|
import com.bingce.utils.DateUtils |
||||||
|
import com.bingce.utils.Util |
||||||
|
import com.project.survey.databinding.ItemStakingPointLibraryBinding |
||||||
|
import com.project.survey.databinding.ItemStakingPointNameLibraryBinding |
||||||
|
|
||||||
|
class StakingPointLibraryAdapter(diffCallback: DiffUtil.ItemCallback<PointRecord>, val context: Context, private val onlyPointName:Boolean): PagingDataAdapter<PointRecord,StakingPointLibraryAdapter.BaseVH>(diffCallback) { |
||||||
|
private var mSelItemPos = -1 |
||||||
|
fun setSelItemPos(pos:Int){ |
||||||
|
mSelItemPos = pos |
||||||
|
notifyDataSetChanged() |
||||||
|
} |
||||||
|
fun getSelItemPos():Int{ |
||||||
|
return mSelItemPos |
||||||
|
} |
||||||
|
fun resetConfig(){ |
||||||
|
mSelItemPos = -1 |
||||||
|
} |
||||||
|
fun getSelItem():PointRecord?{ |
||||||
|
if (mSelItemPos == -1) return null |
||||||
|
return getItem(mSelItemPos) |
||||||
|
} |
||||||
|
fun resetSelPos(){ |
||||||
|
mSelItemPos = -1 |
||||||
|
} |
||||||
|
|
||||||
|
fun clear(pointRecords:List<PointRecord>){ |
||||||
|
mSelItemPos = -1 |
||||||
|
PointDb.getInstance().delete(pointRecords) |
||||||
|
} |
||||||
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BaseVH { |
||||||
|
return if (onlyPointName){ |
||||||
|
VH2(ItemStakingPointNameLibraryBinding.inflate(LayoutInflater.from(context),parent,false)) |
||||||
|
}else { |
||||||
|
VH( |
||||||
|
ItemStakingPointLibraryBinding.inflate( |
||||||
|
LayoutInflater.from(context), |
||||||
|
parent, |
||||||
|
false |
||||||
|
) |
||||||
|
) |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
// override fun getItemCount(): Int { |
||||||
|
// return arrayList.size |
||||||
|
// } |
||||||
|
|
||||||
|
override fun onBindViewHolder(holder: BaseVH, position: Int) { |
||||||
|
getItem(position)?.let { holder.update(it) } |
||||||
|
} |
||||||
|
|
||||||
|
override fun onBindViewHolder(holder: BaseVH, position: Int, payloads: MutableList<Any>) { |
||||||
|
if (payloads.isEmpty()){ |
||||||
|
onBindViewHolder(holder,position) |
||||||
|
}else{ |
||||||
|
val bundle = payloads[0] |
||||||
|
getItem(position)?.let { holder.updatePart(it,bundle as Bundle) } |
||||||
|
} |
||||||
|
} |
||||||
|
inner class VH2(val vb: ItemStakingPointNameLibraryBinding): BaseVH(vb.root) { |
||||||
|
override fun update(pointRecord: PointRecord) { |
||||||
|
vb.tvName.text = pointRecord.name |
||||||
|
if (mSelItemPos == absoluteAdapterPosition){ |
||||||
|
vb.root.setBackgroundColor(Color.rgb(226, 236, 215)) |
||||||
|
}else{ |
||||||
|
vb.root.background = null |
||||||
|
} |
||||||
|
} |
||||||
|
override fun updatePart(pointRecord: PointRecord, bundle: Bundle) { |
||||||
|
for (key in bundle.keySet()) { |
||||||
|
val value = bundle.getString(key)?:"" |
||||||
|
when (key) { |
||||||
|
"name"-> vb.tvName.text = value |
||||||
|
else -> {} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
inner class VH(val vb: ItemStakingPointLibraryBinding): BaseVH(vb.root) { |
||||||
|
override fun update(pointRecord: PointRecord) { |
||||||
|
vb.tvCode.text = pointRecord.code |
||||||
|
vb.tvX.text = Util.formatDouble2StringDotAuto(pointRecord.x) |
||||||
|
vb.tvY.text = Util.formatDouble2StringDotAuto(pointRecord.y) |
||||||
|
vb.tvH.text = Util.formatDouble2StringDotAuto(pointRecord.h) |
||||||
|
vb.tvTime.text = DateUtils.toFull(pointRecord.createDate) |
||||||
|
vb.tvRemark.text = pointRecord.remarks |
||||||
|
if (mSelItemPos == absoluteAdapterPosition){ |
||||||
|
vb.root.setBackgroundColor(Color.rgb(226, 236, 215)) |
||||||
|
}else{ |
||||||
|
vb.root.background = null |
||||||
|
} |
||||||
|
} |
||||||
|
override fun updatePart(pointRecord: PointRecord, bundle: Bundle) { |
||||||
|
for (key in bundle.keySet()) { |
||||||
|
val value = bundle.getString(key)?:"" |
||||||
|
when (key) { |
||||||
|
"code"-> vb.tvCode.text = value |
||||||
|
"x"->vb.tvX.text = value |
||||||
|
"y"->vb.tvY.text = value |
||||||
|
"h"->vb.tvH.text = value |
||||||
|
"time"->vb.tvTime.text = value |
||||||
|
else -> {} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
abstract class BaseVH(val view: View):RecyclerView.ViewHolder(view){ |
||||||
|
abstract fun update(pointRecord:PointRecord) |
||||||
|
abstract fun updatePart(pointRecord: PointRecord, bundle: Bundle) |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,34 @@ |
|||||||
|
package com.project.survey.ui.instrument.setupstation.bean; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
|
||||||
|
import cn.liuyanbing.surveyor.model.base.PointArray; |
||||||
|
|
||||||
|
public class StakingJob implements Serializable { |
||||||
|
private static final long serialVersionUID = 202008141046L; |
||||||
|
String name = "Default"; |
||||||
|
private PointArray pointList = new PointArray(); |
||||||
|
|
||||||
|
public StakingJob() { |
||||||
|
} |
||||||
|
|
||||||
|
public StakingJob(String name) { |
||||||
|
this.name = name; |
||||||
|
} |
||||||
|
|
||||||
|
public String getName() { |
||||||
|
return name; |
||||||
|
} |
||||||
|
|
||||||
|
public void setName(String name) { |
||||||
|
this.name = name; |
||||||
|
} |
||||||
|
|
||||||
|
public PointArray getPointList() { |
||||||
|
return pointList; |
||||||
|
} |
||||||
|
|
||||||
|
public void setPointList(PointArray pointList) { |
||||||
|
this.pointList = pointList; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,47 @@ |
|||||||
|
package com.project.survey.ui.instrument.setupstation.callback |
||||||
|
|
||||||
|
import android.os.Bundle |
||||||
|
import android.text.TextUtils |
||||||
|
import androidx.recyclerview.widget.DiffUtil |
||||||
|
import com.bingce.utils.DateUtils |
||||||
|
import com.bingce.utils.Util |
||||||
|
import com.project.survey.ui.instrument.setupstation.ControlPointsActivity |
||||||
|
|
||||||
|
class ControlPointDiffCallback: DiffUtil.ItemCallback<ControlPointsActivity.DATA>() { |
||||||
|
|
||||||
|
override fun areItemsTheSame(oldItem: ControlPointsActivity.DATA, newItem: ControlPointsActivity.DATA): Boolean { |
||||||
|
if (oldItem.pointRecord == null || newItem.pointRecord == null || TextUtils.isEmpty(oldItem.pointRecord.id) || TextUtils.isEmpty(newItem.pointRecord.id)){ |
||||||
|
return false |
||||||
|
} |
||||||
|
return oldItem.pointRecord.id == newItem.pointRecord.id |
||||||
|
} |
||||||
|
|
||||||
|
override fun areContentsTheSame(oldItem: ControlPointsActivity.DATA, newItem: ControlPointsActivity.DATA): Boolean { |
||||||
|
return oldItem == newItem |
||||||
|
} |
||||||
|
|
||||||
|
override fun getChangePayload(oldItem: ControlPointsActivity.DATA, newItem: ControlPointsActivity.DATA): Any? { |
||||||
|
val bundle = Bundle() |
||||||
|
|
||||||
|
if (oldItem.pointRecord.name != newItem.pointRecord.name){ |
||||||
|
bundle.putString("name",newItem.pointRecord.name) |
||||||
|
} |
||||||
|
if (oldItem.pointRecord.code != newItem.pointRecord.code){ |
||||||
|
bundle.putString("code",newItem.pointRecord.code) |
||||||
|
} |
||||||
|
if (oldItem.pointRecord.x != newItem.pointRecord.x){ |
||||||
|
bundle.putString("x", Util.formatDouble2StringDotAuto(newItem.pointRecord.x)) |
||||||
|
} |
||||||
|
if (oldItem.pointRecord.y != newItem.pointRecord.y){ |
||||||
|
bundle.putString("y", Util.formatDouble2StringDotAuto(newItem.pointRecord.y)) |
||||||
|
} |
||||||
|
if (oldItem.pointRecord.h != newItem.pointRecord.h){ |
||||||
|
bundle.putString("h", Util.formatDouble2StringDotAuto(newItem.pointRecord.h)) |
||||||
|
} |
||||||
|
if (oldItem.pointRecord.createDate.time != newItem.pointRecord.createDate.time){ |
||||||
|
bundle.putString("time", DateUtils.toFull(newItem.pointRecord.createDate)) |
||||||
|
} |
||||||
|
if (bundle.size() == 0) return null |
||||||
|
return bundle |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,65 @@ |
|||||||
|
package com.project.survey.ui.instrument.setupstation.db.controlpoint; |
||||||
|
|
||||||
|
public class Constants { |
||||||
|
public static final String DB_NAME_CONFIG = "__configs__"; |
||||||
|
public static final String DB_NAME_USER = "__users__"; |
||||||
|
public static final String DB_NAME_PROJECT = "__projects__"; |
||||||
|
public static final String DB_NAME_PROJECT2 = "__projects_2_"; |
||||||
|
public static final String DB_NAME_PART = "__parts__"; |
||||||
|
public static final String DB_NAME_POINT = "__points__"; |
||||||
|
public static final String DB_NAME_CONTROL_POINT = "__control_points__"; |
||||||
|
public static final String DB_NAME_STAKE_RECORD = "__stake_records__"; |
||||||
|
|
||||||
|
public static final String DB_SQL_SELECT_CONFIG_ALL = "SELECT * FROM " + DB_NAME_CONFIG; |
||||||
|
public static final String DB_SQL_SELECT_CONFIG_BY_ID = "SELECT * FROM " + DB_NAME_CONFIG + " WHERE id =:id"; |
||||||
|
public static final String DB_SQL_COUNT_OF_CONFIG = "SELECT count(*) FROM " + DB_NAME_CONFIG; |
||||||
|
|
||||||
|
public static final String DB_SQL_SELECT_PROJECT_ALL = "SELECT * FROM " + DB_NAME_PROJECT2; |
||||||
|
public static final String DB_SQL_DELETE_PROJECT_ALL = "DELETE FROM " + DB_NAME_PROJECT2; |
||||||
|
public static final String DB_SQL_SELECT_PROJECT_BY_ID = "SELECT * FROM " + DB_NAME_PROJECT2 + " WHERE id =:id"; |
||||||
|
|
||||||
|
public static final String DB_SQL_SELECT_RECORD_ALL = "SELECT * FROM " + DB_NAME_STAKE_RECORD; |
||||||
|
public static final String DB_SQL_SELECT_RECORD_BY_ID = |
||||||
|
"SELECT * FROM " + DB_NAME_STAKE_RECORD + " WHERE id =:id"; |
||||||
|
public static final String DB_SQL_DELETE_RECORD_BY_ID = |
||||||
|
"DELETE FROM " + DB_NAME_STAKE_RECORD + " WHERE id =:id"; |
||||||
|
public static final String DB_SQL_SELECT_RECORD_BY_POSITION_ID = |
||||||
|
"SELECT * FROM " + DB_NAME_STAKE_RECORD + " WHERE position_id =:id"; |
||||||
|
|
||||||
|
public static final String DB_SQL_SELECT_PART_ALL = "SELECT * FROM " + DB_NAME_PART; |
||||||
|
public static final String DB_SQL_SELECT_PART_BY_ID = "SELECT * FROM " + DB_NAME_PART + " WHERE id =:id"; |
||||||
|
public static final String DB_SQL_SELECT_PART_BY_PROJECT_ID = |
||||||
|
"SELECT * FROM " + DB_NAME_PART + " WHERE project_id =:id and parent_id=\"-1\""; |
||||||
|
public static final String DB_SQL_SELECT_PART_BY_PARENT_ID = |
||||||
|
"SELECT * FROM " + DB_NAME_PART + " WHERE parent_id =:id"; |
||||||
|
|
||||||
|
public static final String DB_SQL_SELECT_CONTROL_POINTS_ALL = |
||||||
|
"SELECT * FROM " + DB_NAME_CONTROL_POINT; |
||||||
|
public static final String DB_SQL_SELECT_CONTROL_POINT_BY_ID = |
||||||
|
"SELECT * FROM " + DB_NAME_CONTROL_POINT + " WHERE id =:id"; |
||||||
|
public static final String DB_SQL_SELECT_CONTROL_POINTS_BY_PROJECT_ID = |
||||||
|
"SELECT * FROM " + DB_NAME_CONTROL_POINT + " WHERE project_id =:id"; |
||||||
|
|
||||||
|
public static final String DB_SQL_SELECT_POINT_ALL = "SELECT * FROM " + DB_NAME_POINT; |
||||||
|
public static final String DB_SQL_SELECT_POINT_BY_ID = "SELECT * FROM " + DB_NAME_POINT + " WHERE id =:id"; |
||||||
|
public static final String DB_SQL_SELECT_POINT_BY_PART_ID = "SELECT * FROM " + DB_NAME_POINT + " WHERE position_id =:id order by point_name asc"; |
||||||
|
public static final String DB_SQL_SELECT_POINT_BY_PROJECT_ID = "SELECT * FROM " + DB_NAME_POINT + " WHERE project_id =:id order by point_name asc"; |
||||||
|
public static final String DB_SQL_DELETE_POINT_BY_PROJECT_POSITION = "DELETE FROM " + DB_NAME_POINT + " WHERE ( project_id =:projectId ) AND ( position_id =:positionId)"; |
||||||
|
public static final String DB_SQL_DELETE_POINT_BY_PROJECT = "DELETE FROM " + DB_NAME_POINT + " WHERE ( project_id =:projectId ) "; |
||||||
|
|
||||||
|
public static final String DB_CONFIG_KEY_USER_NAME = "__user_name_new"; |
||||||
|
public static final String DB_CONFIG_KEY_PWD = "__password_new"; |
||||||
|
public static final String DB_CONFIG_KEY_COOKIE = "__cookie"; |
||||||
|
public static final String DB_CONFIG_KEY_LAST_PROJECT = "__last_project__"; |
||||||
|
public static final String DB_CONFIG_KEY_LAST_LOGIN = "__last_login__"; |
||||||
|
|
||||||
|
public static final String API_RET_FLAG = "rtnFlag"; |
||||||
|
public static final String API_RET_MSG = "rtnMessage"; |
||||||
|
public static final String API_RET_OBJ = "rtnObj"; |
||||||
|
public static final String API_RET_FLAG_IS_SUCCESS = "isSuccess"; |
||||||
|
public static final String API_RET_MSG_2 = "rtnMsg"; |
||||||
|
|
||||||
|
|
||||||
|
public static final int MEASURE_TYPE_WORK = 1; |
||||||
|
public static final int MEASURE_TYPE_CHECK = 3; |
||||||
|
} |
@ -0,0 +1,28 @@ |
|||||||
|
package com.project.survey.ui.instrument.setupstation.db.controlpoint; |
||||||
|
|
||||||
|
import androidx.lifecycle.LiveData; |
||||||
|
import androidx.room.Dao; |
||||||
|
import androidx.room.Delete; |
||||||
|
import androidx.room.Insert; |
||||||
|
import androidx.room.OnConflictStrategy; |
||||||
|
import androidx.room.Query; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
@Dao |
||||||
|
public interface ControlPointDao { |
||||||
|
@Query(Constants.DB_SQL_SELECT_CONTROL_POINTS_ALL) |
||||||
|
LiveData<List<ControlPointItem>> getAll(); |
||||||
|
|
||||||
|
@Query(Constants.DB_SQL_SELECT_CONTROL_POINT_BY_ID) |
||||||
|
LiveData<ControlPointItem> find(String id); |
||||||
|
|
||||||
|
@Query(Constants.DB_SQL_SELECT_CONTROL_POINTS_BY_PROJECT_ID) |
||||||
|
LiveData<List<ControlPointItem>> findByProjectId(String id); |
||||||
|
|
||||||
|
@Insert(onConflict = OnConflictStrategy.REPLACE) |
||||||
|
void insertAll(ControlPointItem... tubes); |
||||||
|
|
||||||
|
@Delete |
||||||
|
void delete(ControlPointItem tube); |
||||||
|
} |
@ -0,0 +1,28 @@ |
|||||||
|
package com.project.survey.ui.instrument.setupstation.db.controlpoint; |
||||||
|
|
||||||
|
import androidx.annotation.NonNull; |
||||||
|
import androidx.room.ColumnInfo; |
||||||
|
import androidx.room.Entity; |
||||||
|
import androidx.room.PrimaryKey; |
||||||
|
|
||||||
|
@Entity(tableName = Constants.DB_NAME_CONTROL_POINT) |
||||||
|
public class ControlPointItem { |
||||||
|
@NonNull |
||||||
|
@PrimaryKey |
||||||
|
public String id; |
||||||
|
|
||||||
|
@ColumnInfo(name = "point_name") |
||||||
|
public String pointName; |
||||||
|
|
||||||
|
@ColumnInfo(name = "project_id") |
||||||
|
public String projectId; |
||||||
|
|
||||||
|
@ColumnInfo(name = "x") |
||||||
|
public double X; |
||||||
|
|
||||||
|
@ColumnInfo(name = "y") |
||||||
|
public double Y; |
||||||
|
|
||||||
|
@ColumnInfo(name = "z") |
||||||
|
public double Z; |
||||||
|
} |
@ -0,0 +1,67 @@ |
|||||||
|
package com.project.survey.ui.instrument.setupstation.util; |
||||||
|
|
||||||
|
import android.content.Context; |
||||||
|
|
||||||
|
import androidx.annotation.WorkerThread; |
||||||
|
|
||||||
|
import com.bingce.TimeCount; |
||||||
|
import com.bingce.data.database.KeyValueDb; |
||||||
|
import com.bingce.data.surveyor.designdata.kv.KeyValueRecord; |
||||||
|
import com.bingce.road.xport.RoadAllUtil; |
||||||
|
|
||||||
|
import java.io.File; |
||||||
|
|
||||||
|
public class CollectAndroidDataFolderUtils { |
||||||
|
|
||||||
|
@WorkerThread |
||||||
|
public static boolean collectFromDataFolder(Context appCompatActivity, File dataFolder, CollectLocalDataInAppStartFirstTimeUtil.ILog log, TimeCount.ITimeCounter timeCounter) { |
||||||
|
log.log("检测Data目录下数据"); |
||||||
|
if (!dataFolder.exists()) { |
||||||
|
log.log("Data目录不存在"); |
||||||
|
return false; |
||||||
|
} |
||||||
|
File[] children = dataFolder.listFiles(); |
||||||
|
if (children == null || children.length == 0) { |
||||||
|
log.log("Data目录为空."); |
||||||
|
return false; |
||||||
|
} |
||||||
|
//检测是否有road目录
|
||||||
|
boolean hasRoad = false; |
||||||
|
for (File folder : children) { |
||||||
|
if (RoadAllUtil.isRoadFolder(folder)) { |
||||||
|
hasRoad = true; |
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
if (!hasRoad) { |
||||||
|
log.log("Data目录为空.."); |
||||||
|
return false; |
||||||
|
} |
||||||
|
File mark = new File(dataFolder, CollectLocalDataInAppStartFirstTimeUtil.COLLECTED_FILE_NAME); |
||||||
|
if (mark.exists()) {//已经收集过了
|
||||||
|
log.log("Data目录数据已收集"); |
||||||
|
return true; |
||||||
|
} |
||||||
|
//1.收集全站仪数据
|
||||||
|
_1TotalStationCollectUtils.collect(dataFolder, log); |
||||||
|
//遍历目录
|
||||||
|
File[] projects = dataFolder.listFiles(); |
||||||
|
if (projects == null) { |
||||||
|
log.log("项目数据为空"); |
||||||
|
return false; |
||||||
|
} |
||||||
|
//2.遍历项目目录
|
||||||
|
for (File project : projects) { |
||||||
|
if (!project.exists() || project.isFile()) { |
||||||
|
continue; |
||||||
|
} |
||||||
|
ProjectDbUtils.collect(appCompatActivity, project, log, timeCounter); |
||||||
|
} |
||||||
|
//生成收集标识
|
||||||
|
if (!CollectLocalDataInAppStartFirstTimeUtil.generatorCollectedFile(dataFolder)) { |
||||||
|
KeyValueDb.getInstance().save(new KeyValueRecord()); |
||||||
|
} |
||||||
|
|
||||||
|
return true; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,106 @@ |
|||||||
|
package com.project.survey.ui.instrument.setupstation.util; |
||||||
|
|
||||||
|
import android.content.Context; |
||||||
|
|
||||||
|
import androidx.annotation.WorkerThread; |
||||||
|
|
||||||
|
import com.bingce.TimeCount; |
||||||
|
import com.bingce.data.database.ProjectCoordinateDatabase; |
||||||
|
import com.bingce.data.database.SurveyRecordDatabase; |
||||||
|
import com.bingce.data.database.SyncRecordDatabase; |
||||||
|
import com.bingce.utils.FileUtil; |
||||||
|
import com.bingce.utils.StringUtil; |
||||||
|
import com.hjq.permissions.Permission; |
||||||
|
import com.hjq.permissions.XXPermissions; |
||||||
|
import com.project.survey.R; |
||||||
|
|
||||||
|
import java.io.File; |
||||||
|
import java.io.IOException; |
||||||
|
|
||||||
|
import blankj.utilcode.util.ToastUtils; |
||||||
|
|
||||||
|
/** |
||||||
|
* 应用首次启动时执行的操作 |
||||||
|
*/ |
||||||
|
public class CollectLocalDataInAppStartFirstTimeUtil { |
||||||
|
static final String COLLECTED_FILE_NAME = "collected2"; |
||||||
|
static final String GENERATOR_COLLECTED_FILE_FAILURE = "generator_collect_failure"; |
||||||
|
|
||||||
|
@WorkerThread |
||||||
|
public static void collectData(Context activity, ILog log, TimeCount.ITimeCounter timeCounter) { |
||||||
|
log.log("执行数据库清除"); |
||||||
|
//1.先清除数据库
|
||||||
|
SurveyRecordDatabase.getInstance().clearAllTables(); |
||||||
|
ProjectCoordinateDatabase.getInstance().clearAllTables(); |
||||||
|
SyncRecordDatabase.getInstance().clearAllTables(); |
||||||
|
|
||||||
|
log.log("读取本地数据"); |
||||||
|
//2.开始收集本地数据
|
||||||
|
collect(activity, log, timeCounter); |
||||||
|
} |
||||||
|
|
||||||
|
@WorkerThread |
||||||
|
private static void collect(Context appCompatActivity, ILog log, TimeCount.ITimeCounter timeCounter) { |
||||||
|
//1.优先尝试读取私有目录
|
||||||
|
File appFolder = new File(appCompatActivity.getFilesDir(), "Project"); |
||||||
|
if (!CollectAndroidDataFolderUtils.collectFromDataFolder(appCompatActivity, appFolder, log, timeCounter)) { |
||||||
|
if (XXPermissions.isGranted(appCompatActivity, Permission.MANAGE_EXTERNAL_STORAGE)) { |
||||||
|
//2.尝试读取根目录下数据--如果有权限 ,就尝试收集根目录,否则以后收集
|
||||||
|
collectFromDisk(appCompatActivity, log, timeCounter); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@WorkerThread |
||||||
|
public static void collectFromDisk(Context appCompatActivity, ILog log, TimeCount.ITimeCounter timeCounter) { |
||||||
|
log.log("检测BingCe目录下数据"); |
||||||
|
//1.检测‘BingCe’目录
|
||||||
|
String sdPath = FileUtil.getSDPath(); |
||||||
|
if (StringUtil.isEmpty(sdPath)) { |
||||||
|
log.log("读取手机根目录失败."); |
||||||
|
return; |
||||||
|
} |
||||||
|
File rootFolder = new File(FileUtil.getSDPath()); |
||||||
|
if (!rootFolder.exists()) { |
||||||
|
log.log("读取手机根目录失败.."); |
||||||
|
ToastUtils.showShort("读取手机根目录失败!"); |
||||||
|
return; |
||||||
|
} |
||||||
|
//1.检测冰测目录
|
||||||
|
File bingceFolder = new File(rootFolder, "Bingce"); |
||||||
|
File surveyorFolder = new File(bingceFolder, "Surveyor"); |
||||||
|
File mark = new File(surveyorFolder, COLLECTED_FILE_NAME); |
||||||
|
if (mark.exists() || !surveyorFolder.exists() || !MigrationBingCeFolderDataUtils.collectFromBingCeFolder(appCompatActivity, surveyorFolder, log, timeCounter)) { |
||||||
|
//2.检测‘测量员’目录
|
||||||
|
File celiangyuanFolder = new File(rootFolder, appCompatActivity.getString(R.string.app_name)); |
||||||
|
mark = new File(celiangyuanFolder, COLLECTED_FILE_NAME); |
||||||
|
if (!mark.exists() && celiangyuanFolder.exists()) { |
||||||
|
MigrationCeliangyuanFolderDataUtils.collectFromCeliangyuanFolder(appCompatActivity, celiangyuanFolder, log, timeCounter); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
static boolean generatorCollectedFile(File folder) { |
||||||
|
if (folder.exists()) { |
||||||
|
File tagFile = new File(folder, COLLECTED_FILE_NAME); |
||||||
|
if (!tagFile.exists()) { |
||||||
|
String result = ""; |
||||||
|
try { |
||||||
|
if (!tagFile.createNewFile()) { |
||||||
|
result = "create Failure"; |
||||||
|
} |
||||||
|
} catch (IOException ioException) { |
||||||
|
result = "generatorCollectedFile of " + folder.getAbsolutePath() + " " + ioException.toString(); |
||||||
|
} |
||||||
|
if (!result.isEmpty()) { |
||||||
|
return false; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
public interface ILog { |
||||||
|
void log(String msg); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,71 @@ |
|||||||
|
package com.project.survey.ui.instrument.setupstation.util; |
||||||
|
|
||||||
|
import android.content.Context; |
||||||
|
import android.content.DialogInterface; |
||||||
|
import android.os.CountDownTimer; |
||||||
|
|
||||||
|
import androidx.annotation.StringRes; |
||||||
|
|
||||||
|
import com.afollestad.materialdialogs.DialogAction; |
||||||
|
import com.afollestad.materialdialogs.MaterialDialog; |
||||||
|
import com.afollestad.materialdialogs.internal.MDButton; |
||||||
|
import com.project.survey.R; |
||||||
|
|
||||||
|
|
||||||
|
public class ControlPointsClearDialogUtils { |
||||||
|
private final Context context; |
||||||
|
|
||||||
|
private MDButton mPositiveAction; |
||||||
|
|
||||||
|
public ControlPointsClearDialogUtils(Context context) { |
||||||
|
this.context = context; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public void showClearDialog(ICallback callback) { |
||||||
|
MaterialDialog dialog = new MaterialDialog.Builder(context) |
||||||
|
.title(R.string.warning) |
||||||
|
.content(R.string.confirm_clear_points) |
||||||
|
.positiveText(getString(R.string.clear)) |
||||||
|
.negativeText(getString(R.string.cancel)) |
||||||
|
.onPositive((dialog1, which) -> { |
||||||
|
// isPrjChanged = true;
|
||||||
|
// allControlPoints.clear();
|
||||||
|
// updateRecyclerView();
|
||||||
|
// ToastUtils.showShort(R.string.clean_over);
|
||||||
|
callback.onCleared(); |
||||||
|
}) |
||||||
|
.build(); |
||||||
|
|
||||||
|
mPositiveAction = dialog.getActionButton(DialogAction.POSITIVE); |
||||||
|
mPositiveAction.setEnabled(false); |
||||||
|
final CountDownTimer countDownTimer = new CountDownTimer(5000, 1000) { |
||||||
|
@Override |
||||||
|
public void onTick(long millisUntilFinished) { |
||||||
|
mPositiveAction.setText(getString(R.string.clear) + "(" + millisUntilFinished / 1000 + "s)"); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void onFinish() { |
||||||
|
mPositiveAction.setEnabled(true); |
||||||
|
mPositiveAction.setText(R.string.clear); |
||||||
|
} |
||||||
|
}.start(); |
||||||
|
dialog.setOnDismissListener(new DialogInterface.OnDismissListener() { |
||||||
|
@Override |
||||||
|
public void onDismiss(DialogInterface dialog) { |
||||||
|
countDownTimer.cancel(); |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
dialog.show(); |
||||||
|
} |
||||||
|
|
||||||
|
private String getString(@StringRes int id) { |
||||||
|
return context.getString(id); |
||||||
|
} |
||||||
|
|
||||||
|
public interface ICallback { |
||||||
|
void onCleared(); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,242 @@ |
|||||||
|
package com.project.survey.ui.instrument.setupstation.util; |
||||||
|
|
||||||
|
|
||||||
|
import android.content.Context; |
||||||
|
import android.graphics.Color; |
||||||
|
import android.text.Editable; |
||||||
|
import android.text.TextWatcher; |
||||||
|
import android.view.View; |
||||||
|
|
||||||
|
import androidx.annotation.StringRes; |
||||||
|
|
||||||
|
import com.afollestad.materialdialogs.DialogAction; |
||||||
|
import com.afollestad.materialdialogs.MaterialDialog; |
||||||
|
import com.afollestad.materialdialogs.internal.MDButton; |
||||||
|
import com.bingce.data.cache.CachedCurrentJob; |
||||||
|
import com.bingce.data.cache.CachedCurrentProject; |
||||||
|
import com.bingce.data.cache.CachedCurrentRoad; |
||||||
|
import com.bingce.data.database.DBQueryConstant; |
||||||
|
import com.bingce.data.database.PointDb; |
||||||
|
import com.bingce.data.database.RoadDb; |
||||||
|
import com.bingce.data.surveyor.designdata.road.RoadConstants; |
||||||
|
import com.bingce.data.surveyor.designdata.road.RoadRecord; |
||||||
|
import com.bingce.data.surveyor.surveydata.pointsurvey.PointConstants; |
||||||
|
import com.bingce.data.surveyor.surveydata.pointsurvey.PointRecord; |
||||||
|
import com.bingce.device.util.DeviceUtils; |
||||||
|
import com.bingce.utils.DateUtils; |
||||||
|
import com.bingce.utils.StringUtil; |
||||||
|
import com.bingce.utils.ThreadPoolUtil; |
||||||
|
import com.bingce.utils.Util; |
||||||
|
import com.project.survey.App; |
||||||
|
import com.project.survey.R; |
||||||
|
import com.project.survey.ui.instrument.setupstation.ControlPointsActivity; |
||||||
|
import com.rengwuxian.materialedittext.MaterialEditText; |
||||||
|
|
||||||
|
import java.util.Date; |
||||||
|
|
||||||
|
import blankj.utilcode.util.Utils; |
||||||
|
import cn.liuyanbing.surveyor.model.base.Point; |
||||||
|
import cn.liuyanbing.surveyor.model.base.Road; |
||||||
|
|
||||||
|
public class ControlPointsDetailDialogUtils { |
||||||
|
private final Context context; |
||||||
|
|
||||||
|
private MDButton mPositiveAction; |
||||||
|
private MaterialEditText met_name, met_code, met_x, met_y, met_z, met_remarks, met_date; |
||||||
|
|
||||||
|
public ControlPointsDetailDialogUtils(Context context) { |
||||||
|
this.context = context; |
||||||
|
} |
||||||
|
|
||||||
|
public interface DataCallBack { |
||||||
|
default void edit(ControlPointsActivity.DATA data) { |
||||||
|
} |
||||||
|
|
||||||
|
default void add(ControlPointsActivity.DATA data) { |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public void showControlPointDialog(String roadId, final ControlPointsActivity.DATA data, String title, DataCallBack callBack) { |
||||||
|
MaterialDialog dialog = new MaterialDialog.Builder(context) |
||||||
|
.title(title) |
||||||
|
.customView(R.layout.dialog_new_control_point, false) |
||||||
|
.onPositive((dialog1, which) -> { |
||||||
|
String name = met_name.getText().toString().trim(); |
||||||
|
String code = met_code.getText().toString().trim(); |
||||||
|
double x = "".equals(met_x.getText().toString().trim()) ? 0 : Double.parseDouble(met_x.getText().toString().trim()); |
||||||
|
double y = "".equals(met_y.getText().toString().trim()) ? 0 : Double.parseDouble(met_y.getText().toString().trim()); |
||||||
|
double z = "".equals(met_z.getText().toString().trim()) ? 0 : Double.parseDouble(met_z.getText().toString().trim()); |
||||||
|
String remarks = met_remarks.getText().toString().trim(); |
||||||
|
if (data != null) {//修改
|
||||||
|
ThreadPoolUtil.execute(() -> { |
||||||
|
if (StringUtil.isEmpty(data.roadId)) {//全局控制点
|
||||||
|
PointRecord pointRecord = data.pointRecord; |
||||||
|
pointRecord.name = name; |
||||||
|
pointRecord.code = code; |
||||||
|
pointRecord.x = x; |
||||||
|
pointRecord.y = y; |
||||||
|
pointRecord.h = z; |
||||||
|
pointRecord.remarks = remarks; |
||||||
|
|
||||||
|
PointDb.getInstance().save(pointRecord); |
||||||
|
if (callBack != null) callBack.edit(data); |
||||||
|
} else {//线路控制点
|
||||||
|
RoadRecord roadRecord = RoadDb.getInstance() |
||||||
|
.rawQueryData(DBQueryConstant.findById(RoadConstants.DB_NAME, data.roadId)); |
||||||
|
Road road = RoadDb.getInstance().roadConverter().convert(roadRecord); |
||||||
|
if (road != null && road.getControlPointList() != null && data.index >= 0 && data.index < road.getControlPointList().size()) { |
||||||
|
road.getControlPointList().set(data.index, Point.CONTROL, name, code, x, y, z, remarks, DateUtils.toFull(new Date())); |
||||||
|
RoadDb.getInstance().save(road); |
||||||
|
} |
||||||
|
} |
||||||
|
}); |
||||||
|
} else {//添加
|
||||||
|
ThreadPoolUtil.execute(() -> { |
||||||
|
if (StringUtil.isEmpty(roadId)) {//添加全局控制点
|
||||||
|
String currentProjectId = CachedCurrentProject.currentProjectId(); |
||||||
|
PointRecord pointRecord = new PointRecord( |
||||||
|
currentProjectId, CachedCurrentJob.currentJobId(currentProjectId), CachedCurrentRoad.currentRoadId(currentProjectId), |
||||||
|
PointConstants.POINT_TYPE_GLOBAL_CONTROL_POINT, |
||||||
|
name, code, remarks, |
||||||
|
x, y, z, 0, 0, 0, PointConstants.POINT_FORMAT_XYZ, |
||||||
|
DeviceUtils.collectDeviceInfo()); |
||||||
|
PointDb.getInstance().save(pointRecord); |
||||||
|
if (callBack != null) |
||||||
|
callBack.add(new ControlPointsActivity.DATA(pointRecord)); |
||||||
|
} else { |
||||||
|
RoadRecord roadRecord = RoadDb.getInstance() |
||||||
|
.rawQueryData(DBQueryConstant.findById(RoadConstants.DB_NAME, roadId)); |
||||||
|
Road road = RoadDb.getInstance().roadConverter().convert(roadRecord); |
||||||
|
if (road != null && road.getControlPointList() != null) { |
||||||
|
road.getControlPointList().add(Point.CONTROL, name, code, x, y, z, remarks); |
||||||
|
RoadDb.getInstance().save(road); |
||||||
|
} |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
}) |
||||||
|
.positiveText(this.getString(R.string.save)) |
||||||
|
.negativeText(this.getString(R.string.cancel)).build(); |
||||||
|
|
||||||
|
met_name = dialog.getCustomView().findViewById(R.id.met_dialog_new_staking_point_name); |
||||||
|
met_code = dialog.getCustomView().findViewById(R.id.met_dialog_new_point_code); |
||||||
|
met_x = dialog.getCustomView().findViewById(R.id.met_dialog_new_staking_point_x); |
||||||
|
met_y = dialog.getCustomView().findViewById(R.id.met_dialog_new_staking_point_y); |
||||||
|
met_z = dialog.getCustomView().findViewById(R.id.met_dialog_new_staking_point_z); |
||||||
|
met_remarks = dialog.getCustomView().findViewById(R.id.met_dialog_new_point_remarks); |
||||||
|
met_date = dialog.getCustomView().findViewById(R.id.met_dialog_new_point_date); |
||||||
|
mPositiveAction = dialog.getActionButton(DialogAction.POSITIVE); |
||||||
|
|
||||||
|
initMaterialEditTextColor(); |
||||||
|
|
||||||
|
if (/*position >= 0 && position < allControlPoints.size()*/data != null) { |
||||||
|
PointRecord pointRecord = data.pointRecord; |
||||||
|
met_name.setText(pointRecord.name); |
||||||
|
met_code.setText(pointRecord.code); |
||||||
|
met_x.setText(Util.formatDouble2StringDotAuto(pointRecord.x)); |
||||||
|
met_y.setText(Util.formatDouble2StringDotAuto(pointRecord.y)); |
||||||
|
met_z.setText(Util.formatDouble2StringDotAuto(pointRecord.h)); |
||||||
|
met_remarks.setText(pointRecord.remarks); |
||||||
|
met_date.setText(StringUtil.isEmpty(data.roadId) ? DateUtils.toFull(pointRecord.createDate) : data.timeString); |
||||||
|
} else { |
||||||
|
met_date.setVisibility(View.GONE); |
||||||
|
} |
||||||
|
TextWatcher watcher = new TextWatcher() { |
||||||
|
@Override |
||||||
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) { |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void onTextChanged(CharSequence s, int start, int before, int count) { |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void afterTextChanged(Editable s) { |
||||||
|
String name_text = met_name.getText().toString().trim(); |
||||||
|
String x_text = met_x.getText().toString().trim(); |
||||||
|
String y_text = met_y.getText().toString().trim(); |
||||||
|
String z_text = met_z.getText().toString().trim(); |
||||||
|
|
||||||
|
if (!"".equals(name_text) |
||||||
|
&& !"-".equals(x_text) |
||||||
|
&& !"-".equals(y_text) |
||||||
|
&& !"-".equals(z_text) |
||||||
|
&& !".".equals(x_text) |
||||||
|
&& !".".equals(y_text) |
||||||
|
&& !".".equals(z_text) |
||||||
|
&& !"-.".equals(x_text) |
||||||
|
&& !"-.".equals(y_text) |
||||||
|
&& !"-.".equals(z_text) |
||||||
|
&& !("".equals(x_text) |
||||||
|
&& "".equals(y_text) |
||||||
|
&& "".equals(z_text))) { |
||||||
|
mPositiveAction.setEnabled(true); |
||||||
|
} else { |
||||||
|
mPositiveAction.setEnabled(false); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
}; |
||||||
|
met_name.addTextChangedListener(watcher); |
||||||
|
met_code.addTextChangedListener(watcher); |
||||||
|
met_x.addTextChangedListener(watcher); |
||||||
|
met_y.addTextChangedListener(watcher); |
||||||
|
met_z.addTextChangedListener(watcher); |
||||||
|
met_remarks.addTextChangedListener(watcher); |
||||||
|
|
||||||
|
dialog.show(); |
||||||
|
mPositiveAction.setEnabled(false); |
||||||
|
} |
||||||
|
|
||||||
|
public void showControlPointDialog(String roadId, final ControlPointsActivity.DATA data, String title) { |
||||||
|
showControlPointDialog(roadId, data, title, null); |
||||||
|
} |
||||||
|
|
||||||
|
private void initMaterialEditTextColor() { |
||||||
|
if (((App) Utils.getApp()).isThemeDark) { |
||||||
|
met_name.setMetTextColor(Color.WHITE); |
||||||
|
met_code.setMetTextColor(Color.WHITE); |
||||||
|
met_x.setMetTextColor(Color.WHITE); |
||||||
|
met_y.setMetTextColor(Color.WHITE); |
||||||
|
met_z.setMetTextColor(Color.WHITE); |
||||||
|
met_remarks.setMetTextColor(Color.WHITE); |
||||||
|
met_date.setMetTextColor(Color.WHITE); |
||||||
|
|
||||||
|
met_name.setPrimaryColor(Color.LTGRAY); |
||||||
|
met_code.setPrimaryColor(Color.LTGRAY); |
||||||
|
met_x.setPrimaryColor(Color.LTGRAY); |
||||||
|
met_y.setPrimaryColor(Color.LTGRAY); |
||||||
|
met_z.setPrimaryColor(Color.LTGRAY); |
||||||
|
met_remarks.setPrimaryColor(Color.LTGRAY); |
||||||
|
met_date.setPrimaryColor(Color.LTGRAY); |
||||||
|
|
||||||
|
met_name.setFocusFraction(1.0f); |
||||||
|
met_code.setFocusFraction(1.0f); |
||||||
|
met_x.setFocusFraction(1.0f); |
||||||
|
met_y.setFocusFraction(1.0f); |
||||||
|
met_z.setFocusFraction(1.0f); |
||||||
|
met_remarks.setFocusFraction(1.0f); |
||||||
|
met_date.setFocusFraction(1.0f); |
||||||
|
|
||||||
|
met_name.setMetHintTextColor(Color.GRAY); |
||||||
|
met_code.setMetHintTextColor(Color.GRAY); |
||||||
|
met_x.setMetHintTextColor(Color.GRAY); |
||||||
|
met_y.setMetHintTextColor(Color.GRAY); |
||||||
|
met_z.setMetHintTextColor(Color.GRAY); |
||||||
|
met_remarks.setMetHintTextColor(Color.GRAY); |
||||||
|
met_date.setMetHintTextColor(Color.GRAY); |
||||||
|
|
||||||
|
met_name.setUnderlineColor(Color.GRAY); |
||||||
|
met_code.setUnderlineColor(Color.GRAY); |
||||||
|
met_x.setUnderlineColor(Color.GRAY); |
||||||
|
met_y.setUnderlineColor(Color.GRAY); |
||||||
|
met_z.setUnderlineColor(Color.GRAY); |
||||||
|
met_remarks.setUnderlineColor(Color.GRAY); |
||||||
|
met_date.setUnderlineColor(Color.GRAY); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private String getString(@StringRes int id) { |
||||||
|
return context.getString(id); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,93 @@ |
|||||||
|
package com.project.survey.ui.instrument.setupstation.util; |
||||||
|
|
||||||
|
|
||||||
|
import android.content.Context; |
||||||
|
import android.graphics.Color; |
||||||
|
import android.text.Editable; |
||||||
|
import android.text.TextWatcher; |
||||||
|
|
||||||
|
import com.afollestad.materialdialogs.DialogAction; |
||||||
|
import com.afollestad.materialdialogs.MaterialDialog; |
||||||
|
import com.afollestad.materialdialogs.internal.MDButton; |
||||||
|
import com.project.survey.App; |
||||||
|
import com.project.survey.R; |
||||||
|
import com.rengwuxian.materialedittext.MaterialEditText; |
||||||
|
|
||||||
|
import blankj.utilcode.util.ToastUtils; |
||||||
|
import blankj.utilcode.util.Utils; |
||||||
|
|
||||||
|
public class ControlPointsExportDialogUtils { |
||||||
|
private final Context context; |
||||||
|
|
||||||
|
private MDButton mPositiveAction; |
||||||
|
|
||||||
|
public ControlPointsExportDialogUtils(Context context) { |
||||||
|
this.context = context; |
||||||
|
} |
||||||
|
|
||||||
|
MaterialEditText met_export_name; |
||||||
|
|
||||||
|
public void showExportDialog(ICallback callback) { |
||||||
|
MaterialDialog dialog = new MaterialDialog.Builder(context) |
||||||
|
.title(R.string.export_excel) |
||||||
|
.customView(R.layout.dialog_export_point_config, true) |
||||||
|
.positiveText(R.string.export_points) |
||||||
|
.negativeText(R.string.cancel) |
||||||
|
.onPositive((dialog1, which) -> { |
||||||
|
String name; |
||||||
|
if ("".equals(met_export_name.getText().toString().trim())) { |
||||||
|
ToastUtils.showLong(R.string.file_name_can_not_empty); |
||||||
|
return; |
||||||
|
} else { |
||||||
|
name = met_export_name.getText().toString().trim(); |
||||||
|
} |
||||||
|
// exportExcelAsync(name, mHeaders);
|
||||||
|
if (callback != null) { |
||||||
|
callback.onExport(name); |
||||||
|
} |
||||||
|
}) |
||||||
|
.build(); |
||||||
|
|
||||||
|
met_export_name = dialog.getCustomView().findViewById(R.id.dialog_export_point_config_name); |
||||||
|
mPositiveAction = dialog.getActionButton(DialogAction.POSITIVE); |
||||||
|
|
||||||
|
initMaterialEditTextColor2(); |
||||||
|
|
||||||
|
met_export_name.addTextChangedListener(new TextWatcher() { |
||||||
|
@Override |
||||||
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) { |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void onTextChanged(CharSequence s, int start, int before, int count) { |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void afterTextChanged(Editable s) { |
||||||
|
if (!"".equals(met_export_name.getText().toString().trim())) { |
||||||
|
mPositiveAction.setEnabled(true); |
||||||
|
} else { |
||||||
|
mPositiveAction.setEnabled(false); |
||||||
|
} |
||||||
|
} |
||||||
|
}); |
||||||
|
dialog.show(); |
||||||
|
mPositiveAction.setEnabled(false); |
||||||
|
} |
||||||
|
|
||||||
|
private void initMaterialEditTextColor2() { |
||||||
|
if (((App) Utils.getApp()).isThemeDark) { |
||||||
|
met_export_name.setMetTextColor(Color.WHITE); |
||||||
|
met_export_name.setPrimaryColor(Color.LTGRAY); |
||||||
|
met_export_name.setFocusFraction(1.0f); |
||||||
|
met_export_name.setMetHintTextColor(Color.GRAY); |
||||||
|
met_export_name.setUnderlineColor(Color.GRAY); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public interface ICallback { |
||||||
|
void onExport(String name); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,60 @@ |
|||||||
|
package com.project.survey.ui.instrument.setupstation.util; |
||||||
|
|
||||||
|
import android.content.Context; |
||||||
|
import android.graphics.Color; |
||||||
|
|
||||||
|
import com.afollestad.materialdialogs.MaterialDialog; |
||||||
|
import com.bingce.utils.ContextProviderUtils; |
||||||
|
import com.bingce.utils.IOnSingleGetCallback; |
||||||
|
import com.bingce.utils.IProvider; |
||||||
|
import com.project.survey.App; |
||||||
|
import com.project.survey.R; |
||||||
|
import com.rengwuxian.materialedittext.MaterialEditText; |
||||||
|
|
||||||
|
import blankj.utilcode.util.Utils; |
||||||
|
|
||||||
|
public class ControlPointsFilterDialogUtils extends ContextProviderUtils { |
||||||
|
private String point_name_keyword; |
||||||
|
private MaterialEditText met_point_name_keyword; |
||||||
|
|
||||||
|
public ControlPointsFilterDialogUtils(IProvider<Context> contextIProvider) { |
||||||
|
super(contextIProvider); |
||||||
|
} |
||||||
|
|
||||||
|
public void showFilterDialog(IOnSingleGetCallback<String> keyCallback) { |
||||||
|
MaterialDialog dialog = new MaterialDialog.Builder(context()) |
||||||
|
.title(R.string.filter) |
||||||
|
.customView(R.layout.dialog_control_points_filter, true) |
||||||
|
.onPositive((dialog1, which) -> { |
||||||
|
point_name_keyword = met_point_name_keyword.getText().toString(); |
||||||
|
|
||||||
|
if (keyCallback != null) { |
||||||
|
keyCallback.onGet(point_name_keyword); |
||||||
|
} |
||||||
|
}) |
||||||
|
.positiveText(getString(R.string.confirm)) |
||||||
|
.negativeText(getString(R.string.cancel)).build(); |
||||||
|
met_point_name_keyword = |
||||||
|
dialog.getCustomView().findViewById(R.id.met_dialog_records_filter_roadname_keyword); |
||||||
|
|
||||||
|
initMaterialEditTextColor2(); |
||||||
|
|
||||||
|
met_point_name_keyword.setText(point_name_keyword); |
||||||
|
|
||||||
|
dialog.show(); |
||||||
|
} |
||||||
|
|
||||||
|
private void initMaterialEditTextColor2() { |
||||||
|
if (((App) Utils.getApp()).isThemeDark) { |
||||||
|
met_point_name_keyword.setMetTextColor(Color.WHITE); |
||||||
|
|
||||||
|
met_point_name_keyword.setPrimaryColor(Color.LTGRAY); |
||||||
|
|
||||||
|
met_point_name_keyword.setFocusFraction(1.0f); |
||||||
|
|
||||||
|
met_point_name_keyword.setMetHintTextColor(Color.GRAY); |
||||||
|
|
||||||
|
met_point_name_keyword.setUnderlineColor(Color.GRAY); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,380 @@ |
|||||||
|
package com.project.survey.ui.instrument.setupstation.util; |
||||||
|
|
||||||
|
import static com.bingce.road.parameter.RoadAttributeControlPointConverter.exportPoints; |
||||||
|
|
||||||
|
import android.app.Activity; |
||||||
|
import android.content.DialogInterface; |
||||||
|
import android.content.Intent; |
||||||
|
import android.util.Log; |
||||||
|
|
||||||
|
import androidx.annotation.StringRes; |
||||||
|
import androidx.appcompat.app.AlertDialog; |
||||||
|
|
||||||
|
import com.afollestad.materialdialogs.MaterialDialog; |
||||||
|
import com.bingce.TimeCount; |
||||||
|
import com.bingce.data.cache.CachedCurrentJob; |
||||||
|
import com.bingce.data.cache.CachedCurrentProject; |
||||||
|
import com.bingce.data.cache.CachedCurrentRoad; |
||||||
|
import com.bingce.data.database.DBQueryConstant; |
||||||
|
import com.bingce.data.database.PointDb; |
||||||
|
import com.bingce.data.database.RoadDb; |
||||||
|
import com.bingce.data.surveyor.designdata.road.RoadConstants; |
||||||
|
import com.bingce.data.surveyor.designdata.road.RoadRecord; |
||||||
|
import com.bingce.error.BingCeErrorCode; |
||||||
|
import com.bingce.road.RoadIntentUtil; |
||||||
|
import com.bingce.road.RoadRecordConvertUtils; |
||||||
|
import com.bingce.surveyor.agentweb.AgentWebActivity; |
||||||
|
import com.bingce.utils.StringUtil; |
||||||
|
import com.bingce.utils.ThreadPoolUtil; |
||||||
|
import com.project.survey.App; |
||||||
|
import com.project.survey.R; |
||||||
|
|
||||||
|
import java.io.File; |
||||||
|
|
||||||
|
import blankj.utilcode.util.ToastUtils; |
||||||
|
import blankj.utilcode.util.Utils; |
||||||
|
import cn.liuyanbing.surveyor.model.base.Point; |
||||||
|
import cn.liuyanbing.surveyor.model.base.PointArray; |
||||||
|
import cn.liuyanbing.surveyor.model.base.Road; |
||||||
|
import ru.bartwell.exfilepicker.ExFilePicker; |
||||||
|
import ru.bartwell.exfilepicker.data.ExFilePickerResult; |
||||||
|
|
||||||
|
public class ControlPointsImportConfigDialogUtils { |
||||||
|
private static final int EX_FILE_PICKER_RESULT_SURVEYOR_EXCEL = 330; |
||||||
|
private static final int EX_FILE_PICKER_RESULT_SURVEYOR_TXT = 331; |
||||||
|
private static final int EX_FILE_PICKER_RESULT_CASS_DAT = 332; |
||||||
|
private static final int EX_FILE_PICKER_RESULT_ROADSTAR_EXCEL = 333; |
||||||
|
|
||||||
|
private final Activity context; |
||||||
|
private boolean cassXY = false;//cass格式按照xy排序,否则yx排序
|
||||||
|
private boolean isOverrideImport; |
||||||
|
|
||||||
|
public ControlPointsImportConfigDialogUtils(Activity context) { |
||||||
|
this.context = context; |
||||||
|
} |
||||||
|
|
||||||
|
public void showImportConfigDialog() { |
||||||
|
new MaterialDialog.Builder(context) |
||||||
|
.title(R.string.please_choose_import_format) |
||||||
|
.items(new String[]{getString(R.string.excel_xls) |
||||||
|
, getString(R.string.text_txt) |
||||||
|
, getString(R.string.cass_dat_txt) |
||||||
|
/* , getString(R.string.road_star_point_data_excel_xls)*/}) |
||||||
|
.itemsCallback((dialog, itemView, which, text) -> { |
||||||
|
String[] filter = null; |
||||||
|
int intentResultNumber = EX_FILE_PICKER_RESULT_SURVEYOR_EXCEL; |
||||||
|
String message = ""; |
||||||
|
switch (which) { |
||||||
|
case 0: |
||||||
|
filter = new String[]{"xls", "xlsx"}; |
||||||
|
intentResultNumber = EX_FILE_PICKER_RESULT_SURVEYOR_EXCEL; |
||||||
|
message = getString(R.string.import_point_excel_guide); |
||||||
|
break; |
||||||
|
case 1: |
||||||
|
filter = new String[]{"txt"}; |
||||||
|
intentResultNumber = EX_FILE_PICKER_RESULT_SURVEYOR_TXT; |
||||||
|
message = getString(R.string.import_point_text_guide); |
||||||
|
break; |
||||||
|
case 2: |
||||||
|
showImportCassXYDialog(); |
||||||
|
return; |
||||||
|
case 3: |
||||||
|
filter = new String[]{"xls", "xlsx"}; |
||||||
|
intentResultNumber = EX_FILE_PICKER_RESULT_ROADSTAR_EXCEL; |
||||||
|
message = getString(R.string.import_point_road_star_excel_guide); |
||||||
|
break; |
||||||
|
} |
||||||
|
if (filter != null) { |
||||||
|
final int finalIntentResultNumber = intentResultNumber; |
||||||
|
final String[] finalFilter = filter; |
||||||
|
new AlertDialog.Builder(context) |
||||||
|
.setTitle(R.string.import_points) |
||||||
|
.setMessage(message) |
||||||
|
.setPositiveButton(R.string.overwrite_import, new DialogInterface.OnClickListener() { |
||||||
|
@Override |
||||||
|
public void onClick(DialogInterface dialog, int which) { |
||||||
|
isOverrideImport = true; |
||||||
|
selectFolder(finalIntentResultNumber, finalFilter); |
||||||
|
} |
||||||
|
}) |
||||||
|
.setNegativeButton(R.string.additional_import, new DialogInterface.OnClickListener() { |
||||||
|
@Override |
||||||
|
public void onClick(DialogInterface dialog, int which) { |
||||||
|
isOverrideImport = false; |
||||||
|
selectFolder(finalIntentResultNumber, finalFilter); |
||||||
|
} |
||||||
|
}) |
||||||
|
.setNeutralButton(R.string.view_sample, new DialogInterface.OnClickListener() { |
||||||
|
@Override |
||||||
|
public void onClick(DialogInterface dialog, int which) { |
||||||
|
// Intent intent = new Intent();
|
||||||
|
// intent.setClass(Utils.getApp(), AgentWebActivity.class);
|
||||||
|
// intent.putExtra("short_url", "android_url_import_point_sample");
|
||||||
|
// context.startActivity(intent);
|
||||||
|
AgentWebActivity.navigation2( |
||||||
|
context, |
||||||
|
"android_url_import_point_sample" |
||||||
|
); |
||||||
|
} |
||||||
|
}) |
||||||
|
.show(); |
||||||
|
} |
||||||
|
}).show(); |
||||||
|
} |
||||||
|
|
||||||
|
private void showImportCassXYDialog() { |
||||||
|
cassXY = false; |
||||||
|
String message; |
||||||
|
if (cassXY) { |
||||||
|
message = getString(R.string.import_point_cass_xy_dat); |
||||||
|
} else { |
||||||
|
message = getString(R.string.import_point_cass_yx_dat); |
||||||
|
} |
||||||
|
new AlertDialog.Builder(context) |
||||||
|
.setTitle(R.string.import_points) |
||||||
|
.setMessage(message) |
||||||
|
.setPositiveButton(R.string.overwrite_import, new DialogInterface.OnClickListener() { |
||||||
|
@Override |
||||||
|
public void onClick(DialogInterface dialog, int which) { |
||||||
|
isOverrideImport = true; |
||||||
|
selectFolder(EX_FILE_PICKER_RESULT_CASS_DAT, new String[]{"dat", "txt"}); |
||||||
|
} |
||||||
|
}) |
||||||
|
.setNegativeButton(R.string.additional_import, new DialogInterface.OnClickListener() { |
||||||
|
@Override |
||||||
|
public void onClick(DialogInterface dialog, int which) { |
||||||
|
isOverrideImport = false; |
||||||
|
selectFolder(EX_FILE_PICKER_RESULT_CASS_DAT, new String[]{"dat", "txt"}); |
||||||
|
} |
||||||
|
}) |
||||||
|
.setNeutralButton(R.string.view_sample, new DialogInterface.OnClickListener() { |
||||||
|
@Override |
||||||
|
public void onClick(DialogInterface dialog, int which) { |
||||||
|
// Intent intent = new Intent();
|
||||||
|
// intent.setClass(Utils.getApp(), AgentWebActivity.class);
|
||||||
|
// intent.putExtra("short_url", "android_url_import_point_sample");
|
||||||
|
// startActivity(intent);
|
||||||
|
AgentWebActivity.navigation2( |
||||||
|
context, |
||||||
|
"android_url_import_point_sample"); |
||||||
|
} |
||||||
|
}) |
||||||
|
.show(); |
||||||
|
} |
||||||
|
// private void showImportCassXYDialog() {
|
||||||
|
// new MaterialDialog.Builder(context)
|
||||||
|
// .title(R.string.coordinate_order)
|
||||||
|
// .items(new String[]{"X-Y-Z", "Y-X-Z"})
|
||||||
|
// .itemsCallback(new MaterialDialog.ListCallback() {
|
||||||
|
// @Override
|
||||||
|
// public void onSelection(MaterialDialog dialog, View itemView, int which, CharSequence text) {
|
||||||
|
// String message = getString(R.string.import_point_cass_xy_dat);
|
||||||
|
// switch (which) {
|
||||||
|
// case 0:
|
||||||
|
// cassXY = true;
|
||||||
|
// message = getString(R.string.import_point_cass_xy_dat);
|
||||||
|
// break;
|
||||||
|
// case 1:
|
||||||
|
// cassXY = false;
|
||||||
|
// message = getString(R.string.import_point_cass_yx_dat);
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// new AlertDialog.Builder(context)
|
||||||
|
// .setTitle(R.string.import_points)
|
||||||
|
// .setMessage(message)
|
||||||
|
// .setPositiveButton(R.string.overwrite_import, new DialogInterface.OnClickListener() {
|
||||||
|
// @Override
|
||||||
|
// public void onClick(DialogInterface dialog, int which) {
|
||||||
|
// isOverrideImport = true;
|
||||||
|
// selectFolder(EX_FILE_PICKER_RESULT_CASS_DAT, new String[]{"dat", "txt"});
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// .setNegativeButton(R.string.additional_import, new DialogInterface.OnClickListener() {
|
||||||
|
// @Override
|
||||||
|
// public void onClick(DialogInterface dialog, int which) {
|
||||||
|
// isOverrideImport = false;
|
||||||
|
// selectFolder(EX_FILE_PICKER_RESULT_CASS_DAT, new String[]{"dat", "txt"});
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// .setNeutralButton(R.string.view_sample, new DialogInterface.OnClickListener() {
|
||||||
|
// @Override
|
||||||
|
// public void onClick(DialogInterface dialog, int which) {
|
||||||
|
//// Intent intent = new Intent();
|
||||||
|
//// intent.setClass(Utils.getApp(), AgentWebActivity.class);
|
||||||
|
//// intent.putExtra("short_url", "android_url_import_point_sample");
|
||||||
|
//// context.startActivity(intent);
|
||||||
|
// AgentWebActivity.navigation2(
|
||||||
|
// context, "android_url_import_point_sample");
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// .show();
|
||||||
|
// }
|
||||||
|
// }).show();
|
||||||
|
// }
|
||||||
|
|
||||||
|
private void selectFolder(final int intentResultNumber, final String[] filter) { |
||||||
|
ExFilePicker exFilePicker = new ExFilePicker(); |
||||||
|
exFilePicker.setLandscape(((App) Utils.getApp()).isLandscape()); |
||||||
|
exFilePicker.setShowOnlyExtensions(filter); |
||||||
|
exFilePicker.start(context, intentResultNumber); |
||||||
|
} |
||||||
|
|
||||||
|
public void onActivityResult(boolean isGlobal, int requestCode, int resultCode, Intent data) { |
||||||
|
if (resultCode == Activity.RESULT_OK) { |
||||||
|
if (data != null) { |
||||||
|
ExFilePickerResult object = ExFilePickerResult.getFromIntent(data); |
||||||
|
if (object != null && object.getCount() > 0) { |
||||||
|
try { |
||||||
|
String path = object.getPath() + object.getNames().get(0); |
||||||
|
switch (requestCode) { |
||||||
|
case EX_FILE_PICKER_RESULT_SURVEYOR_EXCEL: { |
||||||
|
ThreadPoolUtil.execute(() -> { |
||||||
|
String projectId = CachedCurrentProject.currentProjectId(); |
||||||
|
if (isGlobal) { |
||||||
|
String jobId = CachedCurrentJob.currentJobId(projectId); |
||||||
|
if (isOverrideImport) { |
||||||
|
//删除之前控制点
|
||||||
|
PointDb.getInstance().deleteControlPoints(projectId); |
||||||
|
} |
||||||
|
_6GlobalControlPointCollectUtils.importGlobalControlPointExcel(projectId, jobId, |
||||||
|
new File(path), |
||||||
|
TimeCount.timeCounter()); |
||||||
|
} else { |
||||||
|
String roadId = RoadIntentUtil.getRoadIdFromIntent(context.getIntent()); |
||||||
|
if (StringUtil.isEmpty(roadId)) { |
||||||
|
roadId = CachedCurrentRoad.currentRoadId(projectId); |
||||||
|
} |
||||||
|
RoadRecord roadRecord = RoadDb.getInstance() |
||||||
|
.rawQueryData(DBQueryConstant.findById(RoadConstants.DB_NAME, roadId)); |
||||||
|
if (roadRecord == null) { |
||||||
|
BingCeErrorCode.toast(BingCeErrorCode.NO_FOUND_ROAD_BY_ID); |
||||||
|
return; |
||||||
|
} |
||||||
|
PointArray pointArray = new PointArray(); |
||||||
|
_6GlobalControlPointCollectUtils.Result result = _6GlobalControlPointCollectUtils.importGlobalControlPointExcel(new File(path), pointArray); |
||||||
|
if (isOverrideImport) { |
||||||
|
roadRecord.controlPointJson = exportPoints(pointArray); |
||||||
|
} else { |
||||||
|
Road road = RoadDb.getInstance().roadConverter().convert(roadRecord); |
||||||
|
if (road != null) { |
||||||
|
for (int index = 0; index < pointArray.size(); index++) { |
||||||
|
Point point = pointArray.get(index); |
||||||
|
road.getControlPointList().add(point.getCategory(), point.getName(), point.getCode(), |
||||||
|
point.getX(), point.getY(), point.getZ(), point.getRemarks(), point.getTime()); |
||||||
|
} |
||||||
|
} |
||||||
|
RoadRecordConvertUtils.updateRecord(roadRecord, road); |
||||||
|
} |
||||||
|
RoadDb.getInstance().save(roadRecord); |
||||||
|
ToastUtils.showShort(result.describe); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
break; |
||||||
|
case EX_FILE_PICKER_RESULT_SURVEYOR_TXT: |
||||||
|
ThreadPoolUtil.execute(() -> { |
||||||
|
String projectId = CachedCurrentProject.currentProjectId(); |
||||||
|
if (isGlobal) { |
||||||
|
String jobId = CachedCurrentJob.currentJobId(projectId); |
||||||
|
if (isOverrideImport) { |
||||||
|
//删除之前控制点
|
||||||
|
PointDb.getInstance().deleteControlPoints(projectId); |
||||||
|
} |
||||||
|
_6GlobalControlPointCollectUtils.importStakingJobPointTxt(new File(path), projectId, jobId, |
||||||
|
|
||||||
|
TimeCount.timeCounter()); |
||||||
|
} else { |
||||||
|
String roadId = RoadIntentUtil.getRoadIdFromIntent(context.getIntent()); |
||||||
|
if (StringUtil.isEmpty(roadId)) { |
||||||
|
roadId = CachedCurrentRoad.currentRoadId(projectId); |
||||||
|
} |
||||||
|
RoadRecord roadRecord = RoadDb.getInstance() |
||||||
|
.rawQueryData(DBQueryConstant.findById(RoadConstants.DB_NAME, roadId)); |
||||||
|
if (roadRecord == null) { |
||||||
|
BingCeErrorCode.toast(BingCeErrorCode.NO_FOUND_ROAD_BY_ID); |
||||||
|
return; |
||||||
|
} |
||||||
|
PointArray pointArray = new PointArray(); |
||||||
|
_6GlobalControlPointCollectUtils.Result result = _6GlobalControlPointCollectUtils.importStakingJobPointTxt(new File(path), pointArray); |
||||||
|
if (isOverrideImport) { |
||||||
|
roadRecord.controlPointJson = exportPoints(pointArray); |
||||||
|
} else { |
||||||
|
Road road = RoadDb.getInstance().roadConverter().convert(roadRecord); |
||||||
|
if (road != null) { |
||||||
|
for (int index = 0; index < pointArray.size(); index++) { |
||||||
|
Point point = pointArray.get(index); |
||||||
|
road.getControlPointList().add(point.getCategory(), point.getName(), point.getCode(), |
||||||
|
point.getX(), point.getY(), point.getZ(), point.getRemarks(), point.getTime()); |
||||||
|
} |
||||||
|
} |
||||||
|
RoadRecordConvertUtils.updateRecord(roadRecord, road); |
||||||
|
} |
||||||
|
RoadDb.getInstance().save(roadRecord); |
||||||
|
ToastUtils.showShort(result.describe); |
||||||
|
} |
||||||
|
}); |
||||||
|
break; |
||||||
|
case EX_FILE_PICKER_RESULT_CASS_DAT: |
||||||
|
ThreadPoolUtil.execute(() -> { |
||||||
|
String projectId = CachedCurrentProject.currentProjectId(); |
||||||
|
if (isGlobal) { |
||||||
|
String jobId = CachedCurrentJob.currentJobId(projectId); |
||||||
|
if (isOverrideImport) { |
||||||
|
//删除之前控制点
|
||||||
|
PointDb.getInstance().deleteControlPoints(projectId); |
||||||
|
} |
||||||
|
_6GlobalControlPointCollectUtils.importStakingJobPointCassDat(new File(path), projectId, jobId, |
||||||
|
|
||||||
|
TimeCount.timeCounter(), false); |
||||||
|
} else { |
||||||
|
String roadId = RoadIntentUtil.getRoadIdFromIntent(context.getIntent()); |
||||||
|
if (StringUtil.isEmpty(roadId)) { |
||||||
|
roadId = CachedCurrentRoad.currentRoadId(projectId); |
||||||
|
} |
||||||
|
RoadRecord roadRecord = RoadDb.getInstance() |
||||||
|
.rawQueryData(DBQueryConstant.findById(RoadConstants.DB_NAME, roadId)); |
||||||
|
if (roadRecord == null) { |
||||||
|
BingCeErrorCode.toast(BingCeErrorCode.NO_FOUND_ROAD_BY_ID); |
||||||
|
return; |
||||||
|
} |
||||||
|
PointArray pointArray = new PointArray(); |
||||||
|
_6GlobalControlPointCollectUtils.Result result = _6GlobalControlPointCollectUtils.importStakingJobPointCassDat(new File(path), pointArray, false); |
||||||
|
if (isOverrideImport) { |
||||||
|
roadRecord.controlPointJson = exportPoints(pointArray); |
||||||
|
} else { |
||||||
|
Road road = RoadDb.getInstance().roadConverter().convert(roadRecord); |
||||||
|
if (road != null) { |
||||||
|
for (int index = 0; index < pointArray.size(); index++) { |
||||||
|
Point point = pointArray.get(index); |
||||||
|
road.getControlPointList().add(point.getCategory(), point.getName(), point.getCode(), |
||||||
|
point.getX(), point.getY(), point.getZ(), point.getRemarks(), point.getTime()); |
||||||
|
} |
||||||
|
} |
||||||
|
RoadRecordConvertUtils.updateRecord(roadRecord, road); |
||||||
|
} |
||||||
|
RoadDb.getInstance().save(roadRecord); |
||||||
|
ToastUtils.showShort(result.describe); |
||||||
|
} |
||||||
|
}); |
||||||
|
break; |
||||||
|
// case EX_FILE_PICKER_RESULT_ROADSTAR_EXCEL:
|
||||||
|
// String result4 = isGlobal
|
||||||
|
// ? PointLibraryUtil.importGlobalControlPointRoadStarExcel(new File(path), isOverrideImport)
|
||||||
|
// : ControlPointUtil.importControlPointRoadStarExcel(new File(path), road, isOverrideImport);
|
||||||
|
// ToastUtils.showLong(result4);
|
||||||
|
// break;
|
||||||
|
} |
||||||
|
// updateRecyclerView();
|
||||||
|
// isPrjChanged = true;
|
||||||
|
} catch (Exception e) { |
||||||
|
Log.e(ControlPointsImportConfigDialogUtils.class.getName(), "File select error", e); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private String getString(@StringRes int id) { |
||||||
|
return context.getString(id); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,341 @@ |
|||||||
|
package com.project.survey.ui.instrument.setupstation.util; |
||||||
|
|
||||||
|
import android.util.Log; |
||||||
|
|
||||||
|
import com.bingce.TimeCount; |
||||||
|
import com.bingce.coordlib.enums.DatumEnum; |
||||||
|
import com.bingce.coordlib.enums.EllipsoidEnum; |
||||||
|
import com.bingce.coordlib.enums.GridEnum; |
||||||
|
import com.bingce.coordlib.enums.HFittingEnum; |
||||||
|
import com.bingce.coordlib.enums.ProjectionEnum; |
||||||
|
import com.bingce.coordlib.model.Blh; |
||||||
|
import com.bingce.coordlib.model.BlhCoordinatePair; |
||||||
|
import com.bingce.coordlib.model.Coordinate; |
||||||
|
import com.bingce.coordlib.model.CoordinateSystem; |
||||||
|
import com.bingce.data.database.CoordinateSystemDb; |
||||||
|
import com.bingce.data.surveyor.designdata.coordinate.CoordinateSystemRecord; |
||||||
|
import com.bingce.poi.excel.ExcelReadHelper; |
||||||
|
import com.bingce.utils.Util; |
||||||
|
|
||||||
|
import java.io.File; |
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
public class CoordinatorSystemCollectUtils { |
||||||
|
static void collectCoordinatorTemplate(File coordinateExcel, TimeCount.ITimeCounter timeCounter) { |
||||||
|
//0.收集坐标系模板
|
||||||
|
// File coordinateExcel = new File(dataFolder, FileNameConstants.CONFIG_FILE_EXCEL_COORDINATOR_OF_PROJECT);
|
||||||
|
if (coordinateExcel.exists()) { |
||||||
|
List<CoordinateSystem> coordinateSystems = importAllCoordSysExcelFile(coordinateExcel); |
||||||
|
if (coordinateSystems != null) { |
||||||
|
List<CoordinateSystemRecord> coordinateSystemRecords = new ArrayList<>(); |
||||||
|
for (CoordinateSystem coordinateSystem : coordinateSystems) { |
||||||
|
CoordinateSystemRecord record = new CoordinateSystemRecord(coordinateSystem, timeCounter.time()); |
||||||
|
coordinateSystemRecords.add(record); |
||||||
|
} |
||||||
|
CoordinateSystemDb.getInstance().save(coordinateSystemRecords); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 导入excel版坐标系统 |
||||||
|
* |
||||||
|
* @param sysFile excel坐标库 |
||||||
|
* @return 坐标系统 |
||||||
|
*/ |
||||||
|
static List<CoordinateSystem> importAllCoordSysExcelFile(File sysFile) { |
||||||
|
if (!sysFile.exists() || sysFile.isDirectory()) { |
||||||
|
return null; |
||||||
|
} |
||||||
|
List<CoordinateSystem> list = new ArrayList<>(); |
||||||
|
int line = 0; |
||||||
|
try { |
||||||
|
List<List<List<String>>> importResult = ExcelReadHelper.excelReadBySheet(sysFile, ExcelReadHelper.FIRST_ROW_NOT_IGNORE); |
||||||
|
if (importResult == null) return new ArrayList<>(); |
||||||
|
if (importResult.isEmpty()) return new ArrayList<>(); |
||||||
|
for (int i = 0; i < importResult.size(); i++) { |
||||||
|
CoordinateSystem coordinateSystem = new CoordinateSystem(); |
||||||
|
coordinateSystem.isPreset = false; |
||||||
|
line = 0; |
||||||
|
List<List<String>> sheetResult = importResult.get(i); |
||||||
|
if (sheetResult == null || sheetResult.isEmpty()) { |
||||||
|
Log.d("CoordinateSystemUtil", sysFile.getAbsolutePath() + ",导入失败,原因:导入excel为空"); |
||||||
|
return new ArrayList<>(); |
||||||
|
} |
||||||
|
String sheetName = sheetResult.get(0).isEmpty() ? "default" : sheetResult.get(0).get(0); |
||||||
|
coordinateSystem.setName(sheetName); |
||||||
|
for (int j = 1; j < sheetResult.size(); j++) { |
||||||
|
List<String> row = sheetResult.get(j); |
||||||
|
|
||||||
|
line = j + 1; |
||||||
|
if (row.isEmpty() || ExcelReadHelper.isRowEmpty(row)) { |
||||||
|
continue; |
||||||
|
} |
||||||
|
if (row.size() != 2 && row.size() != 7 && row.size() != 6 && row.size() != 9) { |
||||||
|
Log.d("CoordinateSystemUtil", sysFile.getAbsolutePath() + ",导入失败,原因:第" + line + "行,元素个数必须为2,7,6,9"); |
||||||
|
break; |
||||||
|
} |
||||||
|
if (row.size() == 2) { |
||||||
|
switch (row.get(0)) { |
||||||
|
case "isPreset": |
||||||
|
int preset = Integer.parseInt(row.get(1)); |
||||||
|
coordinateSystem.isPreset = preset == 1; |
||||||
|
break; |
||||||
|
case "rtkTransformMethod": |
||||||
|
case "transMethod": |
||||||
|
int method = Integer.parseInt(row.get(1)); |
||||||
|
if (method == 0) { |
||||||
|
coordinateSystem.datum = DatumEnum.BURSA; |
||||||
|
coordinateSystem.grid = GridEnum.NULL; |
||||||
|
coordinateSystem.hFitting = HFittingEnum.NULL; |
||||||
|
} else if (method == 1 || method == 2) { |
||||||
|
coordinateSystem.datum = DatumEnum.NULL; |
||||||
|
coordinateSystem.grid = GridEnum.FOUR_PARA; |
||||||
|
coordinateSystem.hFitting = HFittingEnum.FIX; |
||||||
|
} |
||||||
|
break; |
||||||
|
case "ellipsoidType": |
||||||
|
int ellipsoid = Integer.parseInt(row.get(1)); |
||||||
|
switch (ellipsoid) { |
||||||
|
case 0: |
||||||
|
coordinateSystem.setEllipsoid(EllipsoidEnum.WGS_84); |
||||||
|
break; |
||||||
|
case 1: |
||||||
|
coordinateSystem.setEllipsoid(EllipsoidEnum.BEIJING_54); |
||||||
|
break; |
||||||
|
case 2: |
||||||
|
coordinateSystem.setEllipsoid(EllipsoidEnum.XIAN_80); |
||||||
|
break; |
||||||
|
default: |
||||||
|
coordinateSystem.setEllipsoid(EllipsoidEnum.CGCS_2000); |
||||||
|
break; |
||||||
|
} |
||||||
|
break; |
||||||
|
case "rtkProjectType": |
||||||
|
case "projectType": |
||||||
|
int type = Integer.parseInt(row.get(1)); |
||||||
|
switch (type) { |
||||||
|
case 2: |
||||||
|
coordinateSystem.setProjection(ProjectionEnum.UTM); |
||||||
|
break; |
||||||
|
default: |
||||||
|
coordinateSystem.setProjection(ProjectionEnum.GAUSS); |
||||||
|
} |
||||||
|
break; |
||||||
|
case "datumTransType": |
||||||
|
int datumTransType = Integer.parseInt(row.get(1)); |
||||||
|
if (datumTransType < 0 || datumTransType > 1) |
||||||
|
datumTransType = 0; |
||||||
|
switch (datumTransType) { |
||||||
|
case 1: |
||||||
|
coordinateSystem.datum = DatumEnum.BURSA; |
||||||
|
break; |
||||||
|
default: |
||||||
|
coordinateSystem.datum = DatumEnum.NULL; |
||||||
|
} |
||||||
|
break; |
||||||
|
case "planeTransType": |
||||||
|
int planeTransType = Integer.parseInt(row.get(1)); |
||||||
|
switch (planeTransType) { |
||||||
|
case 1: |
||||||
|
coordinateSystem.grid = GridEnum.FOUR_PARA; |
||||||
|
break; |
||||||
|
default: |
||||||
|
coordinateSystem.grid = GridEnum.NULL; |
||||||
|
} |
||||||
|
break; |
||||||
|
case "elvFitType": |
||||||
|
int elvFitType = Integer.parseInt(row.get(1)); |
||||||
|
switch (elvFitType) { |
||||||
|
case 1: |
||||||
|
case 4: |
||||||
|
coordinateSystem.hFitting = HFittingEnum.FIX; |
||||||
|
break; |
||||||
|
case 2: |
||||||
|
coordinateSystem.hFitting = HFittingEnum.PLANE; |
||||||
|
break; |
||||||
|
case 3: |
||||||
|
coordinateSystem.hFitting = HFittingEnum.CURVE; |
||||||
|
break; |
||||||
|
case 5: |
||||||
|
coordinateSystem.hFitting = HFittingEnum.TGO; |
||||||
|
break; |
||||||
|
default: |
||||||
|
coordinateSystem.hFitting = HFittingEnum.NULL; |
||||||
|
} |
||||||
|
break; |
||||||
|
case "longOfOrigin": |
||||||
|
case "centLng": |
||||||
|
coordinateSystem.centLng = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "latOfOrigin": |
||||||
|
case "baseLat": |
||||||
|
coordinateSystem.baseLat = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "projectionScale": |
||||||
|
case "projScl": |
||||||
|
coordinateSystem.projScl = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "falseEasting": |
||||||
|
case "falseE": |
||||||
|
coordinateSystem.falseE = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "falseNorthing": |
||||||
|
case "falseN": |
||||||
|
coordinateSystem.falseN = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "projectionHeight": |
||||||
|
case "projAlt": |
||||||
|
coordinateSystem.projAlt = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "sevenParDx": |
||||||
|
coordinateSystem.sevenDx = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "sevenParDy": |
||||||
|
coordinateSystem.sevenDy = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "sevenParDz": |
||||||
|
coordinateSystem.sevenDz = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "sevenParRx": |
||||||
|
coordinateSystem.sevenRx = Double.parseDouble(row.get(1)) * 3600d; |
||||||
|
break; |
||||||
|
case "sevenParRy": |
||||||
|
coordinateSystem.sevenRy = Double.parseDouble(row.get(1)) * 3600d; |
||||||
|
break; |
||||||
|
case "sevenParRz": |
||||||
|
coordinateSystem.sevenRz = Double.parseDouble(row.get(1)) * 3600d; |
||||||
|
break; |
||||||
|
case "sevenParScl": |
||||||
|
coordinateSystem.sevenPpm = (Double.parseDouble(row.get(1)) - 1) * 1000000d; |
||||||
|
break; |
||||||
|
case "fourParDx": |
||||||
|
coordinateSystem.fourDx = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "fourParDy": |
||||||
|
coordinateSystem.fourDy = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "fourParRot": |
||||||
|
coordinateSystem.fourRot = Util.radianToDmsDouble(Math.toRadians(Double.parseDouble(row.get(1)))); |
||||||
|
break; |
||||||
|
case "fourParScl": |
||||||
|
coordinateSystem.fourScl = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "hFitA0": |
||||||
|
coordinateSystem.hFitA0 = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "hFitA1": |
||||||
|
coordinateSystem.hFitA1 = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "hFitA2": |
||||||
|
coordinateSystem.hFitA2 = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "hFitA3": |
||||||
|
coordinateSystem.hFitA3 = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "hFitA4": |
||||||
|
coordinateSystem.hFitA4 = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "hFitA5": |
||||||
|
coordinateSystem.hFitA5 = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "hFitN": |
||||||
|
coordinateSystem.hFitN = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "hFitE": |
||||||
|
coordinateSystem.hFitE = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "hFitNorthOrigin": |
||||||
|
coordinateSystem.hFitNorthOrigin = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "hFitEastOrigin": |
||||||
|
coordinateSystem.hFitEastOrigin = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "hFitNorthSlope": |
||||||
|
coordinateSystem.hFitNorthSlope = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "hFitEastSlope": |
||||||
|
coordinateSystem.hFitEastSlope = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "hFitHdConstant": |
||||||
|
coordinateSystem.hFitHdConstant = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "correctX": |
||||||
|
coordinateSystem.correctN = -1 * Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "correctY": |
||||||
|
coordinateSystem.correctE = -1 * Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "correctZ": |
||||||
|
coordinateSystem.correctH = -1 * Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "correctN": |
||||||
|
coordinateSystem.correctN = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "correctE": |
||||||
|
coordinateSystem.correctE = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "correctH": |
||||||
|
coordinateSystem.correctH = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
} |
||||||
|
} else if (row.size() == 6) { |
||||||
|
coordinateSystem.getPairs().add(new BlhCoordinatePair("", new Blh(Double.parseDouble(row.get(0)), Double.parseDouble(row.get(1)), Double.parseDouble(row.get(2))) |
||||||
|
, new Coordinate(Double.parseDouble(row.get(3)), Double.parseDouble(row.get(4)), Double.parseDouble(row.get(5))))); |
||||||
|
} else if (row.size() == 9) { |
||||||
|
if ("BlhPointPair".equals(row.get(0).trim())) { |
||||||
|
switch (Integer.parseInt(row.get(1))) { |
||||||
|
case 47: |
||||||
|
coordinateSystem.getPairs().add(new BlhCoordinatePair(row.get(2), new Blh(Double.parseDouble(row.get(3)), Double.parseDouble(row.get(4)), Double.parseDouble(row.get(5))) |
||||||
|
, new Coordinate(Double.parseDouble(row.get(6)), Double.parseDouble(row.get(7)), Double.parseDouble(row.get(8))))); |
||||||
|
break; |
||||||
|
case 51: |
||||||
|
coordinateSystem.phonePair1 = new BlhCoordinatePair(row.get(2), new Blh(Double.parseDouble(row.get(3)), Double.parseDouble(row.get(4)), Double.parseDouble(row.get(5))) |
||||||
|
, new Coordinate(Double.parseDouble(row.get(6)), Double.parseDouble(row.get(7)), Double.parseDouble(row.get(8)))); |
||||||
|
break; |
||||||
|
case 52: |
||||||
|
coordinateSystem.phonePair2 = new BlhCoordinatePair(row.get(2), new Blh(Double.parseDouble(row.get(3)), Double.parseDouble(row.get(4)), Double.parseDouble(row.get(5))) |
||||||
|
, new Coordinate(Double.parseDouble(row.get(6)), Double.parseDouble(row.get(7)), Double.parseDouble(row.get(8)))); |
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
} else { |
||||||
|
switch (Integer.parseInt(row.get(0))) { |
||||||
|
case 4: |
||||||
|
case 7: |
||||||
|
coordinateSystem.getPairs().add(new BlhCoordinatePair("", new Blh(Math.toDegrees(Util.dmsStringToRadian(row.get(1), false)), Math.toDegrees(Util.dmsStringToRadian(row.get(2), false)), Double.parseDouble(row.get(3))) |
||||||
|
, new Coordinate(Double.parseDouble(row.get(4)), Double.parseDouble(row.get(5)), Double.parseDouble(row.get(6))))); |
||||||
|
break; |
||||||
|
case 31: |
||||||
|
coordinateSystem.phonePair1 = new BlhCoordinatePair("", new Blh(Math.toDegrees(Util.dmsStringToRadian(row.get(1), false)), Math.toDegrees(Util.dmsStringToRadian(row.get(2), false)), Double.parseDouble(row.get(3))) |
||||||
|
, new Coordinate(Double.parseDouble(row.get(4)), Double.parseDouble(row.get(5)), Double.parseDouble(row.get(6)))); |
||||||
|
break; |
||||||
|
case 32: |
||||||
|
coordinateSystem.phonePair2 = new BlhCoordinatePair("", new Blh(Math.toDegrees(Util.dmsStringToRadian(row.get(1), false)), Math.toDegrees(Util.dmsStringToRadian(row.get(2), false)), Double.parseDouble(row.get(3))) |
||||||
|
, new Coordinate(Double.parseDouble(row.get(4)), Double.parseDouble(row.get(5)), Double.parseDouble(row.get(6)))); |
||||||
|
break; |
||||||
|
case 41: |
||||||
|
coordinateSystem.phonePair1 = new BlhCoordinatePair("", new Blh(Double.parseDouble(row.get(1)), Double.parseDouble(row.get(2)), Double.parseDouble(row.get(3))) |
||||||
|
, new Coordinate(Double.parseDouble(row.get(4)), Double.parseDouble(row.get(5)), Double.parseDouble(row.get(6)))); |
||||||
|
break; |
||||||
|
case 42: |
||||||
|
coordinateSystem.phonePair2 = new BlhCoordinatePair("", new Blh(Double.parseDouble(row.get(1)), Double.parseDouble(row.get(2)), Double.parseDouble(row.get(3))) |
||||||
|
, new Coordinate(Double.parseDouble(row.get(4)), Double.parseDouble(row.get(5)), Double.parseDouble(row.get(6)))); |
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
list.add(coordinateSystem); |
||||||
|
} |
||||||
|
|
||||||
|
Log.d("CoordinateSystemUtil", sysFile.getAbsolutePath() + ",导入成功"); |
||||||
|
} catch (NumberFormatException ex) { |
||||||
|
Log.d("CoordinateSystemUtil", sysFile.getAbsolutePath() + ",导入失败,原因:第" + line + "行,发现非数字字符串"); |
||||||
|
} catch (Exception ex) { |
||||||
|
ex.printStackTrace(); |
||||||
|
} |
||||||
|
return list; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,240 @@ |
|||||||
|
package com.project.survey.ui.instrument.setupstation.util; |
||||||
|
|
||||||
|
import android.content.Context; |
||||||
|
import android.content.SharedPreferences; |
||||||
|
import android.text.TextUtils; |
||||||
|
|
||||||
|
import androidx.annotation.WorkerThread; |
||||||
|
|
||||||
|
import com.bingce.TimeCount; |
||||||
|
import com.bingce.constants.FileNameConstants; |
||||||
|
import com.bingce.data.database.JobDb; |
||||||
|
import com.bingce.data.database.KeyValueDb; |
||||||
|
import com.bingce.data.database.PointDb; |
||||||
|
import com.bingce.data.surveyor.designdata.job.JobConstants; |
||||||
|
import com.bingce.data.surveyor.designdata.job.JobRecord; |
||||||
|
import com.bingce.data.surveyor.designdata.kv.KeyValueConstants; |
||||||
|
import com.bingce.data.surveyor.designdata.kv.KeyValueRecord; |
||||||
|
import com.bingce.data.surveyor.surveydata.pointsurvey.PointConstants; |
||||||
|
import com.bingce.data.surveyor.surveydata.pointsurvey.PointRecord; |
||||||
|
import com.bingce.log.BCLog; |
||||||
|
import com.bingce.poi.excel.ExcelReadHelper; |
||||||
|
import com.bingce.utils.AppUtil; |
||||||
|
import com.bingce.utils.StringUtil; |
||||||
|
import com.google.gson.Gson; |
||||||
|
import com.google.gson.JsonArray; |
||||||
|
import com.google.gson.JsonElement; |
||||||
|
import com.google.gson.JsonParser; |
||||||
|
import com.project.survey.R; |
||||||
|
import com.project.survey.ui.instrument.setupstation.bean.StakingJob; |
||||||
|
|
||||||
|
import java.io.File; |
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.Date; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
import blankj.utilcode.util.StringUtils; |
||||||
|
import cn.liuyanbing.surveyor.model.base.Point; |
||||||
|
import cn.liuyanbing.surveyor.model.base.PointArray; |
||||||
|
|
||||||
|
public class JobDbUtils { |
||||||
|
@WorkerThread |
||||||
|
static void collect(Context context, String projectId, File projectFolder, CollectLocalDataInAppStartFirstTimeUtil.ILog log, TimeCount.ITimeCounter time) { |
||||||
|
if (StringUtil.isEmpty(projectId) || projectFolder == null || !projectFolder.exists() || projectFolder.isFile()) { |
||||||
|
return; |
||||||
|
} |
||||||
|
log.log("读取面积测量作业"); |
||||||
|
log.log("读取点测量作业"); |
||||||
|
//收集点测量作业
|
||||||
|
collectPointSurveyJob(projectId, projectFolder, time); |
||||||
|
log.log("读取已知点放样作业"); |
||||||
|
//收集已知点放样作业
|
||||||
|
collectPointStakingJob(projectId, projectFolder, time); |
||||||
|
log.log("读取断面测量作业"); |
||||||
|
} |
||||||
|
|
||||||
|
/* |
||||||
|
* 收集项目下的点测量作业 |
||||||
|
*/ |
||||||
|
@WorkerThread |
||||||
|
private static void collectPointSurveyJob(String projectId, File projectFolder, TimeCount.ITimeCounter time) { |
||||||
|
String fileName = FileNameConstants.POINT_SURVEYOR; |
||||||
|
collectXJob(projectId, projectFolder, FileNameConstants.POINT_SURVEYOR_JOB_PREFIX, fileName, time); |
||||||
|
} |
||||||
|
|
||||||
|
@WorkerThread |
||||||
|
private static void collectPointStakingJob(String projectId, File projectFolder, TimeCount.ITimeCounter timeCounter) { |
||||||
|
File stakingFile = new File(projectFolder, FileNameConstants.CONFIG_FILE_KNOWN_POINT_STAKING); |
||||||
|
if (!stakingFile.exists()) { |
||||||
|
stakingFile = new File(projectFolder, "放样点库.xls"); |
||||||
|
} |
||||||
|
if (!stakingFile.exists()) { |
||||||
|
return; |
||||||
|
} |
||||||
|
List<StakingJob> stakingJobs = new ArrayList<>(); |
||||||
|
String error = readStakingJob(stakingFile, stakingJobs); |
||||||
|
BCLog.log(log -> log.e("collect_job", projectId + "__" + error)); |
||||||
|
for (StakingJob job : stakingJobs) { |
||||||
|
String stakingJobName = job.getName(); |
||||||
|
JobRecord record = JobDb.getInstance().rawQueryData( |
||||||
|
JobConstants.findByProjectAndName(projectId, FileNameConstants.POINT_STAKE_JOB_PREFIX + stakingJobName)); |
||||||
|
if (record != null) { |
||||||
|
BCLog.log(log -> log.d("collect_warning", "stakingJob 重复收集-" + stakingJobName)); |
||||||
|
continue; |
||||||
|
} |
||||||
|
JobRecord jobRecord = new JobRecord(FileNameConstants.POINT_STAKE_JOB_PREFIX + stakingJobName, projectId, timeCounter.time()); |
||||||
|
JobDb.getInstance().save(jobRecord); |
||||||
|
String jobId = jobRecord.id; |
||||||
|
//存储放样任务设置点坐标
|
||||||
|
PointArray pointArray = job.getPointList(); |
||||||
|
if (pointArray == null || pointArray.isEmpty()) { |
||||||
|
continue; |
||||||
|
} |
||||||
|
List<PointRecord> pointRecords = new ArrayList<>(); |
||||||
|
for (int index = 0; index < pointArray.size(); index++) { |
||||||
|
Point point = pointArray.get(index); |
||||||
|
PointRecord pointRecord = new PointRecord(projectId, jobId, "", |
||||||
|
PointConstants.POINT_TYPE_KNOWN_POINT, |
||||||
|
point.getName(), point.getCode(), point.getRemarks(), |
||||||
|
point.getX(), point.getY(), point.getZ(), |
||||||
|
0, 0, 0, |
||||||
|
PointConstants.POINT_FORMAT_XYZ, null); |
||||||
|
pointRecord.createDate = new Date(timeCounter.time()); |
||||||
|
pointRecords.add(pointRecord); |
||||||
|
} |
||||||
|
PointDb.getInstance().save(pointRecords); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private static String readStakingJob(File stakingFile, List<StakingJob> stakingJobs) { |
||||||
|
String result = ""; |
||||||
|
int line = 0; |
||||||
|
try { |
||||||
|
List<List<List<String>>> importResult = ExcelReadHelper.excelReadBySheet(stakingFile, ExcelReadHelper.FIRST_ROW_NOT_IGNORE); |
||||||
|
if (importResult == null) return ""; |
||||||
|
for (int i = 0; i < importResult.size(); i++) { |
||||||
|
line = 0; |
||||||
|
List<List<String>> sheetResult = importResult.get(i); |
||||||
|
if (sheetResult == null || sheetResult.isEmpty()) { |
||||||
|
if (AppUtil.isZh()) { |
||||||
|
return stakingFile.getAbsolutePath() + ",导入失败,原因:导入excel为空"; |
||||||
|
} else { |
||||||
|
result = stakingFile.getAbsolutePath() + "," + StringUtils.getString(R.string.import_failed); |
||||||
|
} |
||||||
|
} |
||||||
|
String sheetName = sheetResult.get(0).isEmpty() ? "default" : sheetResult.get(0).get(0); |
||||||
|
StakingJob stakeOutJob = new StakingJob(sheetName); |
||||||
|
for (int j = 1; j < sheetResult.size(); j++) { |
||||||
|
List<String> row = sheetResult.get(j); |
||||||
|
|
||||||
|
line = j + 1; |
||||||
|
if (row.isEmpty() || ExcelReadHelper.isRowEmpty(row)) { |
||||||
|
continue; |
||||||
|
} |
||||||
|
if (row.size() != 8) { |
||||||
|
if (AppUtil.isZh()) { |
||||||
|
result = stakingFile.getAbsolutePath() + "/" + sheetName + ",导入失败,原因:第" + line + "行,元素个数必须为8"; |
||||||
|
} else { |
||||||
|
result = stakingFile.getAbsolutePath() + "," + StringUtils.getString(R.string.import_failed); |
||||||
|
} |
||||||
|
break; |
||||||
|
} |
||||||
|
stakeOutJob.getPointList().add(Integer.parseInt(row.get(0)), row.get(1), row.get(2), Double.parseDouble(row.get(3)) |
||||||
|
, Double.parseDouble(row.get(4)), Double.parseDouble(row.get(5)), row.get(6), row.get(7)); |
||||||
|
} |
||||||
|
stakingJobs.add(stakeOutJob); |
||||||
|
} |
||||||
|
if ("".equals(result)) { |
||||||
|
result = stakingFile.getAbsolutePath() + "," + "," + StringUtils.getString(R.string.import_success); |
||||||
|
} |
||||||
|
} catch (NumberFormatException ex) { |
||||||
|
if (AppUtil.isZh()) { |
||||||
|
result = stakingFile.getAbsolutePath() + ",导入失败,原因:第" + line + "行,发现非数字字符串"; |
||||||
|
} else { |
||||||
|
result = stakingFile.getAbsolutePath() + "," + StringUtils.getString(R.string.import_failed); |
||||||
|
} |
||||||
|
} catch (Exception ex) { |
||||||
|
ex.printStackTrace(); |
||||||
|
} |
||||||
|
|
||||||
|
return result; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 收集面积测量任务和点测量任务 |
||||||
|
*/ |
||||||
|
@WorkerThread |
||||||
|
static void collectXJob(String projectId, File projectFolder, String prefix, String jsonArrayFileName, TimeCount.ITimeCounter time) { |
||||||
|
if (projectId == null || projectFolder == null || !projectFolder.exists()) { |
||||||
|
return; |
||||||
|
} |
||||||
|
JsonStringArray jsonStringArray = readListStringJson(projectFolder, jsonArrayFileName); |
||||||
|
if (jsonStringArray != null && jsonStringArray.getStrings() != null) { //1.尝试读取「.json」文件
|
||||||
|
List<String> surveyJobList = jsonStringArray.getStrings(); |
||||||
|
for (String jobString : surveyJobList) { |
||||||
|
String jobName = prefix + jobString; |
||||||
|
JobRecord record = JobDb.getInstance().rawQueryData( |
||||||
|
JobConstants.findByProjectAndName(projectId, jobName)); |
||||||
|
if (record != null) { |
||||||
|
BCLog.log(log -> log.d("collect_warning", "测量任务 重复收集-" + jobName + " in " + projectId)); |
||||||
|
continue; |
||||||
|
} |
||||||
|
JobRecord jobRecord = new JobRecord(jobName, projectId, time.time()); |
||||||
|
JobDb.getInstance().save(jobRecord); |
||||||
|
} |
||||||
|
} else { //2.尝试读取「.job」文件
|
||||||
|
//todo 暂时放弃
|
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 读取面积测量、点测量任务配置文件 |
||||||
|
*/ |
||||||
|
private static JsonStringArray readListStringJson(File prjFolder, String fileName) { |
||||||
|
if (!new File(prjFolder, fileName + "." + FileNameConstants.JSON_SUFFIX).exists()) {//应用自有目录下文件是否存在
|
||||||
|
return null; |
||||||
|
} else { |
||||||
|
try { |
||||||
|
return JsonStringArray.read(prjFolder, fileName, FileNameConstants.JSON_SUFFIX); |
||||||
|
} catch (Exception ex) { |
||||||
|
File target = new File(prjFolder, fileName + FileNameConstants.JSON_SUFFIX); |
||||||
|
BCLog.log(log -> log.e("Read Config", "read " + target.getAbsolutePath() + " failure!" + "\n" + ex.toString())); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* json转换成列表 |
||||||
|
*/ |
||||||
|
//Json数组字符串转换为对应的列表
|
||||||
|
private static <T> List<T> getDataList(Context context, String tag, Class<T> cls) { |
||||||
|
List<T> list = new ArrayList<>(); |
||||||
|
SharedPreferences preferences = context.getSharedPreferences("bingce_celiangyuan", Context.MODE_PRIVATE); |
||||||
|
String json = preferences.getString(tag, ""); |
||||||
|
if (!TextUtils.isEmpty(json)) { |
||||||
|
Gson gson = new Gson(); |
||||||
|
JsonArray array = new JsonParser().parse(json).getAsJsonArray(); |
||||||
|
for (JsonElement elem : array) { |
||||||
|
try { |
||||||
|
list.add(gson.fromJson(elem, cls)); |
||||||
|
} catch (Exception ignore) { |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
return list; |
||||||
|
} |
||||||
|
|
||||||
|
@WorkerThread |
||||||
|
public static String createDefaultJob(Context context, String projectId, long time) { |
||||||
|
JobRecord jobRecord = new JobRecord(context.getString(R.string.default_work_name), projectId, time); |
||||||
|
JobDb.getInstance().save(jobRecord); |
||||||
|
|
||||||
|
KeyValueRecord defaultJobConfig = new KeyValueRecord(KeyValueConstants.keyOfProjectCurrentJob(projectId), jobRecord.id); |
||||||
|
KeyValueDb.getInstance().save(defaultJobConfig); |
||||||
|
BCLog.Launcher.log(() -> "为项目[" + projectId + "]创建默认作业[" + jobRecord.id + "]"); |
||||||
|
|
||||||
|
return jobRecord.id; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,70 @@ |
|||||||
|
package com.project.survey.ui.instrument.setupstation.util; |
||||||
|
|
||||||
|
import com.bingce.utils.FileUtil; |
||||||
|
import com.google.gson.Gson; |
||||||
|
import com.google.gson.reflect.TypeToken; |
||||||
|
|
||||||
|
import java.io.File; |
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
class JsonStringArray { |
||||||
|
private String name; |
||||||
|
private List<String> strings = new ArrayList<>(); |
||||||
|
|
||||||
|
public JsonStringArray() { |
||||||
|
} |
||||||
|
|
||||||
|
public JsonStringArray(String name) { |
||||||
|
this.name = name; |
||||||
|
strings = new ArrayList<>(); |
||||||
|
} |
||||||
|
|
||||||
|
public List<String> getStrings() { |
||||||
|
return strings; |
||||||
|
} |
||||||
|
|
||||||
|
public void setStrings(List<String> strings) { |
||||||
|
this.strings = strings; |
||||||
|
} |
||||||
|
|
||||||
|
public String getName() { |
||||||
|
return name; |
||||||
|
} |
||||||
|
|
||||||
|
public void setName(String name) { |
||||||
|
this.name = name; |
||||||
|
} |
||||||
|
|
||||||
|
public static JsonStringArray read(File folder, String name, String suffix) { |
||||||
|
JsonStringArray jsonStringArray = new JsonStringArray(name); |
||||||
|
File target = new File(folder, name + "." + suffix); |
||||||
|
if (!target.exists()) { |
||||||
|
return jsonStringArray; |
||||||
|
} |
||||||
|
FileUtil.ReadFileResult readFileResult = FileUtil.readStringFrom(target); |
||||||
|
if (readFileResult.success) { |
||||||
|
try { |
||||||
|
List<String> result = gson.fromJson(readFileResult.string, new TypeToken<List<String>>() { |
||||||
|
}.getType()); |
||||||
|
if (result != null) { |
||||||
|
jsonStringArray.strings.addAll(result); |
||||||
|
} |
||||||
|
} catch (Exception e) { |
||||||
|
e.printStackTrace(); |
||||||
|
} |
||||||
|
} |
||||||
|
return jsonStringArray; |
||||||
|
} |
||||||
|
|
||||||
|
public void save(File folder, String suffix) { |
||||||
|
String json = gson.toJson(strings); |
||||||
|
FileUtil.writeString(json, new File(folder, name + "." + suffix)); |
||||||
|
} |
||||||
|
|
||||||
|
public void clear() { |
||||||
|
strings.clear(); |
||||||
|
} |
||||||
|
|
||||||
|
private static final Gson gson = new Gson(); |
||||||
|
} |
@ -0,0 +1,50 @@ |
|||||||
|
package com.project.survey.ui.instrument.setupstation.util; |
||||||
|
|
||||||
|
import android.content.Context; |
||||||
|
|
||||||
|
import androidx.annotation.WorkerThread; |
||||||
|
|
||||||
|
import com.bingce.TimeCount; |
||||||
|
import com.bingce.constants.FileNameConstants; |
||||||
|
import com.bingce.data.database.KeyValueDb; |
||||||
|
import com.bingce.data.surveyor.designdata.kv.KeyValueConstants; |
||||||
|
import com.bingce.data.surveyor.designdata.kv.KeyValueRecord; |
||||||
|
|
||||||
|
import java.io.File; |
||||||
|
|
||||||
|
public class MigrationBingCeFolderDataUtils { |
||||||
|
@WorkerThread |
||||||
|
public static boolean collectFromBingCeFolder(Context appCompatActivity, File dataFolder, CollectLocalDataInAppStartFirstTimeUtil.ILog log, TimeCount.ITimeCounter timeCounter) { |
||||||
|
if (!dataFolder.exists()) { |
||||||
|
return false; |
||||||
|
} |
||||||
|
File mark = new File(dataFolder, CollectLocalDataInAppStartFirstTimeUtil.COLLECTED_FILE_NAME); |
||||||
|
if (mark.exists()) {//已经收集过了
|
||||||
|
log.log("BingCe目录下数据已读取"); |
||||||
|
return true; |
||||||
|
} |
||||||
|
log.log("读取坐标系数据"); |
||||||
|
//0.收集坐标系模板
|
||||||
|
CoordinatorSystemCollectUtils.collectCoordinatorTemplate(new File(dataFolder, FileNameConstants.CONFIG_FILE_EXCEL_COORDINATOR_OF_PROJECT), timeCounter); |
||||||
|
//1.收集全站仪数据
|
||||||
|
_1TotalStationCollectUtils.collect(dataFolder, log); |
||||||
|
//遍历目录
|
||||||
|
File[] projects = dataFolder.listFiles(); |
||||||
|
if (projects == null) { |
||||||
|
return false; |
||||||
|
} |
||||||
|
//遍历项目目录
|
||||||
|
for (File project : projects) { |
||||||
|
if (!project.exists() || project.isFile()) { |
||||||
|
continue; |
||||||
|
} |
||||||
|
ProjectDbUtils.collect(appCompatActivity, project, log, timeCounter); |
||||||
|
} |
||||||
|
//生成收集标识
|
||||||
|
if (!CollectLocalDataInAppStartFirstTimeUtil.generatorCollectedFile(dataFolder)) { |
||||||
|
KeyValueDb.getInstance().save(new KeyValueRecord(CollectLocalDataInAppStartFirstTimeUtil.GENERATOR_COLLECTED_FILE_FAILURE |
||||||
|
, KeyValueConstants.VALUE_YES)); |
||||||
|
} |
||||||
|
return true; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,26 @@ |
|||||||
|
package com.project.survey.ui.instrument.setupstation.util; |
||||||
|
|
||||||
|
import android.content.Context; |
||||||
|
|
||||||
|
import com.bingce.TimeCount; |
||||||
|
import com.bingce.data.database.KeyValueDb; |
||||||
|
import com.bingce.data.surveyor.designdata.kv.KeyValueConstants; |
||||||
|
import com.bingce.data.surveyor.designdata.kv.KeyValueRecord; |
||||||
|
|
||||||
|
import java.io.File; |
||||||
|
|
||||||
|
public class MigrationCeliangyuanFolderDataUtils { |
||||||
|
static boolean collectFromCeliangyuanFolder( |
||||||
|
Context appCompatActivity, File celiangyuanFolder, CollectLocalDataInAppStartFirstTimeUtil.ILog log, TimeCount.ITimeCounter timeCounter) { |
||||||
|
log.log("读取测量员目录下数据"); |
||||||
|
if (!ProjectDbUtils.collect(appCompatActivity, celiangyuanFolder, log, timeCounter)) { |
||||||
|
return false; |
||||||
|
} |
||||||
|
//生成收集标识
|
||||||
|
if (!CollectLocalDataInAppStartFirstTimeUtil.generatorCollectedFile(celiangyuanFolder)) { |
||||||
|
KeyValueDb.getInstance().save(new KeyValueRecord(CollectLocalDataInAppStartFirstTimeUtil.GENERATOR_COLLECTED_FILE_FAILURE |
||||||
|
, KeyValueConstants.VALUE_YES)); |
||||||
|
} |
||||||
|
return true; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,59 @@ |
|||||||
|
package com.project.survey.ui.instrument.setupstation.util; |
||||||
|
|
||||||
|
import android.content.Context; |
||||||
|
|
||||||
|
import androidx.annotation.NonNull; |
||||||
|
import androidx.annotation.WorkerThread; |
||||||
|
|
||||||
|
import com.bingce.TimeCount; |
||||||
|
import com.bingce.coordlib.model.CoordinateSystem; |
||||||
|
import com.bingce.data.database.KeyValueDb; |
||||||
|
import com.bingce.data.database.ProjectDb; |
||||||
|
import com.bingce.data.surveyor.designdata.kv.KeyValueConstants; |
||||||
|
import com.bingce.data.surveyor.designdata.kv.KeyValueRecord; |
||||||
|
import com.bingce.data.surveyor.designdata.project.ProjectRecord; |
||||||
|
import com.bingce.utils.StringUtil; |
||||||
|
|
||||||
|
import java.io.File; |
||||||
|
|
||||||
|
public class ProjectDbUtils { |
||||||
|
@WorkerThread |
||||||
|
static boolean collect(@NonNull Context context, @NonNull File projectFolder, CollectLocalDataInAppStartFirstTimeUtil.ILog log, TimeCount.ITimeCounter timeCounter) { |
||||||
|
if (!projectFolder.exists() || projectFolder.isFile()) { |
||||||
|
return false; |
||||||
|
} |
||||||
|
log.log("读取[" + projectFolder.getName() + "]项目数据"); |
||||||
|
//收集项目坐标系
|
||||||
|
CoordinateSystem coordinateSystem = _3CoordinatorCollectUtils.collectCoordinatorOfProject(projectFolder); |
||||||
|
//创建项目记录
|
||||||
|
ProjectRecord projectRecord = new ProjectRecord(projectFolder.getName(), coordinateSystem, timeCounter.time()); |
||||||
|
String projectId = projectRecord.id; |
||||||
|
//收集道路信息
|
||||||
|
File[] folders = projectFolder.listFiles(); |
||||||
|
if (folders != null) { |
||||||
|
for (File folder : folders) { |
||||||
|
String id = RoadDbUtils.collectRoad(projectId, folder, log, timeCounter.time()); |
||||||
|
if (StringUtil.isEmpty(id)) { |
||||||
|
continue; |
||||||
|
} |
||||||
|
projectRecord.roadSequence.add(id); |
||||||
|
} |
||||||
|
} |
||||||
|
//检测是否有线路
|
||||||
|
if (projectRecord.roadSequence.isEmpty()) { |
||||||
|
String defaultRoadId = RoadDbUtils.createDefaultRoad(context, projectId); |
||||||
|
projectRecord.roadSequence.add(defaultRoadId); |
||||||
|
} |
||||||
|
KeyValueRecord defaultRoadConfig = new KeyValueRecord(KeyValueConstants.keyOfProjectCurrentRoad(projectId), projectRecord.roadSequence.get(0)); |
||||||
|
KeyValueDb.getInstance().save(defaultRoadConfig); |
||||||
|
//需要在更新过线路顺序后再存储project
|
||||||
|
ProjectDb.getInstance().save(projectRecord); |
||||||
|
//收集作业
|
||||||
|
//创建默认作业,用于存储各种测量信息
|
||||||
|
String defaultJobId = JobDbUtils.createDefaultJob(context, projectId, timeCounter.time()); |
||||||
|
JobDbUtils.collect(context, projectId, projectFolder, log, timeCounter); |
||||||
|
//收集全局控制点
|
||||||
|
_6GlobalControlPointCollectUtils.collect(projectId, defaultJobId, projectFolder, log, timeCounter); |
||||||
|
return true; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,71 @@ |
|||||||
|
package com.project.survey.ui.instrument.setupstation.util; |
||||||
|
|
||||||
|
import android.content.Context; |
||||||
|
import android.util.Log; |
||||||
|
|
||||||
|
import androidx.annotation.WorkerThread; |
||||||
|
|
||||||
|
import com.bingce.constants.FileNameConstants; |
||||||
|
import com.project.survey.BuildConfig; |
||||||
|
import com.bingce.data.database.KeyValueDb; |
||||||
|
import com.bingce.data.database.RoadDb; |
||||||
|
import com.bingce.data.surveyor.designdata.kv.KeyValueConstants; |
||||||
|
import com.bingce.data.surveyor.designdata.kv.KeyValueRecord; |
||||||
|
import com.bingce.data.surveyor.designdata.road.RoadRecord; |
||||||
|
import com.bingce.log.BCLog; |
||||||
|
import com.bingce.road.RoadRecordConvertUtils; |
||||||
|
import com.bingce.road.xport.RoadAllUtil; |
||||||
|
import com.bingce.utils.IdUtils; |
||||||
|
|
||||||
|
import java.io.File; |
||||||
|
|
||||||
|
import com.project.survey.R; |
||||||
|
import cn.liuyanbing.surveyor.model.base.Road; |
||||||
|
|
||||||
|
public class RoadDbUtils { |
||||||
|
/** |
||||||
|
* 收集道路数据 |
||||||
|
* |
||||||
|
* @return 成功返回RoadRecord实例(已经被存储到数据库中)的id,失败返回null |
||||||
|
*/ |
||||||
|
@WorkerThread |
||||||
|
static String collectRoad(String projectId, File roadFolder, CollectLocalDataInAppStartFirstTimeUtil.ILog log, long time) { |
||||||
|
//1.检测是否是道路数据目录
|
||||||
|
if (!RoadAllUtil.isRoadFolder(roadFolder)) { |
||||||
|
return null; |
||||||
|
} |
||||||
|
log.log("开始读取道路数据[" + roadFolder.getName() + "]"); |
||||||
|
if (BuildConfig.DEBUG) { |
||||||
|
Log.d("__test_develop", "收集Road" + roadFolder.getName() + ": "); |
||||||
|
} |
||||||
|
//2.优化使用json文件导入道路数据
|
||||||
|
File jsonFile = new File(roadFolder, FileNameConstants.DEFAULT_ROAD_DATA_FILE_NAME); |
||||||
|
Road road = new Road(roadFolder.getName()); |
||||||
|
if (!jsonFile.exists() || !road.read(jsonFile.getAbsolutePath())) { |
||||||
|
if (BuildConfig.DEBUG) { |
||||||
|
Log.d("__test_develop", "收集Road" + roadFolder.getName() + ": 读取road.json失败"); |
||||||
|
} |
||||||
|
//如果json文件导入失败,尝试读取excel或txt
|
||||||
|
RoadAllUtil.importRoadArgs(roadFolder, road, false); |
||||||
|
} |
||||||
|
RoadRecord roadRecord = RoadRecordConvertUtils.convert2Record(road, projectId, time); |
||||||
|
//检测id是否是uuid
|
||||||
|
//检测UUID是否合法----之前使用id是根据时间创建的,现在需要将其转换为uuid
|
||||||
|
int deprecatedIdSize = "20220707092909073544".length(); |
||||||
|
if (roadRecord.id.length() <= deprecatedIdSize) { |
||||||
|
roadRecord.id = IdUtils.getUUID(); |
||||||
|
} |
||||||
|
RoadDb.getInstance().save(roadRecord); |
||||||
|
return roadRecord.id; |
||||||
|
} |
||||||
|
|
||||||
|
@WorkerThread |
||||||
|
public static String createDefaultRoad(Context context, String projectId) { |
||||||
|
//设置默认线路
|
||||||
|
RoadRecord roadRecord = RoadDb.getInstance().createNewInstance(projectId, context.getString(R.string.default_road)); |
||||||
|
KeyValueRecord defaultRoadConfig = new KeyValueRecord(KeyValueConstants.keyOfProjectCurrentRoad(projectId), roadRecord.id); |
||||||
|
KeyValueDb.getInstance().save(defaultRoadConfig); |
||||||
|
BCLog.Launcher.log(() ->"为项目[" + projectId + "]创建默认线路[" + roadRecord.id + "]"); |
||||||
|
return roadRecord.id; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,79 @@ |
|||||||
|
package com.project.survey.ui.instrument.setupstation.util; |
||||||
|
|
||||||
|
import static com.bingce.data.database.DBQueryConstant.NOT_DELETED; |
||||||
|
import static com.bingce.data.database.DBQueryConstant.WHERE; |
||||||
|
|
||||||
|
import android.text.TextUtils; |
||||||
|
|
||||||
|
import androidx.annotation.NonNull; |
||||||
|
import androidx.sqlite.db.SimpleSQLiteQuery; |
||||||
|
import androidx.sqlite.db.SupportSQLiteQuery; |
||||||
|
|
||||||
|
import com.bingce.data.BingCeDbConstant; |
||||||
|
import com.bingce.data.database.DBQueryConstant; |
||||||
|
import com.bingce.data.surveyor.surveydata.pointsurvey.PointConstants; |
||||||
|
import com.bingce.utils.RoomFilterBuilder; |
||||||
|
import com.bingce.utils.StringUtil; |
||||||
|
import com.bingce.viewmodel.AbstractCoordinatePointsLibraryViewModelKt.FilterParameter; |
||||||
|
|
||||||
|
|
||||||
|
public class StakingPointsLibraryActivitySQLiteUtils { |
||||||
|
@NonNull |
||||||
|
static SimpleSQLiteQuery getSimpleSQLiteQuery(FilterParameter parameter, StringBuilder stringBuilder, String jobOrProjectId, int pageIndex, int pageSize, boolean stakingFlag, String nameOrCodeStr) { |
||||||
|
if (parameter == null) { |
||||||
|
return new SimpleSQLiteQuery(stringBuilder.toString()); |
||||||
|
} |
||||||
|
stringBuilder.append(WHERE).append(NOT_DELETED); |
||||||
|
boolean filtered = stakingFlag ? |
||||||
|
RoomFilterBuilder.appendEqualsFilter(true, stringBuilder, BingCeDbConstant.DB_KEY_JOB_ID, jobOrProjectId): |
||||||
|
RoomFilterBuilder.appendEqualsFilter(true,stringBuilder,BingCeDbConstant.DB_KEY_PROJECT_ID,jobOrProjectId); |
||||||
|
filtered = stakingFlag? PointConstants.knownPoint(filtered, stringBuilder) : PointConstants.globalControlPoint(filtered,stringBuilder); |
||||||
|
|
||||||
|
if (!StringUtil.isEmpty(parameter.getNameKey())) { |
||||||
|
filtered = RoomFilterBuilder.appendLikesFilter(filtered, stringBuilder, PointConstants.COL_NAME, parameter.getNameKey()); |
||||||
|
} |
||||||
|
if (!StringUtil.isEmpty(parameter.getCodeKey())) { |
||||||
|
filtered = RoomFilterBuilder.appendLikesFilter(filtered, stringBuilder, PointConstants.COL_CODE, parameter.getCodeKey()); |
||||||
|
} |
||||||
|
if (!StringUtil.isEmpty(parameter.getRemarkKey())) { |
||||||
|
filtered = RoomFilterBuilder.appendLikesFilter(filtered, stringBuilder, BingCeDbConstant.DB_KEY_REMARKS, parameter.getRemarkKey()); |
||||||
|
} |
||||||
|
if (!TextUtils.isEmpty(nameOrCodeStr)){ |
||||||
|
stringBuilder.append(" AND "); |
||||||
|
stringBuilder.append(" ("); |
||||||
|
stringBuilder.append(RoomFilterBuilder.filterLike(PointConstants.COL_NAME, nameOrCodeStr)); |
||||||
|
RoomFilterBuilder.appendOrLikesFilter(filtered,stringBuilder,PointConstants.COL_CODE,nameOrCodeStr); |
||||||
|
stringBuilder.append(") "); |
||||||
|
} |
||||||
|
if (parameter.getDateStart() != null && parameter.getDateEnd() != null) { |
||||||
|
filtered = RoomFilterBuilder.appendBetweenDate(filtered, stringBuilder, BingCeDbConstant.DB_KEY_CREATED_DATE, |
||||||
|
parameter.getDateStart(), parameter.getDateEnd()); |
||||||
|
} else if (parameter.getDateStart() != null) { |
||||||
|
filtered = RoomFilterBuilder.appendDateFilter(filtered, stringBuilder, parameter.getDateStart(), BingCeDbConstant.DB_KEY_CREATED_DATE, true); |
||||||
|
} else if (parameter.getDateEnd() != null) { |
||||||
|
filtered = RoomFilterBuilder.appendDateFilter(filtered, stringBuilder, parameter.getDateEnd(), BingCeDbConstant.DB_KEY_CREATED_DATE, false); |
||||||
|
} |
||||||
|
|
||||||
|
RoomFilterBuilder.appendDateOrder(stringBuilder, BingCeDbConstant.DB_KEY_CREATED_DATE, false); |
||||||
|
return new SimpleSQLiteQuery(stringBuilder.toString()); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public static SupportSQLiteQuery countSQLit(String jobId, FilterParameter parameter, boolean stakingFlag) { |
||||||
|
StringBuilder stringBuilder = new StringBuilder(DBQueryConstant.COUNT_FROM) |
||||||
|
.append(PointConstants.DB_NAME); |
||||||
|
return getSimpleSQLiteQuery(parameter, stringBuilder, jobId, -1, -1,stakingFlag,null); |
||||||
|
} |
||||||
|
|
||||||
|
public static SupportSQLiteQuery searchSQLit(String jobId, FilterParameter parameter, int pageIndex, int pageSize, boolean stakingFlag) { |
||||||
|
StringBuilder stringBuilder = new StringBuilder(DBQueryConstant.SELECT_FROM) |
||||||
|
.append(PointConstants.DB_NAME); |
||||||
|
return getSimpleSQLiteQuery(parameter, stringBuilder, jobId, pageIndex, pageSize,stakingFlag,null); |
||||||
|
} |
||||||
|
|
||||||
|
public static SupportSQLiteQuery searchSQLit(String jobOrProjectId, FilterParameter parameter, boolean stakingFlag, String nameOrCode){ |
||||||
|
StringBuilder stringBuilder = new StringBuilder(DBQueryConstant.SELECT_FROM) |
||||||
|
.append(PointConstants.DB_NAME); |
||||||
|
return getSimpleSQLiteQuery(parameter, stringBuilder, jobOrProjectId, -1, -1,stakingFlag,nameOrCode); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,44 @@ |
|||||||
|
package com.project.survey.ui.instrument.setupstation.util; |
||||||
|
|
||||||
|
import androidx.annotation.WorkerThread; |
||||||
|
|
||||||
|
import com.bingce.totalstation.TsConfig; |
||||||
|
import com.bingce.utils.FileUtil; |
||||||
|
|
||||||
|
import java.io.File; |
||||||
|
|
||||||
|
import blankj.utilcode.util.Utils; |
||||||
|
|
||||||
|
class _1TotalStationCollectUtils { |
||||||
|
@WorkerThread |
||||||
|
static void collect(File appFolder, CollectLocalDataInAppStartFirstTimeUtil.ILog log) { |
||||||
|
log.log("读取全站仪数据..."); |
||||||
|
//1.优化读取total_station.json
|
||||||
|
File jsonFile = new File(appFolder, TsConfig.CONFIG_FILE); |
||||||
|
if (jsonFile.exists()) { |
||||||
|
FileUtil.ReadFileResult readFileResult = FileUtil.readStringFrom(jsonFile); |
||||||
|
if (readFileResult.success) { |
||||||
|
save(readFileResult.string); |
||||||
|
} |
||||||
|
log.log("完成全站仪数据收集."); |
||||||
|
return; |
||||||
|
} |
||||||
|
//2.读取其他
|
||||||
|
File configJsonFile = new File(appFolder, "totalstation.json"); |
||||||
|
if (configJsonFile.exists()) { |
||||||
|
FileUtil.ReadFileResult readFileResult = FileUtil.readStringFrom(configJsonFile); |
||||||
|
if (readFileResult.success) { |
||||||
|
save(readFileResult.string); |
||||||
|
log.log("完成全站仪数据收集.."); |
||||||
|
return; |
||||||
|
} |
||||||
|
} |
||||||
|
log.log("结束全站仪数据收集."); |
||||||
|
} |
||||||
|
|
||||||
|
@WorkerThread |
||||||
|
private static void save(String configString) { |
||||||
|
File configJsonFile = new File(Utils.getApp().getFilesDir(), TsConfig.CONFIG_FILE); |
||||||
|
FileUtil.writeString(configString, configJsonFile); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,348 @@ |
|||||||
|
package com.project.survey.ui.instrument.setupstation.util; |
||||||
|
|
||||||
|
import android.util.Log; |
||||||
|
|
||||||
|
import androidx.annotation.WorkerThread; |
||||||
|
|
||||||
|
import com.bingce.coordlib.enums.DatumEnum; |
||||||
|
import com.bingce.coordlib.enums.EllipsoidEnum; |
||||||
|
import com.bingce.coordlib.enums.GridEnum; |
||||||
|
import com.bingce.coordlib.enums.HFittingEnum; |
||||||
|
import com.bingce.coordlib.enums.ProjectionEnum; |
||||||
|
import com.bingce.coordlib.model.Blh; |
||||||
|
import com.bingce.coordlib.model.BlhCoordinatePair; |
||||||
|
import com.bingce.coordlib.model.Coordinate; |
||||||
|
import com.bingce.coordlib.model.CoordinateSystem; |
||||||
|
import com.bingce.coordlib.util.CoordinateSystemUtil; |
||||||
|
import com.bingce.coordlib.util.CoordinateSystemUtilOld; |
||||||
|
import com.bingce.poi.excel.ExcelReadHelper; |
||||||
|
import com.bingce.utils.Util; |
||||||
|
|
||||||
|
import java.io.File; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
import blankj.utilcode.util.Utils; |
||||||
|
|
||||||
|
class _3CoordinatorCollectUtils { |
||||||
|
/** |
||||||
|
* 收集坐标系数据 |
||||||
|
* |
||||||
|
* @return 成功返回CoordinateRecord实例(已经被存储到数据库中),失败返回null |
||||||
|
*/ |
||||||
|
@WorkerThread |
||||||
|
static CoordinateSystem collectCoordinatorOfProject(File projectFolder) { |
||||||
|
//先尝试收集.json
|
||||||
|
CoordinateSystem coordinateSystem = CoordinateSystemUtilOld.importCoordSysJsonFile(projectFolder); |
||||||
|
//如果json坐标文件不存在,尝试读取excel
|
||||||
|
if (coordinateSystem == null) { |
||||||
|
coordinateSystem = importCoordSysExcelFile(projectFolder); |
||||||
|
} |
||||||
|
if (coordinateSystem == null){ |
||||||
|
coordinateSystem = CoordinateSystemUtil.importCoordSysStringFile(projectFolder); |
||||||
|
} |
||||||
|
//如果仍然没有配置文件,则尝试新建
|
||||||
|
if (coordinateSystem == null) { |
||||||
|
coordinateSystem = CoordinateSystem.newCoordinateSystem(Utils.getApp()); |
||||||
|
} |
||||||
|
return coordinateSystem; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 导入excel版坐标系统 |
||||||
|
* |
||||||
|
* @param prjFolder 工程文件夹路径 |
||||||
|
* @return 坐标系统 |
||||||
|
*/ |
||||||
|
private static CoordinateSystem importCoordSysExcelFile(File prjFolder) { |
||||||
|
File sysFile = new File(prjFolder, "coordinate_system.xls"); |
||||||
|
if (!sysFile.exists() || sysFile.isDirectory()) { |
||||||
|
return null; |
||||||
|
} |
||||||
|
CoordinateSystem coordinateSystem = new CoordinateSystem(); |
||||||
|
coordinateSystem.isPreset = false; |
||||||
|
int line = 0; |
||||||
|
try { |
||||||
|
List<List<List<String>>> importResult = ExcelReadHelper.excelReadBySheet(sysFile, ExcelReadHelper.FIRST_ROW_NOT_IGNORE); |
||||||
|
if (importResult == null) return coordinateSystem; |
||||||
|
if (importResult.isEmpty()) return coordinateSystem; |
||||||
|
|
||||||
|
line = 0; |
||||||
|
List<List<String>> sheetResult = importResult.get(0); |
||||||
|
if (sheetResult == null || sheetResult.isEmpty()) { |
||||||
|
Log.d("CoordinateSystemUtil", sysFile.getAbsolutePath() + ",导入失败,原因:导入excel为空"); |
||||||
|
return coordinateSystem; |
||||||
|
} |
||||||
|
String sheetName = sheetResult.get(0).isEmpty() ? "default" : sheetResult.get(0).get(0); |
||||||
|
coordinateSystem.setName(sheetName); |
||||||
|
for (int j = 1; j < sheetResult.size(); j++) { |
||||||
|
List<String> row = sheetResult.get(j); |
||||||
|
|
||||||
|
line = j + 1; |
||||||
|
if (row.isEmpty() || ExcelReadHelper.isRowEmpty(row)) { |
||||||
|
continue; |
||||||
|
} |
||||||
|
if (row.size() != 2 && row.size() != 7 && row.size() != 6 && row.size() != 9) { |
||||||
|
Log.d("CoordinateSystemUtil", sysFile.getAbsolutePath() + ",导入失败,原因:第" + line + "行,元素个数必须为2,7,6,9"); |
||||||
|
break; |
||||||
|
} |
||||||
|
if (row.size() == 2) { |
||||||
|
switch (row.get(0)) { |
||||||
|
case "isPreset": |
||||||
|
int preset = Integer.parseInt(row.get(1)); |
||||||
|
coordinateSystem.isPreset = preset == 1; |
||||||
|
break; |
||||||
|
case "rtkTransformMethod": |
||||||
|
case "transMethod": |
||||||
|
int method = Integer.parseInt(row.get(1)); |
||||||
|
if (method == 0) { |
||||||
|
coordinateSystem.datum = DatumEnum.BURSA; |
||||||
|
coordinateSystem.grid = GridEnum.NULL; |
||||||
|
coordinateSystem.hFitting = HFittingEnum.NULL; |
||||||
|
} else if (method == 1 || method == 2) { |
||||||
|
coordinateSystem.datum = DatumEnum.NULL; |
||||||
|
coordinateSystem.grid = GridEnum.FOUR_PARA; |
||||||
|
coordinateSystem.hFitting = HFittingEnum.FIX; |
||||||
|
} |
||||||
|
break; |
||||||
|
case "ellipsoidType": |
||||||
|
int ellipsoid = Integer.parseInt(row.get(1)); |
||||||
|
switch (ellipsoid) { |
||||||
|
case 0: |
||||||
|
coordinateSystem.setEllipsoid(EllipsoidEnum.WGS_84); |
||||||
|
break; |
||||||
|
case 1: |
||||||
|
coordinateSystem.setEllipsoid(EllipsoidEnum.BEIJING_54); |
||||||
|
break; |
||||||
|
case 2: |
||||||
|
coordinateSystem.setEllipsoid(EllipsoidEnum.XIAN_80); |
||||||
|
break; |
||||||
|
default: |
||||||
|
coordinateSystem.setEllipsoid(EllipsoidEnum.CGCS_2000); |
||||||
|
break; |
||||||
|
} |
||||||
|
break; |
||||||
|
case "rtkProjectType": |
||||||
|
case "projectType": |
||||||
|
int type = Integer.parseInt(row.get(1)); |
||||||
|
switch (type) { |
||||||
|
case 2: |
||||||
|
coordinateSystem.setProjection(ProjectionEnum.UTM); |
||||||
|
break; |
||||||
|
default: |
||||||
|
coordinateSystem.setProjection(ProjectionEnum.GAUSS); |
||||||
|
} |
||||||
|
break; |
||||||
|
case "datumTransType": |
||||||
|
int datumTransType = Integer.parseInt(row.get(1)); |
||||||
|
if (datumTransType < 0 || datumTransType > 1) |
||||||
|
datumTransType = 0; |
||||||
|
switch (datumTransType) { |
||||||
|
case 1: |
||||||
|
coordinateSystem.datum = DatumEnum.BURSA; |
||||||
|
break; |
||||||
|
default: |
||||||
|
coordinateSystem.datum = DatumEnum.NULL; |
||||||
|
} |
||||||
|
break; |
||||||
|
case "planeTransType": |
||||||
|
int planeTransType = Integer.parseInt(row.get(1)); |
||||||
|
switch (planeTransType) { |
||||||
|
case 1: |
||||||
|
coordinateSystem.grid = GridEnum.FOUR_PARA; |
||||||
|
break; |
||||||
|
default: |
||||||
|
coordinateSystem.grid = GridEnum.NULL; |
||||||
|
} |
||||||
|
break; |
||||||
|
case "elvFitType": |
||||||
|
int elvFitType = Integer.parseInt(row.get(1)); |
||||||
|
switch (elvFitType) { |
||||||
|
case 1: |
||||||
|
case 4: |
||||||
|
coordinateSystem.hFitting = HFittingEnum.FIX; |
||||||
|
break; |
||||||
|
case 2: |
||||||
|
coordinateSystem.hFitting = HFittingEnum.PLANE; |
||||||
|
break; |
||||||
|
case 3: |
||||||
|
coordinateSystem.hFitting = HFittingEnum.CURVE; |
||||||
|
break; |
||||||
|
case 5: |
||||||
|
coordinateSystem.hFitting = HFittingEnum.TGO; |
||||||
|
break; |
||||||
|
default: |
||||||
|
coordinateSystem.hFitting = HFittingEnum.NULL; |
||||||
|
} |
||||||
|
break; |
||||||
|
case "longOfOrigin": |
||||||
|
case "centLng": |
||||||
|
coordinateSystem.centLng = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "latOfOrigin": |
||||||
|
case "baseLat": |
||||||
|
coordinateSystem.baseLat = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "projectionScale": |
||||||
|
case "projScl": |
||||||
|
coordinateSystem.projScl = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "falseEasting": |
||||||
|
case "falseE": |
||||||
|
coordinateSystem.falseE = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "falseNorthing": |
||||||
|
case "falseN": |
||||||
|
coordinateSystem.falseN = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "projectionHeight": |
||||||
|
case "projAlt": |
||||||
|
coordinateSystem.projAlt = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "sevenParDx": |
||||||
|
coordinateSystem.sevenDx = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "sevenParDy": |
||||||
|
coordinateSystem.sevenDy = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "sevenParDz": |
||||||
|
coordinateSystem.sevenDz = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "sevenParRx": |
||||||
|
coordinateSystem.sevenRx = Double.parseDouble(row.get(1)) * 3600d; |
||||||
|
break; |
||||||
|
case "sevenParRy": |
||||||
|
coordinateSystem.sevenRy = Double.parseDouble(row.get(1)) * 3600d; |
||||||
|
break; |
||||||
|
case "sevenParRz": |
||||||
|
coordinateSystem.sevenRz = Double.parseDouble(row.get(1)) * 3600d; |
||||||
|
break; |
||||||
|
case "sevenParScl": |
||||||
|
coordinateSystem.sevenPpm = (Double.parseDouble(row.get(1)) - 1) * 1000000d; |
||||||
|
break; |
||||||
|
case "fourParDx": |
||||||
|
coordinateSystem.fourDx = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "fourParDy": |
||||||
|
coordinateSystem.fourDy = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "fourParRot": |
||||||
|
coordinateSystem.fourRot = Util.radianToDmsDouble(Math.toRadians(Double.parseDouble(row.get(1)))); |
||||||
|
break; |
||||||
|
case "fourParScl": |
||||||
|
coordinateSystem.fourScl = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "hFitA0": |
||||||
|
coordinateSystem.hFitA0 = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "hFitA1": |
||||||
|
coordinateSystem.hFitA1 = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "hFitA2": |
||||||
|
coordinateSystem.hFitA2 = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "hFitA3": |
||||||
|
coordinateSystem.hFitA3 = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "hFitA4": |
||||||
|
coordinateSystem.hFitA4 = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "hFitA5": |
||||||
|
coordinateSystem.hFitA5 = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "hFitN": |
||||||
|
coordinateSystem.hFitN = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "hFitE": |
||||||
|
coordinateSystem.hFitE = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "hFitNorthOrigin": |
||||||
|
coordinateSystem.hFitNorthOrigin = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "hFitEastOrigin": |
||||||
|
coordinateSystem.hFitEastOrigin = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "hFitNorthSlope": |
||||||
|
coordinateSystem.hFitNorthSlope = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "hFitEastSlope": |
||||||
|
coordinateSystem.hFitEastSlope = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "hFitHdConstant": |
||||||
|
coordinateSystem.hFitHdConstant = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "correctX": |
||||||
|
coordinateSystem.correctN = -1 * Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "correctY": |
||||||
|
coordinateSystem.correctE = -1 * Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "correctZ": |
||||||
|
coordinateSystem.correctH = -1 * Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "correctN": |
||||||
|
coordinateSystem.correctN = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "correctE": |
||||||
|
coordinateSystem.correctE = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
case "correctH": |
||||||
|
coordinateSystem.correctH = Double.parseDouble(row.get(1)); |
||||||
|
break; |
||||||
|
} |
||||||
|
} else if (row.size() == 6) { |
||||||
|
coordinateSystem.getPairs().add(new BlhCoordinatePair("", new Blh(Double.parseDouble(row.get(0)), Double.parseDouble(row.get(1)), Double.parseDouble(row.get(2))) |
||||||
|
, new Coordinate(Double.parseDouble(row.get(3)), Double.parseDouble(row.get(4)), Double.parseDouble(row.get(5))))); |
||||||
|
} else if (row.size() == 9) { |
||||||
|
if ("BlhPointPair".equals(row.get(0).trim())) { |
||||||
|
switch (Integer.parseInt(row.get(1))) { |
||||||
|
case 47: |
||||||
|
coordinateSystem.getPairs().add(new BlhCoordinatePair(row.get(2), new Blh(Double.parseDouble(row.get(3)), Double.parseDouble(row.get(4)), Double.parseDouble(row.get(5))) |
||||||
|
, new Coordinate(Double.parseDouble(row.get(6)), Double.parseDouble(row.get(7)), Double.parseDouble(row.get(8))))); |
||||||
|
break; |
||||||
|
case 51: |
||||||
|
coordinateSystem.phonePair1 = new BlhCoordinatePair(row.get(2), new Blh(Double.parseDouble(row.get(3)), Double.parseDouble(row.get(4)), Double.parseDouble(row.get(5))) |
||||||
|
, new Coordinate(Double.parseDouble(row.get(6)), Double.parseDouble(row.get(7)), Double.parseDouble(row.get(8)))); |
||||||
|
break; |
||||||
|
case 52: |
||||||
|
coordinateSystem.phonePair2 = new BlhCoordinatePair(row.get(2), new Blh(Double.parseDouble(row.get(3)), Double.parseDouble(row.get(4)), Double.parseDouble(row.get(5))) |
||||||
|
, new Coordinate(Double.parseDouble(row.get(6)), Double.parseDouble(row.get(7)), Double.parseDouble(row.get(8)))); |
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
} else { |
||||||
|
switch (Integer.parseInt(row.get(0))) { |
||||||
|
case 4: |
||||||
|
case 7: |
||||||
|
coordinateSystem.getPairs().add(new BlhCoordinatePair("", new Blh(Math.toDegrees(Util.dmsStringToRadian(row.get(1), false)), Math.toDegrees(Util.dmsStringToRadian(row.get(2), false)), Double.parseDouble(row.get(3))) |
||||||
|
, new Coordinate(Double.parseDouble(row.get(4)), Double.parseDouble(row.get(5)), Double.parseDouble(row.get(6))))); |
||||||
|
break; |
||||||
|
case 31: |
||||||
|
coordinateSystem.phonePair1 = new BlhCoordinatePair("", new Blh(Math.toDegrees(Util.dmsStringToRadian(row.get(1), false)), Math.toDegrees(Util.dmsStringToRadian(row.get(2), false)), Double.parseDouble(row.get(3))) |
||||||
|
, new Coordinate(Double.parseDouble(row.get(4)), Double.parseDouble(row.get(5)), Double.parseDouble(row.get(6)))); |
||||||
|
break; |
||||||
|
case 32: |
||||||
|
coordinateSystem.phonePair2 = new BlhCoordinatePair("", new Blh(Math.toDegrees(Util.dmsStringToRadian(row.get(1), false)), Math.toDegrees(Util.dmsStringToRadian(row.get(2), false)), Double.parseDouble(row.get(3))) |
||||||
|
, new Coordinate(Double.parseDouble(row.get(4)), Double.parseDouble(row.get(5)), Double.parseDouble(row.get(6)))); |
||||||
|
break; |
||||||
|
case 41: |
||||||
|
coordinateSystem.phonePair1 = new BlhCoordinatePair("", new Blh(Double.parseDouble(row.get(1)), Double.parseDouble(row.get(2)), Double.parseDouble(row.get(3))) |
||||||
|
, new Coordinate(Double.parseDouble(row.get(4)), Double.parseDouble(row.get(5)), Double.parseDouble(row.get(6)))); |
||||||
|
break; |
||||||
|
case 42: |
||||||
|
coordinateSystem.phonePair2 = new BlhCoordinatePair("", new Blh(Double.parseDouble(row.get(1)), Double.parseDouble(row.get(2)), Double.parseDouble(row.get(3))) |
||||||
|
, new Coordinate(Double.parseDouble(row.get(4)), Double.parseDouble(row.get(5)), Double.parseDouble(row.get(6)))); |
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
Log.d("CoordinateSystemUtil", sysFile.getAbsolutePath() + ",导入成功"); |
||||||
|
} catch (NumberFormatException ex) { |
||||||
|
Log.d("CoordinateSystemUtil", sysFile.getAbsolutePath() + ",导入失败,原因:第" + line + "行,发现非数字字符串"); |
||||||
|
} catch (Exception ex) { |
||||||
|
ex.printStackTrace(); |
||||||
|
} |
||||||
|
return coordinateSystem; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,379 @@ |
|||||||
|
package com.project.survey.ui.instrument.setupstation.util; |
||||||
|
|
||||||
|
|
||||||
|
import androidx.annotation.WorkerThread; |
||||||
|
|
||||||
|
import com.bingce.TimeCount; |
||||||
|
import com.bingce.constants.FileNameConstants; |
||||||
|
import com.bingce.data.database.PointDb; |
||||||
|
import com.bingce.data.surveyor.surveydata.pointsurvey.PointConstants; |
||||||
|
import com.bingce.data.surveyor.surveydata.pointsurvey.PointRecord; |
||||||
|
import com.bingce.poi.excel.ExcelReadHelper; |
||||||
|
import com.bingce.utils.AppUtil; |
||||||
|
import com.project.survey.R; |
||||||
|
|
||||||
|
import java.io.BufferedInputStream; |
||||||
|
import java.io.BufferedReader; |
||||||
|
import java.io.File; |
||||||
|
import java.io.FileInputStream; |
||||||
|
import java.io.IOException; |
||||||
|
import java.io.InputStreamReader; |
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.Date; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
import blankj.utilcode.util.StringUtils; |
||||||
|
import blankj.utilcode.util.ToastUtils; |
||||||
|
import cn.liuyanbing.surveyor.model.base.Point; |
||||||
|
import cn.liuyanbing.surveyor.model.base.PointArray; |
||||||
|
|
||||||
|
public class _6GlobalControlPointCollectUtils { |
||||||
|
static void collect(String projectId, String defaultJobId, File projectFolder, CollectLocalDataInAppStartFirstTimeUtil.ILog log, TimeCount.ITimeCounter timeCounter) { |
||||||
|
File globalFile = new File(projectFolder, FileNameConstants.CONFIG_FILE_GLOBAL_CONTROL_POINT); |
||||||
|
if (!globalFile.exists()) { |
||||||
|
globalFile = new File(projectFolder, "全局控制点.xls"); |
||||||
|
} |
||||||
|
|
||||||
|
if (!globalFile.exists()) { |
||||||
|
return; |
||||||
|
} |
||||||
|
log.log("读取全局控制点数据"); |
||||||
|
importGlobalControlPointExcel(projectId, defaultJobId, globalFile, timeCounter); |
||||||
|
// PointArray pointArray = new PointArray();
|
||||||
|
// String error = importGlobalControlPointExcel(globalFile, pointArray);
|
||||||
|
// if (!StringUtil.isEmpty(error)) {
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// int size = pointArray.size();
|
||||||
|
// List<PointRecord> pointRecords = new ArrayList<>();
|
||||||
|
// for (int index = 0; index < size; index++) {
|
||||||
|
// Point point = pointArray.get(index);
|
||||||
|
// PointRecord pointRecord = new PointRecord(projectId, defaultJobId, "",
|
||||||
|
// PointConstants.POINT_TYPE_GLOBAL_CONTROL_POINT,
|
||||||
|
// point.getName(), point.getCode(), point.getRemarks(),
|
||||||
|
// point.getX(), point.getY(), point.getZ(),
|
||||||
|
// 0, 0, 0,
|
||||||
|
// PointConstants.POINT_FORMAT_XYZ, null);
|
||||||
|
// pointRecord.createDate = new Date(timeCounter.time());
|
||||||
|
// pointRecords.add(pointRecord);
|
||||||
|
// }
|
||||||
|
// PointDb.getInstance().save(pointRecords);
|
||||||
|
} |
||||||
|
|
||||||
|
public static void importGlobalControlPointExcel(String projectId, String defaultJobId, File globalFile, TimeCount.ITimeCounter timeCounter) { |
||||||
|
PointArray pointArray = new PointArray(); |
||||||
|
Result result = importGlobalControlPointExcel(globalFile, pointArray); |
||||||
|
if (!pointArray.isEmpty()) { |
||||||
|
int size = pointArray.size(); |
||||||
|
List<PointRecord> pointRecords = new ArrayList<>(); |
||||||
|
for (int index = 0; index < size; index++) { |
||||||
|
Point point = pointArray.get(index); |
||||||
|
PointRecord pointRecord = new PointRecord(projectId, defaultJobId, "", |
||||||
|
PointConstants.POINT_TYPE_GLOBAL_CONTROL_POINT, |
||||||
|
point.getName(), point.getCode(), point.getRemarks(), |
||||||
|
point.getX(), point.getY(), point.getZ(), |
||||||
|
0, 0, 0, |
||||||
|
PointConstants.POINT_FORMAT_XYZ, null); |
||||||
|
pointRecord.createDate = new Date(timeCounter.time()); |
||||||
|
pointRecords.add(pointRecord); |
||||||
|
} |
||||||
|
PointDb.getInstance().save(pointRecords); |
||||||
|
} |
||||||
|
if (!result.isSuccess()) { |
||||||
|
ToastUtils.showShort(result.describe); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public static Result importGlobalControlPointExcel(File file, PointArray pointArray) { |
||||||
|
int line = 0; |
||||||
|
try { |
||||||
|
List<List<String>> importResult = ExcelReadHelper.excelRead(file, ExcelReadHelper.FIRST_ROW_NOT_IGNORE); |
||||||
|
if (importResult == null || importResult.isEmpty()) { |
||||||
|
if (AppUtil.isZh()) { |
||||||
|
return Result.failure(file.getAbsolutePath() + ",导入失败,原因:导入excel为空"); |
||||||
|
} else { |
||||||
|
return Result.failure(file.getAbsolutePath() + "," + StringUtils.getString(R.string.import_failed)); |
||||||
|
} |
||||||
|
} |
||||||
|
for (int i = 0; i < importResult.size(); i++) { |
||||||
|
List<String> row = importResult.get(i); |
||||||
|
|
||||||
|
line = i + 1; |
||||||
|
if (row.isEmpty() || ExcelReadHelper.isRowEmpty(row) || row.size() < 3) { |
||||||
|
continue; |
||||||
|
} |
||||||
|
if (row.size() == 3) { |
||||||
|
pointArray.add(Point.CONTROL, "", Double.parseDouble(row.get(0)) |
||||||
|
, Double.parseDouble(row.get(1)), Double.parseDouble(row.get(2)), ""); |
||||||
|
} else if (row.size() == 4) { |
||||||
|
pointArray.add(Point.CONTROL, row.get(0), Double.parseDouble(row.get(1)) |
||||||
|
, Double.parseDouble(row.get(2)), Double.parseDouble(row.get(3)), ""); |
||||||
|
} else if (row.size() == 5) { |
||||||
|
pointArray.add(Point.CONTROL, row.get(0), Double.parseDouble(row.get(1)) |
||||||
|
, Double.parseDouble(row.get(2)), Double.parseDouble(row.get(3)), row.get(4)); |
||||||
|
} else if (row.size() == 6) { |
||||||
|
pointArray.add(Point.CONTROL, row.get(0), row.get(1), Double.parseDouble(row.get(2)) |
||||||
|
, Double.parseDouble(row.get(3)), Double.parseDouble(row.get(4)), row.get(5)); |
||||||
|
} else { |
||||||
|
pointArray.add(Point.CONTROL, row.get(1), row.get(2), Double.parseDouble(row.get(3)) |
||||||
|
, Double.parseDouble(row.get(4)), Double.parseDouble(row.get(5)), row.get(6), row.get(7)); |
||||||
|
} |
||||||
|
} |
||||||
|
} catch (NumberFormatException ex) { |
||||||
|
pointArray.clear(); |
||||||
|
if (AppUtil.isZh()) { |
||||||
|
return Result.failure(file.getAbsolutePath() + ",导入失败,原因:第" + line + "行,发现非数字字符串"); |
||||||
|
} else { |
||||||
|
return Result.failure(file.getAbsolutePath() + "," + StringUtils.getString(R.string.import_failed)); |
||||||
|
} |
||||||
|
} catch (Exception ex) { |
||||||
|
ex.printStackTrace(); |
||||||
|
if (AppUtil.isZh()) { |
||||||
|
return Result.failure(file.getAbsolutePath() + ",导入失败,原因:第" + line + "行:" + ex.getMessage()); |
||||||
|
} else { |
||||||
|
return Result.failure(file.getAbsolutePath() + "," + StringUtils.getString(R.string.import_failed)); |
||||||
|
} |
||||||
|
} |
||||||
|
return Result.success(file.getAbsolutePath() + "," + StringUtils.getString(R.string.import_success)); |
||||||
|
} |
||||||
|
|
||||||
|
public static Result importStakingJobPointTxt(File file, PointArray pointArray) { |
||||||
|
String result = ""; |
||||||
|
FileInputStream fis = null; |
||||||
|
BufferedInputStream bis = null; |
||||||
|
BufferedReader buff = null; |
||||||
|
int line = 0; |
||||||
|
|
||||||
|
try { |
||||||
|
fis = new FileInputStream(file); |
||||||
|
bis = new BufferedInputStream(fis); |
||||||
|
buff = new BufferedReader(new InputStreamReader(bis, "utf-8")); |
||||||
|
String a = null; |
||||||
|
while ((a = buff.readLine()) != null)// 检查数据
|
||||||
|
{ |
||||||
|
line++; |
||||||
|
if ("".equals(a.trim()) || a.trim().startsWith("#")) { |
||||||
|
continue; |
||||||
|
} |
||||||
|
a = a.replaceAll("(^[\u0020\u0009\u3000]*)|([\u0020\u0009\u3000]*$)", "");// 删除首尾空格、制表及全角空格
|
||||||
|
String[] arr = a.split(",|,", -2); |
||||||
|
if (arr.length < 4) { |
||||||
|
if (AppUtil.isZh()) { |
||||||
|
return Result.failure(file.getAbsolutePath() + ",导入失败,原因:第" + line + "行,元素个数不能少于4个"); |
||||||
|
} else { |
||||||
|
return Result.failure(file.getAbsolutePath() + "," + StringUtils.getString(R.string.import_failed)); |
||||||
|
} |
||||||
|
} |
||||||
|
if (arr.length == 4) { |
||||||
|
/*job.getPointList()*/ |
||||||
|
pointArray.add(Point.STAKEOUT, arr[0], Double.parseDouble(arr[1]) |
||||||
|
, Double.parseDouble(arr[2]), Double.parseDouble(arr[3]), ""); |
||||||
|
} else if (arr.length == 5) { |
||||||
|
/*job.getPointList()*/ |
||||||
|
pointArray.add(Point.STAKEOUT, arr[0], Double.parseDouble(arr[1]) |
||||||
|
, Double.parseDouble(arr[2]), Double.parseDouble(arr[3]), arr[4]); |
||||||
|
} else if (arr.length == 6) { |
||||||
|
/*job.getPointList()*/ |
||||||
|
pointArray.add(Point.STAKEOUT, arr[0], arr[1], Double.parseDouble(arr[2]) |
||||||
|
, Double.parseDouble(arr[3]), Double.parseDouble(arr[4]), arr[5]); |
||||||
|
} |
||||||
|
} |
||||||
|
// if ("".equals(result)) {
|
||||||
|
// result = file.getAbsolutePath() + ",导入成功";
|
||||||
|
// }
|
||||||
|
} catch (NumberFormatException ex) { |
||||||
|
if (AppUtil.isZh()) { |
||||||
|
return Result.failure(file.getAbsolutePath() + ",导入失败,原因:第" + line + "行,发现非数字字符串"); |
||||||
|
} else { |
||||||
|
return Result.failure(file.getAbsolutePath() + "," + StringUtils.getString(R.string.import_failed)); |
||||||
|
} |
||||||
|
} catch (IOException ex) { |
||||||
|
ex.printStackTrace(); |
||||||
|
} finally { |
||||||
|
if (fis != null) { |
||||||
|
try { |
||||||
|
fis.close(); |
||||||
|
} catch (IOException e) { |
||||||
|
e.printStackTrace(); |
||||||
|
} |
||||||
|
} |
||||||
|
if (bis != null) { |
||||||
|
try { |
||||||
|
bis.close(); |
||||||
|
} catch (IOException e) { |
||||||
|
e.printStackTrace(); |
||||||
|
} |
||||||
|
} |
||||||
|
if (buff != null) { |
||||||
|
try { |
||||||
|
buff.close(); |
||||||
|
} catch (IOException e) { |
||||||
|
e.printStackTrace(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
//执行一次性操作
|
||||||
|
//更新数据
|
||||||
|
//PointDb.getInstance().replaceKnownPoints(jobId, knownPointRecordsFrom(projectId, jobId, pointArray), isOverride);
|
||||||
|
return Result.success(file.getAbsolutePath() + "," + StringUtils.getString(R.string.import_success)); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@WorkerThread |
||||||
|
public static void importStakingJobPointCassDat(File file, String projectId, String jobId, TimeCount.ITimeCounter timeCounter, boolean cassXy) { |
||||||
|
PointArray pointArray = new PointArray(); |
||||||
|
Result result = importStakingJobPointCassDat(file, pointArray, cassXy); |
||||||
|
if (!pointArray.isEmpty()) { |
||||||
|
int size = pointArray.size(); |
||||||
|
List<PointRecord> pointRecords = new ArrayList<>(); |
||||||
|
for (int index = 0; index < size; index++) { |
||||||
|
Point point = pointArray.get(index); |
||||||
|
PointRecord pointRecord = new PointRecord(projectId, jobId, "", |
||||||
|
PointConstants.POINT_TYPE_GLOBAL_CONTROL_POINT, |
||||||
|
point.getName(), point.getCode(), point.getRemarks(), |
||||||
|
point.getX(), point.getY(), point.getZ(), |
||||||
|
0, 0, 0, |
||||||
|
PointConstants.POINT_FORMAT_XYZ, null); |
||||||
|
pointRecord.createDate = new Date(timeCounter.time()); |
||||||
|
pointRecords.add(pointRecord); |
||||||
|
} |
||||||
|
PointDb.getInstance().save(pointRecords); |
||||||
|
} |
||||||
|
if (!result.isSuccess()) { |
||||||
|
ToastUtils.showShort(result.describe); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 导入点数据 |
||||||
|
* |
||||||
|
* @param file |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
@WorkerThread |
||||||
|
public static Result importStakingJobPointCassDat(File file, PointArray pointArray, boolean cassXy) { |
||||||
|
String result = ""; |
||||||
|
FileInputStream fis = null; |
||||||
|
BufferedInputStream bis = null; |
||||||
|
BufferedReader buff = null; |
||||||
|
int line = 0; |
||||||
|
try { |
||||||
|
fis = new FileInputStream(file); |
||||||
|
bis = new BufferedInputStream(fis); |
||||||
|
buff = new BufferedReader(new InputStreamReader(bis, "utf-8")); |
||||||
|
String a = null; |
||||||
|
while ((a = buff.readLine()) != null)// 检查数据
|
||||||
|
{ |
||||||
|
line++; |
||||||
|
if ("".equals(a.trim()) || a.trim().startsWith("#")) { |
||||||
|
continue; |
||||||
|
} |
||||||
|
a = a.replaceAll("(^[\u0020\u0009\u3000]*)|([\u0020\u0009\u3000]*$)", "");// 删除首尾空格、制表及全角空格
|
||||||
|
String[] arr = a.split(",|,", -2); |
||||||
|
if (arr.length != 5) { |
||||||
|
if (AppUtil.isZh()) { |
||||||
|
return Result.failure(file.getAbsolutePath() + ",导入失败,原因:第" + line + "行,元素个数不等于5个"); |
||||||
|
} else { |
||||||
|
return Result.failure(file.getAbsolutePath() + "," + StringUtils.getString(R.string.import_failed)); |
||||||
|
} |
||||||
|
} |
||||||
|
if (cassXy) { |
||||||
|
pointArray.add(Point.STAKEOUT, arr[0], arr[1], Double.parseDouble(arr[2]), Double.parseDouble(arr[3]), Double.parseDouble(arr[4]), ""); |
||||||
|
} else { |
||||||
|
pointArray.add(Point.STAKEOUT, arr[0], arr[1], Double.parseDouble(arr[3]), Double.parseDouble(arr[2]), Double.parseDouble(arr[4]), ""); |
||||||
|
} |
||||||
|
} |
||||||
|
} catch (NumberFormatException ex) { |
||||||
|
if (AppUtil.isZh()) { |
||||||
|
return Result.failure(file.getAbsolutePath() + ",导入失败,原因:第\" + line + \"行,发现非数字字符串"); |
||||||
|
} else { |
||||||
|
return Result.failure(file.getAbsolutePath() + "," + StringUtils.getString(R.string.import_failed)); |
||||||
|
} |
||||||
|
} catch (IOException ex) { |
||||||
|
ex.printStackTrace(); |
||||||
|
} finally { |
||||||
|
if (fis != null) { |
||||||
|
try { |
||||||
|
fis.close(); |
||||||
|
} catch (IOException e) { |
||||||
|
e.printStackTrace(); |
||||||
|
} |
||||||
|
} |
||||||
|
if (bis != null) { |
||||||
|
try { |
||||||
|
bis.close(); |
||||||
|
} catch (IOException e) { |
||||||
|
e.printStackTrace(); |
||||||
|
} |
||||||
|
} |
||||||
|
if (buff != null) { |
||||||
|
try { |
||||||
|
buff.close(); |
||||||
|
} catch (IOException e) { |
||||||
|
e.printStackTrace(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
//执行一次性操作
|
||||||
|
//更新数据
|
||||||
|
// PointDb.getInstance().replaceKnownPoints(jobId, knownPointRecordsFrom(projectId, jobId, pointArray), isOverride);
|
||||||
|
return Result.success(file.getAbsolutePath() + "," + StringUtils.getString(R.string.import_success)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 导入点数据 |
||||||
|
* |
||||||
|
* @param file |
||||||
|
* @param jobId |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
@WorkerThread |
||||||
|
public static void importStakingJobPointTxt(File file, String projectId, String jobId, TimeCount.ITimeCounter timeCounter) { |
||||||
|
PointArray pointArray = new PointArray(); |
||||||
|
Result result = importStakingJobPointTxt(file, pointArray); |
||||||
|
if (!pointArray.isEmpty()) { |
||||||
|
int size = pointArray.size(); |
||||||
|
List<PointRecord> pointRecords = new ArrayList<>(); |
||||||
|
for (int index = 0; index < size; index++) { |
||||||
|
Point point = pointArray.get(index); |
||||||
|
PointRecord pointRecord = new PointRecord(projectId, jobId, "", |
||||||
|
PointConstants.POINT_TYPE_GLOBAL_CONTROL_POINT, |
||||||
|
point.getName(), point.getCode(), point.getRemarks(), |
||||||
|
point.getX(), point.getY(), point.getZ(), |
||||||
|
0, 0, 0, |
||||||
|
PointConstants.POINT_FORMAT_XYZ, null); |
||||||
|
pointRecord.createDate = new Date(timeCounter.time()); |
||||||
|
pointRecords.add(pointRecord); |
||||||
|
} |
||||||
|
PointDb.getInstance().save(pointRecords); |
||||||
|
} |
||||||
|
if (!result.isSuccess()) { |
||||||
|
ToastUtils.showShort(result.describe); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public static class Result { |
||||||
|
private final int code; |
||||||
|
public final String describe; |
||||||
|
|
||||||
|
public Result(int code, String describe) { |
||||||
|
this.code = code; |
||||||
|
this.describe = describe; |
||||||
|
} |
||||||
|
|
||||||
|
public boolean isSuccess() { |
||||||
|
return SUCCESS == code; |
||||||
|
} |
||||||
|
|
||||||
|
private final static int SUCCESS = 0; |
||||||
|
|
||||||
|
public static Result success(String str) { |
||||||
|
return new Result(SUCCESS, str); |
||||||
|
} |
||||||
|
|
||||||
|
public static Result failure(String str) { |
||||||
|
return new Result(-1, str); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,308 @@ |
|||||||
|
package com.project.survey.util; |
||||||
|
|
||||||
|
import android.content.Context; |
||||||
|
|
||||||
|
import com.bingce.coordlib.model.CoordinateSystem; |
||||||
|
import com.bingce.data.cache.CachedProject; |
||||||
|
import com.bingce.surveyor.util.dialog.CustomInputDialog; |
||||||
|
import com.bingce.utils.FileUtil; |
||||||
|
import com.bingce.utils.StringUtil; |
||||||
|
import com.bingce.utils.Util; |
||||||
|
import com.hjq.permissions.Permission; |
||||||
|
import com.hjq.permissions.XXPermissions; |
||||||
|
import com.project.survey.R; |
||||||
|
import com.project.survey.ui.instrument.setupstation.AddResultFormatActivity; |
||||||
|
import com.project.survey.ui.instrument.setupstation.db.PointSurveyRecord; |
||||||
|
import com.project.survey.ui.instrument.setupstation.db.resultformat.FormatRecord; |
||||||
|
|
||||||
|
import java.io.File; |
||||||
|
import java.text.SimpleDateFormat; |
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Objects; |
||||||
|
|
||||||
|
import blankj.utilcode.util.ToastUtils; |
||||||
|
import blankj.utilcode.util.Utils; |
||||||
|
|
||||||
|
public class CassCsvTxtExportUtil { |
||||||
|
|
||||||
|
public static void exportFormat(Context activity, String suffixesUtils, CachedProject currentProject, FormatRecord formatRecord, List<PointSurveyRecord> pointSurveyRecords, CoordinateSystem coordinateSystem) { |
||||||
|
|
||||||
|
List<String> regexFormatRecordList = new ArrayList<>(); |
||||||
|
String[] split = formatRecord.format_content.split(formatRecord.divided_symbols); |
||||||
|
for (int i = 0; i < split.length; i++) { |
||||||
|
regexFormatRecordList.add(split[i]); |
||||||
|
} |
||||||
|
|
||||||
|
if (XXPermissions.isGranted(activity, Permission.MANAGE_EXTERNAL_STORAGE)) { |
||||||
|
exportCassFile(activity, currentProject, suffixesUtils, formatRecord, regexFormatRecordList, pointSurveyRecords, coordinateSystem); |
||||||
|
} else { |
||||||
|
ToastUtils.showShort(activity.getString(R.string.open_read_write_permissions)); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 导出Cass文件 |
||||||
|
*/ |
||||||
|
private static String title; |
||||||
|
|
||||||
|
private static void exportCassFile(Context context, CachedProject currentProject, String suffixesUtils, FormatRecord formatRecord, List<String> regexList, List<PointSurveyRecord> pointSurveyRecordList, CoordinateSystem coordinateSystem) { |
||||||
|
if (Objects.equals(suffixesUtils, FormatSuffixesUtils.formatDAT)) { |
||||||
|
title = context.getString(R.string.export_cass_file_name); |
||||||
|
} else if (Objects.equals(suffixesUtils, FormatSuffixesUtils.formatTXT)) { |
||||||
|
title = context.getString(R.string.export_txt_file_name); |
||||||
|
} else if (Objects.equals(suffixesUtils, FormatSuffixesUtils.formatCSV)) { |
||||||
|
title = context.getString(R.string.export_csv_file_name); |
||||||
|
} |
||||||
|
new CustomInputDialog.Builder(context).setTitle(title).setButtonConfirm(new CustomInputDialog.setOnConfirmClickListener() { |
||||||
|
@Override |
||||||
|
public void OnConfirmClick(String editText) { |
||||||
|
if (android.text.TextUtils.isEmpty(editText.trim())) { |
||||||
|
ToastUtils.showShort(context.getString(R.string.enter_file_name)); |
||||||
|
return; |
||||||
|
} |
||||||
|
StringBuilder result = new StringBuilder(); |
||||||
|
String divided_symbols = formatRecord.divided_symbols; |
||||||
|
for (int i = 0; i < pointSurveyRecordList.size(); i++) { |
||||||
|
PointSurveyRecord pointBaseRecord = pointSurveyRecordList.get(i); |
||||||
|
|
||||||
|
for (int j = 0; j < regexList.size(); j++) { |
||||||
|
String s = regexList.get(j); |
||||||
|
if (s.equals("点名") || s.equals("Point name") || s.equals("№точ.")) { |
||||||
|
if (j == regexList.size() - 1) { |
||||||
|
result.append(pointBaseRecord.pointName); |
||||||
|
} else { |
||||||
|
result.append(pointBaseRecord.pointName).append(divided_symbols); |
||||||
|
} |
||||||
|
} else if (s.equals("编码") || s.equals("Code") || s.equals("Код")) { |
||||||
|
if (StringUtil.isEmpty(pointBaseRecord.code) || pointBaseRecord.code.equals("空") || pointBaseRecord.code.equals("null") || pointBaseRecord.code.equals("Null") || pointBaseRecord.code.equals("NULL")) { |
||||||
|
if (j == regexList.size() - 1) { |
||||||
|
result.append(""); |
||||||
|
} else { |
||||||
|
result.append("").append(divided_symbols); |
||||||
|
} |
||||||
|
} else { |
||||||
|
if (j == regexList.size() - 1) { |
||||||
|
result.append(pointBaseRecord.code); |
||||||
|
} else { |
||||||
|
result.append(pointBaseRecord.code).append(divided_symbols); |
||||||
|
} |
||||||
|
} |
||||||
|
} else if (s.equals("纬度") || s.equals("Latitude") || s.equals("Широта")) { |
||||||
|
if (j == regexList.size() - 1) { |
||||||
|
result.append(converAngleFormat(formatRecord.angle_format, pointBaseRecord.latitude)); |
||||||
|
} else { |
||||||
|
result.append(converAngleFormat(formatRecord.angle_format, pointBaseRecord.latitude)).append(divided_symbols); |
||||||
|
} |
||||||
|
} else if (s.equals("经度") || s.equals("Longitude") || s.equals("Долгота")) { |
||||||
|
if (j == regexList.size() - 1) { |
||||||
|
result.append(converAngleFormat(formatRecord.angle_format, pointBaseRecord.longitude)); |
||||||
|
} else { |
||||||
|
result.append(converAngleFormat(formatRecord.angle_format, pointBaseRecord.longitude)).append(divided_symbols); |
||||||
|
} |
||||||
|
} else if (s.equals("大地高") || s.equals("Geodetic height") || s.equals("Высота")) { |
||||||
|
if (j == regexList.size() - 1) { |
||||||
|
result.append(Util.formatDouble2String(pointBaseRecord.altitude, 6)); |
||||||
|
} else { |
||||||
|
result.append(Util.formatDouble2String(pointBaseRecord.altitude, 6)).append(divided_symbols); |
||||||
|
} |
||||||
|
} else if (s.equals("天线类型") || s.equals("Antenna type") || s.equals("Тип антенны")) { |
||||||
|
if (j == regexList.size() - 1) { |
||||||
|
result.append(pointBaseRecord.antennaTypeName == null ? "" : pointBaseRecord.antennaTypeName); |
||||||
|
} else { |
||||||
|
result.append(pointBaseRecord.antennaTypeName == null ? "" : pointBaseRecord.antennaTypeName).append(divided_symbols); |
||||||
|
} |
||||||
|
} else if (s.equals("天线高") || s.equals("Antenna height") || s.equals("Высота антенны")) { |
||||||
|
if (j == regexList.size() - 1) { |
||||||
|
if (pointBaseRecord.antennaHeight == -1) { |
||||||
|
result.append("null"); |
||||||
|
} else { |
||||||
|
result.append(Util.formatDouble2StringDotAuto(pointBaseRecord.antennaHeight)); |
||||||
|
} |
||||||
|
} else { |
||||||
|
if (pointBaseRecord.antennaHeight == -1) { |
||||||
|
result.append("null").append(divided_symbols); |
||||||
|
} else { |
||||||
|
result.append(Util.formatDouble2StringDotAuto(pointBaseRecord.antennaHeight)).append(divided_symbols); |
||||||
|
} |
||||||
|
} |
||||||
|
} else if (s.equals("北坐标") || s.equals("Northing") || s.equals("Северные координаты.")) { |
||||||
|
if (j == regexList.size() - 1) { |
||||||
|
result.append(Util.formatDouble2String(pointBaseRecord.planeN, 6)); |
||||||
|
} else { |
||||||
|
result.append(Util.formatDouble2String(pointBaseRecord.planeN, 6)).append(divided_symbols); |
||||||
|
} |
||||||
|
} else if (s.equals("东坐标") || s.equals("Easting") || s.equals("Восточные координаты.")) { |
||||||
|
if (j == regexList.size() - 1) { |
||||||
|
result.append(Util.formatDouble2String(pointBaseRecord.planeE, 6)); |
||||||
|
} else { |
||||||
|
result.append(Util.formatDouble2String(pointBaseRecord.planeE, 6)).append(divided_symbols); |
||||||
|
} |
||||||
|
} else if (s.equals("高程") || s.equals("Elevation") || s.equals("Восточные координаты.")) { |
||||||
|
if (j == regexList.size() - 1) { |
||||||
|
result.append(Util.formatDouble2String(pointBaseRecord.planeH, 6)); |
||||||
|
} else { |
||||||
|
result.append(Util.formatDouble2String(pointBaseRecord.planeH, 6)).append(divided_symbols); |
||||||
|
} |
||||||
|
} else if (s.equals("解状态") || s.equals("Solution state") || s.equals("Режим решения.")) { |
||||||
|
if (j == regexList.size() - 1) { |
||||||
|
result.append(pointBaseRecord.solutionState); |
||||||
|
} else { |
||||||
|
result.append(pointBaseRecord.solutionState).append(divided_symbols); |
||||||
|
} |
||||||
|
} else if (s.equals("解算卫星") || s.equals("Satellite number") || s.equals("Спутник для вычисления")) { |
||||||
|
if (j == regexList.size() - 1) { |
||||||
|
if (pointBaseRecord.satelliteNum == -1) { |
||||||
|
result.append("null"); |
||||||
|
} else { |
||||||
|
result.append(Util.formatDouble2StringDotAuto(pointBaseRecord.satelliteNum)); |
||||||
|
} |
||||||
|
} else { |
||||||
|
if (pointBaseRecord.satelliteNum == -1) { |
||||||
|
result.append("null").append(divided_symbols); |
||||||
|
} else { |
||||||
|
result.append(Util.formatDouble2StringDotAuto(pointBaseRecord.satelliteNum)).append(divided_symbols); |
||||||
|
} |
||||||
|
} |
||||||
|
} else if (s.equals("可见卫星") || s.equals("Satellite track num") || s.equals("Видимый спутник")) { |
||||||
|
if (j == regexList.size() - 1) { |
||||||
|
if (pointBaseRecord.satelliteTrackNum == -1) { |
||||||
|
result.append("null"); |
||||||
|
} else { |
||||||
|
result.append(Util.formatDouble2StringDotAuto(pointBaseRecord.satelliteTrackNum)); |
||||||
|
} |
||||||
|
} else { |
||||||
|
if (pointBaseRecord.satelliteTrackNum == -1) { |
||||||
|
result.append("null").append(divided_symbols); |
||||||
|
} else { |
||||||
|
result.append(Util.formatDouble2StringDotAuto(pointBaseRecord.satelliteTrackNum)).append(divided_symbols); |
||||||
|
} |
||||||
|
} |
||||||
|
} else if (s.equals(context.getString(R.string.pdop))) { |
||||||
|
if (j == regexList.size() - 1) { |
||||||
|
if (pointBaseRecord.pdop == -1) { |
||||||
|
result.append("null"); |
||||||
|
} else { |
||||||
|
result.append(Util.formatDouble2StringDotAuto(pointBaseRecord.pdop)); |
||||||
|
} |
||||||
|
} else { |
||||||
|
if (pointBaseRecord.pdop == -1) { |
||||||
|
result.append("null").append(divided_symbols); |
||||||
|
} else { |
||||||
|
result.append(Util.formatDouble2StringDotAuto(pointBaseRecord.pdop)).append(divided_symbols); |
||||||
|
} |
||||||
|
} |
||||||
|
} else if (s.equals(context.getString(R.string.hrms))) { |
||||||
|
if (j == regexList.size() - 1) { |
||||||
|
if (pointBaseRecord.hrms == -1) { |
||||||
|
result.append("null"); |
||||||
|
} else { |
||||||
|
result.append(Util.formatDouble2StringDotAuto(pointBaseRecord.hrms)); |
||||||
|
} |
||||||
|
} else { |
||||||
|
if (pointBaseRecord.hrms == -1) { |
||||||
|
result.append("null").append(divided_symbols); |
||||||
|
} else { |
||||||
|
result.append(Util.formatDouble2StringDotAuto(pointBaseRecord.hrms)).append(divided_symbols); |
||||||
|
} |
||||||
|
} |
||||||
|
} else if (s.equals(context.getString(R.string.vrms))) { |
||||||
|
if (j == regexList.size() - 1) { |
||||||
|
if (pointBaseRecord.vrms == -1) { |
||||||
|
result.append("null"); |
||||||
|
} else { |
||||||
|
result.append(Util.formatDouble2StringDotAuto(pointBaseRecord.vrms)); |
||||||
|
} |
||||||
|
} else { |
||||||
|
if (pointBaseRecord.vrms == -1) { |
||||||
|
result.append("null").append(divided_symbols); |
||||||
|
} else { |
||||||
|
result.append(Util.formatDouble2StringDotAuto(pointBaseRecord.vrms)).append(divided_symbols); |
||||||
|
} |
||||||
|
} |
||||||
|
} else if (s.equals("差分延迟") || s.equals("Diff age") || s.equals("Дифференциальная задержка")) { |
||||||
|
if (j == regexList.size() - 1) { |
||||||
|
if (pointBaseRecord.diffAge == -1) { |
||||||
|
result.append("null"); |
||||||
|
} else { |
||||||
|
result.append(Util.formatDouble2StringDotAuto(pointBaseRecord.diffAge)); |
||||||
|
} |
||||||
|
} else { |
||||||
|
if (pointBaseRecord.diffAge == -1) { |
||||||
|
result.append("null").append(divided_symbols); |
||||||
|
} else { |
||||||
|
result.append(Util.formatDouble2StringDotAuto(pointBaseRecord.diffAge)).append(divided_symbols); |
||||||
|
} |
||||||
|
} |
||||||
|
} else if (s.equals("备注") || s.equals("Remark") || s.equals("примечан")) { |
||||||
|
if (StringUtil.isEmpty(pointBaseRecord.remarks) || pointBaseRecord.remarks.equals("") || pointBaseRecord.remarks.equals("null") || pointBaseRecord.remarks.equals("Null") || pointBaseRecord.remarks.equals("NULL")) { |
||||||
|
if (j == regexList.size() - 1) { |
||||||
|
result.append(""); |
||||||
|
} else { |
||||||
|
result.append("").append(divided_symbols); |
||||||
|
} |
||||||
|
} else { |
||||||
|
if (j == regexList.size() - 1) { |
||||||
|
result.append(pointBaseRecord.remarks); |
||||||
|
} else { |
||||||
|
result.append(pointBaseRecord.remarks).append(divided_symbols); |
||||||
|
} |
||||||
|
} |
||||||
|
} else if (s.equals("采集时间") || s.equals("Measure time") || s.equals("Время сбора")) { |
||||||
|
if (j == regexList.size() - 1) { |
||||||
|
result.append(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(pointBaseRecord.createdAt)); |
||||||
|
} else { |
||||||
|
result.append(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(pointBaseRecord.createdAt)).append(divided_symbols); |
||||||
|
} |
||||||
|
} else if (s.equals("惯导测量") || s.equals("Tilt survey") || s.equals("Нормативное измерение")) { |
||||||
|
if (pointBaseRecord.isTiltEnable) { |
||||||
|
if (j == regexList.size() - 1) { |
||||||
|
result.append(context.getString(R.string.yes)); |
||||||
|
} else { |
||||||
|
result.append(context.getString(R.string.yes)).append(divided_symbols); |
||||||
|
} |
||||||
|
} else { |
||||||
|
if (j == regexList.size() - 1) { |
||||||
|
result.append(context.getString(R.string.no)); |
||||||
|
} else { |
||||||
|
result.append(context.getString(R.string.no)).append(divided_symbols); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
result.append("\r\n"); |
||||||
|
} |
||||||
|
File target = new File(FileUtil.getSDPath() + "/" + context.getString(R.string.surveyor_exported_file) + "/" + context.getString(R.string.point_survey) + "/" + editText + suffixesUtils); |
||||||
|
boolean success = FileUtil.writeString(result.toString(), target, "GBK"); |
||||||
|
if (success) { |
||||||
|
ExcelUtil.showCompleteDialog(context, target); |
||||||
|
} else { |
||||||
|
ToastUtils.showShort(context.getString(R.string.export_failure)); |
||||||
|
} |
||||||
|
} |
||||||
|
}).create().show(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 根据成果导出的格式,经纬度进行转换导出 |
||||||
|
* |
||||||
|
* @param angle_format_type |
||||||
|
* @param l |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
private static String converAngleFormat(int angle_format_type, double l) { |
||||||
|
if (angle_format_type == AddResultFormatActivity.ANGLE_FORMAT_D_MS) { |
||||||
|
//度.分秒
|
||||||
|
return Util.radianToDmsDoubleString(Math.toRadians(l), 6, false); |
||||||
|
} else if (angle_format_type == AddResultFormatActivity.ANGLE_FORMAT_D_M_S) { |
||||||
|
//度°分′秒″
|
||||||
|
return Util.radianToDmsString(Math.toRadians(l), 6, true); |
||||||
|
} else if (angle_format_type == AddResultFormatActivity.ANGLE_FORMAT_D) { |
||||||
|
//度
|
||||||
|
return Util.formatDouble2String(l, 6); |
||||||
|
} else { |
||||||
|
//弧度
|
||||||
|
return Util.formatDouble2String(Math.toRadians(l), 6); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,48 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto" |
||||||
|
xmlns:fab="http://schemas.android.com/apk/res-auto" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="match_parent"> |
||||||
|
|
||||||
|
<LinearLayout |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="match_parent" |
||||||
|
android:orientation="vertical"> |
||||||
|
|
||||||
|
<androidx.appcompat.widget.Toolbar |
||||||
|
android:id="@+id/toolbar" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="?android:attr/actionBarSize" |
||||||
|
android:background="?colorPrimary" |
||||||
|
android:minHeight="?android:attr/actionBarSize" |
||||||
|
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" |
||||||
|
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" /> |
||||||
|
|
||||||
|
<TextView |
||||||
|
android:id="@+id/tv_filter_key" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:paddingStart="16dp" |
||||||
|
android:paddingEnd="16dp" |
||||||
|
android:visibility="gone" /> |
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView |
||||||
|
android:id="@+id/recyclerview_points" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="0dp" |
||||||
|
android:layout_weight="1" /> |
||||||
|
</LinearLayout> |
||||||
|
|
||||||
|
<com.github.clans.fab.FloatingActionButton |
||||||
|
android:id="@+id/fab_new_point" |
||||||
|
android:layout_width="wrap_content" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:layout_alignParentEnd="true" |
||||||
|
android:layout_alignParentBottom="true" |
||||||
|
android:layout_marginEnd="16dp" |
||||||
|
android:layout_marginBottom="16dp" |
||||||
|
android:src="@drawable/fab_add" |
||||||
|
fab:fab_colorNormal="?colorPrimary" |
||||||
|
fab:fab_colorPressed="?colorPrimaryDark" /> |
||||||
|
</RelativeLayout> |
@ -0,0 +1,307 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto" |
||||||
|
xmlns:tools="http://schemas.android.com/tools" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="match_parent"> |
||||||
|
<androidx.appcompat.widget.Toolbar |
||||||
|
android:id="@+id/toolbar" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="?android:attr/actionBarSize" |
||||||
|
android:background="?colorPrimary" |
||||||
|
android:minHeight="?android:attr/actionBarSize" |
||||||
|
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" |
||||||
|
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/> |
||||||
|
<RelativeLayout |
||||||
|
android:id="@+id/top_layout" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="50dp" |
||||||
|
android:elevation="3dp" |
||||||
|
app:layout_constraintEnd_toEndOf="parent" |
||||||
|
app:layout_constraintStart_toStartOf="parent" |
||||||
|
app:layout_constraintTop_toBottomOf="@id/toolbar"> |
||||||
|
|
||||||
|
<LinearLayout |
||||||
|
android:id="@+id/ll_number" |
||||||
|
android:layout_width="wrap_content" |
||||||
|
android:layout_height="match_parent" |
||||||
|
android:layout_centerVertical="true" |
||||||
|
android:gravity="center_vertical" |
||||||
|
android:orientation="horizontal"> |
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView |
||||||
|
android:layout_width="wrap_content" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:layout_marginLeft="15dp" |
||||||
|
android:text="数量" |
||||||
|
android:textAppearance="@style/MyTextAppearanceBody1" |
||||||
|
android:textSize="15sp" |
||||||
|
android:textStyle="bold" /> |
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView |
||||||
|
android:id="@+id/tv_point_number" |
||||||
|
android:layout_width="wrap_content" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:layout_marginLeft="5dp" |
||||||
|
android:text="0" |
||||||
|
android:textColor="@color/nliveo_green_colorPrimaryDark" |
||||||
|
android:textSize="16sp" |
||||||
|
android:textStyle="bold" /> |
||||||
|
|
||||||
|
</LinearLayout> |
||||||
|
|
||||||
|
<RelativeLayout |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="match_parent" |
||||||
|
android:layout_marginStart="10dp" |
||||||
|
android:layout_marginTop="6dp" |
||||||
|
android:layout_marginEnd="15dp" |
||||||
|
android:layout_marginBottom="6dp" |
||||||
|
android:layout_toEndOf="@+id/ll_number" |
||||||
|
android:background="@drawable/rectangle_radius_5_gray_full"> |
||||||
|
|
||||||
|
<com.bingce.ui.CleanableEditText |
||||||
|
android:id="@+id/etEnterNameCode" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="match_parent" |
||||||
|
android:layout_alignParentEnd="true" |
||||||
|
android:layout_centerVertical="true" |
||||||
|
android:layout_marginEnd="20dp" |
||||||
|
android:background="@null" |
||||||
|
android:drawableEnd="@mipmap/icon_clear" |
||||||
|
android:gravity="center_vertical" |
||||||
|
android:imeOptions="actionDone" |
||||||
|
android:paddingLeft="15dp" |
||||||
|
android:paddingRight="15dp" |
||||||
|
android:singleLine="true" |
||||||
|
android:textColor="@color/black" |
||||||
|
android:textColorHint="@color/color_999999" |
||||||
|
android:textSize="@dimen/NormalTextSize" /> |
||||||
|
|
||||||
|
</RelativeLayout> |
||||||
|
|
||||||
|
</RelativeLayout> |
||||||
|
<androidx.appcompat.widget.AppCompatTextView |
||||||
|
android:id="@+id/header_name" |
||||||
|
app:layout_constraintStart_toStartOf="parent" |
||||||
|
app:layout_constraintTop_toBottomOf="@id/top_layout" |
||||||
|
android:layout_width="100dp" |
||||||
|
android:layout_height="50dp" |
||||||
|
android:paddingHorizontal="10dp" |
||||||
|
android:ellipsize="end" |
||||||
|
android:gravity="center" |
||||||
|
android:singleLine="true" |
||||||
|
android:minWidth="100dp" |
||||||
|
android:textAppearance="@style/MyTextAppearanceBody1" |
||||||
|
android:textSize="14sp" |
||||||
|
android:textStyle="bold" |
||||||
|
android:text="@string/point_name" /> |
||||||
|
<com.project.survey.widget.bingce.SyncHorizontalScrollView |
||||||
|
android:id="@+id/header_hsv" |
||||||
|
app:layout_constraintTop_toTopOf="@id/header_name" |
||||||
|
app:layout_constraintBottom_toBottomOf="@id/header_name" |
||||||
|
app:layout_constraintStart_toEndOf="@id/header_name" |
||||||
|
app:layout_constraintEnd_toEndOf="parent" |
||||||
|
android:layout_width="0dp" |
||||||
|
android:layout_height="0dp" |
||||||
|
android:fillViewport="true" |
||||||
|
android:scrollbars="none"> |
||||||
|
<LinearLayout |
||||||
|
android:layout_width="600dp" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:orientation="horizontal"> |
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView |
||||||
|
android:layout_width="70dp" |
||||||
|
android:layout_height="50dp" |
||||||
|
android:paddingHorizontal="10dp" |
||||||
|
android:ellipsize="end" |
||||||
|
android:gravity="center" |
||||||
|
android:singleLine="true" |
||||||
|
android:textAppearance="@style/MyTextAppearanceBody1" |
||||||
|
android:textSize="14sp" |
||||||
|
android:textStyle="bold" |
||||||
|
android:text="@string/point_code" /> |
||||||
|
<androidx.appcompat.widget.AppCompatTextView |
||||||
|
android:layout_width="110dp" |
||||||
|
android:layout_height="50dp" |
||||||
|
android:paddingHorizontal="10dp" |
||||||
|
android:ellipsize="end" |
||||||
|
android:gravity="center" |
||||||
|
android:singleLine="true" |
||||||
|
android:textAppearance="@style/MyTextAppearanceBody1" |
||||||
|
android:textSize="14sp" |
||||||
|
android:textStyle="bold" |
||||||
|
android:text="@string/northing" /> |
||||||
|
<androidx.appcompat.widget.AppCompatTextView |
||||||
|
android:layout_width="110dp" |
||||||
|
android:layout_height="50dp" |
||||||
|
android:paddingHorizontal="10dp" |
||||||
|
android:ellipsize="end" |
||||||
|
android:gravity="center" |
||||||
|
android:singleLine="true" |
||||||
|
android:textAppearance="@style/MyTextAppearanceBody1" |
||||||
|
android:textSize="14sp" |
||||||
|
android:textStyle="bold" |
||||||
|
android:text="@string/easting" /> |
||||||
|
<androidx.appcompat.widget.AppCompatTextView |
||||||
|
android:layout_width="110dp" |
||||||
|
android:layout_height="50dp" |
||||||
|
android:paddingHorizontal="10dp" |
||||||
|
android:ellipsize="end" |
||||||
|
android:gravity="center" |
||||||
|
android:singleLine="true" |
||||||
|
android:minWidth="100dp" |
||||||
|
android:textAppearance="@style/MyTextAppearanceBody1" |
||||||
|
android:textSize="14sp" |
||||||
|
android:textStyle="bold" |
||||||
|
android:text="@string/elevation" /> |
||||||
|
<androidx.appcompat.widget.AppCompatTextView |
||||||
|
android:layout_width="200dp" |
||||||
|
android:layout_height="50dp" |
||||||
|
android:paddingHorizontal="10dp" |
||||||
|
android:ellipsize="end" |
||||||
|
android:gravity="center" |
||||||
|
android:singleLine="true" |
||||||
|
android:minWidth="100dp" |
||||||
|
android:textAppearance="@style/MyTextAppearanceBody1" |
||||||
|
android:textSize="14sp" |
||||||
|
android:textStyle="bold" |
||||||
|
android:text="@string/create_date" /> |
||||||
|
<androidx.appcompat.widget.AppCompatTextView |
||||||
|
android:layout_width="200dp" |
||||||
|
android:layout_height="50dp" |
||||||
|
android:paddingHorizontal="10dp" |
||||||
|
android:ellipsize="end" |
||||||
|
android:gravity="center" |
||||||
|
android:singleLine="true" |
||||||
|
android:minWidth="100dp" |
||||||
|
android:textAppearance="@style/MyTextAppearanceBody1" |
||||||
|
android:textSize="14sp" |
||||||
|
android:textStyle="bold" |
||||||
|
android:text="@string/remark" /> |
||||||
|
</LinearLayout> |
||||||
|
</com.project.survey.widget.bingce.SyncHorizontalScrollView> |
||||||
|
<com.project.survey.widget.bingce.TouchRelativeLayout |
||||||
|
android:id="@+id/body_name_rl" |
||||||
|
app:layout_constraintTop_toBottomOf="@id/header_name" |
||||||
|
app:layout_constraintStart_toStartOf="@id/header_name" |
||||||
|
app:layout_constraintBottom_toTopOf="@id/bottom_menu" |
||||||
|
android:layout_width="100dp" |
||||||
|
android:layout_height="0dp"> |
||||||
|
<androidx.recyclerview.widget.RecyclerView |
||||||
|
android:id="@+id/body_name_rv" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="match_parent" |
||||||
|
android:orientation="vertical" |
||||||
|
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"/> |
||||||
|
</com.project.survey.widget.bingce.TouchRelativeLayout> |
||||||
|
<com.project.survey.widget.bingce.SyncHorizontalScrollView |
||||||
|
android:id="@+id/body_hsv" |
||||||
|
app:layout_constraintStart_toEndOf="@id/body_name_rl" |
||||||
|
app:layout_constraintEnd_toEndOf="parent" |
||||||
|
app:layout_constraintTop_toTopOf="@id/body_name_rl" |
||||||
|
app:layout_constraintBottom_toBottomOf="@id/body_name_rl" |
||||||
|
android:layout_width="0dp" |
||||||
|
android:layout_height="0dp" |
||||||
|
android:fillViewport="true" |
||||||
|
android:scrollbars="none"> |
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView |
||||||
|
android:id="@+id/body_rv" |
||||||
|
android:layout_width="600dp" |
||||||
|
android:layout_height="match_parent" |
||||||
|
android:orientation="vertical" |
||||||
|
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" /> |
||||||
|
</com.project.survey.widget.bingce.SyncHorizontalScrollView> |
||||||
|
|
||||||
|
<include |
||||||
|
android:id="@+id/page_layout" |
||||||
|
layout="@layout/page_layout" |
||||||
|
android:layout_width="0dp" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:visibility="gone" |
||||||
|
app:layout_constraintBottom_toTopOf="@id/bottom_menu" |
||||||
|
app:layout_constraintEnd_toEndOf="parent" |
||||||
|
app:layout_constraintStart_toStartOf="parent" |
||||||
|
tools:visibility="visible" /> |
||||||
|
|
||||||
|
<LinearLayout |
||||||
|
android:id="@+id/bottom_menu" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
app:layout_constraintBottom_toBottomOf="parent" |
||||||
|
app:layout_constraintEnd_toEndOf="parent" |
||||||
|
app:layout_constraintStart_toStartOf="parent"> |
||||||
|
|
||||||
|
<Button |
||||||
|
android:id="@+id/points_library_btn_filter" |
||||||
|
style="@style/Widget.AppCompat.Button.Colored" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="@dimen/bt_height" |
||||||
|
android:textAppearance="@style/MyTextAppearanceBody1" |
||||||
|
android:layout_weight="1" |
||||||
|
android:text="@string/filter" /> |
||||||
|
|
||||||
|
<Button |
||||||
|
android:id="@+id/points_library_btn_new_create" |
||||||
|
style="@style/Widget.AppCompat.Button.Colored" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="@dimen/bt_height" |
||||||
|
android:textAppearance="@style/MyTextAppearanceBody1" |
||||||
|
android:layout_weight="1" |
||||||
|
android:text="@string/create" /> |
||||||
|
|
||||||
|
<Button |
||||||
|
android:id="@+id/points_library_btn_delete" |
||||||
|
style="@style/Widget.AppCompat.Button.Colored" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="@dimen/bt_height" |
||||||
|
android:textAppearance="@style/MyTextAppearanceBody1" |
||||||
|
android:layout_weight="1" |
||||||
|
android:text="@string/delete" /> |
||||||
|
|
||||||
|
<Button |
||||||
|
android:id="@+id/points_library_btn_confirm" |
||||||
|
style="@style/Widget.AppCompat.Button.Colored" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="@dimen/bt_height" |
||||||
|
android:textAppearance="@style/MyTextAppearanceBody1" |
||||||
|
android:layout_weight="1" |
||||||
|
android:text="@string/confirm" /> |
||||||
|
|
||||||
|
<Button |
||||||
|
android:id="@+id/points_library_btn_more" |
||||||
|
style="@style/Widget.AppCompat.Button.Colored" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="@dimen/bt_height" |
||||||
|
android:textAppearance="@style/MyTextAppearanceBody1" |
||||||
|
android:layout_weight="1" |
||||||
|
android:text="@string/more" /> |
||||||
|
|
||||||
|
</LinearLayout> |
||||||
|
|
||||||
|
<FrameLayout |
||||||
|
android:id="@+id/loading_layout" |
||||||
|
android:layout_width="0dp" |
||||||
|
android:layout_height="0dp" |
||||||
|
android:background="@drawable/ripple_white_loading" |
||||||
|
android:clickable="true" |
||||||
|
android:elevation="3dp" |
||||||
|
android:visibility="gone" |
||||||
|
android:focusable="true" |
||||||
|
app:layout_constraintBottom_toBottomOf="parent" |
||||||
|
app:layout_constraintEnd_toEndOf="parent" |
||||||
|
app:layout_constraintStart_toStartOf="parent" |
||||||
|
app:layout_constraintTop_toBottomOf="@id/top_layout"> |
||||||
|
|
||||||
|
<ProgressBar |
||||||
|
android:layout_width="40dp" |
||||||
|
android:layout_height="40dp" |
||||||
|
android:layout_gravity="center" |
||||||
|
android:indeterminateDrawable="@drawable/loading_drawable" |
||||||
|
android:visibility="visible" /> |
||||||
|
|
||||||
|
</FrameLayout> |
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout> |
@ -0,0 +1,302 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto" |
||||||
|
xmlns:tools="http://schemas.android.com/tools" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="match_parent"> |
||||||
|
|
||||||
|
<RelativeLayout |
||||||
|
android:id="@+id/top_layout" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="52dp" |
||||||
|
android:background="@color/white" |
||||||
|
android:elevation="3dp" |
||||||
|
app:layout_constraintEnd_toEndOf="parent" |
||||||
|
app:layout_constraintStart_toStartOf="parent" |
||||||
|
tools:ignore="MissingConstraints"> |
||||||
|
|
||||||
|
<LinearLayout |
||||||
|
android:id="@+id/ll_number" |
||||||
|
android:layout_width="wrap_content" |
||||||
|
android:layout_height="match_parent" |
||||||
|
android:layout_centerVertical="true" |
||||||
|
android:gravity="center_vertical" |
||||||
|
android:orientation="horizontal"> |
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView |
||||||
|
android:id="@+id/tv_number" |
||||||
|
android:layout_width="wrap_content" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:layout_marginLeft="15dp" |
||||||
|
android:text="@string/number" |
||||||
|
android:textColor="@color/black" |
||||||
|
android:textSize="15sp" |
||||||
|
android:textStyle="bold" /> |
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView |
||||||
|
android:id="@+id/tv_point_number" |
||||||
|
android:layout_width="wrap_content" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:layout_marginLeft="5dp" |
||||||
|
android:text="0" |
||||||
|
android:textColor="@color/nliveo_green_colorPrimaryDark" |
||||||
|
android:textSize="16sp" |
||||||
|
android:textStyle="bold" /> |
||||||
|
|
||||||
|
</LinearLayout> |
||||||
|
|
||||||
|
<RelativeLayout |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="match_parent" |
||||||
|
android:layout_marginStart="10dp" |
||||||
|
android:layout_marginTop="6dp" |
||||||
|
android:layout_marginEnd="15dp" |
||||||
|
android:layout_marginBottom="6dp" |
||||||
|
android:layout_toEndOf="@+id/ll_number" |
||||||
|
android:background="@drawable/rectangle_radius_5_gray_full"> |
||||||
|
|
||||||
|
<com.bingce.ui.CleanableEditText |
||||||
|
android:id="@+id/etEnterNameCode" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="match_parent" |
||||||
|
android:layout_alignParentEnd="true" |
||||||
|
android:layout_centerVertical="true" |
||||||
|
android:layout_marginEnd="20dp" |
||||||
|
android:background="@null" |
||||||
|
android:drawableEnd="@mipmap/icon_clear" |
||||||
|
android:gravity="center_vertical" |
||||||
|
android:imeOptions="actionDone" |
||||||
|
android:paddingLeft="15dp" |
||||||
|
android:paddingRight="15dp" |
||||||
|
android:singleLine="true" |
||||||
|
android:textColor="@color/black" |
||||||
|
android:textColorHint="@color/color_999999" |
||||||
|
android:textSize="@dimen/NormalTextSize" /> |
||||||
|
|
||||||
|
</RelativeLayout> |
||||||
|
|
||||||
|
</RelativeLayout> |
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView |
||||||
|
android:id="@+id/header_name" |
||||||
|
app:layout_constraintStart_toStartOf="parent" |
||||||
|
app:layout_constraintTop_toBottomOf="@id/top_layout" |
||||||
|
android:layout_width="100dp" |
||||||
|
android:layout_height="50dp" |
||||||
|
android:paddingHorizontal="10dp" |
||||||
|
android:ellipsize="end" |
||||||
|
android:gravity="center" |
||||||
|
android:singleLine="true" |
||||||
|
android:minWidth="100dp" |
||||||
|
android:textAppearance="@style/MyTextAppearanceBody1" |
||||||
|
android:textSize="14sp" |
||||||
|
android:textStyle="bold" |
||||||
|
android:text="@string/point_name" /> |
||||||
|
<com.project.survey.widget.bingce.SyncHorizontalScrollView |
||||||
|
android:id="@+id/header_hsv" |
||||||
|
app:layout_constraintTop_toTopOf="@id/header_name" |
||||||
|
app:layout_constraintBottom_toBottomOf="@id/header_name" |
||||||
|
app:layout_constraintStart_toEndOf="@id/header_name" |
||||||
|
app:layout_constraintEnd_toEndOf="parent" |
||||||
|
android:layout_width="0dp" |
||||||
|
android:layout_height="0dp" |
||||||
|
android:fillViewport="true" |
||||||
|
android:scrollbars="none"> |
||||||
|
<LinearLayout |
||||||
|
android:layout_width="600dp" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:orientation="horizontal"> |
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView |
||||||
|
android:layout_width="70dp" |
||||||
|
android:layout_height="50dp" |
||||||
|
android:paddingHorizontal="10dp" |
||||||
|
android:ellipsize="end" |
||||||
|
android:gravity="center" |
||||||
|
android:singleLine="true" |
||||||
|
android:textAppearance="@style/MyTextAppearanceBody1" |
||||||
|
android:textSize="14sp" |
||||||
|
android:textStyle="bold" |
||||||
|
android:text="@string/point_code" /> |
||||||
|
<androidx.appcompat.widget.AppCompatTextView |
||||||
|
android:layout_width="110dp" |
||||||
|
android:layout_height="50dp" |
||||||
|
android:paddingHorizontal="10dp" |
||||||
|
android:ellipsize="end" |
||||||
|
android:gravity="center" |
||||||
|
android:singleLine="true" |
||||||
|
android:textAppearance="@style/MyTextAppearanceBody1" |
||||||
|
android:textSize="14sp" |
||||||
|
android:textStyle="bold" |
||||||
|
android:text="@string/northing" /> |
||||||
|
<androidx.appcompat.widget.AppCompatTextView |
||||||
|
android:layout_width="110dp" |
||||||
|
android:layout_height="50dp" |
||||||
|
android:paddingHorizontal="10dp" |
||||||
|
android:ellipsize="end" |
||||||
|
android:gravity="center" |
||||||
|
android:singleLine="true" |
||||||
|
android:textAppearance="@style/MyTextAppearanceBody1" |
||||||
|
android:textSize="14sp" |
||||||
|
android:textStyle="bold" |
||||||
|
android:text="@string/easting" /> |
||||||
|
<androidx.appcompat.widget.AppCompatTextView |
||||||
|
android:layout_width="110dp" |
||||||
|
android:layout_height="50dp" |
||||||
|
android:paddingHorizontal="10dp" |
||||||
|
android:ellipsize="end" |
||||||
|
android:gravity="center" |
||||||
|
android:singleLine="true" |
||||||
|
android:textAppearance="@style/MyTextAppearanceBody1" |
||||||
|
android:textSize="14sp" |
||||||
|
android:textStyle="bold" |
||||||
|
android:text="@string/elevation" /> |
||||||
|
<androidx.appcompat.widget.AppCompatTextView |
||||||
|
android:layout_width="200dp" |
||||||
|
android:layout_height="50dp" |
||||||
|
android:paddingHorizontal="10dp" |
||||||
|
android:ellipsize="end" |
||||||
|
android:gravity="center" |
||||||
|
android:singleLine="true" |
||||||
|
android:minWidth="100dp" |
||||||
|
android:textAppearance="@style/MyTextAppearanceBody1" |
||||||
|
android:textSize="14sp" |
||||||
|
android:textStyle="bold" |
||||||
|
android:text="@string/create_date" /> |
||||||
|
<androidx.appcompat.widget.AppCompatTextView |
||||||
|
android:layout_width="200dp" |
||||||
|
android:layout_height="50dp" |
||||||
|
android:paddingHorizontal="10dp" |
||||||
|
android:ellipsize="end" |
||||||
|
android:gravity="center" |
||||||
|
android:singleLine="true" |
||||||
|
android:minWidth="100dp" |
||||||
|
android:textAppearance="@style/MyTextAppearanceBody1" |
||||||
|
android:textSize="14sp" |
||||||
|
android:textStyle="bold" |
||||||
|
android:text="@string/remark" /> |
||||||
|
</LinearLayout> |
||||||
|
</com.project.survey.widget.bingce.SyncHorizontalScrollView> |
||||||
|
<com.project.survey.widget.bingce.TouchRelativeLayout |
||||||
|
android:id="@+id/body_name_rl" |
||||||
|
app:layout_constraintTop_toBottomOf="@id/header_name" |
||||||
|
app:layout_constraintStart_toStartOf="@id/header_name" |
||||||
|
app:layout_constraintBottom_toTopOf="@id/bottom_menu" |
||||||
|
android:layout_width="100dp" |
||||||
|
android:layout_height="0dp"> |
||||||
|
<androidx.recyclerview.widget.RecyclerView |
||||||
|
android:id="@+id/body_name_rv" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="match_parent" |
||||||
|
android:orientation="vertical" |
||||||
|
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"/> |
||||||
|
</com.project.survey.widget.bingce.TouchRelativeLayout> |
||||||
|
<com.project.survey.widget.bingce.SyncHorizontalScrollView |
||||||
|
android:id="@+id/body_hsv" |
||||||
|
app:layout_constraintStart_toEndOf="@id/body_name_rl" |
||||||
|
app:layout_constraintEnd_toEndOf="parent" |
||||||
|
app:layout_constraintTop_toTopOf="@id/body_name_rl" |
||||||
|
app:layout_constraintBottom_toBottomOf="@id/body_name_rl" |
||||||
|
android:layout_width="0dp" |
||||||
|
android:layout_height="0dp" |
||||||
|
android:fillViewport="true" |
||||||
|
android:scrollbars="none"> |
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView |
||||||
|
android:id="@+id/body_rv" |
||||||
|
android:layout_width="600dp" |
||||||
|
android:layout_height="match_parent" |
||||||
|
android:orientation="vertical" |
||||||
|
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" /> |
||||||
|
</com.project.survey.widget.bingce.SyncHorizontalScrollView> |
||||||
|
|
||||||
|
<include |
||||||
|
android:id="@+id/page_layout" |
||||||
|
layout="@layout/page_layout" |
||||||
|
android:layout_width="0dp" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:visibility="gone" |
||||||
|
app:layout_constraintBottom_toTopOf="@id/bottom_menu" |
||||||
|
app:layout_constraintEnd_toEndOf="parent" |
||||||
|
app:layout_constraintStart_toStartOf="parent" |
||||||
|
tools:visibility="visible" /> |
||||||
|
|
||||||
|
<LinearLayout |
||||||
|
android:id="@+id/bottom_menu" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
app:layout_constraintBottom_toBottomOf="parent" |
||||||
|
app:layout_constraintEnd_toEndOf="parent" |
||||||
|
app:layout_constraintStart_toStartOf="parent"> |
||||||
|
|
||||||
|
<Button |
||||||
|
android:id="@+id/points_library_btn_filter" |
||||||
|
style="@style/Widget.AppCompat.Button.Colored" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="@dimen/bt_height" |
||||||
|
android:textAppearance="@style/MyTextAppearanceBody1" |
||||||
|
android:layout_weight="1" |
||||||
|
android:text="@string/filter" /> |
||||||
|
|
||||||
|
<Button |
||||||
|
android:id="@+id/points_library_btn_new_create" |
||||||
|
style="@style/Widget.AppCompat.Button.Colored" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="@dimen/bt_height" |
||||||
|
android:textAppearance="@style/MyTextAppearanceBody1" |
||||||
|
android:layout_weight="1" |
||||||
|
android:text="@string/create" /> |
||||||
|
|
||||||
|
<Button |
||||||
|
android:id="@+id/points_library_btn_delete" |
||||||
|
style="@style/Widget.AppCompat.Button.Colored" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="@dimen/bt_height" |
||||||
|
android:textAppearance="@style/MyTextAppearanceBody1" |
||||||
|
android:layout_weight="1" |
||||||
|
android:text="@string/delete" /> |
||||||
|
|
||||||
|
<Button |
||||||
|
android:id="@+id/points_library_btn_confirm" |
||||||
|
style="@style/Widget.AppCompat.Button.Colored" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="@dimen/bt_height" |
||||||
|
android:textAppearance="@style/MyTextAppearanceBody1" |
||||||
|
android:layout_weight="1" |
||||||
|
android:text="@string/confirm" /> |
||||||
|
|
||||||
|
<Button |
||||||
|
android:id="@+id/points_library_btn_more" |
||||||
|
style="@style/Widget.AppCompat.Button.Colored" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="@dimen/bt_height" |
||||||
|
android:textAppearance="@style/MyTextAppearanceBody1" |
||||||
|
android:layout_weight="1" |
||||||
|
android:text="@string/more" /> |
||||||
|
|
||||||
|
</LinearLayout> |
||||||
|
|
||||||
|
<FrameLayout |
||||||
|
android:id="@+id/loading_layout" |
||||||
|
android:layout_width="0dp" |
||||||
|
android:layout_height="0dp" |
||||||
|
android:background="@drawable/ripple_white_loading" |
||||||
|
android:clickable="true" |
||||||
|
android:elevation="3dp" |
||||||
|
android:visibility="gone" |
||||||
|
android:focusable="true" |
||||||
|
app:layout_constraintBottom_toBottomOf="parent" |
||||||
|
app:layout_constraintEnd_toEndOf="parent" |
||||||
|
app:layout_constraintStart_toStartOf="parent" |
||||||
|
app:layout_constraintTop_toBottomOf="@id/top_layout"> |
||||||
|
|
||||||
|
<ProgressBar |
||||||
|
android:layout_width="40dp" |
||||||
|
android:layout_height="40dp" |
||||||
|
android:layout_gravity="center" |
||||||
|
android:indeterminateDrawable="@drawable/loading_drawable" |
||||||
|
android:visibility="visible" /> |
||||||
|
|
||||||
|
</FrameLayout> |
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout> |
@ -0,0 +1,19 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="match_parent" |
||||||
|
android:orientation="vertical" |
||||||
|
android:paddingStart="16dp" |
||||||
|
android:paddingEnd="16dp"> |
||||||
|
|
||||||
|
<com.rengwuxian.materialedittext.MaterialEditText |
||||||
|
android:id="@+id/met_dialog_records_filter_roadname_keyword" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:hint="@string/name" |
||||||
|
android:textSize="@dimen/myTextSize" |
||||||
|
app:met_clearButton="true" |
||||||
|
app:met_floatingLabel="normal" |
||||||
|
app:met_floatingLabelText="@string/point_name" /> |
||||||
|
</LinearLayout> |
@ -0,0 +1,19 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="match_parent" |
||||||
|
android:gravity="center_horizontal" |
||||||
|
android:orientation="vertical" |
||||||
|
android:padding="10dip"> |
||||||
|
|
||||||
|
<com.rengwuxian.materialedittext.MaterialEditText |
||||||
|
android:id="@+id/dialog_export_point_config_name" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:hint="@string/file_name" |
||||||
|
android:textSize="@dimen/myTextSize" |
||||||
|
app:met_floatingLabel="normal" |
||||||
|
app:met_floatingLabelText="@string/file_name" /> |
||||||
|
|
||||||
|
</LinearLayout> |
@ -0,0 +1,95 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="match_parent" |
||||||
|
android:orientation="vertical"> |
||||||
|
|
||||||
|
<LinearLayout |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:orientation="vertical" |
||||||
|
android:paddingStart="16dp" |
||||||
|
android:paddingEnd="16dp"> |
||||||
|
|
||||||
|
<com.rengwuxian.materialedittext.MaterialEditText |
||||||
|
android:id="@+id/met_dialog_new_staking_point_name" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:hint="@string/point_name" |
||||||
|
android:singleLine="true" |
||||||
|
android:textSize="@dimen/myTextSize" |
||||||
|
app:met_clearButton="true" |
||||||
|
app:met_floatingLabel="normal" |
||||||
|
app:met_floatingLabelText="@string/point_name" /> |
||||||
|
|
||||||
|
<com.rengwuxian.materialedittext.MaterialEditText |
||||||
|
android:id="@+id/met_dialog_new_point_code" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:hint="@string/point_code" |
||||||
|
android:singleLine="true" |
||||||
|
android:textSize="@dimen/myTextSize" |
||||||
|
app:met_clearButton="true" |
||||||
|
app:met_floatingLabel="normal" |
||||||
|
app:met_floatingLabelText="@string/point_code" /> |
||||||
|
|
||||||
|
<com.rengwuxian.materialedittext.MaterialEditText |
||||||
|
android:id="@+id/met_dialog_new_staking_point_x" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:hint="@string/x_coordinate" |
||||||
|
android:inputType="numberDecimal|numberSigned" |
||||||
|
android:singleLine="true" |
||||||
|
android:textSize="@dimen/myTextSize" |
||||||
|
app:met_clearButton="true" |
||||||
|
app:met_floatingLabel="normal" |
||||||
|
app:met_floatingLabelText="@string/x_coordinate" /> |
||||||
|
|
||||||
|
<com.rengwuxian.materialedittext.MaterialEditText |
||||||
|
android:id="@+id/met_dialog_new_staking_point_y" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:hint="@string/y_coordinate" |
||||||
|
android:inputType="numberDecimal|numberSigned" |
||||||
|
android:singleLine="true" |
||||||
|
android:textSize="@dimen/myTextSize" |
||||||
|
app:met_clearButton="true" |
||||||
|
app:met_floatingLabel="normal" |
||||||
|
app:met_floatingLabelText="@string/y_coordinate" /> |
||||||
|
|
||||||
|
<com.rengwuxian.materialedittext.MaterialEditText |
||||||
|
android:id="@+id/met_dialog_new_staking_point_z" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:hint="@string/z_coordinate" |
||||||
|
android:inputType="numberDecimal|numberSigned" |
||||||
|
android:singleLine="true" |
||||||
|
android:textSize="@dimen/myTextSize" |
||||||
|
app:met_clearButton="true" |
||||||
|
app:met_floatingLabel="normal" |
||||||
|
app:met_floatingLabelText="@string/z_coordinate" /> |
||||||
|
|
||||||
|
<com.rengwuxian.materialedittext.MaterialEditText |
||||||
|
android:id="@+id/met_dialog_new_point_remarks" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:hint="@string/remarks" |
||||||
|
android:maxLines="3" |
||||||
|
android:textSize="@dimen/myTextSize" |
||||||
|
app:met_clearButton="true" |
||||||
|
app:met_floatingLabel="normal" |
||||||
|
app:met_floatingLabelText="@string/remarks" /> |
||||||
|
|
||||||
|
<com.rengwuxian.materialedittext.MaterialEditText |
||||||
|
android:id="@+id/met_dialog_new_point_date" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:enabled="false" |
||||||
|
android:hint="@string/modify_time" |
||||||
|
android:singleLine="true" |
||||||
|
android:textSize="@dimen/myTextSize" |
||||||
|
app:met_floatingLabel="normal" |
||||||
|
app:met_floatingLabelText="@string/modify_time" /> |
||||||
|
</LinearLayout> |
||||||
|
</ScrollView> |
@ -0,0 +1,85 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="match_parent" |
||||||
|
android:orientation="vertical"> |
||||||
|
|
||||||
|
<LinearLayout |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:orientation="vertical" |
||||||
|
android:paddingStart="16dp" |
||||||
|
android:paddingEnd="16dp"> |
||||||
|
|
||||||
|
<com.rengwuxian.materialedittext.MaterialEditText |
||||||
|
android:id="@+id/met_dialog_new_staking_point_name" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:hint="@string/point_name" |
||||||
|
android:singleLine="true" |
||||||
|
android:textSize="@dimen/myTextSize" |
||||||
|
app:met_clearButton="true" |
||||||
|
app:met_floatingLabel="normal" |
||||||
|
app:met_floatingLabelText="@string/point_name" /> |
||||||
|
|
||||||
|
<com.rengwuxian.materialedittext.MaterialEditText |
||||||
|
android:id="@+id/met_dialog_new_staking_point_code" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:hint="@string/point_code" |
||||||
|
android:singleLine="true" |
||||||
|
android:textSize="@dimen/myTextSize" |
||||||
|
app:met_clearButton="true" |
||||||
|
app:met_floatingLabel="normal" |
||||||
|
app:met_floatingLabelText="@string/point_code" /> |
||||||
|
|
||||||
|
<com.rengwuxian.materialedittext.MaterialEditText |
||||||
|
android:id="@+id/met_dialog_new_staking_point_x" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:hint="@string/x_coordinate" |
||||||
|
android:inputType="numberDecimal|numberSigned" |
||||||
|
android:singleLine="true" |
||||||
|
android:textSize="@dimen/myTextSize" |
||||||
|
app:met_clearButton="true" |
||||||
|
app:met_floatingLabel="normal" |
||||||
|
app:met_floatingLabelText="@string/x_coordinate" /> |
||||||
|
|
||||||
|
<com.rengwuxian.materialedittext.MaterialEditText |
||||||
|
android:id="@+id/met_dialog_new_staking_point_y" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:hint="@string/y_coordinate" |
||||||
|
android:inputType="numberDecimal|numberSigned" |
||||||
|
android:singleLine="true" |
||||||
|
android:textSize="@dimen/myTextSize" |
||||||
|
app:met_clearButton="true" |
||||||
|
app:met_floatingLabel="normal" |
||||||
|
app:met_floatingLabelText="@string/y_coordinate" /> |
||||||
|
|
||||||
|
<com.rengwuxian.materialedittext.MaterialEditText |
||||||
|
android:id="@+id/met_dialog_new_staking_point_z" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:hint="@string/z_coordinate" |
||||||
|
android:inputType="numberDecimal|numberSigned" |
||||||
|
android:singleLine="true" |
||||||
|
android:textSize="@dimen/myTextSize" |
||||||
|
app:met_clearButton="true" |
||||||
|
app:met_floatingLabel="normal" |
||||||
|
app:met_floatingLabelText="@string/z_coordinate" /> |
||||||
|
|
||||||
|
|
||||||
|
<com.rengwuxian.materialedittext.MaterialEditText |
||||||
|
android:id="@+id/met_dialog_new_staking_point_remarks" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:hint="@string/remarks" |
||||||
|
android:maxLines="3" |
||||||
|
android:textSize="@dimen/myTextSize" |
||||||
|
app:met_clearButton="true" |
||||||
|
app:met_floatingLabel="normal" |
||||||
|
app:met_floatingLabelText="@string/remarks" /> |
||||||
|
</LinearLayout> |
||||||
|
</ScrollView> |
@ -0,0 +1,98 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="50dp" |
||||||
|
xmlns:tools="http://schemas.android.com/tools" |
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto" |
||||||
|
android:orientation="horizontal"> |
||||||
|
<androidx.appcompat.widget.AppCompatTextView |
||||||
|
android:id="@+id/tv_code" |
||||||
|
android:layout_width="70dp" |
||||||
|
android:layout_height="match_parent" |
||||||
|
android:paddingHorizontal="5dp" |
||||||
|
android:gravity="center" |
||||||
|
android:maxLines="1" |
||||||
|
android:textAppearance="@style/MyTextAppearanceBody1" |
||||||
|
android:textSize="14sp" |
||||||
|
android:ellipsize="end" |
||||||
|
app:autoSizeTextType="uniform" |
||||||
|
app:autoSizeMinTextSize="9sp" |
||||||
|
app:autoSizeMaxTextSize="14sp" |
||||||
|
app:autoSizeStepGranularity="1sp" |
||||||
|
tools:text="编码" /> |
||||||
|
<androidx.appcompat.widget.AppCompatTextView |
||||||
|
android:id="@+id/tv_x" |
||||||
|
android:layout_width="110dp" |
||||||
|
android:layout_height="match_parent" |
||||||
|
android:paddingHorizontal="5dp" |
||||||
|
android:gravity="center" |
||||||
|
android:maxLines="1" |
||||||
|
android:ellipsize="end" |
||||||
|
android:textAppearance="@style/MyTextAppearanceBody1" |
||||||
|
android:textSize="14sp" |
||||||
|
app:autoSizeTextType="uniform" |
||||||
|
app:autoSizeMinTextSize="9sp" |
||||||
|
app:autoSizeMaxTextSize="14sp" |
||||||
|
app:autoSizeStepGranularity="1sp" |
||||||
|
tools:text="北坐标" /> |
||||||
|
<androidx.appcompat.widget.AppCompatTextView |
||||||
|
android:id="@+id/tv_y" |
||||||
|
android:layout_width="110dp" |
||||||
|
android:layout_height="match_parent" |
||||||
|
android:paddingHorizontal="5dp" |
||||||
|
android:gravity="center" |
||||||
|
android:ellipsize="end" |
||||||
|
android:maxLines="1" |
||||||
|
android:textAppearance="@style/MyTextAppearanceBody1" |
||||||
|
android:textSize="14sp" |
||||||
|
app:autoSizeTextType="uniform" |
||||||
|
app:autoSizeMinTextSize="9sp" |
||||||
|
app:autoSizeMaxTextSize="14sp" |
||||||
|
app:autoSizeStepGranularity="1sp" |
||||||
|
tools:text="东坐标" /> |
||||||
|
<androidx.appcompat.widget.AppCompatTextView |
||||||
|
android:id="@+id/tv_h" |
||||||
|
android:layout_width="110dp" |
||||||
|
android:layout_height="match_parent" |
||||||
|
android:paddingHorizontal="5dp" |
||||||
|
android:ellipsize="end" |
||||||
|
android:gravity="center" |
||||||
|
android:maxLines="1" |
||||||
|
android:textAppearance="@style/MyTextAppearanceBody1" |
||||||
|
android:textSize="14sp" |
||||||
|
app:autoSizeTextType="uniform" |
||||||
|
app:autoSizeMinTextSize="9sp" |
||||||
|
app:autoSizeMaxTextSize="14sp" |
||||||
|
app:autoSizeStepGranularity="1sp" |
||||||
|
tools:text="高程" /> |
||||||
|
<androidx.appcompat.widget.AppCompatTextView |
||||||
|
android:id="@+id/tv_time" |
||||||
|
android:layout_width="200dp" |
||||||
|
android:layout_height="match_parent" |
||||||
|
android:paddingHorizontal="5dp" |
||||||
|
android:gravity="center" |
||||||
|
android:ellipsize="end" |
||||||
|
android:maxLines="1" |
||||||
|
android:textAppearance="@style/MyTextAppearanceBody1" |
||||||
|
android:textSize="14sp" |
||||||
|
app:autoSizeTextType="uniform" |
||||||
|
app:autoSizeMinTextSize="9sp" |
||||||
|
app:autoSizeMaxTextSize="14sp" |
||||||
|
app:autoSizeStepGranularity="1sp" |
||||||
|
tools:text="创建时间" /> |
||||||
|
<androidx.appcompat.widget.AppCompatTextView |
||||||
|
android:id="@+id/tv_remark" |
||||||
|
android:layout_width="200dp" |
||||||
|
android:layout_height="match_parent" |
||||||
|
android:paddingHorizontal="5dp" |
||||||
|
android:gravity="center" |
||||||
|
android:ellipsize="end" |
||||||
|
android:maxLines="3" |
||||||
|
android:textAppearance="@style/MyTextAppearanceBody1" |
||||||
|
android:textSize="14sp" |
||||||
|
app:autoSizeTextType="uniform" |
||||||
|
app:autoSizeMinTextSize="8sp" |
||||||
|
app:autoSizeMaxTextSize="14sp" |
||||||
|
app:autoSizeStepGranularity="1sp" |
||||||
|
tools:text="备注" /> |
||||||
|
</LinearLayout> |
@ -0,0 +1,24 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="50dp" |
||||||
|
xmlns:tools="http://schemas.android.com/tools" |
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto" |
||||||
|
android:orientation="horizontal"> |
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView |
||||||
|
android:id="@+id/tv_name" |
||||||
|
android:layout_width="100dp" |
||||||
|
android:layout_height="match_parent" |
||||||
|
android:paddingHorizontal="10dp" |
||||||
|
android:gravity="center" |
||||||
|
android:maxLines="3" |
||||||
|
android:textAppearance="@style/MyTextAppearanceBody1" |
||||||
|
android:textSize="14sp" |
||||||
|
app:autoSizeTextType="uniform" |
||||||
|
android:ellipsize="end" |
||||||
|
app:autoSizeMinTextSize="10sp" |
||||||
|
app:autoSizeMaxTextSize="14sp" |
||||||
|
app:autoSizeStepGranularity="1sp" |
||||||
|
tools:text="点名" /> |
||||||
|
</LinearLayout> |
@ -0,0 +1,40 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
android:layout_width="106dp" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto" |
||||||
|
android:orientation="vertical" |
||||||
|
android:background="@drawable/round_white"> |
||||||
|
<TextView |
||||||
|
android:id="@+id/tv_edit" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="50dp" |
||||||
|
android:textSize="16sp" |
||||||
|
android:text="编辑" |
||||||
|
style="@style/Widget.AppCompat.Button.Colored" |
||||||
|
android:textAppearance="@style/MyTextAppearanceBody1" |
||||||
|
android:gravity="center" |
||||||
|
android:paddingHorizontal="10dp"/> |
||||||
|
<TextView |
||||||
|
android:id="@+id/tv_import" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="50dp" |
||||||
|
android:textSize="16sp" |
||||||
|
android:textAppearance="@style/MyTextAppearanceBody1" |
||||||
|
android:text="导入" |
||||||
|
style="@style/Widget.AppCompat.Button.Colored" |
||||||
|
android:gravity="center" |
||||||
|
android:paddingHorizontal="10dp"/> |
||||||
|
<TextView |
||||||
|
android:id="@+id/tv_export" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="50dp" |
||||||
|
android:textSize="16sp" |
||||||
|
android:text="导出" |
||||||
|
android:textAppearance="@style/MyTextAppearanceBody1" |
||||||
|
style="@style/Widget.AppCompat.Button.Colored" |
||||||
|
android:gravity="center" |
||||||
|
android:paddingHorizontal="10dp"/> |
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout> |
@ -0,0 +1,116 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto" |
||||||
|
xmlns:tools="http://schemas.android.com/tools" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content"> |
||||||
|
|
||||||
|
<LinearLayout |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="80dp" |
||||||
|
android:layout_margin="5dp" |
||||||
|
android:gravity="center_vertical" |
||||||
|
android:orientation="horizontal" |
||||||
|
android:paddingStart="16dp" |
||||||
|
android:paddingEnd="16dp" |
||||||
|
app:layout_constraintEnd_toEndOf="parent" |
||||||
|
app:layout_constraintStart_toStartOf="parent" |
||||||
|
app:layout_constraintTop_toTopOf="parent"> |
||||||
|
|
||||||
|
<LinearLayout |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="match_parent" |
||||||
|
android:elevation="5dp" |
||||||
|
android:gravity="center_vertical" |
||||||
|
android:orientation="vertical"> |
||||||
|
|
||||||
|
<LinearLayout |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:orientation="horizontal"> |
||||||
|
|
||||||
|
<TextView |
||||||
|
android:id="@+id/recyclerview_item_swipe_point_title1" |
||||||
|
android:layout_width="wrap_content" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:ellipsize="end" |
||||||
|
android:paddingEnd="16dp" |
||||||
|
android:singleLine="true" |
||||||
|
android:textAppearance="@style/MyTextAppearanceHeadline" |
||||||
|
tools:text="标题1" /> |
||||||
|
|
||||||
|
<TextView |
||||||
|
android:id="@+id/recyclerview_item_swipe_point_title2" |
||||||
|
android:layout_width="wrap_content" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:ellipsize="end" |
||||||
|
android:singleLine="true" |
||||||
|
android:textAppearance="@style/MyTextAppearanceSubhead" |
||||||
|
tools:text="标题2" /> |
||||||
|
</LinearLayout> |
||||||
|
|
||||||
|
|
||||||
|
<LinearLayout |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:orientation="horizontal"> |
||||||
|
|
||||||
|
<TextView |
||||||
|
android:id="@+id/recyclerview_item_swipe_point_body1" |
||||||
|
android:layout_width="wrap_content" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:ellipsize="end" |
||||||
|
android:paddingEnd="16dp" |
||||||
|
android:singleLine="true" |
||||||
|
android:textAppearance="@style/MyTextAppearanceBody1" |
||||||
|
tools:text="内容1" /> |
||||||
|
|
||||||
|
<TextView |
||||||
|
android:id="@+id/recyclerview_item_swipe_point_body2" |
||||||
|
android:layout_width="wrap_content" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:ellipsize="end" |
||||||
|
android:paddingEnd="16dp" |
||||||
|
android:singleLine="true" |
||||||
|
android:textAppearance="@style/MyTextAppearanceBody1" |
||||||
|
tools:text="内容2" /> |
||||||
|
|
||||||
|
<TextView |
||||||
|
android:id="@+id/recyclerview_item_swipe_point_body3" |
||||||
|
android:layout_width="wrap_content" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:ellipsize="end" |
||||||
|
android:singleLine="true" |
||||||
|
android:textAppearance="@style/MyTextAppearanceBody1" |
||||||
|
tools:text="内容3" /> |
||||||
|
</LinearLayout> |
||||||
|
|
||||||
|
<LinearLayout |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:orientation="horizontal"> |
||||||
|
|
||||||
|
<TextView |
||||||
|
android:id="@+id/recyclerview_item_swipe_point_body4" |
||||||
|
android:layout_width="wrap_content" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:ellipsize="end" |
||||||
|
android:paddingEnd="16dp" |
||||||
|
android:singleLine="true" |
||||||
|
android:textAppearance="@style/MyTextAppearanceBody1" |
||||||
|
tools:text="内容4" /> |
||||||
|
|
||||||
|
<TextView |
||||||
|
android:id="@+id/recyclerview_item_swipe_point_body5" |
||||||
|
android:layout_width="wrap_content" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
android:ellipsize="end" |
||||||
|
android:singleLine="true" |
||||||
|
android:textAppearance="@style/MyTextAppearanceBody1" |
||||||
|
tools:text="内容5" /> |
||||||
|
</LinearLayout> |
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout> |
||||||
|
</LinearLayout> |
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout> |
@ -0,0 +1,20 @@ |
|||||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"> |
||||||
|
|
||||||
|
<item |
||||||
|
android:id="@+id/menu_point_search" |
||||||
|
android:title="@string/search" |
||||||
|
app:showAsAction="ifRoom|collapseActionView" /> |
||||||
|
<item |
||||||
|
android:id="@+id/menu_point_import" |
||||||
|
android:title="@string/import_points" |
||||||
|
app:showAsAction="ifRoom" /> |
||||||
|
<item |
||||||
|
android:id="@+id/menu_point_export" |
||||||
|
android:title="@string/export_points" |
||||||
|
app:showAsAction="ifRoom" /> |
||||||
|
<item |
||||||
|
android:id="@+id/menu_point_clear" |
||||||
|
android:title="@string/clear" |
||||||
|
app:showAsAction="never" /> |
||||||
|
</menu> |
@ -0,0 +1,8 @@ |
|||||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"> |
||||||
|
|
||||||
|
<item |
||||||
|
android:id="@+id/menu_job_clear" |
||||||
|
android:title="@string/clear" |
||||||
|
app:showAsAction="ifRoom" /> |
||||||
|
</menu> |
Loading…
Reference in new issue