Bugfix: Just working with Add100 and Sub100 button does not allow to submit values.
This commit is contained in:
@@ -63,7 +63,7 @@ class MainActivity : AppCompatActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
if (currentRound.isValidRound()) {
|
||||
if (currentRound.isValidRound() && inputTeamA.text.isNotEmpty() && inputTeamB.text.isNotEmpty()) {
|
||||
enableSubmitButton()
|
||||
} else {
|
||||
disableSubmitButton()
|
||||
@@ -94,7 +94,7 @@ class MainActivity : AppCompatActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
if (currentRound.isValidRound()) {
|
||||
if (currentRound.isValidRound() && inputTeamA.text.isNotEmpty() && inputTeamB.text.isNotEmpty()) {
|
||||
enableSubmitButton()
|
||||
} else {
|
||||
disableSubmitButton()
|
||||
@@ -104,50 +104,58 @@ class MainActivity : AppCompatActivity() {
|
||||
buttonAdd100.setOnClickListener {
|
||||
if (inputTeamA.isFocused) {
|
||||
|
||||
val temp = try {
|
||||
currentRound.scoreA = try {
|
||||
inputTeamA.text.toString().toInt() + 100
|
||||
} catch (e: Exception) {
|
||||
inputTeamB.setText(0.toString())
|
||||
currentRound.scoreB = 0
|
||||
inputTeamB.setText(currentRound.scoreB.toString())
|
||||
100
|
||||
|
||||
}
|
||||
updateOnChange = false
|
||||
inputTeamA.setText(temp.toString())
|
||||
inputTeamA.setText(currentRound.scoreA.toString())
|
||||
}
|
||||
|
||||
if (inputTeamB.isFocused) {
|
||||
val temp = try {
|
||||
currentRound.scoreB = try {
|
||||
inputTeamB.text.toString().toInt() + 100
|
||||
} catch (e: Exception) {
|
||||
inputTeamA.setText(0.toString())
|
||||
currentRound.scoreA = 0
|
||||
inputTeamA.setText(currentRound.scoreA.toString())
|
||||
100
|
||||
|
||||
}
|
||||
updateOnChange = false
|
||||
inputTeamB.setText(temp.toString())
|
||||
inputTeamB.setText(currentRound.scoreB.toString())
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
buttonSub100.setOnClickListener {
|
||||
if (inputTeamA.isFocused) {
|
||||
val temp = try {
|
||||
currentRound.scoreA = try {
|
||||
inputTeamA.text.toString().toInt() - 100
|
||||
} catch (e: Exception) {
|
||||
currentRound.scoreB = 0
|
||||
inputTeamB.setText(currentRound.scoreB.toString())
|
||||
-100
|
||||
}
|
||||
updateOnChange = false
|
||||
inputTeamA.setText(temp.toString())
|
||||
inputTeamA.setText(currentRound.scoreA.toString())
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (inputTeamB.isFocused) {
|
||||
val temp = try {
|
||||
currentRound.scoreB = try {
|
||||
inputTeamB.text.toString().toInt() - 100
|
||||
} catch (e: Exception) {
|
||||
currentRound.scoreA = 0
|
||||
inputTeamA.setText(currentRound.scoreA.toString())
|
||||
-100
|
||||
}
|
||||
updateOnChange = false
|
||||
inputTeamB.setText(temp.toString())
|
||||
inputTeamB.setText(currentRound.scoreB.toString())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -262,6 +270,7 @@ class MainActivity : AppCompatActivity() {
|
||||
|
||||
inputTeamA.text.clear()
|
||||
inputTeamB.text.clear()
|
||||
disableSubmitButton()
|
||||
|
||||
scrollViewHistory.fullScroll(ScrollView.FOCUS_DOWN)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user