Skip to content

Commit

Permalink
Fix in Speak.java
Browse files Browse the repository at this point in the history
  • Loading branch information
hoeveid committed Aug 6, 2024
1 parent 3c6ebbe commit 5f9849d
Show file tree
Hide file tree
Showing 11 changed files with 71 additions and 32 deletions.
8 changes: 4 additions & 4 deletions docs/match/2.4.match.format.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ Here you can specify
* Note: you can toggle between 'Best of' and 'Total of' sets to play <!-- TennisPadel only -->
* number of games per set <!-- TennisPadel only -->
* How you want the final set to finish: may deviate from the initial sets. <!-- TennisPadel only -->
* E.g. a longer tiebreak, or <!-- TennisPadel only -->
* no games and a deciding tiebreak immediatly <!-- TennisPadel only -->
* E.g. a longer tiebreak to 10 instead of 7, or <!-- TennisPadel only -->
* no games in the final set : start deciding match tiebreak immediately <!-- TennisPadel only -->
* number of games to be played <!-- not for TennisPadel -->
* Note: you can toggle between 'Best of' and 'Total of' games to play <!-- not for TennisPadel -->
* Note: you can toggle between 'Best of' and 'Total of' games to play <!-- not for TennisPadel -->
* how many points per game <!-- not for TennisPadel -->
* what format of Tie-break you want to use
* If you want the tiebreak to start one-game early (e.g. at 5-5 if sets are played to 6 games) <!-- TennisPadel only -->
Expand All @@ -46,7 +46,7 @@ Here you can specify
* Name of the assessor <!-- Squore only -->
* Announcement language (currently supported are English, French, German, Spanish, Portuguese, Dutch, Czech)

In case of a 'Doubles' match you also have the option to specify the 'Sequence of Serve' used for the doubles match.
In case of a 'Doubles' match you also have the option to specify the 'Sequence of Serve' used for the doubles match. <!-- Squore only -->

Note that if you do not want to specify an event, and the fields are e.g. already pre-filled for you, you can clear them by 'long clicking' on the label `Event`.
(And similarly you can clear the player fields by 'long clicking' the label `Players`, and clear the referee fields by 'long clicking' the label `Referee`.)
Expand Down
6 changes: 3 additions & 3 deletions docs/social/4.7.club.website.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ If you want to protect you url where results can be posted to, there is the opti
To do so add a line with `Authentication=Basic` to your URLs configuration. So for example it will look like this now:

Name=Demo URL
FeedMatches=http://squore.double-yellow.be/demo/demo.matches.json
FeedPlayers=http://squore.double-yellow.be/demo/demo.players.txt
PostResult=http://squore.double-yellow.be/demo/demo.post.matchresult.basic.authentication.php
FeedMatches=https://squore.double-yellow.be/demo/demo.matches.json
FeedPlayers=https://squore.double-yellow.be/demo/demo.players.txt
PostResult=https://squore.double-yellow.be/demo/demo.post.matchresult.basic.auth.php
Authentication=Basic

If this line exists in your 'Active' URL section, the Squore app will ask a Username and Password combination before posting the result to the URL.
Expand Down
1 change: 1 addition & 0 deletions res/values-de/OfficialAnnouncements.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<string name="sb_receive">Rückschläger</string>
<string name="oa_love_all">Null Beide</string>

<string name="oa_game_NamePlayerX__TennisPadel">Spiel %s</string>
<string name="oa_game_to_x">Satz an %s</string>
<string name="oa_match_to_x">Spiel an %s</string>
<string name="oa_1_game_all">Ein Satz beide</string>
Expand Down
1 change: 1 addition & 0 deletions res/values-fr/OfficialAnnouncements.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<string name="oa_x_to_serve__y_to_receive">%1$s au service, %2$s à la réception</string>
<string name="oa_love_all">0–0</string>

<string name="oa_game_NamePlayerX__TennisPadel">Jeu %s</string>
<string name="oa_game_to_x">Jeu %s</string>
<string name="oa_match_to_x">Match %s</string>
<string name="oa_1_game_all">Un jeu partout</string>
Expand Down
1 change: 1 addition & 0 deletions res/values-it/OfficialAnnouncements.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<string name="sb_receive">Risposta</string>
<string name="oa_love_all">Zero a zero</string>

<string name="oa_game_NamePlayerX__TennisPadel">Gioco %s</string>
<string name="oa_game_to_x">Gioco a %s</string>
<string name="oa_match_to_x">Incontro a %s</string>
<string name="oa_1_game_all">Un gioco pari</string>
Expand Down
8 changes: 4 additions & 4 deletions res/values-nl/tennispadel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
<string name="pref_StartTieBreakOneGameEarly">Start Tiebreak een game vroeger</string>
<string name="pref_StartTieBreakOneGameEarly_CheckUncheckMsg">Tiebreak zal gespeeld worden bij %1$d-%1$d</string>
<string-array name="finalSetFinishDisplayValues"> <!-- keep in sync with com.doubleyellow.scoreboard.model.FinalSetFinish -->
<item>TieBreak Tot 7</item>
<item>TieBreak Tot 10</item>
<item>Geen games - Gelijk TieBreak Tot 7</item>
<item>Geen games - Gelijk TieBreak Tot 10</item>
<item>Normaal aantal games - TieBreak Tot 7</item>
<item>Normaal aantal games - TieBreak Tot 10</item>
<item>Geen games - Match TieBreak Tot 7</item>
<item>Geen games - Match TieBreak Tot 10</item>
<item>Games Tot 12 - Dan TieBreak Tot 7</item>
<item>Games Tot 12 - Dan TieBreak Tot 10</item>
<item>Geen Tie-Break</item>
Expand Down
1 change: 1 addition & 0 deletions res/values/OfficialAnnouncements.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<string name="sb_receive">Receive</string>
<string name="oa_love_all">Love-all</string>

<string name="oa_game_NamePlayerX__TennisPadel">Game %s</string> <!-- spoken text -->
<string name="oa_game_to_x">Game to %s</string>
<string name="oa_match_to_x">Match to %s</string>
<string name="oa_1_game_all">One game all</string>
Expand Down
12 changes: 6 additions & 6 deletions res/values/tennispadel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
<string name="pref_StartTieBreakOneGameEarly">Start Tiebreak One Game Early</string>
<string name="pref_StartTieBreakOneGameEarly_CheckUncheckMsg">Tie break will start at %1$d-%1$d</string>
<string-array name="finalSetFinishDisplayValues"> <!-- keep in sync with com.doubleyellow.scoreboard.model.FinalSetFinish -->
<item>TieBreak To 7</item>
<item>TieBreak To 10</item>
<item>No Games - TieBreak To 7</item>
<item>No Games - TieBreak To 10</item>
<item>Games To 12 - Then TieBreak To 7</item>
<item>Games To 12 - Then TieBreak To 10</item>
<item>Games as normal - TieBreak To 7</item>
<item>Games as normal - TieBreak To 10</item>
<item>No Games - Match TieBreak To 7</item>
<item>No Games - Match TieBreak To 10</item>
<item>Games To 12 - If equal, TieBreak To 7</item>
<item>Games To 12 - If equal, TieBreak To 10</item>
<item>No Tie-Break</item>
</string-array>

Expand Down
11 changes: 10 additions & 1 deletion src/com/doubleyellow/scoreboard/model/Model.java
Original file line number Diff line number Diff line change
Expand Up @@ -1215,7 +1215,16 @@ public Player getLastScorer() {
}

public ScoreLine getLastScoreLine() {
return ListUtil.getLast(getGameScoreHistory());
List<ScoreLine> gameScoreHistory = getGameScoreHistory();
if ( ListUtil.isEmpty(gameScoreHistory) ) {
// introduced for GSM Speak
int iTail = ListUtil.size(m_lGamesScorelineHistory);
while(iTail > 0 && ListUtil.isEmpty(gameScoreHistory) ) {
iTail--;
gameScoreHistory = m_lGamesScorelineHistory.get(iTail);
}
}
return ListUtil.getLast(gameScoreHistory);
}

public ScoreLine getLastCall() {
Expand Down
21 changes: 7 additions & 14 deletions src/com/doubleyellow/scoreboard/speech/Speak.java
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,13 @@ private void score(Model model)
if ( gsmModel != null ) {
List<Map<Player, Integer>> gamesWonPerSet = gsmModel.getGamesWonPerSet();
gamesWonLastSet = ListUtil.getLast(gamesWonPerSet);

Player pGameWonBy = gsmModel.getLastScorer();
if ( pGameWonBy != null ) {
String sName = gsmModel.getName(pGameWonBy);
String sGameX = getResourceString(R.string.oa_game_NamePlayerX__TennisPadel, sName);
setTextToSpeak(SpeechType.GameWon, sGameX);
}
} else {
gamesWonLastSet = model.getGamesWon();
}
Expand Down Expand Up @@ -528,7 +535,6 @@ private void gameBall(Model model)

if ( model instanceof GSMModel ) {
GSMModel gsmModel = (GSMModel) model;
// TODO: set ball
Player[] possibleSetBallFor = gsmModel.isPossibleSetVictoryFor();
Boolean bIsSetBall = (possibleSetBallFor != null) && (possibleSetBallFor.length != 0);
if ( bIsSetBall ) {
Expand Down Expand Up @@ -613,19 +619,6 @@ private String x_GamesTo_y(int iGamesLeader, int iGamesTrailer, int iResIdGameOr
//------------------------------

/** text fragments will be announced in this sequence they are defined in this enumeration */
private enum SpeechType {
//Call,
//StartAnnouncement,
Handout,
GamesScore,
GSMSetScore,
ScoreServer,
ScoreReceiver,
Gameball,
//EndAnnouncement,
TimerRelated,
Other,
}
private String[] m_sText = new String[SpeechType.values().length];
private void setTextToSpeak(SpeechType type, Object oText) {
if ( oText == null ) { return; }
Expand Down
33 changes: 33 additions & 0 deletions src/com/doubleyellow/scoreboard/speech/SpeechType.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright (C) 2020 Iddo Hoeve
*
* Squore is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.doubleyellow.scoreboard.speech;

public enum SpeechType {
//Call,
//StartAnnouncement,
Handout,
GameWon,
/* GSM and others: oa_a_leads_xGamesToy, oa_a_wins_xGamesToy as well as oa_a_wins_set_b_xGamesToy__TennisPadel */
GamesScore,
GSMSetScore,
ScoreServer,
ScoreReceiver,
Gameball,
//EndAnnouncement,
TimerRelated,
Other,
}

0 comments on commit 5f9849d

Please sign in to comment.