mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-10-09 20:53:07 +02:00
Style and warning fixes.
This commit is contained in:
@@ -463,6 +463,7 @@ public class ChartActivity extends Activity implements TrackDataListener {
|
|||||||
return true; // Reload data
|
return true; // Reload data
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("hiding")
|
||||||
@Override
|
@Override
|
||||||
public boolean onReportSpeedChanged(boolean reportSpeed) {
|
public boolean onReportSpeedChanged(boolean reportSpeed) {
|
||||||
boolean changed = reportSpeed != this.reportSpeed;
|
boolean changed = reportSpeed != this.reportSpeed;
|
||||||
|
|||||||
@@ -56,8 +56,8 @@ public class DeleteAllTracks extends Handler {
|
|||||||
builder.setIcon(android.R.drawable.ic_dialog_alert);
|
builder.setIcon(android.R.drawable.ic_dialog_alert);
|
||||||
builder.setPositiveButton(context.getString(R.string.yes),
|
builder.setPositiveButton(context.getString(R.string.yes),
|
||||||
new DialogInterface.OnClickListener() {
|
new DialogInterface.OnClickListener() {
|
||||||
public void onClick(DialogInterface dialog, int i) {
|
public void onClick(DialogInterface dialogInterface, int i) {
|
||||||
dialog.dismiss();
|
dialogInterface.dismiss();
|
||||||
Log.w(Constants.TAG, "deleting all!");
|
Log.w(Constants.TAG, "deleting all!");
|
||||||
MyTracksProviderUtils.Factory.get(context).deleteAllTracks();
|
MyTracksProviderUtils.Factory.get(context).deleteAllTracks();
|
||||||
SharedPreferences prefs =
|
SharedPreferences prefs =
|
||||||
@@ -74,8 +74,8 @@ public class DeleteAllTracks extends Handler {
|
|||||||
});
|
});
|
||||||
builder.setNegativeButton(context.getString(R.string.no),
|
builder.setNegativeButton(context.getString(R.string.no),
|
||||||
new DialogInterface.OnClickListener() {
|
new DialogInterface.OnClickListener() {
|
||||||
public void onClick(DialogInterface dialog, int i) {
|
public void onClick(DialogInterface dialogInterface, int i) {
|
||||||
dialog.dismiss();
|
dialogInterface.dismiss();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
dialog = builder.create();
|
dialog = builder.create();
|
||||||
|
|||||||
@@ -386,8 +386,8 @@ public class MyTracks extends TabActivity implements OnTouchListener {
|
|||||||
builder.setIcon(android.R.drawable.ic_dialog_alert);
|
builder.setIcon(android.R.drawable.ic_dialog_alert);
|
||||||
builder.setPositiveButton(getString(R.string.yes),
|
builder.setPositiveButton(getString(R.string.yes),
|
||||||
new DialogInterface.OnClickListener() {
|
new DialogInterface.OnClickListener() {
|
||||||
public void onClick(DialogInterface dialog, int i) {
|
public void onClick(DialogInterface dialogInterface, int i) {
|
||||||
dialog.dismiss();
|
dialogInterface.dismiss();
|
||||||
providerUtils.deleteTrack(trackId);
|
providerUtils.deleteTrack(trackId);
|
||||||
if (trackId == dataHub.getSelectedTrackId()) {
|
if (trackId == dataHub.getSelectedTrackId()) {
|
||||||
dataHub.unloadCurrentTrack();
|
dataHub.unloadCurrentTrack();
|
||||||
@@ -395,8 +395,8 @@ public class MyTracks extends TabActivity implements OnTouchListener {
|
|||||||
}});
|
}});
|
||||||
builder.setNegativeButton(getString(R.string.no),
|
builder.setNegativeButton(getString(R.string.no),
|
||||||
new DialogInterface.OnClickListener() {
|
new DialogInterface.OnClickListener() {
|
||||||
public void onClick(DialogInterface dialog, int i) {
|
public void onClick(DialogInterface dialogInterface, int i) {
|
||||||
dialog.dismiss();
|
dialogInterface.dismiss();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
dialog = builder.create();
|
dialog = builder.create();
|
||||||
|
|||||||
@@ -340,7 +340,7 @@ public class SettingsActivity extends PreferenceActivity {
|
|||||||
.setPositiveButton(android.R.string.ok,
|
.setPositiveButton(android.R.string.ok,
|
||||||
new OnClickListener() {
|
new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int button) {
|
public void onClick(DialogInterface dialogInterface, int button) {
|
||||||
onResetPreferencesConfirmed();
|
onResetPreferencesConfirmed();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public class WaypointsList extends ListActivity
|
|||||||
|
|
||||||
private int contextPosition = -1;
|
private int contextPosition = -1;
|
||||||
private long trackId = -1;
|
private long trackId = -1;
|
||||||
private long waypointId = -1;
|
private long selectedWaypointId = -1;
|
||||||
private ListView listView = null;
|
private ListView listView = null;
|
||||||
private Button insertWaypointButton = null;
|
private Button insertWaypointButton = null;
|
||||||
private Button insertStatisticsButton = null;
|
private Button insertStatisticsButton = null;
|
||||||
@@ -77,7 +77,7 @@ public class WaypointsList extends ListActivity
|
|||||||
AdapterView.AdapterContextMenuInfo info =
|
AdapterView.AdapterContextMenuInfo info =
|
||||||
(AdapterView.AdapterContextMenuInfo) menuInfo;
|
(AdapterView.AdapterContextMenuInfo) menuInfo;
|
||||||
contextPosition = info.position;
|
contextPosition = info.position;
|
||||||
waypointId = WaypointsList.this.listView.getAdapter()
|
selectedWaypointId = WaypointsList.this.listView.getAdapter()
|
||||||
.getItemId(contextPosition);
|
.getItemId(contextPosition);
|
||||||
Waypoint waypoint = providerUtils.getWaypoint(info.id);
|
Waypoint waypoint = providerUtils.getWaypoint(info.id);
|
||||||
if (waypoint != null) {
|
if (waypoint != null) {
|
||||||
@@ -108,18 +108,18 @@ public class WaypointsList extends ListActivity
|
|||||||
if (!super.onMenuItemSelected(featureId, item)) {
|
if (!super.onMenuItemSelected(featureId, item)) {
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
case Constants.MENU_SHOW: {
|
case Constants.MENU_SHOW: {
|
||||||
onListItemClick(null, null, 0, waypointId);
|
onListItemClick(null, null, 0, selectedWaypointId);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case Constants.MENU_EDIT: {
|
case Constants.MENU_EDIT: {
|
||||||
Intent intent = new Intent(this, WaypointDetails.class);
|
Intent intent = new Intent(this, WaypointDetails.class);
|
||||||
intent.putExtra("trackid", trackId);
|
intent.putExtra("trackid", trackId);
|
||||||
intent.putExtra(WaypointDetails.WAYPOINT_ID_EXTRA, waypointId);
|
intent.putExtra(WaypointDetails.WAYPOINT_ID_EXTRA, selectedWaypointId);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case Constants.MENU_DELETE: {
|
case Constants.MENU_DELETE: {
|
||||||
deleteWaypoint(waypointId);
|
deleteWaypoint(selectedWaypointId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -297,8 +297,8 @@ public class WaypointsList extends ListActivity
|
|||||||
builder.setPositiveButton(getString(R.string.yes),
|
builder.setPositiveButton(getString(R.string.yes),
|
||||||
new DialogInterface.OnClickListener() {
|
new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int i) {
|
public void onClick(DialogInterface dialogInterface, int i) {
|
||||||
dialog.dismiss();
|
dialogInterface.dismiss();
|
||||||
providerUtils.deleteWaypoint(waypointId,
|
providerUtils.deleteWaypoint(waypointId,
|
||||||
new StringUtils(WaypointsList.this));
|
new StringUtils(WaypointsList.this));
|
||||||
}
|
}
|
||||||
@@ -306,8 +306,8 @@ public class WaypointsList extends ListActivity
|
|||||||
builder.setNegativeButton(getString(R.string.no),
|
builder.setNegativeButton(getString(R.string.no),
|
||||||
new DialogInterface.OnClickListener() {
|
new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int i) {
|
public void onClick(DialogInterface dialogInterface, int i) {
|
||||||
dialog.dismiss();
|
dialogInterface.dismiss();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
dialog = builder.create();
|
dialog = builder.create();
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ public class TrackDataHub {
|
|||||||
private Handler listenerHandler;
|
private Handler listenerHandler;
|
||||||
|
|
||||||
/** Manager for external listeners (those from activities). */
|
/** Manager for external listeners (those from activities). */
|
||||||
private final TrackDataListeners listeners;
|
private final TrackDataListeners dataListeners;
|
||||||
|
|
||||||
/** Wrapper for interacting with system data managers. */
|
/** Wrapper for interacting with system data managers. */
|
||||||
private DataSourcesWrapper dataSources;
|
private DataSourcesWrapper dataSources;
|
||||||
@@ -213,7 +213,7 @@ public class TrackDataHub {
|
|||||||
TrackDataHub(Context ctx, TrackDataListeners listeners, SharedPreferences preferences,
|
TrackDataHub(Context ctx, TrackDataListeners listeners, SharedPreferences preferences,
|
||||||
MyTracksProviderUtils providerUtils, int targetNumPoints) {
|
MyTracksProviderUtils providerUtils, int targetNumPoints) {
|
||||||
this.context = ctx;
|
this.context = ctx;
|
||||||
this.listeners = listeners;
|
this.dataListeners = listeners;
|
||||||
this.preferences = preferences;
|
this.preferences = preferences;
|
||||||
this.providerUtils = providerUtils;
|
this.providerUtils = providerUtils;
|
||||||
this.targetNumPoints = targetNumPoints;
|
this.targetNumPoints = targetNumPoints;
|
||||||
@@ -437,8 +437,9 @@ public class TrackDataHub {
|
|||||||
|
|
||||||
public void registerTrackDataListener(
|
public void registerTrackDataListener(
|
||||||
TrackDataListener listener, EnumSet<ListenerDataType> dataTypes) {
|
TrackDataListener listener, EnumSet<ListenerDataType> dataTypes) {
|
||||||
synchronized (listeners) {
|
synchronized (dataListeners) {
|
||||||
ListenerRegistration registration = listeners.registerTrackDataListener(listener, dataTypes);
|
ListenerRegistration registration =
|
||||||
|
dataListeners.registerTrackDataListener(listener, dataTypes);
|
||||||
|
|
||||||
// Don't load any data or start internal listeners if start() hasn't been
|
// Don't load any data or start internal listeners if start() hasn't been
|
||||||
// called. When it is called, we'll do both things.
|
// called. When it is called, we'll do both things.
|
||||||
@@ -451,8 +452,8 @@ public class TrackDataHub {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void unregisterTrackDataListener(TrackDataListener listener) {
|
public void unregisterTrackDataListener(TrackDataListener listener) {
|
||||||
synchronized (listeners) {
|
synchronized (dataListeners) {
|
||||||
listeners.unregisterTrackDataListener(listener);
|
dataListeners.unregisterTrackDataListener(listener);
|
||||||
|
|
||||||
// Don't load any data or start internal listeners if start() hasn't been
|
// Don't load any data or start internal listeners if start() hasn't been
|
||||||
// called. When it is called, we'll do both things.
|
// called. When it is called, we'll do both things.
|
||||||
@@ -467,8 +468,8 @@ public class TrackDataHub {
|
|||||||
*/
|
*/
|
||||||
public void reloadDataForListener(TrackDataListener listener) {
|
public void reloadDataForListener(TrackDataListener listener) {
|
||||||
ListenerRegistration registration;
|
ListenerRegistration registration;
|
||||||
synchronized (listeners) {
|
synchronized (dataListeners) {
|
||||||
registration = listeners.getRegistration(listener);
|
registration = dataListeners.getRegistration(listener);
|
||||||
registration.resetState();
|
registration.resetState();
|
||||||
loadNewDataForListener(registration);
|
loadNewDataForListener(registration);
|
||||||
}
|
}
|
||||||
@@ -477,7 +478,7 @@ public class TrackDataHub {
|
|||||||
/**
|
/**
|
||||||
* Reloads all track data received so far into the specified listeners.
|
* Reloads all track data received so far into the specified listeners.
|
||||||
*
|
*
|
||||||
* Assumes it's called from a block that synchronizes on {@link #listeners}.
|
* Assumes it's called from a block that synchronizes on {@link #dataListeners}.
|
||||||
*/
|
*/
|
||||||
private void loadNewDataForListener(final ListenerRegistration registration) {
|
private void loadNewDataForListener(final ListenerRegistration registration) {
|
||||||
if (!isStarted()) {
|
if (!isStarted()) {
|
||||||
@@ -492,7 +493,7 @@ public class TrackDataHub {
|
|||||||
// If a listener happens to be added after this method but before the Runnable below is
|
// If a listener happens to be added after this method but before the Runnable below is
|
||||||
// executed, it will have triggered a separate call to load data only up to the point this
|
// executed, it will have triggered a separate call to load data only up to the point this
|
||||||
// listener got to. This is ensured by being synchronized on listeners.
|
// listener got to. This is ensured by being synchronized on listeners.
|
||||||
final boolean isOnlyListener = (listeners.getNumListeners() == 1);
|
final boolean isOnlyListener = (dataListeners.getNumListeners() == 1);
|
||||||
|
|
||||||
runInListenerThread(new Runnable() {
|
runInListenerThread(new Runnable() {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@@ -577,8 +578,8 @@ public class TrackDataHub {
|
|||||||
Log.w(TAG, "Not started, not reloading");
|
Log.w(TAG, "Not started, not reloading");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
synchronized (listeners) {
|
synchronized (dataListeners) {
|
||||||
if (!listeners.hasListeners()) {
|
if (!dataListeners.hasListeners()) {
|
||||||
Log.d(TAG, "No listeners, not reloading");
|
Log.d(TAG, "No listeners, not reloading");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -651,7 +652,7 @@ public class TrackDataHub {
|
|||||||
for (TrackDataListener listener : displayListeners) {
|
for (TrackDataListener listener : displayListeners) {
|
||||||
// TODO: Do the reloading just once for all interested listeners
|
// TODO: Do the reloading just once for all interested listeners
|
||||||
if (listener.onReportSpeedChanged(reportSpeed)) {
|
if (listener.onReportSpeedChanged(reportSpeed)) {
|
||||||
synchronized (listeners) {
|
synchronized (dataListeners) {
|
||||||
reloadDataForListener(listener);
|
reloadDataForListener(listener);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -671,7 +672,7 @@ public class TrackDataHub {
|
|||||||
|
|
||||||
for (TrackDataListener listener : displayListeners) {
|
for (TrackDataListener listener : displayListeners) {
|
||||||
if (listener.onUnitsChanged(useMetricUnits)) {
|
if (listener.onUnitsChanged(useMetricUnits)) {
|
||||||
synchronized (listeners) {
|
synchronized (dataListeners) {
|
||||||
reloadDataForListener(listener);
|
reloadDataForListener(listener);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -739,7 +740,7 @@ public class TrackDataHub {
|
|||||||
if (isGpsLocation) {
|
if (isGpsLocation) {
|
||||||
// We consider a good fix to be a recent one with reasonable accuracy.
|
// We consider a good fix to be a recent one with reasonable accuracy.
|
||||||
hasFix = !isLocationOld(location, now, MAX_LOCATION_AGE_MS);
|
hasFix = !isLocationOld(location, now, MAX_LOCATION_AGE_MS);
|
||||||
hasGoodFix = (location != null && location.getAccuracy() <= minRequiredAccuracy);
|
hasGoodFix = (location.getAccuracy() <= minRequiredAccuracy);
|
||||||
} else {
|
} else {
|
||||||
if (!isLocationOld(lastSeenLocation, now, MAX_LOCATION_AGE_MS)) {
|
if (!isLocationOld(lastSeenLocation, now, MAX_LOCATION_AGE_MS)) {
|
||||||
// This is a network location, but we have a recent/valid GPS location, just ignore this.
|
// This is a network location, but we have a recent/valid GPS location, just ignore this.
|
||||||
@@ -961,7 +962,7 @@ public class TrackDataHub {
|
|||||||
|
|
||||||
Log.i(TAG, "Resampling point set after " + numLoadedPoints + " points.");
|
Log.i(TAG, "Resampling point set after " + numLoadedPoints + " points.");
|
||||||
resetState();
|
resetState();
|
||||||
synchronized (listeners) {
|
synchronized (dataListeners) {
|
||||||
sampledListeners = getListenersFor(ListenerDataType.POINT_UPDATES);
|
sampledListeners = getListenersFor(ListenerDataType.POINT_UPDATES);
|
||||||
sampledOutListeners = getListenersFor(ListenerDataType.SAMPLED_OUT_POINT_UPDATES);
|
sampledOutListeners = getListenersFor(ListenerDataType.SAMPLED_OUT_POINT_UPDATES);
|
||||||
}
|
}
|
||||||
@@ -1046,7 +1047,7 @@ public class TrackDataHub {
|
|||||||
listener.onNewTrackPointsDone();
|
listener.onNewTrackPointsDone();
|
||||||
|
|
||||||
// Update the listener state
|
// Update the listener state
|
||||||
ListenerRegistration registration = listeners.getRegistration(listener);
|
ListenerRegistration registration = dataListeners.getRegistration(listener);
|
||||||
if (registration != null) {
|
if (registration != null) {
|
||||||
registration.lastTrackId = currentSelectedTrackId;
|
registration.lastTrackId = currentSelectedTrackId;
|
||||||
registration.lastPointId = localLastSeenLocationId;
|
registration.lastPointId = localLastSeenLocationId;
|
||||||
@@ -1059,7 +1060,7 @@ public class TrackDataHub {
|
|||||||
private void notifyNewPoint(Location location,
|
private void notifyNewPoint(Location location,
|
||||||
long locationId,
|
long locationId,
|
||||||
long lastStoredLocationId,
|
long lastStoredLocationId,
|
||||||
int numLoadedPoints,
|
int loadedPoints,
|
||||||
int pointSamplingFrequency,
|
int pointSamplingFrequency,
|
||||||
Set<TrackDataListener> sampledListeners,
|
Set<TrackDataListener> sampledListeners,
|
||||||
Set<TrackDataListener> sampledOutListeners) {
|
Set<TrackDataListener> sampledOutListeners) {
|
||||||
@@ -1078,7 +1079,7 @@ public class TrackDataHub {
|
|||||||
// - Is the last point and we are not recording this track.
|
// - Is the last point and we are not recording this track.
|
||||||
boolean recordingSelected = isRecordingSelected();
|
boolean recordingSelected = isRecordingSelected();
|
||||||
boolean includeInSample =
|
boolean includeInSample =
|
||||||
(numLoadedPoints % pointSamplingFrequency == 0 ||
|
(loadedPoints % pointSamplingFrequency == 0 ||
|
||||||
(!recordingSelected && locationId == lastStoredLocationId));
|
(!recordingSelected && locationId == lastStoredLocationId));
|
||||||
|
|
||||||
if (!includeInSample) {
|
if (!includeInSample) {
|
||||||
@@ -1106,13 +1107,13 @@ public class TrackDataHub {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Set<TrackDataListener> getListenersFor(ListenerDataType type) {
|
private Set<TrackDataListener> getListenersFor(ListenerDataType type) {
|
||||||
synchronized (listeners) {
|
synchronized (dataListeners) {
|
||||||
return listeners.getListenersFor(type);
|
return dataListeners.getListenersFor(type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private EnumSet<ListenerDataType> getNeededListenerTypes() {
|
private EnumSet<ListenerDataType> getNeededListenerTypes() {
|
||||||
EnumSet<ListenerDataType> neededTypes = listeners.getAllRegisteredTypes();
|
EnumSet<ListenerDataType> neededTypes = dataListeners.getAllRegisteredTypes();
|
||||||
|
|
||||||
// We always want preference updates.
|
// We always want preference updates.
|
||||||
neededTypes.add(ListenerDataType.DISPLAY_PREFERENCES);
|
neededTypes.add(ListenerDataType.DISPLAY_PREFERENCES);
|
||||||
|
|||||||
@@ -196,7 +196,7 @@ public class SendToFusionTables implements Runnable {
|
|||||||
// Create a new table:
|
// Create a new table:
|
||||||
progressIndicator.setProgressValue(PROGRESS_FUSION_TABLE_CREATE);
|
progressIndicator.setProgressValue(PROGRESS_FUSION_TABLE_CREATE);
|
||||||
progressIndicator.setProgressMessage(R.string.progress_message_creating_fusiontable);
|
progressIndicator.setProgressMessage(R.string.progress_message_creating_fusiontable);
|
||||||
if (!createNewTable(track) || !makeTableUnlisted(tableId)) {
|
if (!createNewTable(track) || !makeTableUnlisted()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -245,7 +245,7 @@ public class SendToFusionTables implements Runnable {
|
|||||||
return runUpdate(query);
|
return runUpdate(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean makeTableUnlisted(String tableId) {
|
private boolean makeTableUnlisted() {
|
||||||
Log.d(Constants.TAG, "Setting visibility to unlisted.");
|
Log.d(Constants.TAG, "Setting visibility to unlisted.");
|
||||||
String query = "UPDATE TABLE " + tableId + " SET VISIBILITY = UNLISTED";
|
String query = "UPDATE TABLE " + tableId + " SET VISIBILITY = UNLISTED";
|
||||||
return runUpdate(query);
|
return runUpdate(query);
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ public class BackupActivityHelper {
|
|||||||
*/
|
*/
|
||||||
private void restoreFromDateAsync(final Date date) {
|
private void restoreFromDateAsync(final Date date) {
|
||||||
// Show a progress dialog
|
// Show a progress dialog
|
||||||
final ProgressDialog progressDialog = ProgressDialog.show(
|
ProgressDialog.show(
|
||||||
activity,
|
activity,
|
||||||
activity.getString(R.string.progress_title),
|
activity.getString(R.string.progress_title),
|
||||||
activity.getString(R.string.backup_import_progress_message),
|
activity.getString(R.string.backup_import_progress_message),
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ class DatabaseDumper {
|
|||||||
public void writeHeaders(Cursor cursor, int numRows, DataOutputStream writer)
|
public void writeHeaders(Cursor cursor, int numRows, DataOutputStream writer)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
initializeCachedValues(cursor);
|
initializeCachedValues(cursor);
|
||||||
writeQueryMetadata(cursor, numRows, writer);
|
writeQueryMetadata(numRows, writer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -151,7 +151,7 @@ class DatabaseDumper {
|
|||||||
* @throws IOException if there are any errors while writing
|
* @throws IOException if there are any errors while writing
|
||||||
*/
|
*/
|
||||||
private void writeQueryMetadata(
|
private void writeQueryMetadata(
|
||||||
Cursor cursor, int numRows, DataOutputStream writer) throws IOException {
|
int numRows, DataOutputStream writer) throws IOException {
|
||||||
// Write column data
|
// Write column data
|
||||||
writer.writeInt(columnNames.length);
|
writer.writeInt(columnNames.length);
|
||||||
for (int i = 0; i < columnNames.length; i++) {
|
for (int i = 0; i < columnNames.length; i++) {
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ public class DocsHelper {
|
|||||||
final GDataWrapper<GDataServiceClient> docListWrapper, final String name) throws IOException {
|
final GDataWrapper<GDataServiceClient> docListWrapper, final String name) throws IOException {
|
||||||
final AtomicReference<String> idSaver = new AtomicReference<String>();
|
final AtomicReference<String> idSaver = new AtomicReference<String>();
|
||||||
|
|
||||||
boolean result = docListWrapper.runQuery(new QueryFunction<GDataServiceClient>() {
|
boolean success = docListWrapper.runQuery(new QueryFunction<GDataServiceClient>() {
|
||||||
@Override
|
@Override
|
||||||
public void query(GDataServiceClient client) throws IOException,
|
public void query(GDataServiceClient client) throws IOException,
|
||||||
GDataWrapper.AuthenticationException {
|
GDataWrapper.AuthenticationException {
|
||||||
@@ -148,7 +148,7 @@ public class DocsHelper {
|
|||||||
idSaver.set(id);
|
idSaver.set(id);
|
||||||
}});
|
}});
|
||||||
|
|
||||||
if (!result) {
|
if (!success) {
|
||||||
throw newIOException(docListWrapper,
|
throw newIOException(docListWrapper,
|
||||||
"Failed to create new spreadsheet.");
|
"Failed to create new spreadsheet.");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public class CsvTrackWriter implements TrackFormatWriter {
|
|||||||
new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
|
new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
|
||||||
|
|
||||||
static {
|
static {
|
||||||
SHORT_FORMAT.setMaximumFractionDigits(4);
|
SHORT_FORMAT.setMaximumFractionDigits(4);
|
||||||
TIMESTAMP_FORMAT.setTimeZone(TimeZone.getTimeZone("UTC"));
|
TIMESTAMP_FORMAT.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,6 +65,7 @@ public class CsvTrackWriter implements TrackFormatWriter {
|
|||||||
return TrackFileFormat.CSV.getExtension();
|
return TrackFileFormat.CSV.getExtension();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("hiding")
|
||||||
@Override
|
@Override
|
||||||
public void prepare(Track track, OutputStream out) {
|
public void prepare(Track track, OutputStream out) {
|
||||||
this.track = track;
|
this.track = track;
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ public class GpxTrackWriter implements TrackFormatWriter {
|
|||||||
+ "\" lon=\"" + coordinateFormatter.format(l.getLongitude()) + "\"";
|
+ "\" lon=\"" + coordinateFormatter.format(l.getLongitude()) + "\"";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("hiding")
|
||||||
@Override
|
@Override
|
||||||
public void prepare(Track track, OutputStream out) {
|
public void prepare(Track track, OutputStream out) {
|
||||||
this.track = track;
|
this.track = track;
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ public class KmlTrackWriter implements TrackFormatWriter {
|
|||||||
this.stringUtils = stringUtils;
|
this.stringUtils = stringUtils;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("hiding")
|
||||||
@Override
|
@Override
|
||||||
public void prepare(Track track, OutputStream out) {
|
public void prepare(Track track, OutputStream out) {
|
||||||
this.track = track;
|
this.track = track;
|
||||||
|
|||||||
@@ -157,6 +157,7 @@ public class SaveActivity extends Activity {
|
|||||||
if (controller != null) {
|
if (controller != null) {
|
||||||
return controller.createProgressDialog();
|
return controller.createProgressDialog();
|
||||||
}
|
}
|
||||||
|
//$FALL-THROUGH$
|
||||||
default:
|
default:
|
||||||
return super.onCreateDialog(id);
|
return super.onCreateDialog(id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ public class TcxTrackWriter implements TrackFormatWriter {
|
|||||||
timestampFormatter.setTimeZone(TimeZone.getTimeZone("UTC"));
|
timestampFormatter.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("hiding")
|
||||||
@Override
|
@Override
|
||||||
public void prepare(Track track, OutputStream out) {
|
public void prepare(Track track, OutputStream out) {
|
||||||
this.track = track;
|
this.track = track;
|
||||||
|
|||||||
@@ -280,9 +280,7 @@ class TrackWriterImpl implements TrackWriter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
if (cursor != null) {
|
cursor.close();
|
||||||
cursor.close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ class WriteProgressController {
|
|||||||
private final DialogInterface.OnCancelListener dialogCancelListener =
|
private final DialogInterface.OnCancelListener dialogCancelListener =
|
||||||
new DialogInterface.OnCancelListener() {
|
new DialogInterface.OnCancelListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onCancel(DialogInterface dialog) {
|
public void onCancel(DialogInterface dialogInterface) {
|
||||||
writer.stopWriteTrack();
|
writer.stopWriteTrack();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ public class PreferenceManager implements OnSharedPreferenceChangeListener {
|
|||||||
* @param key the key that changed (may be null to update all preferences)
|
* @param key the key that changed (may be null to update all preferences)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
|
public void onSharedPreferenceChanged(SharedPreferences preferences,
|
||||||
String key) {
|
String key) {
|
||||||
if (service == null) {
|
if (service == null) {
|
||||||
Log.w(Constants.TAG,
|
Log.w(Constants.TAG,
|
||||||
|
|||||||
@@ -361,7 +361,7 @@ public class TrackRecordingService extends Service {
|
|||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setAutoResumeTrackRetries(SharedPreferences sharedPreferences, int retryAttempts) {
|
private void setAutoResumeTrackRetries(int retryAttempts) {
|
||||||
Log.d(TAG, "Updating auto-resume retry attempts to: " + retryAttempts);
|
Log.d(TAG, "Updating auto-resume retry attempts to: " + retryAttempts);
|
||||||
prefManager.setAutoResumeTrackCurrentRetry(retryAttempts);
|
prefManager.setAutoResumeTrackCurrentRetry(retryAttempts);
|
||||||
}
|
}
|
||||||
@@ -386,7 +386,7 @@ public class TrackRecordingService extends Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Increase number of retry attempts.
|
// Increase number of retry attempts.
|
||||||
setAutoResumeTrackRetries(sharedPreferences, retries + 1);
|
setAutoResumeTrackRetries(retries + 1);
|
||||||
|
|
||||||
// Check for special cases.
|
// Check for special cases.
|
||||||
if (autoResumeTrackTimeout == 0) {
|
if (autoResumeTrackTimeout == 0) {
|
||||||
@@ -579,8 +579,7 @@ public class TrackRecordingService extends Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Reset the number of auto-resume retries.
|
// Reset the number of auto-resume retries.
|
||||||
setAutoResumeTrackRetries(
|
setAutoResumeTrackRetries(0);
|
||||||
getSharedPreferences(Constants.SETTINGS_NAME, 0), 0);
|
|
||||||
// Persist the current recording track.
|
// Persist the current recording track.
|
||||||
prefManager.setRecordingTrack(recordingTrackId);
|
prefManager.setRecordingTrack(recordingTrackId);
|
||||||
|
|
||||||
@@ -695,8 +694,6 @@ public class TrackRecordingService extends Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Location lastRecordedLocation = providerUtils.getLastLocation();
|
Location lastRecordedLocation = providerUtils.getLastLocation();
|
||||||
long lastRecordedLocationId =
|
|
||||||
providerUtils.getLastLocationId(recordingTrackId);
|
|
||||||
double distanceToLastRecorded = Double.POSITIVE_INFINITY;
|
double distanceToLastRecorded = Double.POSITIVE_INFINITY;
|
||||||
if (lastRecordedLocation != null) {
|
if (lastRecordedLocation != null) {
|
||||||
distanceToLastRecorded = location.distanceTo(lastRecordedLocation);
|
distanceToLastRecorded = location.distanceTo(lastRecordedLocation);
|
||||||
@@ -722,9 +719,7 @@ public class TrackRecordingService extends Service {
|
|||||||
// Need to write the last location. This will happen when
|
// Need to write the last location. This will happen when
|
||||||
// lastRecordedLocation.distance(lastLocation) <
|
// lastRecordedLocation.distance(lastLocation) <
|
||||||
// minRecordingDistance
|
// minRecordingDistance
|
||||||
if (!insertLocation(recordingTrack, lastLocation,
|
if (!insertLocation(lastLocation, lastRecordedLocation, recordingTrackId)) {
|
||||||
lastRecordedLocation, lastRecordedLocationId,
|
|
||||||
recordingTrackId)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -737,11 +732,9 @@ public class TrackRecordingService extends Service {
|
|||||||
if (lastLocation != null && !isMoving) {
|
if (lastLocation != null && !isMoving) {
|
||||||
// Last location was the last stationary location. Need to go back and
|
// Last location was the last stationary location. Need to go back and
|
||||||
// add it.
|
// add it.
|
||||||
if (!insertLocation(recordingTrack, lastLocation,
|
if (!insertLocation(lastLocation, lastRecordedLocation, recordingTrackId)) {
|
||||||
lastRecordedLocation, lastRecordedLocationId, recordingTrackId)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
lastRecordedLocationId++;
|
|
||||||
isMoving = true;
|
isMoving = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -762,8 +755,7 @@ public class TrackRecordingService extends Service {
|
|||||||
providerUtils.insertTrackPoint(separator, recordingTrackId);
|
providerUtils.insertTrackPoint(separator, recordingTrackId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!insertLocation(recordingTrack, location, lastRecordedLocation,
|
if (!insertLocation(location, lastRecordedLocation, recordingTrackId)) {
|
||||||
lastRecordedLocationId, recordingTrackId)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -790,18 +782,13 @@ public class TrackRecordingService extends Service {
|
|||||||
* Inserts a new location in the track points db and updates the corresponding
|
* Inserts a new location in the track points db and updates the corresponding
|
||||||
* track in the track db.
|
* track in the track db.
|
||||||
*
|
*
|
||||||
* @param recordingTrack the track that is currently being recorded
|
|
||||||
* @param location the location to be inserted
|
* @param location the location to be inserted
|
||||||
* @param lastRecordedLocation the last recorded location before this one (or
|
* @param lastRecordedLocation the last recorded location before this one (or
|
||||||
* null if none)
|
* null if none)
|
||||||
* @param lastRecordedLocationId the id of the last recorded location (or -1
|
|
||||||
* if none)
|
|
||||||
* @param trackId the id of the track
|
* @param trackId the id of the track
|
||||||
* @return true if successful. False if SQLite3 threw an exception.
|
* @return true if successful. False if SQLite3 threw an exception.
|
||||||
*/
|
*/
|
||||||
private boolean insertLocation(Track recordingTrack, Location location,
|
private boolean insertLocation(Location location, Location lastRecordedLocation, long trackId) {
|
||||||
Location lastRecordedLocation, long lastRecordedLocationId,
|
|
||||||
long trackId) {
|
|
||||||
|
|
||||||
// Keep track of length along recorded track (needed when a waypoint is
|
// Keep track of length along recorded track (needed when a waypoint is
|
||||||
// inserted):
|
// inserted):
|
||||||
@@ -1003,22 +990,22 @@ public class TrackRecordingService extends Service {
|
|||||||
announcementExecutor.shutdown();
|
announcementExecutor.shutdown();
|
||||||
splitExecutor.shutdown();
|
splitExecutor.shutdown();
|
||||||
isRecording = false;
|
isRecording = false;
|
||||||
Track recordingTrack = providerUtils.getTrack(recordingTrackId);
|
Track recordedTrack = providerUtils.getTrack(recordingTrackId);
|
||||||
if (recordingTrack != null) {
|
if (recordedTrack != null) {
|
||||||
TripStatistics stats = recordingTrack.getStatistics();
|
TripStatistics stats = recordedTrack.getStatistics();
|
||||||
stats.setStopTime(System.currentTimeMillis());
|
stats.setStopTime(System.currentTimeMillis());
|
||||||
stats.setTotalTime(stats.getStopTime() - stats.getStartTime());
|
stats.setTotalTime(stats.getStopTime() - stats.getStartTime());
|
||||||
long lastRecordedLocationId =
|
long lastRecordedLocationId =
|
||||||
providerUtils.getLastLocationId(recordingTrackId);
|
providerUtils.getLastLocationId(recordingTrackId);
|
||||||
ContentValues values = new ContentValues();
|
ContentValues values = new ContentValues();
|
||||||
if (lastRecordedLocationId >= 0
|
if (lastRecordedLocationId >= 0
|
||||||
&& recordingTrack.getStopId() >= 0) {
|
&& recordedTrack.getStopId() >= 0) {
|
||||||
values.put(TracksColumns.STOPID, lastRecordedLocationId);
|
values.put(TracksColumns.STOPID, lastRecordedLocationId);
|
||||||
}
|
}
|
||||||
values.put(TracksColumns.STOPTIME, stats.getStopTime());
|
values.put(TracksColumns.STOPTIME, stats.getStopTime());
|
||||||
values.put(TracksColumns.TOTALTIME, stats.getTotalTime());
|
values.put(TracksColumns.TOTALTIME, stats.getTotalTime());
|
||||||
getContentResolver().update(TracksColumns.CONTENT_URI, values,
|
getContentResolver().update(TracksColumns.CONTENT_URI, values,
|
||||||
"_id=" + recordingTrack.getId(), null);
|
"_id=" + recordedTrack.getId(), null);
|
||||||
}
|
}
|
||||||
showNotification();
|
showNotification();
|
||||||
long recordedTrackId = recordingTrackId;
|
long recordedTrackId = recordingTrackId;
|
||||||
|
|||||||
+2
-2
@@ -82,7 +82,7 @@ public abstract class AntSensorManager extends SensorManager {
|
|||||||
/** Receives and logs all status ANT intents. */
|
/** Receives and logs all status ANT intents. */
|
||||||
private final BroadcastReceiver statusReceiver = new BroadcastReceiver() {
|
private final BroadcastReceiver statusReceiver = new BroadcastReceiver() {
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context ctx, Intent intent) {
|
||||||
String antAction = intent.getAction();
|
String antAction = intent.getAction();
|
||||||
Log.i(TAG, "enter status onReceive" + antAction);
|
Log.i(TAG, "enter status onReceive" + antAction);
|
||||||
}
|
}
|
||||||
@@ -91,7 +91,7 @@ public abstract class AntSensorManager extends SensorManager {
|
|||||||
/** Receives all data ANT intents. */
|
/** Receives all data ANT intents. */
|
||||||
private final BroadcastReceiver dataReceiver = new BroadcastReceiver() {
|
private final BroadcastReceiver dataReceiver = new BroadcastReceiver() {
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context ctx, Intent intent) {
|
||||||
String antAction = intent.getAction();
|
String antAction = intent.getAction();
|
||||||
Log.i(TAG, "enter data onReceive" + antAction);
|
Log.i(TAG, "enter data onReceive" + antAction);
|
||||||
|
|
||||||
|
|||||||
+6
-4
@@ -130,10 +130,12 @@ public class StatusAnnouncerTask implements PeriodicTask {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
checkReady();
|
synchronized (this) {
|
||||||
if (!ready) {
|
checkReady();
|
||||||
Log.e(TAG, "StatusAnnouncer Tts not ready.");
|
if (!ready) {
|
||||||
return;
|
Log.e(TAG, "StatusAnnouncer Tts not ready.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!speechAllowed) {
|
if (!speechAllowed) {
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ public class ApiFeatures {
|
|||||||
/**
|
/**
|
||||||
* Injects a specific singleton instance, to be used for unit tests.
|
* Injects a specific singleton instance, to be used for unit tests.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("hiding")
|
||||||
public static void injectInstance(ApiFeatures instance) {
|
public static void injectInstance(ApiFeatures instance) {
|
||||||
ApiFeatures.instance = instance;
|
ApiFeatures.instance = instance;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -197,7 +197,7 @@ public class LocationUtils {
|
|||||||
result.add(piece);
|
result.add(piece);
|
||||||
}
|
}
|
||||||
n += (pieceLocations.size() - 1);
|
n += (pieceLocations.size() - 1);
|
||||||
} while (n < nTotal && piece != null && piece.getLocations().size() > 1);
|
} while (n < nTotal && piece.getLocations().size() > 1);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,20 +48,19 @@ public class XmlDocsGDataParserFactory implements GDataParserFactory {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings("rawtypes")
|
||||||
@Override
|
@Override
|
||||||
public GDataParser createParser(Class cls, InputStream is)
|
public GDataParser createParser(Class cls, InputStream is)
|
||||||
throws ParseException {
|
throws ParseException {
|
||||||
try {
|
try {
|
||||||
return createParserForClass(cls, is);
|
return createParserForClass(is);
|
||||||
} catch (XmlPullParserException e) {
|
} catch (XmlPullParserException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private GDataParser createParserForClass(
|
private GDataParser createParserForClass(InputStream is)
|
||||||
Class<? extends Entry> cls, InputStream is)
|
|
||||||
throws ParseException, XmlPullParserException {
|
throws ParseException, XmlPullParserException {
|
||||||
return new XmlGDataParser(is, xmlFactory.createParser());
|
return new XmlGDataParser(is, xmlFactory.createParser());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -180,48 +180,42 @@ public class GpxImporterTest extends AndroidTestCase {
|
|||||||
/**
|
/**
|
||||||
* Test with invalid location - track should be deleted.
|
* Test with invalid location - track should be deleted.
|
||||||
*/
|
*/
|
||||||
public void testImportLocationFailure() throws ParserConfigurationException,
|
public void testImportLocationFailure() throws ParserConfigurationException, IOException {
|
||||||
SAXException, IOException {
|
|
||||||
testInvalidXML(INVALID_LOCATION_TEST_GPX);
|
testInvalidXML(INVALID_LOCATION_TEST_GPX);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test with invalid time - track should be deleted.
|
* Test with invalid time - track should be deleted.
|
||||||
*/
|
*/
|
||||||
public void testImportTimeFailure() throws ParserConfigurationException,
|
public void testImportTimeFailure() throws ParserConfigurationException, IOException {
|
||||||
SAXException, IOException {
|
|
||||||
testInvalidXML(INVALID_TIME_TEST_GPX);
|
testInvalidXML(INVALID_TIME_TEST_GPX);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test with invalid xml - track should be deleted.
|
* Test with invalid xml - track should be deleted.
|
||||||
*/
|
*/
|
||||||
public void testImportXMLFailure() throws ParserConfigurationException,
|
public void testImportXMLFailure() throws ParserConfigurationException, IOException {
|
||||||
SAXException, IOException {
|
|
||||||
testInvalidXML(INVALID_XML_TEST_GPX);
|
testInvalidXML(INVALID_XML_TEST_GPX);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test with invalid altitude - track should be deleted.
|
* Test with invalid altitude - track should be deleted.
|
||||||
*/
|
*/
|
||||||
public void testImportInvalidAltitude() throws ParserConfigurationException,
|
public void testImportInvalidAltitude() throws ParserConfigurationException, IOException {
|
||||||
SAXException, IOException {
|
|
||||||
testInvalidXML(INVALID_ALTITUDE_TEST_GPX);
|
testInvalidXML(INVALID_ALTITUDE_TEST_GPX);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test with invalid latitude - track should be deleted.
|
* Test with invalid latitude - track should be deleted.
|
||||||
*/
|
*/
|
||||||
public void testImportInvalidLatitude() throws ParserConfigurationException,
|
public void testImportInvalidLatitude() throws ParserConfigurationException, IOException {
|
||||||
SAXException, IOException {
|
|
||||||
testInvalidXML(INVALID_LATITUDE_TEST_GPX);
|
testInvalidXML(INVALID_LATITUDE_TEST_GPX);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test with invalid longitude - track should be deleted.
|
* Test with invalid longitude - track should be deleted.
|
||||||
*/
|
*/
|
||||||
public void testImportInvalidLongitude() throws ParserConfigurationException,
|
public void testImportInvalidLongitude() throws ParserConfigurationException, IOException {
|
||||||
SAXException, IOException {
|
|
||||||
testInvalidXML(INVALID_LONGITUDE_TEST_GPX);
|
testInvalidXML(INVALID_LONGITUDE_TEST_GPX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,9 +31,9 @@ public class KmlTrackWriterTest extends TrackFormatWriterTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String generateTrackDescription(Track track,
|
public String generateTrackDescription(Track trackToDescribe,
|
||||||
Vector<Double> distances, Vector<Double> elevations) {
|
Vector<Double> distances, Vector<Double> elevations) {
|
||||||
assertSame(KmlTrackWriterTest.super.track, track);
|
assertSame(KmlTrackWriterTest.super.track, trackToDescribe);
|
||||||
assertTrue(distances.isEmpty());
|
assertTrue(distances.isEmpty());
|
||||||
assertTrue(elevations.isEmpty());
|
assertTrue(elevations.isEmpty());
|
||||||
return FULL_TRACK_DESCRIPTION;
|
return FULL_TRACK_DESCRIPTION;
|
||||||
|
|||||||
+1
@@ -59,6 +59,7 @@ public class ResultListAdapterTest extends AndroidTestCase {
|
|||||||
this.urlId = urlId;
|
this.urlId = urlId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("hiding")
|
||||||
private void saveContentView(View contentView) {
|
private void saveContentView(View contentView) {
|
||||||
if (this.contentView == null) {
|
if (this.contentView == null) {
|
||||||
this.contentView = contentView;
|
this.contentView = contentView;
|
||||||
|
|||||||
+1
-1
@@ -331,7 +331,7 @@ public class TrackRecordingServiceTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context ctx, Intent intent) {
|
||||||
Log.d("MyTracksTest", "Got broadcast: " + intent);
|
Log.d("MyTracksTest", "Got broadcast: " + intent);
|
||||||
synchronized (receivedIntents) {
|
synchronized (receivedIntents) {
|
||||||
receivedIntents.add(intent);
|
receivedIntents.add(intent);
|
||||||
|
|||||||
+1
@@ -38,6 +38,7 @@ public class AntSensorManagerTest extends AndroidTestCase {
|
|||||||
super.handleMessage(rawMessage);
|
super.handleMessage(rawMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("hiding")
|
||||||
@Override
|
@Override
|
||||||
public boolean handleMessage(byte messageId, byte[] messageData) {
|
public boolean handleMessage(byte messageId, byte[] messageData) {
|
||||||
this.messageId = messageId;
|
this.messageId = messageId;
|
||||||
|
|||||||
+1
@@ -60,6 +60,7 @@ public class SignalStrengthListenerCupcake extends PhoneStateListener
|
|||||||
return PhoneStateListener.LISTEN_SIGNAL_STRENGTH;
|
return PhoneStateListener.LISTEN_SIGNAL_STRENGTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("hiding")
|
||||||
@Override
|
@Override
|
||||||
public void onSignalStrengthChanged(int signalStrength) {
|
public void onSignalStrengthChanged(int signalStrength) {
|
||||||
Log.d(TAG, "Signal Strength: " + signalStrength);
|
Log.d(TAG, "Signal Strength: " + signalStrength);
|
||||||
|
|||||||
+1
@@ -44,6 +44,7 @@ public class SignalStrengthListenerEclair extends SignalStrengthListenerCupcake
|
|||||||
return PhoneStateListener.LISTEN_SIGNAL_STRENGTHS;
|
return PhoneStateListener.LISTEN_SIGNAL_STRENGTHS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("hiding")
|
||||||
@Override
|
@Override
|
||||||
public void onSignalStrengthsChanged(SignalStrength signalStrength) {
|
public void onSignalStrengthsChanged(SignalStrength signalStrength) {
|
||||||
Log.d(TAG, "Signal Strength Modern: " + signalStrength);
|
Log.d(TAG, "Signal Strength Modern: " + signalStrength);
|
||||||
|
|||||||
+3
-3
@@ -69,16 +69,16 @@ public class SignalStrengthService extends Service
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStart(Intent intent, int startId) {
|
public void onStart(Intent intent, int startId) {
|
||||||
handleCommand(intent, startId);
|
handleCommand(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||||
handleCommand(intent, startId);
|
handleCommand(intent);
|
||||||
return START_STICKY;
|
return START_STICKY;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleCommand(Intent intent, int startId) {
|
private void handleCommand(Intent intent) {
|
||||||
String action = intent.getAction();
|
String action = intent.getAction();
|
||||||
if (START_SAMPLING.equals(action)) {
|
if (START_SAMPLING.equals(action)) {
|
||||||
startSampling();
|
startSampling();
|
||||||
|
|||||||
Reference in New Issue
Block a user