- folderNameEditText.setOnKeyListener(new View.OnKeyListener() {
- public boolean onKey(View v, int keyCode, KeyEvent event) {
- // If the event is a key-down on the "enter" button, select the PositiveButton `Save`.
- if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER) && editButton.isEnabled()) { // The enter key was pressed and the edit button is enabled.
- // Trigger `editBookmarkListener` and return the DialogFragment to the parent activity.
- editBookmarkFolderListener.onSaveEditBookmarkFolder(EditBookmarkFolderDialog.this, selectedFolderDatabaseId);
-
- // Manually dismiss the `AlertDialog`.
- alertDialog.dismiss();
-
- // Consume the event.
- return true;
- } else { // If any other key was pressed, or if the edit button is currently disabled, do not consume the event.
- return false;
- }
+ folderNameEditText.setOnKeyListener((View v, int keyCode, KeyEvent event) -> {
+ // If the event is a key-down on the "enter" button, select the PositiveButton `Save`.
+ if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER) && editButton.isEnabled()) { // The enter key was pressed and the edit button is enabled.
+ // Trigger `editBookmarkListener` and return the DialogFragment to the parent activity.
+ editBookmarkFolderListener.onSaveBookmarkFolder(EditBookmarkFolderDialog.this, selectedFolderDatabaseId);
+
+ // Manually dismiss the `AlertDialog`.
+ alertDialog.dismiss();
+
+ // Consume the event.
+ return true;
+ } else { // If any other key was pressed, or if the edit button is currently disabled, do not consume the event.
+ return false;