This commit is contained in:
adrienmalin 2018-12-03 23:41:52 +01:00
parent 621c035c74
commit 9f4b35070d
16 changed files with 338 additions and 264 deletions

Binary file not shown.

2
.idea/misc.xml generated
View File

@ -29,7 +29,7 @@
</value>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">

View File

@ -25,7 +25,7 @@ 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: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'

View File

@ -18,7 +18,6 @@
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>

View File

@ -2,12 +2,10 @@ package adrienmalin.pingpoints
import android.os.Build
import android.text.Html
import android.text.Spanned
fun Html.fromHtml2(source: String) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
Html.fromHtml(source, Html.FROM_HTML_MODE_COMPACT)
} else {
Html.fromHtml(source)
}
fun fromHtml(source: String): Spanned = when {
Build.VERSION.SDK_INT >= Build.VERSION_CODES.N -> Html.fromHtml(source, Html.FROM_HTML_MODE_COMPACT)
else -> Html.fromHtml(source)
}

View File

@ -5,6 +5,11 @@ import android.support.v7.app.AppCompatActivity
import android.support.v7.app.AppCompatDelegate
import android.view.View
import android.arch.lifecycle.ViewModelProviders
import android.speech.tts.TextToSpeech
import android.support.design.widget.Snackbar
import android.widget.*
const val REQ_CODE_SPEECH_INPUT = 1
class MatchActivity : AppCompatActivity() {
@ -14,13 +19,13 @@ class MatchActivity : AppCompatActivity() {
var buttons: Array<Button> = emptyArray()
var imageViews: Array<ImageView?> = emptyArray()
var matchModel: MatchModel? = null
var tts: TextToSpeech? = null
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)
textScore = findViewById(R.id.textScore)
textService = findViewById(R.id.textService)
buttons = arrayOf(
@ -31,11 +36,69 @@ class MatchActivity : AppCompatActivity() {
findViewById(R.id.imgService0),
findViewById(R.id.imgService1)
)
val matchModel = ViewModelProviders.of(this).get(MatchModel::class.java)
if (!matchModel.matchStarted) {
matchModel.startMatch(
intent.getStringExtra("player1Name"),
intent.getStringExtra("player2Name"),
intent.getIntExtra("starterId", 0),
intent.getBooleanExtra("enableTTS", false),
intent.getBooleanExtra("enableSTT", false)
)
if (matchModel.ttsEnabled) {
tts = TextToSpeech(
this,
TextToSpeech.OnInitListener {
fun onInit(status: Int) {}
}
)
}
Snackbar.make(
findViewById(R.id.coordinatorLayout),
R.string.button_hint,
Snackbar.LENGTH_SHORT
).show()
}
updateUI()
}
fun updateUI() {
matchModel?.apply {
textScore?.text = getString(
R.string.score,
players[serviceSide].score,
players[relaunchSide].score
)
textService?.text = getString(R.string.service, players[serviceSide].name)
for ((button, player) in buttons.zip(players)) {
button.text = fromHtml(getString(R.string.button_text, player.name, player.score))
}
when (serviceSide) {
0 -> {
imageViews[0]?.setImageResource(R.drawable.ic_service_0)
imageViews[1]?.setImageResource(0)
}
else -> {
imageViews[0]?.setImageResource(0)
imageViews[1]?.setImageResource(R.drawable.ic_service_1)
}
}
if (ttsEnabled) {
tts?.speak(
getString(
R.string.update_score_speech,
players[serviceSide].score,
players[relaunchSide].score,
players[serviceSide].name
),
TextToSpeech.QUEUE_FLUSH,
hashMapOf(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID to "MessageId")
)
}
}
}
fun updateScore(view: View) {

View File

@ -6,14 +6,21 @@ import android.arch.lifecycle.ViewModel
class MatchModel : ViewModel() {
var matchStarted: Boolean = false
var players: List<Player> = emptyList()
var serverId: Int = 0
var serviceSide: Int = 0
var relaunchSide: Int = 1
var ttsEnabled: Boolean = false
var sttEnabled: Boolean = false
fun startMatch(player1Name: String, player2Name:String, starterId: Int, enableTTS: Boolean, enableSTT: Boolean) {
matchStarted = true
players = listOf(Player(player1Name), Player(player2Name))
serverId = starterId
serviceSide = starterId
relaunchSide = when(starterId) {
0 -> 1
else -> 0
}
ttsEnabled = enableTTS
sttEnabled = enableSTT
}

View File

@ -14,7 +14,6 @@ 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.Html
import android.text.method.LinkMovementMethod
import android.view.View
import android.widget.*
@ -40,7 +39,7 @@ class StarterNameActivity : AppCompatActivity() {
setSupportActionBar(findViewById(R.id.toolbar))
// Set HTML text for icons credits
findViewById<TextView>(R.id.iconsCredit).run {
setText(Html.fromHtml2(getString(R.string.iconCredits)))
setText(fromHtml(getString(R.string.iconCredits)))
movementMethod = LinkMovementMethod.getInstance()
}
// Find views

View File

@ -1,13 +0,0 @@
package adrienmalin.pingpoints
import android.os.Build
import android.text.Html
import android.widget.TextView
fun TextView.setHtmlText(htmlText: String) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
this.setText(Html.fromHtml(htmlText, Html.FROM_HTML_MODE_COMPACT));
} else {
this.setText(Html.fromHtml(htmlText));
}
}

View File

@ -0,0 +1,7 @@
<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

@ -3,5 +3,5 @@
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"/>
<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,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,143 +1,152 @@
<?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"
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">
android:layout_height="match_parent">
<LinearLayout
<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"
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>
tools:context=".MatchActivity"
tools:layout_editor_absoluteY="73dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
android:orientation="vertical">
<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"
style="@style/Widget.AppCompat.Button.Colored"
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="?attr/actionBarSize"
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/imgService0"
app:layout_constraintTop_toTopOf="parent"
tools:text="@string/button_text" android:layout_marginRight="8dp"/>
android:background="@color/colorPrimary"
android:elevation="4dp"
android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
<Button
android:id="@+id/buttonPlayer1"
style="@style/Widget.AppCompat.Button.Colored"
<LinearLayout
android:id="@+id/linearLayoutText"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="8dp"
android:layout_height="wrap_content"
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/imgService1"
app:layout_constraintStart_toEndOf="@+id/buttonPlayer0"
tools:text="@string/button_text"/>
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:layout_editor_absoluteY="8dp">
<ImageView
android:id="@+id/imgService1"
android:layout_width="48dp"
<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="left"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="@string/score" android:layout_marginRight="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="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"
tools:text="@string/service" android:layout_marginRight="8dp"
android:layout_marginLeft="8dp"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="8dp"
android:layout_weight="0"
android:contentDescription="@string/service_img_description"
tools:layout_editor_absoluteY="120dp"/>
android:orientation="horizontal">
<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"
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/imgService0"
app:layout_constraintTop_toTopOf="parent"
tools:text="@string/button_text" android:layout_marginRight="8dp"/>
<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_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/imgService1"
app:layout_constraintStart_toEndOf="@+id/buttonPlayer0"
tools:text="@string/button_text"/>
<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>
</LinearLayout>
</android.support.constraint.ConstraintLayout>
</android.support.constraint.ConstraintLayout>
</android.support.design.widget.CoordinatorLayout>

View File

@ -1,136 +1,144 @@
<?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"
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">
android:layout_height="match_parent">
<LinearLayout
<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"
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>
tools:context=".MatchActivity"
tools:layout_editor_absoluteY="73dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:id="@+id/imgService0"
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
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"/>
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" />
<Button
android:id="@+id/buttonPlayer0"
style="@style/Widget.AppCompat.Button.Colored"
<LinearLayout
android:id="@+id/linearLayoutText"
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/imgService0"
app:layout_constraintTop_toTopOf="parent"
tools:text="@string/button_text" android:layout_margin="8dp"/>
<Button
android:id="@+id/buttonPlayer1"
style="@style/Widget.AppCompat.Button.Colored"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="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/imgService1"
app:layout_constraintStart_toEndOf="@+id/buttonPlayer0"
tools:text="@string/button_text" android:layout_margin="8dp"/>
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:layout_editor_absoluteY="8dp">
<ImageView
android:id="@+id/imgService1"
<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="left"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="@string/score" android:layout_marginRight="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: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:gravity="right"/>
</LinearLayout>
<LinearLayout
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"/>
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:id="@+id/imgService0"
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/buttonPlayer0"
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/imgService0"
app:layout_constraintTop_toTopOf="parent"
tools:text="@string/button_text" android:layout_margin="8dp"/>
<Button
android:id="@+id/buttonPlayer1"
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/imgService1"
app:layout_constraintStart_toEndOf="@+id/buttonPlayer0"
tools:text="@string/button_text" android:layout_margin="8dp"/>
<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"
tools:layout_editor_absoluteY="120dp"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</android.support.constraint.ConstraintLayout>
</android.support.constraint.ConstraintLayout>
</android.support.design.widget.CoordinatorLayout>

View File

@ -25,4 +25,6 @@ Vous pouvez à tout moment changer la permission dans les paramètres Android."
<string name="score">Score : %d - %d</string>
<string name="service_img_description">Service</string>
<string name="title_activity_match">Ping Points</string>
<string name="update_score_speech">%d - %d. Service : %s</string>
<string name="button_hint">Cliquez sur le joueur qui a marqué</string>
</resources>

View File

@ -29,4 +29,6 @@
<string name="service_img_description">Service</string>
<string name="button_text" translatable="false">%s &lt;br /&gt; &lt;br /&gt; &lt;big&gt; &lt;big&gt; %d &lt;/big&gt; &lt;/big&gt;
</string>
<string name="update_score_speech">%d - %d. Service: %s</string>
<string name="button_hint">Click on the scoring player</string>
</resources>