Revert "use string.equals(ignoreCase=true) instead of regex"
This reverts commit 4bb1ff5b42
.
This commit is contained in:
@ -59,8 +59,8 @@ class MatchActivity : AppCompatActivity() {
|
||||
val player1Name = getStringExtra("player1Name")
|
||||
val player2Name = getStringExtra("player2Name")
|
||||
players = listOf(
|
||||
Player(player1Name, 0),
|
||||
Player(player2Name, 0)
|
||||
Player(player1Name, 0, Pattern.compile(getString(R.string.pattern, player1Name))),
|
||||
Player(player2Name, 0, Pattern.compile(getString(R.string.pattern, player2Name)))
|
||||
)
|
||||
serviceSide = getIntExtra("starterId", 0)
|
||||
relaunchSide = when(serviceSide) {
|
||||
|
@ -1,6 +1,9 @@
|
||||
package adrienmalin.pingpoints
|
||||
|
||||
import java.util.regex.Pattern
|
||||
|
||||
data class Player (
|
||||
var name: String,
|
||||
var score: Int
|
||||
var score: Int,
|
||||
var pattern: Pattern? = null
|
||||
)
|
@ -57,7 +57,7 @@ class SttDialog : DialogFragment() {
|
||||
matchModel?.apply {
|
||||
for (result in results) {
|
||||
for (player in players) {
|
||||
if (getString(R.string.pattern, player.name).equals(result, ignoreCase=true)) {
|
||||
if (player.pattern?.matcher(result)?.find() == true) {
|
||||
dismiss()
|
||||
updateScore(player)
|
||||
updateUI()
|
||||
@ -97,8 +97,8 @@ class SttDialog : DialogFragment() {
|
||||
matchModel?.apply {
|
||||
view.findViewById<TextView>(R.id.sttHintTextView).text = getString(
|
||||
R.string.STT_hint,
|
||||
getString(R.string.pattern, players[0].name),
|
||||
getString(R.string.pattern, players[1].name)
|
||||
players[0].name,
|
||||
players[1].name
|
||||
)
|
||||
sttIntent = Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH).apply {
|
||||
putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM)
|
||||
|
Reference in New Issue
Block a user