Skip to content

Commit

Permalink
Minor improvements: release 0452 + additional FinalSetFinish for Tenn…
Browse files Browse the repository at this point in the history
…is/Padel
  • Loading branch information
obbimi committed Oct 18, 2020
1 parent f054193 commit 9f44bc5
Show file tree
Hide file tree
Showing 17 changed files with 129 additions and 53 deletions.
2 changes: 2 additions & 0 deletions AndroidManifestBadminton.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
package="com.doubleyellow.badminton"
android:versionName="${versionNameBadminton}"
android:versionCode="${versionCodePrefix}${versionCodeSuffixBadminton}">
<!-- PlayStoreID=4974076001360456618 -->

<!--
<uses-feature android:name="android.permission.SEND_SMS" android:required="false" />
<uses-feature android:name="android.permission.INTERNET" android:required="true" />
Expand Down
1 change: 1 addition & 0 deletions AndroidManifestRacketlon.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
package="com.doubleyellow.racketlon"
android:versionName="${versionNameRacketlon}"
android:versionCode="${versionCodePrefix}${versionCodeSuffixRacketlon}">
<!-- PlayStoreID=4973204554147732137 -->
<!--
<uses-feature android:name="android.permission.SEND_SMS" android:required="false" />
<uses-feature android:name="android.permission.INTERNET" android:required="true" />
Expand Down
2 changes: 2 additions & 0 deletions AndroidManifestSquore.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
package="com.doubleyellow.scoreboard"
android:versionName="${versionNameSquore}"
android:versionCode="${versionCodePrefix}${versionCodeSuffixSquore}">
<!-- PlayStoreID=4972255383319852172 -->
<!--
<uses-feature android:name="android.permission.SEND_SMS" android:required="false" />
<uses-feature android:name="android.permission.INTERNET" android:required="true" />
Expand Down Expand Up @@ -129,6 +130,7 @@
<intent-filter> <data android:scheme="https" android:host="squore.double-yellow.be" android:pathPattern="/.*20.*" /> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> </intent-filter>
<intent-filter> <data android:scheme="https" android:host="squore.double-yellow.be" android:pathPattern="/show/.*20.*" /> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> </intent-filter>
<intent-filter> <data android:scheme="https" android:host="squore.double-yellow.be" android:pathPattern="/uploads/.*.zip" /> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> </intent-filter>
<intent-filter> <data android:scheme="https" android:host="squore.double-yellow.be" android:pathPattern="/tournamentsoftware/*" /> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> </intent-filter>

<intent-filter> <data android:scheme="http" android:host="squash.nl" android:pathPattern="/sport/tournament.aspx"/> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> </intent-filter>
<intent-filter> <data android:scheme="https" android:host="squash.nl" android:pathPattern="/sport/tournament.aspx"/> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> </intent-filter>
Expand Down
1 change: 1 addition & 0 deletions AndroidManifestTabletennis.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
package="com.doubleyellow.tabletennis"
android:versionName="${versionNameTabletennis}"
android:versionCode="${versionCodePrefix}${versionCodeSuffixTabletennis}">
<!-- PlayStoreID=4975506867766261096 -->
<!--
<uses-feature android:name="android.permission.SEND_SMS" android:required="false" />
<uses-feature android:name="android.permission.INTERNET" android:required="true" />
Expand Down
1 change: 1 addition & 0 deletions AndroidManifestTennisPadel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
package="com.doubleyellow.tennispadel"
android:versionName="${versionNameTennisPadel}"
android:versionCode="${versionCodePrefix}${versionCodeSuffixTennisPadel}">
<!-- PlayStoreID=4972207514792479457 -->
<!--
<uses-feature android:name="android.permission.SEND_SMS" android:required="false" />
<uses-feature android:name="android.permission.INTERNET" android:required="true" />
Expand Down
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ android {

//testInstrumentationRunner = 'android.support.test.runner.AndroidJUnitRunner'
//applicationId "com.doubleyellow"
manifestPlaceholders = [versionNameTabletennis: "4.36", versionCodeSuffixTabletennis: "0451"
,versionNameBadminton : "4.36", versionCodeSuffixBadminton : "0451"
,versionNameTennisPadel: "4.36", versionCodeSuffixTennisPadel: "0451"
,versionNameSquore : "4.36", versionCodeSuffixSquore : "0451"
,versionNameRacketlon : "4.36", versionCodeSuffixRacketlon : "0451"
manifestPlaceholders = [versionNameTabletennis: "4.36", versionCodeSuffixTabletennis: "0452"
,versionNameBadminton : "4.36", versionCodeSuffixBadminton : "0452"
,versionNameTennisPadel: "4.37", versionCodeSuffixTennisPadel: "0452"
,versionNameSquore : "4.36", versionCodeSuffixSquore : "0452"
,versionNameRacketlon : "4.36", versionCodeSuffixRacketlon : "0452"
]
}
sourceSets {
Expand Down
Binary file modified libs/AndroidBase.aar
Binary file not shown.
2 changes: 1 addition & 1 deletion res/layout-land/match.xml
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@
android:orientation="vertical"/>
</LinearLayout>
<LinearLayout
android:layout_below="@+id/llTieBreakFormat"
android:layout_below="@+id/llFinalSetFinish"
android:id="@+id/llPauseDuration"
android:orientation="horizontal"
android:layout_alignParentStart="true"
Expand Down
6 changes: 6 additions & 0 deletions res/raw/changelog_tennispadel.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 4.37 (okt 2020)

- new options for the final set
- no games - tie break to 7 (or 10)
- games to 12 - followed by tie break to 7 (or 10)

## 4.36 (june 2020)

- The app has been translated into Spanish. Thank you very much Salvador Martinez!
Expand Down
8 changes: 4 additions & 4 deletions res/values-es/tennispadel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
<string-array name="finalSetFinishDisplayValues"> <!-- keep in sync with com.doubleyellow.scoreboard.model.FinalSetFinish -->
<item>TieBreak a 7</item>
<item>TieBreak a 10</item>
<!--
<item>Games To 12 - Then TieBreak To 7</item>
<item>Games To 12 - Then TieBreak To 10</item>
<item>TieBreak a 7 - No juegos</item>
<item>TieBreak a 10 - No juegos</item>
<item>Juegos a 12 - Seguido por TieBreak a 7</item>
<item>Juegos a 12 - Seguido por TieBreak a 10</item>
<item>No Tie-Break</item>
-->
</string-array>

</resources>
4 changes: 2 additions & 2 deletions res/values-nl/tennispadel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
<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>Games Tot 12 - Dan TieBreak Tot 7</item>
<item>Games Tot 12 - Dan TieBreak Tot 10</item>
<item>Geen Tie-Break</item>
-->
</string-array>

</resources>
4 changes: 2 additions & 2 deletions res/values/tennispadel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
<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>No Tie-Break</item>
-->
</string-array>

</resources>
1 change: 1 addition & 0 deletions src/com/doubleyellow/scoreboard/dialog/ServerToss.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public ServerToss(Context context, Model matchModel, ScoreBoard scoreBoard) {
}

@Override public void show() {
if ( matchModel == null ) { return; }
String sPlayerA = matchModel.getName(Player.A);
String sPlayerB = matchModel.getName(Player.B);
adb.setTitle (R.string.sb_who_will_start_to_serve);
Expand Down
56 changes: 34 additions & 22 deletions src/com/doubleyellow/scoreboard/main/ScoreBoard.java
Original file line number Diff line number Diff line change
Expand Up @@ -3373,7 +3373,7 @@ public boolean triggerEvent(SBEvent event, Object ctx) {
return true;
case tossDialogEnded:
showTossFloatButton(false);
if ( matchModel.hasStarted() == false ) {
if ( (matchModel != null) && matchModel.hasStarted() == false ) {
timestampStartOfGame(GameTiming.ChangedBy.DialogClosed);
}
showNextDialog();
Expand All @@ -3394,7 +3394,7 @@ public boolean triggerEvent(SBEvent event, Object ctx) {
// assume only the inline timer is shown: hide it so timer is better visible
showTossFloatButton(false);
}
if ( matchModel.gameHasStarted() == false ) {
if ( (matchModel != null) && matchModel.gameHasStarted() == false ) {
timestampStartOfGame(GameTiming.ChangedBy.TimerStarted);
}
return true;
Expand All @@ -3416,14 +3416,16 @@ public boolean triggerEvent(SBEvent event, Object ctx) {
timerType = (Type) ctx;
//viewType = (ViewType) ctx2;
if ( EnumSet.of(Type.UntillStartOfNextGame, Type.Warmup).contains(timerType) ) {
if ( matchModel.gameHasStarted() == false ) {
if ( (matchModel != null) && matchModel.gameHasStarted() == false ) {
timestampStartOfGame(GameTiming.ChangedBy.TimerEnded);
}
}
hidePresentationEndOfGame();
showAppropriateMenuItemInActionBar();
showTimerFloatButton(Type.Warmup.equals(timerType) && (matchModel.gameHasStarted() == false));
showTossFloatButton (Type.Warmup.equals(timerType) && (matchModel.hasStarted() == false));
if ( matchModel != null ) {
showTimerFloatButton(Type.Warmup.equals(timerType) && (matchModel.gameHasStarted() == false));
showTossFloatButton (Type.Warmup.equals(timerType) && (matchModel.hasStarted() == false));
}
updateMicrophoneFloatButton();
showNextDialog();

Expand Down Expand Up @@ -3459,7 +3461,7 @@ public boolean triggerEvent(SBEvent event, Object ctx) {
case restartScoreDialogEnded:
case endMatchDialogEnded: // fall through
case endGameDialogEnded: {
if ( matchModel.matchHasEnded() ) {
if ( (matchModel != null) && matchModel.matchHasEnded() ) {
// if the match has ended the OnlineSheetAvailableChoice dialog may be on the stack
showNextDialog();
} else {
Expand Down Expand Up @@ -3615,7 +3617,7 @@ private void doTimerFeedback(Type viewType, boolean bIsEnd) {
//setMenuItemVisibility(R.id.sb_swap_double_players , false);
}
if ( Brand.isTabletennis() ) {
boolean bIsInNormalMode = matchModel.isInNormalMode();
boolean bIsInNormalMode = (matchModel == null) || matchModel.isInNormalMode();
setMenuItemVisibility(R.id.tt_activate_mode , bIsInNormalMode == true );
setMenuItemVisibility(R.id.tt_deactivate_mode, bIsInNormalMode == false);
if ( PreferenceValues.isBrandTesting(this) ) {
Expand Down Expand Up @@ -3807,7 +3809,7 @@ public boolean handleMenuItem(int id, Object... ctx) {
case R.id.sb_change_sides:
case R.id.float_changesides:
swapSides(Toast.LENGTH_LONG, null);
if ( Brand.isBadminton() && matchModel.isDoubles() ) {
if ( Brand.isBadminton() && (matchModel != null) && matchModel.isDoubles() ) {
_swapDoublePlayers(Player.values(), false);
}
return true;
Expand Down Expand Up @@ -5821,9 +5823,11 @@ private void lockMatch(Object... ctx) {
if ( ListUtil.length(ctx) != 0 ) {
lockState = (LockState) ctx[0];
}
matchModel.setLockState(lockState);
if ( matchModel != null ) {
matchModel.setLockState(lockState);

writeMethodToBluetooth(BTMethods.lock);
writeMethodToBluetooth(BTMethods.lock);
}
}
private void unlockMatch() {
LockState current = matchModel.getLockState();
Expand Down Expand Up @@ -5865,6 +5869,7 @@ public boolean endGame() {
}
private boolean endGame(boolean bBTDelayed) {
if ( warnModelIsLocked() ) { return false; }
if ( matchModel == null ) { return false; }
matchModel.endGame();

if ( BTRole.Master.equals(m_blueToothRole) ) {
Expand Down Expand Up @@ -5892,6 +5897,7 @@ public void recordConduct(Player pMisbehaving, Call call, ConductType conductTyp
writeMethodToBluetooth(BTMethods.recordConduct, pMisbehaving, call, conductType);
}
public void timestampStartOfGame(GameTiming.ChangedBy changedBy) {
if ( matchModel == null ) { return; }
matchModel.timestampStartOfGame(changedBy);

writeMethodToBluetooth(BTMethods.timestampStartOfGame, changedBy);
Expand Down Expand Up @@ -6007,8 +6013,10 @@ public void sendMatchToOtherBluetoothDevice(boolean bOnlyAsMaster, int iDelayMs)
m_cdtSendMatchToOther = new CountDownTimer(iDelayMs, 500) {
@Override public void onTick(long millisUntilFinished) { }
@Override public void onFinish() {
String sJson = matchModel.toJsonString(ScoreBoard.this);
mBluetoothControlService.write( sJson.length() + ":" + sJson );
if ( matchModel != null ) {
String sJson = matchModel.toJsonString(ScoreBoard.this);
mBluetoothControlService.write(sJson.length() + ":" + sJson);
}
}
};
m_cdtSendMatchToOther.start();
Expand All @@ -6017,8 +6025,10 @@ public void sendMatchToOtherBluetoothDevice(boolean bOnlyAsMaster, int iDelayMs)
}
}

String sJson = matchModel.toJsonString(this);
sendMatchFromToWearable(sJson);
if ( matchModel != null ) {
String sJson = matchModel.toJsonString(this);
sendMatchFromToWearable(sJson);
}
}

public void sendFlagToOtherBluetoothDevice(Context ctx, String sCountryCode) {
Expand Down Expand Up @@ -6259,26 +6269,28 @@ public synchronized void interpretReceivedMessage(String readMessage, boolean bT
// or old version communicating with new version with new method
//e.printStackTrace();
}
if ( btMethod == null ) {
if ( matchModel == null ) {
Log.w(TAG, "Matchmodel is null"); // should not happen normally
} else if ( btMethod == null ) {
Log.w(TAG, String.format("Could not derive btMethod from message %s (%s) [#%d]", sMethod, readMessage.substring(0, Math.min(20, readMessage.length())) + "...", readMessage.length()));
} else {
switch (btMethod) {
case changeScore: {
if ( sMethodNArgs.length > 1 ) {
if ( sMethodNArgs.length > 1 && (matchModel != null) ) {
Player player = Player.valueOf(sMethodNArgs[1]);
matchModel.changeScore(player);
}
break;
}
case changeSide: {
if ( sMethodNArgs.length > 1 ) {
if ( sMethodNArgs.length > 1 && (matchModel != null) ) {
Player player = Player.valueOf(sMethodNArgs[1]);
matchModel.changeSide(player);
}
break;
}
case changeColor: {
if ( sMethodNArgs.length > 1 ) {
if ( sMethodNArgs.length > 1 && (matchModel != null) ) {
Player player = Player.valueOf(sMethodNArgs[1]);
matchModel.setPlayerColor(player, sMethodNArgs.length>2?sMethodNArgs[2]:null);
}
Expand All @@ -6289,7 +6301,7 @@ public synchronized void interpretReceivedMessage(String readMessage, boolean bT
break;
}
case undoLastForScorer: {
if ( sMethodNArgs.length > 1 ) {
if ( sMethodNArgs.length > 1 && (matchModel != null) ) {
Player nonScorer = Player.valueOf(sMethodNArgs[1]);
matchModel.undoLastForScorer(nonScorer);
}
Expand All @@ -6300,7 +6312,7 @@ public synchronized void interpretReceivedMessage(String readMessage, boolean bT
break;
}
case timestampStartOfGame: {
if ( sMethodNArgs.length > 1 ) {
if ( sMethodNArgs.length > 1 && (matchModel != null) ) {
GameTiming.ChangedBy changedBy = GameTiming.ChangedBy.valueOf(sMethodNArgs[1]);
matchModel.timestampStartOfGame(changedBy);
}
Expand All @@ -6326,15 +6338,15 @@ public synchronized void interpretReceivedMessage(String readMessage, boolean bT
}
}
case recordAppealAndCall: {
if ( sMethodNArgs.length > 2 ) {
if ( sMethodNArgs.length > 2 && (matchModel != null) ) {
Player player = Player.valueOf(sMethodNArgs[1]);
Call call = Call .valueOf(sMethodNArgs[2]);
matchModel.recordAppealAndCall(player, call);
}
break;
}
case recordConduct: {
if ( sMethodNArgs.length > 3 ) {
if ( sMethodNArgs.length > 3 && (matchModel != null) ) {
Player player = Player .valueOf(sMethodNArgs[1]);
Call call = Call .valueOf(sMethodNArgs[2]);
ConductType conductType = ConductType.valueOf(sMethodNArgs[3]);
Expand Down
31 changes: 23 additions & 8 deletions src/com/doubleyellow/scoreboard/model/FinalSetFinish.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,27 @@
package com.doubleyellow.scoreboard.model;

/** For GSMModel only */
public enum FinalSetFinish {
TieBreakTo7,
TieBreakTo10,
/* TODO:
GamesTo12ThenTieBreakTo7,
GamesTo12ThenTieBreakTo10,
NoTieBreak,
*/
public enum FinalSetFinish
{
TieBreakTo7 (GSMModel.FS_NR_GAMES_AS_OTHER_SETS, 7),
TieBreakTo10 (GSMModel.FS_NR_GAMES_AS_OTHER_SETS, 10),
NoGames_TieBreakTo7 ( 0, 7),
NoGames_TieBreakTo10 ( 0, 10),
GamesTo12ThenTieBreakTo7 (12, 7),
GamesTo12ThenTieBreakTo10(12, 10),
NoTieBreak(GSMModel.FS_UNLIMITED_NR_OF_GAMES, GSMModel.NOT_APPLICABLE),
;
private int m_iNrOfGamesToWinSet = GSMModel.FS_NR_GAMES_AS_OTHER_SETS; // not deviating, -2 unlimited
private int m_iNrOfPointsToWinTiebreak = 7;
FinalSetFinish(int iNrOfGames, int iNrOfPointsToWinTiebreak) {
m_iNrOfGamesToWinSet = iNrOfGames;
m_iNrOfPointsToWinTiebreak = iNrOfPointsToWinTiebreak;
}
public int numberOfGamesToWinSet() {
return m_iNrOfGamesToWinSet;
}
public int numberOfPointsToWinTiebreak() {
return m_iNrOfPointsToWinTiebreak;
}

}
Loading

0 comments on commit 9f44bc5

Please sign in to comment.