Skip to content

Commit

Permalink
Merge pull request #91 from sverbach/dev
Browse files Browse the repository at this point in the history
Sprint 4: Dev to master
  • Loading branch information
sverbach authored Jun 10, 2021
2 parents 6623143 + 2d0f925 commit b4957ea
Show file tree
Hide file tree
Showing 163 changed files with 1,127 additions and 636 deletions.
2 changes: 0 additions & 2 deletions OpenCV-android-sdk/sdk/java/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@
package="org.opencv"
android:versionCode="34110"
android:versionName="3.4.11">

<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="21" />
</manifest>
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ android {
}
}
ndk {
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64' // build for v7 only
abiFilters 'arm64-v8a', 'x86'
}
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
Binary file added app/release/app-release.apk
Binary file not shown.
18 changes: 18 additions & 0 deletions app/release/output-metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"version": 2,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "cz.fmo",
"variantName": "processReleaseResources",
"elements": [
{
"type": "SINGLE",
"filters": [],
"versionCode": 1,
"versionName": "1.0",
"outputFile": "app-release.apk"
}
]
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ch.m3ts.tabletennis.events.gesture;
package ch.m3ts.detection.gesture;

import android.app.Activity;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ch.m3ts.tabletennis.events.gesture;
package ch.m3ts.detection.gesture;

import android.app.Activity;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ch.m3ts.tabletennis.events.gesture;
package ch.m3ts.detection.gesture;

import android.app.Activity;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ch.m3ts.tabletennis.events.gesture;
package ch.m3ts.detection.gesture;

import android.app.Activity;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ch.m3ts.tabletennis.events.gesture;
package ch.m3ts.detection.gesture;

import android.app.Activity;

Expand Down
21 changes: 16 additions & 5 deletions app/src/androidTest/java/ch/m3ts/display/MatchActivityTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@
import androidx.test.rule.ActivityTestRule;
import androidx.test.rule.GrantPermissionRule;
import androidx.test.runner.AndroidJUnit4;
import ch.m3ts.tabletennis.helper.Side;
import ch.m3ts.eventbus.TTEvent;
import ch.m3ts.eventbus.TTEventBus;
import ch.m3ts.eventbus.event.StatusUpdateData;
import ch.m3ts.util.Side;
import cz.fmo.R;
import cz.fmo.util.Config;
import helper.GrantPermission;
Expand Down Expand Up @@ -224,16 +227,24 @@ public void run(){
assertEquals("0"+scoreRight, textView.getText());

// invoke onWin and check if values match (need to separate onScore and onWin as onWin clears the score points)
getInstrumentation().runOnMainSync(new Runnable(){
public void run(){
getInstrumentation().runOnMainSync(new Runnable() {
public void run() {
matchScoreFragment.onWin(Side.LEFT, winsLeft);
matchScoreFragment.onWin(Side.RIGHT, winsRight);
}
});
textView = matchActivity.findViewById(R.id.left_games);
assertEquals("0"+winsLeft, textView.getText());
assertEquals("0" + winsLeft, textView.getText());
textView = matchActivity.findViewById(R.id.right_games);
assertEquals("0"+winsRight, textView.getText());
assertEquals("0" + winsRight, textView.getText());

// click on mirror-button
onView(withId(R.id.btnMirrorLayout)).perform(click());
TTEventBus.getInstance().dispatch(new TTEvent<>(new StatusUpdateData("hans", "peter", 3, 5, 1, 0, Side.RIGHT, 3)));
onView(withId(R.id.right_name)).check(matches(withText("peter")));
onView(withId(R.id.left_name)).check(matches(withText("hans")));
onView(withId(R.id.right_score)).check(matches(withText("05")));

getInstrumentation().runOnMainSync(new Runnable() {
public void run() {
matchScoreFragment.onMatchEnded(Side.LEFT.toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.rule.ActivityTestRule;
import androidx.test.runner.AndroidJUnit4;
import ch.m3ts.display.stats.GameStats;
import ch.m3ts.display.stats.MatchStats;
import ch.m3ts.display.stats.PointData;
import ch.m3ts.display.stats.TrackData;
import ch.m3ts.display.statistic.data.GameData;
import ch.m3ts.display.statistic.data.MatchData;
import ch.m3ts.display.statistic.data.PointData;
import ch.m3ts.display.statistic.data.TrackData;
import ch.m3ts.eventbus.TTEvent;
import ch.m3ts.eventbus.TTEventBus;
import ch.m3ts.eventbus.data.StatsData;
import ch.m3ts.tabletennis.helper.Side;
import ch.m3ts.eventbus.event.StatsData;
import ch.m3ts.util.Side;
import cz.fmo.R;

import static androidx.test.espresso.Espresso.onView;
Expand Down Expand Up @@ -104,13 +104,13 @@ public void onClickMatchStats() {
points.add(new PointData("msg1", new ArrayList<TrackData>(), Side.LEFT, 9, 2, Side.RIGHT, Side.RIGHT, Side.LEFT, 12));
points.add(new PointData("msg2", new ArrayList<TrackData>(), Side.LEFT, 10, 2, Side.RIGHT, Side.RIGHT, Side.LEFT, 10));
points.add(new PointData("msg3", new ArrayList<TrackData>(), Side.LEFT, 11, 2, Side.RIGHT, Side.RIGHT, Side.LEFT, 3));
List<GameStats> games = new ArrayList<>();
GameStats gameStats = new GameStats(points);
List<GameData> games = new ArrayList<>();
GameData gameStats = new GameData(points);
games.add(gameStats);
Map<Side, Integer> tableCorners = new HashMap<>();
tableCorners.put(Side.LEFT, 60);
tableCorners.put(Side.RIGHT, 1130);
MatchStats stats = new MatchStats(games, playerLeftName, playerRightName, "12.12.2021", tableCorners);
MatchData stats = new MatchData(games, playerLeftName, playerRightName, "12.12.2021", tableCorners);
TTEventBus.getInstance().dispatch(new TTEvent<>(new StatsData(stats)));
onView(isRoot()).perform(waitFor(1000));
onView(withId(R.id.player_left)).check(matches(withText(playerLeftName)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
import androidx.test.rule.ActivityTestRule;
import androidx.test.runner.AndroidJUnit4;
import ch.m3ts.MainActivity;
import ch.m3ts.tabletennis.Table;
import ch.m3ts.tabletennis.events.gesture.ReadyToServeCallback;
import ch.m3ts.tabletennis.events.gesture.ReadyToServeDetector;
import ch.m3ts.tabletennis.helper.Side;
import ch.m3ts.detection.gesture.ReadyToServeCallback;
import ch.m3ts.detection.gesture.ReadyToServeDetector;
import ch.m3ts.util.Side;
import ch.m3ts.util.Table;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
import androidx.test.runner.lifecycle.ActivityLifecycleMonitorRegistry;
import androidx.test.runner.lifecycle.Stage;
import ch.m3ts.connection.NearbyTrackerConnection;
import ch.m3ts.tabletennis.helper.Side;
import ch.m3ts.tabletennis.match.MatchType;
import ch.m3ts.tracker.visualization.CameraPreviewActivity;
import ch.m3ts.tracker.visualization.live.LiveActivity;
import ch.m3ts.util.Side;
import cz.fmo.R;
import cz.fmo.util.Config;
import helper.GrantPermission;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
import androidx.test.rule.GrantPermissionRule;
import androidx.test.runner.AndroidJUnit4;
import ch.m3ts.MainActivity;
import ch.m3ts.detection.EventDetectionListener;
import ch.m3ts.eventbus.Event;
import ch.m3ts.eventbus.Subscribable;
import ch.m3ts.eventbus.TTEventBus;
import ch.m3ts.eventbus.data.eventdetector.EventDetectorEventData;
import ch.m3ts.tabletennis.events.EventDetectionListener;
import ch.m3ts.tabletennis.helper.Side;
import ch.m3ts.eventbus.event.ball.EventDetectorEventData;
import ch.m3ts.util.Side;
import cz.fmo.Lib;
import cz.fmo.R;
import cz.fmo.data.Track;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
import androidx.test.rule.ActivityTestRule;
import androidx.test.rule.GrantPermissionRule;
import ch.m3ts.MainActivity;
import ch.m3ts.detection.EventDetectionListener;
import ch.m3ts.eventbus.Event;
import ch.m3ts.eventbus.Subscribable;
import ch.m3ts.eventbus.TTEventBus;
import ch.m3ts.eventbus.data.eventdetector.EventDetectorEventData;
import ch.m3ts.eventbus.data.todisplay.ToDisplayData;
import ch.m3ts.tabletennis.events.EventDetectionListener;
import ch.m3ts.tabletennis.helper.Side;
import ch.m3ts.eventbus.event.ball.EventDetectorEventData;
import ch.m3ts.eventbus.event.todisplay.ToDisplayData;
import ch.m3ts.tabletennis.match.DisplayUpdateListener;
import ch.m3ts.util.Side;
import cz.fmo.Lib;
import cz.fmo.R;
import cz.fmo.data.Track;
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@
<activity
android:name="ch.m3ts.display.MatchWonActivity"
android:label="@string/app_name"
android:screenOrientation="unspecified"
android:screenOrientation="landscape"
android:configChanges="orientation|screenSize" />
<activity
android:name="ch.m3ts.display.stats.StatsActivity"
android:name="ch.m3ts.display.statistic.StatsActivity"
android:label="@string/app_name"
android:screenOrientation="landscape"
android:configChanges="orientation|screenSize" />
<activity
android:name="ch.m3ts.tutorial.TutorialActivity"
android:label="@string/app_name"
android:screenOrientation="unspecified"
android:screenOrientation="landscape"
android:configChanges="orientation|screenSize" />
<activity
android:name="ch.m3ts.tracker.init.InitTrackerActivity"
Expand Down
10 changes: 10 additions & 0 deletions app/src/main/assets/!test_outdoor_3.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8" ?><!DOCTYPE properties SYSTEM
"http://java.sun.com/dtd/properties.dtd">
<properties>
<entry key="c1_x">131</entry>
<entry key="c1_y">485</entry>
<entry key="c2_x">1194</entry>
<entry key="c2_y">482</entry>
<entry key="n1_x">663</entry>
<entry key="n1_y">481</entry>
</properties>
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"http://java.sun.com/dtd/properties.dtd">
<properties>
<comment>table location (2 corners)</comment>
<entry key="servingSide">RIGHT</entry>
<entry key="c1_x">55</entry>
<entry key="c1_y">547</entry>
<entry key="c2_x">1215</entry>
Expand Down
11 changes: 11 additions & 0 deletions app/src/main/assets/sports_hall_black_background_1.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8" ?><!DOCTYPE properties SYSTEM
"http://java.sun.com/dtd/properties.dtd">
<properties>
<comment>table location (2 corners)</comment>
<entry key="c1_x">55</entry>
<entry key="c1_y">547</entry>
<entry key="c2_x">1215</entry>
<entry key="c2_y">539</entry>
<entry key="n1_x">634</entry>
<entry key="n1_y">538</entry>
</properties>
12 changes: 12 additions & 0 deletions app/src/main/assets/zpos_2d_diagonal_shot.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?><!DOCTYPE properties SYSTEM
"http://java.sun.com/dtd/properties.dtd">
<properties>
<comment>table location (2 corners)</comment>
<entry key="servingSide">RIGHT</entry>
<entry key="c1_x">22</entry>
<entry key="c1_y">453</entry>
<entry key="c2_x">1260</entry>
<entry key="c2_y">454</entry>
<entry key="n1_x">646</entry>
<entry key="n1_y">460</entry>
</properties>
12 changes: 12 additions & 0 deletions app/src/main/assets/zpos_middle_center_shot.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?><!DOCTYPE properties SYSTEM
"http://java.sun.com/dtd/properties.dtd">
<properties>
<comment>table location (2 corners)</comment>
<entry key="servingSide">RIGHT</entry>
<entry key="c1_x">31</entry>
<entry key="c1_y">390</entry>
<entry key="c2_x">1229</entry>
<entry key="c2_y">367</entry>
<entry key="n1_x">675</entry>
<entry key="n1_y">388</entry>
</properties>
12 changes: 12 additions & 0 deletions app/src/main/assets/zpos_middle_diagonal_shot.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?><!DOCTYPE properties SYSTEM
"http://java.sun.com/dtd/properties.dtd">
<properties>
<comment>table location (2 corners)</comment>
<entry key="servingSide">RIGHT</entry>
<entry key="c1_x">31</entry>
<entry key="c1_y">390</entry>
<entry key="c2_x">1229</entry>
<entry key="c2_y">367</entry>
<entry key="n1_x">675</entry>
<entry key="n1_y">388</entry>
</properties>
4 changes: 2 additions & 2 deletions app/src/main/java/ch/m3ts/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
import android.widget.TextView;
import android.widget.Toast;

import com.google.audio.DebugImplAudioRecorderCallback;
import com.google.audio.core.Recorder;

import ch.m3ts.detection.audio.AudioBounceDetectionDebug;
import ch.m3ts.display.MatchActivity;
import ch.m3ts.tracker.init.InitTrackerActivity;
import ch.m3ts.tutorial.TutorialActivity;
Expand Down Expand Up @@ -89,7 +89,7 @@ protected void onCreate(Bundle savedInstanceState) {
animationDrawable.setEnterFadeDuration(2000);
animationDrawable.setExitFadeDuration(4000);
animationDrawable.start();
this.audioRecorder = new Recorder(new DebugImplAudioRecorderCallback(
this.audioRecorder = new Recorder(new AudioBounceDetectionDebug(
(TextView) findViewById(R.id.txtPlayMovieFrequency),
(TextView) findViewById(R.id.txtAudioBounce)
));
Expand Down
26 changes: 13 additions & 13 deletions app/src/main/java/ch/m3ts/connection/ImplDisplayConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,25 @@
import ch.m3ts.connection.pubnub.ByteToBase64;
import ch.m3ts.connection.pubnub.JSONInfo;
import ch.m3ts.display.DisplayConnectCallback;
import ch.m3ts.display.stats.MatchStats;
import ch.m3ts.display.statistic.data.MatchData;
import ch.m3ts.eventbus.Event;
import ch.m3ts.eventbus.EventBus;
import ch.m3ts.eventbus.Subscribable;
import ch.m3ts.eventbus.TTEvent;
import ch.m3ts.eventbus.TTEventBus;
import ch.m3ts.eventbus.data.RequestStatsData;
import ch.m3ts.eventbus.data.RestartMatchData;
import ch.m3ts.eventbus.data.StatsData;
import ch.m3ts.eventbus.data.StatusUpdateData;
import ch.m3ts.eventbus.data.scoremanipulation.ScoreManipulationData;
import ch.m3ts.eventbus.data.todisplay.InvalidServeData;
import ch.m3ts.eventbus.data.todisplay.MatchEndedData;
import ch.m3ts.eventbus.data.todisplay.ReadyToServeData;
import ch.m3ts.eventbus.data.todisplay.ScoreData;
import ch.m3ts.eventbus.data.todisplay.ToDisplayGameWinData;
import ch.m3ts.tabletennis.helper.Side;
import ch.m3ts.eventbus.event.RequestStatsData;
import ch.m3ts.eventbus.event.RestartMatchData;
import ch.m3ts.eventbus.event.StatsData;
import ch.m3ts.eventbus.event.StatusUpdateData;
import ch.m3ts.eventbus.event.scoremanipulation.ScoreManipulationData;
import ch.m3ts.eventbus.event.todisplay.InvalidServeData;
import ch.m3ts.eventbus.event.todisplay.MatchEndedData;
import ch.m3ts.eventbus.event.todisplay.ReadyToServeData;
import ch.m3ts.eventbus.event.todisplay.ScoreData;
import ch.m3ts.eventbus.event.todisplay.ToDisplayGameWinData;
import ch.m3ts.tabletennis.match.game.ScoreManipulationListener;
import ch.m3ts.util.Log;
import ch.m3ts.util.Side;

public abstract class ImplDisplayConnection extends Callback implements ScoreManipulationListener, DisplayConnection, Subscribable {
protected DisplayConnectCallback displayConnectCallback;
Expand Down Expand Up @@ -188,7 +188,7 @@ private void handleMultipartTransmissionCompletion(JSONObject json) throws JSONE
byte[] b = android.util.Base64.decode(this.encodedMultipartComplete, android.util.Base64.DEFAULT);
ByteArrayInputStream bi = new ByteArrayInputStream(b);
ObjectInputStream si = new ObjectInputStream(bi);
MatchStats stats = (MatchStats) si.readObject();
MatchData stats = (MatchData) si.readObject();
TTEventBus.getInstance().dispatch(new TTEvent<>(new StatsData(stats)));
} catch (Exception e) {
Log.d("Failed to serialize Stats:" + e.getMessage());
Expand Down
Loading

0 comments on commit b4957ea

Please sign in to comment.