parent
32ff8ad12e
commit
36e72f239c
53 changed files with 7000 additions and 1 deletions
Binary file not shown.
Binary file not shown.
@ -0,0 +1,154 @@ |
||||
package com.project.survey.dialog; |
||||
|
||||
import android.app.Dialog; |
||||
import android.content.Context; |
||||
import android.view.LayoutInflater; |
||||
import android.view.View; |
||||
import android.view.ViewGroup; |
||||
import android.widget.TextView; |
||||
|
||||
import com.project.survey.R; |
||||
|
||||
|
||||
public class CustomStyleDialog extends Dialog { |
||||
|
||||
private CustomStyleDialog(Context context, int themeResId) { |
||||
super(context, themeResId); |
||||
} |
||||
|
||||
private CustomStyleDialog(Context context, boolean cancelable, OnCancelListener cancelListener) { |
||||
super(context, cancelable, cancelListener); |
||||
} |
||||
|
||||
/* Builder */ |
||||
public static class Builder { |
||||
private TextView tvTitle, tvContent; |
||||
private TextView btnSample,btnCancel, btnConfirm; |
||||
|
||||
private View mLayout; |
||||
private View.OnClickListener mButtonSampleClickListener; |
||||
private View.OnClickListener mButtonCancelClickListener; |
||||
private View.OnClickListener mButtonConfirmClickListener; |
||||
|
||||
private CustomStyleDialog mDialog; |
||||
|
||||
public Builder(Context context) { |
||||
mDialog = new CustomStyleDialog(context, R.style.gif_dialog); |
||||
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); |
||||
// 加载布局文件
|
||||
mLayout = inflater.inflate(R.layout.layout_content_style_dialog, null, false); |
||||
// 添加布局文件到 Dialog
|
||||
mDialog.addContentView(mLayout, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); |
||||
|
||||
tvTitle = mLayout.findViewById(R.id.tv_title); |
||||
tvContent = mLayout.findViewById(R.id.tv_content); |
||||
btnSample = mLayout.findViewById(R.id.btn_look_sample); |
||||
btnCancel = mLayout.findViewById(R.id.btn_cancel); |
||||
btnConfirm = mLayout.findViewById(R.id.btn_confirm); |
||||
} |
||||
|
||||
/** |
||||
* 设置 Dialog 标题 |
||||
*/ |
||||
public Builder setTitle(String title) { |
||||
tvTitle.setText(title); |
||||
tvTitle.setVisibility(View.VISIBLE); |
||||
return this; |
||||
} |
||||
|
||||
/** |
||||
* 设置 Dialog内容 |
||||
*/ |
||||
public Builder setContent(String content) { |
||||
tvContent.setText(content); |
||||
return this; |
||||
} |
||||
|
||||
public Builder setButtonSample(String text){ |
||||
btnSample.setText(text); |
||||
return this; |
||||
} |
||||
|
||||
public Builder setButtonSample(View.OnClickListener listener) { |
||||
mButtonSampleClickListener = listener; |
||||
return this; |
||||
} |
||||
|
||||
public Builder setButtonSample(String text, View.OnClickListener listener) { |
||||
btnSample.setText(text); |
||||
mButtonSampleClickListener = listener; |
||||
return this; |
||||
} |
||||
|
||||
/** |
||||
* 设置取消按钮文字和监听 |
||||
*/ |
||||
public Builder setButtonCancel(String text) { |
||||
btnCancel.setText(text); |
||||
return this; |
||||
} |
||||
|
||||
public Builder setButtonCancel(View.OnClickListener listener) { |
||||
mButtonCancelClickListener = listener; |
||||
return this; |
||||
} |
||||
|
||||
public Builder setButtonCancel(String text, View.OnClickListener listener) { |
||||
btnCancel.setText(text); |
||||
mButtonCancelClickListener = listener; |
||||
return this; |
||||
} |
||||
|
||||
/** |
||||
* 设置确认按钮文字和监听 |
||||
*/ |
||||
public Builder setButtonConfirm(View.OnClickListener listener) { |
||||
mButtonConfirmClickListener = listener; |
||||
return this; |
||||
} |
||||
|
||||
public Builder setButtonConfirm(String text, View.OnClickListener listener) { |
||||
btnConfirm.setText(text); |
||||
mButtonConfirmClickListener = listener; |
||||
return this; |
||||
} |
||||
|
||||
public CustomStyleDialog create() { |
||||
|
||||
btnSample.setOnClickListener(new View.OnClickListener() { |
||||
@Override |
||||
public void onClick(View view) { |
||||
mDialog.dismiss(); |
||||
if (mButtonSampleClickListener != null) { |
||||
mButtonSampleClickListener.onClick(view); |
||||
} |
||||
} |
||||
}); |
||||
|
||||
btnCancel.setOnClickListener(new View.OnClickListener() { |
||||
@Override |
||||
public void onClick(View view) { |
||||
mDialog.dismiss(); |
||||
if (mButtonCancelClickListener != null) { |
||||
mButtonCancelClickListener.onClick(view); |
||||
} |
||||
} |
||||
}); |
||||
|
||||
btnConfirm.setOnClickListener(new View.OnClickListener() { |
||||
@Override |
||||
public void onClick(View view) { |
||||
mDialog.dismiss(); |
||||
if (mButtonConfirmClickListener != null) { |
||||
mButtonConfirmClickListener.onClick(view); |
||||
} |
||||
} |
||||
}); |
||||
|
||||
mDialog.setContentView(mLayout); |
||||
mDialog.setCancelable(true); |
||||
mDialog.setCanceledOnTouchOutside(false); |
||||
return mDialog; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,390 @@ |
||||
package com.project.survey.ui.instrument.setupstation; |
||||
|
||||
import android.content.Context; |
||||
import android.content.Intent; |
||||
import android.text.TextUtils; |
||||
import android.view.LayoutInflater; |
||||
import android.view.View; |
||||
import android.widget.AdapterView; |
||||
import android.widget.ArrayAdapter; |
||||
import android.widget.ImageView; |
||||
import android.widget.LinearLayout; |
||||
import android.widget.RelativeLayout; |
||||
import android.widget.TextView; |
||||
|
||||
import androidx.activity.result.ActivityResultLauncher; |
||||
|
||||
|
||||
import com.bingce.surveyor.util.ConstUtils; |
||||
|
||||
import com.bingce.utils.IntentUtil; |
||||
import com.bingce.utils.ThreadPoolUtil; |
||||
import com.google.gson.Gson; |
||||
import com.project.survey.R; |
||||
import com.project.survey.databinding.ActivityAddResultFormatBinding; |
||||
import com.project.survey.ui.base.BaseSurveyNewActivity; |
||||
import com.project.survey.ui.instrument.setupstation.db.RecordsFixedDataBase; |
||||
import com.project.survey.ui.instrument.setupstation.db.resultformat.FormatRecord; |
||||
import com.project.survey.util.SystemUtils; |
||||
import com.zhy.view.flowlayout.FlowLayout; |
||||
import com.zhy.view.flowlayout.TagAdapter; |
||||
|
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
import blankj.utilcode.util.ToastUtils; |
||||
|
||||
|
||||
public class AddResultFormatActivity extends BaseSurveyNewActivity { |
||||
|
||||
public ActivityAddResultFormatBinding binding; |
||||
|
||||
private final int[] mItemsFileHeader = new int[]{R.string.yes, R.string.no}; |
||||
private List<String> mItemsFileHeaderArrayList; |
||||
private int indexOfFileHeader = 0; |
||||
|
||||
private final int[] mItemsSuffix = new int[]{R.string.xls, R.string.dat, R.string.txt,R.string.csv}; |
||||
private List<String> mItemsSuffixArrayList; |
||||
private int indexOfSuffix = 0; |
||||
|
||||
private final int[] mItemsAngleFormat = new int[]{R.string.af_d_ms, R.string.af_d_m_s, R.string.af_d, R.string.af_radian}; |
||||
private List<String> mItemsAngleFormatArrayList; |
||||
private int indexOfAngleFormat = 0; |
||||
|
||||
private final int[] mItemsDividedSymbols = new int[]{R.string.split_comma, R.string.split_at, R.string.split_space, R.string.split_tab, R.string.split_enter}; |
||||
private List<String> mItemsDividedSymbolsArrayList; |
||||
private int indexOfDividedSymbols = 0; |
||||
|
||||
private TagAdapter<String> selAdapter,tagAdapter; |
||||
private List<String> tagTab = new ArrayList(); |
||||
private List<String> selTab = new ArrayList(); |
||||
private String uid; |
||||
private boolean isNewCraet; |
||||
private List<String> allTagList = new ArrayList<>(); |
||||
public static int SUFFIX_XLS_NUM = 0; |
||||
public static int SUFFIX_DAT_NUM = 1; |
||||
public static int SUFFIX_TXT_NUM = 2; |
||||
public static int SUFFIX_CSV_NUM = 3; |
||||
|
||||
private int SYMBOLS_COMMMA = 0; |
||||
private int SYMBOLS_AT = 1; |
||||
private int SYMBOLS_SPACE = 2; |
||||
private int SYMBOLS_TAB = 3; |
||||
private int SYMBOLS_ENTER = 4; |
||||
|
||||
public static int ANGLE_FORMAT_D_MS = 0; |
||||
public static int ANGLE_FORMAT_D_M_S = 1; |
||||
public static int ANGLE_FORMAT_D = 2; |
||||
public static int ANGLE_FORMAT_R = 3; |
||||
|
||||
@Override |
||||
public View getContentView() { |
||||
binding = ActivityAddResultFormatBinding.inflate(getLayoutInflater()); |
||||
return binding.getRoot(); |
||||
} |
||||
|
||||
@Override |
||||
protected void initView() { |
||||
|
||||
isNewCraet = IntentUtil.boolExtra(this, ConstUtils.intentConst.keyIsNewCreateResultFormat); |
||||
|
||||
if (isNewCraet){ |
||||
setTitle(getString(R.string.new_export_format)); |
||||
}else { |
||||
setTitle(getString(R.string.edit_export_format)); |
||||
} |
||||
binding.tvFormatName.setText(getString(R.string.format_name) + ":"); |
||||
binding.tvFileHeader.setText(getString(R.string.file_header) + ":"); |
||||
binding.tvFileSuffix.setText(getString(R.string.file_suffix) + ":"); |
||||
binding.tvAngleFormat.setText(getString(R.string.angle_formats) + ":"); |
||||
binding.tvDividedSymbols.setText(getString(R.string.divided_symbols) + ":"); |
||||
|
||||
binding.btnConfirm.setOnClickListener(new View.OnClickListener() { |
||||
@Override |
||||
public void onClick(View v) { |
||||
String formatName = binding.etFormatName.getText().toString(); |
||||
if (TextUtils.isEmpty(formatName)){ |
||||
ToastUtils.showShort(getString(R.string.enter_format_name)); |
||||
return; |
||||
} |
||||
|
||||
if (selTab != null && selTab.size() == 0){ |
||||
ToastUtils.showShort(getString(R.string.select_custom_format_description)); |
||||
return; |
||||
} |
||||
|
||||
StringBuilder stringBuilder = new StringBuilder(); |
||||
for (int i = 0; i < selTab.size(); i++) { |
||||
if (i == selTab.size() - 1){ |
||||
stringBuilder.append(selTab.get(i)); |
||||
}else { |
||||
stringBuilder.append(selTab.get(i)).append(binding.sherlockSymbol.getText().toString()); |
||||
} |
||||
} |
||||
|
||||
ThreadPoolUtil.execute(new Runnable() { |
||||
@Override |
||||
public void run() { |
||||
FormatRecord formatRecord = new FormatRecord(); |
||||
formatRecord.id = uid; |
||||
formatRecord.format_name = formatName; |
||||
formatRecord.format_content = stringBuilder.toString(); |
||||
formatRecord.divided_symbols = mItemsDividedSymbolsArrayList.get(indexOfDividedSymbols); |
||||
formatRecord.file_suffix = indexOfSuffix; |
||||
formatRecord.file_header = indexOfFileHeader == 0 ? true : false; |
||||
formatRecord.angle_format = indexOfAngleFormat; |
||||
RecordsFixedDataBase.getInstance().formatRecordDao().save(formatRecord); |
||||
Intent intent = new Intent(); |
||||
intent.putExtra(ConstUtils.intentConst.keyResultFormatRecord, new Gson().toJson(formatRecord)); |
||||
intent.putExtra(ConstUtils.intentConst.keyIsNewCreateResultFormat, isNewCraet); |
||||
setResult(LauncherEvent.launcher_results_export,intent); |
||||
finish(); |
||||
} |
||||
}); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
@Override |
||||
protected void initData() { |
||||
allTagList.add(getString(R.string.point_name)); |
||||
allTagList.add(getString(R.string.point_code)); |
||||
allTagList.add(getString(R.string.latitude)); |
||||
allTagList.add(getString(R.string.longitude)); |
||||
allTagList.add(getString(R.string.altitude)); |
||||
allTagList.add(getString(R.string.antenna_type)); |
||||
allTagList.add(getString(R.string.antenna_height)); |
||||
allTagList.add(getString(R.string.northing)); |
||||
allTagList.add(getString(R.string.easting)); |
||||
allTagList.add(getString(R.string.elevation)); |
||||
allTagList.add(getString(R.string.solution_state)); |
||||
allTagList.add(getString(R.string.satellite_num)); |
||||
allTagList.add(getString(R.string.satellite_track_num)); |
||||
allTagList.add(getString(R.string.pdop)); |
||||
allTagList.add(getString(R.string.hrms)); |
||||
allTagList.add(getString(R.string.vrms)); |
||||
allTagList.add(getString(R.string.diff_delay)); |
||||
allTagList.add(getString(R.string.remark)); |
||||
allTagList.add(getString(R.string.acquisition_time)); |
||||
allTagList.add(getString(R.string.tilt_survey)); |
||||
|
||||
if (isNewCraet){ |
||||
uid = SystemUtils.getUUID(); |
||||
for (int i = 0; i < allTagList.size(); i++) { |
||||
if (i == 0){ |
||||
selTab.add(allTagList.get(i)); |
||||
}else { |
||||
tagTab.add(allTagList.get(i)); |
||||
} |
||||
} |
||||
|
||||
TagFormatData(); |
||||
|
||||
TagFlowData(); |
||||
|
||||
}else { |
||||
uid = IntentUtil.stringExtra(this, ConstUtils.intentConst.keyResultsExportFormatId); |
||||
|
||||
ThreadPoolUtil.execute(new Runnable() { |
||||
@Override |
||||
public void run() { |
||||
FormatRecord formatRecord = RecordsFixedDataBase.getInstance().formatRecordDao().findById(uid); |
||||
ThreadPoolUtil.executeInMain(new Runnable() { |
||||
@Override |
||||
public void run() { |
||||
|
||||
binding.etFormatName.setText(formatRecord.format_name); |
||||
|
||||
String[] split = formatRecord.format_content.split(formatRecord.divided_symbols); |
||||
for (int i = 0; i < split.length; i++) { |
||||
selTab.add(split[i]); |
||||
} |
||||
|
||||
for (int i = 0; i < allTagList.size(); i++) { |
||||
if (!selTab.contains(allTagList.get(i))){ |
||||
tagTab.add(allTagList.get(i)); |
||||
} |
||||
} |
||||
|
||||
if (formatRecord.file_header){ |
||||
indexOfFileHeader = 0; |
||||
}else { |
||||
indexOfFileHeader = 1; |
||||
} |
||||
|
||||
indexOfSuffix = formatRecord.file_suffix; |
||||
|
||||
if (indexOfSuffix == SUFFIX_TXT_NUM || indexOfSuffix == SUFFIX_CSV_NUM){ |
||||
binding.llSherlockSymbol.setVisibility(View.VISIBLE); |
||||
}else { |
||||
binding.llSherlockSymbol.setVisibility(View.GONE); |
||||
} |
||||
|
||||
indexOfAngleFormat = formatRecord.angle_format; |
||||
|
||||
if (formatRecord.divided_symbols.equals(getString(R.string.split_comma))){ |
||||
indexOfDividedSymbols = SYMBOLS_COMMMA; |
||||
}else if (formatRecord.divided_symbols.equals(getString(R.string.split_at))){ |
||||
indexOfDividedSymbols = SYMBOLS_AT; |
||||
}else if (formatRecord.divided_symbols.equals(getString(R.string.split_space))){ |
||||
indexOfDividedSymbols = SYMBOLS_SPACE; |
||||
}else if (formatRecord.divided_symbols.equals(getString(R.string.split_tab))){ |
||||
indexOfDividedSymbols = SYMBOLS_TAB; |
||||
}else if (formatRecord.divided_symbols.equals(getString(R.string.split_enter))){ |
||||
indexOfDividedSymbols = SYMBOLS_ENTER; |
||||
} |
||||
|
||||
TagFormatData(); |
||||
|
||||
TagFlowData(); |
||||
} |
||||
}); |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
|
||||
private void TagFormatData() { |
||||
mItemsFileHeaderArrayList = new ArrayList<>(); |
||||
for (int mItem : mItemsFileHeader) { |
||||
mItemsFileHeaderArrayList.add(getResources().getString(mItem)); |
||||
} |
||||
ArrayAdapter<String> fileHeaderAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, mItemsFileHeaderArrayList); |
||||
binding.sherlockFileHeader.setAdapter(fileHeaderAdapter); |
||||
binding.sherlockFileHeader.setText(mItemsFileHeaderArrayList.get(indexOfFileHeader)); |
||||
binding.sherlockFileHeader.setOnItemClickListener(new AdapterView.OnItemClickListener() { |
||||
@Override |
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) { |
||||
indexOfFileHeader = position; |
||||
binding.sherlockFileHeader.setText(mItemsFileHeaderArrayList.get(indexOfFileHeader)); |
||||
} |
||||
}); |
||||
|
||||
mItemsSuffixArrayList = new ArrayList<>(); |
||||
for (int mItem : mItemsSuffix) { |
||||
mItemsSuffixArrayList.add(getResources().getString(mItem)); |
||||
} |
||||
ArrayAdapter<String> suffixAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, mItemsSuffixArrayList); |
||||
binding.sherlockSuffix.setAdapter(suffixAdapter); |
||||
binding.sherlockSuffix.setText(mItemsSuffixArrayList.get(indexOfSuffix)); |
||||
if (indexOfSuffix == SUFFIX_XLS_NUM){ |
||||
binding.rlFileHeader.setVisibility(View.VISIBLE); |
||||
}else { |
||||
binding.rlFileHeader.setVisibility(View.GONE); |
||||
} |
||||
binding.sherlockSuffix.setOnItemClickListener(new AdapterView.OnItemClickListener() { |
||||
@Override |
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) { |
||||
indexOfSuffix = position; |
||||
binding.sherlockSuffix.setText(mItemsSuffixArrayList.get(indexOfSuffix)); |
||||
if (indexOfSuffix == SUFFIX_TXT_NUM || indexOfSuffix == SUFFIX_CSV_NUM){ |
||||
binding.llSherlockSymbol.setVisibility(View.VISIBLE); |
||||
}else { |
||||
indexOfDividedSymbols = SYMBOLS_COMMMA; |
||||
binding.sherlockSymbol.setText(mItemsDividedSymbolsArrayList.get(indexOfDividedSymbols)); |
||||
binding.llSherlockSymbol.setVisibility(View.GONE); |
||||
} |
||||
|
||||
if (indexOfSuffix == SUFFIX_XLS_NUM){ |
||||
binding.rlFileHeader.setVisibility(View.VISIBLE); |
||||
indexOfFileHeader = 0; |
||||
}else { |
||||
binding.rlFileHeader.setVisibility(View.GONE); |
||||
indexOfFileHeader = 1; |
||||
} |
||||
binding.sherlockFileHeader.setText(mItemsFileHeaderArrayList.get(indexOfFileHeader)); |
||||
} |
||||
}); |
||||
|
||||
mItemsAngleFormatArrayList = new ArrayList<>(); |
||||
for (int mItem : mItemsAngleFormat) { |
||||
mItemsAngleFormatArrayList.add(getResources().getString(mItem)); |
||||
} |
||||
ArrayAdapter<String> angleFormatAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, mItemsAngleFormatArrayList); |
||||
binding.sherlockAngleFormat.setAdapter(angleFormatAdapter); |
||||
binding.sherlockAngleFormat.setText(mItemsAngleFormatArrayList.get(indexOfAngleFormat)); |
||||
binding.sherlockAngleFormat.setOnItemClickListener(new AdapterView.OnItemClickListener() { |
||||
@Override |
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) { |
||||
indexOfAngleFormat = position; |
||||
binding.sherlockAngleFormat.setText(mItemsAngleFormatArrayList.get(indexOfAngleFormat)); |
||||
} |
||||
}); |
||||
|
||||
mItemsDividedSymbolsArrayList = new ArrayList<>(); |
||||
for (int mItem : mItemsDividedSymbols) { |
||||
mItemsDividedSymbolsArrayList.add(getResources().getString(mItem)); |
||||
} |
||||
ArrayAdapter<String> dividedSymbolsAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, mItemsDividedSymbolsArrayList); |
||||
binding.sherlockSymbol.setAdapter(dividedSymbolsAdapter); |
||||
binding.sherlockSymbol.setText(mItemsDividedSymbolsArrayList.get(indexOfDividedSymbols)); |
||||
binding.sherlockSymbol.setOnItemClickListener(new AdapterView.OnItemClickListener() { |
||||
@Override |
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) { |
||||
indexOfDividedSymbols = position; |
||||
binding.sherlockSymbol.setText(mItemsDividedSymbolsArrayList.get(indexOfDividedSymbols)); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
private void TagFlowData() { |
||||
|
||||
selAdapter = new TagAdapter<String>(selTab){ |
||||
@Override |
||||
public View getView(FlowLayout parent, final int position, String s) { |
||||
RelativeLayout view = (RelativeLayout) LayoutInflater.from(AddResultFormatActivity.this).inflate( R.layout.layout_format_flowlayout, binding.flowlayout,false); |
||||
TextView viewById = (TextView) view.findViewById(R.id.tv_name); |
||||
viewById.setText(s); |
||||
ImageView imageView = (ImageView) view.findViewById(R.id.iv_delete); |
||||
imageView.setOnClickListener(new View.OnClickListener() { |
||||
@Override |
||||
public void onClick(View v) { |
||||
tagTab.add(selTab.get(position)); |
||||
tagAdapter.notifyDataChanged(); |
||||
|
||||
selTab.remove(position); |
||||
selAdapter.notifyDataChanged(); |
||||
} |
||||
}); |
||||
return view; |
||||
} |
||||
}; |
||||
binding.flowlayout.setAdapter(selAdapter); |
||||
|
||||
tagAdapter = new TagAdapter<String>(tagTab){ |
||||
@Override |
||||
public View getView(FlowLayout parent, final int position, String s) { |
||||
LinearLayout view = (LinearLayout) LayoutInflater.from(AddResultFormatActivity.this).inflate( R.layout.layout_format_flowlayout_tag, binding.tagFlowlayout,false); |
||||
TextView viewById = (TextView) view.findViewById(R.id.tv_name); |
||||
viewById.setText(s); |
||||
//如果点击就添加元素并刷新adapter
|
||||
view.setOnClickListener(new View.OnClickListener() { |
||||
@Override |
||||
public void onClick(View v) { |
||||
//将新加入的数据加到集合的最后一个位置,而原来的添加图标会到 +1 的位置
|
||||
selTab.add(tagTab.get(position)); |
||||
selAdapter.notifyDataChanged(); |
||||
|
||||
tagTab.remove(position); |
||||
tagAdapter.notifyDataChanged(); |
||||
} |
||||
}); |
||||
return view ; |
||||
} |
||||
}; |
||||
binding.tagFlowlayout.setAdapter(tagAdapter); |
||||
} |
||||
|
||||
|
||||
public static void start(ActivityResultLauncher<Intent> launcher, Context context, boolean isNewCraet){ |
||||
start(launcher,context,isNewCraet,""); |
||||
} |
||||
|
||||
public static void start(ActivityResultLauncher<Intent> launcher,Context context, boolean isNewCraet, String uid) { |
||||
Intent intent = new Intent(context,AddResultFormatActivity.class); |
||||
intent.putExtra(ConstUtils.intentConst.keyIsNewCreateResultFormat,isNewCraet); |
||||
intent.putExtra(ConstUtils.intentConst.keyResultsExportFormatId,uid); |
||||
launcher.launch(intent); |
||||
} |
||||
} |
@ -0,0 +1,49 @@ |
||||
package com.project.survey.ui.instrument.setupstation; |
||||
|
||||
import com.bingce.BaseApp; |
||||
import com.bingce.coordlib.model.Blh; |
||||
import com.bingce.rtk.model.GnssPosition; |
||||
import com.bingce.utils.Util; |
||||
import com.project.survey.util.CommonUtils; |
||||
|
||||
import net.tatans.tensorflowtts.tts.TtsManager; |
||||
|
||||
import blankj.utilcode.util.Utils; |
||||
import cn.leancloud.types.LCGeoPoint; |
||||
import cn.liuyanbing.surveyor.model.util.CUtil; |
||||
|
||||
public class BingCeBaseSurveyPresenter { |
||||
public static void hideSoftKey() { |
||||
CommonUtils.hideSoftInput(); |
||||
} |
||||
|
||||
public static void speak(String string) { |
||||
TtsManager.getInstance().speak(string); |
||||
} |
||||
|
||||
public static void updateLastRTKLocation() { |
||||
if (((BaseApp) Utils.getApp()).avGeoPoint == null && GnssPosition.getInstance().validate) { |
||||
Blh blh = GnssPosition.getInstance().getWgs84Blh(); |
||||
if (!CUtil.isEqual(blh.getLatitude(), 0) && !CUtil.isEqual(blh.getLongitude(), 0)) { |
||||
((BaseApp) Utils.getApp()).avGeoPoint = new LCGeoPoint(blh.getLatitude(), blh.getLongitude()); |
||||
((BaseApp) Utils.getApp()).lastRTKLocation = ((BaseApp) Utils.getApp()).avGeoPoint.getLatitude() + "," + ((BaseApp) Utils.getApp()).avGeoPoint.getLongitude(); |
||||
Util.putPreference("lastRTKLocation", ((BaseApp) Utils.getApp()).lastRTKLocation); |
||||
} |
||||
} |
||||
} |
||||
|
||||
public static boolean checkRegister() { |
||||
return true; |
||||
} |
||||
|
||||
|
||||
public static int volumeUpAction() { |
||||
// return ((App) Utils.getApp()).volumeUpAction;
|
||||
return 0; |
||||
} |
||||
|
||||
public static int volumeDownAction() { |
||||
// return ((App) Utils.getApp()).volumeDownAction;
|
||||
return 0; |
||||
} |
||||
} |
@ -0,0 +1,181 @@ |
||||
package com.project.survey.ui.instrument.setupstation |
||||
|
||||
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.ThreadPoolUtil |
||||
import com.bingce.utils.Util |
||||
import com.project.survey.databinding.ItemCoordinatePointLibraryBinding |
||||
import com.project.survey.databinding.ItemCoordinatePointNameLibraryBinding |
||||
|
||||
class CoordinatePointLibraryAdapter( |
||||
diffCallback: DiffUtil.ItemCallback<PointRecord>, |
||||
val context: Context, |
||||
private val onlyPointName: Boolean |
||||
) : PagingDataAdapter<PointRecord, CoordinatePointLibraryAdapter.BaseVH>(diffCallback) { |
||||
private var mSelItemPos = mutableSetOf<Int>() |
||||
fun toggleSelItemPos(pos: Int) { |
||||
if (mSelItemPos.contains(pos)) { |
||||
mSelItemPos.remove(pos) |
||||
} else { |
||||
mSelItemPos.add(pos) |
||||
} |
||||
notifyDataSetChanged() |
||||
} |
||||
|
||||
fun selAll() { |
||||
mSelItemPos.addAll((0 until itemCount)) |
||||
notifyDataSetChanged() |
||||
} |
||||
|
||||
fun getSelItemPos(): List<Int> { |
||||
return mSelItemPos.toList() |
||||
} |
||||
|
||||
fun resetConfig() { |
||||
mSelItemPos.clear() |
||||
} |
||||
|
||||
fun getSelItem(): MutableList<PointRecord>? { |
||||
if (mSelItemPos.size == 0) return null |
||||
val list = mutableListOf<PointRecord>() |
||||
mSelItemPos.forEach { getItem(it)?.let { it1 -> list.add(it1) } } |
||||
return list |
||||
} |
||||
|
||||
fun resetSelPos() { |
||||
mSelItemPos.clear() |
||||
} |
||||
|
||||
fun clear() { |
||||
val list = ArrayList<PointRecord>() |
||||
ThreadPoolUtil.execute { |
||||
(0 until itemCount).forEach { |
||||
getItem(it)?.let { it1 -> list.add(it1) } |
||||
} |
||||
mSelItemPos.clear() |
||||
PointDb.getInstance().delete(list) |
||||
} |
||||
} |
||||
|
||||
fun clear(pointRecords: List<PointRecord>) { |
||||
mSelItemPos.clear() |
||||
PointDb.getInstance().delete(pointRecords) |
||||
} |
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BaseVH { |
||||
return if (onlyPointName) { |
||||
VH2( |
||||
ItemCoordinatePointNameLibraryBinding.inflate( |
||||
LayoutInflater.from(context), |
||||
parent, |
||||
false |
||||
) |
||||
) |
||||
} else { |
||||
VH( |
||||
ItemCoordinatePointLibraryBinding.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: ItemCoordinatePointNameLibraryBinding) : BaseVH(vb.root) { |
||||
override fun update(pointRecord: PointRecord) { |
||||
vb.tvName.text = pointRecord.name |
||||
if (mSelItemPos.contains(absoluteAdapterPosition)) { |
||||
vb.root.setBackgroundColor(Color.rgb(226, 236, 215)) |
||||
vb.checkBox.isChecked = true |
||||
} else { |
||||
vb.root.background = null |
||||
vb.checkBox.isChecked = false |
||||
} |
||||
// vb.checkBox.setOnCheckedChangeListener{_,isChecked-> |
||||
// if (isChecked){ |
||||
// mSelItemPos.add(absoluteAdapterPosition) |
||||
// }else{ |
||||
// mSelItemPos.remove(absoluteAdapterPosition) |
||||
// } |
||||
// notifyItemChanged(absoluteAdapterPosition) |
||||
// } |
||||
} |
||||
|
||||
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: ItemCoordinatePointLibraryBinding) : 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.tvLatitude.text = |
||||
Util.radianToDmsDoubleString(Math.toRadians(pointRecord.latitude), 6, false) |
||||
vb.tvLongitude.text = |
||||
Util.radianToDmsDoubleString(Math.toRadians(pointRecord.longitude), 6, false) |
||||
vb.tvEarthH.text = Util.formatDouble2String(pointRecord.altitude, 4) |
||||
vb.tvTime.text = DateUtils.toFull(pointRecord.createDate) |
||||
if (mSelItemPos.contains(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,502 @@ |
||||
package com.project.survey.ui.instrument.setupstation; |
||||
|
||||
import android.content.Context; |
||||
import android.content.Intent; |
||||
import android.os.Handler; |
||||
import android.text.Editable; |
||||
import android.view.View; |
||||
|
||||
import androidx.activity.result.ActivityResultLauncher; |
||||
import androidx.activity.result.contract.ActivityResultContracts; |
||||
import androidx.annotation.NonNull; |
||||
import androidx.fragment.app.FragmentActivity; |
||||
import androidx.lifecycle.LiveData; |
||||
import androidx.paging.Pager; |
||||
import androidx.paging.PagingConfig; |
||||
import androidx.paging.PagingData; |
||||
import androidx.paging.PagingDataTransforms; |
||||
import androidx.paging.PagingLiveData; |
||||
import androidx.paging.PagingSource; |
||||
import androidx.recyclerview.widget.RecyclerView; |
||||
|
||||
import com.bingce.data.cache.CachedCurrentJob; |
||||
import com.bingce.data.cache.CachedProject; |
||||
import com.bingce.data.database.DBQueryConstant; |
||||
import com.bingce.data.database.JobDb; |
||||
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.surveydata.pointsurvey.PointRecord; |
||||
import com.bingce.error.BingCeErrorCode; |
||||
import com.bingce.ui.BcDialogExt; |
||||
import com.bingce.utils.ActivityUtils; |
||||
import com.bingce.utils.SimpleTextWatcher; |
||||
import com.bingce.utils.ThreadPoolUtil; |
||||
import com.bingce.viewmodel.AbstractCoordinatePointsLibraryViewModelKt; |
||||
import com.project.survey.App; |
||||
import com.project.survey.R; |
||||
import com.project.survey.databinding.ActivityCoordinatePointsLibraryBinding; |
||||
import com.project.survey.dialog.BubblePopWindow; |
||||
import com.project.survey.ui.base.BaseSurveyNewActivity; |
||||
|
||||
import java.util.Arrays; |
||||
import java.util.List; |
||||
|
||||
import blankj.utilcode.util.ToastUtils; |
||||
import blankj.utilcode.util.Utils; |
||||
|
||||
import kotlinx.coroutines.Dispatchers; |
||||
import kotlinx.coroutines.ExecutorsKt; |
||||
|
||||
public class CoordinatePointsLibraryActivity extends BaseSurveyNewActivity { |
||||
|
||||
private ActivityCoordinatePointsLibraryBinding binding; |
||||
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 final CoordinatePointLibraryAdapter coordinatePointLibraryAdapter = new CoordinatePointLibraryAdapter(new PointRecordDiffCallback2(), this, false); |
||||
private final CoordinatePointLibraryAdapter coordinatePointNameLibraryAdapter = new CoordinatePointLibraryAdapter(new PointRecordDiffCallback2(), this, true); |
||||
|
||||
private String jobId; |
||||
private AbstractCoordinatePointsLibraryViewModelKt.FilterParameter filterParameter = new AbstractCoordinatePointsLibraryViewModelKt.FilterParameter(); |
||||
private Pager<Integer, PointRecord> pager = new Pager<>( |
||||
new PagingConfig(100), |
||||
this::dataSourse); |
||||
|
||||
private PagingSource<Integer, PointRecord> dataSourse() { |
||||
return PointDb.getInstance().rawQueryPagingSource(CoordinatePointsLibraryActivitySQLiteUtils.searchSQLit( |
||||
jobId, |
||||
filterParameter, binding.etEnterNameCode.getText().toString().trim() |
||||
)); |
||||
} |
||||
private List<PointRecord> getAllPoint(){ |
||||
return PointDb.getInstance().rawQueryListData(CoordinatePointsLibraryActivitySQLiteUtils.searchSQLit( |
||||
jobId, |
||||
filterParameter, binding.etEnterNameCode.getText().toString().trim() |
||||
)); |
||||
} |
||||
|
||||
private LiveData<PagingData<PointRecord>> pagingDataLiveData; |
||||
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(CoordinatePointsLibraryActivity.this); |
||||
pagingDataLiveData = PagingLiveData.cachedIn(PagingLiveData.getLiveData(pager), getLifecycle()); |
||||
pagingDataLiveData.observe(CoordinatePointsLibraryActivity.this, downloadRecordPagingData -> { |
||||
refreshAdapter(downloadRecordPagingData); |
||||
}); |
||||
|
||||
}); |
||||
}); |
||||
} |
||||
}); |
||||
|
||||
private void refreshAdapter(PagingData<PointRecord> downloadRecordPagingData) { |
||||
coordinatePointLibraryAdapter.submitData(getLifecycle(), downloadRecordPagingData); |
||||
coordinatePointNameLibraryAdapter.submitData(getLifecycle(), downloadRecordPagingData); |
||||
coordinatePointLibraryAdapter.resetConfig(); |
||||
coordinatePointNameLibraryAdapter.resetConfig(); |
||||
coordinatePointLibraryAdapter.notifyDataSetChanged(); |
||||
coordinatePointNameLibraryAdapter.notifyDataSetChanged(); |
||||
new Handler().postDelayed(() -> binding.tvPointNumber.setText(coordinatePointLibraryAdapter.getItemCount() + ""), 500); |
||||
} |
||||
|
||||
private void resetSelPos() { |
||||
coordinatePointLibraryAdapter.resetSelPos(); |
||||
coordinatePointNameLibraryAdapter.resetSelPos(); |
||||
} |
||||
|
||||
@Override |
||||
public View getContentView() { |
||||
binding = ActivityCoordinatePointsLibraryBinding.inflate(getLayoutInflater()); |
||||
return binding.getRoot(); |
||||
} |
||||
|
||||
@Override |
||||
protected void initView() { |
||||
setTitle(getString(R.string.point_survey_point_library)); |
||||
|
||||
if (((App) Utils.getApp()).isThemeDark) { |
||||
binding.topLayout.setBackgroundColor(getColor(R.color.theme_dark_black)); |
||||
} |
||||
|
||||
binding.bodyRv.setAdapter(coordinatePointLibraryAdapter); |
||||
binding.bodyNameRv.setAdapter(coordinatePointNameLibraryAdapter); |
||||
binding.bodyHsv.setScrollView(binding.headerHsv); |
||||
binding.headerHsv.setScrollView(binding.bodyHsv); |
||||
|
||||
binding.tvLatitude.setText(getString(R.string.latitude) + "(dd.mmss)"); |
||||
binding.tvLongitude.setText(getString(R.string.longitude) + "(dd.mmss)"); |
||||
|
||||
binding.bodyRv.addOnScrollListener(rightScrollListener); |
||||
|
||||
binding.bodyNameRv.addOnScrollListener(leftScrollListener); |
||||
binding.bodyRv.addOnItemTouchListener(new SimpleRecyclerViewItemClickListener(binding.bodyRv, (view, position) -> { |
||||
coordinatePointLibraryAdapter.toggleSelItemPos(position); |
||||
coordinatePointNameLibraryAdapter.toggleSelItemPos(position); |
||||
})); |
||||
binding.bodyNameRv.addOnItemTouchListener(new SimpleRecyclerViewItemClickListener(binding.bodyNameRv, (view, position) -> { |
||||
coordinatePointLibraryAdapter.toggleSelItemPos(position); |
||||
coordinatePointNameLibraryAdapter.toggleSelItemPos(position); |
||||
})); |
||||
binding.tvSelAll.setOnClickListener(v -> { |
||||
if (coordinatePointLibraryAdapter.getItemCount() == coordinatePointLibraryAdapter.getSelItemPos().size()) { |
||||
coordinatePointLibraryAdapter.resetSelPos(); |
||||
coordinatePointNameLibraryAdapter.resetSelPos(); |
||||
coordinatePointLibraryAdapter.notifyDataSetChanged(); |
||||
coordinatePointNameLibraryAdapter.notifyDataSetChanged(); |
||||
}else { |
||||
coordinatePointLibraryAdapter.resetSelPos(); |
||||
coordinatePointNameLibraryAdapter.resetSelPos(); |
||||
coordinatePointLibraryAdapter.selAll(); |
||||
coordinatePointNameLibraryAdapter.selAll(); |
||||
coordinatePointLibraryAdapter.notifyDataSetChanged(); |
||||
coordinatePointNameLibraryAdapter.notifyDataSetChanged(); |
||||
} |
||||
}); |
||||
|
||||
ThreadPoolUtil.execute(() -> { |
||||
String projectId = CachedProject.currentProjectId(); |
||||
jobId = CachedCurrentJob.currentJobId(projectId); |
||||
ThreadPoolUtil.executeInMain(() -> { |
||||
pagingDataLiveData = PagingLiveData.cachedIn(PagingLiveData.getLiveData(pager), getLifecycle()); |
||||
pagingDataLiveData |
||||
.observe(this, downloadRecordPagingData -> { |
||||
PagingDataTransforms.map(downloadRecordPagingData, ExecutorsKt.asExecutor(Dispatchers.getIO()), item -> { |
||||
return item; |
||||
}); |
||||
refreshAdapter(downloadRecordPagingData); |
||||
}); |
||||
|
||||
}); |
||||
}); |
||||
|
||||
binding.etEnterNameCode.addTextChangedListener(new SimpleTextWatcher() { |
||||
@Override |
||||
public void afterTextChanged(Editable s) { |
||||
filterHandler.onFilterStringChanged(s.toString()); |
||||
} |
||||
}); |
||||
|
||||
binding.pointsLibraryBtnFilter.setOnClickListener(v -> { |
||||
PointFilterActivity.startFilter(CoordinatePointsLibraryActivity.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.pointsLibraryBtnEdit.setOnClickListener(v -> { |
||||
List<PointRecord> selItem = coordinatePointNameLibraryAdapter.getSelItem(); |
||||
if (selItem == null || selItem.size() != 1) { |
||||
ToastUtils.showShort(R.string.please_select_one_data_item); |
||||
return; |
||||
} |
||||
EditCoordinatePointActivity.start(launcher, CoordinatePointsLibraryActivity.this, selItem.get(0).id); |
||||
}); |
||||
|
||||
binding.pointsLibraryBtnDelete.setOnClickListener(v -> { |
||||
List<PointRecord> selItem = coordinatePointLibraryAdapter.getSelItem(); |
||||
if (selItem == null || selItem.size() == 0) { |
||||
ToastUtils.showShort(R.string.please_select_one_data_item); |
||||
return; |
||||
} |
||||
BcDialogExt.create().showMessage(getString(R.string.warning),"确定要删除选择的点吗?", |
||||
getString(R.string.confirm), getString(R.string.cancel), (baseDialog, view) -> { |
||||
ThreadPoolUtil.execute(() -> { |
||||
PointDb.getInstance().delete(selItem); |
||||
resetSelPos(); |
||||
}); |
||||
return false; |
||||
}, (baseDialog, view) -> false); |
||||
|
||||
}); |
||||
|
||||
binding.pointsLibraryBtnExport.setOnClickListener(v -> { |
||||
ResultsTheExportActivity.start(CoordinatePointsLibraryActivity.this, "导出", false, |
||||
filterParameter.getNameKey(), |
||||
filterParameter.getCodeKey(), |
||||
filterParameter.getRemarkKey(), |
||||
filterParameter.getDateStart(), |
||||
filterParameter.getDateEnd()); |
||||
}); |
||||
|
||||
binding.pointsLibraryBtnConfirm.setOnClickListener(new View.OnClickListener() { |
||||
@Override |
||||
public void onClick(View v) { |
||||
List<PointRecord> selItem = coordinatePointLibraryAdapter.getSelItem(); |
||||
if (selItem == null || selItem.size() != 1) { |
||||
ToastUtils.showShort(R.string.please_select_one_data_item); |
||||
return; |
||||
} |
||||
PointRecord pointRecord = selItem.get(0); |
||||
|
||||
// 数据是使用Intent返回
|
||||
Intent intent = new Intent(); |
||||
// 把返回数据存入Intent
|
||||
intent.putExtra(RESULT_ID, pointRecord.id); |
||||
intent.putExtra(RESULT_NAME, pointRecord.name); |
||||
intent.putExtra(RESULT_CODE, pointRecord.code); |
||||
intent.putExtra(RESULT_X, pointRecord.x); |
||||
intent.putExtra(RESULT_Y, pointRecord.y); |
||||
intent.putExtra(RESULT_Z, pointRecord.h); |
||||
intent.putExtra(RESULT_B, pointRecord.latitude); |
||||
intent.putExtra(RESULT_L, pointRecord.longitude); |
||||
intent.putExtra(RESULT_H, pointRecord.altitude); |
||||
// 设置返回数据
|
||||
setResult(RESULT_OK, intent); |
||||
// 关闭Activity
|
||||
finish(); |
||||
} |
||||
}); |
||||
|
||||
boolean isSelect = getIntent().getBooleanExtra(KEY_IS_PICK,false); |
||||
|
||||
if (isSelect) { |
||||
binding.pointsLibraryBtnConfirm.setVisibility(View.VISIBLE); |
||||
binding.pointsLibraryBtnEdit.setVisibility(View.GONE); |
||||
binding.pointsLibraryBtnDelete.setVisibility(View.GONE); |
||||
binding.pointsLibraryBtnExport.setVisibility(View.GONE); |
||||
} else { |
||||
binding.pointsLibraryBtnConfirm.setVisibility(View.GONE); |
||||
binding.pointsLibraryBtnEdit.setVisibility(View.VISIBLE); |
||||
binding.pointsLibraryBtnDelete.setVisibility(View.VISIBLE); |
||||
binding.pointsLibraryBtnExport.setVisibility(View.VISIBLE); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
protected void initData() { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public BubblePopWindow newBubblePopWindow(Context context) { |
||||
return new BubblePopWindow(this, Arrays.asList(new BubblePopWindow.CustomMenuItem(R.drawable.icon_function_delete, getString(R.string.batch_delete), () -> { |
||||
List<PointRecord> selItemPos = coordinatePointLibraryAdapter.getSelItem(); |
||||
if (selItemPos != null && selItemPos.size() > 0) { |
||||
BcDialogExt.create().showMessageWithTick(getString(R.string.warning), getString(R.string.want_to_batch_delete_points), getString(R.string.confirm), getString(R.string.cancel), (baseDialog, view) -> { |
||||
ThreadPoolUtil.execute(() -> { |
||||
PointDb.getInstance().delete(selItemPos); |
||||
resetSelPos(); |
||||
}); |
||||
return false; |
||||
}, (baseDialog, view) -> false); |
||||
} else { |
||||
ToastUtils.showShort(getString(R.string.select_batch_delete_data)); |
||||
} |
||||
}))); |
||||
} |
||||
|
||||
@Override |
||||
public boolean isHideHelpDoc() { |
||||
return true; |
||||
} |
||||
|
||||
public final static String KEY_JOB_ID = "JOBID"; |
||||
final static String FORCE_SURVEY_POINT_LIBRARY = "should survey point library"; |
||||
|
||||
public static void start4Result(ActivityResultLauncher<Intent> launcher, Context context, String jobId) { |
||||
Intent intent = new Intent(context, CoordinatePointsLibraryActivity.class); |
||||
intent.putExtra(KEY_JOB_ID, jobId); |
||||
intent.putExtra(KEY_IS_PICK, false); |
||||
launcher.launch(intent); |
||||
} |
||||
|
||||
public static void start(Context context, String jobId) { |
||||
Intent intent = new Intent(context, CoordinatePointsLibraryActivity.class); |
||||
intent.putExtra(KEY_JOB_ID, jobId); |
||||
intent.putExtra(KEY_IS_PICK, false); |
||||
context.startActivity(intent); |
||||
} |
||||
|
||||
public final ActivityResultLauncher<Intent> launcher = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), result -> { |
||||
if (result != null) { |
||||
if (result.getResultCode() == LauncherEvent.launcher_update_point_library) { |
||||
// holderInActivity.getViewModel().refreshCurrentPage();
|
||||
} |
||||
} |
||||
}); |
||||
public static void start(FragmentActivity fragmentActivity) { |
||||
ThreadPoolUtil.execute(() -> { |
||||
String projectId = CachedProject.currentProjectId(); |
||||
String jobId = CachedCurrentJob.currentJobId(projectId); |
||||
JobRecord jobRecord = JobDb.getInstance() |
||||
.rawQueryData(DBQueryConstant.findById(JobConstants.DB_NAME, jobId)); |
||||
if (jobRecord == null) { |
||||
BingCeErrorCode.toast(BingCeErrorCode.NO_CURRENT_JOB); |
||||
return; |
||||
} |
||||
Intent intent = new Intent(fragmentActivity, CoordinatePointsLibraryActivity.class); |
||||
intent.putExtra(KEY_JOB_ID, jobId); |
||||
fragmentActivity.startActivity(intent); |
||||
}); |
||||
} |
||||
private static final String RESULT_ID = "id"; |
||||
private static final String RESULT_NAME = "name"; |
||||
private static final String RESULT_CODE = "code"; |
||||
private static final String RESULT_X = "x"; |
||||
private static final String RESULT_Y = "y"; |
||||
private static final String RESULT_Z = "z"; |
||||
private static final String RESULT_B = "b"; |
||||
private static final String RESULT_L = "l"; |
||||
private static final String RESULT_H = "h"; |
||||
|
||||
private static final String KEY_IS_PICK = "is pick"; |
||||
|
||||
public static void pickPoint(@NonNull FragmentActivity fragmentActivity, @NonNull ICallback callback) { |
||||
ThreadPoolUtil.execute(() -> { |
||||
String projectId = CachedProject.currentProjectId(); |
||||
String jobId = CachedCurrentJob.currentJobId(projectId); |
||||
JobRecord jobRecord = JobDb.getInstance() |
||||
.rawQueryData(DBQueryConstant.findById(JobConstants.DB_NAME, jobId)); |
||||
if (jobRecord == null) { |
||||
BingCeErrorCode.toast(BingCeErrorCode.NO_CURRENT_JOB); |
||||
return; |
||||
} |
||||
Intent intent = new Intent(fragmentActivity, CoordinatePointsLibraryActivity.class); |
||||
intent.putExtra(KEY_IS_PICK, true); |
||||
intent.putExtra(KEY_JOB_ID, jobId); |
||||
fragmentActivity.runOnUiThread(() -> { |
||||
ActivityUtils.startActivityForResults(fragmentActivity, intent, result -> { |
||||
if (result == null) { |
||||
return; |
||||
} |
||||
if (result.getResultCode() != RESULT_OK) { |
||||
return; |
||||
} |
||||
Intent data = result.getData(); |
||||
if (data == null) { |
||||
return; |
||||
} |
||||
callback.onPicked( |
||||
data.getStringExtra(RESULT_NAME), |
||||
data.getStringExtra(RESULT_CODE), |
||||
data.getDoubleExtra(RESULT_X, 0), |
||||
data.getDoubleExtra(RESULT_Y, 0), |
||||
data.getDoubleExtra(RESULT_Z, 0), |
||||
data.getDoubleExtra(RESULT_B, 0), |
||||
data.getDoubleExtra(RESULT_L, 0), |
||||
data.getDoubleExtra(RESULT_H, 0)); |
||||
}); |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
public interface ICallback { |
||||
void onPicked(String name, String code, |
||||
double x, double y, double z, |
||||
double b, double l, double h); |
||||
} |
||||
|
||||
public static void pickPoint(@NonNull FragmentActivity fragmentActivity, @NonNull ICallback2 callback) { |
||||
ThreadPoolUtil.execute(() -> { |
||||
String projectId = CachedProject.currentProjectId(); |
||||
String jobId = CachedCurrentJob.currentJobId(projectId); |
||||
JobRecord jobRecord = JobDb.getInstance() |
||||
.rawQueryData(DBQueryConstant.findById(JobConstants.DB_NAME, jobId)); |
||||
if (jobRecord == null) { |
||||
BingCeErrorCode.toast(BingCeErrorCode.NO_CURRENT_JOB); |
||||
return; |
||||
} |
||||
Intent intent = new Intent(fragmentActivity, CoordinatePointsLibraryActivity.class); |
||||
intent.putExtra(KEY_IS_PICK, true); |
||||
intent.putExtra(KEY_JOB_ID, jobId); |
||||
fragmentActivity.runOnUiThread(() -> { |
||||
ActivityUtils.startActivityForResults(fragmentActivity, intent, result -> { |
||||
if (result == null) { |
||||
return; |
||||
} |
||||
if (result.getResultCode() != RESULT_OK) { |
||||
return; |
||||
} |
||||
Intent data = result.getData(); |
||||
if (data == null) { |
||||
return; |
||||
} |
||||
callback.onPicked( |
||||
data.getStringExtra(RESULT_ID), |
||||
data.getStringExtra(RESULT_NAME), |
||||
data.getStringExtra(RESULT_CODE), |
||||
data.getDoubleExtra(RESULT_X, 0), |
||||
data.getDoubleExtra(RESULT_Y, 0), |
||||
data.getDoubleExtra(RESULT_Z, 0), |
||||
data.getDoubleExtra(RESULT_B, 0), |
||||
data.getDoubleExtra(RESULT_L, 0), |
||||
data.getDoubleExtra(RESULT_H, 0)); |
||||
}); |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
|
||||
public interface ICallback2 { |
||||
void onPicked(String pointId, String name, String code, |
||||
double x, double y, double z, |
||||
double b, double l, double h); |
||||
} |
||||
|
||||
@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,88 @@ |
||||
package com.project.survey.ui.instrument.setupstation; |
||||
|
||||
import static com.bingce.data.database.DBQueryConstant.NOT_DELETED; |
||||
import static com.bingce.data.database.DBQueryConstant.WHERE; |
||||
import static com.bingce.data.surveyor.surveydata.pointsurvey.PointConstants.surveyorPoint; |
||||
|
||||
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 CoordinatePointsLibraryActivitySQLiteUtils { |
||||
@NonNull |
||||
static SimpleSQLiteQuery getSimpleSQLiteQuery(FilterParameter parameter, StringBuilder stringBuilder, String jobId, int pageIndex, int pageSize, String nameOrCodeStr) { |
||||
if (parameter == null) { |
||||
return new SimpleSQLiteQuery(stringBuilder.toString()); |
||||
} |
||||
stringBuilder.append(WHERE).append(NOT_DELETED); |
||||
boolean filtered = RoomFilterBuilder.appendEqualsFilter(true, stringBuilder, BingCeDbConstant.DB_KEY_JOB_ID, jobId); |
||||
filtered = surveyorPoint(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); |
||||
} |
||||
|
||||
// if (pageIndex < 0 || pageSize < 0) {
|
||||
RoomFilterBuilder.appendDateOrder(stringBuilder, BingCeDbConstant.DB_KEY_CREATED_DATE, false); |
||||
// } else {
|
||||
// if (pageIndex == 0) {
|
||||
// RoomFilterBuilder.appendDateOrderAndNumLimit(stringBuilder, BingCeDbConstant.DB_KEY_CREATED_DATE, pageSize, false);
|
||||
// } else {
|
||||
// RoomFilterBuilder.appendDateOrderAndNumLimitOffset(stringBuilder, BingCeDbConstant.DB_KEY_CREATED_DATE,
|
||||
// pageSize, pageSize * pageIndex, false);
|
||||
// }
|
||||
// }
|
||||
|
||||
return new SimpleSQLiteQuery(stringBuilder.toString()); |
||||
} |
||||
|
||||
|
||||
static SupportSQLiteQuery countSQLit(String jobId, FilterParameter parameter) { |
||||
StringBuilder stringBuilder = new StringBuilder(DBQueryConstant.COUNT_FROM) |
||||
.append(PointConstants.DB_NAME); |
||||
return getSimpleSQLiteQuery(parameter, stringBuilder, jobId, -1, -1,null); |
||||
} |
||||
|
||||
static SupportSQLiteQuery searchSQLit(String jobId, FilterParameter parameter, int pageIndex, int pageSize) { |
||||
StringBuilder stringBuilder = new StringBuilder(DBQueryConstant.SELECT_FROM) |
||||
.append(PointConstants.DB_NAME); |
||||
return getSimpleSQLiteQuery(parameter, stringBuilder, jobId, pageIndex, pageSize,null); |
||||
} |
||||
public static SupportSQLiteQuery searchSQLit(String jobId, FilterParameter parameter, String nameOrCode){ |
||||
StringBuilder stringBuilder = new StringBuilder(DBQueryConstant.SELECT_FROM) |
||||
.append(PointConstants.DB_NAME); |
||||
return getSimpleSQLiteQuery(parameter, stringBuilder, jobId, -1, -1,nameOrCode); |
||||
} |
||||
} |
@ -0,0 +1,153 @@ |
||||
package com.project.survey.ui.instrument.setupstation; |
||||
|
||||
|
||||
import static com.project.survey.ui.instrument.setupstation.LauncherEvent.launcher_update_point_library; |
||||
|
||||
import android.content.Context; |
||||
import android.content.Intent; |
||||
import android.text.TextUtils; |
||||
import android.view.View; |
||||
|
||||
import androidx.activity.result.ActivityResultLauncher; |
||||
|
||||
import com.bingce.data.DeprecatedDeviceData; |
||||
import com.bingce.data.DeviceInfoData; |
||||
import com.bingce.data.DeviceInfoDataUtils; |
||||
import com.bingce.data.RTKStatusData; |
||||
import com.bingce.data.TSStatusData; |
||||
import com.bingce.data.database.DBQueryConstant; |
||||
import com.bingce.data.database.JobDb; |
||||
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.surveydata.pointsurvey.PointConstants; |
||||
import com.bingce.data.surveyor.surveydata.pointsurvey.PointRecord; |
||||
import com.bingce.utils.DateUtils; |
||||
import com.bingce.utils.IntentUtil; |
||||
import com.bingce.utils.StringUtil; |
||||
import com.bingce.utils.ThreadPoolUtil; |
||||
import com.bingce.utils.Util; |
||||
import com.project.survey.R; |
||||
import com.project.survey.databinding.ActivityEditCoordinatePointBinding; |
||||
import com.project.survey.ui.base.BaseSurveyNewActivity; |
||||
|
||||
import blankj.utilcode.util.ToastUtils; |
||||
|
||||
public class EditCoordinatePointActivity extends BaseSurveyNewActivity { |
||||
|
||||
private ActivityEditCoordinatePointBinding binding; |
||||
private PointRecord pointRecord; |
||||
private double recordHigh, recordAltitude, recordHr; |
||||
|
||||
@Override |
||||
public View getContentView() { |
||||
binding = ActivityEditCoordinatePointBinding.inflate(getLayoutInflater()); |
||||
return binding.getRoot(); |
||||
} |
||||
|
||||
@Override |
||||
protected void initView() { |
||||
|
||||
binding.editCoordinatePointBtnConfirm.setOnClickListener(v -> { |
||||
|
||||
if (pointRecord != null) { |
||||
if (TextUtils.isEmpty(binding.etPointName.getText().toString())) { |
||||
ToastUtils.showShort("请输入点名"); |
||||
return; |
||||
} |
||||
if (TextUtils.isEmpty(binding.etAntennaHeight.getText().toString())) { |
||||
ToastUtils.showShort(getString(R.string.enter_pole_height)); |
||||
return; |
||||
} |
||||
pointRecord.name = binding.etPointName.getText().toString(); |
||||
pointRecord.code = binding.etCode.getText().toString(); |
||||
pointRecord.remarks = binding.etRemark.getText().toString(); |
||||
|
||||
String inputHrString = binding.etAntennaHeight.getText().toString(); |
||||
double inputHrDouble = Double.parseDouble(inputHrString); |
||||
|
||||
if (pointRecord.deviceInfoData.tsStatusData != null) { |
||||
TSStatusData pointRecordTSInfo = pointRecord.deviceInfoData.tsStatusData; |
||||
TSStatusData tsStatusData = new TSStatusData(pointRecordTSInfo.deviceType, pointRecordTSInfo.x, pointRecordTSInfo.y, pointRecordTSInfo.z, inputHrDouble, pointRecordTSInfo.setupStationMethod, pointRecordTSInfo.stationName, pointRecordTSInfo.stationX, pointRecordTSInfo.stationY, pointRecordTSInfo.stationZ, pointRecordTSInfo.hi, pointRecordTSInfo.ha, pointRecordTSInfo.va, pointRecordTSInfo.sd, pointRecordTSInfo.angleDifference, pointRecordTSInfo.powerLevel, pointRecordTSInfo.backSightPoints, pointRecordTSInfo.checkPoints, pointRecordTSInfo.deviceModel, pointRecordTSInfo.deviceSn); |
||||
DeviceInfoData deviceInfoData = new DeviceInfoData(tsStatusData); |
||||
pointRecord.deviceInfoData = deviceInfoData; |
||||
} |
||||
if (pointRecord.deviceInfoData.rtkStatusData != null) { |
||||
RTKStatusData pointRecordRTKInfo = pointRecord.deviceInfoData.rtkStatusData; |
||||
RTKStatusData rtkStatusData = new RTKStatusData(pointRecordRTKInfo.deviceType, pointRecordRTKInfo.workMode, pointRecordRTKInfo.posType, pointRecordRTKInfo.solutionState, pointRecordRTKInfo.latitude, pointRecordRTKInfo.longitude, pointRecordRTKInfo.altitude, pointRecordRTKInfo.x, pointRecordRTKInfo.y, pointRecordRTKInfo.z, pointRecordRTKInfo.isTiltOpen, pointRecordRTKInfo.isTiltEnable, pointRecordRTKInfo.diffAge, pointRecordRTKInfo.pdop, pointRecordRTKInfo.hrms, pointRecordRTKInfo.vrms, inputHrDouble, pointRecordRTKInfo.powerLevel, pointRecordRTKInfo.satTrackNum, pointRecordRTKInfo.satSolutionNum, pointRecordRTKInfo.deviceModel, pointRecordRTKInfo.deviceSn); |
||||
DeviceInfoData deviceInfoData = new DeviceInfoData(rtkStatusData); |
||||
pointRecord.deviceInfoData = deviceInfoData; |
||||
} |
||||
if (pointRecord.deviceInfoData.deprecatedDeviceData != null) { |
||||
DeprecatedDeviceData pointRecordDeprecatedInfo = pointRecord.deviceInfoData.deprecatedDeviceData; |
||||
DeprecatedDeviceData deprecatedDeviceData = new DeprecatedDeviceData(pointRecordDeprecatedInfo.satellite, binding.etAntennaHeight.getText().toString(), pointRecordDeprecatedInfo.electricity, pointRecordDeprecatedInfo.posType, pointRecordDeprecatedInfo.hrms, pointRecordDeprecatedInfo.vrms, pointRecordDeprecatedInfo.posType, pointRecordDeprecatedInfo.diffAge, pointRecordDeprecatedInfo.stationType, pointRecordDeprecatedInfo.solutionState); |
||||
DeviceInfoData deviceInfoData = new DeviceInfoData(deprecatedDeviceData); |
||||
pointRecord.deviceInfoData = deviceInfoData; |
||||
} |
||||
|
||||
pointRecord.h = recordHigh + recordHr - inputHrDouble; |
||||
pointRecord.altitude = recordAltitude + recordHr - inputHrDouble; |
||||
|
||||
ThreadPoolUtil.execute(() -> { |
||||
PointDb.getInstance().save(pointRecord); |
||||
runOnUiThread(() -> { |
||||
setResult(launcher_update_point_library); |
||||
finish(); |
||||
}); |
||||
}); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
@Override |
||||
protected void initData() { |
||||
String recordId = IntentUtil.stringExtra(getIntent(), KEY_RECORD); |
||||
if (StringUtil.isEmpty(recordId)) { |
||||
finish(); |
||||
ToastUtils.showShort("无记录"); |
||||
return; |
||||
} |
||||
ThreadPoolUtil.execute(() -> { |
||||
pointRecord = PointDb.getInstance() |
||||
.rawQueryData(DBQueryConstant.findById(PointConstants.DB_NAME, recordId)); |
||||
JobRecord jobRecord = JobDb.getInstance() |
||||
.rawQueryData(DBQueryConstant.findById(JobConstants.DB_NAME, pointRecord.jobId)); |
||||
String jobName = jobRecord == null ? getString(R.string.empty) : jobRecord.name; |
||||
|
||||
recordHigh = pointRecord.h; |
||||
recordAltitude = pointRecord.altitude; |
||||
recordHr = Double.parseDouble(DeviceInfoDataUtils.hrString(pointRecord.deviceInfoData)); |
||||
|
||||
setRecord(pointRecord, jobName); |
||||
}); |
||||
} |
||||
|
||||
private void setRecord(PointRecord results, String jobName) { |
||||
setTitle(jobName); |
||||
binding.etPointName.setText(results.name); |
||||
binding.etCode.setText(results.code); |
||||
binding.etAntennaHeight.setText(DeviceInfoDataUtils.hrString(results.deviceInfoData)); |
||||
binding.etRemark.setText(results.remarks); |
||||
binding.tvX.setText(Util.formatDouble2StringDotAuto(results.x)); |
||||
binding.tvY.setText(Util.formatDouble2StringDotAuto(results.y)); |
||||
binding.tvZ.setText(Util.formatDouble2StringDotAuto(results.h)); |
||||
binding.tvLatitude.setText(Util.radianToDmsDoubleString(Math.toRadians(results.latitude), 6, false)); |
||||
binding.tvLongitude.setText(Util.radianToDmsDoubleString(Math.toRadians(results.longitude), 6, false)); |
||||
binding.tvAltitude.setText(Util.formatDouble2StringDotAuto(results.altitude)); |
||||
binding.tvHrms.setText(DeviceInfoDataUtils.hrmsString(results.deviceInfoData)); |
||||
binding.tvVrms.setText(DeviceInfoDataUtils.vrmsString(results.deviceInfoData)); |
||||
binding.tvPdop.setText(DeviceInfoDataUtils.pdopString(results.deviceInfoData)); |
||||
binding.tvDiffAge.setText(DeviceInfoDataUtils.diffAgeString(this, results.deviceInfoData)); |
||||
binding.tvSolutionStatus.setText(DeviceInfoDataUtils.solutionStateString(results.deviceInfoData)); |
||||
binding.tvSolutionSatelliteNumber.setText(DeviceInfoDataUtils.satelliteString(this, results.deviceInfoData)); |
||||
binding.tvRecordTime.setText(DateUtils.toFull(results.createDate)); |
||||
} |
||||
|
||||
private static final String KEY_RECORD = "record"; |
||||
|
||||
public static void start(ActivityResultLauncher<Intent> launcher, Context context, String recordId) { |
||||
Intent intent = new Intent(context, EditCoordinatePointActivity.class); |
||||
intent.putExtra(KEY_RECORD, recordId); |
||||
launcher.launch(intent); |
||||
} |
||||
} |
@ -0,0 +1,71 @@ |
||||
package com.project.survey.ui.instrument.setupstation; |
||||
|
||||
import android.os.Handler; |
||||
import android.os.Looper; |
||||
import android.os.Message; |
||||
|
||||
import androidx.annotation.NonNull; |
||||
|
||||
import com.bingce.utils.ThreadPoolUtil; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
import java.util.concurrent.atomic.AtomicBoolean; |
||||
|
||||
public final class FilterHandlerNew extends Handler { |
||||
private static final int MSG_WORK = 0;//过滤关键字发生变化
|
||||
private static final List<String> filterKey = new ArrayList<>(); |
||||
private final AtomicBoolean isWorking = new AtomicBoolean(false); |
||||
private FilterCallBack iData; |
||||
public interface FilterCallBack{ |
||||
void fireByKey(String key); |
||||
} |
||||
|
||||
public FilterHandlerNew(FilterCallBack callBack) { |
||||
super(Looper.getMainLooper()); |
||||
this.iData = callBack; |
||||
} |
||||
@Override |
||||
public void handleMessage(@NonNull Message msg) { |
||||
if (!isWorking.compareAndSet(false, true)) { |
||||
return; |
||||
} |
||||
String targetKey = null; |
||||
synchronized (this) { |
||||
if (!filterKey.isEmpty()) { |
||||
targetKey = filterKey.get(filterKey.size() - 1); |
||||
filterKey.clear(); |
||||
} |
||||
} |
||||
//检测是否有key
|
||||
if (targetKey == null) { |
||||
isWorking.set(false); |
||||
return; |
||||
} |
||||
//执行数据更新
|
||||
String finalTargetKey = targetKey; |
||||
ThreadPoolUtil.executeInQueue(() -> { |
||||
iData.fireByKey(finalTargetKey); |
||||
//执行完毕后,不管后续是否还有其他消息,都要再检查一下
|
||||
isWorking.set(false); |
||||
startLoop(); |
||||
}); |
||||
} |
||||
|
||||
public void onFilterStringChanged(String string) { |
||||
removeMessages(MSG_WORK); |
||||
synchronized (this) { |
||||
filterKey.add(string); |
||||
startLoop(); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 启动消息循环 |
||||
*/ |
||||
private void startLoop() { |
||||
Message msg = Message.obtain(); |
||||
msg.what = MSG_WORK; |
||||
sendMessageDelayed(msg,400); |
||||
} |
||||
} |
@ -0,0 +1,55 @@ |
||||
package com.project.survey.ui.instrument.setupstation; |
||||
|
||||
import android.content.Intent; |
||||
|
||||
import androidx.fragment.app.Fragment; |
||||
|
||||
import com.afollestad.materialdialogs.MaterialDialog; |
||||
import com.bingce.device.Device; |
||||
import com.bingce.device.enums.DeviceTypeEnum; |
||||
import com.bingce.totalstation.TsConfig; |
||||
import com.bingce.totalstation.enums.SetupStationMethodEnum; |
||||
import com.project.survey.R; |
||||
|
||||
import blankj.utilcode.util.ToastUtils; |
||||
import blankj.utilcode.util.Utils; |
||||
|
||||
|
||||
public class InstrumentSetFragmentSetupStationTypeUtils { |
||||
/** |
||||
* 选择设站模式 |
||||
*/ |
||||
public static void chooseSetupStationType(Fragment fragment) { |
||||
if (Device.getInstance().deviceType == DeviceTypeEnum.DEVICE_TYPE_RTK) { |
||||
ToastUtils.showShort("当前仪器模式不支持"); |
||||
return; |
||||
} |
||||
new MaterialDialog.Builder(fragment.getActivity()) |
||||
.items(R.array.setup_station_type_with_current) |
||||
.itemsCallback((dialog, view, which, text) -> { |
||||
switch (which) { |
||||
case 0: |
||||
fragment.startActivity(new Intent(Utils.getApp(), SetupStationCurrentActivity.class)); |
||||
break; |
||||
case 1: |
||||
TsConfig.getInstance().setSetupStationMethod(SetupStationMethodEnum.TS_DONE_SKIP); |
||||
ToastUtils.showShort(R.string.apply_success); |
||||
break; |
||||
case 2: |
||||
TsConfig.getInstance().setSetupStationMethod(SetupStationMethodEnum.TS_DONE_INPUT_INTO_APP); |
||||
fragment.startActivity(new Intent(Utils.getApp(), SetupStationInputActivity.class)); |
||||
break; |
||||
case 3: |
||||
TsConfig.getInstance().setSetupStationMethod(SetupStationMethodEnum.APP_SETUP_KNOWN_BACK_SIGHT); |
||||
fragment.startActivity(new Intent(Utils.getApp(), SetupStationKnownBackSightActivity.class)); |
||||
break; |
||||
case 4: |
||||
TsConfig.getInstance().setSetupStationMethod(SetupStationMethodEnum.APP_SETUP_RESECTION); |
||||
fragment.startActivity(new Intent(Utils.getApp(), SetupStationResectionActivity.class)); |
||||
} |
||||
TsConfig.getInstance().save(); |
||||
// ((App) Utils.getApp()).lastTsSetupStationType = which - 1;
|
||||
// Util.putPreference("lastTsSetupStationType", ((App) Utils.getApp()).lastTsSetupStationType);
|
||||
}).show(); |
||||
} |
||||
} |
@ -0,0 +1,14 @@ |
||||
package com.project.survey.ui.instrument.setupstation; |
||||
|
||||
public class LauncherEvent { |
||||
public final static int point_survey_list_change_number = 22; |
||||
public final static int launcher_delete_point_lib = point_survey_list_change_number + 1; |
||||
public final static int launcher_results_export = launcher_delete_point_lib + 1; |
||||
public final static int launcher_add_code_color = launcher_results_export + 1; |
||||
public final static int launcher_code_style = launcher_add_code_color + 1; |
||||
public final static int launcher_code_shape_surface = launcher_code_style + 1; |
||||
public final static int launcher_code_library_update = launcher_code_shape_surface + 1; |
||||
public final static int launcher_code_apply_id = launcher_code_library_update + 1; |
||||
public final static int launcher_update_point_library = launcher_code_apply_id + 1; |
||||
public final static int launcher_update_area_survey = launcher_update_point_library + 1; |
||||
} |
@ -0,0 +1,263 @@ |
||||
package com.project.survey.ui.instrument.setupstation; |
||||
|
||||
import android.content.Intent; |
||||
import android.view.View; |
||||
|
||||
import androidx.appcompat.app.AppCompatActivity; |
||||
|
||||
import com.bingce.dialog.TimePicker; |
||||
import com.bingce.utils.ActivityUtils; |
||||
import com.bingce.utils.IntentUtil; |
||||
import com.project.survey.R; |
||||
import com.project.survey.databinding.ActivityPointFilterBinding; |
||||
import com.project.survey.ui.base.BaseSurveyNewActivity; |
||||
|
||||
import java.util.Calendar; |
||||
import java.util.Date; |
||||
|
||||
|
||||
public class PointFilterActivity extends BaseSurveyNewActivity { |
||||
private ActivityPointFilterBinding binding; |
||||
private TimePicker timePicker = null; |
||||
private long startTime = -1; |
||||
private long endTime = -1; |
||||
@Override |
||||
public View getContentView() { |
||||
binding = ActivityPointFilterBinding.inflate(getLayoutInflater()); |
||||
return binding.getRoot(); |
||||
} |
||||
|
||||
private void onTodayClicked() { |
||||
setBtnDayBackground(0, true); |
||||
setBtnDayBackground(1, false); |
||||
setBtnDayBackground(2, false); |
||||
setCalendarBackground(0, false); |
||||
setCalendarBackground(1, false); |
||||
Calendar calendar = Calendar.getInstance(); |
||||
calendar.setTime(new Date()); |
||||
calendar.set(Calendar.HOUR_OF_DAY, 0); |
||||
calendar.set(Calendar.MINUTE, 0); |
||||
calendar.set(Calendar.SECOND, 1); |
||||
startTime = calendar.getTime().getTime(); |
||||
endTime = startTime + 1000 * 60 * 60 * 24 - 2000;//减2s到23:59:59
|
||||
binding.tvStartDate.setText(TimePicker.getTime(new Date(startTime))); |
||||
binding.tvEndDate.setText(TimePicker.getTime(new Date(endTime))); |
||||
} |
||||
|
||||
private void on7DayClicked() { |
||||
setBtnDayBackground(0, false); |
||||
setBtnDayBackground(1, true); |
||||
setBtnDayBackground(2, false); |
||||
setCalendarBackground(0, false); |
||||
setCalendarBackground(1, false); |
||||
Calendar calendar = Calendar.getInstance(); |
||||
calendar.setTime(new Date()); |
||||
calendar.set(Calendar.HOUR_OF_DAY, 23); |
||||
calendar.set(Calendar.MINUTE, 59); |
||||
calendar.set(Calendar.SECOND, 59); |
||||
endTime = calendar.getTime().getTime(); |
||||
startTime = endTime - 1000 * 60 * 60 * 24 * 7 + 2000;//加2s,到0:0:1
|
||||
binding.tvStartDate.setText(TimePicker.getTime(new Date(startTime))); |
||||
binding.tvEndDate.setText(TimePicker.getTime(new Date(endTime))); |
||||
} |
||||
|
||||
private void onAllDayClicked() { |
||||
setBtnDayBackground(0, false); |
||||
setBtnDayBackground(1, false); |
||||
setBtnDayBackground(2, true); |
||||
setCalendarBackground(0, false); |
||||
setCalendarBackground(1, false); |
||||
|
||||
startTime = -1; |
||||
endTime = -1; |
||||
binding.tvStartDate.setText(""); |
||||
binding.tvEndDate.setText(""); |
||||
} |
||||
|
||||
@Override |
||||
protected void initView() { |
||||
setTitle(getString(R.string.filter)); |
||||
timePicker = new TimePicker(this, R.color.theme_green); |
||||
boolean forceSurvey = IntentUtil.boolExtra(this, KEY_FORCE_SURVEY); |
||||
if (forceSurvey) { |
||||
binding.typeLabel.setVisibility(View.GONE); |
||||
binding.typeCheckBoxes.setVisibility(View.GONE); |
||||
} |
||||
setBtnDayBackground(0, true); |
||||
binding.tvToday.setOnClickListener(v -> onTodayClicked()); |
||||
binding.tvNearly7Days.setOnClickListener(v -> on7DayClicked()); |
||||
binding.tvAllDays.setOnClickListener(v -> onAllDayClicked()); |
||||
binding.rlStartDate.setOnClickListener(v -> { |
||||
timePicker.select(instance -> { |
||||
setBtnDayBackground(0, false); |
||||
setBtnDayBackground(1, false); |
||||
setBtnDayBackground(2, false); |
||||
setCalendarBackground(0, true); |
||||
binding.tvStartDate.setText(TimePicker.getTime(new Date(instance))); |
||||
startTime = instance; |
||||
}); |
||||
}); |
||||
binding.rlEndDate.setOnClickListener(v -> { |
||||
timePicker.select(binding.tvStartDate.getText().toString(), instance -> { |
||||
setBtnDayBackground(0, false); |
||||
setBtnDayBackground(1, false); |
||||
setBtnDayBackground(2, false); |
||||
setCalendarBackground(1, true); |
||||
binding.tvEndDate.setText(TimePicker.getTime(new Date(instance))); |
||||
endTime = instance; |
||||
}); |
||||
}); |
||||
|
||||
binding.filterBtnConfirm.setOnClickListener(new View.OnClickListener() { |
||||
@Override |
||||
public void onClick(View v) { |
||||
Intent intent = new Intent(); |
||||
if (forceSurvey) { |
||||
intent.putExtra(KEY_NEED_SURVEY, true); |
||||
} else { |
||||
intent.putExtra(KEY_NEED_SURVEY, binding.cbSurvey.isChecked()); |
||||
intent.putExtra(KEY_NEED_INPUT, binding.cbInput.isChecked()); |
||||
intent.putExtra(KEY_NEED_CONTROL, binding.cbControl.isChecked()); |
||||
} |
||||
if (startTime > 0) { |
||||
intent.putExtra(KEY_DATE_START, startTime); |
||||
} |
||||
if (endTime > 0) { |
||||
intent.putExtra(KEY_DATE_END, endTime); |
||||
} |
||||
intent.putExtra(KEY_NAME, binding.etName.getText().toString()); |
||||
intent.putExtra(KEY_CODE, binding.etCode.getText().toString()); |
||||
intent.putExtra(KEY_REMARKS, binding.etRemarks.getText().toString()); |
||||
|
||||
setResult(RESULT_OK, intent); |
||||
finish(); |
||||
} |
||||
}); |
||||
|
||||
binding.filterBtnCancel.setOnClickListener(new View.OnClickListener() { |
||||
@Override |
||||
public void onClick(View v) { |
||||
finish(); |
||||
} |
||||
}); |
||||
//除时间外,设置默认值
|
||||
binding.cbSurvey.setChecked(IntentUtil.boolExtra(this, KEY_NEED_SURVEY)); |
||||
binding.cbInput.setChecked(IntentUtil.boolExtra(this, KEY_NEED_INPUT)); |
||||
binding.cbControl.setChecked(IntentUtil.boolExtra(this, KEY_NEED_CONTROL)); |
||||
|
||||
binding.etName.setText(IntentUtil.stringExtra(this, KEY_NAME)); |
||||
binding.etCode.setText(IntentUtil.stringExtra(this, KEY_CODE)); |
||||
binding.etRemarks.setText(IntentUtil.stringExtra(this, KEY_REMARKS)); |
||||
} |
||||
|
||||
@Override |
||||
protected void initData() { |
||||
long start = IntentUtil.longExtra(this, KEY_DATE_START); |
||||
long end = IntentUtil.longExtra(this, KEY_DATE_END); |
||||
if (start < 0 && end < 0) { |
||||
onAllDayClicked(); |
||||
} else { |
||||
if (end - start == 1000 * 60 * 60 * 24 * 7 - 2000){ |
||||
on7DayClicked(); |
||||
}else { |
||||
onTodayClicked(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* @param selectedIndex 0--今天,1--7天,2--全部 |
||||
*/ |
||||
private void setBtnDayBackground(int selectedIndex, boolean selected) { |
||||
if (0 == selectedIndex) { |
||||
binding.tvToday.setBackgroundResource(buttonBg(selected)); |
||||
binding.tvToday.setTextColor(getResources().getColor(buttonColor(selected))); |
||||
} else if (1 == selectedIndex) { |
||||
binding.tvNearly7Days.setBackgroundResource(buttonBg(selected)); |
||||
binding.tvNearly7Days.setTextColor(getResources().getColor(buttonColor(selected))); |
||||
} else if (2 == selectedIndex) { |
||||
binding.tvAllDays.setBackgroundResource(buttonBg(selected)); |
||||
binding.tvAllDays.setTextColor(getResources().getColor(buttonColor(selected))); |
||||
} |
||||
} |
||||
|
||||
private static int buttonBg(boolean selected) { |
||||
return selected ? |
||||
R.drawable.rectangle_radius_5_theme_green_press_full : |
||||
R.drawable.rectangle_radius_5_theme_green_line; |
||||
} |
||||
|
||||
private static int buttonColor(boolean selected) { |
||||
return selected ? R.color.white : R.color.theme_green; |
||||
} |
||||
|
||||
private void setCalendarBackground(int selectedIndex, boolean selected) { |
||||
if (0 == selectedIndex) { |
||||
binding.rlStartDate.setBackgroundResource(selected ? |
||||
R.drawable.rectangle_radius_5_theme_green_line : |
||||
R.drawable.rectangle_radius_5_theme_gray_line); |
||||
binding.tvStartDate.setTextColor(getResources().getColor(selected ? |
||||
R.color.theme_green : R.color.color_575757)); |
||||
binding.ivStartCalendar.setImageResource(selected ? |
||||
R.mipmap.icon_calendar_green : R.mipmap.icon_calendar_gray); |
||||
} else if (1 == selectedIndex) { |
||||
binding.rlEndDate.setBackgroundResource(selected ? |
||||
R.drawable.rectangle_radius_5_theme_green_line : |
||||
R.drawable.rectangle_radius_5_theme_gray_line); |
||||
binding.tvEndDate.setTextColor(getResources().getColor(selected ? |
||||
R.color.theme_green : R.color.color_575757)); |
||||
binding.ivEndCalendar.setImageResource(selected ? |
||||
R.mipmap.icon_calendar_green : R.mipmap.icon_calendar_gray); |
||||
} |
||||
} |
||||
|
||||
public interface IFilterCallback { |
||||
void onFilter(boolean needSurvey, boolean needInput, boolean needControl, |
||||
Date dateStart, Date dateEnd, String nameKey, String codeKey, String remarksKey); |
||||
} |
||||
|
||||
private static final String KEY_FORCE_SURVEY = "FORCE SURVEY";//只在测量点中过滤
|
||||
|
||||
private static final String KEY_NEED_SURVEY = "NEED_SURVEY"; |
||||
private static final String KEY_NEED_INPUT = "NEED INPUT"; |
||||
private static final String KEY_NEED_CONTROL = "NEED CONTROL"; |
||||
private static final String KEY_DATE_START = "date start"; |
||||
private static final String KEY_DATE_END = "date end"; |
||||
private static final String KEY_NAME = "name key"; |
||||
private static final String KEY_CODE = "code key"; |
||||
private static final String KEY_REMARKS = "remarks key"; |
||||
|
||||
public static void startFilter(AppCompatActivity activity, boolean forceSurvey, |
||||
boolean needSurvey, boolean needInput, boolean needControl, |
||||
Date dateStart, Date dateEnd, String nameKey, String codeKey, String remarksKey, |
||||
IFilterCallback callback) { |
||||
Intent intent2StartActivity = new Intent(activity, PointFilterActivity.class); |
||||
intent2StartActivity.putExtra(KEY_FORCE_SURVEY, forceSurvey); |
||||
intent2StartActivity.putExtra(KEY_NEED_SURVEY, needSurvey); |
||||
intent2StartActivity.putExtra(KEY_NEED_INPUT, needInput); |
||||
intent2StartActivity.putExtra(KEY_NEED_CONTROL, needControl); |
||||
intent2StartActivity.putExtra(KEY_DATE_START, dateStart == null ? -1 : dateStart.getTime()); |
||||
intent2StartActivity.putExtra(KEY_DATE_END, dateEnd == null ? -1 : dateEnd.getTime()); |
||||
intent2StartActivity.putExtra(KEY_NAME, nameKey); |
||||
intent2StartActivity.putExtra(KEY_CODE, codeKey); |
||||
intent2StartActivity.putExtra(KEY_REMARKS, remarksKey); |
||||
|
||||
ActivityUtils.startActivityForResults(activity, intent2StartActivity, result -> { |
||||
if (result == null || result.getData() == null || result.getResultCode() != RESULT_OK) { |
||||
return; |
||||
} |
||||
Intent intent = result.getData(); |
||||
long start = intent.getLongExtra(KEY_DATE_START, -1); |
||||
long end = intent.getLongExtra(KEY_DATE_END, -1); |
||||
callback.onFilter( |
||||
intent.getBooleanExtra(KEY_NEED_SURVEY, false), |
||||
intent.getBooleanExtra(KEY_NEED_INPUT, false), |
||||
intent.getBooleanExtra(KEY_NEED_CONTROL, false), |
||||
start > 0 ? new Date(start) : null, |
||||
end > 0 ? new Date(end) : null, |
||||
intent.getStringExtra(KEY_NAME), |
||||
intent.getStringExtra(KEY_CODE), |
||||
intent.getStringExtra(KEY_REMARKS)); |
||||
}); |
||||
} |
||||
} |
@ -0,0 +1,43 @@ |
||||
package com.project.survey.ui.instrument.setupstation |
||||
|
||||
import android.os.Bundle |
||||
import androidx.recyclerview.widget.DiffUtil |
||||
import com.bingce.data.surveyor.surveydata.pointsurvey.PointRecord |
||||
import com.bingce.utils.DateUtils |
||||
import com.bingce.utils.Util |
||||
|
||||
class PointRecordDiffCallback2: DiffUtil.ItemCallback<PointRecord>() { |
||||
|
||||
override fun areItemsTheSame(oldItem: PointRecord, newItem: PointRecord): Boolean { |
||||
return oldItem.id == newItem.id |
||||
} |
||||
|
||||
override fun areContentsTheSame(oldItem: PointRecord, newItem: PointRecord): Boolean { |
||||
return oldItem == newItem |
||||
} |
||||
|
||||
override fun getChangePayload(oldItem: PointRecord, newItem: PointRecord): Any? { |
||||
val bundle = Bundle() |
||||
|
||||
if (oldItem.name != newItem.name){ |
||||
bundle.putString("name",newItem.name) |
||||
} |
||||
if (oldItem.code != newItem.code){ |
||||
bundle.putString("code",newItem.code) |
||||
} |
||||
if (oldItem.x != newItem.x){ |
||||
bundle.putString("x", Util.formatDouble2StringDotAuto(newItem.x)) |
||||
} |
||||
if (oldItem.y != newItem.y){ |
||||
bundle.putString("y", Util.formatDouble2StringDotAuto(newItem.y)) |
||||
} |
||||
if (oldItem.h != newItem.h){ |
||||
bundle.putString("h", Util.formatDouble2StringDotAuto(newItem.h)) |
||||
} |
||||
if (oldItem.createDate.time != newItem.createDate.time){ |
||||
bundle.putString("time", DateUtils.toFull(newItem.createDate)) |
||||
} |
||||
if (bundle.size() == 0) return null |
||||
return bundle |
||||
} |
||||
} |
@ -0,0 +1,234 @@ |
||||
package com.project.survey.ui.instrument.setupstation; |
||||
|
||||
import android.annotation.SuppressLint; |
||||
import android.content.Context; |
||||
import android.text.TextUtils; |
||||
import android.view.LayoutInflater; |
||||
import android.view.View; |
||||
import android.view.ViewGroup; |
||||
import android.widget.ImageView; |
||||
import android.widget.TextView; |
||||
|
||||
import androidx.annotation.NonNull; |
||||
import androidx.recyclerview.widget.RecyclerView; |
||||
|
||||
import com.bingce.surveyor.util.dialog.CustomDialog; |
||||
import com.project.survey.R; |
||||
import com.project.survey.ui.instrument.setupstation.db.resultformat.FormatRecord; |
||||
|
||||
import java.util.List; |
||||
|
||||
|
||||
public class ResultsExportAdapter extends RecyclerView.Adapter<ResultsExportAdapter.ViewHolder> { |
||||
private Context context; |
||||
private OnItemClickListener onClickListener; |
||||
private int selectPosition; |
||||
private List<FormatRecord> formatRecordList; |
||||
|
||||
public ResultsExportAdapter(Context context, List<FormatRecord> formatRecordList, int defPosition) { |
||||
this.selectPosition = defPosition; |
||||
this.context = context; |
||||
this.formatRecordList = formatRecordList; |
||||
} |
||||
|
||||
@NonNull |
||||
@Override |
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { |
||||
ViewHolder holder = new ViewHolder(LayoutInflater.from( |
||||
context).inflate(R.layout.layout_results_export_item, parent, |
||||
false)); |
||||
return holder; |
||||
} |
||||
|
||||
@Override |
||||
public void onBindViewHolder(@NonNull ViewHolder viewHolder, @SuppressLint("RecyclerView") int position) { |
||||
FormatRecord formatRecord = formatRecordList.get(position); |
||||
|
||||
if (TextUtils.isEmpty(formatRecord.id)) { |
||||
viewHolder.iv_format_fixed.setVisibility(View.VISIBLE); |
||||
} else { |
||||
viewHolder.iv_format_fixed.setVisibility(View.GONE); |
||||
} |
||||
viewHolder.tv_name.setText(formatRecord.format_name); |
||||
|
||||
StringBuilder stringBuilder = new StringBuilder(); |
||||
String[] split = formatRecord.format_content.split(formatRecord.divided_symbols); |
||||
if (position == 5) { |
||||
viewHolder.tv_view_all.setVisibility(View.VISIBLE); |
||||
} else { |
||||
viewHolder.tv_view_all.setVisibility(View.GONE); |
||||
} |
||||
|
||||
viewHolder.tv_view_all.setOnClickListener(new View.OnClickListener() { |
||||
@Override |
||||
public void onClick(View v) { |
||||
new CustomDialog.Builder(context).setContent(formatRecord.format_content).create().show(); |
||||
} |
||||
}); |
||||
|
||||
for (int i = 0; i < split.length; i++) { |
||||
switch (split[i]) { |
||||
case "点名": |
||||
split[i] = context.getString(R.string.point_name); |
||||
break; |
||||
case "编码": |
||||
split[i] = "编码"; |
||||
break; |
||||
case "纬度": |
||||
split[i] = "纬度"; |
||||
break; |
||||
case "经度": |
||||
split[i] = context.getString(R.string.longitude); |
||||
break; |
||||
case "大地高": |
||||
split[i] = "大地高"; |
||||
break; |
||||
case "天线类型": |
||||
split[i] = "天线类型"; |
||||
break; |
||||
case "天线高度": |
||||
split[i] = context.getString(R.string.antenna_height); |
||||
break; |
||||
case "北坐标": |
||||
split[i] = "北坐标"; |
||||
break; |
||||
case "东坐标": |
||||
split[i] = "东坐标"; |
||||
break; |
||||
case "高程": |
||||
split[i] = "高程"; |
||||
break; |
||||
case "解状态": |
||||
split[i] = "解状态"; |
||||
break; |
||||
case "解算卫星": |
||||
split[i] = "解算卫星"; |
||||
break; |
||||
case "可见卫星": |
||||
split[i] = "可见卫星"; |
||||
break; |
||||
case "PDOP": |
||||
split[i] = "PDOP"; |
||||
break; |
||||
case "HRMS": |
||||
split[i] = "HRMS"; |
||||
break; |
||||
case "VRMS": |
||||
split[i] = "VRMS"; |
||||
break; |
||||
case "差分延迟": |
||||
split[i] = "差分延迟"; |
||||
break; |
||||
case "采集时间": |
||||
split[i] = "采集时间"; |
||||
break; |
||||
case "基站ID": |
||||
split[i] = "基站ID"; |
||||
break; |
||||
case "基站纬度": |
||||
split[i] = "基站纬度"; |
||||
break; |
||||
case "基站经度": |
||||
split[i] = "基站经度"; |
||||
break; |
||||
case "基站距离": |
||||
split[i] = "基站距离"; |
||||
break; |
||||
case "惯导测量": |
||||
split[i] = "惯导测量"; |
||||
break; |
||||
} |
||||
|
||||
if (i == split.length - 1) { |
||||
stringBuilder.append("[" + split[i] + "]"); |
||||
} else { |
||||
stringBuilder.append("[" + split[i] + "]" + formatRecord.divided_symbols); |
||||
} |
||||
} |
||||
|
||||
viewHolder.tv_content.setText(stringBuilder.toString()); |
||||
switch (formatRecord.file_suffix) { |
||||
case 0: |
||||
viewHolder.tv_suffix.setText(".xls"); |
||||
break; |
||||
case 1: |
||||
viewHolder.tv_suffix.setText(".dat"); |
||||
break; |
||||
case 2: |
||||
viewHolder.tv_suffix.setText(".txt"); |
||||
break; |
||||
case 3: |
||||
viewHolder.tv_suffix.setText(".csv"); |
||||
break; |
||||
case 4: |
||||
viewHolder.tv_suffix.setText(".dxf"); |
||||
break; |
||||
case 5: |
||||
viewHolder.tv_suffix.setText(".kml"); |
||||
break; |
||||
} |
||||
|
||||
viewHolder.tv_file_header.setText("文件表头" + ":" + (formatRecord.file_header ? context.getString(R.string.yes) : context.getString(R.string.no))); |
||||
|
||||
if (formatRecord.angle_format == 0) { |
||||
viewHolder.tv_angle_formats.setText("度.分秒"); |
||||
} else if (formatRecord.angle_format == 1) { |
||||
viewHolder.tv_angle_formats.setText("度°分′秒″"); |
||||
} else if (formatRecord.angle_format == 2) { |
||||
viewHolder.tv_angle_formats.setText("度"); |
||||
} else if (formatRecord.angle_format == 3) { |
||||
viewHolder.tv_angle_formats.setText("弧度"); |
||||
} |
||||
|
||||
if (selectPosition == position) { |
||||
viewHolder.iv_checkbox.setImageResource(R.mipmap.icon_checkbox_select); |
||||
} else { |
||||
viewHolder.iv_checkbox.setImageResource(R.mipmap.icon_checkbox_unselect); |
||||
} |
||||
viewHolder.itemView.setOnClickListener(new View.OnClickListener() { |
||||
@Override |
||||
public void onClick(View v) { |
||||
onClickListener.OnItemClick(position); |
||||
selectPosition = position; |
||||
notifyDataSetChanged(); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
@Override |
||||
public int getItemCount() { |
||||
return formatRecordList == null ? 0 : formatRecordList.size(); |
||||
} |
||||
|
||||
public void setUpdateList(int position, List<FormatRecord> formatRecordList) { |
||||
this.selectPosition = position; |
||||
this.formatRecordList = formatRecordList; |
||||
notifyDataSetChanged(); |
||||
} |
||||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder { |
||||
TextView tv_name, tv_content, tv_suffix, tv_file_header, tv_angle_formats, tv_view_all; |
||||
ImageView iv_checkbox; |
||||
ImageView iv_format_fixed; |
||||
|
||||
public ViewHolder(@NonNull View itemView) { |
||||
super(itemView); |
||||
iv_format_fixed = itemView.findViewById(R.id.iv_format_fixed); |
||||
tv_name = itemView.findViewById(R.id.tv_name); |
||||
tv_content = itemView.findViewById(R.id.tv_content); |
||||
tv_suffix = itemView.findViewById(R.id.tv_suffix); |
||||
iv_checkbox = itemView.findViewById(R.id.iv_checkbox); |
||||
tv_file_header = itemView.findViewById(R.id.tv_file_header); |
||||
tv_angle_formats = itemView.findViewById(R.id.tv_angle_formats); |
||||
tv_view_all = itemView.findViewById(R.id.tv_view_all); |
||||
} |
||||
} |
||||
|
||||
public interface OnItemClickListener { |
||||
void OnItemClick(int position); |
||||
} |
||||
|
||||
public void setOnClickListener(OnItemClickListener onClickListener) { |
||||
this.onClickListener = onClickListener; |
||||
} |
||||
} |
@ -0,0 +1,649 @@ |
||||
package com.project.survey.ui.instrument.setupstation; |
||||
|
||||
import static androidx.recyclerview.widget.LinearLayoutManager.VERTICAL; |
||||
|
||||
import android.content.Context; |
||||
import android.content.Intent; |
||||
import android.view.View; |
||||
|
||||
import androidx.activity.result.ActivityResultLauncher; |
||||
import androidx.activity.result.contract.ActivityResultContracts; |
||||
import androidx.annotation.Nullable; |
||||
import androidx.recyclerview.widget.LinearLayoutManager; |
||||
|
||||
import com.bingce.coordlib.model.CoordinateSystem; |
||||
import com.bingce.data.cache.CachedCurrentCoordinateSystem; |
||||
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.util.ConstUtils; |
||||
|
||||
import com.bingce.surveyor.util.dialog.CustomDialog; |
||||
import com.bingce.utils.IntentUtil; |
||||
import com.bingce.utils.StringUtil; |
||||
import com.bingce.utils.ThreadPoolUtil; |
||||
import com.bingce.utils.Util; |
||||
import com.hjq.permissions.OnPermissionCallback; |
||||
import com.hjq.permissions.Permission; |
||||
import com.hjq.permissions.XXPermissions; |
||||
import com.project.survey.R; |
||||
import com.project.survey.databinding.ActivityResultsTheExportBinding; |
||||
import com.project.survey.ui.base.BaseSurveyNewActivity; |
||||
import com.project.survey.ui.instrument.setupstation.db.PointSurveyRecord; |
||||
import com.project.survey.ui.instrument.setupstation.db.RecordsFixedDataBase; |
||||
import com.project.survey.ui.instrument.setupstation.db.resultformat.FormatRecord; |
||||
import com.project.survey.util.ExcelUtil; |
||||
import com.project.survey.util.FormatSuffixesUtils; |
||||
import com.project.survey.util.SystemUtils; |
||||
import com.project.survey.util.TxtUtil; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.Arrays; |
||||
import java.util.Date; |
||||
import java.util.List; |
||||
|
||||
import blankj.utilcode.util.ToastUtils; |
||||
|
||||
|
||||
public class ResultsTheExportActivity extends BaseSurveyNewActivity { |
||||
|
||||
private ActivityResultsTheExportBinding binding; |
||||
private final String filterId = SystemUtils.getUUID(); |
||||
private ResultsExportAdapter adapter; |
||||
private String uid; |
||||
private final List<PointSurveyRecord> selectedPoints = new ArrayList<>(); |
||||
private int defPosition = 0; |
||||
private List<FormatRecord> formatRecordList = new ArrayList<>(); |
||||
private String title; |
||||
private boolean isImport; |
||||
private List<String> fileTypeSuffixList; |
||||
private String txtContent = ""; |
||||
private final CachedProject currentProject = new CachedProject(this); |
||||
|
||||
@Override |
||||
public View getContentView() { |
||||
binding = ActivityResultsTheExportBinding.inflate(getLayoutInflater()); |
||||
return binding.getRoot(); |
||||
} |
||||
|
||||
@Override |
||||
protected void initView() { |
||||
title = IntentUtil.stringExtra(this, ConstUtils.intentConst.keyActivityTitleName); |
||||
isImport = IntentUtil.boolExtra(this, ConstUtils.intentConst.keyIsImport); |
||||
if (StringUtil.isEmpty(title)) { |
||||
setTitle("导出"); |
||||
} else { |
||||
setTitle(title); |
||||
} |
||||
|
||||
binding.pointsLibraryBtnNewCreate.setOnClickListener(new View.OnClickListener() { |
||||
@Override |
||||
public void onClick(View v) { |
||||
AddResultFormatActivity.start(launcher, ResultsTheExportActivity.this, true); |
||||
} |
||||
}); |
||||
|
||||
binding.pointsLibraryBtnEdit.setOnClickListener(new View.OnClickListener() { |
||||
@Override |
||||
public void onClick(View v) { |
||||
if (formatRecordList != null && formatRecordList.size() > 0) { |
||||
if (defPosition == -1) { |
||||
ToastUtils.showShort(getString(R.string.select_format_want_edit)); |
||||
return; |
||||
} |
||||
|
||||
if (StringUtil.isEmpty(formatRecordList.get(defPosition).id)) { |
||||
ToastUtils.showShort(getString(R.string.default_format_not_allowed_edit_delete)); |
||||
return; |
||||
} |
||||
|
||||
AddResultFormatActivity.start(launcher, ResultsTheExportActivity.this, false, uid); |
||||
} |
||||
} |
||||
}); |
||||
|
||||
binding.pointsLibraryBtnDelete.setOnClickListener(new View.OnClickListener() { |
||||
@Override |
||||
public void onClick(View v) { |
||||
if (formatRecordList != null && formatRecordList.size() > 0) { |
||||
if (defPosition == -1) { |
||||
ToastUtils.showShort(getString(R.string.select_format_want_delete)); |
||||
return; |
||||
} |
||||
|
||||
if (StringUtil.isEmpty(formatRecordList.get(defPosition).id)) { |
||||
ToastUtils.showShort(getString(R.string.default_format_not_allowed_edit_delete)); |
||||
return; |
||||
} |
||||
|
||||
ThreadPoolUtil.execute(new Runnable() { |
||||
@Override |
||||
public void run() { |
||||
RecordsFixedDataBase.getInstance().formatRecordDao().deleteById(uid); |
||||
ThreadPoolUtil.executeInMain(new Runnable() { |
||||
@Override |
||||
public void run() { |
||||
adapter.notifyItemRemoved(defPosition); |
||||
formatRecordList.remove(defPosition); |
||||
defPosition = -1; |
||||
uid = ""; |
||||
adapter.setUpdateList(defPosition, formatRecordList); |
||||
} |
||||
}); |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
}); |
||||
|
||||
binding.pointsLibraryBtnImportExport.setOnClickListener(new View.OnClickListener() { |
||||
@Override |
||||
public void onClick(View v) { |
||||
if (formatRecordList != null && formatRecordList.size() > 0) { |
||||
requestStoragePermission(); |
||||
} else { |
||||
ToastUtils.showShort(getString(R.string.create_new_export_format_first)); |
||||
} |
||||
} |
||||
}); |
||||
} |
||||
|
||||
public void requestStoragePermission() { |
||||
XXPermissions.with(this) |
||||
.permission(Permission.MANAGE_EXTERNAL_STORAGE) |
||||
.request(new OnPermissionCallback() { |
||||
@Override |
||||
public void onGranted(List<String> permissions, boolean all) { |
||||
if (!isImport) { |
||||
export(); |
||||
} else { |
||||
importContent(); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void onDenied(List<String> permissions, boolean never) { |
||||
if (never) { |
||||
ToastUtils.showShort("请手动授予文件读写权限"); |
||||
// 如果是被永久拒绝就跳转到应用权限系统设置页面
|
||||
XXPermissions.startPermissionActivity(ResultsTheExportActivity.this, permissions); |
||||
} else { |
||||
requestStoragePermission(); |
||||
} |
||||
} |
||||
}); |
||||
} |
||||
|
||||
private void export() { |
||||
//导出功能
|
||||
ThreadPoolUtil.execute(new Runnable() { |
||||
@Override |
||||
public void run() { |
||||
if (pointBaseRecordList2Export() != null && pointBaseRecordList2Export().size() > 0) { |
||||
ThreadPoolUtil.executeInMain(new Runnable() { |
||||
@Override |
||||
public void run() { |
||||
switch (formatRecordList.get(defPosition).file_suffix) { |
||||
case 0: |
||||
ExcelUtil.exportFormat(ExcelUtil.ID_POINT_COORDINATE, ResultsTheExportActivity.this, currentProject, formatRecordList.get(defPosition), filePaths -> { |
||||
ExcelUtil.exportCoordinator(pointBaseRecordList2Export(), filePaths, ResultsTheExportActivity.this, formatRecordList.get(defPosition)); |
||||
}); |
||||
break; |
||||
case 1: |
||||
ExportCassCsvTxt(FormatSuffixesUtils.formatDAT); |
||||
break; |
||||
case 2: |
||||
ExportCassCsvTxt(FormatSuffixesUtils.formatTXT); |
||||
break; |
||||
case 3: |
||||
ExportCassCsvTxt(FormatSuffixesUtils.formatCSV); |
||||
break; |
||||
case 4: |
||||
ExportDxf(); |
||||
break; |
||||
case 5: |
||||
ExportKml(); |
||||
break; |
||||
} |
||||
} |
||||
}); |
||||
} else { |
||||
ToastUtils.showShort(getString(R.string.no_exportable_data)); |
||||
} |
||||
} |
||||
}); |
||||
} |
||||
|
||||
private void importContent() { |
||||
//导入功能
|
||||
fileTypeSuffixList = new ArrayList<>(); |
||||
String fileFormatName = ""; |
||||
int suffix = formatRecordList.get(defPosition).file_suffix; |
||||
if (suffix == AddResultFormatActivity.SUFFIX_XLS_NUM) { |
||||
fileTypeSuffixList = Arrays.asList("xls", "xlsx"); |
||||
fileFormatName = "Excel"; |
||||
} else if (suffix == AddResultFormatActivity.SUFFIX_DAT_NUM) { |
||||
fileTypeSuffixList = Arrays.asList("dat", "DAT"); |
||||
fileFormatName = "Cass"; |
||||
} else if (suffix == AddResultFormatActivity.SUFFIX_TXT_NUM) { |
||||
fileTypeSuffixList = Arrays.asList("txt", "TXT"); |
||||
fileFormatName = "Txt"; |
||||
} else if (suffix == AddResultFormatActivity.SUFFIX_CSV_NUM) { |
||||
fileTypeSuffixList = Arrays.asList("csv", "CSV"); |
||||
fileFormatName = "Csv"; |
||||
} |
||||
new CustomDialog.Builder(ResultsTheExportActivity.this) |
||||
.setTitle(getString(R.string.import1) + fileFormatName + getString(R.string.file)) |
||||
.setContent("选择导入的文件,请严格按照以下" + "\n\n[" + formatRecordList.get(defPosition).format_content + "]" + "\n" + "以免出现导入失败等情况!") |
||||
.setButtonConfirm(new View.OnClickListener() { |
||||
@Override |
||||
public void onClick(View v) { |
||||
// SelectFilePathActivity.select(ResultsTheExportActivity.this, fileTypeSuffixList, instance -> {
|
||||
// ThreadPoolUtil.execute(() -> {
|
||||
// List<PointSurveyRecord> pointSurveyRecordList = null;
|
||||
// String projectId = CachedProject.currentProjectId();
|
||||
// if (suffix == AddResultFormatActivity.SUFFIX_XLS_NUM){
|
||||
// pointSurveyRecordList = ImportCoordinatorUtils.doImport(formatRecordList.get(defPosition),projectId, ResultsTheExportActivity.this, instance);
|
||||
// }else if (suffix == AddResultFormatActivity.SUFFIX_DAT_NUM || suffix == AddResultFormatActivity.SUFFIX_TXT_NUM || suffix == AddResultFormatActivity.SUFFIX_CSV_NUM){
|
||||
// pointSurveyRecordList = CassCsvTxtImportUtil.importControlPoint(formatRecordList.get(defPosition),ResultsTheExportActivity.this, instance);
|
||||
// }
|
||||
// Intent intent = new Intent();
|
||||
// intent.putExtra(ConstUtils.intentConst.keyCoordinatePointsLibrary,new Gson().toJson(pointSurveyRecordList));
|
||||
// setResult(LauncherEvent.launcher_coordinate_point_library,intent);
|
||||
// finish();
|
||||
// });
|
||||
// });
|
||||
} |
||||
}).create().show(); |
||||
} |
||||
|
||||
@Override |
||||
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { |
||||
super.onActivityResult(requestCode, resultCode, data); |
||||
if (requestCode == XXPermissions.REQUEST_CODE) { |
||||
if (XXPermissions.isGranted(this, Permission.MANAGE_EXTERNAL_STORAGE)) { |
||||
if (!isImport) { |
||||
export(); |
||||
} else { |
||||
importContent(); |
||||
} |
||||
} else { |
||||
ToastUtils.showLong(getString(R.string.open_read_write_permissions)); |
||||
} |
||||
} |
||||
} |
||||
|
||||
private void ExportKml() { |
||||
ThreadPoolUtil.execute(() -> { |
||||
List<PointSurveyRecord> pointSurveyRecordList = pointBaseRecordList2Export(); |
||||
ThreadPoolUtil.executeInMain(new Runnable() { |
||||
@Override |
||||
public void run() { |
||||
if (pointSurveyRecordList != null && pointSurveyRecordList.size() > 0) { |
||||
String txtContentHead = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + |
||||
"<kml xmlns=\"http://www.opengis.net/kml/2.2\">\n" + |
||||
"<Document>\n" + |
||||
"<name>" + currentProject.currentProject().name + "</name>\n" + |
||||
"\t<open>1</open>\n" + |
||||
"\t<Style id=\"khStyle\">\n" + |
||||
"\t<IconStyle>\n" + |
||||
"\t<scale>0.6</scale>\n" + |
||||
"\t<Icon><href>http://maps.google.com/mapfiles/kml/shapes/donut.png</href></Icon>\n" + |
||||
"\t</IconStyle>\n" + |
||||
"\t<LabelStyle>\n" + |
||||
"\t<scale>0.7</scale>\n" + |
||||
"\t</LabelStyle>\n" + |
||||
"\t</Style>"; |
||||
|
||||
for (int i = 0; i < pointSurveyRecordList.size(); i++) { |
||||
txtContent += "<Placemark>\n" + |
||||
"\t<name>" + pointSurveyRecordList.get(i).pointName + "</name>\n" + |
||||
"\t<styleUrl>#khStyle</styleUrl>\n" + |
||||
"\t<Style>\n" + |
||||
"\t<IconStyle>\n" + |
||||
"\t<color>ff000000</color>\n" + |
||||
"\t</IconStyle>\n" + |
||||
"\t</Style>\n" + |
||||
"\t<Point>\n" + |
||||
"\t<coordinates>\n" + |
||||
"\t" + pointSurveyRecordList.get(i).planeN + "," + pointSurveyRecordList.get(i).planeE + "," + pointSurveyRecordList.get(i).altitude + "\n" + |
||||
"\t</coordinates>\n" + |
||||
"\t</Point>\n" + |
||||
"\t</Placemark>"; |
||||
} |
||||
|
||||
String txtContentFoot = "</Document>\n" + |
||||
"</kml>"; |
||||
|
||||
TxtUtil.exportFormat(ResultsTheExportActivity.this, txtContentHead + txtContent + txtContentFoot, FormatSuffixesUtils.formatKML, currentProject); |
||||
} else { |
||||
ToastUtils.showShort(getString(R.string.no_exportable_data)); |
||||
} |
||||
} |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
private void ExportDxf() { |
||||
ThreadPoolUtil.execute(() -> { |
||||
List<PointSurveyRecord> pointSurveyRecordList = pointBaseRecordList2Export(); |
||||
ThreadPoolUtil.executeInMain(new Runnable() { |
||||
@Override |
||||
public void run() { |
||||
if (pointSurveyRecordList != null && pointSurveyRecordList.size() > 0) { |
||||
DxfUtil.exportFormat(ResultsTheExportActivity.this, currentProject, pointSurveyRecordList); |
||||
} else { |
||||
ToastUtils.showShort(getString(R.string.no_exportable_data)); |
||||
} |
||||
} |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
private void ExportCassCsvTxt(String formatDat) { |
||||
ThreadPoolUtil.execute(new Runnable() { |
||||
@Override |
||||
public void run() { |
||||
CoordinateSystem coordinateSystem = CachedCurrentCoordinateSystem.currentCoordinateSystem(); |
||||
List<PointSurveyRecord> pointBaseRecordList = pointBaseRecordList2Export(); |
||||
ThreadPoolUtil.executeInMain(new Runnable() { |
||||
@Override |
||||
public void run() { |
||||
CassCsvTxtExportUtil.exportFormat(ResultsTheExportActivity.this, formatDat, currentProject, formatRecordList.get(defPosition), pointBaseRecordList, coordinateSystem); |
||||
} |
||||
}); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
private List<PointSurveyRecord> pointBaseRecordList2Export() { |
||||
if (selectedPoints.isEmpty()) { |
||||
String jobId = IntentUtil.stringExtra(getIntent(), KEY_JOB_ID); |
||||
String filterName = IntentUtil.stringExtra(getIntent(), KEY_NAME); |
||||
String filterCode = IntentUtil.stringExtra(getIntent(), KEY_CODE); |
||||
String filterRemark = IntentUtil.stringExtra(getIntent(), KEY_REMARK); |
||||
Date filterStart = new Date(IntentUtil.longExtra(getIntent(), KEY_START_DATE)); |
||||
Date filterEnd = new Date(IntentUtil.longExtra(getIntent(), KEY_END_DATE)); |
||||
List<PointRecord> results = PointDb.getInstance().rawQueryListData(PointConstants.findPointSurveyByJobNameCodeRemarkDate(jobId, filterName, filterCode, filterRemark, filterStart, filterEnd)); |
||||
if (results != null) { |
||||
for (int i = 0; i < results.size(); i++) { |
||||
PointRecord pointRecord = results.get(i); |
||||
if (pointRecord == null) { |
||||
continue; |
||||
} |
||||
PointSurveyRecord pointSurveyRecord = new PointSurveyRecord(pointRecord); |
||||
pointSurveyRecord.pointId = pointRecord.id; |
||||
pointSurveyRecord.pointName = pointRecord.name; |
||||
pointSurveyRecord.code = pointRecord.code; |
||||
pointSurveyRecord.planeN = pointRecord.x; |
||||
pointSurveyRecord.planeE = pointRecord.y; |
||||
pointSurveyRecord.planeH = pointRecord.h; |
||||
pointSurveyRecord.latitude = pointRecord.latitude; |
||||
pointSurveyRecord.longitude = pointRecord.longitude; |
||||
pointSurveyRecord.altitude = pointRecord.altitude; |
||||
pointSurveyRecord.originalLatitude = pointRecord.originalLatitude; |
||||
pointSurveyRecord.originalLongitude = pointRecord.originalLongitude; |
||||
pointSurveyRecord.originalAltitude = pointRecord.originalAltitude; |
||||
pointSurveyRecord.remarks = pointRecord.remarks; |
||||
pointSurveyRecord.createdAt = pointRecord.createDate; |
||||
if (pointRecord.deviceInfoData.rtkStatusData == null && pointRecord.deviceInfoData.deprecatedDeviceData == null) { |
||||
pointSurveyRecord.solutionState = ""; |
||||
} else if (pointRecord.deviceInfoData.rtkStatusData != null) { |
||||
pointSurveyRecord.solutionState = pointRecord.deviceInfoData.rtkStatusData.solutionState; |
||||
} else { |
||||
pointSurveyRecord.solutionState = pointRecord.deviceInfoData.deprecatedDeviceData.solutionState; |
||||
} |
||||
if (pointRecord.deviceInfoData.rtkStatusData != null) { |
||||
pointSurveyRecord.satelliteNum = pointRecord.deviceInfoData.rtkStatusData.satSolutionNum; |
||||
} else { |
||||
if (pointRecord.deviceInfoData.deprecatedDeviceData == null) { |
||||
pointSurveyRecord.satelliteNum = -1; |
||||
} else { |
||||
if (!StringUtil.isEmpty(pointRecord.deviceInfoData.deprecatedDeviceData.satellite)) { |
||||
pointSurveyRecord.satelliteNum = Integer.parseInt(pointRecord.deviceInfoData.deprecatedDeviceData.satellite); |
||||
} else { |
||||
pointSurveyRecord.satelliteNum = -1; |
||||
} |
||||
} |
||||
} |
||||
pointSurveyRecord.satelliteTrackNum = pointRecord.deviceInfoData.rtkStatusData != null ? pointRecord.deviceInfoData.rtkStatusData.satTrackNum : -1; |
||||
if (pointRecord.deviceInfoData.rtkStatusData != null) { |
||||
pointSurveyRecord.pdop = pointRecord.deviceInfoData.rtkStatusData.pdop; |
||||
} else { |
||||
if (pointRecord.deviceInfoData.deprecatedDeviceData == null) { |
||||
pointSurveyRecord.pdop = -1; |
||||
} else { |
||||
if (!StringUtil.isEmpty(pointRecord.deviceInfoData.deprecatedDeviceData.pdop)) { |
||||
pointSurveyRecord.pdop = Double.parseDouble(pointRecord.deviceInfoData.deprecatedDeviceData.pdop); |
||||
} else { |
||||
pointSurveyRecord.pdop = -1; |
||||
} |
||||
} |
||||
} |
||||
if (pointRecord.deviceInfoData.rtkStatusData != null) { |
||||
pointSurveyRecord.hrms = pointRecord.deviceInfoData.rtkStatusData.hrms; |
||||
} else { |
||||
if (pointRecord.deviceInfoData.deprecatedDeviceData == null) { |
||||
pointSurveyRecord.hrms = -1; |
||||
} else { |
||||
if (!StringUtil.isEmpty(pointRecord.deviceInfoData.deprecatedDeviceData.hrms)) { |
||||
pointSurveyRecord.hrms = Double.parseDouble(pointRecord.deviceInfoData.deprecatedDeviceData.hrms); |
||||
} else { |
||||
pointSurveyRecord.hrms = -1; |
||||
} |
||||
} |
||||
} |
||||
if (pointRecord.deviceInfoData.rtkStatusData != null) { |
||||
pointSurveyRecord.vrms = pointRecord.deviceInfoData.rtkStatusData.vrms; |
||||
} else { |
||||
if (pointRecord.deviceInfoData.deprecatedDeviceData == null) { |
||||
pointSurveyRecord.vrms = -1; |
||||
} else { |
||||
if (!StringUtil.isEmpty(pointRecord.deviceInfoData.deprecatedDeviceData.vrms)) { |
||||
pointSurveyRecord.vrms = Double.parseDouble(pointRecord.deviceInfoData.deprecatedDeviceData.vrms); |
||||
} else { |
||||
pointSurveyRecord.vrms = -1; |
||||
} |
||||
} |
||||
} |
||||
if (pointRecord.deviceInfoData.rtkStatusData != null) { |
||||
pointSurveyRecord.diffAge = pointRecord.deviceInfoData.rtkStatusData.diffAge; |
||||
} else { |
||||
if (pointRecord.deviceInfoData.deprecatedDeviceData == null) { |
||||
pointSurveyRecord.diffAge = -1; |
||||
} else { |
||||
if (!StringUtil.isEmpty(pointRecord.deviceInfoData.deprecatedDeviceData.diffAge)) { |
||||
pointSurveyRecord.diffAge = Double.parseDouble(pointRecord.deviceInfoData.deprecatedDeviceData.diffAge); |
||||
} else { |
||||
pointSurveyRecord.diffAge = -1; |
||||
} |
||||
} |
||||
} |
||||
pointSurveyRecord.isTiltEnable = pointRecord.deviceInfoData.rtkStatusData != null && pointRecord.deviceInfoData.rtkStatusData.isTiltEnable; |
||||
if (pointRecord.deviceInfoData.rtkStatusData != null) { |
||||
pointSurveyRecord.antennaHeight = pointRecord.deviceInfoData.rtkStatusData.poleHeight; |
||||
} else { |
||||
if (pointRecord.deviceInfoData.deprecatedDeviceData == null) { |
||||
pointSurveyRecord.antennaHeight = -1; |
||||
} else { |
||||
if (!StringUtil.isEmpty(pointRecord.deviceInfoData.deprecatedDeviceData.hr)) { |
||||
pointSurveyRecord.antennaHeight = Double.parseDouble(pointRecord.deviceInfoData.deprecatedDeviceData.hr); |
||||
} else { |
||||
pointSurveyRecord.antennaHeight = -1; |
||||
} |
||||
} |
||||
} |
||||
selectedPoints.add(pointSurveyRecord); |
||||
} |
||||
} |
||||
} |
||||
return selectedPoints; |
||||
} |
||||
|
||||
@Override |
||||
protected void initData() { |
||||
ThreadPoolUtil.execute(new Runnable() { |
||||
@Override |
||||
public void run() { |
||||
formatRecordList = RecordsFixedDataBase.getInstance().formatRecordDao().findAll(); |
||||
ThreadPoolUtil.executeInMain(new Runnable() { |
||||
@Override |
||||
public void run() { |
||||
if (formatRecordList != null && formatRecordList.size() > 0) { |
||||
uid = formatRecordList.get(defPosition).id; |
||||
} else { |
||||
uid = ""; |
||||
} |
||||
|
||||
FormatRecord formatRecordCass = new FormatRecord(); |
||||
formatRecordCass.id = ""; |
||||
formatRecordCass.format_name = "Cass"; |
||||
formatRecordCass.format_content = "点名,编码,东坐标,北坐标,高程"; |
||||
formatRecordCass.divided_symbols = ","; |
||||
formatRecordCass.file_suffix = 1; |
||||
formatRecordCass.file_header = false; |
||||
formatRecordCass.angle_format = 0; |
||||
formatRecordList.add(0, formatRecordCass); |
||||
|
||||
FormatRecord formatRecordPlane = new FormatRecord(); |
||||
formatRecordPlane.id = ""; |
||||
formatRecordPlane.format_name = getString(R.string.plane_coordinate); |
||||
formatRecordPlane.format_content = "点名,北坐标,东坐标,高程,编码"; |
||||
formatRecordPlane.divided_symbols = ","; |
||||
formatRecordPlane.file_suffix = 3; |
||||
formatRecordPlane.file_header = false; |
||||
formatRecordPlane.angle_format = 0; |
||||
formatRecordList.add(1, formatRecordPlane); |
||||
|
||||
FormatRecord formatRecordLatLon = new FormatRecord(); |
||||
formatRecordLatLon.id = ""; |
||||
formatRecordLatLon.format_name = getString(R.string.lat_lon_coordinate); |
||||
formatRecordLatLon.format_content = "点名,纬度,经度,大地高,编码"; |
||||
formatRecordLatLon.divided_symbols = ","; |
||||
formatRecordLatLon.file_suffix = 3; |
||||
formatRecordLatLon.file_header = false; |
||||
formatRecordLatLon.angle_format = 0; |
||||
formatRecordList.add(2, formatRecordLatLon); |
||||
|
||||
FormatRecord formatRecordDxf = new FormatRecord(); |
||||
formatRecordDxf.id = ""; |
||||
formatRecordDxf.format_name = "dxf"; |
||||
formatRecordDxf.format_content = "点名,经度,纬度,大地高"; |
||||
formatRecordDxf.divided_symbols = ","; |
||||
formatRecordDxf.file_suffix = 4; |
||||
formatRecordDxf.file_header = false; |
||||
formatRecordDxf.angle_format = 0; |
||||
formatRecordList.add(3, formatRecordDxf); |
||||
|
||||
FormatRecord formatRecordKml = new FormatRecord(); |
||||
formatRecordKml.id = ""; |
||||
formatRecordKml.format_name = "google kml"; |
||||
formatRecordKml.format_content = "点名,北坐标,东坐标,高程"; |
||||
formatRecordKml.divided_symbols = ","; |
||||
formatRecordKml.file_suffix = 5; |
||||
formatRecordKml.file_header = false; |
||||
formatRecordKml.angle_format = 0; |
||||
formatRecordList.add(4, formatRecordKml); |
||||
|
||||
FormatRecord formatRecordAllCsv = new FormatRecord(); |
||||
formatRecordAllCsv.id = ""; |
||||
formatRecordAllCsv.format_name = getString(R.string.format_original_data); |
||||
formatRecordAllCsv.format_content = "点名,编码,纬度,经度,大地高,天线类型,天线高,北坐标,东坐标,高程,解状态,解算卫星,可见卫星,PDOP,HRMS,VRMS,差分延迟,备注,采集时间,惯导测量"; |
||||
formatRecordAllCsv.divided_symbols = ","; |
||||
formatRecordAllCsv.file_suffix = 3; |
||||
formatRecordAllCsv.file_header = false; |
||||
formatRecordAllCsv.angle_format = 0; |
||||
formatRecordList.add(5, formatRecordAllCsv); |
||||
|
||||
adapter = new ResultsExportAdapter(ResultsTheExportActivity.this, formatRecordList, defPosition); |
||||
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(ResultsTheExportActivity.this); |
||||
linearLayoutManager.setOrientation(VERTICAL); |
||||
binding.recyclerView.setLayoutManager(linearLayoutManager); |
||||
binding.recyclerView.setAdapter(adapter); |
||||
|
||||
adapter.setOnClickListener(new ResultsExportAdapter.OnItemClickListener() { |
||||
@Override |
||||
public void OnItemClick(int position) { |
||||
defPosition = position; |
||||
uid = formatRecordList.get(position).id; |
||||
} |
||||
}); |
||||
} |
||||
}); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
public final ActivityResultLauncher<Intent> launcher = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), result -> { |
||||
if (result != null) { |
||||
switch (result.getResultCode()) { |
||||
case LauncherEvent.launcher_results_export: |
||||
FormatRecord formatRecord = new Gson().fromJson(result.getData().getStringExtra(ConstUtils.intentConst.keyResultFormatRecord), FormatRecord.class); |
||||
if (result.getData().getBooleanExtra(ConstUtils.intentConst.keyIsNewCreateResultFormat, false)) { |
||||
formatRecordList.add(formatRecord); |
||||
if (formatRecordList != null && formatRecordList.size() > 0) { |
||||
adapter.setUpdateList(formatRecordList.size() - 1, formatRecordList); |
||||
defPosition = formatRecordList.size() - 1; |
||||
} else { |
||||
adapter.setUpdateList(0, formatRecordList); |
||||
defPosition = 0; |
||||
} |
||||
uid = formatRecord.id; |
||||
} else { |
||||
formatRecordList.set(defPosition, formatRecord); |
||||
adapter.setUpdateList(defPosition, formatRecordList); |
||||
} |
||||
break; |
||||
} |
||||
} |
||||
}); |
||||
|
||||
/** |
||||
* 根据成果导出的格式,经纬度进行转换导出 |
||||
* |
||||
* @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); |
||||
} |
||||
} |
||||
|
||||
private final static String KEY_JOB_ID = "JOBID"; |
||||
private final static String KEY_NAME = "KEYNAME"; |
||||
private final static String KEY_CODE = "KEYCODE"; |
||||
private final static String KEY_REMARK = "KEYREMARK"; |
||||
private final static String KEY_START_DATE = "KEYSTARTDATE"; |
||||
private final static String KEY_END_DATE = "KEYENDDATE"; |
||||
|
||||
public static void start(Context context, String title, Boolean isImport, String name, String code, String remark, Date startDate, Date endDate) { |
||||
ThreadPoolUtil.execute(() -> { |
||||
String jobId = CachedCurrentJob.currentJobId(CachedProject.currentProjectId()); |
||||
Intent intent = new Intent(context, ResultsTheExportActivity.class); |
||||
intent.putExtra(ConstUtils.intentConst.keyActivityTitleName, title); |
||||
intent.putExtra(ConstUtils.intentConst.keyIsImport, isImport); |
||||
intent.putExtra(KEY_JOB_ID, jobId); |
||||
intent.putExtra(KEY_NAME, name); |
||||
intent.putExtra(KEY_CODE, code); |
||||
intent.putExtra(KEY_REMARK, remark); |
||||
intent.putExtra(KEY_START_DATE, startDate == null ? null : startDate.getTime()); |
||||
intent.putExtra(KEY_END_DATE, endDate == null ? SystemUtils.getSimpleDateTimeStamp() : endDate.getTime()); |
||||
context.startActivity(intent); |
||||
}); |
||||
} |
||||
} |
@ -0,0 +1,13 @@ |
||||
package com.project.survey.ui.instrument.setupstation; |
||||
|
||||
import com.bingce.device.ui.totalstation.AbstractSetupStationCurrentActivity; |
||||
import com.project.survey.App; |
||||
|
||||
import blankj.utilcode.util.Utils; |
||||
|
||||
public class SetupStationCurrentActivity extends AbstractSetupStationCurrentActivity { |
||||
@Override |
||||
protected boolean isThemeDark() { |
||||
return ((App) Utils.getApp()).isThemeDark; |
||||
} |
||||
} |
@ -0,0 +1,73 @@ |
||||
package com.project.survey.ui.instrument.setupstation; |
||||
|
||||
import com.afollestad.materialdialogs.MaterialDialog; |
||||
import com.bingce.AppChannel; |
||||
import com.bingce.device.ui.totalstation.AbstractSetupStationInputActivity; |
||||
import com.project.survey.App; |
||||
import com.project.survey.R; |
||||
|
||||
|
||||
import blankj.utilcode.util.Utils; |
||||
|
||||
public class SetupStationInputActivity extends AbstractSetupStationInputActivity { |
||||
@Override |
||||
protected void selectPoint() { |
||||
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(name, x, y, z); |
||||
}); |
||||
break; |
||||
case 1: |
||||
StakingNewJobActivity.pickPoint(this, (name, x, y, z) -> { |
||||
onPicked(name, x, y, z); |
||||
}); |
||||
break; |
||||
} |
||||
}).show(); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
protected boolean isThemeDark() { |
||||
return ((App) Utils.getApp()).isThemeDark; |
||||
} |
||||
|
||||
@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(); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,118 @@ |
||||
package com.project.survey.ui.instrument.setupstation; |
||||
|
||||
import android.graphics.Rect; |
||||
import android.view.GestureDetector; |
||||
import android.view.MotionEvent; |
||||
import android.view.View; |
||||
import android.view.ViewGroup; |
||||
|
||||
import androidx.annotation.IdRes; |
||||
import androidx.core.view.GestureDetectorCompat; |
||||
import androidx.recyclerview.widget.RecyclerView; |
||||
|
||||
/** |
||||
* description: recyclerView的单击与长按事件监听器 |
||||
* version: |
||||
* state: done |
||||
*/ |
||||
public class SimpleRecyclerViewItemClickListener extends RecyclerView.SimpleOnItemTouchListener { |
||||
|
||||
private OnItemClickListener mListener; |
||||
private GestureDetectorCompat mGestureDetector; |
||||
private RecyclerView mRecyclerView; |
||||
private int[] ids; |
||||
|
||||
public SimpleRecyclerViewItemClickListener(RecyclerView rv, OnItemClickListener listener, @IdRes int... ids) { |
||||
this.mListener = listener; |
||||
this.mRecyclerView = rv; |
||||
this.ids = ids; |
||||
} |
||||
public SimpleRecyclerViewItemClickListener(RecyclerView rv, OnItemClickListener listener) { |
||||
this.mListener = listener; |
||||
this.mRecyclerView = rv; |
||||
} |
||||
|
||||
@Override |
||||
public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent e) { |
||||
if (mGestureDetector == null) { |
||||
initGestureDetector(mRecyclerView); |
||||
} |
||||
return mGestureDetector.onTouchEvent(e);// 把事件交给GestureDetector处理
|
||||
} |
||||
|
||||
private Rect getRelativeRectTo(RecyclerView recyclerView,View otherView,View view){ |
||||
Rect rootRect = new Rect(); |
||||
recyclerView.getGlobalVisibleRect(rootRect); |
||||
Rect otherRect = new Rect(); |
||||
otherView.getGlobalVisibleRect(otherRect); |
||||
Rect rect = new Rect(); |
||||
view.getGlobalVisibleRect(rect); |
||||
int relativeLeft = rect.left - otherRect.left; |
||||
int relativeTop = rect.top - rootRect.top; |
||||
int relativeRight = relativeLeft + (rect.right - rect.left); |
||||
int relativeBottom = relativeTop + (rect.bottom - rect.top); |
||||
return new Rect(relativeLeft, relativeTop, relativeRight, relativeBottom); |
||||
} |
||||
/** |
||||
* 初始化GestureDetector |
||||
*/ |
||||
private void initGestureDetector(final RecyclerView recyclerView) { |
||||
mGestureDetector = new GestureDetectorCompat(recyclerView.getContext(), new GestureDetector.SimpleOnGestureListener() { // 这里选择SimpleOnGestureListener实现类,可以根据需要选择重写的方法
|
||||
|
||||
/** |
||||
* 单击事件 |
||||
*/ |
||||
@Override |
||||
public boolean onSingleTapUp(MotionEvent e) { |
||||
View childView = recyclerView.findChildViewUnder(e.getX(), e.getY()); |
||||
if (childView != null && mListener != null) { |
||||
if (childView instanceof ViewGroup && ids != null && ids.length != 0) { |
||||
for (int id:ids) { |
||||
if (getRelativeRectTo(recyclerView,childView, childView.findViewById(id)).contains((int) e.getX(), (int) e.getY())) { |
||||
mListener.onItemClick(childView.findViewById(id), recyclerView.getChildLayoutPosition(childView)); |
||||
return false; |
||||
} |
||||
} |
||||
} |
||||
mListener.onItemClick(childView, recyclerView.getChildLayoutPosition(childView)); |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
/** |
||||
* 长按事件 |
||||
*/ |
||||
@Override |
||||
public void onLongPress(MotionEvent e) { |
||||
View childView = recyclerView.findChildViewUnder(e.getX(), e.getY()); |
||||
if (childView != null && mListener != null) { |
||||
if (childView instanceof ViewGroup && ids != null && ids.length != 0) { |
||||
for (int id:ids) { |
||||
if (getRelativeRectTo(recyclerView,childView, childView.findViewById(id)).contains((int) e.getX(), (int) e.getY())) { |
||||
mListener.onItemLongClick(childView.findViewById(id), recyclerView.getChildLayoutPosition(childView)); |
||||
return; |
||||
} |
||||
} |
||||
} |
||||
mListener.onItemLongClick(childView, recyclerView.getChildLayoutPosition(childView)); |
||||
} |
||||
} |
||||
|
||||
}); |
||||
|
||||
} |
||||
|
||||
public interface OnItemClickListener { |
||||
|
||||
/** |
||||
* 当ItemView的单击事件触发时调用 |
||||
*/ |
||||
void onItemClick(View view, int position); |
||||
|
||||
/** |
||||
* 当ItemView的长按事件触发时调用 |
||||
*/ |
||||
default void onItemLongClick(View view, int position){}; |
||||
|
||||
} |
||||
} |
@ -0,0 +1,155 @@ |
||||
package com.project.survey.ui.instrument.setupstation.db; |
||||
|
||||
import androidx.annotation.NonNull; |
||||
import androidx.room.ColumnInfo; |
||||
import androidx.room.PrimaryKey; |
||||
|
||||
import com.bingce.data.surveyor.surveydata.pointsurvey.PointRecord; |
||||
|
||||
import java.util.Date; |
||||
|
||||
public class PointSurveyRecord { |
||||
@PrimaryKey |
||||
@NonNull |
||||
@ColumnInfo(name = "pointId") |
||||
public String pointId; |
||||
|
||||
@ColumnInfo(name = "workId") |
||||
public String workId; |
||||
|
||||
@ColumnInfo(name = "pointType") |
||||
public int pointType; |
||||
|
||||
@ColumnInfo(name = "pointName") |
||||
public String pointName; |
||||
|
||||
@ColumnInfo(name = "format")//坐标格式
|
||||
public int format; |
||||
|
||||
@ColumnInfo(name = "latitude") |
||||
public double latitude; |
||||
|
||||
@ColumnInfo(name = "longitude") |
||||
public double longitude; |
||||
|
||||
@ColumnInfo(name = "altitude") |
||||
public double altitude; |
||||
|
||||
@ColumnInfo(name = "originalLatitude") |
||||
public double originalLatitude; |
||||
|
||||
@ColumnInfo(name = "originalLongitude") |
||||
public double originalLongitude; |
||||
|
||||
@ColumnInfo(name = "originalAltitude") |
||||
public double originalAltitude; |
||||
|
||||
@ColumnInfo(name = "planeN") |
||||
public double planeN; |
||||
|
||||
@ColumnInfo(name = "planeE") |
||||
public double planeE; |
||||
|
||||
@ColumnInfo(name = "planeH") |
||||
public double planeH; |
||||
|
||||
@ColumnInfo(name = "code")//编码
|
||||
public String code; |
||||
|
||||
@ColumnInfo(name = "remarks")//备注
|
||||
public String remarks; |
||||
|
||||
@ColumnInfo(name = "createdAt")//创建或保存时间
|
||||
public Date createdAt; |
||||
|
||||
@ColumnInfo(name = "timeStamp")//时间戳(创建或保存时间)
|
||||
public long timeStamp; |
||||
|
||||
@ColumnInfo(name = "projectId") |
||||
public String projectId; |
||||
|
||||
@ColumnInfo(name = "hr")//棱镜高
|
||||
public double hr; |
||||
|
||||
@ColumnInfo(name = "electricity")//仪器电量
|
||||
public int electricity; |
||||
|
||||
@ColumnInfo(name = "pdop") |
||||
public double pdop; |
||||
|
||||
@ColumnInfo(name = "hrms") |
||||
public double hrms; |
||||
|
||||
@ColumnInfo(name = "vrms") |
||||
public double vrms; |
||||
|
||||
@ColumnInfo(name = "posType")//解状态 id(仪器返回的id)
|
||||
public int posType; |
||||
|
||||
@ColumnInfo(name = "diffAge")//延迟(差分延时)
|
||||
public double diffAge; |
||||
|
||||
@ColumnInfo(name = "sysMode")//系统模式
|
||||
public String sysMode; |
||||
|
||||
@ColumnInfo(name = "isSelect")//是否可选(非必传)
|
||||
public boolean isSelect; |
||||
|
||||
@ColumnInfo(name = "antennaHeight")//天线高度
|
||||
public double antennaHeight; |
||||
|
||||
@ColumnInfo(name = "antennaType")//天线类型id
|
||||
public int antennaType; |
||||
|
||||
@ColumnInfo(name = "antennaTypeName")//天线类型name
|
||||
public String antennaTypeName; |
||||
|
||||
@ColumnInfo(name = "solutionState")//解状态 name(名称)
|
||||
public String solutionState; |
||||
|
||||
@ColumnInfo(name = "satelliteNum")//解算卫星数量
|
||||
public int satelliteNum; |
||||
|
||||
@ColumnInfo(name = "satelliteTrackNum")//可见卫星数量
|
||||
public int satelliteTrackNum; |
||||
|
||||
@ColumnInfo(name = "siteId")//基站id
|
||||
public String siteId; |
||||
|
||||
@ColumnInfo(name = "siteLatitude")//基站纬度
|
||||
public double siteLatitude; |
||||
|
||||
@ColumnInfo(name = "siteLongitude")//基站经度
|
||||
public double siteLongitude; |
||||
|
||||
@ColumnInfo(name = "siteDistance2D")//基站距离(平面)
|
||||
public double siteDistance2D; |
||||
|
||||
@ColumnInfo(name = "isTiltEnable")//惯导是否可用
|
||||
public boolean isTiltEnable; |
||||
|
||||
public final PointRecord record; |
||||
|
||||
public PointSurveyRecord(PointRecord record) { |
||||
this.record = record; |
||||
} |
||||
|
||||
public static PointSurveyRecord convert(PointRecord pointRecord){ |
||||
PointSurveyRecord pointSurveyRecord = new PointSurveyRecord(pointRecord); |
||||
pointSurveyRecord.pointId = pointRecord.id; |
||||
pointSurveyRecord.pointName = pointRecord.name; |
||||
pointSurveyRecord.code = pointRecord.code; |
||||
pointSurveyRecord.remarks = pointRecord.remarks; |
||||
pointSurveyRecord.planeN = pointRecord.x; |
||||
pointSurveyRecord.planeE = pointRecord.y; |
||||
pointSurveyRecord.planeH = pointRecord.h; |
||||
pointSurveyRecord.latitude = pointRecord.latitude; |
||||
pointSurveyRecord.longitude = pointRecord.longitude; |
||||
pointSurveyRecord.altitude = pointRecord.altitude; |
||||
pointSurveyRecord.originalLatitude = pointRecord.originalLatitude; |
||||
pointSurveyRecord.originalLongitude = pointRecord.originalLongitude; |
||||
pointSurveyRecord.originalAltitude = pointRecord.originalAltitude; |
||||
pointSurveyRecord.createdAt = pointRecord.createDate; |
||||
return pointSurveyRecord; |
||||
} |
||||
} |
@ -0,0 +1,49 @@ |
||||
package com.project.survey.ui.instrument.setupstation.db; |
||||
|
||||
import android.content.Context; |
||||
|
||||
import androidx.room.Database; |
||||
import androidx.room.Room; |
||||
import androidx.room.RoomDatabase; |
||||
|
||||
|
||||
import com.project.survey.ui.instrument.setupstation.db.resultformat.FormatRecord; |
||||
import com.project.survey.ui.instrument.setupstation.db.resultformat.FormatRecordDao; |
||||
|
||||
import blankj.utilcode.util.Utils; |
||||
|
||||
@Database(entities = { |
||||
FormatRecord.class |
||||
}, version = 1) |
||||
|
||||
public abstract class RecordsFixedDataBase extends RoomDatabase { |
||||
public static final String DB_NAME = "records_fixed.db"; |
||||
public abstract FormatRecordDao formatRecordDao(); |
||||
|
||||
private static RecordsFixedDataBase instance = null; |
||||
|
||||
public static void reset() { |
||||
synchronized (RecordsFixedDataBase.class) { |
||||
Context applicationContext = Utils.getApp().getApplicationContext(); |
||||
//2.创建数据实例
|
||||
instance = readInstance(applicationContext); |
||||
} |
||||
} |
||||
|
||||
public static RecordsFixedDataBase readInstance(Context context) { |
||||
return Room.databaseBuilder( |
||||
context.getApplicationContext(), |
||||
RecordsFixedDataBase.class, |
||||
DB_NAME) |
||||
.enableMultiInstanceInvalidation() |
||||
.fallbackToDestructiveMigrationOnDowngrade() |
||||
.build(); |
||||
} |
||||
|
||||
public static RecordsFixedDataBase getInstance() { |
||||
if (instance == null) { |
||||
reset(); |
||||
} |
||||
return instance; |
||||
} |
||||
} |
@ -0,0 +1,5 @@ |
||||
package com.project.survey.ui.instrument.setupstation.db.resultformat; |
||||
|
||||
public class FormatConstants { |
||||
public static final String DB_NAME = "LocalResultExportFormat"; |
||||
} |
@ -0,0 +1,38 @@ |
||||
package com.project.survey.ui.instrument.setupstation.db.resultformat; |
||||
|
||||
import androidx.annotation.NonNull; |
||||
import androidx.room.ColumnInfo; |
||||
import androidx.room.Entity; |
||||
import androidx.room.PrimaryKey; |
||||
import androidx.room.TypeConverters; |
||||
|
||||
import com.bingce.data.converter.DateConverter; |
||||
|
||||
@Entity(tableName = FormatConstants.DB_NAME) |
||||
@TypeConverters(DateConverter.class) |
||||
public class FormatRecord { |
||||
|
||||
@PrimaryKey |
||||
@NonNull |
||||
@ColumnInfo(name = "id") |
||||
public String id; |
||||
|
||||
@ColumnInfo(name = "format_name") |
||||
public String format_name; |
||||
|
||||
@ColumnInfo(name = "format_content") |
||||
public String format_content; |
||||
|
||||
@ColumnInfo(name = "divided_symbols") |
||||
public String divided_symbols; |
||||
|
||||
@ColumnInfo(name = "file_suffix") |
||||
public int file_suffix; |
||||
|
||||
@ColumnInfo(name = "file_header") |
||||
public boolean file_header; |
||||
|
||||
@ColumnInfo(name = "angle_format") |
||||
public int angle_format; |
||||
|
||||
} |
@ -0,0 +1,27 @@ |
||||
package com.project.survey.ui.instrument.setupstation.db.resultformat; |
||||
|
||||
import androidx.room.Dao; |
||||
import androidx.room.Insert; |
||||
import androidx.room.OnConflictStrategy; |
||||
import androidx.room.Query; |
||||
|
||||
import java.util.List; |
||||
|
||||
@Dao |
||||
public interface FormatRecordDao { |
||||
|
||||
@Query("SELECT * FROM " + FormatConstants.DB_NAME) |
||||
List<FormatRecord> findAll(); |
||||
|
||||
@Query("SELECT * FROM " + FormatConstants.DB_NAME + " ORDER BY id DESC") |
||||
List<FormatRecord> findDescAll(); |
||||
|
||||
@Query("SELECT * FROM " + FormatConstants.DB_NAME + " WHERE id=:id") |
||||
FormatRecord findById(String id); |
||||
|
||||
@Query("DELETE FROM " + FormatConstants.DB_NAME + " WHERE id=:id") |
||||
void deleteById(String id); |
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE) |
||||
void save(FormatRecord record); |
||||
} |
@ -0,0 +1,440 @@ |
||||
package com.project.survey.util; |
||||
|
||||
import android.content.Context; |
||||
import android.graphics.Bitmap; |
||||
import android.graphics.Canvas; |
||||
import android.graphics.Color; |
||||
import android.graphics.DashPathEffect; |
||||
import android.graphics.Rect; |
||||
import android.text.TextUtils; |
||||
import android.view.View; |
||||
|
||||
import com.bingce.chart.ChartViewUtils; |
||||
import com.bingce.coordlib.model.Coordinate; |
||||
import com.bingce.data.surveyor.surveydata.pointsurvey.PointConstants; |
||||
import com.bingce.data.surveyor.surveydata.pointsurvey.PointRecord; |
||||
import com.bingce.utils.FileUtil; |
||||
import com.bingce.utils.PointUtils; |
||||
import com.bingce.utils.SoftKeyUtils; |
||||
import com.google.gson.Gson; |
||||
import com.google.gson.JsonArray; |
||||
import com.google.gson.JsonElement; |
||||
import com.google.gson.JsonParser; |
||||
|
||||
import java.io.BufferedInputStream; |
||||
import java.io.BufferedReader; |
||||
import java.io.ByteArrayInputStream; |
||||
import java.io.ByteArrayOutputStream; |
||||
import java.io.File; |
||||
import java.io.FileInputStream; |
||||
import java.io.IOException; |
||||
import java.io.InputStream; |
||||
import java.io.InputStreamReader; |
||||
import java.util.ArrayList; |
||||
import java.util.Date; |
||||
import java.util.List; |
||||
|
||||
import blankj.utilcode.util.ActivityUtils; |
||||
import blankj.utilcode.util.ToastUtils; |
||||
import blankj.utilcode.util.Utils; |
||||
import cn.liuyanbing.surveyor.model.base.BasePoint; |
||||
import cn.liuyanbing.surveyor.model.base.Road; |
||||
import cn.liuyanbing.surveyor.model.horizontalcurve.JDCurveElement; |
||||
import cn.liuyanbing.surveyor.model.horizontalcurve.JDElement; |
||||
import cn.liuyanbing.surveyor.model.horizontalcurve.JDFiveCurveElement; |
||||
import cn.liuyanbing.surveyor.model.horizontalcurve.XJDCurveElement; |
||||
import cn.liuyanbing.surveyor.model.horizontalcurve.XYCurveElement; |
||||
|
||||
public class CommonUtils { |
||||
|
||||
/** |
||||
* 隐藏软键盘 |
||||
*/ |
||||
public static void hideSoftInput() { |
||||
SoftKeyUtils.hideSoftKey(ActivityUtils.getTopActivity()); |
||||
} |
||||
|
||||
/** |
||||
* 创建文件在路径下 |
||||
* |
||||
* @param path 路径{方法中包含sd卡路径} |
||||
* @param filename 文件名称 |
||||
*/ |
||||
public static File createMkdirsAndFiles(String path, String filename) { |
||||
if (TextUtils.isEmpty(path)) { |
||||
throw new RuntimeException("路径不能为空"); |
||||
} |
||||
path = FileUtil.getSDPath() + File.separator + path; |
||||
File file = new File(path); |
||||
if (!file.exists()) { |
||||
try { |
||||
file.mkdirs(); |
||||
} catch (Exception e) { |
||||
throw new RuntimeException("创建文件夹失败"); |
||||
} |
||||
} |
||||
File file1 = new File(file, filename); |
||||
if (!file1.exists()) { |
||||
try { |
||||
file1.createNewFile(); |
||||
} catch (IOException e) { |
||||
throw new RuntimeException("创建文件失败"); |
||||
} |
||||
} |
||||
return file1; |
||||
} |
||||
|
||||
// /**
|
||||
// * 移动文件
|
||||
// *
|
||||
// * @param oldFile 待移动文件
|
||||
// * @param nDir 新目录
|
||||
// * @param nName 新文件名称
|
||||
// */
|
||||
// public static boolean moveFileTo(File oldFile, String nDir, String nName) {
|
||||
// if (oldFile == null) {
|
||||
// ToastUtils.showShort("移动文件不存在-0");
|
||||
// return false;
|
||||
// }
|
||||
// if (!oldFile.exists()) {
|
||||
// ToastUtils.showShort("移动文件不存在-1");
|
||||
// return false;
|
||||
// }
|
||||
// File fileDir = new File(FileUtil.getSDPath() + File.separator + nDir);
|
||||
// if (!fileDir.exists()) {
|
||||
// fileDir.mkdirs();
|
||||
// }
|
||||
// return oldFile.renameTo(new File(fileDir, nName));
|
||||
// }
|
||||
|
||||
|
||||
/** |
||||
* 将view转化为bitmap |
||||
*/ |
||||
public static Bitmap view2Bitmap(View view) { |
||||
int w = view.getWidth(); |
||||
int h = view.getHeight(); |
||||
Bitmap bmp = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888); |
||||
Canvas canvas = new Canvas(bmp); |
||||
canvas.drawColor(Color.WHITE); |
||||
view.layout(0, 0, w, h); |
||||
view.draw(canvas); |
||||
return bmp; |
||||
} |
||||
|
||||
/** |
||||
* 将bitmap转化为数据流 |
||||
* |
||||
* @return 生成的图片压缩20% |
||||
*/ |
||||
public static InputStream bitmap2InputStream(Bitmap bitmap) { |
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
||||
bitmap.compress(Bitmap.CompressFormat.PNG, 80, baos); |
||||
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); |
||||
return bais; |
||||
} |
||||
|
||||
/** |
||||
* 获取数据对象 |
||||
*/ |
||||
public static <T> List<T> mJson2Lists(String content, Class<T> cls) { |
||||
List<T> list = new ArrayList<>(); |
||||
String json = content; |
||||
if (!TextUtils.isEmpty(json)) { |
||||
Gson gson = new Gson(); |
||||
JsonArray array = new JsonParser().parse(json).getAsJsonArray(); |
||||
for (JsonElement elem : array) { |
||||
list.add(gson.fromJson(elem, cls)); |
||||
} |
||||
} |
||||
return list; |
||||
} |
||||
|
||||
/** |
||||
* 数据转换为json格式 |
||||
*/ |
||||
public static <T> String mLists2Json(List<T> datalist) { |
||||
String result; |
||||
if (null == datalist || datalist.size() <= 0) { |
||||
result = ""; |
||||
} else { |
||||
Gson gson = new Gson(); |
||||
//转换成json数据,再保存
|
||||
result = gson.toJson(datalist); |
||||
} |
||||
return result; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 导入exl文件 |
||||
* |
||||
* @param remarks 备注 |
||||
* @param file 文件路径 |
||||
*/ |
||||
public static List<PointRecord> importExl(Context context, String projectId, String jobId, String roadId, String remarks, File file) { |
||||
long time = new Date().getTime(); |
||||
List<PointRecord> records = new ArrayList<>(); |
||||
int line = 0; |
||||
try { |
||||
List<List<String>> iResult = ExcelReadHelper.excelRead(file, ExcelReadHelper.FIRST_ROW_NOT_IGNORE); |
||||
if (iResult == null || iResult.isEmpty()) { |
||||
return null; |
||||
} |
||||
for (int i = 0; i < iResult.size(); i++) { |
||||
List<String> row = iResult.get(i); |
||||
line = i + 1; |
||||
if (row.isEmpty() || ExcelReadHelper.isRowEmpty(row) || row.size() < 3) |
||||
continue; |
||||
if (row.size() == 3) { |
||||
PointRecord record = new PointRecord(projectId, jobId, roadId, |
||||
PointConstants.POINT_TYPE_SURVEY_AREA, line + "", line + "" |
||||
, remarks == null ? context.getString(R.string.record_none) : remarks |
||||
, Double.parseDouble(row.get(0)), Double.parseDouble(row.get(1)), Double.parseDouble(row.get(2)), 0, 0, 0 |
||||
, PointConstants.POINT_FORMAT_XYZ, null); |
||||
record.createDate = new Date(time + i); |
||||
records.add(record); |
||||
} |
||||
if (row.size() == 4) { |
||||
PointRecord record = new PointRecord(projectId, jobId, roadId, |
||||
PointConstants.POINT_TYPE_SURVEY_AREA, row.get(0), row.get(0) |
||||
, remarks == null ? context.getString(R.string.record_none) : remarks |
||||
, Double.parseDouble(row.get(1)), Double.parseDouble(row.get(2)), Double.parseDouble(row.get(3)), 0, 0, 0 |
||||
, PointConstants.POINT_FORMAT_XYZ, null); |
||||
record.createDate = new Date(time + i); |
||||
records.add(record); |
||||
} |
||||
} |
||||
ToastUtils.showLong(file.getAbsolutePath() + ",导入成功"); |
||||
return records; |
||||
} catch (Exception e) { |
||||
ToastUtils.showLong(file.getAbsolutePath() + ",导入失败.Error:第" + line + "行,数据格式有误.可能存在非数组坐标"); |
||||
e.printStackTrace(); |
||||
return null; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 导入txt文件 |
||||
* |
||||
* @param context 上下文 |
||||
* @param jobId 作业Id |
||||
* @param remarks 备注 |
||||
* @param file 文件 |
||||
*/ |
||||
public static List<PointRecord> importTxt(Context context, String projectId, String jobId, String roadId, String remarks, File file) { |
||||
long time = new Date().getTime(); |
||||
List<PointRecord> records = new ArrayList<>(); |
||||
String result = null; |
||||
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())) { |
||||
continue; |
||||
} |
||||
a = a.replaceAll("(^[\u0020\u0009\u3000]*)|([\u0020\u0009\u3000]*$)", "");// 删除首尾空格、制表及全角空格
|
||||
String[] arr = a.split(","); |
||||
if (arr.length < 3) { |
||||
result = file.getAbsolutePath() + ",导入失败,原因:第" + line + "行,元素个数不能少于4个"; |
||||
continue; |
||||
} |
||||
if (arr.length == 3) { |
||||
PointRecord record = new PointRecord(projectId, jobId, roadId, |
||||
PointConstants.POINT_TYPE_SURVEY_AREA, line + "", line + "" |
||||
, remarks == null ? context.getString(R.string.record_none) : remarks |
||||
, Double.parseDouble(arr[0]), Double.parseDouble(arr[1]), Double.parseDouble(arr[2]), 0, 0, 0 |
||||
, PointConstants.POINT_FORMAT_XYZ, null); |
||||
record.createDate = new Date(time++); |
||||
records.add(record); |
||||
} |
||||
if (arr.length == 4) { |
||||
PointRecord record = new PointRecord(projectId, jobId, roadId, |
||||
PointConstants.POINT_TYPE_SURVEY_AREA, arr[0], arr[0] |
||||
, remarks == null ? context.getString(R.string.record_none) : remarks |
||||
, Double.parseDouble(arr[1]), Double.parseDouble(arr[2]), Double.parseDouble(arr[3]), 0, 0, 0 |
||||
, PointConstants.POINT_FORMAT_XYZ, null); |
||||
record.createDate = new Date(time++); |
||||
records.add(record); |
||||
} |
||||
} |
||||
if (result != null) |
||||
ToastUtils.showLong(result); |
||||
return records; |
||||
} catch (NumberFormatException e) { |
||||
result = file.getAbsolutePath() + ",导入失败,原因:第" + line + "行,发现非数字字符串"; |
||||
ToastUtils.showLong(result); |
||||
e.printStackTrace(); |
||||
return null; |
||||
} catch (IOException e) { |
||||
e.printStackTrace(); |
||||
return null; |
||||
} 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(); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* huo |
||||
* |
||||
* @param startK |
||||
* @param endK |
||||
* @return |
||||
*/ |
||||
public static List<Double> getMainPoints(Road currentRoad, double startK, double endK) { |
||||
List<Double> mainPoints = new ArrayList<>(); |
||||
if (currentRoad.isUseJD()) { |
||||
for (int i = 0; i < currentRoad.getJdHorList().size(); i++) { |
||||
JDElement jde = currentRoad.getJdHorList().get(i); |
||||
if (jde.isCurveElement()) { |
||||
JDCurveElement curveElement = JDCurveElement.dynamic_cast(jde); |
||||
if (curveElement.getZHK() >= startK && curveElement.getZHK() <= endK) { |
||||
mainPoints.add(curveElement.getZHK()); |
||||
} |
||||
if (curveElement.getHYK() >= startK && curveElement.getHYK() <= endK) { |
||||
mainPoints.add(curveElement.getHYK()); |
||||
} |
||||
if (curveElement.getQZK() >= startK && curveElement.getQZK() <= endK) { |
||||
mainPoints.add(curveElement.getQZK()); |
||||
} |
||||
if (curveElement.getYHK() >= startK && curveElement.getYHK() <= endK) { |
||||
mainPoints.add(curveElement.getYHK()); |
||||
} |
||||
if (curveElement.getHZK() >= startK && curveElement.getHZK() <= endK) { |
||||
mainPoints.add(curveElement.getHZK()); |
||||
} |
||||
} else if (jde.isFiveCurveElement()) { |
||||
JDFiveCurveElement fiveCurveElement = JDFiveCurveElement.dynamic_cast(jde); |
||||
if (fiveCurveElement.getZHK() >= startK && fiveCurveElement.getZHK() <= endK) { |
||||
mainPoints.add(fiveCurveElement.getZHK()); |
||||
} |
||||
if (fiveCurveElement.getHYK1() >= startK && fiveCurveElement.getHYK1() <= endK) { |
||||
mainPoints.add(fiveCurveElement.getHYK1()); |
||||
} |
||||
if (fiveCurveElement.getQZK1() >= startK && fiveCurveElement.getQZK1() <= endK) { |
||||
mainPoints.add(fiveCurveElement.getQZK1()); |
||||
} |
||||
if (fiveCurveElement.getYHK1() >= startK && fiveCurveElement.getYHK1() <= endK) { |
||||
mainPoints.add(fiveCurveElement.getYHK1()); |
||||
} |
||||
if (fiveCurveElement.getHYK2() >= startK && fiveCurveElement.getHYK2() <= endK) { |
||||
mainPoints.add(fiveCurveElement.getHYK2()); |
||||
} |
||||
if (fiveCurveElement.getQZK2() >= startK && fiveCurveElement.getQZK2() <= endK) { |
||||
mainPoints.add(fiveCurveElement.getQZK2()); |
||||
} |
||||
if (fiveCurveElement.getYHK2() >= startK && fiveCurveElement.getYHK2() <= endK) { |
||||
mainPoints.add(fiveCurveElement.getYHK2()); |
||||
} |
||||
if (fiveCurveElement.getHZK() >= startK && fiveCurveElement.getHZK() <= endK) { |
||||
mainPoints.add(fiveCurveElement.getHZK()); |
||||
} |
||||
} else if (jde.isXJDCurveElement()) { |
||||
XJDCurveElement xjd = XJDCurveElement.dynamic_cast(jde); |
||||
if (xjd.getZHK() >= startK && xjd.getZHK() <= endK) { |
||||
mainPoints.add(xjd.getZHK()); |
||||
} |
||||
if (xjd.getHYK() >= startK && xjd.getHYK() <= endK) { |
||||
mainPoints.add(xjd.getHYK()); |
||||
} |
||||
if (xjd.getQZK() >= startK && xjd.getQZK() <= endK) { |
||||
mainPoints.add(xjd.getQZK()); |
||||
} |
||||
if (xjd.getYHK() >= startK && xjd.getYHK() <= endK) { |
||||
mainPoints.add(xjd.getYHK()); |
||||
} |
||||
if (xjd.getHZK() >= startK && xjd.getHZK() <= endK) { |
||||
mainPoints.add(xjd.getHZK()); |
||||
} |
||||
} |
||||
} |
||||
} else { |
||||
for (int i = 0; i < currentRoad.getHorList().size(); i++) { |
||||
XYCurveElement ce = currentRoad.getHorList().get(i); |
||||
if (ce.isLineElement()) { |
||||
if (ce.getStartPoint().getK() >= startK && ce.getStartPoint().getK() <= endK) { |
||||
mainPoints.add(ce.getStartPoint().getK()); |
||||
} |
||||
} else if (ce.isInTransCurveElement()) { |
||||
if (ce.getStartPoint().getK() >= startK && ce.getStartPoint().getK() <= endK) { |
||||
mainPoints.add(ce.getStartPoint().getK()); |
||||
} |
||||
} else if (ce.isCircleCurveElement()) { |
||||
if (ce.getStartPoint().getK() >= startK && ce.getStartPoint().getK() <= endK) { |
||||
mainPoints.add(ce.getStartPoint().getK()); |
||||
mainPoints.add((ce.getStartPoint().getK() + ce.getEndPoint().getK()) / 2); |
||||
} |
||||
} else if (ce.isOutTransCurveElement()) { |
||||
if (ce.getStartPoint().getK() >= startK && ce.getStartPoint().getK() <= endK) { |
||||
mainPoints.add(ce.getStartPoint().getK()); |
||||
} |
||||
} else if (ce.isOvateCurveElement()) { |
||||
if (ce.getStartPoint().getK() >= startK && ce.getStartPoint().getK() <= endK) { |
||||
mainPoints.add(ce.getStartPoint().getK()); |
||||
} |
||||
} |
||||
} |
||||
|
||||
} |
||||
return mainPoints; |
||||
} |
||||
|
||||
// public static McGePoint3d wcsToUcs(McGePoint3d point3d) {
|
||||
// return McGePointUtils.wcsToUcs(point3d);
|
||||
// }
|
||||
//
|
||||
// public static McGePoint3d ucsToWcs(McGePoint3d point3d) {
|
||||
// return McGePointUtils.ucsToWcs(point3d);
|
||||
// }
|
||||
|
||||
public static BasePoint toBasePoint(Coordinate coordinate) { |
||||
return PointUtils.toBasePoint(coordinate); |
||||
} |
||||
|
||||
/** |
||||
* dp 转成 px |
||||
* @param dpValue |
||||
* @return |
||||
*/ |
||||
public static int dip2px(float dpValue) { |
||||
final float scale = ((App) Utils.getApp()).getResources().getDisplayMetrics().density; |
||||
return (int) (dpValue * scale + 0.5f); |
||||
} |
||||
|
||||
/** |
||||
* 判断导出文件是否存在 |
||||
* @param filePaths 文件路径 |
||||
*/ |
||||
public static boolean isCheckExistFile(String filePaths) { |
||||
File file = new File(filePaths); |
||||
return file.exists(); |
||||
} |
||||
} |
@ -0,0 +1,135 @@ |
||||
package com.project.survey.util; |
||||
|
||||
import android.content.Context; |
||||
import android.text.TextUtils; |
||||
|
||||
import androidx.annotation.MainThread; |
||||
|
||||
import com.bingce.data.cache.CachedProject; |
||||
import com.bingce.file.FileOperator; |
||||
import com.bingce.surveyor.util.dialog.CustomDialog; |
||||
import com.bingce.surveyor.util.dialog.CustomInputDialog; |
||||
import com.bingce.utils.FileUtil; |
||||
import com.bingce.utils.ThreadPoolUtil; |
||||
import com.hjq.permissions.Permission; |
||||
import com.hjq.permissions.XXPermissions; |
||||
|
||||
import java.io.File; |
||||
import java.io.IOException; |
||||
import java.util.List; |
||||
|
||||
import blankj.utilcode.util.ToastUtils; |
||||
import cn.liuyanbing.javadxf.AciColor; |
||||
import cn.liuyanbing.javadxf.DxfDocument; |
||||
import cn.liuyanbing.javadxf.Entities.Point; |
||||
import cn.liuyanbing.javadxf.Entities.Text; |
||||
import cn.liuyanbing.javadxf.Exception.DxfException; |
||||
import cn.liuyanbing.javadxf.Header.DxfVersion; |
||||
import cn.liuyanbing.javadxf.Tables.Layer; |
||||
import cn.liuyanbing.javadxf.Vector3; |
||||
|
||||
import com.project.survey.BuildConfig; |
||||
import com.project.survey.R; |
||||
|
||||
public class DxfUtil { |
||||
/** |
||||
* 导出dxf文件调用此方法 |
||||
* |
||||
* @param context |
||||
*/ |
||||
private static List<PointSurveyRecord> pointSurveyRecordLists; |
||||
|
||||
public static void exportFormat(Context context, CachedProject currentProject) { |
||||
exportFormat(context, currentProject, null); |
||||
} |
||||
|
||||
public static void exportFormat(Context context, CachedProject currentProject, List<PointSurveyRecord> pointSurveyRecordList) { |
||||
if (pointSurveyRecordList != null) { |
||||
pointSurveyRecordLists = pointSurveyRecordList; |
||||
} |
||||
if (XXPermissions.isGranted(context, Permission.MANAGE_EXTERNAL_STORAGE)) { |
||||
showEditTextDialog(context, FileUtil.getSDPath() + "/" + context.getString(R.string.surveyor_exported_file) + "/" + context.getString(R.string.point_survey) + "/"); |
||||
} else { |
||||
ToastUtils.showShort(context.getString(R.string.open_read_write_permissions)); |
||||
} |
||||
} |
||||
|
||||
private static CustomInputDialog.Builder inputBuilder; |
||||
|
||||
private static void showEditTextDialog(Context context, String filePath) { |
||||
inputBuilder = new CustomInputDialog.Builder(context); |
||||
inputBuilder.setTitle(context.getString(R.string.export_dxf_file_name)).setInputHint(context.getString(R.string.file_name)).setButtonConfirm(editText -> { |
||||
if (TextUtils.isEmpty(editText.trim())) { |
||||
ToastUtils.showShort(context.getString(R.string.enter_file_name)); |
||||
} else { |
||||
if (isCheckExistFile(filePath + editText.trim() + ".dxf")) { |
||||
new CustomDialog.Builder(context).setContent("\"" + filePath + "\"" |
||||
+ context.getString(R.string.folder_name_already_exists) + "[" + editText.trim() + ".dxf]" |
||||
+ context.getString(R.string.replace_file)).setButtonConfirm(context.getString(R.string.replace) |
||||
, v -> writeTxtToFile(context, filePath, editText.trim())).setButtonCancel(context.getString(R.string.rename) |
||||
, v -> inputBuilder.create().show()).create().show(); |
||||
} else { |
||||
writeTxtToFile(context, filePath, editText.trim()); |
||||
} |
||||
} |
||||
}).create().show(); |
||||
} |
||||
|
||||
/** |
||||
* 导出dxf |
||||
*/ |
||||
public static void writeTxtToFile(Context context, String filePath, String fileName) { |
||||
//导出数据库的点
|
||||
DxfDocument dxf = new DxfDocument(); |
||||
ThreadPoolUtil.execute(() -> { |
||||
for (int i = 0; i < pointSurveyRecordLists.size(); i++) { |
||||
PointSurveyRecord pointSurveyRecord = pointSurveyRecordLists.get(i); |
||||
Point point1 = new Point(new Vector3(pointSurveyRecord.planeE, pointSurveyRecord.planeN, pointSurveyRecord.planeH)); |
||||
point1.setLayer(new Layer("0")); |
||||
point1.setColor(new AciColor(30)); |
||||
dxf.AddEntity(point1); |
||||
|
||||
Text text = new Text(pointSurveyRecordLists.get(i).pointName, new Vector3(pointSurveyRecord.planeE, pointSurveyRecord.planeN, pointSurveyRecord.planeH), 0.4); |
||||
text.setLayer(new Layer("0")); |
||||
text.setColor(new AciColor(30)); |
||||
dxf.AddEntity(text); |
||||
} |
||||
ThreadPoolUtil.executeInMain(() -> { |
||||
try { |
||||
File file = new File(filePath + fileName + ".dxf"); |
||||
if (file.getParentFile() != null && !file.getParentFile().exists()) { |
||||
file.getParentFile().mkdirs(); |
||||
file.createNewFile(); |
||||
} |
||||
dxf.Save(file.getPath(), DxfVersion.AutoCad2004); |
||||
FileUtil.scanFile(context, file); |
||||
showCompleteDialog(context, file); |
||||
} catch (DxfException | IOException e) { |
||||
e.printStackTrace(); |
||||
} |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
@MainThread |
||||
public static void showCompleteDialog(Context context, File file) { |
||||
new CustomStyleDialog.Builder(context) |
||||
.setTitle(context.getString(R.string.export_successful)) |
||||
.setContent(file.getPath()) |
||||
.setButtonSample(context.getString(R.string.close)) |
||||
.setButtonCancel(context.getString(R.string.open), v -> FileUtil.openFile(context, file)) |
||||
.setButtonConfirm(context.getString(R.string.send_to), v -> FileOperator.shareFile(context, file, BuildConfig.APPLICATION_ID)) |
||||
.create() |
||||
.show(); |
||||
} |
||||
|
||||
/** |
||||
* 判断导出文件是否重复 |
||||
* |
||||
* @param filePaths 文件路径 |
||||
*/ |
||||
private static boolean isCheckExistFile(String filePaths) { |
||||
File file = new File(filePaths); |
||||
return file.exists(); |
||||
} |
||||
} |
@ -0,0 +1,689 @@ |
||||
package com.project.survey.util; |
||||
|
||||
import android.content.Context; |
||||
import android.text.TextUtils; |
||||
import android.util.Log; |
||||
import android.view.View; |
||||
|
||||
import androidx.annotation.MainThread; |
||||
import androidx.annotation.WorkerThread; |
||||
|
||||
import com.bingce.data.cache.CachedProject; |
||||
import com.bingce.file.FileOperator; |
||||
import com.bingce.surveyor.util.dialog.CustomDialog; |
||||
import com.bingce.surveyor.util.dialog.CustomInputDialog; |
||||
import com.bingce.utils.FileUtil; |
||||
import com.bingce.utils.ThreadPoolUtil; |
||||
import com.bingce.utils.Util; |
||||
import com.hjq.permissions.Permission; |
||||
import com.hjq.permissions.XXPermissions; |
||||
import com.project.survey.App; |
||||
import com.project.survey.BuildConfig; |
||||
import com.project.survey.R; |
||||
import com.project.survey.dialog.CustomStyleDialog; |
||||
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.io.FileInputStream; |
||||
import java.io.IOException; |
||||
import java.io.InputStream; |
||||
import java.text.SimpleDateFormat; |
||||
import java.util.ArrayList; |
||||
import java.util.Arrays; |
||||
import java.util.List; |
||||
|
||||
import blankj.utilcode.util.ToastUtils; |
||||
import blankj.utilcode.util.Utils; |
||||
import jxl.Workbook; |
||||
import jxl.format.Colour; |
||||
import jxl.write.Label; |
||||
import jxl.write.WritableCell; |
||||
import jxl.write.WritableCellFormat; |
||||
import jxl.write.WritableFont; |
||||
import jxl.write.WritableSheet; |
||||
import jxl.write.WritableWorkbook; |
||||
import jxl.write.WriteException; |
||||
import jxl.WorkbookSettings; |
||||
|
||||
|
||||
public class ExcelUtil { |
||||
public static final int ID_POINT_STAKING = 0; |
||||
public static final int ID_POINT_COORDINATE = ID_POINT_STAKING + 1; |
||||
public static final int ID_CONVER_PARAMETER = ID_POINT_COORDINATE + 1; |
||||
public static final int ID_RESULT_EXPORT_PLANE_POINT_COORDINATE = ID_CONVER_PARAMETER + 1; |
||||
public static final int ID_RESULT_EXPORT_LATLON_POINT_COORDINATE = ID_RESULT_EXPORT_PLANE_POINT_COORDINATE + 1; |
||||
public static final int ID_CUSTOM_EXPORT = ID_RESULT_EXPORT_LATLON_POINT_COORDINATE + 1; |
||||
public static final int ID_LINE_STAKING = ID_CUSTOM_EXPORT + 1; |
||||
public static final int ID_MIDDLE_SIDE_STAKING = ID_LINE_STAKING + 1; |
||||
public static final int ID_STAKING_TO_LINE = ID_MIDDLE_SIDE_STAKING + 1; |
||||
public static final int ID_STAKING_SIDE_COMMON = ID_STAKING_TO_LINE + 1; |
||||
public static final int ID_CAD_STAKING = ID_STAKING_SIDE_COMMON + 1; |
||||
|
||||
private static WritableFont arial14font = null; |
||||
private static WritableCellFormat arial14format = null; |
||||
private static WritableFont arial10font = null; |
||||
private static WritableCellFormat arial10format = null; |
||||
private static WritableFont arial12font = null; |
||||
private static WritableCellFormat arial12format = null; |
||||
private final static String UTF8_ENCODING = "UTF-8"; |
||||
|
||||
private final static List<String> topTabsPointCoordinate = Arrays.asList( |
||||
Utils.getApp().getString(R.string.point_name), |
||||
Utils.getApp().getString(R.string.point_code), |
||||
Utils.getApp().getString(R.string.latitude), |
||||
Utils.getApp().getString(R.string.longitude), |
||||
Utils.getApp().getString(R.string.altitude), |
||||
Utils.getApp().getString(R.string.antenna_type), |
||||
Utils.getApp().getString(R.string.antenna_height), |
||||
Utils.getApp().getString(R.string.easting), |
||||
Utils.getApp().getString(R.string.northing), |
||||
Utils.getApp().getString(R.string.elevation), |
||||
Utils.getApp().getString(R.string.solution_state), |
||||
Utils.getApp().getString(R.string.satellite_num), |
||||
Utils.getApp().getString(R.string.satellite_track_num), |
||||
Utils.getApp().getString(R.string.pdop), |
||||
Utils.getApp().getString(R.string.hrms), |
||||
Utils.getApp().getString(R.string.vrms), |
||||
Utils.getApp().getString(R.string.diff_delay), |
||||
Utils.getApp().getString(R.string.remark), |
||||
Utils.getApp().getString(R.string.acquisition_time), |
||||
Utils.getApp().getString(R.string.base_station) + "ID", |
||||
Utils.getApp().getString(R.string.base_station) + Utils.getApp().getString(R.string.latitude), |
||||
Utils.getApp().getString(R.string.base_station) + Utils.getApp().getString(R.string.longitude), |
||||
Utils.getApp().getString(R.string.base_station) + Utils.getApp().getString(R.string.distance), |
||||
Utils.getApp().getString(R.string.tilt_survey)); |
||||
|
||||
private final static List<String> topTabsResultExportPLANE = Arrays.asList( |
||||
Utils.getApp().getString(R.string.point_name), |
||||
Utils.getApp().getString(R.string.point_code), |
||||
Utils.getApp().getString(R.string.easting), |
||||
Utils.getApp().getString(R.string.northing), |
||||
Utils.getApp().getString(R.string.elevation)); |
||||
|
||||
private final static List<String> topTabsResultExportLatLon = Arrays.asList( |
||||
Utils.getApp().getString(R.string.point_name), |
||||
Utils.getApp().getString(R.string.point_code), |
||||
Utils.getApp().getString(R.string.latitude), |
||||
Utils.getApp().getString(R.string.longitude), |
||||
Utils.getApp().getString(R.string.altitude)); |
||||
|
||||
public static List<String> topTabCustomExport = Arrays.asList(); |
||||
|
||||
/** |
||||
* 单元格的格式设置 字体大小 颜色 对齐方式、背景颜色等... |
||||
*/ |
||||
private static void format() { |
||||
try { |
||||
arial14font = new WritableFont(WritableFont.ARIAL, 14, WritableFont.BOLD); |
||||
arial14font.setColour(Colour.LIGHT_BLUE); |
||||
arial14format = new WritableCellFormat(arial14font); |
||||
arial14format.setAlignment(jxl.format.Alignment.CENTRE); |
||||
arial14format.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN); |
||||
arial14format.setBackground(Colour.VERY_LIGHT_YELLOW); |
||||
|
||||
arial10font = new WritableFont(WritableFont.ARIAL, 10, WritableFont.BOLD); |
||||
arial10format = new WritableCellFormat(arial10font); |
||||
arial10format.setAlignment(jxl.format.Alignment.CENTRE); |
||||
arial10format.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN); |
||||
arial10format.setBackground(Colour.GRAY_25); |
||||
|
||||
arial12font = new WritableFont(WritableFont.ARIAL, 10); |
||||
arial12format = new WritableCellFormat(arial12font); |
||||
//对齐格式
|
||||
arial10format.setAlignment(jxl.format.Alignment.CENTRE); |
||||
//设置边框
|
||||
arial12format.setBorder(jxl.format.Border.ALL, jxl.format.BorderLineStyle.THIN); |
||||
|
||||
} catch (WriteException e) { |
||||
e.printStackTrace(); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 导出Excel文件调用此方法 |
||||
*/ |
||||
public static void exportFormat(int ID_TYPE, Context context, CachedProject currentProject, IExportExcel exportExcel) { |
||||
exportFormat(ID_TYPE, context, currentProject, null, exportExcel); |
||||
} |
||||
|
||||
public static void exportFormat(int ID_TYPE, Context context, CachedProject currentProject, FormatRecord formatRecord, IExportExcel exportExcel) { |
||||
if (XXPermissions.isGranted(context, Permission.MANAGE_EXTERNAL_STORAGE)) { |
||||
showEditTextDialog(ID_TYPE, context, currentProject, formatRecord, exportExcel); |
||||
} else { |
||||
ToastUtils.showShort(context.getString(R.string.open_read_write_permissions)); |
||||
} |
||||
} |
||||
|
||||
private static CustomInputDialog.Builder inputBuilder; |
||||
|
||||
private static void showEditTextDialog(int ID_TYPE, Context context, CachedProject currentProject, FormatRecord formatRecord, IExportExcel exportExcel) { |
||||
inputBuilder = new CustomInputDialog.Builder(context); |
||||
inputBuilder.setTitle(context.getString(R.string.export_excel_file_name)).setInputHint(context.getString(R.string.file_name)).setButtonConfirm(new CustomInputDialog.setOnConfirmClickListener() { |
||||
@Override |
||||
public void OnConfirmClick(String editText) { |
||||
if (TextUtils.isEmpty(editText.trim())) { |
||||
ToastUtils.showShort(context.getString(R.string.enter_file_name)); |
||||
return; |
||||
} |
||||
setExcelInformation(ID_TYPE, editText.trim(), context, currentProject, formatRecord, exportExcel); |
||||
} |
||||
}).create().show(); |
||||
} |
||||
|
||||
public interface IExportExcel { |
||||
void onExportExcel(String filePaths); |
||||
} |
||||
|
||||
/** |
||||
* 设置excel保存的path、名称 |
||||
*/ |
||||
private static String sheetName, filePaths; |
||||
|
||||
private static <T> void setExcelInformation(int ID_TYPE, String inputFileName, Context context, CachedProject currentProject, FormatRecord formatRecord, IExportExcel exportExcel) { |
||||
filePaths = FileUtil.getSDPath() + "/" + context.getString(R.string.surveyor_exported_file) + "/" + context.getString(R.string.point_survey) + "/" + inputFileName + ".xls"; |
||||
switch (ID_TYPE) { |
||||
case ID_POINT_COORDINATE: |
||||
sheetName = context.getString(R.string.coordinate_points_library) + " " + SystemUtils.getSimpleDateFormat(); |
||||
break; |
||||
case ID_RESULT_EXPORT_PLANE_POINT_COORDINATE://(E,N,h).xls
|
||||
filePaths = FileUtil.getSDPath() + "/" + context.getString(R.string.surveyor_exported_file) + "/" + context.getString(R.string.point_survey) + "/" + inputFileName + "(E,N,h).xls"; |
||||
sheetName = context.getString(R.string.results_the_export) + " " + SystemUtils.getSimpleDateFormat(); |
||||
break; |
||||
case ID_RESULT_EXPORT_LATLON_POINT_COORDINATE://(B,L,H).xls
|
||||
filePaths = FileUtil.getSDPath() + "/" + context.getString(R.string.surveyor_exported_file) + "/" + context.getString(R.string.point_survey) + "/" + inputFileName + "(B,L,H).xls"; |
||||
sheetName = context.getString(R.string.results_the_export) + " " + SystemUtils.getSimpleDateFormat(); |
||||
break; |
||||
case ID_CUSTOM_EXPORT://自定义格式
|
||||
sheetName = context.getString(R.string.results_the_export) + " " + SystemUtils.getSimpleDateFormat(); |
||||
break; |
||||
} |
||||
if (isCheckExistFile(filePaths)) { |
||||
new CustomDialog.Builder(context).setContent("\"" + FileUtil.getSDPath() + "/" + context.getString(R.string.surveyor_exported_file) + "/" + context.getString(R.string.point_survey) + "/" + "\"" + context.getString(R.string.folder_name_already_exists) + "[" + inputFileName + ".xls]" + context.getString(R.string.replace_file)).setButtonConfirm(context.getString(R.string.replace), new View.OnClickListener() { |
||||
@Override |
||||
public void onClick(View v) { |
||||
ThreadPoolUtil.execute(() -> { |
||||
ExcelUtil.initExcel(filePaths, sheetName, ID_TYPE, formatRecord); |
||||
exportExcel.onExportExcel(filePaths); |
||||
}); |
||||
} |
||||
}).setButtonCancel(context.getString(R.string.rename), new View.OnClickListener() { |
||||
@Override |
||||
public void onClick(View v) { |
||||
inputBuilder.create().show(); |
||||
} |
||||
}).create().show(); |
||||
} else { |
||||
ThreadPoolUtil.execute(() -> { |
||||
ExcelUtil.initExcel(filePaths, sheetName, ID_TYPE, formatRecord); |
||||
exportExcel.onExportExcel(filePaths); |
||||
}); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 判断导出文件是否重复 |
||||
* |
||||
* @param filePaths 文件路径 |
||||
*/ |
||||
private static boolean isCheckExistFile(String filePaths) { |
||||
File file = new File(filePaths); |
||||
return file.exists(); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 初始化Excel表格 |
||||
* |
||||
* @param filePath 存放excel文件的路径(path/demo.xls) |
||||
* @param sheetName Excel表格的表名 |
||||
* @param colName excel中包含的列名(可以有多个) |
||||
*/ |
||||
private static List<String> colName; |
||||
|
||||
private static void initExcel(String filePath, String sheetName, int ID_TYPE, FormatRecord formatRecord) { |
||||
|
||||
switch (ID_TYPE) { |
||||
case ID_POINT_COORDINATE: |
||||
//用于判断是否导出的数据是否显示表格头
|
||||
if (formatRecord != null) { |
||||
List<String> topCustomTabsPointCoordinate = new ArrayList<>(); |
||||
String[] split = formatRecord.format_content.split(formatRecord.divided_symbols); |
||||
for (int i = 0; i < split.length; i++) { |
||||
topCustomTabsPointCoordinate.add(split[i]); |
||||
} |
||||
colName = topCustomTabsPointCoordinate; |
||||
} else { |
||||
colName = topTabsPointCoordinate; |
||||
} |
||||
break; |
||||
case ID_RESULT_EXPORT_PLANE_POINT_COORDINATE: |
||||
colName = topTabsResultExportPLANE; |
||||
break; |
||||
case ID_RESULT_EXPORT_LATLON_POINT_COORDINATE: |
||||
colName = topTabsResultExportLatLon; |
||||
break; |
||||
case ID_CUSTOM_EXPORT: |
||||
colName = topTabCustomExport; |
||||
break; |
||||
} |
||||
|
||||
format(); |
||||
WritableWorkbook workbook = null; |
||||
try { |
||||
File file = new File(filePath); |
||||
if (file.getParentFile() != null && !file.getParentFile().exists()) { |
||||
file.getParentFile().mkdirs(); |
||||
file.createNewFile(); |
||||
} |
||||
workbook = Workbook.createWorkbook(file); |
||||
//设置表格的名字
|
||||
WritableSheet sheet = workbook.createSheet(sheetName, 0); |
||||
if (formatRecord != null) { |
||||
if (formatRecord.file_header) { |
||||
//创建标题栏
|
||||
sheet.addCell((WritableCell) new Label(0, 0, filePath, arial14format)); |
||||
for (int col = 0; col < colName.size(); col++) { |
||||
sheet.addCell(new Label(col, 0, colName.get(col), arial10format)); |
||||
} |
||||
//设置行高
|
||||
sheet.setRowView(0, 340); |
||||
} |
||||
} else { |
||||
//创建标题栏
|
||||
sheet.addCell((WritableCell) new Label(0, 0, filePath, arial14format)); |
||||
for (int col = 0; col < colName.size(); col++) { |
||||
sheet.addCell(new Label(col, 0, colName.get(col), arial10format)); |
||||
} |
||||
//设置行高
|
||||
sheet.setRowView(0, 340); |
||||
} |
||||
workbook.write(); |
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
} finally { |
||||
if (workbook != null) { |
||||
try { |
||||
workbook.close(); |
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 导出坐标库(新版本) |
||||
* |
||||
* @param objList |
||||
* @param fileName |
||||
* @param context |
||||
*/ |
||||
|
||||
@WorkerThread |
||||
public static void exportCoordinator(List<PointSurveyRecord> objList, String fileName, Context context, FormatRecord formatRecord) { |
||||
// CoordinateSystem coordinateSystem = CachedCurrentCoordinateSystem.currentCoordinateSystem();
|
||||
writeListToExcelNew(objList, fileName, context, formatRecord, pointBaseRecord -> { |
||||
List<String> regexList = new ArrayList<>(); |
||||
String[] split = formatRecord.format_content.split(formatRecord.divided_symbols); |
||||
for (int i = 0; i < split.length; i++) { |
||||
regexList.add(split[i]); |
||||
} |
||||
|
||||
List<String> list = new ArrayList<>(); |
||||
|
||||
for (int i = 0; i < regexList.size(); i++) { |
||||
String s = regexList.get(i); |
||||
if (s.equals("点名") || s.equals("Point name") || s.equals("№точ.")) { |
||||
list.add(pointBaseRecord.pointName); |
||||
} else if (s.equals("编码") || s.equals("Code") || s.equals("Код")) { |
||||
list.add(pointBaseRecord.code); |
||||
} else if (s.equals("纬度") || s.equals("Latitude") || s.equals("Широта")) { |
||||
list.add(convertAngleFormat(formatRecord.angle_format, pointBaseRecord.latitude)); |
||||
} else if (s.equals("经度") || s.equals("Longitude") || s.equals("Долгота")) { |
||||
list.add(convertAngleFormat(formatRecord.angle_format, pointBaseRecord.longitude)); |
||||
} else if (s.equals("大地高") || s.equals("Geodetic height") || s.equals("Высота")) { |
||||
list.add(Util.formatDouble2StringDotAuto(pointBaseRecord.altitude)); |
||||
} else if (s.equals("天线类型") || s.equals("Antenna type") || s.equals("Тип антенны")) { |
||||
list.add(pointBaseRecord.antennaTypeName == null ? "" : pointBaseRecord.antennaTypeName); |
||||
} else if (s.equals("天线高") || s.equals("Antenna height") || s.equals("Высота антенны")) { |
||||
if (pointBaseRecord.antennaHeight == -1) { |
||||
list.add(""); |
||||
} else { |
||||
list.add(Util.formatDouble2StringDotAuto(pointBaseRecord.antennaHeight)); |
||||
} |
||||
} else if (s.equals("北坐标") || s.equals("Northing") || s.equals("Северные координаты.")) { |
||||
list.add(Util.formatDouble2String(pointBaseRecord.planeN, 6)); |
||||
} else if (s.equals("东坐标") || s.equals("Easting") || s.equals("Восточные координаты.")) { |
||||
list.add(Util.formatDouble2String(pointBaseRecord.planeE, 6)); |
||||
} else if (s.equals("高程") || s.equals("Elevation") || s.equals("Восточные координаты.")) { |
||||
list.add(Util.formatDouble2String(pointBaseRecord.planeH, 6)); |
||||
} else if (s.equals("解状态") || s.equals("Solution state") || s.equals("Режим решения.")) { |
||||
list.add(pointBaseRecord.solutionState); |
||||
} else if (s.equals("解算卫星") || s.equals("Satellite number") || s.equals("Спутник для вычисления")) { |
||||
if (pointBaseRecord.satelliteNum == -1) { |
||||
list.add(""); |
||||
} else { |
||||
list.add(Util.formatDouble2StringDotAuto(pointBaseRecord.satelliteNum)); |
||||
} |
||||
} else if (s.equals("可见卫星") || s.equals("Satellite track num") || s.equals("Видимый спутник")) { |
||||
if (pointBaseRecord.satelliteTrackNum == -1) { |
||||
list.add(""); |
||||
} else { |
||||
list.add(Util.formatDouble2StringDotAuto(pointBaseRecord.satelliteTrackNum)); |
||||
} |
||||
} else if (s.equals(context.getString(R.string.pdop))) { |
||||
if (pointBaseRecord.pdop == -1) { |
||||
list.add(""); |
||||
} else { |
||||
list.add(Util.formatDouble2StringDotAuto(pointBaseRecord.pdop)); |
||||
} |
||||
} else if (s.equals(context.getString(R.string.hrms))) { |
||||
if (pointBaseRecord.hrms == -1) { |
||||
list.add(""); |
||||
} else { |
||||
list.add(Util.formatDouble2StringDotAuto(pointBaseRecord.hrms)); |
||||
} |
||||
} else if (s.equals(context.getString(R.string.vrms))) { |
||||
if (pointBaseRecord.vrms == -1) { |
||||
list.add(""); |
||||
} else { |
||||
list.add(Util.formatDouble2StringDotAuto(pointBaseRecord.vrms)); |
||||
} |
||||
} else if (s.equals("差分延迟") || s.equals("Diff age") || s.equals("Дифференциальная задержка")) { |
||||
if (pointBaseRecord.diffAge == -1) { |
||||
list.add(""); |
||||
} else { |
||||
list.add(Util.formatDouble2StringDotAuto(pointBaseRecord.diffAge)); |
||||
} |
||||
} else if (s.equals("备注") || s.equals("Remark") || s.equals("примечан")) { |
||||
list.add(pointBaseRecord.remarks); |
||||
} else if (s.equals("采集时间") || s.equals("Measure time") || s.equals("Время сбора")) { |
||||
list.add(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(pointBaseRecord.createdAt)); |
||||
} else if (s.equals("惯导测量") || s.equals("Tilt survey") || s.equals("Нормативное измерение")) { |
||||
if (pointBaseRecord.isTiltEnable) { |
||||
list.add(context.getString(R.string.yes)); |
||||
} else { |
||||
list.add(context.getString(R.string.no)); |
||||
} |
||||
} |
||||
} |
||||
return list; |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 根据成果导出的格式,经纬度进行转换导出 |
||||
* |
||||
* @param angle_format_type |
||||
* @param l |
||||
* @return |
||||
*/ |
||||
private static String convertAngleFormat(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); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 导出坐标库(老版本) |
||||
* |
||||
* @param objList |
||||
* @param fileName |
||||
* @param context |
||||
*/ |
||||
@WorkerThread |
||||
public static void exportCoordinator(List<PointSurveyRecord> objList, String fileName, Context context) { |
||||
// CoordinateSystem coordinateSystem = CachedCurrentCoordinateSystem.currentCoordinateSystem();
|
||||
writeListToExcel(objList, fileName, context, pointBaseRecord -> { |
||||
List<String> list = new ArrayList<>(); |
||||
list.add(pointBaseRecord.pointName); |
||||
list.add(pointBaseRecord.code); |
||||
list.add(Util.formatDouble2String(pointBaseRecord.latitude, 6)); |
||||
list.add(Util.formatDouble2String(pointBaseRecord.longitude, 6)); |
||||
list.add(Util.formatDouble2String(pointBaseRecord.altitude, 6)); |
||||
list.add(pointBaseRecord.antennaTypeName == null ? "" : pointBaseRecord.antennaTypeName); |
||||
list.add(Util.formatDouble2StringDotAuto(pointBaseRecord.antennaHeight)); |
||||
list.add(Util.formatDouble2String(pointBaseRecord.planeE, 6)); |
||||
list.add(Util.formatDouble2String(pointBaseRecord.planeN, 6)); |
||||
list.add(Util.formatDouble2String(pointBaseRecord.planeH, 6)); |
||||
list.add(pointBaseRecord.solutionState); |
||||
list.add(Util.formatDouble2StringDotAuto(pointBaseRecord.satelliteNum)); |
||||
list.add(Util.formatDouble2StringDotAuto(pointBaseRecord.satelliteTrackNum)); |
||||
list.add(Util.formatDouble2StringDotAuto(pointBaseRecord.pdop)); |
||||
list.add(Util.formatDouble2StringDotAuto(pointBaseRecord.hrms)); |
||||
list.add(Util.formatDouble2StringDotAuto(pointBaseRecord.vrms)); |
||||
list.add(Util.formatDouble2StringDotAuto(pointBaseRecord.diffAge)); |
||||
list.add(pointBaseRecord.remarks); |
||||
list.add(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(pointBaseRecord.createdAt)); |
||||
list.add(pointBaseRecord.siteId == null ? "" : pointBaseRecord.siteId); |
||||
String blhLat = Util.radianToDmsDoubleString(Math.toRadians(pointBaseRecord.siteLatitude), 4, true); |
||||
String blhLon = Util.radianToDmsDoubleString(Math.toRadians(pointBaseRecord.siteLongitude), 4, true); |
||||
Log.e("radianToDmsString", blhLat + "----" + blhLon); |
||||
list.add(blhLat); |
||||
list.add(blhLon); |
||||
list.add(Util.formatDouble2StringDotAuto(pointBaseRecord.siteDistance2D)); |
||||
if (pointBaseRecord.isTiltEnable) { |
||||
list.add(context.getString(R.string.yes)); |
||||
} else { |
||||
list.add(context.getString(R.string.no)); |
||||
} |
||||
return list; |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 导出成果导出(平面坐标) |
||||
* |
||||
* @param objList |
||||
* @param fileName |
||||
* @param context |
||||
*/ |
||||
public static void exportCoordinatePlane(List<PointSurveyRecord> objList, String fileName, Context context) { |
||||
ThreadPoolUtil.execute(() -> { |
||||
writeListToExcel(objList, fileName, context, planePointBaseRecord -> { |
||||
List<String> list = new ArrayList<>(); |
||||
list.add(planePointBaseRecord.pointName); |
||||
list.add(planePointBaseRecord.code); |
||||
list.add(Util.formatDouble2String(planePointBaseRecord.planeE, 6)); |
||||
list.add(Util.formatDouble2String(planePointBaseRecord.planeN, 6)); |
||||
list.add(Util.formatDouble2String(planePointBaseRecord.planeH, 6)); |
||||
return list; |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 导出成果导出(经纬度坐标) |
||||
* |
||||
* @param objList |
||||
* @param fileName |
||||
* @param context |
||||
*/ |
||||
public static void exportCoordinateLatlon(List<PointSurveyRecord> objList, String fileName, Context context) { |
||||
ThreadPoolUtil.execute(() -> { |
||||
writeListToExcel(objList, fileName, context, latlonPointBaseRecord -> { |
||||
List<String> list = new ArrayList<>(); |
||||
list.add(latlonPointBaseRecord.pointName); |
||||
list.add(latlonPointBaseRecord.code); |
||||
list.add(Util.formatDouble2String(latlonPointBaseRecord.latitude, 6)); |
||||
list.add(Util.formatDouble2String(latlonPointBaseRecord.longitude, 6)); |
||||
list.add(Util.formatDouble2String(latlonPointBaseRecord.altitude, 6)); |
||||
return list; |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
private interface IRecord2StringList<T> { |
||||
List<String> convert(T t); |
||||
} |
||||
|
||||
private static File file; |
||||
|
||||
private static <T> void writeListToExcel(List<T> objList, String fileName, Context context, IRecord2StringList<T> record2StringList) { |
||||
if (objList != null && objList.size() > 0) { |
||||
WritableWorkbook writebook = null; |
||||
InputStream in = null; |
||||
try { |
||||
WorkbookSettings setEncode = new WorkbookSettings(); |
||||
setEncode.setEncoding(UTF8_ENCODING); |
||||
file = new File(fileName); |
||||
in = new FileInputStream(file); |
||||
Workbook workbook = Workbook.getWorkbook(in); |
||||
writebook = Workbook.createWorkbook(file, workbook); |
||||
WritableSheet sheet = writebook.getSheet(0); |
||||
|
||||
for (int j = 0; j < objList.size(); j++) { |
||||
List<String> list = record2StringList.convert(objList.get(j)); |
||||
|
||||
for (int i = 0; i < list.size(); i++) { |
||||
sheet.addCell(new Label(i, j + 1, list.get(i), arial12format)); |
||||
if (list.get(i) == null) { |
||||
//设置列宽
|
||||
sheet.setColumnView(i, 8); |
||||
} else { |
||||
if (list.get(i).length() <= 4) { |
||||
//设置列宽
|
||||
sheet.setColumnView(i, list.get(i).length() + 8); |
||||
} else { |
||||
//设置列宽
|
||||
sheet.setColumnView(i, list.get(i).length() + 5); |
||||
} |
||||
} |
||||
} |
||||
//设置行高
|
||||
sheet.setRowView(j + 1, 350); |
||||
} |
||||
writebook.write(); |
||||
workbook.close(); |
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
ToastUtils.showShort(e.getMessage()); |
||||
} finally { |
||||
if (writebook != null) { |
||||
try { |
||||
writebook.close(); |
||||
ThreadPoolUtil.executeInMain(new Runnable() { |
||||
@Override |
||||
public void run() { |
||||
FileUtil.scanFile(context, file); |
||||
showCompleteDialog(context, file); |
||||
} |
||||
}); |
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
ToastUtils.showShort(e.getMessage()); |
||||
} |
||||
|
||||
} |
||||
if (in != null) { |
||||
try { |
||||
in.close(); |
||||
} catch (IOException e) { |
||||
e.printStackTrace(); |
||||
ToastUtils.showShort(e.getMessage()); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
private static <T> void writeListToExcelNew(List<T> objList, String fileName, Context context, FormatRecord formatRecord, IRecord2StringList<T> record2StringList) { |
||||
if (objList != null && objList.size() > 0) { |
||||
WritableWorkbook writebook = null; |
||||
InputStream in = null; |
||||
int x; |
||||
try { |
||||
WorkbookSettings setEncode = new WorkbookSettings(); |
||||
setEncode.setEncoding(UTF8_ENCODING); |
||||
file = new File(fileName); |
||||
in = new FileInputStream(file); |
||||
Workbook workbook = Workbook.getWorkbook(in); |
||||
writebook = Workbook.createWorkbook(file, workbook); |
||||
WritableSheet sheet = writebook.getSheet(0); |
||||
|
||||
for (int j = 0; j < objList.size(); j++) { |
||||
List<String> list = record2StringList.convert(objList.get(j)); |
||||
//用于判断是否导出的数据是否显示表格头 x = j + 1;代表要表格头,x = j;代表不要表格头
|
||||
if (formatRecord != null) { |
||||
if (formatRecord.file_header) { |
||||
x = j + 1; |
||||
} else { |
||||
x = j; |
||||
} |
||||
} else { |
||||
x = j + 1; |
||||
} |
||||
for (int i = 0; i < list.size(); i++) { |
||||
sheet.addCell(new Label(i, x, list.get(i), arial12format)); |
||||
if (list.get(i) == null) { |
||||
//设置列宽
|
||||
sheet.setColumnView(i, 8); |
||||
} else { |
||||
if (list.get(i).length() <= 4) { |
||||
//设置列宽
|
||||
sheet.setColumnView(i, list.get(i).length() + 8); |
||||
} else { |
||||
//设置列宽
|
||||
sheet.setColumnView(i, list.get(i).length() + 5); |
||||
} |
||||
} |
||||
} |
||||
//设置行高
|
||||
sheet.setRowView(x, 350); |
||||
} |
||||
writebook.write(); |
||||
workbook.close(); |
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
ToastUtils.showShort(e.getMessage()); |
||||
} finally { |
||||
if (writebook != null) { |
||||
try { |
||||
writebook.close(); |
||||
ThreadPoolUtil.executeInMain(() -> { |
||||
FileUtil.scanFile(context, file); |
||||
showCompleteDialog(context, file); |
||||
}); |
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
ToastUtils.showShort(e.getMessage()); |
||||
} |
||||
|
||||
} |
||||
if (in != null) { |
||||
try { |
||||
in.close(); |
||||
} catch (IOException e) { |
||||
e.printStackTrace(); |
||||
ToastUtils.showShort(e.getMessage()); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
@MainThread |
||||
public static void showCompleteDialog(Context context, File file) { |
||||
new CustomStyleDialog.Builder(context) |
||||
.setTitle(context.getString(R.string.export_successful)) |
||||
.setContent(file.getPath()) |
||||
.setButtonSample(context.getString(R.string.close)) |
||||
.setButtonCancel(context.getString(R.string.open), v -> FileUtil.openFile(context, file)) |
||||
.setButtonConfirm(context.getString(R.string.send_to), v -> FileOperator.shareFile(context, file, BuildConfig.APPLICATION_ID)) |
||||
.create() |
||||
.show(); |
||||
} |
||||
} |
@ -0,0 +1,10 @@ |
||||
package com.project.survey.util; |
||||
|
||||
public class FormatSuffixesUtils { |
||||
public static final String formatHDM = ".hdm"; |
||||
public static final String formatKML = ".kml"; |
||||
public static final String formatHTML = ".html"; |
||||
public static final String formatTXT = ".txt"; |
||||
public static final String formatDAT = ".dat"; |
||||
public static final String formatCSV = ".csv"; |
||||
} |
@ -0,0 +1,179 @@ |
||||
package com.project.survey.util; |
||||
|
||||
import android.app.Activity; |
||||
import android.content.Context; |
||||
import android.text.TextUtils; |
||||
|
||||
import androidx.annotation.MainThread; |
||||
import androidx.annotation.NonNull; |
||||
import androidx.core.content.PermissionChecker; |
||||
|
||||
import com.bingce.data.cache.CachedProject; |
||||
import com.bingce.file.FileOperator; |
||||
import com.bingce.surveyor.util.dialog.CustomDialog; |
||||
import com.bingce.surveyor.util.dialog.CustomInputDialog; |
||||
import com.bingce.utils.FileUtil; |
||||
import com.bingce.utils.ThreadPoolUtil; |
||||
import com.hjq.permissions.Permission; |
||||
import com.hjq.permissions.XXPermissions; |
||||
import com.project.survey.BuildConfig; |
||||
import com.project.survey.R; |
||||
import com.project.survey.dialog.CustomStyleDialog; |
||||
|
||||
import java.io.File; |
||||
import java.io.RandomAccessFile; |
||||
|
||||
import blankj.utilcode.util.ToastUtils; |
||||
|
||||
public class TxtUtil { |
||||
|
||||
public static void exportFormat(Context context, String strContent, String format_suffixes, CachedProject currentProject) { |
||||
exportFormat(context, "", strContent, format_suffixes, currentProject, false); |
||||
} |
||||
|
||||
/** |
||||
* 导出txt文件调用此方法 |
||||
* |
||||
* @param context |
||||
* @param strContent 导出内容 |
||||
* @param format_suffixes 格式后缀 |
||||
* @param isFinish 是否关闭当前页面 |
||||
*/ |
||||
public static void exportFormat(Context context, String fileName, String strContent, String format_suffixes, CachedProject currentProject, boolean isFinish) { |
||||
if (XXPermissions.isGranted(context, Permission.MANAGE_EXTERNAL_STORAGE)) { |
||||
agreePermission(context, fileName, strContent, format_suffixes, currentProject, isFinish); |
||||
} else { |
||||
ToastUtils.showShort(context.getString(R.string.open_read_write_permissions)); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 同意权限 |
||||
* |
||||
* @param context |
||||
* @param fileName |
||||
* @param strContent |
||||
* @param format_suffixes |
||||
* @param currentProject |
||||
*/ |
||||
private static void agreePermission(Context context, String fileName, String strContent, String format_suffixes, CachedProject currentProject, boolean isFinish) { |
||||
//单独列出导出Html(当结尾和文件名都传过来时,无需弹出编辑文件名弹框。当没传过来的文件名,和正常的编辑文件名一样弹出编辑弹框)
|
||||
if (format_suffixes.equals(FormatSuffixesUtils.formatHTML) && !TextUtils.isEmpty(fileName)) { |
||||
if (isCheckExistFile(FileUtil.getSDPath() + "/" + context.getString(R.string.surveyor_exported_file) + "/" + context.getString(R.string.point_survey) + "/" + format_suffixes)) { |
||||
new CustomDialog.Builder(context).setContent("\"" + FileUtil.getSDPath() + "/" + context.getString(R.string.surveyor_exported_file) |
||||
+ "/" + context.getString(R.string.point_survey) + "/" + "\"" + context.getString(R.string.folder_name_already_exists) + "[" + fileName + format_suffixes + "]" |
||||
+ context.getString(R.string.replace_file)).setButtonConfirm(context.getString(R.string.replace), v -> writeTxtToFile(context, strContent, FileUtil.getSDPath() + "/" |
||||
+ context.getString(R.string.surveyor_exported_file) + "/" + context.getString(R.string.point_survey) + "/", fileName + format_suffixes, isFinish)) |
||||
.setButtonCancel(context.getString(R.string.rename), v -> inputBuilder.create().show()).create().show(); |
||||
} else { |
||||
writeTxtToFile(context, strContent, FileUtil.getSDPath() + "/" + context.getString(R.string.surveyor_exported_file) + "/" + context.getString(R.string.point_survey) + "/", fileName + format_suffixes, isFinish); |
||||
} |
||||
} else { |
||||
//传过来的点名为空时,弹出编写文件名称弹框
|
||||
showEditTextDialog(context, strContent, FileUtil.getSDPath() + "/" + context.getString(R.string.surveyor_exported_file) + "/" + context.getString(R.string.point_survey) + "/", format_suffixes, isFinish); |
||||
} |
||||
} |
||||
|
||||
private static CustomInputDialog.Builder inputBuilder; |
||||
private static String dialogTitle; |
||||
|
||||
private static void showEditTextDialog(Context context, String strContent, String filePath, String format_suffixes, boolean isFinish) { |
||||
inputBuilder = new CustomInputDialog.Builder(context); |
||||
if (format_suffixes.equals(FormatSuffixesUtils.formatHDM)) { |
||||
dialogTitle = context.getString(R.string.export_hdm_file_name); |
||||
} else if (format_suffixes.equals(FormatSuffixesUtils.formatKML)) { |
||||
dialogTitle = context.getString(R.string.export_kml_file_name); |
||||
} else if (format_suffixes.equals(FormatSuffixesUtils.formatTXT)) { |
||||
dialogTitle = context.getString(R.string.export_txt_file_name); |
||||
} else { |
||||
dialogTitle = context.getString(R.string.export_excel_file_name); |
||||
} |
||||
inputBuilder.setTitle(dialogTitle).setInputHint(context.getString(R.string.file_name)).setButtonConfirm(editText -> { |
||||
if (TextUtils.isEmpty(editText.trim())) { |
||||
ToastUtils.showShort(context.getString(R.string.enter_file_name)); |
||||
} else { |
||||
if (isCheckExistFile(filePath + editText.trim() + format_suffixes)) { |
||||
new CustomDialog.Builder(context).setContent("\"" + filePath + "\"" |
||||
+ context.getString(R.string.folder_name_already_exists) + "[" + editText.trim() + format_suffixes + "]" |
||||
+ context.getString(R.string.replace_file)).setButtonConfirm(context.getString(R.string.replace) |
||||
, v -> writeTxtToFile(context, strContent, filePath, editText.trim() + format_suffixes, isFinish)) |
||||
.setButtonCancel(context.getString(R.string.rename), v -> inputBuilder.create().show()).create().show(); |
||||
} else { |
||||
writeTxtToFile(context, strContent, filePath, editText.trim() + format_suffixes, isFinish); |
||||
} |
||||
} |
||||
}).create().show(); |
||||
} |
||||
|
||||
/** |
||||
* 判断权限是否授权 |
||||
* |
||||
* @param context |
||||
* @param permissions |
||||
* @return |
||||
*/ |
||||
public static boolean hasPermission(@NonNull Context context, @NonNull String... permissions) { |
||||
if (permissions.length == 0) { |
||||
return false; |
||||
} |
||||
for (String per : permissions) { |
||||
int result = PermissionChecker.checkSelfPermission(context, per); |
||||
if (result != PermissionChecker.PERMISSION_GRANTED) { |
||||
return false; |
||||
} |
||||
} |
||||
return true; |
||||
} |
||||
|
||||
|
||||
// 将字符串写入到文本文件中
|
||||
public static void writeTxtToFile(Context context, String content, String filePath, String fileName, boolean isFinish) { |
||||
String strFilePath = filePath + fileName; |
||||
// 每次写入时,都换行写
|
||||
String strContent = content + "\r\n"; |
||||
try { |
||||
File file = new File(strFilePath); |
||||
if (file.getParentFile() != null && !file.getParentFile().exists()) { |
||||
file.getParentFile().mkdirs(); |
||||
file.createNewFile(); |
||||
} |
||||
RandomAccessFile raf = new RandomAccessFile(file, "rwd"); |
||||
raf.seek(file.length()); |
||||
raf.write(strContent.getBytes()); |
||||
raf.close(); |
||||
ThreadPoolUtil.executeInMain(() -> { |
||||
FileUtil.scanFile(context, file); |
||||
showCompleteDialog(context, file, isFinish); |
||||
}); |
||||
} catch (Exception e) { |
||||
ToastUtils.showShort(e.getMessage()); |
||||
} |
||||
} |
||||
|
||||
@MainThread |
||||
public static void showCompleteDialog(Context context, File file, boolean isFinish) { |
||||
new CustomStyleDialog.Builder(context) |
||||
.setTitle(context.getString(R.string.export_successful)) |
||||
.setContent(file.getPath()) |
||||
.setButtonSample(context.getString(R.string.close)) |
||||
.setButtonCancel(context.getString(R.string.open), v -> FileUtil.openFile(context, file)) |
||||
.setButtonConfirm(context.getString(R.string.send_to), v -> FileOperator.shareFile(context, file, BuildConfig.APPLICATION_ID)) |
||||
.setButtonCancel(v -> { |
||||
if (isFinish) { |
||||
((Activity) context).finish(); |
||||
} |
||||
}) |
||||
.create() |
||||
.show(); |
||||
} |
||||
|
||||
/** |
||||
* 判断导出文件是否重复 |
||||
* |
||||
* @param filePaths 文件路径 |
||||
*/ |
||||
private static boolean isCheckExistFile(String filePaths) { |
||||
File file = new File(filePaths); |
||||
return file.exists(); |
||||
} |
||||
} |
@ -0,0 +1,45 @@ |
||||
package com.project.survey.widget.bingce |
||||
|
||||
import android.content.Context |
||||
import android.util.AttributeSet |
||||
import android.view.MotionEvent |
||||
import android.view.View |
||||
import android.widget.HorizontalScrollView |
||||
|
||||
|
||||
class SyncHorizontalScrollView : HorizontalScrollView { |
||||
private var mView: View? = null |
||||
|
||||
constructor(paramContext: Context?) : super(paramContext) {} |
||||
constructor(paramContext: Context?, paramAttributeSet: AttributeSet?) : super( |
||||
paramContext, |
||||
paramAttributeSet |
||||
) { |
||||
} |
||||
|
||||
override fun onScrollChanged(paramInt1: Int, paramInt2: Int, paramInt3: Int, paramInt4: Int) { |
||||
super.onScrollChanged(paramInt1, paramInt2, paramInt3, paramInt4) |
||||
if (mView != null) mView!!.scrollTo(paramInt1, paramInt2) |
||||
} |
||||
|
||||
fun setScrollView(paramView: View?) { |
||||
mView = paramView |
||||
} |
||||
|
||||
override fun onInterceptTouchEvent(ev: MotionEvent?): Boolean { |
||||
if (intercept) { |
||||
return true |
||||
} |
||||
return super.onInterceptTouchEvent(ev) |
||||
} |
||||
|
||||
private var intercept = false |
||||
fun isIntercept(): Boolean { |
||||
return intercept |
||||
} |
||||
|
||||
fun setIntercept(intercept: Boolean) { |
||||
this.intercept = intercept |
||||
} |
||||
} |
||||
|
@ -0,0 +1,35 @@ |
||||
package com.project.survey.widget.bingce; |
||||
|
||||
import android.content.Context; |
||||
import android.util.AttributeSet; |
||||
import android.view.MotionEvent; |
||||
import android.widget.RelativeLayout; |
||||
|
||||
public class TouchRelativeLayout extends RelativeLayout { |
||||
public TouchRelativeLayout(Context context) { |
||||
super(context); |
||||
} |
||||
|
||||
public TouchRelativeLayout(Context context, AttributeSet attrs) { |
||||
super(context, attrs); |
||||
} |
||||
|
||||
public TouchRelativeLayout(Context context, AttributeSet attrs, int defStyleAttr) { |
||||
super(context, attrs, defStyleAttr); |
||||
} |
||||
|
||||
@Override |
||||
public boolean onInterceptTouchEvent(MotionEvent ev) { |
||||
if (intercept){ |
||||
return true; |
||||
} |
||||
return super.onInterceptTouchEvent(ev); |
||||
} |
||||
private boolean intercept = false; |
||||
public boolean isIntercept(){ |
||||
return intercept; |
||||
} |
||||
public void setIntercept(boolean intercept){ |
||||
this.intercept = intercept; |
||||
} |
||||
} |
@ -0,0 +1,5 @@ |
||||
<vector android:alpha="0.9" android:height="48dp" |
||||
android:viewportHeight="1024" android:viewportWidth="1024" |
||||
android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android"> |
||||
<path android:fillColor="#bfbfbf" android:pathData="M725.3,362.7v-85.3c0,-117.8 -95.5,-213.3 -213.3,-213.3S298.7,159.5 298.7,277.3v85.3a128,128 0,0 0,-128 128v341.3a128,128 0,0 0,128 128h426.7a128,128 0,0 0,128 -128L853.3,490.7a128,128 0,0 0,-128 -128zM362.7,277.3c0,-82.3 67,-149.3 149.3,-149.3s149.3,67 149.3,149.3v85.3L362.7,362.7v-85.3zM544,746.7a32,32 0,1 1,-64 0v-170.7a32,32 0,1 1,64 0v170.7z"/> |
||||
</vector> |
@ -0,0 +1,8 @@ |
||||
<vector android:autoMirrored="true" android:height="48dp" |
||||
android:viewportHeight="1024" android:viewportWidth="1024" |
||||
android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android"> |
||||
<path android:fillColor="#333333" android:pathData="M621.7,73.1a146.3,146.3 0,0 1,146.3 146.3v73.1h-73.1V219.4a73.1,73.1 0,0 0,-73.1 -73.1h-219.4a73.1,73.1 0,0 0,-73.1 73.1v73.1H256V219.4a146.3,146.3 0,0 1,146.3 -146.3h219.4zM256,804.6a73.1,73.1 0,0 0,67.7 73L329.1,877.7h365.7a73.1,73.1 0,0 0,73 -67.7L768,804.6V402.3a36.6,36.6 0,0 1,73.1 0v402.3a146.3,146.3 0,0 1,-146.3 146.3H329.1a146.3,146.3 0,0 1,-146.3 -146.3V402.3a36.6,36.6 0,0 1,73.1 0v402.3z"/> |
||||
<path android:fillColor="#333333" android:pathData="M365.7,475.4m36.6,0l0,0q36.6,0 36.6,36.6l0,182.9q0,36.6 -36.6,36.6l0,0q-36.6,0 -36.6,-36.6l0,-182.9q0,-36.6 36.6,-36.6Z"/> |
||||
<path android:fillColor="#333333" android:pathData="M585.1,475.4m36.6,0l0,0q36.6,0 36.6,36.6l0,182.9q0,36.6 -36.6,36.6l0,0q-36.6,0 -36.6,-36.6l0,-182.9q0,-36.6 36.6,-36.6Z"/> |
||||
<path android:fillColor="#333333" android:pathData="M73.1,256m36.6,0l804.6,0q36.6,0 36.6,36.6l0,0q0,36.6 -36.6,36.6l-804.6,0q-36.6,0 -36.6,-36.6l0,0q0,-36.6 36.6,-36.6Z"/> |
||||
</vector> |
@ -0,0 +1,260 @@ |
||||
<?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" |
||||
xmlns:tools="http://schemas.android.com/tools" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:orientation="vertical"> |
||||
|
||||
<androidx.core.widget.NestedScrollView |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:layout_weight="1"> |
||||
|
||||
<LinearLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:orientation="vertical"> |
||||
|
||||
<LinearLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="50dp" |
||||
android:layout_marginLeft="10dp" |
||||
android:layout_marginTop="10dp" |
||||
android:layout_marginRight="10dp" |
||||
android:background="@drawable/rectangle_radius_5_white_full"> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_format_name" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_gravity="center_vertical" |
||||
android:layout_marginLeft="15dp" |
||||
android:text="格式名称" |
||||
android:textColor="@color/color_575757" |
||||
android:textSize="14.5sp" |
||||
android:textStyle="bold" /> |
||||
|
||||
<com.bingce.ui.CleanableEditText |
||||
android:id="@+id/et_format_name" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:background="@null" |
||||
android:drawableRight="@mipmap/icon_clear" |
||||
android:hint="请输入格式名称" |
||||
android:paddingLeft="10dp" |
||||
android:paddingRight="10dp" |
||||
android:textColor="@color/black" |
||||
android:textColorHint="@color/color_999999" |
||||
android:textSize="15sp" |
||||
android:textStyle="bold" /> |
||||
|
||||
</LinearLayout> |
||||
|
||||
<LinearLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="50dp" |
||||
android:layout_margin="10dp"> |
||||
|
||||
<RelativeLayout |
||||
android:id="@+id/rl_file_header" |
||||
android:layout_width="0dp" |
||||
android:layout_height="match_parent" |
||||
android:layout_marginRight="10dp" |
||||
android:layout_weight="1" |
||||
android:background="@drawable/rectangle_radius_5_white_full"> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_file_header" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerVertical="true" |
||||
android:layout_marginLeft="15dp" |
||||
android:text="文件表头" |
||||
android:textColor="@color/color_575757" |
||||
android:textSize="14sp" |
||||
android:textStyle="bold" /> |
||||
|
||||
<com.sherlockshi.widget.SherlockSpinner |
||||
android:id="@+id/sherlock_file_header" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:background="@null" |
||||
android:gravity="end|center_vertical" |
||||
android:paddingLeft="15dp" |
||||
android:paddingRight="15dp" |
||||
android:textColor="@color/color_8a8a8a" |
||||
android:textSize="@dimen/NormalTextSize" |
||||
android:textStyle="bold" /> |
||||
|
||||
</RelativeLayout> |
||||
|
||||
<RelativeLayout |
||||
android:layout_width="0dp" |
||||
android:layout_height="match_parent" |
||||
android:layout_weight="1" |
||||
android:background="@drawable/rectangle_radius_5_white_full"> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_file_suffix" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerVertical="true" |
||||
android:layout_marginLeft="15dp" |
||||
android:text="文件后缀" |
||||
android:textColor="@color/color_575757" |
||||
android:textSize="14.5sp" |
||||
android:textStyle="bold" /> |
||||
|
||||
<com.sherlockshi.widget.SherlockSpinner |
||||
android:id="@+id/sherlock_suffix" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:background="@null" |
||||
android:gravity="end|center_vertical" |
||||
android:paddingLeft="15dp" |
||||
android:paddingRight="15dp" |
||||
android:textColor="@color/color_8a8a8a" |
||||
android:textSize="@dimen/NormalTextSize" |
||||
android:textStyle="bold" /> |
||||
|
||||
</RelativeLayout> |
||||
|
||||
</LinearLayout> |
||||
|
||||
<LinearLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="50dp" |
||||
android:layout_marginLeft="10dp" |
||||
android:layout_marginRight="10dp" |
||||
android:layout_marginBottom="10dp" |
||||
android:visibility="visible"> |
||||
|
||||
<RelativeLayout |
||||
android:layout_width="0dp" |
||||
android:layout_height="match_parent" |
||||
android:layout_weight="1" |
||||
android:background="@drawable/rectangle_radius_5_white_full"> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_angle_format" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerVertical="true" |
||||
android:layout_marginLeft="15dp" |
||||
android:text="角度格式" |
||||
android:textColor="@color/color_575757" |
||||
android:textSize="14.5sp" |
||||
android:textStyle="bold" /> |
||||
|
||||
<com.sherlockshi.widget.SherlockSpinner |
||||
android:id="@+id/sherlock_angle_format" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:background="@null" |
||||
android:gravity="end|center_vertical" |
||||
android:paddingLeft="15dp" |
||||
android:paddingRight="15dp" |
||||
android:textColor="@color/color_8a8a8a" |
||||
android:textSize="@dimen/NormalTextSize" |
||||
android:textStyle="bold" /> |
||||
|
||||
</RelativeLayout> |
||||
|
||||
<RelativeLayout |
||||
android:id="@+id/ll_sherlock_symbol" |
||||
android:layout_width="0dp" |
||||
android:layout_height="match_parent" |
||||
android:layout_marginLeft="10dp" |
||||
android:layout_weight="1" |
||||
android:background="@drawable/rectangle_radius_5_white_full" |
||||
android:visibility="gone"> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_divided_symbols" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerVertical="true" |
||||
android:layout_marginLeft="15dp" |
||||
android:text="分割符号" |
||||
android:textColor="@color/color_575757" |
||||
android:textSize="14.5sp" |
||||
android:textStyle="bold" /> |
||||
|
||||
<com.sherlockshi.widget.SherlockSpinner |
||||
android:id="@+id/sherlock_symbol" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:background="@null" |
||||
android:gravity="end|center_vertical" |
||||
android:paddingLeft="15dp" |
||||
android:paddingRight="15dp" |
||||
android:textColor="@color/color_8a8a8a" |
||||
android:textSize="@dimen/NormalTextSize" |
||||
android:textStyle="bold" /> |
||||
|
||||
</RelativeLayout> |
||||
|
||||
</LinearLayout> |
||||
|
||||
<LinearLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginLeft="10dp" |
||||
android:layout_marginRight="10dp" |
||||
android:background="@drawable/rectangle_radius_5_white_full" |
||||
android:orientation="vertical"> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginLeft="10dp" |
||||
android:layout_marginTop="10dp" |
||||
android:text="自定义格式描述" |
||||
android:textColor="@color/color_575757" |
||||
android:textSize="15sp" |
||||
android:textStyle="bold" /> |
||||
|
||||
<com.zhy.view.flowlayout.TagFlowLayout |
||||
android:id="@+id/flowlayout" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginLeft="10dp" |
||||
android:layout_marginRight="10dp" |
||||
app:max_select="-1"></com.zhy.view.flowlayout.TagFlowLayout> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginLeft="10dp" |
||||
android:layout_marginTop="10dp" |
||||
android:text="待选描述区" |
||||
android:textColor="@color/color_575757" |
||||
android:textSize="15sp" |
||||
android:textStyle="bold" /> |
||||
|
||||
<com.zhy.view.flowlayout.TagFlowLayout |
||||
android:id="@+id/tag_flowlayout" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:layout_marginLeft="10dp" |
||||
android:layout_marginRight="10dp" |
||||
android:layout_marginBottom="10dp" |
||||
app:max_select="-1"> |
||||
|
||||
</com.zhy.view.flowlayout.TagFlowLayout> |
||||
|
||||
</LinearLayout> |
||||
|
||||
</LinearLayout> |
||||
|
||||
</androidx.core.widget.NestedScrollView> |
||||
|
||||
<Button |
||||
android:id="@+id/btn_confirm" |
||||
style="@style/Widget.AppCompat.Button.Colored" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="@dimen/bt_height" |
||||
android:text="@string/confirm" /> |
||||
|
||||
</LinearLayout> |
@ -0,0 +1,308 @@ |
||||
<?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="50dp" |
||||
android:elevation="3dp" |
||||
app:layout_constraintEnd_toEndOf="parent" |
||||
app:layout_constraintStart_toStartOf="parent" |
||||
app:layout_constraintTop_toTopOf="parent"> |
||||
|
||||
<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="数量" |
||||
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/tv_sel_all" |
||||
app:layout_constraintStart_toStartOf="parent" |
||||
app:layout_constraintTop_toBottomOf="@id/top_layout" |
||||
android:layout_width="50dp" |
||||
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="全选" /> |
||||
<androidx.appcompat.widget.AppCompatTextView |
||||
android:id="@+id/header_name" |
||||
app:layout_constraintStart_toEndOf="@id/tv_sel_all" |
||||
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: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="match_parent" |
||||
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="编码" /> |
||||
<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="北坐标" /> |
||||
<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="东坐标" /> |
||||
<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="高程" /> |
||||
<androidx.appcompat.widget.AppCompatTextView |
||||
android:id="@+id/tv_latitude" |
||||
android:layout_width="110dp" |
||||
android:layout_height="50dp" |
||||
android:paddingHorizontal="10dp" |
||||
android:gravity="center" |
||||
android:textAppearance="@style/MyTextAppearanceBody1" |
||||
android:textSize="14sp" |
||||
android:textStyle="bold" |
||||
android:text="@string/latitude" /> |
||||
<androidx.appcompat.widget.AppCompatTextView |
||||
android:id="@+id/tv_longitude" |
||||
android:layout_width="110dp" |
||||
android:layout_height="50dp" |
||||
android:paddingHorizontal="10dp" |
||||
android:gravity="center" |
||||
android:textAppearance="@style/MyTextAppearanceBody1" |
||||
android:textSize="14sp" |
||||
android:textStyle="bold" |
||||
android:text="@string/longitude" /> |
||||
<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="大地高" /> |
||||
<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:textAppearance="@style/MyTextAppearanceBody1" |
||||
android:textSize="14sp" |
||||
android:textStyle="bold" |
||||
android:text="测量时间" /> |
||||
</LinearLayout> |
||||
</com.project.survey.widget.bingce.SyncHorizontalScrollView> |
||||
<com.project.survey.widget.bingce.TouchRelativeLayout |
||||
android:id="@+id/body_name_rl" |
||||
app:layout_constraintTop_toBottomOf="@id/tv_sel_all" |
||||
app:layout_constraintStart_toStartOf="@id/tv_sel_all" |
||||
app:layout_constraintBottom_toTopOf="@id/bottom_menu" |
||||
android:layout_width="150dp" |
||||
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="900dp" |
||||
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:layout_weight="1" |
||||
android:textAppearance="@style/MyTextAppearanceBody1" |
||||
android:text="@string/filter" /> |
||||
|
||||
<Button |
||||
android:id="@+id/points_library_btn_edit" |
||||
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/edit" /> |
||||
|
||||
<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_export" |
||||
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="导出" /> |
||||
|
||||
<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:layout_weight="1" |
||||
android:textAppearance="@style/MyTextAppearanceBody1" |
||||
android:text="@string/confirm" /> |
||||
|
||||
</LinearLayout> |
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout> |
@ -0,0 +1,632 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:orientation="vertical" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent"> |
||||
|
||||
<ScrollView |
||||
android:layout_width="match_parent" |
||||
android:layout_height="0dp" |
||||
android:layout_weight="1"> |
||||
|
||||
<LinearLayout |
||||
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:layout_marginTop="15dp" |
||||
android:layout_marginLeft="15dp" |
||||
android:layout_marginRight="15dp" |
||||
android:orientation="vertical" |
||||
android:background="@drawable/rectangle_radius_all_7_white_full"> |
||||
|
||||
<RelativeLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="50dp"> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_point_name" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerVertical="true" |
||||
android:layout_marginLeft="15dp" |
||||
android:textSize="15sp" |
||||
android:textColor="@color/black" |
||||
android:textStyle="bold" |
||||
android:text="@string/point_name"/> |
||||
|
||||
<com.bingce.ui.CleanableEditText |
||||
android:id="@+id/et_point_name" |
||||
android:layout_toRightOf="@+id/tv_point_name" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:layout_marginLeft="10dp" |
||||
android:layout_marginTop="5dp" |
||||
android:layout_marginBottom="5dp" |
||||
android:paddingLeft="15dp" |
||||
android:paddingRight="15dp" |
||||
android:background="@null" |
||||
android:drawableRight="@mipmap/icon_clear" |
||||
android:gravity="center_vertical|right" |
||||
android:hint="请输入点名" |
||||
android:textColor="@color/black" |
||||
android:textColorHint="@color/color_999999" |
||||
android:textStyle="bold" |
||||
android:textSize="14sp" /> |
||||
|
||||
</RelativeLayout> |
||||
|
||||
<include layout="@layout/layout_dividing_line_theme_gray"/> |
||||
|
||||
<RelativeLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="50dp"> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_code" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerVertical="true" |
||||
android:layout_marginLeft="15dp" |
||||
android:textSize="15sp" |
||||
android:textColor="@color/black" |
||||
android:textStyle="bold" |
||||
android:text="@string/point_code"/> |
||||
|
||||
<com.bingce.ui.CleanableEditText |
||||
android:id="@+id/et_code" |
||||
android:layout_toRightOf="@+id/tv_code" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:layout_marginLeft="10dp" |
||||
android:layout_marginTop="5dp" |
||||
android:layout_marginBottom="5dp" |
||||
android:paddingLeft="15dp" |
||||
android:paddingRight="15dp" |
||||
android:background="@null" |
||||
android:drawableRight="@mipmap/icon_clear" |
||||
android:gravity="center_vertical|right" |
||||
android:hint="@string/enter_code" |
||||
android:textColor="@color/black" |
||||
android:textColorHint="@color/color_999999" |
||||
android:textStyle="bold" |
||||
android:textSize="14sp" /> |
||||
|
||||
</RelativeLayout> |
||||
|
||||
<include layout="@layout/layout_dividing_line_theme_gray"/> |
||||
|
||||
<RelativeLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="50dp" |
||||
android:background="@drawable/rectangle_radius_all_7_white_full"> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_antenna_height" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerVertical="true" |
||||
android:layout_marginLeft="15dp" |
||||
android:textSize="15sp" |
||||
android:textColor="@color/black" |
||||
android:textStyle="bold" |
||||
android:text="@string/antenna_height"/> |
||||
|
||||
<TextView |
||||
android:layout_toRightOf="@+id/tv_antenna_height" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerVertical="true" |
||||
android:layout_marginLeft="5dp" |
||||
android:textSize="13sp" |
||||
android:textColor="@color/color_8a8a8a" |
||||
android:textStyle="bold" |
||||
android:text="(m)"/> |
||||
|
||||
<com.bingce.ui.CleanableEditText |
||||
android:id="@+id/et_antenna_height" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:layout_marginLeft="10dp" |
||||
android:layout_marginTop="5dp" |
||||
android:layout_marginBottom="5dp" |
||||
android:paddingLeft="15dp" |
||||
android:paddingRight="15dp" |
||||
android:background="@null" |
||||
android:digits="1234567890." |
||||
android:imeOptions="actionDone" |
||||
android:inputType="number|numberDecimal" |
||||
android:drawableRight="@mipmap/icon_clear" |
||||
android:gravity="center_vertical|right" |
||||
android:hint="@string/enter_pole_height" |
||||
android:textColor="@color/black" |
||||
android:textColorHint="@color/color_999999" |
||||
android:textStyle="bold" |
||||
android:textSize="14sp" /> |
||||
|
||||
</RelativeLayout> |
||||
|
||||
<include layout="@layout/layout_dividing_line_theme_gray"/> |
||||
|
||||
<RelativeLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="50dp" |
||||
android:background="@drawable/rectangle_radius_all_7_white_full"> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_remark" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerVertical="true" |
||||
android:layout_marginLeft="15dp" |
||||
android:textSize="15sp" |
||||
android:textColor="@color/black" |
||||
android:textStyle="bold" |
||||
android:text="@string/remark"/> |
||||
|
||||
<com.bingce.ui.CleanableEditText |
||||
android:id="@+id/et_remark" |
||||
android:layout_toRightOf="@+id/tv_remark" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:layout_marginLeft="10dp" |
||||
android:layout_marginTop="5dp" |
||||
android:layout_marginBottom="5dp" |
||||
android:paddingLeft="15dp" |
||||
android:paddingRight="15dp" |
||||
android:background="@null" |
||||
android:drawableRight="@mipmap/icon_clear" |
||||
android:gravity="center_vertical|right" |
||||
android:hint="@string/enter_remark" |
||||
android:textColor="@color/black" |
||||
android:textColorHint="@color/color_999999" |
||||
android:textStyle="bold" |
||||
android:textSize="14sp" /> |
||||
|
||||
</RelativeLayout> |
||||
|
||||
</LinearLayout> |
||||
|
||||
<LinearLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginTop="10dp" |
||||
android:layout_marginLeft="15dp" |
||||
android:layout_marginRight="15dp" |
||||
android:orientation="vertical" |
||||
android:background="@drawable/rectangle_radius_all_7_white_full"> |
||||
|
||||
<RelativeLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="50dp" |
||||
android:background="@drawable/rectangle_radius_all_7_white_full"> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerVertical="true" |
||||
android:layout_marginLeft="15dp" |
||||
android:textSize="15sp" |
||||
android:textColor="@color/black" |
||||
android:textStyle="bold" |
||||
android:text="@string/x_coordinate"/> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_x" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerVertical="true" |
||||
android:layout_alignParentRight="true" |
||||
android:layout_marginRight="15dp" |
||||
android:textColor="@color/color_C2C1BA" |
||||
android:textStyle="bold" |
||||
android:textSize="14sp" /> |
||||
|
||||
</RelativeLayout> |
||||
|
||||
<include layout="@layout/layout_dividing_line_theme_gray"/> |
||||
|
||||
<RelativeLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="50dp" |
||||
android:background="@drawable/rectangle_radius_all_7_white_full"> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerVertical="true" |
||||
android:layout_marginLeft="15dp" |
||||
android:textSize="15sp" |
||||
android:textColor="@color/black" |
||||
android:textStyle="bold" |
||||
android:text="@string/y_coordinate"/> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_y" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerVertical="true" |
||||
android:layout_alignParentRight="true" |
||||
android:layout_marginRight="15dp" |
||||
android:textColor="@color/color_C2C1BA" |
||||
android:textStyle="bold" |
||||
android:textSize="14sp" /> |
||||
|
||||
</RelativeLayout> |
||||
|
||||
<include layout="@layout/layout_dividing_line_theme_gray"/> |
||||
|
||||
<RelativeLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="50dp" |
||||
android:background="@drawable/rectangle_radius_all_7_white_full"> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerVertical="true" |
||||
android:layout_marginLeft="15dp" |
||||
android:textSize="15sp" |
||||
android:textColor="@color/black" |
||||
android:textStyle="bold" |
||||
android:text="@string/z_coordinate"/> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_z" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerVertical="true" |
||||
android:layout_alignParentRight="true" |
||||
android:layout_marginRight="15dp" |
||||
android:textColor="@color/color_C2C1BA" |
||||
android:textStyle="bold" |
||||
android:textSize="14sp" /> |
||||
|
||||
</RelativeLayout> |
||||
|
||||
</LinearLayout> |
||||
|
||||
<LinearLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginTop="10dp" |
||||
android:layout_marginLeft="15dp" |
||||
android:layout_marginRight="15dp" |
||||
android:orientation="vertical" |
||||
android:background="@drawable/rectangle_radius_all_7_white_full"> |
||||
|
||||
<RelativeLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="50dp" |
||||
android:background="@drawable/rectangle_radius_all_7_white_full"> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerVertical="true" |
||||
android:layout_marginLeft="15dp" |
||||
android:textSize="15sp" |
||||
android:textColor="@color/black" |
||||
android:textStyle="bold" |
||||
android:text="@string/latitude"/> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_latitude" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerVertical="true" |
||||
android:layout_alignParentRight="true" |
||||
android:layout_marginRight="15dp" |
||||
android:textColor="@color/color_C2C1BA" |
||||
android:textStyle="bold" |
||||
android:textSize="14sp" /> |
||||
|
||||
</RelativeLayout> |
||||
|
||||
<include layout="@layout/layout_dividing_line_theme_gray"/> |
||||
|
||||
<RelativeLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="50dp" |
||||
android:background="@drawable/rectangle_radius_all_7_white_full"> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerVertical="true" |
||||
android:layout_marginLeft="15dp" |
||||
android:textSize="15sp" |
||||
android:textColor="@color/black" |
||||
android:textStyle="bold" |
||||
android:text="@string/longitude"/> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_longitude" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerVertical="true" |
||||
android:layout_alignParentRight="true" |
||||
android:layout_marginRight="15dp" |
||||
android:textColor="@color/color_C2C1BA" |
||||
android:textStyle="bold" |
||||
android:textSize="14sp" /> |
||||
|
||||
</RelativeLayout> |
||||
|
||||
<include layout="@layout/layout_dividing_line_theme_gray"/> |
||||
|
||||
<RelativeLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="50dp" |
||||
android:background="@drawable/rectangle_radius_all_7_white_full"> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerVertical="true" |
||||
android:layout_marginLeft="15dp" |
||||
android:textSize="15sp" |
||||
android:textColor="@color/black" |
||||
android:textStyle="bold" |
||||
android:text="@string/altitude"/> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_altitude" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerVertical="true" |
||||
android:layout_alignParentRight="true" |
||||
android:layout_marginRight="15dp" |
||||
android:textColor="@color/color_C2C1BA" |
||||
android:textStyle="bold" |
||||
android:textSize="14sp" /> |
||||
|
||||
</RelativeLayout> |
||||
|
||||
</LinearLayout> |
||||
|
||||
<LinearLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginTop="10dp" |
||||
android:layout_marginLeft="15dp" |
||||
android:layout_marginRight="15dp" |
||||
android:orientation="vertical" |
||||
android:background="@drawable/rectangle_radius_all_7_white_full"> |
||||
|
||||
<RelativeLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="50dp" |
||||
android:background="@drawable/rectangle_radius_all_7_white_full"> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerVertical="true" |
||||
android:layout_marginLeft="15dp" |
||||
android:textSize="15sp" |
||||
android:textColor="@color/black" |
||||
android:textStyle="bold" |
||||
android:text="@string/hrms"/> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_hrms" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerVertical="true" |
||||
android:layout_alignParentRight="true" |
||||
android:layout_marginRight="15dp" |
||||
android:textColor="@color/color_C2C1BA" |
||||
android:textStyle="bold" |
||||
android:textSize="14sp" /> |
||||
|
||||
</RelativeLayout> |
||||
|
||||
<include layout="@layout/layout_dividing_line_theme_gray"/> |
||||
|
||||
<RelativeLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="50dp" |
||||
android:background="@drawable/rectangle_radius_all_7_white_full"> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerVertical="true" |
||||
android:layout_marginLeft="15dp" |
||||
android:textSize="15sp" |
||||
android:textColor="@color/black" |
||||
android:textStyle="bold" |
||||
android:text="@string/vrms"/> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_vrms" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerVertical="true" |
||||
android:layout_alignParentRight="true" |
||||
android:layout_marginRight="15dp" |
||||
android:textColor="@color/color_C2C1BA" |
||||
android:textStyle="bold" |
||||
android:textSize="14sp" /> |
||||
|
||||
</RelativeLayout> |
||||
|
||||
<include layout="@layout/layout_dividing_line_theme_gray"/> |
||||
|
||||
<RelativeLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="50dp" |
||||
android:background="@drawable/rectangle_radius_all_7_white_full"> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerVertical="true" |
||||
android:layout_marginLeft="15dp" |
||||
android:textSize="15sp" |
||||
android:textColor="@color/black" |
||||
android:textStyle="bold" |
||||
android:text="@string/pdop"/> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_pdop" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerVertical="true" |
||||
android:layout_alignParentRight="true" |
||||
android:layout_marginRight="15dp" |
||||
android:textColor="@color/color_C2C1BA" |
||||
android:textStyle="bold" |
||||
android:textSize="14sp" /> |
||||
|
||||
</RelativeLayout> |
||||
|
||||
<include layout="@layout/layout_dividing_line_theme_gray"/> |
||||
|
||||
<RelativeLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="50dp" |
||||
android:background="@drawable/rectangle_radius_all_7_white_full"> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerVertical="true" |
||||
android:layout_marginLeft="15dp" |
||||
android:textSize="15sp" |
||||
android:textColor="@color/black" |
||||
android:textStyle="bold" |
||||
android:text="@string/diff_age"/> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_diff_age" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerVertical="true" |
||||
android:layout_alignParentRight="true" |
||||
android:layout_marginRight="15dp" |
||||
android:textColor="@color/color_C2C1BA" |
||||
android:textStyle="bold" |
||||
android:textSize="14sp" /> |
||||
|
||||
</RelativeLayout> |
||||
|
||||
</LinearLayout> |
||||
|
||||
<LinearLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginTop="10dp" |
||||
android:layout_marginLeft="15dp" |
||||
android:layout_marginRight="15dp" |
||||
android:layout_marginBottom="15dp" |
||||
android:orientation="vertical" |
||||
android:background="@drawable/rectangle_radius_all_7_white_full"> |
||||
|
||||
<RelativeLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="50dp" |
||||
android:background="@drawable/rectangle_radius_all_7_white_full"> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerVertical="true" |
||||
android:layout_marginLeft="15dp" |
||||
android:textSize="15sp" |
||||
android:textColor="@color/black" |
||||
android:textStyle="bold" |
||||
android:text="@string/solution_status"/> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_solution_status" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerVertical="true" |
||||
android:layout_alignParentRight="true" |
||||
android:layout_marginRight="15dp" |
||||
android:textColor="@color/color_C2C1BA" |
||||
android:textStyle="bold" |
||||
android:textSize="14sp" /> |
||||
|
||||
</RelativeLayout> |
||||
|
||||
<include layout="@layout/layout_dividing_line_theme_gray"/> |
||||
|
||||
<RelativeLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="50dp" |
||||
android:background="@drawable/rectangle_radius_all_7_white_full"> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerVertical="true" |
||||
android:layout_marginLeft="15dp" |
||||
android:textSize="15sp" |
||||
android:textColor="@color/black" |
||||
android:textStyle="bold" |
||||
android:text="@string/solution_satellite_number"/> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_solution_satellite_number" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerVertical="true" |
||||
android:layout_alignParentRight="true" |
||||
android:layout_marginRight="15dp" |
||||
android:textColor="@color/color_C2C1BA" |
||||
android:textStyle="bold" |
||||
android:textSize="14sp" /> |
||||
|
||||
</RelativeLayout> |
||||
|
||||
<include layout="@layout/layout_dividing_line_theme_gray"/> |
||||
|
||||
<RelativeLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="50dp" |
||||
android:background="@drawable/rectangle_radius_all_7_white_full"> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerVertical="true" |
||||
android:layout_marginLeft="15dp" |
||||
android:textSize="15sp" |
||||
android:textColor="@color/black" |
||||
android:textStyle="bold" |
||||
android:text="@string/record_time"/> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_record_time" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerVertical="true" |
||||
android:layout_alignParentRight="true" |
||||
android:layout_marginRight="15dp" |
||||
android:textColor="@color/color_C2C1BA" |
||||
android:textStyle="bold" |
||||
android:textSize="14sp" /> |
||||
|
||||
</RelativeLayout> |
||||
|
||||
</LinearLayout> |
||||
|
||||
</LinearLayout> |
||||
|
||||
</ScrollView> |
||||
|
||||
<Button |
||||
android:id="@+id/edit_coordinate_point_btn_confirm" |
||||
style="@style/Widget.AppCompat.Button.Colored" |
||||
android:layout_width="match_parent" |
||||
android:layout_marginLeft="14dp" |
||||
android:layout_marginRight="14dp" |
||||
android:layout_height="@dimen/bt_height" |
||||
android:text="@string/confirm" /> |
||||
</LinearLayout> |
@ -0,0 +1,324 @@ |
||||
<?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:tools="http://schemas.android.com/tools" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent"> |
||||
|
||||
<LinearLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:orientation="vertical"> |
||||
|
||||
<TextView |
||||
android:id="@+id/type_label" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginLeft="15dp" |
||||
android:layout_marginTop="10dp" |
||||
android:layout_marginBottom="10dp" |
||||
android:text="数据分类" |
||||
android:textColor="@color/black" |
||||
android:textSize="14.5sp" |
||||
android:textStyle="bold" |
||||
android:visibility="gone"/> |
||||
|
||||
<LinearLayout |
||||
android:id="@+id/type_check_boxes" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginLeft="15dp" |
||||
android:layout_marginRight="15dp" |
||||
android:visibility="gone" |
||||
android:orientation="horizontal"> |
||||
|
||||
<LinearLayout |
||||
android:layout_width="0dp" |
||||
android:layout_height="wrap_content" |
||||
android:layout_weight="1" |
||||
android:orientation="horizontal"> |
||||
|
||||
<androidx.appcompat.widget.AppCompatCheckBox |
||||
android:id="@+id/cb_survey" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" /> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:textColor="@color/black" |
||||
android:textSize="14.5sp" /> |
||||
|
||||
</LinearLayout> |
||||
|
||||
<LinearLayout |
||||
android:layout_width="0dp" |
||||
android:layout_height="wrap_content" |
||||
android:layout_weight="1" |
||||
android:orientation="horizontal"> |
||||
|
||||
<androidx.appcompat.widget.AppCompatCheckBox |
||||
android:id="@+id/cb_input" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" /> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:textColor="@color/black" |
||||
android:textSize="14.5sp" /> |
||||
|
||||
</LinearLayout> |
||||
|
||||
<LinearLayout |
||||
android:layout_width="0dp" |
||||
android:layout_height="wrap_content" |
||||
android:layout_weight="1" |
||||
android:orientation="horizontal"> |
||||
|
||||
<androidx.appcompat.widget.AppCompatCheckBox |
||||
android:id="@+id/cb_control" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" /> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:textColor="@color/black" |
||||
android:textSize="14.5sp" /> |
||||
|
||||
</LinearLayout> |
||||
|
||||
</LinearLayout> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginLeft="15dp" |
||||
android:layout_marginTop="10dp" |
||||
android:layout_marginBottom="10dp" |
||||
android:text="采集时间" |
||||
android:textColor="@color/black" |
||||
android:textSize="14.5sp" |
||||
android:textStyle="bold" /> |
||||
|
||||
<LinearLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginLeft="15dp" |
||||
android:layout_marginRight="15dp" |
||||
android:orientation="horizontal"> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_today" |
||||
android:layout_width="0dp" |
||||
android:layout_height="40dp" |
||||
android:layout_weight="1" |
||||
android:background="@drawable/rectangle_radius_5_theme_green_line" |
||||
android:gravity="center" |
||||
android:text="今天" |
||||
android:textColor="@color/theme_green" |
||||
android:textSize="@dimen/NormalTextSize" |
||||
android:textStyle="bold" /> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_nearly_7_days" |
||||
android:layout_width="0dp" |
||||
android:layout_height="40dp" |
||||
android:layout_marginLeft="15dp" |
||||
android:layout_weight="1" |
||||
android:background="@drawable/rectangle_radius_5_theme_green_line" |
||||
android:gravity="center" |
||||
android:text="七天" |
||||
android:textColor="@color/theme_green" |
||||
android:textSize="@dimen/NormalTextSize" |
||||
android:textStyle="bold" /> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_all_days" |
||||
android:layout_width="0dp" |
||||
android:layout_height="40dp" |
||||
android:layout_marginLeft="15dp" |
||||
android:layout_weight="1" |
||||
android:background="@drawable/rectangle_radius_5_theme_green_line" |
||||
android:gravity="center" |
||||
android:text="@string/all" |
||||
android:textColor="@color/theme_green" |
||||
android:textSize="@dimen/NormalTextSize" |
||||
android:textStyle="bold" /> |
||||
|
||||
</LinearLayout> |
||||
|
||||
<LinearLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:layout_margin="15dp" |
||||
android:orientation="horizontal"> |
||||
|
||||
<TextView |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_gravity="center_vertical" |
||||
android:text="@string/apn_operator_custom" |
||||
android:textColor="@color/color_575757" |
||||
android:textSize="@dimen/NormalTextSize" /> |
||||
|
||||
<RelativeLayout |
||||
android:id="@+id/rl_start_date" |
||||
android:layout_width="0dp" |
||||
android:layout_height="40dp" |
||||
android:layout_gravity="center_vertical" |
||||
android:layout_marginLeft="10dp" |
||||
android:layout_marginRight="10dp" |
||||
android:layout_weight="1" |
||||
android:background="@drawable/rectangle_radius_5_theme_gray_line"> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_start_date" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerVertical="true" |
||||
android:layout_marginLeft="10dp" |
||||
android:text="2022/01/01" |
||||
android:textColor="@color/color_575757" |
||||
android:textSize="@dimen/NormalTextSize" /> |
||||
|
||||
<ImageView |
||||
android:id="@+id/iv_start_calendar" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="15dp" |
||||
android:layout_alignParentRight="true" |
||||
android:layout_centerVertical="true" |
||||
android:layout_marginRight="5dp" |
||||
android:src="@mipmap/icon_calendar_gray" /> |
||||
|
||||
</RelativeLayout> |
||||
|
||||
<View |
||||
android:layout_width="15dp" |
||||
android:layout_height="@dimen/divider_height" |
||||
android:layout_gravity="center_vertical" |
||||
android:background="@color/theme_gray" /> |
||||
|
||||
<RelativeLayout |
||||
android:id="@+id/rl_end_date" |
||||
android:layout_width="0dp" |
||||
android:layout_height="40dp" |
||||
android:layout_gravity="center_vertical" |
||||
android:layout_marginLeft="10dp" |
||||
android:layout_weight="1" |
||||
android:background="@drawable/rectangle_radius_5_theme_gray_line"> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_end_date" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerVertical="true" |
||||
android:layout_marginLeft="10dp" |
||||
android:text="2022/01/01" |
||||
android:textColor="@color/color_575757" |
||||
android:textSize="@dimen/NormalTextSize" /> |
||||
|
||||
<ImageView |
||||
android:id="@+id/iv_end_calendar" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="15dp" |
||||
android:layout_alignParentRight="true" |
||||
android:layout_centerVertical="true" |
||||
android:layout_marginRight="5dp" |
||||
android:src="@mipmap/icon_calendar_gray" /> |
||||
|
||||
</RelativeLayout> |
||||
|
||||
</LinearLayout> |
||||
|
||||
<com.bingce.ui.CleanableEditText |
||||
android:id="@+id/et_name" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="40dp" |
||||
android:layout_alignParentRight="true" |
||||
android:layout_centerVertical="true" |
||||
android:layout_marginLeft="15dp" |
||||
android:layout_marginRight="15dp" |
||||
android:background="@drawable/rectangle_radius_5_theme_gray_line" |
||||
android:drawableRight="@mipmap/icon_clear" |
||||
android:gravity="center_vertical" |
||||
android:hint="名称关键字" |
||||
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" /> |
||||
|
||||
<com.bingce.ui.CleanableEditText |
||||
android:id="@+id/et_code" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="40dp" |
||||
android:layout_alignParentRight="true" |
||||
android:layout_centerVertical="true" |
||||
android:layout_marginLeft="15dp" |
||||
android:layout_marginTop="15dp" |
||||
android:layout_marginRight="15dp" |
||||
android:background="@drawable/rectangle_radius_5_theme_gray_line" |
||||
android:drawableRight="@mipmap/icon_clear" |
||||
android:gravity="center_vertical" |
||||
android:hint="编码关键词" |
||||
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" /> |
||||
|
||||
<com.bingce.ui.CleanableEditText |
||||
android:id="@+id/et_remarks" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="40dp" |
||||
android:layout_alignParentRight="true" |
||||
android:layout_centerVertical="true" |
||||
android:layout_marginLeft="15dp" |
||||
android:layout_marginTop="15dp" |
||||
android:layout_marginRight="15dp" |
||||
android:background="@drawable/rectangle_radius_5_theme_gray_line" |
||||
android:drawableRight="@mipmap/icon_clear" |
||||
android:gravity="center_vertical" |
||||
android:hint="备注关键词" |
||||
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" /> |
||||
|
||||
</LinearLayout> |
||||
|
||||
<LinearLayout |
||||
android:id="@+id/bottom_menu" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:layout_weight="1" |
||||
android:layout_alignParentBottom="true" > |
||||
|
||||
<Button |
||||
android:id="@+id/filter_btn_cancel" |
||||
style="@style/Widget.AppCompat.Button.Colored" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="@dimen/bt_height" |
||||
android:layout_weight="1" |
||||
android:text="@string/cancel" /> |
||||
|
||||
<Button |
||||
android:id="@+id/filter_btn_confirm" |
||||
style="@style/Widget.AppCompat.Button.Colored" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="@dimen/bt_height" |
||||
android:layout_weight="1" |
||||
android:text="@string/confirm" /> |
||||
|
||||
</LinearLayout> |
||||
|
||||
</RelativeLayout> |
@ -0,0 +1,56 @@ |
||||
<?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"> |
||||
|
||||
<androidx.recyclerview.widget.RecyclerView |
||||
android:id="@+id/recyclerView" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:layout_weight="1" /> |
||||
|
||||
<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_new_create" |
||||
style="@style/Widget.AppCompat.Button.Colored" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="@dimen/bt_height" |
||||
android:layout_weight="1" |
||||
android:text="@string/new_create" /> |
||||
|
||||
<Button |
||||
android:id="@+id/points_library_btn_edit" |
||||
style="@style/Widget.AppCompat.Button.Colored" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="@dimen/bt_height" |
||||
android:layout_weight="1" |
||||
android:text="@string/edit" /> |
||||
|
||||
<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:layout_weight="1" |
||||
android:text="@string/delete" /> |
||||
|
||||
<Button |
||||
android:id="@+id/points_library_btn_import_export" |
||||
style="@style/Widget.AppCompat.Button.Colored" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="@dimen/bt_height" |
||||
android:layout_weight="1" |
||||
android:text="导出" /> |
||||
|
||||
</LinearLayout> |
||||
|
||||
</LinearLayout> |
@ -0,0 +1,120 @@ |
||||
<?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" |
||||
app:autoSizeTextType="uniform" |
||||
app:autoSizeMinTextSize="10sp" |
||||
app:autoSizeMaxTextSize="14sp" |
||||
app:autoSizeStepGranularity="1sp" |
||||
tools:text="@string/point_code" /> |
||||
<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:textAppearance="@style/MyTextAppearanceBody1" |
||||
android:textSize="14sp" |
||||
app:autoSizeTextType="uniform" |
||||
app:autoSizeMinTextSize="9sp" |
||||
app:autoSizeMaxTextSize="14sp" |
||||
app:autoSizeStepGranularity="1sp" |
||||
android:text="@string/northing"/> |
||||
<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:maxLines="1" |
||||
android:textAppearance="@style/MyTextAppearanceBody1" |
||||
android:textSize="14sp" |
||||
app:autoSizeTextType="uniform" |
||||
app:autoSizeMinTextSize="10sp" |
||||
app:autoSizeMaxTextSize="14sp" |
||||
app:autoSizeStepGranularity="1sp" |
||||
tools:text="@string/easting" /> |
||||
<androidx.appcompat.widget.AppCompatTextView |
||||
android:id="@+id/tv_h" |
||||
android:layout_width="110dp" |
||||
android:layout_height="match_parent" |
||||
android:paddingHorizontal="5dp" |
||||
android:gravity="center" |
||||
android:maxLines="1" |
||||
android:textAppearance="@style/MyTextAppearanceBody1" |
||||
android:textSize="14sp" |
||||
app:autoSizeTextType="uniform" |
||||
app:autoSizeMinTextSize="10sp" |
||||
app:autoSizeMaxTextSize="14sp" |
||||
app:autoSizeStepGranularity="1sp" |
||||
tools:text="@string/elevation" /> |
||||
<androidx.appcompat.widget.AppCompatTextView |
||||
android:id="@+id/tv_latitude" |
||||
android:layout_width="110dp" |
||||
android:layout_height="match_parent" |
||||
android:paddingHorizontal="5dp" |
||||
android:gravity="center" |
||||
android:maxLines="1" |
||||
android:textAppearance="@style/MyTextAppearanceBody1" |
||||
android:textSize="14sp" |
||||
app:autoSizeTextType="uniform" |
||||
app:autoSizeMinTextSize="10sp" |
||||
app:autoSizeMaxTextSize="14sp" |
||||
app:autoSizeStepGranularity="1sp" |
||||
tools:text="@string/latitude" /> |
||||
<androidx.appcompat.widget.AppCompatTextView |
||||
android:id="@+id/tv_longitude" |
||||
android:layout_width="110dp" |
||||
android:layout_height="match_parent" |
||||
android:paddingHorizontal="5dp" |
||||
android:gravity="center" |
||||
android:maxLines="1" |
||||
android:textAppearance="@style/MyTextAppearanceBody1" |
||||
android:textSize="14sp" |
||||
app:autoSizeTextType="uniform" |
||||
app:autoSizeMinTextSize="10sp" |
||||
app:autoSizeMaxTextSize="14sp" |
||||
app:autoSizeStepGranularity="1sp" |
||||
tools:text="@string/longitude" /> |
||||
<androidx.appcompat.widget.AppCompatTextView |
||||
android:id="@+id/tv_earth_h" |
||||
android:layout_width="110dp" |
||||
android:layout_height="match_parent" |
||||
android:paddingHorizontal="5dp" |
||||
android:gravity="center" |
||||
android:maxLines="1" |
||||
android:textAppearance="@style/MyTextAppearanceBody1" |
||||
android:textSize="14sp" |
||||
app:autoSizeTextType="uniform" |
||||
app:autoSizeMinTextSize="10sp" |
||||
app:autoSizeMaxTextSize="14sp" |
||||
app:autoSizeStepGranularity="1sp" |
||||
tools:text="@string/altitude" /> |
||||
<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:maxLines="1" |
||||
android:textAppearance="@style/MyTextAppearanceBody1" |
||||
android:textSize="14sp" |
||||
app:autoSizeTextType="uniform" |
||||
app:autoSizeMinTextSize="10sp" |
||||
app:autoSizeMaxTextSize="14sp" |
||||
app:autoSizeStepGranularity="1sp" |
||||
tools:text="@string/add_time" /> |
||||
</LinearLayout> |
@ -0,0 +1,31 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="50dp" |
||||
xmlns:tools="http://schemas.android.com/tools" |
||||
xmlns:app="http://schemas.android.com/apk/res-auto" |
||||
android:orientation="horizontal"> |
||||
<FrameLayout |
||||
android:layout_width="50dp" |
||||
android:layout_height="match_parent"> |
||||
<com.hjq.shape.view.ShapeCheckBox |
||||
android:id="@+id/check_box" |
||||
android:layout_gravity="center" |
||||
android:layout_width="wrap_content" |
||||
android:enabled="false" |
||||
app:shape_buttonCheckedDrawable="@mipmap/ic_dialogx_mul_menu_bc_item_sel" |
||||
app:shape_buttonDrawable="@mipmap/ic_dialogx_mul_menu_bc_item_unsel" |
||||
android:layout_height="wrap_content" /> |
||||
</FrameLayout> |
||||
|
||||
<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="1" |
||||
android:textAppearance="@style/MyTextAppearanceBody1" |
||||
android:textSize="14sp" |
||||
tools:text="点名" /> |
||||
</LinearLayout> |
@ -0,0 +1,92 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:orientation="vertical" |
||||
android:gravity="center" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent"> |
||||
|
||||
<LinearLayout |
||||
android:layout_width="275dp" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginLeft="20dp" |
||||
android:layout_marginRight="20dp" |
||||
android:orientation="vertical" |
||||
android:background="@drawable/rectangle_radius_5_white_full"> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_title" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="50dp" |
||||
android:textSize="16sp" |
||||
android:textStyle="bold" |
||||
android:text="@string/prompt" |
||||
android:gravity="center" |
||||
android:layout_marginTop="3dp" |
||||
android:textColor="@color/black"/> |
||||
|
||||
<RelativeLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content"> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_content" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerInParent="true" |
||||
android:text="湿哒哒" |
||||
android:textColor="@color/color_575757" |
||||
android:textSize="14.5sp" |
||||
android:layout_marginBottom="5dp"/> |
||||
|
||||
</RelativeLayout> |
||||
|
||||
<LinearLayout |
||||
android:id="@+id/ll_button" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="55dp" |
||||
android:orientation="horizontal"> |
||||
|
||||
<LinearLayout |
||||
android:layout_width="0dp" |
||||
android:layout_height="match_parent" |
||||
android:layout_weight="2"> |
||||
|
||||
<TextView |
||||
android:id="@+id/btn_look_sample" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:text="@string/look_at_sample" |
||||
android:textColor="@color/theme_green" |
||||
android:gravity="center_vertical" |
||||
android:textStyle="bold" |
||||
android:textSize="@dimen/NormalTextSize" /> |
||||
|
||||
</LinearLayout> |
||||
|
||||
<TextView |
||||
android:id="@+id/btn_cancel" |
||||
android:layout_width="0dp" |
||||
android:layout_height="match_parent" |
||||
android:layout_weight="1" |
||||
android:text="@string/cancel" |
||||
android:textColor="@color/theme_green" |
||||
android:gravity="center_vertical|right" |
||||
android:textStyle="bold" |
||||
android:textSize="@dimen/NormalTextSize" /> |
||||
|
||||
<TextView |
||||
android:id="@+id/btn_confirm" |
||||
android:layout_width="0dp" |
||||
android:layout_height="match_parent" |
||||
android:layout_weight="1" |
||||
android:text="@string/confirm" |
||||
android:gravity="center_vertical|right" |
||||
android:textColor="@color/theme_green" |
||||
android:textStyle="bold" |
||||
android:textSize="@dimen/NormalTextSize" /> |
||||
|
||||
</LinearLayout> |
||||
|
||||
</LinearLayout> |
||||
|
||||
</LinearLayout> |
@ -0,0 +1,12 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:orientation="vertical" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content"> |
||||
|
||||
<View |
||||
android:layout_width="match_parent" |
||||
android:layout_height="@dimen/divider_height" |
||||
android:background="@color/theme_gray"/> |
||||
|
||||
</LinearLayout> |
@ -0,0 +1,26 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<RelativeLayout |
||||
xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:layout_width="88dp" |
||||
android:layout_height="wrap_content"> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_name" |
||||
android:layout_marginTop="10dp" |
||||
android:layout_width="80dp" |
||||
android:gravity="center" |
||||
android:layout_height="32dp" |
||||
android:background="@drawable/rectangle_radius_5_theme_green_press_full" |
||||
android:textSize="13sp" |
||||
android:textColor="@color/white" |
||||
android:textStyle="bold"> |
||||
</TextView> |
||||
|
||||
<ImageView |
||||
android:id="@+id/iv_delete" |
||||
android:layout_alignParentRight="true" |
||||
android:layout_width="20dp" |
||||
android:layout_height="20dp" |
||||
android:src="@mipmap/icon_red_delect" /> |
||||
|
||||
</RelativeLayout> |
@ -0,0 +1,19 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||
android:orientation="vertical" |
||||
android:layout_width="88dp" |
||||
android:layout_height="wrap_content"> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_name" |
||||
android:layout_width="80dp" |
||||
android:layout_height="32dp" |
||||
android:gravity="center" |
||||
android:layout_marginTop="7dp" |
||||
android:background="@drawable/rectangle_radius_5_theme_gray_full" |
||||
android:textSize="13sp" |
||||
android:textColor="@color/color_575757" |
||||
android:textStyle="bold"> |
||||
</TextView> |
||||
|
||||
</LinearLayout> |
@ -0,0 +1,141 @@ |
||||
<?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="wrap_content" |
||||
android:orientation="vertical"> |
||||
|
||||
<RelativeLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="85dp" |
||||
android:layout_marginLeft="15dp" |
||||
android:layout_marginTop="10dp" |
||||
android:layout_marginRight="15dp" |
||||
android:background="@drawable/rectangle_radius_all_7_white_full"> |
||||
|
||||
<LinearLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="match_parent" |
||||
android:layout_alignParentLeft="true" |
||||
android:layout_toLeftOf="@+id/rl_end" |
||||
android:gravity="center_vertical" |
||||
android:orientation="vertical" |
||||
android:paddingLeft="15dp"> |
||||
|
||||
<LinearLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:gravity="center_vertical"> |
||||
|
||||
<ImageView |
||||
android:id="@+id/iv_format_fixed" |
||||
android:layout_width="16dp" |
||||
android:layout_height="16dp" |
||||
android:layout_marginRight="4dp" |
||||
android:src="@drawable/icon_format_fixed" /> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_name" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerVertical="true" |
||||
android:ellipsize="end" |
||||
android:lines="1" |
||||
android:text="自定义" |
||||
android:textColor="@color/black" |
||||
android:textSize="14.5sp" |
||||
android:textStyle="bold" /> |
||||
|
||||
</LinearLayout> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_content" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_centerVertical="true" |
||||
android:layout_marginTop="5dp" |
||||
android:ellipsize="end" |
||||
android:lines="1" |
||||
android:text="自定义1111111111111111111111111111111111111111111111111111111" |
||||
android:textColor="@color/color_575757" |
||||
android:textSize="@dimen/NormalTextSize" /> |
||||
|
||||
<LinearLayout |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginTop="5dp" |
||||
android:orientation="horizontal"> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_file_header" |
||||
android:layout_width="0dp" |
||||
android:layout_height="wrap_content" |
||||
android:layout_weight="1" |
||||
android:text="文件表头" |
||||
android:textColor="@color/color_575757" |
||||
android:textSize="@dimen/NormalTextSize" |
||||
android:textStyle="bold" /> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_angle_formats" |
||||
android:layout_width="0dp" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginLeft="15dp" |
||||
android:layout_weight="1" |
||||
android:text="角度格式" |
||||
android:textColor="@color/color_575757" |
||||
android:textSize="@dimen/NormalTextSize" |
||||
android:textStyle="bold" /> |
||||
|
||||
</LinearLayout> |
||||
|
||||
</LinearLayout> |
||||
|
||||
<RelativeLayout |
||||
android:id="@+id/rl_end" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="match_parent" |
||||
android:layout_alignParentRight="true" |
||||
android:paddingLeft="10dp" |
||||
android:paddingRight="15dp"> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_view_all" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginTop="10dp" |
||||
android:text="[查看全部]" |
||||
android:textColor="@color/color_1781FF" |
||||
android:textSize="@dimen/NormalTextSize" |
||||
android:textStyle="bold" /> |
||||
|
||||
<LinearLayout |
||||
android:id="@+id/ll_end" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="match_parent" |
||||
android:gravity="center_vertical"> |
||||
|
||||
<TextView |
||||
android:id="@+id/tv_suffix" |
||||
android:layout_width="wrap_content" |
||||
android:layout_height="wrap_content" |
||||
android:layout_marginRight="10dp" |
||||
android:text=".xls" |
||||
android:textColor="@color/black" |
||||
android:textSize="14.5sp" |
||||
android:textStyle="bold" /> |
||||
|
||||
<ImageView |
||||
android:id="@+id/iv_checkbox" |
||||
android:layout_width="20dp" |
||||
android:layout_height="20dp" |
||||
android:layout_alignParentRight="true" |
||||
android:layout_centerVertical="true" |
||||
android:src="@mipmap/icon_checkbox_unselect" /> |
||||
|
||||
</LinearLayout> |
||||
|
||||
</RelativeLayout> |
||||
|
||||
</RelativeLayout> |
||||
|
||||
</LinearLayout> |
After Width: | Height: | Size: 472 B |
After Width: | Height: | Size: 504 B |
After Width: | Height: | Size: 885 B |
Loading…
Reference in new issue