Compatibility with Android 10

Refresh GUI
This commit is contained in:
adrienmalin 2020-09-12 15:39:42 +02:00
parent a3a3bcc673
commit 58b7c35219
33 changed files with 1133 additions and 1056 deletions

Binary file not shown.

View File

@ -1,6 +1,22 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<JetCodeStyleSettings>
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
<value>
<package name="java.util" alias="false" withSubpackages="false" />
<package name="kotlinx.android.synthetic" alias="false" withSubpackages="true" />
<package name="io.ktor" alias="false" withSubpackages="true" />
</value>
</option>
<option name="PACKAGES_IMPORT_LAYOUT">
<value>
<package name="" alias="false" withSubpackages="true" />
<package name="java" alias="false" withSubpackages="true" />
<package name="javax" alias="false" withSubpackages="true" />
<package name="kotlin" alias="false" withSubpackages="true" />
<package name="" alias="true" withSubpackages="true" />
</value>
</option>
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</JetCodeStyleSettings>
<Objective-C-extensions>
@ -28,6 +44,115 @@
<pair source="c" header="h" fileNamingConvention="NONE" />
</extensions>
</Objective-C-extensions>
<codeStyleSettings language="XML">
<arrangement>
<rules>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:android</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:id</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>style</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
<order>ANDROID_ATTRIBUTE_ORDER</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>.*</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
</rules>
</arrangement>
</codeStyleSettings>
<codeStyleSettings language="kotlin">
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</codeStyleSettings>

2
.idea/gradle.xml generated
View File

@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="PLATFORM" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">

14
.idea/misc.xml generated
View File

@ -5,7 +5,7 @@
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
<option name="myNullables">
<value>
<list size="7">
<list size="12">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
<item index="2" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" />
@ -13,18 +13,28 @@
<item index="4" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
<item index="5" class="java.lang.String" itemvalue="androidx.annotation.Nullable" />
<item index="6" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNullable" />
<item index="7" class="java.lang.String" itemvalue="android.annotation.Nullable" />
<item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.qual.Nullable" />
<item index="9" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableDecl" />
<item index="10" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableType" />
<item index="11" class="java.lang.String" itemvalue="com.android.annotations.Nullable" />
</list>
</value>
</option>
<option name="myNotNulls">
<value>
<list size="6">
<list size="11">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
<item index="4" class="java.lang.String" itemvalue="androidx.annotation.NonNull" />
<item index="5" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNonNull" />
<item index="6" class="java.lang.String" itemvalue="android.annotation.NonNull" />
<item index="7" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.qual.NonNull" />
<item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullDecl" />
<item index="9" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullType" />
<item index="10" class="java.lang.String" itemvalue="com.android.annotations.NonNull" />
</list>
</value>
</option>

View File

@ -5,13 +5,13 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
compileSdkVersion 30
defaultConfig {
applicationId "adrienmalin.pingpoints"
minSdkVersion 15
targetSdkVersion 28
versionCode 9
versionName "2.3"
targetSdkVersion 30
versionCode 10
versionName "2.4"
vectorDrawables.useSupportLibrary true
}
buildTypes {
@ -25,11 +25,11 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'android.arch.lifecycle:extensions:1.1.1'
annotationProcessor 'android.arch.lifecycle:compiler:1.1.1'
implementation 'com.android.support:design:28.0.0'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
annotationProcessor 'androidx.lifecycle:lifecycle-compiler:2.2.0'
implementation 'com.google.android.material:material:1.2.1'
}

View File

@ -12,6 +12,7 @@
android:logo="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:fullBackupContent="@xml/backup_descriptor"
android:theme="@style/PingPointsTheme">
<activity
android:name=".StarterNameActivity"

View File

@ -1,26 +1,38 @@
package adrienmalin.pingpoints
import android.arch.lifecycle.ViewModelProviders
import android.content.ActivityNotFoundException
import android.content.Context
import android.content.Intent
import android.media.AudioManager
import android.os.Build
import android.os.Bundle
import android.speech.RecognitionListener
import android.speech.RecognizerIntent
import android.speech.SpeechRecognizer
import android.speech.tts.TextToSpeech
import android.speech.tts.UtteranceProgressListener
import android.support.design.widget.Snackbar
import android.support.v7.app.AppCompatActivity
import android.support.v7.app.AppCompatDelegate
import android.util.Log
import android.view.View
import android.widget.Button
import android.widget.ImageView
import java.util.regex.Pattern
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.app.AppCompatDelegate
import androidx.lifecycle.ViewModelProvider
import com.google.android.material.snackbar.Snackbar
import kotlin.math.max
import kotlin.math.min
class MatchActivity : AppCompatActivity() {
var matchModel: MatchModel? = null
var match: MatchModel? = null
var textScore: android.widget.TextView? = null
var textService: android.widget.TextView? = null
var buttons: Array<Button> = emptyArray()
var imageViews: Array<ImageView> = emptyArray()
var icStt: ImageView? = null
var tts: TextToSpeech? = null
var stt: SpeechRecognizer? = null
inner class WaitForTtsInit : TextToSpeech.OnInitListener {
override fun onInit(status: Int) {
@ -28,58 +40,91 @@ class MatchActivity : AppCompatActivity() {
}
}
inner class SttAfterTts : UtteranceProgressListener() {
inner class WaitForTtsSpeak : UtteranceProgressListener() {
override fun onDone(id: String) {
SttDialog().show(supportFragmentManager, "SttDialog")
runOnUiThread {
startSTT()
}
}
override fun onStart(id: String) {}
@Suppress("OverridingDeprecatedMember")
override fun onError(id: String) {}
}
inner class SttListener : RecognitionListener {
var minRms: Float = 0f
var maxRms: Float = 0f
override fun onReadyForSpeech(arg0: Bundle?) {
icStt?.alpha = .5f
}
override fun onBeginningOfSpeech() {}
override fun onBufferReceived(buffer: ByteArray?) {}
override fun onRmsChanged(rmsdB: Float) {
minRms = min(rmsdB, minRms)
maxRms = max(rmsdB, maxRms)
if (minRms != maxRms)
icStt?.alpha = 0.5f + (rmsdB - minRms) / (2 * (maxRms - minRms))
}
override fun onPartialResults(data: Bundle) {}
override fun onResults(data: Bundle) {
stt = null
data.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION)?.let { results ->
match?.apply {
for (result in results) {
Log.i("stt results", result)
val soundex = soundex(result)
for (player in players) {
if (soundex == player.soundex) {
icStt?.alpha = 0f
unMuteAudio()
updateScore(player)
updateUI()
return
}
}
}
}
}
showPopUp(getString(R.string.not_understood))
startSTT()
}
override fun onEndOfSpeech() {}
override fun onError(errorCode: Int) {
muteAudio()
Log.e(
"stt", when (errorCode) {
SpeechRecognizer.ERROR_AUDIO -> "Audio recording error"
SpeechRecognizer.ERROR_CLIENT -> "Client side error"
SpeechRecognizer.ERROR_INSUFFICIENT_PERMISSIONS -> "Insufficient permissions"
SpeechRecognizer.ERROR_NETWORK -> "Network error"
SpeechRecognizer.ERROR_NETWORK_TIMEOUT -> "Network timeout"
SpeechRecognizer.ERROR_NO_MATCH -> "No match"
SpeechRecognizer.ERROR_RECOGNIZER_BUSY -> "RecognitionService busy"
SpeechRecognizer.ERROR_SERVER -> "Error from server"
SpeechRecognizer.ERROR_SPEECH_TIMEOUT -> "No speech input"
else -> "Didn't understand, please try again."
}
)
if (match?.matchStarted == true) startSTT()
}
override fun onEvent(arg0: Int, arg1: Bundle?) {}
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true)
setContentView(R.layout.activity_match)
initMatchModel()
findViews()
updateUI()
}
fun initMatchModel() {
matchModel = ViewModelProviders.of(this).get(MatchModel::class.java).apply {
if (!matchStarted) {
intent.apply {
matchStarted = true
val player1Name = getStringExtra("player1Name")
val player2Name = getStringExtra("player2Name")
players = listOf(
Player(player1Name, 0),
Player(player2Name, 0)
)
serviceSide = getIntExtra("starterId", 0)
relaunchSide = when(serviceSide) {
0 -> 1
else -> 0
}
ttsEnabled = getBooleanExtra("enableTTS", false)
sttEnabled = getBooleanExtra("enableSTT", false)
saveState()
if (ttsEnabled) {
tts = TextToSpeech(this@MatchActivity, WaitForTtsInit())
if (sttEnabled) tts?.setOnUtteranceProgressListener(SttAfterTts())
}
if (!sttEnabled) showPopUp(getString(R.string.button_hint))
}
}
}
}
fun findViews() {
textScore = findViewById(R.id.textScore)
textService = findViewById(R.id.textService)
buttons = arrayOf(
@ -90,10 +135,70 @@ class MatchActivity : AppCompatActivity() {
findViewById(R.id.imgService0),
findViewById(R.id.imgService1)
)
icStt = findViewById(R.id.icStt)
match = ViewModelProvider(this).get(MatchModel::class.java).apply {
if (!matchStarted) {
intent.apply {
matchStarted = true
val player1Name = getStringExtra("player1Name")
val player2Name = getStringExtra("player2Name")
players = listOf(
Player(player1Name ?: getString(R.string.player_1_default_name), 0),
Player(player2Name ?: getString(R.string.player_2_default_name), 0)
)
players.forEach {
it.soundex = soundex(getString(R.string.soundex, it.name))
}
serviceSide = getIntExtra("starterId", 0)
relaunchSide = when (serviceSide) {
0 -> 1
else -> 0
}
ttsEnabled = getBooleanExtra("enableTTS", false)
sttEnabled = getBooleanExtra("enableSTT", false)
saveState()
if (sttEnabled) {
showPopUp(
getString(
R.string.STT_hint,
players[0].name,
players[1].name
),
Snackbar.LENGTH_LONG
)
} else {
showPopUp(getString(R.string.button_hint))
}
if (ttsEnabled) {
tts = TextToSpeech(this@MatchActivity, WaitForTtsInit()).apply {
if (sttEnabled) setOnUtteranceProgressListener(WaitForTtsSpeak())
}
}
}
}
}
}
override fun onDestroy() {
stopSTT()
super.onDestroy()
}
override fun onResume() {
super.onResume()
updateUI()
}
override fun onPause() {
stopSTT()
super.onPause()
}
fun updateUI() {
matchModel?.apply {
match?.apply {
textScore?.text = getString(
R.string.score_score,
players[serviceSide].score,
@ -105,40 +210,44 @@ class MatchActivity : AppCompatActivity() {
button.text = fromHtml(getString(R.string.button_text, player.name, player.score))
imageViews[0].setImageResource(
when(serviceSide) {
when (serviceSide) {
0 -> R.drawable.ic_service_0
else -> 0
}
)
imageViews[1].setImageResource(
when(serviceSide) {
when (serviceSide) {
0 -> 0
else -> R.drawable.ic_service_1
}
)
if (matchFinished)
proclaimVictory()
else {
if (ttsEnabled) {
var scoreSpeech: String = getString(
R.string.update_score_speech,
players[serviceSide].score,
players[relaunchSide].score,
players[serviceSide].name
)
if (matchPoint) scoreSpeech += getString(R.string.match_point)
say(scoreSpeech)
}
if (matchStarted) {
if (matchFinished)
proclaimVictory()
else {
if (sttEnabled) SttDialog().show(supportFragmentManager, "SttDialog")
if (ttsEnabled) {
unMuteAudio()
var scoreSpeech = getString(
R.string.update_score_speech,
players[serviceSide].score,
players[relaunchSide].score,
players[serviceSide].name
)
if (matchPoint) scoreSpeech += getString(R.string.match_point)
say(scoreSpeech)
} else if (sttEnabled) {
startSTT()
}
}
}
}
}
fun proclaimVictory() {
matchModel?.apply {
match?.apply {
matchStarted = false
stopSTT()
val (loser, winner) = players.sortedBy { it.score }
if (ttsEnabled) {
say(
@ -163,9 +272,9 @@ class MatchActivity : AppCompatActivity() {
}
fun updateScore(view: View) {
matchModel?.apply {
match?.apply {
if (!matchFinished) {
when(view) {
when (view) {
buttons[0] -> updateScore(players[0])
buttons[1] -> updateScore(players[1])
}
@ -175,10 +284,10 @@ class MatchActivity : AppCompatActivity() {
}
override fun onBackPressed() {
if (matchModel?.pointId == 0)
if (match?.pointId == 0)
super.onBackPressed()
else {
matchModel?.undo()
match?.undo()
updateUI()
}
}
@ -191,7 +300,7 @@ class MatchActivity : AppCompatActivity() {
).show()
}
fun showPopUp(textId: Int, duration: Int = Snackbar.LENGTH_SHORT) {
fun showPopUp(textId: Int, duration: Int = Snackbar.LENGTH_INDEFINITE) {
Snackbar.make(
findViewById(R.id.coordinatorLayout),
textId,
@ -199,12 +308,87 @@ class MatchActivity : AppCompatActivity() {
).show()
}
fun stopSTT() {
icStt?.alpha = 0f
unMuteAudio()
stt?.stopListening()
stt?.destroy()
stt = null
}
fun startSTT() {
stt?.stopListening()
stt?.destroy()
if (match?.matchStarted == true) {
stt = SpeechRecognizer.createSpeechRecognizer(this@MatchActivity).apply {
setRecognitionListener(SttListener())
try {
startListening(
Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH).apply {
putExtra(
RecognizerIntent.EXTRA_LANGUAGE_MODEL,
RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH
)
putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 10)
putExtra(RecognizerIntent.EXTRA_PARTIAL_RESULTS, true)
if (!hasExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE)) {
putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, packageName)
}
}
)
} catch (e: ActivityNotFoundException) {
match?.sttEnabled = false
showPopUp(R.string.STT_unavailable)
}
}
}
}
@Suppress("DEPRECATION")
fun say(text: String, queueMode: Int = TextToSpeech.QUEUE_FLUSH) {
stopSTT()
tts?.speak(
text,
queueMode,
hashMapOf(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID to "TTS")
)
}
@Suppress("DEPRECATION")
fun muteAudio() {
(getSystemService(Context.AUDIO_SERVICE) as AudioManager).apply {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
adjustStreamVolume(AudioManager.STREAM_NOTIFICATION, AudioManager.ADJUST_MUTE, 0)
adjustStreamVolume(AudioManager.STREAM_ALARM, AudioManager.ADJUST_MUTE, 0)
adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_MUTE, 0)
adjustStreamVolume(AudioManager.STREAM_RING, AudioManager.ADJUST_MUTE, 0)
adjustStreamVolume(AudioManager.STREAM_SYSTEM, AudioManager.ADJUST_MUTE, 0)
} else {
setStreamMute(AudioManager.STREAM_NOTIFICATION, true)
setStreamMute(AudioManager.STREAM_ALARM, true)
setStreamMute(AudioManager.STREAM_MUSIC, true)
setStreamMute(AudioManager.STREAM_RING, true)
setStreamMute(AudioManager.STREAM_SYSTEM, true)
}
}
}
@Suppress("DEPRECATION")
fun unMuteAudio() {
(getSystemService(Context.AUDIO_SERVICE) as AudioManager).apply {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
adjustStreamVolume(AudioManager.STREAM_NOTIFICATION, AudioManager.ADJUST_UNMUTE, 0)
adjustStreamVolume(AudioManager.STREAM_ALARM, AudioManager.ADJUST_UNMUTE, 0)
adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_UNMUTE, 0)
adjustStreamVolume(AudioManager.STREAM_RING, AudioManager.ADJUST_UNMUTE, 0)
adjustStreamVolume(AudioManager.STREAM_SYSTEM, AudioManager.ADJUST_UNMUTE, 0)
} else {
setStreamMute(AudioManager.STREAM_NOTIFICATION, false)
setStreamMute(AudioManager.STREAM_ALARM, false)
setStreamMute(AudioManager.STREAM_MUSIC, false)
setStreamMute(AudioManager.STREAM_RING, false)
setStreamMute(AudioManager.STREAM_SYSTEM, false)
}
}
}
}

View File

@ -1,6 +1,6 @@
package adrienmalin.pingpoints
import android.arch.lifecycle.ViewModel
import androidx.lifecycle.ViewModel
class MatchModel : ViewModel() {

View File

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

View File

@ -9,14 +9,16 @@ import android.content.pm.PackageManager
import android.os.Bundle
import android.speech.SpeechRecognizer
import android.speech.tts.TextToSpeech
import android.support.design.widget.Snackbar
import android.support.v4.app.ActivityCompat
import android.support.v4.content.ContextCompat
import android.support.v7.app.AlertDialog
import android.support.v7.app.AppCompatActivity
import android.view.MotionEvent
import android.view.View
import android.widget.*
import android.widget.ArrayAdapter
import android.widget.AutoCompleteTextView
import android.widget.RadioGroup
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
import com.google.android.material.snackbar.Snackbar
import com.google.android.material.switchmaterial.SwitchMaterial
class StarterNameActivity : AppCompatActivity() {
@ -26,8 +28,8 @@ class StarterNameActivity : AppCompatActivity() {
var player1NameInput: AutoCompleteTextView? = null
var player2NameInput: AutoCompleteTextView? = null
var starterRadioGroup: RadioGroup? = null
var enableTtsSwitch: Switch? = null
var enableSttSwitch: Switch? = null
var enableTtsSwitch: SwitchMaterial? = null
var enableSttSwitch: SwitchMaterial? = null
var previousMatch: SharedPreferences? = null
var previousPlayers: Set<String> = emptySet()
@ -53,10 +55,11 @@ class StarterNameActivity : AppCompatActivity() {
fun restorePreviousSettings() {
previousMatch = getPreferences(Context.MODE_PRIVATE).apply {
getStringSet("previousPlayers", emptySet())?.let { previousPlayers = it.toSet() }
val adapter = ArrayAdapter<String>(
val adapter = ArrayAdapter(
this@StarterNameActivity,
android.R.layout.simple_list_item_1,
previousPlayers.toList())
previousPlayers.toList()
)
player1NameInput?.apply {
setText(
getString("previousPlayer2", getString(R.string.player_1_default_name)),
@ -157,8 +160,7 @@ class StarterNameActivity : AppCompatActivity() {
fun startMatch(view: View) {
val player1Name = player1NameInput?.text.toString()
val player2Name = player2NameInput?.text.toString()
val radioStarterId = starterRadioGroup?.checkedRadioButtonId
val starterId = when(radioStarterId) {
val starterId = when (starterRadioGroup?.checkedRadioButtonId) {
R.id.radioPlayer2Starts -> 1
else -> 0
}
@ -166,14 +168,14 @@ class StarterNameActivity : AppCompatActivity() {
val enableSTT = enableSttSwitch?.isChecked
// Save settings
previousMatch?.edit()?.apply{
player1Name.let { putString("previousPlayer1", it) }
player2Name.let { putString("previousPlayer2", it) }
previousMatch?.edit()?.apply {
putString("previousPlayer1", player1Name)
putString("previousPlayer2", player2Name)
putInt("previousStarterId", starterId)
putStringSet("previousPlayers", previousPlayers.plus(player1Name).plus(player2Name))
enableTTS?.let { putBoolean("enableTTS", it) }
enableSTT?.let { putBoolean("enableSTT", it) }
commit()
apply()
}
startActivity(

View File

@ -1,200 +0,0 @@
package adrienmalin.pingpoints
import android.app.AlertDialog
import android.content.ActivityNotFoundException
import android.content.Context
import android.content.Intent
import android.media.AudioManager
import android.os.Build
import android.os.Bundle
import android.speech.RecognitionListener
import android.speech.RecognizerIntent
import android.speech.SpeechRecognizer
import android.support.v4.app.DialogFragment
import android.view.LayoutInflater
import android.widget.ImageView
import android.widget.TextView
import java.util.regex.Pattern
import kotlin.math.max
import kotlin.math.min
class SttDialog : DialogFragment() {
var matchActivity: MatchActivity? = null
var partialResultsTextView: TextView? = null
var icStt: ImageView? = null
var stt: SpeechRecognizer? = null
var sttIntent: Intent? = null
var pattern: Pattern? = null
inner class SttListener : RecognitionListener {
val ERROR_NOT_UNDERSTOOD = 1
var minRms: Float = 0f
var maxRms: Float = 0f
override fun onReadyForSpeech(arg0: Bundle?) {}
override fun onBeginningOfSpeech() {}
override fun onBufferReceived(buffer: ByteArray?) {}
override fun onRmsChanged(rmsdB: Float) {
minRms = min(rmsdB, minRms)
maxRms = max(rmsdB, maxRms)
if (minRms != maxRms)
icStt?.alpha = 0.5f + (rmsdB - minRms) / (2 * (maxRms - minRms))
}
override fun onPartialResults(data: Bundle) {
data.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION)?.let { results ->
matchActivity?.apply {
matchModel?.apply {
for (result in results) {
partialResultsTextView?.text = result
pattern?.apply{
val matcher = matcher(result)
if (matcher.find()) {
val foundName = matcher.group(1)
for (player in players) {
if (soundex(foundName) == player.soundex) {
dismiss()
updateScore(player)
updateUI()
return
}
}
}
}
}
}
}
}
}
override fun onResults(data: Bundle) {
partialResultsTextView?.text = getString(R.string.not_understood)
onError(ERROR_NOT_UNDERSTOOD)
}
override fun onEndOfSpeech() {}
override fun onError(errorCode: Int) {
muteAudio()
stt?.destroy()
stt = SpeechRecognizer.createSpeechRecognizer(activity).apply {
setRecognitionListener(this@SttListener)
startListening(sttIntent)
}
}
override fun onEvent(arg0: Int, arg1: Bundle?) {}
}
override fun onCreateDialog(savedInstanceState: Bundle?) = AlertDialog.Builder(activity).apply {
(context?.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater).inflate(R.layout.dialog_stt, null).let { view ->
partialResultsTextView = view.findViewById(R.id.partialResultTextView)
icStt = view.findViewById(R.id.icStt)
setView(view)
matchActivity = (activity as MatchActivity).apply {
matchModel?.apply {
view.findViewById<TextView>(R.id.sttHintTextView).text = getString(
R.string.STT_hint,
players[0].name,
players[1].name
)
sttIntent = Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH).apply {
putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH)
putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 10)
putExtra(RecognizerIntent.EXTRA_PARTIAL_RESULTS, true)
putExtra(RecognizerIntent.EXTRA_PREFER_OFFLINE, true)
putExtra(RecognizerIntent.EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS, 30000)
}
stt = SpeechRecognizer.createSpeechRecognizer(activity).apply {
setRecognitionListener(SttListener())
try {
stopListening()
startListening(sttIntent)
} catch (e: ActivityNotFoundException) {
sttEnabled = false
dismiss()
showPopUp(R.string.STT_unavailable)
}
}
pattern = Pattern.compile(getString(R.string.pattern), Pattern.CASE_INSENSITIVE)
}
}
}
}.create()!!
override fun onResume() {
super.onResume()
matchActivity?.apply {
matchModel?.apply {
stt?.destroy()
stt = SpeechRecognizer.createSpeechRecognizer(activity).apply {
setRecognitionListener(SttListener())
try {
stopListening()
startListening(sttIntent)
} catch (e: ActivityNotFoundException) {
sttEnabled = false
dismiss()
showPopUp(R.string.STT_unavailable)
}
}
}
}
}
override fun onPause() {
unMuteAudio()
stt?.stopListening()
stt?.destroy()
super.onPause()
}
@Suppress("DEPRECATION")
fun muteAudio() {
activity?.apply {
(getSystemService(Context.AUDIO_SERVICE) as AudioManager).apply {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
adjustStreamVolume(AudioManager.STREAM_NOTIFICATION, AudioManager.ADJUST_MUTE, 0)
adjustStreamVolume(AudioManager.STREAM_ALARM, AudioManager.ADJUST_MUTE, 0)
adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_MUTE, 0)
adjustStreamVolume(AudioManager.STREAM_RING, AudioManager.ADJUST_MUTE, 0)
adjustStreamVolume(AudioManager.STREAM_SYSTEM, AudioManager.ADJUST_MUTE, 0)
} else {
setStreamMute(AudioManager.STREAM_NOTIFICATION, true)
setStreamMute(AudioManager.STREAM_ALARM, true)
setStreamMute(AudioManager.STREAM_MUSIC, true)
setStreamMute(AudioManager.STREAM_RING, true)
setStreamMute(AudioManager.STREAM_SYSTEM, true)
}
}
}
}
@Suppress("DEPRECATION")
fun unMuteAudio() {
activity?.apply {
(getSystemService(Context.AUDIO_SERVICE) as AudioManager).apply {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
adjustStreamVolume(AudioManager.STREAM_NOTIFICATION, AudioManager.ADJUST_UNMUTE, 0)
adjustStreamVolume(AudioManager.STREAM_ALARM, AudioManager.ADJUST_UNMUTE, 0)
adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_UNMUTE, 0)
adjustStreamVolume(AudioManager.STREAM_RING, AudioManager.ADJUST_UNMUTE, 0)
adjustStreamVolume(AudioManager.STREAM_SYSTEM, AudioManager.ADJUST_UNMUTE, 0)
} else {
setStreamMute(AudioManager.STREAM_NOTIFICATION, false)
setStreamMute(AudioManager.STREAM_ALARM, false)
setStreamMute(AudioManager.STREAM_MUSIC, false)
setStreamMute(AudioManager.STREAM_RING, false)
setStreamMute(AudioManager.STREAM_SYSTEM, false)
}
}
}
}
}

View File

@ -1,17 +1,17 @@
package adrienmalin.pingpoints
import android.arch.lifecycle.ViewModelProviders
import android.content.Context
import android.content.Intent
import android.content.SharedPreferences
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.support.v7.app.AppCompatDelegate
import android.text.method.LinkMovementMethod
import android.view.View
import android.widget.ArrayAdapter
import android.widget.GridView
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.app.AppCompatDelegate
import androidx.lifecycle.ViewModelProvider
import kotlin.math.max
import kotlin.math.min
@ -31,17 +31,19 @@ class VictoryActivity : AppCompatActivity() {
}
fun initVictoryModel() {
victoryModel = ViewModelProviders.of(this).get(VictoryModel::class.java).apply {
victoryModel = ViewModelProvider(this).get(VictoryModel::class.java).apply {
if (!matchFinished) {
matchFinished = true
winnerName = intent.getStringExtra("winnerName")
winnerName = intent.getStringExtra("winnerName") ?: ""
players = listOf(
Player(
intent.getStringExtra("player1Name"),
intent.getStringExtra("player1Name")
?: getString(R.string.player_1_default_name),
intent.getIntExtra("player1Score", 0)
),
Player(
intent.getStringExtra("player2Name"),
intent.getStringExtra("player2Name")
?: getString(R.string.player_2_default_name),
intent.getIntExtra("player2Score", 0)
)
)
@ -60,17 +62,17 @@ class VictoryActivity : AppCompatActivity() {
players[1].score
)
findViewById<TextView>(R.id.player2NameTextView).text = players[1].name
findViewById<GridView>(R.id.previousMatchesGrid).adapter = ArrayAdapter<String>(
findViewById<GridView>(R.id.previousMatchesGrid).adapter = ArrayAdapter(
this@VictoryActivity,
R.layout.grid_item,
R.id.grid_item_text,
previousMatches.split("\t|\n".toRegex()).toMutableList()
previousMatches.split("[\t\n]".toRegex()).toMutableList()
)
}
// Set HTML text for icons credits
findViewById<TextView>(R.id.iconsCredit).apply {
setText(fromHtml(getString(R.string.iconCredits)))
text = fromHtml(getString(R.string.iconCredits))
movementMethod = LinkMovementMethod.getInstance()
}
}
@ -88,19 +90,19 @@ class VictoryActivity : AppCompatActivity() {
previousMatches
)
)
commit()
apply()
}
}
super.onStop()
}
fun newMatch(view: View) {
fun newMatch(@Suppress("UNUSED_PARAMETER") view: View) {
startActivity(
Intent(this, StarterNameActivity::class.java)
)
}
fun share(view: View) {
fun share(@Suppress("UNUSED_PARAMETER") view: View) {
victoryModel?.apply {
startActivity(
Intent().apply {

View File

@ -1,6 +1,6 @@
package adrienmalin.pingpoints
import android.arch.lifecycle.ViewModel
import androidx.lifecycle.ViewModel
class VictoryModel : ViewModel() {
var matchFinished: Boolean = false

View File

@ -1,6 +1,7 @@
package adrienmalin.pingpoints
import java.util.regex.*
import java.util.*
import java.util.regex.Pattern
val yNotPrecededByA:Pattern = Pattern.compile("(?<!A)Y")
val hNotPrecededByCS: Pattern = Pattern.compile("(?<![CS])H")
@ -12,7 +13,7 @@ val doubleLetter = Pattern.compile("(\\w)\\1+(?!\\1)")
fun soundex(string: String): String {
var s = string
.trim()
.toUpperCase()
.toUpperCase(Locale.ROOT)
.replace('Â', 'A')
.replace('Ä', 'A')
.replace('À', 'A')

View File

@ -1,170 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportHeight="108"
android:viewportWidth="108">
<path
android:fillColor="#26A69A"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
</vector>

View File

@ -1,7 +0,0 @@
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:autoMirrored="true"
android:height="48dp" android:width="48dp"
android:viewportHeight="285.876" android:viewportWidth="285.876">
<path android:fillColor="#FFFFFF" android:pathData="M261.207,76.226c-8.573,9.43 -20.236,13.134 -27.668,9.293c0.605,6.751 -3.436,13.287 -10.141,15.544c-18.231,6.139 -37.408,9.21 -56.583,9.21c-10.257,0 -20.512,-0.885 -30.624,-2.643c15.289,20.576 39.358,32.753 65.156,32.753c8.284,0 15,6.716 15,15s-6.716,15 -15,15c-32.82,0 -63.598,-14.394 -84.591,-39.029l-26.497,44.097c30.164,25.599 53.935,55.258 70.763,88.411c3.749,7.387 0.801,16.415 -6.587,20.165c-2.176,1.104 -4.494,1.627 -6.777,1.627c-5.47,0 -10.742,-3.002 -13.388,-8.214c-14.607,-28.78 -35.188,-54.695 -61.282,-77.281c-3.667,27.708 -13.553,54.145 -29.537,78.86c-2.871,4.438 -7.69,6.855 -12.609,6.855c-2.792,0 -5.614,-0.778 -8.132,-2.406c-6.957,-4.499 -8.935,-13.785 -4.436,-20.741c17.485,-27.035 26.365,-56.402 26.365,-87.284v-3.058c0,-4.645 0.568,-9.303 3.111,-13.535L92.94,83.63c6.162,-13.495 19.867,-12.797 26.78,-11.028l0.941,0.311c30.074,9.922 63.158,9.825 93.164,-0.28c4.559,-1.533 9.328,-0.743 13.052,1.715c-0.392,-6.599 2.662,-14.617 8.781,-21.348c9.621,-10.583 23.14,-13.963 30.195,-7.549C272.908,51.864 270.828,65.643 261.207,76.226zM244.508,138.119c-4.768,0 -8.632,3.865 -8.632,8.632s3.865,8.632 8.632,8.632c4.768,0 8.632,-3.865 8.632,-8.632S249.276,138.119 244.508,138.119zM121.3,62.781c17.337,0 31.391,-14.054 31.391,-31.391S138.636,0 121.3,0c-17.337,0 -31.391,14.054 -31.391,31.391S103.963,62.781 121.3,62.781z"/>
</vector>

View File

@ -1,7 +0,0 @@
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:autoMirrored="true"
android:height="48dp" android:width="48dp"
android:viewportHeight="285.876" android:viewportWidth="285.876">
<path android:fillColor="#ffffff" android:pathData="m24.693,76.226c8.573,9.43 20.236,13.134 27.668,9.293 -0.605,6.751 3.436,13.287 10.141,15.544 18.231,6.139 37.408,9.21 56.583,9.21 10.257,0 20.512,-0.885 30.624,-2.643 -15.289,20.576 -39.358,32.753 -65.156,32.753 -8.284,0 -15,6.716 -15,15 -0,8.284 6.716,15 15,15 32.82,0 63.598,-14.394 84.591,-39.029l26.497,44.097c-30.164,25.599 -53.935,55.258 -70.763,88.411 -3.749,7.387 -0.801,16.415 6.587,20.165 2.176,1.104 4.494,1.627 6.777,1.627 5.47,0 10.742,-3.002 13.388,-8.214 14.607,-28.78 35.188,-54.695 61.282,-77.281 3.667,27.708 13.553,54.145 29.537,78.86 2.871,4.438 7.69,6.855 12.609,6.855 2.792,0 5.614,-0.778 8.132,-2.406 6.957,-4.499 8.935,-13.785 4.436,-20.741 -17.485,-27.035 -26.365,-56.402 -26.365,-87.284l-0,-3.058c-0,-4.645 -0.568,-9.303 -3.111,-13.535L192.96,83.63c-6.162,-13.495 -19.867,-12.797 -26.78,-11.028l-0.941,0.311c-30.074,9.922 -63.158,9.825 -93.164,-0.28 -4.559,-1.533 -9.328,-0.743 -13.052,1.715 0.392,-6.599 -2.662,-14.617 -8.781,-21.348 -9.621,-10.583 -23.14,-13.963 -30.195,-7.549 -7.055,6.413 -4.975,20.192 4.646,30.775zM41.392,138.119c4.768,0 8.632,3.865 8.632,8.632 -0,4.767 -3.865,8.632 -8.632,8.632 -4.768,0 -8.632,-3.865 -8.632,-8.632 -0,-4.767 3.864,-8.632 8.632,-8.632zM164.6,62.781c-17.337,0 -31.391,-14.054 -31.391,-31.391C133.209,14.053 147.264,0 164.6,0 181.937,0 195.991,14.054 195.991,31.391c-0,17.337 -14.054,31.39 -31.391,31.39z"/>
</vector>

View File

@ -1,131 +1,132 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:tools="http://schemas.android.com/tools" android:id="@+id/coordinatorLayout"
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/coordinatorLayout"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:keepScreenOn="true">
<LinearLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/linearLayoutText"
android:layout_width="match_parent"
<TextView
android:id="@+id/textScore"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
android:layout_margin="8dp"
android:layout_marginStart="32dp"
android:layout_marginLeft="32dp"
android:layout_marginTop="32dp"
android:layout_weight="1"
android:text="@string/score_score"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
app:layout_constraintStart_toStartOf="parent"
tools:layout_editor_absoluteY="8dp" android:layout_weight="0">
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textScore"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_weight="1"
android:gravity="left"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:text="@string/score_score" android:layout_margin="8dp"/>
<TextView
android:id="@+id/textService"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_weight="1"
android:gravity="right"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toEndOf="@+id/textScore"
app:layout_constraintTop_toTopOf="parent"
android:text="@string/service" android:layout_margin="8dp"/>
<TextView
android:id="@+id/textService"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="32dp"
android:layout_marginRight="32dp"
android:layout_weight="1"
android:text="@string/service"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</LinearLayout>
<ImageView
android:id="@+id/icStt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:layout_marginTop="24dp"
android:alpha="0"
android:contentDescription="@string/STT"
app:layout_constraintEnd_toEndOf="@+id/textService"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_stt" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" android:layout_weight="1">
<ImageView
android:id="@+id/imgService0"
android:layout_width="48dp"
android:layout_height="0dp"
android:layout_margin="8dp"
android:layout_marginStart="32dp"
android:layout_marginLeft="32dp"
android:layout_marginTop="16dp"
android:layout_marginBottom="32dp"
android:contentDescription="@string/service_img_description"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textScore"
app:srcCompat="@drawable/ic_service_1" />
<ImageView
android:id="@+id/imgService0"
android:layout_width="48dp"
android:layout_margin="8dp"
android:layout_weight="0"
android:contentDescription="@string/service_img_description"
app:srcCompat="@drawable/ic_service_1"
tools:layout_editor_absoluteY="120dp" android:layout_height="match_parent"/>
<Button
android:id="@+id/buttonPlayer0"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="24dp"
android:layout_marginLeft="24dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="32dp"
android:layout_weight="1"
android:bufferType="spannable"
android:onClick="updateScore"
android:textAllCaps="false"
android:textSize="24sp"
android:textStyle="bold"
android:theme="@style/ColoredButtonStyle"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/buttonPlayer1"
app:layout_constraintStart_toEndOf="@+id/imgService0"
app:layout_constraintTop_toBottomOf="@+id/textScore"
tools:text="@string/button_text" />
<Button
android:id="@+id/buttonPlayer0"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="8dp"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_weight="1"
android:bufferType="spannable"
android:onClick="updateScore"
android:textAllCaps="false"
android:textAppearance="@style/TextAppearance.AppCompat.Button"
android:textSize="24sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/imgService0"
app:layout_constraintTop_toTopOf="parent"
tools:text="@string/button_text" android:layout_marginRight="8dp"
android:theme="@style/ScoreButton"/>
<Button
android:id="@+id/buttonPlayer1"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="24dp"
android:layout_marginRight="24dp"
android:layout_marginBottom="32dp"
android:layout_weight="1"
android:bufferType="spannable"
android:onClick="updateScore"
android:textAllCaps="false"
android:textSize="24sp"
android:textStyle="bold"
android:theme="@style/ColoredButtonStyle"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/imgService1"
app:layout_constraintStart_toEndOf="@+id/buttonPlayer0"
app:layout_constraintTop_toBottomOf="@+id/textService"
tools:text="@string/button_text" />
<Button
android:id="@+id/buttonPlayer1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_weight="1"
android:bufferType="spannable"
android:onClick="updateScore"
android:textAllCaps="false"
android:textAppearance="@style/TextAppearance.AppCompat.Button"
android:textSize="24sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/imgService1"
app:layout_constraintStart_toEndOf="@+id/buttonPlayer0"
tools:text="@string/button_text" android:theme="@style/ScoreButton"/>
<ImageView
android:id="@+id/imgService1"
android:layout_width="48dp"
android:layout_height="0dp"
android:layout_margin="8dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="32dp"
android:layout_marginRight="32dp"
android:layout_marginBottom="32dp"
android:contentDescription="@string/service_img_description"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textService" />
</androidx.constraintlayout.widget.ConstraintLayout>
<ImageView
android:id="@+id/imgService1"
android:layout_width="48dp"
android:layout_height="match_parent"
android:layout_margin="8dp"
android:layout_weight="0"
android:contentDescription="@string/service_img_description"
tools:layout_editor_absoluteY="120dp"/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_weight="0">
</LinearLayout>
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -1,101 +1,136 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:tools="http://schemas.android.com/tools" xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/myCoordinatorLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".StarterNameActivity">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:id="@+id/WhoStarts" android:text="@string/who_starts"
app:layout_constraintStart_toStartOf="parent" android:layout_marginLeft="8dp"
android:layout_marginStart="8dp" android:textAppearance="@style/TextAppearance.AppCompat.Headline"
android:layout_marginTop="8dp" app:layout_constraintTop_toTopOf="parent"/>
<RadioGroup
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
app:layout_constraintTop_toBottomOf="@+id/WhoStarts" android:id="@+id/starterRadioGroup"
android:layout_marginStart="8dp" app:layout_constraintStart_toStartOf="parent"
android:layout_marginLeft="8dp" app:layout_constraintEnd_toEndOf="parent" android:layout_marginEnd="8dp"
android:layout_marginRight="8dp" android:orientation="horizontal">
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content" tools:layout_editor_absoluteY="93dp"
tools:layout_editor_absoluteX="16dp" android:id="@+id/radioPlayer1Starts" android:layout_weight="0"
android:checked="true"/>
<AutoCompleteTextView
android:text="@string/player_1_default_name"
android:layout_width="match_parent"
android:layout_height="wrap_content" tools:layout_editor_absoluteY="48dp"
android:id="@+id/player1Name"
tools:layout_editor_absoluteX="143dp" android:hint="@string/player_1_default_name"
android:layout_weight="1"
android:completionThreshold="1"
android:singleLine="true"
android:imeOptions="actionNext"/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content" app:srcCompat="@drawable/ic_swap_horiz"
android:layout_weight="0" android:id="@+id/swapNamesButton"
android:contentDescription="@string/swap_names" android:onClick="swapNames"/>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content" tools:layout_editor_absoluteY="93dp"
tools:layout_editor_absoluteX="16dp" android:id="@+id/radioPlayer2Starts"
android:layout_weight="0" android:checked="true"/>
<AutoCompleteTextView
android:text="@string/player_2_default_name"
android:layout_width="match_parent"
tools:layout_editor_absoluteX="136dp" android:id="@+id/player2Name"
android:hint="@string/player_2_default_name" android:layout_height="wrap_content"
android:layout_weight="1"
android:completionThreshold="1"
android:singleLine="true"
android:imeOptions="actionNext"/>
</RadioGroup>
<Switch
android:text="@string/TTS"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:id="@+id/enableTtsSwitch"
android:layout_marginTop="8dp" app:layout_constraintTop_toBottomOf="@+id/starterRadioGroup"
android:layout_marginEnd="8dp" app:layout_constraintEnd_toEndOf="parent"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp" app:layout_constraintStart_toStartOf="parent"
android:layout_marginLeft="8dp"/>
<Switch
android:text="@string/STT"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:id="@+id/enableSttSwitch" android:layout_marginTop="8dp"
app:layout_constraintTop_toBottomOf="@+id/enableTtsSwitch" app:layout_constraintEnd_toEndOf="parent"
android:layout_marginEnd="8dp" android:layout_marginRight="8dp"
app:layout_constraintStart_toStartOf="parent" android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"/>
<Button
android:text="@string/start"
android:id="@+id/startButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/startMatchButton"
android:layout_marginBottom="8dp"
app:layout_constraintBottom_toBottomOf="parent" android:layout_marginEnd="8dp"
app:layout_constraintEnd_toEndOf="parent" android:layout_marginRight="8dp"
style="@android:style/Widget.DeviceDefault.Button"
android:layout_marginTop="32dp"
android:layout_marginEnd="32dp"
android:layout_marginRight="32dp"
android:drawableStart="@drawable/ic_new_match"
android:drawableLeft="@drawable/ic_new_match"
android:onClick="startMatch"/>
</android.support.constraint.ConstraintLayout>
android:onClick="startMatch"
android:text="@string/start"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/enableSttSwitch" />
</android.support.design.widget.CoordinatorLayout>
<TextView
android:id="@+id/WhoStarts"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginLeft="32dp"
android:layout_marginTop="32dp"
android:text="@string/who_starts"
android:textAppearance="@style/TextAppearance.AppCompat.Headline"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<RadioGroup
android:id="@+id/starterRadioGroup"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginLeft="32dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="32dp"
android:layout_marginRight="32dp"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/WhoStarts">
<RadioButton
android:id="@+id/radioPlayer1Starts"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:checked="true"
tools:layout_editor_absoluteX="16dp"
tools:layout_editor_absoluteY="93dp" />
<AutoCompleteTextView
android:id="@+id/player1Name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:completionThreshold="1"
android:hint="@string/player_1_default_name"
android:imeOptions="actionNext"
android:singleLine="true"
android:text="@string/player_1_default_name"
tools:layout_editor_absoluteX="143dp"
tools:layout_editor_absoluteY="48dp" />
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:contentDescription="@string/swap_names"
android:onClick="swapNames"
app:srcCompat="@drawable/ic_swap_horiz" />
<RadioButton
android:id="@+id/radioPlayer2Starts"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:checked="true"
tools:layout_editor_absoluteX="16dp"
tools:layout_editor_absoluteY="93dp" />
<AutoCompleteTextView
android:id="@+id/player2Name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:completionThreshold="1"
android:hint="@string/player_2_default_name"
android:imeOptions="actionNext"
android:singleLine="true"
android:text="@string/player_2_default_name"
tools:layout_editor_absoluteX="136dp" />
</RadioGroup>
<com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/enableTtsSwitch"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginLeft="32dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="32dp"
android:layout_marginRight="32dp"
android:text="@string/TTS"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/starterRadioGroup" />
<com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/enableSttSwitch"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginLeft="32dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="32dp"
android:layout_marginRight="32dp"
android:text="@string/STT"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/enableTtsSwitch" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -1,116 +1,144 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:tools="http://schemas.android.com/tools" android:id="@+id/coordinatorLayout"
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/coordinatorLayout"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:keepScreenOn="true">
<LinearLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/linearLayoutText"
android:layout_width="match_parent"
<TextView
android:id="@+id/textService"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:orientation="horizontal"
android:layout_margin="8dp"
android:layout_marginStart="32dp"
android:layout_marginLeft="32dp"
android:layout_marginTop="32dp"
android:layout_weight="1"
android:gravity="start"
android:text="@string/service"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/icStt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="32dp"
android:layout_marginRight="32dp"
android:alpha="0"
android:contentDescription="@string/STT"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_stt" />
<TextView
android:id="@+id/textScore"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:layout_marginStart="32dp"
android:layout_marginLeft="32dp"
android:layout_marginTop="16dp"
android:layout_marginBottom="8dp"
android:gravity="start"
android:text="@string/score_score"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
app:layout_constraintBottom_toTopOf="@+id/imgService0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textService" />
<ImageView
android:id="@+id/imgService0"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_margin="8dp"
android:layout_marginStart="32dp"
android:layout_marginLeft="32dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="32dp"
android:layout_marginRight="32dp"
android:layout_marginBottom="8dp"
android:contentDescription="@string/service_img_description"
app:layout_constraintBottom_toTopOf="@+id/buttonPlayer0"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:layout_editor_absoluteY="8dp" android:layout_weight="0">
app:layout_constraintTop_toBottomOf="@+id/textScore"
app:srcCompat="@drawable/ic_service_1" />
<TextView
android:id="@+id/textScore"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
android:gravity="left"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginRight="8dp" android:text="@string/score_score"
android:layout_weight="1" android:layout_margin="8dp"/>
<TextView
android:id="@+id/textService"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toEndOf="@+id/textScore"
app:layout_constraintTop_toTopOf="parent"
android:gravity="right" android:text="@string/service"
android:layout_weight="1" android:layout_margin="8dp"/>
<Button
android:id="@+id/buttonPlayer0"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_margin="8dp"
android:layout_marginStart="32dp"
android:layout_marginLeft="32dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="32dp"
android:layout_marginRight="32dp"
android:layout_marginBottom="8dp"
android:layout_weight="1"
android:bufferType="spannable"
android:onClick="updateScore"
android:textAllCaps="false"
android:textSize="24sp"
android:textStyle="bold"
android:theme="@style/ColoredButtonStyle"
app:layout_constraintBottom_toTopOf="@+id/buttonPlayer1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/imgService0"
tools:text="@string/button_text" />
</LinearLayout>
<Button
android:id="@+id/buttonPlayer1"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_margin="8dp"
android:layout_marginStart="32dp"
android:layout_marginLeft="32dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="32dp"
android:layout_marginRight="32dp"
android:layout_marginBottom="8dp"
android:layout_weight="1"
android:bufferType="spannable"
android:onClick="updateScore"
android:textAllCaps="false"
android:textSize="24sp"
android:textStyle="bold"
android:theme="@style/ColoredButtonStyle"
app:layout_constraintBottom_toTopOf="@+id/imgService1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/buttonPlayer0"
tools:text="@string/button_text" />
<LinearLayout
<ImageView
android:id="@+id/imgService1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" android:layout_weight="1">
android:layout_height="48dp"
android:layout_margin="8dp"
android:layout_marginStart="32dp"
android:layout_marginLeft="32dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="32dp"
android:layout_marginRight="32dp"
android:layout_marginBottom="32dp"
android:contentDescription="@string/service_img_description"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/buttonPlayer1" />
</androidx.constraintlayout.widget.ConstraintLayout>
<ImageView
android:id="@+id/imgService0"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_margin="8dp"
android:contentDescription="@string/service_img_description"
app:srcCompat="@drawable/ic_service_1"
tools:layout_editor_absoluteY="120dp"/>
<Button
android:id="@+id/buttonPlayer0"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="8dp"
android:bufferType="spannable"
android:onClick="updateScore"
android:textAllCaps="false"
android:textAppearance="@style/TextAppearance.AppCompat.Button"
android:textSize="24sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/imgService0"
app:layout_constraintTop_toTopOf="parent"
tools:text="@string/button_text" android:layout_margin="8dp" android:layout_weight="1"
android:theme="@style/ScoreButton" android:layout_marginLeft="8dp"/>
<Button
android:id="@+id/buttonPlayer1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:bufferType="spannable"
android:onClick="updateScore"
android:textAllCaps="false"
android:textAppearance="@style/TextAppearance.AppCompat.Button"
android:textSize="24sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/imgService1"
app:layout_constraintStart_toEndOf="@+id/buttonPlayer0"
tools:text="@string/button_text" android:layout_margin="8dp" android:layout_weight="1"
android:theme="@style/ScoreButton"/>
<ImageView
android:id="@+id/imgService1"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_margin="8dp"
android:contentDescription="@string/service_img_description"
tools:layout_editor_absoluteY="120dp"/>
</LinearLayout>
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -1,116 +1,158 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:tools="http://schemas.android.com/tools" android:id="@+id/coordinatorLayout"
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/coordinatorLayout"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".StarterNameActivity">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".StarterNameActivity">
<TextView
android:id="@+id/WhoStarts"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:id="@+id/WhoStarts" android:text="@string/who_starts"
app:layout_constraintStart_toStartOf="parent" android:layout_marginLeft="8dp"
android:layout_marginStart="8dp" android:textAppearance="@style/TextAppearance.AppCompat.Headline"
android:layout_marginTop="8dp" app:layout_constraintTop_toTopOf="parent"/>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
app:layout_constraintTop_toBottomOf="@+id/WhoStarts"
android:layout_marginStart="32dp"
android:layout_marginLeft="32dp"
android:layout_marginTop="32dp"
android:text="@string/who_starts"
android:textAppearance="@style/TextAppearance.AppCompat.Headline"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginLeft="8dp" android:layout_marginStart="8dp" app:layout_constraintEnd_toEndOf="parent"
android:layout_marginEnd="8dp" android:layout_marginRight="8dp" android:id="@+id/linearLayout"
android:layout_margin="8dp">
<RadioGroup
app:layout_constraintTop_toTopOf="parent" />
<RadioGroup
android:id="@+id/starterRadioGroup"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_marginStart="32dp"
android:layout_marginLeft="32dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
app:layout_constraintBottom_toBottomOf="@+id/player2Name"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/player1Name">
<RadioButton
android:id="@+id/radioPlayer1Starts"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginTop="8dp"
app:layout_constraintTop_toBottomOf="@+id/WhoStarts" android:id="@+id/starterRadioGroup"
android:layout_marginStart="8dp" app:layout_constraintStart_toStartOf="parent"
android:layout_marginLeft="8dp" app:layout_constraintEnd_toEndOf="parent"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp" android:layout_marginBottom="8dp">
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content" tools:layout_editor_absoluteY="93dp"
tools:layout_editor_absoluteX="16dp" android:id="@+id/radioPlayer1Starts"
android:layout_weight="1" android:gravity="top" android:checked="true"/>
<RadioButton
android:layout_height="wrap_content" tools:layout_editor_absoluteY="93dp"
tools:layout_editor_absoluteX="16dp" android:id="@+id/radioPlayer2Starts"
android:layout_width="wrap_content" android:layout_weight="1"
android:gravity="bottom"
android:checked="false"/>
</RadioGroup>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<AutoCompleteTextView
android:text="@string/player_1_default_name"
android:layout_width="match_parent"
android:layout_height="wrap_content" tools:layout_editor_absoluteY="48dp"
android:id="@+id/player1Name"
tools:layout_editor_absoluteX="143dp" android:hint="@string/player_1_default_name"
android:selectAllOnFocus="true"
android:completionThreshold="1"
android:singleLine="true"
android:imeOptions="actionNext"/>
<ImageButton
android:layout_width="match_parent"
android:layout_height="wrap_content" app:srcCompat="@drawable/ic_swap_vert"
android:id="@+id/swapNamesButton" android:contentDescription="@string/swap_names"
android:onClick="swapNames"/>
<AutoCompleteTextView
android:text="@string/player_2_default_name"
tools:layout_editor_absoluteX="136dp" android:id="@+id/player2Name"
android:hint="@string/player_2_default_name" android:layout_height="wrap_content"
android:layout_width="match_parent" android:selectAllOnFocus="true"
android:completionThreshold="1"
android:singleLine="true"
android:imeOptions="actionNext"/>
</LinearLayout>
</LinearLayout>
<Switch
android:text="@string/TTS"
android:layout_height="wrap_content"
android:layout_weight="1"
android:checked="true"
android:gravity="top"
tools:layout_editor_absoluteX="16dp"
tools:layout_editor_absoluteY="93dp" />
<RadioButton
android:id="@+id/radioPlayer2Starts"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:checked="false"
android:gravity="bottom"
tools:layout_editor_absoluteX="16dp"
tools:layout_editor_absoluteY="93dp" />
</RadioGroup>
<AutoCompleteTextView
android:id="@+id/player1Name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:id="@+id/enableTtsSwitch"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginLeft="8dp" android:layout_marginStart="8dp" app:layout_constraintEnd_toEndOf="parent"
android:layout_marginEnd="6dp" android:layout_marginRight="6dp" app:layout_constraintHorizontal_bias="0.0"
android:layout_marginTop="8dp" app:layout_constraintTop_toBottomOf="@+id/linearLayout"/>
<Switch
android:text="@string/STT"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:id="@+id/enableSttSwitch"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
app:layout_constraintTop_toBottomOf="@+id/enableTtsSwitch" android:layout_marginStart="8dp"
app:layout_constraintStart_toStartOf="parent" android:layout_marginLeft="8dp" android:layout_marginEnd="8dp"
app:layout_constraintEnd_toEndOf="parent" android:layout_marginRight="8dp"/>
<Button
android:text="@string/start"
android:layout_marginEnd="32dp"
android:layout_marginRight="32dp"
android:completionThreshold="1"
android:hint="@string/player_1_default_name"
android:imeOptions="actionNext"
android:selectAllOnFocus="true"
android:singleLine="true"
android:text="@string/player_1_default_name"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/starterRadioGroup"
app:layout_constraintTop_toBottomOf="@+id/WhoStarts" />
<ImageButton
android:id="@+id/imageButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/startMatchButton"
style="@android:style/Widget.DeviceDefault.Button"
android:layout_marginEnd="8dp" app:layout_constraintEnd_toEndOf="parent" android:layout_marginRight="8dp"
android:layout_marginBottom="8dp" app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginStart="32dp"
android:layout_marginLeft="32dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="32dp"
android:layout_marginRight="32dp"
android:contentDescription="@string/swap_names"
android:onClick="swapNames"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/player1Name"
app:srcCompat="@drawable/ic_swap_vert" />
<AutoCompleteTextView
android:id="@+id/player2Name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginEnd="32dp"
android:layout_marginRight="32dp"
android:completionThreshold="1"
android:hint="@string/player_2_default_name"
android:imeOptions="actionNext"
android:selectAllOnFocus="true"
android:singleLine="true"
android:text="@string/player_2_default_name"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/starterRadioGroup"
app:layout_constraintTop_toBottomOf="@+id/imageButton" />
<com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/enableTtsSwitch"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginLeft="32dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="32dp"
android:layout_marginRight="32dp"
android:text="@string/TTS"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/player2Name" />
<com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/enableSttSwitch"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginLeft="32dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="32dp"
android:layout_marginRight="32dp"
android:text="@string/STT"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/enableTtsSwitch" />
<Button
android:id="@+id/startButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:layout_marginEnd="32dp"
android:layout_marginRight="32dp"
android:drawableStart="@drawable/ic_new_match"
android:drawableLeft="@drawable/ic_new_match" android:onClick="startMatch"/>
android:drawableLeft="@drawable/ic_new_match"
android:onClick="startMatch"
android:text="@string/start"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/enableSttSwitch" />
</android.support.constraint.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</android.support.design.widget.CoordinatorLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -1,133 +1,175 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:tools="http://schemas.android.com/tools" xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/coordinatorLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".VictoryActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/congrats"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginLeft="32dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="32dp"
android:layout_marginRight="32dp"
android:text="@string/congrats"
android:textAppearance="@style/TextAppearance.AppCompat.Headline"
android:layout_marginEnd="8dp" app:layout_constraintEnd_toEndOf="parent"
android:layout_marginRight="8dp" android:layout_marginStart="8dp"
app:layout_constraintStart_toStartOf="parent" android:layout_marginLeft="8dp"
android:text="@string/congrats" android:layout_marginTop="8dp"
app:layout_constraintTop_toTopOf="parent"/>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content" app:layout_constraintTop_toBottomOf="@+id/congrats"
android:id="@+id/resultLinearLayout" android:layout_marginTop="8dp"
app:layout_constraintStart_toStartOf="parent" android:layout_marginLeft="8dp"
android:layout_marginStart="8dp" app:layout_constraintEnd_toEndOf="parent"
android:layout_marginEnd="8dp" android:layout_marginRight="8dp" android:layout_marginBottom="8dp"
app:layout_constraintBottom_toTopOf="@+id/previousMatchesTextView">
<TextView
android:text="@string/player_1_default_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:id="@+id/player1NameTextView"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:gravity="right" tools:layout_editor_absoluteX="8dp" android:layout_weight="1"/>
<TextView
android:text="@string/score"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="@+id/scoreTextView"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:layout_marginStart="24dp"
android:layout_marginLeft="24dp" android:layout_weight="0" android:layout_marginRight="24dp"/>
<TextView
android:text="@string/player_2_default_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:id="@+id/player2NameTextView"
android:layout_marginLeft="24dp" android:layout_marginStart="24dp"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" android:layout_marginEnd="8dp"
android:layout_marginRight="8dp" android:gravity="left"
android:layout_weight="1"/>
</LinearLayout>
<TextView
android:text="@string/previous_matches"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" android:textAllCaps="true"
android:id="@+id/previousMatchesTextView"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginLeft="8dp" android:layout_marginStart="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/resultLinearLayout"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp" android:layout_marginTop="32dp"/>
<GridView
android:layout_width="0dp"
android:numColumns="3" android:id="@+id/previousMatchesGrid" android:clickable="false"
android:gravity="center"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginLeft="16dp" android:layout_marginStart="16dp"
android:layout_marginEnd="16dp" app:layout_constraintEnd_toEndOf="parent"
android:layout_marginRight="16dp"
android:layout_height="0dp"
app:layout_constraintTop_toBottomOf="@+id/previousMatchesTextView" android:layout_marginTop="8dp"
android:layout_marginBottom="8dp" app:layout_constraintBottom_toTopOf="@+id/pingPointsCredit"/>
<Button
android:text="@string/new_match"
android:layout_width="wrap_content"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/player1NameTextView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:id="@+id/buttonNewMatch" app:layout_constraintEnd_toEndOf="parent"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:layout_weight="1"
android:text="@string/player_1_default_name"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
app:layout_constraintBottom_toTopOf="@+id/previousMatchesTextView"
app:layout_constraintEnd_toStartOf="@+id/scoreTextView"
app:layout_constraintTop_toBottomOf="@+id/congrats" />
<TextView
android:id="@+id/scoreTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:layout_weight="0"
android:text="@string/score"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
app:layout_constraintBottom_toTopOf="@+id/previousMatchesTextView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/congrats" />
<TextView
android:id="@+id/player2NameTextView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:layout_weight="1"
android:text="@string/player_2_default_name"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
app:layout_constraintBottom_toTopOf="@+id/previousMatchesTextView"
app:layout_constraintStart_toEndOf="@+id/scoreTextView"
app:layout_constraintTop_toBottomOf="@+id/congrats" />
<TextView
android:id="@+id/previousMatchesTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginLeft="32dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="32dp"
android:layout_marginRight="32dp"
android:text="@string/previous_matches"
android:textAllCaps="true"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/player1NameTextView" />
<GridView
android:id="@+id/previousMatchesGrid"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="32dp"
android:layout_marginLeft="32dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="32dp"
android:layout_marginRight="32dp"
android:layout_marginBottom="8dp"
android:clickable="false"
android:gravity="center"
android:numColumns="3"
app:layout_constraintBottom_toTopOf="@+id/pingPointsCredit"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/previousMatchesTextView">
</GridView>
<TextView
android:id="@+id/pingPointsCredit"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginLeft="32dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="32dp"
android:layout_marginRight="32dp"
android:layout_weight="0"
android:text="@string/PingPointsCredits"
app:layout_constraintBottom_toTopOf="@+id/iconsCredit"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/previousMatchesGrid" />
<TextView
android:id="@+id/iconsCredit"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginLeft="32dp"
android:layout_marginEnd="32dp"
android:layout_marginRight="32dp"
android:layout_marginBottom="24dp"
android:layout_weight="0"
android:maxLines="1"
android:text="@string/iconCredits"
app:layout_constraintBottom_toTopOf="@+id/buttonShare"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent" />
<Button
android:id="@+id/buttonNewMatch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="32dp"
android:layout_marginRight="32dp"
android:layout_marginBottom="32dp"
android:drawableStart="@drawable/ic_new_match"
android:drawableLeft="@drawable/ic_new_match"
android:onClick="newMatch"
android:layout_marginBottom="8dp"
app:layout_constraintBottom_toBottomOf="parent"/>
android:text="@string/new_match"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<Button
android:text="@string/share"
android:id="@+id/buttonShare"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/buttonShare"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginLeft="8dp" android:layout_marginStart="8dp"
android:layout_marginStart="32dp"
android:layout_marginLeft="32dp"
android:layout_marginBottom="32dp"
android:drawableStart="@drawable/ic_share"
android:drawableLeft="@drawable/ic_share" android:onClick="share"
android:layout_marginBottom="8dp" app:layout_constraintBottom_toBottomOf="parent"/>
<TextView
android:id="@+id/pingPointsCredit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/PingPointsCredits"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginStart="8dp"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginEnd="8dp"
android:layout_weight="0" android:layout_marginLeft="8dp" android:layout_marginRight="8dp"
app:layout_constraintBottom_toTopOf="@+id/iconsCredit"
/>
<TextView
android:id="@+id/iconsCredit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/iconCredits"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginStart="8dp" app:layout_constraintEnd_toEndOf="parent"
android:layout_marginEnd="8dp"
android:layout_weight="0" android:layout_marginLeft="8dp" android:layout_marginRight="8dp"
android:maxLines="1"
app:layout_constraintHorizontal_bias="1.0"
android:layout_marginBottom="8dp" app:layout_constraintBottom_toTopOf="@+id/buttonShare"/>
android:drawableLeft="@drawable/ic_share"
android:onClick="share"
android:text="@string/share"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</android.support.constraint.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</android.support.design.widget.CoordinatorLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".SttDialog">
<ImageView
app:srcCompat="@drawable/ic_stt"
android:layout_width="match_parent"
android:layout_height="wrap_content" android:id="@+id/icStt" android:layout_margin="8dp"
android:contentDescription="@string/STT"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/STT_hint" android:id="@+id/sttHintTextView"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" android:gravity="center"
android:layout_marginLeft="8dp" android:layout_marginRight="8dp"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content" android:id="@+id/partialResultTextView"
android:layout_margin="8dp" android:gravity="center"/>
</LinearLayout>

View File

@ -1,14 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/grid_item_text" android:gravity="center" app:layout_constraintEnd_toEndOf="parent"
android:layout_marginEnd="8dp" android:layout_marginRight="8dp"
app:layout_constraintStart_toStartOf="parent" android:layout_marginLeft="8dp"
android:layout_marginStart="8dp" android:layout_marginTop="8dp" app:layout_constraintTop_toTopOf="parent"
android:layout_marginBottom="8dp" app:layout_constraintBottom_toBottomOf="parent"/>
</android.support.constraint.ConstraintLayout>
android:id="@+id/grid_item_text"
android:gravity="center"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginBottom="8dp"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -12,8 +12,6 @@
<string name="iconCredits">Icônes par &lt;a href=&quot;http://www.freepik.com&quot; title=&quot;Freepik&quot;&gt;Freepik&lt;/a&gt; chez &lt;a href=&quot;https://www.flaticon.com/&quot; title=&quot;Flaticon&quot;&gt;flaticon.com&lt;/a&gt; Licence &lt;a href=&quot;http://creativecommons.org/licenses/by/3.0/&quot; title=&quot;Creative Commons BY 3.0&quot; target=&quot;_blank&quot;&gt;CC 3.0 BY&lt;/a&gt;</string>
<string name="TTS_unavailable">Désolé, votre appareil ne permet pas la synthèse vocale.</string>
<string name="STT_unavailable">Désolé, votre appareil ne permet pas la reconnaissance vocale.</string>
<string name="OK">OK</string>
<string name="cancel">Annuler</string>
<string name="audio_record_permission_denied">La reconnaissance vocale a besoin de la permission d\'enregistrer des
fichiers audio pour fonctionner.
</string>
@ -22,8 +20,6 @@
<string name="service_img_description">Service</string>
<string name="update_score_speech">"%d - %d. Service : %s. "</string>
<string name="button_hint">Cliquez sur le joueur qui a marqué</string>
<string name="redo">Rétablir</string>
<string name="undo">Annuler</string>
<string name="congrats">Bravo %s !</string>
<string name="previous_matches">Matchs précédents</string>
<string name="new_match">Nouveau match</string>
@ -33,7 +29,6 @@
<string name="share_message">"%s contre %s:\n%s a gagné par %d à %d\nPing Points est disponible sur Google Play"</string>
<string name="match_point">Balle de match</string>
<string name="STT_hint">Dîtes : \"Point pour %s\"\nou \"Point pour %s\"</string>
<string name="pattern">point pour (.+)</string>
<string name="not_understood">Pouvez-vous répéter ?</string>
<string name="STT_disabled">Reconnaissance vocale désactivée.</string>
<string name="soundex">point pour %s</string>
</resources>

View File

@ -3,4 +3,5 @@
<color name="colorPrimary">#016df5</color>
<color name="colorPrimaryDark">#004aa7</color>
<color name="colorAccent">#0088ff</color>
<color name="white">#ffffff</color>
</resources>

View File

@ -15,8 +15,6 @@
</string>
<string name="TTS_unavailable">Sorry, your device doesn\'t support text to speech.</string>
<string name="STT_unavailable">Sorry, your device doesn\'t support voice recognition.</string>
<string name="OK">OK</string>
<string name="cancel">Cancel</string>
<string name="audio_record_permission_denied">Audio recording permission required to use voice recognition.</string>
<string name="service">Service: %s</string>
<string name="score_score">Score: %d - %d</string>
@ -26,8 +24,6 @@
</string>
<string name="update_score_speech">"%d - %d. Service: %s. "</string>
<string name="button_hint">Click on the scoring player</string>
<string name="undo">Undo</string>
<string name="redo">Redo</string>
<string name="congrats">Congratulations, %s!</string>
<string name="previous_matches">Previous matches</string>
<string name="new_match">New match</string>
@ -38,8 +34,7 @@
<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="STT_hint">Say: \"Point for %s\"\nor \"Point for %s\"</string>
<string name="pattern">point for (.+)</string>
<string name="soundex">point for %s</string>
<string name="not_understood">Can you repeat, please?</string>
<string name="score" translatable="false">%d - %d</string>
<string name="STT_disabled">Voice recognition disabled.</string>
</resources>

View File

@ -1,17 +1,23 @@
<resources>
<!-- the theme applied to the application or activity -->
<style name="PingPointsTheme" parent="Base.V22.Theme.AppCompat">
<style name="PingPointsTheme" parent="@style/Platform.MaterialComponents">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="colorControlNormal">#FFFFFF</item>
<item name="android:actionBarStyle">@style/ColoredActionBarBackground</item>
<!-- Support library compatibility -->
<item name="actionBarStyle">@style/ColoredActionBarBackground</item>
</style>
<style name="ColoredActionBarBackground"
parent="@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="android:background">@color/colorPrimaryDark</item>
<style name="ColoredActionBarBackground" parent="@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="android:background">@color/colorPrimary</item>
<!-- Support library compatibility -->
<item name="background">@color/colorPrimaryDark</item>
<item name="background">@color/colorPrimary</item>
</style>
<style name="ScoreButton">
<style name="ColoredButtonStyle" parent="Widget.AppCompat.Button.Colored">
<item name="colorButtonNormal">@color/colorAccent</item>
<item name="android:textColor">@color/white</item>
</style>
</resources>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<full-backup-content>
<!-- Exclude specific shared preferences that contain GCM registration Id -->
</full-backup-content>

View File

@ -1,5 +1,6 @@
<!--suppress XmlHighlighting -->
<vector android:autoMirrored="true" android:height="24dp"
android:viewportHeight="430.556" android:viewportWidth="430.556"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
android:viewportHeight="430.556" android:viewportWidth="430.556"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FFFFFF" android:pathData="M139.689,93.625c0.552,-4.94 5.006,-8.496 9.944,-7.945c4.94,0.552 8.497,5.004 7.945,9.943c-0.398,3.566 3.715,14.81 21.66,34.326c16.172,17.59 39.202,37.165 64.845,55.121c17.287,12.104 35.165,23.035 51.702,31.609c4.413,2.288 6.135,7.721 3.847,12.133c-1.602,3.089 -4.743,4.859 -7.997,4.859c-1.396,0 -2.811,-0.325 -4.135,-1.012c-17.231,-8.935 -35.814,-20.293 -53.741,-32.846C184.855,165.572 136.803,119.458 139.689,93.625zM52.83,91.751c-4.802,-1.301 -9.739,1.543 -11.036,6.341c-5.789,21.428 -4.187,44.349 4.51,64.541c2.622,6.087 5.887,11.938 9.705,17.391l25.55,36.492c11.818,16.878 28.379,29.397 47.893,36.205c0.981,0.342 1.981,0.505 2.964,0.505c3.721,0 7.203,-2.326 8.498,-6.038c1.637,-4.693 -0.84,-9.825 -5.533,-11.463c-15.926,-5.556 -29.438,-15.768 -39.076,-29.533l-25.551,-36.493c-3.116,-4.45 -5.78,-9.223 -7.917,-14.186c-7.098,-16.478 -8.399,-35.203 -3.666,-52.727C60.468,97.988 57.629,93.047 52.83,91.751zM306.703,198.433c3.112,0 6.139,-1.616 7.805,-4.507c2.483,-4.306 1.005,-9.81 -3.301,-12.292c-11.505,-6.634 -23.224,-14.118 -34.83,-22.244c-21.658,-15.165 -41.119,-31.282 -56.278,-46.611c-3.495,-3.532 -9.192,-3.565 -12.728,-0.07c-3.534,3.495 -3.566,9.193 -0.07,12.728c15.907,16.085 36.223,32.925 58.752,48.698c12.036,8.428 24.203,16.197 36.163,23.094C303.632,198.044 305.177,198.433 306.703,198.433zM179.468,105.23c4.071,2.851 9.683,1.86 12.535,-2.21l27.736,-39.611c16.175,-23.102 40.497,-38.542 68.484,-43.477c27.986,-4.938 56.124,1.255 79.227,17.431c42.257,29.588 57.098,86.902 34.521,133.317c-2.174,4.47 -0.313,9.855 4.157,12.03c1.268,0.616 2.609,0.908 3.93,0.908c3.336,0 6.542,-1.863 8.1,-5.065c12.747,-26.206 15.785,-56.35 8.555,-84.876c-7.311,-28.845 -24.69,-54.08 -48.939,-71.059C350.733,3.685 317.821,-3.568 285.097,2.205c-32.722,5.77 -61.17,23.839 -80.103,50.879l-27.736,39.611C174.406,96.767 175.396,102.379 179.468,105.23zM349.668,380.735c2.235,3.19 3.094,7.069 2.416,10.92c-0.679,3.851 -2.812,7.203 -6.006,9.439l-37.92,26.552c-2.546,1.781 -5.469,2.636 -8.363,2.637c-4.613,0 -9.154,-2.171 -11.994,-6.224l-23.765,-33.94c-0.015,-0.021 -0.03,-0.042 -0.045,-0.063c-0.015,-0.021 -0.029,-0.042 -0.044,-0.063l-26.687,-38.114c-0.039,-0.053 -0.077,-0.105 -0.114,-0.159c-0.037,-0.054 -0.074,-0.107 -0.11,-0.161l-10.572,-15.099c-2.851,-4.071 -1.861,-9.684 2.21,-12.534c4.072,-2.853 9.684,-1.862 12.535,2.21l5.521,7.886l39.754,-27.834c4.072,-2.852 9.684,-1.862 12.535,2.21l26.714,38.153c0.044,0.061 0.088,0.121 0.131,0.183s0.085,0.123 0.126,0.186L349.668,380.735zM273.574,372.358l32.381,-22.673l-16.519,-23.593l-32.381,22.673L273.574,372.358zM332.984,388.288l-16.705,-23.858l-32.381,22.673l16.706,23.859L332.984,388.288zM424.708,240.113c0,29.289 -23.828,53.117 -53.117,53.117c-15.028,0 -29.419,-6.41 -39.483,-17.587c-8.792,-9.765 -13.634,-22.383 -13.634,-35.53c0,-29.289 23.828,-53.117 53.117,-53.117S424.708,210.823 424.708,240.113zM406.708,240.113c0,-19.363 -15.753,-35.117 -35.117,-35.117s-35.117,15.754 -35.117,35.117c0,8.691 3.2,17.032 9.011,23.485c6.655,7.393 16.171,11.632 26.106,11.632C390.955,275.23 406.708,259.476 406.708,240.113zM118.872,288.815c3.721,0 7.203,-2.326 8.498,-6.038c1.637,-4.693 -0.841,-9.825 -5.534,-11.462c-21.089,-7.355 -38.982,-20.88 -51.746,-39.112L37.09,185.075c-16.176,-23.103 -22.366,-51.238 -17.431,-79.226c4.935,-27.988 20.377,-52.31 43.48,-68.486c36.03,-25.229 84.706,-25.36 121.124,-0.324c4.097,2.815 9.7,1.778 12.515,-2.318c2.816,-4.097 1.778,-9.699 -2.318,-12.516C151.887,-7.061 94.963,-6.895 52.815,22.619C25.774,41.552 7.703,70.001 1.933,102.724s1.479,65.635 20.413,92.676l32.998,47.126c14.943,21.346 35.886,37.178 60.564,45.785C116.889,288.653 117.888,288.815 118.872,288.815zM236.791,289.807l-16.505,23.571c-0.001,0.001 -0.001,0.002 -0.002,0.003c-0.001,0.002 -0.002,0.004 -0.003,0.005l-77.493,110.67c-2.839,4.056 -7.382,6.229 -11.995,6.229c-2.894,0 -5.815,-0.855 -8.361,-2.636l-37.924,-26.557c-3.194,-2.235 -5.327,-5.587 -6.006,-9.437c-0.679,-3.85 0.18,-7.729 2.417,-10.923l23.721,-33.877c0.028,-0.041 0.057,-0.083 0.085,-0.124c0.029,-0.042 0.059,-0.083 0.088,-0.123l26.655,-38.067c0.033,-0.049 0.066,-0.097 0.1,-0.146c0.034,-0.049 0.068,-0.097 0.103,-0.145l26.631,-38.032c0.036,-0.054 0.073,-0.107 0.111,-0.161c0.037,-0.054 0.076,-0.107 0.114,-0.16l16.389,-23.406c-17.779,-23.404 -26.645,-52.261 -25.064,-82.017c0.263,-4.964 4.5,-8.781 9.465,-8.51c4.963,0.264 8.773,4.501 8.51,9.465c-1.461,27.494 7.484,54.077 25.188,74.851c2.659,3.12 2.874,7.643 0.522,11l-15.216,21.73l32.381,22.674l15.216,-21.73c2.351,-3.357 6.672,-4.702 10.515,-3.271c20.884,7.781 44.326,8.711 66.005,2.615c4.785,-1.345 9.755,1.443 11.1,6.229s-1.443,9.754 -6.228,11.1C284.255,297.106 259.48,296.782 236.791,289.807zM146.689,387.102l-32.38,-22.673l-16.707,23.859l32.38,22.673L146.689,387.102zM173.533,348.767l-32.381,-22.674l-16.519,23.591l32.381,22.674L173.533,348.767zM200.377,310.429l-32.38,-22.673l-16.52,23.593l32.38,22.673L200.377,310.429z"/>
</vector>

View File

@ -1,13 +1,13 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.2.71'
ext.kotlin_version = '1.4.0'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.android.tools.build:gradle:4.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong

View File

@ -10,12 +10,11 @@
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
android.useAndroidX=true
android.enableJetifier=true

View File

@ -1,5 +1,6 @@
#Tue Sep 08 21:52:23 CEST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-all.zip