// The public interface is used to send information back to the parent activity.
interface UpdateFontSizeListener {
- fun onApplyNewFontSize(dialogFragment: DialogFragment)
+ fun updateFontSize(dialogFragment: DialogFragment)
}
override fun onAttach(context: Context) {
// Set the apply button listener.
dialogBuilder.setPositiveButton(R.string.apply) { _: DialogInterface?, _: Int ->
// Return the dialog fragment to the parent activity.
- updateFontSizeListener.onApplyNewFontSize(this)
+ updateFontSizeListener.updateFontSize(this)
}
// Create an alert dialog from the builder.
// Check the key code, event, and button status.
if (keyEvent.action == KeyEvent.ACTION_DOWN && keyCode == KeyEvent.KEYCODE_ENTER) { // The enter key was pressed.
// Trigger the update font size listener and return the dialog fragment to the parent activity.
- updateFontSizeListener.onApplyNewFontSize(this)
+ updateFontSizeListener.updateFontSize(this)
// Manually dismiss the alert dialog.
alertDialog.dismiss()