Last active
July 27, 2022 19:57
-
-
Save meshileya/b7858a1d96c819f98e02606a1c81d586 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun fixAppend(displayStr: StringBuilder, digit: String, txtView: TextView): Boolean { | |
if (displayStr.length <= 11) { | |
displayStr.append(digit) | |
var newAmount = displayStr.toString().toDouble() | |
// fix new input | |
newAmount *= 10.00 | |
if ("00" == digit) newAmount *= 10.00 | |
val updatedAmount = DecimalFormat("0.00").format(newAmount) | |
txtView.text = updatedAmount.toString() | |
// binding.txtAmount.text = updatedAmount.toString() | |
} | |
return true | |
} | |
fun fixDelete(displayStr: StringBuilder, textView: TextView) { | |
var bd = BigDecimal(displayStr.toString()) | |
bd = bd.movePointLeft(1) | |
textView.text = bd.toString() | |
// binding.txtAmount.text = bd.toString() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment