From ef230d552052e937f38909482c5d6f1ee076dbe6 Mon Sep 17 00:00:00 2001 From: adrienmalin <41926238+adrienmalin@users.noreply.github.com> Date: Mon, 3 Dec 2018 17:43:27 +0100 Subject: [PATCH] start MatchActivity --- .idea/caches/build_file_checksums.ser | Bin 537 -> 548 bytes app/build.gradle | 6 +- app/src/main/AndroidManifest.xml | 37 +-- .../adrienmalin/pingpoints/MatchActivity.kt | 24 ++ .../java/adrienmalin/pingpoints/MatchModel.kt | 15 +- .../pingpoints/StarterNameActivity.kt | 115 +++++++-- .../{ic_left_service.xml => ic_service_1.xml} | 0 ...{ic_right_service.xml => ic_service_2.xml} | 0 .../main/res/layout-land/activity_match.xml | 143 +++++++++++ .../res/layout-land/activity_starter_name.xml | 218 ++++++++-------- app/src/main/res/layout/activity_match.xml | 136 ++++++++++ .../main/res/layout/activity_starter_name.xml | 235 ++++++++++-------- app/src/main/res/values-fr/strings.xml | 13 + app/src/main/res/values/colors.xml | 2 +- app/src/main/res/values/strings.xml | 20 +- 15 files changed, 714 insertions(+), 250 deletions(-) create mode 100644 app/src/main/java/adrienmalin/pingpoints/MatchActivity.kt rename app/src/main/res/drawable/{ic_left_service.xml => ic_service_1.xml} (100%) rename app/src/main/res/drawable/{ic_right_service.xml => ic_service_2.xml} (100%) create mode 100644 app/src/main/res/layout-land/activity_match.xml create mode 100644 app/src/main/res/layout/activity_match.xml diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser index 41ba9fbb165d325c94e2ec5100a3795d3f82cfd9..452d5799b4852a125a12e548eb207cd5285348c1 100644 GIT binary patch delta 112 zcmV-$0FVEf1f&Fzm;`j;{y&kNcMuw1wqFk<sZ%(0DmBY=p(K+d0dg$$b<p_ixP9&k z6!@>u^ao0G05d~6Tvc;ra&uf^WO8X`ZZ2(MY-w(1a%FjwwgDs)+1zwCauce0>iYfo Shg^&UbN~^PzX2PQ2m%qhyf452 delta 107 zcmV-x0F?iv1epYom;`BpvYnBfcMu`}=PEA$LH%h-|3l;TfBcgp0dgT9gK*7F-bq6; zIWLF&Hcx$Y04PH`Tvc;ra&uf^WNB?-lfeNb8Ppw&*^dCS1nGbYnC$pMeslm4XL4a= NY-N*x0Tq)I0uc>DEYbh~ diff --git a/app/build.gradle b/app/build.gradle index 167350b..6005423 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -24,10 +24,14 @@ android { } dependencies { + def lifecycle_version = "2.0.0" + implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" + 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 "androidx.lifecycle:lifecycle-extensions-ktx:$lifecycle_version" testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index a3a6e85..7a4b14a 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,26 +1,31 @@ <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="adrienmalin.pingpoints" > + package="adrienmalin.pingpoints"> + <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.RECORD_AUDIO"/> - <application - android:allowBackup="true" - android:icon="@mipmap/ic_launcher" - android:logo="@mipmap/ic_launcher" - android:label="@string/app_name" - android:roundIcon="@mipmap/ic_launcher_round" - android:supportsRtl="true" - android:theme="@style/Theme.AppCompat" - > - <activity - android:name=".StarterNameActivity" - android:windowSoftInputMode="adjustResize" > - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> + <application + android:allowBackup="true" + android:icon="@mipmap/ic_launcher" + android:label="@string/app_name" + android:logo="@mipmap/ic_launcher" + android:roundIcon="@mipmap/ic_launcher_round" + android:supportsRtl="true" + android:theme="@style/Theme.AppCompat.NoActionBar"> + <activity + android:name=".StarterNameActivity" + android:windowSoftInputMode="adjustResize"> + <intent-filter> + <action android:name="android.intent.action.MAIN"/> + + <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> + <activity + android:name=".MatchActivity" + android:label="@string/title_activity_match"> + </activity> </application> </manifest> \ No newline at end of file diff --git a/app/src/main/java/adrienmalin/pingpoints/MatchActivity.kt b/app/src/main/java/adrienmalin/pingpoints/MatchActivity.kt new file mode 100644 index 0000000..b0812aa --- /dev/null +++ b/app/src/main/java/adrienmalin/pingpoints/MatchActivity.kt @@ -0,0 +1,24 @@ +package adrienmalin.pingpoints + +import android.os.Bundle +import android.support.v7.app.AppCompatActivity +import android.support.v7.app.AppCompatDelegate +import android.view.View +import android.arch.lifecycle.ViewModelProviders + + +class MatchActivity : AppCompatActivity() { + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + AppCompatDelegate.setCompatVectorFromResourcesEnabled(true) + setContentView(R.layout.activity_match) + setSupportActionBar(findViewById(R.id.toolbar)) + val matchModel = ViewModelProviders.of(this).get(MatchModel::class.java) + } + + fun updateScore(view: View) { + + } + +} diff --git a/app/src/main/java/adrienmalin/pingpoints/MatchModel.kt b/app/src/main/java/adrienmalin/pingpoints/MatchModel.kt index 3672ffd..fa844ad 100644 --- a/app/src/main/java/adrienmalin/pingpoints/MatchModel.kt +++ b/app/src/main/java/adrienmalin/pingpoints/MatchModel.kt @@ -3,8 +3,15 @@ package adrienmalin.pingpoints import android.arch.lifecycle.ViewModel class MatchModel : ViewModel() { - var players: List<Player> = listOf(Player(), Player()) - var server: Int = 0 - var ttsEnabled: Boolean = false - var sttEnabled: Boolean = false + lateinit var players: List<Player> + lateinit var server: Int + lateinit var ttsEnabled: Boolean + lateinit var sttEnabled: Boolean + + fun startMatch(player1Name: String, player2Name:String, starterId: Int, enableTTS: Boolean, enableSTT: Boolean) { + players = listOf(Player(player1Name), Player(player2Name)) + server = starterId + ttsEnabled = enableTTS + sttEnabled = enableSTT + } } \ No newline at end of file diff --git a/app/src/main/java/adrienmalin/pingpoints/StarterNameActivity.kt b/app/src/main/java/adrienmalin/pingpoints/StarterNameActivity.kt index c3d30b4..433022b 100644 --- a/app/src/main/java/adrienmalin/pingpoints/StarterNameActivity.kt +++ b/app/src/main/java/adrienmalin/pingpoints/StarterNameActivity.kt @@ -1,19 +1,26 @@ package adrienmalin.pingpoints +import android.Manifest import android.annotation.SuppressLint import android.content.Context +import android.content.Intent import android.content.SharedPreferences -import android.support.v7.app.AppCompatActivity +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.text.method.LinkMovementMethod import android.view.View import android.widget.* -import android.speech.tts.TextToSpeech -import android.content.Intent -import android.speech.SpeechRecognizer -val CHECK_TTS = 1 +const val CHECK_TTS = 1 +const val ASK_PERMISSIONS_RECORD_AUDIO = 2 class StarterNameActivity : AppCompatActivity() { @@ -29,23 +36,21 @@ class StarterNameActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_starter_name) - + setSupportActionBar(findViewById(R.id.toolbar)) // Set HTML text for icons credits findViewById<TextView>(R.id.iconsCredit).run { setHtmlText(getString(R.string.iconCredits)) movementMethod = LinkMovementMethod.getInstance() } - // Find views player1NameInput = findViewById(R.id.player1Name) player2NameInput = findViewById(R.id.player2Name) starterRadioGroup = findViewById(R.id.starterRadioGroup) enableTtsSwitch = findViewById(R.id.enableTtsSwitch) enableSttSwitch = findViewById(R.id.enableSttSwitch) - + // Check if function is available on switch checked or swapped enableTtsSwitch?.setOnCheckedChangeListener { view, isChecked -> checkTTS() } enableTtsSwitch?.setOnTouchListener { view, event -> checkTTS(); false} - enableSttSwitch?.setOnCheckedChangeListener { view, isChecked -> checkSTT() } enableSttSwitch?.setOnTouchListener { view, event -> checkSTT(); false} @@ -94,15 +99,18 @@ class StarterNameActivity : AppCompatActivity() { when (requestCode) { CHECK_TTS -> { if (resultCode != TextToSpeech.Engine.CHECK_VOICE_DATA_PASS) { - Toast.makeText(applicationContext, R.string.TTS_unavailable, Toast.LENGTH_LONG).show() + Snackbar.make( + findViewById(R.id.coordinatorLayout), + R.string.TTS_unavailable, + Snackbar.LENGTH_SHORT + ).show() enableTtsSwitch?.isChecked = false Intent().run { action = TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA startActivity(this) } } - } - else -> { + } else -> { } } } @@ -111,28 +119,93 @@ class StarterNameActivity : AppCompatActivity() { enableSttSwitch?.let { if (it.isChecked) { if (!SpeechRecognizer.isRecognitionAvailable(this)) { - Toast.makeText(applicationContext, R.string.STT_unavailable, Toast.LENGTH_LONG).show() - it.isChecked = false + Snackbar.make( + findViewById(R.id.coordinatorLayout), + R.string.STT_unavailable, + Snackbar.LENGTH_SHORT + ).show() + enableSttSwitch?.isChecked = false + } else { + // Ask for record audio permission + if (ContextCompat.checkSelfPermission(this, Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED) { + // Permission is not granted + // Should we show an explanation? + if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.RECORD_AUDIO)) { + AlertDialog.Builder(this) + .setTitle(R.string.STT) + .setMessage(R.string.explain_record_audio_request) + .setPositiveButton(R.string.OK) { dialog, id -> + ActivityCompat.requestPermissions(this, arrayOf(Manifest.permission.RECORD_AUDIO), ASK_PERMISSIONS_RECORD_AUDIO) + } + .setNegativeButton(R.string.cancel) { dialog, id -> + enableSttSwitch?.isChecked = false + } + .create() + .show() + } else { + // No explanation needed, we can request the permission. + ActivityCompat.requestPermissions(this, arrayOf(Manifest.permission.RECORD_AUDIO), ASK_PERMISSIONS_RECORD_AUDIO) + } + } } } } } + override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<String>, grantResults: IntArray) { + when (requestCode) { + ASK_PERMISSIONS_RECORD_AUDIO -> { + // If request is cancelled, the result arrays are empty. + if ((grantResults.isNotEmpty() && grantResults[0] != PackageManager.PERMISSION_GRANTED)) { + // permission denied + Snackbar.make( + findViewById(R.id.coordinatorLayout), + R.string.audio_record_permission_denied, + Snackbar.LENGTH_LONG + ).show() + enableSttSwitch?.isChecked = false + } + return + } else -> { + } + } + } + fun startMatch(view: View) { val player1Name = player1NameInput?.text.toString() val player2Name = player2NameInput?.text.toString() + val radioStarterId = starterRadioGroup?.checkedRadioButtonId + val enableTTS = enableTtsSwitch?.isChecked + val enableSTT = enableSttSwitch?.isChecked // Save - previousMatch?.edit()?.run{ - putString("previousPlayer1", player1Name) - putString("previousPlayer2", player2Name) - starterRadioGroup?.let{ putInt("previousStarterId", it.checkedRadioButtonId) } - previousPlayers?.let { putStringSet("previousPlayers", it.plus(player1Name).plus(player2Name)) } - enableTtsSwitch?.let { putBoolean("enableTTS", it.isChecked) } - enableSttSwitch?.let { putBoolean("enableSTT", it.isChecked) } + previousMatch?.edit()?.apply{ + player1Name.let { putString("previousPlayer1", it) } + player2Name.let { putString("previousPlayer2", it) } + radioStarterId?.let{ putInt("previousStarterId", it) } + putStringSet("previousPlayers", previousPlayers.plus(player1Name).plus(player2Name)) + enableTTS?.let { putBoolean("enableTTS", it) } + enableSTT?.let { putBoolean("enableSTT", it) } commit() } + startActivity( + Intent(this, MatchActivity::class.java).apply { + putExtra("player1Name", player1Name) + putExtra("player2Name", player2Name) + putExtra( + "starterId", + when(radioStarterId) { + R.id.radioPlayer1Starts -> 0 + R.id.radioPlayer2Starts -> 1 + else -> 0 + } + ) + putExtra("enableTTS", enableTTS) + putExtra("enableSTT", enableSTT) + } + ) + finish() } } diff --git a/app/src/main/res/drawable/ic_left_service.xml b/app/src/main/res/drawable/ic_service_1.xml similarity index 100% rename from app/src/main/res/drawable/ic_left_service.xml rename to app/src/main/res/drawable/ic_service_1.xml diff --git a/app/src/main/res/drawable/ic_right_service.xml b/app/src/main/res/drawable/ic_service_2.xml similarity index 100% rename from app/src/main/res/drawable/ic_right_service.xml rename to app/src/main/res/drawable/ic_service_2.xml diff --git a/app/src/main/res/layout-land/activity_match.xml b/app/src/main/res/layout-land/activity_match.xml new file mode 100644 index 0000000..1b2e76a --- /dev/null +++ b/app/src/main/res/layout-land/activity_match.xml @@ -0,0 +1,143 @@ +<?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" + tools:context=".MatchActivity" + tools:layout_editor_absoluteY="73dp"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical"> + + <android.support.v7.widget.Toolbar + android:id="@+id/toolbar" + android:layout_width="match_parent" + android:layout_height="?attr/actionBarSize" + android:layout_marginBottom="8dp" + android:background="@color/colorPrimary" + android:elevation="4dp" + android:theme="@style/ThemeOverlay.AppCompat.ActionBar" + app:popupTheme="@style/ThemeOverlay.AppCompat.Light" /> + + <LinearLayout + android:id="@+id/linearLayoutText" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginEnd="8dp" + android:layout_marginLeft="8dp" + android:layout_marginRight="8dp" + android:layout_marginStart="8dp" + android:orientation="horizontal" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + tools:layout_editor_absoluteY="8dp"> + + <TextView + android:id="@+id/textService" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginEnd="8dp" + android:layout_marginStart="8dp" + android:layout_weight="1" + android:gravity="left" + 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" + tools:text="@string/service" android:layout_marginRight="8dp" + android:layout_marginLeft="8dp"/> + + <TextView + android:id="@+id/textScore" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginLeft="8dp" + android:layout_marginStart="8dp" + android:layout_weight="1" + android:gravity="right|center" + android:textAppearance="@style/TextAppearance.AppCompat.Large" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + tools:text="@string/score" android:layout_marginRight="8dp"/> + + </LinearLayout> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="horizontal"> + + <ImageView + android:id="@+id/imgService1" + 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/buttonPlayer1" + style="@style/Widget.AppCompat.Button.Colored" + 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:background="@color/colorAccent" + 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/imgService1" + app:layout_constraintTop_toTopOf="parent" + tools:text="@string/button_text" android:layout_marginRight="8dp"/> + + <Button + android:id="@+id/buttonPlayer2" + style="@style/Widget.AppCompat.Button.Colored" + 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:background="@color/colorAccent" + 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/imgService2" + app:layout_constraintStart_toEndOf="@+id/buttonPlayer1" + tools:text="@string/button_text"/> + + <ImageView + android:id="@+id/imgService2" + 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.support.constraint.ConstraintLayout> \ No newline at end of file diff --git a/app/src/main/res/layout-land/activity_starter_name.xml b/app/src/main/res/layout-land/activity_starter_name.xml index 83b6e76..b003586 100644 --- a/app/src/main/res/layout-land/activity_starter_name.xml +++ b/app/src/main/res/layout-land/activity_starter_name.xml @@ -1,103 +1,123 @@ <?xml version="1.0" encoding="utf-8"?> -<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"> - <TextView - android:layout_width="0dp" - android:layout_height="wrap_content" - android:id="@+id/WhoStarts" android:text="@string/who_starts" - android:layout_marginTop="8dp" app:layout_constraintTop_toTopOf="parent" - app:layout_constraintStart_toStartOf="parent" android:layout_marginLeft="8dp" - android:layout_marginStart="8dp" android:textAppearance="@style/TextAppearance.AppCompat.Headline" - /> - <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.support.design.widget.CoordinatorLayout + android:id="@+id/myCoordinatorLayout" + 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"> + + <android.support.v7.widget.Toolbar + android:id="@+id/toolbar" 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"/> - <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"/> - <AutoCompleteTextView - android:text="@string/player_2_default_name" + android:layout_height="?attr/actionBarSize" + android:layout_marginBottom="8dp" + android:background="@color/colorPrimary" + android:elevation="4dp" + android:theme="@style/ThemeOverlay.AppCompat.ActionBar" + app:popupTheme="@style/ThemeOverlay.AppCompat.Light" /> + + <TextView + android:layout_width="0dp" + android:layout_height="wrap_content" + android:id="@+id/WhoStarts" android:text="@string/who_starts" + android:layout_marginTop="8dp" + app:layout_constraintStart_toStartOf="parent" android:layout_marginLeft="8dp" + android:layout_marginStart="8dp" android:textAppearance="@style/TextAppearance.AppCompat.Headline" + app:layout_constraintTop_toBottomOf="@+id/toolbar"/> + <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"/> + <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"/> + <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"/> + </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"/> + <TextView + android:id="@+id/pingPointsCredit" 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"/> - </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"/> - <TextView - android:id="@+id/pingPointsCredit" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:text="@string/PingPointsCredits" - app:layout_constraintTop_toBottomOf="@+id/enableSttSwitch" 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_marginTop="24dp"/> - <TextView - android:id="@+id/iconsCredit" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:text="@string/iconCredits" - app:layout_constraintTop_toBottomOf="@+id/pingPointsCredit" - 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"/> - <Button - android:text="@string/start" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:id="@+id/button2" - 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:drawableStart="@drawable/ic_new_match" - android:drawableLeft="@drawable/ic_new_match" - android:onClick="startMatch"/> -</android.support.constraint.ConstraintLayout> \ No newline at end of file + android:layout_height="wrap_content" + android:text="@string/PingPointsCredits" + app:layout_constraintTop_toBottomOf="@+id/enableSttSwitch" 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_marginTop="24dp"/> + <TextView + android:id="@+id/iconsCredit" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="@string/iconCredits" + app:layout_constraintTop_toBottomOf="@+id/pingPointsCredit" + 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"/> + <Button + android:text="@string/start" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:id="@+id/button2" + 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:drawableStart="@drawable/ic_new_match" + android:drawableLeft="@drawable/ic_new_match" + android:onClick="startMatch"/> + </android.support.constraint.ConstraintLayout> + +</android.support.design.widget.CoordinatorLayout> \ No newline at end of file diff --git a/app/src/main/res/layout/activity_match.xml b/app/src/main/res/layout/activity_match.xml new file mode 100644 index 0000000..7a61717 --- /dev/null +++ b/app/src/main/res/layout/activity_match.xml @@ -0,0 +1,136 @@ +<?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" + tools:context=".MatchActivity" + tools:layout_editor_absoluteY="73dp"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical"> + + <android.support.v7.widget.Toolbar + android:id="@+id/toolbar" + android:layout_width="match_parent" + android:layout_height="?attr/actionBarSize" + android:layout_marginBottom="8dp" + android:background="@color/colorPrimary" + android:elevation="4dp" + android:theme="@style/ThemeOverlay.AppCompat.ActionBar" + app:popupTheme="@style/ThemeOverlay.AppCompat.Light" /> + + <LinearLayout + android:id="@+id/linearLayoutText" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginEnd="8dp" + android:layout_marginLeft="8dp" + android:layout_marginRight="8dp" + android:layout_marginStart="8dp" + android:orientation="horizontal" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + tools:layout_editor_absoluteY="8dp"> + + <TextView + android:id="@+id/textService" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginEnd="8dp" + android:layout_marginStart="8dp" + android:layout_weight="1" + android:gravity="left" + 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" + tools:text="@string/service" /> + + <TextView + android:id="@+id/textScore" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginLeft="8dp" + android:layout_marginStart="8dp" + android:layout_weight="1" + android:gravity="right|center" + android:textAppearance="@style/TextAppearance.AppCompat.Large" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + tools:text="@string/score" android:layout_marginRight="8dp"/> + + </LinearLayout> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical"> + + <ImageView + android:id="@+id/imgService1" + android:layout_width="match_parent" + android:layout_height="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"/> + + <Button + android:id="@+id/buttonPlayer1" + style="@style/Widget.AppCompat.Button.Colored" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_marginStart="8dp" + android:layout_weight="1" + android:background="@color/colorAccent" + 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/imgService1" + app:layout_constraintTop_toTopOf="parent" + tools:text="@string/button_text" android:layout_margin="8dp"/> + + <Button + android:id="@+id/buttonPlayer2" + style="@style/Widget.AppCompat.Button.Colored" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_marginEnd="8dp" + android:layout_marginStart="8dp" + android:layout_weight="1" + android:background="@color/colorAccent" + 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/imgService2" + app:layout_constraintStart_toEndOf="@+id/buttonPlayer1" + tools:text="@string/button_text" android:layout_margin="8dp"/> + + <ImageView + android:id="@+id/imgService2" + android:layout_width="match_parent" + android:layout_height="48dp" + android:layout_margin="8dp" + android:layout_weight="0" + android:contentDescription="@string/service_img_description" + tools:layout_editor_absoluteY="120dp"/> + + </LinearLayout> + + </LinearLayout> + +</android.support.constraint.ConstraintLayout> \ No newline at end of file diff --git a/app/src/main/res/layout/activity_starter_name.xml b/app/src/main/res/layout/activity_starter_name.xml index e5cc252..3316f83 100644 --- a/app/src/main/res/layout/activity_starter_name.xml +++ b/app/src/main/res/layout/activity_starter_name.xml @@ -1,5 +1,13 @@ <?xml version="1.0" encoding="utf-8"?> -<android.support.constraint.ConstraintLayout + +<android.support.design.widget.CoordinatorLayout + 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" @@ -7,112 +15,125 @@ 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" - android:layout_marginTop="8dp" app:layout_constraintTop_toTopOf="parent" - app:layout_constraintStart_toStartOf="parent" android:layout_marginLeft="8dp" - android:layout_marginStart="8dp" android:textAppearance="@style/TextAppearance.AppCompat.Headline" - /> - <LinearLayout - android:orientation="horizontal" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginTop="8dp" - app:layout_constraintTop_toBottomOf="@+id/WhoStarts" - 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 - 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"/> - </RadioGroup> - <LinearLayout - android:orientation="vertical" + <android.support.v7.widget.Toolbar + android:id="@+id/toolbar" android:layout_width="match_parent" - android:layout_height="wrap_content"> - <AutoCompleteTextView - android:text="@string/player_1_default_name" + android:layout_height="?attr/actionBarSize" + android:layout_marginBottom="8dp" + android:background="@color/colorPrimary" + android:elevation="4dp" + android:theme="@style/ThemeOverlay.AppCompat.ActionBar" + app:popupTheme="@style/ThemeOverlay.AppCompat.Light" /> + + <TextView + android:layout_width="0dp" + android:layout_height="wrap_content" + android:id="@+id/WhoStarts" android:text="@string/who_starts" + android:layout_marginTop="8dp" + app:layout_constraintStart_toStartOf="parent" android:layout_marginLeft="8dp" + android:layout_marginStart="8dp" android:textAppearance="@style/TextAppearance.AppCompat.Headline" + app:layout_constraintTop_toBottomOf="@+id/toolbar"/> + <LinearLayout + android:orientation="horizontal" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="8dp" + app:layout_constraintTop_toBottomOf="@+id/WhoStarts" + 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 + 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"/> + </RadioGroup> + <LinearLayout + android:orientation="vertical" 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"/> - <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: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"/> + <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"/> + </LinearLayout> </LinearLayout> - </LinearLayout> - <Switch - android:text="@string/TTS" - 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_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"/> - <TextView - android:id="@+id/PingPointsCredit" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:text="@string/PingPointsCredits" - app:layout_constraintTop_toBottomOf="@+id/enableSttSwitch" 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_marginTop="24dp"/> - <TextView - android:id="@+id/iconsCredit" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:text="@string/iconCredits" - app:layout_constraintTop_toBottomOf="@+id/PingPointsCredit" - 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"/> - <Button - android:text="@string/start" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:id="@+id/button" - 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:drawableStart="@drawable/ic_new_match" - android:drawableLeft="@drawable/ic_new_match" android:onClick="startMatch"/> -</android.support.constraint.ConstraintLayout> \ No newline at end of file + <Switch + android:text="@string/TTS" + 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_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"/> + <TextView + android:id="@+id/PingPointsCredit" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="@string/PingPointsCredits" + app:layout_constraintTop_toBottomOf="@+id/enableSttSwitch" 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_marginTop="24dp"/> + <TextView + android:id="@+id/iconsCredit" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="@string/iconCredits" + app:layout_constraintTop_toBottomOf="@+id/PingPointsCredit" + 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"/> + <Button + android:text="@string/start" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:id="@+id/button" + 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:drawableStart="@drawable/ic_new_match" + android:drawableLeft="@drawable/ic_new_match" android:onClick="startMatch"/> + + </android.support.constraint.ConstraintLayout> + +</android.support.design.widget.CoordinatorLayout> \ No newline at end of file diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 82ddfc8..74cea8a 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -12,4 +12,17 @@ <string name="iconCredits"><html>Icônes par <a href="http://www.freepik.com" title="Freepik">Freepik</a> chez <a href="https://www.flaticon.com/" title="Flaticon">flaticon.com</a> Licence <a href="http://creativecommons.org/licenses/by/3.0/" title="Creative Commons BY 3.0" target="_blank">CC 3.0 BY</a></html></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="explain_record_audio_request">"Cette appli utilise l'API de Google pour la reconnaissance vocale : votre voix sera enregistrée et envoyée aux serveurs de Google pour analyse. +Cela requiert une connexion internet et la permission d'enregistrer des fichiers audio. +Vous pouvez à tout moment changer la permission dans les paramètres Android." + </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> + <string name="service">Service : %s</string> + <string name="score">Score : %d - %d</string> + <string name="service_img_description">Service</string> + <string name="title_activity_match">Ping Points</string> </resources> \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index da003e7..2a4e3a1 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -2,5 +2,5 @@ <resources> <color name="colorPrimary">#016df5</color> <color name="colorPrimaryDark">#004aa7</color> - <color name="colorAccent">#0088FF</color> + <color name="colorAccent">#0088ff</color> </resources> \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 19ad99c..d92b856 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -8,7 +8,25 @@ <string name="start">Let\'s go!</string> <string name="swap_names">Swap names</string> <string name="PingPointsCredits">Ping Points by Adrien Malin</string> - <string name="iconCredits">"<html>Icons made by <a href="http://www.freepik.com" title="Freepik">Freepik</a> from <a href="https://www.flaticon.com/" title="Flaticon">flaticon.com</a> is licensed by <a href="http://creativecommons.org/licenses/by/3.0/" title="Creative Commons BY 3.0" target="_blank">CC 3.0 BY</a></html>"</string> + <string name="iconCredits">"<html>Icons made by <a href="http://www.freepik.com" title="Freepik">Freepik</a> + from <a href="https://www.flaticon.com/" title="Flaticon">flaticon.com</a> is + licensed by <a href="http://creativecommons.org/licenses/by/3.0/" title="Creative Commons BY + 3.0" target="_blank">CC 3.0 BY</a></html>" + </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="explain_record_audio_request">"This app uses Google API for voice recognition: your voice will be + recorded and analyzed by Google's servers. + It requires an internet connection and permission for audio recording. + You can always change permission in Android settings." + </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="title_activity_match">Ping Points</string> + <string name="service">Service: %s</string> + <string name="score">Score: %d - %d</string> + <string name="service_img_description">Service</string> + <string name="button_text" translatable="false">%s <br /> <br /> <big> <big> %d </big> </big> + </string> </resources>