Skip to content

Commit

Permalink
Move EditText methods to EditTextElement interface
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
devinmorgan committed Jun 17, 2024
1 parent 6960592 commit 9fc0eff
Showing 1 changed file with 35 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<T : ElementState> {
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.
Expand Down Expand Up @@ -150,6 +115,41 @@ internal interface ForageElement<T : ElementState> {
* @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<T : ElementState> {
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.
Expand Down

0 comments on commit 9fc0eff

Please sign in to comment.