BadCase自定义录包

This commit is contained in:
xuxinchao
2022-10-27 16:51:04 +08:00
parent 6021a30ba9
commit 45eddf619c
5 changed files with 42 additions and 44 deletions

View File

@@ -11,6 +11,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.mogo.eagle.core.data.badcase.RecordCaseEntity;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotRecordListener;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager;
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
import com.zhjt.mogo_core_function_devatools.R;
@@ -75,6 +76,8 @@ public class CaseListDialog extends Dialog implements IMoGoAutopilotRecordListen
public void onAttachedToWindow() {
super.onAttachedToWindow();
CallerAutopilotRecordListenerManager.INSTANCE.addListener(TAG, this);
//获取数据采集录制模式配置列表
CallerAutoPilotManager.INSTANCE.getBadCaseConfig(0, 0,new ArrayList<>());
}
@Override
@@ -94,13 +97,16 @@ public class CaseListDialog extends Dialog implements IMoGoAutopilotRecordListen
ThreadUtils.runOnUiThread(() -> {
if(config.getRecordTypesCount()>0){
for(int index=0;index<config.getRecordTypesCount();index++){
ArrayList<String> topicList = new ArrayList<>();
for(int position=0;position<config.getRecordTypesCount();position++){
topicList.add(config.getRecordTypes(index).getTopicsList().get(position));
if(config.getRecordTypes(index).getId() != 99){
ArrayList<String> topicList = new ArrayList<>();
// TODO java.lang.IndexOutOfBoundsException: Index: 38, Size: 38
// for(int position=0;index<config.getRecordTypes(index).getTopicsCount();position++){
// topicList.add(config.getRecordTypes(index).getTopicsList().get(position));
// }
recordTypeEntityArrayList.add(new RecordCaseEntity(
config.getRecordTypes(index).getId(),config.getRecordTypes(index).getDesc(),
topicList));
}
recordTypeEntityArrayList.add(new RecordCaseEntity(
config.getRecordTypes(index).getId(),config.getRecordTypes(index).getDesc(),
topicList));
}
}
if(BadCaseConfig.customTopicList.size()>0){

View File

@@ -156,26 +156,23 @@ public class CaseTopicListDialog extends Dialog implements IMoGoAutopilotRecordL
topicListAdapter.notifyDataSetChanged();
}
});
tvSave.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(recordType!=null){
Boolean success=CallerAutoPilotManager.INSTANCE.getBadCaseConfig(2,recordType.getId(),addTopicList);
if(Boolean.TRUE.equals(success)){
ToastUtils.showShort("Topic设置成功");
if(recordType.getId() == 0){
//自定义Topic
BadCaseConfig.customTopicList.addAll(addTopicList);
}
addTopicList.clear();
dismiss();
}else{
ToastUtils.showShort("Topic设置失败");
tvSave.setOnClickListener(v -> {
if(recordType!=null){
Boolean success=CallerAutoPilotManager.INSTANCE.getBadCaseConfig(2,recordType.getId(),addTopicList);
if(Boolean.TRUE.equals(success)){
ToastUtils.showShort("Topic设置成功");
if(recordType.getId() == 0){
//自定义Topic
BadCaseConfig.customTopicList.addAll(addTopicList);
}
addTopicList.clear();
dismiss();
}else{
ToastUtils.showShort("Topic设置失败");
}
}
});
tvCancel.setOnClickListener(v -> {
@@ -189,9 +186,13 @@ public class CaseTopicListDialog extends Dialog implements IMoGoAutopilotRecordL
ThreadUtils.runOnUiThread(() -> {
if(config.getAllTopicsCount()>0){
for(int index=0;index<config.getAllTopicsCount();index++){
allTopicList.add(new TopicEntity(config.getAllTopics(index),false,true));
if(!recordType.getTopicsList().contains(config.getAllTopics(index))){
allTopicList.add(new TopicEntity(config.getAllTopics(index),false,true));
}
}
recordType.getTopicsList().addAll(allTopicList);
topicListAdapter.setData(recordType.getTopicsList());
topicListAdapter.notifyDataSetChanged();
}
});
}

View File

@@ -9,10 +9,10 @@
android:gravity="center"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:paddingStart="30dp"
android:paddingEnd="30dp"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
android:clickable="true"
android:focusable="true"
>

View File

@@ -10,9 +10,9 @@
android:layout_marginTop="20dp"
android:clickable="true"
android:focusable="true"
android:paddingStart="30dp"
android:paddingEnd="30dp"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
>
</TextView>

View File

@@ -315,20 +315,11 @@
app:layout_constraintLeft_toLeftOf="@id/tvRecordTemplate"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvRecordTemplate"
app:layout_constraintBottom_toBottomOf="parent"
android:background="@drawable/template_list_bg"
android:layout_marginTop="@dimen/dp_50"
android:paddingBottom="20dp"
/>
<RadioGroup
android:id="@+id/rgRecordConfig"
android:layout_width="0dp"
android:layout_height="match_parent"
app:layout_constraintLeft_toLeftOf="@id/tvRecordTemplate"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvRecordTemplate"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginTop="@dimen/dp_20"
android:layout_marginBottom="@dimen/dp_50"
android:paddingBottom="10dp"
/>
</androidx.constraintlayout.widget.ConstraintLayout>