Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FX-1278] Remove ability to set hint on ForagePINEditText #244

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ internal class BTVaultWrapper @JvmOverloads constructor(
val boxCornerRadiusTopEnd = getBoxCornerRadiusTopEnd(boxCornerRadius)
val boxCornerRadiusBottomStart = getBoxCornerRadiusBottomStart(boxCornerRadius)
val boxCornerRadiusBottomEnd = getBoxCornerRadiusBottomEnd(boxCornerRadius)
val hintTextColorVal =
getColor(com.joinforage.forage.android.R.styleable.ForagePINEditText_hintTextColor, getThemeAccentColor(context))

val inputWidth: Int = getDimensionPixelSize(com.joinforage.forage.android.R.styleable.ForagePINEditText_inputWidth, ViewGroup.LayoutParams.MATCH_PARENT)
val inputHeight: Int = getDimensionPixelSize(com.joinforage.forage.android.R.styleable.ForagePINEditText_inputHeight, ViewGroup.LayoutParams.WRAP_CONTENT)
Expand All @@ -57,8 +55,6 @@ internal class BTVaultWrapper @JvmOverloads constructor(
inputType = com.basistheory.android.model.InputType.NUMBER_PASSWORD
val digit = Regex("""\d""")
mask = ElementMask(listOf(digit, digit, digit, digit))
hint = getString(com.joinforage.forage.android.R.styleable.ForagePINEditText_hint)
hintTextColor = hintTextColorVal
textSize = getDimension(com.joinforage.forage.android.R.styleable.ForagePINEditText_textSize, -1f)
textColor = getColor(com.joinforage.forage.android.R.styleable.ForagePINEditText_textColor, Color.BLACK)
var customBackground = GradientDrawable().apply {
Expand Down Expand Up @@ -134,11 +130,4 @@ internal class BTVaultWrapper @JvmOverloads constructor(
_internalTextElement.textSize = textSize
}

override fun setHint(hint: String) {
_internalTextElement.hint = hint
}

override fun setHintTextColor(hintTextColor: Int) {
_internalTextElement.hintTextColor = hintTextColor
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -110,19 +110,6 @@ interface ForageElement<T : ElementState> {
*/
fun setTextSize(textSize: Float)

/**
* Sets the text to be displayed when the ForageElement input field is empty.
*
* @param hint The text to display.
*/
fun setHint(hint: String)

/**
* Sets the hint text color.
*
* @param hintTextColor The color value in the form `0xAARRGGBB`.
*/
fun setHintTextColor(hintTextColor: Int)
Comment on lines -113 to -125
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still want the merchant to be able to set the placeholder on PAN elements.

Would this be a breaking change for clients who may be setting the placeholder on the panEditText?

Copy link
Contributor

@dleis612 dleis612 Apr 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: Is Gopuff using this and setting the value to the empty string currently?


/**
* Sets the border color of the input field.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,12 +216,6 @@ class ForagePINEditText @JvmOverloads constructor(
btVaultWrapper.typeface = value
vgsVaultWrapper.typeface = value
}
override fun setHint(hint: String) {
vault.setHint(hint)
}
override fun setHintTextColor(hintTextColor: Int) {
vault.setHintTextColor(hintTextColor)
}
override fun setBoxStrokeColor(boxStrokeColor: Int) {
// no-ops for now
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ internal class ForageVaultWrapper @JvmOverloads constructor(
InputType.TYPE_CLASS_NUMBER or InputType.TYPE_NUMBER_VARIATION_PASSWORD

gravity = Gravity.CENTER
hint = parsedStyles.hint
setHintTextColor(parsedStyles.hintTextColor)

val customBackground = GradientDrawable().apply {
setPaddingRelative(20, 20, 20, 20)
Expand Down Expand Up @@ -132,11 +130,4 @@ internal class ForageVaultWrapper @JvmOverloads constructor(
_editText.textSize = textSize
}

override fun setHint(hint: String) {
_editText.hint = hint
}

override fun setHintTextColor(hintTextColor: Int) {
_editText.setHintTextColor(hintTextColor)
}
Comment on lines -135 to -141
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of removing this altogether ; can we use @Deprecated / @deprecated with level hidden / warning?

https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-deprecation-level/

}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ internal class VGSVaultWrapper @JvmOverloads constructor(
context.obtainStyledAttributes(attrs, com.joinforage.forage.android.R.styleable.ForagePINEditText, defStyleAttr, 0)
.apply {
try {
val hint = getString(com.joinforage.forage.android.R.styleable.ForagePINEditText_hint)
val textInputLayoutStyleAttribute =
getResourceId(com.joinforage.forage.android.R.styleable.ForagePINEditText_pinInputLayoutStyle, 0)
val boxStrokeColor = getColor(
Expand All @@ -46,8 +45,6 @@ internal class VGSVaultWrapper @JvmOverloads constructor(
val boxCornerRadiusTopEnd = getBoxCornerRadiusTopEnd(boxCornerRadius)
val boxCornerRadiusBottomStart = getBoxCornerRadiusBottomStart(boxCornerRadius)
val boxCornerRadiusBottomEnd = getBoxCornerRadiusBottomEnd(boxCornerRadius)
val hintTextColor =
getColorStateList(com.joinforage.forage.android.R.styleable.ForagePINEditText_hintTextColor)
val textSize = getDimension(com.joinforage.forage.android.R.styleable.ForagePINEditText_textSize, -1f)
val textColor = getColor(com.joinforage.forage.android.R.styleable.ForagePINEditText_textColor, Color.BLACK)

Expand All @@ -61,11 +58,6 @@ internal class VGSVaultWrapper @JvmOverloads constructor(
inputHeight
)

setHint(hint)
hintTextColor?.let {
setHintTextColor(hintTextColor)
}

val customBackground = GradientDrawable().apply {
setPaddingRelative(20, 20, 20, 20)
shape = GradientDrawable.RECTANGLE
Expand Down Expand Up @@ -157,11 +149,4 @@ internal class VGSVaultWrapper @JvmOverloads constructor(
_internalEditText.setTextSize(textSize)
}

override fun setHint(hint: String) {
_internalEditText.setHint(hint)
}

override fun setHintTextColor(hintTextColor: Int) {
_internalEditText.setHintTextColor(hintTextColor)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ internal data class ParsedStyles(
val boxCornerRadiusTopEnd: Float,
val boxCornerRadiusBottomStart: Float,
val boxCornerRadiusBottomEnd: Float,
val hint: String?,
val hintTextColor: ColorStateList?,
val inputWidth: Int,
val inputHeight: Int,
val textSize: Float,
Expand All @@ -56,8 +54,6 @@ internal abstract class VaultWrapper @JvmOverloads constructor(

abstract fun setTextColor(textColor: Int)
abstract fun setTextSize(textSize: Float)
abstract fun setHint(hint: String)
abstract fun setHintTextColor(hintTextColor: Int)
abstract fun getUnderlying(): View
abstract fun getVGSEditText(): VGSEditText
abstract fun getTextElement(): TextElement
Expand All @@ -78,8 +74,6 @@ internal abstract class VaultWrapper @JvmOverloads constructor(
boxCornerRadiusTopEnd = typedArray.getBoxCornerRadius(R.styleable.ForagePINEditText_boxCornerRadiusTopEnd, boxCornerRadius),
boxCornerRadiusBottomStart = typedArray.getBoxCornerRadius(R.styleable.ForagePINEditText_boxCornerRadiusBottomStart, boxCornerRadius),
boxCornerRadiusBottomEnd = typedArray.getBoxCornerRadius(R.styleable.ForagePINEditText_boxCornerRadiusBottomEnd, boxCornerRadius),
hint = typedArray.getString(R.styleable.ForagePINEditText_hint),
hintTextColor = typedArray.getColorStateList(R.styleable.ForagePINEditText_hintTextColor),
inputWidth = typedArray.getDimensionPixelSize(R.styleable.ForagePINEditText_inputWidth, ViewGroup.LayoutParams.MATCH_PARENT),
inputHeight = typedArray.getDimensionPixelSize(R.styleable.ForagePINEditText_inputHeight, ViewGroup.LayoutParams.WRAP_CONTENT),
textSize = typedArray.getDimension(R.styleable.ForagePINEditText_textSize, -1f),
Expand Down
1 change: 0 additions & 1 deletion forage-android/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
<!-- Style attribute for the TextInputLayout -->
<attr name="pinInputLayoutStyle" format="reference" />

<attr name="hint" />
<attr name="text" />
<attr name="textSize" />
<attr name="textColor" />
Expand Down
1 change: 0 additions & 1 deletion sample-app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
<string name="bearer_token">AbCaccesstokenXyz</string>
<string name="merchant_account_hint">Merchant Account</string>
<string name="merchant_account">8000009</string>
<string name="pin">PIN</string>
<string name="capture_snap">Capture SNAP</string>
<string name="defer_capture_snap">Defer SNAP</string>
<string name="capture_cash">Capture EBT Cash</string>
Expand Down
6 changes: 0 additions & 6 deletions sample-app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,15 @@
<item name="android:layout_marginEnd">@dimen/pin_field_margin</item>
<item name="android:layout_marginTop">@dimen/pin_field_margin</item>
<item name="android:layout_marginBottom">@dimen/pin_field_margin</item>
<item name="hint">@string/pin</item>
<item name="textSize">@dimen/pin_text_size</item>
<item name="pinBoxStrokeColor">@color/purple_700</item>
<item name="hintTextColor">@color/purple_700</item>
<item name="boxCornerRadius">@dimen/corner_radius</item>
</style>

<style name="SecondForagePINEditTextStyle" parent="">
<item name="android:layout_margin">@dimen/pin_field_margin</item>
<item name="hint">@string/pin</item>
<item name="textSize">@dimen/pin_text_size</item>
<item name="pinBoxStrokeColor">@color/purple_200</item>
<item name="hintTextColor">@color/purple_200</item>
<item name="boxCornerRadiusTopStart">@dimen/box_corner_radius_top_start</item>
<item name="boxCornerRadiusTopEnd">@dimen/box_corner_radius_top_end</item>
<item name="boxCornerRadiusBottomStart">@dimen/box_corner_radius_bottom_start</item>
Expand All @@ -114,10 +110,8 @@

<style name="ThirdForagePINEditTextStyle" parent="">
<item name="android:layout_margin">@dimen/pin_field_margin</item>
<item name="hint">@string/pin</item>
<item name="textSize">@dimen/pin_text_size</item>
<item name="pinBoxStrokeColor">@color/colorAccent</item>
<item name="hintTextColor">@color/colorAccent</item>
<item name="boxCornerRadius">@dimen/corner_radius</item>
</style>

Expand Down
Loading