mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-04 10:09:42 +00:00
upgrade to Android 4.4, set Java compiler level to 1.7 and fix deprecations
This commit is contained in:
1 parent
39652a942c
commit
37f57da934
21 files changed
+115
-58
No files matched your search
@@ -1,11 +1,12 @@
|
|||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
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.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.lineNumber=generate
|
||||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=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
|
||||||
@@ -3,6 +3,6 @@
|
|||||||
android:versionCode="1"
|
android:versionCode="1"
|
||||||
android:versionName="1.0">
|
android:versionName="1.0">
|
||||||
|
|
||||||
<uses-sdk android:minSdkVersion="13" android:targetSdkVersion="15" />
|
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="19" />
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
@@ -69,7 +69,7 @@
|
|||||||
<artifactId>android-maven-plugin</artifactId>
|
<artifactId>android-maven-plugin</artifactId>
|
||||||
<configuration>
|
<configuration>
|
||||||
<sdk>
|
<sdk>
|
||||||
<platform>13</platform>
|
<platform>19</platform>
|
||||||
</sdk>
|
</sdk>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|||||||
@@ -11,6 +11,6 @@
|
|||||||
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
|
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
|
||||||
|
|
||||||
# Project target.
|
# Project target.
|
||||||
target=android-13
|
target=android-19
|
||||||
android.library=true
|
android.library=true
|
||||||
|
|
||||||
+3
-1
@@ -35,7 +35,9 @@ public class ConnectivityChangedReceiver extends BroadcastReceiver {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
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())
|
if (!networkInfo.isConnected())
|
||||||
return;
|
return;
|
||||||
context.startService(MessageSendingService.createSendDelayedIntent(context));
|
context.startService(MessageSendingService.createSendDelayedIntent(context));
|
||||||
|
|||||||
+11
-8
@@ -4,6 +4,7 @@ import java.io.FileInputStream;
|
|||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.net.URLDecoder;
|
import java.net.URLDecoder;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -38,7 +39,7 @@ public class MessagePersistenceManager {
|
|||||||
return !persistedMessages.isEmpty();
|
return !persistedMessages.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void persistIntent(Intent intent) {
|
public void persistIntent(Intent intent) throws UnsupportedEncodingException {
|
||||||
Bundle extras = intent.getExtras();
|
Bundle extras = intent.getExtras();
|
||||||
String callbackPayload = extras.getString(MessageSendingService.CALLBACK_PAYLOAD);
|
String callbackPayload = extras.getString(MessageSendingService.CALLBACK_PAYLOAD);
|
||||||
String url = extras.getString(MessageSendingService.URL);
|
String url = extras.getString(MessageSendingService.URL);
|
||||||
@@ -47,7 +48,7 @@ public class MessagePersistenceManager {
|
|||||||
persistMessage(url, callbackPayload, payload, callbackClass);
|
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);
|
String messageLine = getSerializedIntentForPersistence(url, callbackPayload, payload, callbackClass);
|
||||||
ExLog.i(context, TAG, String.format("Persisting message \"%s\".", messageLine));
|
ExLog.i(context, TAG, String.format("Persisting message \"%s\".", messageLine));
|
||||||
if (persistedMessages.contains(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
|
* @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,
|
private String getSerializedIntentForPersistence(String url, String callbackPayload,
|
||||||
String payload, String callbackClass) {
|
String payload, String callbackClass) throws UnsupportedEncodingException {
|
||||||
String messageLine = String.format("%s;%s;%s;%s", callbackPayload, URLEncoder.encode(payload),
|
String messageLine = String.format("%s;%s;%s;%s", callbackPayload, URLEncoder.encode(payload,
|
||||||
|
MessageSendingService.charsetName),
|
||||||
url, callbackClass);
|
url, callbackClass);
|
||||||
return messageLine;
|
return messageLine;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeIntent(Intent intent) {
|
public void removeIntent(Intent intent) throws UnsupportedEncodingException {
|
||||||
Bundle extras = intent.getExtras();
|
Bundle extras = intent.getExtras();
|
||||||
String url = extras.getString(MessageSendingService.URL);
|
String url = extras.getString(MessageSendingService.URL);
|
||||||
String callbackPayload = extras.getString(MessageSendingService.CALLBACK_PAYLOAD);
|
String callbackPayload = extras.getString(MessageSendingService.CALLBACK_PAYLOAD);
|
||||||
@@ -76,7 +79,7 @@ public class MessagePersistenceManager {
|
|||||||
removeMessage(url, callbackPayload, payload, callbackClass);
|
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()) {
|
if (!persistedMessages.isEmpty()) {
|
||||||
ExLog.i(context, TAG, String.format("Removing message \"%s\".", payload));
|
ExLog.i(context, TAG, String.format("Removing message \"%s\".", payload));
|
||||||
String messageLine = getSerializedIntentForPersistence(url, callbackPayload, payload, callbackClass);
|
String messageLine = getSerializedIntentForPersistence(url, callbackPayload, payload, callbackClass);
|
||||||
@@ -112,13 +115,13 @@ public class MessagePersistenceManager {
|
|||||||
void restoreMessage(Context context, Intent messageIntent);
|
void restoreMessage(Context context, Intent messageIntent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Intent> restoreMessages() {
|
public List<Intent> restoreMessages() throws UnsupportedEncodingException {
|
||||||
List<Intent> delayedIntents = new ArrayList<Intent>();
|
List<Intent> delayedIntents = new ArrayList<Intent>();
|
||||||
for (String persistedMessage : persistedMessages) {
|
for (String persistedMessage : persistedMessages) {
|
||||||
String[] lineParts = persistedMessage.split(";");
|
String[] lineParts = persistedMessage.split(";");
|
||||||
String url = lineParts[2];
|
String url = lineParts[2];
|
||||||
String callbackPayload = lineParts[0];
|
String callbackPayload = lineParts[0];
|
||||||
String payload = URLDecoder.decode(lineParts[1]);
|
String payload = URLDecoder.decode(lineParts[1], MessageSendingService.charsetName);
|
||||||
String callbackClassString = lineParts[3];
|
String callbackClassString = lineParts[3];
|
||||||
|
|
||||||
Class<? extends ServerReplyCallback> callbackClass = null;
|
Class<? extends ServerReplyCallback> callbackClass = null;
|
||||||
|
|||||||
+29
-10
@@ -2,6 +2,7 @@ package com.sap.sailing.android.shared.services.sending;
|
|||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@@ -61,6 +62,8 @@ public class MessageSendingService extends Service implements MessageSendingList
|
|||||||
public final static String CALLBACK_CLASS = "callback";
|
public final static String CALLBACK_CLASS = "callback";
|
||||||
public final static String CALLBACK_PAYLOAD = "callbackPayload"; // passed back to callback
|
public final static String CALLBACK_PAYLOAD = "callbackPayload"; // passed back to callback
|
||||||
public final static String MESSAGE_ID = "messageId";
|
public final static String MESSAGE_ID = "messageId";
|
||||||
|
|
||||||
|
public static final String charsetName = "UTF=8";
|
||||||
|
|
||||||
protected final static String TAG = MessageSendingService.class.getName();
|
protected final static String TAG = MessageSendingService.class.getName();
|
||||||
|
|
||||||
@@ -225,7 +228,11 @@ public class MessageSendingService extends Service implements MessageSendingList
|
|||||||
ExLog.i(this, TAG, String.format("Trying to send a message..."));
|
ExLog.i(this, TAG, String.format("Trying to send a message..."));
|
||||||
if (!isConnected()) {
|
if (!isConnected()) {
|
||||||
ExLog.i(this, TAG, String.format("Send aborted because there is no connection."));
|
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);
|
ConnectivityChangedReceiver.enable(this);
|
||||||
serviceLogger.onMessageSentFailed();
|
serviceLogger.onMessageSentFailed();
|
||||||
} else {
|
} else {
|
||||||
@@ -246,10 +253,14 @@ public class MessageSendingService extends Service implements MessageSendingList
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void sendDelayedMessages() {
|
private void sendDelayedMessages() {
|
||||||
List<Intent> delayedIntents = persistenceManager.restoreMessages();
|
try {
|
||||||
ExLog.i(this, TAG, String.format("Resending %d messages...", delayedIntents.size()));
|
List<Intent> delayedIntents = persistenceManager.restoreMessages();
|
||||||
for (Intent intent : delayedIntents) {
|
ExLog.i(this, TAG, String.format("Resending %d messages...", delayedIntents.size()));
|
||||||
sendMessage(intent);
|
for (Intent intent : delayedIntents) {
|
||||||
|
sendMessage(intent);
|
||||||
|
}
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
ExLog.e(this, TAG, "Could not restore messages (unsupported encoding)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -276,7 +287,11 @@ public class MessageSendingService extends Service implements MessageSendingList
|
|||||||
R.integer.preference_messageResendIntervalMillis_default);
|
R.integer.preference_messageResendIntervalMillis_default);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
ExLog.w(this, TAG, "Error while posting intent to server. Will persist intent...");
|
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) {
|
if (!isHandlerSet) {
|
||||||
SendDelayedMessagesCaller delayedCaller = new SendDelayedMessagesCaller(this);
|
SendDelayedMessagesCaller delayedCaller = new SendDelayedMessagesCaller(this);
|
||||||
handler.postDelayed(delayedCaller, resendMillis); // after 30 sec, try the sending again
|
handler.postDelayed(delayedCaller, resendMillis); // after 30 sec, try the sending again
|
||||||
@@ -286,7 +301,11 @@ public class MessageSendingService extends Service implements MessageSendingList
|
|||||||
} else {
|
} else {
|
||||||
ExLog.i(this, TAG, "Message successfully sent.");
|
ExLog.i(this, TAG, "Message successfully sent.");
|
||||||
if (persistenceManager.areIntentsDelayed()) {
|
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();
|
lastSuccessfulSend = Calendar.getInstance().getTime();
|
||||||
serviceLogger.onMessageSentSuccessful();
|
serviceLogger.onMessageSentSuccessful();
|
||||||
@@ -327,15 +346,15 @@ public class MessageSendingService extends Service implements MessageSendingList
|
|||||||
public final static UUID uuid = UUID.randomUUID();
|
public final static UUID uuid = UUID.randomUUID();
|
||||||
|
|
||||||
public static String getRaceLogEventSendAndReceiveUrl(Context context, final String raceGroupName,
|
public static String getRaceLogEventSendAndReceiveUrl(Context context, final String raceGroupName,
|
||||||
final String raceName, final String fleetName) {
|
final String raceName, final String fleetName) throws UnsupportedEncodingException {
|
||||||
String url = String.format("%s/sailingserver/rc/racelog?"+
|
String url = String.format("%s/sailingserver/rc/racelog?"+
|
||||||
RaceLogServletConstants.PARAMS_LEADERBOARD_NAME+"=%s&"+
|
RaceLogServletConstants.PARAMS_LEADERBOARD_NAME+"=%s&"+
|
||||||
RaceLogServletConstants.PARAMS_RACE_COLUMN_NAME+"=%s&"+
|
RaceLogServletConstants.PARAMS_RACE_COLUMN_NAME+"=%s&"+
|
||||||
RaceLogServletConstants.PARAMS_RACE_FLEET_NAME+"=%s&"+
|
RaceLogServletConstants.PARAMS_RACE_FLEET_NAME+"=%s&"+
|
||||||
RaceLogServletConstants.PARAMS_CLIENT_UUID+"=%s",
|
RaceLogServletConstants.PARAMS_CLIENT_UUID+"=%s",
|
||||||
PrefUtils.getString(context, R.string.preference_server_url_key, R.string.preference_server_url_default),
|
PrefUtils.getString(context, R.string.preference_server_url_key, R.string.preference_server_url_default),
|
||||||
URLEncoder.encode(raceGroupName),
|
URLEncoder.encode(raceGroupName, charsetName),
|
||||||
URLEncoder.encode(raceName), URLEncoder.encode(fleetName), uuid);
|
URLEncoder.encode(raceName, charsetName), URLEncoder.encode(fleetName, charsetName), uuid);
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,12 @@
|
|||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
||||||
org.eclipse.jdt.core.compiler.source=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.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
|
||||||
@@ -5,8 +5,8 @@
|
|||||||
android:versionName="1 - Altitude" >
|
android:versionName="1 - Altitude" >
|
||||||
|
|
||||||
<uses-sdk
|
<uses-sdk
|
||||||
android:minSdkVersion="13"
|
android:minSdkVersion="19"
|
||||||
android:targetSdkVersion="20" />
|
android:targetSdkVersion="21" />
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
|
|||||||
@@ -11,6 +11,6 @@
|
|||||||
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
|
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
|
||||||
|
|
||||||
# Project target.
|
# 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.1=../google-play-services_lib
|
||||||
android.library.reference.2=../com.sap.sailing.android.shared
|
android.library.reference.2=../com.sap.sailing.android.shared
|
||||||
+8
-2
@@ -144,11 +144,17 @@ public class TrackingService extends Service implements ConnectionCallbacks, OnC
|
|||||||
|
|
||||||
private void showNotification() {
|
private void showNotification() {
|
||||||
CharSequence text = getText(R.string.tracker_started);
|
CharSequence text = getText(R.string.tracker_started);
|
||||||
Notification notification = new Notification(R.drawable.icon, text, System.currentTimeMillis());
|
|
||||||
Intent i = new Intent(this, LaunchActivity.class);
|
Intent i = new Intent(this, LaunchActivity.class);
|
||||||
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||||
PendingIntent pi = PendingIntent.getActivity(this, 0, i, 0);
|
PendingIntent pi = PendingIntent.getActivity(this, 0, i, 0);
|
||||||
notification.setLatestEventInfo(this, getText(R.string.app_name), text, pi);
|
Notification notification = new Notification.Builder(this)
|
||||||
|
.setSmallIcon(R.drawable.icon)
|
||||||
|
.setTicker(text)
|
||||||
|
.setWhen(System.currentTimeMillis())
|
||||||
|
.setContentTitle(getText(R.string.app_name))
|
||||||
|
.setContentText(text)
|
||||||
|
.setContentIntent(pi)
|
||||||
|
.build();
|
||||||
notification.flags |= Notification.FLAG_NO_CLEAR;
|
notification.flags |= Notification.FLAG_NO_CLEAR;
|
||||||
startForeground(NOTIFICATION_ID, notification);
|
startForeground(NOTIFICATION_ID, notification);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,12 @@
|
|||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
||||||
org.eclipse.jdt.core.compiler.source=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.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"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.sap.sailing.racecommittee.app"
|
package="com.sap.sailing.racecommittee.app"
|
||||||
android:versionCode="6"
|
android:versionCode="6"
|
||||||
android:versionName="6 - Laser" >
|
android:versionName="6 - Laser" xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
<uses-sdk
|
<uses-sdk
|
||||||
android:maxSdkVersion="17"
|
android:minSdkVersion="19"
|
||||||
android:minSdkVersion="13"
|
android:targetSdkVersion="19" tools:ignore="OldTargetApi"/>
|
||||||
android:targetSdkVersion="17" />
|
|
||||||
|
|
||||||
<permission
|
<permission
|
||||||
android:name="com.sap.sailing.racecommittee.app.MAPS_RECEIVE"
|
android:name="com.sap.sailing.racecommittee.app.MAPS_RECEIVE"
|
||||||
|
|||||||
@@ -11,6 +11,6 @@
|
|||||||
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
|
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
|
||||||
|
|
||||||
# Project target.
|
# 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.1=../google-play-services_lib
|
||||||
android.library.reference.2=../com.sap.sailing.android.shared
|
android.library.reference.2=../com.sap.sailing.android.shared
|
||||||
+10
-10
@@ -162,9 +162,9 @@ public class OnlineDataManager extends DataManager {
|
|||||||
|
|
||||||
ManagedRaceIdentifier identifier = managedRace.getIdentifier();
|
ManagedRaceIdentifier identifier = managedRace.getIdentifier();
|
||||||
|
|
||||||
String raceGroupName = URLEncoder.encode(identifier.getRaceGroup().getName());
|
String raceGroupName = URLEncoder.encode(identifier.getRaceGroup().getName(), MessageSendingService.charsetName);
|
||||||
String raceColumnName = URLEncoder.encode(identifier.getRaceName());
|
String raceColumnName = URLEncoder.encode(identifier.getRaceName(), MessageSendingService.charsetName);
|
||||||
String fleetName = URLEncoder.encode(identifier.getFleet().getName());
|
String fleetName = URLEncoder.encode(identifier.getFleet().getName(), MessageSendingService.charsetName);
|
||||||
|
|
||||||
return new OnlineDataLoader<Collection<Mark>>(context, new URL(preferences.getServerBaseURL() +
|
return new OnlineDataLoader<Collection<Mark>>(context, new URL(preferences.getServerBaseURL() +
|
||||||
"/sailingserver/rc/marks?"+RaceLogServletConstants.PARAMS_LEADERBOARD_NAME + "=" + raceGroupName +
|
"/sailingserver/rc/marks?"+RaceLogServletConstants.PARAMS_LEADERBOARD_NAME + "=" + raceGroupName +
|
||||||
@@ -188,9 +188,9 @@ public class OnlineDataManager extends DataManager {
|
|||||||
|
|
||||||
ManagedRaceIdentifier identifier = managedRace.getIdentifier();
|
ManagedRaceIdentifier identifier = managedRace.getIdentifier();
|
||||||
|
|
||||||
String raceGroupName = URLEncoder.encode(identifier.getRaceGroup().getName());
|
String raceGroupName = URLEncoder.encode(identifier.getRaceGroup().getName(), MessageSendingService.charsetName);
|
||||||
String raceColumnName = URLEncoder.encode(identifier.getRaceName());
|
String raceColumnName = URLEncoder.encode(identifier.getRaceName(), MessageSendingService.charsetName);
|
||||||
String fleetName = URLEncoder.encode(identifier.getFleet().getName());
|
String fleetName = URLEncoder.encode(identifier.getFleet().getName(), MessageSendingService.charsetName);
|
||||||
|
|
||||||
return new OnlineDataLoader<CourseBase>(context, new URL(preferences.getServerBaseURL()
|
return new OnlineDataLoader<CourseBase>(context, new URL(preferences.getServerBaseURL()
|
||||||
+ "/sailingserver/rc/currentcourse?" + RaceLogServletConstants.PARAMS_LEADERBOARD_NAME + "="
|
+ "/sailingserver/rc/currentcourse?" + RaceLogServletConstants.PARAMS_LEADERBOARD_NAME + "="
|
||||||
@@ -216,9 +216,9 @@ public class OnlineDataManager extends DataManager {
|
|||||||
|
|
||||||
ManagedRaceIdentifier identifier = managedRace.getIdentifier();
|
ManagedRaceIdentifier identifier = managedRace.getIdentifier();
|
||||||
|
|
||||||
String raceGroupName = URLEncoder.encode(identifier.getRaceGroup().getName());
|
String raceGroupName = URLEncoder.encode(identifier.getRaceGroup().getName(), MessageSendingService.charsetName);
|
||||||
String raceColumnName = URLEncoder.encode(identifier.getRaceName());
|
String raceColumnName = URLEncoder.encode(identifier.getRaceName(), MessageSendingService.charsetName);
|
||||||
String fleetName = URLEncoder.encode(identifier.getFleet().getName());
|
String fleetName = URLEncoder.encode(identifier.getFleet().getName(), MessageSendingService.charsetName);
|
||||||
|
|
||||||
return new OnlineDataLoader<Collection<Competitor>>(context, new URL(
|
return new OnlineDataLoader<Collection<Competitor>>(context, new URL(
|
||||||
preferences.getServerBaseURL() + "/sailingserver/rc/competitors?"
|
preferences.getServerBaseURL() + "/sailingserver/rc/competitors?"
|
||||||
@@ -240,7 +240,7 @@ public class OnlineDataManager extends DataManager {
|
|||||||
DataHandler<DeviceConfiguration> handler = new NullDataHandler<DeviceConfiguration>();
|
DataHandler<DeviceConfiguration> handler = new NullDataHandler<DeviceConfiguration>();
|
||||||
DataParser<DeviceConfiguration> parser = new DeviceConfigurationParser(DeviceConfigurationJsonDeserializer.create());
|
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");
|
encodedIdentifier = encodedIdentifier.replace("+", "%20");
|
||||||
|
|
||||||
return new OnlineDataLoader<DeviceConfiguration>(
|
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.InputStream;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -64,12 +65,12 @@ public class RaceLogPoller implements PollingActiveChangedListener {
|
|||||||
this.hasRacesToPoll = true;
|
this.hasRacesToPoll = true;
|
||||||
ExLog.i(context, TAG, String.format("Registered race %s for polling, will start in %d milliseconds.", race.getId(),
|
ExLog.i(context, TAG, String.format("Registered race %s for polling, will start in %d milliseconds.", race.getId(),
|
||||||
pollingInterval));
|
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()));
|
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(),
|
return new URL(MessageSendingService.getRaceLogEventSendAndReceiveUrl(context, race.getRaceGroup().getName(),
|
||||||
race.getName(), race.getFleet().getName()));
|
race.getName(), race.getFleet().getName()));
|
||||||
}
|
}
|
||||||
|
|||||||
+1
@@ -27,6 +27,7 @@ public class RaceLogPollerTask extends AsyncTask<Util.Pair<Serializable, URL>, P
|
|||||||
this.context = context;
|
this.context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
protected Void doInBackground(Util.Pair<Serializable, URL>... queries) {
|
protected Void doInBackground(Util.Pair<Serializable, URL>... queries) {
|
||||||
for (Util.Pair<Serializable, URL> query : queries) {
|
for (Util.Pair<Serializable, URL> query : queries) {
|
||||||
|
|||||||
+2
-1
@@ -1,6 +1,7 @@
|
|||||||
package com.sap.sailing.racecommittee.app.services.sending;
|
package com.sap.sailing.racecommittee.app.services.sending;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@@ -25,7 +26,7 @@ public class EventSendingServiceUtil {
|
|||||||
* @return the intent that shall be sent to the EventSendingService
|
* @return the intent that shall be sent to the EventSendingService
|
||||||
*/
|
*/
|
||||||
public static Intent createEventIntent(Context context, ManagedRace race, Serializable eventId, String serializedEventAsJson,
|
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,
|
String url = MessageSendingService.getRaceLogEventSendAndReceiveUrl(context,
|
||||||
race.getRaceGroup().getName(), race.getName(), race.getFleet().getName());
|
race.getRaceGroup().getName(), race.getName(), race.getFleet().getName());
|
||||||
return MessageSendingService.createMessageIntent(context, url, race.getId(), eventId, serializedEventAsJson, callbackClass);
|
return MessageSendingService.createMessageIntent(context, url, race.getId(), eventId, serializedEventAsJson, callbackClass);
|
||||||
|
|||||||
+10
-2
@@ -1,9 +1,12 @@
|
|||||||
package com.sap.sailing.racecommittee.app.services.sending;
|
package com.sap.sailing.racecommittee.app.services.sending;
|
||||||
|
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
|
||||||
import org.json.simple.JSONObject;
|
import org.json.simple.JSONObject;
|
||||||
|
|
||||||
import android.app.Service;
|
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.RaceLogChangedListener;
|
||||||
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
import com.sap.sailing.domain.abstractlog.race.RaceLogEvent;
|
||||||
import com.sap.sailing.racecommittee.app.domain.ManagedRace;
|
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;
|
import com.sap.sailing.server.gateway.serialization.JsonSerializer;
|
||||||
|
|
||||||
public class RaceEventSender implements RaceLogChangedListener {
|
public class RaceEventSender implements RaceLogChangedListener {
|
||||||
|
private static final String TAG = RaceEventSender.class.getName();
|
||||||
|
|
||||||
private final Service service;
|
private final Service service;
|
||||||
private final JsonSerializer<RaceLogEvent> serializer;
|
private final JsonSerializer<RaceLogEvent> serializer;
|
||||||
@@ -25,7 +29,11 @@ public class RaceEventSender implements RaceLogChangedListener {
|
|||||||
@Override
|
@Override
|
||||||
public void eventAdded(RaceLogEvent event) {
|
public void eventAdded(RaceLogEvent event) {
|
||||||
JSONObject serializedEvent = serializer.serialize(event);
|
JSONObject serializedEvent = serializer.serialize(event);
|
||||||
service.startService(EventSendingServiceUtil.createEventIntent(service, race, event.getId(),
|
try {
|
||||||
serializedEvent.toJSONString(), RaceLogEventsCallback.class));
|
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.
|
// underlying surface is created and destroyed.
|
||||||
surfaceHolder = getHolder();
|
surfaceHolder = getHolder();
|
||||||
surfaceHolder.addCallback(this);
|
surfaceHolder.addCallback(this);
|
||||||
surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void snap(final PictureCallback pictureHandler) {
|
public void snap(final PictureCallback pictureHandler) {
|
||||||
|
|||||||
+2
-1
@@ -44,7 +44,8 @@ public class AutoUpdaterChecker {
|
|||||||
this.dialog = new ProgressDialog(context);
|
this.dialog = new ProgressDialog(context);
|
||||||
dialog.setTitle(context.getString(R.string.auto_update));
|
dialog.setTitle(context.getString(R.string.auto_update));
|
||||||
dialog.setCancelable(true);
|
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
|
@Override
|
||||||
public void onClick(DialogInterface arg0, int arg1) {
|
public void onClick(DialogInterface arg0, int arg1) {
|
||||||
dialog.cancel();
|
dialog.cancel();
|
||||||
|
|||||||
Reference in new issue
Block a user