small changes

This commit is contained in:
adrienmalin 2018-12-18 15:29:28 +01:00
parent a6287e1760
commit 720795cfd6
3 changed files with 6 additions and 5 deletions

View File

@ -1,6 +1,7 @@
package adrienmalin.pingpoints package adrienmalin.pingpoints
data class Player ( data class Player (
var name: String, val name: String,
var score: Int var score: Int,
val soundex: String = soundex(name)
) )

View File

@ -56,7 +56,7 @@ class SttDialog : DialogFragment() {
if (matcher.find()) { if (matcher.find()) {
val foundName = matcher.group(1) val foundName = matcher.group(1)
for (player in players) { for (player in players) {
if (soundex(foundName) == soundex(player.name)) { if (soundex(foundName) == player.soundex) {
dismiss() dismiss()
updateScore(player) updateScore(player)
updateUI() updateUI()

View File

@ -45,7 +45,7 @@ class VictoryActivity : AppCompatActivity() {
intent.getIntExtra("player2Score", 0) intent.getIntExtra("player2Score", 0)
) )
) )
previousMatch?.apply{ previousMatches = getString("previousMatches", "") } previousMatch?.apply{ previousMatches = getString("previousMatches", "") ?: "" }
} }
} }
} }
@ -64,7 +64,7 @@ class VictoryActivity : AppCompatActivity() {
this@VictoryActivity, this@VictoryActivity,
R.layout.grid_item, R.layout.grid_item,
R.id.grid_item_text, R.id.grid_item_text,
previousMatches.split("\t|\n".toRegex())?.toMutableList() previousMatches.split("\t|\n".toRegex()).toMutableList()
) )
} }