Skip to content

Commit

Permalink
case export fix, dialog fix
Browse files Browse the repository at this point in the history
  • Loading branch information
soloPi committed Jul 18, 2019
1 parent d3603bf commit c911e41
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,30 @@ public void onClick(DialogInterface dialog, int which) {
}
});

// check update
mCheckUpdateSettingWrapper.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new AlertDialog.Builder(SettingsActivity.this, R.style.SimpleDialogTheme)
.setMessage(R.string.settings__check_update)
.setPositiveButton(R.string.constant__yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
SPService.putBoolean(SPService.KEY_CHECK_UPDATE, true);
mCheckUpdateSettingInfo.setText(R.string.constant__yes);
dialog.dismiss();
}
}).setNegativeButton(R.string.constant__no, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
SPService.putBoolean(SPService.KEY_CHECK_UPDATE, false);
mCheckUpdateSettingInfo.setText(R.string.constant__no);
dialog.dismiss();
}
}).show();
}
});

mHideLogSettingWrapper.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Expand Down Expand Up @@ -404,6 +428,10 @@ public void run() {

// 加载实例
RecordCaseInfo caseInfo = JSON.parseObject(sb.toString(), RecordCaseInfo.class);
String operationLog = caseInfo.getOperationLog();
GeneralOperationLogBean log = JSON.parseObject(operationLog, GeneralOperationLogBean.class);
OperationStepUtil.beforeStore(log);
caseInfo.setOperationLog(JSON.toJSONString(log));

GreenDaoManager.getInstance().getRecordCaseInfoDao().insert(caseInfo);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,11 @@
import com.alipay.hulu.replay.OperationStepProvider;
import com.alipay.hulu.replay.RepeatStepProvider;
import com.alipay.hulu.service.CaseReplayManager;
import com.alipay.hulu.shared.io.bean.GeneralOperationLogBean;
import com.alipay.hulu.shared.io.bean.RecordCaseInfo;
import com.alipay.hulu.shared.io.db.GreenDaoManager;
import com.alipay.hulu.shared.io.db.RecordCaseInfoDao;
import com.alipay.hulu.shared.io.util.OperationStepUtil;
import com.alipay.hulu.shared.node.action.PerformActionEnum;
import com.alipay.hulu.shared.node.utils.AppUtil;
import com.alipay.hulu.util.DialogUtils;
Expand Down Expand Up @@ -280,10 +282,16 @@ private void exportCase(int position) {
if (caseInfo == null) {
return;
}

BackgroundExecutor.execute(new Runnable() {
@Override
public void run() {
// 读取实际用例信息
String operationLog = caseInfo.getOperationLog();
GeneralOperationLogBean logBean = JSON.parseObject(operationLog, GeneralOperationLogBean.class);
OperationStepUtil.afterLoad(logBean);
logBean.setStorePath(null);
caseInfo.setOperationLog(JSON.toJSONString(logBean));

String content = JSON.toJSONString(caseInfo);

// 导出文件
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ public abstract class LauncherApplication extends Application {
protected static LauncherApplication appInstance;
protected Map<String, ServiceReference> registeredService = new HashMap<>();
private Handler handler;
private AlertDialog dialog;

private Stack<ContextInstanceWrapper> openedActivity = new Stack<>();
private Stack<ContextInstanceWrapper> openedService = new Stack<>();
Expand Down Expand Up @@ -807,38 +806,32 @@ public void showDialog(final Context context, final String message, final String
runOnUiThread(new Runnable() {
@Override
public void run() {
if (dialog == null) {
AlertDialog.Builder builder = new AlertDialog.Builder(context, R.style.PermissionAppDialogTheme)
.setMessage(message)
.setPositiveButton(positiveText, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (positiveRunnable != null) {
positiveRunnable.run();
}
dialog.dismiss();
}
});
if (!StringUtil.isEmpty(negativeText)) {
builder.setNegativeButton(negativeText, new DialogInterface.OnClickListener() {
AlertDialog.Builder builder = new AlertDialog.Builder(context, R.style.PermissionAppDialogTheme)
.setMessage(message)
.setPositiveButton(positiveText, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (negativeRunnable != null) {
negativeRunnable.run();
if (positiveRunnable != null) {
positiveRunnable.run();
}
dialog.dismiss();
}
});
}
dialog = builder.create();
dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
dialog.setCanceledOnTouchOutside(false); //点击外面区域不会让dialog消失
dialog.setCancelable(false);
} else {
dialog.setMessage(message);
dialog.setButton(AlertDialog.BUTTON_POSITIVE, positiveText, listener);
dialog.setButton(AlertDialog.BUTTON_NEGATIVE, negativeText, listener);
});
if (!StringUtil.isEmpty(negativeText)) {
builder.setNegativeButton(negativeText, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (negativeRunnable != null) {
negativeRunnable.run();
}
dialog.dismiss();
}
});
}
AlertDialog dialog = builder.create();
dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
dialog.setCanceledOnTouchOutside(false); //点击外面区域不会让dialog消失
dialog.setCancelable(false);

try {
dialog.show();
Expand Down

0 comments on commit c911e41

Please sign in to comment.