feat:fix Prompt bridge error

This commit is contained in:
pengfei.zhou 2019-11-22 17:06:24 +08:00
parent 660503e88c
commit b19a3e32f3

View File

@ -72,7 +72,7 @@ public class ModalPlugin extends DoricJavaPlugin {
} }
toast.show(); toast.show();
} catch (ArchiveException e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -101,12 +101,8 @@ public class ModalPlugin extends DoricJavaPlugin {
} }
}); });
builder.setCancelable(false); builder.setCancelable(false);
try { builder.show();
builder.show(); } catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
}
} catch (ArchiveException e) {
e.printStackTrace(); e.printStackTrace();
promise.reject(new JavaValue(e.getLocalizedMessage())); promise.reject(new JavaValue(e.getLocalizedMessage()));
} }
@ -148,12 +144,8 @@ public class ModalPlugin extends DoricJavaPlugin {
} }
}); });
builder.setCancelable(false); builder.setCancelable(false);
try { builder.show();
builder.show(); } catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
}
} catch (ArchiveException e) {
e.printStackTrace(); e.printStackTrace();
promise.reject(new JavaValue(e.getLocalizedMessage())); promise.reject(new JavaValue(e.getLocalizedMessage()));
} }
@ -187,7 +179,9 @@ public class ModalPlugin extends DoricJavaPlugin {
View v = LayoutInflater.from(getDoricContext().getContext()).inflate(R.layout.doric_modal_prompt, null); View v = LayoutInflater.from(getDoricContext().getContext()).inflate(R.layout.doric_modal_prompt, null);
TextView tvMsg = v.findViewById(R.id.tv_msg); TextView tvMsg = v.findViewById(R.id.tv_msg);
tvMsg.setText(msgVal.asString().value()); if (msgVal.isString()) {
tvMsg.setText(msgVal.asString().value());
}
final EditText editText = v.findViewById(R.id.edit_input); final EditText editText = v.findViewById(R.id.edit_input);
if (defaultVal.isString()) { if (defaultVal.isString()) {
editText.setHint(defaultVal.asString().value()); editText.setHint(defaultVal.asString().value());
@ -211,12 +205,8 @@ public class ModalPlugin extends DoricJavaPlugin {
} }
}); });
builder.setCancelable(false); builder.setCancelable(false);
try { builder.show();
builder.show(); } catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
}
} catch (ArchiveException e) {
e.printStackTrace(); e.printStackTrace();
promise.reject(new JavaValue(e.getLocalizedMessage())); promise.reject(new JavaValue(e.getLocalizedMessage()));
} }