private lateinit var editBookmarkDatabaseViewListener: EditBookmarkDatabaseViewListener
private lateinit var editBookmarkDatabaseViewListener: EditBookmarkDatabaseViewListener
- // Define the handles for the views that need to be accessed from `updateEditButton()`.
+ // Declare the class views.
private lateinit var newIconRadioButton: RadioButton
private lateinit var nameEditText: EditText
private lateinit var urlEditText: EditText
private lateinit var folderSpinner: Spinner
private lateinit var displayOrderEditText: EditText
private lateinit var newIconRadioButton: RadioButton
private lateinit var nameEditText: EditText
private lateinit var urlEditText: EditText
private lateinit var folderSpinner: Spinner
private lateinit var displayOrderEditText: EditText
- private lateinit var editButton: Button
+ private lateinit var saveButton: Button
+
+ // The public interface is used to send information back to the parent activity.
+ interface EditBookmarkDatabaseViewListener {
+ fun onSaveBookmark(dialogFragment: DialogFragment, selectedBookmarkDatabaseId: Int, favoriteIconBitmap: Bitmap)
+ }
override fun onAttach(context: Context) {
// Run the default commands.
override fun onAttach(context: Context) {
// Run the default commands.
@@ -73,7+86,7 @@ class EditBookmarkDatabaseViewDialog: DialogFragment() {
}
companion object {
}
companion object {
- // `@JvmStatic` will no longer be required once all the code has transitioned to Kotlin. Also, the function can then be moved out of a companion object and just become a package-level function.
+ // `@JvmStatic` will no longer be required once all the code has transitioned to Kotlin.
@JvmStatic
fun bookmarkDatabaseId(databaseId: Int, favoriteIconBitmap: Bitmap): EditBookmarkDatabaseViewDialog {
// Create a favorite icon byte array output stream.
@JvmStatic
fun bookmarkDatabaseId(databaseId: Int, favoriteIconBitmap: Bitmap): EditBookmarkDatabaseViewDialog {
// Create a favorite icon byte array output stream.
@@ -89,8+102,8 @@ class EditBookmarkDatabaseViewDialog: DialogFragment() {
- if (keyEvent.action == KeyEvent.ACTION_DOWN && keyCode == KeyEvent.KEYCODE_ENTER && editButton.isEnabled) { // The enter key was pressed and the edit button is enabled.
+ if (keyEvent.action == KeyEvent.ACTION_DOWN && keyCode == KeyEvent.KEYCODE_ENTER && saveButton.isEnabled) { // The enter key was pressed and the save button is enabled.
// Trigger the listener and return the dialog fragment to the parent activity.
// Trigger the listener and return the dialog fragment to the parent activity.
- if (keyEvent.action == KeyEvent.ACTION_DOWN && keyCode == KeyEvent.KEYCODE_ENTER && editButton.isEnabled) { // The enter key was pressed and the edit button is enabled.
+ if (keyEvent.action == KeyEvent.ACTION_DOWN && keyCode == KeyEvent.KEYCODE_ENTER && saveButton.isEnabled) { // The enter key was pressed and the save button is enabled.
// Trigger the listener and return the dialog fragment to the parent activity.
// Trigger the listener and return the dialog fragment to the parent activity.
- if (keyEvent.action == KeyEvent.ACTION_DOWN && keyCode == KeyEvent.KEYCODE_ENTER && editButton.isEnabled) { // The enter key was pressed and the edit button is enabled.
+ if (keyEvent.action == KeyEvent.ACTION_DOWN && keyCode == KeyEvent.KEYCODE_ENTER && saveButton.isEnabled) { // The enter key was pressed and the save button is enabled.
// Trigger the listener and return the dialog fragment to the parent activity.
// Trigger the listener and return the dialog fragment to the parent activity.