- // Allow the `enter` key on the keyboard to create the folder from `create_folder_name_edittext`.
- folderNameEditText.setOnKeyListener(new View.OnKeyListener() {
- public boolean onKey(View v, int keyCode, KeyEvent event) {
- // If the event is a key-down on the `enter` key, select the `PositiveButton` `Create`.
- if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER) && createButton.isEnabled()) { // The enter key was pressed and the create button is enabled.
- // Trigger `createBookmarkFolderListener` and return the `DialogFragment` to the parent activity.
- createBookmarkFolderListener.onCreateBookmarkFolder(CreateBookmarkFolderDialog.this);
- // Manually dismiss the `AlertDialog`.
- alertDialog.dismiss();
- // Consume the event.
- return true;
- } else { // If any other key was pressed, or if the create button is currently disabled, do not consume the event.
- return false;
- }
+ // Allow the enter key on the keyboard to create the folder from `create_folder_name_edittext`.
+ folderNameEditText.setOnKeyListener((View v, int keyCode, KeyEvent event) -> {
+ // If the event is a key-down on the `enter` key, select the `PositiveButton` `Create`.
+ if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER) && createButton.isEnabled()) { // The enter key was pressed and the create button is enabled.
+ // Trigger `createBookmarkFolderListener` and return the `DialogFragment` to the parent activity.
+ createBookmarkFolderListener.onCreateBookmarkFolder(CreateBookmarkFolderDialog.this);
+ // Manually dismiss the `AlertDialog`.
+ alertDialog.dismiss();
+ // Consume the event.
+ return true;
+ } else { // If any other key was pressed, or if the create button is currently disabled, do not consume the event.
+ return false;