fix and re-land "re-enable android_view_test (#54214)" (#54312)

This commit is contained in:
Chris Yang
2020-04-09 11:03:02 -07:00
committed by GitHub
parent d390f4d9c6
commit 13052b10e4
4 changed files with 24 additions and 8 deletions

View File

@@ -52,21 +52,27 @@ public class SimplePlatformView implements PlatformView, MethodChannel.MethodCal
touchPipe.disable();
result.success(null);
return;
case "showAlertDialog":
showAlertDialog(result);
case "showAndHideAlertDialog":
showAndHideAlertDialog(result);
return;
}
result.notImplemented();
}
private void showAlertDialog(MethodChannel.Result result) {
private void showAndHideAlertDialog(MethodChannel.Result result) {
Context context = view.getContext();
AlertDialog.Builder builder = new AlertDialog.Builder(context);
TextView textView = new TextView(context);
textView.setText("Alert!");
textView.setText("This alert dialog will close in 1 second");
builder.setView(textView);
final AlertDialog alertDialog = builder.show();
result.success(null);
view.postDelayed(new Runnable() {
@Override
public void run() {
alertDialog.hide();
}
}, 1000);
}
}