|
|
|
@ -19,6 +19,8 @@ import androidx.paging.PagingLiveData; |
|
|
|
|
import androidx.paging.PagingSource; |
|
|
|
|
import androidx.recyclerview.widget.RecyclerView; |
|
|
|
|
|
|
|
|
|
import com.afollestad.materialdialogs.DialogAction; |
|
|
|
|
import com.afollestad.materialdialogs.MaterialDialog; |
|
|
|
|
import com.bingce.data.cache.CachedCurrentJob; |
|
|
|
|
import com.bingce.data.cache.CachedProject; |
|
|
|
|
import com.bingce.data.database.DBQueryConstant; |
|
|
|
@ -30,6 +32,7 @@ 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.IntentUtil; |
|
|
|
|
import com.bingce.utils.SimpleTextWatcher; |
|
|
|
|
import com.bingce.utils.ThreadPoolUtil; |
|
|
|
|
import com.bingce.viewmodel.AbstractCoordinatePointsLibraryViewModelKt; |
|
|
|
@ -95,7 +98,8 @@ public class CoordinatePointsLibraryActivity extends BaseSurveyNewActivity { |
|
|
|
|
filterParameter, binding.etEnterNameCode.getText().toString().trim() |
|
|
|
|
)); |
|
|
|
|
} |
|
|
|
|
private List<PointRecord> getAllPoint(){ |
|
|
|
|
|
|
|
|
|
private List<PointRecord> getAllPoint() { |
|
|
|
|
return PointDb.getInstance().rawQueryListData(CoordinatePointsLibraryActivitySQLiteUtils.searchSQLit( |
|
|
|
|
jobId, |
|
|
|
|
filterParameter, binding.etEnterNameCode.getText().toString().trim() |
|
|
|
@ -107,8 +111,8 @@ public class CoordinatePointsLibraryActivity extends BaseSurveyNewActivity { |
|
|
|
|
@Override |
|
|
|
|
public void fireByKey(String key) { |
|
|
|
|
ThreadPoolUtil.execute(() -> { |
|
|
|
|
String projectId = CachedProject.currentProjectId(); |
|
|
|
|
jobId = CachedCurrentJob.currentJobId(projectId); |
|
|
|
|
// String projectId = CachedProject.currentProjectId();
|
|
|
|
|
// jobId = CachedCurrentJob.currentJobId(projectId);
|
|
|
|
|
ThreadPoolUtil.executeInMain(() -> { |
|
|
|
|
pagingDataLiveData.removeObservers(CoordinatePointsLibraryActivity.this); |
|
|
|
|
pagingDataLiveData = PagingLiveData.cachedIn(PagingLiveData.getLiveData(pager), getLifecycle()); |
|
|
|
@ -145,6 +149,7 @@ public class CoordinatePointsLibraryActivity extends BaseSurveyNewActivity { |
|
|
|
|
@Override |
|
|
|
|
protected void initView() { |
|
|
|
|
setTitle(getString(R.string.point_survey_point_library)); |
|
|
|
|
jobId = IntentUtil.stringExtra(this, KEY_JOB_ID); |
|
|
|
|
|
|
|
|
|
if (App.instance.isThemeDark()) { |
|
|
|
|
binding.topLayout.setBackgroundColor(getColor(R.color.theme_dark_black)); |
|
|
|
@ -175,7 +180,7 @@ public class CoordinatePointsLibraryActivity extends BaseSurveyNewActivity { |
|
|
|
|
coordinatePointNameLibraryAdapter.resetSelPos(); |
|
|
|
|
coordinatePointLibraryAdapter.notifyDataSetChanged(); |
|
|
|
|
coordinatePointNameLibraryAdapter.notifyDataSetChanged(); |
|
|
|
|
}else { |
|
|
|
|
} else { |
|
|
|
|
coordinatePointLibraryAdapter.resetSelPos(); |
|
|
|
|
coordinatePointNameLibraryAdapter.resetSelPos(); |
|
|
|
|
coordinatePointLibraryAdapter.selAll(); |
|
|
|
@ -186,8 +191,8 @@ public class CoordinatePointsLibraryActivity extends BaseSurveyNewActivity { |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
ThreadPoolUtil.execute(() -> { |
|
|
|
|
String projectId = CachedProject.currentProjectId(); |
|
|
|
|
jobId = CachedCurrentJob.currentJobId(projectId); |
|
|
|
|
// String projectId = CachedProject.currentProjectId();
|
|
|
|
|
// jobId = CachedCurrentJob.currentJobId(projectId);
|
|
|
|
|
ThreadPoolUtil.executeInMain(() -> { |
|
|
|
|
pagingDataLiveData = PagingLiveData.cachedIn(PagingLiveData.getLiveData(pager), getLifecycle()); |
|
|
|
|
pagingDataLiveData |
|
|
|
@ -223,8 +228,8 @@ public class CoordinatePointsLibraryActivity extends BaseSurveyNewActivity { |
|
|
|
|
filterParameter.setCodeKey(codeKey); |
|
|
|
|
filterParameter.setRemarkKey(remarksKey); |
|
|
|
|
ThreadPoolUtil.execute(() -> { |
|
|
|
|
String projectId = CachedProject.currentProjectId(); |
|
|
|
|
jobId = CachedCurrentJob.currentJobId(projectId); |
|
|
|
|
// String projectId = CachedProject.currentProjectId();
|
|
|
|
|
// jobId = CachedCurrentJob.currentJobId(projectId);
|
|
|
|
|
ThreadPoolUtil.executeInMain(() -> { |
|
|
|
|
pagingDataLiveData.removeObservers(this); |
|
|
|
|
pagingDataLiveData = |
|
|
|
@ -252,25 +257,40 @@ public class CoordinatePointsLibraryActivity extends BaseSurveyNewActivity { |
|
|
|
|
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); |
|
|
|
|
new MaterialDialog.Builder(this) |
|
|
|
|
.title(R.string.warning) |
|
|
|
|
.content("确定要删除选择的点吗?") |
|
|
|
|
.negativeText(R.string.cancel) |
|
|
|
|
.positiveText(R.string.confirm) |
|
|
|
|
.onPositive((materialDialog, dialogAction) -> { |
|
|
|
|
ThreadPoolUtil.execute(() -> { |
|
|
|
|
PointDb.getInstance().delete(selItem); |
|
|
|
|
resetSelPos(); |
|
|
|
|
}); |
|
|
|
|
}).show(); |
|
|
|
|
// 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.pointsLibraryBtnExport.setOnClickListener(v -> |
|
|
|
|
ResultsTheExportActivity.start( |
|
|
|
|
this, |
|
|
|
|
jobId, |
|
|
|
|
false, |
|
|
|
|
filterParameter.getNameKey(), |
|
|
|
|
filterParameter.getCodeKey(), |
|
|
|
|
filterParameter.getRemarkKey(), |
|
|
|
|
filterParameter.getDateStart(), |
|
|
|
|
filterParameter.getDateEnd()) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
binding.pointsLibraryBtnConfirm.setOnClickListener(new View.OnClickListener() { |
|
|
|
|
@Override |
|
|
|
@ -301,7 +321,7 @@ public class CoordinatePointsLibraryActivity extends BaseSurveyNewActivity { |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
boolean isSelect = getIntent().getBooleanExtra(KEY_IS_PICK,false); |
|
|
|
|
boolean isSelect = getIntent().getBooleanExtra(KEY_IS_PICK, false); |
|
|
|
|
|
|
|
|
|
if (isSelect) { |
|
|
|
|
binding.pointsLibraryBtnConfirm.setVisibility(View.VISIBLE); |
|
|
|
@ -368,6 +388,7 @@ public class CoordinatePointsLibraryActivity extends BaseSurveyNewActivity { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
public static void start(FragmentActivity fragmentActivity) { |
|
|
|
|
ThreadPoolUtil.execute(() -> { |
|
|
|
|
String projectId = CachedProject.currentProjectId(); |
|
|
|
@ -383,6 +404,7 @@ public class CoordinatePointsLibraryActivity extends BaseSurveyNewActivity { |
|
|
|
|
fragmentActivity.startActivity(intent); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static final String RESULT_ID = "id"; |
|
|
|
|
private static final String RESULT_NAME = "name"; |
|
|
|
|
private static final String RESULT_CODE = "code"; |
|
|
|
@ -494,7 +516,7 @@ public class CoordinatePointsLibraryActivity extends BaseSurveyNewActivity { |
|
|
|
|
binding.bodyRv.removeOnScrollListener(rightScrollListener); |
|
|
|
|
leftScrollListener = null; |
|
|
|
|
rightScrollListener = null; |
|
|
|
|
}catch (Exception e){ |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
} |
|
|
|
|
super.onDestroy(); |
|
|
|
|