|
|
|
@ -27,6 +27,7 @@ import com.bingce.data.sync.utils.LoadCurrentProjectIdKt; |
|
|
|
|
import com.bingce.data.sync.utils.LoadCurrentRoadIdKt; |
|
|
|
|
import com.bingce.data.sync.utils.LoadCurrentWaterPipeIdKt; |
|
|
|
|
import com.bingce.data.sync.utils.LoadUserConfigKt; |
|
|
|
|
import com.bingce.utils.IntentUtil; |
|
|
|
|
import com.bingce.utils.StringUtil; |
|
|
|
|
import com.bingce.utils.ThreadPoolUtil; |
|
|
|
|
import com.hjq.permissions.Permission; |
|
|
|
@ -71,7 +72,7 @@ public class RecordsActivity extends ColorfulActivity { |
|
|
|
|
private ShapeTextView tv_filter_dcs_type; |
|
|
|
|
private ActivityRecordsBinding binding; |
|
|
|
|
|
|
|
|
|
private int currentTypeFromSpinner; |
|
|
|
|
private int currentTypeFromSpinner = RecordTypeConstants.TYPE_POINT_STAKE; |
|
|
|
|
private final RecordsActivityFilterUtils filterUtils = new RecordsActivityFilterUtils(() -> this, |
|
|
|
|
() -> currentTypeFromSpinner, () -> tv_filter_time, () -> tv_filter_dcs_type); |
|
|
|
|
private final RecordsActivityExportUtils exportUtils = new RecordsActivityExportUtils(() -> this, () -> currentTypeFromSpinner); |
|
|
|
@ -82,6 +83,7 @@ public class RecordsActivity extends ColorfulActivity { |
|
|
|
|
private final RecordsActivityHeaders headers = new RecordsActivityHeaders(() -> this); |
|
|
|
|
private final RecordsViewModelKt.HolderInActivity holderInActivity = |
|
|
|
|
new RecordsViewModelKt.HolderInActivity(this); |
|
|
|
|
private String workId = ""; |
|
|
|
|
|
|
|
|
|
public static void start(Context context, int type) { |
|
|
|
|
Intent intent = new Intent(context, RecordsActivity.class); |
|
|
|
@ -94,6 +96,14 @@ public class RecordsActivity extends ColorfulActivity { |
|
|
|
|
context.startActivity(intent); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static final String KEY_WORK_ID = "keyWorkId"; |
|
|
|
|
|
|
|
|
|
public static void start(Context context, String workId) { |
|
|
|
|
Intent intent = new Intent(context, RecordsActivity.class); |
|
|
|
|
intent.putExtra(KEY_WORK_ID, workId); |
|
|
|
|
context.startActivity(intent); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@SuppressLint("SourceLockedOrientationActivity") |
|
|
|
|
@Override |
|
|
|
|
protected void onCreate(Bundle savedInstanceState) { |
|
|
|
@ -108,9 +118,13 @@ public class RecordsActivity extends ColorfulActivity { |
|
|
|
|
super.onCreate(savedInstanceState); |
|
|
|
|
binding = ActivityRecordsBinding.inflate(getLayoutInflater()); |
|
|
|
|
setContentView(binding.getRoot()); |
|
|
|
|
setSupportActionBar(binding.toolbarWithOneSpinner); |
|
|
|
|
setSupportActionBar(binding.toolbar); |
|
|
|
|
if (getSupportActionBar() != null) |
|
|
|
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true); |
|
|
|
|
getSupportActionBar().setTitle("采集记录"); |
|
|
|
|
|
|
|
|
|
workId = IntentUtil.stringExtra(this, KEY_WORK_ID); |
|
|
|
|
|
|
|
|
|
tv_top_date_filter = findViewById(R.id.activity_records_top_date_filter); |
|
|
|
|
tv_filter_time = findViewById(R.id.tv_filter_time); |
|
|
|
|
tv_filter_dcs_type = findViewById(R.id.tv_filter_dcs_type); |
|
|
|
@ -126,7 +140,8 @@ public class RecordsActivity extends ColorfulActivity { |
|
|
|
|
tv_filter_dcs_type.getShapeDrawableBuilder().setSolidColor(Color.WHITE).intoBackground(); |
|
|
|
|
tv_filter_other.getShapeDrawableBuilder().setSolidColor(Color.WHITE).intoBackground(); |
|
|
|
|
} |
|
|
|
|
initSpinnerType(); |
|
|
|
|
// initSpinnerType();
|
|
|
|
|
updateRecyclerView(); |
|
|
|
|
headers.initHeaders(); |
|
|
|
|
binding.ivOrder.setOnClickListener(view -> { |
|
|
|
|
isSortByTimeAcs = !isSortByTimeAcs; |
|
|
|
@ -149,110 +164,110 @@ public class RecordsActivity extends ColorfulActivity { |
|
|
|
|
/** |
|
|
|
|
* 切换里程坐标等记录类型 |
|
|
|
|
*/ |
|
|
|
|
private void initSpinnerType() { |
|
|
|
|
binding.spinner1.setOnItemSelectedListener(spinnerListener); |
|
|
|
|
|
|
|
|
|
List<String> spinnerTitlesList = new ArrayList<>(); |
|
|
|
|
for (Map.Entry<Integer, IRecordsUtils> entry : recordsUtilsMap.entrySet()) { |
|
|
|
|
if (entry == null) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
IRecordsUtils recordsUtils = entry.getValue(); |
|
|
|
|
if (recordsUtils == null) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
int type = entry.getKey(); |
|
|
|
|
String name = recordsUtils.name(); |
|
|
|
|
switch (type) { |
|
|
|
|
case RecordTypeConstants.TYPE_CUSTOM_ZHONG_JIAO_ONE: |
|
|
|
|
if (AppChannel.customChannel == AppChannel.CUSTOM_ZJYGJ) { |
|
|
|
|
spinnerTitlesList.add(name); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case RecordTypeConstants.TYPE_CUSTOM_TIAN_JING_ONE: |
|
|
|
|
if (AppChannel.customChannel == AppChannel.CUSTOM_CR18SZ) { |
|
|
|
|
spinnerTitlesList.add(name); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case RecordTypeConstants.TYPE_CUSTOM_MDM: |
|
|
|
|
if (AppChannel.customChannel == AppChannel.CUSTOM_MONITOR) { |
|
|
|
|
spinnerTitlesList.add(name); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
// case RecordTypeConstants.TYPE_ROTARY_BRIDGE_6COM:
|
|
|
|
|
// if (AppChannel.customChannel == AppChannel.CUSTOM_6_COM) {
|
|
|
|
|
// private void initSpinnerType() {
|
|
|
|
|
// binding.spinner1.setOnItemSelectedListener(spinnerListener);
|
|
|
|
|
//
|
|
|
|
|
// List<String> spinnerTitlesList = new ArrayList<>();
|
|
|
|
|
// for (Map.Entry<Integer, IRecordsUtils> entry : recordsUtilsMap.entrySet()) {
|
|
|
|
|
// if (entry == null) {
|
|
|
|
|
// continue;
|
|
|
|
|
// }
|
|
|
|
|
// IRecordsUtils recordsUtils = entry.getValue();
|
|
|
|
|
// if (recordsUtils == null) {
|
|
|
|
|
// continue;
|
|
|
|
|
// }
|
|
|
|
|
// int type = entry.getKey();
|
|
|
|
|
// String name = recordsUtils.name();
|
|
|
|
|
// switch (type) {
|
|
|
|
|
// case RecordTypeConstants.TYPE_CUSTOM_ZHONG_JIAO_ONE:
|
|
|
|
|
// if (AppChannel.customChannel == AppChannel.CUSTOM_ZJYGJ) {
|
|
|
|
|
// spinnerTitlesList.add(name);
|
|
|
|
|
// }
|
|
|
|
|
// break;
|
|
|
|
|
default: |
|
|
|
|
spinnerTitlesList.add(name); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ArrayAdapter<String> mSpinnerAdapter = new ArrayAdapter<>(this, |
|
|
|
|
R.layout.spinner_dropdown_item_my_with_background, android.R.id.text1, |
|
|
|
|
spinnerTitlesList); |
|
|
|
|
binding.spinner1.setAdapter(mSpinnerAdapter); |
|
|
|
|
|
|
|
|
|
//设置默认记录类型
|
|
|
|
|
int type = App.instance.getLastRecordBrowseType(); |
|
|
|
|
Intent intent = getIntent(); |
|
|
|
|
if (intent != null && intent.hasExtra(KEY_TYPE)) { |
|
|
|
|
type = intent.getIntExtra(KEY_TYPE, 0); |
|
|
|
|
} |
|
|
|
|
int lastType = Math.max(type, 0); |
|
|
|
|
|
|
|
|
|
IRecordsUtils utils = recordsUtilsMap.get(lastType); |
|
|
|
|
int index = 0; |
|
|
|
|
if (utils != null) { |
|
|
|
|
String name = utils.name(); |
|
|
|
|
boolean found = false; |
|
|
|
|
for (index = 0; index < spinnerTitlesList.size(); index++) { |
|
|
|
|
if (spinnerTitlesList.get(index).equals(name)) { |
|
|
|
|
found = true; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (!found) { |
|
|
|
|
index = 0; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
binding.spinner1.setSelection(index); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//里程计算坐标等类型切换监听器
|
|
|
|
|
AdapterView.OnItemSelectedListener spinnerListener = new AdapterView.OnItemSelectedListener() { |
|
|
|
|
@Override |
|
|
|
|
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { |
|
|
|
|
String typeString = binding.spinner1.getSelectedItem().toString(); |
|
|
|
|
Set<Map.Entry<Integer, IRecordsUtils>> entries = recordsUtilsMap.entrySet(); |
|
|
|
|
for (Map.Entry<Integer, IRecordsUtils> entry : entries) { |
|
|
|
|
if (entry.getValue().name().equals(typeString)) { |
|
|
|
|
currentTypeFromSpinner = entry.getKey(); |
|
|
|
|
if (currentTypeFromSpinner != RecordTypeConstants.TYPE_TUNNEL_BACK_BREAK && currentTypeFromSpinner != RecordTypeConstants.TYPE_WATER_PIPE_BACK_BREAK) { |
|
|
|
|
filterUtils.resetTcsType(); |
|
|
|
|
tv_filter_dcs_type.setVisibility(View.GONE); |
|
|
|
|
} else { |
|
|
|
|
tv_filter_dcs_type.setVisibility(View.VISIBLE); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
updateRecyclerView(); |
|
|
|
|
App.instance.setLastRecordBrowseType(currentTypeFromSpinner); |
|
|
|
|
SharedPreferences prefs = |
|
|
|
|
PreferenceManager.getDefaultSharedPreferences(RecordsActivity.this); |
|
|
|
|
SharedPreferences.Editor editor = prefs.edit(); |
|
|
|
|
editor.putInt("lastRecordBrowseType", App.instance.getLastRecordBrowseType()); |
|
|
|
|
editor.apply(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void onNothingSelected(AdapterView<?> parent) { |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
// case RecordTypeConstants.TYPE_CUSTOM_TIAN_JING_ONE:
|
|
|
|
|
// if (AppChannel.customChannel == AppChannel.CUSTOM_CR18SZ) {
|
|
|
|
|
// spinnerTitlesList.add(name);
|
|
|
|
|
// }
|
|
|
|
|
// break;
|
|
|
|
|
// case RecordTypeConstants.TYPE_CUSTOM_MDM:
|
|
|
|
|
// if (AppChannel.customChannel == AppChannel.CUSTOM_MONITOR) {
|
|
|
|
|
// spinnerTitlesList.add(name);
|
|
|
|
|
// }
|
|
|
|
|
// break;
|
|
|
|
|
//// case RecordTypeConstants.TYPE_ROTARY_BRIDGE_6COM:
|
|
|
|
|
//// if (AppChannel.customChannel == AppChannel.CUSTOM_6_COM) {
|
|
|
|
|
//// spinnerTitlesList.add(name);
|
|
|
|
|
//// }
|
|
|
|
|
//// break;
|
|
|
|
|
// default:
|
|
|
|
|
// spinnerTitlesList.add(name);
|
|
|
|
|
// break;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// ArrayAdapter<String> mSpinnerAdapter = new ArrayAdapter<>(this,
|
|
|
|
|
// R.layout.spinner_dropdown_item_my_with_background, android.R.id.text1,
|
|
|
|
|
// spinnerTitlesList);
|
|
|
|
|
// binding.spinner1.setAdapter(mSpinnerAdapter);
|
|
|
|
|
//
|
|
|
|
|
// //设置默认记录类型
|
|
|
|
|
// int type = App.instance.getLastRecordBrowseType();
|
|
|
|
|
// Intent intent = getIntent();
|
|
|
|
|
// if (intent != null && intent.hasExtra(KEY_TYPE)) {
|
|
|
|
|
// type = intent.getIntExtra(KEY_TYPE, 0);
|
|
|
|
|
// }
|
|
|
|
|
// int lastType = Math.max(type, 0);
|
|
|
|
|
//
|
|
|
|
|
// IRecordsUtils utils = recordsUtilsMap.get(lastType);
|
|
|
|
|
// int index = 0;
|
|
|
|
|
// if (utils != null) {
|
|
|
|
|
// String name = utils.name();
|
|
|
|
|
// boolean found = false;
|
|
|
|
|
// for (index = 0; index < spinnerTitlesList.size(); index++) {
|
|
|
|
|
// if (spinnerTitlesList.get(index).equals(name)) {
|
|
|
|
|
// found = true;
|
|
|
|
|
// break;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// if (!found) {
|
|
|
|
|
// index = 0;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// binding.spinner1.setSelection(index);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// //里程计算坐标等类型切换监听器
|
|
|
|
|
// AdapterView.OnItemSelectedListener spinnerListener = new AdapterView.OnItemSelectedListener() {
|
|
|
|
|
// @Override
|
|
|
|
|
// public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
|
|
|
|
// String typeString = binding.spinner1.getSelectedItem().toString();
|
|
|
|
|
// Set<Map.Entry<Integer, IRecordsUtils>> entries = recordsUtilsMap.entrySet();
|
|
|
|
|
// for (Map.Entry<Integer, IRecordsUtils> entry : entries) {
|
|
|
|
|
// if (entry.getValue().name().equals(typeString)) {
|
|
|
|
|
// currentTypeFromSpinner = entry.getKey();
|
|
|
|
|
// if (currentTypeFromSpinner != RecordTypeConstants.TYPE_TUNNEL_BACK_BREAK && currentTypeFromSpinner != RecordTypeConstants.TYPE_WATER_PIPE_BACK_BREAK) {
|
|
|
|
|
// filterUtils.resetTcsType();
|
|
|
|
|
// tv_filter_dcs_type.setVisibility(View.GONE);
|
|
|
|
|
// } else {
|
|
|
|
|
// tv_filter_dcs_type.setVisibility(View.VISIBLE);
|
|
|
|
|
// }
|
|
|
|
|
// break;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// updateRecyclerView();
|
|
|
|
|
// App.instance.setLastRecordBrowseType(currentTypeFromSpinner);
|
|
|
|
|
// SharedPreferences prefs =
|
|
|
|
|
// PreferenceManager.getDefaultSharedPreferences(RecordsActivity.this);
|
|
|
|
|
// SharedPreferences.Editor editor = prefs.edit();
|
|
|
|
|
// editor.putInt("lastRecordBrowseType", App.instance.getLastRecordBrowseType());
|
|
|
|
|
// editor.apply();
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// @Override
|
|
|
|
|
// public void onNothingSelected(AdapterView<?> parent) {
|
|
|
|
|
// }
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public boolean onCreateOptionsMenu(Menu menu) { |
|
|
|
@ -332,8 +347,7 @@ public class RecordsActivity extends ColorfulActivity { |
|
|
|
|
IRecordsUtils recordsUtils = recordsUtilsMap.get(currentTypeFromSpinner); |
|
|
|
|
if (recordsUtils != null) { |
|
|
|
|
recordsUtils.update(binding.recyclerviewRecords, isSortByTimeAcs, |
|
|
|
|
null, |
|
|
|
|
SPUtils.INSTANCE.getString(SPConstants.PROJECT_ID, ""), "", "", |
|
|
|
|
SPUtils.INSTANCE.getString(SPConstants.PROJECT_ID, ""), workId, |
|
|
|
|
filterUtils.filterParameter()); |
|
|
|
|
|
|
|
|
|
// if (RecordTypeConstants.TYPE_MEASURING_TAPE == currentTypeFromSpinner) {
|
|
|
|
|