- usernameEditText.setOnKeyListener(new View.OnKeyListener() {
- public boolean onKey(View view, int keyCode, KeyEvent event) {
- // If the event is a key-down on the `enter` key, call `onHttpAuthenticationProceed()`.
- if ((keyCode == KeyEvent.KEYCODE_ENTER) && (event.getAction() == KeyEvent.ACTION_DOWN)) {
- // Trigger `onHttpAuthenticationProceed` and return the `DialogFragment` to the parent activity.
- httpAuthenticationListener.onHttpAuthenticationProceed(HttpAuthenticationDialog.this);
-
- // Manually dismiss the `AlertDialog`.
- alertDialog.dismiss();
-
- // Consume the event.
- return true;
- } else { // If any other key was pressed, do not consume the event.
- return false;
- }
+ usernameEditText.setOnKeyListener((View view, int keyCode, KeyEvent event) -> {
+ // If the event is a key-down on the `enter` key, call `onHttpAuthenticationProceed()`.
+ if ((keyCode == KeyEvent.KEYCODE_ENTER) && (event.getAction() == KeyEvent.ACTION_DOWN)) {
+ // Send the login information.
+ login(httpAuthHandler);
+
+ // Manually dismiss the alert dialog.
+ alertDialog.dismiss();
+
+ // Consume the event.
+ return true;
+ } else { // If any other key was pressed, do not consume the event.
+ return false;