mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-30 01:16:40 +00:00
Merge branch 'master' into android_apps
This commit is contained in:
@@ -181,6 +181,9 @@ fi
|
||||
|
||||
if [[ "$@" == "clean" ]]; then
|
||||
./gradlew clean
|
||||
if [[ $? != 0 ]]; then
|
||||
exit 100
|
||||
fi
|
||||
cd $PROJECT_HOME/java
|
||||
rm -rf com.sap.$PROJECT_TYPE.gwt.ui/com.sap.$PROJECT_TYPE.*
|
||||
rm -rf com.sap.sse.security.ui/com.sap.sse.security.ui.*
|
||||
@@ -606,6 +609,9 @@ if [[ "$@" == "build" ]] || [[ "$@" == "all" ]]; then
|
||||
|
||||
( sleep 5 && while [ 1 ]; do sleep 1; echo y; done ) | $ANDROID_HOME/tools/android update sdk --no-ui
|
||||
./gradlew clean build
|
||||
if [[ $? != 0 ]]; then
|
||||
exit 100
|
||||
fi
|
||||
else
|
||||
echo "INFO: Deactivating mobile modules"
|
||||
extra="$extra -P !with-mobile"
|
||||
|
||||
+6
@@ -116,6 +116,7 @@ public class LeaderboardEntryDTO implements Serializable {
|
||||
result = prime * result + ((fleet == null) ? 0 : fleet.hashCode());
|
||||
result = prime * result + ((legDetails == null) ? 0 : legDetails.hashCode());
|
||||
result = prime * result + ((netPoints == null) ? 0 : netPoints.hashCode());
|
||||
result = prime * result + ((netPointsUncorrected == null) ? 0 : netPointsUncorrected.hashCode());
|
||||
result = prime * result + (netPointsCorrected ? 1231 : 1237);
|
||||
result = prime * result + ((race == null) ? 0 : race.hashCode());
|
||||
result = prime * result + ((reasonForMaxPoints == null) ? 0 : reasonForMaxPoints.hashCode());
|
||||
@@ -182,6 +183,11 @@ public class LeaderboardEntryDTO implements Serializable {
|
||||
return false;
|
||||
} else if (!netPoints.equals(other.netPoints))
|
||||
return false;
|
||||
if (netPointsUncorrected == null) {
|
||||
if (other.netPointsUncorrected != null)
|
||||
return false;
|
||||
} else if (!netPointsUncorrected.equals(other.netPointsUncorrected))
|
||||
return false;
|
||||
if (netPointsCorrected != other.netPointsCorrected)
|
||||
return false;
|
||||
if (race == null) {
|
||||
|
||||
+1
-1
@@ -1814,7 +1814,7 @@ public abstract class AbstractSimpleLeaderboardImpl implements Leaderboard, Race
|
||||
InterruptedException, ExecutionException {
|
||||
LeaderboardDTO result = null;
|
||||
if (timePoint == null) {
|
||||
// date==null means live mode; however, if we're after the end of all races and after all score
|
||||
// timePoint==null means live mode; however, if we're after the end of all races and after all score
|
||||
// corrections, don't use the live leaderboard updater which would keep re-calculating over and over again, but map
|
||||
// this to a usual non-live call which uses the regular LeaderboardDTOCache which is invalidated properly
|
||||
// when the tracked race associations or score corrections or tracked race contents changes:
|
||||
|
||||
Regular → Executable
+3
-3
@@ -1,12 +1,12 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.6
|
||||
org.eclipse.jdt.core.compiler.source=1.7
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.sap.sailing.android.shared"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
|
||||
<uses-sdk android:minSdkVersion="13" android:targetSdkVersion="21" />
|
||||
|
||||
</manifest>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.sap.sailing.android.shared"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
|
||||
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="21" />
|
||||
|
||||
</manifest>
|
||||
|
||||
@@ -5,7 +5,7 @@ android {
|
||||
compileSdkVersion 21
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 13
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 21
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,6 @@
|
||||
<type>aar</type>
|
||||
</dependency>
|
||||
|
||||
<!-- needed on remote repository -->
|
||||
<dependency>
|
||||
<groupId>android</groupId>
|
||||
<artifactId>android</artifactId>
|
||||
|
||||
+3
-1
@@ -35,7 +35,9 @@ public class ConnectivityChangedReceiver extends BroadcastReceiver {
|
||||
*/
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
NetworkInfo networkInfo = (NetworkInfo)intent.getParcelableExtra(ConnectivityManager.EXTRA_NETWORK_INFO);
|
||||
ConnectivityManager cService = (ConnectivityManager)
|
||||
context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
NetworkInfo networkInfo = (NetworkInfo) cService.getActiveNetworkInfo();
|
||||
if (!networkInfo.isConnected())
|
||||
return;
|
||||
context.startService(MessageSendingService.createSendDelayedIntent(context));
|
||||
|
||||
+11
-8
@@ -4,6 +4,7 @@ import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
@@ -38,7 +39,7 @@ public class MessagePersistenceManager {
|
||||
return !persistedMessages.isEmpty();
|
||||
}
|
||||
|
||||
public void persistIntent(Intent intent) {
|
||||
public void persistIntent(Intent intent) throws UnsupportedEncodingException {
|
||||
Bundle extras = intent.getExtras();
|
||||
String callbackPayload = extras.getString(MessageSendingService.CALLBACK_PAYLOAD);
|
||||
String url = extras.getString(MessageSendingService.URL);
|
||||
@@ -47,7 +48,7 @@ public class MessagePersistenceManager {
|
||||
persistMessage(url, callbackPayload, payload, callbackClass);
|
||||
}
|
||||
|
||||
private void persistMessage(String url, String callbackPayload, String payload, String callbackClass) {
|
||||
private void persistMessage(String url, String callbackPayload, String payload, String callbackClass) throws UnsupportedEncodingException {
|
||||
String messageLine = getSerializedIntentForPersistence(url, callbackPayload, payload, callbackClass);
|
||||
ExLog.i(context, TAG, String.format("Persisting message \"%s\".", messageLine));
|
||||
if (persistedMessages.contains(messageLine)) {
|
||||
@@ -59,15 +60,17 @@ public class MessagePersistenceManager {
|
||||
|
||||
/**
|
||||
* @param payload will be URL-encoded to ensure that the resulting string does not contain newlines
|
||||
* @throws UnsupportedEncodingException
|
||||
*/
|
||||
private String getSerializedIntentForPersistence(String url, String callbackPayload,
|
||||
String payload, String callbackClass) {
|
||||
String messageLine = String.format("%s;%s;%s;%s", callbackPayload, URLEncoder.encode(payload),
|
||||
String payload, String callbackClass) throws UnsupportedEncodingException {
|
||||
String messageLine = String.format("%s;%s;%s;%s", callbackPayload, URLEncoder.encode(payload,
|
||||
MessageSendingService.charsetName),
|
||||
url, callbackClass);
|
||||
return messageLine;
|
||||
}
|
||||
|
||||
public void removeIntent(Intent intent) {
|
||||
public void removeIntent(Intent intent) throws UnsupportedEncodingException {
|
||||
Bundle extras = intent.getExtras();
|
||||
String url = extras.getString(MessageSendingService.URL);
|
||||
String callbackPayload = extras.getString(MessageSendingService.CALLBACK_PAYLOAD);
|
||||
@@ -76,7 +79,7 @@ public class MessagePersistenceManager {
|
||||
removeMessage(url, callbackPayload, payload, callbackClass);
|
||||
}
|
||||
|
||||
private void removeMessage(String url, String callbackPayload, String payload, String callbackClass) {
|
||||
private void removeMessage(String url, String callbackPayload, String payload, String callbackClass) throws UnsupportedEncodingException {
|
||||
if (!persistedMessages.isEmpty()) {
|
||||
ExLog.i(context, TAG, String.format("Removing message \"%s\".", payload));
|
||||
String messageLine = getSerializedIntentForPersistence(url, callbackPayload, payload, callbackClass);
|
||||
@@ -112,13 +115,13 @@ public class MessagePersistenceManager {
|
||||
void restoreMessage(Context context, Intent messageIntent);
|
||||
}
|
||||
|
||||
public List<Intent> restoreMessages() {
|
||||
public List<Intent> restoreMessages() throws UnsupportedEncodingException {
|
||||
List<Intent> delayedIntents = new ArrayList<Intent>();
|
||||
for (String persistedMessage : persistedMessages) {
|
||||
String[] lineParts = persistedMessage.split(";");
|
||||
String url = lineParts[2];
|
||||
String callbackPayload = lineParts[0];
|
||||
String payload = URLDecoder.decode(lineParts[1]);
|
||||
String payload = URLDecoder.decode(lineParts[1], MessageSendingService.charsetName);
|
||||
String callbackClassString = lineParts[3];
|
||||
|
||||
Class<? extends ServerReplyCallback> callbackClass = null;
|
||||
|
||||
+35
-22
@@ -62,6 +62,8 @@ public class MessageSendingService extends Service implements MessageSendingList
|
||||
public final static String CALLBACK_CLASS = "callback";
|
||||
public final static String CALLBACK_PAYLOAD = "callbackPayload"; // passed back to callback
|
||||
public final static String MESSAGE_ID = "messageId";
|
||||
|
||||
public static final String charsetName = "UTF=8";
|
||||
|
||||
protected final static String TAG = MessageSendingService.class.getName();
|
||||
|
||||
@@ -229,7 +231,11 @@ public class MessageSendingService extends Service implements MessageSendingList
|
||||
ExLog.i(this, TAG, String.format("Trying to send a message..."));
|
||||
if (!isConnected()) {
|
||||
ExLog.i(this, TAG, String.format("Send aborted because there is no connection."));
|
||||
persistenceManager.persistIntent(intent);
|
||||
try {
|
||||
persistenceManager.persistIntent(intent);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
ExLog.e(this, TAG, "Could not persist message (unsupported encoding)");
|
||||
}
|
||||
ConnectivityChangedReceiver.enable(this);
|
||||
serviceLogger.onMessageSentFailed();
|
||||
reportApiConnectivity(APIConnectivity.notReachable);
|
||||
@@ -251,10 +257,14 @@ public class MessageSendingService extends Service implements MessageSendingList
|
||||
}
|
||||
|
||||
private void sendDelayedMessages() {
|
||||
List<Intent> delayedIntents = persistenceManager.restoreMessages();
|
||||
ExLog.i(this, TAG, String.format("Resending %d messages...", delayedIntents.size()));
|
||||
for (Intent intent : delayedIntents) {
|
||||
sendMessage(intent);
|
||||
try {
|
||||
List<Intent> delayedIntents = persistenceManager.restoreMessages();
|
||||
ExLog.i(this, TAG, String.format("Resending %d messages...", delayedIntents.size()));
|
||||
for (Intent intent : delayedIntents) {
|
||||
sendMessage(intent);
|
||||
}
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
ExLog.e(this, TAG, "Could not restore messages (unsupported encoding)");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -284,7 +294,11 @@ public class MessageSendingService extends Service implements MessageSendingList
|
||||
ExLog.i(this, "MS", "success");
|
||||
reportApiConnectivity(APIConnectivity.transmissionError);
|
||||
ExLog.w(this, TAG, "Error while posting intent to server. Will persist intent...");
|
||||
persistenceManager.persistIntent(intent);
|
||||
try {
|
||||
persistenceManager.persistIntent(intent);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
ExLog.e(this, TAG, "Could not store message (unsupported encoding)");
|
||||
}
|
||||
if (!isHandlerSet) {
|
||||
SendDelayedMessagesCaller delayedCaller = new SendDelayedMessagesCaller(this);
|
||||
handler.postDelayed(delayedCaller, resendMillis); // after 30 sec, try the sending again
|
||||
@@ -297,7 +311,11 @@ public class MessageSendingService extends Service implements MessageSendingList
|
||||
reportApiConnectivity(APIConnectivity.transmissionSuccess);
|
||||
ExLog.i(this, TAG, "Message successfully sent.");
|
||||
if (persistenceManager.areIntentsDelayed()) {
|
||||
persistenceManager.removeIntent(intent);
|
||||
try {
|
||||
persistenceManager.removeIntent(intent);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
ExLog.e(this, TAG, "Could not remove message (unsupported encoding)");
|
||||
}
|
||||
}
|
||||
lastSuccessfulSend = Calendar.getInstance().getTime();
|
||||
serviceLogger.onMessageSentSuccessful();
|
||||
@@ -340,21 +358,16 @@ public class MessageSendingService extends Service implements MessageSendingList
|
||||
public final static UUID uuid = UUID.randomUUID();
|
||||
|
||||
public static String getRaceLogEventSendAndReceiveUrl(Context context, final String raceGroupName,
|
||||
final String raceName, final String fleetName) {
|
||||
String url = null;
|
||||
try {
|
||||
url = String.format("%s/sailingserver/rc/racelog?"+
|
||||
RaceLogServletConstants.PARAMS_LEADERBOARD_NAME+"=%s&"+
|
||||
RaceLogServletConstants.PARAMS_RACE_COLUMN_NAME+"=%s&"+
|
||||
RaceLogServletConstants.PARAMS_RACE_FLEET_NAME+"=%s&"+
|
||||
RaceLogServletConstants.PARAMS_CLIENT_UUID+"=%s",
|
||||
PrefUtils.getString(context, R.string.preference_server_url_key, R.string.preference_server_url_default),
|
||||
URLEncoder.encode(raceGroupName, "UTF-8"),
|
||||
URLEncoder.encode(raceName,"UTF-8"),
|
||||
URLEncoder.encode(fleetName, "UTF-8"), uuid);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
ExLog.e(context, TAG, "UnsupportedEncodingException: " + e.getLocalizedMessage());
|
||||
}
|
||||
final String raceName, final String fleetName) throws UnsupportedEncodingException {
|
||||
String url = String.format("%s/sailingserver/rc/racelog?"+
|
||||
RaceLogServletConstants.PARAMS_LEADERBOARD_NAME+"=%s&"+
|
||||
RaceLogServletConstants.PARAMS_RACE_COLUMN_NAME+"=%s&"+
|
||||
RaceLogServletConstants.PARAMS_RACE_FLEET_NAME+"=%s&"+
|
||||
RaceLogServletConstants.PARAMS_CLIENT_UUID+"=%s",
|
||||
PrefUtils.getString(context, R.string.preference_server_url_key, R.string.preference_server_url_default),
|
||||
URLEncoder.encode(raceGroupName, charsetName),
|
||||
URLEncoder.encode(raceName, charsetName),
|
||||
URLEncoder.encode(fleetName, charsetName), uuid);
|
||||
return url;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||
org.eclipse.jdt.core.compiler.source=1.6
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.7
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!-- needed on remote repository -->
|
||||
<dependency>
|
||||
<groupId>android</groupId>
|
||||
<artifactId>android</artifactId>
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
|
||||
|
||||
# Project target.
|
||||
target=android-21
|
||||
|
||||
target=Google Inc.:Google APIs:21
|
||||
android.library.reference.1=../google-play-services_lib
|
||||
android.library.reference.2=../com.sap.sailing.android.shared
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||
org.eclipse.jdt.core.compiler.source=1.6
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.7
|
||||
|
||||
@@ -2,12 +2,11 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.sap.sailing.racecommittee.app"
|
||||
android:versionCode="6"
|
||||
android:versionName="6 - Laser" >
|
||||
android:versionName="6 - Laser" xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<uses-sdk
|
||||
android:maxSdkVersion="17"
|
||||
android:minSdkVersion="13"
|
||||
android:targetSdkVersion="17" />
|
||||
android:minSdkVersion="14"
|
||||
android:targetSdkVersion="19" tools:ignore="OldTargetApi"/>
|
||||
|
||||
<permission
|
||||
android:name="com.sap.sailing.racecommittee.app.MAPS_RECEIVE"
|
||||
|
||||
@@ -9,7 +9,7 @@ android {
|
||||
|
||||
defaultConfig {
|
||||
applicationId packageName
|
||||
minSdkVersion 13
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 21
|
||||
versionCode verCode
|
||||
versionName "$verCode - Laser"
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
<undeployBeforeDeploy>true</undeployBeforeDeploy>
|
||||
<extractDuplicates>true</extractDuplicates>
|
||||
<sdk>
|
||||
<platform>13</platform>
|
||||
<platform>19</platform>
|
||||
</sdk>
|
||||
<release>true</release>
|
||||
<proguard>
|
||||
|
||||
@@ -11,6 +11,6 @@
|
||||
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
|
||||
|
||||
# Project target.
|
||||
target=Google Inc.:Google APIs:13
|
||||
target=Google Inc.:Google APIs:19
|
||||
android.library.reference.1=../google-play-services_lib
|
||||
android.library.reference.2=../com.sap.sailing.android.shared
|
||||
|
||||
+10
-10
@@ -162,9 +162,9 @@ public class OnlineDataManager extends DataManager {
|
||||
|
||||
ManagedRaceIdentifier identifier = managedRace.getIdentifier();
|
||||
|
||||
String raceGroupName = URLEncoder.encode(identifier.getRaceGroup().getName());
|
||||
String raceColumnName = URLEncoder.encode(identifier.getRaceName());
|
||||
String fleetName = URLEncoder.encode(identifier.getFleet().getName());
|
||||
String raceGroupName = URLEncoder.encode(identifier.getRaceGroup().getName(), MessageSendingService.charsetName);
|
||||
String raceColumnName = URLEncoder.encode(identifier.getRaceName(), MessageSendingService.charsetName);
|
||||
String fleetName = URLEncoder.encode(identifier.getFleet().getName(), MessageSendingService.charsetName);
|
||||
|
||||
return new OnlineDataLoader<Collection<Mark>>(context, new URL(preferences.getServerBaseURL() +
|
||||
"/sailingserver/rc/marks?"+RaceLogServletConstants.PARAMS_LEADERBOARD_NAME + "=" + raceGroupName +
|
||||
@@ -188,9 +188,9 @@ public class OnlineDataManager extends DataManager {
|
||||
|
||||
ManagedRaceIdentifier identifier = managedRace.getIdentifier();
|
||||
|
||||
String raceGroupName = URLEncoder.encode(identifier.getRaceGroup().getName());
|
||||
String raceColumnName = URLEncoder.encode(identifier.getRaceName());
|
||||
String fleetName = URLEncoder.encode(identifier.getFleet().getName());
|
||||
String raceGroupName = URLEncoder.encode(identifier.getRaceGroup().getName(), MessageSendingService.charsetName);
|
||||
String raceColumnName = URLEncoder.encode(identifier.getRaceName(), MessageSendingService.charsetName);
|
||||
String fleetName = URLEncoder.encode(identifier.getFleet().getName(), MessageSendingService.charsetName);
|
||||
|
||||
return new OnlineDataLoader<CourseBase>(context, new URL(preferences.getServerBaseURL()
|
||||
+ "/sailingserver/rc/currentcourse?" + RaceLogServletConstants.PARAMS_LEADERBOARD_NAME + "="
|
||||
@@ -216,9 +216,9 @@ public class OnlineDataManager extends DataManager {
|
||||
|
||||
ManagedRaceIdentifier identifier = managedRace.getIdentifier();
|
||||
|
||||
String raceGroupName = URLEncoder.encode(identifier.getRaceGroup().getName());
|
||||
String raceColumnName = URLEncoder.encode(identifier.getRaceName());
|
||||
String fleetName = URLEncoder.encode(identifier.getFleet().getName());
|
||||
String raceGroupName = URLEncoder.encode(identifier.getRaceGroup().getName(), MessageSendingService.charsetName);
|
||||
String raceColumnName = URLEncoder.encode(identifier.getRaceName(), MessageSendingService.charsetName);
|
||||
String fleetName = URLEncoder.encode(identifier.getFleet().getName(), MessageSendingService.charsetName);
|
||||
|
||||
return new OnlineDataLoader<Collection<Competitor>>(context, new URL(
|
||||
preferences.getServerBaseURL() + "/sailingserver/rc/competitors?"
|
||||
@@ -240,7 +240,7 @@ public class OnlineDataManager extends DataManager {
|
||||
DataHandler<DeviceConfiguration> handler = new NullDataHandler<DeviceConfiguration>();
|
||||
DataParser<DeviceConfiguration> parser = new DeviceConfigurationParser(DeviceConfigurationJsonDeserializer.create());
|
||||
|
||||
String encodedIdentifier = URLEncoder.encode(identifier.getClientIdentifier());
|
||||
String encodedIdentifier = URLEncoder.encode(identifier.getClientIdentifier(), MessageSendingService.charsetName);
|
||||
encodedIdentifier = encodedIdentifier.replace("+", "%20");
|
||||
|
||||
return new OnlineDataLoader<DeviceConfiguration>(
|
||||
|
||||
+3
-2
@@ -2,6 +2,7 @@ package com.sap.sailing.racecommittee.app.services.polling;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.Serializable;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
@@ -64,12 +65,12 @@ public class RaceLogPoller implements PollingActiveChangedListener {
|
||||
this.hasRacesToPoll = true;
|
||||
ExLog.i(context, TAG, String.format("Registered race %s for polling, will start in %d milliseconds.", race.getId(),
|
||||
pollingInterval));
|
||||
} catch (MalformedURLException e) {
|
||||
} catch (MalformedURLException | UnsupportedEncodingException e) {
|
||||
ExLog.e(context, TAG, String.format("Unable to create polling URL for race %s: %s", race.getId(), e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
private URL createURL(ManagedRace race) throws MalformedURLException {
|
||||
private URL createURL(ManagedRace race) throws MalformedURLException, UnsupportedEncodingException {
|
||||
return new URL(MessageSendingService.getRaceLogEventSendAndReceiveUrl(context, race.getRaceGroup().getName(),
|
||||
race.getName(), race.getFleet().getName()));
|
||||
}
|
||||
|
||||
+1
@@ -27,6 +27,7 @@ public class RaceLogPollerTask extends AsyncTask<Util.Pair<Serializable, URL>, P
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
protected Void doInBackground(Util.Pair<Serializable, URL>... queries) {
|
||||
for (Util.Pair<Serializable, URL> query : queries) {
|
||||
|
||||
+2
-1
@@ -1,6 +1,7 @@
|
||||
package com.sap.sailing.racecommittee.app.services.sending;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -25,7 +26,7 @@ public class EventSendingServiceUtil {
|
||||
* @return the intent that shall be sent to the EventSendingService
|
||||
*/
|
||||
public static Intent createEventIntent(Context context, ManagedRace race, Serializable eventId, String serializedEventAsJson,
|
||||
Class<? extends ServerReplyCallback> callbackClass) {
|
||||
Class<? extends ServerReplyCallback> callbackClass) throws UnsupportedEncodingException {
|
||||
String url = MessageSendingService.getRaceLogEventSendAndReceiveUrl(context,
|
||||
race.getRaceGroup().getName(), race.getName(), race.getFleet().getName());
|
||||
return MessageSendingService.createMessageIntent(context, url, race.getId(), eventId, serializedEventAsJson, callbackClass);
|
||||
|
||||
+10
-2
@@ -1,9 +1,12 @@
|
||||
package com.sap.sailing.racecommittee.app.services.sending;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
import android.app.Service;
|
||||
|
||||
import com.sap.sailing.android.shared.logging.ExLog;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogChangedListener;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||
import com.sap.sailing.racecommittee.app.domain.ManagedRace;
|
||||
@@ -11,6 +14,7 @@ import com.sap.sailing.racecommittee.app.domain.racelog.impl.RaceLogEventsCallba
|
||||
import com.sap.sailing.server.gateway.serialization.JsonSerializer;
|
||||
|
||||
public class RaceEventSender implements RaceLogChangedListener {
|
||||
private static final String TAG = RaceEventSender.class.getName();
|
||||
|
||||
private final Service service;
|
||||
private final JsonSerializer<RaceLogEvent> serializer;
|
||||
@@ -25,7 +29,11 @@ public class RaceEventSender implements RaceLogChangedListener {
|
||||
@Override
|
||||
public void eventAdded(RaceLogEvent event) {
|
||||
JSONObject serializedEvent = serializer.serialize(event);
|
||||
service.startService(EventSendingServiceUtil.createEventIntent(service, race, event.getId(),
|
||||
serializedEvent.toJSONString(), RaceLogEventsCallback.class));
|
||||
try {
|
||||
service.startService(EventSendingServiceUtil.createEventIntent(service, race, event.getId(),
|
||||
serializedEvent.toJSONString(), RaceLogEventsCallback.class));
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
ExLog.e(service, TAG, "Could not create racelog event message (unsupported encoding)");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-1
@@ -28,7 +28,6 @@ public class CameraView extends SurfaceView implements SurfaceHolder.Callback {
|
||||
// underlying surface is created and destroyed.
|
||||
surfaceHolder = getHolder();
|
||||
surfaceHolder.addCallback(this);
|
||||
surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
|
||||
}
|
||||
|
||||
public void snap(final PictureCallback pictureHandler) {
|
||||
|
||||
+2
-1
@@ -44,7 +44,8 @@ public class AutoUpdaterChecker {
|
||||
this.dialog = new ProgressDialog(context);
|
||||
dialog.setTitle(context.getString(R.string.auto_update));
|
||||
dialog.setCancelable(true);
|
||||
dialog.setButton(context.getString(android.R.string.cancel), new DialogInterface.OnClickListener() {
|
||||
dialog.setButton(DialogInterface.BUTTON_POSITIVE,
|
||||
context.getString(android.R.string.cancel), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface arg0, int arg1) {
|
||||
dialog.cancel();
|
||||
|
||||
+22
-8
@@ -32,14 +32,20 @@
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<!-- needed on remote repository -->
|
||||
<dependency>
|
||||
<groupId>android</groupId>
|
||||
<artifactId>android</artifactId>
|
||||
<version>21</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${env.ANDROID_HOME}/platforms/android-21/android.jar</systemPath>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<dependency>
|
||||
<groupId>android</groupId>
|
||||
<artifactId>android</artifactId>
|
||||
<version>4.4.2_r4</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- needed on remote repository -->
|
||||
<dependency>
|
||||
<groupId>android.support</groupId>
|
||||
<artifactId>compatibility-v4</artifactId>
|
||||
<version>19</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<build>
|
||||
@@ -124,6 +130,14 @@
|
||||
</filesets>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
|
||||
@@ -113,7 +113,7 @@ The password is omitted from the response.
|
||||
|
||||
Called for getting details of other users, e.g. on invite to training.
|
||||
|
||||
**Path:** ``users/{userId}``
|
||||
**Path:** ``users/{user_id}``
|
||||
|
||||
**Verb:** ``GET``
|
||||
|
||||
@@ -164,7 +164,7 @@ The password is omitted from the response.
|
||||
|
||||
Update a user. Only sent properties are updated, all others remain untouched. To delete a value, it must be set to ``null``.
|
||||
|
||||
**Path:** ``users/{userId}``
|
||||
**Path:** ``users/{user_id}``
|
||||
|
||||
**Verb:** ``PUT``
|
||||
|
||||
@@ -191,7 +191,7 @@ The password is omitted from the response.
|
||||
|
||||
A multipart message is used to upload a profile image.
|
||||
|
||||
**Path:** ``me/profileImage``
|
||||
**Path:** ``me/profile_image``
|
||||
|
||||
**Verb:** ``POST``
|
||||
|
||||
@@ -235,7 +235,7 @@ Get complete details about a training. These include:
|
||||
* list of markers
|
||||
* list of sessions
|
||||
|
||||
**Path:** ``training/{trainingId}``
|
||||
**Path:** ``training/{training_id}``
|
||||
|
||||
**Verb:** ``GET``
|
||||
|
||||
@@ -325,7 +325,7 @@ Start a new training.
|
||||
|
||||
Finish a training.
|
||||
|
||||
**Path:** ``training/{trainingId}/finish``
|
||||
**Path:** ``training/{training_id}/finish``
|
||||
|
||||
**Verb:** ``POST``
|
||||
|
||||
@@ -368,7 +368,7 @@ This call is used by the users who wants to join a training.
|
||||
|
||||
This call gets all training possibilities nearby.
|
||||
|
||||
**Path:** ``training/{trainingId}/joinRequest``
|
||||
**Path:** ``training/{training_id}/join_request``
|
||||
|
||||
**Verb:** ``POST``
|
||||
|
||||
@@ -395,7 +395,7 @@ This call gets all training possibilities nearby.
|
||||
|
||||
This call is used by the initiator to see who wants to join in.
|
||||
|
||||
**Path:** ``training/{trainingId}/joinRequests``
|
||||
**Path:** ``training/{training_id}/join_requests``
|
||||
|
||||
**Verb:** ``GET``
|
||||
|
||||
@@ -419,7 +419,7 @@ This call is used by the initiator to see who wants to join in.
|
||||
|
||||
This call is used by the initiator accept or deny a join request.
|
||||
|
||||
**Path:** ``training/{trainingId}/joinRequests/{joinRequestId}``
|
||||
**Path:** ``training/{training_id}/join_requests/{join_request_id}``
|
||||
|
||||
**Verb:** ``PUT``
|
||||
|
||||
@@ -448,7 +448,7 @@ This call is used by the initiator accept or deny a join request.
|
||||
|
||||
Get details about a training's course.
|
||||
|
||||
**Path:** ``training/{trainingId}/course``
|
||||
**Path:** ``training/{training_id}/course``
|
||||
|
||||
**Verb:** ``GET``
|
||||
|
||||
@@ -472,7 +472,7 @@ TODO Possible values for ``courseType`` must be defined.
|
||||
|
||||
Currently only the course type can be set.
|
||||
|
||||
**Path:** ``training/{trainingId}/course``
|
||||
**Path:** ``training/{training_id}/course``
|
||||
|
||||
**Verb:** ``PUT``
|
||||
|
||||
@@ -495,7 +495,7 @@ TODO Possible values for ``courseType`` must be defined.
|
||||
|
||||
Creates the race course for training.
|
||||
|
||||
**Path:** ``training/{trainingId}/course``
|
||||
**Path:** ``training/{training_id}/course``
|
||||
|
||||
**Verb:** ``POST``
|
||||
|
||||
@@ -518,7 +518,7 @@ TODO Possible values for ``courseType`` must be defined.
|
||||
|
||||
Sets a course mark, e.g. pin end, leeward mark, windward park, or reach mark.
|
||||
|
||||
**Path:** ``training/{trainingId}/course/marks/{markId}``
|
||||
**Path:** ``training/{training_id}/course/marks/{mark_id}``
|
||||
|
||||
**Verb:** ``POST``
|
||||
|
||||
@@ -546,7 +546,7 @@ TODO Possible values for ``markType`` must be defined.
|
||||
|
||||
Deletes a previously defined course mark.
|
||||
|
||||
**Path:** ``training/{trainingId}/course/marks/{markId}``
|
||||
**Path:** ``training/{training_id}/course/marks/{mark_id}``
|
||||
|
||||
**Verb:** ``DELETE``
|
||||
|
||||
@@ -554,7 +554,7 @@ Deletes a previously defined course mark.
|
||||
|
||||
Sets wind speed and direction.
|
||||
|
||||
**Path:** ``training/{trainingId}/wind``
|
||||
**Path:** ``training/{training_id}/wind``
|
||||
|
||||
**Verb:** ``POST``
|
||||
|
||||
@@ -575,7 +575,7 @@ During a training, markers are set, these are timestamps. Afterwards, the traini
|
||||
|
||||
Sets wind speed and direction.
|
||||
|
||||
**Path:** ``training/{trainingId}/markers``
|
||||
**Path:** ``training/{training_id}/markers``
|
||||
|
||||
**Verb:** ``POST``
|
||||
|
||||
@@ -600,7 +600,7 @@ Sets wind speed and direction.
|
||||
|
||||
#### Create a Session
|
||||
|
||||
**Path:** ``training/{trainingId}/sessions``
|
||||
**Path:** ``training/{training_id}/sessions``
|
||||
|
||||
**Verb:** ``POST``
|
||||
|
||||
@@ -623,7 +623,7 @@ Sets wind speed and direction.
|
||||
|
||||
#### Update a Session
|
||||
|
||||
**Path:** ``training/{trainingId}/sessions/{sessionId}``
|
||||
**Path:** ``training/{training_id}/sessions/{session_id}``
|
||||
|
||||
**Verb:** ``PUT``
|
||||
|
||||
@@ -646,7 +646,7 @@ Sets wind speed and direction.
|
||||
|
||||
#### Delete a Session
|
||||
|
||||
**Path:** ``training/{trainingId}/sessions/{sessionId}``
|
||||
**Path:** ``training/{training_id}/sessions/{session_id}``
|
||||
|
||||
**Verb:** ``DELETE``
|
||||
|
||||
@@ -654,7 +654,7 @@ Sets wind speed and direction.
|
||||
|
||||
The tracking interface is identical to that of the race tracking API http://wiki.sapsailing.com/wiki/tracking-app-api-v1-draft#Send-Measurements-%28to-the-Fix-Store%29
|
||||
|
||||
**Path:** ``gpsFixes``
|
||||
**Path:** ``gps_fixes``
|
||||
|
||||
**Verb:** ``POST``
|
||||
|
||||
|
||||
Reference in New Issue
Block a user