Revert "use string.equals(ignoreCase=true) instead of regex"
This reverts commit 4bb1ff5b42.
			
			
This commit is contained in:
		| @ -10,8 +10,8 @@ android { | |||||||
|         applicationId "adrienmalin.pingpoints" |         applicationId "adrienmalin.pingpoints" | ||||||
|         minSdkVersion 15 |         minSdkVersion 15 | ||||||
|         targetSdkVersion 28 |         targetSdkVersion 28 | ||||||
|         versionCode 6 |         versionCode 5 | ||||||
|         versionName "2.1" |         versionName "2.0" | ||||||
|         vectorDrawables.useSupportLibrary true |         vectorDrawables.useSupportLibrary true | ||||||
|     } |     } | ||||||
|     buildTypes { |     buildTypes { | ||||||
|  | |||||||
| @ -59,8 +59,8 @@ class MatchActivity : AppCompatActivity() { | |||||||
|                     val player1Name = getStringExtra("player1Name") |                     val player1Name = getStringExtra("player1Name") | ||||||
|                     val player2Name = getStringExtra("player2Name") |                     val player2Name = getStringExtra("player2Name") | ||||||
|                     players = listOf( |                     players = listOf( | ||||||
|                         Player(player1Name, 0), |                         Player(player1Name, 0, Pattern.compile(getString(R.string.pattern, player1Name))), | ||||||
|                         Player(player2Name, 0) |                         Player(player2Name, 0, Pattern.compile(getString(R.string.pattern, player2Name))) | ||||||
|                     ) |                     ) | ||||||
|                     serviceSide = getIntExtra("starterId", 0) |                     serviceSide = getIntExtra("starterId", 0) | ||||||
|                     relaunchSide = when(serviceSide) { |                     relaunchSide = when(serviceSide) { | ||||||
|  | |||||||
| @ -1,6 +1,9 @@ | |||||||
| package adrienmalin.pingpoints | package adrienmalin.pingpoints | ||||||
|  |  | ||||||
|  | import java.util.regex.Pattern | ||||||
|  |  | ||||||
| data class Player ( | data class Player ( | ||||||
|     var name: String, |     var name: String, | ||||||
|     var score: Int |     var score: Int, | ||||||
|  |     var pattern: Pattern? = null | ||||||
| ) | ) | ||||||
| @ -57,7 +57,7 @@ class SttDialog : DialogFragment() { | |||||||
|                     matchModel?.apply { |                     matchModel?.apply { | ||||||
|                         for (result in results) { |                         for (result in results) { | ||||||
|                             for (player in players) { |                             for (player in players) { | ||||||
|                                 if (getString(R.string.pattern, player.name).equals(result, ignoreCase=true)) { |                                 if (player.pattern?.matcher(result)?.find() == true) { | ||||||
|                                     dismiss() |                                     dismiss() | ||||||
|                                     updateScore(player) |                                     updateScore(player) | ||||||
|                                     updateUI() |                                     updateUI() | ||||||
| @ -97,8 +97,8 @@ class SttDialog : DialogFragment() { | |||||||
|                 matchModel?.apply { |                 matchModel?.apply { | ||||||
|                     view.findViewById<TextView>(R.id.sttHintTextView).text = getString( |                     view.findViewById<TextView>(R.id.sttHintTextView).text = getString( | ||||||
|                         R.string.STT_hint, |                         R.string.STT_hint, | ||||||
|                         getString(R.string.pattern, players[0].name), |                         players[0].name, | ||||||
|                         getString(R.string.pattern, players[1].name) |                         players[1].name | ||||||
|                     ) |                     ) | ||||||
|                     sttIntent = Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH).apply { |                     sttIntent = Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH).apply { | ||||||
|                         putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM) |                         putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM) | ||||||
|  | |||||||
| @ -32,8 +32,8 @@ | |||||||
|     <string name="share_subject">Match Ping Points : %s contre %s</string> |     <string name="share_subject">Match Ping Points : %s contre %s</string> | ||||||
|     <string name="share_message">"%s contre %s:\n%s a gagné par %d à %d\nPing Points est disponible sur Google Play\n "</string> |     <string name="share_message">"%s contre %s:\n%s a gagné par %d à %d\nPing Points est disponible sur Google Play\n "</string> | ||||||
|     <string name="match_point">Balle de match</string> |     <string name="match_point">Balle de match</string> | ||||||
|     <string name="STT_hint">Dîtes : \"%s\"\nou \"%s\"</string> |     <string name="STT_hint">Dîtes : \"Point pour %s\"\nou \"Point pour %s\"</string> | ||||||
|     <string name="pattern">Point pour %s</string> |     <string name="pattern">(?i:Point pour %s)</string> | ||||||
|     <string name="not_understood">Pouvez-vous répéter ?</string> |     <string name="not_understood">Pouvez-vous répéter ?</string> | ||||||
|     <string name="STT_disabled">Reconnaissance vocale désactivée.</string> |     <string name="STT_disabled">Reconnaissance vocale désactivée.</string> | ||||||
| </resources> | </resources> | ||||||
| @ -38,7 +38,7 @@ | |||||||
|     <string name="share_message">%s vs. %s:\n%s won by %d to %d\nGet Ping Points on Google Play</string> |     <string name="share_message">%s vs. %s:\n%s won by %d to %d\nGet Ping Points on Google Play</string> | ||||||
|     <string name="match_point">Match point</string> |     <string name="match_point">Match point</string> | ||||||
|     <string name="STT_hint">Say: \"Point for %s\"\nor \"Point for %s\"</string> |     <string name="STT_hint">Say: \"Point for %s\"\nor \"Point for %s\"</string> | ||||||
|     <string name="pattern">Point for %s</string> |     <string name="pattern">(?i:Point for %s)</string> | ||||||
|     <string name="not_understood">Can you repeat, please?</string> |     <string name="not_understood">Can you repeat, please?</string> | ||||||
|     <string name="score" translatable="false">%d - %d</string> |     <string name="score" translatable="false">%d - %d</string> | ||||||
|     <string name="STT_disabled">Voice recognition disabled.</string> |     <string name="STT_disabled">Voice recognition disabled.</string> | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user