From 9fc0eff350cadbfe87636225333476767b95247b Mon Sep 17 00:00:00 2001 From: Devin Morgan Date: Mon, 10 Jun 2024 10:30:53 -0400 Subject: [PATCH] Move EditText methods to EditTextElement interface Many of the methods originally organized under the ForageElement interface should actually live under the EditTextElement interface as not all ForageElements will specifically care to implement them (e.g. the UI-based ForagePinPad, does not care about hints, box stroke, and also has no concept of "focussed" Signed-off-by: Devin Morgan --- .../android/core/ui/element/ForageElement.kt | 70 +++++++++---------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/forage-android/src/main/java/com/joinforage/forage/android/core/ui/element/ForageElement.kt b/forage-android/src/main/java/com/joinforage/forage/android/core/ui/element/ForageElement.kt index c38062b4..2fcdd95c 100644 --- a/forage-android/src/main/java/com/joinforage/forage/android/core/ui/element/ForageElement.kt +++ b/forage-android/src/main/java/com/joinforage/forage/android/core/ui/element/ForageElement.kt @@ -80,41 +80,6 @@ internal interface EditTextElement { * @param l The [SimpleElementListener] to be fired on blur events. */ fun setOnBlurEventListener(l: SimpleElementListener) -} - -/** - * The interface that defines methods for configuring and interacting with a [ForageElement]. - * A ForageElement is a secure, client-side entity that accepts and submits customer input for a - * transaction. - * Both [ForagePANEditText] and [ForagePINEditText] adhere to the [ForageElement] interface. - * - * @property typeface The [Typeface](https://developer.android.com/reference/android/graphics/Typeface) - * that is used to render text within the ForageElement. - * @see * [Online-only Android Quickstart](https://docs.joinforage.app/docs/forage-android-quickstart) - * * [POS Terminal Android Quickstart](https://docs.joinforage.app/docs/forage-terminal-android) - * * [Guide to styling Forage Android Elements](https://docs.joinforage.app/docs/forage-android-styling-guide) - */ -internal interface ForageElement { - var typeface: Typeface? - - /** - * Clears the text input field of the ForageElement. - */ - fun clearText() - - /** - * Sets the text color for the ForageElement. - * - * @param textColor The color value in the form `0xAARRGGBB`. - */ - fun setTextColor(textColor: Int) - - /** - * Sets the text size for the ForageElement. - * - * @param textSize The scaled pixel size. - */ - fun setTextSize(textSize: Float) /** * Sets the text to be displayed when the ForageElement input field is empty. @@ -150,6 +115,41 @@ internal interface ForageElement { * @param boxStrokeWidth The scaled pixel size. */ fun setBoxStrokeWidthFocused(boxStrokeWidth: Int) +} + +/** + * The interface that defines methods for configuring and interacting with a [ForageElement]. + * A ForageElement is a secure, client-side entity that accepts and submits customer input for a + * transaction. + * Both [ForagePANEditText] and [ForagePINEditText] adhere to the [ForageElement] interface. + * + * @property typeface The [Typeface](https://developer.android.com/reference/android/graphics/Typeface) + * that is used to render text within the ForageElement. + * @see * [Online-only Android Quickstart](https://docs.joinforage.app/docs/forage-android-quickstart) + * * [POS Terminal Android Quickstart](https://docs.joinforage.app/docs/forage-terminal-android) + * * [Guide to styling Forage Android Elements](https://docs.joinforage.app/docs/forage-android-styling-guide) + */ +internal interface ForageElement { + var typeface: Typeface? + + /** + * Clears the text input field of the ForageElement. + */ + fun clearText() + + /** + * Sets the text color for the ForageElement. + * + * @param textColor The color value in the form `0xAARRGGBB`. + */ + fun setTextColor(textColor: Int) + + /** + * Sets the text size for the ForageElement. + * + * @param textSize The scaled pixel size. + */ + fun setTextSize(textSize: Float) /** * Gets the current [ElementState] state of the ForageElement.