mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-16 07:10:48 +00:00
only CR/LF changes due to git config change
Change-Id: I0a8649611c2ed63c772b9c37ad89b88eed5a4e96
This commit is contained in:
1 parent
d5dc2fdbc2
commit
3f92520125
10 files changed
+796
-796
No files matched your search
@@ -1,65 +1,65 @@
|
||||
/*
|
||||
* Side.java
|
||||
* Copyright (C) 2014 Lázár József
|
||||
*
|
||||
* This file is part of Java Marine API.
|
||||
* <http://ktuukkan.github.io/marine-api/>
|
||||
*
|
||||
* Java Marine API is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* Java Marine API is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Java Marine API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package net.sf.marineapi.nmea.util;
|
||||
|
||||
/**
|
||||
* Defines the sides of a boat, i.e. "port" and "starboard".
|
||||
*
|
||||
* @author Lázár József
|
||||
*/
|
||||
public enum Side {
|
||||
|
||||
/** Port */
|
||||
PORT('P'),
|
||||
|
||||
/** Right */
|
||||
STARBOARD('S');
|
||||
|
||||
private char ch;
|
||||
|
||||
private Side(char c) {
|
||||
ch = c;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the corresponding char constant.
|
||||
*
|
||||
* @return Char indicator for Direction
|
||||
*/
|
||||
public char toChar() {
|
||||
return ch;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the enum corresponding to specified char.
|
||||
*
|
||||
* @param c Char indicator for Side
|
||||
* @return Side
|
||||
*/
|
||||
public static Side valueOf(char c) {
|
||||
for (Side d : values()) {
|
||||
if (d.toChar() == c) {
|
||||
return d;
|
||||
}
|
||||
}
|
||||
return valueOf(String.valueOf(c));
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Side.java
|
||||
* Copyright (C) 2014 Lázár József
|
||||
*
|
||||
* This file is part of Java Marine API.
|
||||
* <http://ktuukkan.github.io/marine-api/>
|
||||
*
|
||||
* Java Marine API is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* Java Marine API is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Java Marine API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package net.sf.marineapi.nmea.util;
|
||||
|
||||
/**
|
||||
* Defines the sides of a boat, i.e. "port" and "starboard".
|
||||
*
|
||||
* @author Lázár József
|
||||
*/
|
||||
public enum Side {
|
||||
|
||||
/** Port */
|
||||
PORT('P'),
|
||||
|
||||
/** Right */
|
||||
STARBOARD('S');
|
||||
|
||||
private char ch;
|
||||
|
||||
private Side(char c) {
|
||||
ch = c;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the corresponding char constant.
|
||||
*
|
||||
* @return Char indicator for Direction
|
||||
*/
|
||||
public char toChar() {
|
||||
return ch;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the enum corresponding to specified char.
|
||||
*
|
||||
* @param c Char indicator for Side
|
||||
* @return Side
|
||||
*/
|
||||
public static Side valueOf(char c) {
|
||||
for (Side d : values()) {
|
||||
if (d.toChar() == c) {
|
||||
return d;
|
||||
}
|
||||
}
|
||||
return valueOf(String.valueOf(c));
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head></head>
|
||||
<body>
|
||||
Utilities and helper classes for handling the data extracted from NMEA sentences.
|
||||
</body>
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head></head>
|
||||
<body>
|
||||
Utilities and helper classes for handling the data extracted from NMEA sentences.
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,80 +1,80 @@
|
||||
/*
|
||||
* HeadingProvider.java
|
||||
* Copyright (C) 2012 Kimmo Tuukkanen
|
||||
*
|
||||
* This file is part of Java Marine API.
|
||||
* <http://ktuukkan.github.io/marine-api/>
|
||||
*
|
||||
* Java Marine API is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* Java Marine API is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Java Marine API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package net.sf.marineapi.provider;
|
||||
|
||||
import net.sf.marineapi.nmea.io.SentenceReader;
|
||||
import net.sf.marineapi.nmea.sentence.HeadingSentence;
|
||||
import net.sf.marineapi.nmea.sentence.Sentence;
|
||||
import net.sf.marineapi.nmea.sentence.SentenceId;
|
||||
import net.sf.marineapi.provider.event.HeadingEvent;
|
||||
|
||||
/**
|
||||
* Heading provider reports the vessel's current heading. Data is captured from
|
||||
* HDT, HDM or HDG sentences.
|
||||
*
|
||||
* @author Kimmo Tuukkanen
|
||||
* @see net.sf.marineapi.provider.event.HeadingEvent
|
||||
* @see net.sf.marineapi.provider.event.HeadingListener
|
||||
*/
|
||||
public class HeadingProvider extends AbstractProvider<HeadingEvent> {
|
||||
|
||||
/**
|
||||
* Creates a new intance of HeadingProvider.
|
||||
*
|
||||
* @param reader Reader for capturing heading sentences.
|
||||
*/
|
||||
public HeadingProvider(SentenceReader reader) {
|
||||
super(reader, SentenceId.HDT, SentenceId.HDM, SentenceId.HDG);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see net.sf.marineapi.provider.AbstractProvider#createEvent()
|
||||
*/
|
||||
@Override
|
||||
protected HeadingEvent createProviderEvent() {
|
||||
for (Sentence s : getSentences()) {
|
||||
if (s instanceof HeadingSentence) {
|
||||
return new HeadingEvent(this, (HeadingSentence) s);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see net.sf.marineapi.provider.AbstractProvider#isReady()
|
||||
*/
|
||||
@Override
|
||||
protected boolean isReady() {
|
||||
return hasOne("HDT", "HDM", "HDG");
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see net.sf.marineapi.provider.AbstractProvider#isValid()
|
||||
*/
|
||||
@Override
|
||||
protected boolean isValid() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
* HeadingProvider.java
|
||||
* Copyright (C) 2012 Kimmo Tuukkanen
|
||||
*
|
||||
* This file is part of Java Marine API.
|
||||
* <http://ktuukkan.github.io/marine-api/>
|
||||
*
|
||||
* Java Marine API is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* Java Marine API is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Java Marine API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package net.sf.marineapi.provider;
|
||||
|
||||
import net.sf.marineapi.nmea.io.SentenceReader;
|
||||
import net.sf.marineapi.nmea.sentence.HeadingSentence;
|
||||
import net.sf.marineapi.nmea.sentence.Sentence;
|
||||
import net.sf.marineapi.nmea.sentence.SentenceId;
|
||||
import net.sf.marineapi.provider.event.HeadingEvent;
|
||||
|
||||
/**
|
||||
* Heading provider reports the vessel's current heading. Data is captured from
|
||||
* HDT, HDM or HDG sentences.
|
||||
*
|
||||
* @author Kimmo Tuukkanen
|
||||
* @see net.sf.marineapi.provider.event.HeadingEvent
|
||||
* @see net.sf.marineapi.provider.event.HeadingListener
|
||||
*/
|
||||
public class HeadingProvider extends AbstractProvider<HeadingEvent> {
|
||||
|
||||
/**
|
||||
* Creates a new intance of HeadingProvider.
|
||||
*
|
||||
* @param reader Reader for capturing heading sentences.
|
||||
*/
|
||||
public HeadingProvider(SentenceReader reader) {
|
||||
super(reader, SentenceId.HDT, SentenceId.HDM, SentenceId.HDG);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see net.sf.marineapi.provider.AbstractProvider#createEvent()
|
||||
*/
|
||||
@Override
|
||||
protected HeadingEvent createProviderEvent() {
|
||||
for (Sentence s : getSentences()) {
|
||||
if (s instanceof HeadingSentence) {
|
||||
return new HeadingEvent(this, (HeadingSentence) s);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see net.sf.marineapi.provider.AbstractProvider#isReady()
|
||||
*/
|
||||
@Override
|
||||
protected boolean isReady() {
|
||||
return hasOne("HDT", "HDM", "HDG");
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see net.sf.marineapi.provider.AbstractProvider#isValid()
|
||||
*/
|
||||
@Override
|
||||
protected boolean isValid() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,72 +1,72 @@
|
||||
/*
|
||||
* HeadingEvent.java
|
||||
* Copyright (C) 2012 Kimmo Tuukkanen
|
||||
*
|
||||
* This file is part of Java Marine API.
|
||||
* <http://ktuukkan.github.io/marine-api/>
|
||||
*
|
||||
* Java Marine API is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* Java Marine API is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Java Marine API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package net.sf.marineapi.provider.event;
|
||||
|
||||
import net.sf.marineapi.nmea.sentence.HeadingSentence;
|
||||
|
||||
/**
|
||||
* HeadingProvider event, reports the current magnetic/true heading of vessel in
|
||||
* degrees.
|
||||
*
|
||||
* @author Kimmo Tuukkanen
|
||||
* @see net.sf.marineapi.provider.HeadingProvider
|
||||
*/
|
||||
public class HeadingEvent extends ProviderEvent {
|
||||
|
||||
private static final long serialVersionUID = 5706774741081575448L;
|
||||
private double heading;
|
||||
private boolean isTrue;
|
||||
|
||||
/**
|
||||
* @param source
|
||||
*/
|
||||
public HeadingEvent(Object source, HeadingSentence s) {
|
||||
super(source);
|
||||
heading = s.getHeading();
|
||||
isTrue = s.isTrue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current heading.
|
||||
*
|
||||
* @return Heading in degrees.
|
||||
*/
|
||||
public double getHeading() {
|
||||
return heading;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tells if the heading is relative to true or magnetic north.
|
||||
*
|
||||
* @return true if true heading, otherwise false (magnetic).
|
||||
*/
|
||||
public boolean isTrue() {
|
||||
return isTrue;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see java.util.EventObject#toString()
|
||||
*/
|
||||
public String toString() {
|
||||
return "[" + getHeading() + ", " + (isTrue() ? "T" : "M") + "]";
|
||||
}
|
||||
}
|
||||
/*
|
||||
* HeadingEvent.java
|
||||
* Copyright (C) 2012 Kimmo Tuukkanen
|
||||
*
|
||||
* This file is part of Java Marine API.
|
||||
* <http://ktuukkan.github.io/marine-api/>
|
||||
*
|
||||
* Java Marine API is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* Java Marine API is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Java Marine API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package net.sf.marineapi.provider.event;
|
||||
|
||||
import net.sf.marineapi.nmea.sentence.HeadingSentence;
|
||||
|
||||
/**
|
||||
* HeadingProvider event, reports the current magnetic/true heading of vessel in
|
||||
* degrees.
|
||||
*
|
||||
* @author Kimmo Tuukkanen
|
||||
* @see net.sf.marineapi.provider.HeadingProvider
|
||||
*/
|
||||
public class HeadingEvent extends ProviderEvent {
|
||||
|
||||
private static final long serialVersionUID = 5706774741081575448L;
|
||||
private double heading;
|
||||
private boolean isTrue;
|
||||
|
||||
/**
|
||||
* @param source
|
||||
*/
|
||||
public HeadingEvent(Object source, HeadingSentence s) {
|
||||
super(source);
|
||||
heading = s.getHeading();
|
||||
isTrue = s.isTrue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current heading.
|
||||
*
|
||||
* @return Heading in degrees.
|
||||
*/
|
||||
public double getHeading() {
|
||||
return heading;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tells if the heading is relative to true or magnetic north.
|
||||
*
|
||||
* @return true if true heading, otherwise false (magnetic).
|
||||
*/
|
||||
public boolean isTrue() {
|
||||
return isTrue;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see java.util.EventObject#toString()
|
||||
*/
|
||||
public String toString() {
|
||||
return "[" + getHeading() + ", " + (isTrue() ? "T" : "M") + "]";
|
||||
}
|
||||
}
|
||||
@@ -1,37 +1,37 @@
|
||||
/*
|
||||
* HeadingListener.java
|
||||
* Copyright (C) 2012 Kimmo Tuukkanen
|
||||
*
|
||||
* This file is part of Java Marine API.
|
||||
* <http://ktuukkan.github.io/marine-api/>
|
||||
*
|
||||
* Java Marine API is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* Java Marine API is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Java Marine API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package net.sf.marineapi.provider.event;
|
||||
|
||||
/**
|
||||
* Listener interface for {@link net.sf.marineapi.provider.HeadingProvider}.
|
||||
*
|
||||
* @author Kimmo Tuukkanen
|
||||
*/
|
||||
public interface HeadingListener extends ProviderListener<HeadingEvent> {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see
|
||||
* net.sf.marineapi.provider.event.ProviderListener#providerUpdate(net.sf
|
||||
* .marineapi.provider.event.ProviderEvent)
|
||||
*/
|
||||
public void providerUpdate(HeadingEvent evt);
|
||||
}
|
||||
/*
|
||||
* HeadingListener.java
|
||||
* Copyright (C) 2012 Kimmo Tuukkanen
|
||||
*
|
||||
* This file is part of Java Marine API.
|
||||
* <http://ktuukkan.github.io/marine-api/>
|
||||
*
|
||||
* Java Marine API is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* Java Marine API is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Java Marine API. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package net.sf.marineapi.provider.event;
|
||||
|
||||
/**
|
||||
* Listener interface for {@link net.sf.marineapi.provider.HeadingProvider}.
|
||||
*
|
||||
* @author Kimmo Tuukkanen
|
||||
*/
|
||||
public interface HeadingListener extends ProviderListener<HeadingEvent> {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see
|
||||
* net.sf.marineapi.provider.event.ProviderListener#providerUpdate(net.sf
|
||||
* .marineapi.provider.event.ProviderEvent)
|
||||
*/
|
||||
public void providerUpdate(HeadingEvent evt);
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head></head>
|
||||
<body>
|
||||
Contains event classes and listener interfaces for Providers.
|
||||
</body>
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head></head>
|
||||
<body>
|
||||
Contains event classes and listener interfaces for Providers.
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,8 +1,8 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head></head>
|
||||
<body>
|
||||
<p>
|
||||
Higher-level APIs that provide data value updates for selected measurements.
|
||||
</body>
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head></head>
|
||||
<body>
|
||||
<p>
|
||||
Higher-level APIs that provide data value updates for selected measurements.
|
||||
</body>
|
||||
</html>
|
||||
+96
-96
@@ -1,96 +1,96 @@
|
||||
package com.sap.sailing.racecommittee.app;
|
||||
|
||||
public class AppConstants {
|
||||
|
||||
//TODO replace it later with BuildConfig.APPLICATION_ID (Eclipse didn't know it)
|
||||
private final static String PACKAGE_NAME = "com.sap.sailing.racecommittee.app";
|
||||
|
||||
// Intent extra fields
|
||||
public final static String COURSE_AREA_UUID_KEY = "courseUuid";
|
||||
public final static String INTENT_EXTRA_RACE_ID = PACKAGE_NAME + ".raceUuid";
|
||||
public final static String INTENT_EXTRA_TIMEPOINT_MILLIS = PACKAGE_NAME + ".timePoint.millis";
|
||||
public final static String INTENT_EXTRA_EVENTNAME = PACKAGE_NAME + ".eventName";
|
||||
public final static String FLAG_KEY = PACKAGE_NAME + ".raceFlag";
|
||||
public final static String EXTRA_FORCE_REFRESH = PACKAGE_NAME + ".forceRefresh";
|
||||
|
||||
public final static String AUTHOR_TYPE_OFFICER_START = "Race Officer on Start Vessel";
|
||||
public final static String AUTHOR_TYPE_OFFICER_FINISH = "Race Officer on Finish Vessel";
|
||||
public final static String AUTHOR_TYPE_SHORE_CONTROL = "Shore Control";
|
||||
public final static String AUTHOR_TYPE_VIEWER = "Viewer";
|
||||
|
||||
public final static String DARK_THEME = "dark";
|
||||
public final static String LIGHT_THEME = "light";
|
||||
|
||||
private final static String INTENT_ACTION = PACKAGE_NAME + ".action";
|
||||
public final static String INTENT_ACTION_RESET = INTENT_ACTION + ".reset";
|
||||
public final static String INTENT_ACTION_CLEAR_RACES = INTENT_ACTION + ".clearRaces";
|
||||
public final static String INTENT_ACTION_CLEANUP_RACES = INTENT_ACTION + ".cleanupRaces";
|
||||
public final static String INTENT_ACTION_ALARM_ACTION = INTENT_ACTION + ".alarmAction";
|
||||
public final static String INTENT_ACTION_RELOAD_RACES = INTENT_ACTION + ".reloadRaces";
|
||||
public final static String INTENT_ACTION_START_PROCEDURE_SPECIFIC_ACTION = INTENT_ACTION + ".startProcedureSpecificAction";
|
||||
|
||||
public final static String INTENT_ACTION_POLLING_STOP = ".stopPolling";
|
||||
public final static String INTENT_ACTION_POLLING_RACE_ADD = ".addRace";
|
||||
public final static String INTENT_ACTION_POLLING_RACE_REMOVE = ".removeRace";
|
||||
public final static String INTENT_ACTION_POLLING_POLL = ".poll";
|
||||
|
||||
// Login activity
|
||||
public final static String EventIdTag = "EventId";
|
||||
|
||||
public static final int DefaultStartTimeMinuteOffset = 10;
|
||||
|
||||
// Inner process events
|
||||
public final static String INTENT_ACTION_TOGGLE = PACKAGE_NAME + ".action.toggle";
|
||||
|
||||
public final static String INTENT_ACTION_EXTRA = PACKAGE_NAME + ".extra";
|
||||
public final static String INTENT_ACTION_TOGGLE_PROCEDURE = "procedure";
|
||||
public final static String INTENT_ACTION_TOGGLE_PROCEDURE_MORE_MODE = "more_mode";
|
||||
public final static String INTENT_ACTION_TOGGLE_PROCEDURE_MORE_PATHFINDER = "more_pathfinder";
|
||||
public final static String INTENT_ACTION_TOGGLE_PROCEDURE_MORE_TIMING = "more_timing";
|
||||
public final static String INTENT_ACTION_TOGGLE_FACTOR = "factor";
|
||||
public final static String INTENT_ACTION_TOGGLE_COURSE = "course";
|
||||
public final static String INTENT_ACTION_TOGGLE_WIND = "wind";
|
||||
public final static String INTENT_ACTION_TOGGLE_TIME = "time";
|
||||
public final static String INTENT_ACTION_TOGGLE_POSTPONE = "postpone";
|
||||
public final static String INTENT_ACTION_TOGGLE_ABANDON = "abandon";
|
||||
public final static String INTENT_ACTION_TOGGLE_RECALL = "recall";
|
||||
public final static String INTENT_ACTION_TOGGLE_BLUE_FIRST = "more";
|
||||
public final static String INTENT_ACTION_TOGGLE_BLUE_LAST = "blue_last";
|
||||
|
||||
public final static String INTENT_ACTION_TOGGLE_REPLAY = "replay";
|
||||
public final static String INTENT_ACTION_TOGGLE_PHOTOS = "photos";
|
||||
public final static String INTENT_ACTION_TOGGLE_LIST = "list";
|
||||
|
||||
public final static String INTENT_ACTION_TOGGLE_EVENT = "event";
|
||||
public final static String INTENT_ACTION_TOGGLE_AREA = "area";
|
||||
public final static String INTENT_ACTION_TOGGLE_POSITION = "position";
|
||||
|
||||
private final static String INTENT_ACTION_TIME = PACKAGE_NAME + "action.time";
|
||||
public final static String INTENT_ACTION_TIME_HIDE = INTENT_ACTION_TIME + ".hide";
|
||||
public final static String INTENT_ACTION_TIME_SHOW = INTENT_ACTION_TIME + ".show";
|
||||
|
||||
public final static String INTENT_ACTION_CHECK_LOGIN = "show_empty_screen";
|
||||
public final static String INTENT_ACTION_SHOW_ONBOARDING = "show_onboarding";
|
||||
public final static String INTENT_ACTION_SHOW_LOGIN = "show_login";
|
||||
public final static String INTENT_ACTION_VALID_DATA = "valid_data";
|
||||
public final static String INTENT_ACTION_SHOW_WELCOME = "show_welcome";
|
||||
|
||||
// clears all toggle buttons
|
||||
public final static String INTENT_ACTION_CLEAR_TOGGLE = PACKAGE_NAME + ".action.toggle.clear";
|
||||
|
||||
public final static String INTENT_ACTION_UPDATE_SCREEN = PACKAGE_NAME + ".action.update.screen";
|
||||
public final static String INTENT_ACTION_SHOW_MAIN_CONTENT = PACKAGE_NAME + ".action.show.main";
|
||||
public final static String INTENT_ACTION_SHOW_SUMMARY_CONTENT = PACKAGE_NAME + ".action.show.summary";
|
||||
|
||||
/**
|
||||
* As extra this intent expects the String obtained for a FilterableRace / ManagedRace using
|
||||
* {@code new RaceGroupSeries(race.getRaceGroup(), race.getSeries()).getDisplayName()}.
|
||||
*/
|
||||
public final static String INTENT_ACTION_SHOW_PROTEST = PACKAGE_NAME + ".action.show.protest";
|
||||
public final static String INTENT_ACTION_REMOVE_PROTEST = PACKAGE_NAME + ".action.remove.protest";
|
||||
|
||||
public final static String INTENT_ACTION_IS_TRACKING = PACKAGE_NAME + "action.is.tracking";
|
||||
public final static String INTENT_ACTION_IS_TRACKING_EXTRA = PACKAGE_NAME + "action.is.tracking.extra";
|
||||
|
||||
public final static String GWT_MAP_AND_WIND_CHART_HTML = "gwt/EmbeddedMapAndWindChart.html";
|
||||
}
|
||||
package com.sap.sailing.racecommittee.app;
|
||||
|
||||
public class AppConstants {
|
||||
|
||||
//TODO replace it later with BuildConfig.APPLICATION_ID (Eclipse didn't know it)
|
||||
private final static String PACKAGE_NAME = "com.sap.sailing.racecommittee.app";
|
||||
|
||||
// Intent extra fields
|
||||
public final static String COURSE_AREA_UUID_KEY = "courseUuid";
|
||||
public final static String INTENT_EXTRA_RACE_ID = PACKAGE_NAME + ".raceUuid";
|
||||
public final static String INTENT_EXTRA_TIMEPOINT_MILLIS = PACKAGE_NAME + ".timePoint.millis";
|
||||
public final static String INTENT_EXTRA_EVENTNAME = PACKAGE_NAME + ".eventName";
|
||||
public final static String FLAG_KEY = PACKAGE_NAME + ".raceFlag";
|
||||
public final static String EXTRA_FORCE_REFRESH = PACKAGE_NAME + ".forceRefresh";
|
||||
|
||||
public final static String AUTHOR_TYPE_OFFICER_START = "Race Officer on Start Vessel";
|
||||
public final static String AUTHOR_TYPE_OFFICER_FINISH = "Race Officer on Finish Vessel";
|
||||
public final static String AUTHOR_TYPE_SHORE_CONTROL = "Shore Control";
|
||||
public final static String AUTHOR_TYPE_VIEWER = "Viewer";
|
||||
|
||||
public final static String DARK_THEME = "dark";
|
||||
public final static String LIGHT_THEME = "light";
|
||||
|
||||
private final static String INTENT_ACTION = PACKAGE_NAME + ".action";
|
||||
public final static String INTENT_ACTION_RESET = INTENT_ACTION + ".reset";
|
||||
public final static String INTENT_ACTION_CLEAR_RACES = INTENT_ACTION + ".clearRaces";
|
||||
public final static String INTENT_ACTION_CLEANUP_RACES = INTENT_ACTION + ".cleanupRaces";
|
||||
public final static String INTENT_ACTION_ALARM_ACTION = INTENT_ACTION + ".alarmAction";
|
||||
public final static String INTENT_ACTION_RELOAD_RACES = INTENT_ACTION + ".reloadRaces";
|
||||
public final static String INTENT_ACTION_START_PROCEDURE_SPECIFIC_ACTION = INTENT_ACTION + ".startProcedureSpecificAction";
|
||||
|
||||
public final static String INTENT_ACTION_POLLING_STOP = ".stopPolling";
|
||||
public final static String INTENT_ACTION_POLLING_RACE_ADD = ".addRace";
|
||||
public final static String INTENT_ACTION_POLLING_RACE_REMOVE = ".removeRace";
|
||||
public final static String INTENT_ACTION_POLLING_POLL = ".poll";
|
||||
|
||||
// Login activity
|
||||
public final static String EventIdTag = "EventId";
|
||||
|
||||
public static final int DefaultStartTimeMinuteOffset = 10;
|
||||
|
||||
// Inner process events
|
||||
public final static String INTENT_ACTION_TOGGLE = PACKAGE_NAME + ".action.toggle";
|
||||
|
||||
public final static String INTENT_ACTION_EXTRA = PACKAGE_NAME + ".extra";
|
||||
public final static String INTENT_ACTION_TOGGLE_PROCEDURE = "procedure";
|
||||
public final static String INTENT_ACTION_TOGGLE_PROCEDURE_MORE_MODE = "more_mode";
|
||||
public final static String INTENT_ACTION_TOGGLE_PROCEDURE_MORE_PATHFINDER = "more_pathfinder";
|
||||
public final static String INTENT_ACTION_TOGGLE_PROCEDURE_MORE_TIMING = "more_timing";
|
||||
public final static String INTENT_ACTION_TOGGLE_FACTOR = "factor";
|
||||
public final static String INTENT_ACTION_TOGGLE_COURSE = "course";
|
||||
public final static String INTENT_ACTION_TOGGLE_WIND = "wind";
|
||||
public final static String INTENT_ACTION_TOGGLE_TIME = "time";
|
||||
public final static String INTENT_ACTION_TOGGLE_POSTPONE = "postpone";
|
||||
public final static String INTENT_ACTION_TOGGLE_ABANDON = "abandon";
|
||||
public final static String INTENT_ACTION_TOGGLE_RECALL = "recall";
|
||||
public final static String INTENT_ACTION_TOGGLE_BLUE_FIRST = "more";
|
||||
public final static String INTENT_ACTION_TOGGLE_BLUE_LAST = "blue_last";
|
||||
|
||||
public final static String INTENT_ACTION_TOGGLE_REPLAY = "replay";
|
||||
public final static String INTENT_ACTION_TOGGLE_PHOTOS = "photos";
|
||||
public final static String INTENT_ACTION_TOGGLE_LIST = "list";
|
||||
|
||||
public final static String INTENT_ACTION_TOGGLE_EVENT = "event";
|
||||
public final static String INTENT_ACTION_TOGGLE_AREA = "area";
|
||||
public final static String INTENT_ACTION_TOGGLE_POSITION = "position";
|
||||
|
||||
private final static String INTENT_ACTION_TIME = PACKAGE_NAME + "action.time";
|
||||
public final static String INTENT_ACTION_TIME_HIDE = INTENT_ACTION_TIME + ".hide";
|
||||
public final static String INTENT_ACTION_TIME_SHOW = INTENT_ACTION_TIME + ".show";
|
||||
|
||||
public final static String INTENT_ACTION_CHECK_LOGIN = "show_empty_screen";
|
||||
public final static String INTENT_ACTION_SHOW_ONBOARDING = "show_onboarding";
|
||||
public final static String INTENT_ACTION_SHOW_LOGIN = "show_login";
|
||||
public final static String INTENT_ACTION_VALID_DATA = "valid_data";
|
||||
public final static String INTENT_ACTION_SHOW_WELCOME = "show_welcome";
|
||||
|
||||
// clears all toggle buttons
|
||||
public final static String INTENT_ACTION_CLEAR_TOGGLE = PACKAGE_NAME + ".action.toggle.clear";
|
||||
|
||||
public final static String INTENT_ACTION_UPDATE_SCREEN = PACKAGE_NAME + ".action.update.screen";
|
||||
public final static String INTENT_ACTION_SHOW_MAIN_CONTENT = PACKAGE_NAME + ".action.show.main";
|
||||
public final static String INTENT_ACTION_SHOW_SUMMARY_CONTENT = PACKAGE_NAME + ".action.show.summary";
|
||||
|
||||
/**
|
||||
* As extra this intent expects the String obtained for a FilterableRace / ManagedRace using
|
||||
* {@code new RaceGroupSeries(race.getRaceGroup(), race.getSeries()).getDisplayName()}.
|
||||
*/
|
||||
public final static String INTENT_ACTION_SHOW_PROTEST = PACKAGE_NAME + ".action.show.protest";
|
||||
public final static String INTENT_ACTION_REMOVE_PROTEST = PACKAGE_NAME + ".action.remove.protest";
|
||||
|
||||
public final static String INTENT_ACTION_IS_TRACKING = PACKAGE_NAME + "action.is.tracking";
|
||||
public final static String INTENT_ACTION_IS_TRACKING_EXTRA = PACKAGE_NAME + "action.is.tracking.extra";
|
||||
|
||||
public final static String GWT_MAP_AND_WIND_CHART_HTML = "gwt/EmbeddedMapAndWindChart.html";
|
||||
}
|
||||
+265
-265
@@ -1,265 +1,265 @@
|
||||
package com.sap.sailing.racecommittee.app.data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
import android.app.LoaderManager.LoaderCallbacks;
|
||||
import android.content.Context;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
import com.sap.sailing.domain.abstractlog.race.impl.RaceLogImpl;
|
||||
import com.sap.sailing.domain.abstractlog.race.impl.RaceLogRaceStatusEventImpl;
|
||||
import com.sap.sailing.domain.abstractlog.race.impl.RaceLogStartTimeEventImpl;
|
||||
import com.sap.sailing.domain.abstractlog.race.state.impl.RaceStateImpl;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.base.CourseArea;
|
||||
import com.sap.sailing.domain.base.CourseBase;
|
||||
import com.sap.sailing.domain.base.EventBase;
|
||||
import com.sap.sailing.domain.base.LeaderboardGroupBase;
|
||||
import com.sap.sailing.domain.base.Mark;
|
||||
import com.sap.sailing.domain.base.SharedDomainFactory;
|
||||
import com.sap.sailing.domain.base.configuration.ConfigurationLoader;
|
||||
import com.sap.sailing.domain.base.configuration.DeviceConfiguration;
|
||||
import com.sap.sailing.domain.base.configuration.DeviceConfigurationIdentifier;
|
||||
import com.sap.sailing.domain.base.configuration.RegattaConfiguration;
|
||||
import com.sap.sailing.domain.base.configuration.impl.EmptyRegattaConfiguration;
|
||||
import com.sap.sailing.domain.base.impl.BoatClassImpl;
|
||||
import com.sap.sailing.domain.base.impl.CompetitorImpl;
|
||||
import com.sap.sailing.domain.base.impl.CourseAreaImpl;
|
||||
import com.sap.sailing.domain.base.impl.FleetImpl;
|
||||
import com.sap.sailing.domain.base.impl.MarkImpl;
|
||||
import com.sap.sailing.domain.base.impl.RaceColumnFactorImpl;
|
||||
import com.sap.sailing.domain.base.impl.StrippedEventImpl;
|
||||
import com.sap.sailing.domain.base.racegroup.RaceGroup;
|
||||
import com.sap.sailing.domain.base.racegroup.SeriesWithRows;
|
||||
import com.sap.sailing.domain.base.racegroup.impl.RaceGroupImpl;
|
||||
import com.sap.sailing.domain.base.racegroup.impl.SeriesWithRowsImpl;
|
||||
import com.sap.sailing.domain.common.racelog.RaceLogRaceStatus;
|
||||
import com.sap.sailing.racecommittee.app.AppPreferences;
|
||||
import com.sap.sailing.racecommittee.app.data.clients.LoadClient;
|
||||
import com.sap.sailing.racecommittee.app.data.loaders.DataLoaderResult;
|
||||
import com.sap.sailing.racecommittee.app.data.loaders.ImmediateDataLoaderCallbacks;
|
||||
import com.sap.sailing.racecommittee.app.domain.CoursePosition;
|
||||
import com.sap.sailing.racecommittee.app.domain.ManagedRace;
|
||||
import com.sap.sailing.racecommittee.app.domain.configuration.impl.PreferencesRegattaConfigurationLoader;
|
||||
import com.sap.sailing.racecommittee.app.domain.impl.ManagedRaceIdentifierImpl;
|
||||
import com.sap.sailing.racecommittee.app.domain.impl.ManagedRaceImpl;
|
||||
import com.sap.sailing.racecommittee.app.ui.fragments.lists.PositionListFragment;
|
||||
import com.sap.sse.common.Color;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
import com.sap.sse.common.impl.MillisecondsTimePoint;
|
||||
|
||||
public class OfflineDataManager extends DataManager {
|
||||
|
||||
private static boolean isInitialized = false;
|
||||
private final Context context;
|
||||
|
||||
protected OfflineDataManager(Context context, DataStore dataStore, SharedDomainFactory domainFactory) {
|
||||
super(context, dataStore, domainFactory);
|
||||
this.context = context;
|
||||
if (!isInitialized) {
|
||||
isInitialized = true;
|
||||
fillDataStore(dataStore);
|
||||
}
|
||||
}
|
||||
|
||||
private void fillDataStore(DataStore dataStore) {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.set(2012, 12, 1);
|
||||
final TimePoint startDate = new MillisecondsTimePoint(cal.getTimeInMillis());
|
||||
cal.set(2012, 12, 5);
|
||||
final TimePoint endDate = new MillisecondsTimePoint(cal.getTimeInMillis());
|
||||
|
||||
dataStore.addEvent(new StrippedEventImpl("Extreme Sailing Series 2012 (Cardiff)", startDate, endDate, "Cardiff", true, UUID.randomUUID(), Collections.<LeaderboardGroupBase> emptySet()));
|
||||
dataStore.addEvent(new StrippedEventImpl("Extreme Sailing Series 2012 (Nice)", startDate, endDate, "Nice", true, UUID.randomUUID(), Collections.<LeaderboardGroupBase> emptySet()));
|
||||
dataStore.addEvent(new StrippedEventImpl("Extreme Sailing Series 2012 (Rio)", startDate, endDate, "Rio", true, UUID.randomUUID(), Collections.<LeaderboardGroupBase> emptySet()));
|
||||
EventBase newEvent = new StrippedEventImpl("Extreme Sailing Series 2013 (Muscat)", startDate, endDate, "Muscat", true, UUID.randomUUID(), Collections.<LeaderboardGroupBase> emptySet());
|
||||
newEvent.getVenue().addCourseArea(new CourseAreaImpl("Offshore", UUID.randomUUID()));
|
||||
newEvent.getVenue().addCourseArea(new CourseAreaImpl("Stadium", UUID.randomUUID()));
|
||||
dataStore.addEvent(newEvent);
|
||||
|
||||
SeriesWithRows qualifying = new SeriesWithRowsImpl("Qualifying", false, /* isFleetsCanRunInParallel */ true, null);
|
||||
SeriesWithRows medal = new SeriesWithRowsImpl("Medal", true, /* isFleetsCanRunInParallel */ true, null);
|
||||
RaceGroup raceGroup = new RaceGroupImpl("ESS", /* displayName */ null, new BoatClassImpl("X40", false), null, Arrays.asList(qualifying,
|
||||
medal), new EmptyRegattaConfiguration());
|
||||
|
||||
List<Competitor> competitors = new ArrayList<Competitor>();
|
||||
competitors.add(new CompetitorImpl(UUID.randomUUID(), "SAP Extreme Sailing Team", Color.BLUE, null, null, null, null, /* timeOnTimeFactor */ null, /* timeOnDistanceAllowancePerNauticalMile */ null, null));
|
||||
competitors.add(new CompetitorImpl(UUID.randomUUID(), "The Wave Muscat", Color.LIGHT_GRAY, null, null, null, null, /* timeOnTimeFactor */ null, /* timeOnDistanceAllowancePerNauticalMile */ null, null));
|
||||
competitors.add(new CompetitorImpl(UUID.randomUUID(), "Red Bull Extreme Sailing Team", Color.RED, null, null, null, null, /* timeOnTimeFactor */ null, /* timeOnDistanceAllowancePerNauticalMile */ null, null));
|
||||
competitors.add(new CompetitorImpl(UUID.randomUUID(), "Team Korea", Color.GREEN, null, null, null, null, /* timeOnTimeFactor */ null, /* timeOnDistanceAllowancePerNauticalMile */ null, null));
|
||||
competitors.add(new CompetitorImpl(UUID.randomUUID(), "Realteam", Color.BLACK, null, null, null, null, /* timeOnTimeFactor */ null, /* timeOnDistanceAllowancePerNauticalMile */ null, null));
|
||||
|
||||
RaceLog log = new RaceLogImpl(UUID.randomUUID());
|
||||
final AbstractLogEventAuthor author = AppPreferences.on(context).getAuthor();
|
||||
ConfigurationLoader<RegattaConfiguration> configuration = PreferencesRegattaConfigurationLoader
|
||||
.loadFromPreferences(preferences);
|
||||
|
||||
log.add(new RaceLogStartTimeEventImpl(new MillisecondsTimePoint(new Date().getTime() - 2000), author, 1,
|
||||
new MillisecondsTimePoint(new Date().getTime() - 1000)));
|
||||
|
||||
log.add(new RaceLogRaceStatusEventImpl(new MillisecondsTimePoint(new Date().getTime()),
|
||||
AppPreferences.on(context).getAuthor(), 1, RaceLogRaceStatus.FINISHING));
|
||||
|
||||
ManagedRace q1 = new ManagedRaceImpl(new ManagedRaceIdentifierImpl("A.B", new FleetImpl("A"), qualifying, raceGroup),
|
||||
RaceStateImpl.create(new AndroidRaceLogResolver(), log, AppPreferences.on(context).getAuthor(), configuration),
|
||||
/* zeroBasedIndexInFleet */ 0);
|
||||
|
||||
log = new RaceLogImpl(UUID.randomUUID());
|
||||
/*
|
||||
* log.add(factory.createStartTimeEvent( new MillisecondsTimePoint(new Date()), 1, RaceLogRaceStatus.SCHEDULED,
|
||||
* new MillisecondsTimePoint(new Date().getTime() + 100000)));
|
||||
*/
|
||||
|
||||
ManagedRace q2 = new ManagedRaceImpl(new ManagedRaceIdentifierImpl("B", new FleetImpl("A.A"), qualifying, raceGroup),
|
||||
RaceStateImpl.create(new AndroidRaceLogResolver(), log, AppPreferences.on(context).getAuthor(), configuration),
|
||||
/* zeroBasedIndexInFleet */ 1);
|
||||
|
||||
log = new RaceLogImpl(UUID.randomUUID());
|
||||
/*
|
||||
* log.add(factory.createRaceStatusEvent( new MillisecondsTimePoint(new Date()), 5,
|
||||
* RaceLogRaceStatus.FINISHED));
|
||||
*/
|
||||
ManagedRace q3 = new ManagedRaceImpl(new ManagedRaceIdentifierImpl("Q3", new FleetImpl("Default"), qualifying, raceGroup),
|
||||
RaceStateImpl.create(new AndroidRaceLogResolver(), log, AppPreferences.on(context).getAuthor(), configuration),
|
||||
/* zeroBasedIndexInFleet */ 2);
|
||||
/*
|
||||
* ManagedRace m1 = new ManagedRaceImpl( new ManagedRaceIdentifierImpl( "M1", new FleetImpl("Default"), medal,
|
||||
* raceGroup), null);
|
||||
*/
|
||||
dataStore.addRace(q1);
|
||||
dataStore.addRace(q2);
|
||||
dataStore.addRace(q3);
|
||||
// dataStore.addRace(m1);
|
||||
|
||||
Mark m1 = new MarkImpl("Red");
|
||||
Mark m2 = new MarkImpl("Green");
|
||||
Mark m3 = new MarkImpl("White");
|
||||
|
||||
dataStore.addMark(m1);
|
||||
dataStore.addMark(m2);
|
||||
dataStore.addMark(m3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LoaderCallbacks<DataLoaderResult<Collection<EventBase>>> createEventsLoader(
|
||||
LoadClient<Collection<EventBase>> callback) {
|
||||
return new ImmediateDataLoaderCallbacks<Collection<EventBase>>(context, callback,
|
||||
new Callable<Collection<EventBase>>() {
|
||||
@Override
|
||||
public Collection<EventBase> call() throws Exception {
|
||||
return dataStore.getEvents();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public LoaderCallbacks<DataLoaderResult<Collection<CourseArea>>> createCourseAreasLoader(
|
||||
final Serializable parentEventId, LoadClient<Collection<CourseArea>> callback) {
|
||||
return new ImmediateDataLoaderCallbacks<Collection<CourseArea>>(context, callback,
|
||||
new Callable<Collection<CourseArea>>() {
|
||||
@Override
|
||||
public Collection<CourseArea> call() throws Exception {
|
||||
return dataStore.getCourseAreas(dataStore.getEvent(parentEventId));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public LoaderCallbacks<DataLoaderResult<Collection<CourseArea>>> createCourseAreasLoader(
|
||||
final EventBase parentEvent, LoadClient<Collection<CourseArea>> callback) {
|
||||
// TODO Auto-generated method stub
|
||||
return new ImmediateDataLoaderCallbacks<Collection<CourseArea>>(context, callback,
|
||||
new Callable<Collection<CourseArea>>() {
|
||||
@Override
|
||||
public Collection<CourseArea> call() throws Exception {
|
||||
return dataStore.getCourseAreas(parentEvent);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public LoaderCallbacks<DataLoaderResult<Collection<ManagedRace>>> createRacesLoader(Serializable courseAreaId,
|
||||
LoadClient<Collection<ManagedRace>> callback) {
|
||||
return new ImmediateDataLoaderCallbacks<Collection<ManagedRace>>(context, callback,
|
||||
new Callable<Collection<ManagedRace>>() {
|
||||
@Override
|
||||
public Collection<ManagedRace> call() throws Exception {
|
||||
return dataStore.getRaces();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public LoaderCallbacks<DataLoaderResult<Collection<Mark>>> createMarksLoader(ManagedRace managedRace,
|
||||
LoadClient<Collection<Mark>> callback) {
|
||||
return new ImmediateDataLoaderCallbacks<Collection<Mark>>(context, callback, new Callable<Collection<Mark>>() {
|
||||
@Override
|
||||
public Collection<Mark> call() throws Exception {
|
||||
return dataStore.getMarks();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public LoaderCallbacks<DataLoaderResult<CourseBase>> createCourseLoader(final ManagedRace managedRace,
|
||||
LoadClient<CourseBase> callback) {
|
||||
return new ImmediateDataLoaderCallbacks<CourseBase>(context, callback, new Callable<CourseBase>() {
|
||||
@Override
|
||||
public CourseBase call() throws Exception {
|
||||
return managedRace.getCourseOnServer();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public LoaderCallbacks<DataLoaderResult<Collection<Competitor>>> createCompetitorsLoader(
|
||||
final ManagedRace managedRace, LoadClient<Collection<Competitor>> callback) {
|
||||
return new ImmediateDataLoaderCallbacks<Collection<Competitor>>(context, callback,
|
||||
new Callable<Collection<Competitor>>() {
|
||||
@Override
|
||||
public Collection<Competitor> call() throws Exception {
|
||||
return managedRace.getCompetitors();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public LoaderCallbacks<DataLoaderResult<DeviceConfiguration>> createConfigurationLoader(
|
||||
DeviceConfigurationIdentifier identifier, LoadClient<DeviceConfiguration> callback) {
|
||||
return new ImmediateDataLoaderCallbacks<DeviceConfiguration>(context, callback,
|
||||
new Callable<DeviceConfiguration>() {
|
||||
@Override
|
||||
public DeviceConfiguration call() throws Exception {
|
||||
throw new IllegalStateException("No remote configuration in offline mode.");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMapUrl(String baseUrl, ManagedRace race, String eventId, boolean showWindCharts, boolean showStreamlets, boolean showSimulation,
|
||||
boolean showMapControls) {
|
||||
throw new IllegalStateException("No wind map in offline mode.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public LoaderCallbacks<DataLoaderResult<Collection<CoursePosition>>> createPositionLoader(
|
||||
PositionListFragment positionListFragment) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LoaderCallbacks<DataLoaderResult<RaceColumnFactorImpl>> createRaceColumnFactorLoader(LoadClient<RaceColumnFactorImpl> callback) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
package com.sap.sailing.racecommittee.app.data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
import android.app.LoaderManager.LoaderCallbacks;
|
||||
import android.content.Context;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.AbstractLogEventAuthor;
|
||||
import com.sap.sailing.domain.abstractlog.race.RaceLog;
|
||||
import com.sap.sailing.domain.abstractlog.race.impl.RaceLogImpl;
|
||||
import com.sap.sailing.domain.abstractlog.race.impl.RaceLogRaceStatusEventImpl;
|
||||
import com.sap.sailing.domain.abstractlog.race.impl.RaceLogStartTimeEventImpl;
|
||||
import com.sap.sailing.domain.abstractlog.race.state.impl.RaceStateImpl;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.base.CourseArea;
|
||||
import com.sap.sailing.domain.base.CourseBase;
|
||||
import com.sap.sailing.domain.base.EventBase;
|
||||
import com.sap.sailing.domain.base.LeaderboardGroupBase;
|
||||
import com.sap.sailing.domain.base.Mark;
|
||||
import com.sap.sailing.domain.base.SharedDomainFactory;
|
||||
import com.sap.sailing.domain.base.configuration.ConfigurationLoader;
|
||||
import com.sap.sailing.domain.base.configuration.DeviceConfiguration;
|
||||
import com.sap.sailing.domain.base.configuration.DeviceConfigurationIdentifier;
|
||||
import com.sap.sailing.domain.base.configuration.RegattaConfiguration;
|
||||
import com.sap.sailing.domain.base.configuration.impl.EmptyRegattaConfiguration;
|
||||
import com.sap.sailing.domain.base.impl.BoatClassImpl;
|
||||
import com.sap.sailing.domain.base.impl.CompetitorImpl;
|
||||
import com.sap.sailing.domain.base.impl.CourseAreaImpl;
|
||||
import com.sap.sailing.domain.base.impl.FleetImpl;
|
||||
import com.sap.sailing.domain.base.impl.MarkImpl;
|
||||
import com.sap.sailing.domain.base.impl.RaceColumnFactorImpl;
|
||||
import com.sap.sailing.domain.base.impl.StrippedEventImpl;
|
||||
import com.sap.sailing.domain.base.racegroup.RaceGroup;
|
||||
import com.sap.sailing.domain.base.racegroup.SeriesWithRows;
|
||||
import com.sap.sailing.domain.base.racegroup.impl.RaceGroupImpl;
|
||||
import com.sap.sailing.domain.base.racegroup.impl.SeriesWithRowsImpl;
|
||||
import com.sap.sailing.domain.common.racelog.RaceLogRaceStatus;
|
||||
import com.sap.sailing.racecommittee.app.AppPreferences;
|
||||
import com.sap.sailing.racecommittee.app.data.clients.LoadClient;
|
||||
import com.sap.sailing.racecommittee.app.data.loaders.DataLoaderResult;
|
||||
import com.sap.sailing.racecommittee.app.data.loaders.ImmediateDataLoaderCallbacks;
|
||||
import com.sap.sailing.racecommittee.app.domain.CoursePosition;
|
||||
import com.sap.sailing.racecommittee.app.domain.ManagedRace;
|
||||
import com.sap.sailing.racecommittee.app.domain.configuration.impl.PreferencesRegattaConfigurationLoader;
|
||||
import com.sap.sailing.racecommittee.app.domain.impl.ManagedRaceIdentifierImpl;
|
||||
import com.sap.sailing.racecommittee.app.domain.impl.ManagedRaceImpl;
|
||||
import com.sap.sailing.racecommittee.app.ui.fragments.lists.PositionListFragment;
|
||||
import com.sap.sse.common.Color;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
import com.sap.sse.common.impl.MillisecondsTimePoint;
|
||||
|
||||
public class OfflineDataManager extends DataManager {
|
||||
|
||||
private static boolean isInitialized = false;
|
||||
private final Context context;
|
||||
|
||||
protected OfflineDataManager(Context context, DataStore dataStore, SharedDomainFactory domainFactory) {
|
||||
super(context, dataStore, domainFactory);
|
||||
this.context = context;
|
||||
if (!isInitialized) {
|
||||
isInitialized = true;
|
||||
fillDataStore(dataStore);
|
||||
}
|
||||
}
|
||||
|
||||
private void fillDataStore(DataStore dataStore) {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.set(2012, 12, 1);
|
||||
final TimePoint startDate = new MillisecondsTimePoint(cal.getTimeInMillis());
|
||||
cal.set(2012, 12, 5);
|
||||
final TimePoint endDate = new MillisecondsTimePoint(cal.getTimeInMillis());
|
||||
|
||||
dataStore.addEvent(new StrippedEventImpl("Extreme Sailing Series 2012 (Cardiff)", startDate, endDate, "Cardiff", true, UUID.randomUUID(), Collections.<LeaderboardGroupBase> emptySet()));
|
||||
dataStore.addEvent(new StrippedEventImpl("Extreme Sailing Series 2012 (Nice)", startDate, endDate, "Nice", true, UUID.randomUUID(), Collections.<LeaderboardGroupBase> emptySet()));
|
||||
dataStore.addEvent(new StrippedEventImpl("Extreme Sailing Series 2012 (Rio)", startDate, endDate, "Rio", true, UUID.randomUUID(), Collections.<LeaderboardGroupBase> emptySet()));
|
||||
EventBase newEvent = new StrippedEventImpl("Extreme Sailing Series 2013 (Muscat)", startDate, endDate, "Muscat", true, UUID.randomUUID(), Collections.<LeaderboardGroupBase> emptySet());
|
||||
newEvent.getVenue().addCourseArea(new CourseAreaImpl("Offshore", UUID.randomUUID()));
|
||||
newEvent.getVenue().addCourseArea(new CourseAreaImpl("Stadium", UUID.randomUUID()));
|
||||
dataStore.addEvent(newEvent);
|
||||
|
||||
SeriesWithRows qualifying = new SeriesWithRowsImpl("Qualifying", false, /* isFleetsCanRunInParallel */ true, null);
|
||||
SeriesWithRows medal = new SeriesWithRowsImpl("Medal", true, /* isFleetsCanRunInParallel */ true, null);
|
||||
RaceGroup raceGroup = new RaceGroupImpl("ESS", /* displayName */ null, new BoatClassImpl("X40", false), null, Arrays.asList(qualifying,
|
||||
medal), new EmptyRegattaConfiguration());
|
||||
|
||||
List<Competitor> competitors = new ArrayList<Competitor>();
|
||||
competitors.add(new CompetitorImpl(UUID.randomUUID(), "SAP Extreme Sailing Team", Color.BLUE, null, null, null, null, /* timeOnTimeFactor */ null, /* timeOnDistanceAllowancePerNauticalMile */ null, null));
|
||||
competitors.add(new CompetitorImpl(UUID.randomUUID(), "The Wave Muscat", Color.LIGHT_GRAY, null, null, null, null, /* timeOnTimeFactor */ null, /* timeOnDistanceAllowancePerNauticalMile */ null, null));
|
||||
competitors.add(new CompetitorImpl(UUID.randomUUID(), "Red Bull Extreme Sailing Team", Color.RED, null, null, null, null, /* timeOnTimeFactor */ null, /* timeOnDistanceAllowancePerNauticalMile */ null, null));
|
||||
competitors.add(new CompetitorImpl(UUID.randomUUID(), "Team Korea", Color.GREEN, null, null, null, null, /* timeOnTimeFactor */ null, /* timeOnDistanceAllowancePerNauticalMile */ null, null));
|
||||
competitors.add(new CompetitorImpl(UUID.randomUUID(), "Realteam", Color.BLACK, null, null, null, null, /* timeOnTimeFactor */ null, /* timeOnDistanceAllowancePerNauticalMile */ null, null));
|
||||
|
||||
RaceLog log = new RaceLogImpl(UUID.randomUUID());
|
||||
final AbstractLogEventAuthor author = AppPreferences.on(context).getAuthor();
|
||||
ConfigurationLoader<RegattaConfiguration> configuration = PreferencesRegattaConfigurationLoader
|
||||
.loadFromPreferences(preferences);
|
||||
|
||||
log.add(new RaceLogStartTimeEventImpl(new MillisecondsTimePoint(new Date().getTime() - 2000), author, 1,
|
||||
new MillisecondsTimePoint(new Date().getTime() - 1000)));
|
||||
|
||||
log.add(new RaceLogRaceStatusEventImpl(new MillisecondsTimePoint(new Date().getTime()),
|
||||
AppPreferences.on(context).getAuthor(), 1, RaceLogRaceStatus.FINISHING));
|
||||
|
||||
ManagedRace q1 = new ManagedRaceImpl(new ManagedRaceIdentifierImpl("A.B", new FleetImpl("A"), qualifying, raceGroup),
|
||||
RaceStateImpl.create(new AndroidRaceLogResolver(), log, AppPreferences.on(context).getAuthor(), configuration),
|
||||
/* zeroBasedIndexInFleet */ 0);
|
||||
|
||||
log = new RaceLogImpl(UUID.randomUUID());
|
||||
/*
|
||||
* log.add(factory.createStartTimeEvent( new MillisecondsTimePoint(new Date()), 1, RaceLogRaceStatus.SCHEDULED,
|
||||
* new MillisecondsTimePoint(new Date().getTime() + 100000)));
|
||||
*/
|
||||
|
||||
ManagedRace q2 = new ManagedRaceImpl(new ManagedRaceIdentifierImpl("B", new FleetImpl("A.A"), qualifying, raceGroup),
|
||||
RaceStateImpl.create(new AndroidRaceLogResolver(), log, AppPreferences.on(context).getAuthor(), configuration),
|
||||
/* zeroBasedIndexInFleet */ 1);
|
||||
|
||||
log = new RaceLogImpl(UUID.randomUUID());
|
||||
/*
|
||||
* log.add(factory.createRaceStatusEvent( new MillisecondsTimePoint(new Date()), 5,
|
||||
* RaceLogRaceStatus.FINISHED));
|
||||
*/
|
||||
ManagedRace q3 = new ManagedRaceImpl(new ManagedRaceIdentifierImpl("Q3", new FleetImpl("Default"), qualifying, raceGroup),
|
||||
RaceStateImpl.create(new AndroidRaceLogResolver(), log, AppPreferences.on(context).getAuthor(), configuration),
|
||||
/* zeroBasedIndexInFleet */ 2);
|
||||
/*
|
||||
* ManagedRace m1 = new ManagedRaceImpl( new ManagedRaceIdentifierImpl( "M1", new FleetImpl("Default"), medal,
|
||||
* raceGroup), null);
|
||||
*/
|
||||
dataStore.addRace(q1);
|
||||
dataStore.addRace(q2);
|
||||
dataStore.addRace(q3);
|
||||
// dataStore.addRace(m1);
|
||||
|
||||
Mark m1 = new MarkImpl("Red");
|
||||
Mark m2 = new MarkImpl("Green");
|
||||
Mark m3 = new MarkImpl("White");
|
||||
|
||||
dataStore.addMark(m1);
|
||||
dataStore.addMark(m2);
|
||||
dataStore.addMark(m3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LoaderCallbacks<DataLoaderResult<Collection<EventBase>>> createEventsLoader(
|
||||
LoadClient<Collection<EventBase>> callback) {
|
||||
return new ImmediateDataLoaderCallbacks<Collection<EventBase>>(context, callback,
|
||||
new Callable<Collection<EventBase>>() {
|
||||
@Override
|
||||
public Collection<EventBase> call() throws Exception {
|
||||
return dataStore.getEvents();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public LoaderCallbacks<DataLoaderResult<Collection<CourseArea>>> createCourseAreasLoader(
|
||||
final Serializable parentEventId, LoadClient<Collection<CourseArea>> callback) {
|
||||
return new ImmediateDataLoaderCallbacks<Collection<CourseArea>>(context, callback,
|
||||
new Callable<Collection<CourseArea>>() {
|
||||
@Override
|
||||
public Collection<CourseArea> call() throws Exception {
|
||||
return dataStore.getCourseAreas(dataStore.getEvent(parentEventId));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public LoaderCallbacks<DataLoaderResult<Collection<CourseArea>>> createCourseAreasLoader(
|
||||
final EventBase parentEvent, LoadClient<Collection<CourseArea>> callback) {
|
||||
// TODO Auto-generated method stub
|
||||
return new ImmediateDataLoaderCallbacks<Collection<CourseArea>>(context, callback,
|
||||
new Callable<Collection<CourseArea>>() {
|
||||
@Override
|
||||
public Collection<CourseArea> call() throws Exception {
|
||||
return dataStore.getCourseAreas(parentEvent);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public LoaderCallbacks<DataLoaderResult<Collection<ManagedRace>>> createRacesLoader(Serializable courseAreaId,
|
||||
LoadClient<Collection<ManagedRace>> callback) {
|
||||
return new ImmediateDataLoaderCallbacks<Collection<ManagedRace>>(context, callback,
|
||||
new Callable<Collection<ManagedRace>>() {
|
||||
@Override
|
||||
public Collection<ManagedRace> call() throws Exception {
|
||||
return dataStore.getRaces();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public LoaderCallbacks<DataLoaderResult<Collection<Mark>>> createMarksLoader(ManagedRace managedRace,
|
||||
LoadClient<Collection<Mark>> callback) {
|
||||
return new ImmediateDataLoaderCallbacks<Collection<Mark>>(context, callback, new Callable<Collection<Mark>>() {
|
||||
@Override
|
||||
public Collection<Mark> call() throws Exception {
|
||||
return dataStore.getMarks();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public LoaderCallbacks<DataLoaderResult<CourseBase>> createCourseLoader(final ManagedRace managedRace,
|
||||
LoadClient<CourseBase> callback) {
|
||||
return new ImmediateDataLoaderCallbacks<CourseBase>(context, callback, new Callable<CourseBase>() {
|
||||
@Override
|
||||
public CourseBase call() throws Exception {
|
||||
return managedRace.getCourseOnServer();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public LoaderCallbacks<DataLoaderResult<Collection<Competitor>>> createCompetitorsLoader(
|
||||
final ManagedRace managedRace, LoadClient<Collection<Competitor>> callback) {
|
||||
return new ImmediateDataLoaderCallbacks<Collection<Competitor>>(context, callback,
|
||||
new Callable<Collection<Competitor>>() {
|
||||
@Override
|
||||
public Collection<Competitor> call() throws Exception {
|
||||
return managedRace.getCompetitors();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public LoaderCallbacks<DataLoaderResult<DeviceConfiguration>> createConfigurationLoader(
|
||||
DeviceConfigurationIdentifier identifier, LoadClient<DeviceConfiguration> callback) {
|
||||
return new ImmediateDataLoaderCallbacks<DeviceConfiguration>(context, callback,
|
||||
new Callable<DeviceConfiguration>() {
|
||||
@Override
|
||||
public DeviceConfiguration call() throws Exception {
|
||||
throw new IllegalStateException("No remote configuration in offline mode.");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMapUrl(String baseUrl, ManagedRace race, String eventId, boolean showWindCharts, boolean showStreamlets, boolean showSimulation,
|
||||
boolean showMapControls) {
|
||||
throw new IllegalStateException("No wind map in offline mode.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public LoaderCallbacks<DataLoaderResult<Collection<CoursePosition>>> createPositionLoader(
|
||||
PositionListFragment positionListFragment) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LoaderCallbacks<DataLoaderResult<RaceColumnFactorImpl>> createRaceColumnFactorLoader(LoadClient<RaceColumnFactorImpl> callback) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+162
-162
@@ -1,162 +1,162 @@
|
||||
package com.sap.sailing.racecommittee.app.data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.base.CourseArea;
|
||||
import com.sap.sailing.domain.base.CourseBase;
|
||||
import com.sap.sailing.domain.base.EventBase;
|
||||
import com.sap.sailing.domain.base.Mark;
|
||||
import com.sap.sailing.domain.base.configuration.DeviceConfiguration;
|
||||
import com.sap.sailing.domain.base.configuration.DeviceConfigurationIdentifier;
|
||||
import com.sap.sailing.domain.base.impl.RaceColumnFactorImpl;
|
||||
import com.sap.sailing.racecommittee.app.data.clients.LoadClient;
|
||||
import com.sap.sailing.racecommittee.app.data.loaders.DataLoaderResult;
|
||||
import com.sap.sailing.racecommittee.app.domain.CoursePosition;
|
||||
import com.sap.sailing.racecommittee.app.domain.ManagedRace;
|
||||
import com.sap.sailing.racecommittee.app.ui.fragments.lists.PositionListFragment;
|
||||
|
||||
import android.app.LoaderManager;
|
||||
import android.app.LoaderManager.LoaderCallbacks;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Interface for everything read related when working with data.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* The result values of this interface's methods are meant to be used in conjunction with the Android's
|
||||
* {@link LoaderManager} facility. Everything that is loaded by this interface is stored and cached in the underlying
|
||||
* {@link DataStore}.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* If there are cached results your {@link LoadClient}'s callback methods might be called twice (first cached results;
|
||||
* afterwards remote results). See {@link LoadClient} for restrictions that apply to your data handling code.
|
||||
* </p>
|
||||
*/
|
||||
public interface ReadonlyDataManager {
|
||||
|
||||
/**
|
||||
* Gets the underlying data store.
|
||||
*
|
||||
* @return the {@link DataStore}.
|
||||
*/
|
||||
DataStore getDataStore();
|
||||
|
||||
/**
|
||||
* Creates a new {@link LoaderCallbacks} object for loading {@link EventBase}s.
|
||||
*
|
||||
* @param callback
|
||||
* {@link LoadClient} implementing your data handling code.
|
||||
* @return {@link LoaderCallbacks} to be used in
|
||||
* {@link LoaderManager#initLoader(int, android.os.Bundle, LoaderCallbacks)} or
|
||||
* {@link LoaderManager#restartLoader(int, android.os.Bundle, LoaderCallbacks)}.
|
||||
*/
|
||||
LoaderCallbacks<DataLoaderResult<Collection<EventBase>>> createEventsLoader(LoadClient<Collection<EventBase>> callback);
|
||||
|
||||
/**
|
||||
* Creates a new {@link LoaderCallbacks} object for loading {@link CourseArea}s.
|
||||
*
|
||||
* @param callback
|
||||
* {@link LoadClient} implementing your data handling code.
|
||||
* @return {@link LoaderCallbacks} to be used in
|
||||
* {@link LoaderManager#initLoader(int, android.os.Bundle, LoaderCallbacks)} or
|
||||
* {@link LoaderManager#restartLoader(int, android.os.Bundle, LoaderCallbacks)}.
|
||||
*/
|
||||
LoaderCallbacks<DataLoaderResult<Collection<CourseArea>>> createCourseAreasLoader(Serializable parentEventId,
|
||||
LoadClient<Collection<CourseArea>> callback);
|
||||
|
||||
LoaderCallbacks<DataLoaderResult<Collection<CourseArea>>> createCourseAreasLoader(EventBase parentEvent,
|
||||
LoadClient<Collection<CourseArea>> callback);
|
||||
|
||||
/**
|
||||
* Creates a new {@link LoaderCallbacks} object for loading racing referee positions.
|
||||
*
|
||||
* @return {@link LoaderCallbacks} to be used in
|
||||
* {@link LoaderManager#initLoader(int, android.os.Bundle, LoaderCallbacks)} or
|
||||
* {@link LoaderManager#restartLoader(int, android.os.Bundle, LoaderCallbacks)}.
|
||||
*/
|
||||
LoaderCallbacks<DataLoaderResult<Collection<CoursePosition>>> createPositionLoader(PositionListFragment positionListFragment);
|
||||
|
||||
/**
|
||||
* Creates a new {@link LoaderCallbacks} object for loading {@link ManagedRace}s of a specific {@link CourseArea}.
|
||||
*
|
||||
* @param courseAreaId
|
||||
* the {@link CourseArea}'s Identifier.
|
||||
* @param callback
|
||||
* {@link LoadClient} implementing your data handling code.
|
||||
* @return {@link LoaderCallbacks} to be used in
|
||||
* {@link LoaderManager#initLoader(int, android.os.Bundle, LoaderCallbacks)} or
|
||||
* {@link LoaderManager#restartLoader(int, android.os.Bundle, LoaderCallbacks)}.
|
||||
*/
|
||||
LoaderCallbacks<DataLoaderResult<Collection<ManagedRace>>> createRacesLoader(Serializable courseAreaId,
|
||||
LoadClient<Collection<ManagedRace>> callback);
|
||||
|
||||
/**
|
||||
* Creates a new {@link LoaderCallbacks} object for loading a race's {@link Mark}s.
|
||||
*
|
||||
* @param managedRace
|
||||
* the {@link ManagedRace}.
|
||||
* @param callback
|
||||
* {@link LoadClient} implementing your data handling code.
|
||||
* @return {@link LoaderCallbacks} to be used in
|
||||
* {@link LoaderManager#initLoader(int, android.os.Bundle, LoaderCallbacks)} or
|
||||
* {@link LoaderManager#restartLoader(int, android.os.Bundle, LoaderCallbacks)}.
|
||||
*/
|
||||
LoaderCallbacks<DataLoaderResult<Collection<Mark>>> createMarksLoader(ManagedRace managedRace, LoadClient<Collection<Mark>> callback);
|
||||
|
||||
/**
|
||||
* Creates a new {@link LoaderCallbacks} object for loading a race's {@link CourseBase}.
|
||||
*
|
||||
* @param managedRace
|
||||
* the {@link ManagedRace}.
|
||||
* @param callback
|
||||
* {@link LoadClient} implementing your data handling code.
|
||||
* @return {@link LoaderCallbacks} to be used in
|
||||
* {@link LoaderManager#initLoader(int, android.os.Bundle, LoaderCallbacks)} or
|
||||
* {@link LoaderManager#restartLoader(int, android.os.Bundle, LoaderCallbacks)}.
|
||||
*/
|
||||
LoaderCallbacks<DataLoaderResult<CourseBase>> createCourseLoader(ManagedRace managedRace, LoadClient<CourseBase> callback);
|
||||
|
||||
/**
|
||||
* Creates a new {@link LoaderCallbacks} object for loading {@link Competitor}s.
|
||||
*
|
||||
* @param callback
|
||||
* {@link LoadClient} implementing your data handling code.
|
||||
* @return {@link LoaderCallbacks} to be used in
|
||||
* {@link LoaderManager#initLoader(int, android.os.Bundle, LoaderCallbacks)} or
|
||||
* {@link LoaderManager#restartLoader(int, android.os.Bundle, LoaderCallbacks)}.
|
||||
*/
|
||||
LoaderCallbacks<DataLoaderResult<Collection<Competitor>>> createCompetitorsLoader(ManagedRace managedRace,
|
||||
LoadClient<Collection<Competitor>> callback);
|
||||
|
||||
/**
|
||||
* Creates a new {@link LoaderCallbacks} object for loading a client's configuration.
|
||||
*
|
||||
* @param callback
|
||||
* {@link LoadClient} implementing your data handling code.
|
||||
* @return {@link LoaderCallbacks} to be used in
|
||||
* {@link LoaderManager#initLoader(int, android.os.Bundle, LoaderCallbacks)} or
|
||||
* {@link LoaderManager#restartLoader(int, android.os.Bundle, LoaderCallbacks)}.
|
||||
*/
|
||||
LoaderCallbacks<DataLoaderResult<DeviceConfiguration>> createConfigurationLoader(DeviceConfigurationIdentifier identifier,
|
||||
LoadClient<DeviceConfiguration> callback);
|
||||
|
||||
String getMapUrl(String baseUrl, ManagedRace race, String eventId, boolean showWindCharts, boolean showStreamlets, boolean showSimulation,
|
||||
boolean showMapControls);
|
||||
|
||||
/**
|
||||
* Create a new {@link LoaderCallbacks} object for loading the race columns (e.g. factors)
|
||||
*
|
||||
* @param leaderboard
|
||||
* @param race_column
|
||||
* @param callback
|
||||
*
|
||||
* @return {@link LoaderCallbacks} to be used in
|
||||
* {@link LoaderManager#initLoader(int, android.os.Bundle, LoaderCallbacks)} or
|
||||
* {@link LoaderManager#restartLoader(int, android.os.Bundle, LoaderCallbacks)}.
|
||||
*/
|
||||
LoaderCallbacks<DataLoaderResult<RaceColumnFactorImpl>> createRaceColumnFactorLoader(LoadClient<RaceColumnFactorImpl> callback);
|
||||
}
|
||||
package com.sap.sailing.racecommittee.app.data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.base.CourseArea;
|
||||
import com.sap.sailing.domain.base.CourseBase;
|
||||
import com.sap.sailing.domain.base.EventBase;
|
||||
import com.sap.sailing.domain.base.Mark;
|
||||
import com.sap.sailing.domain.base.configuration.DeviceConfiguration;
|
||||
import com.sap.sailing.domain.base.configuration.DeviceConfigurationIdentifier;
|
||||
import com.sap.sailing.domain.base.impl.RaceColumnFactorImpl;
|
||||
import com.sap.sailing.racecommittee.app.data.clients.LoadClient;
|
||||
import com.sap.sailing.racecommittee.app.data.loaders.DataLoaderResult;
|
||||
import com.sap.sailing.racecommittee.app.domain.CoursePosition;
|
||||
import com.sap.sailing.racecommittee.app.domain.ManagedRace;
|
||||
import com.sap.sailing.racecommittee.app.ui.fragments.lists.PositionListFragment;
|
||||
|
||||
import android.app.LoaderManager;
|
||||
import android.app.LoaderManager.LoaderCallbacks;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Interface for everything read related when working with data.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* The result values of this interface's methods are meant to be used in conjunction with the Android's
|
||||
* {@link LoaderManager} facility. Everything that is loaded by this interface is stored and cached in the underlying
|
||||
* {@link DataStore}.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* If there are cached results your {@link LoadClient}'s callback methods might be called twice (first cached results;
|
||||
* afterwards remote results). See {@link LoadClient} for restrictions that apply to your data handling code.
|
||||
* </p>
|
||||
*/
|
||||
public interface ReadonlyDataManager {
|
||||
|
||||
/**
|
||||
* Gets the underlying data store.
|
||||
*
|
||||
* @return the {@link DataStore}.
|
||||
*/
|
||||
DataStore getDataStore();
|
||||
|
||||
/**
|
||||
* Creates a new {@link LoaderCallbacks} object for loading {@link EventBase}s.
|
||||
*
|
||||
* @param callback
|
||||
* {@link LoadClient} implementing your data handling code.
|
||||
* @return {@link LoaderCallbacks} to be used in
|
||||
* {@link LoaderManager#initLoader(int, android.os.Bundle, LoaderCallbacks)} or
|
||||
* {@link LoaderManager#restartLoader(int, android.os.Bundle, LoaderCallbacks)}.
|
||||
*/
|
||||
LoaderCallbacks<DataLoaderResult<Collection<EventBase>>> createEventsLoader(LoadClient<Collection<EventBase>> callback);
|
||||
|
||||
/**
|
||||
* Creates a new {@link LoaderCallbacks} object for loading {@link CourseArea}s.
|
||||
*
|
||||
* @param callback
|
||||
* {@link LoadClient} implementing your data handling code.
|
||||
* @return {@link LoaderCallbacks} to be used in
|
||||
* {@link LoaderManager#initLoader(int, android.os.Bundle, LoaderCallbacks)} or
|
||||
* {@link LoaderManager#restartLoader(int, android.os.Bundle, LoaderCallbacks)}.
|
||||
*/
|
||||
LoaderCallbacks<DataLoaderResult<Collection<CourseArea>>> createCourseAreasLoader(Serializable parentEventId,
|
||||
LoadClient<Collection<CourseArea>> callback);
|
||||
|
||||
LoaderCallbacks<DataLoaderResult<Collection<CourseArea>>> createCourseAreasLoader(EventBase parentEvent,
|
||||
LoadClient<Collection<CourseArea>> callback);
|
||||
|
||||
/**
|
||||
* Creates a new {@link LoaderCallbacks} object for loading racing referee positions.
|
||||
*
|
||||
* @return {@link LoaderCallbacks} to be used in
|
||||
* {@link LoaderManager#initLoader(int, android.os.Bundle, LoaderCallbacks)} or
|
||||
* {@link LoaderManager#restartLoader(int, android.os.Bundle, LoaderCallbacks)}.
|
||||
*/
|
||||
LoaderCallbacks<DataLoaderResult<Collection<CoursePosition>>> createPositionLoader(PositionListFragment positionListFragment);
|
||||
|
||||
/**
|
||||
* Creates a new {@link LoaderCallbacks} object for loading {@link ManagedRace}s of a specific {@link CourseArea}.
|
||||
*
|
||||
* @param courseAreaId
|
||||
* the {@link CourseArea}'s Identifier.
|
||||
* @param callback
|
||||
* {@link LoadClient} implementing your data handling code.
|
||||
* @return {@link LoaderCallbacks} to be used in
|
||||
* {@link LoaderManager#initLoader(int, android.os.Bundle, LoaderCallbacks)} or
|
||||
* {@link LoaderManager#restartLoader(int, android.os.Bundle, LoaderCallbacks)}.
|
||||
*/
|
||||
LoaderCallbacks<DataLoaderResult<Collection<ManagedRace>>> createRacesLoader(Serializable courseAreaId,
|
||||
LoadClient<Collection<ManagedRace>> callback);
|
||||
|
||||
/**
|
||||
* Creates a new {@link LoaderCallbacks} object for loading a race's {@link Mark}s.
|
||||
*
|
||||
* @param managedRace
|
||||
* the {@link ManagedRace}.
|
||||
* @param callback
|
||||
* {@link LoadClient} implementing your data handling code.
|
||||
* @return {@link LoaderCallbacks} to be used in
|
||||
* {@link LoaderManager#initLoader(int, android.os.Bundle, LoaderCallbacks)} or
|
||||
* {@link LoaderManager#restartLoader(int, android.os.Bundle, LoaderCallbacks)}.
|
||||
*/
|
||||
LoaderCallbacks<DataLoaderResult<Collection<Mark>>> createMarksLoader(ManagedRace managedRace, LoadClient<Collection<Mark>> callback);
|
||||
|
||||
/**
|
||||
* Creates a new {@link LoaderCallbacks} object for loading a race's {@link CourseBase}.
|
||||
*
|
||||
* @param managedRace
|
||||
* the {@link ManagedRace}.
|
||||
* @param callback
|
||||
* {@link LoadClient} implementing your data handling code.
|
||||
* @return {@link LoaderCallbacks} to be used in
|
||||
* {@link LoaderManager#initLoader(int, android.os.Bundle, LoaderCallbacks)} or
|
||||
* {@link LoaderManager#restartLoader(int, android.os.Bundle, LoaderCallbacks)}.
|
||||
*/
|
||||
LoaderCallbacks<DataLoaderResult<CourseBase>> createCourseLoader(ManagedRace managedRace, LoadClient<CourseBase> callback);
|
||||
|
||||
/**
|
||||
* Creates a new {@link LoaderCallbacks} object for loading {@link Competitor}s.
|
||||
*
|
||||
* @param callback
|
||||
* {@link LoadClient} implementing your data handling code.
|
||||
* @return {@link LoaderCallbacks} to be used in
|
||||
* {@link LoaderManager#initLoader(int, android.os.Bundle, LoaderCallbacks)} or
|
||||
* {@link LoaderManager#restartLoader(int, android.os.Bundle, LoaderCallbacks)}.
|
||||
*/
|
||||
LoaderCallbacks<DataLoaderResult<Collection<Competitor>>> createCompetitorsLoader(ManagedRace managedRace,
|
||||
LoadClient<Collection<Competitor>> callback);
|
||||
|
||||
/**
|
||||
* Creates a new {@link LoaderCallbacks} object for loading a client's configuration.
|
||||
*
|
||||
* @param callback
|
||||
* {@link LoadClient} implementing your data handling code.
|
||||
* @return {@link LoaderCallbacks} to be used in
|
||||
* {@link LoaderManager#initLoader(int, android.os.Bundle, LoaderCallbacks)} or
|
||||
* {@link LoaderManager#restartLoader(int, android.os.Bundle, LoaderCallbacks)}.
|
||||
*/
|
||||
LoaderCallbacks<DataLoaderResult<DeviceConfiguration>> createConfigurationLoader(DeviceConfigurationIdentifier identifier,
|
||||
LoadClient<DeviceConfiguration> callback);
|
||||
|
||||
String getMapUrl(String baseUrl, ManagedRace race, String eventId, boolean showWindCharts, boolean showStreamlets, boolean showSimulation,
|
||||
boolean showMapControls);
|
||||
|
||||
/**
|
||||
* Create a new {@link LoaderCallbacks} object for loading the race columns (e.g. factors)
|
||||
*
|
||||
* @param leaderboard
|
||||
* @param race_column
|
||||
* @param callback
|
||||
*
|
||||
* @return {@link LoaderCallbacks} to be used in
|
||||
* {@link LoaderManager#initLoader(int, android.os.Bundle, LoaderCallbacks)} or
|
||||
* {@link LoaderManager#restartLoader(int, android.os.Bundle, LoaderCallbacks)}.
|
||||
*/
|
||||
LoaderCallbacks<DataLoaderResult<RaceColumnFactorImpl>> createRaceColumnFactorLoader(LoadClient<RaceColumnFactorImpl> callback);
|
||||
}
|
||||
Reference in new issue
Block a user